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