Update Bridges list page.
This commit is contained in:
parent
349684bb00
commit
3e1c19640b
|
|
@ -42,6 +42,7 @@
|
|||
//get posted data
|
||||
if (is_array($_POST['bridges'])) {
|
||||
$action = $_POST['action'];
|
||||
$search = $_POST['search'];
|
||||
$bridges = $_POST['bridges'];
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +53,7 @@
|
|||
$obj = new bridges;
|
||||
$obj->copy($bridges);
|
||||
//redirect
|
||||
header('Location: bridges.php');
|
||||
header('Location: bridges.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
@ -64,7 +65,7 @@
|
|||
$obj = new bridges;
|
||||
$obj->toggle($bridges);
|
||||
//redirect
|
||||
header('Location: bridges.php');
|
||||
header('Location: bridges.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
@ -76,7 +77,7 @@
|
|||
$obj = new bridges;
|
||||
$obj->delete($bridges);
|
||||
//redirect
|
||||
header('Location: bridges.php');
|
||||
header('Location: bridges.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
@ -123,6 +124,7 @@
|
|||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
list($paging_controls_mini, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page, true);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
|
|
@ -131,40 +133,15 @@
|
|||
$sql .= limit_offset($rows_per_page, $offset);
|
||||
$database = new database;
|
||||
$bridges = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//create token
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//alternate the row style
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
//include the header
|
||||
require_once "resources/header.php";
|
||||
|
||||
//define the checkbox functions
|
||||
echo "<script type='text/javascript'>\n";
|
||||
echo " function checkbox_toggle() {\n";
|
||||
echo " var inputs = document.getElementsByTagName('input');\n";
|
||||
echo " var box_checked = document.getElementById('checkbox_all').checked;\n";
|
||||
echo " for (var i = 0, max = inputs.length; i < max; i++) {\n";
|
||||
echo " if (inputs[i].type === 'checkbox') {\n";
|
||||
echo " inputs[i].checked = box_checked;\n";
|
||||
echo " }\n";
|
||||
echo " }\n";
|
||||
echo " if (box_checked) {\n";
|
||||
echo " document.getElementById('btn_check_all').style.display = 'none';\n";
|
||||
echo " document.getElementById('btn_check_none').style.display = '';\n";
|
||||
echo " }\n";
|
||||
echo " else {\n";
|
||||
echo " document.getElementById('btn_check_all').style.display = '';\n";
|
||||
echo " document.getElementById('btn_check_none').style.display = 'none';\n";
|
||||
echo " }\n";
|
||||
echo " }\n";
|
||||
echo "</script>\n";
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <b style='float: left;'>".$text['title-bridges']." (".$num_rows.")</b>\n";
|
||||
|
|
@ -172,13 +149,13 @@
|
|||
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'link'=>'bridge_edit.php']);
|
||||
}
|
||||
if (permission_exists('bridge_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'onclick'=>"if (confirm('".$text['confirm-copy']."')) { set_action('copy'); submit_form('form_list'); } else { this.blur(); return false; }"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'onclick'=>"if (confirm('".$text['confirm-copy']."')) { list_action_set('copy'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
if (permission_exists('bridge_edit')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'onclick'=>"if (confirm('".$text['confirm-toggle']."')) { set_action('toggle'); submit_form('form_list'); } else { this.blur(); return false; }"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'onclick'=>"if (confirm('".$text['confirm-toggle']."')) { list_action_set('toggle'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
if (permission_exists('bridge_delete')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'onclick'=>"if (confirm('".$text['confirm-delete']."')) { set_action('delete'); submit_form('form_list'); } else { this.blur(); return false; }"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
if (permission_exists('bridge_all')) {
|
||||
if ($_GET['show'] == 'all') {
|
||||
|
|
@ -189,9 +166,12 @@
|
|||
}
|
||||
}
|
||||
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||
echo "<input type='text' class='txt search' name='search' id='search' value='".escape($search)."' placeholder=\"".$text['label-search']."\" onkeydown='reset_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'=>'bridges.php','style'=>($search == '' ? 'display: none;' : null)]);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
echo "</form>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
|
@ -200,11 +180,12 @@
|
|||
|
||||
echo "<form id='form_list' method='post'>\n";
|
||||
echo "<input type='hidden' id='action' name='action' value=''>\n";
|
||||
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
|
||||
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo " <th style='width: 30px;'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' value='' onclick='checkbox_toggle();'>\n";
|
||||
echo "<table class='list'>\n";
|
||||
echo "<tr class='list-header'>\n";
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' value='' onclick='list_all_toggle();'>\n";
|
||||
echo " </th>\n";
|
||||
if ($_GET['show'] == "all" && permission_exists('bridge_all')) {
|
||||
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
|
||||
|
|
@ -213,50 +194,49 @@
|
|||
echo th_order_by('bridge_destination', $text['label-bridge_destination'], $order_by, $order);
|
||||
echo th_order_by('bridge_enabled', $text['label-bridge_enabled'], $order_by, $order, null, "style='text-align: center;'");
|
||||
echo " <th>".$text['label-description']."</th>\n";
|
||||
echo " <td style='width: 1px;'> </td>\n";
|
||||
if (permission_exists('bridge_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($bridges)) {
|
||||
$x = 0;
|
||||
foreach($bridges as $row) {
|
||||
if (permission_exists('bridge_edit')) {
|
||||
$tr_link = "href='bridge_edit.php?id=".escape($row['bridge_uuid'])."'";
|
||||
$list_row_url = "bridge_edit.php?id=".escape($row['bridge_uuid']);
|
||||
}
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='align: center; padding: 3px 3px 0px 8px;'>\n";
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='bridges[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||
echo " <input type='hidden' name='bridges[$x][bridge_uuid]' value='".escape($row['bridge_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
if ($_GET['show'] == "all" && permission_exists('bridge_all')) {
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
|
||||
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
|
||||
}
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
echo " <td>";
|
||||
if (permission_exists('bridge_edit')) {
|
||||
echo " <a ".$tr_link." title=\"".$text['button-edit']."\">".escape($row['bridge_name'])."</a>\n";
|
||||
echo " <a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($row['bridge_name'])."</a>\n";
|
||||
}
|
||||
else {
|
||||
echo " ".escape($row['bridge_name'])."\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['bridge_destination'])."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center;'>";
|
||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['bridge_enabled']],'title'=>$text['button-toggle'],'onclick'=>"check_self('checkbox_".$x."'); set_action('toggle'); submit_form('form_list')"]);
|
||||
echo " <td>".escape($row['bridge_destination'])."</td>\n";
|
||||
echo " <td class='no-link' style='text-align: center;'>";
|
||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['bridge_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['bridge_description'])."</td>\n";
|
||||
echo " <td style='width: 0; white-space: nowrap;' class='tr_link_void'>";
|
||||
|
||||
echo " <td class='description overflow'>".escape($row['bridge_description'])."</td>\n";
|
||||
if (permission_exists('bridge_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>"bridge_edit.php?id=".escape($row['bridge_uuid'])]);
|
||||
echo " <td class='action-button'>";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = $c ? 0 : 1;
|
||||
$x++;
|
||||
}
|
||||
unset($sql, $bridges);
|
||||
unset($bridges);
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
echo "<div align='center'>".$paging_controls."</div>\n";
|
||||
|
|
@ -265,27 +245,7 @@
|
|||
|
||||
echo "</form>\n";
|
||||
|
||||
//handle form actions
|
||||
echo "<script type='text/javascript'>\n";
|
||||
echo " function check_self(checkbox_id) {\n";
|
||||
echo " document.getElementById(checkbox_id).checked = true;\n";
|
||||
echo " }\n";
|
||||
|
||||
echo " function set_action(action) {\n";
|
||||
echo " document.getElementById('action').value = action;\n";
|
||||
echo " }\n";
|
||||
|
||||
echo " function submit_form(form_id) {\n";
|
||||
echo " document.getElementById(form_id).submit();\n";
|
||||
echo " }\n";
|
||||
|
||||
echo " function reset_search() {\n";
|
||||
echo " document.getElementById('btn_reset').style.display = 'none';\n";
|
||||
echo " document.getElementById('btn_search').style.display = '';\n";
|
||||
echo " }\n";
|
||||
echo "</script>\n";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
@ -207,4 +207,4 @@ $obj = new bridges;
|
|||
$obj->delete();
|
||||
*/
|
||||
|
||||
?>
|
||||
?>
|
||||
Loading…
Reference in New Issue