|
@@ -17,27 +17,59 @@
|
|
|
|
|
|
The Initial Developer of the Original Code is
|
|
|
Mark J Crane <[email protected]>
|
|
|
- Portions created by the Initial Developer are Copyright (C) 2008-2019
|
|
|
+ Portions created by the Initial Developer are Copyright (C) 2008-2020
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
Contributor(s):
|
|
|
Mark J Crane <[email protected]>
|
|
|
*/
|
|
|
-include "root.php";
|
|
|
-require_once "resources/require.php";
|
|
|
-require_once "resources/check_auth.php";
|
|
|
-if (permission_exists('menu_add') || permission_exists('menu_edit') || permission_exists('menu_delete')) {
|
|
|
- //access granted
|
|
|
-}
|
|
|
-else {
|
|
|
- echo "access denied";
|
|
|
- return;
|
|
|
-}
|
|
|
+
|
|
|
+//includes
|
|
|
+ require_once "root.php";
|
|
|
+ require_once "resources/require.php";
|
|
|
+ require_once "resources/check_auth.php";
|
|
|
+
|
|
|
+//check permissions
|
|
|
+ if (permission_exists('menu_add') || permission_exists('menu_edit') || permission_exists('menu_delete')) {
|
|
|
+ //access granted
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ echo "access denied";
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+
|
|
|
+//get the http post data
|
|
|
+ if (is_array($_POST['menu_items'])) {
|
|
|
+ $action = $_POST['action'];
|
|
|
+ $menu_uuid = $_POST['menu_uuid'];
|
|
|
+ $menu_items = $_POST['menu_items'];
|
|
|
+ }
|
|
|
+
|
|
|
+//process the http post data by action
|
|
|
+ if ($action != '' && is_array($menu_items) && @sizeof($menu_items) != 0) {
|
|
|
+ switch ($action) {
|
|
|
+ case 'toggle':
|
|
|
+ if (permission_exists('menu_item_edit')) {
|
|
|
+ $obj = new menu;
|
|
|
+ $obj->toggle_items($menu_items);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'delete':
|
|
|
+ if (permission_exists('menu_item_delete')) {
|
|
|
+ $obj = new menu;
|
|
|
+ $obj->delete_items($menu_items);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ header('Location: menu_edit.php?id='.urlencode($menu_uuid));
|
|
|
+ exit;
|
|
|
+ }
|
|
|
|
|
|
$tmp_menu_item_order = 0;
|
|
|
|
|
|
-function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid, $c) {
|
|
|
- global $menu_uuid, $tmp_menu_item_order, $v_link_label_edit, $v_link_label_delete, $page, $text;
|
|
|
+function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid) {
|
|
|
+ global $menu_uuid, $tmp_menu_item_order, $v_link_label_edit, $v_link_label_delete, $page, $text, $x;
|
|
|
|
|
|
//check for sub menus
|
|
|
$menu_item_level = $menu_item_level+1;
|
|
@@ -51,12 +83,8 @@ function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid, $c) {
|
|
|
$result2 = $database->select($sql, $parameters, 'all');
|
|
|
unset($sql, $parameters);
|
|
|
|
|
|
- $row_style["0"] = "row_style1";
|
|
|
- $row_style["1"] = "row_style1";
|
|
|
-
|
|
|
if (is_array($result2) && sizeof($result2) != 0) {
|
|
|
- if ($c == 0) { $c2 = 1; } else { $c2 = 0; }
|
|
|
- foreach($result2 as $row2) {
|
|
|
+ foreach ($result2 as $row2) {
|
|
|
//set the db values as php variables
|
|
|
$menu_item_uuid = $row2['menu_item_uuid'];
|
|
|
$menu_item_category = $row2['menu_item_category'];
|
|
@@ -95,52 +123,66 @@ function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid, $c) {
|
|
|
//display the main body of the list
|
|
|
switch ($menu_item_category) {
|
|
|
case "internal":
|
|
|
- $menu_item_title = "<a href='".PROJECT_PATH . $menu_item_link."'>$menu_item_title</a>";
|
|
|
+ $menu_item_link = "<a href='".PROJECT_PATH.$menu_item_link."'>$menu_item_link</a>";
|
|
|
break;
|
|
|
case "external":
|
|
|
if (substr($menu_item_link,0,1) == "/") {
|
|
|
- $menu_item_link = PROJECT_PATH . $menu_item_link;
|
|
|
+ $menu_item_link = PROJECT_PATH.$menu_item_link;
|
|
|
}
|
|
|
- $menu_item_title = "<a href='$menu_item_link' target='_blank'>$menu_item_title</a>";
|
|
|
+ $menu_item_link = "<a href='".$menu_item_link."' target='_blank'>".$menu_item_link."</a>";
|
|
|
break;
|
|
|
case "email":
|
|
|
- $menu_item_title = "<a href='mailto:$menu_item_link'>$menu_item_title</a>";
|
|
|
+ $menu_item_link = "<a href='mailto:".$menu_item_link."'>".$menu_item_link."</a>";
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
//display the content of the list
|
|
|
- $tr_link = permission_exists('menu_edit') ? "href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row2['menu_item_uuid']."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."'" : null;
|
|
|
- echo "<tr ".$tr_link.">\n";
|
|
|
- echo "<td valign='top' class='".$row_style[$c]." ".(($menu_item_category != 'internal') ? "tr_link_void" : null)."' style='padding-left: ".($menu_item_level * 25)."px;' nowrap>".$menu_item_title." </td>";
|
|
|
- echo "<td valign='top' class='".$row_style[$c]."'>".$group_list." </td>";
|
|
|
- echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_category." </td>";
|
|
|
- if ($menu_item_protected == "true") {
|
|
|
- echo "<td valign='top' class='".$row_style[$c]."' style='text-align: center;'><strong>".$text['label-true']."</strong> </td>";
|
|
|
+ if (permission_exists('menu_item_edit')) {
|
|
|
+ $list_row_url = 'menu_item_edit.php?id='.urlencode($menu_uuid)."&menu_item_uuid=".urlencode($menu_item_uuid)."&menu_item_parent_uuid=".urlencode($row2['menu_item_parent_uuid']);
|
|
|
+ }
|
|
|
+ echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
|
|
+ if (permission_exists('menu_item_edit') || permission_exists('menu_item_delete')) {
|
|
|
+ echo " <td class='checkbox'>\n";
|
|
|
+ echo " <input type='checkbox' name='menu_items[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
|
|
+ echo " <input type='hidden' name='menu_items[$x][uuid]' value='".escape($menu_item_uuid)."' />\n";
|
|
|
+ echo " </td>\n";
|
|
|
+ }
|
|
|
+ echo "<td class='no-wrap".($menu_item_category != 'internal' ? "no-link" : null)."' style='padding-left: ".($menu_item_level * 25)."px;'>\n";
|
|
|
+ if (permission_exists('menu_item_edit')) {
|
|
|
+ echo " <a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($menu_item_title)."</a>\n";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ echo " ".escape($menu_item_title);
|
|
|
+ }
|
|
|
+ echo "</td>\n";
|
|
|
+ echo "<td class='no-wrap overflow no-link hide-sm-dn'>".$menu_item_link." </td>\n";
|
|
|
+ echo "<td class='no-wrap overflow hide-xs'>".$group_list." </td>";
|
|
|
+ echo "<td class='center'>".$menu_item_category." </td>";
|
|
|
+ if (permission_exists('menu_item_edit')) {
|
|
|
+ echo " <td class='no-link center'>\n";
|
|
|
+ echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.($menu_item_protected == 'true' ? 'true' : 'false')],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
|
|
}
|
|
|
else {
|
|
|
- echo "<td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".$text['label-false']." </td>";
|
|
|
+ echo " <td class='center'>\n";
|
|
|
+ echo $text['label-'.($menu_item_protected == 'true' ? 'true' : 'false')];
|
|
|
}
|
|
|
- echo "<td valign='top' align='center' nowrap class='".$row_style[$c]."'>";
|
|
|
- echo " ";
|
|
|
- //echo " ".$row2[menu_item_order]." ";
|
|
|
- echo "</td>";
|
|
|
+ echo " </td>\n";
|
|
|
+ echo "<td class='center no-wrap'> </td>";
|
|
|
|
|
|
- //echo "<td valign='top' align='center' class='".$row_style[$c]."'>";
|
|
|
+ //echo "<td align='center'>";
|
|
|
//if (permission_exists('menu_edit')) {
|
|
|
// echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_up.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."&menu_item_uuid=".$row2[menu_item_uuid]."&menu_item_order=".$row2[menu_item_order]."'\" value='<' title='".$row2[menu_item_order].". ".$text['button-move_up']."'>";
|
|
|
// echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_down.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."&menu_item_uuid=".$row2[menu_item_uuid]."&menu_item_order=".$row2[menu_item_order]."'\" value='>' title='".$row2[menu_item_order].". ".$text['button-move_down']."'>";
|
|
|
//}
|
|
|
//echo "</td>";
|
|
|
|
|
|
- echo " <td class='list_control_icons'>\n";
|
|
|
- if (permission_exists('menu_edit')) {
|
|
|
- echo "<a href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row2['menu_item_uuid']."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
|
|
- }
|
|
|
- if (permission_exists('menu_delete')) {
|
|
|
- echo "<a href='menu_item_delete.php?id=".$menu_uuid."&menu_item_uuid=".$row2['menu_item_uuid']."' onclick=\"return confirm('".$text['confirm-delete']."')\" alt='".$text['button-delete']."'>$v_link_label_delete</a>";
|
|
|
+ if (permission_exists('menu_item_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
|
|
+ echo " <td class='action-button'>\n";
|
|
|
+ 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>";
|
|
|
+ echo "</tr>\n";
|
|
|
+ $x++;
|
|
|
|
|
|
//update the menu order
|
|
|
if ($row2['menu_item_order'] != $tmp_menu_item_order) {
|
|
@@ -158,183 +200,220 @@ function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid, $c) {
|
|
|
|
|
|
//check for additional sub menus
|
|
|
if (strlen($menu_item_uuid)> 0) {
|
|
|
- $c = build_db_child_menu_list($db, $menu_item_level, $menu_item_uuid, $c);
|
|
|
+ build_db_child_menu_list($db, $menu_item_level, $menu_item_uuid);
|
|
|
}
|
|
|
|
|
|
- if ($c==0) { $c=1; } else { $c=0; }
|
|
|
- } //end foreach
|
|
|
+ }
|
|
|
unset($result2, $row2);
|
|
|
}
|
|
|
- return $c;
|
|
|
- //end check for children
|
|
|
}
|
|
|
|
|
|
-require_once "resources/header.php";
|
|
|
-
|
|
|
-$order_by = $_GET["order_by"] != '' ? $_GET["order_by"] : 'menu_item_order';
|
|
|
-$order = $_GET["order"];
|
|
|
-
|
|
|
-$sql = "select * from v_menu_items ";
|
|
|
-$sql .= "where menu_uuid = :menu_uuid ";
|
|
|
-$sql .= "and menu_item_parent_uuid is null ";
|
|
|
-$sql .= order_by($order_by, $order);
|
|
|
-$parameters['menu_uuid'] = $menu_uuid;
|
|
|
-$database = new database;
|
|
|
-$result = $database->select($sql, $parameters, 'all');
|
|
|
-unset($sql, $parameters);
|
|
|
-
|
|
|
-$c = 0;
|
|
|
-$row_style["0"] = "row_style0";
|
|
|
-$row_style["1"] = "row_style0";
|
|
|
-
|
|
|
-echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
-echo " <tr>";
|
|
|
-echo " <th align='left' nowrap>".$text['label-title']."</th>";
|
|
|
-echo " <th align='left' nowrap>".$text['label-groups']."</th>";
|
|
|
-echo " <th align='left'nowrap>".$text['label-category']."</th>";
|
|
|
-echo " <th nowrap style='text-align: center;'>".$text['label-protected']."</th>";
|
|
|
-echo " <th nowrap width='70' style='text-align: center;'>".$text['label-menu_order']."</th>";
|
|
|
-echo " <td class='list_control_icons'>";
|
|
|
-if (permission_exists('menu_add')) {
|
|
|
- echo " <a href='menu_item_edit.php?id=".$menu_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
|
|
-}
|
|
|
-echo " </td>\n";
|
|
|
-echo " </tr>";
|
|
|
-if (is_array($result) && sizeof($result) != 0) {
|
|
|
- foreach($result as $row) {
|
|
|
- //set the db values as php variables
|
|
|
- $menu_item_uuid = $row['menu_item_uuid'];
|
|
|
- $menu_item_category = $row['menu_item_category'];
|
|
|
- $menu_item_title = $row['menu_item_title'];
|
|
|
- $menu_item_link = $row['menu_item_link'];
|
|
|
- $menu_item_protected = $row['menu_item_protected'];
|
|
|
-
|
|
|
- //get the groups that have been assigned to the menu
|
|
|
- $sql = "select ";
|
|
|
- $sql .= " g.group_name, g.domain_uuid as group_domain_uuid ";
|
|
|
- $sql .= "from ";
|
|
|
- $sql .= " v_menu_item_groups as mig, ";
|
|
|
- $sql .= " v_groups as g ";
|
|
|
- $sql .= "where ";
|
|
|
- $sql .= " mig.group_uuid = g.group_uuid ";
|
|
|
- $sql .= " and mig.menu_uuid = :menu_uuid ";
|
|
|
- $sql .= " and mig.menu_item_uuid = :menu_item_uuid ";
|
|
|
- $sql .= "order by ";
|
|
|
- $sql .= " g.domain_uuid desc, ";
|
|
|
- $sql .= " g.group_name asc ";
|
|
|
- $parameters['menu_uuid'] = $menu_uuid;
|
|
|
- $parameters['menu_item_uuid'] = $menu_item_uuid;
|
|
|
- $database = new database;
|
|
|
- $sub_result = $database->select($sql, $parameters, 'all');
|
|
|
- unset($sql, $group_list);
|
|
|
-
|
|
|
- if (is_array($sub_result) && sizeof($sub_result) != 0) {
|
|
|
- foreach ($sub_result as &$sub_row) {
|
|
|
- $group_list[] = $sub_row["group_name"].(($sub_row['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$sub_row['group_domain_uuid']]['domain_name'] : null);
|
|
|
- }
|
|
|
- $group_list = implode(', ', $group_list);
|
|
|
- }
|
|
|
- unset($sub_result, $sub_row);
|
|
|
-
|
|
|
- //add the type link based on the typd of the menu
|
|
|
- switch ($menu_item_category) {
|
|
|
- case "internal":
|
|
|
- $menu_item_title = "<a href='".PROJECT_PATH . $menu_item_link."'>$menu_item_title</a>";
|
|
|
- break;
|
|
|
- case "external":
|
|
|
- if (substr($menu_item_link, 0,1) == "/") {
|
|
|
- $menu_item_link = PROJECT_PATH . $menu_item_link;
|
|
|
+//get variables used to control the order
|
|
|
+ $order_by = $_GET["order_by"];
|
|
|
+ $order = $_GET["order"];
|
|
|
+
|
|
|
+//get the list
|
|
|
+ $sql = "select * from v_menu_items ";
|
|
|
+ $sql .= "where menu_uuid = :menu_uuid ";
|
|
|
+ $sql .= "and menu_item_parent_uuid is null ";
|
|
|
+ $sql .= order_by($order_by, $order, 'menu_item_order', 'asc');
|
|
|
+ $parameters['menu_uuid'] = $menu_uuid;
|
|
|
+ $database = new database;
|
|
|
+ $result = $database->select($sql, $parameters, 'all');
|
|
|
+ $num_rows = is_array($result) && @sizeof($result) != 0 ? sizeof($result) : 0;
|
|
|
+ unset($sql, $parameters);
|
|
|
+
|
|
|
+//create token
|
|
|
+ $object = new token;
|
|
|
+ $token = $object->create('/core/menu/menu_item_list.php');
|
|
|
+
|
|
|
+//show the content
|
|
|
+ echo "<form id='form_list' method='post' action='menu_item_list.php'>\n";
|
|
|
+ echo "<input type='hidden' name='action' id='action' value=''>\n";
|
|
|
+ echo "<input type='hidden' name='menu_uuid' value='".escape($menu_uuid)."'>\n";
|
|
|
+
|
|
|
+ echo "<div class='action_bar' id='action_bar_sub'>\n";
|
|
|
+ echo " <div class='heading'><b id='heading_sub'>".$text['header-menu_items']." (".$num_rows.")</b></div>\n";
|
|
|
+ echo " <div class='actions'>\n";
|
|
|
+ echo button::create(['type'=>'button','id'=>'action_bar_sub_button_back','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'collapse'=>'hide-xs','style'=>'margin-right: 15px; display: none;','link'=>'menu.php']);
|
|
|
+ if (permission_exists('menu_item_add')) {
|
|
|
+ echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'hide-xs','link'=>'menu_item_edit.php?id='.urlencode($menu_uuid)]);
|
|
|
+ }
|
|
|
+ if (permission_exists('menu_item_edit') && $result) {
|
|
|
+ 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('menu_item_delete') && $result) {
|
|
|
+ echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'collapse'=>'hide-xs','onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
|
|
+ }
|
|
|
+ echo " </div>\n";
|
|
|
+ echo " <div style='clear: both;'></div>\n";
|
|
|
+ echo "</div>\n";
|
|
|
+
|
|
|
+ echo "<table class='list'>\n";
|
|
|
+ echo " <tr class='list-header'>";
|
|
|
+ if (permission_exists('menu_item_edit') || permission_exists('menu_item_delete')) {
|
|
|
+ echo " <th class='checkbox'>\n";
|
|
|
+ echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($result ?: "style='visibility: hidden;'").">\n";
|
|
|
+ echo " </th>\n";
|
|
|
+ }
|
|
|
+ echo " <th class='no-wrap pct-30'>".$text['label-title']."</th>";
|
|
|
+ echo " <th class='no-wrap pct-35 hide-sm-dn'>".$text['label-link']."</th>";
|
|
|
+ echo " <th class='no-wrap pct-35 hide-xs'>".$text['label-groups']."</th>";
|
|
|
+ echo " <th class='no-wrap center shrink'>".$text['label-category']."</th>";
|
|
|
+ echo " <th class='no-wrap center shrink'>".$text['label-protected']."</th>";
|
|
|
+ echo " <th class='no-wrap center shrink'>".$text['label-menu_order']."</th>";
|
|
|
+ if (permission_exists('menu_item_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
|
|
+ echo " <td class='action-button'> </td>\n";
|
|
|
+ }
|
|
|
+ echo "</tr>\n";
|
|
|
+
|
|
|
+ if (is_array($result) && @sizeof($result) != 0) {
|
|
|
+ $x = 0;
|
|
|
+ foreach ($result as $row) {
|
|
|
+ //set the db values as php variables
|
|
|
+ $menu_item_uuid = $row['menu_item_uuid'];
|
|
|
+ $menu_item_category = $row['menu_item_category'];
|
|
|
+ $menu_item_title = $row['menu_item_title'];
|
|
|
+ $menu_item_link = $row['menu_item_link'];
|
|
|
+ $menu_item_protected = $row['menu_item_protected'];
|
|
|
+
|
|
|
+ //get the groups that have been assigned to the menu
|
|
|
+ $sql = "select ";
|
|
|
+ $sql .= " g.group_name, g.domain_uuid as group_domain_uuid ";
|
|
|
+ $sql .= "from ";
|
|
|
+ $sql .= " v_menu_item_groups as mig, ";
|
|
|
+ $sql .= " v_groups as g ";
|
|
|
+ $sql .= "where ";
|
|
|
+ $sql .= " mig.group_uuid = g.group_uuid ";
|
|
|
+ $sql .= " and mig.menu_uuid = :menu_uuid ";
|
|
|
+ $sql .= " and mig.menu_item_uuid = :menu_item_uuid ";
|
|
|
+ $sql .= "order by ";
|
|
|
+ $sql .= " g.domain_uuid desc, ";
|
|
|
+ $sql .= " g.group_name asc ";
|
|
|
+ $parameters['menu_uuid'] = $menu_uuid;
|
|
|
+ $parameters['menu_item_uuid'] = $menu_item_uuid;
|
|
|
+ $database = new database;
|
|
|
+ $sub_result = $database->select($sql, $parameters, 'all');
|
|
|
+ unset($sql, $group_list);
|
|
|
+
|
|
|
+ if (is_array($sub_result) && sizeof($sub_result) != 0) {
|
|
|
+ foreach ($sub_result as &$sub_row) {
|
|
|
+ $group_list[] = $sub_row["group_name"].(($sub_row['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$sub_row['group_domain_uuid']]['domain_name'] : null);
|
|
|
}
|
|
|
- $menu_item_title = "<a href='$menu_item_link' target='_blank'>$menu_item_title</a>";
|
|
|
- break;
|
|
|
- case "email":
|
|
|
- $menu_item_title = "<a href='mailto:$menu_item_link'>$menu_item_title</a>";
|
|
|
- break;
|
|
|
- }
|
|
|
+ $group_list = implode(', ', $group_list);
|
|
|
+ }
|
|
|
+ unset($sub_result, $sub_row);
|
|
|
+
|
|
|
+ //add the type link based on the type of the menu
|
|
|
+ switch ($menu_item_category) {
|
|
|
+ case "internal":
|
|
|
+ $menu_item_link = "<a href='".PROJECT_PATH.$menu_item_link."'>".$menu_item_link."</a>";
|
|
|
+ break;
|
|
|
+ case "external":
|
|
|
+ if (substr($menu_item_link, 0,1) == "/") {
|
|
|
+ $menu_item_link = PROJECT_PATH.$menu_item_link;
|
|
|
+ }
|
|
|
+ $menu_item_link = "<a href='".$menu_item_link."' target='_blank'>".$menu_item_link."</a>";
|
|
|
+ break;
|
|
|
+ case "email":
|
|
|
+ $menu_item_link = "<a href='mailto:".$menu_item_link."'>".$menu_item_link."</a>";
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- //display the content of the list
|
|
|
- $tr_link = (permission_exists('menu_edit')) ? "href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."'" : null;
|
|
|
- echo "<tr style='".$row_style[$c]."' ".$tr_link.">\n";
|
|
|
- echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_title." </td>";
|
|
|
- echo "<td valign='top' class='".$row_style[$c]."'>".$group_list." </td>";
|
|
|
- //echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_link." </td>";
|
|
|
- echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_category." </td>";
|
|
|
- //echo "<td valign='top' class='".$row_style[$c]."'>".$row[menu_item_description]."</td>";
|
|
|
- //echo "<td valign='top' class='".$row_style[$c]."'>".$row['menu_item_parent_uuid']." </td>";
|
|
|
- //echo "<td valign='top' class='".$row_style[$c]."'>".$row['menu_item_order']." </td>";
|
|
|
-
|
|
|
- if ($menu_item_protected == "true") {
|
|
|
- echo "<td valign='top' class='".$row_style[$c]."' style='text-align: center;'><strong>".$text['label-true']."</strong> </td>";
|
|
|
- }
|
|
|
- else {
|
|
|
- echo "<td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".$text['label-false']." </td>";
|
|
|
- }
|
|
|
+ //display the content of the list
|
|
|
+ if (permission_exists('menu_item_edit')) {
|
|
|
+ $list_row_url = 'menu_item_edit.php?id='.urlencode($menu_uuid)."&menu_item_uuid=".urlencode($menu_item_uuid)."&menu_uuid=".urlencode($menu_uuid);
|
|
|
+ }
|
|
|
+ echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
|
|
+ if (permission_exists('menu_item_edit') || permission_exists('menu_item_delete')) {
|
|
|
+ echo "<td class='checkbox'>\n";
|
|
|
+ echo " <input type='checkbox' name='menu_items[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
|
|
+ echo " <input type='hidden' name='menu_items[$x][uuid]' value='".escape($menu_item_uuid)."' />\n";
|
|
|
+ echo "</td>\n";
|
|
|
+ }
|
|
|
+ echo "<td>\n";
|
|
|
+ if (permission_exists('menu_item_edit')) {
|
|
|
+ echo " <a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($menu_item_title)."</a>\n";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ echo " ".escape($menu_item_title);
|
|
|
+ }
|
|
|
+ echo "</td>\n";
|
|
|
+ echo "<td class='no-wrap overflow no-link hide-sm-dn'>".$menu_item_link." </td>\n";
|
|
|
+ echo "<td class='no-wrap overflow hide-xs'>".$group_list." </td>\n";
|
|
|
+ echo "<td class='center'>".$menu_item_category." </td>\n";
|
|
|
+ if (permission_exists('menu_item_edit')) {
|
|
|
+ echo "<td class='no-link center'>\n";
|
|
|
+ echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.($menu_item_protected == 'true' ? 'true' : 'false')],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ echo "<td class='center'>\n";
|
|
|
+ echo $text['label-'.($menu_item_protected == 'true' ? 'true' : 'false')];
|
|
|
+ }
|
|
|
+ echo "</td>\n";
|
|
|
+ echo "<td class='center'>".$row['menu_item_order']." </td>\n";
|
|
|
+
|
|
|
+ //echo "<td align='center' nowrap>";
|
|
|
+ //if (permission_exists('menu_edit')) {
|
|
|
+ // echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_up.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row['menu_item_parent_uuid']."&menu_item_uuid=".$menu_item_uuid."&menu_item_order=".$row['menu_item_order']."'\" value='<' title='".$row['menu_item_order'].". ".$text['button-move_up']."'>";
|
|
|
+ // echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_down.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row['menu_item_parent_uuid']."&menu_item_uuid=".$menu_item_uuid."&menu_item_order=".$row['menu_item_order']."'\" value='>' title='".$row['menu_item_order'].". ".$text['button-move_down']."'>";
|
|
|
+ //}
|
|
|
+ //echo "</td>";
|
|
|
+
|
|
|
+ if (permission_exists('menu_item_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
|
|
+ echo "<td class='action-button'>\n";
|
|
|
+ echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
|
|
+ echo "</td>\n";
|
|
|
+ }
|
|
|
+ echo "</tr>\n";
|
|
|
+ $x++;
|
|
|
+
|
|
|
+ //update the menu order
|
|
|
+ if ($row['menu_item_order'] != $tmp_menu_item_order) {
|
|
|
+ $array['menu_items'][0]['menu_item_uuid'] = $menu_item_uuid;
|
|
|
+ $array['menu_items'][0]['menu_uuid'] = $menu_uuid;
|
|
|
+ $array['menu_items'][0]['menu_item_title'] = $row['menu_item_title'];
|
|
|
+ $array['menu_items'][0]['menu_item_order'] = $tmp_menu_item_order;
|
|
|
+ //$database = new database;
|
|
|
+ //$database->app_name = 'menu';
|
|
|
+ //$database->app_uuid = 'f4b3b3d2-6287-489c-2a00-64529e46f2d7';
|
|
|
+ //$database->save($array);
|
|
|
+ unset($array);
|
|
|
+ }
|
|
|
+ $tmp_menu_item_order++;
|
|
|
|
|
|
- echo "<td valign='top' nowrap class='".$row_style[$c]."' style='text-align: center;'>";
|
|
|
- echo " ".$row['menu_item_order']." ";
|
|
|
- echo "</td>";
|
|
|
+ //check for sub menus
|
|
|
+ $menu_item_level = 0;
|
|
|
+ if (is_uuid($menu_item_uuid)) {
|
|
|
+ build_db_child_menu_list($db, $menu_item_level, $menu_item_uuid);
|
|
|
+ }
|
|
|
|
|
|
- //echo "<td valign='top' align='center' nowrap class='".$row_style[$c]."'>";
|
|
|
- //if (permission_exists('menu_edit')) {
|
|
|
- // echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_up.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row['menu_item_parent_uuid']."&menu_item_uuid=".$row['menu_item_uuid']."&menu_item_order=".$row['menu_item_order']."'\" value='<' title='".$row['menu_item_order'].". ".$text['button-move_up']."'>";
|
|
|
- // echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_down.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row['menu_item_parent_uuid']."&menu_item_uuid=".$row['menu_item_uuid']."&menu_item_order=".$row['menu_item_order']."'\" value='>' title='".$row['menu_item_order'].". ".$text['button-move_down']."'>";
|
|
|
- //}
|
|
|
- //echo "</td>";
|
|
|
+ }
|
|
|
+ unset($result);
|
|
|
|
|
|
- echo " <td class='list_control_icons'>";
|
|
|
- if (permission_exists('menu_edit')) {
|
|
|
- echo "<a href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
|
|
- }
|
|
|
- if (permission_exists('menu_delete')) {
|
|
|
- echo "<a href='menu_item_delete.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."' onclick=\"return confirm('".$text['confirm-delete']."')\" alt='".$text['button-delete']."'>$v_link_label_delete</a>";
|
|
|
- }
|
|
|
- echo " </td>\n";
|
|
|
- echo "</tr>";
|
|
|
-
|
|
|
- //update the menu order
|
|
|
- if ($row['menu_item_order'] != $tmp_menu_item_order) {
|
|
|
- $array['menu_items'][0]['menu_item_uuid'] = $row['menu_item_uuid'];
|
|
|
- $array['menu_items'][0]['menu_uuid'] = $menu_uuid;
|
|
|
- $array['menu_items'][0]['menu_item_title'] = $row['menu_item_title'];
|
|
|
- $array['menu_items'][0]['menu_item_order'] = $tmp_menu_item_order;
|
|
|
- //$database = new database;
|
|
|
- //$database->app_name = 'menu';
|
|
|
- //$database->app_uuid = 'f4b3b3d2-6287-489c-2a00-64529e46f2d7';
|
|
|
- //$database->save($array);
|
|
|
- unset($array);
|
|
|
- }
|
|
|
- $tmp_menu_item_order++;
|
|
|
+ }
|
|
|
|
|
|
- //check for sub menus
|
|
|
- $menu_item_level = 0;
|
|
|
- if (strlen($row['menu_item_uuid']) > 0) {
|
|
|
- $c = build_db_child_menu_list($db, $menu_item_level, $row['menu_item_uuid'], $c);
|
|
|
- }
|
|
|
+ echo "</table>\n";
|
|
|
+ echo "<br><br>";
|
|
|
|
|
|
- if ($c==0) { $c=1; } else { $c=0; }
|
|
|
- } //end foreach
|
|
|
- unset($result);
|
|
|
-
|
|
|
-} //end if results
|
|
|
-
|
|
|
-echo "<tr>\n";
|
|
|
-echo "<td colspan='6' align='left'>\n";
|
|
|
-echo " <table border='0' width='100%' cellpadding='0' cellspacing='0'>\n";
|
|
|
-echo " <tr>\n";
|
|
|
-echo " <td width='33.3%' nowrap> </td>\n";
|
|
|
-echo " <td width='33.3%' align='center' nowrap> </td>\n";
|
|
|
-echo " <td width='33.3%' align='right'>\n";
|
|
|
-if (permission_exists('menu_add') && $action == "update") {
|
|
|
- echo " <a href='menu_item_edit.php?id=".$menu_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
|
|
|
-}
|
|
|
-echo " </td>\n";
|
|
|
-echo " </tr>\n";
|
|
|
-echo " </table>\n";
|
|
|
+ echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
|
|
+ echo "</form>\n";
|
|
|
+
|
|
|
+//make sub action bar sticky
|
|
|
+ echo "<script>\n";
|
|
|
+
|
|
|
+ echo " window.addEventListener('scroll', function(){\n";
|
|
|
+ echo " action_bar_scroll('action_bar_sub', 280, heading_modify, heading_restore);\n";
|
|
|
+ echo " }, false);\n";
|
|
|
+
|
|
|
+ echo " function heading_modify() {\n";
|
|
|
+ echo " document.getElementById('action_bar_sub_button_back').style.display = 'inline-block';\n";
|
|
|
+ echo " }\n";
|
|
|
+
|
|
|
+ echo " function heading_restore() {\n";
|
|
|
+ echo " document.getElementById('action_bar_sub_button_back').style.display = 'none';\n";
|
|
|
+ echo " }\n";
|
|
|
|
|
|
-echo "</td>\n";
|
|
|
-echo "</tr>\n";
|
|
|
-echo "</table>\n";
|
|
|
-echo "<br><br>";
|
|
|
+ echo "</script>\n";
|
|
|
|
|
|
-require_once "resources/footer.php";
|
|
|
-?>
|
|
|
+?>
|