From 3a3734ef86857cbbd95640b7cb66bf5564ef9358 Mon Sep 17 00:00:00 2001 From: lonalore Date: Mon, 7 Nov 2016 14:12:19 +0100 Subject: [PATCH] Revert changes by infopanel, and introduce flexpanel, which extends infopanel funcionality. --- e107_admin/admin.php | 17 +- e107_admin/footer.php | 12 +- e107_admin/header.php | 14 +- e107_admin/includes/flexpanel.php | 262 ++++++++++++++++ e107_admin/includes/infopanel.php | 290 +++++++++++------- .../shortcodes/batch/admin_shortcodes.php | 5 +- e107_themes/bootstrap3/admin_template.php | 93 ++---- e107_themes/bootstrap3/admin_theme.php | 2 +- .../js/core/admin.flexpanel.js | 28 +- 9 files changed, 504 insertions(+), 219 deletions(-) create mode 100644 e107_admin/includes/flexpanel.php rename e107_themes/bootstrap3/js/bootstrap3.js => e107_web/js/core/admin.flexpanel.js (69%) diff --git a/e107_admin/admin.php b/e107_admin/admin.php index 36600d630..01c9245a0 100644 --- a/e107_admin/admin.php +++ b/e107_admin/admin.php @@ -31,18 +31,19 @@ if (varset($pref['adminstyle'])=='cascade' || varset($pref['adminstyle'])=='begi $pref['adminstyle'] = 'infopanel'; } -if(strpos($pref['adminstyle'], 'infopanel') === 0) +if(in_array($pref['adminstyle'], array('infopanel', 'flexpanel'))) { - // Define constant for using custom template on the dashboard. - define('e_DASHBOARD', true); + require_once(e_ADMIN . 'includes/' . $pref['adminstyle'] . '.php'); - require_once(e_ADMIN.'includes/'.$pref['adminstyle'].'.php'); - $_class = 'adminstyle_'.$pref['adminstyle']; + $_class = 'adminstyle_' . $pref['adminstyle']; if(class_exists($_class, false)) { - $adp = new $_class; + $adp = new $_class; + } + else + { + $adp = new adminstyle_infopanel; } - else $adp = new adminstyle_infopanel; } @@ -399,7 +400,7 @@ function render_clean() // still used by classis, tabbed etc. if(is_object($adp)) { - $adp->render(); + $adp->render(); } else { diff --git a/e107_admin/footer.php b/e107_admin/footer.php index 431e489d4..dacce49e9 100644 --- a/e107_admin/footer.php +++ b/e107_admin/footer.php @@ -19,7 +19,7 @@ if (!defined('e107_INIT')) } $In_e107_Footer = TRUE; // For registered shutdown function -global $error_handler,$db_time,$ADMIN_FOOTER,$ADMIN_FOOTER_DASHBOARD; +global $error_handler,$db_time,$ADMIN_FOOTER; // Legacy fix - call header if not already done, mainly fixing left side menus to work proper if(!deftrue('e_ADMIN_UI') && !deftrue('ADMIN_AREA')) @@ -98,15 +98,7 @@ if (varset($e107_popup) != 1) //NEW - Iframe mod if (!deftrue('e_IFRAME')) { - // Dashboard uses its own template. - if (deftrue('e_DASHBOARD', false) === true) - { - parse_admin($ADMIN_FOOTER_DASHBOARD); - } - else - { - parse_admin($ADMIN_FOOTER); - } + parse_admin($ADMIN_FOOTER); } $eTimingStop = microtime(); diff --git a/e107_admin/header.php b/e107_admin/header.php index d80195d45..786e9fefd 100644 --- a/e107_admin/header.php +++ b/e107_admin/header.php @@ -295,15 +295,17 @@ echo "\n\n"; $e_js->renderJs('core_css', false, 'css', false); echo "\n\n"; -// Plugin CSS -$e_js->renderJs('plugin_css', false, 'css', false); -echo "\n\n"; + // Theme CSS //echo "\n"; $e_js->renderJs('theme_css', false, 'css', false); echo "\n\n"; +// Plugin CSS +$e_js->renderJs('plugin_css', false, 'css', false); +echo "\n\n"; + // Inline CSS - not sure if this should stay at all! $e_js->renderJs('inline_css', false, 'css', false); echo "\n\n"; @@ -589,10 +591,10 @@ if ($e107_popup != 1) { //removed check strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE - // Dashboard uses its own template. - if (deftrue('e_DASHBOARD', false) === true) + // "flexpanel" style uses its own template!!! + if(defset('e_PAGE') == 'admin.php' && varset($pref['adminstyle']) == 'flexpanel') { - parse_admin($ADMIN_HEADER_DASHBOARD); + parse_admin($ADMIN_HEADER_FLEXPANEL); } else { diff --git a/e107_admin/includes/flexpanel.php b/e107_admin/includes/flexpanel.php new file mode 100644 index 000000000..943de431a --- /dev/null +++ b/e107_admin/includes/flexpanel.php @@ -0,0 +1,262 @@ +iconlist = $this->getIconList(); + + e107::js('core', 'core/admin.flexpanel.js', 'jquery', 4); + } + + /** + * Render contents. + */ + public function render() + { + $admin_sc = e107::getScBatch('admin'); + $tp = e107::getParser(); + $ns = e107::getRender(); + $mes = e107::getMessage(); + $pref = e107::getPref(); + $frm = e107::getForm(); + + global $user_pref; + + $panels = array( + 'Area01' => '', // Sidebar. + 'Area02' => '', + 'Area03' => '', + 'Area04' => '', + 'Area05' => '', + 'Area06' => '', + 'Area07' => '', // Content left. + 'Area08' => '', // Content right. + 'Area09' => '', + 'Area10' => '', + 'Area11' => '', + 'Area12' => '', + 'Area13' => '', + ); + + + // "Help" box. + $panels['Area01'] .= $tp->parseTemplate('{SETSTYLE=site_info}{ADMIN_HELP}', true, $admin_sc); + // "Latest" box. + $panels['Area01'] .= $tp->parseTemplate('{SETSTYLE=admin_menu}{ADMIN_LATEST=infopanel}', true, $admin_sc); + // "Status" box. + $panels['Area01'] .= $tp->parseTemplate('{SETSTYLE=admin_menu}{ADMIN_STATUS=infopanel}', true, $admin_sc); + + + // --------------------- Personalized Panel ----------------------- + if(getperms('0') && !vartrue($user_pref['core-infopanel-mye107'])) // Set default icons. + { + $defArray = array( + 0 => 'e-administrator', + 1 => 'e-cpage', + 2 => 'e-frontpage', + 3 => 'e-mailout', + 4 => 'e-image', + 5 => 'e-menus', + 6 => 'e-meta', + 7 => 'e-newspost', + 8 => 'e-plugin', + 9 => 'e-prefs', + 10 => 'e-links', + 11 => 'e-theme', + 12 => 'e-userclass2', + 13 => 'e-users', + 14 => 'e-wmessage' + ); + $user_pref['core-infopanel-mye107'] = vartrue($pref['core-infopanel-default'], $defArray); + } + $tp->parseTemplate("{SETSTYLE=core-infopanel}"); + $mainPanel = "
"; + $mainPanel .= "
"; + foreach($this->iconlist as $key => $val) + { + if(!vartrue($user_pref['core-infopanel-mye107']) || in_array($key, $user_pref['core-infopanel-mye107'])) + { + $mainPanel .= e107::getNav()->renderAdminButton($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div"); + } + } + $mainPanel .= "
"; + // Rendering the saved configuration. + $tp->parseTemplate("{SETSTYLE=core-infopanel}"); + $caption = $tp->lanVars(LAN_CONTROL_PANEL, ucwords(USERNAME)); + $coreInfoPanelMyE107 = $ns->tablerender($caption, $mainPanel, "core-infopanel_mye107", true); + $panels['Area07'] .= $coreInfoPanelMyE107; + + + // --------------------- e107 News -------------------------------- + $newsTabs = array(); + $newsTabs['coreFeed'] = array('caption' => LAN_GENERAL, 'text' => "
" . LAN_MORE . "
"); + $newsTabs['pluginFeed'] = array('caption' => LAN_PLUGIN, 'text' => "
"); + $newsTabs['themeFeed'] = array('caption' => LAN_THEMES, 'text' => "
"); + + $coreInfoPanelNews = $ns->tablerender(LAN_LATEST_e107_NEWS, e107::getForm()->tabs($newsTabs, array('active' => 'coreFeed')), "core-infopanel_news", true); + $panels['Area08'] .= $coreInfoPanelNews; + + + // --------------------- Website Status --------------------------- + $coreInfoPanelWebsiteStatus = $ns->tablerender(LAN_WEBSITE_STATUS, $this->renderWebsiteStatus(), "", true); + $panels['Area08'] .= $coreInfoPanelWebsiteStatus; + + + // --------------------- Latest Comments -------------------------- + $panels['Area01'] .= $this->renderLatestComments(); + + + // --------------------- User Selected Menus ---------------------- + if(varset($user_pref['core-infopanel-menus'])) + { + foreach($user_pref['core-infopanel-menus'] as $val) + { + $inc = $tp->parseTemplate("{PLUGIN=$val|TRUE}"); + $panels['Area01'] .= $inc; + } + } + + // Sidebar. + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; + + + if(vartrue($_GET['mode']) != 'customize') + { + echo '
'; + echo '
'; + echo $mes->render(); + echo '
'; + echo '
'; + + + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; + + + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; + + + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; + + + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; + + + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; + + + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; + + + echo '
'; + echo '
'; + echo ''; + echo '
'; + echo '
'; + } + else + { + echo $frm->open('infopanel', 'post', e_SELF); + echo $this->render_infopanel_options(true); + echo $frm->close(); + } + + echo '
'; + echo '
'; + } + +} diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php index 541b00b37..b218a8aa8 100644 --- a/e107_admin/includes/infopanel.php +++ b/e107_admin/includes/infopanel.php @@ -57,12 +57,9 @@ class adminstyle_infopanel { $user_pref['core-infopanel-mye107'] = $_POST['e-mye107']; - + $user_pref['core-infopanel-menus'] = $_POST['e-mymenus']; + save_prefs('user'); - - $pref['core-infopanel-menus'] = $_POST['e-mymenus']; - - save_prefs(); } @@ -72,6 +69,15 @@ class adminstyle_infopanel $this->iconlist = e107::getNav()->adminLinks(); } + + + /** + * Allow to get Icon List. + */ + function getIconList() + { + return $this->iconlist; + } function render() @@ -82,23 +88,53 @@ class adminstyle_infopanel $mes = e107::getMessage(); $pref = e107::getPref(); $frm = e107::getForm(); + + + // XXX Check Bootstrap bug is fixed. + /* + echo ' + - $droppableAreaContent1 = ''; - $droppableAreaContent2 = ''; - $droppableAreaContent3 = ''; - $droppableAreaContent4 = ''; - $droppableAreaContent5 = ''; - $droppableAreaContent6 = ''; - $droppableAreaContent7 = ''; - $droppableAreaContent8 = ''; - $droppableAreaContent9 = ''; - $droppableAreaContent10 = ''; - - // TODO LANs throughout. + '; + */ + //TODO LANs throughout. global $style, $user_pref; - // ---------------------- Start Panel ----------------------------- + // ---------------------- Start Panel -------------------------------- + +// $text = "
"; if (getperms('0') && !vartrue($user_pref['core-infopanel-mye107'])) // Set default icons. { $defArray = array ( @@ -117,136 +153,156 @@ class adminstyle_infopanel 12 => 'e-userclass2', 13 => 'e-users', 14 => 'e-wmessage' - ); - + ); $user_pref['core-infopanel-mye107'] = vartrue($pref['core-infopanel-default'],$defArray); + } - + + + + // "
"; + $tp->parseTemplate("{SETSTYLE=core-infopanel}"); - - // --------------------- Personalized Panel ----------------------- + + // Personalized Panel // Rendering the saved configuration. - $mainPanel = "
"; - $mainPanel .= "
"; - foreach ($this->iconlist as $key=>$val) - { - if (!vartrue($user_pref['core-infopanel-mye107']) || in_array($key, $user_pref['core-infopanel-mye107'])) + $mainPanel = " +
+ "; + + /* + $mainPanel .= ' + +
+ + +
+
+
'; + + */ + + // print_a($user_pref['core-infopanel-mye107']); + + $mainPanel .= " + + + + + +
"; + + foreach ($this->iconlist as $key=>$val) { - $mainPanel .= e107::getNav()->renderAdminButton($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div"); + if (!vartrue($user_pref['core-infopanel-mye107']) || in_array($key, $user_pref['core-infopanel-mye107'])) + { + $mainPanel .= e107::getNav()->renderAdminButton($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div"); + } } - } - $mainPanel .= "
"; + + // $mainPanel .= "
 
"; + $mainPanel .= "
+ +
"; $caption = $tp->lanVars(LAN_CONTROL_PANEL, ucwords(USERNAME)); - $coreInfoPanelMyE107 = $ns->tablerender($caption, $mainPanel, "core-infopanel_mye107",true); - $droppableAreaContent1 .= $coreInfoPanelMyE107; + $text = $ns->tablerender($caption, $mainPanel, "core-infopanel_mye107",true); - // --------------------- e107 News -------------------------------- + // ------------------------------- e107 News -------------------------------- + $newsTabs = array(); $newsTabs['coreFeed'] = array('caption'=>LAN_GENERAL,'text'=>"
"); $newsTabs['pluginFeed'] = array('caption'=>LAN_PLUGIN,'text'=>"
"); $newsTabs['themeFeed'] = array('caption'=>LAN_THEMES,'text'=>"
"); - $coreInfoPanelNews = $ns->tablerender(LAN_LATEST_e107_NEWS,e107::getForm()->tabs($newsTabs, array('active'=>'coreFeed')),"core-infopanel_news",true); - $droppableAreaContent2 .= $coreInfoPanelNews; + $text2 = $ns->tablerender(LAN_LATEST_e107_NEWS,e107::getForm()->tabs($newsTabs, array('active'=>'coreFeed')),"core-infopanel_news",true); + + + + + // ---------------------Latest Stuff --------------------------- + + //require_once (e_CORE."shortcodes/batch/admin_shortcodes.php"); + e107::getScBatch('admin'); + - // --------------------- Website Status --------------------------- - $coreInfoPanelWebsiteStatus = $ns->tablerender(LAN_WEBSITE_STATUS, $this->renderWebsiteStatus(),"",true); - $droppableAreaContent2 .= $coreInfoPanelWebsiteStatus; - - - // --------------------- Latest Comments -------------------------- - $droppableAreaContent1 .= $this->renderLatestComments(); - - - // --------------------- User Selected Menus ---------------------- + + $text2 .= $ns->tablerender(LAN_WEBSITE_STATUS, $this->renderWebsiteStatus(),"",true); + + + // $text .= $ns->tablerender(ADLAN_LAT_1,$tp->parseTemplate("{ADMIN_LATEST=norender}"),"core-infopanel_latest",true); + // $text .= $ns->tablerender(LAN_STATUS,$tp->parseTemplate("{ADMIN_STATUS=norender}"),"core-infopanel_latest",true); + /* + + $text .= "
  • + ".$tp->parseTemplate("{ADMIN_LATEST=norender}"). + $tp->parseTemplate("{ADMIN_STATUS=norender}")." +
  • "; + + */ + + + $text .= $this->renderLatestComments(); + + + // ---------------------- Who's Online ------------------------ + // TODO Could use a new _menu item instead. + + + // $text2 .= $ns->tablerender('Visitors Online : '.vartrue($nOnline), $panelOnline,'core-infopanel_online',true); + + // --------------------- User Selected Menus ------------------- + + if (varset($pref['core-infopanel-menus'])) { foreach ($pref['core-infopanel-menus'] as $val) { $id = $frm->name2id('core-infopanel_'.$val); $inc = $tp->parseTemplate("{PLUGIN=$val|TRUE}"); - $droppableAreaContent1 .= $inc; + $text .= $inc; + // $text .= $ns->tablerender("", $inc, $id,true); } } - - $droppableAreaContent1 .= $this->render_infopanel_options(); + + + + + + + + // $text .= "
     
    "; + + $text .= $this->render_infopanel_options(); + + + + // $text .= ""; if(vartrue($_GET['mode']) != 'customize') { - echo '
    '; - echo '
    '; - echo $mes->render(); - echo '
    '; - echo '
    '; + // $ns->tablerender(ADLAN_47." ".ADMINNAME, $emessage->render().$text); + echo $mes->render().' - echo '
    '; - echo '
    '; - echo '
    '; - echo $droppableAreaContent4; - echo '
    '; - echo '
    '; - echo '
    '; + +
    +
    + '.$text.' +
    - echo '
    '; - echo '
    '; - echo '
    '; - echo $droppableAreaContent5; - echo '
    '; - echo '
    '; - echo '
    '; - echo '
    '; - echo $droppableAreaContent6; - echo '
    '; - echo '
    '; - echo '
    '; - echo '
    '; - echo $droppableAreaContent7; - echo '
    '; - echo '
    '; - echo '
    '; - - echo '
    '; - echo '
    '; - echo '
    '; - echo $droppableAreaContent1; // Control Panel - echo '
    '; - echo '
    '; - echo '
    '; - echo '
    '; - echo $droppableAreaContent2; // Latest e107 News - echo '
    '; - echo '
    '; - echo '
    '; - - echo '
    '; - echo '
    '; - echo '
    '; - echo $droppableAreaContent8; - echo '
    '; - echo '
    '; - echo '
    '; - echo '
    '; - echo $droppableAreaContent9; - echo '
    '; - echo '
    '; - echo '
    '; - echo '
    '; - echo $droppableAreaContent10; - echo '
    '; - echo '
    '; - echo '
    '; - - echo '
    '; - echo '
    '; - echo '
    '; - echo $droppableAreaContent3; // Website Status - echo '
    '; - echo '
    '; - echo '
    '; +
    + '.$text2.' +
    +
    + + + + '; } else { diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index 43be7fc1d..ebe5f2832 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -411,12 +411,11 @@ class admin_shortcodes function sc_admin_latest($parm) { - if($parm == 'infopanel' && e_PAGE != 'admin.php') + if(($parm == 'infopanel' || $parm == 'flexpanel') && e_PAGE != 'admin.php') { return; } - if (ADMIN) { if (!function_exists('admin_latest')) //XXX Is this still necessary? { @@ -1095,7 +1094,7 @@ class admin_shortcodes function sc_admin_status($parm) { - if($parm == 'infopanel' && e_PAGE != 'admin.php') + if(($parm == 'infopanel' || $parm == 'flexpanel') && e_PAGE != 'admin.php') { return; } diff --git a/e107_themes/bootstrap3/admin_template.php b/e107_themes/bootstrap3/admin_template.php index d182b2232..ac218b578 100644 --- a/e107_themes/bootstrap3/admin_template.php +++ b/e107_themes/bootstrap3/admin_template.php @@ -208,6 +208,7 @@ $ADMIN_MODAL = ' -'; + + + +'; - -$ADMIN_HEADER_DASHBOARD = $ADMIN_HEADER = $ADMIN_MODAL . ' +// TODO - LANs +$ADMIN_HEADER_FLEXPANEL = $ADMIN_HEADER = $ADMIN_MODAL . ' -'; - - -$ADMIN_HEADER_DASHBOARD .= ' -
    -
    -
    -
    - {SETSTYLE=admin_menu} - {ADMIN_MENU} - {ADMIN_PWORD} - {ADMIN_MENUMANAGER} - - {SETSTYLE=site_info} - {ADMINUI_HELP} - {ADMIN_HELP} - - {ADMIN_SITEINFO=creditsonly} - {SETSTYLE=admin_menu} - {ADMIN_LATEST=infopanel} - {ADMIN_STATUS=infopanel} - {ADMIN_LOG=request} - {ADMIN_MSG=request} - {ADMIN_PLUGINS} - {SETSTYLE=default} -
    -
    -
    - -
    -'; - -$ADMIN_FOOTER_DASHBOARD = ' -
    -
    -
    -
    - - -'; - - -$ADMIN_HEADER .= '
    +'; + +$ADMIN_HEADER_FLEXPANEL .= ' +
    +
    +'; + +// TODO - LANs +$ADMIN_HEADER .= '
    {SETSTYLE=admin_menu} {ADMIN_MENU} + {ADMIN_PWORD} {ADMIN_MENUMANAGER} +
    {SETSTYLE=site_info} {ADMINUI_HELP} {ADMIN_HELP}
    + {ADMIN_SITEINFO=creditsonly} {SETSTYLE=admin_menu} + {ADMIN_LATEST=infopanel} {ADMIN_STATUS=infopanel} + {ADMIN_LOG=request} {ADMIN_MSG=request} {ADMIN_PLUGINS} - {SETSTYLE=default} + + {SETSTYLE=default}
    -
    +
    '; +// TODO - LANs $ADMIN_FOOTER = ' -
    -
    -
    +
    +
    +