From 61862e38345ea2fb80c9d8101d3d0fd9e45d9b31 Mon Sep 17 00:00:00 2001
From: Niklas Forsdahl
Date: Tue, 31 Jul 2012 09:12:03 +0300
Subject: [PATCH 01/27] Added Swedish javascript translations
---
javascript/lang/sv_SE.js | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 javascript/lang/sv_SE.js
diff --git a/javascript/lang/sv_SE.js b/javascript/lang/sv_SE.js
new file mode 100644
index 00000000..eef22abb
--- /dev/null
+++ b/javascript/lang/sv_SE.js
@@ -0,0 +1,36 @@
+if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
+ if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
+} else {
+ ss.i18n.addDictionary('sv_SE', {
+ 'CMSMAIN.WARNINGSAVEPAGESBEFOREADDING' : "Du måste spara en sida innan du kan lägga till undersidor.",
+ 'CMSMAIN.CANTADDCHILDREN' : "Du kan inte lägga till undersidor till den valda sidan.",
+ 'CMSMAIN.ERRORADDINGPAGE' : 'Ett fel uppstod när sidan skulle läggas till',
+ 'CMSMAIN.FILTEREDTREE' : 'Filtrerat träd för att visa enbart ändrade sidor',
+ 'CMSMAIN.ERRORFILTERPAGES' : 'Kunde inte filtrera trädet för att visa enbart ändrade sidor
%s',
+ 'CMSMAIN.ERRORUNFILTER' : 'Ofiltrerat träd',
+ 'CMSMAIN.PUBLISHINGPAGES' : 'Publicerar sidor...',
+ 'CMSMAIN.SELECTONEPAGE' : "Vänligen välj åtminståne 1 sida.",
+ 'CMSMAIN.ERRORPUBLISHING' : 'Ett fel uppstod när sidorna skulle publiceras',
+ 'CMSMAIN.REALLYDELETEPAGES' : "Vill du verkligen radera de %s markerade sidorna?",
+ 'CMSMAIN.DELETINGPAGES' : 'Raderar sidor...',
+ 'CMSMAIN.ERRORDELETINGPAGES': 'Ett fel uppstod när sidorna skulle raderas',
+ 'CMSMAIN.PUBLISHING' : 'Publicerar...',
+ 'CMSMAIN.RESTORING': 'Återställer...',
+ 'CMSMAIN.ERRORREVERTING': 'Ett fel uppstod vid återgång till publicerat innehåll',
+ 'CMSMAIN.SAVING' : 'sparar...',
+ 'CMSMAIN.SELECTMOREPAGES' : "Du har valt %s sidor.\n\nVill du verkligen utföra denna åtgärd?",
+ 'CMSMAIN.ALERTCLASSNAME': 'Sidtypen kommer att uppdateras efter att sidan sparats',
+ 'CMSMAIN.URLSEGMENTVALIDATION': 'URLar kan endast innehålla bokstäver, siffror och bindesträck.',
+ 'AssetAdmin.BATCHACTIONSDELETECONFIRM': "Vill du verkligen radera %s mappar?",
+ 'AssetTableField.REALLYDELETE': 'Vill du verkligen radera de markerade filerna?',
+ 'AssetTableField.MOVING': 'Flyttar %s fil(er)',
+ 'CMSMAIN.AddSearchCriteria': 'Lägg till kriterie',
+ 'WidgetAreaEditor.TOOMANY': 'Du har tyvärr nått max antal widgetar i detta område.',
+ 'AssetAdmin.ConfirmDelete': 'Vill du verkligen radera denna mapp och alla filer i den?',
+ 'Folder.Name': 'Mappnamn',
+ 'Tree.AddSubPage': 'Lägg till ny sida här',
+ 'Tree.EditPage': 'Editera',
+ 'CMSMain.ConfirmRestoreFromLive': "Vill du verkligen kopiera det publicerade innehållet till utkastsajten?",
+ 'CMSMain.RollbackToVersion': "Vill du verkligen gå tillbaka till version %s av denna sida?"
+ });
+}
From 03e4893b151f663b5bfaa400f60fc88ba2f78b89 Mon Sep 17 00:00:00 2001
From: Kirk Mayo
Date: Wed, 8 Aug 2012 16:39:10 +1200
Subject: [PATCH 02/27] BUG: Fixing a issue with a undefined variable in
getLink
---
code/controllers/SilverStripeNavigator.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/controllers/SilverStripeNavigator.php b/code/controllers/SilverStripeNavigator.php
index 2241ddc2..d3e5f15d 100644
--- a/code/controllers/SilverStripeNavigator.php
+++ b/code/controllers/SilverStripeNavigator.php
@@ -320,7 +320,7 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
}
function getLink() {
- return $this->record->AbsoluteLink() . '?archiveDate=' . $date;
+ return $this->record->AbsoluteLink() . '?archiveDate=' . $this->record->LastEdited;
}
function canView($member = null) {
From 5f9362e7424ce71cde850d5ba87b03cb0c795458 Mon Sep 17 00:00:00 2001
From: Ryan Wachtl
Date: Fri, 17 Aug 2012 03:05:39 -0500
Subject: [PATCH 03/27] BUG Visual cue that URLSegment is updating
Added a loading class on .field.urlsegment to indicate that the URLSegment is updating its value, set before and after self.suggest().
---
css/screen.css | 4 ++--
images/loading.gif | Bin 0 -> 847 bytes
javascript/SiteTreeURLSegmentField.js | 2 ++
scss/_CMSMain.scss | 8 ++------
4 files changed, 6 insertions(+), 8 deletions(-)
create mode 100644 images/loading.gif
diff --git a/css/screen.css b/css/screen.css
index bcf6069d..677cb1a0 100644
--- a/css/screen.css
+++ b/css/screen.css
@@ -21,7 +21,7 @@
.cms-content-tools #cms-content-treeview .cms-tree a:hover > .text > .badge, .cms-content-tools #cms-content-treeview .cms-tree .jstree-clicked > .text > .badge { display: inline-block; }
/** ------------------------------------------------------------------ URLSegment field ----------------------------------------------------------------- */
-.field.urlsegment.disabled { color: #444; padding-left: 0px; margin-left: 0px; background: none; border-color: transparent; }
+.field.urlsegment.loading { background: url(../images/loading.gif) no-repeat 162px 8px; }
.field.urlsegment .prefix, .field.urlsegment .preview { padding-top: 8px; display: inline-block; }
.field.urlsegment .prefix { color: #777; }
.field.urlsegment .cancel, .field.urlsegment .update, .field.urlsegment .edit { margin-left: 7px; }
@@ -41,7 +41,7 @@
.cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-state-active.content-treeview a, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-content .ui-state-active.content-treeview a, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-header .ui-state-active.content-treeview a { background-position: 1px -40px; }
.cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-state-active.content-galleryview a, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-content .ui-state-active.content-galleryview a, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-header .ui-state-active.content-galleryview a { background-position: -161px -40px; }
.cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-state-active.content-listview a, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-content .ui-state-active.content-listview a, .cms .AssetAdmin .cms-content-header-tabs .ui-tabs-nav .ui-widget-header .ui-state-active.content-listview a { background-position: -38px -40px; }
-.cms .AssetAdmin .cms-content-toolbar .cms-page-add-button { background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #f3f3f3), color-stop(100%, #d9d9d9)); background-image: -webkit-linear-gradient(#f3f3f3, #d9d9d9); background-image: -moz-linear-gradient(#f3f3f3, #d9d9d9); background-image: -o-linear-gradient(#f3f3f3, #d9d9d9); background-image: -ms-linear-gradient(#f3f3f3, #d9d9d9); background-image: linear-gradient(#f3f3f3, #d9d9d9); border-color: #c0c0c2; }
+.cms .AssetAdmin .cms-content-toolbar .cms-page-add-button { background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #f3f3f3), color-stop(100%, #d9d9d9)); background-image: -webkit-linear-gradient(#f3f3f3, #d9d9d9); background-image: -moz-linear-gradient(#f3f3f3, #d9d9d9); background-image: -o-linear-gradient(#f3f3f3, #d9d9d9); background-image: linear-gradient(#f3f3f3, #d9d9d9); border-color: #c0c0c2; }
.cms .AssetAdmin .cms-content-toolbar .cms-page-add-button span.btn-icon-add { height: 17px; }
.cms .AssetAdmin .cms-content-toolbar .cms-page-add-button span.ui-button-text { color: #393939; text-shadow: white 0 1px 1px; }
.cms .AssetAdmin #Root_TreeView .cms-tree ul .class-Folder a span.text span.jstree-foldericon { background: url(../images/blue-folder-horizontal.png) no-repeat; width: 16px; height: 16px; float: left; display: block; margin-right: 4px; }
diff --git a/images/loading.gif b/images/loading.gif
new file mode 100644
index 0000000000000000000000000000000000000000..e21f078cd94c501559b857037062191963304b85
GIT binary patch
literal 847
zcmZ?wbhEHb6krfw_`<;O|Nnoks7XJ5{kE@L*|Gi!qD9xAyjgwhrhLZi>Saf=
zXYYOb_S2j_mrmS#=HIa)X5uymQh?%rZa>$MU}whwS0gxd8la%imy$Vesewq2qE<`7s!Q9jnmP@hQ9l-`Bz@TBF=>KD%L-F9*@{ln
zYy}%(kx!MfN8k55VY4JdL7~h2Qcs4K)X@hkRye4*)*d);@Y+!(j-DwEsTm?dJO>Xb
zI0$n29BBBE9O&N6W)@!3wc;ix&1fW(%BGc4XkT
z2{1Qcx8Y=IFyM=1v(Vz@Y*$vqW_be8hsvKPXxtL<(Be80Ai}A;q}}knaU++N^Jzox
zEgmgR57|8QW~kiUSjoU4uO4tMw>85S9MaEi6+81y+^;p)p4@Ot)^
zC)D1woSCIYC7U-!lb@#>tEEAZU~N#C!el6N)L})lvmDzR@nhNDO>-C(ot`AvGc;~z
z+BZSjwaKE&DKMfTd3WxjGHxNIg$geZEly}mXyXlaTP9g_N0M)8!E4RWY5yCrS_ASM
zF!okB@VFWZ96BkH8!K^qr-Vn(g|-_S>;hdZCQJ&?HFPAFxhW=kFhm5;;AqS>U9y!i
z$;D#}8^fxdiAg$KeX0!w#$w4wlsBmV;C-XSZenI0pr#d}-=NXctAf?ic&McwK#y@O
zb1-2zwCR|mlIKK@4YL*|aM
Date: Wed, 22 Aug 2012 13:52:33 +1200
Subject: [PATCH 04/27] BUG: Installer templates
Installer was feeing the title "Title" to the template. Template
rearranged for usability concerns (people were missing the email and
password when going to the CMS login page)
---
code/controllers/ContentController.php | 2 +-
.../Includes/Install_successfullyinstalled.ss | 15 ++++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/code/controllers/ContentController.php b/code/controllers/ContentController.php
index 847a54a8..60356e05 100644
--- a/code/controllers/ContentController.php
+++ b/code/controllers/ContentController.php
@@ -401,7 +401,7 @@ HTML;
));
return array(
- "Title" => DBField::create_field('Varchar', "Title", "Installation Successful"),
+ "Title" => _t("ContentController.INSTALL_SUCCESS", "Installation Successful!"),
"Content" => $data->renderWith('Install_successfullyinstalled'),
);
}
diff --git a/templates/Includes/Install_successfullyinstalled.ss b/templates/Includes/Install_successfullyinstalled.ss
index c3817ce0..6fe35031 100644
--- a/templates/Includes/Install_successfullyinstalled.ss
+++ b/templates/Includes/Install_successfullyinstalled.ss
@@ -1,17 +1,18 @@
-
- <%t ContentController.InstallSuccessCongratulations "SilverStripe has been successfully installed." %>
+
+ <%t ContentController.InstallSuccessCongratulations "SilverStripe has been successfully installed!" %>
<% if Project == 'tutorial' %>
- <%t ContentController.PostInstallTutorialIntro 'This website is a simplistic version of a SilverStripe 2 site. To extend this, please take a look at {link}.' link='our new tutorials' %>
+ <%t ContentController.PostInstallTutorialIntro 'This website is a simplistic version of a SilverStripe 3 site. To extend this, please take a look at {link}.' link='our tutorials' %>
<% end_if %>
+ <%t ContentController.Email "Email" %>: $Username
+ <%t ContentController.Password "Password" %>: $Password
+
- <%t ContentController.StartEditing 'You can start editing your site\'s content by opening the CMS.' link="admin/" %>
-
- <%t ContentController.Email "Email" %>: $Username
- <%t ContentController.Password "Password" %>: $Password
+ <%t ContentController.StartEditing "You can start editing your site's content by opening the CMS." link="admin/" %>
+
From cd8c3a024505d79a6fc7ad34abb1985e03340fab Mon Sep 17 00:00:00 2001
From: Ingo Schommer
Date: Mon, 27 Aug 2012 11:47:12 +0200
Subject: [PATCH 05/27] NEW Re-added SilverStripeNavigator styling
---
code/controllers/ContentController.php | 2 +-
css/SilverStripeNavigator.css | 25 +++++++
scss/SilverStripeNavigator.scss | 90 ++++++++++++++++++++++++++
3 files changed, 116 insertions(+), 1 deletion(-)
create mode 100644 css/SilverStripeNavigator.css
create mode 100644 scss/SilverStripeNavigator.scss
diff --git a/code/controllers/ContentController.php b/code/controllers/ContentController.php
index 847a54a8..98b1743f 100644
--- a/code/controllers/ContentController.php
+++ b/code/controllers/ContentController.php
@@ -314,7 +314,7 @@ class ContentController extends Controller {
-
$viewPageIn
+ $viewPageIn
$items
diff --git a/css/SilverStripeNavigator.css b/css/SilverStripeNavigator.css
new file mode 100644
index 00000000..24d390cc
--- /dev/null
+++ b/css/SilverStripeNavigator.css
@@ -0,0 +1,25 @@
+#SilverStripeNavigator { position: fixed; bottom: 0; left: 0; width: 100%; border-top: 2px solid #d4d0c8; background-color: #81858d; height: 22px; }
+
+#SilverStripeNavigator * { font-family: Arial,Helvetica,sans-serif; font-size: 10px !important; }
+
+#SilverStripeNavigator .holder { text-align: center; padding-top: 4px; padding-left: 3px; padding-right: 6px; color: white; border-top: 1px solid #555555; }
+
+#SilverStripeNavigator #logInStatus { float: right; }
+
+#SilverStripeNavigator #switchView { float: left; }
+
+#SilverStripeNavigator a { color: #fff; background-color: transparent; text-decoration: underline; }
+
+#SilverStripeNavigator a:hover { background-color: transparent; }
+
+#SilverStripeNavigator .bottomTabs a { margin-right: 8px; text-decoration: underline; }
+
+#SilverStripeNavigator .bottomTabs a.current { font-weight: bold; text-decoration: none; }
+
+#SilverStripeNavigatorMessage { font-family: 'Lucida Grande', Verdana, Arial, 'sans-serif'; position: absolute; right: 20px; top: 40px; padding: 10px; border-color: #c99; color: #fff; background-color: #c00; border: 1px solid #000; }
+
+#SilverStripeNavigatorLinkPopup { display: none; position: absolute; top: -60px; height: 50px; width: 350px; left: 200px; background-color: white; border: 1px solid black; z-index: 100; color: black; padding: 5px; }
+
+#SilverStripeNavigatorLinkPopup input { width: 250px; }
+
+#SilverStripeNavigatorLinkPopup a.close { color: blue; text-align: right; width: 80%; border: none !important; cursor: pointer; }
diff --git a/scss/SilverStripeNavigator.scss b/scss/SilverStripeNavigator.scss
new file mode 100644
index 00000000..029bc1bf
--- /dev/null
+++ b/scss/SilverStripeNavigator.scss
@@ -0,0 +1,90 @@
+
+#SilverStripeNavigator {
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ width: 100%;
+ border-top: 2px solid #d4d0c8;
+ background-color:#81858d;
+ height: 22px;
+}
+
+#SilverStripeNavigator * {
+ font-family: Arial,Helvetica,sans-serif;
+ font-size: 10px !important;
+}
+
+#SilverStripeNavigator .holder {
+ text-align: center;
+ padding-top : 4px;
+ padding-left : 3px;
+ padding-right : 6px;
+ color: white;
+ border-top: 1px solid #555555;
+}
+#SilverStripeNavigator #logInStatus {
+ float: right;
+}
+#SilverStripeNavigator #switchView {
+ float: left;
+
+}
+
+#SilverStripeNavigator a {
+ color: #fff;
+ background-color: transparent;
+ text-decoration: underline;
+}
+#SilverStripeNavigator a:hover {
+ background-color: transparent;
+}
+
+#SilverStripeNavigator .bottomTabs a {
+ margin-right: 8px;
+ text-decoration: underline;
+}
+
+#SilverStripeNavigator .bottomTabs a.current {
+ font-weight:bold;
+ text-decoration: none;
+}
+
+#SilverStripeNavigatorMessage {
+ font-family: 'Lucida Grande', Verdana, Arial, 'sans-serif';
+ position: absolute;
+ right: 20px;
+ top: 40px;
+ padding: 10px;
+ border-color: #c99;
+ color: #fff;
+ background-color: #c00;
+ border: 1px solid #000;
+}
+
+#SilverStripeNavigatorLinkPopup {
+ display: none;
+ position: absolute;
+ top: -60px;
+ height: 50px;
+ width: 350px;
+ left: 200px;
+ background-color: white;
+ border: 1px solid black;
+ z-index: 100;
+ color: black;
+ padding: 5px;
+}
+
+#SilverStripeNavigatorLinkPopup input {
+ width: 250px;
+}
+
+#SilverStripeNavigatorLinkPopup a.close {
+ color: blue;
+ text-align: right;
+ width: 80%;
+ border: none !important;
+ cursor: pointer;
+}
+
+
From e59aec3f6f6c1215d2a83e1e404e0988b69815b9 Mon Sep 17 00:00:00 2001
From: Ingo Schommer
Date: Mon, 27 Aug 2012 14:19:40 +0200
Subject: [PATCH 06/27] BUG Redirect to edit view after page revert in CMS
(fixes #7391)
---
code/controllers/CMSMain.php | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php
index 8672db4b..9285259e 100644
--- a/code/controllers/CMSMain.php
+++ b/code/controllers/CMSMain.php
@@ -1061,8 +1061,12 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
// Can be used in different contexts: In normal page edit view, in which case the redirect won't have any effect.
// Or in history view, in which case a revert causes the CMS to re-load the edit view.
+ // The X-Pjax header forces a "full" content refresh on redirect.
$url = Controller::join_links(singleton('CMSPageEditController')->Link('show'), $record->ID);
$this->response->addHeader('X-ControllerURL', $url);
+ $this->request->addHeader('X-Pjax', 'Content');
+ $this->response->addHeader('X-Pjax', 'Content');
+
return $this->getResponseNegotiator()->respond($this->request);
}
From 11b85e988e3ac346c1daaeca09f8e48512e23452 Mon Sep 17 00:00:00 2001
From: Ingo Schommer
Date: Mon, 27 Aug 2012 16:04:31 +0200
Subject: [PATCH 07/27] Fixed "from"/"to" filter field widths
Removed ineffective FieldGroup->subfieldParam setting,
replaced with a specialised template, as well as a new "stacked" styling
(both added to framework codebase)
---
code/controllers/CMSMain.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php
index 9285259e..edd62a82 100644
--- a/code/controllers/CMSMain.php
+++ b/code/controllers/CMSMain.php
@@ -284,7 +284,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
)
// new TextField('MetaTags', _t('CMSMain.SearchMetaTags', 'Meta tags'))
);
- $dateGroup->subfieldParam = 'FieldHolder';
+ $dateGroup->setFieldHolderTemplate('FieldGroup_DefaultFieldHolder')->addExtraClass('stacked');
$dateFrom->setConfig('showcalendar', true);
$dateTo->setConfig('showcalendar', true);
$classDropdown->setEmptyString(_t('CMSMain.PAGETYPEANYOPT','Any'));
From 62783c75a9568b0c22d504d145b3aa9d1f5995b3 Mon Sep 17 00:00:00 2001
From: Ingo Schommer
Date: Mon, 27 Aug 2012 18:20:56 +0200
Subject: [PATCH 08/27] BUG Prevent overwriting of draft/live preview form
fields
By renaming fields to "StageLink" and "LiveLink",
which means they don't get influenced by the model getters
on Form->loadDataFrom(). Its also a more accurate
name for the field value, since it contains a full (nested) URL
rather than just a segment. Only used internally, so no API change.
---
code/controllers/CMSMain.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php
index edd62a82..dccb354c 100644
--- a/code/controllers/CMSMain.php
+++ b/code/controllers/CMSMain.php
@@ -574,17 +574,18 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$fields->push($idField = new HiddenField("ID", false, $id));
// Necessary for different subsites
$fields->push($liveURLField = new HiddenField("AbsoluteLink", false, $record->AbsoluteLink()));
- $fields->push($liveURLField = new HiddenField("LiveURLSegment"));
- $fields->push($stageURLField = new HiddenField("StageURLSegment"));
+ $fields->push($liveURLField = new HiddenField("LiveLink"));
+ $fields->push($stageURLField = new HiddenField("StageLink"));
$fields->push(new HiddenField("TreeTitle", false, $record->TreeTitle));
$fields->push(new HiddenField('Sort','', $record->Sort));
if($record->ID && is_numeric( $record->ID ) ) {
$liveRecord = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree\".\"ID\" = $record->ID");
- if($liveRecord) $liveURLField->setValue($liveRecord->AbsoluteLink());
+ if($liveRecord) {
+ $liveURLField->setValue(Controller::join_links($liveRecord->AbsoluteLink(), '?stage=Live'));
+ }
}
-
if(!$deletedFromStage) {
$stageURLField->setValue(Controller::join_links($record->AbsoluteLink(), '?stage=Stage'));
}
@@ -615,7 +616,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$form = new Form($this, "EditForm", $fields, $actions, $validator);
$form->loadDataFrom($record);
- $stageURLField->setValue(Controller::join_links($record->getStageURLSegment(), '?stage=Stage'));
$form->disableDefaultAction();
$form->addExtraClass('cms-edit-form');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
From cbadd3ef9bd862987033e318ae06649e909f097e Mon Sep 17 00:00:00 2001
From: Hamish Friedlander
Date: Tue, 28 Aug 2012 13:55:49 +1200
Subject: [PATCH 09/27] FIX Config frag legacycmsroutes doesnt need to come
after _everything_
---
_config/routes.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/_config/routes.yml b/_config/routes.yml
index 1baa48fb..9a6a595f 100644
--- a/_config/routes.yml
+++ b/_config/routes.yml
@@ -8,8 +8,8 @@ Director:
'$URLSegment//$Action/$ID/$OtherID': 'ModelAsController'
---
Name: legacycmsroutes
-After: '*'
+After: framework/routes#adminroutes
---
Director:
rules:
- 'admin/cms': '->admin/pages'
\ No newline at end of file
+ 'admin/cms': '->admin/pages'
From d45dd34db95a131d0ab95db0f9630b9c52708a90 Mon Sep 17 00:00:00 2001
From: Hamish Friedlander
Date: Tue, 28 Aug 2012 15:13:57 +1200
Subject: [PATCH 10/27] FIX VirtualPageTest failing on apps with no $db on Page
VirtualPageTest was adding fields to Page via a decorator, but Page might
not have any fields itself. This changed Page from not having a table
to having a table, which then caused a problem on tearDown
---
tests/model/VirtualPageTest.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/model/VirtualPageTest.php b/tests/model/VirtualPageTest.php
index ba4ef7ad..cd47dfbb 100644
--- a/tests/model/VirtualPageTest.php
+++ b/tests/model/VirtualPageTest.php
@@ -10,7 +10,7 @@ class VirtualPageTest extends SapphireTest {
);
protected $requiredExtensions = array(
- 'Page' => array('VirtualPageTest_PageExtension')
+ 'SiteTree' => array('VirtualPageTest_PageExtension')
);
function setUp() {
From 2637e6d9b2e3aea8f017c5502def632b685771e5 Mon Sep 17 00:00:00 2001
From: Hamish Friedlander
Date: Tue, 28 Aug 2012 15:46:33 +1200
Subject: [PATCH 11/27] FIX Dont refer to framework module in config rules
Might be called sapphire instead, in which case routing rules
will end up in the wrong place
---
_config/routes.yml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/_config/routes.yml b/_config/routes.yml
index 9a6a595f..deed433b 100644
--- a/_config/routes.yml
+++ b/_config/routes.yml
@@ -1,6 +1,7 @@
---
Name: modelascontrollerroutes
-After: framework/routes#rootroutes
+Before: '*'
+After: '#rootroutes'
---
Director:
rules:
@@ -8,7 +9,7 @@ Director:
'$URLSegment//$Action/$ID/$OtherID': 'ModelAsController'
---
Name: legacycmsroutes
-After: framework/routes#adminroutes
+After: '#adminroutes'
---
Director:
rules:
From 62cfd871b61531d1e8d3b41f3b96843d934f9226 Mon Sep 17 00:00:00 2001
From: jean
Date: Tue, 28 Aug 2012 16:43:54 +1200
Subject: [PATCH 12/27] FIX 7819 Check if the current folder ID is in the url
before assuming the list should not filter by folder ID
---
code/controllers/AssetAdmin.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php
index e71e6498..429454ee 100644
--- a/code/controllers/AssetAdmin.php
+++ b/code/controllers/AssetAdmin.php
@@ -95,7 +95,7 @@ JS
// Don't filter list when a detail view is requested,
// to avoid edge cases where the filtered list wouldn't contain the requested
// record due to faulty session state (current folder not always encoded in URL, see #7408).
- if($this->request->param('ID') == 'field') {
+ if(!$folder->ID && ($this->request->param('ID') == 'field')) {
return $list;
}
From 436972744df5d1f1bf38efd463ef02758cc989ef Mon Sep 17 00:00:00 2001
From: Saophalkun Ponlu
Date: Tue, 28 Aug 2012 21:18:07 +1200
Subject: [PATCH 13/27] Enable page sorting by Page name in list view (see
#7601)
---
code/controllers/CMSMain.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php
index dccb354c..600418e7 100644
--- a/code/controllers/CMSMain.php
+++ b/code/controllers/CMSMain.php
@@ -703,6 +703,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
'Created' => _t('SiteTree.CREATED', 'Date Created'),
'LastEdited' => _t('SiteTree.LASTUPDATED', 'Last Updated'),
);
+ $gridField->getConfig()->getComponentByType('GridFieldSortableHeader')->setFieldSorting(array('getTreeTitle' => 'Title'));
if(!$params) {
$fields = array_merge(array('listChildrenLink' => ''), $fields);
From 8a514d8b64a3a16f5fcbd40e6cf46f00ac973f79 Mon Sep 17 00:00:00 2001
From: Ingo Schommer
Date: Tue, 28 Aug 2012 19:00:42 +0200
Subject: [PATCH 14/27] BUG Correct live state in
SiteTree->getAbsoluteLiveLink()
Was fetching the record from live (and its direct URLSegment),
but all of its parents from the current stage, which might be draft,
leading to "mixed" draft/live nested URLs which might no longer
be reachable in live mode.
---
code/model/SiteTree.php | 16 ++++++++--------
tests/model/SiteTreeTest.php | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php
index b4a25ef7..178522d9 100644
--- a/code/model/SiteTree.php
+++ b/code/model/SiteTree.php
@@ -455,18 +455,18 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* Get the absolute URL for this page on the Live site.
*/
public function getAbsoluteLiveLink($includeStageEqualsLive = true) {
+ $oldStage = Versioned::current_stage();
+ Versioned::reading_stage('Live');
$live = Versioned::get_one_by_stage('SiteTree', 'Live', '"SiteTree"."ID" = ' . $this->ID);
-
if($live) {
$link = $live->AbsoluteLink();
-
- if($includeStageEqualsLive) {
- $link .= '?stage=Live';
- }
-
- return $link;
-
+ if($includeStageEqualsLive) $link .= '?stage=Live';
+ } else {
+ $link = null;
}
+
+ Versioned::reading_stage($oldStage);
+ return $link;
}
/**
diff --git a/tests/model/SiteTreeTest.php b/tests/model/SiteTreeTest.php
index f8134aa3..c8a74551 100644
--- a/tests/model/SiteTreeTest.php
+++ b/tests/model/SiteTreeTest.php
@@ -356,6 +356,23 @@ class SiteTreeTest extends SapphireTest {
$this->assertEquals('about-us/edit', $about->RelativeLink('edit'), 'Matches URLSegment plus parameter on top level');
$this->assertEquals('about-us/tom&jerry', $about->RelativeLink('tom&jerry'), 'Doesnt url encode parameter');
}
+
+ function testAbsoluteLiveLink() {
+ $parent = $this->objFromFixture('Page', 'about');
+ $child = $this->objFromFixture('Page', 'staff');
+
+ SiteTree::enable_nested_urls();
+
+ $child->publish('Stage', 'Live');
+ $parent->URLSegment = 'changed-on-live';
+ $parent->write();
+ $parent->publish('Stage', 'Live');
+ $parent->URLSegment = 'changed-on-draft';
+ $parent->write();
+
+ $this->assertStringEndsWith('changed-on-live/my-staff/', $child->getAbsoluteLiveLink(false));
+ $this->assertStringEndsWith('changed-on-live/my-staff/?stage=Live', $child->getAbsoluteLiveLink());
+ }
function testDeleteFromStageOperatesRecursively() {
SiteTree::set_enforce_strict_hierarchy(false);
From cec461b767c7ddeaa6da3047d4b65bab43f98f7d Mon Sep 17 00:00:00 2001
From: Ingo Schommer
Date: Tue, 28 Aug 2012 19:07:12 +0200
Subject: [PATCH 15/27] BUG Use AbsoluteLiveLink() for CMS previews
It uses the correct live URLSegments for its parents
by setting the global Versioned reading mode correctly,
see 8a514d8b64 for detail.
---
code/controllers/CMSMain.php | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php
index dccb354c..ab43edf0 100644
--- a/code/controllers/CMSMain.php
+++ b/code/controllers/CMSMain.php
@@ -573,22 +573,21 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$fields->push($idField = new HiddenField("ID", false, $id));
// Necessary for different subsites
- $fields->push($liveURLField = new HiddenField("AbsoluteLink", false, $record->AbsoluteLink()));
- $fields->push($liveURLField = new HiddenField("LiveLink"));
- $fields->push($stageURLField = new HiddenField("StageLink"));
+ $fields->push($liveLinkField = new HiddenField("AbsoluteLink", false, $record->AbsoluteLink()));
+ $fields->push($liveLinkField = new HiddenField("LiveLink"));
+ $fields->push($stageLinkField = new HiddenField("StageLink"));
$fields->push(new HiddenField("TreeTitle", false, $record->TreeTitle));
$fields->push(new HiddenField('Sort','', $record->Sort));
if($record->ID && is_numeric( $record->ID ) ) {
- $liveRecord = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree\".\"ID\" = $record->ID");
- if($liveRecord) {
- $liveURLField->setValue(Controller::join_links($liveRecord->AbsoluteLink(), '?stage=Live'));
+ $liveLink = $record->getAbsoluteLiveLink();
+ if($liveLink) $liveLinkField->setValue($liveLink);
+ if(!$deletedFromStage) {
+ $stageLink = Controller::join_links($record->AbsoluteLink(), '?stage=Stage');
+ if($stageLink) $stageLinkField->setValue($stageLink);
}
}
- if(!$deletedFromStage) {
- $stageURLField->setValue(Controller::join_links($record->AbsoluteLink(), '?stage=Stage'));
- }
// Added in-line to the form, but plucked into different view by LeftAndMain.Preview.js upon load
if(in_array('CMSPreviewable', class_implements($record)) && !$fields->fieldByName('SilverStripeNavigator')) {
From 362e9795fdad62e42d926a909073c4e5ff491755 Mon Sep 17 00:00:00 2001
From: Naomi Guyer
Date: Wed, 29 Aug 2012 11:24:37 +1200
Subject: [PATCH 16/27] Replace tutorial link
---
templates/Includes/Install_successfullyinstalled.ss | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/templates/Includes/Install_successfullyinstalled.ss b/templates/Includes/Install_successfullyinstalled.ss
index 6fe35031..44b01499 100644
--- a/templates/Includes/Install_successfullyinstalled.ss
+++ b/templates/Includes/Install_successfullyinstalled.ss
@@ -3,7 +3,7 @@
<% if Project == 'tutorial' %>
- <%t ContentController.PostInstallTutorialIntro 'This website is a simplistic version of a SilverStripe 3 site. To extend this, please take a look at {link}.' link='our tutorials' %>
+ <%t ContentController.PostInstallTutorialIntro 'This website is a simplistic version of a SilverStripe 3 site. To extend this, please take a look at {link}.' link='our tutorials' %>
<% end_if %>
<%t ContentController.Email "Email" %>: $Username
From 949507c3feeea41d5559b82c2456300c2afe5f40 Mon Sep 17 00:00:00 2001
From: Hamish Friedlander
Date: Wed, 29 Aug 2012 14:48:23 +1200
Subject: [PATCH 17/27] NEW Add warning if viewed SiteTree object class is
obsolete
---
code/model/SiteTree.php | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php
index b4a25ef7..da9bcf59 100644
--- a/code/model/SiteTree.php
+++ b/code/model/SiteTree.php
@@ -1803,7 +1803,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
if($this->HasBrokenLink || $this->HasBrokenFile) {
$statusMessage[] = _t('SiteTree.HASBROKENLINKS', "This page has broken links.");
}
-
+
$dependentNote = '';
$dependentTable = new LiteralField('DependentNote', '');
@@ -1877,6 +1877,20 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$tabMain->setTitle(_t('SiteTree.TABCONTENT', "Main Content"));
+ if($this->ObsoleteClassName) {
+ $obsoleteWarning = _t(
+ 'SiteTree.OBSOLETECLASS',
+ "This page is of obsolete type {type}. Saving will reset it's type and you may lose data",
+ array('type' => $this->ObsoleteClassName)
+ );
+
+ $fields->addFieldToTab(
+ "Root.Main",
+ new LiteralField("ObsoleteWarningHeader", "$obsoleteWarning
"),
+ "Title"
+ );
+ }
+
if(file_exists(BASE_PATH . '/install.php')) {
$fields->addFieldToTab("Root.Main", new LiteralField("InstallWarningHeader",
"" . _t("SiteTree.REMOVE_INSTALL_WARNING",
From d9243cddde050c9d1d65533b92011dc0b5ce7fd1 Mon Sep 17 00:00:00 2001
From: Hamish Friedlander
Date: Wed, 29 Aug 2012 16:17:17 +1200
Subject: [PATCH 18/27] FIX Pages with obsolete class shouldnt do first
versionless write
---
code/controllers/CMSMain.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php
index dccb354c..bdd5fa2a 100644
--- a/code/controllers/CMSMain.php
+++ b/code/controllers/CMSMain.php
@@ -783,7 +783,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$record->HasBrokenLink = 0;
$record->HasBrokenFile = 0;
- $record->writeWithoutVersion();
+ if (!$record->ObsoleteClassName) $record->writeWithoutVersion();
// Update the class instance if necessary
if(isset($data['ClassName']) && $data['ClassName'] != $record->ClassName) {
From 651cb03ff20e96c36a8584cd42d2cf91ed5852d4 Mon Sep 17 00:00:00 2001
From: Ingo Schommer
Date: Wed, 29 Aug 2012 14:58:42 +0200
Subject: [PATCH 19/27] BUG Removed 'Sort' field from CMSMain edit form
Related to #7740. The sort field gets stale if the current
record is moved in the tree. Since the sort value can't
be altered by interacting with the form, its not required
as a hidden field, either.
---
code/controllers/CMSMain.php | 2 --
1 file changed, 2 deletions(-)
diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php
index 3e1a25f6..e925e87d 100644
--- a/code/controllers/CMSMain.php
+++ b/code/controllers/CMSMain.php
@@ -578,8 +578,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$fields->push($stageLinkField = new HiddenField("StageLink"));
$fields->push(new HiddenField("TreeTitle", false, $record->TreeTitle));
- $fields->push(new HiddenField('Sort','', $record->Sort));
-
if($record->ID && is_numeric( $record->ID ) ) {
$liveLink = $record->getAbsoluteLiveLink();
if($liveLink) $liveLinkField->setValue($liveLink);
From f454f481f25e25406e7b0236d89f19a65a4ea58c Mon Sep 17 00:00:00 2001
From: Ingo Schommer
Date: Tue, 28 Aug 2012 00:28:58 +0200
Subject: [PATCH 20/27] BUG Session namespace sharing for CMS controllers
Ideally we could do this without session, but pragmatically
we still need it, because of the inflexible routing system,
and because of performance considerations.
Example: The tree is lazy loaded via a generic URL (admin/pages/treeview).
While we could add ?ID= to make the view (more or less) stateless,
it would trigger a full tree reload on every tree navigation action.
Instead, we assume that all "reachable" nodes are already cached,
and simply mark a different one as current. For this to work, we need
shared session state between CMS controllers.
See http://open.silverstripe.org/ticket/7815 for detail.
---
code/controllers/CMSPageEditController.php | 2 ++
code/controllers/CMSPageHistoryController.php | 1 +
code/controllers/CMSPageSettingsController.php | 1 +
code/controllers/CMSPagesController.php | 9 +--------
4 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/code/controllers/CMSPageEditController.php b/code/controllers/CMSPageEditController.php
index 5027f6d9..05df5f2d 100644
--- a/code/controllers/CMSPageEditController.php
+++ b/code/controllers/CMSPageEditController.php
@@ -9,4 +9,6 @@ class CMSPageEditController extends CMSMain {
static $url_rule = '/$Action/$ID/$OtherID';
static $url_priority = 41;
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
+ static $session_namespace = 'CMSMain';
+
}
diff --git a/code/controllers/CMSPageHistoryController.php b/code/controllers/CMSPageHistoryController.php
index 3a076b65..43251753 100644
--- a/code/controllers/CMSPageHistoryController.php
+++ b/code/controllers/CMSPageHistoryController.php
@@ -11,6 +11,7 @@ class CMSPageHistoryController extends CMSMain {
static $url_priority = 42;
static $menu_title = 'History';
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
+ static $session_namespace = 'CMSMain';
static $allowed_actions = array(
'VersionsForm',
diff --git a/code/controllers/CMSPageSettingsController.php b/code/controllers/CMSPageSettingsController.php
index d8ff7d4d..592cad29 100644
--- a/code/controllers/CMSPageSettingsController.php
+++ b/code/controllers/CMSPageSettingsController.php
@@ -9,6 +9,7 @@ class CMSPageSettingsController extends CMSMain {
static $url_rule = '/$Action/$ID/$OtherID';
static $url_priority = 42;
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
+ static $session_namespace = 'CMSMain';
function getEditForm($id = null, $fields = null) {
$record = $this->getRecord($id ? $id : $this->currentPageID());
diff --git a/code/controllers/CMSPagesController.php b/code/controllers/CMSPagesController.php
index 5f401d7a..56aa2687 100644
--- a/code/controllers/CMSPagesController.php
+++ b/code/controllers/CMSPagesController.php
@@ -10,6 +10,7 @@ class CMSPagesController extends CMSMain {
static $url_priority = 40;
static $menu_title = 'Pages';
static $required_permission_codes = 'CMS_ACCESS_CMSMain';
+ static $session_namespace = 'CMSMain';
function LinkPreview() {
return false;
@@ -22,14 +23,6 @@ class CMSPagesController extends CMSMain {
return $this->request->getVar('view');
}
- /**
- * Doesn't deal with a single record, and we need
- * to avoid session state from previous record edits leaking in here.
- */
- public function currentPageID() {
- return false;
- }
-
public function isCurrentPage(DataObject $record) {
return false;
}
From e5401668faa9cff780202cb492c7b5c772c35249 Mon Sep 17 00:00:00 2001
From: Saophalkun Ponlu
Date: Thu, 30 Aug 2012 22:42:45 +1200
Subject: [PATCH 21/27] BUG Filter pages by LastEdited always returns an empty
list
This is caused by the input date values entered by the user are passed into query without converting in a correct format first.
---
code/controllers/CMSSiteTreeFilter.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/code/controllers/CMSSiteTreeFilter.php b/code/controllers/CMSSiteTreeFilter.php
index d75ebfbe..3b311a2a 100644
--- a/code/controllers/CMSSiteTreeFilter.php
+++ b/code/controllers/CMSSiteTreeFilter.php
@@ -194,11 +194,13 @@ class CMSSiteTreeFilter_Search extends CMSSiteTreeFilter {
break;
case 'LastEditedFrom':
- $query->where("\"LastEdited\" >= '$SQL_val'");
+ $fromDate = new DateField(null, null, $SQL_val);
+ $query->where("\"LastEdited\" >= '{$fromDate->dataValue()}'");
break;
case 'LastEditedTo':
- $query->where("\"LastEdited\" <= '$SQL_val'");
+ $toDate = new DateField(null, null, $SQL_val);
+ $query->where("\"LastEdited\" <= '{$toDate->dataValue()}'");
break;
case 'ClassName':
From 1cd82e2db1ab2bf3d60184b0b4e9aa626acb0b2e Mon Sep 17 00:00:00 2001
From: Ingo Schommer
Date: Sun, 2 Sep 2012 18:06:25 +0200
Subject: [PATCH 22/27] BUG Enforce $allowed_children in controllers on page
creation (fixes #7694)
Original bug fix contributed by @kmayo-ss
---
code/model/SiteTree.php | 2 +-
tests/controller/CMSMainTest.php | 47 ++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php
index 178522d9..9c632dfa 100644
--- a/code/model/SiteTree.php
+++ b/code/model/SiteTree.php
@@ -1511,7 +1511,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// deconstructs any inheritance trees already.
$allowed = $parent->allowedChildren();
$subject = ($this instanceof VirtualPage) ? $this->CopyContentFrom() : $this;
- if($subject->ID && !in_array($subject->ClassName, $allowed)) {
+ if(!in_array($subject->ClassName, $allowed)) {
$result->error(
_t(
diff --git a/tests/controller/CMSMainTest.php b/tests/controller/CMSMainTest.php
index 9b0e2fbc..14e5f74c 100644
--- a/tests/controller/CMSMainTest.php
+++ b/tests/controller/CMSMainTest.php
@@ -4,6 +4,7 @@
* @subpackage tests
*/
class CMSMainTest extends FunctionalTest {
+
static $fixture_file = 'CMSMainTest.yml';
protected $autoFollowRedirection = false;
@@ -221,6 +222,44 @@ class CMSMainTest extends FunctionalTest {
$this->session()->inst_set('loggedInAs', NULL);
}
+ function testCreationOfRestrictedPage(){
+ $adminUser = $this->objFromFixture('Member', 'admin');
+ $adminUser->logIn();
+
+ // 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)
+ );
+ $this->assertFalse($response->isError());
+ preg_match('/edit\/show\/(\d*)/', $response->getHeader('Location'), $matches);
+ $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)
+ );
+ $this->assertFalse($response->isError());
+ $this->assertNull($response->getBody());
+
+ // 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)
+ );
+ $this->assertFalse($response->isError());
+ $this->assertContains(
+ _t('SiteTree.PageTypeNotAllowed', array('type' => 'Page')),
+ $response->getBody()
+ );
+
+ $this->session()->inst_set('loggedInAs', NULL);
+ }
+
function testBreadcrumbs() {
$page3 = $this->objFromFixture('Page', 'page3');
$page31 = $this->objFromFixture('Page', 'page31');
@@ -239,3 +278,11 @@ class CMSMainTest extends FunctionalTest {
$this->session()->inst_set('loggedInAs', null);
}
}
+
+class CMSMainTest_ClassA extends Page implements TestOnly {
+ static $allowed_children = array('CMSMainTest_ClassB');
+}
+
+class CMSMainTest_ClassB extends Page implements TestOnly {
+
+}
\ No newline at end of file
From fd8e852c9277641ef5a1d496060e72653ba7dc91 Mon Sep 17 00:00:00 2001
From: Ingo Schommer
Date: Sun, 2 Sep 2012 18:07:00 +0200
Subject: [PATCH 23/27] BUG Disallow "add page here" shortcut to avoid
$allowed_children edge cases (fixes #7694)
---
javascript/CMSMain.Tree.js | 5 -----
1 file changed, 5 deletions(-)
diff --git a/javascript/CMSMain.Tree.js b/javascript/CMSMain.Tree.js
index 49d522ac..73b41c5c 100644
--- a/javascript/CMSMain.Tree.js
+++ b/javascript/CMSMain.Tree.js
@@ -41,11 +41,6 @@
if(allowedChildren.hasOwnProperty('allowedchildren-0')) {
menuitems['addsubpage'] = {
'label': ss.i18n._t('Tree.AddSubPage'),
- 'action': function(obj) {
- $('.cms-container').entwine('.ss').loadPanel(ss.i18n.sprintf(
- self.data('urlAddpage'), id, 'Page'
- ));
- },
'submenu': allowedChildren
};
}
From 53fdafb47378ab32ccf9f5dc05b1663cb68c8a55 Mon Sep 17 00:00:00 2001
From: jean
Date: Tue, 4 Sep 2012 11:26:09 +1200
Subject: [PATCH 24/27] NEW 7839 Support for documents as a file type in Files
and images
---
code/controllers/AssetAdmin.php | 1 +
lang/en_GB.yml | 1 +
lang/fr.yml | 1 +
3 files changed, 3 insertions(+)
diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php
index 429454ee..0fd1beab 100644
--- a/code/controllers/AssetAdmin.php
+++ b/code/controllers/AssetAdmin.php
@@ -336,6 +336,7 @@ JS
'mov' => _t('AssetAdmin.AppCategoryVideo', 'Video'),
'flash' => _t('AssetAdmin.AppCategoryFlash', 'Flash', 'The fileformat'),
'zip' => _t('AssetAdmin.AppCategoryArchive', 'Archive', 'A collection of files'),
+ 'doc' => _t('AssetAdmin.AppCategoryDocument', 'Document')
);
$context->addField(
$typeDropdown = new DropdownField(
diff --git a/lang/en_GB.yml b/lang/en_GB.yml
index e959902c..3c1dd1c5 100644
--- a/lang/en_GB.yml
+++ b/lang/en_GB.yml
@@ -8,6 +8,7 @@ en_GB:
AppCategoryFlash: Flash
AppCategoryImage: Image
AppCategoryVideo: Video
+ AppCategoryDocument: Document
BackToFolder: 'Back to folder'
CREATED: Date
CurrentFolderOnly: 'Limit to current folder?'
diff --git a/lang/fr.yml b/lang/fr.yml
index 86236a03..7765d2af 100644
--- a/lang/fr.yml
+++ b/lang/fr.yml
@@ -8,6 +8,7 @@ fr:
AppCategoryFlash: Flash
AppCategoryImage: Image
AppCategoryVideo: Vidéo
+ AppCategoryDocument: Document
BackToFolder: 'Revenir au dossier'
CREATED: Date
CurrentFolderOnly: 'Limiter au dossier actuel ?'
From 2934423ebc573a0ba0ebbf2874181713cf5adf3f Mon Sep 17 00:00:00 2001
From: Niklas Forsdahl
Date: Tue, 4 Sep 2012 08:55:38 +0300
Subject: [PATCH 25/27] BUG: Page type names not translated in pages overview
search form
Fixed by using the singularname translation for the class as values in the page
types array used for the page types dropdown field.
---
code/controllers/CMSMain.php | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php
index c791cfc2..aa3612db 100644
--- a/code/controllers/CMSMain.php
+++ b/code/controllers/CMSMain.php
@@ -247,8 +247,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
function SearchForm() {
// get all page types in a dropdown-compatible format
- $pageTypes = SiteTree::page_type_classes();
- $pageTypes = array_combine($pageTypes, $pageTypes);
+ $pageTypeClasses = SiteTree::page_type_classes();
+ $pageTypes = array();
+ foreach ($pageTypeClasses as $pageTypeClass) {
+ $pageTypes[$pageTypeClass] = _t($pageTypeClass.'.SINGULARNAME', $pageTypeClass);
+ }
asort($pageTypes);
// get all filter instances
From f843dd56dc4a09bf961244b05957c49cd5757391 Mon Sep 17 00:00:00 2001
From: Andrew O'Neil
Date: Tue, 4 Sep 2012 14:51:14 +1200
Subject: [PATCH 26/27] BUGFIX: Fix site tree filter not showing parents of
results more than a level deep in the hierachy
---
code/controllers/CMSSiteTreeFilter.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/code/controllers/CMSSiteTreeFilter.php b/code/controllers/CMSSiteTreeFilter.php
index 3b311a2a..25067baa 100644
--- a/code/controllers/CMSSiteTreeFilter.php
+++ b/code/controllers/CMSSiteTreeFilter.php
@@ -71,13 +71,15 @@ abstract class CMSSiteTreeFilter extends Object {
$parents[$pageArr['ParentID']] = true;
$this->_cache_ids[$pageArr['ID']] = true;
}
-
- if(!empty($parents)) {
+
+ while(!empty($parents)) {
$q = new SQLQuery();
$q->setSelect(array('"ID"','"ParentID"'))
->setFrom('"SiteTree"')
->setWhere('"ID" in ('.implode(',',array_keys($parents)).')');
+ $parents = array();
+
foreach($q->execute() as $row) {
if ($row['ParentID']) $parents[$row['ParentID']] = true;
$this->_cache_ids[$row['ID']] = true;
From 02e95adb4c8e69e599d873e501d80bc85cb5495a Mon Sep 17 00:00:00 2001
From: Damian Mooyman
Date: Fri, 7 Sep 2012 17:06:29 +0200
Subject: [PATCH 27/27] BUG Consistently save SiteConfig, and refactor
Translatable hooks
Squashed commit of the following:
commit a60eddfacc710d3047bd1d5107e5df0cc6dba93c
Merge: c847b55 76be14b
Author: Ingo Schommer
Date: Fri Sep 7 17:02:47 2012 +0200
Merge branch '3.0-translation-migration' of git://github.com/tractorcow/silverstripe-cms into tractorcow-3.0-translation-migration
commit 76be14b1fccc05b5dcca8c805e0354a42e75135d
Author: Damian Mooyman
Date: Fri Aug 24 08:28:18 2012 +1200
FIXED: Indentation
commit 715b60387c970846db1bf9a5f14140aee49ce665
Author: Damian Mooyman
Date: Fri Aug 24 08:25:14 2012 +1200
FIXED: Coding style inconsistencies
commit 6395f9030ed65b24494842ce74864ff7ebbf6c5e
Author: Damian Mooyman
Date: Thu Aug 16 16:30:11 2012 +1200
FIXED: Issue where new SiteConfig instances weren't always saved to the database
commit aca242e31c8d98ee3b8acc397bf605ceb964e1bf
Author: Damian Mooyman
Date: Thu Aug 16 14:22:56 2012 +1200
UPDATED: Refactored Translation module specific code out of the SiteConfig
---
code/model/SiteConfig.php | 76 +++++++++++----------------------------
code/model/SiteTree.php | 12 +++----
2 files changed, 24 insertions(+), 64 deletions(-)
diff --git a/code/model/SiteConfig.php b/code/model/SiteConfig.php
index 89ea9a85..b7573d88 100644
--- a/code/model/SiteConfig.php
+++ b/code/model/SiteConfig.php
@@ -1,15 +1,8 @@
Title = _t('SiteConfig.SITENAMEDEFAULT', "Your Site Name");
+ $this->Tagline = _t('SiteConfig.TAGLINEDEFAULT', "your tagline here");
+
+ // Allow these defaults to be overridden
+ parent::populateDefaults();
+ }
+
/**
* Get the fields that are sent to the CMS. In
* your extensions: updateCMSFields($fields)
@@ -84,13 +86,6 @@ class SiteConfig extends DataObject implements PermissionProvider {
$topLevelCreatorsOptionsField->setSource($editorsOptionsSource);
- // Translatable doesn't handle updateCMSFields on DataObjects,
- // so add it here to save the current Locale,
- // because onBeforeWrite does not work.
- if(class_exists('Translatable') && Object::has_extension('SiteConfig',"Translatable")){
- $fields->push(new HiddenField("Locale"));
- }
-
if (!Permission::check('EDIT_SITECONFIG')) {
$fields->makeFieldReadonly($viewersOptionsField);
$fields->makeFieldReadonly($viewerGroupsField);
@@ -161,22 +156,14 @@ class SiteConfig extends DataObject implements PermissionProvider {
* Get the current sites SiteConfig, and creates a new one
* through {@link make_site_config()} if none is found.
*
- * @param string $locale
* @return SiteConfig
*/
- static function current_site_config($locale = null) {
- if(class_exists('Translatable') && Object::has_extension('SiteConfig',"Translatable")){
- $locale = isset($locale) ? $locale : Translatable::get_current_locale();
- $siteConfig = Translatable::get_one_by_locale('SiteConfig', $locale);
- } else {
- $siteConfig = DataObject::get_one('SiteConfig');
- }
+ static function current_site_config() {
+ if ($siteConfig = DataObject::get_one('SiteConfig')) return $siteConfig;
- if (!$siteConfig) $siteConfig = self::make_site_config($locale);
-
- return $siteConfig;
+ return self::make_site_config();
}
-
+
/**
* Setup a default SiteConfig record if none exists
*/
@@ -191,39 +178,16 @@ class SiteConfig extends DataObject implements PermissionProvider {
/**
* Create SiteConfig with defaults from language file.
- * if Translatable is enabled on SiteConfig, see if one already exist
- * and use those values for the translated defaults.
*
* @param string $locale
* @return SiteConfig
*/
- static function make_site_config($locale = null) {
- if(class_exists('Translatable') && !$locale) $locale = Translatable::get_current_locale();
-
- $siteConfig = new SiteConfig();
- $siteConfig->Title = _t('SiteConfig.SITENAMEDEFAULT',"Your Site Name");
- $siteConfig->Tagline = _t('SiteConfig.TAGLINEDEFAULT',"your tagline here");
+ static function make_site_config() {
+ $config = SiteConfig::create();
+ $config->write();
+ return $config;
+ }
- if(class_exists('Translatable') && $siteConfig->hasExtension('Translatable')){
- Translatable::disable_locale_filter();
- $defaultConfig = SiteConfig::get()->first();
- Translatable::enable_locale_filter();
-
- if($defaultConfig){
- return $defaultConfig->createTranslation($locale);
- }
-
- // TODO Copy view/edit group settings
-
- // set the correct Locale
- $siteConfig->Locale = $locale;
- }
-
- $siteConfig->write();
-
- return $siteConfig;
- }
-
/**
* Can a user view pages on this site? This method is only
* called if a page is set to Inherit, but there is nothing
diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php
index 06f7c961..16d510a2 100644
--- a/code/model/SiteTree.php
+++ b/code/model/SiteTree.php
@@ -991,17 +991,13 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* Stub method to get the site config, provided so it's easy to override
*/
function getSiteConfig() {
- $altConfig = false;
+
if($this->hasMethod('alternateSiteConfig')) {
$altConfig = $this->alternateSiteConfig();
+ if($altConfig) return $altConfig;
}
- if($altConfig) {
- return $altConfig;
- } elseif(class_exists('Translatable') && $this->hasExtension('Translatable')) {
- return SiteConfig::current_site_config($this->Locale);
- } else {
- return SiteConfig::current_site_config();
- }
+
+ return SiteConfig::current_site_config();
}
/**