From 19b616dae4ef50fd6d87ec617c866332126e6088 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 29 May 2013 19:37:06 -0700 Subject: [PATCH] Page templates for listPages and listChapters --- e107_core/templates/page_template.php | 26 ++++++++ e107_plugins/page/e_shortcode.php | 2 +- e107_plugins/page/e_sitelink.php | 2 +- e107_plugins/page/page_navigation_menu.php | 2 +- .../bootstrap/templates/page_template.php | 48 +++++++-------- page.php | 61 ++++++++----------- 6 files changed, 75 insertions(+), 66 deletions(-) diff --git a/e107_core/templates/page_template.php b/e107_core/templates/page_template.php index 20e070cdb..67b3cce9a 100644 --- a/e107_core/templates/page_template.php +++ b/e107_core/templates/page_template.php @@ -175,3 +175,29 @@ $sc_style['CPAGENAV|default']['post'] = ''; '; $PAGE_TEMPLATE['nav']['submenu_end'] = ''; + + + + $PAGE_TEMPLATE['listPages']['start'] = ""; + + + $PAGE_TEMPLATE['listChapters']['start'] = ""; + + + + + + + + + + + + + + +?> \ No newline at end of file diff --git a/e107_plugins/page/e_shortcode.php b/e107_plugins/page/e_shortcode.php index 8cf0591e3..4b4eb1b27 100644 --- a/e107_plugins/page/e_shortcode.php +++ b/e107_plugins/page/e_shortcode.php @@ -19,7 +19,7 @@ class page_shortcodes extends e_shortcode $this->request = e107::getRegistry('core/pages/request'); - if(varset($this->request['action']) == 'listPages' && vartrue($this->request['id'])) + if((varset($this->request['action']) == 'listPages' || varset($this->request['action']) == 'listChapters') && vartrue($this->request['id'])) { $this->var = e107::getDb()->retrieve('page_chapters','chapter_name, chapter_meta_description','chapter_id = '.intval($this->request['id']).' LIMIT 1'); } diff --git a/e107_plugins/page/e_sitelink.php b/e107_plugins/page/e_sitelink.php index 78fe31ac7..e268a8091 100644 --- a/e107_plugins/page/e_sitelink.php +++ b/e107_plugins/page/e_sitelink.php @@ -78,7 +78,7 @@ class page_sitelink // include plugin-folder in the name. } elseif(vartrue($options['book'])) { - $q[] = "page_chapter IN (SELECT chapter_id FROM #page_chapters WHERE chapter_parent=".intval($options['book']).")"; + $q[] = "page_title !='' && page_chapter IN (SELECT chapter_id FROM #page_chapters WHERE chapter_parent=".intval($options['book']).")"; } // XXX discuss FIXED remove DB check, use default title - AND page_title !='' $q[] = "page_class IN (".USERCLASS_LIST.")"; diff --git a/e107_plugins/page/page_navigation_menu.php b/e107_plugins/page/page_navigation_menu.php index 5d5064a1e..7aa056baa 100644 --- a/e107_plugins/page/page_navigation_menu.php +++ b/e107_plugins/page/page_navigation_menu.php @@ -15,7 +15,7 @@ if (!defined('e107_INIT')) { exit; } $parm = eHelper::scParams($parm); -$template = e107::getCoreTemplate('page',vartrue($parm['template'],'nav'), true, true); // always merge +$template = e107::getCoreTemplate('page','nav',false,true); // always merge $request = e107::getRegistry('core/pages/request'); if($request && is_array($request)) diff --git a/e107_themes/bootstrap/templates/page_template.php b/e107_themes/bootstrap/templates/page_template.php index 8f3664d76..ea57f8e6d 100644 --- a/e107_themes/bootstrap/templates/page_template.php +++ b/e107_themes/bootstrap/templates/page_template.php @@ -52,37 +52,33 @@ $PAGE_TEMPLATE['navdoc']['end'] = ''; - $PAGE_TEMPLATE['navdoc']['submenu_start'] = ''; + $PAGE_TEMPLATE['listChapters']['start'] = '
'; + $PAGE_TEMPLATE['listChapters']['item'] = "

{CHAPTER_NAME}

+ {CHAPTER_DESCRIPTION} + "; + $PAGE_TEMPLATE['listChapters']['end'] = "
"; + ?> \ No newline at end of file diff --git a/page.php b/page.php index 7a5e14fb5..f5767b98d 100644 --- a/page.php +++ b/page.php @@ -47,29 +47,7 @@ elseif(vartrue($_GET['bk'])) // List Chapters within a specific Book elseif(vartrue($_GET['ch'])) // List Pages within a specific Chapter { $e107CorePage->setRequest('listPages'); - - if($_GET['action']=='all') // See bootstrap 'docs' layout for an example. - { - $template = array(); - $template['start'] = ''; - $template['item'] = ' -
- - {CPAGEBODY} -
- '; - $template['end'] = ''; - define('e_PAGETITLE', 'Documentation'); //FIXME - grab from selected chapter. - } - else - { - $template = array(); - $template['start'] = ""; - } + require_once(HEADERF); $text = $e107CorePage->listPages($_GET['ch'],$template); @@ -216,17 +194,28 @@ class pageClass $sql = e107::getDb('chap'); $tp = e107::getParser(); + $template = e107::getCoreTemplate('page','listChapters', true, true); // always merge + if($sql->db_Select("page_chapters", "*", "chapter_parent = ".intval($book)." ORDER BY chapter_order ASC ")) { - $text .= ""; } return $text; @@ -234,14 +223,13 @@ class pageClass - // TODO template for page list - function listPages($chapt=0,$template='') + function listPages($chapt=0) { $sql = e107::getDb('pg'); $tp = e107::getParser(); $this->batch = e107::getScBatch('page',null,'cpage'); - + $template = e107::getCoreTemplate('page','listPages',true,true); // always merge if(!e107::getPref('listPages', false)) { @@ -258,11 +246,10 @@ class pageClass } else { - - // $text .= ""; + // $caption = ($title !='')? $title: LAN_PAGE_11; // e107::getRender()->tablerender($caption, $text,"cpage_list"); }