MINOR Renamed #sitetree_ul to .cms-tree in templates, removed #sitetree from contained <ul> (unnecessary duplication)

This commit is contained in:
Ingo Schommer 2011-04-17 19:55:23 +12:00
parent ce05ce78e5
commit f4cb6ae40f
8 changed files with 9 additions and 74 deletions

View File

@ -535,7 +535,7 @@ class LeftAndMain extends Controller {
$treeTitle = '...';
}
$html = "<ul id=\"sitetree\" class=\"tree unformatted\"><li id=\"record-0\" data-id=\"0\"class=\"Root nodelete\"><a href=\"$rootLink\"><strong>$treeTitle</strong></a>"
$html = "<ul><li id=\"record-0\" data-id=\"0\"class=\"Root nodelete\"><a href=\"$rootLink\"><strong>$treeTitle</strong></a>"
. $html . "</li></ul>";
}

View File

@ -40,7 +40,7 @@
Observable.applyTo(this[0]);
var tree = $('#sitetree');
var tree = $('.cms-tree');
this.setTree(tree);
// Event bindings

View File

@ -36,7 +36,7 @@
* Constructor: onmatch
*/
onmatch: function() {
var self = this, tree = $('#sitetree');
var self = this, tree = $('.cms-tree');
this.setTree(tree);

View File

@ -6,7 +6,7 @@
$.entwine('ss', function($){
$('#sitetree').entwine({
$('.cms-tree').entwine({
onmatch: function() {
this._super();
@ -264,7 +264,7 @@
});
});
$('#sitetree.multiple').entwine({
$('.cms-tree.multiple').entwine({
onmatch: function() {
this._super();
@ -286,7 +286,7 @@
}
});
$('#sitetree li').entwine({
$('.cms-tree li').entwine({
/**
* Function: setEnabled

View File

@ -12,7 +12,7 @@
if(memberTableField) memberTableField.refresh();
// Refresh tree
var tree = $(window.parent.document).find('#sitetree').get(0);
var tree = $(window.parent.document).find('.cms-tree').get(0);
if(tree) tree.reload();
}
};

View File

@ -36,7 +36,7 @@
</label>
</div>
<div id="sitetree" data-url-tree="$Link(getsubtree)" data-url-savetreenode="$Link(savetreenode)" class="jstree jstree-apple">
<div data-url-tree="$Link(getsubtree)" data-url-savetreenode="$Link(savetreenode)" class="cms-tree jstree jstree-apple">
$SiteTreeAsUL
</div>

View File

@ -1,65 +0,0 @@
# Extending the CMS
CMSMain is part of the CMS. It is the controller for the content editor.
## Creating another hierarchical editor by subclassing CMSMain
Sometimes you'll want to provide an administration interface that is pretty much exactly what CMSMain provides, but it's
not appropriate to include your data in with the site content.
Here's how you can do this:
## Using classes other than SiteTree in the site tree
It is possible to use to different classes in two separate site trees. For example, there is the usual site
content tree and a category tree. To change that find:
:::php
static $tree_class = 'SiteTree';
And change the string to the name of the class that will be the base class for classes visible in the site tree.
## Overloading page urls
If using a url other than admin/ for your section then you will need to change the SiteTreeHandlers to use the correct
controller.
Create the init method:
:::php
function init() {
parent::init();
Requirements::javascript('project-name/javascript/Classname_left.js');
}
Where project-name and Classname are changed as appropriate.
Create the javascript file and add the handlers:
:::php
if(typeof SiteTreeHandlers == 'undefined') SiteTreeHandlers = {};
SiteTreeHandlers.parentChanged_url = 'url/ajaxupdateparent';
SiteTreeHandlers.orderChanged_url = 'url/ajaxupdatesort';
SiteTreeHandlers.showRecord_url = 'url/show/';
SiteTreeHandlers.loadPage_url = 'url/show/';
SiteTreeHandlers.loadTree_url = 'url/getsubtree';
where url is the relative link to the page (eg 'admin/categories'). You can change the handler functions as necessary.
## Overloading EditForm
You may need to overload EditForm if your class does not use the `[api:Versioned]` extension.
## Overloading SiteTreeAsUL
The tree hints can sometimes cause problems when reorganising the tree, and the CMSMain::SiteTreeAsUL function uses
`[api:SiteTree]` explicitly. Use:
:::php
public function SiteTreeAsUL() {
// $this->generateDataTreeHints();
$this->generateTreeStylingJS();
return $this->getSiteTreeFor( $this->stat('tree_class') );
}

View File

@ -602,7 +602,7 @@ The CMS has a number of Observer-pattern hooks you can access: (The elements whi
* BeforeSave -- after user clicks 'Save', before AJAX save-request (#Form_EditForm)
* PageLoaded -- after new SiteTree page is loaded. (#Form_EditForm)
* PageSaved -- after AJAX save-request is successful (#Form_EditForm)
* SelectionChanged -- when new item is chosen from SiteTree (#sitetree)
* SelectionChanged -- when new item is chosen from SiteTree (.cms-tree)
Here's an example of hooking the 'PageLoaded' and 'BeforeSave' methods: