[Rt-commit] rt branch, menu-redo, updated. a638adfc27831072111bde76ec813077d3458422

jesse jesse at bestpractical.com
Tue Nov 3 22:49:37 EST 2009


The branch, menu-redo has been updated
       via  a638adfc27831072111bde76ec813077d3458422 (commit)
      from  3e167cfb2ed07f703db4b0280ccd65b929a28a97 (commit)

Summary of changes:
 lib/RT/Dispatcher.pm              |    6 +++---
 lib/RT/Interface/Web.pm           |   26 +++++++++++++++++++++++---
 lib/RT/Test.pm                    |   10 ++++++++++
 share/html/Dashboards/Modify.html |    9 ++++++++-
 share/html/Ticket/Display.html    |   11 ++++-------
 t/web/dashboards.t                |   20 +++++++++-----------
 6 files changed, 57 insertions(+), 25 deletions(-)

- Log -----------------------------------------------------------------
commit a638adfc27831072111bde76ec813077d3458422
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 3 22:49:11 2009 -0500

    Failed 10/118 test programs. 29/4440 subtests failed.
    
    Files=118, Tests=4440, 982 wallclock secs ( 0.79 usr  0.14 sys + 894.60 cusr 44.83 csys = 940.36 CPU)
    Result: FAIL
    make: *** [test_dynamic] Error 1
    
    closer still

diff --git a/lib/RT/Dispatcher.pm b/lib/RT/Dispatcher.pm
index d42dfbe..e217182 100644
--- a/lib/RT/Dispatcher.pm
+++ b/lib/RT/Dispatcher.pm
@@ -294,7 +294,7 @@ before qr'Dashboards/(\d*)?' => sub {
             $tabs->child( _('Basics'),       url => "/Dashboards/Modify.html?id=" . $obj->id );
             $tabs->child( _('Queries'),      url => "/Dashboards/Queries.html?id=" . $obj->id );
             $tabs->child( _('Subscription'), url => "/Dashboards/Subscription.html?dashboard_id=" . $obj->id ) if $obj->current_user_can_subscribe;
-            $tabs->child( _('Show'), url => "Dashboards/" . $obj->id . "/" . $obj->name )
+            $tabs->child( _('Show'), url => "/Dashboards/" . $obj->id . "/" . $obj->name )
 
         }
     }
@@ -611,11 +611,11 @@ before 'User/Group' => sub {
 
 before 'Prefs' => sub {
 	my $tabs;
-	my $searches = RT::System->new->saved_searches();
+	my @searches = RT::System->new->saved_searches();
 
 	page_nav->child(  'Quick search' => label => _('Quick search'), url => '/Prefs/Quicksearch.html');
 
-	for my $search (@$searches) {
+	for my $search (@searches) {
 	page_nav->child(
         $search->[0],
         url  => "/Prefs/Search.html?" .query_string( name => ref($search->[1]).'-'.$search->[1]->id));
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index c948e83..6b917cb 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -119,17 +119,37 @@ sub web_external_auto_info {
 }
 
 
-=head2 redirect URL
+=head2 redirect URL || HASHREF
 
 This routine tells the current user's browser to redirect to URL.  
 
+If a hashref is passed in, takes: url => a url to redirect to
+								  messages => an array ref to messages to propagate across the redirect
+
 =cut
 
 sub redirect {
-    my $redir_to   = shift;
+	my %args;
+	if (!defined $_[1]) {
+		$args{url} = shift;
+	} else {
+
+		%args = ( url => undef, messages => undef, @_);
+	}
+    my $redir_to   = $args{url};
     my $uri        = URI->new($redir_to);
     my $server_uri = URI->new( Jifty->web->url );
-
+    
+	
+    if ( $args{messages} ) {
+
+        # We've done something, so we need to clear the decks to avoid
+        # resubmission on refresh.
+        # But we need to store Actions somewhere too, so we don't lose them.
+        my $key = Digest::MD5::md5_hex( rand(1024) );
+        Jifty->web->session->set( "actions_$key" => $args{messages} );
+        $uri->query_form( $uri->query_form(), results => $key );
+    }
     # If the user is coming in via a non-canonical
     # hostname, don't redirect them to the canonical host,
     # it will just upset them (and invalidate their credentials)
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index d3649cc..fa2c9ba 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -726,4 +726,14 @@ sub trust_gnupg_key {
     return %res;
 }
 
+sub diag_html_content {
+	my $self = shift;
+	my $content = shift;
+	$content =~ s/\s+/ /g;
+	$content =~ s/<script.*?<\/script.*?>//gi;
+	$content =~ s/<(?:p|br).*?>/\n/i;
+	$content =~ s/\<.+?\>//g;
+	diag($content);
+}
+
 1;
diff --git a/share/html/Dashboards/Modify.html b/share/html/Dashboards/Modify.html
index 1415aba..9c7d790 100644
--- a/share/html/Dashboards/Modify.html
+++ b/share/html/Dashboards/Modify.html
@@ -112,7 +112,14 @@ else {
         }
 
         push @results, $msg;
-        $id = $Dashboard->id;
+		$id = $Dashboard->id;
+	warn Jifty->web->url . "Dashboards/Modify.html?id=" . $Dashboard->id;
+	warn join(',', at results);
+    RT::Interface::Web::redirect(
+	url      => Jifty->web->url . "Dashboards/Modify.html?id=" . $Dashboard->id,
+	messages => \@results
+    );
+					
     }
     else {
         my ($ok, $msg) = $Dashboard->load_by_id($id);
diff --git a/share/html/Ticket/Display.html b/share/html/Ticket/Display.html
index 2a23efd..345f390 100755
--- a/share/html/Ticket/Display.html
+++ b/share/html/Ticket/Display.html
@@ -198,13 +198,10 @@ $m->callback(
 # This code does automatic redirection if any updates happen. 
 
 if (@Actions) {
-
-    # We've done something, so we need to clear the decks to avoid
-    # resubmission on refresh.
-    # But we need to store Actions somewhere too, so we don't lose them.
-    my $key = Digest::MD5::md5_hex( rand(1024) );
-    Jifty->web->session->set( "actions_$key" => \@Actions );
-    RT::Interface::Web::redirect( Jifty->web->url . "Ticket/Display.html?id=" . $ticket_obj->id . "&results=" . $key );
+    RT::Interface::Web::redirect(
+        url      => Jifty->web->url . "Ticket/Display.html?id=" . $ticket_obj->id,
+        messages => \@Actions
+    );
 }
 
 my $attachments = $m->comp('Elements/FindAttachments', ticket => $ticket_obj, tickets => $Tickets);
diff --git a/t/web/dashboards.t b/t/web/dashboards.t
index d5d7355..6be5f3d 100644
--- a/t/web/dashboards.t
+++ b/t/web/dashboards.t
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
 
-use RT::Test tests => 99, l10n => 1;
+use RT::Test tests => 100, l10n => 1;
 use RT::Dashboard;
 my ($baseurl, $m) = RT::Test->started_ok;
 
@@ -36,7 +36,7 @@ for my $user ($user_obj, $onlooker) {
 ok $m->login(customer => 'customer'), "logged in";
 
 $m->get_ok($url."/Dashboards/index.html");
-$m->content_lacks("New dashboard", "No 'new dashboard' link because we have no CreateOwnDashboard");
+$m->content_lacks(">Create<", "No 'new dashboard' link because we have no CreateOwnDashboard");
 
 $m->no_warnings_ok;
 
@@ -62,17 +62,14 @@ $m->content_lacks("Permission denied");
 $m->content_contains("Save Changes");
 
 $m->get_ok($url."/Dashboards/index.html");
-$m->content_contains("New dashboard", "'New dashboard' link because we now have ModifyOwnDashboard");
-
-$m->follow_link_ok({text => "New dashboard"});
+$m->content_contains("Create", "'Create' link because we now have ModifyOwnDashboard");
+$m->follow_link_ok({text => "Create"});
 $m->form_name( 'modify_dashboard' );
 $m->field("name" => 'different dashboard');
 $m->content_lacks('Delete', "Delete button hidden because we are creating");
 $m->click_button(value => 'Save Changes');
 $m->content_lacks("No permission to create dashboards");
 $m->content_contains("Saved dashboard different dashboard");
-$m->content_lacks('Delete', "Delete button hidden because we lack DeleteOwnDashboard");
-
 $m->get_ok($url."/Dashboards/index.html");
 $m->content_lacks("different dashboard", "we lack SeeOwnDashboard");
 
@@ -82,6 +79,10 @@ $m->get_ok($url."/Dashboards/index.html");
 $m->content_contains("different dashboard", "we now have SeeOwnDashboard");
 $m->content_lacks("Permission denied");
 
+
+$m->content_lacks('Delete', "Delete button hidden because we lack DeleteOwnDashboard");
+
+
 $m->follow_link_ok({text => "different dashboard"});
 $m->content_contains("Basics");
 $m->content_contains("Queries");
@@ -150,8 +151,7 @@ $m->get_ok("/Dashboards/Subscription.html?dashboard_id=$id");
 $m->form_name( 'subscribe_dashboard' );
 $m->click_button(name => 'save');
 $m->content_contains("Permission denied");
-$m->warnings_like(qr/Unable to subscribe to dashboard.*Permission denied/, "got a permission denied warning when trying to subscribe to a dashboard");
-
+$m->warnings_like([qr/Permission denied/,qr/Unable to subscribe/i], "got a permission denied warning when trying to subscribe to a dashboard");
 Jifty::DBI::Record::Cachable->flush_cache;
 is($user_obj->attributes->named('Subscription'), 0, "no subscriptions");
 
@@ -220,9 +220,7 @@ $m->content_lacks('Delete', "Delete button hidden because we are creating");
 $m->click_button(value => 'Save Changes');
 $m->content_lacks("No permission to create dashboards");
 $m->content_contains("Saved dashboard system dashboard");
-
 $m->follow_link_ok({text => 'Queries'});
-
 $m->form_name('Dashboard-Searches-body');
 my ( $personal_search_option ) = $m->content =~ /(search-\d+-RT::Model::User-\d+)/;
 $m->field('Searches-body-Available' => [$personal_search_option]);

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


More information about the Rt-commit mailing list