[Rt-commit] r2314 - in rt/branches/QUEBEC-EXPERIMENTAL: etc html/Elements html/Prefs html/User/Elements html/Widgets lib/t/regression

clkao at bestpractical.com clkao at bestpractical.com
Tue Mar 8 12:11:45 EST 2005


Author: clkao
Date: Tue Mar  8 12:11:43 2005
New Revision: 2314

Modified:
   rt/branches/QUEBEC-EXPERIMENTAL/etc/initialdata
   rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/MyRT
   rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/Quicksearch
   rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowSearch
   rt/branches/QUEBEC-EXPERIMENTAL/html/Prefs/MyRT.html
   rt/branches/QUEBEC-EXPERIMENTAL/html/Prefs/Quicksearch.html
   rt/branches/QUEBEC-EXPERIMENTAL/html/Prefs/Search.html
   rt/branches/QUEBEC-EXPERIMENTAL/html/User/Elements/Tabs
   rt/branches/QUEBEC-EXPERIMENTAL/html/Widgets/SelectionBox
   rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/17custom_search.t
   rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/18custom_frontpage.t
Log:
Misc UI changes, and according test tweaks.

Modified: rt/branches/QUEBEC-EXPERIMENTAL/etc/initialdata
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/etc/initialdata	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/etc/initialdata	Tue Mar  8 12:11:43 2005
@@ -609,15 +609,15 @@
         Order   => 'DESC',
 	SummaryRows => 10, },
     },
-    { Name => 'My RT',
-      Description => 'My RT',
+    { Name => 'HomepageSettings',
+      Description => 'HomepageSettings',
       Content =>
-      { main =>
+      { 'body' => # loc
 	[ { type => 'system', name => 'My Tickets' },
 	  { type => 'system', name => 'My Requests' },
 	  { type => 'component',  name => 'QuickCreate'},
 	],
-        right =>
+        'summary' => # loc
 	[ { type => 'component', name => 'Quicksearch' },
 	  { type => 'component', name => 'MySupportQueues' },
 	  { type => 'component', name => 'MyAdminQueues' },

Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/MyRT
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/MyRT	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/MyRT	Tue Mar  8 12:11:43 2005
@@ -48,7 +48,7 @@
 <TR VALIGN=TOP>
 <TD WIDTH=70% class="boxcontainer">
 
-% for my $portlet (@{$portlets->{main}}) {
+% for my $portlet (@{$portlets->{body}}) {
 <% _show($portlet) %>
 <BR>
 % }
@@ -57,7 +57,7 @@
 </TD>
 <TD class="boxcontainer">
 
-% for my $portlet (@{$portlets->{right}}) {
+% for my $portlet (@{$portlets->{summary}}) {
 <% _show($portlet) %>
 <BR>
 % }
@@ -65,8 +65,6 @@
 </TD>
 </TR>
 </TABLE>
-<a href="<%$RT::WebPath%>/Prefs/MyRT.html"><&|/l&>Customize</&></a>
-
 
 <%INIT>
 
@@ -74,9 +72,9 @@
     qw(QuickCreate Quicksearch MyAdminQueues MySupportQueues RefreshHomepage);
 
 unless (exists $session{'my_rt_portlets'}) {
-    my ($d_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('My RT');
+    my ($d_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings');
     my $user = $session{'CurrentUser'}->UserObj;
-    $session{'my_rt_portlets'} = $user->Preferences('My RT', $d_portlets->Content);
+    $session{'my_rt_portlets'} = $user->Preferences('HomepageSettings', $d_portlets->Content);
 }
 
 my $portlets = $session{'my_rt_portlets'};

Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/Quicksearch
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/Quicksearch	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/Quicksearch	Tue Mar  8 12:11:43 2005
@@ -44,7 +44,7 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <&|/Elements/TitleBox, title => loc("Quick search"), bodyclass => "",
-   titleright => loc("Customize"), titleright_href => $RT::WebPath.'/Prefs/Quicksearch.html' &>
+#   titleright => loc("Customize"), titleright_href => $RT::WebPath.'/Prefs/Quicksearch.html' &>
 <& /Elements/QueueSummary,
    cache => 'quick_search_queues',
    queue_filter => sub { $_->CurrentUserHasRight('ShowTicket') && !exists $unwanted->{$_->Name} },

Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowSearch
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowSearch	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowSearch	Tue Mar  8 12:11:43 2005
@@ -46,8 +46,8 @@
 <&|/Elements/TitleBox,
     title => loc($search->Description, $rows),
     title_href => "Search/Results.html".$QueryString,
-    titleright => loc('Customize'),
-    titleright_href => $customize &>
+#    titleright => loc('Customize'),
+#    titleright_href => $customize &>
 <& /Elements/TicketList, %$SearchArg,
         Rows => $rows,
         ShowNavigation => 0
@@ -72,7 +72,7 @@
 }
 else {
     ($search) = RT::System->new($session{'CurrentUser'})->Attributes->Named('Search - '.$Name);
-    unless ($search->Id) {
+    unless ($search && $search->Id) {
 	$m->out ("Predefined search $Name not found");
 	return;
     }

Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Prefs/MyRT.html
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Prefs/MyRT.html	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Prefs/MyRT.html	Tue Mar  8 12:11:43 2005
@@ -44,8 +44,8 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <& /Elements/Header, Title => $title &>
-<& /Ticket/Elements/Tabs, 
-    current_toptab => '',
+<& /User/Elements/Tabs,
+    current_tab => 'Prefs/MyRT.html',
     Title => $title
 &>
 
@@ -53,20 +53,34 @@
 
 <& /Elements/ListActions, actions => \@actions &>
 <a href="<% $ARGS{'referer'} %>"><&|/l&>Go back</&></a><br>
+<p>
+<&|/Elements/TitleBox, title => loc('Predefined searches'), bodyclass => "" &>
+<ul>
+<li><a href="<% $RT::WebPath %>/Prefs/Quicksearch.html"><&|/l&>Quick search</&></a></li>
+% for my $search (@sys_searches) {
+<li><a href="<% $RT::WebPath.'/Prefs/Search.html?'.$m->comp('/Elements/QueryString', name => ref($search->[1]).'-'.$search->[1]->Id) %>"><% $search->[0] %></a></li>
+% }
+</ul>
+</&>
+
+<&|/Elements/TitleBox, title => loc('Quick search'), bodyclass => "" &>
+</&>
 
 % for my $pane (@panes) {
+<&|/Elements/TitleBox, title => loc('RT at a glance').': '.loc($pane->{Name}), bodyclass => "" &>
 <& /Widgets/SelectionBox:show, self => $pane &>
+</&>
 % }
 <%INIT>
 my @actions;
 
-my $title = loc("Customize").' '.loc("My RT");
+my $title = loc("Customize").' '.loc("RT at a glance");
 my $user = $session{'CurrentUser'}->UserObj;
 $ARGS{'referer'} ||= $ENV{'HTTP_REFERER'};
 
 unless (exists $session{'my_rt_portlets'}) {
-    my ($d_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('My RT');
-    $session{'my_rt_portlets'} = $user->Preferences('My RT', $d_portlets->Content);
+    my ($d_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings');
+    $session{'my_rt_portlets'} = $user->Preferences('HomepageSettings', $d_portlets->Content);
 }
 
 my $portlets = $session{'my_rt_portlets'};
@@ -88,11 +102,13 @@
 $groups->LimitToUserDefinedGroups;
 $groups->WithMember(PrincipalId => $session{'CurrentUser'}->Id,
                     Recursively => 1);
+my @sys_searches;
 for my $object ($sys, $user, @{$groups->ItemsArrayRef()}) {
     for ($m->comp("/Search/Elements/SearchesForObject", Object => $object)) {
 	my ($desc, $search) = @$_;
 	if ($object eq $sys) {
-	    push @items, ["system-$desc", $desc],
+	    push @items, ["system-$desc", $desc];
+	    push @sys_searches, [$desc, $search];
 	}
 	else {
 	    my $oid = ref($object).'-'.$object->Id.'-SavedSearch-'.$search->Id;
@@ -103,7 +119,7 @@
 
 my %item_map = map {$_->[0] => $_->[1]} @items;
 my @panes;
-for my $pane ('main', 'right') {
+for my $pane ('body', 'summary') {
     push @panes,
 	$m->comp ('/Widgets/SelectionBox:new',
 		  Action => 'MyRT.html',
@@ -116,7 +132,7 @@
 				   { type => $1,
 				     name => $2,
 				 }} @{$sel->{Current}}];
-			$user->SetPreferences('My RT', $portlets);
+			$user->SetPreferences('HomepageSettings', $portlets);
 			push @actions, loc ('Preferences saved for [_1].', $pane);
 			delete $session{'my_rt_portlets'};
 

Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Prefs/Quicksearch.html
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Prefs/Quicksearch.html	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Prefs/Quicksearch.html	Tue Mar  8 12:11:43 2005
@@ -44,8 +44,8 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <& /Elements/Header, Title => $title &>
-<& /Ticket/Elements/Tabs, 
-#    current_tab => "Search/Build.html".$QueryString, 
+<& /User/Elements/Tabs,
+    current_tab => 'Prefs/MyRT.html',
     Title => $title
 &>
 <& /Elements/ListActions, actions => \@actions &>

Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Prefs/Search.html
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Prefs/Search.html	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Prefs/Search.html	Tue Mar  8 12:11:43 2005
@@ -44,12 +44,19 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <& /Elements/Header, Title => $title &>
-<& /Ticket/Elements/Tabs, 
-#    current_tab => "Search/Build.html".$QueryString, 
-    Title => $title, %$SearchArg
+<& /User/Elements/Tabs,
+    current_tab => 'Prefs/MyRT.html',
+    Title => $title
 &>
 <& /Elements/ListActions, actions => \@actions &>
 <a href="<% $ARGS{'referer'} %>"><&|/l&>Go back</&></a><br>
+% if ($session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser')) {
+<&|/l&>You can also edit the predefined search itself</&>:
+<a href="<% $RT::WebPath.'/Search/Build.html?'.
+	$m->comp('/Elements/QueryString',
+		 LoadSavedSearch => 'RT::System-1-SavedSearch-'.$id) %>"><% $search->Name %></a>
+% }
+<br>
 <FORM METHOD="POST" ACTION="Search.html" NAME="BuildQuery">
 <input type=hidden name=name value="<%$ARGS{name}%>">
 <input type=hidden name=referer value="<%$ARGS{referer}%>">
@@ -74,7 +81,7 @@
 
 my $search = $class->new ($session{'CurrentUser'});
 $search->LoadById ($id);
-$title .= loc ($search->Description, 'N');
+$title .= loc ($search->Description, loc ('"N"'));
 my $user = $session{'CurrentUser'}->UserObj;
 my $SearchArg = $user->Preferences($search, $search->Content);
 for (@fields) {

Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/User/Elements/Tabs
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/User/Elements/Tabs	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/User/Elements/Tabs	Tue Mar  8 12:11:43 2005
@@ -59,6 +59,9 @@
 	       h => { title => loc('Delegation'),
 			   path => 'User/Delegation.html',
 			 },
+	       r => { title => loc('RT at a glance'),
+			   path => 'Prefs/MyRT.html',
+			 },
 	     };
 
   foreach my $tab (sort keys %{$tabs}) {

Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Widgets/SelectionBox
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Widgets/SelectionBox	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Widgets/SelectionBox	Tue Mar  8 12:11:43 2005
@@ -166,7 +166,6 @@
 </%method>
 
 <%method show>
-<h2><% loc($name) %></h2>
 <FORM METHOD="POST" ACTION="<%$self->{Action}%>" name="SelectionBox-<% $name %>" id="SelectionBox-<% $name %>">
 <input type="hidden" name="<% $self->{Name} %>-Submit" value="1">
 <& SelectionBox:current, self => $self &>

Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/17custom_search.t
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/17custom_search.t	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/17custom_search.t	Tue Mar  8 12:11:43 2005
@@ -29,8 +29,9 @@
 like ($t_link->url, qr/$id/, 'link to the ticket we created');
 
 $m->content_lacks ('customsearch at localhost', 'requestor not displayed ');
-
-my ($cus_hp, undef, $cus_qs) = $m->find_all_links( text => "Customize" );
+$m->get ( BaseURL.'Prefs/MyRT.html' );
+my $cus_hp = $m->find_link( text => "My Tickets" );
+my $cus_qs = $m->find_link( text => "Quick search" );
 $m->get ($cus_hp);
 $m->content_like (qr'highest priority tickets');
 
@@ -43,7 +44,7 @@
 $m->form_name ('BuildQuery');
 $m->click_button (name => 'Save');
 
-$m->follow_link (text => 'Go back') or die;
+$m->get( BaseURL );
 $m->content_contains ('customsearch at localhost', 'requestor now displayed ');
 
 
@@ -57,7 +58,7 @@
 $m->form_name ('BuildQuery');
 $m->click_button (name => 'Save');
 
-$m->follow_link (text => 'Go back') or die;
+$m->get( BaseURL );
 $m->content_lacks ('customsearch at localhost', 'requestor not displayed ');
 
 
@@ -73,7 +74,7 @@
 $m->untick('Want-General', '1');
 $m->click_button (name => 'Save');
 
-$m->follow_link (text => 'Go back') or die;
+$m->get( BaseURL );
 is ($#{$m->find_all_links( text => "General" )}, $nlinks - 1,
     'General gone from quicksearch list');
 
@@ -83,6 +84,6 @@
 $m->tick('Want-General', '1');
 $m->click_button (name => 'Save');
 
-$m->follow_link (text => 'Go back') or die;
+$m->get( BaseURL );
 is ($#{$m->find_all_links( text => "General" )}, $nlinks,
     'General back in quicksearch list');

Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/18custom_frontpage.t
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/18custom_frontpage.t	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/t/regression/18custom_frontpage.t	Tue Mar  8 12:11:43 2005
@@ -21,28 +21,28 @@
 $m->content_like(qr/Logout/, 'we did log in');
 
 $m->get ( BaseURL.'Prefs/MyRT.html' );
-$m->form_name ('SelectionBox-main');
+$m->form_name ('SelectionBox-body');
 # can't use submit form for mutli-valued select as it uses set_fields
-$m->field ('main-Selected' => ['component-QuickCreate', 'system-My Requests', 'system-My Tickets']);
+$m->field ('body-Selected' => ['component-QuickCreate', 'system-My Requests', 'system-My Tickets']);
 $m->click_button (name => 'remove');
-$m->form_name ('SelectionBox-main');
+$m->form_name ('SelectionBox-body');
 $m->click_button (name => 'submit');
 $m->get ( BaseURL );
-$m->content_lacks ('highest priority tickets');
+$m->content_lacks ('highest priority tickets', 'remove everything from body pane');
 
 $m->get ( BaseURL.'Prefs/MyRT.html' );
-$m->form_name ('SelectionBox-main');
-$m->field ('main-Available' => ['component-QuickCreate', 'system-My Requests', 'system-My Tickets']);
+$m->form_name ('SelectionBox-body');
+$m->field ('body-Available' => ['component-QuickCreate', 'system-My Requests', 'system-My Tickets']);
 $m->click_button (name => 'add');
 
-$m->form_name ('SelectionBox-main');
-$m->field ('main-Selected' => ['component-QuickCreate']);
+$m->form_name ('SelectionBox-body');
+$m->field ('body-Selected' => ['component-QuickCreate']);
 $m->click_button (name => 'movedown');
 
-$m->form_name ('SelectionBox-main');
+$m->form_name ('SelectionBox-body');
 $m->click_button (name => 'movedown');
 
-$m->form_name ('SelectionBox-main');
+$m->form_name ('SelectionBox-body');
 $m->click_button (name => 'submit');
 $m->get ( BaseURL );
-$m->content_like (qr'highest priority tickets');
+$m->content_like (qr'highest priority tickets', 'adds them back');


More information about the Rt-commit mailing list