Merge remote-tracking branch 'origin/3.2' into 3

This commit is contained in:
Damian Mooyman 2015-12-22 14:10:52 +13:00
commit 15685d85ab
19 changed files with 546 additions and 406 deletions

View File

@ -413,7 +413,7 @@ class VirtualPage extends Page {
public function __get($field) { public function __get($field) {
if(parent::hasMethod($funcName = "get$field")) { if(parent::hasMethod($funcName = "get$field")) {
return $this->$funcName(); return $this->$funcName();
} else if(parent::hasField($field)) { } else if(parent::hasField($field) || ($field === 'ID' && !$this->exists())) {
return $this->getField($field); return $this->getField($field);
} else { } else {
return $this->copyContentFrom()->$field; return $this->copyContentFrom()->$field;
@ -563,12 +563,17 @@ class VirtualPage_Controller extends Page_Controller {
} catch (Exception $e) { } catch (Exception $e) {
// Hack... detect exception type. We really should use exception subclasses. // Hack... detect exception type. We really should use exception subclasses.
// if the exception isn't a 'no method' error, rethrow it // 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(); $original = $this->copyContentFrom();
$originalClass = get_class($original); $controller = ModelAsController::controller_for($original);
if ($originalClass == 'SiteTree') $name = 'ContentController';
else $name = $originalClass."_Controller"; // Ensure request/response data is available on virtual controller
$controller = new $name($this->dataRecord->copyContentFrom()); $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); return call_user_func_array(array($controller, $method), $args);
} }
} }

View File

@ -16,16 +16,18 @@ class BrokenFilesReport extends SS_Report {
public function sourceRecords($params = null) { public function sourceRecords($params = null) {
// Get class names for page types that are not virtual pages or redirector pages // 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)."'"; $stage = isset($params['OnLive']) ? 'Live' : 'Stage';
return Versioned::get_by_stage('SiteTree', $stage, $classFilter);
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;
} }
public function columns() { public function columns() {
@ -42,4 +44,14 @@ class BrokenFilesReport extends SS_Report {
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site')) new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
); );
} }
} }
/**
* @deprecated 3.2..4.0
*/
class SideReport_BrokenFiles extends BrokenFilesReport {
public function __construct() {
Deprecation::notice('4.0', 'Use BrokenFilesReport instead');
parent::__construct();
}
}

View File

@ -29,14 +29,14 @@ class BrokenLinksReport extends SS_Report {
$sort = ''; $sort = '';
} }
} }
if (!isset($_REQUEST['CheckSite']) || $params['CheckSite'] == 'Published') { $brokenFilter = array(
$ret = Versioned::get_by_stage('SiteTree', 'Live', array( '"SiteTree"."HasBrokenLink" = ? OR "SiteTree"."HasBrokenFile" = ?' => array(true, true)
'"SiteTree"."HasBrokenLink" = ? OR "SiteTree"."HasBrokenFile" = ?' => array(true, true) );
), $sort, $join, $limit); $isLive = !isset($params['CheckSite']) || $params['CheckSite'] == 'Published';
if ($isLive) {
$ret = Versioned::get_by_stage('SiteTree', 'Live', $brokenFilter, $sort, $join, $limit);
} else { } else {
$ret = DataObject::get('SiteTree', array( $ret = DataObject::get('SiteTree', $brokenFilter, $sort, $join, $limit);
'"SiteTree"."HasBrokenFile" = ? OR "SiteTree"."HasBrokenLink" = ?' => array(true, true)
), $sort, $join, $limit);
} }
$returnSet = new ArrayList(); $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();
}
}

View File

@ -15,11 +15,13 @@ class BrokenRedirectorPagesReport extends SS_Report {
} }
public function sourceRecords($params = null) { public function sourceRecords($params = null) {
$classNames = "'".join("','", ClassInfo::subclassesFor('RedirectorPage'))."'"; $classes = ClassInfo::subclassesFor('RedirectorPage');
$classParams = DB::placeholders($classes);
if (isset($_REQUEST['OnLive'])) $ret = Versioned::get_by_stage('SiteTree', 'Live', "\"ClassName\" IN ($classNames) AND \"HasBrokenLink\" = 1"); $classFilter = array(
else $ret = DataObject::get('SiteTree', "\"ClassName\" IN ($classNames) AND \"HasBrokenLink\" = 1"); "\"ClassName\" IN ($classParams) AND \"HasBrokenLink\" = 1" => $classes
return $ret; );
$stage = isset($params['OnLive']) ? 'Live' : 'Stage';
return Versioned::get_by_stage('SiteTree', $stage, $classFilter);
} }
public function columns() { 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();
}
}

View File

@ -15,15 +15,13 @@ class BrokenVirtualPagesReport extends SS_Report {
} }
public function sourceRecords($params = null) { public function sourceRecords($params = null) {
$classNames = "'".join("','", ClassInfo::subclassesFor('VirtualPage'))."'"; $classes = ClassInfo::subclassesFor('VirtualPage');
$classParams = DB::placeholders($classes);
if (isset($_REQUEST['OnLive'])) { $classFilter = array(
$ret = Versioned::get_by_stage('SiteTree', 'Live', "\"ClassName\" IN ($classNames) AND \"HasBrokenLink\" = 1"); "\"ClassName\" IN ($classParams) AND \"HasBrokenLink\" = 1" => $classes
} else { );
$ret = DataObject::get('SiteTree', "\"ClassName\" IN ($classNames) AND \"HasBrokenLink\" = 1"); $stage = isset($params['OnLive']) ? 'Live' : 'Stage';
} return Versioned::get_by_stage('SiteTree', $stage, $classFilter);
return $ret;
} }
public function columns() { public function columns() {
@ -40,4 +38,14 @@ class BrokenVirtualPagesReport extends SS_Report {
new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site')) new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site'))
); );
} }
} }
/**
* @deprecated 3.2..4.0
*/
class SideReport_BrokenVirtualPages extends BrokenVirtualPagesReport {
public function __construct() {
Deprecation::notice('4.0', 'Use BrokenVirtualPagesReport instead');
parent::__construct();
}
}

View File

@ -32,4 +32,14 @@ class EmptyPagesReport extends SS_Report {
), ),
); );
} }
} }
/**
* @deprecated 3.2..4.0
*/
class SideReport_EmptyPages extends EmptyPagesReport {
public function __construct() {
Deprecation::notice('4.0', 'Use EmptyPagesReport instead');
parent::__construct();
}
}

View File

@ -31,4 +31,14 @@ class RecentlyEditedReport extends SS_Report {
), ),
); );
} }
} }
/**
* @deprecated 3.2..4.0
*/
class SideReport_RecentlyEdited extends RecentlyEditedReport {
public function __construct() {
Deprecation::notice('4.0', 'Use RecentlyEditedReport instead');
parent::__construct();
}
}

View File

@ -36,13 +36,13 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
"Tree.ThisPageOnly": "Nur diese Seite", "Tree.ThisPageOnly": "Nur diese Seite",
"Tree.ThisPageAndSubpages": "Diese Seite und Unterseiten", "Tree.ThisPageAndSubpages": "Diese Seite und Unterseiten",
"Tree.ShowAsList": "Kinder als LIste zeigen", "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.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.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": "Are you sure you want to restore this page from archive?", "CMSMain.Restore": "Sind Sie sicher, dass Sie diese Seite aus dem Archiv wiederherstellen wollen?",
"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.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": "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.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": "Are you sure you want to remove your page from the draft site?\n\nThis page will remain on the published site.", "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.Edit": "Bearbeiten",
"URLSEGMENT.OK": "OK", "URLSEGMENT.OK": "OK",
"URLSEGMENT.Cancel": "Abbrechen", "URLSEGMENT.Cancel": "Abbrechen",

View File

@ -31,13 +31,13 @@
"Tree.ThisPageOnly": "Nur diese Seite", "Tree.ThisPageOnly": "Nur diese Seite",
"Tree.ThisPageAndSubpages": "Diese Seite und Unterseiten", "Tree.ThisPageAndSubpages": "Diese Seite und Unterseiten",
"Tree.ShowAsList": "Kinder als LIste zeigen", "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.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.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": "Are you sure you want to restore this page from archive?", "CMSMain.Restore": "Sind Sie sicher, dass Sie diese Seite aus dem Archiv wiederherstellen wollen?",
"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.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": "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.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": "Are you sure you want to remove your page from the draft site?\n\nThis page will remain on the published site.", "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.Edit": "Bearbeiten",
"URLSEGMENT.OK": "OK", "URLSEGMENT.OK": "OK",
"URLSEGMENT.Cancel": "Abbrechen", "URLSEGMENT.Cancel": "Abbrechen",

View File

@ -71,8 +71,6 @@ cs:
PUBLISH_PAGES: Zveřejnit PUBLISH_PAGES: Zveřejnit
RESTORE: Obnovit RESTORE: Obnovit
RESTORED_PAGES: 'Obnoveno %d stránek' RESTORED_PAGES: 'Obnoveno %d stránek'
UNPUBLISHED_PAGES: 'Nezveřejněných %d stránek'
UNPUBLISH_PAGES: Nezveřejnit
CMSFileAddController: CMSFileAddController:
MENUTITLE: Soubory MENUTITLE: Soubory
CMSMain: CMSMain:
@ -109,7 +107,6 @@ cs:
REMOVED: 'Smazáno ''{title}''{description} z webu' REMOVED: 'Smazáno ''{title}''{description} z webu'
REMOVEDPAGE: 'Odstraněno ''{title}'' ze zveřejněného webu' REMOVEDPAGE: 'Odstraněno ''{title}'' ze zveřejněného webu'
REMOVEDPAGEFROMDRAFT: 'Odstraněno ''%s'' z konceptu webu' REMOVEDPAGEFROMDRAFT: 'Odstraněno ''%s'' z konceptu webu'
RESTORE: Obnovit
RESTORED: 'Obnoveno ''{title}'' úspěšně' RESTORED: 'Obnoveno ''{title}'' úspěšně'
RESTORE_DESC: 'Obnovit archivovanou verzi na koncept' RESTORE_DESC: 'Obnovit archivovanou verzi na koncept'
RESTORE_TO_ROOT: 'Obnovit koncept do nejvyšší úrovně' RESTORE_TO_ROOT: 'Obnovit koncept do nejvyšší úrovně'
@ -171,16 +168,8 @@ cs:
FILTERLABELTEXT: Obsah FILTERLABELTEXT: Obsah
CMSSettingsController: CMSSettingsController:
MENUTITLE: Možnosti MENUTITLE: Možnosti
CMSSiteTreeFilter_ChangedPages:
Title: 'Změnené stránky'
CMSSiteTreeFilter_DeletedPages:
Title: 'Všechny stránky, včetně odstraněných'
CMSSiteTreeFilter_Search: CMSSiteTreeFilter_Search:
Title: 'Všechny stránky' Title: 'Všechny stránky'
CMSSiteTreeFilter_StatusDeletedPages:
Title: 'Smazané stránky'
CMSSiteTreeFilter_StatusDraftPages:
Title: 'Koncept nezveřejněných stránek'
CMSSiteTreeFilter_StatusRemovedFromDraftPages: CMSSiteTreeFilter_StatusRemovedFromDraftPages:
Title: 'Živé, ale odstraněno z konceptu' Title: 'Živé, ale odstraněno z konceptu'
ContentControl: ContentControl:
@ -298,7 +287,6 @@ cs:
SilverStripeNavigator: SilverStripeNavigator:
ARCHIVED: Archivováno ARCHIVED: Archivováno
SilverStripeNavigatorLink: SilverStripeNavigatorLink:
ShareInstructions: 'K sdílení této stránky, odkaz zkopírujte a vložte dolů..'
ShareLink: 'Sdílet odkaz' ShareLink: 'Sdílet odkaz'
SilverStripeNavigatorLinkl: SilverStripeNavigatorLinkl:
CloseLink: Zavřít CloseLink: Zavřít

View File

@ -4,7 +4,10 @@ da:
ActionAdd: 'Tilføj mappe' ActionAdd: 'Tilføj mappe'
AppCategoryArchive: Arkiv AppCategoryArchive: Arkiv
AppCategoryAudio: Lyd AppCategoryAudio: Lyd
AppCategoryDocument: Dokument
AppCategoryFlash: Flash
AppCategoryImage: Billeder AppCategoryImage: Billeder
AppCategoryVideo: Video
BackToFolder: 'Tilbage til mappen' BackToFolder: 'Tilbage til mappen'
CREATED: Dato CREATED: Dato
CurrentFolderOnly: 'Begræns til den nuværende mappe' CurrentFolderOnly: 'Begræns til den nuværende mappe'
@ -24,6 +27,8 @@ da:
Upload: Overfør Upload: Overfør
AssetAdmin_DeleteBatchAction: AssetAdmin_DeleteBatchAction:
TITLE: 'Slet mapper' TITLE: 'Slet mapper'
AssetAdmin_Tools:
FILTER: Filter
AssetTableField: AssetTableField:
BACKLINKCOUNT: 'Brugt på:' BACKLINKCOUNT: 'Brugt på:'
PAGES: side(r) PAGES: side(r)
@ -53,6 +58,8 @@ da:
CMSAddPageController: CMSAddPageController:
Title: 'Tilføj side' Title: 'Tilføj side'
CMSBatchActions: CMSBatchActions:
ARCHIVE: Arkiv
ARCHIVED_PAGES: 'Arkiverede %d sider'
DELETED_DRAFT_PAGES: 'Slettede %d sider fra kladdesiden, %d fejl' DELETED_DRAFT_PAGES: 'Slettede %d sider fra kladdesiden, %d fejl'
DELETED_PAGES: 'Slettede %d sider fra udgivet webside, %d fejl' DELETED_PAGES: 'Slettede %d sider fra udgivet webside, %d fejl'
DELETE_DRAFT_PAGES: 'Slet fra kladder' DELETE_DRAFT_PAGES: 'Slet fra kladder'
@ -64,6 +71,7 @@ da:
CMSMain: CMSMain:
ACCESS: 'Adgang til ''{title}'' sektionen' 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".' 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' AddNew: 'Tilføj ny side'
AddNewButton: 'Tilføj ny' AddNewButton: 'Tilføj ny'
ChoosePageParentMode: 'Vælg hvor denne side skal oprettes' ChoosePageParentMode: 'Vælg hvor denne side skal oprettes'
@ -152,6 +160,7 @@ da:
LOGIN: Log ind LOGIN: Log ind
LOGOUT: 'Log ud' LOGOUT: 'Log ud'
NOTLOGGEDIN: 'Ikke logget ind' NOTLOGGEDIN: 'Ikke logget ind'
PUBLISHED: Udgivet
PUBLISHEDSITE: 'Udgivet side' PUBLISHEDSITE: 'Udgivet side'
Password: Adgangskode Password: Adgangskode
UnableDeleteInstall: 'Var ikke i stand til at slette installationsfilerne. Slet venligst filerne herunder manuelt.' 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' APPEARSVIRTUALPAGES: 'Dette indhold er også på de virtuelle sider i {title}sektionerne'
BUTTONCANCELDRAFT: 'Annuller ændringer i kladden ' BUTTONCANCELDRAFT: 'Annuller ændringer i kladden '
BUTTONCANCELDRAFTDESC: 'Slet kladden og benyt istedet den nuværende side' BUTTONCANCELDRAFTDESC: 'Slet kladden og benyt istedet den nuværende side'
BUTTONPUBLISHED: Udgivet
BUTTONSAVED: Gemt
BUTTONSAVEPUBLISH: 'Gem & udgiv'
BUTTONUNPUBLISH: Annuller udgivelse BUTTONUNPUBLISH: Annuller udgivelse
BUTTONUNPUBLISHDESC: 'Fjern denne side fra det udgivne websted' BUTTONUNPUBLISHDESC: 'Fjern denne side fra det udgivne websted'
Comments: Kommentarer Comments: Kommentarer

View File

@ -71,6 +71,8 @@ de:
PUBLISH_PAGES: Veröffentlichen PUBLISH_PAGES: Veröffentlichen
RESTORE: Wiederherstellen RESTORE: Wiederherstellen
RESTORED_PAGES: '%d Seiten wiederhergestellt' RESTORED_PAGES: '%d Seiten wiederhergestellt'
UNPUBLISHED_PAGES: 'Veröffentlichung von %d Seiten zurückgenommen'
UNPUBLISH_PAGES: Veröffentlichung zurücknehmen
CMSFileAddController: CMSFileAddController:
MENUTITLE: Dateien MENUTITLE: Dateien
CMSMain: CMSMain:
@ -107,6 +109,7 @@ de:
REMOVED: 'Lösche ''{title}''{description} von Live Umgebung' REMOVED: 'Lösche ''{title}''{description} von Live Umgebung'
REMOVEDPAGE: '''{title}'' wurde von der veröffentlichten Site entfernt' REMOVEDPAGE: '''{title}'' wurde von der veröffentlichten Site entfernt'
REMOVEDPAGEFROMDRAFT: 'Lösche ''%s'' von der Entwurfs-Site' REMOVEDPAGEFROMDRAFT: 'Lösche ''%s'' von der Entwurfs-Site'
RESTORE: Wiederherstellen
RESTORED: '''{title}'' wurde wiederhergestellt' RESTORED: '''{title}'' wurde wiederhergestellt'
RESTORE_DESC: 'Entwurf aus archivierter Version wiederherstellen' RESTORE_DESC: 'Entwurf aus archivierter Version wiederherstellen'
RESTORE_TO_ROOT: 'Entwurf in oberster Ebene wiederherstellen' RESTORE_TO_ROOT: 'Entwurf in oberster Ebene wiederherstellen'
@ -168,8 +171,16 @@ de:
FILTERLABELTEXT: Inhalt FILTERLABELTEXT: Inhalt
CMSSettingsController: CMSSettingsController:
MENUTITLE: Einstellungen MENUTITLE: Einstellungen
CMSSiteTreeFilter_ChangedPages:
Title: 'Geänderte Seiten'
CMSSiteTreeFilter_DeletedPages:
Title: 'Alle Seiten, auch gelöschte'
CMSSiteTreeFilter_Search: CMSSiteTreeFilter_Search:
Title: 'Alle Seiten' Title: 'Alle Seiten'
CMSSiteTreeFilter_StatusDeletedPages:
Title: 'Gelöschte Seiten'
CMSSiteTreeFilter_StatusDraftPages:
Title: 'Entwürfe'
CMSSiteTreeFilter_StatusRemovedFromDraftPages: CMSSiteTreeFilter_StatusRemovedFromDraftPages:
Title: 'Veröffentlicht aber aus Entwurf entfernt' Title: 'Veröffentlicht aber aus Entwurf entfernt'
ContentControl: ContentControl:
@ -287,6 +298,7 @@ de:
SilverStripeNavigator: SilverStripeNavigator:
ARCHIVED: Archiviert ARCHIVED: Archiviert
SilverStripeNavigatorLink: SilverStripeNavigatorLink:
ShareInstructions: 'Kopieren Sie den untenstehenden Link um ihn zu teilen.'
ShareLink: 'Link teilen' ShareLink: 'Link teilen'
SilverStripeNavigatorLinkl: SilverStripeNavigatorLinkl:
CloseLink: schließen CloseLink: schließen

View File

@ -172,15 +172,15 @@ lt:
CMSSettingsController: CMSSettingsController:
MENUTITLE: Nustatymai MENUTITLE: Nustatymai
CMSSiteTreeFilter_ChangedPages: CMSSiteTreeFilter_ChangedPages:
Title: 'Ištrinti puslapiai' Title: 'Pakeisti puslapiai'
CMSSiteTreeFilter_DeletedPages: CMSSiteTreeFilter_DeletedPages:
Title: 'Visi puslapiai, kartu su suarchyvuotais' Title: 'Visi puslapiai, taip pat ir archyvuoti'
CMSSiteTreeFilter_Search: CMSSiteTreeFilter_Search:
Title: 'Visi puslapiai' Title: 'Visi puslapiai'
CMSSiteTreeFilter_StatusDeletedPages: CMSSiteTreeFilter_StatusDeletedPages:
Title: 'Ištrinti puslapiai' Title: 'Archyvuoti puslapiai'
CMSSiteTreeFilter_StatusDraftPages: CMSSiteTreeFilter_StatusDraftPages:
Title: 'Juodraštiniai nepublikuoti puslapiai' Title: 'Juodraštiniai puslapiai'
CMSSiteTreeFilter_StatusRemovedFromDraftPages: CMSSiteTreeFilter_StatusRemovedFromDraftPages:
Title: 'Publikuotas, bet pašalintas iš juodraščių' Title: 'Publikuotas, bet pašalintas iš juodraščių'
ContentControl: ContentControl:
@ -298,7 +298,7 @@ lt:
SilverStripeNavigator: SilverStripeNavigator:
ARCHIVED: Archyvuota ARCHIVED: Archyvuota
SilverStripeNavigatorLink: 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' ShareLink: 'Dalintis nuoroda'
SilverStripeNavigatorLinkl: SilverStripeNavigatorLinkl:
CloseLink: Uždaryti CloseLink: Uždaryti

View File

@ -61,6 +61,7 @@ nl:
CMSAddPageController: CMSAddPageController:
Title: 'Pagina toevoegen' Title: 'Pagina toevoegen'
CMSBatchActions: CMSBatchActions:
ARCHIVE: Archief
DELETED_DRAFT_PAGES: '%d pagina''s van de concept-site verwijderd, %d mislukt' 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' DELETED_PAGES: '%d pagina''s van de gepubliceerde site verwijderd, %d mislukt'
DELETE_DRAFT_PAGES: 'Verwijder van concept site' DELETE_DRAFT_PAGES: 'Verwijder van concept site'
@ -72,6 +73,7 @@ nl:
CMSMain: CMSMain:
ACCESS: 'Toegang tot het ''{title}'' gedeelte' 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".' 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' AddNew: 'Voeg nieuwe pagina toe'
AddNewButton: 'Nieuw' AddNewButton: 'Nieuw'
AddPageRestriction: 'Opmerking: Sommige paginatypes zijn niet toegestaan voor deze selectie' AddPageRestriction: 'Opmerking: Sommige paginatypes zijn niet toegestaan voor deze selectie'

View File

@ -71,8 +71,6 @@ sk:
PUBLISH_PAGES: Zverejniť PUBLISH_PAGES: Zverejniť
RESTORE: Obnoviť RESTORE: Obnoviť
RESTORED_PAGES: 'Obnovených %d stránok' RESTORED_PAGES: 'Obnovených %d stránok'
UNPUBLISHED_PAGES: 'Nezverejnených %d stránok'
UNPUBLISH_PAGES: Nezverejniť
CMSFileAddController: CMSFileAddController:
MENUTITLE: Súbory MENUTITLE: Súbory
CMSMain: CMSMain:
@ -109,7 +107,6 @@ sk:
REMOVED: 'Smazané ''{title}''{description} z webu' REMOVED: 'Smazané ''{title}''{description} z webu'
REMOVEDPAGE: 'Smazané ''{title}'' z verejného webu' REMOVEDPAGE: 'Smazané ''{title}'' z verejného webu'
REMOVEDPAGEFROMDRAFT: 'Odstránené ''%s'' z konceptu webu' REMOVEDPAGEFROMDRAFT: 'Odstránené ''%s'' z konceptu webu'
RESTORE: Obnoviť
RESTORED: 'Obnovené ''{title}'' úspešne' RESTORED: 'Obnovené ''{title}'' úspešne'
RESTORE_DESC: 'Obnoviť archivovanú verziu na koncept' RESTORE_DESC: 'Obnoviť archivovanú verziu na koncept'
RESTORE_TO_ROOT: 'Obnoviť koncept na najvyšiu úroveň' RESTORE_TO_ROOT: 'Obnoviť koncept na najvyšiu úroveň'
@ -171,16 +168,8 @@ sk:
FILTERLABELTEXT: Obsah FILTERLABELTEXT: Obsah
CMSSettingsController: CMSSettingsController:
MENUTITLE: Nastavenia MENUTITLE: Nastavenia
CMSSiteTreeFilter_ChangedPages:
Title: 'Zmenené stránky'
CMSSiteTreeFilter_DeletedPages:
Title: 'Všetky stránky, vrátane vymazaných'
CMSSiteTreeFilter_Search: CMSSiteTreeFilter_Search:
Title: 'Všechny stránky' Title: 'Všechny stránky'
CMSSiteTreeFilter_StatusDeletedPages:
Title: 'Zmazané stránky'
CMSSiteTreeFilter_StatusDraftPages:
Title: 'Koncept nezverejnených stránok'
CMSSiteTreeFilter_StatusRemovedFromDraftPages: CMSSiteTreeFilter_StatusRemovedFromDraftPages:
Title: 'Živé, ale odstránené z konceptu' Title: 'Živé, ale odstránené z konceptu'
ContentControl: ContentControl:
@ -298,7 +287,6 @@ sk:
SilverStripeNavigator: SilverStripeNavigator:
ARCHIVED: Archivované ARCHIVED: Archivované
SilverStripeNavigatorLink: SilverStripeNavigatorLink:
ShareInstructions: 'Pre zdielanie tejto stránky, skopírujte a vložte odkaz nižšie.'
ShareLink: 'Zdieľať odkaz' ShareLink: 'Zdieľať odkaz'
SilverStripeNavigatorLinkl: SilverStripeNavigatorLinkl:
CloseLink: Zavrieť CloseLink: Zavrieť

View File

@ -9,6 +9,18 @@ class CMSMainTest extends FunctionalTest {
static protected $orig = array(); 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() { function testSiteTreeHints() {
$cache = SS_Cache::factory('CMSMain_SiteTreeHints'); $cache = SS_Cache::factory('CMSMain_SiteTreeHints');
// Login as user with root creation privileges // Login as user with root creation privileges
@ -262,16 +274,16 @@ class CMSMainTest extends FunctionalTest {
$cmsUser->logIn(); $cmsUser->logIn();
$this->get('admin/pages/add'); $this->get('admin/pages/add');
$response = $this->post( $response = $this->post(
'admin/pages/add/AddForm', 'admin/pages/add/AddForm',
array( array(
'ParentID' => '0', 'ParentID' => '0',
'PageType' => 'Page', 'PageType' => 'Page',
'Locale' => 'en_US', 'Locale' => 'en_US',
'action_doAdd' => 1, 'action_doAdd' => 1,
'ajax' => 1, 'ajax' => 1,
), array( ), array(
'X-Pjax' => 'CurrentForm,Breadcrumbs', 'X-Pjax' => 'CurrentForm,Breadcrumbs',
) )
); );
// should redirect, which is a permission error // should redirect, which is a permission error
$this->assertEquals(403, $response->getStatusCode(), 'Add TopLevel page must fail for normal user'); $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->get('admin/pages/add');
$response = $this->post( $response = $this->post(
'admin/pages/add/AddForm', 'admin/pages/add/AddForm',
array( array(
'ParentID' => '0', 'ParentID' => '0',
'PageType' => 'Page', 'PageType' => 'Page',
'Locale' => 'en_US', 'Locale' => 'en_US',
'action_doAdd' => 1, 'action_doAdd' => 1,
'ajax' => 1, 'ajax' => 1,
), array( ), array(
'X-Pjax' => 'CurrentForm,Breadcrumbs', 'X-Pjax' => 'CurrentForm,Breadcrumbs',
) )
); );
$location = $response->getHeader('X-ControllerURL'); $location = $response->getHeader('X-ControllerURL');
@ -312,27 +324,60 @@ class CMSMainTest extends FunctionalTest {
// Create toplevel page // Create toplevel page
$this->get('admin/pages/add'); $this->get('admin/pages/add');
$response = $this->post( $response = $this->post(
'admin/pages/add/AddForm', 'admin/pages/add/AddForm',
array('ParentID' => '0', 'PageType' => 'CMSMainTest_ClassA', 'Locale' => 'en_US', 'action_doAdd' => 1) array(
'ParentID' => '0',
'PageType' => 'CMSMainTest_ClassA',
'Locale' => 'en_US',
'action_doAdd' => 1,
'ajax' => 1
), array(
'X-Pjax' => 'CurrentForm,Breadcrumbs',
)
); );
$this->assertFalse($response->isError()); $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]; $newPageId = $matches[1];
// Create allowed child // Create allowed child
$this->get('admin/pages/add'); $this->get('admin/pages/add');
$response = $this->post( $response = $this->post(
'admin/pages/add/AddForm', 'admin/pages/add/AddForm',
array('ParentID' => $newPageId, 'PageType' => 'CMSMainTest_ClassB', 'Locale' => 'en_US', 'action_doAdd' => 1) array(
'ParentID' => $newPageId,
'PageType' => 'CMSMainTest_ClassB',
'Locale' => 'en_US',
'action_doAdd' => 1,
'ajax' => 1
), array(
'X-Pjax' => 'CurrentForm,Breadcrumbs',
)
); );
$this->assertFalse($response->isError()); $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 // Create disallowed child
$this->get('admin/pages/add'); $this->get('admin/pages/add');
$response = $this->post( $response = $this->post(
'admin/pages/add/AddForm', 'admin/pages/add/AddForm',
array('ParentID' => $newPageId, 'PageType' => 'Page', 'Locale' => 'en_US', 'action_doAdd' => 1) 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'); $this->assertEquals(403, $response->getStatusCode(), 'Add disallowed child should fail');

View File

@ -1,142 +1,142 @@
Page: Page:
page1: page1:
Title: Page 1 Title: Page 1
Sort: 1 Sort: 1
page2: page2:
Title: Page 2 Title: Page 2
Sort: 2 Sort: 2
page3: page3:
Title: Page 3 Title: Page 3
Sort: 3 Sort: 3
page31: page31:
Title: Page 3.1 Title: Page 3.1
Parent: =>Page.page3 Parent: =>Page.page3
Sort: 1 Sort: 1
page32: page32:
Title: Page 3.2 Title: Page 3.2
Parent: =>Page.page3 Parent: =>Page.page3
Sort: 2 Sort: 2
page4: page4:
Title: Page 4 Title: Page 4
Sort: 4 Sort: 4
page5: page5:
Title: Page 5 Title: Page 5
Sort: 5 Sort: 5
page6: page6:
Title: Page 6 Title: Page 6
Sort: 6 Sort: 6
page7: page7:
Title: Page 7 Title: Page 7
Sort: 7 Sort: 7
page8: page8:
Title: Page 8 Title: Page 8
Sort: 8 Sort: 8
page9: page9:
Title: Page 9 Title: Page 9
Sort: 9 Sort: 9
page10: page10:
Title: Page 10 Title: Page 10
Sort: 10 Sort: 10
page11: page11:
Title: Page 11 Title: Page 11
Sort: 11 Sort: 11
page12: page12:
Title: Page 12 Title: Page 12
Sort: 12 Sort: 12
page13: page13:
Title: Page 13 Title: Page 13
Sort: 13 Sort: 13
page14: page14:
Title: Page 14 Title: Page 14
Sort: 14 Sort: 14
page15: page15:
Title: Page 15 Title: Page 15
Sort: 15 Sort: 15
page16: page16:
Title: Page 16 Title: Page 16
Sort: 16 Sort: 16
page17: page17:
Title: Page 17 Title: Page 17
Sort: 17 Sort: 17
page18: page18:
Title: Page 18 Title: Page 18
Sort: 18 Sort: 18
page19: page19:
Title: Page 19 Title: Page 19
Sort: 19 Sort: 19
page20: page20:
Title: Page 20 Title: Page 20
Sort: 20 Sort: 20
page21: page21:
Title: Page 21 Title: Page 21
Sort: 21 Sort: 21
page22: page22:
Title: Page 22 Title: Page 22
Sort: 22 Sort: 22
page23: page23:
Title: Page 23 Title: Page 23
Sort: 23 Sort: 23
page24: page24:
Title: Page 24 Title: Page 24
Sort: 24 Sort: 24
page25: page25:
Title: Page 25 Title: Page 25
Sort: 25 Sort: 25
page26: page26:
Title: Page 26 Title: Page 26
Sort: 26 Sort: 26
home: home:
Title: Home Title: Home
URLSegment: home URLSegment: home
Sort: 27 Sort: 27
Group: Group:
admin: admin:
Title: Administrators Title: Administrators
empty: empty:
Title: Empty Group Title: Empty Group
assetsonly: assetsonly:
Title: assetsonly Title: assetsonly
allcmssections: allcmssections:
Title: allcmssections Title: allcmssections
rooteditusers: rooteditusers:
Title: rooteditusers Title: rooteditusers
Member: Member:
admin: admin:
Email: admin@example.com Email: admin@example.com
Password: ZXXlkwecxz2390232233 Password: ZXXlkwecxz2390232233
Groups: =>Group.admin Groups: =>Group.admin
assetsonlyuser: assetsonlyuser:
Email: assetsonlyuser@test.com Email: assetsonlyuser@test.com
Groups: =>Group.assetsonly Groups: =>Group.assetsonly
allcmssectionsuser: allcmssectionsuser:
Email: allcmssectionsuser@test.com Email: allcmssectionsuser@test.com
Groups: =>Group.allcmssections Groups: =>Group.allcmssections
rootedituser: rootedituser:
Email: rootedituser@test.com Email: rootedituser@test.com
Groups: =>Group.rooteditusers Groups: =>Group.rooteditusers
Permission: Permission:
admin: admin:
Code: ADMIN Code: ADMIN
GroupID: =>Group.admin GroupID: =>Group.admin
assetsonly: assetsonly:
Code: CMS_ACCESS_AssetAdmin Code: CMS_ACCESS_AssetAdmin
GroupID: =>Group.assetsonly GroupID: =>Group.assetsonly
allcmssections: allcmssections:
Code: CMS_ACCESS_LeftAndMain Code: CMS_ACCESS_LeftAndMain
GroupID: =>Group.allcmssections GroupID: =>Group.allcmssections
allcmssections2: allcmssections2:
Code: CMS_ACCESS_LeftAndMain Code: CMS_ACCESS_LeftAndMain
GroupID: =>Group.rooteditusers GroupID: =>Group.rooteditusers
SiteConfig: SiteConfig:
siteconfig1: siteconfig1:
EditorGroups: =>Group.rooteditusers EditorGroups: =>Group.rooteditusers
CanCreateTopLevelType: 'OnlyTheseUsers' CanCreateTopLevelType: 'OnlyTheseUsers'
SiteConfig_CreateTopLevelGroups: SiteConfig_CreateTopLevelGroups:
createtoplevelgroups1: createtoplevelgroups1:
SiteConfigID: =>SiteConfig.siteconfig1 SiteConfigID: =>SiteConfig.siteconfig1
GroupID: =>Group.rooteditusers GroupID: =>Group.rooteditusers
RedirectorPage: RedirectorPage:
page5: page5:
Title: Page 5 Title: Page 5
RedirectionType: External RedirectionType: External
ExternalURL: http://www.google.com ExternalURL: http://www.google.com

View File

@ -1,7 +1,9 @@
<?php <?php
class VirtualPageTest extends SapphireTest { class VirtualPageTest extends FunctionalTest {
protected static $fixture_file = 'VirtualPageTest.yml'; protected static $fixture_file = 'VirtualPageTest.yml';
protected static $use_draft_site = false;
protected $autoFollowRedirection = false;
protected $extraDataObjects = array( protected $extraDataObjects = array(
'VirtualPageTest_ClassA', 'VirtualPageTest_ClassA',
@ -21,6 +23,9 @@ class VirtualPageTest extends SapphireTest {
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
// Ensure we always have permission to save/publish
$this->logInWithPermission("ADMIN");
$this->origInitiallyCopiedFields = VirtualPage::config()->initially_copied_fields; $this->origInitiallyCopiedFields = VirtualPage::config()->initially_copied_fields;
Config::inst()->remove('VirtualPage', 'initially_copied_fields'); Config::inst()->remove('VirtualPage', 'initially_copied_fields');
VirtualPage::config()->initially_copied_fields = array_merge( 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"); 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 { class VirtualPageTest_ClassA extends Page implements TestOnly {

View File

@ -37,15 +37,13 @@ class CmsReportsTest extends SapphireTest {
$class = get_class($report); $class = get_class($report);
// ASSERT that the "draft" report is returning the correct results. // ASSERT that the "draft" report is returning the correct results.
$parameters = array('CheckSite' => 'Draft');
$results = count($report->sourceRecords(array())) > 0; $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."); $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. // ASSERT that the "published" report is returning the correct results.
$parameters = array('CheckSite' => 'Published', 'OnLive' => 1);
$results = count($report->sourceRecords(array( $results = count($report->sourceRecords($parameters, null, null)) > 0;
'OnLive' => 1
))) > 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."); $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(); $reports = SS_Report::get_reports();
$brokenLinksReport = null; $brokenLinksReport = null;
foreach($reports as $report) { foreach($reports as $report) {
if($report instanceof SideReport_BrokenLinks) { if($report instanceof BrokenLinksReport) {
$brokenLinksReport = $report; $brokenLinksReport = $report;
break; break;
} }
} }
// Determine that the report exists, otherwise it has been excluded. // Determine that the report exists, otherwise it has been excluded.
if(!$brokenLinksReport){
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);
} }
// 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(); $reports = SS_Report::get_reports();
$brokenFilesReport = null; $brokenFilesReport = null;
foreach($reports as $report) { foreach($reports as $report) {
if($report instanceof SideReport_BrokenFiles) { if($report instanceof BrokenFilesReport) {
$brokenFilesReport = $report; $brokenFilesReport = $report;
break; break;
} }
} }
// Determine that the report exists, otherwise it has been excluded. // Determine that the report exists, otherwise it has been excluded.
if(!$brokenFilesReport){
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);
} }
// 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(); $reports = SS_Report::get_reports();
$brokenVirtualPagesReport = null; $brokenVirtualPagesReport = null;
foreach($reports as $report) { foreach($reports as $report) {
if($report instanceof SideReport_BrokenVirtualPages) { if($report instanceof BrokenVirtualPagesReport) {
$brokenVirtualPagesReport = $report; $brokenVirtualPagesReport = $report;
break; break;
} }
} }
// Determine that the report exists, otherwise it has been excluded. // Determine that the report exists, otherwise it has been excluded.
if(!$brokenVirtualPagesReport){
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);
} }
// 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(); $reports = SS_Report::get_reports();
$brokenRedirectorPagesReport = null; $brokenRedirectorPagesReport = null;
foreach($reports as $report) { foreach($reports as $report) {
if($report instanceof SideReport_BrokenRedirectorPages) { if($report instanceof BrokenRedirectorPagesReport) {
$brokenRedirectorPagesReport = $report; $brokenRedirectorPagesReport = $report;
break; break;
} }
} }
// Determine that the report exists, otherwise it has been excluded. // Determine that the report exists, otherwise it has been excluded.
if(!$brokenRedirectorPagesReport){
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);
} }
// 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);
} }
} }