Multilinguified Menu Manager

This commit is contained in:
Nate Jones
2013-05-18 22:07:59 +00:00
parent 8351d0f717
commit 24a4faf3d1
10 changed files with 365 additions and 132 deletions

195
core/menu/app_languages.php Normal file
View File

@@ -0,0 +1,195 @@
<?php
// Menus
$text['title-menus']['en-us'] = 'Menu Manager';
$text['title-menus']['pt-pt'] = '';
$text['header-menus']['en-us'] = 'Menu Manager';
$text['header-menus']['pt-pt'] = '';
$text['description-menus']['en-us'] = 'Used to customize one or more menus.';
$text['description-menus']['pt-pt'] = '';
//------
$text['title-menu-edit']['en-us'] = 'Menu Edit';
$text['title-menu-edit']['pt-pt'] = '';
$text['header-menu-edit']['en-us'] = 'Menu Edit';
$text['header-menu-edit']['pt-pt'] = '';
$text['description-menu-edit']['en-us'] = 'Used to customize one or more menus.';
$text['description-menu-edit']['pt-pt'] = '';
//------
$text['title-menu-add']['en-us'] = 'Menu Add';
$text['title-menu-add']['pt-pt'] = '';
$text['header-menu-add']['en-us'] = 'Menu Add';
$text['header-menu-add']['pt-pt'] = '';
$text['description-menu-add']['en-us'] = 'Used to customize one or more menus.';
$text['description-menu-add']['pt-pt'] = '';
//------
$text['label-name']['en-us'] = 'Name';
$text['label-name']['pt-pt'] = '';
$text['description-name']['en-us'] = 'Enter the name of the menu.';
$text['description-name']['pt-pt'] = '';
$text['label-language']['en-us'] = 'Language';
$text['label-language']['pt-pt'] = '';
$text['description-language']['en-us'] = 'Enter the language.';
$text['description-language']['pt-pt'] = '';
$text['label-description']['en-us'] = 'Description';
$text['label-description']['pt-pt'] = '';
$text['description-description']['en-us'] = 'Enter a description for this menu, if desired.';
$text['description-description']['pt-pt'] = '';
//------ items
$text['title-menu_item-edit']['en-us'] = 'Menu Item Edit';
$text['title-menu_item-edit']['pt-pt'] = '';
$text['header-menu_item-edit']['en-us'] = 'Menu Item Edit';
$text['header-menu_item-edit']['pt-pt'] = '';
$text['description-menu_item-edit']['en-us'] = '';
$text['description-menu_item-edit']['pt-pt'] = '';
//------
$text['title-menu_item-add']['en-us'] = 'Menu Item Add';
$text['title-menu_item-add']['pt-pt'] = '';
$text['header-menu_item-add']['en-us'] = 'Menu Item Add';
$text['header-menu_item-add']['pt-pt'] = '';
$text['description-menu_item-add']['en-us'] = '';
$text['description-menu_item-add']['pt-pt'] = '';
//------
$text['label-title']['en-us'] = 'Title';
$text['label-title']['pt-pt'] = '';
$text['description-title']['en-us'] = '';
$text['description-title']['pt-pt'] = '';
$text['label-link']['en-us'] = 'Link';
$text['label-link']['pt-pt'] = '';
$text['description-link']['en-us'] = '';
$text['description-link']['pt-pt'] = '';
$text['label-category']['en-us'] = 'Target';
$text['label-category']['pt-pt'] = '';
$text['description-category']['en-us'] = '';
$text['description-category']['pt-pt'] = '';
$text['option-internal']['en-us'] = 'Internal';
$text['option-internal']['pt-pt'] = '';
$text['option-external']['en-us'] = 'External';
$text['option-external']['pt-pt'] = '';
$text['option-email']['en-us'] = 'E-mail';
$text['option-email']['pt-pt'] = '';
$text['label-parent_menu']['en-us'] = 'Parent Menu';
$text['label-parent_menu']['pt-pt'] = '';
$text['description-parent_menu']['en-us'] = '';
$text['description-parent_menu']['pt-pt'] = '';
$text['label-groups']['en-us'] = 'Groups';
$text['label-groups']['pt-pt'] = '';
$text['description-groups']['en-us'] = '';
$text['description-groups']['pt-pt'] = '';
$text['button-restore_default']['en-us'] = 'Restore Default';
$text['button-restore_default']['pt-pt'] = '';
$text['label-protected']['en-us'] = 'Protected';
$text['label-protected']['pt-pt'] = '';
$text['description-protected']['en-us'] = "# Enable this feature to protect this menu item from removal by '".$text['button-restore_default']['en-us']."'.";
$text['description-protected']['pt-pt'] = '';
$text['label-menu_order']['en-us'] = 'Order';
$text['label-menu_order']['pt-pt'] = '';
$text['description-menu_order']['en-us'] = '';
$text['description-menu_order']['pt-pt'] = '';
$text['label-description']['en-us'] = 'Description';
$text['label-description']['pt-pt'] = '';
$text['description-description']['en-us'] = 'Enter a description, if desired.';
$text['description-description']['pt-pt'] = '';
$text['label-true']['en-us'] = 'True';
$text['label-true']['pt-pt'] = '';
$text['label-false']['en-us'] = 'False';
$text['label-false']['pt-pt'] = 'falso';
$text['button-add']['en-us'] = 'Add';
$text['button-add']['pt-pt'] = '';
$text['button-edit']['en-us'] = 'Edit';
$text['button-edit']['pt-pt'] = '';
$text['button-delete']['en-us'] = 'Delete';
$text['button-delete']['pt-pt'] = '';
$text['confirm-delete']['en-us'] = 'Do you really want to delete this?';
$text['confirm-delete']['pt-pt'] = '';
$text['button-save']['en-us'] = 'Save';
$text['button-save']['pt-pt'] = 'Guardar';
$text['button-back']['en-us'] = 'Back';
$text['button-back']['pt-pt'] = 'Voltar';
$text['button-move_up']['en-us'] = 'Move Up';
$text['button-move_up']['pt-pt'] = '';
$text['button-move_down']['en-us'] = 'Move Down';
$text['button-move_down']['pt-pt'] = '';
$text['message-moved_up']['en-us'] = 'Item Moved Up';
$text['message-moved_up']['pt-pt'] = '';
$text['message-moved_down']['en-us'] = 'Item Moved Down';
$text['message-moved_down']['pt-pt'] = '';
$text['message-message']['en-us'] = 'Message';
$text['message-message']['pt-pt'] = '';
$text['message-add']['en-us'] = 'Add Completed';
$text['message-add']['pt-pt'] = '';
$text['message-update']['en-us'] = 'Update Completed';
$text['message-update']['pt-pt'] = '';
$text['message-delete']['en-us'] = 'Delete Completed';
$text['message-delete']['pt-pt'] = '';
$text['message-restore']['en-us'] = 'Restore Completed';
$text['message-restore']['pt-pt'] = '';
$text['message-required']['en-us'] = 'Please provide: ';
$text['message-required']['pt-pt'] = '';
?>

View File

@@ -26,14 +26,23 @@
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (if_group("admin") || if_group("superadmin")) {
if (permission_exists('menu_add') || permission_exists('menu_edit') || permission_exists('menu_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
require_once "includes/header.php";
$page["title"] = $text['title-menus'];
require_once "includes/paging.php";
//get variables used to control the order
@@ -49,12 +58,12 @@ require_once "includes/paging.php";
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>Menu Manager</b></td>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['header-menus']."</b></td>\n";
echo " <td width='50%' align='right'>&nbsp;</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " Used to customize one or more menus.<br /><br />\n";
echo " ".$text['description-menus']."<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
@@ -77,9 +86,9 @@ require_once "includes/paging.php";
$rows_per_page = 150;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = " select * from v_menus ";
@@ -98,11 +107,11 @@ require_once "includes/paging.php";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('menu_name', 'Name', $order_by, $order);
echo th_order_by('menu_language', 'Language', $order_by, $order);
echo th_order_by('menu_description', 'Description', $order_by, $order);
echo th_order_by('menu_name', $text['label-name'], $order_by, $order);
echo th_order_by('menu_language', $text['label-language'], $order_by, $order);
echo th_order_by('menu_description', $text['label-description'], $order_by, $order);
echo "<td align='right' width='42'>\n";
echo " <a href='menu_edit.php' alt='add'>$v_link_label_add</a>\n";
echo " <a href='menu_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
echo "</td>\n";
echo "<tr>\n";
@@ -113,8 +122,8 @@ require_once "includes/paging.php";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['menu_language']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['menu_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='menu_edit.php?id=".$row['menu_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='menu_delete.php?id=".$row['menu_uuid']."&menu_uuid=".$row['menu_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " <a href='menu_edit.php?id=".$row['menu_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
echo " <a href='menu_delete.php?id=".$row['menu_uuid']."&menu_uuid=".$row['menu_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
@@ -129,7 +138,7 @@ require_once "includes/paging.php";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n";
echo " <a href='menu_edit.php' alt='add'>$v_link_label_add</a>\n";
echo " <a href='menu_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";

View File

@@ -34,6 +34,12 @@ else {
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
$menu_uuid = check_str($_GET["menu_uuid"]);
@@ -75,7 +81,7 @@ if (strlen($id)>0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo $text['message-delete']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;

View File

@@ -26,7 +26,7 @@
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (if_group("admin") || if_group("superadmin")) {
if (permission_exists('menu_add') || permission_exists('menu_edit')) {
//access granted
}
else {
@@ -34,6 +34,12 @@ else {
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
@@ -59,10 +65,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
//check for all required data
//if (strlen($menu_uuid) == 0) { $msg .= "Please provide: Menu UUID<br>\n"; }
//if (strlen($menu_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
//if (strlen($menu_language) == 0) { $msg .= "Please provide: Language<br>\n"; }
//if (strlen($menu_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
//if (strlen($menu_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
//if (strlen($menu_language) == 0) { $msg .= $text['message-required'].$text['label-language']."<br>\n"; }
//if (strlen($menu_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.php";
@@ -111,7 +116,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo $text['message-add']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
@@ -131,12 +136,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo $text['message-update']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
@@ -159,6 +164,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//show the header
require_once "includes/header.php";
if ($action == "update") {
$page["title"] = $text['title-menu-edit'];
}
if ($action == "add") {
$page["title"] = $text['title-menu-add'];
}
//show the content
echo "<div align='center'>";
@@ -172,53 +183,59 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
if ($action == "add") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>Menu Add</b></td>\n";
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>Menu Edit</b></td>\n";
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['header-menu-edit']."</b></td>\n";
}
echo "<td width='70%' align='right'>\n";
if (permission_exists('menu_restore')) {
echo " <input type='button' class='btn' value='Restore Default' onclick=\"document.location.href='menu_restore_default.php?menu_uuid=$menu_uuid&menu_language=$menu_language';\" />";
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='button' class='btn' name='' alt='back' onclick=\"window.location='menu.php'\" value='Back'></td>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='menu.php'\" value='".$text['button-back']."'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo "Used to customize one or more menus.<br /><br />\n";
if ($action == "update") {
echo $text['description-menu-edit'];
}
if ($action == "add") {
echo $text['description-menu-add'];
}
echo "<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Name:\n";
echo " ".$text['label-name'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='menu_name' maxlength='255' value=\"$menu_name\">\n";
echo "<br />\n";
echo "Enter the name of the menu.\n";
echo "</td>\n";
echo "\n";
echo $text['description-name']."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Language:\n";
echo " ".$text['label-language'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='menu_language' maxlength='255' value=\"$menu_language\">\n";
echo "<br />\n";
echo "Enter the language.\n";
echo $text['description-language']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Description:\n";
echo " ".$text['label-description'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='menu_description' maxlength='255' value=\"$menu_description\">\n";
echo "<br />\n";
echo "Enter the description.\n";
echo $text['description-description']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
@@ -226,7 +243,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "update") {
echo " <input type='hidden' name='menu_uuid' value='$menu_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";

View File

@@ -34,6 +34,12 @@ else {
return;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
if (count($_GET)>0) {
//clear the menu session so it will rebuild with the update
$_SESSION["menu"] = "";
@@ -53,7 +59,7 @@ if (count($_GET)>0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu_edit.php?id=$menu_uuid\">\n";
echo "<div align='center'>";
echo "Delete Completed";
echo $text['message-delete'];
echo "</div>";
require_once "includes/footer.php";
return;

View File

@@ -26,7 +26,7 @@
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('menu_add') || permission_exists('menu_edit') || permission_exists('menu_delete')) {
if (permission_exists('menu_add') || permission_exists('menu_edit')) {
//access granted
}
else {
@@ -34,8 +34,11 @@ else {
return;
}
//include the header
require_once "includes/header.php";
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//get the menu_uuid
$menu_uuid = check_str($_REQUEST["id"]);
@@ -54,7 +57,7 @@ else {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu_item_edit.php?id=$menu_uuid&menu_item_uuid=$menu_item_uuid&menu_uuid=$menu_uuid\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo $text['message-delete']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
@@ -100,9 +103,9 @@ else {
//check for all required data
$msg = '';
if (strlen($menu_item_title) == 0) { $msg .= "Please provide: title<br>\n"; }
if (strlen($menu_item_category) == 0) { $msg .= "Please provide: category<br>\n"; }
//if (strlen($menu_item_link) == 0) { $msg .= "Please provide: menu_item_link<br>\n"; }
if (strlen($menu_item_title) == 0) { $msg .= $text['message-required'].$text['label-title']."<br>\n"; }
if (strlen($menu_item_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
//if (strlen($menu_item_link) == 0) { $msg .= $text['message-required'].$text['label-link']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.php";
@@ -219,13 +222,13 @@ else {
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu_item_edit.php?id=$menu_uuid&menu_item_uuid=$menu_item_uuid&menu_uuid=$menu_uuid\">\n";
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu_edit.php?id=$menu_uuid\">\n";
echo "<div align='center'>\n";
if ($action == "add") {
echo "Add Complete\n";
echo $text['message-add']."\n";
}
if ($action == "update") {
echo "Edit Complete\n";
echo $text['message-update']."\n";
}
echo "</div>\n";
require_once "includes/footer.php";
@@ -262,8 +265,15 @@ else {
}
}
//show the content
//include the header
require_once "includes/header.php";
if ($action == "update") {
$page["title"] = $text['title-menu_item-edit'];
}
if ($action == "add") {
$page["title"] = $text['title-menu_item-add'];
}
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
@@ -273,32 +283,39 @@ else {
echo "<form method='post' action=''>";
echo "<table width='100%' cellpadding='6' cellspacing='0'>";
echo "<tr>\n";
echo "<td width='30%' align='left' valign='top' nowrap><b>Menu Item Edit</b></td>\n";
echo "<td width='70%' align='right' valign='top'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='menu_edit.php?id=".$menu_uuid."'\" value='Back'><br /><br /></td>\n";
echo "<td width='30%' align='left' valign='top' nowrap><b>";
if ($action == "update") {
echo $text['header-menu_item-edit'];
}
if ($action == "add") {
echo $text['header-menu_item-add'];
}
echo "</b></td>\n";
echo "<td width='70%' align='right' valign='top'><input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='menu_edit.php?id=".$menu_uuid."'\" value='".$text['button-back']."'><br /><br /></td>\n";
echo "</tr>\n";
echo " <tr>";
echo " <td class='vncellreq'>Title:</td>";
echo " <td class='vncellreq'>".$text['label-title'].":</td>";
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_title' value='$menu_item_title'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncellreq'>Link:</td>";
echo " <td class='vncellreq'>".$text['label-link'].":</td>";
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_link' value='$menu_item_link'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncellreq'>Category:</td>";
echo " <td class='vncellreq'>".$text['label-category'].":</td>";
echo " <td class='vtable'>";
echo " <select name=\"menu_item_category\" class='formfld'>\n";
echo " <option value=\"\"></option>\n";
if ($menu_item_category == "internal") { echo "<option value=\"internal\" selected>internal</option>\n"; } else { echo "<option value=\"internal\">internal</option>\n"; }
if ($menu_item_category == "external") { echo "<option value=\"external\" selected>external</option>\n"; } else { echo "<option value=\"external\">external</option>\n"; }
if ($menu_item_category == "email") { echo "<option value=\"email\" selected>email</option>\n"; } else { echo "<option value=\"email\">email</option>\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"; }
if ($menu_item_category == "external") { echo "<option value=\"external\" selected>".$text['option-external']."</option>\n"; } else { echo "<option value=\"external\">".$text['option-external']."</option>\n"; }
if ($menu_item_category == "email") { echo "<option value=\"email\" selected>".$text['option-email']."</option>\n"; } else { echo "<option value=\"email\">".$text['option-email']."</option>\n"; }
echo " </select>";
echo " </td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncell'>Parent Menu:</td>";
echo " <td class='vncell'>".$text['label-parent_menu'].":</td>";
echo " <td class='vtable'>";
$sql = "SELECT * FROM v_menu_items ";
$sql .= "where menu_uuid = '$menu_uuid' ";
@@ -322,7 +339,7 @@ else {
echo " </tr>";
echo " <tr>";
echo " <td class='vncell' valign='top'>Groups:</td>";
echo " <td class='vncell' valign='top'>".$text['label-groups'].":</td>";
echo " <td class='vtable'>";
echo "<table width='52%'>\n";
@@ -341,7 +358,7 @@ else {
echo " <td class='vtable'>".$field['group_name']."</td>\n";
echo " <td>\n";
if (permission_exists('group_member_delete') || if_group("superadmin")) {
echo " <a href='menu_item_edit.php?id=".$field['menu_uuid']."&group_name=".$field['group_name']."&menu_item_uuid=".$menu_item_uuid."&menu_item_parent_uuid=".$menu_item_parent_uuid."&a=delete' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " <a href='menu_item_edit.php?id=".$field['menu_uuid']."&group_name=".$field['group_name']."&menu_item_uuid=".$menu_item_uuid."&menu_item_parent_uuid=".$menu_item_parent_uuid."&a=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
echo "</tr>\n";
@@ -369,32 +386,32 @@ else {
}
}
echo "</select>";
echo "<input type=\"submit\" class='btn' value=\"Add\">\n";
echo "<input type=\"submit\" class='btn' value=\"".$text['button-add']."\">\n";
unset($sql, $result);
echo " </td>";
echo " </tr>";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Protected:\n";
echo " ".$text['label-protected'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='menu_item_protected'>\n";
echo " <option value=''></option>\n";
if ($menu_item_protected == "true") {
echo " <option value='true' selected='selected' >true</option>\n";
if ($menu_item_protected == "true") {
echo " <option value='true' selected='selected' >".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($menu_item_protected == "false") {
echo " <option value='false' selected='selected' >false</option>\n";
if ($menu_item_protected == "false") {
echo " <option value='false' selected='selected' >".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select><br />\n";
echo "Protect this item in the menu so that is is not removed by 'Restore Default.'<br />\n";
echo $text['description-protected']."<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
@@ -402,38 +419,14 @@ else {
if ($action == "update") {
if ($menu_item_parent_uuid == "") {
echo " <tr>";
echo " <td class='vncell'>Menu Order:</td>";
echo " <td class='vncell'>".$text['label-menu_order'].":</td>";
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_order' value='$menu_item_order'></td>";
echo " </tr>";
}
//echo " <tr>";
//echo " <td class='vncell'>Added By:</td>";
//echo " <td class='vtable'>$menu_item_add_user &nbsp;</td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncell'>Add Date:</td>";
//echo " <td class='vtable'>$menu_item_add_date &nbsp;</td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncell'>menu_item_del_user:</td>";
//echo " <td><input type='text' name='menu_item_del_user' value='$menu_item_del_user'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncell'>menu_item_del_date:</td>";
//echo " <td><input type='text' name='menu_item_del_date' value='$menu_item_del_date'></td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncell'>Modified By:</td>";
//echo " <td class='vtable'>$menu_item_mod_user &nbsp;</td>";
//echo " </tr>";
//echo " <tr>";
//echo " <td class='vncell'>Modified Date:</td>";
//echo " <td class='vtable'>$menu_item_mod_date &nbsp;</td>";
//echo " </tr>";
}
echo " <tr>";
echo " <td class='vncell'>Description:</td>";
echo " <td class='vncell'>".$text['label-description'].":</td>";
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_description' value='$menu_item_description'></td>";
echo " </tr>";
@@ -450,7 +443,7 @@ else {
}
echo " <input type='hidden' name='menu_uuid' value='$menu_uuid'>";
echo " <input type='hidden' name='menu_item_uuid' value='$menu_item_uuid'>";
echo " <input type='submit' class='btn' name='submit' value='Save'>\n";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-save']."'>\n";
echo " </td>";
echo " </tr>";
echo " </table>";

View File

@@ -26,7 +26,7 @@
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('menu_add') || permission_exists('menu_edit')) {
if (permission_exists('menu_add') || permission_exists('menu_edit') || permission_exists('menu_delete')) {
//access granted
}
else {
@@ -37,7 +37,7 @@ else {
$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;
global $menu_uuid, $tmp_menu_item_order, $v_link_label_edit, $v_link_label_delete, $page, $text;
//check for sub menus
$menu_item_level = $menu_item_level+1;
@@ -123,10 +123,10 @@ function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid, $c) {
//echo "<td valign='top'>".$row[menu_item_description]."</td>";
//echo "<td valign='top'>&nbsp;".$row[menu_item_order]."&nbsp;</td>";
if ($menu_item_protected == "true") {
echo "<td valign='top' class='".$row_style[$c]."'>&nbsp; <strong>yes</strong> &nbsp;</td>";
echo "<td valign='top' class='".$row_style[$c]."'>&nbsp; <strong>".$text['label-true']."</strong> &nbsp;</td>";
}
else {
echo "<td valign='top' class='".$row_style[$c]."'>&nbsp; no &nbsp;</td>";
echo "<td valign='top' class='".$row_style[$c]."'>&nbsp; ".$text['label-false']." &nbsp;</td>";
}
echo "<td valign='top' align='center' nowrap class='".$row_style[$c]."'>";
echo " &nbsp;";
@@ -135,17 +135,17 @@ function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid, $c) {
//echo "<td valign='top' align='center' 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=".$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].". 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].". Move Down'>";
// 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 valign='top' align='right' nowrap>\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='edit'>$v_link_label_edit</a>\n";
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>\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('Do you really want to delete this?')\" alt='delete'>$v_link_label_delete</a>\n";
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>\n";
}
echo " </td>\n";
echo "</tr>";
@@ -184,16 +184,6 @@ $order = $_GET["order"];
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo "<table width='100%' border='0'><tr>";
//echo "<td width='50%'><b>Menu Manager</b></td>";
echo "<td width='50%' align='right'>\n";
//if (permission_exists('menu_restore')) {
// echo " <input type='button' class='btn' value='Restore Default' onclick=\"document.location.href='menu_restore_default.php';\" />";
//}
echo "</td>\n";
echo "<td width='35' nowrap></td>\n";
echo "</tr></table>";
$sql = "select * from v_menu_items ";
$sql .= "where menu_uuid = '".$menu_uuid."' ";
$sql .= "and menu_item_parent_uuid is null ";
@@ -221,15 +211,14 @@ $order = $_GET["order"];
}
else {
echo "<tr>";
echo "<th align='left' nowrap>&nbsp; Title &nbsp; </th>";
echo "<th align='left' nowrap>&nbsp; Groups &nbsp; </th>";
echo "<th align='left'nowrap>&nbsp; Category &nbsp; </th>";
echo "<th nowrap>&nbsp; Protected &nbsp; </th>";
//echo "<th align='left' width='55' nowrap>&nbsp; Order &nbsp;</th>";
echo "<th nowrap width='70'>Order &nbsp; </th>";
echo "<th align='left' nowrap>&nbsp; ".$text['label-title']." &nbsp; </th>";
echo "<th align='left' nowrap>&nbsp; ".$text['label-groups']." &nbsp; </th>";
echo "<th align='left'nowrap>&nbsp; ".$text['label-category']." &nbsp; </th>";
echo "<th nowrap>&nbsp; ".$text['label-protected']." &nbsp; </th>";
echo "<th nowrap width='70'>&nbsp; ".$text['label-menu_order']." &nbsp; </th>";
echo "<td align='right' width='42'>\n";
if (permission_exists('menu_add')) {
echo " <a href='menu_item_edit.php?id=".$menu_uuid."' alt='add'>$v_link_label_add</a>\n";
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>";
@@ -290,10 +279,10 @@ $order = $_GET["order"];
//echo "<td valign='top' class='".$row_style[$c]."'>&nbsp;".$row['menu_item_order']."&nbsp;</td>";
if ($menu_item_protected == "true") {
echo "<td valign='top' class='".$row_style[$c]."'>&nbsp; <strong>yes</strong> &nbsp;</td>";
echo "<td valign='top' class='".$row_style[$c]."'>&nbsp; <strong>".$text['label-true']."</strong> &nbsp;</td>";
}
else {
echo "<td valign='top' class='".$row_style[$c]."'>&nbsp; no &nbsp;</td>";
echo "<td valign='top' class='".$row_style[$c]."'>&nbsp; ".$text['label-false']." &nbsp;</td>";
}
echo "<td valign='top' align='center' nowrap class='".$row_style[$c]."'>";
@@ -302,17 +291,17 @@ $order = $_GET["order"];
//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'].". 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'].". Move Down'>";
// 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>";
echo " <td valign='top' align='right' nowrap>\n";
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='edit'>$v_link_label_edit</a>\n";
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>\n";
}
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('Do you really want to delete this?')\" alt='delete'>$v_link_label_delete</a>\n";
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>\n";
}
echo " </td>\n";
echo "</tr>";
@@ -347,8 +336,8 @@ $order = $_GET["order"];
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')) {
echo " <a href='menu_item_edit.php?id=".$menu_uuid."' alt='add'>$v_link_label_add</a>\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";

View File

@@ -34,6 +34,12 @@ else {
return;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//move down more than one level at a time
//update v_menu_items set menu_item_order = (menu_item_order+1) where menu_item_order > 2 or menu_item_order = 2
@@ -79,7 +85,7 @@ if (count($_GET)>0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"1;url=menu_list.php?menu_item_id=$menu_item_id\">\n";
echo "<div align='center'>";
echo "Item Moved Down";
echo $text['message-moved_down'];
echo "</div>";
require_once "includes/footer.php";
return;

View File

@@ -34,6 +34,12 @@ else {
return;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//move down more than one level at a time
//update v_menu_items set menu_order = (menu_order+1) where menu_order > 2 or menu_order = 2
@@ -43,7 +49,7 @@ if (count($_GET)>0) {
if ($menu_order != 1) {
//clear the menu session so it will rebuild with the update
$_SESSION["menu"] = "";
$_SESSION["menu"] = "";
//move the current item's order number down
$sql = "update v_menu_items set ";
@@ -66,7 +72,7 @@ if (count($_GET)>0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"1;url=menu_list.php?menu_item_id=$menu_item_id\">\n";
echo "<div align='center'>";
echo "Item Moved Up";
echo $text['message-moved_up'];
echo "</div>";
require_once "includes/footer.php";
return;

View File

@@ -34,6 +34,12 @@ else {
return;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//get the http value and set as a php variable
$menu_uuid = check_str($_REQUEST["menu_uuid"]);
$menu_language = check_str($_REQUEST["menu_language"]);
@@ -57,7 +63,7 @@ else {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/core/menu/menu_edit.php?id=$menu_uuid\">\n";
echo "<div align='center'>\n";
echo "Restore Complete\n";
echo $text['message-restore']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;