bug fixes in adm_list: filter implementation and screen display

This commit is contained in:
Remi 2016-02-23 12:02:58 +01:00
parent 604592eedd
commit f5737e0ee6
2 changed files with 44 additions and 21 deletions

View File

@ -52,7 +52,6 @@ if ($short != -1) {
}
$subadmin = variable_get("subadmin_restriction", 0);
// If we ask for all account but we aren't "admin" and
// subadmin var is not 1
if ($show == "all" && !$subadmin == 1 && $cuid != 2000) {
@ -61,6 +60,9 @@ if ($show == "all" && !$subadmin == 1 && $cuid != 2000) {
exit();
}
// show all accounts by default for admin-like accounts
if (($show=="")&&($subadmin == 1 || $cuid == 2000)) $show=all;
if ($pattern && $pattern_type) {
$accountList = $admin->get_list($show == 'all' ? 1 : 0, $creator, $pattern, $pattern_type);
} else {
@ -86,34 +88,42 @@ if ($mem->user["admlist"] == 0) { // Normal (large) mode
<fieldset style="clear:both;">
<legend><?php __("Filters"); ?></legend>
<form method="post" action="adm_list.php" >
<form method="post" action="adm_list.php">
<p>
<label for="pattern_type_login"><?php __("Search for a Login"); ?></label><input type="radio" name="pattern_type" value="login" id="pattern_type_login" <?php if (!$pattern_type || $pattern_type === 'login') echo ' checked="checked" '; ?>/>&nbsp;
<label for="pattern_type_domain"><?php __("Search for a Domain"); ?></label><input type="radio" name="pattern_type" value="domaine" id="pattern_type_domain" <?php if ($pattern_type === 'domaine') echo ' checked="checked" '; ?>/>
<input type="text" id="pattern" name="pattern" value="<?php echo $pattern ?>"/> <input type="submit" class="inb filter" value="<?php __("submit"); ?>" />
<label>
<input type="radio" name="pattern_type" value="login" id="pattern_type_login" <?php if (!$pattern_type || $pattern_type === 'login') echo ' checked="checked" '; ?>/>
<?php __("Search for a Login"); ?>
</label>
<label>
<input type="radio" name="pattern_type" value="domaine" id="pattern_type_domain" <?php if ($pattern_type === 'domaine') echo ' checked="checked" '; ?>/>
<?php __("Search for a Domain"); ?>
</label>
<input type="text" id="pattern" name="pattern" value="<?php echo $pattern ?>"/>
<input type="submit" class="inb filter" value="<?php __("submit"); ?>" />
<input type="hidden" name="show" value="<?php echo $show;?>" />
</p>
</form>
<?php
$list_creators = $admin->get_creator_list();
if ($subadmin == 1 || $cuid == 2000) {
$class=($show=="all") ? "inb" : "ina";
echo '<p><span class="'.$class.' filter"><a href="adm_list.php?show=all">' . _('List all AlternC accounts') . '</a></span>';
$class=($show!="all") ? "inb" : "ina";
echo ' <span class="'.$class.' filter"><a href="adm_list.php?show=me">' . _('List only my accounts') . '</a></span></p>';
if ($show != 'all') {
echo '<p><span class="inb filter"><a href="adm_list.php?show=all">' . _('List all AlternC accounts') . '</a></span>';
$infos_creators = array();
if ($subadmin == 1 || $cuid == 2000) {
$infos_creators = array();
foreach ($list_creators as $key => $val) {
$infos_creators[] = '<a href="adm_list.php?creator=' . $val['uid'] . '">' . $val['login'] . '</a>';
}
foreach ($list_creators as $key => $val) {
$infos_creators[] = '<a href="adm_list.php?creator=' . $val['uid'] . '">' . $val['login'] . '</a>';
}
if (count($infos_creators)) {
echo ' (' . _("Or only the accounts of:") . " " . implode(', ', $infos_creators) . ')';
}
}
echo "</p>";
} else { // if show != all
echo '<p><span class="ina filter"><a href="adm_list.php">' . _('List only my accounts') . '</a></span></p>';
if (count($infos_creators)) {
echo ' (' . _("Or only the accounts of:") . " " . implode(', ', $infos_creators) . ')';
}
}
}// END ($subadmin==1 || $cuid==2000)
?>
@ -126,7 +136,7 @@ if (!empty($error)) {
?>
<p>
<?php __("Here is the list of hosted AlternC accounts"); ?> (<?php printf(_("%s accounts"), count($accountList)); ?>)
<?php __("Here is the list of hosted AlternC accounts"); ?> (<?php printf(_("%s accounts"), $accountList? count($accountList) : 0); ?>)
</p>
<p><span class="ina add"><a href="adm_add.php"><?php __("Create a new AlternC account"); ?></a></span></p>
@ -256,7 +266,7 @@ if ($mem->user["admlist"] == 1) { // SHORT MODE
<td align="center">
<a href="adm_login.php?id=<?php echo $val["uid"]; ?>" title="<?php __("Connect as"); ?>">[&nbsp;<?php __("C"); ?>&nbsp;]</a>
<a href="adm_edit.php?uid=<?php echo $val["uid"] ?>" title="<?php __("Edit"); ?>">[&nbsp;<?php __("E"); ?>&nbsp;]</a>
<?php if ($admin->checkcreator($val['uid'])) { ?>
<?php if ($admin->checkcreator($val['uid'])||($show=="all")) { ?>
<a href="adm_quotaedit.php?uid=<?php echo $val["uid"] ?>" title="<?php __("Quotas"); ?>">[&nbsp;<?php __("Q"); ?>&nbsp;]</a><?php
} // $admin->checkcreator
$creator_name = ( ($val['creator'] == '0') ? _("himself") : $list_creators[$val['creator']]['login'])

View File

@ -401,6 +401,19 @@ img {
background-color: #F0F0F4;
}
@media screen and (min-width: 1000px) {
#global {
margin: 20px 50px;
width: auto;
display: flex;
}
#content {
flex: 1;
width: auto;
}
}
/* Main container */
#menu {