Code

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