Loading…
diff --git a/e107_admin/menus.php b/e107_admin/menus.php
index 7f0ed1656..90de4b66f 100644
--- a/e107_admin/menus.php
+++ b/e107_admin/menus.php
@@ -37,7 +37,7 @@ if(e_IFRAME) //<-- Check config and delete buttons if modifying
}
-if(strpos(e_QUERY, 'configure') !== FALSE )
+if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
{
//e107::js('core', 'colorbox/jquery.colorbox-min.js', 'jquery', 2);
@@ -61,18 +61,179 @@ if(strpos(e_QUERY, 'configure') !== FALSE )
// e107::css('core', 'core/admin.css', 'jquery');
- e107::js('core', 'core/admin.jquery.js', 'jquery', 4);
+// e107::js('core', 'core/admin.jquery.js', 'jquery', 4);
+ // e107::js('core','bootstrap/js/bootstrap.min.js');
+// e107::css('core','bootstrap/css/bootstrap.min.css');
+ e107::js('inline', "
+ $(function() {
+
+ // Visibility Options
+
+ $('.e-menumanager-option').on('click', function(){
+
+ var link = $(this).attr('href');
+ var caption = $(this).attr('title');
+ window.parent.$('#uiModal .modal-caption').text(caption);
+ window.parent.$('#uiModal .modal-body').load(link, function(){
+
+ window.parent.$('.modal-body .e-save').on('change', function(){
+
+ var target = window.parent.$('#e-save-form').attr('action');
+ var data = window.parent.$('#e-save-form').serialize();
+
+ $.post(target, data ,function(ret)
+ {
+ var a = $.parseJSON(ret);
+
+ if(a.error)
+ {
+ alert(a.msg);
+ }
+
+ });
+
+ });
+ });
+
+
+ window.parent.$('#uiModal').modal('show');
+
+ return false;
+
+ }) ;
+
+
+
+ // Delete Button (Remove Menu) Function
+
+ $('.e-menumanager-delete').on('click', function(e){
+ e.preventDefault();
+ var area = 'remove';
+ var remove = $(this).attr('id');
+ var opt = remove.split('-');
+ var hidem = '#block-' + opt[1] +'-' + opt[2];
+ $(hidem).hide('slow');
+ // alert(hidem);
+ $.ajax({
+ type: 'POST',
+ url: 'menus.php',
+ data: { removeid: remove, area: area, mode: 'delete' }
+
+ }).done(function( data ) {
+
+ var a = $.parseJSON(data);
+
+ if(a.error)
+ {
+ alert(a.msg);
+ }
+ });
+ });
+
+
+
+
+
+ });
+
+ ");
e107::css('inline'," .column { width:100%; padding-bottom: 100px; }
.regularMenu { border:1px dotted silver; margin-bottom:6px; padding-left:3px; padding-right:3px }
- .menuOptions { padding-top:7px; padding-right:5px; text-align:right; }
+
.portlet { margin: 0 1em 1em 0; }
.portlet-header { margin: 0.3em; padding-bottom: 4px; padding-left: 0.2em; cursor:move }
.portlet-header .ui-icon { float: right; }
.portlet-content { padding: 7px; }
.ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; height: 50px !important; }
.ui-sortable-placeholder * { visibility: hidden; }
+
+
+
+
+
+
+ /* A little bit of bootstrap styling - loading /bootstrap.css could break some themes */
+
+
+
+
+ .menu-btn {
+ display: inline-block;
+ padding: 4px 12px;
+ margin-bottom: 0px;
+ font-size: 14px;
+ line-height: 20px;
+ color: rgb(51, 51, 51);
+ text-align: center;
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.75);
+ vertical-align: middle;
+ cursor: pointer;
+ background-color: rgb(245, 245, 245);
+ background-image: linear-gradient(to bottom, rgb(255, 255, 255), rgb(230, 230, 230));
+ background-repeat: repeat-x;
+ border-width: 1px;
+ border-style: solid;
+ -moz-border-top-colors: none;
+ -moz-border-right-colors: none;
+ -moz-border-bottom-colors: none;
+ -moz-border-left-colors: none;
+ border-image: none;
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgb(179, 179, 179);
+ border-radius: 4px 4px 4px 4px;
+ box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.2) inset, 0px 1px 2px rgba(0, 0, 0, 0.05);
+ }
+
+ .menu-btn:hover, .menu-btn:focus, .menu-btn:active, .menu-btn.active, .menu-btn.disabled, .menu-btn[disabled] {
+ color: rgb(51, 51, 51);
+ background-color: rgb(230, 230, 230);
+ }
+
+ .menu-btn:hover, .menu-btn:focus {
+ color: rgb(51, 51, 51);
+ text-decoration: none;
+ background-position: 0px -15px;
+ transition: background-position 0.1s linear 0s;
+ }
+
+
+ .menu-btn-primary {
+ color: rgb(255, 255, 255);
+ text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.25);
+ background-color: rgb(0, 109, 204);
+ background-image: linear-gradient(to bottom, rgb(0, 136, 204), rgb(0, 68, 204));
+ background-repeat: repeat-x;
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+ }
+
+ .tbox { text-align:left }
+
+ .menuOptions {
+ padding-top: 7px;
+ padding-right: 5px;
+ text-align: left;
+ white-space: nowrap;
+ }
+
+ select.menu-btn { text-align:left }
+
+ label { font-size: 12px; line-height:14px }
+
+ #core-menumanager-main { width:100%; margin-left:auto; margin-right:auto }
+
+
+ table.table { width: 95% ; margin-left:auto; margin-right:auto; }
+
+ label.selection-row { padding:6px ; cursor: pointer; width:90%}
+
+ table.table tbody > tr >td { }
+ table.table tbody > tr >td label { padding:15px; display:block; cursor: pointer; font-size:14px ; }
+
+ .table-striped tbody > tr:nth-child(2n+1) > td, .table-striped tbody > tr:nth-child(2n+1) > th {
+ background-color: rgb(249, 249, 249);
+ }
+
",'jquery');
@@ -94,8 +255,40 @@ $mes = e107::getMessage();
if(e_AJAX_REQUEST)
{
- $men->menuSaveAjax();
+
+ if(vartrue($_GET['enc']))
+ {
+ $string = base64_decode($_GET['enc']);
+ parse_str($string,$_GET);
+
+ // print_a($_GET);
+ }
+// print_a($_POST);
+
+ if(vartrue($_GET['vis']))
+ {
+ $text = $men->menuVisibilityOptions();
+ }
+
+ // print_a($_GET);
+
+ if(vartrue($_GET['parmsId']))
+ {
+ $text = $men->menuInstanceParameters();
+ }
+
+ if(vartrue($_POST['mode']))
+ {
+ // print_r($_POST);
+ // $men->setMenuId($this->menuId);
+ $text = $men->menuSaveAjax($_POST['mode']);
+ }
+
+
+
+ echo $text;
exit;
+
}
if(isset($_GET['configure']) || isset($_GET['iframe']))
diff --git a/e107_handlers/menumanager_class.php b/e107_handlers/menumanager_class.php
index 485b35686..e1bebd8bb 100644
--- a/e107_handlers/menumanager_class.php
+++ b/e107_handlers/menumanager_class.php
@@ -142,7 +142,7 @@ class e_menuManager {
$url = e_SELF."?configure=".$this->curLayout;
}
- $cnt = $sql->db_Select("menus", "*", "menu_location > 0 AND menu_layout = '$curLayout' ORDER BY menu_name "); // calculate height to remove vertical scroll-bar.
+ $cnt = $sql->select("menus", "*", "menu_location > 0 AND menu_layout = '$curLayout' ORDER BY menu_name "); // calculate height to remove vertical scroll-bar.
$text = "";
@@ -315,9 +315,9 @@ class e_menuManager {
foreach($menuAreas as $val)
{
- if($sql->db_Select("menus", 'menu_name, menu_path' , "menu_name = '".$val['menu_name']."' LIMIT 1"))
+ if($sql->select("menus", 'menu_name, menu_path' , "menu_name = '".$val['menu_name']."' LIMIT 1"))
{
- $row=$sql->db_Fetch();
+ $row=$sql->fetch();
if(!$sql->db_Update('menus', "menu_order='{$val['menu_order']}', menu_location = ".$val['menu_location'].", menu_class= ".$val['menu_class']." WHERE menu_name='".$val['menu_name']."' AND menu_layout = '".$this->dbLayout."' LIMIT 1 "))
{
@@ -407,10 +407,10 @@ class e_menuManager {
if (!is_object($sql2)) $sql2 = new db; // Shouldn't be needed
foreach ($this->menu_areas as $menu_act)
{
- if ($sql->db_Select("menus", "menu_id", "menu_location={$menu_act} ORDER BY menu_order ASC"))
+ if ($sql->select("menus", "menu_id", "menu_location={$menu_act} ORDER BY menu_order ASC"))
{
$c = 1;
- while ($row = $sql->db_Fetch())
+ while ($row = $sql->fetch())
{
$sql2->db_Update("menus", "menu_order={$c} WHERE menu_id=".$row['menu_id']);
$c++;
@@ -418,8 +418,8 @@ class e_menuManager {
}
}
- $sql->db_Select("menus", "*", "menu_path NOT REGEXP('[0-9]+') ");
- while (list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->db_Fetch(MYSQL_NUM))
+ $sql->select("menus", "*", "menu_path NOT REGEXP('[0-9]+') ");
+ while (list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->fetch(MYSQL_NUM))
{
if (stristr($menustr, $menu_name) === FALSE)
{
@@ -460,33 +460,42 @@ class e_menuManager {
$frm = e107::getForm();
$sql = e107::getDb();
- if(!$sql->db_Select("menus", "*", "menu_id=".$id))
+ if(!$sql->select("menus", "*", "menu_id=".$id))
{
$this->menuAddMessage("Couldn't Load Menu",E_MESSAGE_ERROR);
return;
};
- $row = $sql->db_Fetch();
+ $row = $sql->fetch();
// TODO lan
$text = "
-
";
+
return $text;
//$caption = MENLAN_7." ".$row['menu_name'];
//$ns->tablerender($caption, $text);
@@ -497,49 +506,82 @@ class e_menuManager {
{
if(!vartrue($_GET['vis'])) return;
- global $sql,$ns,$frm;
+ $sql = e107::getDb();
+ $ns = e107::getRender();
+ $frm = e107::getForm();
+
require_once(e_HANDLER."userclass_class.php");
- if(!$sql->db_Select("menus", "*", "menu_id=".intval($_GET['vis'])))
+
+ if(!$sql->select("menus", "*", "menu_id=".intval($_GET['vis'])))
{
$this->menuAddMessage("Couldn't Load Menu",E_MESSAGE_ERROR);
return;
- };
- $row = $sql->db_Fetch();
- $listtype = substr($row['menu_pages'], 0, 1);
+ }
+
+ $row = $sql->fetch();
+
+ $listtype = substr($row['menu_pages'], 0, 1);
$menu_pages = substr($row['menu_pages'], 2);
$menu_pages = str_replace("|", "\n", $menu_pages);
- $text = "
-
";
+ */
+ $text .= "
";
+
+
return $text;
- $caption = MENLAN_7." ".$row['menu_name'];
- $ns->tablerender($caption, $text);
+ //$caption = MENLAN_7." ".$row['menu_name'];
+ //$ns->tablerender($caption, $text);
+ //echo $text;
}
@@ -560,12 +602,12 @@ class e_menuManager {
foreach($this->menuActivateIds as $sel_mens)
{
//Get info from menu being activated
- if($sql->db_Select("menus", 'menu_name, menu_path' , "menu_id = ".intval($sel_mens)." "))
+ if($sql->select("menus", 'menu_name, menu_path' , "menu_id = ".intval($sel_mens)." "))
{
- $row=$sql->db_Fetch();
+ $row=$sql->fetch();
//If menu is not already activated in that area, add the record.
//$query = "SELECT menu_name,menu_path FROM #menus WHERE menu_name='".$row['menu_name']."' AND menu_layout = '".$this->dbLayout."' AND menu_location = ".$location." LIMIT 1 ";
- //if(!$sql->db_Select_gen($query, $this->debug))
+ //if(!$sql->gen($query, $this->debug))
{
$insert = array(
@@ -676,25 +718,32 @@ class e_menuManager {
{
$sql = e107::getDb();
$parms = $sql->escape(strip_tags($_POST['menu_parms']));
- $check = $sql->db_Update("menus", "menu_parms='".$parms."' WHERE menu_id=".$this->menuId);
+
+ $check = $sql->db_Update("menus", "menu_parms='".$parms."' WHERE menu_id=".intval($_POST['menu_id'])." LIMIT 1");
+
if($check)
{
+ return array('msg'=>'All Okay','error'=>false);
// FIXME - menu log
//$admin_log->log_event('MENU_02',$_POST['menu_parms'].'[!br!]'.$parms.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,'');
- $this->menuAddMessage(LAN_SAVED,E_MESSAGE_SUCCESS);
+ // $this->menuAddMessage(LAN_SAVED,E_MESSAGE_SUCCESS);
}
elseif(false === $check)
{
- $this->menuAddMessage(LAN_UPDATED_FAILED,E_MESSAGE_ERROR);
+ return array('msg'=>LAN_UPDATED_FAILED,'error'=>true);
+
+ }
+ else
+ {
+ return array('msg'=>'No Changes Made','error'=>false); // $this->menuAddMessage(LAN_NOCHANGE_NOTSAVED,E_MESSAGE_INFO);
}
- else $this->menuAddMessage(LAN_NOCHANGE_NOTSAVED,E_MESSAGE_INFO);
}
// --------------------------------------------------------------------------
- function menuSaveVisibility()
+ function menuSaveVisibility() // Used by Ajax
{
global $admin_log;
$sql = e107::getDb();
@@ -709,41 +758,48 @@ class e_menuManager {
$pageparms = preg_replace("#\|$#", "", $pageparms);
$pageparms = (trim($_POST['pagelist']) == '') ? '' : $pageparms;
- if($sql->db_Update("menus", "menu_class='".$_POST['menu_class']."', menu_pages='{$pageparms}' WHERE menu_id=".intval($this->menuId)))
+ if($sql->db_Update("menus", "menu_class='".intval($_POST['menu_class'])."', menu_pages='{$pageparms}' WHERE menu_id=".intval($_POST['menu_id'])))
{
$admin_log->log_event('MENU_02',$_POST['menu_class'].'[!br!]'.$pageparms.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,'');
- $message = "
";
- $this->menuAddMessage($message,E_MESSAGE_SUCCESS);
+
+ return array('msg'=>LAN_UPDATED, 'error'=> false);
+ //$this->menuAddMessage($message,E_MESSAGE_SUCCESS);
}
else
{
- $message = "the update failed";
- $this->menuAddMessage($message,E_MESSAGE_ERROR);
+ return array('msg'=>LAN_UPDATED_FAILED, 'error'=> true, 'posted'=>$_POST);
+ // $this->menuAddMessage($message,E_MESSAGE_ERROR);
}
}
-
+ function setMenuId($id)
+ {
+ $this->menuId = intval($id);
+ }
// -----------------------------------------------------------------------
function menuDeactivate()
{ // Get current menu name
- global $sql,$admin_log;
+ global $admin_log;
+ $sql = e107::getDb();
//echo "FOUND= ".$this->menuId;
+ $error = false;
- if($sql->db_Select('menus', 'menu_name', 'menu_id='.$this->menuId, 'default'))
+ if($sql->gen('SELECT menu_name FROM #menus WHERE menu_id = '.$this->menuId.' LIMIT 1'))
{
- $row = $sql->db_Fetch();
+ $row = $sql->fetch();
//Check to see if there is already a menu with location = 0 (to maintain BC)
- if($sql->db_Select('menus', 'menu_id', "menu_name='{$row['menu_name']}' AND menu_location = 0 AND menu_layout ='".$this->dbLayout."' LIMIT 1"))
+ if($sql->select('menus', 'menu_id', "menu_name='{$row['menu_name']}' AND menu_location = 0 AND menu_layout ='".$this->dbLayout."' LIMIT 1"))
{
//menu_location=0 already exists, we can just delete this record
if(!$sql->db_Delete('menus', 'menu_id='.$this->menuId))
{
$message = "Deletion Failed";
+ $error = true;
}
}
else
@@ -752,6 +808,7 @@ class e_menuManager {
if(!$sql->db_Update("menus", "menu_location=0, menu_order=0, menu_class=0, menu_pages='' WHERE menu_id=".$this->menuId))
{
$message = "FAILED";
+ $error = true;
}
}
//Move all other menus up
@@ -760,10 +817,12 @@ class e_menuManager {
}
else
{
- $message = "NO CHANGES MADE";
+ $message = "NO CHANGES MADE : ".$this->menuId;
+ $error = true;
+
}
- echo $message;
+ return array('msg'=>$message,'error'=>$error);
}
@@ -774,11 +833,11 @@ class e_menuManager {
global $admin_log,$sql;
- if($sql->db_Select('menus', 'menu_name', 'menu_id='.$this->menuId, 'default'))
+ if($sql->select('menus', 'menu_name', 'menu_id='.$this->menuId, 'default'))
{
- $row = $sql->db_Fetch();
+ $row = $sql->fetch();
//Check to see if menu is already active in the new area, if not then move it
- if(!$sql->db_Select('menus', 'menu_id', "menu_name='{$row['menu_name']}' AND menu_location = ".$this->menuNewLoc." AND menu_layout='".$this->dbLayout ."' LIMIT 1"))
+ if(!$sql->select('menus', 'menu_id', "menu_name='{$row['menu_name']}' AND menu_location = ".$this->menuNewLoc." AND menu_layout='".$this->dbLayout ."' LIMIT 1"))
{
$menu_count = $sql->db_Count("menus", "(*)", " WHERE menu_location=".$this->menuNewLoc);
$sql->db_Update("menus", "menu_location='{$this->menuNewLoc}', menu_order=".($menu_count+1)." WHERE menu_id=".$this->menuId);
@@ -799,6 +858,7 @@ class e_menuManager {
$sql = e107::getDb();
$tp = e107::getParser();
$ns = e107::getRender();
+ $frm = e107::getForm();
//FIXME - XHTML cleanup, front-end standards (elist, forms etc)
echo "