diff --git a/e107_admin/admin.php b/e107_admin/admin.php index ecc47d0dd..a22472e60 100644 --- a/e107_admin/admin.php +++ b/e107_admin/admin.php @@ -15,6 +15,22 @@ */ require_once('../class2.php'); + + +if(varset($_GET['mode']) == 'customize') +{ + $adminPref = e107::getConfig()->get('adminpref', 0); + + // If not Main Admin and "Apply dashboard preferences to all administrators" + // is checked in admin theme settings. + if(!getperms("1") && $adminPref == 1) + { + e107::redirect('admin'); + exit; + } +} + + include_once(e107::coreTemplatePath('admin_icons')); // Needs to be loaded before infopanel AND in boot.php if(vartrue($_GET['iframe']) == 1) @@ -31,15 +47,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'))) { - require_once(e_ADMIN.'includes/'.$pref['adminstyle'].'.php'); - $_class = 'adminstyle_'.$pref['adminstyle']; + require_once(e_ADMIN . 'includes/' . $pref['adminstyle'] . '.php'); + + $_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; } @@ -396,7 +416,7 @@ function render_clean() // still used by classis, tabbed etc. if(is_object($adp)) { - $adp->render(); + $adp->render(); } else { diff --git a/e107_admin/includes/flexpanel.php b/e107_admin/includes/flexpanel.php new file mode 100644 index 000000000..ca639eb55 --- /dev/null +++ b/e107_admin/includes/flexpanel.php @@ -0,0 +1,592 @@ +get('adminpref', 0); +$flepanelEnabled = true; + +// If not Main Admin and "Apply dashboard preferences to all administrators" is checked. +if(!getperms('1') && $adminPref == 1) +{ + $flepanelEnabled = false; +} + +define('FLEXPANEL_ENABLED', $flepanelEnabled); + + +// Save rearranged menus to user. +if(e_AJAX_REQUEST) +{ + if(FLEXPANEL_ENABLED && varset($_POST['core-flexpanel-order'], false)) + { + // If "Apply dashboard preferences to all administrators" is checked. + if($adminPref == 1) + { + e107::getConfig() + ->setPosted('core-flexpanel-order', $_POST['core-flexpanel-order']) + ->save(); + } + else + { + e107::getUser() + ->getConfig() + ->set('core-flexpanel-order', $_POST['core-flexpanel-order']) + ->save(); + } + exit; + } +} + +// Flexpanel uses infopanel's methods to avoid code duplication. +e107_require_once(e_ADMIN . 'includes/infopanel.php'); + + +/** + * Class adminstyle_flexpanel. + */ +class adminstyle_flexpanel extends adminstyle_infopanel +{ + + private $iconlist = array(); + + /** + * Constructor. + */ + public function __construct() + { + parent::__construct(); + + $this->iconlist = $this->getIconList(); + + if(FLEXPANEL_ENABLED) + { + e107::css('inline', '.draggable-panels .panel-heading { cursor: move; }'); + e107::js('core', 'core/admin.flexpanel.js', 'jquery', 4); + + if(varset($_GET['mode']) == 'customize') + { + e107::css('inline', '.layout-container { display: table; margin-left: auto; margin-right: auto; }'); + e107::css('inline', '.layout-container label.radio { float: left; padding: 0; width: 120px; margin: 7px; cursor: pointer; text-align: center; }'); + e107::css('inline', '.layout-container label.radio img { margin-left: auto; margin-right: auto; display: block; }'); + e107::css('inline', '.layout-container label.radio input { width: 100%; margin-left: auto; margin-right: auto; display: block; }'); + e107::css('inline', '.layout-container label.radio p { width: 100%; text-align: center; display: block; margin: 20px 0 0 0; }'); + } + + // Save posted Layout type. + if(varset($_POST['e-flexpanel-layout'])) + { + $user_pref = $this->getUserPref(); + + // If Layout has been changed, we clear previous arrangement in order to use defaults. + if($user_pref['core-flexpanel-layout'] != $_POST['e-flexpanel-layout']) + { + $this->savePref('core-flexpanel-order', array()); + } + + $this->savePref('core-flexpanel-layout', $_POST['e-flexpanel-layout']); + } + } + } + + /** + * 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(); + + $user_pref = $this->getUserPref(); + + if(varset($_GET['mode']) == 'customize') + { + echo $frm->open('infopanel', 'post', e_SELF); + echo $ns->tablerender(LAN_DASHBOARD_LAYOUT, $this->renderLayoutPicker(), 'personalize', true); + echo '
 
'; + echo $this->render_infopanel_options(true); + echo $frm->close(); + return; + } + + // Default menu areas. + $panels = array( + 'menu-area-01' => array(), // Sidebar. + 'menu-area-02' => array(), + 'menu-area-03' => array(), + 'menu-area-04' => array(), + 'menu-area-05' => array(), + 'menu-area-06' => array(), + 'menu-area-07' => array(), // Content left. + 'menu-area-08' => array(), // Content right. + 'menu-area-09' => array(), + 'menu-area-10' => array(), + 'menu-area-11' => array(), + 'menu-area-12' => array(), + 'menu-area-13' => array(), + ); + + + // "Help" box. + $tp->parseTemplate("{SETSTYLE=flexpanel}"); + $ns->setUniqueId('core-infopanel_help'); + $info = $this->getMenuPosition('core-infopanel_help'); + $panels[$info['area']][$info['weight']] .= $tp->parseTemplate('{ADMIN_HELP}', true, $admin_sc); + + // "Latest" box. + $tp->parseTemplate("{SETSTYLE=flexpanel}"); + $info = $this->getMenuPosition('e-latest-list'); + $panels[$info['area']][$info['weight']] .= $tp->parseTemplate('{ADMIN_LATEST=infopanel}', true, $admin_sc); + + // "Status" box. + $tp->parseTemplate("{SETSTYLE=flexpanel}"); + $info = $this->getMenuPosition('e-status-list'); + $panels[$info['area']][$info['weight']] .= $tp->parseTemplate('{ADMIN_STATUS=infopanel}', true, $admin_sc); + + + // --------------------- Personalized Panel ----------------------- + if(empty(varset($user_pref['core-infopanel-mye107'], array()))) // 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'] = $defArray; + } + $tp->parseTemplate("{SETSTYLE=flexpanel}"); + $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=flexpanel}"); + $caption = $tp->lanVars(LAN_CONTROL_PANEL, ucwords(USERNAME)); + $ns->setUniqueId('core-infopanel_mye107'); + $coreInfoPanelMyE107 = $ns->tablerender($caption, $mainPanel, "core-infopanel_mye107", true); + $info = $this->getMenuPosition('core-infopanel_mye107'); + $panels[$info['area']][$info['weight']] .= $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' => "
"); + $tp->parseTemplate("{SETSTYLE=flexpanel}"); + $ns->setUniqueId('core-infopanel_news'); + $coreInfoPanelNews = $ns->tablerender(LAN_LATEST_e107_NEWS, e107::getForm()->tabs($newsTabs, array('active' => 'coreFeed')), "core-infopanel_news", true); + $info = $this->getMenuPosition('core-infopanel_news'); + $panels[$info['area']][$info['weight']] .= $coreInfoPanelNews; + + + // --------------------- Website Status --------------------------- + $tp->parseTemplate("{SETSTYLE=flexpanel}"); + $ns->setUniqueId('core-infopanel_website_status'); + $coreInfoPanelWebsiteStatus = $ns->tablerender(LAN_WEBSITE_STATUS, $this->renderWebsiteStatus(), "core-infopanel_website_status", true); + $info = $this->getMenuPosition('core-infopanel_website_status'); + $panels[$info['area']][$info['weight']] .= $coreInfoPanelWebsiteStatus; + + + // --------------------- Latest Comments -------------------------- + // $panels['Area01'] .= $this->renderLatestComments(); // TODO + + + // --------------------- User Selected Menus ---------------------- + if(varset($user_pref['core-infopanel-menus'])) + { + $tp->parseTemplate("{SETSTYLE=flexpanel}"); + foreach($user_pref['core-infopanel-menus'] as $val) + { + // Custom menu. + if(is_numeric($val)) + { + $menu = e107::getDb()->retrieve('page', 'menu_name', 'page_id = ' . (int) $val); + $id = 'cmenu-' . $menu; + $inc = e107::getMenu()->renderMenu($val, null, null, true); + } + else + { + $id = $frm->name2id($val); + $inc = $tp->parseTemplate("{PLUGIN=$val|TRUE}"); + } + $info = $this->getMenuPosition($id); + $panels[$info['area']][$info['weight']] .= $inc; + } + } + + // Sorting panels. + foreach($panels as $key => $value) + { + ksort($panels[$key]); + } + + $layout = varset($user_pref['core-flexpanel-layout'], 'default'); + $layout_file = e_ADMIN . 'includes/layouts/flexpanel_' . $layout . '.php'; + + if(is_readable($layout_file)) + { + include_once($layout_file); + + $template = varset($FLEXPANEL_LAYOUT); + $template = str_replace('{MESSAGES}', $mes->render(), $template); + + foreach($panels as $key => $value) + { + $token = '{' . strtoupper(str_replace('-', '_', $key)) . '}'; + $template = str_replace($token, implode("\n", $value), $template); + } + + echo $template; + } + } + + /** + * Get selected area and position for a menu item. + * + * @param $id + * Menu ID. + * @return array + * Contains menu area and weight. + */ + function getMenuPosition($id) + { + $user_pref = $this->getUserPref(); + + if(varset($user_pref['core-flexpanel-order'][$id])) + { + return $user_pref['core-flexpanel-order'][$id]; + } + + $default = array( + 'area' => 'menu-area-01', + 'weight' => 1000, + ); + + switch(varset($user_pref['core-flexpanel-layout'], 'default')) + { + case 'two_col_bricks': + if($id == 'core-infopanel_help') + { + $default['area'] = 'menu-area-01'; + $default['weight'] = 0; + } + + if($id == 'e-latest-list') + { + $default['area'] = 'menu-area-04'; + $default['weight'] = 1; + } + + if($id == 'e-status-list') + { + $default['area'] = 'menu-area-04'; + $default['weight'] = 2; + } + + if($id == 'core-infopanel_mye107') + { + $default['area'] = 'menu-area-02'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_news') + { + $default['area'] = 'menu-area-03'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_website_status') + { + $default['area'] = 'menu-area-03'; + $default['weight'] = 1; + } + break; + + case 'two_col_stacked': + if($id == 'core-infopanel_help') + { + $default['area'] = 'menu-area-01'; + $default['weight'] = 1; + } + + if($id == 'e-latest-list') + { + $default['area'] = 'menu-area-04'; + $default['weight'] = 0; + } + + if($id == 'e-status-list') + { + $default['area'] = 'menu-area-05'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_mye107') + { + $default['area'] = 'menu-area-02'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_news') + { + $default['area'] = 'menu-area-03'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_website_status') + { + $default['area'] = 'menu-area-12'; + $default['weight'] = 1; + } + break; + + case 'three_col_bricks': + if($id == 'core-infopanel_help') + { + $default['area'] = 'menu-area-02'; + $default['weight'] = 0; + } + + if($id == 'e-latest-list') + { + $default['area'] = 'menu-area-03'; + $default['weight'] = 0; + } + + if($id == 'e-status-list') + { + $default['area'] = 'menu-area-04'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_mye107') + { + $default['area'] = 'menu-area-01'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_news') + { + $default['area'] = 'menu-area-09'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_website_status') + { + $default['area'] = 'menu-area-13'; + $default['weight'] = 0; + } + break; + + case 'three_col_stacked': + if($id == 'core-infopanel_help') + { + $default['area'] = 'menu-area-03'; + $default['weight'] = 0; + } + + if($id == 'e-latest-list') + { + $default['area'] = 'menu-area-04'; + $default['weight'] = 0; + } + + if($id == 'e-status-list') + { + $default['area'] = 'menu-area-05'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_mye107') + { + $default['area'] = 'menu-area-02'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_news') + { + $default['area'] = 'menu-area-12'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_website_status') + { + $default['area'] = 'menu-area-13'; + $default['weight'] = 0; + } + break; + + case 'one_col': + if($id == 'core-infopanel_help') + { + $default['area'] = 'menu-area-01'; + $default['weight'] = 0; + } + + if($id == 'e-latest-list') + { + $default['area'] = 'menu-area-02'; + $default['weight'] = 0; + } + + if($id == 'e-status-list') + { + $default['area'] = 'menu-area-03'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_mye107') + { + $default['area'] = 'menu-area-04'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_news') + { + $default['area'] = 'menu-area-05'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_website_status') + { + $default['area'] = 'menu-area-06'; + $default['weight'] = 0; + } + break; + + case 'wider_sidebar': + case 'default': + default: + if($id == 'core-infopanel_help') + { + $default['area'] = 'menu-area-01'; + $default['weight'] = 0; + } + + if($id == 'e-latest-list') + { + $default['area'] = 'menu-area-01'; + $default['weight'] = 1; + } + + if($id == 'e-status-list') + { + $default['area'] = 'menu-area-01'; + $default['weight'] = 2; + } + + if($id == 'core-infopanel_mye107') + { + $default['area'] = 'menu-area-07'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_news') + { + $default['area'] = 'menu-area-08'; + $default['weight'] = 0; + } + + if($id == 'core-infopanel_website_status') + { + $default['area'] = 'menu-area-08'; + $default['weight'] = 1; + } + break; + } + + return $default; + } + + /** + * Render layout-picker widget. + * + * @return string + */ + function renderLayoutPicker() + { + $tp = e107::getParser(); + $fr = e107::getForm(); + $fl = e107::getFile(); + + $user_pref = $this->getUserPref(); + + $default = varset($user_pref['core-flexpanel-layout'], 'default'); + + $html = '
'; + + $layouts = array( + 'default', + 'wider_sidebar', + 'two_col_bricks', + 'two_col_stacked', + 'three_col_bricks', + 'three_col_stacked', + 'one_col', + ); + + $files = $fl->get_files(e_ADMIN . 'includes/layouts/', "flexpanel_(.*).php", "standard", 1); + foreach($files as $num => $val) + { + $filename = basename($val['fname']); + $layout = str_replace('flexpanel_', '', $filename); + $layout = str_replace('.php', '', $layout); + + if(!in_array($layout, $layouts)) + { + $layouts[] = $layout; + } + } + + foreach($layouts as $layout) + { + $html .= ''; + } + + $html .= '
'; + $html .= '
'; + + return $html; + } + +} diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php index 234ad002d..961f9686d 100644 --- a/e107_admin/includes/infopanel.php +++ b/e107_admin/includes/infopanel.php @@ -31,45 +31,86 @@ class adminstyle_infopanel function __construct() { - // e107::js('core','zrssfeed/jquery.zrssfeed.min.js'); // http://www.zazar.net/developers/jquery/zrssfeed/ - $code = " - - jQuery(function($){ - $('#e-adminfeed').load('".e_ADMIN."admin.php?mode=core&type=feed'); - $('#e-adminfeed-plugin').load('".e_ADMIN."admin.php?mode=addons&type=plugin'); - $('#e-adminfeed-theme').load('".e_ADMIN."admin.php?mode=addons&type=theme'); - }); -"; - - global $user_pref; // quick fix. - $pref = e107::getPref(); + "; e107::js('inline',$code,'jquery'); - if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus'])) { - - $user_pref['core-infopanel-mye107'] = $_POST['e-mye107']; - $user_pref['core-infopanel-menus'] = $_POST['e-mymenus']; - - save_prefs('user'); + $this->savePref('core-infopanel-mye107', $_POST['e-mye107']); + $this->savePref('core-infopanel-menus', $_POST['e-mymenus']); } - - - // $array_functions_assoc = e107::getNav()->adminLinks('assoc'); - - // $this->iconlist = array_merge($array_functions_assoc, e107::getNav()->pluginLinks(E_16_PLUGMANAGER, "array")); + $this->iconlist = e107::getNav()->adminLinks(); - } - + + /** + * Save preferences. + * + * @param $key + * @param $value + */ + public function savePref($key, $value) + { + // Get "Apply dashboard preferences to all administrators" setting. + $adminPref = e107::getConfig()->get('adminpref', 0); + + // If "Apply dashboard preferences to all administrators" is checked. + // Save as $pref. + if($adminPref == 1) + { + e107::getConfig() + ->setPosted($key, $value) + ->save(); + } + // Save as $user_pref. + else + { + e107::getUser() + ->getConfig() + ->set($key, $value) + ->save(); + } + } + + /** + * Get preferences. + * + * @return mixed + */ + public function getUserPref() + { + // Get "Apply dashboard preferences to all administrators" setting. + $adminPref = e107::getConfig()->get('adminpref', 0); + + // If "Apply dashboard preferences to all administrators" is checked. + // Get $pref. + if($adminPref == 1) + { + $user_pref = e107::getPref(); + } + // Get $user_pref. + else + { + $user_pref = e107::getUser()->getPref(); + } + + return $user_pref; + } + + /** + * Allow to get Icon List. + */ + function getIconList() + { + return $this->iconlist; + } function render() { @@ -120,33 +161,32 @@ class adminstyle_infopanel '; */ //TODO LANs throughout. - - global $style, $user_pref; + + $user_pref = $this->getUserPref(); // ---------------------- Start Panel -------------------------------- // $text = "
"; - if (getperms('0') && !vartrue($user_pref['core-infopanel-mye107'])) // Set default icons. + if(empty(varset($user_pref['core-infopanel-mye107'], array()))) // 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); - + $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'] = $defArray; } @@ -305,7 +345,7 @@ class adminstyle_infopanel } else { - echo $frm->open('infopanel','post',e_SELF); + echo $frm->open('infopanel','post', e_SELF); echo $this->render_infopanel_options(true); echo $frm->close(); } @@ -585,37 +625,20 @@ class adminstyle_infopanel function render_infopanel_options($render = false) //TODO LAN { - // $frm = e107::getSingleton('e_form'); $frm = e107::getForm(); $mes = e107::getMessage(); $ns = e107::getRender(); - $start = "
- To customize this page, please click here. -
- "; - if($render == false){ return ""; } - - $text2 = "
-
"; - - $text2 .= $ns->tablerender(LAN_PERSONALIZE_ICONS, $this->render_infopanel_icons(),'personalize',true); + + $text2 = $ns->tablerender(LAN_PERSONALIZE_ICONS, $this->render_infopanel_icons(),'personalize',true); $text2 .= "
 
"; $text2 .= $ns->tablerender(LAN_PERSONALIZE_MENUS, $this->render_infopanel_menu_options(),'personalize',true); - // $text2 .= render_infopanel_icons(); - //$text2 .= "
 
"; - // $text2 .= "

Menus

"; - // $text2 .= render_infopanel_menu_options(); $text2 .= "
 
"; $text2 .= "
"; $text2 .= $frm->admin_button('submit-mye107', LAN_SAVE, 'create'); - $text2 .= "
"; - // $text2 .= "
"; - - // $end = "
"; - - + $text2 .= ""; + return $mes->render().$text2; } @@ -624,11 +647,32 @@ class adminstyle_infopanel { $frm = e107::getForm(); - global $user_pref; + $user_pref = $this->getUserPref(); $text = "
"; - - + + + if(empty(varset($user_pref['core-infopanel-mye107'], array()))) // 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'] = $defArray; + } foreach ($this->iconlist as $key=>$icon) @@ -642,7 +686,7 @@ class adminstyle_infopanel } } - if (is_array($pluglist)) + if (isset($pluglist) && is_array($pluglist)) { foreach ($pluglist as $key=>$icon) { @@ -669,7 +713,7 @@ class adminstyle_infopanel } $frm = e107::getForm(); - global $user_pref; + $user_pref = $this->getUserPref(); $text = "
"; diff --git a/e107_admin/includes/layouts/flexpanel_default.php b/e107_admin/includes/layouts/flexpanel_default.php new file mode 100644 index 000000000..fec95d300 --- /dev/null +++ b/e107_admin/includes/layouts/flexpanel_default.php @@ -0,0 +1,115 @@ + +
+ +
+
+ + +
+
+
+ {MESSAGES} +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+
+
+
+
+'; diff --git a/e107_admin/includes/layouts/flexpanel_default.png b/e107_admin/includes/layouts/flexpanel_default.png new file mode 100644 index 000000000..7bdc97c05 Binary files /dev/null and b/e107_admin/includes/layouts/flexpanel_default.png differ diff --git a/e107_admin/includes/layouts/flexpanel_one_col.php b/e107_admin/includes/layouts/flexpanel_one_col.php new file mode 100644 index 000000000..b4f846741 --- /dev/null +++ b/e107_admin/includes/layouts/flexpanel_one_col.php @@ -0,0 +1,112 @@ + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+'; diff --git a/e107_admin/includes/layouts/flexpanel_one_col.png b/e107_admin/includes/layouts/flexpanel_one_col.png new file mode 100644 index 000000000..31afa0747 Binary files /dev/null and b/e107_admin/includes/layouts/flexpanel_one_col.png differ diff --git a/e107_admin/includes/layouts/flexpanel_three_col_bricks.php b/e107_admin/includes/layouts/flexpanel_three_col_bricks.php new file mode 100644 index 000000000..b2a673ba3 --- /dev/null +++ b/e107_admin/includes/layouts/flexpanel_three_col_bricks.php @@ -0,0 +1,100 @@ + +
+ +
+ + +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+
+'; diff --git a/e107_admin/includes/layouts/flexpanel_three_col_bricks.png b/e107_admin/includes/layouts/flexpanel_three_col_bricks.png new file mode 100644 index 000000000..e38a1561a Binary files /dev/null and b/e107_admin/includes/layouts/flexpanel_three_col_bricks.png differ diff --git a/e107_admin/includes/layouts/flexpanel_three_col_stacked.php b/e107_admin/includes/layouts/flexpanel_three_col_stacked.php new file mode 100644 index 000000000..40224611c --- /dev/null +++ b/e107_admin/includes/layouts/flexpanel_three_col_stacked.php @@ -0,0 +1,90 @@ + +
+ + +
+ + +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ + +
+
+'; diff --git a/e107_admin/includes/layouts/flexpanel_three_col_stacked.png b/e107_admin/includes/layouts/flexpanel_three_col_stacked.png new file mode 100644 index 000000000..f5ac86b12 Binary files /dev/null and b/e107_admin/includes/layouts/flexpanel_three_col_stacked.png differ diff --git a/e107_admin/includes/layouts/flexpanel_two_col_bricks.php b/e107_admin/includes/layouts/flexpanel_two_col_bricks.php new file mode 100644 index 000000000..12f7adb3b --- /dev/null +++ b/e107_admin/includes/layouts/flexpanel_two_col_bricks.php @@ -0,0 +1,104 @@ + +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+'; diff --git a/e107_admin/includes/layouts/flexpanel_two_col_bricks.png b/e107_admin/includes/layouts/flexpanel_two_col_bricks.png new file mode 100644 index 000000000..8c75db61c Binary files /dev/null and b/e107_admin/includes/layouts/flexpanel_two_col_bricks.png differ diff --git a/e107_admin/includes/layouts/flexpanel_two_col_stacked.php b/e107_admin/includes/layouts/flexpanel_two_col_stacked.php new file mode 100644 index 000000000..eab43543f --- /dev/null +++ b/e107_admin/includes/layouts/flexpanel_two_col_stacked.php @@ -0,0 +1,97 @@ + +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ + +
+
+'; diff --git a/e107_admin/includes/layouts/flexpanel_two_col_stacked.png b/e107_admin/includes/layouts/flexpanel_two_col_stacked.png new file mode 100644 index 000000000..d317159c0 Binary files /dev/null and b/e107_admin/includes/layouts/flexpanel_two_col_stacked.png differ diff --git a/e107_admin/includes/layouts/flexpanel_wider_sidebar.php b/e107_admin/includes/layouts/flexpanel_wider_sidebar.php new file mode 100644 index 000000000..65a0b857b --- /dev/null +++ b/e107_admin/includes/layouts/flexpanel_wider_sidebar.php @@ -0,0 +1,115 @@ + +
+ +
+
+ + +
+
+
+ {MESSAGES} +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+
+
+
+ +'; diff --git a/e107_admin/includes/layouts/flexpanel_wider_sidebar.png b/e107_admin/includes/layouts/flexpanel_wider_sidebar.png new file mode 100644 index 000000000..727ae463b Binary files /dev/null and b/e107_admin/includes/layouts/flexpanel_wider_sidebar.png differ diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index 17486a70b..364955253 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -405,18 +405,17 @@ class admin_shortcodes if(isset($params['nomenu'])) { return $select; } if($select) { $text .= "
{$select}
"; } - return $ns->tablerender(UTHEME_MENU_L2, $text, '', true); + return $ns->tablerender(UTHEME_MENU_L2, $text, 'core-menu-lang', true); } 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? { @@ -508,8 +507,7 @@ class admin_shortcodes // $text .= ""; $ns->setUniqueId('e-latest-list'); - return ($parm != 'norender') ? $ns -> tablerender(ADLAN_LAT_1, $text, '', TRUE) : $text; - + return ($parm != 'norender') ? $ns -> tablerender(ADLAN_LAT_1, $text, '', TRUE) : $text; } } @@ -1096,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; } @@ -1681,16 +1679,22 @@ Inverse 10 10 $tmp[1]['image_large'] = ''; $tmp[1]['image_src'] = ''; $tmp[1]['image_large_src'] = ''; - - - $tmp[2]['text'] = LAN_PERSONALIZE; - $tmp[2]['description'] = "Customize administration panels"; - $tmp[2]['link'] = e_ADMIN.'admin.php?mode=customize'; - $tmp[2]['image'] = ""; //E_16_ADMIN; // "".ADLAN_151.""; - $tmp[2]['image_large'] = ''; - $tmp[2]['image_src'] = ''; - $tmp[2]['image_large_src'] = ''; - // $tmp[2]['perm'] = ''; + + + // If not Main Admin and "Apply dashboard preferences to all administrators" + // is checked in admin theme settings. + $adminPref = e107::getConfig()->get('adminpref', 0); + if(getperms("1") || $adminPref == 0) + { + $tmp[2]['text'] = LAN_PERSONALIZE; + $tmp[2]['description'] = "Customize administration panels"; + $tmp[2]['link'] = e_ADMIN . 'admin.php?mode=customize'; + $tmp[2]['image'] = ""; //E_16_ADMIN; // "".ADLAN_151.""; + $tmp[2]['image_large'] = ''; + $tmp[2]['image_src'] = ''; + $tmp[2]['image_large_src'] = ''; + // $tmp[2]['perm'] = ''; + } $tmp[3]['text'] = LAN_LOGOUT; diff --git a/e107_handlers/menu_class.php b/e107_handlers/menu_class.php index 59405a8a5..b0fadeb0a 100644 --- a/e107_handlers/menu_class.php +++ b/e107_handlers/menu_class.php @@ -542,8 +542,12 @@ class e_menu //{ // $mpath .= '/'; //} - + $mpath = trim($mpath, '/').'/'; // faster... + + $id = e107::getForm()->name2id($mpath . $mname); + $ns->setUniqueId($id); + $e107_debug ? include(e_PLUGIN.$mpath.$mname.'.php') : @include(e_PLUGIN.$mpath.$mname.'.php'); } e107::getDB()->db_Mark_Time("(After ".$mname.")"); diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index df83c2800..b035e0b0a 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -706,7 +706,7 @@ class themeHandler $text = $this->renderTheme(1, $theme); } } - echo "
\n"; + echo "\n"; $ns->tablerender(TPVLAN_26.SEP.TPVLAN_33, $mes->render().$text); echo "
"; } @@ -722,7 +722,7 @@ class themeHandler $text = $this->renderTheme(2, $theme); } } - echo "
\n"; + echo "\n"; $ns->tablerender(TPVLAN_26.SEP.TPVLAN_34, $mes->render().$text); echo "
"; } @@ -744,7 +744,7 @@ class themeHandler // print_a($theme); } $text .= "
 
"; - echo "
\n"; + echo "\n"; $ns->tablerender(TPVLAN_26.SEP.TPVLAN_39, $mes->render().$text); $text .= "
"; @@ -1210,10 +1210,10 @@ class themeHandler - - ".TPVLAN_11." - ".$theme['version']." - ".$thumbnail." + + ".TPVLAN_11." + ".$theme['version']." + ".$thumbnail." "; $text .= "".LAN_AUTHOR.":".$author.""; @@ -1225,8 +1225,7 @@ class themeHandler $text .= "".LAN_FOLDER.":".$theme['path'].""; // $text .= "Price:".$price.""; - $text .= "".TPVLAN_49.": - "; + $text .= "".TPVLAN_49.":"; $text .= ($theme['xhtmlcompliant']) ? "W3C XHTML ".$theme['xhtmlcompliant'] : TPVLAN_71; $text .= ($theme['csscompliant']) ? " & CSS ".$theme['csscompliant'] : ""; $text .= ""; @@ -1246,7 +1245,7 @@ class themeHandler $text .= " ".TPVLAN_53." - "; + "; if(varset($theme['plugins'])) { @@ -1410,13 +1409,24 @@ class themeHandler $text .= " ".TPVLAN_41.": - ".$astext." + ".$astext." + + \n"; + + $text .= " + + " . TPVLAN_89 . " + + + \n"; } - $text .= $itext; + $text .= varset($itext, ''); $theme['css'] = $this->filterStylesheets($mode, $theme); @@ -1443,16 +1453,12 @@ class themeHandler switch($mode) { case 2: // admin mode. - $for = $frm->name2id("admincss-".$css['name']); - $text2 = " - ". - $frm->radio('admincss', $css['name'], vartrue($pref['admincss'])== $css['name'])." - - "; - + $text2 = ""; + $text2 .= $frm->radio('admincss', $css['name'], vartrue($pref['admincss'])== $css['name']); + $text2 .= ""; + $text2 .= ""; $text2 .= "".($css['info'] ? $css['info'] : ($css['name'] == "admin_style.css" ? TPVLAN_23 : TPVLAN_24))."\n"; - break; case 1: // front 'sitetheme' mode. @@ -1981,9 +1987,14 @@ class themeHandler //TODO adminlog - e107::getConfig()->setPosted('admincss', $_POST['admincss'])->setPosted('adminstyle', $_POST['adminstyle']); + e107::getConfig() + ->setPosted('admincss', $_POST['admincss']) + ->setPosted('adminstyle', $_POST['adminstyle']) + ->setPosted('adminpref', varset($_POST['adminpref'], 0)); - return (e107::getConfig()->dataHasChangedFor('admincss') || e107::getConfig()->dataHasChangedFor('adminstyle')); + return (e107::getConfig()->dataHasChangedFor('admincss') + || e107::getConfig()->dataHasChangedFor('adminstyle') + || e107::getConfig()->dataHasChangedFor('adminpref')); } function SetCustomPages($array) diff --git a/e107_languages/English/admin/lan_admin.php b/e107_languages/English/admin/lan_admin.php index 544f148f1..d13898d95 100644 --- a/e107_languages/English/admin/lan_admin.php +++ b/e107_languages/English/admin/lan_admin.php @@ -458,6 +458,7 @@ define("LAN_PERSONALIZE", "Personalize"); define("LAN_SELECT_COLUMNS_TO_DISPLAY", "Select columns to display"); define("LAN_DISPLAY_COLUMNS", "Display Columns"); define("LAN_SETTINGS_NOT_SAVED_NO_CHANGES_MADE", "Settings not saved as no changes were made."); +define("LAN_DASHBOARD_LAYOUT", "Dashboard Layout"); define("LAN_AFTER_SUBMIT", "After submit:"); define("LAN_UNAVAILABLE", "Unavailable"); define("LAN_READY_UP_FOLDER_FIELDS", "Ready to use upload form fields, optional - file list view"); @@ -470,4 +471,3 @@ define("LAN_GO_TO_LIST", "go to list"); define("LAN_CREATE_ANOTHER", "create another"); define("LAN_EDIT_CURRENT", "edit current"); define("LAN_MAINTENANCE", "Maintenance"); - diff --git a/e107_languages/English/admin/lan_theme.php b/e107_languages/English/admin/lan_theme.php index 35cf9bb35..31931268f 100644 --- a/e107_languages/English/admin/lan_theme.php +++ b/e107_languages/English/admin/lan_theme.php @@ -122,4 +122,4 @@ define("TPVLAN_86","Could not change site theme."); define("TPVLAN_87","Rendering Theme Config"); define("TPVLAN_88","Converter"); -?> +define("TPVLAN_89", "Apply dashboard preferences to all administrators"); diff --git a/e107_themes/bootstrap3/admin_style.css b/e107_themes/bootstrap3/admin_style.css index c18976080..57be30c1b 100644 --- a/e107_themes/bootstrap3/admin_style.css +++ b/e107_themes/bootstrap3/admin_style.css @@ -1176,10 +1176,10 @@ 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 } +.admin-left-panel.toggled { display: none } /* ######## selectize.js ######## */ @@ -1278,9 +1278,8 @@ li.after-submit:hover { background-color: #337AB7; color:white } .plugin-manager .fa-refresh { padding-top: 4px } -#left-panel .panel-title span { display: inline-block; vertical-align: middle; color:white;text-shadow:0 1px 1px #000} -#left-panel .panel-title .S24, #left-panel .panel-title img { margin-right:6px; width:24px; height:24px; vertical-align:middle} - +.admin-left-panel .panel-title span { display: inline-block; vertical-align: middle; color:white;text-shadow:0 1px 1px #000} +.admin-left-panel .panel-title .S24, .admin-left-panel .panel-title img { margin-right:6px; width:24px; height:24px; vertical-align:middle} /* diff --git a/e107_themes/bootstrap3/admin_template.php b/e107_themes/bootstrap3/admin_template.php index 88c5a6d99..9d88b2751 100644 --- a/e107_themes/bootstrap3/admin_template.php +++ b/e107_themes/bootstrap3/admin_template.php @@ -208,121 +208,115 @@ $ADMIN_MODAL = ''; - - - -//
  • {ADMIN_COREUPDATE=icon}
  • - - $ADMIN_HEADER = $ADMIN_MODAL. ' +// TODO - LANs +$ADMIN_MODAL = ' + +'; +// TODO - LANs +$ADMIN_HEADER = $ADMIN_MODAL . '