mirror of
https://github.com/e107inc/e107.git
synced 2025-07-30 19:30:25 +02:00
Fixed conflict between page shortcodes and page plugin shortcodes. Book and Chapter listings improved and page_navigation_menu improved.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -110,7 +110,7 @@ $sc_style['CPAGENAV|default']['post'] = '</div>';
|
||||
|
||||
$PAGE_TEMPLATE['nav']['caption'] = "Articles";
|
||||
|
||||
$PAGE_TEMPLATE['nav']['start'] = '<ul>';
|
||||
$PAGE_TEMPLATE['nav']['start'] = '<ul class="page-nav">';
|
||||
|
||||
// Main Link
|
||||
$PAGE_TEMPLATE['nav']['item'] = '
|
||||
@@ -161,7 +161,7 @@ $sc_style['CPAGENAV|default']['post'] = '</div>';
|
||||
$PAGE_TEMPLATE['nav']['end'] = '</ul>';
|
||||
|
||||
|
||||
$PAGE_TEMPLATE['nav']['submenu_start'] = '<ul id="{LINK_PARENT}" role="menu" >';
|
||||
$PAGE_TEMPLATE['nav']['submenu_start'] = '<ul class="page-nav" id="{LINK_PARENT}" role="menu" >';
|
||||
|
||||
|
||||
$PAGE_TEMPLATE['nav']['submenu_item'] = '
|
||||
|
@@ -27,6 +27,4 @@ class page_shortcodes extends e_shortcode
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
@@ -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' => '',
|
||||
|
70
page.php
70
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 .= "<h2>".$tp->toHtml($row['chapter_name'])."</h2>"; // Book Title.
|
||||
$text .= "<h3 class='page-book-list'>".$tp->toHtml($row['chapter_name'])."</h3>"; // Book Title.
|
||||
$text .= $this->listChapters($row['chapter_id']);
|
||||
}
|
||||
}
|
||||
|
||||
$text .= "<h1>Other Pages</h1>"; // Book Title.
|
||||
$text .= "<h3>Other Articles</h3>"; // 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 .= "<ul class='page-chapters-list'>";
|
||||
while($row = $sql->db_Fetch())
|
||||
{
|
||||
$text .= "<h3>".$tp->toHtml($row['chapter_name'])."</h3>"; // Chapter Title.
|
||||
$text .= "<li>";
|
||||
$text .= "<h4>".$tp->toHtml($row['chapter_name'])."</h4>"; // Chapter Title.
|
||||
$text .= $this->listPages(intval($row['chapter_id']));
|
||||
}
|
||||
$text .= "</li>";
|
||||
}
|
||||
$text .= "</ul>";
|
||||
}
|
||||
|
||||
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 .= "<ul class='page-pages-list'>";
|
||||
$pageArray = $sql->db_getList();
|
||||
foreach($pageArray as $page)
|
||||
{
|
||||
$url = e107::getUrl()->create('page/view', $page, 'allow=page_id,page_sef');
|
||||
$text .= $this->bullet." <a href='".$url."'>".$tp->toHtml($page['page_title'])."</a><br />"; //XXX Better to use <ul> and <li> ??
|
||||
$text .= "<li><a href='".$url."'>".$tp->toHtml($page['page_title'])."</a></li>";
|
||||
}
|
||||
|
||||
$text .= "</ul>";
|
||||
// $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']);
|
||||
|
Reference in New Issue
Block a user