From 12a6367fdf04b3e61b449e6e04ec65f662950b21 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 10 Apr 2016 14:10:39 -0700 Subject: [PATCH] The beginnings of Menu-Manager drag-n-drop. (in debug mode) Debug can now be called from singleton. e107::getDebug()->log($message,E107_DBG_BASIC); --- e107_admin/menus.php | 94 +++++++++++-- .../shortcodes/batch/admin_shortcodes.php | 132 ++++++++++++------ e107_handlers/debug_handler.php | 11 +- e107_handlers/menumanager_class.php | 4 +- e107_languages/English/admin/help/menus.php | 2 +- e107_plugins/featurebox/admin_config.php | 2 +- e107_themes/bootstrap3/admin_template.php | 11 +- 7 files changed, 191 insertions(+), 65 deletions(-) diff --git a/e107_admin/menus.php b/e107_admin/menus.php index f101e4613..d634ae98a 100644 --- a/e107_admin/menus.php +++ b/e107_admin/menus.php @@ -16,6 +16,15 @@ if(isset($_GET['configure'])) define("USER_AREA", true); //Switch to desired layout define('THEME_LAYOUT', $_GET['configure']); + define('e_DEBUG', false); + define('E107_DEBUG_LEVEL', 0); + if(function_exists('xdebug_disable')) + { + xdebug_disable(); + } + @ini_set('display_errors', 0); + error_reporting(0); + } require_once("../class2.php"); @@ -25,7 +34,7 @@ if (!getperms("2")) exit; } - +define('e_DEBUG', false); e107::coreLan('menus', true); @@ -35,15 +44,30 @@ e107::css('inline'," .menu-manager-items { padding-right:15px} .menu-manager-items div.item { padding:5px; margin:5px 0; border:1px solid rgba(255,255,255,0.3); border-radius:3px; cursor: move } +.menu-manager-sticky { + position: fixed; +padding-left: 15px; +padding-right: 15px; +left: 0; +top: 60px; + z-index: 100; + border-top: 0; + -moz-transition: fadeIn .4s; + -o-transition: fadeIn .4s; + -webkit-transition: fadeIn .4s; + transition: fadeIn .4s; +} "); + if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc'])) { - + + //e107::js('core', 'core/jquery.elastic.source.js', 'jquery', 2); @@ -65,6 +89,9 @@ if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc'])) // e107::css('core', 'core/admin.css', 'jquery'); // e107::js('core', 'core/admin.jquery.js', 'jquery', 4); e107::js('core','bootstrap/js/bootstrap-tooltip.js'); + + + // e107::css('core','bootstrap/css/bootstrap.min.css'); $JSMODAL = << stickyNavTop) { + $('.e-scroll-fixed').addClass('menu-manager-sticky visible col-lg-2 col-md-3'); + } else { + $('.e-scroll-fixed').removeClass('menu-manager-sticky visible col-lg-2 col-md-3'); + } + }; + + stickyNav(); + + $(window).scroll(function() { // and run it again every time you scroll + stickyNav(); + }); +}); + + + + "); + + + + + + + +} @@ -428,10 +494,10 @@ if($_SERVER['E_DEV_MENU'] == 'true') //{ function e_help() { - if($_SERVER['E_DEV_MENU'] != 'true') + if(e_DEBUG === false) { - return false; - } + return null; + } @@ -447,13 +513,13 @@ if($_SERVER['E_DEV_MENU'] == 'true') $text .= "
-
    "; + "; $c++; } - $text .= "
+ $text .= "
"; if($sql->select('page','*',"menu_name !='' ORDER BY menu_name")) { - $text .= "
    "; + $text .= ""; } - $text .= "
"; + $text .= "
"; } $text .= " "; - return array('caption'=>'Menu Items','text'=>$text); + return array('caption'=>'DragNDrop Items','text'=>$text); } //} diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index be86817e7..36c3cce75 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -704,6 +704,19 @@ class admin_shortcodes return $ret; } + + function sc_admin_debug() + { + if(e_DEBUG !== false) + { + return ""; + } + + } + + + + // FIXME - make it work function sc_admin_pm($parm) { @@ -1812,13 +1825,20 @@ Inverse 10 10 - function sc_admin_menumanager() // List all menu-configs for easy-navigation + + + + function sc_admin_menumanager($parm=null) // List all menu-configs for easy-navigation { if(strpos(e_REQUEST_URI,e_ADMIN_ABS."menus.php")===false) { return false; } + if($parm == 'selection') + { + return $this->menuManagerSelection(); + } $pref = e107::getPref(); @@ -1852,50 +1872,9 @@ Inverse 10 10 $var = array($defLayout => $var[$defLayout]) + $var; - e107::getNav()->admin(ADLAN_6,$action, $var); - - return null; - - // TODO: Move to another shortcode. - // TODO: Get drag-n-drop working. - - $sql = e107::getDb(); + e107::getNav()->admin(ADLAN_6,$action, $var); - $sql->select("menus", "menu_name, menu_id, menu_pages, menu_path", "1 GROUP BY menu_name ORDER BY menu_name ASC"); - - while ($row = $sql->fetch()) - { - if(is_numeric($row['menu_path'])) - { - $pageMenu[] = $row; - } - else - { - $pluginMenu[] = $row; - } - - } - - $text = ""; - - - return e107::getRender()->tablerender("Menus", $text, null, true); /* @@ -1936,6 +1915,73 @@ Inverse 10 10 } + + private function menuManagerSelection() + { + + if(e_DEBUG === false) + { + return null; + } + + + // TODO: Move to another shortcode? + // TODO: Get drag-n-drop working. + + + $sql = e107::getDb(); + + $pageMenu = array(); + $pluginMenu = array(); + + $sql->select("menus", "menu_name, menu_id, menu_pages, menu_path", "1 GROUP BY menu_name ORDER BY menu_name ASC"); + + while ($row = $sql->fetch()) + { + if(is_numeric($row['menu_path'])) + { + $pageMenu[] = $row; + } + else + { + $pluginMenu[] = $row; + } + + } + + $text = ""; + + + + + + + + return e107::getRender()->tablerender("Drag-N-Drop Menus", $text, null, true); + + + + + } + + } diff --git a/e107_handlers/debug_handler.php b/e107_handlers/debug_handler.php index 8b08c9177..a0adda994 100644 --- a/e107_handlers/debug_handler.php +++ b/e107_handlers/debug_handler.php @@ -49,13 +49,16 @@ if (!defined('e107_INIT')) { exit; } if (strstr(e_MENU, "debug") || isset($_COOKIE['e107_debug_level'])) { $e107_debug = new e107_debug; - require_once(e_HANDLER.'db_debug_class.php'); - $db_debug = new e107_db_debug; +// require_once(e_HANDLER.'db_debug_class.php'); + //$db_debug = new e107_db_debug; -// $db_debug = e107::getDebug(); // XXX enable after 2.1.1 + $db_debug = e107::getDebug(); $e107_debug->set_error_reporting(); $e107_debug_level = $e107_debug->debug_level; - define('E107_DEBUG_LEVEL', $e107_debug_level); + if(!defined('E107_DEBUG_LEVEL')) + { + define('E107_DEBUG_LEVEL', $e107_debug_level); + } } else { diff --git a/e107_handlers/menumanager_class.php b/e107_handlers/menumanager_class.php index d140db48d..f06cc1d5b 100644 --- a/e107_handlers/menumanager_class.php +++ b/e107_handlers/menumanager_class.php @@ -369,7 +369,9 @@ class e_menuManager { $fileList = $efile->get_files(e_PLUGIN,"_menu\.php$",'standard',2); - $this->menuAddMessage('Scanning for new menus', E_MESSAGE_DEBUG); + // $this->menuAddMessage('Scanning for new menus', E_MESSAGE_DEBUG); + + e107::getDebug()->log("Scanning for new menus",E107_DBG_BASIC); $menuList = array(); // existing menus in table. if($result = $sql->retrieve('menus', 'menu_name', null, true)) diff --git a/e107_languages/English/admin/help/menus.php b/e107_languages/English/admin/help/menus.php index 41756b4c4..d66582412 100644 --- a/e107_languages/English/admin/help/menus.php +++ b/e107_languages/English/admin/help/menus.php @@ -57,4 +57,4 @@ If you find the menus are not updating correctly, clicking the refresh button be "; $text = $tp->toHtml($text, true); -$ns->tablerender("Menus Help", $text); \ No newline at end of file +$ns->tablerender("Menu Manager Help", $text); \ No newline at end of file diff --git a/e107_plugins/featurebox/admin_config.php b/e107_plugins/featurebox/admin_config.php index 65fb926f1..a3aabc313 100644 --- a/e107_plugins/featurebox/admin_config.php +++ b/e107_plugins/featurebox/admin_config.php @@ -16,7 +16,7 @@ if (!getperms("P") || !e107::isInstalled('featurebox')) exit; } -// e107::includeLan(e_PLUGIN.'featurebox/languages/'.e_LANGUAGE.'_admin_featurebox.php'); +e107::includeLan(e_PLUGIN.'featurebox/languages/'.e_LANGUAGE.'_admin_featurebox.php'); // e107::lan('plugin','featurebox',true); class fb_admin extends e_admin_dispatcher diff --git a/e107_themes/bootstrap3/admin_template.php b/e107_themes/bootstrap3/admin_template.php index 22ae02266..88c5a6d99 100644 --- a/e107_themes/bootstrap3/admin_template.php +++ b/e107_themes/bootstrap3/admin_template.php @@ -251,6 +251,7 @@ $ADMIN_MODAL = '