mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
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);
This commit is contained in:
@@ -16,6 +16,15 @@ if(isset($_GET['configure']))
|
|||||||
define("USER_AREA", true);
|
define("USER_AREA", true);
|
||||||
//Switch to desired layout
|
//Switch to desired layout
|
||||||
define('THEME_LAYOUT', $_GET['configure']);
|
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");
|
require_once("../class2.php");
|
||||||
@@ -25,7 +34,7 @@ if (!getperms("2"))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define('e_DEBUG', false);
|
||||||
|
|
||||||
|
|
||||||
e107::coreLan('menus', true);
|
e107::coreLan('menus', true);
|
||||||
@@ -35,15 +44,30 @@ e107::css('inline',"
|
|||||||
|
|
||||||
.menu-manager-items { padding-right:15px}
|
.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-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']))
|
if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//e107::js('core', 'core/jquery.elastic.source.js', 'jquery', 2);
|
//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::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-tooltip.js');
|
e107::js('core','bootstrap/js/bootstrap-tooltip.js');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// e107::css('core','bootstrap/css/bootstrap.min.css');
|
// e107::css('core','bootstrap/css/bootstrap.min.css');
|
||||||
|
|
||||||
$JSMODAL = <<<TEMPL
|
$JSMODAL = <<<TEMPL
|
||||||
@@ -402,7 +429,46 @@ TEMPL;
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
e107::js('footer-inline', "
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var stickyNavTop = $('.e-scroll-fixed').offset().top - 60; // grab the initial top offset of the navigation
|
||||||
|
|
||||||
|
var stickyNav = function(){
|
||||||
|
|
||||||
|
var scrollTop = $(window).scrollTop(); // our current vertical position from the top
|
||||||
|
|
||||||
|
if (scrollTop > 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()
|
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 .= "
|
$text .= "
|
||||||
<div class='active tab-pane' id='plugins'>
|
<div class='active tab-pane' id='plugins'>
|
||||||
<ul>";
|
<div id='menu-manager-item-list' class='menu-manager-items' style='height:400px;overflow-y:scroll'>";
|
||||||
|
|
||||||
$c = 500; // start high to prevent overwriting of keys after we drag and drop.
|
$c = 500; // start high to prevent overwriting of keys after we drag and drop.
|
||||||
|
|
||||||
foreach($p as $menu => $folder)
|
foreach($p as $menu => $folder)
|
||||||
{
|
{
|
||||||
$text .= "<li id='{$menu}' class='draggable regularMenu' style='cursor:move'>";
|
$text .= "<div id='{$menu}' class='item draggable regularMenu' style='cursor:move'>";
|
||||||
// $text .= str_replace("_menu","",$menu);
|
// $text .= str_replace("_menu","",$menu);
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
@@ -464,22 +530,22 @@ if($_SERVER['E_DEV_MENU'] == 'true')
|
|||||||
|
|
||||||
$text .= e_layout::renderMenuOptions($defaults,'layout','area',$c);
|
$text .= e_layout::renderMenuOptions($defaults,'layout','area',$c);
|
||||||
|
|
||||||
$text .= "</li>";
|
$text .= "</div>";
|
||||||
$c++;
|
$c++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= "</ul>
|
$text .= "</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='tab-pane' id='custom'>";
|
<div class='tab-pane' id='custom'>";
|
||||||
|
|
||||||
if($sql->select('page','*',"menu_name !='' ORDER BY menu_name"))
|
if($sql->select('page','*',"menu_name !='' ORDER BY menu_name"))
|
||||||
{
|
{
|
||||||
$text .= "<ul>";
|
$text .= "<div id='menu-manager-item-list' class='menu-manager-items' style='height:400px;overflow-y:scroll'>";
|
||||||
while($row = $sql->fetch())
|
while($row = $sql->fetch())
|
||||||
{
|
{
|
||||||
$text .= "<li id='".$row['page_id']."' class='draggable regularMenu' style='cursor:move'>";
|
$text .= "<div id='".$row['page_id']."' class='item draggable regularMenu' style='cursor:move'>";
|
||||||
// $text .= $row['menu_name'];
|
// $text .= $row['menu_name'];
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
@@ -490,17 +556,17 @@ if($_SERVER['E_DEV_MENU'] == 'true')
|
|||||||
|
|
||||||
$text .= e_layout::renderMenuOptions($defaults,'layout','area',$c);
|
$text .= e_layout::renderMenuOptions($defaults,'layout','area',$c);
|
||||||
|
|
||||||
$text .= "</li>";
|
$text .= "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= "</ul>";
|
$text .= "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= "</div>
|
$text .= "</div>
|
||||||
|
|
||||||
</div>";
|
</div>";
|
||||||
|
|
||||||
return array('caption'=>'Menu Items','text'=>$text);
|
return array('caption'=>'DragNDrop Items','text'=>$text);
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
@@ -704,6 +704,19 @@ class admin_shortcodes
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function sc_admin_debug()
|
||||||
|
{
|
||||||
|
if(e_DEBUG !== false)
|
||||||
|
{
|
||||||
|
return "<div class='navbar-right navbar-text'><span class='label label-warning'>DEBUG MODE</span> </div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// FIXME - make it work
|
// FIXME - make it work
|
||||||
function sc_admin_pm($parm)
|
function sc_admin_pm($parm)
|
||||||
{
|
{
|
||||||
@@ -1812,13 +1825,20 @@ Inverse 10 <span class="badge badge-inverse">10</span>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
if(strpos(e_REQUEST_URI,e_ADMIN_ABS."menus.php")===false)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($parm == 'selection')
|
||||||
|
{
|
||||||
|
return $this->menuManagerSelection();
|
||||||
|
}
|
||||||
|
|
||||||
$pref = e107::getPref();
|
$pref = e107::getPref();
|
||||||
|
|
||||||
@@ -1852,50 +1872,9 @@ Inverse 10 <span class="badge badge-inverse">10</span>
|
|||||||
|
|
||||||
$var = array($defLayout => $var[$defLayout]) + $var;
|
$var = array($defLayout => $var[$defLayout]) + $var;
|
||||||
|
|
||||||
e107::getNav()->admin(ADLAN_6,$action, $var);
|
e107::getNav()->admin(ADLAN_6,$action, $var);
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
// TODO: Move to another shortcode.
|
|
||||||
// TODO: Get drag-n-drop working.
|
|
||||||
|
|
||||||
$sql = e107::getDb();
|
|
||||||
|
|
||||||
|
|
||||||
$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 = "<div class='menu-manager-items' style='height:700px;overflow-y:scroll'>";
|
|
||||||
$text .= "<h4>Your Menus</h4>";
|
|
||||||
|
|
||||||
foreach($pageMenu as $row)
|
|
||||||
{
|
|
||||||
$text .= "<div class='item' >".$row['menu_name']."</div>";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$text .= "<h4>Plugin Menus</h4>";
|
|
||||||
foreach($pluginMenu as $row)
|
|
||||||
{
|
|
||||||
$text .= "<div class='item' data-menu-id='".$row['menu_id']."'>".substr($row['menu_name'],0,-5)."</div>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$text .= "</div>";
|
|
||||||
|
|
||||||
|
|
||||||
return e107::getRender()->tablerender("Menus", $text, null, true);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -1936,6 +1915,73 @@ Inverse 10 <span class="badge badge-inverse">10</span>
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 = "<div id='menu-manager-item-list' class='menu-manager-items' style='height:400px;overflow-y:scroll'>";
|
||||||
|
$text .= "<h4>Your Menus</h4>";
|
||||||
|
|
||||||
|
foreach($pageMenu as $row)
|
||||||
|
{
|
||||||
|
if(!empty($row['menu_name']))
|
||||||
|
{
|
||||||
|
$text .= "<div class='item' >".$row['menu_name']."</div>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "<h4>Plugin Menus</h4>";
|
||||||
|
foreach($pluginMenu as $row)
|
||||||
|
{
|
||||||
|
$text .= "<div class='item' data-menu-id='".$row['menu_id']."'>".substr($row['menu_name'],0,-5)."</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "</div>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return e107::getRender()->tablerender("Drag-N-Drop Menus", $text, null, true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -49,13 +49,16 @@ if (!defined('e107_INIT')) { exit; }
|
|||||||
if (strstr(e_MENU, "debug") || isset($_COOKIE['e107_debug_level']))
|
if (strstr(e_MENU, "debug") || isset($_COOKIE['e107_debug_level']))
|
||||||
{
|
{
|
||||||
$e107_debug = new e107_debug;
|
$e107_debug = new e107_debug;
|
||||||
require_once(e_HANDLER.'db_debug_class.php');
|
// require_once(e_HANDLER.'db_debug_class.php');
|
||||||
$db_debug = new e107_db_debug;
|
//$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->set_error_reporting();
|
||||||
$e107_debug_level = $e107_debug->debug_level;
|
$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
|
else
|
||||||
{
|
{
|
||||||
|
@@ -369,7 +369,9 @@ class e_menuManager {
|
|||||||
|
|
||||||
$fileList = $efile->get_files(e_PLUGIN,"_menu\.php$",'standard',2);
|
$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.
|
$menuList = array(); // existing menus in table.
|
||||||
if($result = $sql->retrieve('menus', 'menu_name', null, true))
|
if($result = $sql->retrieve('menus', 'menu_name', null, true))
|
||||||
|
@@ -57,4 +57,4 @@ If you find the menus are not updating correctly, clicking the refresh button be
|
|||||||
";
|
";
|
||||||
|
|
||||||
$text = $tp->toHtml($text, true);
|
$text = $tp->toHtml($text, true);
|
||||||
$ns->tablerender("Menus Help", $text);
|
$ns->tablerender("Menu Manager Help", $text);
|
@@ -16,7 +16,7 @@ if (!getperms("P") || !e107::isInstalled('featurebox'))
|
|||||||
exit;
|
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);
|
// e107::lan('plugin','featurebox',true);
|
||||||
|
|
||||||
class fb_admin extends e_admin_dispatcher
|
class fb_admin extends e_admin_dispatcher
|
||||||
|
@@ -251,6 +251,7 @@ $ADMIN_MODAL = '<div id="uiModal" class="modal hide fade" tabindex="-1" role="d
|
|||||||
{ADMIN_NAVIGATION=language}
|
{ADMIN_NAVIGATION=language}
|
||||||
{ADMIN_NAVIGATION=home}
|
{ADMIN_NAVIGATION=home}
|
||||||
{ADMIN_PM}
|
{ADMIN_PM}
|
||||||
|
{ADMIN_DEBUG}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -273,14 +274,22 @@ $ADMIN_HEADER .= '<div class="container-fluid">
|
|||||||
{SETSTYLE=admin_menu}
|
{SETSTYLE=admin_menu}
|
||||||
|
|
||||||
{ADMIN_MENU}
|
{ADMIN_MENU}
|
||||||
{ADMIN_MENUMANAGER}
|
|
||||||
|
|
||||||
|
|
||||||
{ADMIN_PWORD}
|
{ADMIN_PWORD}
|
||||||
|
{ADMIN_MENUMANAGER}
|
||||||
|
|
||||||
|
<div class="e-scroll-fixed">
|
||||||
|
|
||||||
|
|
||||||
{SETSTYLE=site_info}
|
{SETSTYLE=site_info}
|
||||||
|
|
||||||
{ADMINUI_HELP}
|
{ADMINUI_HELP}
|
||||||
{ADMIN_HELP}
|
{ADMIN_HELP}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
{ADMIN_SITEINFO=creditsonly}
|
{ADMIN_SITEINFO=creditsonly}
|
||||||
{SETSTYLE=admin_menu}
|
{SETSTYLE=admin_menu}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user