[Rt-commit] rt branch, development, updated. 63f40caee208ba39c7f11fdd3def88c2b5f4f68b

Thomas Sibley trs at bestpractical.com
Tue Jun 22 14:34:10 EDT 2010


The branch, development has been updated
       via  63f40caee208ba39c7f11fdd3def88c2b5f4f68b (commit)
      from  829ebedb07c1f3f917043e8483c3f7a3355651a2 (commit)

Summary of changes:
 lib/RT/Action/UpdateUser.pm |    1 +
 lib/RT/Dispatcher.pm        |    6 ++++
 lib/RT/View/SetupWizard.pm  |   68 ++++++++++++++++++++++++++++++++-----------
 3 files changed, 58 insertions(+), 17 deletions(-)

- Log -----------------------------------------------------------------
commit 63f40caee208ba39c7f11fdd3def88c2b5f4f68b
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Jun 22 14:35:17 2010 -0400

    Canonicalize /setup to /setup/

diff --git a/lib/RT/Action/UpdateUser.pm b/lib/RT/Action/UpdateUser.pm
index 213e445..2b0a89e 100644
--- a/lib/RT/Action/UpdateUser.pm
+++ b/lib/RT/Action/UpdateUser.pm
@@ -34,6 +34,7 @@ sub arguments {
 
 sub take_action {
     my $self = shift;
+    warn "running UpdateUser!";
     $self->SUPER::take_action;
     $self->_update_custom_field_values;
     for my $field (qw/disabled privileged/) {
diff --git a/lib/RT/Dispatcher.pm b/lib/RT/Dispatcher.pm
index 59ae6f4..84922e7 100644
--- a/lib/RT/Dispatcher.pm
+++ b/lib/RT/Dispatcher.pm
@@ -173,6 +173,12 @@ on qr{^/$} => run {
     show '/index.html';
 };
 
+# Canonicalize /setup to /setup/ so we can properly use relative links
+# XXX: This is a bit ugly
+before qr'^/setup$' => run {
+    redirect '/setup/';
+};
+
 on qr{^/Dashboards/(\d+)} => run {
     Jifty->web->request->argument( id => $1 );
     show('/Dashboards/Render.html');
diff --git a/lib/RT/View/SetupWizard.pm b/lib/RT/View/SetupWizard.pm
index 3430d9a..8788f05 100644
--- a/lib/RT/View/SetupWizard.pm
+++ b/lib/RT/View/SetupWizard.pm
@@ -52,8 +52,17 @@ package RT::View::SetupWizard;
 use Jifty::View::Declare -base;
 use base qw/ Jifty::Plugin::SetupWizard::View::Helpers /;
 
-template 'index.html' => page { title => 'RT Setup Wizard' } content {
-    h1 { _("RT Setup Wizard") };
+sub setup_page (&) {
+    my ($code) = @_;
+    page { title => "RT Setup Wizard" } content {
+        h1 { _("RT Setup Wizard") };
+        form {
+            $code->();
+        };
+    };
+}
+
+template 'index.html' => setup_page {
     h2 { _("Welcome to RT!") };
 
     p {
@@ -65,41 +74,66 @@ template 'index.html' => page { title => 'RT Setup Wizard' } content {
         moniker => 'sysconfig'
     );
 
-    form { $config->next_page_button( url => 'database', label => 'Start' ) };
+    $config->next_page_button( url => 'database', label => 'Start' );
 
     p {
         outs_raw _("This setup wizard was activated by the presence of <tt>SetupMode: 1</tt> in one of your configuration files. If you are seeing this erroneously, you may restore normal operation by adjusting the <tt>etc/site_config.yml</tt> file to have <tt>SetupMode: 0</tt> set under <tt>framework</tt>.");
     };
 };
 
-template 'database' => page { title => 'RT Setup Wizard: Database' } content {
-    h1 { _("RT Setup Wizard") };
-    h2 { _("Database") };
+template 'database' => setup_page {
+    h2 { _("Configure your database") };
     
     my $config = new_action(
         class   => 'RT::Action::ConfigSystem',
         moniker => 'sysconfig'
     );
 
-    form {
-        show 'database_widget';
-        $config->next_page_button( url => 'web', label => 'Next step' );
-    };
+    show 'database_widget';
+
+    $config->prev_page_button( url => 'index.html', label => 'Previous step' );
+    $config->next_page_button( url => 'root', label => 'Next step', submit => undef );
 };
 
-# web - base url, port, more RT stuff
-# rt specific stuff
-# turn off SetupMode in finalize
+template 'root' => setup_page {
+    h2 { _("Change the default root password") };
 
+    my $config = new_action(
+        class   => 'RT::Action::ConfigSystem',
+        moniker => 'sysconfig'
+    );
 
-template 'basics' => sub {
-    p { _("It is very important that you change the password to RT's root user. Leaving it as the default of 'password' is a serious security risk.") };
+    p {
+        _("It is very important that you change the password of RT's root user.  Leaving it as the default of 'password' is a serious security risk.");
+    };
 
     my $user = RT::Model::User->new;
     $user->load_by_cols(name => 'root');
 
-    my $password = $user->as_update_action;
-    outs_raw( $password->form_field('password') );
+    my $action = $user->as_update_action;
+    render_param( $action => 'password', ajax_validates => 0 );
+    render_param(
+        $action => 'password_confirm',
+        label   => 'Confirm Password',
+    );
+
+    $action->button;
+
+    $config->prev_page_button( url => 'database', label => 'Previous step' );
+    $config->next_page_button(
+        url     => 'ui',
+        submit  => $action,
+        label   => 'Next step',
+    );
+};
+
+# root password
+# rtname, timezone
+# web (base url, port, + rt stuff?)
+# email
+# turn off SetupMode in finish
+
+template 'basics' => sub {
 
     p { _("You may change basic information about your RT install.") };
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list