rt 4.2.16
[freeside.git] / rt / share / html / Dashboards / Queries.html
index 1a1066b..8ac1475 100644 (file)
@@ -1,40 +1,40 @@
 %# BEGIN BPS TAGGED BLOCK {{{
-%# 
+%#
 %# COPYRIGHT:
-%# 
-%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-%#                                          <jesse@bestpractical.com>
-%# 
+%#
+%# This software is Copyright (c) 1996-2019 Best Practical Solutions, LLC
+%#                                          <sales@bestpractical.com>
+%#
 %# (Except where explicitly superseded by other copyright notices)
-%# 
-%# 
+%#
+%#
 %# LICENSE:
-%# 
+%#
 %# This work is made available to you under the terms of Version 2 of
 %# the GNU General Public License. A copy of that license should have
 %# been provided with this software, but in any event can be snarfed
 %# from www.gnu.org.
-%# 
+%#
 %# This work is distributed in the hope that it will be useful, but
 %# WITHOUT ANY WARRANTY; without even the implied warranty of
 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 %# General Public License for more details.
-%# 
+%#
 %# You should have received a copy of the GNU General Public License
 %# along with this program; if not, write to the Free Software
 %# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 %# 02110-1301 or visit their web page on the internet at
 %# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%# 
-%# 
+%#
+%#
 %# CONTRIBUTION SUBMISSION POLICY:
-%# 
+%#
 %# (The following paragraph is not intended to limit the rights granted
 %# to you to modify and distribute this software under the terms of
 %# the GNU General Public License and is only of importance to you if
 %# you choose to contribute your changes and enhancements to the
 %# community by submitting them to Best Practical Solutions, LLC.)
-%# 
+%#
 %# By intentionally submitting any modifications, corrections or
 %# derivatives to this work, or any other work intended for use with
 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
 %# royalty-free, perpetual, license to use, copy, create derivative
 %# works based on those contributions, and sublicense and distribute
 %# those contributions and any derivatives thereof.
-%# 
+%#
 %# END BPS TAGGED BLOCK }}}
 <& /Elements/Header, Title => $title &>
-<& /Dashboards/Elements/Tabs,
-    current_subtab => $current_subtab,
-    Title => $title,
-    DashboardObj => $Dashboard &>
-
-<& /Widgets/SelectionBox:header, nojs => 1 &>
+<& /Elements/Tabs &>
 
 <& /Elements/ListActions, actions => \@results &>
 
@@ -68,7 +63,7 @@
 
 <&| /Widgets/TitleBox, title => $pane->{DisplayName} &>
 % my ( $pane_name ) = $pane->{Name} =~ /Searches-(.+)/;
-    <& /Widgets/SelectionBox:show, self => $pane, nojs => 1, grep( {
+    <& /Widgets/SelectionBox:show, self => $pane, grep( {
             $_->{pane} eq $pane_name} @deleted ) ? ( ShowUpdate => 1 ) : () &>
 </&>
 </form>
 
 <%INIT>
 
-my $current_subtab = 'Dashboards/Queries.html?id=' . $id;
 my @results;
 
 use RT::Dashboard;
-my $Dashboard = new RT::Dashboard($session{'CurrentUser'});
+my $Dashboard = RT::Dashboard->new($session{'CurrentUser'});
 my ($ok, $msg) = $Dashboard->LoadById($id);
 $ok || Abort(loc("Couldn't load dashboard [_1]: [_2]", $id, $msg));
-my $title = loc("Modify the queries of dashboard [_1]", $Dashboard->Name);
+my $title = loc("Modify the content of dashboard [_1]", $Dashboard->Name);
 
 my %desc_of;
 my @items;
@@ -97,20 +91,21 @@ my @components = @{ RT->Config->Get('HomepageComponents') };
 
 for my $desc (@components) {
     my $name = "component-$desc";
-    push @items, [$name, $desc];
-    $desc_of{$name} = $desc;
+    push @items, [$name, loc($desc)];
+    $desc_of{$name} = loc($desc);
     $still_exists{$name} = 1;
 }
 
 # add dashboards
-my $dashboards = $m->comp("/Dashboards/Elements/DashboardsForObjects", flatten => 1);
-for my $dashboard (@{ $dashboards || [] }) {
+my @dashboards = $m->comp("/Dashboards/Elements/ListOfDashboards");
+for my $dashboard (@dashboards) {
     # Users *can* set up mutually recursive dashboards, but don't make it THIS
     # easy for them to shoot themselves in the foot.
     next if $dashboard->Id == $Dashboard->Id;
 
     my $name = 'dashboard-' . $dashboard->Id . '-' . $dashboard->Privacy;
-    my $desc = "Dashboard: " . $dashboard->Name;
+    my $type = loc('Dashboard'); # loc
+    my $desc = "$type: " . $dashboard->Name;
     push @items, [$name, $desc];
     $desc_of{$name} = $desc;
     $still_exists{$name} = 1;
@@ -119,16 +114,18 @@ for my $dashboard (@{ $dashboards || [] }) {
 # add saved searches
 my @objs = RT::System->new($session{'CurrentUser'});
 
-push @objs, RT::SavedSearches->new( $session{CurrentUser} )->_PrivacyObjects
+push @objs, RT::SavedSearch->new( $session{CurrentUser} )->ObjectsForLoading
     if $session{'CurrentUser'}->HasRight( Right  => 'LoadSavedSearch',
                                           Object => $RT::System );
 
 for my $object (@objs) {
     for ($m->comp("/Search/Elements/SearchesForObject", Object => $object)) {
-        my ($desc, $search) = @$_;
+        my ($desc, $loc_desc, $search) = @$_;
         my $SearchType = $search->Content->{'SearchType'} || 'Ticket';
-        my $type = ($SearchType eq 'Ticket') ? 'Saved Search' : $SearchType; # loc
-        $desc = "$type: $desc";
+        my $type = ( $SearchType eq 'Ticket' )
+          ? 'Saved Search'    # loc
+          : $SearchType;
+        $desc = loc($type) . ": $loc_desc";
         my $privacy = $Dashboard->_build_privacy($object);
         my $name = 'search-' . $search->Id . '-' . $privacy;
         push @items, [$name, $desc];
@@ -137,7 +134,7 @@ for my $object (@objs) {
     }
 }
 
-# Get the list of queries already in use
+# Get the list of portlets already in use
 my @deleted;
 do {
     my $panes = $Dashboard->Panes;
@@ -177,7 +174,7 @@ $m->callback(
     selected     => \%selected,
 );
 
-# Create selectionbox widgets for those queries
+# Create selectionbox widgets for those portlets
 
 my %pane_name = (
     'body'    => loc('Body'),
@@ -191,7 +188,7 @@ $m->callback(
 );
 
 my @panes;
-for my $pane (keys %pane_name) {
+for my $pane (sort keys %pane_name) {
     my $sel = $m->comp(
         '/Widgets/SelectionBox:new',
         Action      => 'Queries.html',
@@ -269,7 +266,7 @@ for my $pane (keys %pane_name) {
     push @panes, $sel;
 }
 
-$m->comp('/Widgets/SelectionBox:process', %ARGS, self => $_, nojs => 1)
+$m->comp('/Widgets/SelectionBox:process', %ARGS, self => $_ )
     for @panes;
 
 my @hidden_searches = $Dashboard->PossibleHiddenSearches;