add a link to create new dashboards, #30905
[freeside.git] / rt / share / html / Elements / Tabs
index a82cdd1..f769a80 100755 (executable)
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
 %#                                          <sales@bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
@@ -56,7 +56,7 @@ $request_path =~ s!/{2,}!/!g;
 my $query_string = sub {
     my %args = @_;
     my $u    = URI->new();
-    $u->query_form(%args);
+    $u->query_form(map { $_ => $args{$_} } sort keys %args);
     return $u->query;
 };
 
@@ -516,10 +516,15 @@ my $build_main_nav = sub {
                     if $obj->CurrentUserCanSubscribe;
                 $tabs->child( show         => title => loc('Show'),         path => "/Dashboards/" . $obj->id . "/" . $obj->Name)
             }
+        } else {
+            my $tabs = PageMenu();
+            if ( $dashboard->CurrentUserCanCreateAny ) {
+                # FREESIDE: provide a way to create dashboards
+                $tabs->child('dashboard_create' => title => loc('New Dashboard'), path => "/Dashboards/Modify.html?Create=1");
+            }
         }
     }
 
-
     if ( $request_path =~ m{^/Ticket/} ) {
         if ( ( $DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
             my $id  = $1;
@@ -660,8 +665,10 @@ my $build_main_nav = sub {
                     if ( $item_map->{$id}->{next} ) {
                         $search->child( next =>
                             title => loc('Next') . ' >',  class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{next});
-                        $search->child( last =>
-                            title => loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last});
+                        if ( $item_map->{last} ) {
+                            $search->child( last =>
+                                title => loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last});
+                        }
                     }
                 }
             }