1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Independent menu_class added to custom pages/menus.

This commit is contained in:
Cameron
2014-06-28 00:08:35 -07:00
parent 64ad871e88
commit 3faf3050d7
4 changed files with 16 additions and 5 deletions

View File

@@ -477,7 +477,9 @@ class page_admin_ui extends e_admin_ui
'menu_title' => array('title'=> "Menu Title", 'nolist'=>true, 'tab' => 2, 'type' => 'text', 'inline'=>true, 'width'=>'25%', "help"=>"Caption displayed on the menu item.", 'writeParms'=>'size=xxlarge'),
'menu_text' => array('title'=> "Menu Body", 'nolist'=>true, 'tab' => 2, 'type' => 'bbarea', 'data'=>'str', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1', 'writeParms'=>'media=page' ),
'menu_template' => array('title'=> "Menu Template", 'nolist'=>true, 'tab' => 2, 'type' => 'dropdown', 'width' => 'auto','filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''),
'menu_icon' => array('title' =>"Menu Icon/Glyph", 'nolist'=>true, 'tab' => 2, 'type' => 'icon', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','writeParms'=>'media=page&glyphs=1', 'readonly'=>false),
'menu_class' => array('title'=> LAN_USERCLASS, 'tab' => 2, 'type' => 'userclass', 'data'=>'int', 'inline'=>true, 'width' => 'auto', 'filter' => true, 'batch' => true),
'menu_icon' => array('title' =>"Menu Icon/Glyph", 'nolist'=>true, 'tab' => 2, 'type' => 'icon', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','writeParms'=>'media=page&glyphs=1', 'readonly'=>false),
'menu_image' => array('title' =>"Menu Image/Video", 'nolist'=>true, 'tab' => 2, 'type' => 'image', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','writeParms'=>'media=page&video=1', 'readonly'=>false),
@@ -535,7 +537,8 @@ class page_admin_ui extends e_admin_ui
'menu_name' => array('title'=> "Menu Name", 'type' => 'text', 'inline'=>true, 'width' => '10%','nolist'=>false, "help"=>"Will be listed in the Menu-Manager under this name"),
'menu_template' => array('title'=> "Menu Template", 'type' => 'dropdown', 'width' => '15%', 'filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''),
'menu_class' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'data'=>'int', 'inline'=>true, 'width' => 'auto', 'filter' => true, 'batch' => true),
// 'page_author' => array('title'=> LAN_AUTHOR, 'tab' => 0, 'type' => 'user', 'data'=>'int','width' => 'auto', 'thclass' => 'left'),
'page_datestamp' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'data'=>'int', 'width' => 'auto','writeParms'=>'auto=1&readonly=1'),
@@ -546,7 +549,7 @@ class page_admin_ui extends e_admin_ui
'options' => array('title'=> LAN_OPTIONS, 'type' => 'method', 'noselector' => true, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center','readParms'=>'delete=0&deleteClass='.e_UC_NOBODY)
);
$this->fieldpref = array("page_id","menu_name", "menu_title", 'menu_image', 'menu_template', 'menu_icon', 'page_chapter');
$this->fieldpref = array("page_id","menu_name", "menu_title", 'menu_image', 'menu_template', 'menu_icon', 'page_chapter', 'menu_class');
}

View File

@@ -393,6 +393,7 @@ CREATE TABLE page (
menu_image varchar(250) NOT NULL default '',
menu_icon varchar(250) NOT NULL default '',
menu_template varchar(50) NOT NULL default '',
menu_class varchar(250) NOT NULL default '',
PRIMARY KEY (page_id)
) ENGINE=MyISAM;

View File

@@ -425,6 +425,13 @@ class e_menu
$sql->select("page", "*", $query);
$page = $sql->fetch();
if(!empty($page['menu_class']) && !check_class($page['menu_class']))
{
echo "\n<!-- Menu not rendered due to userclass settings -->\n";
return;
}
$caption = (vartrue($page['menu_icon'])) ? $tp->toIcon($page['menu_icon']) : '';
$caption .= $tp->toHTML($page['menu_title'], true, 'parse_sc, constants');

View File

@@ -444,9 +444,9 @@ class pageClass
// $tmpl = e107::getCoreTemplate('chapter','docs', true, true); // always merge
$template = $tmpl['listPages'];
$pageOnly = ($layout == 'panel') ? '1' : "page_title !='' "; // When in 'panel' mode, allow Menus to be rendered.
$pageOnly = ($layout == 'panel') ? " menu_class IN (".USERCLASS_LIST.") " : "page_title !='' AND page_class IN (".USERCLASS_LIST.") "; // When in 'panel' mode, allow Menus to be rendered while checking menu_class.
if(!$count = $sql->select("page", "*", $pageOnly." AND page_chapter=".intval($chapt)." AND page_class IN (".USERCLASS_LIST.") ORDER BY page_order ASC "))
if(!$count = $sql->select("page", "*", $pageOnly." AND page_chapter=".intval($chapt)." AND ORDER BY page_order ASC "))
{
return array('text' => "<em>".(LAN_PAGE_2)."</em>");
// $text = "<ul class='page-pages-list page-pages-none'><li>".LAN_PAGE_2."</li></ul>";