diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php
index 19864ffe6..5d77dc33b 100644
--- a/e107_admin/cpage.php
+++ b/e107_admin/cpage.php
@@ -207,17 +207,17 @@ class page_chapters_ui extends e_admin_ui
protected $listOrder = 'chapter_parent,chapter_order asc';
protected $fields = array(
- 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
- 'chapter_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE, 'readonly'=>TRUE),
- 'chapter_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>FALSE, 'batch' => FALSE, 'filter'=>FALSE),
- 'chapter_parent' => array('title'=> "Book", 'type' => 'dropdown', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE, 'filter'=>true),
- 'chapter_name' => array('title'=> "Book or Chapter Title", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
- 'chapter_meta_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'textarea', 'width' => 'auto', 'thclass' => 'left','readParms' => 'expand=...&truncate=150&bb=1', 'readonly'=>FALSE),
- 'chapter_meta_keywords' => array('title'=> "Meta Keywords", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
- 'chapter_sef' => array('title'=> "SEF Url String", 'type' => 'text', 'width' => 'auto', 'readonly'=>FALSE), // Display name
- 'chapter_manager' => array('title'=> "Can be edited by", 'type' => 'userclass', 'width' => 'auto', 'data' => 'int','batch'=>TRUE, 'filter'=>TRUE),
- 'chapter_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => 'auto', 'thclass' => 'right', 'class'=> 'right' ),
- 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center')
+ 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
+ 'chapter_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE, 'readonly'=>TRUE),
+ 'chapter_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>FALSE, 'batch' => FALSE, 'filter'=>FALSE),
+ 'chapter_parent' => array('title'=> "Book", 'type' => 'dropdown', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE, 'filter'=>true),
+ 'chapter_name' => array('title'=> "Book or Chapter Title", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
+ 'chapter_meta_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'textarea', 'width' => 'auto', 'thclass' => 'left','readParms' => 'expand=...&truncate=150&bb=1', 'readonly'=>FALSE),
+ 'chapter_meta_keywords' => array('title'=> "Meta Keywords", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
+ 'chapter_sef' => array('title'=> "SEF Url String", 'type' => 'text', 'width' => 'auto', 'readonly'=>FALSE), // Display name
+ 'chapter_manager' => array('title'=> "Can be edited by", 'type' => 'userclass', 'width' => 'auto', 'data' => 'int','batch'=>TRUE, 'filter'=>TRUE),
+ 'chapter_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => 'auto', 'thclass' => 'right', 'class'=> 'right' ),
+ 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center')
);
@@ -331,7 +331,7 @@ class page_admin_ui extends e_admin_ui
$sql = e107::getDb();
- $sql->db_Select_gen("SELECT chapter_id,chapter_name,chapter_parent FROM #page_chapters ORDER BY chapter_parent asc");
+ $sql->db_Select_gen("SELECT chapter_id,chapter_name,chapter_parent FROM #page_chapters ORDER BY chapter_parent asc, chapter_order");
while($row = $sql->db_Fetch())
{
$cat = $row['chapter_id'];
@@ -346,7 +346,7 @@ class page_admin_ui extends e_admin_ui
$this->cats[$cat] = $this->books[$book] . " : ".$row['chapter_name'];
}
}
- asort($this->cats);
+ // asort($this->cats);
$this->fields['page_chapter']['writeParms'] = $this->cats;
diff --git a/e107_core/shortcodes/batch/page_shortcodes.php b/e107_core/shortcodes/batch/page_shortcodes.php
index 30d9052b7..e93244cda 100644
--- a/e107_core/shortcodes/batch/page_shortcodes.php
+++ b/e107_core/shortcodes/batch/page_shortcodes.php
@@ -15,11 +15,12 @@ if (!defined('e107_INIT')) { exit; }
*
* Shortcodes for custom page display
*/
-class page_shortcodes extends e_shortcode
+class cpage_shortcodes extends e_shortcode
{
+ // var $var; // parsed DB values
- function sc_cpagetitle()
- {
+ function sc_cpagetitle($parm='')
+ {
return e107::getParser()->toHTML($this->getParserVars()->title, true, 'TITLE');
}
@@ -30,7 +31,7 @@ class page_shortcodes extends e_shortcode
}
- function sc_cpagebody()
+ function sc_cpagebody($parm='')
{
// already parsed
return $this->getParserVars()->text;
diff --git a/e107_core/templates/page_template.php b/e107_core/templates/page_template.php
index 32e825daa..8c47c78a5 100644
--- a/e107_core/templates/page_template.php
+++ b/e107_core/templates/page_template.php
@@ -110,7 +110,7 @@ $sc_style['CPAGENAV|default']['post'] = '';
$PAGE_TEMPLATE['nav']['caption'] = "Articles";
- $PAGE_TEMPLATE['nav']['start'] = '
';
+ $PAGE_TEMPLATE['nav']['start'] = '';
// Main Link
$PAGE_TEMPLATE['nav']['item'] = '
@@ -161,7 +161,7 @@ $sc_style['CPAGENAV|default']['post'] = '';
$PAGE_TEMPLATE['nav']['end'] = '
';
- $PAGE_TEMPLATE['nav']['submenu_start'] = '';
+ $PAGE_TEMPLATE['nav']['submenu_start'] = '';
$PAGE_TEMPLATE['nav']['submenu_item'] = '
diff --git a/e107_plugins/page/e_shortcode.php b/e107_plugins/page/e_shortcode.php
index 9e17ebb6b..8a88ed63d 100644
--- a/e107_plugins/page/e_shortcode.php
+++ b/e107_plugins/page/e_shortcode.php
@@ -27,6 +27,4 @@ class page_shortcodes extends e_shortcode
}
}
-
-
?>
\ No newline at end of file
diff --git a/e107_plugins/page/e_sitelink.php b/e107_plugins/page/e_sitelink.php
index 57cba11ab..1b4fecf9f 100644
--- a/e107_plugins/page/e_sitelink.php
+++ b/e107_plugins/page/e_sitelink.php
@@ -52,7 +52,9 @@ class page_sitelinks // include plugin-folder in the name.
$sublinks[$pid][] = array(
'link_id' => $row['page_id'],
'link_name' => $row['page_title'],
- 'link_url' => vartrue($row['page_sef'],'page.php?'.$row['page_id']),
+ // 'link_url' => vartrue($row['page_sef'],'page.php?id='.$row['page_id']),
+ 'link_url' => 'page.php?id='.$row['page_id'],
+ // 'link_url' => e107::getUrl()->create('page/view', $row, 'allow=page_id,page_sef'), //XXX FIXME - bad links created.
'link_description' => '',
'link_button' => '',
'link_category' => '',
@@ -86,7 +88,10 @@ class page_sitelinks // include plugin-folder in the name.
$arr[] = array(
'link_id' => $row['chapter_id'],
'link_name' => $row['chapter_name'],
- 'link_url' => vartrue($row['chapter_sef'],'#'),
+ //TODO SEFURLS using chapter_sef.
+ 'link_url' => ($row['chapter_parent'] == 0) ? 'page.php?bk='.$row['chapter_id'] : 'page.php?ch='.$row['chapter_id'],
+ // 'link_url' => vartrue($row['chapter_sef'],'#'),
+
'link_description' => '',
'link_button' => '',
'link_category' => '',
diff --git a/page.php b/page.php
index a45897dc8..a9ab1d7c0 100644
--- a/page.php
+++ b/page.php
@@ -30,6 +30,23 @@ if(!e_QUERY)
exit;
}
}
+elseif(vartrue($_GET['bk'])) // List Chapters within a specific Book
+{
+ require_once(HEADERF);
+ $text = $e107CorePage->listChapters($_GET['bk']);
+ $ns->tablerender('', $text, 'page-book-list'); // TODO FIXME Caption eg. "book title"
+ require_once(FOOTERF);
+ exit;
+}
+elseif(vartrue($_GET['ch'])) // List Pages within a specific Chapter
+{
+ require_once(HEADERF);
+
+ $text = $e107CorePage->listPages($_GET['ch']);
+ $ns->tablerender('', $text, 'page-chapter-list'); // TODO FIXME Caption eg. "book title"
+ require_once(FOOTERF);
+ exit;
+}
else
{
@@ -68,12 +85,22 @@ class pageClass
function __construct($debug=FALSE)
{
/* constructor */
-
- $tmp = explode(".", e_QUERY);
- $this->pageID = intval($tmp[0]);
- $this->pageSelected = (isset($tmp[1]) ? intval($tmp[1]) : 0);
- $this->pageTitles = array();
- $this->bullet = '';
+ if(!vartrue($_GET['id'])) // legacy URLs /page.php?x
+ {
+ $tmp = explode(".", e_QUERY);
+ $this->pageID = intval($tmp[0]);
+ $this->pageSelected = (isset($tmp[1]) ? intval($tmp[1]) : 0);
+ $this->pageTitles = array();
+ $this->bullet = '';
+ }
+ else // NEW URLS /page.php?id=x // TODO Complete and test.
+ {
+ $tmp = explode(".", e_QUERY);
+ $this->pageID = intval($_GET['id']);
+ $this->pageSelected = (isset($tmp[1]) ? intval($tmp[1]) : 0); // Not sure what this is?
+ $this->pageTitles = array();
+ $this->bullet = ''; // deprecated - use CSS instead.
+ }
// TODO nq_ (no query) cache string
$this->cacheString = 'page_'.$this->pageID.'_'.$this->pageSelected;
@@ -115,14 +142,14 @@ class pageClass
{
while($row = $sql->db_Fetch())
{
- $text .= "".$tp->toHtml($row['chapter_name'])."
"; // Book Title.
+ $text .= "".$tp->toHtml($row['chapter_name'])."
"; // Book Title.
$text .= $this->listChapters($row['chapter_id']);
}
}
- $text .= "Other Pages
"; // Book Title.
+ $text .= "Other Articles
"; // Book Title.
$text .= $this->listPages(0); // Pages unassigned to Book/Chapters.
- e107::getRender()->tablerender(LAN_PAGE_11, $text,"cpage_list");
+ e107::getRender()->tablerender("Articles", $text,"cpage_list");
}
@@ -131,16 +158,20 @@ class pageClass
//XXX - May be better to compile into assoc 'tree' array first. ie. books/chapters/pages.
function listChapters($book=1)
{
- $sql = e107::getDb();
+ $sql = e107::getDb('chap');
$tp = e107::getParser();
if($sql->db_Select("page_chapters", "*", "chapter_parent = ".intval($book)." ORDER BY chapter_order ASC "))
{
+ $text .= "";
while($row = $sql->db_Fetch())
{
- $text .= "".$tp->toHtml($row['chapter_name'])."
"; // Chapter Title.
+ $text .= "- ";
+ $text .= "
".$tp->toHtml($row['chapter_name'])."
"; // Chapter Title.
$text .= $this->listPages(intval($row['chapter_id']));
- }
+ $text .= " ";
+ }
+ $text .= "
";
}
return $text;
@@ -151,7 +182,7 @@ class pageClass
// TODO template for page list
function listPages($chapt=0)
{
- $sql = e107::getDb();
+ $sql = e107::getDb('pg');
$tp = e107::getParser();
if(!e107::getPref('listPages', false))
@@ -160,19 +191,20 @@ class pageClass
}
else
{
- if(!$sql->db_Select("page", "*", "page_theme='' AND page_chapter=".$chapt." AND page_class IN (".USERCLASS_LIST.") ORDER BY page_order ASC "))
+ if(!$sql->db_Select("page", "*", "page_theme='' AND page_chapter=".intval($chapt)." AND page_class IN (".USERCLASS_LIST.") ORDER BY page_order ASC "))
{
$text = LAN_PAGE_2;
}
else
{
+ $text .= "";
$pageArray = $sql->db_getList();
foreach($pageArray as $page)
{
$url = e107::getUrl()->create('page/view', $page, 'allow=page_id,page_sef');
- $text .= $this->bullet." ".$tp->toHtml($page['page_title'])."
"; //XXX Better to use ";
// $caption = ($title !='')? $title: LAN_PAGE_11;
// e107::getRender()->tablerender($caption, $text,"cpage_list");
}
@@ -207,7 +239,7 @@ class pageClass
$ret['cachecontrol'] = false;
$this->authorized = 'nf';
$this->template = e107::getCoreTemplate('page', 'default');
- $this->batch = e107::getScBatch('page')->setVars(new e_vars($ret))->setScVar('page', array());
+ $this->batch = e107::getScBatch('page',null,'cpage')->setVars(new e_vars($ret))->setScVar('page', array());
define("e_PAGETITLE", $ret['title']);
return;
@@ -218,7 +250,7 @@ class pageClass
$this->template = e107::getCoreTemplate('page', vartrue($this->page['page_template'], 'default'));
if(empty($this->template)) $this->template = e107::getCoreTemplate('page', 'default');
- $this->batch = e107::getScBatch('page');
+ $this->batch = e107::getScBatch('page',null,'cpage');
$this->pageText = $this->page['page_text'];
@@ -286,7 +318,7 @@ class pageClass
if($this->cacheData['COMMENT_FLAG'])
{
$vars = new e_vars(array('comments' => $this->pageComment(true)));
- $comments = e107::getScBatch('page')->setVars($vars)->cpagecomments();
+ $comments = e107::getScBatch('page',null,'cpage')->setVars($vars)->cpagecomments();
}
define('e_PAGETITLE', eHelper::formatMetaTitle($this->cacheData['TITLE']));
define('META_DESCRIPTION', $this->cacheData['META_DSCR']);