2 require_once(
"../class/config.php");
3 include_once(
"head.php");
13 "var" => array (
"get",
"string", null),
14 "var_id" => array (
"post",
"integer", null),
15 "var_value" => array (
"post",
"string", null),
16 "var_value_arr" => array (
"post",
"array", null),
17 "var_name" => array (
"post",
"string", null),
18 "strata" => array (
"post",
"string", null),
19 "strata_id" => array (
"post",
"integer", null),
20 "delete" => array (
"post",
"boolean",
false),
81 echo
"<p class='error'>";
__(
"Missing var name");echo
"</p>";
82 include_once(
"foot.php");
87 if (!is_null($var_value))
$var_v = $var_value;
88 if (!is_null($var_value_arr))
$var_v = $var_value_arr;
91 if ( $var_id && $delete ) {
93 }
else if ( $strata && $var_name &&
$var_v ) {
94 $variables->variable_update_or_create($var_name,
$var_v, $strata, $strata_id);
96 $variables->variable_update_or_create($var_name,
$var_v, null, null, $var_id);
99 echo
"<h3>";echo sprintf(_(
"Edition of var %s"), $var); echo
"</h3>";
107 foreach($admin->get_list() as $mid=>$mlogin) {
112 foreach($admin->get_creator_list() as $mid=>$mlogin) {
116 echo
"<fieldset><legend>"._(
"Description").
"</legend>";
117 echo
"<p>".$variables->variables_list_name()[$var].
"</p>";
124 echo
"<label for='add_$id'>".$infotype[
'desc'].
"</label>";
125 switch(strtolower($infotype[
'type'])) {
127 echo
"<input type='text' class='int' id='add_$id' name='$name' value='";
ehe(
$value); echo
"' size='30' /> ";
128 echo
"<em>"._(
"Value expected: string").
"</em>";
131 echo
"<input type='text' class='int' id='add_$id' name='$name' value='";
ehe(
$value); echo
"' size='10' pattern='[0-9]+'/> ";
132 echo
"<em>"._(
"Value expected: integer").
"</em>";
135 echo
"<input type='text' class='int' id='add_$id' name='$name' value='";
ehe(
$value); echo
"' size='15' pattern='[0-9\.:]+' /> ";
136 echo
"<em>"._(
"Value expected: IP address").
"</em>";
139 echo
"<input type='hidden' name='$name' value='0' />";
140 echo
"<input type='checkbox' id='add_$id' name='$name' value='1' ";
cbox(
$value);echo
" />";
143 echo
"WTF ? Dunno what to do with a ".$infotype[
'type'];
150 echo
"<div id='edit_var_div_{$var_arr['id']}'><form method=post>";
151 echo
"<input type='hidden' name='var_id' value='";
ehe($var_arr[
'id']);echo
"' />";
152 if (is_array( $allvars[
'DEFAULT'][null][$var_arr[
'name']][
'type'] )) {
154 $infotype = $allvars[
'DEFAULT'][null][$var_arr[
'name']][
'type'];
156 foreach ($var_arr[
'value'] as $kk => $vv) {
158 if ( is_array($vv)) {
161 foreach ($vv as $ll => $mm ) {
163 var_input($infotype[$kk][$ll],
"var_value_arr[$kk][$ll]", $var_arr[
'value'][$kk][$ll] );
168 var_input($infotype[$kk],
"var_value_arr[$kk]", $var_arr[
'value'][$kk]);
174 echo
"<input type='text' class='int' name='var_value' value='";
ehe($var_arr[
'value']); echo
"' size='30' />";
178 echo
"<input type='button' class='inb cancel' name='cancel' value='"._(
'Cancel').
"' onclick=\"$('#edit_var_div_{$var_arr['id']}').toggle();\" />";
179 echo
"<input type='submit' class='inb ok' value='"._(
"Apply").
"'/>";
180 echo
"<input type='submit' class='inb delete' name='delete' value='"._(
"Delete").
"' onclick=\"return confirm('";
ehe(_(
"Are you sure you want to delete it.")); echo
"')\" />";
181 echo
"</form></div>";
182 echo
"<script type='text/javascript'>$('#edit_var_div_{$var_arr['id']}').toggle();</script>";
186 function add_var($stratatata, $stratatata_arr=null) {
188 echo
"<div id='add_var_div_$stratatata'><form method=post>";
189 echo
"<input type='hidden' name='strata' value='";
ehe($stratatata);echo
"' />";
190 echo
"<input type='hidden' name='var_name' value='";
ehe($var);echo
"' />";
191 if (is_array($stratatata_arr)) {
192 echo
"<select name='strata_id'>";
193 eoption($stratatata_arr, null);
196 $infotype = $allvars[
'DEFAULT'][null][$var][
'type'];
197 if (is_array( $infotype )) {
199 foreach ($allvars[
'DEFAULT'][null][$var][
'type'] as $kk => $vv) {
201 if ( is_array($vv) && ! (
isset($vv[
'desc']) &&
isset($vv[
'type'])) ) {
204 foreach ($vv as $ll => $mm ) {
206 var_input($infotype[$kk][$ll],
"var_value_arr[$kk][$ll]" );
211 var_input($infotype[$kk],
"var_value_arr[$kk]" );
217 echo
"<input type='text' class='int' name='var_value' value='' size='30' />";
220 echo
"<input type='button' class='inb cancel' name='cancel' value='"._(
'Cancel').
"' onclick=\"$('#add_var_div_$stratatata').toggle();\" />";
221 echo
"<input type='submit' class='inb ok' value='"._(
"Apply").
"'/>";
222 echo
"</form></div>";
223 echo
"<script type='text/javascript'>$('#add_var_div_$stratatata').toggle();</script>";
227 echo
"<table class='tlist'>";
229 foreach (
$variables->strata_order as $strata) {
230 echo
"<tr class='lst'>";
231 echo
"<td>";
__($strata); echo
"</td>";
234 echo
"<td>";
$variables->display_value_html(
$allvars,
'DEFAULT', null, $var); echo
"</td>";
239 echo
"<a href='javascript:edit_var(".$allvars[
'GLOBAL'][null][$var][
'id'].
");'>";
$variables->display_value_html(
$allvars,
'GLOBAL', null, $var); echo
"</a>";
242 echo
"<a href='javascript:add_var(\"$strata\");'>"._(
"Add").
"</a>";
250 foreach (
$allvars[
'FQDN_CREATOR'] as $ttk => $ttv ) {
251 if (
isset($ttv[$var]) && is_array( $ttv[$var])) {
252 echo sprintf(_(
"Overwritted by %s"),
$members[$ttk][
'login']).
" → ";
253 echo
"<a href='javascript:edit_var(".$ttv[$var][
'id'].
");'>"; echo
$variables->display_valueraw_html($ttv[$var][
'value'], $var);echo
"</a>";
259 echo
"<a href='javascript:add_var(\"$strata\");'>"._(
"Add").
"</a>";
266 foreach (
$allvars[
'FQDN'] as $ttk => $ttv ) {
267 if (
isset($ttv[$var]) && is_array( $ttv[$var])) {
268 echo sprintf(_(
"Overwritted by %s"),
$panel_url[$ttk]).
" → ";
269 echo
"<a href='javascript:edit_var(".$ttv[$var][
'id'].
");'>"; echo
$variables->display_valueraw_html($ttv[$var][
'value'], $var);echo
"</a>";
275 echo
"<a href='javascript:add_var(\"$strata\");'>"._(
"Add").
"</a>";
282 foreach (
$allvars[
'CREATOR'] as $ttk => $ttv ) {
283 if (
isset($ttv[$var]) && is_array( $ttv[$var])) {
284 echo sprintf(_(
"Overwritted by %s"),
$members[$ttk][
'login']).
" → ";
285 echo
"<a href='javascript:edit_var(".$ttv[$var][
'id'].
");'>"; echo
$variables->display_valueraw_html($ttv[$var][
'value'], $var);echo
"</a>";
291 echo
"<a href='javascript:add_var(\"$strata\");'>"._(
"Add").
"</a>";
298 foreach (
$allvars[
'MEMBER'] as $ttk => $ttv ) {
299 if (
isset($ttv[$var]) && is_array( $ttv[$var])) {
300 echo sprintf(_(
"Overwritted by %s"),
$members[$ttk][
'login']).
" → ";
301 echo
"<a href='javascript:edit_var(".$ttv[$var][
'id'].
");'>"; echo
$variables->display_valueraw_html($ttv[$var][
'value'], $var);echo
"</a>";
307 echo
"<a href='javascript:add_var(\"$strata\");'>"._(
"Add").
"</a>";
313 echo
"<td>Todo.</td>";
323 <p><span
class=
"ina back"><a href=
"adm_variables.php"><?php
__(
"Back to the var list"); ?></a></span></p>
325 <script type=
"text/javascript">
327 $(
'#edit_var_div_'+id).toggle();
330 $(
'#add_var_div_'+st).toggle();
334 include_once(
"foot.php");