From 8a121f22caca5ab97f099aaa82d20adcec5508fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Fri, 4 Nov 2016 10:40:45 +0100 Subject: [PATCH 01/13] Custom template and layout for admin dashboard. --- e107_admin/admin.php | 3 + e107_admin/footer.php | 12 +- e107_admin/header.php | 11 +- e107_admin/includes/infopanel.php | 19 +-- e107_themes/bootstrap3/admin_template.php | 178 +++++++++++----------- 5 files changed, 119 insertions(+), 104 deletions(-) diff --git a/e107_admin/admin.php b/e107_admin/admin.php index ecc47d0dd..36600d630 100644 --- a/e107_admin/admin.php +++ b/e107_admin/admin.php @@ -33,6 +33,9 @@ if (varset($pref['adminstyle'])=='cascade' || varset($pref['adminstyle'])=='begi if(strpos($pref['adminstyle'], 'infopanel') === 0) { + // Define constant for using custom template on the dashboard. + define('e_DASHBOARD', true); + require_once(e_ADMIN.'includes/'.$pref['adminstyle'].'.php'); $_class = 'adminstyle_'.$pref['adminstyle']; if(class_exists($_class, false)) diff --git a/e107_admin/footer.php b/e107_admin/footer.php index dacce49e9..431e489d4 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; +global $error_handler,$db_time,$ADMIN_FOOTER,$ADMIN_FOOTER_DASHBOARD; // 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,7 +98,15 @@ if (varset($e107_popup) != 1) //NEW - Iframe mod if (!deftrue('e_IFRAME')) { - parse_admin($ADMIN_FOOTER); + // Dashboard uses its own template. + if (deftrue('e_DASHBOARD', false) === true) + { + parse_admin($ADMIN_FOOTER_DASHBOARD); + } + else + { + parse_admin($ADMIN_FOOTER); + } } $eTimingStop = microtime(); diff --git a/e107_admin/header.php b/e107_admin/header.php index f6fede866..d80195d45 100644 --- a/e107_admin/header.php +++ b/e107_admin/header.php @@ -588,7 +588,16 @@ if ($e107_popup != 1) if (!deftrue('e_IFRAME')) { //removed check strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE - parse_admin($ADMIN_HEADER); + + // Dashboard uses its own template. + if (deftrue('e_DASHBOARD', false) === true) + { + parse_admin($ADMIN_HEADER_DASHBOARD); + } + else + { + parse_admin($ADMIN_HEADER); + } } elseif(!vartrue($_GET['configure'])) { diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php index 3d8d26050..3736c2985 100644 --- a/e107_admin/includes/infopanel.php +++ b/e107_admin/includes/infopanel.php @@ -281,22 +281,9 @@ class adminstyle_infopanel if(vartrue($_GET['mode']) != 'customize') { // $ns->tablerender(ADLAN_47." ".ADMINNAME, $emessage->render().$text); - echo $mes->render().' - - -
-
- '.$text.' -
- -
- '.$text2.' -
-
- - - - '; + // echo $mes->render(); // TODO + echo $text; // Control Panel + echo $text2; // Latest e107 News + Website Status } else { diff --git a/e107_themes/bootstrap3/admin_template.php b/e107_themes/bootstrap3/admin_template.php index 88c5a6d99..93672aa77 100644 --- a/e107_themes/bootstrap3/admin_template.php +++ b/e107_themes/bootstrap3/admin_template.php @@ -208,121 +208,129 @@ $ADMIN_MODAL = ''; - - - - - - - -$ADMIN_HEADER .= '
-
-
- {SETSTYLE=admin_menu} - +$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 = ' +
+
+
+ +
+ Copyright © 2008-2015 e107 Inc (e107.org)
+
+'; + + +$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} +
+
+ +
+'; $ADMIN_FOOTER = ' -
-
-
- - -
-
- Copyright © 2008-2015 e107 Inc (e107.org)
-
'; +
+
+
+
+ +'; //{FS_ADMIN_ALT_NAV} From c8398db04bdd3f1d5a0c2a8ba7171f87d442a7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Fri, 4 Nov 2016 11:13:23 +0100 Subject: [PATCH 02/13] Javascript behaviour for draggable dashboard panels. --- e107_themes/bootstrap3/admin_template.php | 2 +- e107_themes/bootstrap3/admin_theme.php | 2 +- e107_themes/bootstrap3/js/bootstrap3.js | 52 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 e107_themes/bootstrap3/js/bootstrap3.js diff --git a/e107_themes/bootstrap3/admin_template.php b/e107_themes/bootstrap3/admin_template.php index 93672aa77..e00dac553 100644 --- a/e107_themes/bootstrap3/admin_template.php +++ b/e107_themes/bootstrap3/admin_template.php @@ -261,7 +261,7 @@ $ADMIN_HEADER_DASHBOARD = $ADMIN_HEADER = $ADMIN_MODAL . ' $ADMIN_HEADER_DASHBOARD .= '
-
+
{SETSTYLE=admin_menu} {ADMIN_MENU} {ADMIN_PWORD} diff --git a/e107_themes/bootstrap3/admin_theme.php b/e107_themes/bootstrap3/admin_theme.php index 24b253d1a..a22596891 100644 --- a/e107_themes/bootstrap3/admin_theme.php +++ b/e107_themes/bootstrap3/admin_theme.php @@ -5,7 +5,7 @@ define("SEP"," "); define("BOOTSTRAP", 3); define('FONTAWESOME', 4); - +e107::js("theme", "js/bootstrap3.js", 'jquery'); // e107::js("url", "https://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js",'jquery', 2); // e107::css('url', 'http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'); diff --git a/e107_themes/bootstrap3/js/bootstrap3.js b/e107_themes/bootstrap3/js/bootstrap3.js new file mode 100644 index 000000000..785189583 --- /dev/null +++ b/e107_themes/bootstrap3/js/bootstrap3.js @@ -0,0 +1,52 @@ +var e107 = e107 || {'settings': {}, 'behaviors': {}}; + +(function ($) +{ + 'use strict'; + + /** + * Initializes draggable panels on the dashboard. + * + * @type {{attach: e107.behaviors.adminDashboardDraggablePanels.attach}} + */ + e107.behaviors.adminDashboardDraggablePanels = { + attach: function (context, settings) + { + var selector = '.draggable-panels'; + var onceKey = 'admin-dashboard-draggable-panels'; + + $(context).find(selector).once(onceKey).each(function () + { + var $panel = $(this); + + $panel.sortable({ + connectWith: selector, + handle: '.panel-heading', + cursor: 'move', + placeholder: 'placeholder', + forcePlaceholderSize: true, + opacity: 0.4, + stop: function (event, ui) + { + var SortOrder = "SortOrder:\n"; + var i = 0; + + $(selector + " .panel-title").each(function () + { + i++; + var $this = $(this); + var title = $this.text(); + SortOrder += i + " - " + title + "\n"; + }); + + console.log(SortOrder); + } + }); + + $panel.disableSelection(); + + }); + } + }; + +})(jQuery); From 6d96cdbeabbfc4404d6203ba769151e362972a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3na=20Lore?= Date: Fri, 4 Nov 2016 18:06:36 +0100 Subject: [PATCH 03/13] Custom layout for dashboard with 10 droppable areas. --- e107_admin/includes/infopanel.php | 265 ++++++++++------------ e107_themes/bootstrap3/admin_style.css | 5 +- e107_themes/bootstrap3/admin_template.php | 47 ++-- e107_themes/bootstrap3/js/bootstrap3.js | 76 +++++-- e107_web/js/core/admin.jquery.js | 18 +- 5 files changed, 220 insertions(+), 191 deletions(-) diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php index 3736c2985..541b00b37 100644 --- a/e107_admin/includes/infopanel.php +++ b/e107_admin/includes/infopanel.php @@ -82,53 +82,23 @@ class adminstyle_infopanel $mes = e107::getMessage(); $pref = e107::getPref(); $frm = e107::getForm(); - - - // XXX Check Bootstrap bug is fixed. - /* - echo ' - - '; - */ - //TODO LANs throughout. + $droppableAreaContent1 = ''; + $droppableAreaContent2 = ''; + $droppableAreaContent3 = ''; + $droppableAreaContent4 = ''; + $droppableAreaContent5 = ''; + $droppableAreaContent6 = ''; + $droppableAreaContent7 = ''; + $droppableAreaContent8 = ''; + $droppableAreaContent9 = ''; + $droppableAreaContent10 = ''; + + // TODO LANs throughout. global $style, $user_pref; - // ---------------------- Start Panel -------------------------------- - -// $text = "
"; + // ---------------------- Start Panel ----------------------------- if (getperms('0') && !vartrue($user_pref['core-infopanel-mye107'])) // Set default icons. { $defArray = array ( @@ -147,143 +117,136 @@ 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 .= ' - -
- - -
-
-
'; - - */ - - // print_a($user_pref['core-infopanel-mye107']); - - $mainPanel .= " - - - - - -
"; - - foreach ($this->iconlist as $key=>$val) + $mainPanel = "
"; + $mainPanel .= "
"; + foreach ($this->iconlist as $key=>$val) + { + if (!vartrue($user_pref['core-infopanel-mye107']) || in_array($key, $user_pref['core-infopanel-mye107'])) { - 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 .= 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)); - $text = $ns->tablerender($caption, $mainPanel, "core-infopanel_mye107",true); + $coreInfoPanelMyE107 = $ns->tablerender($caption, $mainPanel, "core-infopanel_mye107",true); + $droppableAreaContent1 .= $coreInfoPanelMyE107; - // ------------------------------- 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'=>"
"); - $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'); - + $coreInfoPanelNews = $ns->tablerender(LAN_LATEST_e107_NEWS,e107::getForm()->tabs($newsTabs, array('active'=>'coreFeed')),"core-infopanel_news",true); + $droppableAreaContent2 .= $coreInfoPanelNews; - - $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 ------------------- - - + // --------------------- Website Status --------------------------- + $coreInfoPanelWebsiteStatus = $ns->tablerender(LAN_WEBSITE_STATUS, $this->renderWebsiteStatus(),"",true); + $droppableAreaContent2 .= $coreInfoPanelWebsiteStatus; + + + // --------------------- Latest Comments -------------------------- + $droppableAreaContent1 .= $this->renderLatestComments(); + + + // --------------------- 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}"); - $text .= $inc; - // $text .= $ns->tablerender("", $inc, $id,true); + $droppableAreaContent1 .= $inc; } } - - - - - - - - // $text .= "
     
    "; - - $text .= $this->render_infopanel_options(); - - - - // $text .= "
    "; + + $droppableAreaContent1 .= $this->render_infopanel_options(); if(vartrue($_GET['mode']) != 'customize') { - // $ns->tablerender(ADLAN_47." ".ADMINNAME, $emessage->render().$text); - // echo $mes->render(); // TODO - echo $text; // Control Panel - echo $text2; // Latest e107 News + Website Status + echo '
    '; + echo '
    '; + echo $mes->render(); + echo '
    '; + echo '
    '; + + echo '
    '; + echo '
    '; + echo '
    '; + echo $droppableAreaContent4; + echo '
    '; + echo '
    '; + echo '
    '; + + 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 '
    '; } else { diff --git a/e107_themes/bootstrap3/admin_style.css b/e107_themes/bootstrap3/admin_style.css index c18976080..316330fcb 100644 --- a/e107_themes/bootstrap3/admin_style.css +++ b/e107_themes/bootstrap3/admin_style.css @@ -1176,7 +1176,7 @@ li.rssRow > div { .core-mainpanel-link-icon img { margin-bottom: 5px } -.sidebar-toggle { width: 14px; height:300px; display: block; position: absolute; margin-left: -25px; margin-top:130px } +.sidebar-toggle { width: 14px; height:300px; display: block; position: absolute; margin-left: -25px; margin-top:130px; z-index: 1; } .sidebar-toggle a {color:#C6C6C6; height:300px; display:block; width:100%; border-right:7px double #77ACD9; opacity: 0; transition:.5s; z-index:5000; outline:0 } .sidebar-toggle a:hover { opacity: .8; outline:0 } #left-panel.toggled { display: none } @@ -1282,6 +1282,9 @@ li.after-submit:hover { background-color: #337AB7; color:white } #left-panel .panel-title .S24, #left-panel .panel-title img { margin-right:6px; width:24px; height:24px; vertical-align:middle} +/* Dashboard */ +.draggable-panels .panel-heading { cursor: move; } + /* body { background-color: rgb(68, 68, 68); } diff --git a/e107_themes/bootstrap3/admin_template.php b/e107_themes/bootstrap3/admin_template.php index e00dac553..d182b2232 100644 --- a/e107_themes/bootstrap3/admin_template.php +++ b/e107_themes/bootstrap3/admin_template.php @@ -260,28 +260,37 @@ $ADMIN_HEADER_DASHBOARD = $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} +
    +
    +
    + {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 = ' +
    diff --git a/e107_themes/bootstrap3/js/bootstrap3.js b/e107_themes/bootstrap3/js/bootstrap3.js index 785189583..72e762a75 100644 --- a/e107_themes/bootstrap3/js/bootstrap3.js +++ b/e107_themes/bootstrap3/js/bootstrap3.js @@ -4,15 +4,20 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; { 'use strict'; + e107.settings.draggablePanels = { + selector: '.draggable-panels', + items: '> .panel' + }; + /** - * Initializes draggable panels on the dashboard. + * Behavior to initialize draggable panels on the dashboard. * * @type {{attach: e107.behaviors.adminDashboardDraggablePanels.attach}} */ e107.behaviors.adminDashboardDraggablePanels = { attach: function (context, settings) { - var selector = '.draggable-panels'; + var selector = e107.settings.draggablePanels.selector; var onceKey = 'admin-dashboard-draggable-panels'; $(context).find(selector).once(onceKey).each(function () @@ -21,32 +26,69 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}}; $panel.sortable({ connectWith: selector, + items: e107.settings.draggablePanels.items, handle: '.panel-heading', + accept: e107.settings.draggablePanels.selector, cursor: 'move', - placeholder: 'placeholder', + placeholder: 'draggable-placeholder', forcePlaceholderSize: true, + helper: 'clone', + forceHelperSize: true, opacity: 0.4, + tolerance: 'pointer', + start: function (event, ui) + { + var $placeholders = $('.draggable-placeholder'); + var $draggablePanels = $(e107.settings.draggablePanels.selector); + + $placeholders.css('margin', '15px'); + $placeholders.css('background-color', '#337ab7'); + + $draggablePanels.css('min-height', '20px'); + $draggablePanels.css('border', '1px dashed #CCCCCC'); + $draggablePanels.css('margin-bottom', '30px'); + + $panel.sortable("refreshPositions"); + }, stop: function (event, ui) { - var SortOrder = "SortOrder:\n"; - var i = 0; + var $draggablePanels = $(e107.settings.draggablePanels.selector); + $draggablePanels.css('min-height', '0'); + $draggablePanels.css('border', 'none'); + $draggablePanels.css('margin-bottom', '0'); - $(selector + " .panel-title").each(function () - { - i++; - var $this = $(this); - var title = $this.text(); - SortOrder += i + " - " + title + "\n"; - }); - - console.log(SortOrder); + e107.callbacks.adminDashboardSavePanelOrder(); } }); - - $panel.disableSelection(); - }); } }; + e107.callbacks.adminDashboardSavePanelOrder = function () + { + var selector = e107.settings.draggablePanels.selector; + var NewOrder = []; + + $(selector).each(function () + { + var $this = $(this); + var key = $this.attr('id'); + + if(key) + { + NewOrder[key] = []; + + $('#' + key + ' ' + e107.settings.draggablePanels.items).each(function () + { + var $item = $(this); + var title = $item.find('.panel-title').eq(0).text(); + + NewOrder[key].push(title); + }); + } + }); + + console.log(NewOrder); + } + })(jQuery); diff --git a/e107_web/js/core/admin.jquery.js b/e107_web/js/core/admin.jquery.js index 8d31869fb..e606a5b59 100644 --- a/e107_web/js/core/admin.jquery.js +++ b/e107_web/js/core/admin.jquery.js @@ -154,9 +154,21 @@ $(document).ready(function() $('a[data-toggle-sidebar]').on('click', function(e) { e.preventDefault(); - - $("#left-panel").toggle(1000); - $("#right-panel").toggleClass("col-md-10 col-md-12"); //XXX Control animation direction? + + var $leftPanel = $("#left-panel"); + var $rightPanel = $("#right-panel"); + + if ($rightPanel.hasClass('col-md-12')) + { + $rightPanel.toggleClass("col-md-10 col-md-12"); + $leftPanel.toggle(1000); + } + else + { + $leftPanel.toggle(1000, function() { + $rightPanel.toggleClass("col-md-10 col-md-12"); + }); + } }); From 3a3734ef86857cbbd95640b7cb66bf5564ef9358 Mon Sep 17 00:00:00 2001 From: lonalore Date: Mon, 7 Nov 2016 14:12:19 +0100 Subject: [PATCH 04/13] 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' => "
    "); + $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 = ' -
    -
    -
    -
    - -
    - Copyright © 2008-2015 e107 Inc (e107.org)
    -
    -'; - - -$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 = ' -
    -
    -
    +
    +
    +