1 <& /Admin/Elements/Header, Title => 'Edit scrips' &>
2 <& /Admin/Elements/QueueTabs, id => $QueueObj->Id &>
4 <& /Elements/ListActions, actions => \@actions &>
6 <& /Elements/TitleBoxStart, title => $description &>
9 <& /Admin/Elements/ListGlobalScrips &>
11 <FORM METHOD=POST ACTION="Scrips.html">
12 <INPUT TYPE=HIDDEN NAME=id VALUE=<%$id%>>
14 % if ($Scrips->Count > 0 ) {
21 % while (my $scrip = $Scrips->Next ) {
24 <INPUT TYPE="CHECKBOX" NAME="DeleteScrip-<%$scrip->Id%>">
27 <% $scrip->ConditionObj->Name %>
28 <% $scrip->ActionObj->Name %> with template
29 <% $scrip->TemplateObj->Name %>
36 <h2>Add a scrip to this queue</h2>
37 Condition: <& /Admin/Elements/SelectScripCondition, Name => 'NewScripCondition' &>
38 Action: <& /Admin/Elements/SelectScripAction, Name => 'NewScripAction' &>
39 Template: <& /Admin/Elements/SelectTemplate, Name => 'NewScripTemplate', DefaultQueue => $id &>
41 <& /Elements/TitleBoxEnd &>
42 <& /Elements/Submit &>
45 my (@actions, $description);
47 my $Scrips = new RT::Scrips ($session{'CurrentUser'});
48 unless ($id =~ /^\d+$/) {
49 Abort("$id isn't a valid Queue id.");
52 unless ($Scrips->LimitToQueue($id)) {
53 Abort("Couldn't load Scrips.");
56 my $QueueObj = new RT::Queue($session{'CurrentUser'});
60 $description = "Modify scrips for queue '". $QueueObj->Name ."'";
63 $description = "Modify global scrips";
67 if ($NewScripAction and $NewScripCondition) {
68 my $NewScrip = new RT::Scrip($session{'CurrentUser'});
70 my ($retval, $msg) = $NewScrip->Create ( ScripAction => $NewScripAction,
71 ScripCondition => $NewScripCondition,
72 Stage => 'TransactionCreate',
74 Template => $NewScripTemplate);
75 if (defined $retval) {
83 # {{{ deal with modifying and deleting existing scrips
85 foreach $key (keys %ARGS) {
86 # {{{ if we're trying to delete the scrip
87 if ($key =~ /^DeleteScrip-(\d+)/) {
89 my $scrip = new RT::Scrip($session{'CurrentUser'});
91 my ($retval, $msg) = $scrip->Delete;
93 push @actions, 'Scrip deleted';
107 $NewScripCondition => undef
108 $NewScripAction => undef
109 $NewScripTemplate => undef
110 $id => undef #some identifier that a Queue could