[Rt-commit] r11856 - in rt/branches/3.8-TESTING: . html/installation

jesse at bestpractical.com jesse at bestpractical.com
Wed Apr 23 17:31:14 EDT 2008


Author: jesse
Date: Wed Apr 23 17:31:12 2008
New Revision: 11856

Added:
   rt/branches/3.8-TESTING/html/installation/Elements/
   rt/branches/3.8-TESTING/html/installation/Elements/Header
   rt/branches/3.8-TESTING/html/installation/Elements/Wrapper
Modified:
   rt/branches/3.8-TESTING/   (props changed)
   rt/branches/3.8-TESTING/html/installation/Basics.html
   rt/branches/3.8-TESTING/html/installation/DatabaseDetails.html
   rt/branches/3.8-TESTING/html/installation/DatabaseType.html
   rt/branches/3.8-TESTING/html/installation/Emails.html
   rt/branches/3.8-TESTING/html/installation/Finish.html
   rt/branches/3.8-TESTING/html/installation/Initialize.html
   rt/branches/3.8-TESTING/html/installation/Sendmail.html
   rt/branches/3.8-TESTING/html/installation/autohandler
   rt/branches/3.8-TESTING/html/installation/index.html

Log:
 r30024 at 31b:  jesse | 2008-04-23 16:23:36 -0400
 * ditch usage of sessions for installation.
 move page wrappers for installation out of the templates themselves


Modified: rt/branches/3.8-TESTING/html/installation/Basics.html
==============================================================================
--- rt/branches/3.8-TESTING/html/installation/Basics.html	(original)
+++ rt/branches/3.8-TESTING/html/installation/Basics.html	Wed Apr 23 17:31:12 2008
@@ -46,9 +46,7 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 
-<& /Elements/Header, Title => 'Install' &> 
-<& /Elements/Tabs, 
-    current_toptab => 'Install', Title => 'Step 3: Customize Basics' &> 
+<& Elements/Header, Title => 'Step 3: Customize Basics' &> 
 
 <& /Elements/ListActions, actions => \@results &>
 
@@ -63,7 +61,7 @@
 % } else {
 <input type="text" <% $_ eq 'MinimumPasswordLength' ? q[onchange="(!this.value || this.value.match(/^\d+$/)) ?
 this.style.background='white' : this.style.background='red'" ]: () |n %>
-name="<% $_ %>" value="<% $ARGS{$_} || $session{InstallConfig}{$_} %>" />
+name="<% $_ %>" value="<% $ARGS{$_} || $RT::Installer->{InstallConfig}{$_} %>" />
 % }
 </td>
 </tr>
@@ -101,9 +99,9 @@
 if ( $Run ) {
 
     for ( @types ) {
-        $session{InstallConfig}{$_} = $ARGS{$_} if $ARGS{$_};
+        $RT::Installer->{InstallConfig}{$_} = $ARGS{$_} if $ARGS{$_};
     }
-    $session{TimeStamp} = time;
+    $RT::Installer->{TimeStamp} = time;
 
     for ( qw/MininumPasswordLength/ ) {
         if ( $ARGS{$_} && $ARGS{$_} !~ /^\d+$/ ) {

Modified: rt/branches/3.8-TESTING/html/installation/DatabaseDetails.html
==============================================================================
--- rt/branches/3.8-TESTING/html/installation/DatabaseDetails.html	(original)
+++ rt/branches/3.8-TESTING/html/installation/DatabaseDetails.html	Wed Apr 23 17:31:12 2008
@@ -46,9 +46,7 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 
-<& /Elements/Header, Title => 'Install' &> 
-<& /Elements/Tabs, 
-    current_toptab => 'Install', Title => 'Step 2: Check your database credentials' &> 
+<& Elements/Header, Title => 'Step 2: Check your database credentials' &> 
 
 <& /Elements/ListActions, actions => \@results &>
 
@@ -58,20 +56,20 @@
 <td class="label"><% loc('DatabaseName') %>:</td>
 <td>
 <input type="text" name="DatabaseName" value="<% $ARGS{DatabaseName} ||
-$session{InstallConfig}{DatabaseName} %>" />
+$RT::Installer->{InstallConfig}{DatabaseName} %>" />
 </td>
 </tr>
-% if ( $session{InstallConfig}{DatabaseType} ne 'SQLite' ) {
+% if ( $RT::Installer->{InstallConfig}{DatabaseType} ne 'SQLite' ) {
 % for ( qw/DatabaseHost DatabasePort DatabaseUser DatabasePassword/ ) {
 <tr title="<% $title{$_} |n %>">
 <td class="label"><% loc($_) %>:</td>
 <td>
-<input type="<% /Password/ ? 'password' : 'text' %>" name="<% $_ %>" value="<% $ARGS{$_} || $session{InstallConfig}{$_} %>" />
+<input type="<% /Password/ ? 'password' : 'text' %>" name="<% $_ %>" value="<% $ARGS{$_} || $RT::Installer->{InstallConfig}{$_} %>" />
 </td>
 </tr>
 
 % }
-% if ( $session{InstallConfig}{DatabaseType} eq 'Pg' ) {
+% if ( $RT::Installer->{InstallConfig}{DatabaseType} eq 'Pg' ) {
 <tr title="<% $title{DatabaseRequireSSL} |n %>" >
 <td class="label"><% loc('DatabaseRequireSSL') %>:</td>
 <td>
@@ -85,7 +83,7 @@
 </table>
 <input type="hidden" name="Run" value="1">
 
-% if ( $session{InstallConfig}{DatabaseType} ne 'SQLite' ) {
+% if ( $RT::Installer->{InstallConfig}{DatabaseType} ne 'SQLite' ) {
 <input type="submit" value="check if we can connect" name="Connect" />
 % }
 <& /Elements/Submit, Label => loc('Next: Customize Basics') &>
@@ -130,13 +128,13 @@
 
     for ( qw/DatabaseName DatabaseUser DatabasePassword DatabasePort
             DatabaseHost DatabaseRequireSSL/ ) {
-        $session{InstallConfig}{$_} = $ARGS{$_};
+        $RT::Installer->{InstallConfig}{$_} = $ARGS{$_};
     }
-    $session{TimeStamp} = time;
+    $RT::Installer->{TimeStamp} = time;
 
     if ( $Connect ) {
         my $handle = DBIx::SearchBuilder::Handle->new();
-        my $db_type = $session{InstallConfig}{DatabaseType};
+        my $db_type = $RT::Installer->{InstallConfig}{DatabaseType};
         
         my $dsn;
         $dsn = "dbi:$db_type:";

Modified: rt/branches/3.8-TESTING/html/installation/DatabaseType.html
==============================================================================
--- rt/branches/3.8-TESTING/html/installation/DatabaseType.html	(original)
+++ rt/branches/3.8-TESTING/html/installation/DatabaseType.html	Wed Apr 23 17:31:12 2008
@@ -46,9 +46,7 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 
-<& /Elements/Header, Title => 'Start to Config RT' &> 
-<& /Elements/Tabs, 
-    current_toptab => 'Install', Title => 'Install' &>
+<& Elements/Header, Title => 'Install' &>
 
 <& /Elements/ListActions, actions => \@results &>
 
@@ -85,18 +83,17 @@
 
     if ( grep { $DatabaseType eq $_ } @Types ) {
     
-        $session{InstallConfig}{DatabaseType} = $DatabaseType;
-        $session{TimeStamp} = time; # need this to force %session update
+        $RT::Installer->{InstallConfig}{DatabaseType} = $DatabaseType;
+        $RT::Installer->{TimeStamp} = time; # need this to force %session update
         
-        RT::Interface::Web::Redirect(RT->Config->Get('WebURL') .
-'installation/DatabaseDetails.html');
+        RT::Interface::Web::Redirect(RT->Config->Get('WebURL') .  'installation/DatabaseDetails.html');
     }
     else {
         push @results, "invalid database type: $DatabaseType";
     }
 }
 else {
-    $DatabaseType ||= $session{InstallConfig}{DatabaseType};
+    $DatabaseType ||= $RT::Installer->{InstallConfig}{DatabaseType};
 }
 
 </%init>

Added: rt/branches/3.8-TESTING/html/installation/Elements/Header
==============================================================================
--- (empty file)
+++ rt/branches/3.8-TESTING/html/installation/Elements/Header	Wed Apr 23 17:31:12 2008
@@ -0,0 +1,4 @@
+<%args>
+$Title => undef
+</%args>
+<h1><%$Title%></h1>

Added: rt/branches/3.8-TESTING/html/installation/Elements/Wrapper
==============================================================================
--- (empty file)
+++ rt/branches/3.8-TESTING/html/installation/Elements/Wrapper	Wed Apr 23 17:31:12 2008
@@ -0,0 +1,4 @@
+<& /Elements/Header &>
+<%$m->content() |n%>
+</body></html>
+% $m->abort;

Modified: rt/branches/3.8-TESTING/html/installation/Emails.html
==============================================================================
--- rt/branches/3.8-TESTING/html/installation/Emails.html	(original)
+++ rt/branches/3.8-TESTING/html/installation/Emails.html	Wed Apr 23 17:31:12 2008
@@ -46,9 +46,7 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 
-<& /Elements/Header, Title => 'Install' &> 
-<& /Elements/Tabs, 
-    current_toptab => 'Install', Title => 'Step 4: Customize Emails' &> 
+<& Elements/Header, Title => 'Step 4: Customize Emails' &> 
 
 <& /Elements/ListActions, actions => \@results &>
 
@@ -59,7 +57,7 @@
 <td class="label"><% loc($_) %>:</td>
 <td>
 <input type="text" <% $_ eq 'MaxAttachmentSize' ? q[onchange="(!this.value || this.value.match(/^\d+$/)) ? this.style.background='white' : this.style.background='red'" ]: () |n %>
-name="<% $_ %>" value="<% $ARGS{$_} || $session{InstallConfig}{$_} %>" />
+name="<% $_ %>" value="<% $ARGS{$_} || $RT::Installer->{InstallConfig}{$_} %>" />
 </td>
 </tr>
 % }
@@ -97,9 +95,9 @@
 if ( $Run ) {
 
     for ( @types ) {
-        $session{InstallConfig}{$_} = $ARGS{$_} if $ARGS{$_};
+        $RT::Installer->{InstallConfig}{$_} = $ARGS{$_} if $ARGS{$_};
     }
-    $session{TimeStamp} = time;
+    $RT::Installer->{TimeStamp} = time;
 
     for ( qw/MaxAttachmentSize/ ) {
         if ( $ARGS{$_} && $ARGS{$_} !~ /^\d+$/ ) {

Modified: rt/branches/3.8-TESTING/html/installation/Finish.html
==============================================================================
--- rt/branches/3.8-TESTING/html/installation/Finish.html	(original)
+++ rt/branches/3.8-TESTING/html/installation/Finish.html	Wed Apr 23 17:31:12 2008
@@ -46,9 +46,7 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 
-<& /Elements/Header, Title => 'Install' &> 
-<& /Elements/Tabs, 
-    current_toptab => 'Install', Title => 'Step 7: Finish' &> 
+<& Elements/Header, Title => 'Step 7: Finish' &> 
 
 <div class="intro">
 <p>

Modified: rt/branches/3.8-TESTING/html/installation/Initialize.html
==============================================================================
--- rt/branches/3.8-TESTING/html/installation/Initialize.html	(original)
+++ rt/branches/3.8-TESTING/html/installation/Initialize.html	Wed Apr 23 17:31:12 2008
@@ -46,9 +46,7 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 
-<& /Elements/Header, Title => 'Install' &> 
-<& /Elements/Tabs, 
-    current_toptab => 'Install', Title => 'Step 6: Initialize Database' &> 
+<& Elements/Header, Title => 'Step 6: Initialize Database' &> 
 
 <& /Elements/ListActions, actions => \@results &>
 
@@ -66,7 +64,7 @@
 <%init>
 my @results;
 if ( $Run ) {
-    my $msg = `echo | $^X sbin/rt-setup-database --action init --dba $session{InstallConfig}{DatabaseUser} --dba-password '$session{InstallConfig}{DatabasePassword}' 2>&1`;
+    my $msg = `echo | $^X sbin/rt-setup-database --action init --dba $RT::Installer->{InstallConfig}{DatabaseUser} --dba-password '$RT::Installer->{InstallConfig}{DatabasePassword}' 2>&1`;
     @results = split /\n/, $msg;
 # XXX $? doesn't work here, so I decided to grep the strings to find if any
 # error happens

Modified: rt/branches/3.8-TESTING/html/installation/Sendmail.html
==============================================================================
--- rt/branches/3.8-TESTING/html/installation/Sendmail.html	(original)
+++ rt/branches/3.8-TESTING/html/installation/Sendmail.html	Wed Apr 23 17:31:12 2008
@@ -45,10 +45,7 @@
 %# those contributions and any derivatives thereof.
 %# 
 %# END BPS TAGGED BLOCK }}}
-
-<& /Elements/Header, Title => 'Install' &> 
-<& /Elements/Tabs, 
-    current_toptab => 'Install', Title => 'Step 5: Customize Sendmail' &> 
+<& Elements/Header, Title => 'Step 5: Customize Sendmail' &> 
 
 <& /Elements/ListActions, actions => \@results &>
 
@@ -62,7 +59,7 @@
 <tr title="<% $title{$_} |n%>">
 <td class="label"><% loc($_) %>:</td>
 <td>
-<input type="text" name="<% $_ %>" value="<% $ARGS{$_} || $session{InstallConfig}{$_} %>" />
+<input type="text" name="<% $_ %>" value="<% $ARGS{$_} || $RT::Installer->{InstallConfig}{$_} %>" />
 </td>
 </tr>
 % }
@@ -99,9 +96,9 @@
 if ( $Run ) {
 
     for ( @types ) {
-        $session{InstallConfig}{$_} = $ARGS{$_} if $ARGS{$_};
+        $RT::Installer->{InstallConfig}{$_} = $ARGS{$_} if $ARGS{$_};
     }
-    $session{TimeStamp} = time;
+    $RT::Installer->{TimeStamp} = time;
 
     unless ( @results ) {
 
@@ -110,8 +107,8 @@
         my $file = File::Spec->catfile($RT::EtcPath, 'RT_SiteConfig.pm');
 
         if ( open my $fh, '>', $file  ) {
-            for ( keys %{$session{InstallConfig}} ) {
-                 print $fh "Set( \$$_, '$session{InstallConfig}{$_}' );\n";
+            for ( keys %{$RT::Installer->{InstallConfig}} ) {
+                 print $fh "Set( \$$_, '$RT::Installer->{InstallConfig}{$_}' );\n";
             }
             print $fh "Set( \$Installed, 1 );\n";
             print $fh "1;\n";

Modified: rt/branches/3.8-TESTING/html/installation/autohandler
==============================================================================
--- rt/branches/3.8-TESTING/html/installation/autohandler	(original)
+++ rt/branches/3.8-TESTING/html/installation/autohandler	Wed Apr 23 17:31:12 2008
@@ -45,16 +45,18 @@
 %# those contributions and any derivatives thereof.
 %# 
 %# END BPS TAGGED BLOCK }}}
-
+<%flags>
+inherit => undef
+</%flags>
 <%init>
-
-if ( $session{InstallConfig} && $session{CurrentUser}->HasRight( Right => 'SuperUser',  Object => $RT::System ) ) {
-    $m->call_next;
+RT::Interface::Web::Redirect(RT->Config->Get('WebURL')) unless (RT->InstallMode);
+if (RT->InstallMode) {
+    $RT::Installer->{'CurrentUser'} = RT::CurrentUser->new();
 }
 else {
-     RT::Interface::Web::Redirect(RT->Config->Get('WebURL') .
-'installation/index.html' );
-
+     RT::Interface::Web::Redirect(RT->Config->Get('WebURL'));
 }
-
 </%init>
+<&|Elements/Wrapper &>
+<%$m->call_next()%>
+</&>

Modified: rt/branches/3.8-TESTING/html/installation/index.html
==============================================================================
--- rt/branches/3.8-TESTING/html/installation/index.html	(original)
+++ rt/branches/3.8-TESTING/html/installation/index.html	Wed Apr 23 17:31:12 2008
@@ -46,13 +46,11 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 
-<& /Elements/Header, Title => 'Start to Config RT' &> 
-<& /Elements/Tabs, 
-    current_toptab => 'Install', Title => 'Install' &>
+<& Elements/Header, Title => 'Start to Config RT' &> 
 
 <& /Elements/ListActions, actions => \@results &>
 
-% if ( $session{CurrentUser}->HasRight( Right => 'SuperUser',  Object => $RT::System ) && ! $locked ) {
+% if ( !$locked) {
 
 <div class="intro">
 <p>
@@ -74,11 +72,7 @@
 
 <%init>
 my @results;
-
 my $locked;
-
-if ( $session{CurrentUser}->HasRight( Right => 'SuperUser',  Object =>
-            $RT::System ) ) {
     my $file = File::Spec->catfile( $RT::EtcPath, 'RT_SiteConfig.pm' );
     $locked = 1 unless -w $file;
     
@@ -90,26 +84,18 @@
         push @results, "Config file $file is locked";
     }
     elsif ( $Run ) {
-        $session{InstallConfig} ||= {};
-        for ( qw/DatabaseType DatabaseName DatabaseHost DatabasePort
+        $RT::Installer->{InstallConfig} ||= {};
+        for my $field  ( qw/DatabaseType DatabaseName DatabaseHost DatabasePort
                 DatabaseUser DatabasePassword DatabaseRequireSSL rtname
                 Organization TimeZone MinimumPasswordLength MaxAttachmentSize
                 OwnerEmail CommentAddress CorrespondAddress MailCommand
                 SendmailArguments SendmailBounceArguments SendmailPath/ ) {
-            no strict 'refs';
-            my $v = "RT::$_";
-            $session{InstallConfig}{$_} ||= $$v;
+            $RT::Installer->{InstallConfig}{$field} ||= RT->Config->Get($field);
         }
-        $session{TimeStamp} = time;
-        RT::Interface::Web::Redirect(RT->Config->Get('WebURL') .
-'installation/DatabaseType.html');
+        $RT::Installer->{TimeStamp} = time;
+        RT::Interface::Web::Redirect(RT->Config->Get('WebURL') .  '/installation/DatabaseType.html');
     
-    }
-}
-else {
-    push @results, 'Permission Denied';
-}
-
+        }
 </%init>
 
 <%args>
@@ -117,6 +103,3 @@
 $Run => 0
 </%args>
 
-<%flags>
-inherit => '../autohandler'
-</%flags>


More information about the Rt-commit mailing list