[Rt-commit] rt branch, 4.2/queue-summary-refactoring, repushed
Ruslan Zakirov
ruz at bestpractical.com
Wed Aug 28 11:37:20 EDT 2013
The branch 4.2/queue-summary-refactoring was deleted and repushed:
was bdf34922141c4e3406527d86bd6f1b617483873d
now 864f1ed6db0263aefbb6b7466ec8225d66b85c9c
1: da61ec9 ! 1: 9a22d37 rename Prefs/Quicksearch.html as it going to be more generic
@@ -1,6 +1,32 @@
Author: Ruslan Zakirov <ruz at bestpractical.com>
rename Prefs/Quicksearch.html as it going to be more generic
+
+diff --git a/share/html/Elements/Quicksearch b/share/html/Elements/Quicksearch
+--- a/share/html/Elements/Quicksearch
++++ b/share/html/Elements/Quicksearch
+@@
+ title => loc("Quick search"),
+ bodyclass => "",
+ titleright => loc("Edit"),
+- titleright_href => RT->Config->Get('WebPath').'/Prefs/Quicksearch.html',
++ titleright_href => RT->Config->Get('WebPath').'/Prefs/QueueSummary.html',
+ &>
+ <& $comp,
+ queue_filter => sub { $_->CurrentUserHasRight('ShowTicket') && !exists $unwanted->{$_->Name} },
+
+diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
+--- a/share/html/Elements/Tabs
++++ b/share/html/Elements/Tabs
+@@
+ title => loc('Dashboards in menu'),
+ path => '/Prefs/DashboardsInMenu.html',
+ );
+- $settings->child( quicksearch => title => loc('Quick search'), path => '/Prefs/Quicksearch.html' );
++ $settings->child( quicksearch => title => loc('Quick search'), path => '/Prefs/QueueSummary.html' );
+
+ my $search_menu = $settings->child( 'saved-searches' => title => loc('Saved Searches') );
+ my $searches = [ $m->comp( "/Search/Elements/SearchesForObject",
diff --git a/share/html/Prefs/QueueSummary.html b/share/html/Prefs/QueueSummary.html
new file mode 100644
@@ -59,7 +85,7 @@
+&>
+<& /Elements/ListActions, actions => \@actions &>
+<h1><&|/l&>Select queues to be displayed on the "RT at a glance" page</&></h1>
-+<form method="post" action="Quicksearch.html" name="Preferences">
++<form method="post" action="QueueSummary.html" name="Preferences">
+<ul>
+% for my $queue (@queues) {
+<li><input type="checkbox" class="checkbox" id="Want-<%$queue->Name%>" name="Want-<%$queue->Name%>" value="1"
2: a502544 ! 2: f1e0501 RT::SQL->Quote helper
@@ -1,6 +1,10 @@
Author: Ruslan Zakirov <ruz at bestpractical.com>
RT::SQL->Quote helper
+
+ We could probably use DBI->quote instead, but implementation
+ depends on DBD (database specific) and in theory a DB may has
+ incompatible escaping rules.
diff --git a/lib/RT/SQL.pm b/lib/RT/SQL.pm
--- a/lib/RT/SQL.pm
@@ -9,6 +13,12 @@
return join ' or ', @res;
}
++=head2 Quote
++
++Quotes a string for TicketSQL queries. Changes argument in void context.
++
++=cut
++
+sub Quote {
+ my $v = defined(wantarray)? \"$_[1]" : \$_[1];
+ $$v =~ s{(['\\])}{\\$1}g;
3: 5549890 ! 3: 63868ec merge common code in QueueSummary* into /Elements/QueueSummary
@@ -217,9 +217,10 @@
</td>
% }
</tr>
-@@
- </table>
% }
+-</table>
+ % }
++</table>
<%INIT>
-my $build_search_link = sub {
- my ($queue_name, $extra_query) = @_;
@@ -229,19 +230,19 @@
- . "/Search/Results.html?Query="
- . $m->interp->apply_escapes("Queue = '$queue_name' AND $extra_query", 'u');
-};
--
++return unless @queues && @statuses;
+
-my $link_all = sub {
- my ($queue, $all_statuses) = @_;
- return $build_search_link->($queue->{Name}, "(".join(" OR ", map "Status = '$_'", @$all_statuses).")");
-};
-+return unless @queues && @statuses;
++my $max = 0;
-my $link_status = sub {
- my ($queue, $status) = @_;
- return $build_search_link->($queue->{Name}, "Status = '$status'");
-};
-+my $max = 0;
-
+-
-$m->callback(
- CallbackName => 'LinkBuilders',
- build_search_link => \$build_search_link,
@@ -272,19 +273,10 @@
-} grep $_, @queues;
-
-my %lifecycle;
--
+
-for my $queue (@queues) {
- my $cycle = RT::Lifecycle->Load( Name => $queue->{'Lifecycle'} );
- $lifecycle{ lc $cycle->Name } = $cycle;
--}
-
--unless (@statuses) {
-- my %seen;
-- foreach my $set ( 'initial', 'active' ) {
-- foreach my $lifecycle ( map $lifecycle{$_}, sort keys %lifecycle ) {
-- push @statuses, grep !$seen{ lc $_ }++, $lifecycle->Valid($set);
-- }
-- }
+ $groups{ $cycle_name } = {
+ cycle => $cycle,
+ statuses => [ grep $cycle->IsValid( $_), @statuses ],
@@ -294,6 +286,15 @@
+ if $max < @{ $groups{ $cycle_name }{'statuses'} };
}
+-unless (@statuses) {
+- my %seen;
+- foreach my $set ( 'initial', 'active' ) {
+- foreach my $lifecycle ( map $lifecycle{$_}, sort keys %lifecycle ) {
+- push @statuses, grep !$seen{ lc $_ }++, $lifecycle->Valid($set);
+- }
+- }
+-}
+-
-my $data = {};
-my $statuses = {};
-
4: 78cb695 ! 4: 8cf9625 use new QueueSummary
@@ -53,7 +53,7 @@
title => loc("Quick search"),
bodyclass => "",
titleright => loc("Edit"),
-- titleright_href => RT->Config->Get('WebPath').'/Prefs/Quicksearch.html',
+- titleright_href => RT->Config->Get('WebPath').'/Prefs/QueueSummary.html',
+ titleright_href => RT->Config->Get('WebPath').'/Prefs/QueueSummary.html?EditUnwanted=1',
&>
-<& $comp,
5: 123d78a ! 5: f6b030f new preferences UI for all portlets based on QueueSummary
@@ -15,31 +15,30 @@
+
<& /Elements/ListActions, actions => \@actions &>
-<h1><&|/l&>Select queues to be displayed on the "RT at a glance" page</&></h1>
--<form method="post" action="Quicksearch.html" name="Preferences">
+
-+<form method="post" action="QueueSummary.html" name="Preferences">
+ <form method="post" action="QueueSummary.html" name="Preferences">
+<input type="hidden" class="hidden" name="Pref" value="<% $Pref %>" \>
+<input type="hidden" class="hidden" name="EditUnwanted" value="<% $EditUnwanted %>" \>
+
+<h1><&|/l&>Select table preferences</&></h1>
+
-+<input type="checkbox" class="checkbox" name="ShowEmptyRows" value="1" \
++<label><input type="checkbox" class="checkbox" name="ShowEmptyRows" value="1" \
+% if ( $preference->{'ShowEmptyRows'} ) {
+checked="checked" \
+% }
-+/><&|/l&>Show rows with all zeros</&><br />
++/><&|/l&>Show rows with all zeros</&></label><br />
+
-+<input type="checkbox" class="checkbox" name="ShowEmptyColumns" value="1" \
++<label><input type="checkbox" class="checkbox" name="ShowEmptyColumns" value="1" \
+% if ( $preference->{'ShowEmptyColumns'} ) {
+checked="checked" \
+% }
-+/><&|/l&>Show columns with all zeros</&><br />
++/><&|/l&>Show columns with all zeros</&></label><br />
+
-+<input type="checkbox" class="checkbox" name="SplitByLifecycle" value="1" \
++<label><input type="checkbox" class="checkbox" name="SplitByLifecycle" value="1" \
+% if ( $preference->{'SplitByLifecycle'} ) {
+checked="checked" \
+% }
-+/><&|/l&>Split into groups with different status sets (lifecycles)</&><br />
++/><&|/l&>Split into groups with different status sets (lifecycles)</&></label><br />
+
+% if ( $EditUnwanted ) {
+<h1><&|/l&>Select queues to be displayed</&></h1>
@@ -118,7 +117,7 @@
+ Want => \@Want,
+ );
+
-+ @queues = grep { $right? $_->CurrentUserHasRight('ShowTicket') : 1 } @{ $Queues->ItemsArrayRef };
++ @queues = grep { $right? $_->CurrentUserHasRight( $right ) : 1 } @{ $Queues->ItemsArrayRef };
+}
+
+if ( $Save ) {
6: d2bb48d ! 6: e825b16 drop "quicksearch" preferences tab
@@ -12,7 +12,7 @@
title => loc('Dashboards in menu'),
path => '/Prefs/DashboardsInMenu.html',
);
-- $settings->child( quicksearch => title => loc('Quick search'), path => '/Prefs/Quicksearch.html' );
+- $settings->child( quicksearch => title => loc('Quick search'), path => '/Prefs/QueueSummary.html' );
my $search_menu = $settings->child( 'saved-searches' => title => loc('Saved Searches') );
my $searches = [ $m->comp( "/Search/Elements/SearchesForObject",
7: bdf3492 ! 7: 6f84294 adjust tests for new QueueSummary
@@ -37,3 +37,4 @@
$m->click_button (name => 'Save');
$m->get( $url );
+
--: ------- > 8: e109635 update license tag
--: ------- > 9: cdcb101 make split by lifecycle default
--: ------- > 10: 0ded704 make default to show empty rows/columns
--: ------- > 11: 864f1ed upgrade script for old quicksearch preferences
More information about the Rt-commit
mailing list