[Rt-commit] rt branch, menuing, updated. rt-3.9.4-244-g03f5314

Jesse Vincent jesse at bestpractical.com
Tue Nov 2 13:51:23 EDT 2010


The branch, menuing has been updated
       via  03f5314250af2345739c3ebaf39f726421de346b (commit)
       via  7bc91ae00e68b44bf20ffaa4ad577742641377ed (commit)
       via  3ce26ddf9f927b3e22f8cbba7c8e9f55f05a0f76 (commit)
       via  3e57940b099dcdeeef5201d30cb11e590cc6e282 (commit)
       via  c88390c38a984cc61b0deec5a7ca77abe85df179 (commit)
       via  d713629bac11d29fa48563bb9103d16c59477f95 (commit)
       via  3675e41332317907ff5311e9183a938fc76853b9 (commit)
       via  f90f2fe626ecf2321858d3665e3b801b3c8a234f (commit)
       via  e9d4ab6ef202c1d42b1985349a1368726963eee6 (commit)
       via  8f0c8cd56547d62db60b4f0e2c48b36fb709e64c (commit)
       via  3d37dff3e25c6ddde1379f180cd6cca7326439e8 (commit)
       via  25381bc7670184c7ae9d8c729279e2854666cf15 (commit)
       via  bafb553b2dad0930408fec159089b90250b8febb (commit)
       via  72ba5c61742318817a19834e9c450b338cdb8e2f (commit)
      from  cdb9765f9f355857ce701102db7e4bb5ccb67a2e (commit)

Summary of changes:
 lib/RT/Record.pm                          |   12 +++-
 lib/RT/SharedSetting.pm                   |    4 +-
 share/html/Admin/CustomFields/Modify.html |   15 +++++
 share/html/Admin/Groups/Modify.html       |   13 ++++
 share/html/Dashboards/Modify.html         |   32 ++++++----
 share/html/Dashboards/index.html          |    6 --
 share/html/Elements/Tabs                  |   93 +++++++++++++++-------------
 share/html/Elements/Widgets               |    2 +-
 share/html/NoAuth/css/web2/layout.css     |   13 ++--
 share/html/NoAuth/css/web2/nav.css        |   10 +++-
 t/ticket/scrips_batch.t                   |    2 +-
 t/web/cf_access.t                         |    6 +-
 t/web/cf_date.t                           |    4 +-
 t/web/cf_datetime.t                       |    2 +-
 t/web/cf_onqueue.t                        |    2 +-
 t/web/cf_select_one.t                     |    4 +-
 t/web/dashboards-groups.t                 |    5 +-
 t/web/dashboards.t                        |   12 ++--
 t/web/html_template.t                     |    2 +-
 t/web/rights.t                            |    2 +-
 t/web/walk.t                              |   10 ++--
 21 files changed, 150 insertions(+), 101 deletions(-)

- Log -----------------------------------------------------------------
commit 72ba5c61742318817a19834e9c450b338cdb8e2f
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 09:51:33 2010 -0400

    add more unique ids to some menu items

diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index e048e84..203f1bd 100755
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -114,17 +114,17 @@ if ( $request_path =~ qr{.*} ) {
     if ( $session{'CurrentUser'}
          ->HasRight( Right => 'ShowApprovalsTab', Object => $RT::System ) )
     {
-        $tools->child( loc('Approval'), path => '/Approvals/' );
+        $tools->child( approval => title => loc('Approval'), path => '/Approvals/' );
     }
 
     if ( $session{'CurrentUser'}
          ->HasRight( Right => 'ShowConfigTab', Object => $RT::System ) )
     {
-        my $admin = Menu->child( Config => title => loc('Configuration'),
+        my $admin = Menu->child( config => title => loc('Configuration'),
                                  path   => '/Admin/' );
-        my $users = $admin->child( loc('Users'), path => '/Admin/Users/', );
-        $users->child( loc('Select'), path => "/Admin/Users/" );
-        $users->child( loc('Create'),
+        my $users = $admin->child( users => title => loc('Users'), path => '/Admin/Users/', );
+        $users->child( select => title => loc('Select'), path => "/Admin/Users/" );
+        $users->child( create => title => loc('Create'),
                        path => "/Admin/Users/Modify.html?Create=1" );
 
         my $groups

commit bafb553b2dad0930408fec159089b90250b8febb
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 09:52:01 2010 -0400

    move Configuration under the tools menu

diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 203f1bd..6e7f6b0 100755
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -120,7 +120,7 @@ if ( $request_path =~ qr{.*} ) {
     if ( $session{'CurrentUser'}
          ->HasRight( Right => 'ShowConfigTab', Object => $RT::System ) )
     {
-        my $admin = Menu->child( config => title => loc('Configuration'),
+        my $admin = $tools->child( config => title => loc('Configuration'),
                                  path   => '/Admin/' );
         my $users = $admin->child( users => title => loc('Users'), path => '/Admin/Users/', );
         $users->child( select => title => loc('Select'), path => "/Admin/Users/" );

commit 25381bc7670184c7ae9d8c729279e2854666cf15
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 10:03:09 2010 -0400

    move config to be under tools

diff --git a/t/ticket/scrips_batch.t b/t/ticket/scrips_batch.t
index d4004fb..1cfc732 100644
--- a/t/ticket/scrips_batch.t
+++ b/t/ticket/scrips_batch.t
@@ -16,7 +16,7 @@ ok $m->login, 'logged in as root';
 
 my $sid;
 {
-    $m->follow_link_ok( { id => 'config-queues' } );
+    $m->follow_link_ok( { id => 'tools-config-queues' } );
     $m->follow_link_ok( { text => $queue->Name } );
     $m->follow_link_ok( { id => 'page-scrips-create'});
     $m->form_name('ModifyScrip');
diff --git a/t/web/cf_access.t b/t/web/cf_access.t
index 2a183a8..cf7279f 100644
--- a/t/web/cf_access.t
+++ b/t/web/cf_access.t
@@ -13,7 +13,7 @@ ok $m->login, 'logged in';
 
 diag "Create a CF";
 {
-    $m->follow_link( id => 'config-custom-fields-create');
+    $m->follow_link( id => 'tools-config-custom-fields-create');
     $m->submit_form(
         form_name => "ModifyCustomField",
         fields => {
@@ -29,7 +29,7 @@ diag "apply the CF to General queue";
 my ( $cf, $cfid, $tid );
 {
     $m->title_is(q/Created CustomField img/, 'admin-cf created');
-    $m->follow_link( id => 'config-queues');
+    $m->follow_link( id => 'tools-config-queues');
     $m->follow_link( text => 'General' );
     $m->title_is(q/Configuration for queue General/, 'admin-queue: general');
     $m->follow_link( id => 'page-ticket-custom-fields');
diff --git a/t/web/cf_date.t b/t/web/cf_date.t
index 7a28806..be421a7 100644
--- a/t/web/cf_date.t
+++ b/t/web/cf_date.t
@@ -15,7 +15,7 @@ my $cf_name = 'test cf date';
 my $cfid;
 diag "Create a CF";
 {
-    $m->follow_link( id => 'config-custom-fields-create');
+    $m->follow_link( id => 'tools-config-custom-fields-create');
     $m->submit_form(
         form_name => "ModifyCustomField",
         fields    => {
@@ -34,7 +34,7 @@ my $queue = RT::Test->load_or_create_queue( Name => 'General' );
 ok $queue && $queue->id, 'loaded or created queue';
 
 {
-    $m->follow_link( id => 'config-queues-select');
+    $m->follow_link( id => 'tools-config-queues-select');
     $m->title_is( q/Admin queues/, 'admin-queues screen' );
     $m->follow_link( text => 'General' );
     $m->title_is( q/Configuration for queue General/,
diff --git a/t/web/cf_datetime.t b/t/web/cf_datetime.t
index 5b67579..95f5c17 100644
--- a/t/web/cf_datetime.t
+++ b/t/web/cf_datetime.t
@@ -16,7 +16,7 @@ my $cf_name = 'test cf datetime';
 my $cfid;
 diag "Create a CF";
 {
-    $m->follow_link( id => 'config-custom-fields-create');
+    $m->follow_link( id => 'tools-config-custom-fields-create');
     $m->submit_form(
         form_name => "ModifyCustomField",
         fields => {
diff --git a/t/web/cf_onqueue.t b/t/web/cf_onqueue.t
index 511606d..2c020b7 100644
--- a/t/web/cf_onqueue.t
+++ b/t/web/cf_onqueue.t
@@ -8,7 +8,7 @@ ok $m->login, 'logged in';
 
 diag "Create a queue CF";
 {
-    $m->follow_link( id => 'config-custom-fields-create');
+    $m->follow_link( id => 'tools-config-custom-fields-create');
     $m->submit_form(
         form_name => "ModifyCustomField",
         fields => {
diff --git a/t/web/cf_select_one.t b/t/web/cf_select_one.t
index 207ffe8..86f05cd 100644
--- a/t/web/cf_select_one.t
+++ b/t/web/cf_select_one.t
@@ -13,7 +13,7 @@ my $cf_name = 'test select one value';
 my $cfid;
 diag "Create a CF";
 {
-    $m->follow_link( id => 'config-custom-fields-create');
+    $m->follow_link( id => 'tools-config-custom-fields-create');
     $m->submit_form(
         form_name => "ModifyCustomField",
         fields => {
@@ -50,7 +50,7 @@ ok $queue && $queue->id, 'loaded or created queue';
 
 diag "apply the CF to General queue";
 {
-    $m->follow_link( id => 'config-queues');
+    $m->follow_link( id => 'tools-config-queues');
     $m->follow_link( text => 'General' );
     $m->title_is(q/Configuration for queue General/, 'admin-queue: general');
     $m->follow_link( id => 'page-ticket-custom-fields');
diff --git a/t/web/html_template.t b/t/web/html_template.t
index fccd368..e836de0 100644
--- a/t/web/html_template.t
+++ b/t/web/html_template.t
@@ -17,7 +17,7 @@ diag('make Autoreply template a html one and add utf8 chars')
   if $ENV{TEST_VERBOSE};
 
 {
-    $m->follow_link_ok( { id => 'config-global-templates' },     '-> Templates' );
+    $m->follow_link_ok( { id => 'tools-config-global-templates' },     '-> Templates' );
     $m->follow_link_ok( { text => 'Autoreply' },     '-> Autoreply' );
     $m->submit_form(
         form_name => 'ModifyTemplate',
diff --git a/t/web/rights.t b/t/web/rights.t
index 5c7fc2b..63a0878 100644
--- a/t/web/rights.t
+++ b/t/web/rights.t
@@ -7,7 +7,7 @@ use RT::Test tests => 12;
 my ($baseurl, $m) = RT::Test->started_ok;
 ok $m->login, "logged in";
 
-$m->follow_link_ok({ id => 'config-global-group-rights'});
+$m->follow_link_ok({ id => 'tools-config-global-group-rights'});
 
 
 sub get_rights {
diff --git a/t/web/walk.t b/t/web/walk.t
index af41398..90fd030 100644
--- a/t/web/walk.t
+++ b/t/web/walk.t
@@ -139,13 +139,13 @@ diag 'walk into /Admin' if $ENV{TEST_VERBOSE};
 
         for my $id ( 'group-rights', 'user-rights', 'rt-at-a-glance', 'theme' )
         {
-            $m->follow_link_ok( { id => 'config-global-' . $id }, "-> $id" );
+            $m->follow_link_ok( { id => 'tools-config-global-' . $id }, "-> $id" );
         }
 
         for my $tab ( 'scrips', 'templates' ) {
-            $m->follow_link_ok( { id => "config-global-" . $tab }, "-> $tab" );
+            $m->follow_link_ok( { id => "tools-config-global-" . $tab }, "-> $tab" );
             for my $id (qw/create select/) {
-                $m->follow_link_ok( { id => "config-global-" . $tab . "-$id" },
+                $m->follow_link_ok( { id => "tools-config-global-" . $tab . "-$id" },
                     "-> $id" );
             }
             $m->follow_link_ok( { text => '1' }, '-> 1' );

commit 3d37dff3e25c6ddde1379f180cd6cca7326439e8
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 10:24:50 2010 -0400

    cleanup of the top-of-page widgets

diff --git a/share/html/Elements/Widgets b/share/html/Elements/Widgets
index f87a68a..778a846 100644
--- a/share/html/Elements/Widgets
+++ b/share/html/Elements/Widgets
@@ -1,4 +1,4 @@
-<div class="widgets">
+<div id="topactions">
 <& /Elements/SimpleSearch &>
 <& /Elements/CreateTicket &>
 </div>
diff --git a/share/html/NoAuth/css/web2/layout.css b/share/html/NoAuth/css/web2/layout.css
index 511418e..a7677ba 100644
--- a/share/html/NoAuth/css/web2/layout.css
+++ b/share/html/NoAuth/css/web2/layout.css
@@ -84,8 +84,8 @@ div#body {
 #topactions {
  position: absolute;
  background: transparent;
- top: 3.8em; 
- right: 1em;
+ top: 3.2em; 
+ right: 0.7em;
  width: auto;
  min-width: 42em;
  font-size: 0.9em;
@@ -169,7 +169,7 @@ div#footer #bpscredits {
 
 /* logo stuff */
 
-div#logo a {
+div#logo {
     position: absolute;
     left: 2px;
     top: 0;
@@ -183,12 +183,11 @@ div#logo a img {
 }
 
 div#logo .rtname {
-    position: absolute;
+    position: relative;
     font-weight: bold;
-    top: 0.5em;
-    left: 30%;
-    right: 30%;
     text-align: center;
+    top: -0.8em;
+    left: 0.5em;
 }
 
 
diff --git a/share/html/NoAuth/css/web2/nav.css b/share/html/NoAuth/css/web2/nav.css
index 652a38e..ed1103a 100644
--- a/share/html/NoAuth/css/web2/nav.css
+++ b/share/html/NoAuth/css/web2/nav.css
@@ -55,7 +55,7 @@
 
 #page-navigation {
     position: absolute;
-    top: 5.5em;
+    top: 5.4em;
     right: 0em;
     left: auto;
     z-index: 9995;
@@ -75,3 +75,11 @@
 .sf-menu li, .sf-menu li li, .sf-menu li li li {
     background-color: #eee;
 }
+
+#page-navigation .sf-menu li, #page-navigation .sf-menu li li, #page-navigation .sf-menu li li li {
+    background-color: #fff;
+}
+
+#page-navigation .sf-menu a:visited, #page-navigation .sf-menu a {
+    border: none;
+}

commit 8f0c8cd56547d62db60b4f0e2c48b36fb709e64c
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 11:17:56 2010 -0400

    Move Dashboards under the "homepage" menu.

diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 6e7f6b0..27b106b 100755
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -69,7 +69,43 @@ my $query_string = sub {
 };
 
 if ( $request_path =~ qr{.*} ) {
-    Menu->child( home => title => loc('HomePage'), path => '/' );
+    my $home = Menu->child( home => title => loc('HomePage'), path => '/' );
+
+    my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards");
+    my $limit      = 7;
+
+    $m->callback( Dashboards   => \@dashboards,
+                  Limit        => \$limit,
+                  CallbackName => 'MassageDashboards',
+                );
+
+    my $more = 0;
+    if ( @dashboards > $limit ) {
+        $more = 1;
+        splice @dashboards, $limit;
+    }
+
+    my $position = 0;
+
+    if (@dashboards) {
+    my $dashes = Menu()->child('home');
+    for my $dash (@dashboards) {
+        $home->child('dashboard-' . $dash->id,
+                        title => $dash->Name,
+                        path => '/Dashboards/' . $dash->id . '/' . $dash->Name,
+                       );
+    }
+
+
+    if ($more) {
+        $dashes->child( title => loc('More...'),
+                              path  => 'Dashboards/index.html',
+                            );
+    }
+    }
+
+
+
     my $tickets = Menu->child( search => title => loc('Tickets'),
                                path => '/Search/Build.html' );
     $tickets->child( simple => title => loc('Simple Search') => path =>
@@ -97,6 +133,12 @@ if ( $request_path =~ qr{.*} ) {
         $dashes->child(
                 loc('Create') => path => "/Dashboards/Modify.html?Create=1" );
     }
+
+
+
+
+
+
     my $reports = $tools->child( loc('Reports'),
                                  path => '/Tools/Reports/index.html' );
     $reports->child( loc('Resolved by owner'),
@@ -685,37 +727,7 @@ if ( $request_path =~ qr'(?:Ticket|Search)/' ) {
 
 if ( $request_path =~ /^\/(?:index.html|$)/ ) {
 
-    my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards");
-    my $limit      = 7;
-
-    $m->callback( Dashboards   => \@dashboards,
-                  Limit        => \$limit,
-                  CallbackName => 'MassageDashboards',
-                );
-
-    my $more = 0;
-    if ( @dashboards > $limit ) {
-        $more = 1;
-        splice @dashboards, $limit;
-    }
-
-    my $position = 0;
-
-    for my $dash (@dashboards) {
-        PageMenu->child('dashboard-' . $dash->id,
-                        title => $dash->Name,
-                        path => 'Dashboards/' . $dash->id . '/' . $dash->Name,
-                       );
-    }
-
-    PageMenu()->child( home => title => loc('Home'), path => 'index.html' );
-
-    if ($more) {
-        $tabs->{"D-more"} = { title => loc('More'),
-                              path  => 'Dashboards/index.html',
-                            };
-    }
-
+    PageMenu()->child(edit => title => loc('Edit'), path => '/Prefs/MyRT.html');
 }
 
 

commit e9d4ab6ef202c1d42b1985349a1368726963eee6
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 12:35:51 2010 -0400

    Start abstracting away some cachebusting for dashboard attributes

diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 6642546..6576391 100755
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -224,7 +224,9 @@ Deletes all attributes with the matching name for this object.
 sub DeleteAttribute {
     my $self = shift;
     my $name = shift;
-    return $self->Attributes->DeleteEntry( Name => $name );
+    my ($val,$msg) =  $self->Attributes->DeleteEntry( Name => $name );
+    $self->ClearAttributes;
+    return ($val,$msg);
 }
 
 =head2 FirstAttribute NAME
@@ -245,6 +247,12 @@ sub FirstAttribute {
 }
 
 
+sub ClearAttributes {
+    my $self = shift;
+    delete $self->{'attributes'};
+
+}
+
 sub _Handle { return $RT::Handle }
 
 
@@ -352,7 +360,7 @@ sub LoadByCols {
     my $self = shift;
 
     # We don't want to hang onto this
-    delete $self->{'attributes'};
+    $self->ClearAttributes;
 
     return $self->SUPER::LoadByCols( @_ ) unless $self->_Handle->CaseSensitive;
 
diff --git a/lib/RT/SharedSetting.pm b/lib/RT/SharedSetting.pm
index 32a515d..89c2a98 100644
--- a/lib/RT/SharedSetting.pm
+++ b/lib/RT/SharedSetting.pm
@@ -258,11 +258,11 @@ where status is true upon success.
 
 sub Delete {
     my $self = shift;
-
     return (0, $self->loc("Permission denied"))
         unless $self->CurrentUserCanDelete;
 
     my ($status, $msg) = $self->{'Attribute'}->Delete;
+    $self->CurrentUser->ClearAttributes; # force the current user's attribute cache to be cleaned up
     if ($status) {
         return (1, $self->loc("Deleted [_1]", $self->ObjectName));
     } else {

commit f90f2fe626ecf2321858d3665e3b801b3c8a234f
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 12:36:43 2010 -0400

    a bit more menu reorganization

diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 27b106b..0343420 100755
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -70,15 +70,9 @@ my $query_string = sub {
 
 if ( $request_path =~ qr{.*} ) {
     my $home = Menu->child( home => title => loc('HomePage'), path => '/' );
-
     my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards");
     my $limit      = 7;
 
-    $m->callback( Dashboards   => \@dashboards,
-                  Limit        => \$limit,
-                  CallbackName => 'MassageDashboards',
-                );
-
     my $more = 0;
     if ( @dashboards > $limit ) {
         $more = 1;
@@ -279,25 +273,26 @@ if ( $request_path =~ qr{.*} ) {
                                                Object => $RT::System )
        )
     {
-        $about_me->child( settings => title => loc('Settings'),
+        my $settings = $about_me->child( settings => title => loc('Settings'),
                           path     => '/Prefs/Other.html', );
-        $about_me->child( about_me => title => loc('About me'),
+        $settings->child( about_me => title => loc('About me'),
                           path     => '/User/Prefs.html', );
-        $about_me->child( search_options => title => loc('Search options'),
+        $settings->child( search_options => title => loc('Search options'),
                           path => '/Prefs/SearchOptions.html', );
-        $about_me->child( myrt => title => loc('RT at a glance'),
+        $settings->child( myrt => title => loc('RT at a glance'),
                           path => '/Prefs/MyRT.html', );
-        $about_me->child( quicksearch => title => 'Quick search' => title =>
+        $settings->child( quicksearch => title => 'Quick search' => title =>
                               loc('Quick search'),
                           path => '/Prefs/Quicksearch.html'
                         );
 
+        my $search_menu = $settings->child( 'saved-searches' => title => 'Saved Searches');
         my $searches = [ $m->comp(
                           "/Search/Elements/SearchesForObject",
                           Object => RT::System->new( $session{'CurrentUser'} )) ];
         my $i = 0;
         for my $search (@$searches) {
-            $about_me->child( "search-" . $i++,
+            $search_menu->child( "search-" . $i++,
                       title => $search->[0],
                       path  => "/Prefs/Search.html?" . $query_string->(
                           name => ref( $search->[1] ) . '-' . $search->[1]->Id),

commit 3675e41332317907ff5311e9183a938fc76853b9
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 12:37:06 2010 -0400

    a bit more work on dashboard menuing and tests for the same

diff --git a/share/html/Dashboards/Modify.html b/share/html/Dashboards/Modify.html
index 28050a4..4e88024 100755
--- a/share/html/Dashboards/Modify.html
+++ b/share/html/Dashboards/Modify.html
@@ -86,6 +86,9 @@ my $tried_create = 0;
 # user went directly to Modify.html
 $Create = 1 if !$id;
 
+
+my $redirect_to ='/Dashboards/Modify.html';
+
 use RT::Dashboard;
 
 my $Dashboard = RT::Dashboard->new($session{'CurrentUser'});
@@ -112,6 +115,10 @@ else {
 
         push @results, $msg;
         $id = $Dashboard->Id;
+        if (!$Doashboard->CurrentUserCanSee) {
+            $redirect_to='/Dashboards/index.html';
+
+        }
     }
     else {
         my ($ok, $msg) = $Dashboard->LoadById($id);
@@ -142,26 +149,27 @@ if (!$Create && !$tried_create && $id && $ARGS{'Save'}) {
 }
 
 
+my $can_delete = $Dashboard->CurrentUserCanDelete;
+
+if (!$Create && !$tried_create && $id && $ARGS{'Delete'}) {
+    my ($ok, $msg) = $Dashboard->Delete();
+    if (!$ok) {
+             Abort(loc("Couldn't delete dashboard [_1]: [_2]", $id, $msg));
+             }
+
+    push @results, $msg;
+    $redirect_to = '/Dashboards/index.html';
+}
+
 # This code does automatic redirection if any updates happen. 
 $m->comp(
     '/Elements/MaybeRedirectForResults',
     Actions     => \@results,
-    Path        => 'Dashboards/Modify.html',
+    Path        => $redirect_to,
     id              => $id,
     ARGSRef     => \%ARGS
 );
 
-
-my $can_delete = $Dashboard->CurrentUserCanDelete;
-
-if (!$Create && !$tried_create && $id && $ARGS{'Delete'}) {
-    my ($ok, $msg) = $Dashboard->Delete();
-    $ok || Abort(loc("Couldn't delete dashboard [_1]: [_2]", $id, $msg));
-
-    # put the user back into a useful place with a message
-    RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Dashboards/index.html?Deleted=$id");
-
-}
 </%INIT>
 
 <%ARGS>
diff --git a/share/html/Dashboards/index.html b/share/html/Dashboards/index.html
index 2bda8be..505cc95 100644
--- a/share/html/Dashboards/index.html
+++ b/share/html/Dashboards/index.html
@@ -79,9 +79,6 @@ use RT::Dashboard;
 my $dashboards = $m->comp("/Dashboards/Elements/DashboardsForObjects");
 
 my @actions;
-if (defined $Deleted) {
-    push @actions, loc("Deleted dashboard [_1]", $Deleted);
-}
 
 my @personal_dashboards = sort { $a->Id <=> $b->Id } @{ $dashboards->{personal} || [] };
 my @system_dashboards = sort { $a->Id <=> $b->Id } @{ $dashboards->{system} || [] };
@@ -101,7 +98,4 @@ $m->callback(
     CallbackName       => 'MassageDashboards',
 );
 </%INIT>
-<%ARGS>
-$Deleted => undef
-</%ARGS>
 
diff --git a/t/web/dashboards.t b/t/web/dashboards.t
index b5d07d9..351c722 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 => 110;
+use RT::Test tests => 111;
 my ($baseurl, $m) = RT::Test->started_ok;
 
 my $url = $m->rt_base_url;
@@ -70,12 +70,16 @@ $m->content_lacks('Delete', "Delete button hidden because we are creating");
 $m->click_button(value => 'Create');
 
 $m->content_contains("Permission denied", "we lack SeeOwnDashboard");
+$m->warning_like(qr/Permission denied/, "got a permission denied warning when trying to see the dashboard");
+TODO: {
+    local $TODO = "Dashboard create-without-see permissions are crazy and this will be a real bear to fix";
+    $m->content_contains("Saved dashboard different dashboard");
+}
 $user_obj->PrincipalObj->GrantRight(Right => 'SeeOwnDashboard', Object => $RT::System);
-$m->reload;
+$m->get($url."Dashboards/index.html");
+$m->follow_link_ok({ text => 'different dashboard'});
 $m->content_lacks("Permission denied", "we now have SeeOwnDashboard");
-$m->content_contains("Saved dashboard different dashboard");
 $m->content_lacks('Delete', "Delete button hidden because we lack DeleteOwnDashboard");
-$m->warning_like(qr/Permission denied/, "got a permission denied warning when trying to see the dashboard");
 
 $m->get_ok($url."Dashboards/index.html");
 $m->content_contains("different dashboard", "we now have SeeOwnDashboard");
diff --git a/t/web/walk.t b/t/web/walk.t
index 90fd030..a062bcc 100644
--- a/t/web/walk.t
+++ b/t/web/walk.t
@@ -166,8 +166,8 @@ diag 'walk into /Approvals' if $ENV{TEST_VERBOSE};
 diag 'walk into /Prefs' if $ENV{TEST_VERBOSE};
 {
     for my $id (
-        'settings',    'about_me', 'search_options', 'myrt',
-        'quicksearch', 'search-0', 'search-1',       'search-2',
+        'settings',    'settings-about_me', 'settings-search_options', 'settings-myrt',
+        'settings-quicksearch', 'settings-saved-searches-search-0', 'settings-saved-searches-search-1',       'settings-saved-searches-search-2',
         'logout'
       )
     {

commit d713629bac11d29fa48563bb9103d16c59477f95
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 12:52:27 2010 -0400

    After custom field update, redirect back to the same page, so it's a GET
    rather than a POST

diff --git a/share/html/Admin/CustomFields/Modify.html b/share/html/Admin/CustomFields/Modify.html
index 5f26a21..6d89bd8 100644
--- a/share/html/Admin/CustomFields/Modify.html
+++ b/share/html/Admin/CustomFields/Modify.html
@@ -269,8 +269,23 @@ CustomFieldObj => $CustomFieldObj, CustomFieldValueObj => $cfv, ARGSRef => \%ARG
     }
 }
 
+
+
+
 $id = $CustomFieldObj->id if $CustomFieldObj->id;
 
+
+# This code does automatic redirection if any updates happen. 
+$m->comp(
+    '/Elements/MaybeRedirectForResults',
+    Actions     => \@results,
+    Path        => '/Admin/CustomFields/Modify.html',
+    id              => $id,
+    ARGSRef     => \%ARGS
+);
+
+
+
 my $EnabledChecked = qq[checked="checked"];
 $EnabledChecked = '' if $CustomFieldObj->Disabled;
 

commit c88390c38a984cc61b0deec5a7ca77abe85df179
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 13:09:21 2010 -0400

    typo fix

diff --git a/share/html/Dashboards/Modify.html b/share/html/Dashboards/Modify.html
index 4e88024..e1ac252 100755
--- a/share/html/Dashboards/Modify.html
+++ b/share/html/Dashboards/Modify.html
@@ -115,7 +115,7 @@ else {
 
         push @results, $msg;
         $id = $Dashboard->Id;
-        if (!$Doashboard->CurrentUserCanSee) {
+        if (!$Dashboard->id || ! $Dashboard->CurrentUserCanSee) {
             $redirect_to='/Dashboards/index.html';
 
         }

commit 3e57940b099dcdeeef5201d30cb11e590cc6e282
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 13:09:27 2010 -0400

    warning avoidance

diff --git a/lib/RT/SharedSetting.pm b/lib/RT/SharedSetting.pm
index 89c2a98..6a527a2 100644
--- a/lib/RT/SharedSetting.pm
+++ b/lib/RT/SharedSetting.pm
@@ -333,7 +333,7 @@ This does not deal with ACLs, this only looks at membership.
 sub IsVisibleTo {
     my $self    = shift;
     my $to      = shift;
-    my $privacy = $self->Privacy;
+    my $privacy = $self->Privacy || '';
 
     # if the privacies are the same, then they can be seen. this handles
     # a personal setting being visible to that user.

commit 3ce26ddf9f927b3e22f8cbba7c8e9f55f05a0f76
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 13:09:38 2010 -0400

    update tests to keep pace with new redirect behavior

diff --git a/t/web/cf_access.t b/t/web/cf_access.t
index cf7279f..3a741f6 100644
--- a/t/web/cf_access.t
+++ b/t/web/cf_access.t
@@ -28,7 +28,7 @@ diag "Create a CF";
 diag "apply the CF to General queue";
 my ( $cf, $cfid, $tid );
 {
-    $m->title_is(q/Created CustomField img/, 'admin-cf created');
+    $m->title_is(q/Editing CustomField img/, 'admin-cf created');
     $m->follow_link( id => 'tools-config-queues');
     $m->follow_link( text => 'General' );
     $m->title_is(q/Configuration for queue General/, 'admin-queue: general');

commit 7bc91ae00e68b44bf20ffaa4ad577742641377ed
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 13:27:44 2010 -0400

    Updated dashboard tests to better match the new world order

diff --git a/t/web/dashboards-groups.t b/t/web/dashboards-groups.t
index 668fa84..776e9b5 100644
--- a/t/web/dashboards-groups.t
+++ b/t/web/dashboards-groups.t
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
 
-use RT::Test nodata => 1, tests => 35;
+use RT::Test nodata => 1, tests => 33;
 my ($baseurl, $m) = RT::Test->started_ok;
 
 my $url = $m->rt_base_url;
@@ -70,7 +70,7 @@ $m->content_lacks('Delete', "Delete button hidden because we are creating");
 
 $m->click_button(value => 'Create');
 
-$m->content_contains("Permission denied", "we lack SeeGroupDashboard");
+$m->content_contains("created", "we lack SeeGroupDashboard, so we end up back at the index.");
 $user_obj->PrincipalObj->GrantRight(
     Right  => 'SeeGroupDashboard',
     Object => $inner_group,
@@ -89,7 +89,6 @@ is($dashboard->Name, "inner dashboard");
 is($dashboard->Privacy, 'RT::Group-' . $inner_group->Id, "correct privacy");
 is($dashboard->PossibleHiddenSearches, 0, "all searches are visible");
 
-$m->warning_like(qr/Permission denied/, "got a permission denied warning when trying to see the dashboard");
 
 $m->get_ok("/Dashboards/Modify.html?id=$id");
 $m->content_contains("inner dashboard", "we now have SeeGroupDashboard right");
diff --git a/t/web/dashboards.t b/t/web/dashboards.t
index 351c722..81765a2 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 => 111;
+use RT::Test tests => 108;
 my ($baseurl, $m) = RT::Test->started_ok;
 
 my $url = $m->rt_base_url;
@@ -68,13 +68,7 @@ $m->form_name('ModifyDashboard');
 $m->field("Name" => 'different dashboard');
 $m->content_lacks('Delete', "Delete button hidden because we are creating");
 $m->click_button(value => 'Create');
-
-$m->content_contains("Permission denied", "we lack SeeOwnDashboard");
-$m->warning_like(qr/Permission denied/, "got a permission denied warning when trying to see the dashboard");
-TODO: {
-    local $TODO = "Dashboard create-without-see permissions are crazy and this will be a real bear to fix";
-    $m->content_contains("Saved dashboard different dashboard");
-}
+$m->content_contains("Saved dashboard different dashboard");
 $user_obj->PrincipalObj->GrantRight(Right => 'SeeOwnDashboard', Object => $RT::System);
 $m->get($url."Dashboards/index.html");
 $m->follow_link_ok({ text => 'different dashboard'});
@@ -204,7 +198,7 @@ $m->content_contains('Delete', "Delete button shows because we have DeleteOwnDas
 
 $m->form_name('ModifyDashboard');
 $m->click_button(name => 'Delete');
-$m->content_contains("Deleted dashboard $id");
+$m->content_contains("Deleted dashboard");
 
 $m->get("/Dashboards/Modify.html?id=$id");
 $m->content_lacks("different dashboard", "dashboard was deleted");

commit 03f5314250af2345739c3ebaf39f726421de346b
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 2 13:50:50 2010 -0400

    Modifying a group now redirects after submit

diff --git a/share/html/Admin/Groups/Modify.html b/share/html/Admin/Groups/Modify.html
index 0ec934e..d86b051 100755
--- a/share/html/Admin/Groups/Modify.html
+++ b/share/html/Admin/Groups/Modify.html
@@ -160,6 +160,19 @@ if  ( ($SetEnabled) and ( $Disabled != $Group->Disabled) ) {
     push @results, $msg;
 }
 
+# This code does automatic redirection if any updates happen. 
+$m->comp(
+    '/Elements/MaybeRedirectForResults',
+    Actions     => \@results,
+    Path        => '/Admin/Groups/Modify.html',
+    id              => $id,
+    ARGSRef     => \%ARGS
+);
+
+
+
+
+
 unless ($Group->Disabled()) {
     $EnabledChecked ='checked="checked"';
 }

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


More information about the Rt-commit mailing list