1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-22 14:13:03 +02:00

Fixes #3454 Incorrect "Quick View" URL when using book/chapter/page profile.

This commit is contained in:
Cameron
2019-05-11 13:52:28 -07:00
parent c6d528fcab
commit 2a9d0d3a88
2 changed files with 69 additions and 91 deletions

View File

@@ -636,6 +636,7 @@ class page_admin_ui extends e_admin_ui
protected $cats = array(0 => LAN_NONE);
protected $templates = array();
protected $chapterFields = array();
protected $chapters = array();
function init()
{
@@ -790,11 +791,16 @@ class page_admin_ui extends e_admin_ui
$sql = e107::getDb();
$sql->gen("SELECT chapter_id,chapter_name,chapter_parent, chapter_fields FROM #page_chapters ORDER BY chapter_parent asc, chapter_order");
$sql->gen("SELECT chapter_id,chapter_name,chapter_parent, chapter_sef, chapter_fields FROM #page_chapters ORDER BY chapter_parent asc, chapter_order");
while($row = $sql->fetch())
{
$cat = $row['chapter_id'];
$chrow = $row;
unset($chrow['chapter_fields']);
$this->chapters[$cat] = $chrow;
if($row['chapter_parent'] == 0)
{
$this->books[$cat] = $row['chapter_name'];
@@ -978,13 +984,20 @@ class page_admin_ui extends e_admin_ui
/** @var e_admin_model $model */
foreach ($tree->getTree() as $id => $model)
{
// No chapter, override route
if(!$model->get('page_chapter'))
{
if($chap = $model->get('page_chapter'))
{
$model->set('chapter_sef', $this->chapters[$chap]['chapter_sef']);
$parent = (int) $this->chapters[$chap]['chapter_parent'];
$model->set('book_sef', $this->chapters[$parent]['chapter_sef']);
}
else
{
$urlData = $this->url;
$urlData['route'] = 'page/view/other';
$model->setUrl($urlData);
}
}
}