diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2015-07-09 22:18:55 -0700 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2015-07-09 22:27:04 -0700 |
| commit | e131b1f71f08b69abb832c1687d1f29682d171f8 (patch) | |
| tree | 490167e41d9fe05b760e7b21a96ee35a86f8edda /rt/share/html/Admin/Global | |
| parent | d05d7346bb2387fd9d0354923d577275c5c7f019 (diff) | |
RT 4.2.11, ticket#13852
Diffstat (limited to 'rt/share/html/Admin/Global')
| -rw-r--r--[-rwxr-xr-x] | rt/share/html/Admin/Global/DashboardsInMenu.html (renamed from rt/share/html/Admin/Global/Scrip.html) | 70 | ||||
| -rw-r--r-- | rt/share/html/Admin/Global/MyRT.html | 10 | ||||
| -rwxr-xr-x | rt/share/html/Admin/Global/Template.html | 56 | ||||
| -rwxr-xr-x | rt/share/html/Admin/Global/index.html | 2 |
4 files changed, 94 insertions, 44 deletions
diff --git a/rt/share/html/Admin/Global/Scrip.html b/rt/share/html/Admin/Global/DashboardsInMenu.html index 057032a44..1422e7686 100755..100644 --- a/rt/share/html/Admin/Global/Scrip.html +++ b/rt/share/html/Admin/Global/DashboardsInMenu.html @@ -45,19 +45,69 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/Header, Title => loc("Dashboards in menu") &> <& /Elements/Tabs &> -<& /Elements/ListActions, actions => \@results &> -<& /Admin/Elements/EditScrip, title => $title, %ARGS, id => $id &> +<& /Elements/ListActions, actions => \@actions &> +<br /> +% for my $pane (@panes) { +<&|/Widgets/TitleBox, title => loc('Dashboards in menu'), bodyclass => "" &> +<& /Widgets/SelectionBox:show, self => $pane &></&> +<br /> +% } <%init> -my ($id, @results) = $m->comp( '/Admin/Elements/EditScrip:Process', %ARGS ); +my @actions; +my $sys = RT::System->new( $session{'CurrentUser'} ); -my ($title); -if ( $id ) { - $title = loc("Modify a scrip that applies to all queues"); -} -else { - $title = loc("Add a scrip which will apply to all queues"); +my $has_right = $session{'CurrentUser'}->HasRight( Object=> $RT::System, Right => 'SuperUser'); + +my ($dashboard_attr) = $sys->Attributes->Named('DashboardsInMenu'); +my $default_dashboards_in_menu = + $dashboard_attr && $dashboard_attr->Content->{dashboards} + ? $dashboard_attr->Content->{dashboards} + : []; + +use RT::Dashboards; +my $dashboards = RT::Dashboards->new( $RT::SystemUser ); +$dashboards->LimitToPrivacy('RT::System-' . $sys->id); + +my @dashboards; +while ( my $dashboard = $dashboards->Next ) { + push @dashboards, [$dashboard->id, $dashboard->Name]; } + +my @panes = $m->comp( + '/Admin/Elements/ConfigureDashboardsInMenu', + Action => 'DashboardsInMenu.html', + panes => ['dashboards_in_menu'], + ReadOnly => !$has_right, + items => \@dashboards, + current_portlets => $default_dashboards_in_menu, + OnSave => sub { + my ( $conf ) = @_; + my ( $status, $msg ); + + if (!$has_right) { + push @actions, loc( 'Permission Denied' ); + } + elsif ( $dashboard_attr ) { + ($status, $msg) = $dashboard_attr->SetContent($conf); + } + else { + $dashboard_attr = RT::Attribute->new($RT::SystemUser); + ( $status, $msg ) = $dashboard_attr->Create( + Name => 'DashboardsInMenu', + Object => $sys, + Content => $conf, + ); + } + push @actions, $status ? loc('Global dashboards in menu saved.') : $msg; + } +); + +$m->comp( '/Widgets/SelectionBox:process', %ARGS, self => $_ ) + for @panes; + + </%init> + diff --git a/rt/share/html/Admin/Global/MyRT.html b/rt/share/html/Admin/Global/MyRT.html index d903553e4..0a62d23f6 100644 --- a/rt/share/html/Admin/Global/MyRT.html +++ b/rt/share/html/Admin/Global/MyRT.html @@ -48,13 +48,11 @@ <& /Admin/Elements/Header, Title => loc("RT at a glance") &> <& /Elements/Tabs &> -<& /Widgets/SelectionBox:header, nojs => 1 &> - <& /Elements/ListActions, actions => \@actions &> <br /> % for my $pane (@panes) { <&|/Widgets/TitleBox, title => loc('RT at a glance').': '.loc($pane->{Name}), bodyclass => "" &> -<& /Widgets/SelectionBox:show, self => $pane, nojs => 1 &></&> +<& /Widgets/SelectionBox:show, self => $pane &></&> <br /> % } <%init> @@ -86,7 +84,7 @@ my @panes = $m->comp( '/Admin/Elements/ConfigureMyRT', panes => [ 'body', #loc - 'summary', #loc + 'sidebar', #loc ], Action => 'MyRT.html', items => \@items, @@ -95,7 +93,7 @@ my @panes = $m->comp( OnSave => sub { my ( $conf, $pane ) = @_; if (!$has_right) { - push @actions, loc( 'Permission denied' ); + push @actions, loc( 'Permission Denied' ); } else { $default_portlets->SetContent( $conf ); @@ -104,7 +102,7 @@ my @panes = $m->comp( } ); -$m->comp( '/Widgets/SelectionBox:process', %ARGS, self => $_, nojs => 1 ) +$m->comp( '/Widgets/SelectionBox:process', %ARGS, self => $_ ) for @panes; diff --git a/rt/share/html/Admin/Global/Template.html b/rt/share/html/Admin/Global/Template.html index c88d26c44..c2a802d3c 100755 --- a/rt/share/html/Admin/Global/Template.html +++ b/rt/share/html/Admin/Global/Template.html @@ -59,10 +59,10 @@ %# hang onto the queue id <input type="hidden" class="hidden" name="Queue" value="<%$Queue%>" /> <& /Admin/Elements/ModifyTemplate, - Name => $TemplateObj->Name, - Description => $TemplateObj->Description, - Content => $TemplateObj->Content, - Type => $TemplateObj->Type + Name => $TemplateObj->Name // $ARGS{Name}, + Description => $TemplateObj->Description // $ARGS{Description}, + Content => $TemplateObj->Content // $ARGS{Content}, + Type => $TemplateObj->Type // $ARGS{Type}, &> <& /Elements/Submit, Label => $SubmitLabel, Reset => 1 &> </form> @@ -73,35 +73,37 @@ my $TemplateObj = RT::Template->new($session{'CurrentUser'}); my ($title, @results, $SubmitLabel); -if ($Create) { - $title = loc("Create a template"); - $SubmitLabel = loc('Create'); -} - -else { - if (defined ($Template) && $Template eq 'new') { - my ($val, $msg) = $TemplateObj->Create(Queue => $Queue, Name => $Name, Type => $Type); - Abort(loc("Could not create template: [_1]", $msg)) unless ($val); - push @results, $msg; +if (!$Create) { + if (defined ($Template) && $Template eq 'new') { + my ($val, $msg) = $TemplateObj->Create(Queue => $Queue, Name => $Name, Type => $Type); + push @results, $msg; + } else { + $TemplateObj->Load($Template) || Abort(loc('No Template')); } - else { - $TemplateObj->Load($Template) || Abort(loc('No Template')); - } - $title = loc('Modify template [_1]', loc($TemplateObj->Name())); - $SubmitLabel = loc('Save Changes'); - } + if ($TemplateObj->Id()) { - my @attribs = qw( Name Description Queue Type Content ); - my @aresults = UpdateRecordObject( AttributesRef => \@attribs, - Object => $TemplateObj, - ARGSRef => \%ARGS); - push @results, @aresults; + my @attribs = qw( Name Description Queue Type Content ); + my @aresults = UpdateRecordObject( AttributesRef => \@attribs, + Object => $TemplateObj, + ARGSRef => \%ARGS); + push @results, @aresults; - my ($ok, $msg) = $TemplateObj->CompileCheck; - push @results, $msg if !$ok; + my ($ok, $msg) = $TemplateObj->CompileCheck; + push @results, $msg if !$ok; +} else { + $Create = 1; } +if ($Create) { + $title = loc("Create a template"); + $SubmitLabel = loc('Create'); +} else { + $title = loc('Modify template [_1]', loc($TemplateObj->Name())); + $SubmitLabel = loc('Save Changes'); +} + + </%INIT> <%ARGS> $Queue => '' diff --git a/rt/share/html/Admin/Global/index.html b/rt/share/html/Admin/Global/index.html index cdac7d9a2..223ecd007 100755 --- a/rt/share/html/Admin/Global/index.html +++ b/rt/share/html/Admin/Global/index.html @@ -47,4 +47,4 @@ %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => loc('Admin/Global configuration') &> <& /Elements/Tabs &> -<& /Elements/ListMenu, menu => Menu()->child('tools')->child('config')->child('global') &> +<& /Elements/ListMenu, menu => Menu()->child('admin')->child('global') &> |
