diff options
author | ivan <ivan> | 2002-08-12 06:17:09 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-08-12 06:17:09 +0000 |
commit | 3ef62a0570055da710328937e7f65dbb2c027c62 (patch) | |
tree | d549158b172fd499b4f81a2981b62aabbde4f99b /rt/webrt/Admin/Global/Scrips.html | |
parent | 030438c9cb1c12ccb79130979ef0922097b4311a (diff) |
import rt 2.0.14
Diffstat (limited to 'rt/webrt/Admin/Global/Scrips.html')
-rwxr-xr-x | rt/webrt/Admin/Global/Scrips.html | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/rt/webrt/Admin/Global/Scrips.html b/rt/webrt/Admin/Global/Scrips.html new file mode 100755 index 000000000..e55f8b3de --- /dev/null +++ b/rt/webrt/Admin/Global/Scrips.html @@ -0,0 +1,95 @@ +<& /Admin/Elements/Header, Title => 'Edit scrips' &> +<& /Admin/Elements/SystemTabs &> + +<& /Elements/ListActions, actions => \@actions &> + +<& /Elements/TitleBoxStart, title => "Modify global scrips" &> + + <FORM METHOD=POST ACTION="Scrips.html"> + +% if ($Scrips->Count > 0 ) { +<TABLE> +<TR> +<TD>Delete +</TD> +<TD> +</TR> + +% while (my $scrip = $Scrips->Next ) { +<TR> +<TD> +<INPUT TYPE="CHECKBOX" NAME="DeleteScrip-<%$scrip->Id%>"> +</TD> +<TD> +<% $scrip->ConditionObj->Name %> +<% $scrip->ActionObj->Name %> +with template <% $scrip->TemplateObj->Name %> +</TD> +</TR> +% } + +</TABLE> + +% } +Add a scrip which will apply to all queues: +<ul> +<li>Condition: <& /Admin/Elements/SelectScripCondition, Name => 'NewScripCondition' &> + Action: <& /Admin/Elements/SelectScripAction, Name => 'NewScripAction' &> + Template: <& /Admin/Elements/SelectTemplate, Name => 'NewScripTemplate' &> + +</ul> + +<& /Elements/TitleBoxEnd &> +<& /Elements/Submit &> +</FORM> +<%init> +my (@actions, $description); + +my $Scrips = new RT::Scrips ($session{'CurrentUser'}); +$Scrips->LimitToGlobal(); + + + + +if ($NewScripAction and $NewScripCondition) { + my $NewScrip = new RT::Scrip($session{'CurrentUser'}); + + my ($retval, $msg) = $NewScrip->Create ( ScripAction => $NewScripAction, + ScripCondition => $NewScripCondition, + Stage => 'TransactionCreate', + Queue => 0, + Template => $NewScripTemplate); + if (defined $retval) { + push @actions, $msg; + } + else { + push @actions, $msg; + } +} + +# {{{ deal with modifying and deleting existing scrips +my ($key ); +foreach $key (keys %ARGS) { + # {{{ if we're trying to delete the scrip + if ($key =~ /^DeleteScrip-(\d+)/) { + my $id = $1; + my $scrip = new RT::Scrip($session{'CurrentUser'}); + $scrip->Load($id); + my ($retval, $msg) = $scrip->Delete; + if ($retval) { + push @actions, "Scrip deleted"; + } + else { + push @actions, $msg; + } + } + # }}} +} +# }}} +</%init> + +<%ARGS> +$NewScripCondition => undef +$NewScripAction => undef +$NewScripTemplate => undef +</%ARGS> |