From b749bdb70745b815a962f8c6b73afeb756a3f86c Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 9 Apr 2015 11:13:26 -0700 Subject: [PATCH] Upgraded userclass admin area to use renderHelp() and gave it its own shortcode {ADMINUI_HELP} --- e107_admin/userclass2.php | 37 +++++++------------ .../shortcodes/batch/admin_shortcodes.php | 16 +++++--- .../shortcodes/batch/news_shortcodes.php | 20 +++++----- e107_handlers/userclass_class.php | 9 ++++- e107_themes/bootstrap/admin_template.php | 3 +- 5 files changed, 43 insertions(+), 42 deletions(-) diff --git a/e107_admin/userclass2.php b/e107_admin/userclass2.php index 62019e058..a5ce08b39 100644 --- a/e107_admin/userclass2.php +++ b/e107_admin/userclass2.php @@ -93,8 +93,8 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); 'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ), 'userclass_id' => array('title'=> LAN_ID, 'type' =>'hidden', 'data'=>'int', 'width' => '5%', 'thclass' => 'left'), 'userclass_icon' => array('title'=> UCSLAN_68, 'type' => 'icon', 'data'=>'str', 'width' => '5%', 'thclass' => 'left', 'class' => 'center'), - 'userclass_name' => array('title'=> UCSLAN_12, 'type' => 'text', 'data'=>'str', 'width' => 'auto', 'thclass' => 'left'), - 'userclass_description' => array('title'=> UCSLAN_13, 'type' => 'text', 'data'=>'str', 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array('size'=>'xxlarge')), + 'userclass_name' => array('title'=> UCSLAN_12, 'type' => 'text', 'data'=>'str', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left'), + 'userclass_description' => array('title'=> UCSLAN_13, 'type' => 'text', 'data'=>'str', 'inline'=>true,'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array('size'=>'xxlarge')), 'userclass_type' => array('title'=> UCSLAN_79, 'type' => 'dropdown', 'data'=>'int', 'width' => '10%', 'thclass' => 'left', 'class'=>'left' ), 'userclass_editclass' => array('title'=> UCSLAN_24, 'type' => 'userclass', 'data'=>'int', 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array('classlist'=>'nobody,public,main,admin,classes,matchclass,member, no-excludes')), 'userclass_visibility' => array('title'=> UCSLAN_34, 'type' => 'userclass', 'data'=>'int', 'width' => 'auto', 'thclass' => 'left'), @@ -166,6 +166,17 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); } + function renderHelp() + { + $e_userclass = e107::getSingleton('user_class_admin'); // Admin functions - should just obliterate any previous object created in class2.php + $e_userclass->calc_tree(); + $text = "
".$e_userclass->show_graphical_tree()."
"; + + return array('caption'=>'Class Structure', 'text' => $text); + + // $text .= $e_userclass->show_graphical_tree(); + } + public function optionsPage() { $mes = e107::getMessage(); @@ -1382,28 +1393,6 @@ function userclass2_adminmenu() */ -function e_help() -{ -// require_once(e_HANDLER.'userclass_class.php'); // Modified class handler -// $e_userclass = new user_class_admin; - $e_userclass = e107::getSingleton('user_class_admin'); // Admin functions - should just obliterate any previous object created in class2.php - - $e_userclass->calc_tree(); - $text2 = "
".$e_userclass->show_graphical_tree()."
"; - - $help = e_LANGUAGEDIR.e_LANGUAGE.'/admin/help/userclass2.php'; - if(is_readable($help)) - { - require_once($help); - } -// require_once(e_LANGUAGEDIR.e_LANGUAGE.'/admin/help/userclass2.php'); - - return array('caption'=>'Class Structure', 'text' => $text2); - -// $text .= $e_userclass->show_graphical_tree(); - - -} /* diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index b767786ed..985770af6 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -131,6 +131,17 @@ class admin_shortcodes return $ns -> tablerender(FOOTLAN_14,$text, array('id' => 'admin_docs', 'style' => 'button_menu'), TRUE); } + function sc_adminui_help() + { + if (!ADMIN) { return ''; } + + if($tmp = e107::getRegistry('core/e107/adminui/help')) + { + return e107::getRender()->tablerender($tmp['caption'],$tmp['text'],'e_help',true); + } + + } + function sc_admin_help() { if (!ADMIN) { return ''; } @@ -138,11 +149,6 @@ class admin_shortcodes $ns = e107::getRender(); $pref = e107::getPref(); - if($tmp = e107::getRegistry('core/e107/adminui/help')) - { - return $ns->tablerender($tmp['caption'],$tmp['text'],'e_help',true); - } - if(function_exists('e_help') && ($tmp = e_help())) // new in v2.x for non-admin-ui admin pages. { diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index f862d0731..8e2203c12 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -63,7 +63,7 @@ class news_shortcodes extends e_shortcode return '/s', '', $this->news_item['news_title']).'">'.$title.''; } - function sc_newsbody($parm) + function sc_newsbody($parm=null) { $tp = e107::getParser(); e107::getBB()->setClass("news"); // For automatic bbcode image resizing. @@ -81,7 +81,7 @@ class news_shortcodes extends e_shortcode return $news_body; } - function sc_newsicon($parm) + function sc_newsicon($parm=null) { return $this->sc_newscaticon('url'); @@ -103,7 +103,7 @@ class news_shortcodes extends e_shortcode return "e107"; } - function sc_newscomments($parm) + function sc_newscomments($parm=null) { $pref = e107::getPref(); @@ -155,7 +155,7 @@ class news_shortcodes extends e_shortcode return (!$news_item['news_allow_comments'] ? ''.($pref['comments_icon'] ? $NEWIMAGE.' ' : '')."".$param['commentlink'].intval($news_item['news_comment_total']).'' : vartrue($param['commentoffstring'],'Disabled') ); } - function sc_trackback($parm) + function sc_trackback($parm=null) { global $pref; if(!vartrue($pref['trackbackEnabled'])) { return ''; } @@ -175,7 +175,7 @@ class news_shortcodes extends e_shortcode * @example {NEWSNAVLINK: items=category} // News items for current category. * @example {NEWSNAVLINK: text=myCaption} // Default News item view. ie. news.php */ - function sc_newsnavlink($parm='') //TODO add more options. + function sc_newsnavlink($parm=null) //TODO add more options. { if(varset($parm['list']) == 'all') // A list of all items - usually headings and thumbnails @@ -208,13 +208,13 @@ class news_shortcodes extends e_shortcode - function sc_newsheader($parm) + function sc_newsheader($parm=null) { return $this->sc_newscaticon('src'); } - function sc_newscategory($parm) + function sc_newscategory($parm=null) { $category_name = e107::getParser()->toHTML($this->news_item['category_name'], FALSE ,'defs'); $category = array('id' => $this->news_item['category_id'], 'name' => $this->news_item['category_sef'] ); @@ -256,7 +256,7 @@ class news_shortcodes extends e_shortcode * {NEWSCOMMENTLINK: glyph=comments&class=btn btn-default btn-sm} * */ - function sc_newscommentlink($parm='') + function sc_newscommentlink($parm=null) { if($this->commentsDisabled) @@ -274,7 +274,7 @@ class news_shortcodes extends e_shortcode /** * {NEWSCOMMENTCOUNT: glyph=x} */ - function sc_newscommentcount($parm='') + function sc_newscommentcount($parm=null) { if($this->commentsDisabled || ($this->commentsEngine != 'e107')) { @@ -754,7 +754,7 @@ class news_shortcodes extends e_shortcode * @param string $parm * @return string */ - function sc_newsitem_schook($parm) + function sc_newsitem_schook($parm='') { $parm = explode('|', $parm, 2); $parm[1] = 'news_id='.$this->news_item['news_id'].(varset($parm[1]) ? '&'.$parm[1] : ''); diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php index 656e5f9ea..60b107277 100644 --- a/e107_handlers/userclass_class.php +++ b/e107_handlers/userclass_class.php @@ -1218,9 +1218,14 @@ class user_class_admin extends user_class $this->class_tree[$parent]['userclass_accum'] = $imp_rights; if (!isset($this->class_tree[$cp]['change_flag'])) $this->class_tree[$parent]['change_flag'] = 'UPDATE'; } - foreach ($this->class_tree[$parent]['class_children'] as $cc) + + + if(!empty($this->class_tree[$parent]['class_children'])) { - $this->rebuild_tree($cc,$rights); // Recursive call + foreach ($this->class_tree[$parent]['class_children'] as $cc) + { + $this->rebuild_tree($cc,$rights); // Recursive call + } } } diff --git a/e107_themes/bootstrap/admin_template.php b/e107_themes/bootstrap/admin_template.php index d4dfbf197..aa664a4de 100644 --- a/e107_themes/bootstrap/admin_template.php +++ b/e107_themes/bootstrap/admin_template.php @@ -202,7 +202,8 @@ $ADMIN_HEADER .= '
{ADMIN_PWORD} {SETSTYLE=site_info} - + + {ADMINUI_HELP} {ADMIN_HELP} {ADMIN_SITEINFO=creditsonly} {SETSTYLE=admin_menu}