1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-12 18:46:20 +02:00

Fixed: {CPAGEMENU} could return the incorrect Menu under some conditions.

This commit is contained in:
Cameron
2014-06-16 18:21:51 -07:00
parent 5cbb38ad7f
commit b19d383e0d
3 changed files with 27 additions and 13 deletions

View File

@ -529,20 +529,23 @@ class page_admin_ui extends e_admin_ui
'menu_image' => array('title' =>"Menu Image/Video", 'type' => 'image', 'width' => '110px', 'thclass' => 'left', 'class' => "left", 'nosort' => false, 'readParms'=>'thumb=140&thumb_urlraw=0&thumb_aw=140', 'readonly'=>false), 'menu_image' => array('title' =>"Menu Image/Video", 'type' => 'image', 'width' => '110px', 'thclass' => 'left', 'class' => "left", 'nosort' => false, 'readParms'=>'thumb=140&thumb_urlraw=0&thumb_aw=140', 'readonly'=>false),
'menu_name' => array('title'=> "Menu Name", 'type' => 'text', 'inline'=>true, 'width' => 'auto','nolist'=>false, "help"=>"Will be listed in the Menu-Manager under this name"), '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' => 'auto', 'filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''), 'menu_template' => array('title'=> "Menu Template", 'type' => 'dropdown', 'width' => '15%', 'filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''),
// 'page_author' => array('title'=> LAN_AUTHOR, 'tab' => 0, 'type' => 'user', 'data'=>'int','width' => 'auto', 'thclass' => 'left'), // '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'), 'page_datestamp' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'data'=>'int', 'width' => 'auto','writeParms'=>'auto=1&readonly=1'),
'menu_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'width' => '80px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=80&thumb_urlraw=0&thumb_aw=80', 'readonly'=>false), 'menu_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'width' => '80px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=80&thumb_urlraw=0&thumb_aw=80', 'readonly'=>false),
'menu_title' => array('title'=> "Menu Title", 'forced'=> TRUE, 'type' => 'text', 'inline'=>true, 'width'=>'25%'), 'menu_title' => array('title'=> "Menu Title", 'forced'=> TRUE, 'type' => 'text', 'inline'=>true, 'width'=>'25%'),
'page_chapter' => array('title'=> 'Book/Chapter', 'tab' => 0, 'type' => 'dropdown', 'width' => '20%', 'filter' => true, 'batch'=>true, 'inline'=>true),
'menu_text' => array('title'=> "Menu Body", 'type' => 'bbarea', 'data'=>'str', 'width' => 'auto', 'readParms' => 'expand=...&truncate=50&bb=1', 'writeParms'=>'media=page'), 'menu_text' => array('title'=> "Menu Body", 'type' => 'bbarea', 'data'=>'str', 'width' => 'auto', 'readParms' => 'expand=...&truncate=50&bb=1', 'writeParms'=>'media=page'),
'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) '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_text", 'menu_image', 'menu_template', 'menu_icon'); $this->fieldpref = array("page_id","menu_name", "menu_title", 'menu_image', 'menu_template', 'menu_icon', 'page_chapter');
} }

View File

@ -173,8 +173,8 @@ class cpage_shortcodes extends e_shortcode
function sc_cpagemenu() function sc_cpagemenu()
{ {
$parm = $this->var['menu_name']; $parm = $this->var['page_id'];
return e107::getMenu()->renderMenu($parm, false, false, true); return e107::getMenu()->renderMenu($parm, true, false, true);
} }

View File

@ -41,7 +41,7 @@ elseif(vartrue($_GET['bk'])) // List Chapters within a specific Book
require_once(HEADERF); require_once(HEADERF);
$data = $e107CorePage->listChapters($_GET['bk']); $data = $e107CorePage->listChapters($_GET['bk']);
$ns->tablerender($data['caption'], $data['text'], 'cpage-chapter-list'); // TODO FIXME Caption eg. "book title" $ns->tablerender($data['caption'], $data['text'], 'cpage-chapter-list');
require_once(FOOTERF); require_once(FOOTERF);
exit; exit;
} }
@ -109,7 +109,7 @@ class pageClass
$this->pageTitles = array(); $this->pageTitles = array();
$this->bullet = ''; $this->bullet = '';
} }
else // NEW URLS /page.php?id=x // TODO Complete and test. else // NEW URLS /page.php?id=x
{ {
$tmp = explode(".", e_QUERY); $tmp = explode(".", e_QUERY);
$this->pageID = intval($_GET['id']); $this->pageID = intval($_GET['id']);
@ -246,7 +246,7 @@ class pageClass
'BOOK_ICON' => $this->chapterIcon($row['chapter_icon']), 'BOOK_ICON' => $this->chapterIcon($row['chapter_icon']),
'BOOK_DESCRIPTION' => $tp->toHtml($row['chapter_meta_description'],true,'BODY'), 'BOOK_DESCRIPTION' => $tp->toHtml($row['chapter_meta_description'],true,'BODY'),
'CHAPTERS' => $listChapters['text'], 'CHAPTERS' => $listChapters['text'],
'BOOK_URL' => e107::getUrl()->create('page/book/index', $sef,'allow=chapter_id,chapter_sef,book_sef,page_sef') // e_BASE."page.php?bk=".intval($row['chapter_id']) // FIXME SEF-URL 'BOOK_URL' => e107::getUrl()->create('page/book/index', $sef,'allow=chapter_id,chapter_sef,book_sef,page_sef')
); );
$text .= $tp->simpleParse($template['item'],$var); $text .= $tp->simpleParse($template['item'],$var);
@ -348,7 +348,7 @@ class pageClass
'CHAPTER_ICON' => $this->chapterIcon($row['chapter_icon']), 'CHAPTER_ICON' => $this->chapterIcon($row['chapter_icon']),
'CHAPTER_DESCRIPTION' => $tp->toHtml($row['chapter_meta_description'],true,'BODY'), 'CHAPTER_DESCRIPTION' => $tp->toHtml($row['chapter_meta_description'],true,'BODY'),
'PAGES' => $tmp['text'], 'PAGES' => $tmp['text'],
'CHAPTER_URL' => e107::getUrl()->create('page/chapter/index', $row,'allow=chapter_id,chapter_sef,book_sef') // e_BASE."page.php?ch=".intval($row['chapter_id']) // FIXME SEF-URL 'CHAPTER_URL' => e107::getUrl()->create('page/chapter/index', $row,'allow=chapter_id,chapter_sef,book_sef')
); );
$text .= $tp->simpleParse($template['item'],$var); $text .= $tp->simpleParse($template['item'],$var);
@ -442,9 +442,11 @@ class pageClass
// $tmpl = e107::getCoreTemplate('chapter','docs', true, true); // always merge // $tmpl = e107::getCoreTemplate('chapter','docs', true, true); // always merge
$template = $tmpl['listPages']; $template = $tmpl['listPages'];
if(!$count = $sql->select("page", "*", "page_title !='' AND page_chapter=".intval($chapt)." AND page_class IN (".USERCLASS_LIST.") ORDER BY page_order ASC ")) $pageOnly = ($layout == 'panel') ? '1' : "page_title !='' "; // When in 'panel' mode, allow Menus to be rendered.
if(!$count = $sql->select("page", "*", $pageOnly." AND page_chapter=".intval($chapt)." AND page_class IN (".USERCLASS_LIST.") ORDER BY page_order ASC "))
{ {
return array('text' => "<em>".(LAN_PAGE_2)."</em>"); return array('text' => "<em>".(LAN_PAGE_2)."</em>");
// $text = "<ul class='page-pages-list page-pages-none'><li>".LAN_PAGE_2."</li></ul>"; // $text = "<ul class='page-pages-list page-pages-none'><li>".LAN_PAGE_2."</li></ul>";
@ -493,6 +495,7 @@ class pageClass
function processViewPage() function processViewPage()
{ {
if($this->checkCache()) if($this->checkCache())
{ {
return; return;
@ -504,6 +507,9 @@ class pageClass
LEFT JOIN #user AS u ON p.page_author = u.user_id LEFT JOIN #user AS u ON p.page_author = u.user_id
WHERE p.page_id=".intval($this->pageID); // REMOVED AND p.page_class IN (".USERCLASS_LIST.") - permission check is done later WHERE p.page_id=".intval($this->pageID); // REMOVED AND p.page_class IN (".USERCLASS_LIST.") - permission check is done later
if(!$sql->gen($query)) if(!$sql->gen($query))
{ {
@ -534,7 +540,7 @@ class pageClass
$this->authorized = 'nf'; $this->authorized = 'nf';
$this->template = e107::getCoreTemplate('page', 'default'); $this->template = e107::getCoreTemplate('page', 'default');
// $this->batch = e107::getScBatch('page',null,'cpage')->setVars(new e_vars($ret))->setScVar('page', array()); ///FIXME Needs upgrading to setVars() array. (not using '$this->page') // $this->batch = e107::getScBatch('page',null,'cpage')->setVars(new e_vars($ret))->setScVar('page', array()); ///Upgraded to setVars() array. (not using '$this->page')
$this->batch = e107::getScBatch('page',null,'cpage')->setVars($this->page); $this->batch = e107::getScBatch('page',null,'cpage')->setVars($this->page);
@ -660,6 +666,11 @@ class pageClass
{ {
if(null !== $this->cacheData) if(null !== $this->cacheData)
{ {
@ -744,7 +755,7 @@ class pageClass
public function parsePage() //XXX FIXME Move to page_shortcodes. public function parsePage()
{ {
$tp = e107::getParser(); $tp = e107::getParser();
e107::getBB()->setClass("page"); e107::getBB()->setClass("page");