Corrige un bug sur l'affichage des variables

This commit is contained in:
Alan Garcia 2014-01-21 13:35:50 +00:00
parent 2b8b5e0f67
commit ba77be7a0c
4 changed files with 31 additions and 26 deletions

1
.gitattributes vendored
View File

@ -68,6 +68,7 @@ bureau/admin/adm_donosu.php -text
bureau/admin/adm_dorenew.php -text bureau/admin/adm_dorenew.php -text
bureau/admin/adm_dosu.php -text bureau/admin/adm_dosu.php -text
bureau/admin/adm_edit.php -text bureau/admin/adm_edit.php -text
bureau/admin/adm_editvar.php -text
bureau/admin/adm_email.php -text bureau/admin/adm_email.php -text
bureau/admin/adm_list.php -text bureau/admin/adm_list.php -text
bureau/admin/adm_lockpanel.php -text bureau/admin/adm_lockpanel.php -text

View File

@ -0,0 +1 @@
TODO

View File

@ -39,13 +39,6 @@ $fields = array (
); );
getFields($fields); getFields($fields);
$conf = $variables->variable_init();
foreach ($conf as $name => $val) {
if (isset($GLOBALS['_POST'][$name])) {
$variables->variable_set($name, $GLOBALS['_POST'][$name]);
}
}
include_once ("head.php"); include_once ("head.php");
?> ?>
@ -57,8 +50,7 @@ include_once ("head.php");
<?php __("Here are the internal AlternC variables that are currently being used."); ?> <?php __("Here are the internal AlternC variables that are currently being used."); ?>
</p> </p>
<form method="post" action="adm_variables.php"> <table border="0" cellpadding="4" cellspacing="0" class='tlist' id="tab_listvar_glob">
<table border="0" cellpadding="4" cellspacing="0" class='tlist'>
<thead> <thead>
<tr> <tr>
<th><?php __("Names"); ?></th> <th><?php __("Names"); ?></th>
@ -71,27 +63,21 @@ include_once ("head.php");
<?php <?php
$allvars = $variables->variables_list(); $allvars = $variables->variables_list();
$global_conf=$variables->get_impersonated();
foreach( $variables->variables_list_name() as $varname => $varcomment) { ?> foreach( $variables->variables_list_name() as $varname => $varcomment) { ?>
<tr class="lst"> <tr class="lst">
<td><?php echo $varname; ?></td> <td><?php echo $varname; ?></td>
<td><?php echo $varcomment; ?></td> <td><?php echo $varcomment; ?></td>
<td><?php echo $allvars['DEFAULT'][NULL][$varname]['value']; ?></td> <td><?php echo $allvars['DEFAULT'][NULL][$varname]['value']; ?></td>
<td><?php if (isset($allvars['GLOBAL'][NULL][$varname]['value'])) { echo $allvars['GLOBAL'][NULL][$varname]['value']; } ?></td> <td><?php if (isset($allvars['GLOBAL'][NULL][$varname]['value'])) { echo $allvars['GLOBAL'][NULL][$varname]['value']; } ?></td>
<td><?php echo variable_get($varname); ?></td> <td><?php echo $global_conf[$varname]['value']; ?></td>
<td><a href='adm_editvar.php?var=<?php echo urlencode($varname)?>&amp;strata=global'><?php __("Edit"); ?></a></td>
<!--
<td><input type="text" name="<?php ehe($vars['name']); ?>" value="<?php ehe($vars['value']); ?>" /></td>
-->
</tr> </tr>
<?php } ?> <?php } ?>
</table> </table>
<!--
<p><input type="submit" class="inb" value="<?php __("Save variables"); ?>" /></p>
-->
</form>
<br/> <br/><br/> <br/><br/><br/>
<hr/> <hr/>
<h3 id="overwrited_vars"><?php __("Overwrited vars"); ?></h3> <h3 id="overwrited_vars"><?php __("Overwrited vars"); ?></h3>
@ -115,12 +101,13 @@ echo "<input type='submit' class='ina' value=\""; echo ehe(_("View")); echo "\"
<br/> <br/>
<?php <?php
if ( $member_id && $fqdn_id ) {
$sub_infos=$dom->get_sub_domain_all($fqdn_id); $sub_infos=$dom->get_sub_domain_all($fqdn_id);
$fqdn=$dom->get_panel_url_list()[$fqdn_id]; $fqdn=$dom->get_panel_url_list()[$fqdn_id];
$impersonated_conf=$variables->get_impersonated($fqdn, $member_id); $impersonated_conf=$variables->get_impersonated($fqdn, $member_id);
echo sprintf(_("Here are values for members %s logged via %s"), '<b>'.$ml[$member_id].'</b>', "<b>$fqdn</b>") ;?> echo sprintf(_("Here are values for members %s logged via %s"), '<b>'.$ml[$member_id].'</b>', "<b>$fqdn</b>") ;?>
<table class='tlist'> <table class='tlist' id="tab_listvar_impers">
<?php <?php
echo "<thead><tr>"; echo "<thead><tr>";
echo "<th>"._("Var")."</th>"; echo "<th>"._("Var")."</th>";
@ -140,6 +127,7 @@ foreach( $variables->variables_list_name() as $varname => $varcomment) { ?>
<td><?php if (isset($allvars['MEMBER'][$member_id][$varname]['value'])) { echo $allvars['MEMBER'][$member_id][$varname]['value']; } ?></td> <td><?php if (isset($allvars['MEMBER'][$member_id][$varname]['value'])) { echo $allvars['MEMBER'][$member_id][$varname]['value']; } ?></td>
<td><?php if (isset($allvars['DOMAIN']['FIXME'][$varname]['value'])) { echo $allvars['DOMAIN']['FIXME'][$varname]['value']; } ?></td> <td><?php if (isset($allvars['DOMAIN']['FIXME'][$varname]['value'])) { echo $allvars['DOMAIN']['FIXME'][$varname]['value']; } ?></td>
<td><?php echo $impersonated_conf[$varname]['value']; ?></td> <td><?php echo $impersonated_conf[$varname]['value']; ?></td>
<td><a href='adm_editvar.php?var=<?php echo urlencode($varname)."&amp;member_id=$member_id&amp;fqdn_id=$fqdn_id"?>'><?php __("Edit"); ?></a></td>
</tr> </tr>
<?php <?php
} //foreach } //foreach
@ -147,5 +135,15 @@ foreach( $variables->variables_list_name() as $varname => $varcomment) { ?>
</table> </table>
<br/> <br/>
<?php } // if $member_id && $fqdn_id ?>
<script type="text/javascript">
$(document).ready(function()
{
$("#tab_listvar_impers").tablesorter();
$("#tab_listvar_glob").tablesorter();
}
);
</script>
<?php include_once("foot.php"); ?> <?php include_once("foot.php"); ?>

View File

@ -63,13 +63,18 @@ class m_variables {
} }
function get_impersonated($fqdn, $uid=null, $var=null) { function get_impersonated($fqdn=null, $uid=null, $var=null) {
global $db, $err; global $db, $err;
$arr_var=$this->variables_list(); $arr_var=$this->variables_list();
// Get some vars we are going to need. // Get some vars we are going to need.
$sub_infos=m_dom::get_sub_domain_id_and_member_by_name( strtolower($fqdn) ); if ($fqdn != NULL) {
$sub_infos=m_dom::get_sub_domain_id_and_member_by_name( strtolower($fqdn) );
} else {
$sub_infos=false;
}
if ( $uid != NULL ) { if ( $uid != NULL ) {
$creator=m_mem::get_creator_by_uid($uid); $creator=m_mem::get_creator_by_uid($uid);
} else { } else {