Menu Manager: List view and button updates, bulk menu item delete and toggle protected, etc.

This commit is contained in:
Nate
2020-02-10 20:46:08 -07:00
parent f194f6872f
commit 18b26a9938
6 changed files with 559 additions and 593 deletions

View File

@@ -21,85 +21,45 @@ $text['title-menus']['ru-ru'] = "Управление меню";
$text['title-menus']['sv-se'] = "Meny Inställningar";
$text['title-menus']['uk-ua'] = "Менеджер меню";
$text['title-menu_item-edit']['en-us'] = "Menu Item";
$text['title-menu_item-edit']['ar-eg'] = "";
$text['title-menu_item-edit']['de-at'] = "Menüpunkt"; //copied from de-de
$text['title-menu_item-edit']['de-ch'] = "Menüpunkt"; //copied from de-de
$text['title-menu_item-edit']['de-de'] = "Menüpunkt";
$text['title-menu_item-edit']['es-cl'] = "Editar Ítem de Menú";
$text['title-menu_item-edit']['es-mx'] = "Editar Ítem de Menú"; //copied from es-cl
$text['title-menu_item-edit']['fr-ca'] = "Editer l'objet menu"; //copied from fr-fr
$text['title-menu_item-edit']['fr-fr'] = "Editer l'objet menu";
$text['title-menu_item-edit']['he-il'] = "";
$text['title-menu_item-edit']['it-it'] = "Voce Menu";
$text['title-menu_item-edit']['nl-nl'] = "";
$text['title-menu_item-edit']['pl-pl'] = "Pozycja menu";
$text['title-menu_item-edit']['pt-br'] = "Editar o item do Menu"; //copied from pt-pt
$text['title-menu_item-edit']['pt-pt'] = "Editar o Item do Menu";
$text['title-menu_item-edit']['ro-ro'] = "";
$text['title-menu_item-edit']['ru-ru'] = "Пункт меню";
$text['title-menu_item-edit']['sv-se'] = "Meny Post";
$text['title-menu_item-edit']['uk-ua'] = "Пункт меню";
$text['title-menu']['en-us'] = "Menu";
$text['title-menu']['ar-eg'] = "";
$text['title-menu']['de-at'] = "Menü"; //copied from de-de
$text['title-menu']['de-ch'] = "Menü"; //copied from de-de
$text['title-menu']['de-de'] = "Menü";
$text['title-menu']['es-cl'] = "Editar Menú";
$text['title-menu']['es-mx'] = "Editar Menú"; //copied from es-cl
$text['title-menu']['fr-ca'] = "Editer le Menu"; //copied from fr-fr
$text['title-menu']['fr-fr'] = "Editer le Menu";
$text['title-menu']['he-il'] = "";
$text['title-menu']['it-it'] = "Menu";
$text['title-menu']['nl-nl'] = "";
$text['title-menu']['pl-pl'] = "Menu";
$text['title-menu']['pt-br'] = "Editar Menu"; //copied from pt-pt
$text['title-menu']['pt-pt'] = "Editar Menu";
$text['title-menu']['ro-ro'] = "";
$text['title-menu']['ru-ru'] = "Меню";
$text['title-menu']['sv-se'] = "Meny";
$text['title-menu']['uk-ua'] = "Меню";
$text['title-menu_item-add']['en-us'] = "Menu Item";
$text['title-menu_item-add']['ar-eg'] = "";
$text['title-menu_item-add']['de-at'] = "Menüpunkt"; //copied from de-de
$text['title-menu_item-add']['de-ch'] = "Menüpunkt"; //copied from de-de
$text['title-menu_item-add']['de-de'] = "Menüpunkt";
$text['title-menu_item-add']['es-cl'] = "Agregar Ítem de Menú";
$text['title-menu_item-add']['es-mx'] = "Agregar Ítem de Menú"; //copied from es-cl
$text['title-menu_item-add']['fr-ca'] = "Ajouter un objet menu"; //copied from fr-fr
$text['title-menu_item-add']['fr-fr'] = "Ajouter un objet menu";
$text['title-menu_item-add']['he-il'] = "";
$text['title-menu_item-add']['it-it'] = "Voce Menu";
$text['title-menu_item-add']['nl-nl'] = "";
$text['title-menu_item-add']['pl-pl'] = "Pozycja menu";
$text['title-menu_item-add']['pt-br'] = "Adicionar um Item ao Menu"; //copied from pt-pt
$text['title-menu_item-add']['pt-pt'] = "Adicionar um Item ao Menu";
$text['title-menu_item-add']['ro-ro'] = "";
$text['title-menu_item-add']['ru-ru'] = "Пункт меню";
$text['title-menu_item-add']['sv-se'] = "Meny Post";
$text['title-menu_item-add']['uk-ua'] = "Пункт меню";
$text['title-menu-edit']['en-us'] = "Menu";
$text['title-menu-edit']['ar-eg'] = "";
$text['title-menu-edit']['de-at'] = "Menü"; //copied from de-de
$text['title-menu-edit']['de-ch'] = "Menü"; //copied from de-de
$text['title-menu-edit']['de-de'] = "Menü";
$text['title-menu-edit']['es-cl'] = "Editar Menú";
$text['title-menu-edit']['es-mx'] = "Editar Menú"; //copied from es-cl
$text['title-menu-edit']['fr-ca'] = "Editer le Menu"; //copied from fr-fr
$text['title-menu-edit']['fr-fr'] = "Editer le Menu";
$text['title-menu-edit']['he-il'] = "";
$text['title-menu-edit']['it-it'] = "Menu";
$text['title-menu-edit']['nl-nl'] = "";
$text['title-menu-edit']['pl-pl'] = "Menu";
$text['title-menu-edit']['pt-br'] = "Editar Menu"; //copied from pt-pt
$text['title-menu-edit']['pt-pt'] = "Editar Menu";
$text['title-menu-edit']['ro-ro'] = "";
$text['title-menu-edit']['ru-ru'] = "Меню";
$text['title-menu-edit']['sv-se'] = "Meny";
$text['title-menu-edit']['uk-ua'] = "Меню";
$text['title-menu-add']['en-us'] = "Menu";
$text['title-menu-add']['ar-eg'] = "";
$text['title-menu-add']['de-at'] = "Menü"; //copied from de-de
$text['title-menu-add']['de-ch'] = "Menü"; //copied from de-de
$text['title-menu-add']['de-de'] = "Menü";
$text['title-menu-add']['es-cl'] = "Agregar Menú";
$text['title-menu-add']['es-mx'] = "Agregar Menú"; //copied from es-cl
$text['title-menu-add']['fr-ca'] = "Ajouter un menu"; //copied from fr-fr
$text['title-menu-add']['fr-fr'] = "Ajouter un menu";
$text['title-menu-add']['he-il'] = "";
$text['title-menu-add']['it-it'] = "Menu";
$text['title-menu-add']['nl-nl'] = "";
$text['title-menu-add']['pl-pl'] = "Menu";
$text['title-menu-add']['pt-br'] = "Adicionar Menu"; //copied from pt-pt
$text['title-menu-add']['pt-pt'] = "Adicionar Menu";
$text['title-menu-add']['ro-ro'] = "";
$text['title-menu-add']['ru-ru'] = "Меню";
$text['title-menu-add']['sv-se'] = "Meny";
$text['title-menu-add']['uk-ua'] = "Меню";
$text['title-menu_item']['en-us'] = "Menu Item";
$text['title-menu_item']['ar-eg'] = "";
$text['title-menu_item']['de-at'] = "Menüpunkt"; //copied from de-de
$text['title-menu_item']['de-ch'] = "Menüpunkt"; //copied from de-de
$text['title-menu_item']['de-de'] = "Menüpunkt";
$text['title-menu_item']['es-cl'] = "Editar Ítem de Menú";
$text['title-menu_item']['es-mx'] = "Editar Ítem de Menú"; //copied from es-cl
$text['title-menu_item']['fr-ca'] = "Editer l'objet menu"; //copied from fr-fr
$text['title-menu_item']['fr-fr'] = "Editer l'objet menu";
$text['title-menu_item']['he-il'] = "";
$text['title-menu_item']['it-it'] = "Voce Menu";
$text['title-menu_item']['nl-nl'] = "";
$text['title-menu_item']['pl-pl'] = "Pozycja menu";
$text['title-menu_item']['pt-br'] = "Editar o item do Menu"; //copied from pt-pt
$text['title-menu_item']['pt-pt'] = "Editar o Item do Menu";
$text['title-menu_item']['ro-ro'] = "";
$text['title-menu_item']['ru-ru'] = "Пункт меню";
$text['title-menu_item']['sv-se'] = "Meny Post";
$text['title-menu_item']['uk-ua'] = "Пункт меню";
$text['label-menu_name']['en-us'] = "Name";
$text['label-menu_name']['ar-eg'] = "";
@@ -501,85 +461,65 @@ $text['header-menus']['ru-ru'] = "Управление меню";
$text['header-menus']['sv-se'] = "Meny Inställningar";
$text['header-menus']['uk-ua'] = "Менеджер меню";
$text['header-menu_item-edit']['en-us'] = "Menu Item";
$text['header-menu_item-edit']['ar-eg'] = "";
$text['header-menu_item-edit']['de-at'] = "Menüpunkt"; //copied from de-de
$text['header-menu_item-edit']['de-ch'] = "Menüpunkt"; //copied from de-de
$text['header-menu_item-edit']['de-de'] = "Menüpunkt";
$text['header-menu_item-edit']['es-cl'] = "Editar Ítem de Menú";
$text['header-menu_item-edit']['es-mx'] = "Editar Ítem de Menú"; //copied from es-cl
$text['header-menu_item-edit']['fr-ca'] = "Editer l'objet menu"; //copied from fr-fr
$text['header-menu_item-edit']['fr-fr'] = "Editer l'objet menu";
$text['header-menu_item-edit']['he-il'] = "";
$text['header-menu_item-edit']['it-it'] = "Voce Menu";
$text['header-menu_item-edit']['nl-nl'] = "";
$text['header-menu_item-edit']['pl-pl'] = "Pozycja menu";
$text['header-menu_item-edit']['pt-br'] = "Editar Item do Menu";
$text['header-menu_item-edit']['pt-pt'] = "Editar o Item do Menu";
$text['header-menu_item-edit']['ro-ro'] = "";
$text['header-menu_item-edit']['ru-ru'] = "Пункт меню";
$text['header-menu_item-edit']['sv-se'] = "Meny Post";
$text['header-menu_item-edit']['uk-ua'] = "Пункт меню";
$text['header-menu_item']['en-us'] = "Menu Item";
$text['header-menu_item']['ar-eg'] = "";
$text['header-menu_item']['de-at'] = "Menüpunkt"; //copied from de-de
$text['header-menu_item']['de-ch'] = "Menüpunkt"; //copied from de-de
$text['header-menu_item']['de-de'] = "Menüpunkt";
$text['header-menu_item']['es-cl'] = "Editar Ítem de Menú";
$text['header-menu_item']['es-mx'] = "Editar Ítem de Menú"; //copied from es-cl
$text['header-menu_item']['fr-ca'] = "Editer l'objet menu"; //copied from fr-fr
$text['header-menu_item']['fr-fr'] = "Editer l'objet menu";
$text['header-menu_item']['he-il'] = "";
$text['header-menu_item']['it-it'] = "Voce Menu";
$text['header-menu_item']['nl-nl'] = "";
$text['header-menu_item']['pl-pl'] = "Pozycja menu";
$text['header-menu_item']['pt-br'] = "Editar Item do Menu";
$text['header-menu_item']['pt-pt'] = "Editar o Item do Menu";
$text['header-menu_item']['ro-ro'] = "";
$text['header-menu_item']['ru-ru'] = "Пункт меню";
$text['header-menu_item']['sv-se'] = "Meny Post";
$text['header-menu_item']['uk-ua'] = "Пункт меню";
$text['header-menu_item-add']['en-us'] = "Menu Item";
$text['header-menu_item-add']['ar-eg'] = "";
$text['header-menu_item-add']['de-at'] = "Menüpunkt"; //copied from de-de
$text['header-menu_item-add']['de-ch'] = "Menüpunkt"; //copied from de-de
$text['header-menu_item-add']['de-de'] = "Menüpunkt";
$text['header-menu_item-add']['es-cl'] = "Agregar Ítem de Menú";
$text['header-menu_item-add']['es-mx'] = "Agregar Ítem de Menú"; //copied from es-cl
$text['header-menu_item-add']['fr-ca'] = "Ajouter un objet menu"; //copied from fr-fr
$text['header-menu_item-add']['fr-fr'] = "Ajouter un objet menu";
$text['header-menu_item-add']['he-il'] = "";
$text['header-menu_item-add']['it-it'] = "Voce Menu";
$text['header-menu_item-add']['nl-nl'] = "";
$text['header-menu_item-add']['pl-pl'] = "Pozycja menu";
$text['header-menu_item-add']['pt-br'] = "Adicionar um Item ao Menu"; //copied from pt-pt
$text['header-menu_item-add']['pt-pt'] = "Adicionar um Item ao Menu";
$text['header-menu_item-add']['ro-ro'] = "";
$text['header-menu_item-add']['ru-ru'] = "Пункт меню";
$text['header-menu_item-add']['sv-se'] = "Meny Post";
$text['header-menu_item-add']['uk-ua'] = "Пункт меню";
$text['header-menu_items']['en-us'] = "Menu Items";
$text['header-menu_items']['ar-eg'] = "";
$text['header-menu_items']['de-at'] = "Menüpunkt"; //copied from de-de
$text['header-menu_items']['de-ch'] = "Menüpunkt"; //copied from de-de
$text['header-menu_items']['de-de'] = "Menüpunkt";
$text['header-menu_items']['es-cl'] = "Agregar Ítem de Menú";
$text['header-menu_items']['es-mx'] = "Agregar Ítem de Menú"; //copied from es-cl
$text['header-menu_items']['fr-ca'] = "Ajouter un objet menu"; //copied from fr-fr
$text['header-menu_items']['fr-fr'] = "Ajouter un objet menu";
$text['header-menu_items']['he-il'] = "";
$text['header-menu_items']['it-it'] = "Voce Menu";
$text['header-menu_items']['nl-nl'] = "";
$text['header-menu_items']['pl-pl'] = "Pozycja menu";
$text['header-menu_items']['pt-br'] = "Adicionar um Item ao Menu"; //copied from pt-pt
$text['header-menu_items']['pt-pt'] = "Adicionar um Item ao Menu";
$text['header-menu_items']['ro-ro'] = "";
$text['header-menu_items']['ru-ru'] = "Пункт меню";
$text['header-menu_items']['sv-se'] = "Meny Post";
$text['header-menu_items']['uk-ua'] = "Пункт меню";
$text['header-menu-edit']['en-us'] = "Menu";
$text['header-menu-edit']['ar-eg'] = "";
$text['header-menu-edit']['de-at'] = "Menü"; //copied from de-de
$text['header-menu-edit']['de-ch'] = "Menü"; //copied from de-de
$text['header-menu-edit']['de-de'] = "Menü";
$text['header-menu-edit']['es-cl'] = "Editar Menú";
$text['header-menu-edit']['es-mx'] = "Editar Menú"; //copied from es-cl
$text['header-menu-edit']['fr-ca'] = "Editer le Menu"; //copied from fr-fr
$text['header-menu-edit']['fr-fr'] = "Editer le Menu";
$text['header-menu-edit']['he-il'] = "";
$text['header-menu-edit']['it-it'] = "Menu";
$text['header-menu-edit']['nl-nl'] = "";
$text['header-menu-edit']['pl-pl'] = "Menu";
$text['header-menu-edit']['pt-br'] = "Editar Menu"; //copied from pt-pt
$text['header-menu-edit']['pt-pt'] = "Editar Menu";
$text['header-menu-edit']['ro-ro'] = "";
$text['header-menu-edit']['ru-ru'] = "Меню";
$text['header-menu-edit']['sv-se'] = "Meny";
$text['header-menu-edit']['uk-ua'] = "Меню";
$text['header-menu-add']['en-us'] = "Menu";
$text['header-menu-add']['ar-eg'] = "";
$text['header-menu-add']['de-at'] = "Menü"; //copied from de-de
$text['header-menu-add']['de-ch'] = "Menü"; //copied from de-de
$text['header-menu-add']['de-de'] = "Menü";
$text['header-menu-add']['es-cl'] = "Agregar Menú";
$text['header-menu-add']['es-mx'] = "Agregar Menú"; //copied from es-cl
$text['header-menu-add']['fr-ca'] = "Ajouter un menu"; //copied from fr-fr
$text['header-menu-add']['fr-fr'] = "Ajouter un menu";
$text['header-menu-add']['he-il'] = "";
$text['header-menu-add']['it-it'] = "Menu";
$text['header-menu-add']['nl-nl'] = "";
$text['header-menu-add']['pl-pl'] = "Menu";
$text['header-menu-add']['pt-br'] = "Adicionar Menu"; //copied from pt-pt
$text['header-menu-add']['pt-pt'] = "Adicionar Menu";
$text['header-menu-add']['ro-ro'] = "";
$text['header-menu-add']['ru-ru'] = "Меню";
$text['header-menu-add']['sv-se'] = "Meny";
$text['header-menu-add']['uk-ua'] = "Меню";
$text['header-menu']['en-us'] = "Menu";
$text['header-menu']['ar-eg'] = "";
$text['header-menu']['de-at'] = "Menü"; //copied from de-de
$text['header-menu']['de-ch'] = "Menü"; //copied from de-de
$text['header-menu']['de-de'] = "Menü";
$text['header-menu']['es-cl'] = "Editar Menú";
$text['header-menu']['es-mx'] = "Editar Menú"; //copied from es-cl
$text['header-menu']['fr-ca'] = "Editer le Menu"; //copied from fr-fr
$text['header-menu']['fr-fr'] = "Editer le Menu";
$text['header-menu']['he-il'] = "";
$text['header-menu']['it-it'] = "Menu";
$text['header-menu']['nl-nl'] = "";
$text['header-menu']['pl-pl'] = "Menu";
$text['header-menu']['pt-br'] = "Editar Menu"; //copied from pt-pt
$text['header-menu']['pt-pt'] = "Editar Menu";
$text['header-menu']['ro-ro'] = "";
$text['header-menu']['ru-ru'] = "Меню";
$text['header-menu']['sv-se'] = "Meny";
$text['header-menu']['uk-ua'] = "Меню";
$text['description-title']['en-us'] = "Description";
$text['description-title']['ar-eg'] = "";
@@ -741,45 +681,25 @@ $text['description-menu_item-add']['ru-ru'] = "Описание";
$text['description-menu_item-add']['sv-se'] = "Beskrivning";
$text['description-menu_item-add']['uk-ua'] = "Опис";
$text['description-menu-edit']['en-us'] = "Used to customize one or more menus.";
$text['description-menu-edit']['ar-eg'] = "";
$text['description-menu-edit']['de-at'] = "Hier können Sie die Menüleiste bearbeiten."; //copied from de-de
$text['description-menu-edit']['de-ch'] = "Hier können Sie die Menüleiste bearbeiten."; //copied from de-de
$text['description-menu-edit']['de-de'] = "Hier können Sie die Menüleiste bearbeiten.";
$text['description-menu-edit']['es-cl'] = "Se usa para personalizar uno o más menús.";
$text['description-menu-edit']['es-mx'] = "Se usa para personalizar uno o más menús."; //copied from es-cl
$text['description-menu-edit']['fr-ca'] = "Personnaliser un ou plusieurs menus."; //copied from fr-fr
$text['description-menu-edit']['fr-fr'] = "Personnaliser un ou plusieurs menus.";
$text['description-menu-edit']['he-il'] = "";
$text['description-menu-edit']['it-it'] = "Usato per personalizzare uno o più menu.";
$text['description-menu-edit']['nl-nl'] = "";
$text['description-menu-edit']['pl-pl'] = "Używane do konfiguracji jednego lub kilku menu.";
$text['description-menu-edit']['pt-br'] = "Usado para customizar um ou mais menus";
$text['description-menu-edit']['pt-pt'] = "Utilizado para customizar um ou mais menus.";
$text['description-menu-edit']['ro-ro'] = "";
$text['description-menu-edit']['ru-ru'] = "Используется для настройки одного или нескольких меню.";
$text['description-menu-edit']['sv-se'] = "Används för att anpassa en eller flera menyer.";
$text['description-menu-edit']['uk-ua'] = "Використовується для налаштування одного або декількох меню.";
$text['description-menu-add']['en-us'] = "Used to customize one or more menus.";
$text['description-menu-add']['ar-eg'] = "";
$text['description-menu-add']['de-at'] = "Hier können Sie die Menüleiste bearbeiten."; //copied from de-de
$text['description-menu-add']['de-ch'] = "Hier können Sie die Menüleiste bearbeiten."; //copied from de-de
$text['description-menu-add']['de-de'] = "Hier können Sie die Menüleiste bearbeiten.";
$text['description-menu-add']['es-cl'] = "Se usa para personalizar uno o más menús.";
$text['description-menu-add']['es-mx'] = "Se usa para personalizar uno o más menús."; //copied from es-cl
$text['description-menu-add']['fr-ca'] = "Personnaliser un ou plusieurs menus."; //copied from fr-fr
$text['description-menu-add']['fr-fr'] = "Personnaliser un ou plusieurs menus.";
$text['description-menu-add']['he-il'] = "";
$text['description-menu-add']['it-it'] = "Usato per personalizzare uno o più menu.";
$text['description-menu-add']['nl-nl'] = "";
$text['description-menu-add']['pl-pl'] = "Używane do konfiguracji jednego lub kilku menu.";
$text['description-menu-add']['pt-br'] = "Usado para customizar um ou mais menus";
$text['description-menu-add']['pt-pt'] = "Utilizado para customizar um ou mais menus.";
$text['description-menu-add']['ro-ro'] = "";
$text['description-menu-add']['ru-ru'] = "Используется для настройки одного или нескольких меню.";
$text['description-menu-add']['sv-se'] = "Används för att anpassa en eller flera menyer.";
$text['description-menu-add']['uk-ua'] = "Використовується для налаштування одного або декількох меню.";
$text['description-menu']['en-us'] = "Used to customize one or more menus.";
$text['description-menu']['ar-eg'] = "";
$text['description-menu']['de-at'] = "Hier können Sie die Menüleiste bearbeiten."; //copied from de-de
$text['description-menu']['de-ch'] = "Hier können Sie die Menüleiste bearbeiten."; //copied from de-de
$text['description-menu']['de-de'] = "Hier können Sie die Menüleiste bearbeiten.";
$text['description-menu']['es-cl'] = "Se usa para personalizar uno o más menús.";
$text['description-menu']['es-mx'] = "Se usa para personalizar uno o más menús."; //copied from es-cl
$text['description-menu']['fr-ca'] = "Personnaliser un ou plusieurs menus."; //copied from fr-fr
$text['description-menu']['fr-fr'] = "Personnaliser un ou plusieurs menus.";
$text['description-menu']['he-il'] = "";
$text['description-menu']['it-it'] = "Usato per personalizzare uno o più menu.";
$text['description-menu']['nl-nl'] = "";
$text['description-menu']['pl-pl'] = "Używane do konfiguracji jednego lub kilku menu.";
$text['description-menu']['pt-br'] = "Usado para customizar um ou mais menus";
$text['description-menu']['pt-pt'] = "Utilizado para customizar um ou mais menus.";
$text['description-menu']['ro-ro'] = "";
$text['description-menu']['ru-ru'] = "Используется для настройки одного или нескольких меню.";
$text['description-menu']['sv-se'] = "Används för att anpassa en eller flera menyer.";
$text['description-menu']['uk-ua'] = "Використовується для налаштування одного або декількох меню.";
$text['description-link']['en-us'] = "Description";
$text['description-link']['ar-eg'] = "";

View File

@@ -52,18 +52,6 @@
//process the http post data by action
if ($action != '' && is_array($menus) && @sizeof($menus) != 0) {
switch ($action) {
case 'copy':
//if (permission_exists('menu_add')) {
// $obj = new menu;
// $obj->copy($menus);
//}
break;
case 'toggle':
//if (permission_exists('menu_edit')) {
// $obj = new menu;
// $obj->toggle($menus);
//}
break;
case 'delete':
if (permission_exists('menu_delete')) {
$obj = new menu;

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
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):
@@ -153,49 +153,34 @@
$token = $object->create($_SERVER['PHP_SELF']);
//show the header
$document['title'] = $text['title-menu'];
require_once "resources/header.php";
if ($action == "update") {
$document['title'] = $text['title-menu-edit'];
}
if ($action == "add") {
$document['title'] = $text['title-menu-add'];
}
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
if ($action == "add") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['header-menu-add']."</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['header-menu-edit']."</b></td>\n";
}
echo "<td width='70%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='menu.php'\" value='".$text['button-back']."'>\n";
echo "<form method='post' name='frm'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['header-menu']."</b></div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'collapse'=>'hide-xs','link'=>'menu.php']);
if (permission_exists('menu_restore') && $action == "update") {
echo " <input type='button' class='btn' value='".$text['button-restore_default']."' onclick=\"document.location.href='menu_restore_default.php?menu_uuid=$menu_uuid&menu_language=$menu_language';\" />";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
if ($action == "update") {
echo $text['description-menu-edit'];
}
if ($action == "add") {
echo $text['description-menu-add'];
echo button::create(['type'=>'button','label'=>$text['button-restore_default'],'icon'=>$_SESSION['theme']['button_icon_reload'],'collapse'=>'hide-xs','style'=>'margin-left: 15px;','link'=>'menu_restore_default.php?menu_uuid='.urlencode($menu_uuid).'&menu_language='.urlencode($menu_language)]);
}
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'collapse'=>'hide-xs','style'=>'margin-left: 15px;']);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo $text['description-menu']."\n";
echo "<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo "<td width='30%' class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-name']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='menu_name' maxlength='255' value=\"".escape($menu_name)."\">\n";
echo "<br />\n";
echo "\n";
@@ -223,18 +208,15 @@
echo $text['description-description']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='menu_uuid' value='".escape($menu_uuid)."'>\n";
}
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <br>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<br><br>";
if ($action == "update") {
echo "<input type='hidden' name='menu_uuid' value='".escape($menu_uuid)."'>\n";
}
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
//show the menu items
@@ -245,4 +227,4 @@
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -370,46 +370,34 @@
$token = $object->create($_SERVER['PHP_SELF']);
//include the header
$document['title'] = $text['title-menu_item'];
require_once "resources/header.php";
if ($action == "update") {
$document['title'] = $text['title-menu_item-edit'];
}
if ($action == "add") {
$document['title'] = $text['title-menu_item-add'];
}
echo "<form method='post' action=''>\n";
echo "<form method='post'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['header-menu_item']."</b></div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'style'=>'margin-right: 15px;','link'=>'menu_edit.php?id='.urlencode($menu_uuid)]);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save']]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo "<table width='100%' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' align='left' valign='top' nowrap='nowrap'>\n";
echo " <b>\n";
if ($action == "update") {
echo " ".$text['header-menu_item-edit']."\n";
}
if ($action == "add") {
echo " ".$text['header-menu_item-add']."\n";
}
echo " </b>\n";
echo "</td>\n";
echo "<td width='70%' align='right' valign='top'>";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='menu_edit.php?id=".escape($menu_uuid)."'\" value='".$text['button-back']."'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-save']."'>\n";
echo " <br><br>";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>";
echo " <td class='vncellreq'>".$text['label-title']."</td>";
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_title' value='".escape($menu_item_title)."'></td>";
echo " <td width='30%' class='vncellreq'>".$text['label-title']."</td>";
echo " <td width='70%' class='vtable'><input type='text' class='formfld' name='menu_item_title' value='".escape($menu_item_title)."'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncellreq'>".$text['label-link']."</td>";
echo " <td class='vncell'>".$text['label-link']."</td>";
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_link' value='".escape($menu_item_link)."'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncellreq'>".$text['label-category']."</td>";
echo " <td class='vncell'>".$text['label-category']."</td>";
echo " <td class='vtable'>";
echo " <select name=\"menu_item_category\" class='formfld'>\n";
if ($menu_item_category == "internal") { echo "<option value=\"internal\" selected>".$text['option-internal']."</option>\n"; } else { echo "<option value=\"internal\">".$text['option-internal']."</option>\n"; }
@@ -500,9 +488,9 @@
}
}
echo "</table>\n";
echo "<br />\n";
}
if (is_array($groups)) {
echo "<br />\n";
echo "<select name='group_uuid_name' class='formfld' style='width: auto; margin-right: 3px;'>\n";
echo " <option value=''></option>\n";
foreach($groups as $row) {
@@ -513,7 +501,7 @@
}
}
echo "</select>";
echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]);
echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'collapse'=>'never']);
}
echo " </td>";
echo " </tr>";
@@ -556,33 +544,21 @@
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_description' value='".escape($menu_item_description)."'></td>";
echo " </tr>";
if (permission_exists('menu_add') || permission_exists('menu_edit')) {
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <table width='100%'>";
echo " <tr>";
echo " <td align='left'>";
echo " </td>\n";
echo " <td align='right'>";
if ($action == "update") {
echo " <input type='hidden' name='menu_item_uuid' value='".escape($menu_item_uuid)."'>";
}
echo " <input type='hidden' name='menu_uuid' value='".escape($menu_uuid)."'>";
echo " <input type='hidden' name='menu_item_uuid' value='".escape($menu_item_uuid)."'>";
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <br>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-save']."'>\n";
echo " </td>";
echo " </tr>";
echo " </table>";
echo " </td>";
echo " </tr>";
}
echo "</table>";
echo "<br><br>";
if (permission_exists('menu_add') || permission_exists('menu_edit')) {
if ($action == "update") {
echo "<input type='hidden' name='menu_item_uuid' value='".escape($menu_item_uuid)."'>";
}
echo "<input type='hidden' name='menu_uuid' value='".escape($menu_uuid)."'>";
echo "<input type='hidden' name='menu_item_uuid' value='".escape($menu_item_uuid)."'>";
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
}
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -17,27 +17,59 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
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 <markjcrane@fusionpbx.com>
*/
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."&nbsp;</td>";
echo "<td valign='top' class='".$row_style[$c]."'>".$group_list."&nbsp;</td>";
echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_category."&nbsp;</td>";
if ($menu_item_protected == "true") {
echo "<td valign='top' class='".$row_style[$c]."' style='text-align: center;'><strong>".$text['label-true']."</strong> &nbsp;</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 "<td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".$text['label-false']." &nbsp;</td>";
echo " ".escape($menu_item_title);
}
echo "<td valign='top' align='center' nowrap class='".$row_style[$c]."'>";
echo " &nbsp;";
//echo " ".$row2[menu_item_order]."&nbsp;";
echo "</td>";
echo "</td>\n";
echo "<td class='no-wrap overflow no-link hide-sm-dn'>".$menu_item_link."&nbsp;</td>\n";
echo "<td class='no-wrap overflow hide-xs'>".$group_list."&nbsp;</td>";
echo "<td class='center'>".$menu_item_category."&nbsp;</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 class='center'>\n";
echo $text['label-'.($menu_item_protected == 'true' ? 'true' : 'false')];
}
echo " </td>\n";
echo "<td class='center no-wrap'>&nbsp;</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_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";
}
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>";
}
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";
//get variables used to control the order
$order_by = $_GET["order_by"];
$order = $_GET["order"];
$order_by = $_GET["order_by"] != '' ? $_GET["order_by"] : 'menu_item_order';
$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);
$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);
//create token
$object = new token;
$token = $object->create('/core/menu/menu_item_list.php');
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style0";
//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 "<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'];
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";
//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);
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'>&nbsp;</td>\n";
}
echo "</tr>\n";
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);
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'];
//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 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);
//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."&nbsp;</td>";
echo "<td valign='top' class='".$row_style[$c]."'>".$group_list."&nbsp;</td>";
//echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_link."&nbsp;</td>";
echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_category."&nbsp;</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']."&nbsp;</td>";
//echo "<td valign='top' class='".$row_style[$c]."'>".$row['menu_item_order']."&nbsp;</td>";
//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;
}
if ($menu_item_protected == "true") {
echo "<td valign='top' class='".$row_style[$c]."' style='text-align: center;'><strong>".$text['label-true']."</strong> &nbsp;</td>";
}
else {
echo "<td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".$text['label-false']." &nbsp;</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."&nbsp;</td>\n";
echo "<td class='no-wrap overflow hide-xs'>".$group_list."&nbsp;</td>\n";
echo "<td class='center'>".$menu_item_category."&nbsp;</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']."&nbsp;</td>\n";
echo "<td valign='top' nowrap class='".$row_style[$c]."' style='text-align: center;'>";
echo " ".$row['menu_item_order']."&nbsp;";
echo "</td>";
//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>";
//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>";
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++;
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'] = $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++;
//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 (is_uuid($menu_item_uuid)) {
build_db_child_menu_list($db, $menu_item_level, $menu_item_uuid);
}
//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);
}
}
unset($result);
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($result);
}
} //end if results
echo "</table>\n";
echo "<br><br>";
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>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>&nbsp;</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";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br><br>";
//make sub action bar sticky
echo "<script>\n";
require_once "resources/footer.php";
?>
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 "</script>\n";
?>

View File

@@ -55,11 +55,6 @@ if (!class_exists('menu')) {
//assign the variables
$this->app_name = 'menus';
$this->app_uuid = 'f4b3b3d2-6287-489c-2a00-64529e46f2d7';
$this->name = 'menu';
$this->table = 'menus';
$this->toggle_field = '';
$this->toggle_values = ['true','false'];
$this->description_field = 'menu_description';
$this->location = 'menus.php';
}
@@ -77,6 +72,10 @@ if (!class_exists('menu')) {
* delete rows from the database
*/
public function delete($records) {
//assign the variables
$this->name = 'menu';
$this->table = 'menus';
if (permission_exists($this->name.'_delete')) {
//add multi-lingual support
@@ -96,23 +95,22 @@ if (!class_exists('menu')) {
//build the delete array
$x = 0;
foreach ($records as $record) {
//add to the array
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
//remove menu languages
$array['menu_languages'][$x][$this->name.'_uuid'] = $record['uuid'];
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
//remove menu languages
$array['menu_languages'][$x][$this->name.'_uuid'] = $record['uuid'];
//remove menu item groups
$array['menu_item_groups'][$x][$this->name.'_uuid'] = $record['uuid'];
//remove menu item groups
$array['menu_item_groups'][$x][$this->name.'_uuid'] = $record['uuid'];
//remove menu items
$array['menu_items'][$x][$this->name.'_uuid'] = $record['uuid'];
//remove menu items
$array['menu_items'][$x][$this->name.'_uuid'] = $record['uuid'];
//build array to remove the menu
$array['menus'][$x][$this->name.'_uuid'] = $record['uuid'];
}
//build array to remove the menu
$array[$this->table][$x][$this->name.'_uuid'] = $record['uuid'];
//increment the id
$x++;
//increment
$x++;
}
}
//delete the checked rows
@@ -132,10 +130,101 @@ if (!class_exists('menu')) {
}
}
public function delete_items($records) {
//assign the variables
$this->name = 'menu_item';
$this->table = 'menu_items';
if (permission_exists($this->name.'_delete')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate('/core/menu/menu_item_list.php')) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->location);
exit;
}
//delete multiple records
if (is_array($records) && @sizeof($records) != 0) {
//build the delete array
$x = 0;
foreach ($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
//build array
$uuids[] = "'".$record['uuid']."'";
//remove menu languages
$array['menu_languages'][$x][$this->name.'_uuid'] = $record['uuid'];
//remove menu item groups
$array['menu_item_groups'][$x][$this->name.'_uuid'] = $record['uuid'];
//remove menu items
$array[$this->table][$x][$this->name.'_uuid'] = $record['uuid'];
//increment
$x++;
}
}
//include child menu items
if (is_array($uuids) && @sizeof($uuids) != 0) {
$sql = "select menu_item_uuid as uuid from v_".$this->table." ";
$sql .= "where menu_item_parent_uuid in (".implode(', ', $uuids).") ";
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
//remove menu languages
$array['menu_languages'][$x][$this->name.'_uuid'] = $row['uuid'];
//remove menu item groups
$array['menu_item_groups'][$x][$this->name.'_uuid'] = $row['uuid'];
//remove menu items
$array[$this->table][$x][$this->name.'_uuid'] = $row['uuid'];
//increment
$x++;
}
}
}
//delete the checked rows
if (is_array($array) && @sizeof($array) != 0) {
//grant temporary permissions
$p = new permissions;
$p->add('menu_language_delete', 'temp');
$p->add('menu_item_group_delete', 'temp');
//execute delete
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->delete($array);
unset($array);
//revoke temporary permissions
$p->delete('menu_language_delete', 'temp');
$p->delete('menu_item_group_delete', 'temp');
//set message
message::add($text['message-delete']);
}
unset($records);
}
}
}
/**
* toggle a field between two values
*/
public function toggle($records) {
public function toggle_items($records) {
//assign the variables
$this->name = 'menu_item';
$this->table = 'menu_items';
$this->toggle_field = 'menu_item_protected';
$this->toggle_values = ['true','false'];
if (permission_exists($this->name.'_edit')) {
//add multi-lingual support
@@ -144,7 +233,7 @@ if (!class_exists('menu')) {
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
if (!$token->validate('/core/menu/menu_item_list.php')) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->location);
exit;
@@ -153,7 +242,7 @@ if (!class_exists('menu')) {
//toggle the checked records
if (is_array($records) && @sizeof($records) != 0) {
//get current toggle state
foreach($records as $record) {
foreach ($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = "'".$record['uuid']."'";
}
@@ -165,7 +254,7 @@ if (!class_exists('menu')) {
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
$states[$row['uuid']] = $row['toggle'];
$states[$row['uuid']] = $row['toggle'] == '' ? $this->toggle_values[1] : $row['toggle'];
}
}
unset($sql, $parameters, $rows, $row);
@@ -173,12 +262,12 @@ if (!class_exists('menu')) {
//build update array
$x = 0;
foreach($states as $uuid => $state) {
foreach ($states as $uuid => $state) {
//create the array
$array[$this->table][$x][$this->name.'_uuid'] = $uuid;
$array[$this->table][$x][$this->toggle_field] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0];
//increment the id
//increment
$x++;
}
@@ -199,74 +288,6 @@ if (!class_exists('menu')) {
}
}
/**
* copy rows from the database
*/
public function copy($records) {
if (permission_exists($this->name.'_add')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->location);
exit;
}
//copy the checked records
if (is_array($records) && @sizeof($records) != 0) {
//get checked records
foreach($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = "'".$record['uuid']."'";
}
}
//create the array from existing data
if (is_array($uuids) && @sizeof($uuids) != 0) {
$sql = "select * from v_".$this->table." ";
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
$x = 0;
foreach ($rows as $row) {
//copy data
$array[$this->table][$x] = $row;
//add copy to the description
$array[$this->table][$x][$this->name.'_uuid'] = uuid();
$array[$this->table][$x][$this->description_field] = trim($row[$this->description_field]).' ('.$text['label-copy'].')';
//increment the id
$x++;
}
}
unset($sql, $parameters, $rows, $row);
}
//save the changes and set the message
if (is_array($array) && @sizeof($array) != 0) {
//save the array
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->save($array);
unset($array);
//set message
message::add($text['message-copy']);
}
unset($records);
}
}
}
/**
* delete items in the menu that are not protected
*/