mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 05:07:27 +02:00
Fixed #705 - default list view doesn't show chapters/pages list; number of improvements - render mods, broken views
This commit is contained in:
82
page.php
82
page.php
@@ -17,21 +17,23 @@ e107::coreLan('page');
|
|||||||
|
|
||||||
$e107CorePage = new pageClass(false);
|
$e107CorePage = new pageClass(false);
|
||||||
|
|
||||||
|
|
||||||
// Important - save request BEFORE any output (header footer) - used in navigation menu
|
// Important - save request BEFORE any output (header footer) - used in navigation menu
|
||||||
if(!e_QUERY)
|
if(!e_QUERY)
|
||||||
{
|
{
|
||||||
$e107CorePage->setRequest('listBooks');
|
$e107CorePage->setRequest('listBooks');
|
||||||
|
$e107CorePage->listBooks();
|
||||||
|
|
||||||
require_once(HEADERF);
|
require_once(HEADERF);
|
||||||
|
|
||||||
|
e107::getRender()->tablerender($e107CorePage->pageOutput['caption'], $e107CorePage->pageOutput['text'], "cpage-full-list");
|
||||||
// $tmp = $e107CorePage->listPages();
|
// $tmp = $e107CorePage->listPages();
|
||||||
$tmp = $e107CorePage->listBooks();
|
//$tmp = $e107CorePage->listBooks();
|
||||||
|
|
||||||
// $text = $tp->parseTemplate("{PAGE_NAVIGATION=book=2}",true);
|
// $text = $tp->parseTemplate("{PAGE_NAVIGATION=book=2}",true);
|
||||||
if(is_array($tmp))
|
/*if(is_array($tmp))
|
||||||
{
|
{
|
||||||
$ns->tablerender($tmp['title'], $text, 'cpage-full-list');
|
$ns->tablerender($tmp['title'], $text, 'cpage-full-list');
|
||||||
}
|
}*/
|
||||||
require_once(FOOTERF);
|
require_once(FOOTERF);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -41,7 +43,7 @@ elseif(vartrue($_GET['bk'])) // List Chapters within a specific Book
|
|||||||
$e107CorePage->listChapters($_GET['bk']);
|
$e107CorePage->listChapters($_GET['bk']);
|
||||||
|
|
||||||
require_once(HEADERF);
|
require_once(HEADERF);
|
||||||
$ns->tablerender($e107CorePage->pageOutput['caption'], $e107CorePage->pageOutput['text'], 'cpage-chapter-list');
|
e107::getRender()->tablerender($e107CorePage->pageOutput['caption'], $e107CorePage->pageOutput['text'], 'cpage-chapter-list');
|
||||||
require_once(FOOTERF);
|
require_once(FOOTERF);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -50,8 +52,8 @@ elseif(vartrue($_GET['ch'])) // List Pages within a specific Chapter
|
|||||||
$e107CorePage->setRequest('listPages');
|
$e107CorePage->setRequest('listPages');
|
||||||
$e107CorePage->listPages($_GET['ch']);
|
$e107CorePage->listPages($_GET['ch']);
|
||||||
|
|
||||||
require_once(HEADERF);
|
require_once(HEADERF);
|
||||||
$ns->tablerender($e107CorePage->pageOutput['caption'], $e107CorePage->pageOutput['text'], 'cpage-page-list');
|
e107::getRender()->tablerender($e107CorePage->pageOutput['caption'], $e107CorePage->pageOutput['text'], 'cpage-page-list');
|
||||||
require_once(FOOTERF);
|
require_once(FOOTERF);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -84,7 +86,10 @@ class pageClass
|
|||||||
public $debug; /* temp debug flag */
|
public $debug; /* temp debug flag */
|
||||||
public $title; /* title of page, it if has one (as defined in [newpage=title] tag */
|
public $title; /* title of page, it if has one (as defined in [newpage=title] tag */
|
||||||
public $page; /* page DB data */
|
public $page; /* page DB data */
|
||||||
public $batch; /* shortcode batch object */
|
/**
|
||||||
|
* @var cpage_shortcodes
|
||||||
|
*/
|
||||||
|
public $batch; /* shortcode batch object */
|
||||||
public $template; /* current template array */
|
public $template; /* current template array */
|
||||||
protected $authorized; /* authorized status */
|
protected $authorized; /* authorized status */
|
||||||
public $cacheString; /* current page cache string */
|
public $cacheString; /* current page cache string */
|
||||||
@@ -97,7 +102,8 @@ class pageClass
|
|||||||
|
|
||||||
protected $displayAllMode = false; // set to True when no book/chapter/page has been defined by the url/query.
|
protected $displayAllMode = false; // set to True when no book/chapter/page has been defined by the url/query.
|
||||||
|
|
||||||
public $pageOutput = '';
|
public $pageOutput = array(); // Output storage - text and caption
|
||||||
|
protected $renderMode; // Page render mode to be used on view page
|
||||||
|
|
||||||
function __construct($debug=FALSE)
|
function __construct($debug=FALSE)
|
||||||
{
|
{
|
||||||
@@ -263,14 +269,16 @@ class pageClass
|
|||||||
|
|
||||||
if($text)
|
if($text)
|
||||||
{
|
{
|
||||||
$caption = varset($template['caption'],"Articles");
|
$caption = varset($template['caption'], "Articles");
|
||||||
e107::getRender()->tablerender($caption, $text, "cpage_list");
|
$this->pageOutput = array('caption'=>$caption, 'text'=>$text);
|
||||||
|
//e107::getRender()->tablerender($caption, $text, "cpage_list");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message_handler("MESSAGE", LAN_PAGE_1);
|
$this->pageOutput = array('caption'=>LAN_ERROR, 'text'=>LAN_PAGE_1);
|
||||||
require_once(FOOTERF); // prevent message from showing twice and still listing chapters
|
//message_handler("MESSAGE", LAN_PAGE_1);
|
||||||
exit;
|
//require_once(FOOTERF); // prevent message from showing twice and still listing chapters
|
||||||
|
//exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -372,6 +380,7 @@ class pageClass
|
|||||||
|
|
||||||
#return array('caption'=>$caption, 'text'=>$text);
|
#return array('caption'=>$caption, 'text'=>$text);
|
||||||
$this->pageOutput = array('caption'=>$caption, 'text'=>$text);
|
$this->pageOutput = array('caption'=>$caption, 'text'=>$text);
|
||||||
|
return $this->pageOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -506,6 +515,7 @@ class pageClass
|
|||||||
$caption = $tp->simpleParse($template['caption'], $var);
|
$caption = $tp->simpleParse($template['caption'], $var);
|
||||||
#return array('caption'=>$caption, 'text'=> $text);
|
#return array('caption'=>$caption, 'text'=> $text);
|
||||||
$this->pageOutput = array('caption'=>$caption, 'text'=> $text);
|
$this->pageOutput = array('caption'=>$caption, 'text'=> $text);
|
||||||
|
return $this->pageOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -682,13 +692,6 @@ class pageClass
|
|||||||
|
|
||||||
public function setPage()
|
public function setPage()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(null !== $this->cacheData)
|
if(null !== $this->cacheData)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -716,20 +719,22 @@ class pageClass
|
|||||||
}
|
}
|
||||||
|
|
||||||
$extend = new e_vars;
|
$extend = new e_vars;
|
||||||
$vars = $this->batch->getParserVars();
|
$vars = new e_vars($this->batch->getParserVars());
|
||||||
|
|
||||||
// reset batch data
|
// reset batch data
|
||||||
// $this->batch->setVars(null)->setScVar('page', array());
|
// $this->batch->setVars(null)->setScVar('page', array());
|
||||||
|
|
||||||
// copy some data
|
// copy some data
|
||||||
$extend->title = $vars->title;
|
$extend->title = $vars->page_title;
|
||||||
$extend->message = e107::getMessage()->render();
|
$extend->message = e107::getMessage()->render();
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
switch ($this->authorized)
|
switch ($this->authorized)
|
||||||
{
|
{
|
||||||
case 'class':
|
case 'class':
|
||||||
$extend->text = LAN_PAGE_6;
|
$extend->text = LAN_PAGE_6;
|
||||||
$template = $this->template['start'].$this->template['restricted'].$this->template['end'];
|
$template = $tp->parseTemplate($this->template['start'], true).$this->template['restricted'].$tp->parseTemplate($this->template['end'] ,true);
|
||||||
|
$this->renderMode = 'cpage-restricted';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'pw':
|
case 'pw':
|
||||||
@@ -742,16 +747,18 @@ class pageClass
|
|||||||
// FIXME - add form open/close e_form methods
|
// FIXME - add form open/close e_form methods
|
||||||
$extend->form_open = '<form method="post" action="'.e_REQUEST_URI.'" id="pwform">';
|
$extend->form_open = '<form method="post" action="'.e_REQUEST_URI.'" id="pwform">';
|
||||||
$extend->form_close = '</form>';
|
$extend->form_close = '</form>';
|
||||||
$template = $this->template['start'].$this->template['authorize'].$this->template['end'];
|
$template = $tp->parseTemplate($this->template['start'], true).$this->template['authorize'].$tp->parseTemplate($this->template['end'] ,true);
|
||||||
|
$this->renderMode = 'cpage-authorize';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'nf':
|
case 'nf':
|
||||||
default:
|
default:
|
||||||
$extend->text = $vars->text;
|
$extend->text = $vars->page_text;
|
||||||
$template = $this->template['start'].$this->template['notfound'].$this->template['end'];
|
$template = $tp->parseTemplate($this->template['start'], true).$this->template['notfound'].$tp->parseTemplate($this->template['end'] ,true);
|
||||||
|
$this->renderMode = 'cpage-notfound';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return $this->renderPage($template, $extend);
|
// return $this->renderPage($template, $extend);
|
||||||
$this->pageOutput = array('text' => $this->renderPage($template, $extend));
|
$this->pageOutput = array('text' => $this->renderPage($template, $extend));
|
||||||
}
|
}
|
||||||
@@ -767,9 +774,16 @@ class pageClass
|
|||||||
{
|
{
|
||||||
$ret = e107::getParser()->simpleParse($template, $vars);
|
$ret = e107::getParser()->simpleParse($template, $vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
$mode = vartrue($this->template['tableRender'], 'cpage-'.$template);
|
if($this->renderMode)
|
||||||
|
{
|
||||||
|
$mode = $this->renderMode;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mode = vartrue($this->template['tableRender'], 'cpage-page-view');
|
||||||
|
}
|
||||||
|
|
||||||
return e107::getRender()->tablerender($this->page['page_title'], $ret, $mode, true);
|
return e107::getRender()->tablerender($this->page['page_title'], $ret, $mode, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -783,7 +797,7 @@ class pageClass
|
|||||||
|
|
||||||
$this->pageTitles = array(); // Notice removal
|
$this->pageTitles = array(); // Notice removal
|
||||||
|
|
||||||
if(preg_match_all("/\[newpage.*?\]/si", $this->pageText, $pt))
|
if(preg_match_all('/\[newpage.*?\]/si', $this->pageText, $pt))
|
||||||
{
|
{
|
||||||
if (substr($this->pageText, 0, 6) == '[html]')
|
if (substr($this->pageText, 0, 6) == '[html]')
|
||||||
{ // Need to strip html bbcode from wysiwyg on multi-page docs (handled automatically on single pages)
|
{ // Need to strip html bbcode from wysiwyg on multi-page docs (handled automatically on single pages)
|
||||||
|
Reference in New Issue
Block a user