Skip to content
Browse files

MINOR Moved tree context menu javascript from LeftAndMain.js into Lef…

…tAndMain_left.js

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92694 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent fe82f39 commit bf6ff4addb915efc09f1606977b0843bee0a340f @chillu chillu committed Nov 21, 2009
Showing with 57 additions and 57 deletions.
  1. +0 −57 javascript/LeftAndMain.js
  2. +57 −0 javascript/LeftAndMain_left.js
View
57 javascript/LeftAndMain.js
@@ -425,63 +425,6 @@ returnFalse = function() {
return false;
}
-var _CURRENT_CONTEXT_MENU = null;
-
-/**
- * Create a new context menu
- * @param event The event object
- * @param owner The DOM element that this context-menu was requested from
- * @param menuItems A map of title -> method; context-menu operations to get called
- */
-function createContextMenu(event, owner, menuItems) {
- if(_CURRENT_CONTEXT_MENU) {
- document.body.removeChild(_CURRENT_CONTEXT_MENU);
- _CURRENT_CONTEXT_MENU = null;
- }
-
- var menu = document.createElement("ul");
- menu.className = 'contextMenu';
- menu.style.position = 'absolute';
- menu.style.left = event.clientX + 'px';
- menu.style.top = event.clientY + 'px';
-
- var menuItemName, menuItemTag, menuATag;
- for(menuItemName in menuItems) {
- menuItemTag = document.createElement("li");
-
- menuATag = document.createElement("a");
- menuATag.href = "#";
- menuATag.onclick = menuATag.oncontextmenu = contextmenu_onclick;
- menuATag.innerHTML = menuItemName;
- menuATag.handler = menuItems[menuItemName];
- menuATag.owner = owner;
-
- menuItemTag.appendChild(menuATag);
- menu.appendChild(menuItemTag);
- }
-
- document.body.appendChild(menu);
-
- document.body.onclick = contextmenu_close;
-
- _CURRENT_CONTEXT_MENU = menu;
-
- return menu;
-}
-
-function contextmenu_close() {
- if(_CURRENT_CONTEXT_MENU) {
- document.body.removeChild(_CURRENT_CONTEXT_MENU);
- _CURRENT_CONTEXT_MENU = null;
- }
-}
-
-function contextmenu_onclick() {
- this.handler(this.owner);
- contextmenu_close();
- return false;
-}
-
/**
* Find and enable TinyMCE on all htmleditor fields
* Pulled in from old tinymce.template.js
View
57 javascript/LeftAndMain_left.js
@@ -539,3 +539,60 @@ ReorganiseAction.prototype = {
}
}
}
+
+var _CURRENT_CONTEXT_MENU = null;
+
+/**
+ * Create a new context menu
+ * @param event The event object
+ * @param owner The DOM element that this context-menu was requested from
+ * @param menuItems A map of title -> method; context-menu operations to get called
+ */
+function createContextMenu(event, owner, menuItems) {
+ if(_CURRENT_CONTEXT_MENU) {
+ document.body.removeChild(_CURRENT_CONTEXT_MENU);
+ _CURRENT_CONTEXT_MENU = null;
+ }
+
+ var menu = document.createElement("ul");
+ menu.className = 'contextMenu';
+ menu.style.position = 'absolute';
+ menu.style.left = event.clientX + 'px';
+ menu.style.top = event.clientY + 'px';
+
+ var menuItemName, menuItemTag, menuATag;
+ for(menuItemName in menuItems) {
+ menuItemTag = document.createElement("li");
+
+ menuATag = document.createElement("a");
+ menuATag.href = "#";
+ menuATag.onclick = menuATag.oncontextmenu = contextmenu_onclick;
+ menuATag.innerHTML = menuItemName;
+ menuATag.handler = menuItems[menuItemName];
+ menuATag.owner = owner;
+
+ menuItemTag.appendChild(menuATag);
+ menu.appendChild(menuItemTag);
+ }
+
+ document.body.appendChild(menu);
+
+ document.body.onclick = contextmenu_close;
+
+ _CURRENT_CONTEXT_MENU = menu;
+
+ return menu;
+}
+
+function contextmenu_close() {
+ if(_CURRENT_CONTEXT_MENU) {
+ document.body.removeChild(_CURRENT_CONTEXT_MENU);
+ _CURRENT_CONTEXT_MENU = null;
+ }
+}
+
+function contextmenu_onclick() {
+ this.handler(this.owner);
+ contextmenu_close();
+ return false;
+}

0 comments on commit bf6ff4a

Please sign in to comment.
Something went wrong with that request. Please try again.