summaryrefslogtreecommitdiff
path: root/rt/share/html/Admin/Elements/EditScripOptions
blob: 7b3848419523d9b3b32fd9d1c5ab1e93ec4da34f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
% return if !@options;
<tr><td></td><td><table>
% my $prefix = $Name.'Rules-';
% foreach my $o (@options) {
  <tr><td align="right"><% $o->{'label'} %>:</td>
  <td>
%   if ( $o->{'type'} eq 'text' ) {
  <input type="text" name="<% $prefix.$o->{'name'} %>" value="<% $rules{$o->{'name'}} %>">
%   }
%   elsif ( $o->{'type'} eq 'select' and ref $o->{'options'} ) {
  <select name="<% $prefix.$o->{'name'} %>">
%     my @choices = @{ $o->{'options'} };
%     while (@choices) {
%       my $v = shift @choices;
%       my $l = shift @choices;
  <option value="<% $v %>"<% ($rules{$o->{'name'}} eq $v) ? ' SELECTED' : ''%>>
  <% $l %></option>
%     }
  </select>
%   } # else $o->{'type'}
</td></tr>
% } #foreach $o
</table></td></tr>

<%INIT>
my (@options, %rules);
if ( $ScripX ) {
  my $ScripXObj = "RT::Scrip$Name"->new($session{'CurrentUser'});
  $ScripXObj->Load($ScripX);
  my $QueueObj = RT::Queue->new($session{'CurrentUser'});
  $QueueObj->Load($Queue);
  my $method = "Load$Name";
  my $XObj = $ScripXObj->$method();
  @options = $XObj->Options('QueueObj' => $QueueObj);
  %rules = split("\n", $Default);
}
</%INIT>

<%ARGS>
$Name => undef
$Default => undef
$Queue => 0
$ScripX => undef
</%ARGS>