From f7b6f1de5aff8451ab6bb6bc6021036ce70bc0f9 Mon Sep 17 00:00:00 2001 From: carlos barberis Date: Wed, 18 Jul 2012 16:47:17 +1200 Subject: [PATCH 1/5] BUGFIX: ticket #5239 - Infinite loop: live subpage of draft page redirects onto itself when called just by url segment --- code/controllers/ModelAsController.php | 9 +++++-- tests/controller/ModelAsControllerTest.php | 30 +++++++++++++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/code/controllers/ModelAsController.php b/code/controllers/ModelAsController.php index c1d260f8..c57bf45e 100644 --- a/code/controllers/ModelAsController.php +++ b/code/controllers/ModelAsController.php @@ -159,7 +159,11 @@ class ModelAsController extends Controller implements NestedController { 'SiteTree', "\"URLSegment\" = '$URLSegment'" . ($useParentIDFilter ? ' AND "ParentID" = ' . (int)$parentID : '') ); - if($pages && $pages->Count() == 1) return $pages->First(); + + if($pages && $pages->Count() == 1 && ($page = $pages->First())) { + $parent = $page->ParentID ? $page->Parent() : $page; + if($parent->isPublished()) return $page; + } } // Get an old version of a page that has been renamed. @@ -175,8 +179,9 @@ class ModelAsController extends Controller implements NestedController { $record = $query->execute()->first(); if($record && ($oldPage = DataObject::get_by_id('SiteTree', $record['RecordID']))) { + $oldParent = $oldPage->ParentID ? $oldPage->Parent() : $oldPage; // Run the page through an extra filter to ensure that all extensions are applied. - if(SiteTree::get_by_link($oldPage->RelativeLink())) return $oldPage; + if(SiteTree::get_by_link($oldPage->RelativeLink()) && $oldParent->isPublished()) return $oldPage; } } diff --git a/tests/controller/ModelAsControllerTest.php b/tests/controller/ModelAsControllerTest.php index 8ffd9ac9..e46aa984 100644 --- a/tests/controller/ModelAsControllerTest.php +++ b/tests/controller/ModelAsControllerTest.php @@ -233,5 +233,33 @@ class ModelAsControllerTest extends FunctionalTest { $response = ModelAsController::find_old_page('oldpage2',$page2->ID); $this->assertEquals(false, $response ); } - + + /** + * go to a page that's been published but is child of an unpublished page + * + * NOTE: This test requires nested_urls + */ + function testChildOfDraft() { + RootURLController::reset(); + SiteTree::enable_nested_urls(); + + $draft = new Page(); + $draft->Title = 'Root Leve Draft Page'; + $draft->URLSegment = 'root'; + $draft->write(); + + $published = new Page(); + $published->Title = 'Published Page Under Draft Page'; + $published->URLSegment = 'sub-root'; + $published->write(); + $published->publish('Stage', 'Live'); + $response = $this->get('root/sub-root'); + + $this->assertEquals( + $response->getStatusCode(), + 404, + 'The page should not be found since its parent has not been published, in this case http:///root/sub-root or http:///sub-root' + ); + } + } From 2ba3fbe42d3cf4b5a8608c925f735a09f2109a59 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 17 Jul 2012 22:19:25 +0200 Subject: [PATCH 2/5] 'updatetreenodes' URL in tree template (#7450) --- templates/Includes/CMSMain_TreeView.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/Includes/CMSMain_TreeView.ss b/templates/Includes/CMSMain_TreeView.ss index 248a977d..9c54d888 100644 --- a/templates/Includes/CMSMain_TreeView.ss +++ b/templates/Includes/CMSMain_TreeView.ss @@ -22,7 +22,7 @@ $ExtraTreeTools <% end_if %> -
+
$SiteTreeAsUL
From ace2dfe54f17408068bd2c5f7a770f84314df4a9 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Mon, 23 Jul 2012 22:15:42 +1200 Subject: [PATCH 3/5] Make compass not include line number comments --- config.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config.rb b/config.rb index 7838e4dc..f685460d 100644 --- a/config.rb +++ b/config.rb @@ -9,6 +9,7 @@ sass_dir = "scss" images_dir = "images" javascripts_dir = "javascript" output_style = :compact +line_comments = false # To enable relative paths to assets via compass helper functions. Uncomment: # relative_assets = true From 1717e400f61495b6b5cbeea3b1f53939b48d03b7 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Mon, 23 Jul 2012 22:16:39 +1200 Subject: [PATCH 4/5] Always show badge on current page in side tree --- css/screen.css | 2 +- scss/_CMSMain.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/css/screen.css b/css/screen.css index 4d793a86..5b88d57d 100644 --- a/css/screen.css +++ b/css/screen.css @@ -18,7 +18,7 @@ .cms-content-tools #cms-content-treeview .cms-tree-expand-trigger { display: inline-block; margin: 0 0 2px 0; position: absolute; top: 8px; right: 4px; } .cms-content-tools #cms-content-treeview .cms-tree-expand-trigger span.ui-button-text { padding-right: 8px; } .cms-content-tools #cms-content-treeview .cms-tree .badge, .cms-content-tools #cms-content-treeview .cms-tree a > .jstree-icon { display: none; } -.cms-content-tools #cms-content-treeview .cms-tree a:hover > .text > .badge { display: inline-block; } +.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; } diff --git a/scss/_CMSMain.scss b/scss/_CMSMain.scss index ab71f649..35f6c4f7 100644 --- a/scss/_CMSMain.scss +++ b/scss/_CMSMain.scss @@ -84,7 +84,7 @@ } // Show badge on hovered node - a:hover > .text > .badge { + a:hover > .text > .badge, .jstree-clicked > .text > .badge { display: inline-block; } } From 6b20bc89ecd4f494150c215e391096d7143564f8 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Wed, 25 Jul 2012 09:43:18 +1200 Subject: [PATCH 5/5] Add javascript japanese translation - thanks Yuki Awano --- javascript/lang/ja_JP.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 javascript/lang/ja_JP.js diff --git a/javascript/lang/ja_JP.js b/javascript/lang/ja_JP.js new file mode 100644 index 00000000..9e7a4073 --- /dev/null +++ b/javascript/lang/ja_JP.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('ja_JP', { + 'CMSMAIN.WARNINGSAVEPAGESBEFOREADDING' : "子ページを追加する前に,そのページを保存する必要があります.", + 'CMSMAIN.CANTADDCHILDREN' : "選択されたノードには子供を追加することはできません.", + 'CMSMAIN.ERRORADDINGPAGE' : 'ページの追加でエラーが起きました.', + 'CMSMAIN.FILTEREDTREE' : '変更されたページのみ表示するフィルタされたツリー', + 'CMSMAIN.ERRORFILTERPAGES' : '変更されたページのみ表示するようにツリーをフィルタできませんでした
%s', + 'CMSMAIN.ERRORUNFILTER' : 'フィルタされていないツリー', + 'CMSMAIN.PUBLISHINGPAGES' : 'ページを公開しています...', + 'CMSMAIN.SELECTONEPAGE' : "最低でも1ページ選択してください.", + 'CMSMAIN.ERRORPUBLISHING' : 'ページを公開中にエラー', + 'CMSMAIN.REALLYDELETEPAGES' : "Do you really want to delete the %s marked pages?", + 'CMSMAIN.DELETINGPAGES' : 'ページを削除しています', + 'CMSMAIN.ERRORDELETINGPAGES': 'ページ削除においてエラー', + 'CMSMAIN.PUBLISHING' : '公開しています...', + 'CMSMAIN.RESTORING': '復元しています...', + 'CMSMAIN.ERRORREVERTING': 'Error reverting to live content', + 'CMSMAIN.SAVING' : '保存しています...', + 'CMSMAIN.SELECTMOREPAGES' : "You have %s pages selected.\n\nDo you really want to perform this action?", + 'CMSMAIN.ALERTCLASSNAME': 'ページ保存後にページの種類は更新されます.', + 'CMSMAIN.URLSEGMENTVALIDATION': 'URLはアルファベットの文字か数値,及びハイフンのみから構成されます.', + 'AssetAdmin.BATCHACTIONSDELETECONFIRM': "%sフォルダを本当に削除しますか?", + 'AssetTableField.REALLYDELETE': 'マークされているファイルを本当に削除しますか?', + 'AssetTableField.MOVING': '%sファイルを移動中.', + 'CMSMAIN.AddSearchCriteria': 'Add Criteria', + 'WidgetAreaEditor.TOOMANY': '申し訳ございません.このエリアにおけるウィジェットの最大数に到達しました.', + 'AssetAdmin.ConfirmDelete': 'このフォルダとフォルダに含まれるすべてのファイルを本当に削除しますか?', + 'Folder.Name': 'フォルダ名', + 'Tree.AddSubPage': 'ここに新しいページを追加', + 'Tree.EditPage': '編集', + 'CMSMain.ConfirmRestoreFromLive': "公開されているコンテンツを下書きサイトへ本当にコピーしますか?", + 'CMSMain.RollbackToVersion': "このページのバージョン#%sへ本当にロールバックしますか?" + }); +}