diff --git a/class2.php b/class2.php
index 2724f404c..78d1150c3 100644
--- a/class2.php
+++ b/class2.php
@@ -786,6 +786,7 @@ if (!class_exists('e107table', false))
public $eSetStyle;
private $themeClass = '';
private $adminThemeClass = '';
+ public $frontend = null;
function __construct()
@@ -844,6 +845,8 @@ if (!class_exists('e107table', false))
}
+
+
/**
* Output the styled template.
* @param $caption
@@ -853,7 +856,7 @@ if (!class_exists('e107table', false))
private function tablestyle($caption, $text, $mode)
{
- if(class_exists($this->adminThemeClass))
+ if(class_exists($this->adminThemeClass) && ($this->frontend == false))
{
$thm = new $this->adminThemeClass();
}
diff --git a/e107_admin/header.php b/e107_admin/header.php
index 3ae3c8e98..bf649ffc4 100644
--- a/e107_admin/header.php
+++ b/e107_admin/header.php
@@ -21,8 +21,10 @@ if (!defined('ADMIN_AREA'))
//avoid PHP warning
define("ADMIN_AREA", TRUE);
}
-define("USER_AREA", FALSE);
-
+if(!defined('USER_AREA'))
+{
+ define("USER_AREA", FALSE);
+}
e107::getDb()->db_Mark_Time('(Header Top)');
// Admin template
@@ -154,13 +156,14 @@ if (isset($pref['del_unv']) && $pref['del_unv'] && $pref['user_reg_veri'] != 2)
//
// HTML 5 default.
-if(!defined('XHTML4'))
+//if(!defined('XHTML4'))
{
echo "\n";
echo "\n";
echo "
\n";
echo "\n";
}
+/*
else // XHTML
{
echo(defined("STANDARDS_MODE") ? "" : "\n")."\n";
@@ -171,6 +174,9 @@ else // XHTML
echo(defined("CORE_LC")) ? "\n" : "";
echo "\n";
}
+ *
+*/
+
echo "\n"; // Works better for iOS but still has some issues.
// echo (defined("VIEWPORT")) ? "\n" : "";
@@ -207,14 +213,14 @@ if (isset($eplug_css) && $eplug_css)
- if(e107::getPref('admincss') == "admin_dark.css")
+ if(e107::getPref('admincss') == "admin_dark.css" && !vartrue($_GET['configure']))
{
$e_js->coreCSS('bootstrap/css/darkstrap.css');
}
//NEW - Iframe mod
-if (!defsettrue('e_IFRAME') && isset($pref['admincss']) && $pref['admincss'])
+if (!defsettrue('e_IFRAME') && isset($pref['admincss']) && $pref['admincss'] && !vartrue($_GET['configure']))
{
$css_file = file_exists(THEME.'admin_'.$pref['admincss']) ? 'admin_'.$pref['admincss'] : $pref['admincss'];
//echo "\n";
@@ -223,13 +229,13 @@ if (!defsettrue('e_IFRAME') && isset($pref['admincss']) && $pref['admincss'])
}
elseif (isset($pref['themecss']) && $pref['themecss'])
{
- $css_file = file_exists(THEME.'admin_'.$pref['themecss']) ? 'admin_'.$pref['themecss'] : $pref['themecss'];
+ $css_file = (file_exists(THEME.'admin_'.$pref['themecss']) && !vartrue($_GET['configure'])) ? 'admin_'.$pref['themecss'] : $pref['themecss'];
//echo "\n";
$e_js->themeCSS($css_file);
}
else
{
- $css_file = file_exists(THEME.'admin_style.css') ? 'admin_style.css' : 'style.css';
+ $css_file = (file_exists(THEME.'admin_style.css') && !vartrue($_GET['configure'])) ? 'admin_style.css' : 'style.css';
//echo "\n";
$e_js->themeCSS($css_file);
}
@@ -436,7 +442,7 @@ echo "
\n";
echo getModal();
-echo getAlert();
+// echo getAlert();
function getModal($caption = '', $type='')
{
@@ -529,7 +535,7 @@ if ($e107_popup != 1)
//removed check strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE
parse_admin($ADMIN_HEADER);
}
- else
+ elseif(!vartrue($_GET['configure']))
{
e107::css("inline","body { padding:0px } "); // default padding for iFrame-only.
}
diff --git a/e107_admin/menus.php b/e107_admin/menus.php
index d91c0c348..837594301 100644
--- a/e107_admin/menus.php
+++ b/e107_admin/menus.php
@@ -23,19 +23,13 @@ if (!getperms("2"))
exit;
}
-//include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
+
+
+
e107::coreLan('menus', true);
e107::coreLan('admin', true);
-// FIXME - quick temporarry fix for missing icons on menu administration. We need different core style to be included (forced) here - e.g. e107_web/css/admin/sprite.css
-if(e_IFRAME) //<-- Check config and delete buttons if modifying
-{
-//e107::js('core','bootstrap/js/bootstrap.min.js');
-//e107::css('core','bootstrap/css/bootstrap.min.css');
- e107::css('url','{e_THEME}/bootstrap/admin_style.css');
-
-}
if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
{
@@ -316,6 +310,391 @@ if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
+if($_SERVER['E_ENV_MENUS'] == 'developer')
+{
+ if(isset($_GET['configure']) || isset($_GET['iframe']))
+ {
+ //No layout parse when in iframe mod
+ define('e_IFRAME', true);
+ }
+ $mn = new e_layout;
+ //e107::js('core','jquery.scoped.js','jquery');
+// e107::css('url',e_THEME.'jayya/style.css');
+ require_once("auth.php");
+ require_once("footer.php");
+ exit;
+}
+
+if($_SERVER['E_ENV_MENUS'] == 'developer')
+{
+ function e_help()
+ {
+ $p = e107::getPref('e_menu_list'); // new storage for xxxxx_menu.php list.
+ $sql = e107::getDb();
+
+ $text = '
+
+ ';
+
+ $text .= "
+
+
";
+
+ foreach($p as $menu => $folder)
+ {
+ $text .= "- ".str_replace("_menu","",$menu)."
";
+ }
+
+ $text .= "
+
+
+
";
+
+ if($sql->select('page','*',"menu_name !='' ORDER BY menu_name"))
+ {
+ $text .= "
";
+ while($row = $sql->fetch())
+ {
+ $text .= "- ".$row['menu_name']."
";
+ }
+
+ $text .= "
";
+ }
+
+ $text .= "
+
+
";
+
+ return array('caption'=>'Menu Items','text'=>$text);
+ }
+}
+
+
+// XXX Menu Manager Re-Write with drag and drop and multi-dimensional array as storage. ($pref)
+// TODO Get Drag & Drop Working with the iFrame
+// TODO Sorting, visibility, parameters and delete.
+
+class e_layout
+{
+ private $menuData = array();
+
+ function __construct()
+ {
+ $pref = e107::getPref();
+ $ns = e107::getRender();
+ $this->convertMenuTable();
+
+
+ if(vartrue($_GET['configure'])) //ie Inside the IFRAME.
+ {
+ $this->curLayout = varsettrue($_GET['configure'], $pref['sitetheme_deflayout']);
+ $this->renderLayout($this->curLayout);
+ }
+ else // Parent - ie. main admin page.
+ {
+
+ // XXX HELP _ i don't work with iFrames.
+
+ e107::js('inline','
+ $(function() {
+ $( "#sortable" ).sortable({
+ revert: true
+ });
+ $( ".draggable" ).draggable({
+ connectToSortable: "#sortable",
+ helper: "clone",
+ revert: "invalid",
+ cursor: "move",
+ // iframeFix: true,
+
+ start: function(ev,ui)
+ {
+ },
+ drag: function(ev,ui)
+ {
+
+ },
+ stop: function(ev, ui)
+ {
+
+ }
+ });
+
+ $( "ul, li" ).disableSelection();
+
+ // Not Working.
+ $("#menu_iframe").load(function(){
+ $("#menu_iframe").contents().find("#sortable").droppable({
+ accept: ".drag",
+ drop: function( event, ui ) {
+ var html = ""+ ui.draggable.html() + "
";
+ //alert(html);
+ $(this).append(html);
+ }
+ });
+
+ });
+
+ });
+ ');
+
+ $this->scanForNew();
+
+ $this->renderInterface();
+ }
+ }
+
+
+ /**
+ * Convert from e107_menu table to $pref format.
+ */
+ function convertMenuTable()
+ {
+ $sql = e107::getDb();
+ $sql->select('menus','*','menu_location !=0 ORDER BY menu_location,menu_order');
+ $data = array();
+
+ while($row = $sql->fetch())
+ {
+ $layout = vartrue($row['menu_layout'],'default');
+ $location = $row['menu_location'];
+ $data[$layout][$location][] = array('name'=>$row['menu_name'],'class'=>$row['menu_class'],'path'=>$row['menu_path'],'pages'=>$row['menu_pages'],'parms'=>$row['menu_parms']);
+ }
+
+ $this->menuData = ($data);
+
+
+ }
+
+
+
+
+
+ /**
+ * Substitute all {MENU=X} and Render output.
+ */
+ private function renderLayout($layout='')
+ {
+
+ global $HEADER,$FOOTER,$style; // included by theme file in class2.
+
+ $tp = e107::getParser();
+
+ $head = preg_replace_callback("/\{MENU=([\d]{1,3})(:[\w\d]*)?\}/", array($this, 'renderMenuArea'), $HEADER[THEME_LAYOUT]);
+ $foot = preg_replace_callback("/\{MENU=([\d]{1,3})(:[\w\d]*)?\}/", array($this, 'renderMenuArea'), $FOOTER[THEME_LAYOUT]);
+
+ echo $tp->parsetemplate($head);
+ // echo "MAIN CONTENT
";
+ echo $tp->parsetemplate($foot);
+
+ }
+
+
+
+
+
+
+ /**
+ * Render {MENU=X}
+ */
+ private function renderMenuArea($matches)
+ {
+
+ $area = $matches[1];
+
+ // return print_a($this->menuData,true);
+ $text = "";
+
+ return $text;
+ }
+
+
+
+
+ private function renderMenu($row)
+ {
+ // return print_a($row,true);
+ $TEMPLATE = ''; // TODO perhaps a simple counter for the id
+
+ return $TEMPLATE;
+
+ }
+
+
+ /**
+ * Scan Plugin folders for new _menu files.
+ */
+ private function scanForNew()
+ {
+ $fl = e107::getFile();
+ $fl->dirFilter = array('/', 'CVS', '.svn', 'languages');
+ $files = $fl->get_files(e_PLUGIN,"_menu\.php$",'standard',2);
+
+ $data = array();
+
+ foreach($files as $file)
+ {
+ $path = trim(str_replace(e_PLUGIN,"",$file['path']),"/");
+
+ if(e107::isInstalled($path))
+ {
+ $fname = str_replace(".php","",$file['fname']);
+ $data[$fname] = $path;
+ }
+ }
+
+ $config = e107::getConfig('core');
+ $config->set('e_menu_list',$data);
+ $config->save();
+
+ }
+
+
+
+
+ /**
+ * Render the main area with TABS and iframes.
+ */
+ private function renderInterface()
+ {
+ $ns = e107::getRender();
+ $tp = e107::getParser();
+
+ $TEMPL = $this->getHeadFoot();
+
+ $layouts = array_keys($TEMPL['HEADER']);
+
+ $text = '';
+
+ $active = ' class="active" ';
+
+ foreach($layouts as $title)
+ {
+ $text .= '- '.$title.'
';
+ $active = '';
+ }
+
+ $text .= '
';
+ $active = 'active';
+
+ $text .= '
+ ';
+
+ foreach($layouts as $title)
+ {
+ $text .= '
+
+
+
';
+
+ $active = '';
+ }
+
+ $text .= '
';
+
+ // $ns->frontend = false;
+
+ $ns->tablerender("Menu Layout",$text);
+ }
+
+
+
+
+
+
+ private function getHeadFoot($_MLAYOUT=null)
+ {
+ $theme = e107::getPref('sitetheme');
+
+ $H = array();
+ $F = array();
+
+ require(e_THEME.$theme."/theme.php");
+
+
+ if(is_string($HEADER))
+ {
+ $H['default'] = $HEADER;
+ $F['default'] = $FOOTER;
+ }
+ else
+ {
+ $H = $HEADER;
+ $F = $FOOTER;
+ }
+
+
+ // 0.6 / 0.7-1.x
+ if(isset($CUSTOMHEADER) && isset($CUSTOMHEADER))
+ {
+ if(!is_array($CUSTOMHEADER))
+ {
+ $H['legacyCustom'] = $CUSTOMHEADER;
+ $F['legacyCustom'] = $CUSTOMFOOTER;
+ }
+ else
+ {
+ foreach($CUSTOMHEADER as $k=>$v)
+ {
+ $H[$k] = $v;
+ $F[$k] = $v;
+ }
+ }
+ }
+
+ if($_MLAYOUT)
+ {
+ // return array('HEADER'=>$H[$_MLAYOUT], 'FOOTER'=>$F[$_MLAYOUT]);
+ }
+
+
+ return array('HEADER'=>$H, 'FOOTER'=>$F);
+ }
+
+ //$ns = e107::getRender();
+
+}
+
+
+
+
+//include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
+
+
+// FIXME - quick temporarry fix for missing icons on menu administration. We need different core style to be included (forced) here - e.g. e107_web/css/admin/sprite.css
+if(e_IFRAME) //<-- Check config and delete buttons if modifying
+{
+
+//e107::js('core','bootstrap/js/bootstrap.min.js');
+//e107::css('core','bootstrap/css/bootstrap.min.css');
+ e107::css('url','{e_THEME}/bootstrap/admin_style.css');
+
+}
+
+
+
+
+
$e_sub_cat = 'menus';
@@ -380,6 +759,18 @@ if($_POST)
//FIXME still used in e_HANDLER.menumanager_class.php
+
+
+
+
+
+
+
+
+
+
+
+
if (vartrue($message) != "")
{
echo $ns -> tablerender('Updated', "".$message."
");
@@ -402,6 +793,19 @@ if($_POST)
}
+
+
+
+
+
+
+
+
+
+
+
+
+
// -----------------------------------------------------------------------------
require_once("footer.php");
@@ -409,6 +813,34 @@ require_once("footer.php");
// -----------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function menus_adminmenu()
{
diff --git a/e107_themes/bootstrap/admin_theme.php b/e107_themes/bootstrap/admin_theme.php
index f263508d1..4b4b15f52 100644
--- a/e107_themes/bootstrap/admin_theme.php
+++ b/e107_themes/bootstrap/admin_theme.php
@@ -1,12 +1,9 @@
");
-e107::lan('theme');
+// e107::lan('theme');
e107::js('core','bootstrap/js/bootstrap.min.js');
e107::css('core','bootstrap/css/bootstrap.min.css');
e107::css('core','bootstrap/css/bootstrap-responsive.min.css');
@@ -211,16 +208,7 @@ $HEADER = '';
$FOOTER = '';
-define('ICONMAIL', 'email_16.png');
-define('ICONPRINT', 'print_16.png');
-define('ICONSTYLE', 'border: 0px');
-define('COMMENTLINK', LAN_THEME_2);
-define('COMMENTOFFSTRING', LAN_THEME_1);
-define('PRE_EXTENDEDSTRING', '
');
-define('EXTENDEDSTRING', LAN_THEME_3);
-define('POST_EXTENDEDSTRING', '
');
-define('TRACKBACKSTRING', LAN_THEME_4);
-define('TRACKBACKBEFORESTRING', ' | ');
+/*
$sc_style['NEWSIMAGE']['pre'] = '';
$sc_style['NEWSIMAGE']['post'] = '
';
@@ -250,4 +238,6 @@ $NEWSSTYLE = '
';
+
+ */
?>
\ No newline at end of file