e107
e107 copied to clipboard
you can delete chapter with pages
You can delete chapter with pages.
Problem is that chapter ID is still in page data so you can't relay on this field to test if page has chapter.
It is used here: Maybe reason why page url is sometimes not correct.
function sc_cpageurl()
{
$route = ($this->var['page_chapter'] == 0) ? 'page/view/other' : 'page/view';
$urldata = $this->var;
if($this->var['page_chapter'] && $this->chapterData[$this->var['page_chapter']])
{
$chapter = $this->chapterData[$this->var['page_chapter']];
$urldata = array_merge($this->var, $chapter);
$urldata['book_sef'] = $this->chapterData[$chapter['chapter_parent']]['chapter_sef'];
}
return e107::getUrl()->create($route, $urldata, array('allow' => 'page_sef,page_id,chapter_sef,book_sef'));
}
@Moc this is bug. You can't allow to delete something if there is related table without checking. Not mention if you relay further in code that there is correct value.
Indeed.At least a warning that the page you're about to delete has related chapters....
@rica-carv Page is last in tree, problem is deleted chapter with pages.
@Jimmi08 Humm, let's see if i understand. Chapter is a child of page, right? So why can't i delete a child of a parent page? It should always be allowed, but also, a warning could be in hand, but just to be sure if delete is intencional or not, nothing else....
no, chapter is parent of page. Book is parent of chapter. Otherwise you are right.
I would add this as a preference. Or any visible info that chapter has pages. Because main problem is not deleting itself, but the case when you think that there are no pages and in fact, there are some. The nice way is used in the metatag plugin (with modal confirmation).