X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=rt%2Fshare%2Fhtml%2FAdmin%2FQueues%2FTemplate.html;h=5d5bc1c71a5664427eb5d0583bfe0eec69353710;hb=44dd00a3ff974a17999e86e64488e996edc71e3c;hp=640e16119e96be665ec4a03f3bd268616dd20f93;hpb=fc6209f398899f0211cfcedeb81a3cd65e04a941;p=freeside.git diff --git a/rt/share/html/Admin/Queues/Template.html b/rt/share/html/Admin/Queues/Template.html index 640e16119..5d5bc1c71 100755 --- a/rt/share/html/Admin/Queues/Template.html +++ b/rt/share/html/Admin/Queues/Template.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2019 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -46,15 +46,10 @@ %# %# END BPS TAGGED BLOCK }}} <& /Admin/Elements/Header, Title => $title &> -<& /Admin/Elements/QueueTabs, id => $Queue, - QueueObj => $QueueObj, - current_tab => 'Admin/Queues/Templates.html?id='.$Queue, - current_subtab => $current_subtab, - subtabs => $subtabs, - Title => $title &> +<& /Elements/Tabs &> <& /Elements/ListActions, actions => \@results &> -
+ %if ($Create ) { % } else { @@ -63,64 +58,61 @@ %# hang onto the queue id -<& /Admin/Elements/ModifyTemplate, Name => $TemplateObj->Name, Description => -$TemplateObj->Description, Content => $TemplateObj->Content &> +<& /Admin/Elements/ModifyTemplate, + 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 &>
<%INIT> -my $TemplateObj = new RT::Template($session{'CurrentUser'}); -my ($title, @results, $current_subtab, $SubmitLabel); +my $TemplateObj = RT::Template->new( $session{'CurrentUser'} ); +my $QueueObj; +my $SubmitLabel; +my $title; +my @results; -my $subtabs = { - A => { title => loc('Select template'), - path => "Admin/Queues/Templates.html?id=$Queue" - }, - B => { title => loc('New template'), - path => "Admin/Queues/Template.html?Create=1&Queue=$Queue", - separator => 1, - } - }; +if ( !$Create ) { + if ( $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') ); + } -if ($Create) { - $title = loc("Create a template"); - $current_subtab = "Admin/Queues/Template.html?Create=1&Queue=".$Queue; - $SubmitLabel = loc('Create'); } -else { - if ($Template eq 'new') { - my ($val, $msg) = $TemplateObj->Create(Queue => $Queue, Name => $Name); - Abort(loc("Could not create template: [_1]", $msg)) unless ($val); - push @results, $msg; - } - else { - $TemplateObj->Load($Template) || Abort(loc('No Template')); - } - $title = loc('Modify template [_1]', loc($TemplateObj->Name())); - $SubmitLabel = loc('Save Changes'); - - +if ( $TemplateObj->Id() ) { + $Queue = $TemplateObj->Queue; + $QueueObj = $TemplateObj->QueueObj; + + 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; +} else { + $Create = 1; + $QueueObj = RT::Queue->new( $session{'CurrentUser'} ); + $QueueObj->Load($Queue); } -my $QueueObj; -if ($TemplateObj->Id()) { - $Queue = $TemplateObj->Queue; - $QueueObj = $TemplateObj->QueueObj; - my @attribs = qw( Description Content Queue Name); - my @aresults = UpdateRecordObject( AttributesRef => \@attribs, - Object => $TemplateObj, - ARGSRef => \%ARGS); - $current_subtab = "Admin/Queues/Template.html?Queue=$Queue&Template=".$TemplateObj->Id(); - $subtabs->{"C"} = { title => loc('Template #[_1]', $TemplateObj->Id()), - path => "Admin/Queues/Template.html?Queue=$Queue&Template=".$TemplateObj->Id(), - }; - push @results, @aresults; +if ($Create) { + $title = loc( 'Create a new template for queue [_1]', $QueueObj->Name ); + $SubmitLabel = loc('Create'); } else { - $QueueObj = RT::Queue->new($session{'CurrentUser'}); - $QueueObj->Load($Queue); + + $title = loc( 'Modify template [_1] for queue [_2]', loc( $TemplateObj->Name()), $QueueObj->Name ); + $SubmitLabel = loc('Save Changes'); } @@ -129,4 +121,5 @@ $Queue => '' $Template => '' $Create => undef $Name => undef +$Type => undef