[Rt-commit] r2329 - in rt/branches/QUEBEC-EXPERIMENTAL: etc html/Elements html/Prefs

clkao at bestpractical.com clkao at bestpractical.com
Wed Mar 9 13:04:48 EST 2005


Author: clkao
Date: Wed Mar  9 13:04:48 2005
New Revision: 2329

Modified:
   rt/branches/QUEBEC-EXPERIMENTAL/etc/RT_Config.pm.in
   rt/branches/QUEBEC-EXPERIMENTAL/etc/initialdata
   rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowSearch
   rt/branches/QUEBEC-EXPERIMENTAL/html/Prefs/MyRT.html
Log:
Make SummaryRow a user preference.

Modified: rt/branches/QUEBEC-EXPERIMENTAL/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/etc/RT_Config.pm.in	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/etc/RT_Config.pm.in	Wed Mar  9 13:04:48 2005
@@ -366,6 +366,11 @@
 
 Set($MaxInlineBody, 13456);
 
+# $DefaultSummaryRows is default number of rows displayed in for search
+# results on the frontpage.
+
+Set($DefaultSummaryRows, 10);
+
 # @MasonParameters is the list of parameters for the constructor of
 # HTML::Mason's Apache or CGI Handler.  This is normally only useful
 # for debugging, eg. profiling individual components with:

Modified: rt/branches/QUEBEC-EXPERIMENTAL/etc/initialdata
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/etc/initialdata	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/etc/initialdata	Wed Mar  9 13:04:48 2005
@@ -595,8 +595,7 @@
       { Format => "'<a href=\"__WebPath__/Ticket/Display.html?id=__id__\">__id__</a>/TITLE:#', '<a href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__Subject__</a>/TITLE:Subject', Priority, QueueName, ExtendedStatus",
         Query   => " Owner = '__CurrentUser__' AND ( Status = 'new' OR Status = 'open')",
         OrderBy => 'Priority',
-        Order   => 'DESC',
-	SummaryRows => 10, },
+        Order   => 'DESC' },
     },
     { Name => 'Search - My Requests',
       Description => '[_1] newest unowned tickets', # loc
@@ -606,8 +605,7 @@
 
         Query   => " Owner = 'Nobody' AND ( Status = 'new' OR Status = 'open')",
         OrderBy => 'Created',
-        Order   => 'DESC',
-	SummaryRows => 10, },
+        Order   => 'DESC' },
     },
     { Name => 'HomepageSettings',
       Description => 'HomepageSettings',

Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowSearch
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowSearch	(original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowSearch	Wed Mar  9 13:04:48 2005
@@ -80,7 +80,7 @@
     $customize = $RT::WebPath.'/Prefs/Search.html?'.$m->comp('/Elements/QueryString', name => ref($search).'-'.$search->Id)
 }
 
-my $rows = $SearchArg->{SummaryRows} || 10;
+my $rows = $user->Preferences('SummaryRows', $RT::DefaultSummaryRows);
 $SearchArg->{'Query'} =~ s/__CurrentUser__/$session{'CurrentUser'}->Id/ge;
 $SearchArg->{'Format'} =~ s/__WebPath__/$RT::WebPath/g;
 my $QueryString = '?' . $m->comp('/Elements/QueryString',

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	Wed Mar  9 13:04:48 2005
@@ -61,7 +61,12 @@
 % }
 </ul>
 </&>
-
+<&|/Elements/TitleBox, title => loc('Options'), bodyclass => "" &>
+<form method="POST" action="MyRT.html">
+<&|/l&>Summary rows</&>:<input name="SummaryRows" value="<% $ARGS{SummaryRows} %>">
+<& /Elements/Submit, Caption => loc("Save"), Label => loc('Save'), Name => 'Save' &>
+</form>
+</&>
 % for my $pane (@panes) {
 <&|/Elements/TitleBox, title => loc('RT at a glance').': '.loc($pane->{Name}), bodyclass => "" &>
 <& /Widgets/SelectionBox:show, self => $pane &>
@@ -78,6 +83,15 @@
     $session{'my_rt_portlets'} = $user->Preferences('HomepageSettings', $d_portlets->Content);
 }
 
+if ($ARGS{SummaryRows}) {
+    $user->SetPreferences('SummaryRows', $ARGS{SummaryRows});
+    push @actions, loc ('Preferences saved for [_1].', loc('summary rows'));
+}
+else {
+    $ARGS{SummaryRows} = $user->Preferences('SummaryRows', $RT::DefaultSummaryRows);
+}
+
+
 my $portlets = $session{'my_rt_portlets'};
 
 my %allowed_components = map {$_ => 1}
@@ -87,18 +101,19 @@
 push @items, map {["component-$_", $_]} sort keys %allowed_components;
 
 my $sys = RT::System->new($session{'CurrentUser'});
+my @objs = ($sys);
 
-unless ($session{'CurrentUser'}->HasRight( Right => 'LoadSavedSearch',
-					   Object=> $RT::System )) {
-    return;
+if ($session{'CurrentUser'}->HasRight( Right => 'LoadSavedSearch',
+				       Object=> $RT::System )) {
+    my $groups = RT::Groups->new($session{'CurrentUser'});
+    $groups->LimitToUserDefinedGroups;
+    $groups->WithMember(PrincipalId => $session{'CurrentUser'}->Id,
+			Recursively => 1);
+    push @objs, ($user, @{$groups->ItemsArrayRef()});
 }
 
-my $groups = RT::Groups->new($session{'CurrentUser'});
-$groups->LimitToUserDefinedGroups;
-$groups->WithMember(PrincipalId => $session{'CurrentUser'}->Id,
-                    Recursively => 1);
 my @sys_searches;
-for my $object ($sys, $user, @{$groups->ItemsArrayRef()}) {
+for my $object (@objs) {
     for ($m->comp("/Search/Elements/SearchesForObject", Object => $object)) {
 	my ($desc, $search) = @$_;
 	if ($object eq $sys) {


More information about the Rt-commit mailing list