diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 1f915506..a6fcdac5 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -157,12 +157,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr return $this->LinkWithSearch(singleton('CMSMain')->Link('galleryview')); } - public function LinkPageEdit() { - if($id = $this->currentPageID()) { - return $this->LinkWithSearch( - Controller::join_links(singleton('CMSPageEditController')->Link('show'), $id) - ); - } + public function LinkPageEdit($id = null) { + if(!$id) $id = $this->currentPageID(); + return $this->LinkWithSearch( + Controller::join_links(singleton('CMSPageEditController')->Link('show'), $id) + ); } public function LinkPageSettings() { diff --git a/code/controllers/CMSPageAddController.php b/code/controllers/CMSPageAddController.php index ba348281..c658438e 100644 --- a/code/controllers/CMSPageAddController.php +++ b/code/controllers/CMSPageAddController.php @@ -16,18 +16,6 @@ class CMSPageAddController extends CMSPageEditController { * @return Form */ function AddForm() { - // If request send from rightclick-submenu, directly add Page - if(($pageType = $this->request->getVar('Type')) && ($parentID = $this->request->getVar('ParentID'))) { - $data = array( - "PageType" => (string)$pageType, - "ParentID" => $parentID, - "ParentModeField" => "child" - ); - $this->doAdd($data, null); - return; - } - - $record = $this->currentPage(); $pageTypes = array(); diff --git a/javascript/CMSMain.Tree.js b/javascript/CMSMain.Tree.js index d3a3666c..91f687ed 100644 --- a/javascript/CMSMain.Tree.js +++ b/javascript/CMSMain.Tree.js @@ -3,8 +3,7 @@ $.entwine('ss', function($){ $('.cms-tree').entwine({ getTreeConfig: function() { - var config = this._super(); - var hints = this.getHints(); + var self = this, config = this._super(), hints = this.getHints(); config.plugins.push('contextmenu'); config.contextmenu = { 'items': function(node) { @@ -19,8 +18,9 @@ 'label': '' + val.ssname, '_class': 'class-' + val.ssclass, 'action': function(obj) { - // TODO Fix hardcoding of link - $('.cms-container').loadPanel('admin/pages/add/?ParentID=' + id + '&Type=' + val.ssclass); + $('.cms-container').loadPanel(ss.i18n.sprintf( + self.data('urlAddpage'), id, val.ssclass + )); } }; } @@ -30,8 +30,9 @@ 'edit': { 'label': ss.i18n._t('Tree.EditPage'), 'action': function(obj) { - // TODO Fix hardcoding of link - $('.cms-container').loadPanel('admin/pages/add/show/' + obj.data('id')); + $('.cms-container').loadPanel(ss.i18n.sprintf( + self.data('urlEditpage'), obj.data('id') + )); } } }; @@ -40,8 +41,9 @@ menuitems['addsubpage'] = { 'label': ss.i18n._t('Tree.AddSubPage'), 'action': function(obj) { - // TODO Fix hardcoding of link - $('.cms-container').loadPanel('admin/pages/add/?ParentID=' + obj.data('id')); + $('.cms-container').loadPanel(ss.i18n.sprintf( + self.data('urlAddpage'), id, 'Page' + )); }, 'submenu': allowedChildren }; diff --git a/templates/Includes/CMSMain_TreeView.ss b/templates/Includes/CMSMain_TreeView.ss index d62eeb1e..72a41111 100644 --- a/templates/Includes/CMSMain_TreeView.ss +++ b/templates/Includes/CMSMain_TreeView.ss @@ -20,7 +20,7 @@ <% end_if %> -
+
$SiteTreeAsUL