From 323edd03cb04f24a592c680b38144276b401ac60 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 12 Jan 2012 22:34:05 +0100 Subject: [PATCH] BUGFIX Check original page type of VirtualPage when doing tree drop target checks (AIR-81) --- javascript/LeftAndMain_left.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/javascript/LeftAndMain_left.js b/javascript/LeftAndMain_left.js index ab278c2b..a3faa6c6 100755 --- a/javascript/LeftAndMain_left.js +++ b/javascript/LeftAndMain_left.js @@ -422,6 +422,15 @@ SiteTreeNode.prototype = { alert("You can't add children to that node"); return false; } + + // Special case for VirtualPage: Check that original page type is an allowed child + if(Element.hasClassName(node, 'VirtualPage') && node.className.match(/VirtualPage-([^\s]*)/)) { + var nodeClass = RegExp.$1 + if(nodeClass && newParent.hints.allowedChildren.indexOf(nodeClass) == -1) { + alert("You can't move a virtual page with an original type of '" + nodeClass + '" here'); + return false; + } + } var currentlyOpenPageID = 0; if($('Form_EditForm').elements.ID) currentlyOpenPageID = $('Form_EditForm').elements.ID.value;