diff --git a/code/model/VirtualPage.php b/code/model/VirtualPage.php index ac9a9151..89d1510f 100644 --- a/code/model/VirtualPage.php +++ b/code/model/VirtualPage.php @@ -413,7 +413,7 @@ class VirtualPage extends Page { public function __get($field) { if(parent::hasMethod($funcName = "get$field")) { return $this->$funcName(); - } else if(parent::hasField($field)) { + } else if(parent::hasField($field) || ($field === 'ID' && !$this->exists())) { return $this->getField($field); } else { return $this->copyContentFrom()->$field; @@ -563,12 +563,17 @@ class VirtualPage_Controller extends Page_Controller { } catch (Exception $e) { // Hack... detect exception type. We really should use exception subclasses. // if the exception isn't a 'no method' error, rethrow it - if ($e->getCode() !== 2175) throw $e; + if ($e->getCode() !== 2175) { + throw $e; + } + $original = $this->copyContentFrom(); - $originalClass = get_class($original); - if ($originalClass == 'SiteTree') $name = 'ContentController'; - else $name = $originalClass."_Controller"; - $controller = new $name($this->dataRecord->copyContentFrom()); + $controller = ModelAsController::controller_for($original); + + // Ensure request/response data is available on virtual controller + $controller->setRequest($this->getRequest()); + $controller->response = $this->response; // @todo - replace with getter/setter in 3.3 + return call_user_func_array(array($controller, $method), $args); } } diff --git a/code/reports/BrokenFilesReport.php b/code/reports/BrokenFilesReport.php index fe4e5235..13d34514 100644 --- a/code/reports/BrokenFilesReport.php +++ b/code/reports/BrokenFilesReport.php @@ -16,16 +16,18 @@ class BrokenFilesReport extends SS_Report { public function sourceRecords($params = null) { // Get class names for page types that are not virtual pages or redirector pages - $classes = array_diff(ClassInfo::subclassesFor('SiteTree'), ClassInfo::subclassesFor('VirtualPage'), ClassInfo::subclassesFor('RedirectorPage')); + $classes = array_diff( + ClassInfo::subclassesFor('SiteTree'), + ClassInfo::subclassesFor('VirtualPage'), + ClassInfo::subclassesFor('RedirectorPage') + ); + $classParams = DB::placeholders($classes); + $classFilter = array( + "\"ClassName\" IN ($classParams) AND \"HasBrokenFile\" = 1" => $classes + ); - $classNames = "'".join("','", $classes)."'"; - - if (isset($_REQUEST['OnLive'])) { - $ret = Versioned::get_by_stage('SiteTree', 'Live', "\"ClassName\" IN ($classNames) AND \"HasBrokenFile\" = 1"); - } else { - $ret = DataObject::get('SiteTree', "\"ClassName\" IN ($classNames) AND \"HasBrokenFile\" = 1"); - } - return $ret; + $stage = isset($params['OnLive']) ? 'Live' : 'Stage'; + return Versioned::get_by_stage('SiteTree', $stage, $classFilter); } public function columns() { @@ -42,4 +44,14 @@ class BrokenFilesReport extends SS_Report { new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site')) ); } -} \ No newline at end of file +} + +/** + * @deprecated 3.2..4.0 + */ +class SideReport_BrokenFiles extends BrokenFilesReport { + public function __construct() { + Deprecation::notice('4.0', 'Use BrokenFilesReport instead'); + parent::__construct(); + } +} diff --git a/code/reports/BrokenLinksReport.php b/code/reports/BrokenLinksReport.php index 6dc1d2c0..4ef1511c 100644 --- a/code/reports/BrokenLinksReport.php +++ b/code/reports/BrokenLinksReport.php @@ -29,14 +29,14 @@ class BrokenLinksReport extends SS_Report { $sort = ''; } } - if (!isset($_REQUEST['CheckSite']) || $params['CheckSite'] == 'Published') { - $ret = Versioned::get_by_stage('SiteTree', 'Live', array( - '"SiteTree"."HasBrokenLink" = ? OR "SiteTree"."HasBrokenFile" = ?' => array(true, true) - ), $sort, $join, $limit); + $brokenFilter = array( + '"SiteTree"."HasBrokenLink" = ? OR "SiteTree"."HasBrokenFile" = ?' => array(true, true) + ); + $isLive = !isset($params['CheckSite']) || $params['CheckSite'] == 'Published'; + if ($isLive) { + $ret = Versioned::get_by_stage('SiteTree', 'Live', $brokenFilter, $sort, $join, $limit); } else { - $ret = DataObject::get('SiteTree', array( - '"SiteTree"."HasBrokenFile" = ? OR "SiteTree"."HasBrokenLink" = ?' => array(true, true) - ), $sort, $join, $limit); + $ret = DataObject::get('SiteTree', $brokenFilter, $sort, $join, $limit); } $returnSet = new ArrayList(); @@ -141,3 +141,14 @@ class BrokenLinksReport extends SS_Report { ); } } + + +/** + * @deprecated 3.2..4.0 + */ +class SideReport_BrokenLinks extends BrokenLinksReport { + public function __construct() { + Deprecation::notice('4.0', 'Use BrokenLinksReport instead'); + parent::__construct(); + } +} diff --git a/code/reports/BrokenRedirectorPagesReport.php b/code/reports/BrokenRedirectorPagesReport.php index 56c14425..5a69e619 100644 --- a/code/reports/BrokenRedirectorPagesReport.php +++ b/code/reports/BrokenRedirectorPagesReport.php @@ -15,11 +15,13 @@ class BrokenRedirectorPagesReport extends SS_Report { } public function sourceRecords($params = null) { - $classNames = "'".join("','", ClassInfo::subclassesFor('RedirectorPage'))."'"; - - if (isset($_REQUEST['OnLive'])) $ret = Versioned::get_by_stage('SiteTree', 'Live', "\"ClassName\" IN ($classNames) AND \"HasBrokenLink\" = 1"); - else $ret = DataObject::get('SiteTree', "\"ClassName\" IN ($classNames) AND \"HasBrokenLink\" = 1"); - return $ret; + $classes = ClassInfo::subclassesFor('RedirectorPage'); + $classParams = DB::placeholders($classes); + $classFilter = array( + "\"ClassName\" IN ($classParams) AND \"HasBrokenLink\" = 1" => $classes + ); + $stage = isset($params['OnLive']) ? 'Live' : 'Stage'; + return Versioned::get_by_stage('SiteTree', $stage, $classFilter); } public function columns() { @@ -37,3 +39,13 @@ class BrokenRedirectorPagesReport extends SS_Report { ); } } + +/** + * @deprecated 3.2..4.0 + */ +class SideReport_BrokenRedirectorPages extends BrokenRedirectorPagesReport { + public function __construct() { + Deprecation::notice('4.0', 'Use BrokenRedirectorPagesReport instead'); + parent::__construct(); + } +} diff --git a/code/reports/BrokenVirtualPagesReport.php b/code/reports/BrokenVirtualPagesReport.php index f187d90f..01eb430d 100644 --- a/code/reports/BrokenVirtualPagesReport.php +++ b/code/reports/BrokenVirtualPagesReport.php @@ -15,15 +15,13 @@ class BrokenVirtualPagesReport extends SS_Report { } public function sourceRecords($params = null) { - $classNames = "'".join("','", ClassInfo::subclassesFor('VirtualPage'))."'"; - - if (isset($_REQUEST['OnLive'])) { - $ret = Versioned::get_by_stage('SiteTree', 'Live', "\"ClassName\" IN ($classNames) AND \"HasBrokenLink\" = 1"); - } else { - $ret = DataObject::get('SiteTree', "\"ClassName\" IN ($classNames) AND \"HasBrokenLink\" = 1"); - } - - return $ret; + $classes = ClassInfo::subclassesFor('VirtualPage'); + $classParams = DB::placeholders($classes); + $classFilter = array( + "\"ClassName\" IN ($classParams) AND \"HasBrokenLink\" = 1" => $classes + ); + $stage = isset($params['OnLive']) ? 'Live' : 'Stage'; + return Versioned::get_by_stage('SiteTree', $stage, $classFilter); } public function columns() { @@ -40,4 +38,14 @@ class BrokenVirtualPagesReport extends SS_Report { new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site')) ); } -} \ No newline at end of file +} + +/** + * @deprecated 3.2..4.0 + */ +class SideReport_BrokenVirtualPages extends BrokenVirtualPagesReport { + public function __construct() { + Deprecation::notice('4.0', 'Use BrokenVirtualPagesReport instead'); + parent::__construct(); + } +} diff --git a/code/reports/EmptyPagesReport.php b/code/reports/EmptyPagesReport.php index ed718660..4bbfc9fb 100644 --- a/code/reports/EmptyPagesReport.php +++ b/code/reports/EmptyPagesReport.php @@ -32,4 +32,14 @@ class EmptyPagesReport extends SS_Report { ), ); } -} \ No newline at end of file +} + +/** + * @deprecated 3.2..4.0 + */ +class SideReport_EmptyPages extends EmptyPagesReport { + public function __construct() { + Deprecation::notice('4.0', 'Use EmptyPagesReport instead'); + parent::__construct(); + } +} diff --git a/code/reports/RecentlyEditedReport.php b/code/reports/RecentlyEditedReport.php index 65d1664c..c1dca206 100644 --- a/code/reports/RecentlyEditedReport.php +++ b/code/reports/RecentlyEditedReport.php @@ -31,4 +31,14 @@ class RecentlyEditedReport extends SS_Report { ), ); } -} \ No newline at end of file +} + +/** + * @deprecated 3.2..4.0 + */ +class SideReport_RecentlyEdited extends RecentlyEditedReport { + public function __construct() { + Deprecation::notice('4.0', 'Use RecentlyEditedReport instead'); + parent::__construct(); + } +} diff --git a/javascript/lang/de.js b/javascript/lang/de.js index 5ee6e5fe..9556e382 100644 --- a/javascript/lang/de.js +++ b/javascript/lang/de.js @@ -36,13 +36,13 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') { "Tree.ThisPageOnly": "Nur diese Seite", "Tree.ThisPageAndSubpages": "Diese Seite und Unterseiten", "Tree.ShowAsList": "Kinder als LIste zeigen", - "CMSMain.ConfirmRestoreFromLive": "Are you sure you want to revert draft to when the page was last published?", + "CMSMain.ConfirmRestoreFromLive": "Sind Sie sicher, dass Sie den Entwurf zu der zuletzt veröffentlichten Version zurücksetzen wollen?", "CMSMain.RollbackToVersion": "Wollen Sie wirklich Version #%s dieser Seite wiederherstellen?", - "CMSMain.Archive": "Are you sure you want to archive this page and all of its children pages?\n\nThis page and all of its children will be unpublished and sent to the archive.", - "CMSMain.Restore": "Are you sure you want to restore this page from archive?", - "CMSMain.RestoreToRoot": "Are you sure you want to restore this page from archive?\n\nBecause the parent page is not available this will be restored to the top level.", - "CMSMain.Unpublish": "Are you sure you want to remove your page from the published site?\n\nThis page will still be available in the sitetree as draft.", - "CMSMain.DeleteFromDraft": "Are you sure you want to remove your page from the draft site?\n\nThis page will remain on the published site.", + "CMSMain.Archive": "Sind Sie sicher, dass Sie diese Seite und alle Unterseiten archivieren wollen?\n\nBei dieser Seite und allen Unterseiten wird die Veröffentlichung zurückgenommen und sie werden ins Archiv verschoben.", + "CMSMain.Restore": "Sind Sie sicher, dass Sie diese Seite aus dem Archiv wiederherstellen wollen?", + "CMSMain.RestoreToRoot": "Sind Sie sicher, dass Sie diese Seite aus dem Archiv wiederherstellen wollen?\n\nWeil die ehemalige Elternseite nicht verfügbar ist wird diese Seite auf oberster Ebene wiederhergestellt.", + "CMSMain.Unpublish": "Sind Sie sicher, dass Sie diese Seite von der veröffentlichten Seite entfernen wollen?\n\nDie Seite wird weiterhin im Seitenbaum als Entwurf bleiben.", + "CMSMain.DeleteFromDraft": "Sind Sie sicher, dass Sie diese Seite aus den Entwürfen entfernen wollen?\n\nDiese Seite wird weiterhin veröffentlicht bleiben.", "URLSEGMENT.Edit": "Bearbeiten", "URLSEGMENT.OK": "OK", "URLSEGMENT.Cancel": "Abbrechen", diff --git a/javascript/lang/src/de.js b/javascript/lang/src/de.js index 9f39c806..fb27ca9d 100644 --- a/javascript/lang/src/de.js +++ b/javascript/lang/src/de.js @@ -31,13 +31,13 @@ "Tree.ThisPageOnly": "Nur diese Seite", "Tree.ThisPageAndSubpages": "Diese Seite und Unterseiten", "Tree.ShowAsList": "Kinder als LIste zeigen", - "CMSMain.ConfirmRestoreFromLive": "Are you sure you want to revert draft to when the page was last published?", + "CMSMain.ConfirmRestoreFromLive": "Sind Sie sicher, dass Sie den Entwurf zu der zuletzt veröffentlichten Version zurücksetzen wollen?", "CMSMain.RollbackToVersion": "Wollen Sie wirklich Version #%s dieser Seite wiederherstellen?", - "CMSMain.Archive": "Are you sure you want to archive this page and all of its children pages?\n\nThis page and all of its children will be unpublished and sent to the archive.", - "CMSMain.Restore": "Are you sure you want to restore this page from archive?", - "CMSMain.RestoreToRoot": "Are you sure you want to restore this page from archive?\n\nBecause the parent page is not available this will be restored to the top level.", - "CMSMain.Unpublish": "Are you sure you want to remove your page from the published site?\n\nThis page will still be available in the sitetree as draft.", - "CMSMain.DeleteFromDraft": "Are you sure you want to remove your page from the draft site?\n\nThis page will remain on the published site.", + "CMSMain.Archive": "Sind Sie sicher, dass Sie diese Seite und alle Unterseiten archivieren wollen?\n\nBei dieser Seite und allen Unterseiten wird die Veröffentlichung zurückgenommen und sie werden ins Archiv verschoben.", + "CMSMain.Restore": "Sind Sie sicher, dass Sie diese Seite aus dem Archiv wiederherstellen wollen?", + "CMSMain.RestoreToRoot": "Sind Sie sicher, dass Sie diese Seite aus dem Archiv wiederherstellen wollen?\n\nWeil die ehemalige Elternseite nicht verfügbar ist wird diese Seite auf oberster Ebene wiederhergestellt.", + "CMSMain.Unpublish": "Sind Sie sicher, dass Sie diese Seite von der veröffentlichten Seite entfernen wollen?\n\nDie Seite wird weiterhin im Seitenbaum als Entwurf bleiben.", + "CMSMain.DeleteFromDraft": "Sind Sie sicher, dass Sie diese Seite aus den Entwürfen entfernen wollen?\n\nDiese Seite wird weiterhin veröffentlicht bleiben.", "URLSEGMENT.Edit": "Bearbeiten", "URLSEGMENT.OK": "OK", "URLSEGMENT.Cancel": "Abbrechen", diff --git a/lang/cs.yml b/lang/cs.yml index e3e48c39..8a070f91 100644 --- a/lang/cs.yml +++ b/lang/cs.yml @@ -71,8 +71,6 @@ cs: PUBLISH_PAGES: Zveřejnit RESTORE: Obnovit RESTORED_PAGES: 'Obnoveno %d stránek' - UNPUBLISHED_PAGES: 'Nezveřejněných %d stránek' - UNPUBLISH_PAGES: Nezveřejnit CMSFileAddController: MENUTITLE: Soubory CMSMain: @@ -109,7 +107,6 @@ cs: REMOVED: 'Smazáno ''{title}''{description} z webu' REMOVEDPAGE: 'Odstraněno ''{title}'' ze zveřejněného webu' REMOVEDPAGEFROMDRAFT: 'Odstraněno ''%s'' z konceptu webu' - RESTORE: Obnovit RESTORED: 'Obnoveno ''{title}'' úspěšně' RESTORE_DESC: 'Obnovit archivovanou verzi na koncept' RESTORE_TO_ROOT: 'Obnovit koncept do nejvyšší úrovně' @@ -171,16 +168,8 @@ cs: FILTERLABELTEXT: Obsah CMSSettingsController: MENUTITLE: Možnosti - CMSSiteTreeFilter_ChangedPages: - Title: 'Změnené stránky' - CMSSiteTreeFilter_DeletedPages: - Title: 'Všechny stránky, včetně odstraněných' CMSSiteTreeFilter_Search: Title: 'Všechny stránky' - CMSSiteTreeFilter_StatusDeletedPages: - Title: 'Smazané stránky' - CMSSiteTreeFilter_StatusDraftPages: - Title: 'Koncept nezveřejněných stránek' CMSSiteTreeFilter_StatusRemovedFromDraftPages: Title: 'Živé, ale odstraněno z konceptu' ContentControl: @@ -298,7 +287,6 @@ cs: SilverStripeNavigator: ARCHIVED: Archivováno SilverStripeNavigatorLink: - ShareInstructions: 'K sdílení této stránky, odkaz zkopírujte a vložte dolů..' ShareLink: 'Sdílet odkaz' SilverStripeNavigatorLinkl: CloseLink: Zavřít diff --git a/lang/da.yml b/lang/da.yml index 3abd9b0b..41f90f83 100644 --- a/lang/da.yml +++ b/lang/da.yml @@ -4,7 +4,10 @@ da: ActionAdd: 'Tilføj mappe' AppCategoryArchive: Arkiv AppCategoryAudio: Lyd + AppCategoryDocument: Dokument + AppCategoryFlash: Flash AppCategoryImage: Billeder + AppCategoryVideo: Video BackToFolder: 'Tilbage til mappen' CREATED: Dato CurrentFolderOnly: 'Begræns til den nuværende mappe' @@ -24,6 +27,8 @@ da: Upload: Overfør AssetAdmin_DeleteBatchAction: TITLE: 'Slet mapper' + AssetAdmin_Tools: + FILTER: Filter AssetTableField: BACKLINKCOUNT: 'Brugt på:' PAGES: side(r) @@ -53,6 +58,8 @@ da: CMSAddPageController: Title: 'Tilføj side' CMSBatchActions: + ARCHIVE: Arkiv + ARCHIVED_PAGES: 'Arkiverede %d sider' DELETED_DRAFT_PAGES: 'Slettede %d sider fra kladdesiden, %d fejl' DELETED_PAGES: 'Slettede %d sider fra udgivet webside, %d fejl' DELETE_DRAFT_PAGES: 'Slet fra kladder' @@ -64,6 +71,7 @@ da: CMSMain: ACCESS: 'Adgang til ''{title}'' sektionen' ACCESS_HELP: 'Tillad visning af den sektion, som indeholder sidetræet og indhold. Visnings- og redigeringstilladelser kan håndteres gennem sidespecifikke rullemenuer, såvel som de enkelte "Inholdstilladelser".' + ARCHIVE: Arkiv AddNew: 'Tilføj ny side' AddNewButton: 'Tilføj ny' ChoosePageParentMode: 'Vælg hvor denne side skal oprettes' @@ -152,6 +160,7 @@ da: LOGIN: Log ind LOGOUT: 'Log ud' NOTLOGGEDIN: 'Ikke logget ind' + PUBLISHED: Udgivet PUBLISHEDSITE: 'Udgivet side' Password: Adgangskode UnableDeleteInstall: 'Var ikke i stand til at slette installationsfilerne. Slet venligst filerne herunder manuelt.' @@ -240,6 +249,9 @@ da: APPEARSVIRTUALPAGES: 'Dette indhold er også på de virtuelle sider i {title}sektionerne' BUTTONCANCELDRAFT: 'Annuller ændringer i kladden ' BUTTONCANCELDRAFTDESC: 'Slet kladden og benyt istedet den nuværende side' + BUTTONPUBLISHED: Udgivet + BUTTONSAVED: Gemt + BUTTONSAVEPUBLISH: 'Gem & udgiv' BUTTONUNPUBLISH: Annuller udgivelse BUTTONUNPUBLISHDESC: 'Fjern denne side fra det udgivne websted' Comments: Kommentarer diff --git a/lang/de.yml b/lang/de.yml index 03a760a9..50ab69a8 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -71,6 +71,8 @@ de: PUBLISH_PAGES: Veröffentlichen RESTORE: Wiederherstellen RESTORED_PAGES: '%d Seiten wiederhergestellt' + UNPUBLISHED_PAGES: 'Veröffentlichung von %d Seiten zurückgenommen' + UNPUBLISH_PAGES: Veröffentlichung zurücknehmen CMSFileAddController: MENUTITLE: Dateien CMSMain: @@ -107,6 +109,7 @@ de: REMOVED: 'Lösche ''{title}''{description} von Live Umgebung' REMOVEDPAGE: '''{title}'' wurde von der veröffentlichten Site entfernt' REMOVEDPAGEFROMDRAFT: 'Lösche ''%s'' von der Entwurfs-Site' + RESTORE: Wiederherstellen RESTORED: '''{title}'' wurde wiederhergestellt' RESTORE_DESC: 'Entwurf aus archivierter Version wiederherstellen' RESTORE_TO_ROOT: 'Entwurf in oberster Ebene wiederherstellen' @@ -168,8 +171,16 @@ de: FILTERLABELTEXT: Inhalt CMSSettingsController: MENUTITLE: Einstellungen + CMSSiteTreeFilter_ChangedPages: + Title: 'Geänderte Seiten' + CMSSiteTreeFilter_DeletedPages: + Title: 'Alle Seiten, auch gelöschte' CMSSiteTreeFilter_Search: Title: 'Alle Seiten' + CMSSiteTreeFilter_StatusDeletedPages: + Title: 'Gelöschte Seiten' + CMSSiteTreeFilter_StatusDraftPages: + Title: 'Entwürfe' CMSSiteTreeFilter_StatusRemovedFromDraftPages: Title: 'Veröffentlicht aber aus Entwurf entfernt' ContentControl: @@ -287,6 +298,7 @@ de: SilverStripeNavigator: ARCHIVED: Archiviert SilverStripeNavigatorLink: + ShareInstructions: 'Kopieren Sie den untenstehenden Link um ihn zu teilen.' ShareLink: 'Link teilen' SilverStripeNavigatorLinkl: CloseLink: schließen diff --git a/lang/lt.yml b/lang/lt.yml index a44c258b..65638757 100644 --- a/lang/lt.yml +++ b/lang/lt.yml @@ -172,15 +172,15 @@ lt: CMSSettingsController: MENUTITLE: Nustatymai CMSSiteTreeFilter_ChangedPages: - Title: 'Ištrinti puslapiai' + Title: 'Pakeisti puslapiai' CMSSiteTreeFilter_DeletedPages: - Title: 'Visi puslapiai, kartu su suarchyvuotais' + Title: 'Visi puslapiai, taip pat ir archyvuoti' CMSSiteTreeFilter_Search: Title: 'Visi puslapiai' CMSSiteTreeFilter_StatusDeletedPages: - Title: 'Ištrinti puslapiai' + Title: 'Archyvuoti puslapiai' CMSSiteTreeFilter_StatusDraftPages: - Title: 'Juodraštiniai nepublikuoti puslapiai' + Title: 'Juodraštiniai puslapiai' CMSSiteTreeFilter_StatusRemovedFromDraftPages: Title: 'Publikuotas, bet pašalintas iš juodraščių' ContentControl: @@ -298,7 +298,7 @@ lt: SilverStripeNavigator: ARCHIVED: Archyvuota SilverStripeNavigatorLink: - ShareInstructions: 'Norėdami pasidalinti šiuo puslapiu, nukopijuokite ir įdėkite nuorodą žemiau.' + ShareInstructions: 'Norėdami pasidalinti šiuo puslapiu, kopijuokite žemiau esančią nuorodą.' ShareLink: 'Dalintis nuoroda' SilverStripeNavigatorLinkl: CloseLink: Uždaryti diff --git a/lang/nl.yml b/lang/nl.yml index e2e97fe5..433e9685 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -61,6 +61,7 @@ nl: CMSAddPageController: Title: 'Pagina toevoegen' CMSBatchActions: + ARCHIVE: Archief DELETED_DRAFT_PAGES: '%d pagina''s van de concept-site verwijderd, %d mislukt' DELETED_PAGES: '%d pagina''s van de gepubliceerde site verwijderd, %d mislukt' DELETE_DRAFT_PAGES: 'Verwijder van concept site' @@ -72,6 +73,7 @@ nl: CMSMain: ACCESS: 'Toegang tot het ''{title}'' gedeelte' ACCESS_HELP: 'Bevoegdheid om paginastructuur en inhoud te bekijken. Bekijk- en bewerkingstoestemmingen kunnen worden toegekend met pagina-specifieke menu''s en het aparte "Inhoudsmachtigingen".' + ARCHIVE: Archief AddNew: 'Voeg nieuwe pagina toe' AddNewButton: 'Nieuw' AddPageRestriction: 'Opmerking: Sommige paginatypes zijn niet toegestaan ​​voor deze selectie' diff --git a/lang/sk.yml b/lang/sk.yml index 96b46606..f0c46050 100644 --- a/lang/sk.yml +++ b/lang/sk.yml @@ -71,8 +71,6 @@ sk: PUBLISH_PAGES: Zverejniť RESTORE: Obnoviť RESTORED_PAGES: 'Obnovených %d stránok' - UNPUBLISHED_PAGES: 'Nezverejnených %d stránok' - UNPUBLISH_PAGES: Nezverejniť CMSFileAddController: MENUTITLE: Súbory CMSMain: @@ -109,7 +107,6 @@ sk: REMOVED: 'Smazané ''{title}''{description} z webu' REMOVEDPAGE: 'Smazané ''{title}'' z verejného webu' REMOVEDPAGEFROMDRAFT: 'Odstránené ''%s'' z konceptu webu' - RESTORE: Obnoviť RESTORED: 'Obnovené ''{title}'' úspešne' RESTORE_DESC: 'Obnoviť archivovanú verziu na koncept' RESTORE_TO_ROOT: 'Obnoviť koncept na najvyšiu úroveň' @@ -171,16 +168,8 @@ sk: FILTERLABELTEXT: Obsah CMSSettingsController: MENUTITLE: Nastavenia - CMSSiteTreeFilter_ChangedPages: - Title: 'Zmenené stránky' - CMSSiteTreeFilter_DeletedPages: - Title: 'Všetky stránky, vrátane vymazaných' CMSSiteTreeFilter_Search: Title: 'Všechny stránky' - CMSSiteTreeFilter_StatusDeletedPages: - Title: 'Zmazané stránky' - CMSSiteTreeFilter_StatusDraftPages: - Title: 'Koncept nezverejnených stránok' CMSSiteTreeFilter_StatusRemovedFromDraftPages: Title: 'Živé, ale odstránené z konceptu' ContentControl: @@ -298,7 +287,6 @@ sk: SilverStripeNavigator: ARCHIVED: Archivované SilverStripeNavigatorLink: - ShareInstructions: 'Pre zdielanie tejto stránky, skopírujte a vložte odkaz nižšie.' ShareLink: 'Zdieľať odkaz' SilverStripeNavigatorLinkl: CloseLink: Zavrieť diff --git a/tests/controller/CMSMainTest.php b/tests/controller/CMSMainTest.php index 5ded26aa..8aa99f2d 100644 --- a/tests/controller/CMSMainTest.php +++ b/tests/controller/CMSMainTest.php @@ -9,6 +9,18 @@ class CMSMainTest extends FunctionalTest { static protected $orig = array(); + public function setUp() { + parent::setUp(); + + // Clear automatically created siteconfigs (in case one was created outside of the specified fixtures). + $ids = $this->allFixtureIDs('SiteConfig'); + if($ids) { + foreach(SiteConfig::get()->exclude('ID', $ids) as $config) { + $config->delete(); + } + } + } + function testSiteTreeHints() { $cache = SS_Cache::factory('CMSMain_SiteTreeHints'); // Login as user with root creation privileges @@ -262,16 +274,16 @@ class CMSMainTest extends FunctionalTest { $cmsUser->logIn(); $this->get('admin/pages/add'); $response = $this->post( - 'admin/pages/add/AddForm', - array( - 'ParentID' => '0', - 'PageType' => 'Page', - 'Locale' => 'en_US', - 'action_doAdd' => 1, - 'ajax' => 1, - ), array( - 'X-Pjax' => 'CurrentForm,Breadcrumbs', - ) + 'admin/pages/add/AddForm', + array( + 'ParentID' => '0', + 'PageType' => 'Page', + 'Locale' => 'en_US', + 'action_doAdd' => 1, + 'ajax' => 1, + ), array( + 'X-Pjax' => 'CurrentForm,Breadcrumbs', + ) ); // should redirect, which is a permission error $this->assertEquals(403, $response->getStatusCode(), 'Add TopLevel page must fail for normal user'); @@ -281,16 +293,16 @@ class CMSMainTest extends FunctionalTest { $response = $this->get('admin/pages/add'); $response = $this->post( - 'admin/pages/add/AddForm', - array( - 'ParentID' => '0', - 'PageType' => 'Page', - 'Locale' => 'en_US', - 'action_doAdd' => 1, - 'ajax' => 1, - ), array( - 'X-Pjax' => 'CurrentForm,Breadcrumbs', - ) + 'admin/pages/add/AddForm', + array( + 'ParentID' => '0', + 'PageType' => 'Page', + 'Locale' => 'en_US', + 'action_doAdd' => 1, + 'ajax' => 1, + ), array( + 'X-Pjax' => 'CurrentForm,Breadcrumbs', + ) ); $location = $response->getHeader('X-ControllerURL'); @@ -312,27 +324,60 @@ class CMSMainTest extends FunctionalTest { // Create toplevel page $this->get('admin/pages/add'); $response = $this->post( - 'admin/pages/add/AddForm', - array('ParentID' => '0', 'PageType' => 'CMSMainTest_ClassA', 'Locale' => 'en_US', 'action_doAdd' => 1) + 'admin/pages/add/AddForm', + array( + 'ParentID' => '0', + 'PageType' => 'CMSMainTest_ClassA', + 'Locale' => 'en_US', + 'action_doAdd' => 1, + 'ajax' => 1 + ), array( + 'X-Pjax' => 'CurrentForm,Breadcrumbs', + ) ); $this->assertFalse($response->isError()); - preg_match('/edit\/show\/(\d*)/', $response->getHeader('Location'), $matches); + $ok = preg_match('/edit\/show\/(\d*)/', $response->getHeader('X-ControllerURL'), $matches); + $this->assertNotEmpty($ok); $newPageId = $matches[1]; // Create allowed child $this->get('admin/pages/add'); $response = $this->post( - 'admin/pages/add/AddForm', - array('ParentID' => $newPageId, 'PageType' => 'CMSMainTest_ClassB', 'Locale' => 'en_US', 'action_doAdd' => 1) + 'admin/pages/add/AddForm', + array( + 'ParentID' => $newPageId, + 'PageType' => 'CMSMainTest_ClassB', + 'Locale' => 'en_US', + 'action_doAdd' => 1, + 'ajax' => 1 + ), array( + 'X-Pjax' => 'CurrentForm,Breadcrumbs', + ) ); $this->assertFalse($response->isError()); - $this->assertNull($response->getBody()); + $this->assertEmpty($response->getBody()); + + // Verify that the page was created and redirected to accurately + $newerPage = SiteTree::get()->byID($newPageId)->AllChildren()->first(); + $this->assertNotEmpty($newerPage); + $ok = preg_match('/edit\/show\/(\d*)/', $response->getHeader('X-ControllerURL'), $matches); + $this->assertNotEmpty($ok); + $newerPageID = $matches[1]; + $this->assertEquals($newerPage->ID, $newerPageID); // Create disallowed child $this->get('admin/pages/add'); $response = $this->post( - 'admin/pages/add/AddForm', - array('ParentID' => $newPageId, 'PageType' => 'Page', 'Locale' => 'en_US', 'action_doAdd' => 1) + 'admin/pages/add/AddForm', + array( + 'ParentID' => $newPageId, + 'PageType' => 'Page', + 'Locale' => 'en_US', + 'action_doAdd' => 1, + 'ajax' => 1 + ), array( + 'X-Pjax' => 'CurrentForm,Breadcrumbs', + ) ); $this->assertEquals(403, $response->getStatusCode(), 'Add disallowed child should fail'); diff --git a/tests/controller/CMSMainTest.yml b/tests/controller/CMSMainTest.yml index f2883b39..676f7686 100644 --- a/tests/controller/CMSMainTest.yml +++ b/tests/controller/CMSMainTest.yml @@ -1,142 +1,142 @@ Page: - page1: - Title: Page 1 - Sort: 1 - page2: - Title: Page 2 - Sort: 2 - page3: - Title: Page 3 - Sort: 3 - page31: - Title: Page 3.1 - Parent: =>Page.page3 - Sort: 1 - page32: - Title: Page 3.2 - Parent: =>Page.page3 - Sort: 2 - page4: - Title: Page 4 - Sort: 4 - page5: - Title: Page 5 - Sort: 5 - page6: - Title: Page 6 - Sort: 6 - page7: - Title: Page 7 - Sort: 7 - page8: - Title: Page 8 - Sort: 8 - page9: - Title: Page 9 - Sort: 9 - page10: - Title: Page 10 - Sort: 10 - page11: - Title: Page 11 - Sort: 11 - page12: - Title: Page 12 - Sort: 12 - page13: - Title: Page 13 - Sort: 13 - page14: - Title: Page 14 - Sort: 14 - page15: - Title: Page 15 - Sort: 15 - page16: - Title: Page 16 - Sort: 16 - page17: - Title: Page 17 - Sort: 17 - page18: - Title: Page 18 - Sort: 18 - page19: - Title: Page 19 - Sort: 19 - page20: - Title: Page 20 - Sort: 20 - page21: - Title: Page 21 - Sort: 21 - page22: - Title: Page 22 - Sort: 22 - page23: - Title: Page 23 - Sort: 23 - page24: - Title: Page 24 - Sort: 24 - page25: - Title: Page 25 - Sort: 25 - page26: - Title: Page 26 - Sort: 26 - home: - Title: Home - URLSegment: home - Sort: 27 + page1: + Title: Page 1 + Sort: 1 + page2: + Title: Page 2 + Sort: 2 + page3: + Title: Page 3 + Sort: 3 + page31: + Title: Page 3.1 + Parent: =>Page.page3 + Sort: 1 + page32: + Title: Page 3.2 + Parent: =>Page.page3 + Sort: 2 + page4: + Title: Page 4 + Sort: 4 + page5: + Title: Page 5 + Sort: 5 + page6: + Title: Page 6 + Sort: 6 + page7: + Title: Page 7 + Sort: 7 + page8: + Title: Page 8 + Sort: 8 + page9: + Title: Page 9 + Sort: 9 + page10: + Title: Page 10 + Sort: 10 + page11: + Title: Page 11 + Sort: 11 + page12: + Title: Page 12 + Sort: 12 + page13: + Title: Page 13 + Sort: 13 + page14: + Title: Page 14 + Sort: 14 + page15: + Title: Page 15 + Sort: 15 + page16: + Title: Page 16 + Sort: 16 + page17: + Title: Page 17 + Sort: 17 + page18: + Title: Page 18 + Sort: 18 + page19: + Title: Page 19 + Sort: 19 + page20: + Title: Page 20 + Sort: 20 + page21: + Title: Page 21 + Sort: 21 + page22: + Title: Page 22 + Sort: 22 + page23: + Title: Page 23 + Sort: 23 + page24: + Title: Page 24 + Sort: 24 + page25: + Title: Page 25 + Sort: 25 + page26: + Title: Page 26 + Sort: 26 + home: + Title: Home + URLSegment: home + Sort: 27 Group: - admin: - Title: Administrators - empty: - Title: Empty Group - assetsonly: - Title: assetsonly - allcmssections: - Title: allcmssections - rooteditusers: - Title: rooteditusers + admin: + Title: Administrators + empty: + Title: Empty Group + assetsonly: + Title: assetsonly + allcmssections: + Title: allcmssections + rooteditusers: + Title: rooteditusers Member: - admin: - Email: admin@example.com - Password: ZXXlkwecxz2390232233 - Groups: =>Group.admin - assetsonlyuser: - Email: assetsonlyuser@test.com - Groups: =>Group.assetsonly - allcmssectionsuser: - Email: allcmssectionsuser@test.com - Groups: =>Group.allcmssections - rootedituser: - Email: rootedituser@test.com - Groups: =>Group.rooteditusers + admin: + Email: admin@example.com + Password: ZXXlkwecxz2390232233 + Groups: =>Group.admin + assetsonlyuser: + Email: assetsonlyuser@test.com + Groups: =>Group.assetsonly + allcmssectionsuser: + Email: allcmssectionsuser@test.com + Groups: =>Group.allcmssections + rootedituser: + Email: rootedituser@test.com + Groups: =>Group.rooteditusers Permission: - admin: - Code: ADMIN - GroupID: =>Group.admin - assetsonly: - Code: CMS_ACCESS_AssetAdmin - GroupID: =>Group.assetsonly - allcmssections: - Code: CMS_ACCESS_LeftAndMain - GroupID: =>Group.allcmssections - allcmssections2: - Code: CMS_ACCESS_LeftAndMain - GroupID: =>Group.rooteditusers + admin: + Code: ADMIN + GroupID: =>Group.admin + assetsonly: + Code: CMS_ACCESS_AssetAdmin + GroupID: =>Group.assetsonly + allcmssections: + Code: CMS_ACCESS_LeftAndMain + GroupID: =>Group.allcmssections + allcmssections2: + Code: CMS_ACCESS_LeftAndMain + GroupID: =>Group.rooteditusers SiteConfig: - siteconfig1: - EditorGroups: =>Group.rooteditusers - CanCreateTopLevelType: 'OnlyTheseUsers' + siteconfig1: + EditorGroups: =>Group.rooteditusers + CanCreateTopLevelType: 'OnlyTheseUsers' SiteConfig_CreateTopLevelGroups: - createtoplevelgroups1: - SiteConfigID: =>SiteConfig.siteconfig1 - GroupID: =>Group.rooteditusers + createtoplevelgroups1: + SiteConfigID: =>SiteConfig.siteconfig1 + GroupID: =>Group.rooteditusers RedirectorPage: - page5: - Title: Page 5 - RedirectionType: External - ExternalURL: http://www.google.com + page5: + Title: Page 5 + RedirectionType: External + ExternalURL: http://www.google.com diff --git a/tests/model/VirtualPageTest.php b/tests/model/VirtualPageTest.php index 1a764a84..6e8fafaa 100644 --- a/tests/model/VirtualPageTest.php +++ b/tests/model/VirtualPageTest.php @@ -1,7 +1,9 @@ logInWithPermission("ADMIN"); + $this->origInitiallyCopiedFields = VirtualPage::config()->initially_copied_fields; Config::inst()->remove('VirtualPage', 'initially_copied_fields'); VirtualPage::config()->initially_copied_fields = array_merge( @@ -644,6 +649,24 @@ class VirtualPageTest extends SapphireTest { if(!$isDetected) $this->fail("Shouldn't be allowed to write a VirtualPage that links to a disallowed child"); } + + public function testVirtualPagePointingToRedirectorPage() { + if (!class_exists('RedirectorPage')) { + $this->markTestSkipped('RedirectorPage required'); + } + + $rp = new RedirectorPage(array('ExternalURL' => 'http://google.com', 'RedirectionType' => 'External')); + $rp->write(); + $rp->doPublish(); + + $vp = new VirtualPage(array('URLSegment' => 'vptest', 'CopyContentFromID' => $rp->ID)); + $vp->write(); + $vp->doPublish(); + + $response = $this->get($vp->Link()); + $this->assertEquals(301, $response->getStatusCode()); + $this->assertEquals('http://google.com', $response->getHeader('Location')); + } } class VirtualPageTest_ClassA extends Page implements TestOnly { diff --git a/tests/reports/CmsReportsTest.php b/tests/reports/CmsReportsTest.php index 25b14c83..3e8b713b 100644 --- a/tests/reports/CmsReportsTest.php +++ b/tests/reports/CmsReportsTest.php @@ -37,15 +37,13 @@ class CmsReportsTest extends SapphireTest { $class = get_class($report); // ASSERT that the "draft" report is returning the correct results. - - $results = count($report->sourceRecords(array())) > 0; + $parameters = array('CheckSite' => 'Draft'); + $results = count($report->sourceRecords($parameters, null, null)) > 0; $isDraftBroken ? $this->assertTrue($results, "{$class} has NOT returned the correct DRAFT results, as NO pages were found.") : $this->assertFalse($results, "{$class} has NOT returned the correct DRAFT results, as pages were found."); // ASSERT that the "published" report is returning the correct results. - - $results = count($report->sourceRecords(array( - 'OnLive' => 1 - ))) > 0; + $parameters = array('CheckSite' => 'Published', 'OnLive' => 1); + $results = count($report->sourceRecords($parameters, null, null)) > 0; $isPublishedBroken ? $this->assertTrue($results, "{$class} has NOT returned the correct PUBLISHED results, as NO pages were found.") : $this->assertFalse($results, "{$class} has NOT returned the correct PUBLISHED results, as pages were found."); } @@ -82,49 +80,50 @@ class CmsReportsTest extends SapphireTest { $reports = SS_Report::get_reports(); $brokenLinksReport = null; foreach($reports as $report) { - if($report instanceof SideReport_BrokenLinks) { + if($report instanceof BrokenLinksReport) { $brokenLinksReport = $report; break; } } // Determine that the report exists, otherwise it has been excluded. - - if($brokenLinksReport) { - - // ASSERT that the "draft" report has detected the page having a broken link. - // ASSERT that the "published" report has NOT detected the page having a broken link, as the page has not been "published" yet. - - $this->isReportBroken($brokenLinksReport, true, false); - - // Make sure the page is now "published". - - $page->writeToStage('Live'); - - // ASSERT that the "draft" report has detected the page having a broken link. - // ASSERT that the "published" report has detected the page having a broken link. - - $this->isReportBroken($brokenLinksReport, true, true); - - // Correct the "draft" broken link. - - $page->Content = str_replace('987654321', $page->ID, $page->Content); - $page->writeToStage('Stage'); - - // ASSERT that the "draft" report has NOT detected the page having a broken link. - // ASSERT that the "published" report has detected the page having a broken link, as the previous content remains "published". - - $this->isReportBroken($brokenLinksReport, false, true); - - // Make sure the change has now been "published". - - $page->writeToStage('Live'); - - // ASSERT that the "draft" report has NOT detected the page having a broken link. - // ASSERT that the "published" report has NOT detected the page having a broken link. - - $this->isReportBroken($brokenLinksReport, false, false); + if(!$brokenLinksReport){ + $this->markTestSkipped('BrokenLinksReport is not an available report'); + return; } + + // ASSERT that the "draft" report has detected the page having a broken link. + // ASSERT that the "published" report has NOT detected the page having a broken link, as the page has not been "published" yet. + + $this->isReportBroken($brokenLinksReport, true, false); + + // Make sure the page is now "published". + + $page->writeToStage('Live'); + + // ASSERT that the "draft" report has detected the page having a broken link. + // ASSERT that the "published" report has detected the page having a broken link. + + $this->isReportBroken($brokenLinksReport, true, true); + + // Correct the "draft" broken link. + + $page->Content = str_replace('987654321', $page->ID, $page->Content); + $page->writeToStage('Stage'); + + // ASSERT that the "draft" report has NOT detected the page having a broken link. + // ASSERT that the "published" report has detected the page having a broken link, as the previous content remains "published". + + $this->isReportBroken($brokenLinksReport, false, true); + + // Make sure the change has now been "published". + + $page->writeToStage('Live'); + + // ASSERT that the "draft" report has NOT detected the page having a broken link. + // ASSERT that the "published" report has NOT detected the page having a broken link. + + $this->isReportBroken($brokenLinksReport, false, false); } /** @@ -144,52 +143,53 @@ class CmsReportsTest extends SapphireTest { $reports = SS_Report::get_reports(); $brokenFilesReport = null; foreach($reports as $report) { - if($report instanceof SideReport_BrokenFiles) { + if($report instanceof BrokenFilesReport) { $brokenFilesReport = $report; break; } } // Determine that the report exists, otherwise it has been excluded. - - if($brokenFilesReport) { - - // ASSERT that the "draft" report has detected the page having a broken file. - // ASSERT that the "published" report has NOT detected the page having a broken file, as the page has not been "published" yet. - - $this->isReportBroken($brokenFilesReport, true, false); - - // Make sure the page is now "published". - - $page->writeToStage('Live'); - - // ASSERT that the "draft" report has detected the page having a broken file. - // ASSERT that the "published" report has detected the page having a broken file. - - $this->isReportBroken($brokenFilesReport, true, true); - - // Correct the "draft" broken file. - - $file = File::create(); - $file->Filename = 'name.pdf'; - $file->write(); - $page->Content = str_replace('987654321', $file->ID, $page->Content); - $page->writeToStage('Stage'); - - // ASSERT that the "draft" report has NOT detected the page having a broken file. - // ASSERT that the "published" report has detected the page having a broken file, as the previous content remains "published". - - $this->isReportBroken($brokenFilesReport, false, true); - - // Make sure the change has now been "published". - - $page->writeToStage('Live'); - - // ASSERT that the "draft" report has NOT detected the page having a broken file. - // ASSERT that the "published" report has NOT detected the page having a broken file. - - $this->isReportBroken($brokenFilesReport, false, false); + if(!$brokenFilesReport){ + $this->markTestSkipped('BrokenFilesReport is not an available report'); + return; } + + // ASSERT that the "draft" report has detected the page having a broken file. + // ASSERT that the "published" report has NOT detected the page having a broken file, as the page has not been "published" yet. + + $this->isReportBroken($brokenFilesReport, true, false); + + // Make sure the page is now "published". + + $page->writeToStage('Live'); + + // ASSERT that the "draft" report has detected the page having a broken file. + // ASSERT that the "published" report has detected the page having a broken file. + + $this->isReportBroken($brokenFilesReport, true, true); + + // Correct the "draft" broken file. + + $file = File::create(); + $file->Filename = 'name.pdf'; + $file->write(); + $page->Content = str_replace('987654321', $file->ID, $page->Content); + $page->writeToStage('Stage'); + + // ASSERT that the "draft" report has NOT detected the page having a broken file. + // ASSERT that the "published" report has detected the page having a broken file, as the previous content remains "published". + + $this->isReportBroken($brokenFilesReport, false, true); + + // Make sure the change has now been "published". + + $page->writeToStage('Live'); + + // ASSERT that the "draft" report has NOT detected the page having a broken file. + // ASSERT that the "published" report has NOT detected the page having a broken file. + + $this->isReportBroken($brokenFilesReport, false, false); } /** @@ -209,53 +209,54 @@ class CmsReportsTest extends SapphireTest { $reports = SS_Report::get_reports(); $brokenVirtualPagesReport = null; foreach($reports as $report) { - if($report instanceof SideReport_BrokenVirtualPages) { + if($report instanceof BrokenVirtualPagesReport) { $brokenVirtualPagesReport = $report; break; } } // Determine that the report exists, otherwise it has been excluded. - - if($brokenVirtualPagesReport) { - - // ASSERT that the "draft" report has detected the page having a broken link. - // ASSERT that the "published" report has NOT detected the page having a broken link, as the page has not been "published" yet. - - $this->isReportBroken($brokenVirtualPagesReport, true, false); - - // Make sure the page is now "published". - - $page->writeToStage('Live'); - - // ASSERT that the "draft" report has detected the page having a broken link. - // ASSERT that the "published" report has detected the page having a broken link. - - $this->isReportBroken($brokenVirtualPagesReport, true, true); - - // Correct the "draft" broken link. - - $contentPage = Page::create(); - $contentPage->Content = 'This is some content.'; - $contentPage->writeToStage('Stage'); - $contentPage->writeToStage('Live'); - $page->CopyContentFromID = $contentPage->ID; - $page->writeToStage('Stage'); - - // ASSERT that the "draft" report has NOT detected the page having a broken link. - // ASSERT that the "published" report has detected the page having a broken link, as the previous content remains "published". - - $this->isReportBroken($brokenVirtualPagesReport, false, true); - - // Make sure the change has now been "published". - - $page->writeToStage('Live'); - - // ASSERT that the "draft" report has NOT detected the page having a broken link. - // ASSERT that the "published" report has NOT detected the page having a broken link. - - $this->isReportBroken($brokenVirtualPagesReport, false, false); + if(!$brokenVirtualPagesReport){ + $this->markTestSkipped('BrokenFilesReport is not an available report'); + return; } + + // ASSERT that the "draft" report has detected the page having a broken link. + // ASSERT that the "published" report has NOT detected the page having a broken link, as the page has not been "published" yet. + + $this->isReportBroken($brokenVirtualPagesReport, true, false); + + // Make sure the page is now "published". + + $page->writeToStage('Live'); + + // ASSERT that the "draft" report has detected the page having a broken link. + // ASSERT that the "published" report has detected the page having a broken link. + + $this->isReportBroken($brokenVirtualPagesReport, true, true); + + // Correct the "draft" broken link. + + $contentPage = Page::create(); + $contentPage->Content = 'This is some content.'; + $contentPage->writeToStage('Stage'); + $contentPage->writeToStage('Live'); + $page->CopyContentFromID = $contentPage->ID; + $page->writeToStage('Stage'); + + // ASSERT that the "draft" report has NOT detected the page having a broken link. + // ASSERT that the "published" report has detected the page having a broken link, as the previous content remains "published". + + $this->isReportBroken($brokenVirtualPagesReport, false, true); + + // Make sure the change has now been "published". + + $page->writeToStage('Live'); + + // ASSERT that the "draft" report has NOT detected the page having a broken link. + // ASSERT that the "published" report has NOT detected the page having a broken link. + + $this->isReportBroken($brokenVirtualPagesReport, false, false); } /** @@ -276,53 +277,54 @@ class CmsReportsTest extends SapphireTest { $reports = SS_Report::get_reports(); $brokenRedirectorPagesReport = null; foreach($reports as $report) { - if($report instanceof SideReport_BrokenRedirectorPages) { + if($report instanceof BrokenRedirectorPagesReport) { $brokenRedirectorPagesReport = $report; break; } } // Determine that the report exists, otherwise it has been excluded. - - if($brokenRedirectorPagesReport) { - - // ASSERT that the "draft" report has detected the page having a broken link. - // ASSERT that the "published" report has NOT detected the page having a broken link, as the page has not been "published" yet. - - $this->isReportBroken($brokenRedirectorPagesReport, true, false); - - // Make sure the page is now "published". - - $page->writeToStage('Live'); - - // ASSERT that the "draft" report has detected the page having a broken link. - // ASSERT that the "published" report has detected the page having a broken link. - - $this->isReportBroken($brokenRedirectorPagesReport, true, true); - - // Correct the "draft" broken link. - - $contentPage = Page::create(); - $contentPage->Content = 'This is some content.'; - $contentPage->writeToStage('Stage'); - $contentPage->writeToStage('Live'); - $page->LinkToID = $contentPage->ID; - $page->writeToStage('Stage'); - - // ASSERT that the "draft" report has NOT detected the page having a broken link. - // ASSERT that the "published" report has detected the page having a broken link, as the previous content remains "published". - - $this->isReportBroken($brokenRedirectorPagesReport, false, true); - - // Make sure the change has now been "published". - - $page->writeToStage('Live'); - - // ASSERT that the "draft" report has NOT detected the page having a broken link. - // ASSERT that the "published" report has NOT detected the page having a broken link. - - $this->isReportBroken($brokenRedirectorPagesReport, false, false); + if(!$brokenRedirectorPagesReport){ + $this->markTestSkipped('BrokenRedirectorPagesReport is not an available report'); + return; } + + // ASSERT that the "draft" report has detected the page having a broken link. + // ASSERT that the "published" report has NOT detected the page having a broken link, as the page has not been "published" yet. + + $this->isReportBroken($brokenRedirectorPagesReport, true, false); + + // Make sure the page is now "published". + + $page->writeToStage('Live'); + + // ASSERT that the "draft" report has detected the page having a broken link. + // ASSERT that the "published" report has detected the page having a broken link. + + $this->isReportBroken($brokenRedirectorPagesReport, true, true); + + // Correct the "draft" broken link. + + $contentPage = Page::create(); + $contentPage->Content = 'This is some content.'; + $contentPage->writeToStage('Stage'); + $contentPage->writeToStage('Live'); + $page->LinkToID = $contentPage->ID; + $page->writeToStage('Stage'); + + // ASSERT that the "draft" report has NOT detected the page having a broken link. + // ASSERT that the "published" report has detected the page having a broken link, as the previous content remains "published". + + $this->isReportBroken($brokenRedirectorPagesReport, false, true); + + // Make sure the change has now been "published". + + $page->writeToStage('Live'); + + // ASSERT that the "draft" report has NOT detected the page having a broken link. + // ASSERT that the "published" report has NOT detected the page having a broken link. + + $this->isReportBroken($brokenRedirectorPagesReport, false, false); } }