Registrations: Restore Show All button, better widths for Agent and Status columns.

This commit is contained in:
Nate 2019-12-02 19:01:41 -07:00
parent 6263fd7a0a
commit 941b21adbb
4 changed files with 63 additions and 29 deletions

View File

@ -44,10 +44,12 @@
$text = $language->get();
//get common submitted data
$show = $_REQUEST['show'];
$search = $_REQUEST['search'];
$profile = $_REQUEST['profile'];
//define query string array
if ($show) { $qs['show'] = "&show=".urlencode($show); }
if ($search) { $qs['search'] = "&search=".urlencode($search); }
if ($profile) { $qs['profile'] = "&profile=".urlencode($profile); }
@ -75,13 +77,14 @@
break;
}
header('Location: registrations.php'.($search || $profile ? '?' : null).$qs['search'].$qs['profile']);
header('Location: registrations.php'.($show || $search || $profile ? '?' : null).$qs['show'].$qs['search'].$qs['profile']);
exit;
}
//get the registrations
$obj = new registrations;
$registrations = $obj->get(!$profile ? 'all' : $profile);
$obj->show = $show;
$registrations = $obj->get($profile);
//order the array
require_once "resources/classes/array_order.php";
@ -120,21 +123,28 @@
echo " <div class='heading'><b>".$text['header-registrations']." (".$num_rows.")</b></div>\n";
echo " <div class='actions'>\n";
if (!$reload) {
echo button::create(['type'=>'button','label'=>$text['button-refresh'],'icon'=>$_SESSION['theme']['button_icon_refresh'],'link'=>$location.($qs ? '?' : null).$qs['search'].$qs['profile']]);
echo button::create(['type'=>'button','label'=>$text['button-refresh'],'icon'=>$_SESSION['theme']['button_icon_refresh'],'link'=>$location.($qs ? '?' : null).$qs['show'].$qs['search'].$qs['profile']]);
}
echo button::create(['type'=>'button','label'=>$text['button-unregister'],'title'=>$text['button-unregister'],'icon'=>'user-slash','style'=>'margin-left: 15px;','onclick'=>"if (confirm('".$text['confirm-unregister']."')) { list_action_set('unregister'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
echo button::create(['type'=>'button','label'=>$text['button-provision'],'title'=>$text['button-provision'],'icon'=>'fax','onclick'=>"if (confirm('".$text['confirm-provision']."')) { list_action_set('provision'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
echo button::create(['type'=>'button','label'=>$text['button-reboot'],'title'=>$text['button-reboot'],'icon'=>'power-off','onclick'=>"if (confirm('".$text['confirm-reboot']."')) { list_action_set('reboot'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
echo "<form id='form_search' class='inline' method='get'>\n";
if (permission_exists('registration_all')) {
echo "<input type='hidden' name='profile' value='".escape($profile)."'>";
if ($show == 'all') {
echo "<input type='hidden' name='show' value='".escape($show)."'>";
echo button::create(['type'=>'button','label'=>$text['button-show_local'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>$location.($qs['search'] || $qs['profile'] ? '?' : null).$qs['search'].$qs['profile']]);
}
else {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>$location.'?show=all'.$qs['search'].$qs['profile']]);
}
if ($profile != '') {
echo button::create(['type'=>'button','label'=>$text['button-all_profiles'],'icon'=>'network-wired','style'=>'margin-left: 15px;','link'=>$location.'?'.$qs['search']]);
echo "<input type='hidden' name='profile' value='".escape($profile)."'>";
echo button::create(['type'=>'button','label'=>$text['button-all_profiles'],'icon'=>'network-wired','style'=>'margin-left: 15px;','link'=>$location.($qs['show'] || $qs['search'] ? '?' : null).$qs['show'].$qs['search']]);
}
}
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>$location.($qs['profile'] ? '?' : null).$qs['profile'],'style'=>($search == '' ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>$location.($qs['show'] || $qs['profile'] ? '?' : null).$qs['show'].$qs['profile'],'style'=>($search == '' ? 'display: none;' : null)]);
echo " </form>\n";
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
@ -154,13 +164,13 @@
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($registrations ?: "style='visibility: hidden;'").">\n";
echo " </th>\n";
echo " <th>".$text['label-user']."</th>\n";
echo " <th class='min-pct-25'>".$text['label-agent']."</th>\n";
echo " <th class='pct-25'>".$text['label-agent']."</th>\n";
echo " <th class='hide-md-dn'>".$text['label-contact']."</th>\n";
echo " <th class='hide-sm-dn'>".$text['label-lan_ip']."</th>\n";
echo " <th class='hide-sm-dn'>".$text['label-ip']."</th>\n";
echo " <th class='hide-sm-dn'>".$text['label-port']."</th>\n";
echo " <th class='hide-md-dn'>".$text['label-hostname']."</th>\n";
echo " <th class='min-pct-35'>".$text['label-status']."</th>\n";
echo " <th class='pct-35' style='width: 35%;'>".$text['label-status']."</th>\n";
echo " <th class='hide-md-dn'>".$text['label-ping']."</th>\n";
echo " <th class='hide-md-dn'>".$text['label-sip_profile_name']."</th>\n";
echo " <td class='action-button'>&nbsp;</td>\n";

View File

@ -35,6 +35,7 @@ if (!class_exists('registrations')) {
private $app_uuid;
private $permission_prefix;
private $list_page;
public $show;
/**
* called when the object is created
@ -46,6 +47,7 @@ if (!class_exists('registrations')) {
$this->app_uuid = '5d9e7cd7-629e-3553-4cf5-f26e39fefa39';
$this->permission_prefix = 'registration_';
$this->list_page = 'registrations.php';
$this->show = 'local';
}
@ -163,7 +165,7 @@ if (!class_exists('registrations')) {
//remove unrelated domains
if (count($_SESSION["domains"]) > 1) {
if (!(permission_exists('registration_all') && $profile == "all")) {
if (!permission_exists('registration_all') || $this->show != 'all') {
if ($registrations[$id]['sip-auth-realm'] == $_SESSION['domain_name']) {}
else if ($user_array[1] == $_SESSION['domain_name']) {}
else {

View File

@ -592,6 +592,28 @@ $text['button-show_all']['sv-se'] = "Visa Allt";
$text['button-show_all']['uk-ua'] = "Показати всі";
$text['button-show_all']['tr-tr'] = "Hepsini Görüntüle";
$text['button-show_local']['en-us'] = "Show Local";
$text['button-show_local']['ar-eg'] = "Show Local";
$text['button-show_local']['de-at'] = "Show Local";
$text['button-show_local']['de-ch'] = "Show Local";
$text['button-show_local']['de-de'] = "Show Local";
$text['button-show_local']['el-gr'] = "Show Local";
$text['button-show_local']['es-cl'] = "Show Local";
$text['button-show_local']['es-mx'] = "Show Local";
$text['button-show_local']['fr-ca'] = "Show Local";
$text['button-show_local']['fr-fr'] = "Show Local";
$text['button-show_local']['he-il'] = "Show Local";
$text['button-show_local']['it-it'] = "Show Local";
$text['button-show_local']['nl-nl'] = "Show Local";
$text['button-show_local']['pl-pl'] = "Show Local";
$text['button-show_local']['pt-br'] = "Show Local";
$text['button-show_local']['pt-pt'] = "Show Local";
$text['button-show_local']['ro-ro'] = "Show Local";
$text['button-show_local']['ru-ru'] = "Show Local";
$text['button-show_local']['sv-se'] = "Show Local";
$text['button-show_local']['uk-ua'] = "Show Local";
$text['button-show_local']['tr-tr'] = "Show Local";
$text['button-restore']['en-us'] = "Restore Default";
$text['button-restore']['ar-eg'] = "";
$text['button-restore']['de-at'] = "Ursprungszustand wiederherstellen"; //copied from de-de

View File

@ -2467,26 +2467,26 @@ $default_login = ($_REQUEST['login'] == 'default') ? true : false;
/* WIDTH HELPERS **********************************************************************/
.min-pct-5 { min-width: 5%; }
.min-pct-10 { min-width: 10%; }
.min-pct-15 { min-width: 15%; }
.min-pct-20 { min-width: 20%; }
.min-pct-25 { min-width: 25%; }
.min-pct-30 { min-width: 30%; }
.min-pct-35 { min-width: 35%; }
.min-pct-40 { min-width: 40%; }
.min-pct-45 { min-width: 45%; }
.min-pct-50 { min-width: 50%; }
.min-pct-55 { min-width: 55%; }
.min-pct-60 { min-width: 60%; }
.min-pct-65 { min-width: 65%; }
.min-pct-70 { min-width: 70%; }
.min-pct-75 { min-width: 75%; }
.min-pct-80 { min-width: 80%; }
.min-pct-85 { min-width: 85%; }
.min-pct-90 { min-width: 90%; }
.min-pct-95 { min-width: 95%; }
.min-pct-100 { min-width: 100%; }
.pct-5 { width: 5%; }
.pct-10 { width: 10%; }
.pct-15 { width: 15%; }
.pct-20 { width: 20%; }
.pct-25 { width: 25%; }
.pct-30 { width: 30%; }
.pct-35 { width: 35%; }
.pct-40 { width: 40%; }
.pct-45 { width: 45%; }
.pct-50 { width: 50%; }
.pct-55 { width: 55%; }
.pct-60 { width: 60%; }
.pct-65 { width: 65%; }
.pct-70 { width: 70%; }
.pct-75 { width: 75%; }
.pct-80 { width: 80%; }
.pct-85 { width: 85%; }
.pct-90 { width: 90%; }
.pct-95 { width: 95%; }
.pct-100 { width: 100%; }
/* MODAL ************************************************************************/