From afecc6b20bd39de11ddb56afc91a0fdcb0c4e625 Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Thu, 22 Dec 2011 15:11:41 +0100 Subject: [PATCH 1/2] ENHANCEMENT: #6579 Show page status in page tree --- code/controllers/CMSMain.php | 3 ++- code/model/SiteTree.php | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 59b3481c..6b0293a7 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -251,9 +251,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr $def[$class]['defaultChild'] = $defaultChild; $defaultParent = $obj->defaultParent(); + if(SiteTree::get_by_link($defaultParent)) { $id = $defaultParent ? SiteTree::get_by_link($defaultParent)->ID : null; $defaultParent = $id ? SiteTree::get_by_link($obj->defaultParent())->ID : null; - + } if ($defaultParent != 1 && $defaultParent != null) $def[$class]['defaultParent'] = $defaultParent; if(is_array($def[$class]['disallowedChildren'])) { diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index 4e787023..59bf093a 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -2465,22 +2465,23 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid * @return string */ function getTreeTitle() { + $text = Convert::raw2xml(str_replace(array("\n","\r"),"",$this->MenuTitle)); if($this->IsDeletedFromStage) { if($this->ExistsOnLive) { - $tag ="span class=\"del\" title=\"" . _t('SiteTree.REMOVEDFROMDRAFT', 'Removed from draft site') . "\""; + $tag ="{$text} " . _t('SiteTree.REMOVEDFROMDRAFT', 'Removed from draft site') . ""; } else { - $tag ="span class=\"del\" class=\"deletedOnLive\" title=\"" . _t('SiteTree.DELETEDPAGE', 'Deleted page') . "\""; + $tag ="{$text} ". _t('SiteTree.DELETEDPAGE', 'Deleted page') . ""; } } elseif($this->IsAddedToStage) { - $tag = "span class=\"ins\" title=\"" . _t('SiteTree.ADDEDTODRAFT', 'Added to draft site') . "\""; + $tag = "{$text} ". _t('SiteTree.ADDEDTODRAFT', 'Added to draft site') . ""; } elseif($this->IsModifiedOnStage) { - $tag = "span title=\"" . _t('SiteTree.MODIFIEDONDRAFT', 'Modified on draft site') . "\" class=\"status modified\""; + $tag = "{$text} " . _t('SiteTree.MODIFIEDONDRAFT', 'Modified on draft site') . ""; } else { $tag = ''; } - $text = Convert::raw2xml(str_replace(array("\n","\r"),"",$this->MenuTitle)); - return ($tag) ? ""."<$tag>" . $text . "" : "". $text; + + return ($tag) ? "". $tag : "". $text; } /** From 5d5b5ed07cc91a7a7cde62ac013befdef52b4404 Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Thu, 22 Dec 2011 15:30:46 +0100 Subject: [PATCH 2/2] Tabbed out if --- code/controllers/CMSMain.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 6b0293a7..011a7a97 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -252,8 +252,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr $defaultParent = $obj->defaultParent(); if(SiteTree::get_by_link($defaultParent)) { - $id = $defaultParent ? SiteTree::get_by_link($defaultParent)->ID : null; - $defaultParent = $id ? SiteTree::get_by_link($obj->defaultParent())->ID : null; + $id = $defaultParent ? SiteTree::get_by_link($defaultParent)->ID : null; + $defaultParent = $id ? SiteTree::get_by_link($obj->defaultParent())->ID : null; } if ($defaultParent != 1 && $defaultParent != null) $def[$class]['defaultParent'] = $defaultParent;