Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Supressed dependencies of tree logic on SiteTree elements (not …

…properly isolated to work well with Folder objects)
  • Loading branch information...
commit ce3d48e310265f80ad141c1178596139573748f9 1 parent b1d95cf
@chillu chillu authored
View
2  admin/code/LeftAndMain.php
@@ -663,7 +663,7 @@ function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $num
$titleFn = function(&$child) use(&$controller, &$recordController) {
$classes = $child->CMSTreeClasses();
if($controller->isCurrentPage($child)) $classes .= " current";
- $flags = $child->getStatusFlags();
+ $flags = $child->hasMethod('getStatusFlags') ? $child->getStatusFlags() : false;
if($flags) $classes .= ' ' . implode(' ', array_keys($flags));
return "<li id=\"record-$child->ID\" data-id=\"$child->ID\" data-pagetype=\"$child->ClassName\" class=\"" . $classes . "\">" .
"<ins class=\"jstree-icon\">&nbsp;</ins>" .
View
9 admin/javascript/LeftAndMain.Tree.js
@@ -134,7 +134,7 @@
hints = self.getHints(),
disallowedChildren = [],
hintKey = newParentClass ? newParentClass : 'Root',
- hint = (typeof hints[hintKey] != 'undefined') ? hints[hintKey] : null;
+ hint = (hints && typeof hints[hintKey] != 'undefined') ? hints[hintKey] : null;
// Special case for VirtualPage: Check that original page type is an allowed child
if(hint && movedNode.attr('class').match(/VirtualPage-([^\s]*)/)) movedNodeClass = RegExp.$1;
@@ -211,7 +211,8 @@
updateFromEditForm: function(origData) {
var self = this,
form = $('.cms-edit-form').get(0),
- id = form ? $(form.ID).val() : null;
+ id = form ? $(form.ID).val() : null,
+ urlEditPage = this.data('urlEditpage');
// check if a form with a valid ID exists
if(id) {
@@ -234,7 +235,7 @@
node.addClass(statusFlags.join(' '));
// check if node exists, might have been created instead
- if(!node.length) {
+ if(!node.length && urlEditPage) {
this.jstree(
'create_node',
parentNode,
@@ -251,7 +252,7 @@
var newNode = self.find('li[data-id='+id+']');
// TODO Fix replacement of jstree-icon inside <a> tag
newNode.find('a:first').html(title).attr('href', ss.i18n.sprintf(
- self.data('urlEditpage'), id
+ urlEditPage, id
));
self.jstree('deselect_all');
self.jstree('select_node', newNode);
Please sign in to comment.
Something went wrong with that request. Please try again.