mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
MINOR Moved tree context menu javascript from LeftAndMain.js into LeftAndMain_left.js
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92694 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
fe82f394f1
commit
bf6ff4addb
@ -425,63 +425,6 @@ returnFalse = function() {
|
|||||||
return false;
|
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
|
* Find and enable TinyMCE on all htmleditor fields
|
||||||
* Pulled in from old tinymce.template.js
|
* Pulled in from old tinymce.template.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;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user