1 <h2>Used sudo role options</h2>
3 <table style="width:650px;">
4 {foreach from=$sudoOption item=item key=key}
5 {foreach from=$item item=entry key=entry_key}
6 <tr>
7 <td>{$key}</td>
8 <td style="width:20px;">
9 {if $entry.NEGATE}
10 <img src='images/negate.png' alt="!">
11 {/if}
12 </td>
13 <td>
15 {if $options[$entry.NAME].TYPE == "STRING"}
16 <!-- STRING
17 -->
18 <input type='text' name='option_value__{$key}_{$entry_key}' value="{$entry.VALUE}" style='width:280px;'>
19 {elseif $options[$entry.NAME].TYPE == "LISTS"}
20 <!-- LISTS
21 -->
22 <input type='text' value="{$entry.VALUE}" name="list_value__{$key}_{$entry_key}" style='width:280px;'>
23 {elseif $options[$entry.NAME].TYPE == "INTEGER"}
24 <!-- INTEGER
25 -->
26 <input type='text' name='option_value__{$key}_{$entry_key}' value="{$entry.VALUE}" style='width:280px;'>
27 {elseif $options[$entry.NAME].TYPE == "BOOLEAN"}
28 <!-- BOOLEAN
29 -->
30 <select name="option_value__{$key}_{$entry_key}" style="width:80px;;">
31 <option {if $entry.VALUE == "FALSE"} selected {/if}value="FALSE">FALSE</option>
32 <option {if $entry.VALUE == "TRUE"} selected {/if}value="TRUE">TRUE</option>
33 </select>
34 {elseif $options[$entry.NAME].TYPE == "BOOL_INTEGER"}
35 <!-- BOOLEAN_INTEGER
36 -->
37 <select name="option_selection__{$key}_{$entry_key}" id="option_selection__{$key}_{$entry_key}"
38 style="width:80px;;"
39 onChange="toggle_bool_fields('option_selection__{$key}_{$entry_key}','option_value__{$key}_{$entry_key}');">
40 <option {if $entry.VALUE == "FALSE"} selected {/if}value="FALSE">FALSE</option>
41 <option {if $entry.VALUE == "TRUE"} selected {/if}value="TRUE">TRUE</option>
42 <option {if $entry.VALUE != "TRUE" && $entry.VALUE != "FALSE"} selected {/if}
43 value="STRING">INTEGER</option>
44 </select>
45 <input type='text' value="{$entry.VALUE}" style='width:280px;' name='option_value__{$key}_{$entry_key}'
46 id="option_value__{$key}_{$entry_key}"
47 {if $entry.VALUE == "FALSE" || $entry.VALUE == "TRUE"} disabled {/if}>
48 {elseif $options[$entry.NAME].TYPE == "STRING_BOOL"}
49 <!-- STRING_BOOLEAN
50 -->
51 <select name="option_selection__{$key}_{$entry_key}" id="option_selection__{$key}_{$entry_key}"
52 style="width:80px;;"
53 onChange="toggle_bool_fields('option_selection__{$key}_{$entry_key}','option_value__{$key}_{$entry_key}');">
54 <option {if $entry.VALUE == "FALSE"} selected {/if}value="FALSE">FALSE</option>
55 <option {if $entry.VALUE == "TRUE"} selected {/if}value="TRUE">TRUE</option>
56 <option {if $entry.VALUE != "TRUE" && $entry.VALUE != "FALSE"} selected {/if}
57 value="STRING">STRING</option>
58 </select>
59 <input type='text' value="{$entry.VALUE}" style='width:280px;' name='option_value__{$key}_{$entry_key}'
60 id="option_value__{$key}_{$entry_key}"
61 {if $entry.VALUE == "FALSE" || $entry.VALUE == "TRUE"} disabled {/if}>
62 {/if}
63 </td>
64 <td style='width: 40px;'>
65 <input type='image' src='images/negate.png' name='negOption_{$key}_{$entry_key}' class='center'>
66 <input type='image' src='images/edittrash.png' name='delOption_{$key}_{$entry_key}' class='center'>
67 </td>
68 </tr>
69 {/foreach}
70 {/foreach}
71 </table>
73 <p class="seperator"> </p>
74 <br>
75 <h2>{t}Available options{/t}:</h2>
76 <select name='option'>
77 {foreach from=$options item=item key=key}
78 {if !isset($sudoOption.$key) || ($sudoOption.$key && $item.TYPE == "LISTS")}
79 <option value='{$key}'>{$item.NAME} ({$map[$item.TYPE]})</option>
80 {/if}
81 {/foreach}
82 </select>
84 <input type="submit" name="add_option" value="{msgPool type=addButton}">
87 <script language="JavaScript" type="text/javascript">
88 <!--
89 {literal}
90 function toggle_bool_fields(source_select,target_input)
91 {
92 var select= document.getElementById(source_select);
93 var input = document.getElementById(target_input);
94 if(select.value == "TRUE" || select.value == "FALSE"){
95 input.disabled = true;
96 input.value = select.value;
97 }else{
98 input.disabled = false;
99 input.value = "";
100 }
101 }
102 {/literal}
103 -->
104 </script>