blob: 264ca3a20297b78c7938e83815e11c011d6bc738 (
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
45
46
47
48
|
% return if !@options;
<tr><td></td><td><table>
% my $prefix = $Name.'Rules-';
% foreach my $o (@options) {
% my $curr_value = $rules{ $o->{'name'} };
<tr><td align="right"><% $o->{'label'} %>:</td>
<td>
% if ( $o->{'type'} eq 'text' ) {
<input type="text" name="<% $prefix.$o->{'name'} %>" value="<% $curr_value %>">
% }
% elsif ( $o->{'type'} eq 'checkbox' ) {
<input type="checkbox" name="<% $prefix.$o->{'name'} %>" value="1" <% $curr_value ? 'CHECKED' : '' %>>
% }
% 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 %>"<% ($curr_value 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>
|