1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-27 18:00:30 +02:00

Menu-Manager rewrite complete, debug mode only.

This commit is contained in:
Cameron
2017-01-02 19:13:48 -08:00
parent 9681816eb9
commit 9dd717cba8
5 changed files with 113 additions and 52 deletions

View File

@@ -32,6 +32,50 @@ else
} }
require_once("../class2.php"); require_once("../class2.php");
if(empty($_GET['configure']) )
{
if(e_DEBUG_MENUMANAGER === true)
{
e107::css('inline', '
body { overflow:hidden }
');
}
else
{
e107::js('footer-inline',"
$('#menu_iframe').attr('scrolling','no');
$('#menu_iframe').load(function() {
// $('#menu_iframe').bind('load', function() {
var height = this.contentWindow.document.body.offsetHeight + 400 + 'px';
// $(this).css('overflow-y','visible');
$(this).css('height',height);
// alert(this.style.height);
});
");
}
}
if (!getperms("2")) if (!getperms("2"))
{ {
e107::redirect('admin'); e107::redirect('admin');
@@ -46,6 +90,8 @@ e107::coreLan('admin', true);
e107::css('inline'," 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 { .menu-manager-sticky {
@@ -66,12 +112,18 @@ top: 60px;
.menu-selector ul li { .menu-selector ul li {
background-color: rgba(255,255,255,0.1); background-color: rgba(255,255,255,0.1);
padding: 5px 30px; padding: 5px 30px;
padding-right:2px;
margin-bottom:2px; margin-bottom:2px;
} }
.menu-selector ul li:nth-child(odd){ background-color:rgba(0,0,0,0.2) } .menu-selector ul li:nth-child(odd){ background-color:rgba(0,0,0,0.2) }
.menu-selector { height:400px; display:block; padding-bottom:50px; overflow-y:scroll; margin-bottom:10px } .menu-selector { height:330px; display:block; padding-bottom:50px; overflow-y:scroll; margin-bottom:10px }
@media all and (min-height: 1019px) {
.menu-selector { height:550px }
}
ul.dropdown-menu.e-mm-selector { padding: 10px; margin-top: -2px; margin-right:-2px; } ul.dropdown-menu.e-mm-selector { padding: 10px; margin-top: -2px; margin-right:-2px; }
@@ -573,6 +625,12 @@ else
$(window).scroll(function() { // and run it again every time you scroll $(window).scroll(function() { // and run it again every time you scroll
stickyNav(); stickyNav();
}); });
}); });
@@ -594,7 +652,7 @@ else
/*
if($_SERVER['E_DEV_MENU'] == 'true') if($_SERVER['E_DEV_MENU'] == 'true')
{ {
if(isset($_GET['configure']) || isset($_GET['iframe'])) if(isset($_GET['configure']) || isset($_GET['iframe']))
@@ -608,23 +666,11 @@ if($_SERVER['E_DEV_MENU'] == 'true')
require_once("auth.php"); require_once("auth.php");
require_once("footer.php"); require_once("footer.php");
exit; exit;
} }*/
// if($_SERVER['E_DEV_MENU'] == 'true') // if($_SERVER['E_DEV_MENU'] == 'true')
//{ //{
function countThemeMenus()
{
}
function e_help() function e_help()
@@ -892,8 +938,8 @@ class e_menu_layout
foreach($pageMenu as $row) foreach($pageMenu as $row)
{ {
$menuInf = (!is_numeric($row['menu_path'])) ? ' ('.substr($row['menu_path'],0,-1).')' : " ( #".$row['menu_path']." )"; $menuInf = (!is_numeric($row['menu_path'])) ? ' ('.substr($row['menu_path'],0,-1).')' : " (#".$row['menu_path'].")";
$tab1 .= "<li>".$frm->checkbox('menuselect[]',$row['menu_id'],'',array('label'=>$row['menu_name'].$menuInf))."</li>"; $tab1 .= "<li>".$frm->checkbox('menuselect[]',$row['menu_id'],'',array('label'=>$row['menu_name']."<small>".$menuInf."</small>"))."</li>";
} }
$tab1 .= '</ul></div>'; $tab1 .= '</ul></div>';
@@ -901,15 +947,15 @@ class e_menu_layout
$tab2 = '<div class="menu-selector"><ul class=" list-unstyled">'; $tab2 = '<div class="menu-selector"><ul class=" list-unstyled">';
foreach($pluginMenu as $row) foreach($pluginMenu as $row)
{ {
$menuInf = (!is_numeric($row['menu_path'])) ? ' ('.substr($row['menu_path'],0,-1).')' : " ( #".$row['menu_path']." )"; $menuInf = (!is_numeric($row['menu_path'])) ? ' ('.substr($row['menu_path'],0,-1).')' : " (#".$row['menu_path'].")";
$tab2 .= "<li>".$frm->checkbox('menuselect[]',$row['menu_id'],'',array('label'=>$row['menu_name']."<small>".$menuInf."</small>"))."</li>"; $tab2 .= "<li>".$frm->checkbox('menuselect[]',$row['menu_id'],'',array('label'=>$row['menu_name']."<small>".$menuInf."</small>"))."</li>";
} }
$tab2 .= '</ul></div>'; $tab2 .= '</ul></div>';
$tabs = array( $tabs = array(
'custom' => array('caption'=>MENLAN_49, 'text'=>$tab1), 'custom' => array('caption'=>'<i title="'.MENLAN_49.'" class="S16 e-custom-16"></i>', 'text'=>$tab1),
'plugin' => array('caption'=>ADLAN_CL_7, 'text'=>$tab2) 'plugin' => array('caption'=>'<i title="'.ADLAN_CL_7.'" class="S16 e-plugins-16"></i>', 'text'=>$tab2)
); );
@@ -960,7 +1006,18 @@ class e_menu_layout
$text .= '</form>'; $text .= '</form>';
return array('caption'=>MENLAN_22,'text'=>$text); $tp = e107::getParser();
$caption = MENLAN_22;
;
$diz = "The Menu-Manager allows you to place and arrange your menus within your theme template. Hover over the sub-areas to modify existing menu items. ";
$caption .= "<span class='pull-right'><a class='e-tip' title=\"".$tp->toAttribute($diz)."\">".ADMIN_INFO_ICON."</a></span>";
return array('caption'=>$caption,'text'=>$text);
@@ -1765,8 +1822,7 @@ if($_POST)
@@ -1789,6 +1845,7 @@ if($_POST)
} }
else // Within the IFrame. else // Within the IFrame.
{ {
$men->menuRenderPage(); $men->menuRenderPage();
} }
@@ -1808,7 +1865,7 @@ if($_POST)
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
require_once("footer.php"); require_once("footer.php");
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

View File

@@ -4,7 +4,7 @@ function wmessage_shortcode($parm='')
{ {
if($parm == 'hide') if($parm == 'hide')
{ {
return; return null;
} }
$e107 = e107::getInstance(); $e107 = e107::getInstance();
@@ -43,6 +43,8 @@ function wmessage_shortcode($parm='')
if (strpos($front_url, 'http') === FALSE) $front_url = SITEURL.$front_url; if (strpos($front_url, 'http') === FALSE) $front_url = SITEURL.$front_url;
if (deftrue('e_FRONTPAGE') || ($parm == 'force') || ((e_SELF == $front_url) && (($parm == 'ignore_query') || (e_QUERY == $front_qry)))) if (deftrue('e_FRONTPAGE') || ($parm == 'force') || ((e_SELF == $front_url) && (($parm == 'ignore_query') || (e_QUERY == $front_qry))))
{ {
// Actually want to display a welcome message here // Actually want to display a welcome message here
@@ -52,8 +54,7 @@ function wmessage_shortcode($parm='')
if($cacheData = $e107cache->retrieve('wmessage')) if($cacheData = $e107cache->retrieve('wmessage'))
{ {
echo $cacheData; return $cacheData;
return;
} }
if (!defined('WMFLAG')) if (!defined('WMFLAG'))
@@ -80,7 +81,7 @@ function wmessage_shortcode($parm='')
if (isset($wmessage) && $wmessage) if (isset($wmessage) && $wmessage)
{ {
ob_start(); $cache_data = '';
if(intval($pref['wm_enclose']) === 2) // carousel if(intval($pref['wm_enclose']) === 2) // carousel
{ {
$carousel= array(); $carousel= array();
@@ -89,22 +90,24 @@ function wmessage_shortcode($parm='')
$carousel['slide-'.$k] = array('caption'=>$wmessageCaption[$k], 'text'=>$ns->tablerender($wmessageCaption[$k],$v, 'wm',true)); $carousel['slide-'.$k] = array('caption'=>$wmessageCaption[$k], 'text'=>$ns->tablerender($wmessageCaption[$k],$v, 'wm',true));
} }
echo e107::getForm()->carousel('wmessage-carousel',$carousel); $cache_data = e107::getForm()->carousel('wmessage-carousel',$carousel);
} }
elseif(intval($pref['wm_enclose']) === 1) elseif(intval($pref['wm_enclose']) === 1)
{ {
$ns->tablerender($wmcaption, implode("<br />",$wmessage), 'wm'); $cache_data = $ns->tablerender($wmcaption, implode("<br />",$wmessage), 'wm', true);
} }
else else
{ {
echo "<div class='wmessage'>"; $text = "<div class='wmessage'>";
echo ($wmcaption) ? $wmcaption.'<br />' : ''; $text .= ($wmcaption) ? $wmcaption.'<br />' : '';
echo implode('<br />',$wmessage); $text .= implode('<br />',$wmessage);
echo "</div>"; $text .= "</div>";
$cache_data = $text;
} }
$cache_data = ob_get_flush();
$e107cache->set('wmessage', $cache_data); $e107cache->set('wmessage', $cache_data);
return $cache_data;
} }
} }
} }

View File

@@ -100,6 +100,8 @@ class e_menuManager {
$menu_array = $this->parseheader($HEADER.$FOOTER, 'check'); $menu_array = $this->parseheader($HEADER.$FOOTER, 'check');
if($menu_array) if($menu_array)
{ {
sort($menu_array, SORT_NUMERIC); sort($menu_array, SORT_NUMERIC);
@@ -204,7 +206,7 @@ class e_menuManager {
// $cnt = $sql->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 = "<object class='well' type='text/html' id='menu_iframe' data='".$url."' width='100%' style='overflow:auto;width: 100%; height: ".(($cnt*90)+600)."px; border: 0px' ></object>"; // $text = "<object class='well' type='text/html' id='menu_iframe' data='".$url."' width='100%' style='overflow:auto;width: 100%; height: ".(($cnt*90)+600)."px; border: 0px' ></object>";
$text = "<iframe class='well' id='menu_iframe' name='e-mm-iframe' src='".$url."' width='100%' scrolling='no' style='width: 100%; height: 100vh; border: 0px' ></iframe>"; $text = "<iframe class='well' id='menu_iframe' name='e-mm-iframe' src='".$url."' width='100%' style='width: 100%; height: 90vh; border: 0px' ></iframe>";
return $text; return $text;
} }
@@ -1141,9 +1143,8 @@ class e_menuManager {
$tp = e107::getParser(); $tp = e107::getParser();
//FIXME - XHTML cleanup, front-end standards (elist, forms etc) // echo "<div id='portal'>";
echo "<div id='portal'>";
$this->parseheader($HEADER); // $layouts_str; $this->parseheader($HEADER); // $layouts_str;
$layout = ($this->curLayout); $layout = ($this->curLayout);
@@ -1275,7 +1276,7 @@ class e_menuManager {
{ {
echo "<div id='debug' style='margin-left:0px;border:1px solid silver; overflow:scroll;height:250px'> &nbsp;</div>"; echo "<div id='debug' style='margin-left:0px;border:1px solid silver; overflow:scroll;height:250px'> &nbsp;</div>";
} }
echo "</div>"; // echo "</div>";
} }
@@ -1323,6 +1324,7 @@ class e_menuManager {
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
function parseheader($LAYOUT, $check = FALSE) function parseheader($LAYOUT, $check = FALSE)
{ {
// $tmp = explode("\n", $LAYOUT); // $tmp = explode("\n", $LAYOUT);
// Split up using the same function as the shortcode handler // Split up using the same function as the shortcode handler
$tmp = preg_split('#(\{\S[^\x02]*?\S\})#', $LAYOUT, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); $tmp = preg_split('#(\{\S[^\x02]*?\S\})#', $LAYOUT, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
@@ -1417,12 +1419,12 @@ class e_menuManager {
// { // {
// echo "[SiteLinks]"; // echo "[SiteLinks]";
// } // }
elseif(strstr($str, "NAVIGATION")) // elseif(strstr($str, "NAVIGATION"))
{ // {
$cust = preg_replace("/\W*\{NAVIGATION(.*?)(\+.*)?\}\W*/si", "\\1", $str); // $cust = preg_replace("/\W*\{NAVIGATION(.*?)(\+.*)?\}\W*/si", "\\1", $str);
$tp->parseTemplate("{NAVIGATION".$cust."}",true); // $tp->parseTemplate("{NAVIGATION".$cust."}",true);
// echo "<span class='label label-info'>Navigation Area</span>"; // echo "<span class='label label-info'>Navigation Area</span>";
} // }
elseif(strstr($str, "ALERT")) elseif(strstr($str, "ALERT"))
{ {
//echo "[Navigation Area]"; //echo "[Navigation Area]";

View File

@@ -16,6 +16,12 @@ if (!getperms("2"))
exit; exit;
} }
if(e_DEBUG_MENUMANAGER === true)
{
return;
}
$sql = e107::getDb(); $sql = e107::getDb();
$tp = e107::getParser(); $tp = e107::getParser();
$frm = e107::getForm(); $frm = e107::getForm();

View File

@@ -667,14 +667,7 @@ $(document).ready(function()
$("#menu_iframe").attr("src",link); $("#menu_iframe").attr("src",link);
return false; return false;
}); });
$('#menu_iframe').load(function() {
this.style.height = this.contentWindow.document.body.offsetHeight + 400 + 'px';
// alert(this.style.height);
// this.style.height = '100vh';
});
$("a.e-mm-selector").click(function(e){ $("a.e-mm-selector").click(function(e){