📄 event_util.js
字号:
/*
* Copyright 2001-2008 Hippo (www.hippo.nl)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function isInstanceOf(obj, cls){
return getTop().Cfx.Class.InstanceOf(obj, eval('getTop().' + cls));
}
//get an element by id
function getById(strId) {
return document.getElementById(strId);
}
//get a form by name
function getForm(strName) {
return document.forms[strName];
}
function getWB(){
return getWorkbench();
}
function getWorkbench() {
return getApplication().sm.lookup('cms.workbench');
}
function getApplication() {
return getTop().Application;
}
function getTop() {
//return window.top.window.frames['topframe'];
return window.top.frames[0];
}
function fireEvent(evtName, params) {
// TODO: replace this method with fireCMSEvent() to prevent name clash in IE
window.top.window.frames['topframe'].workbench.sm.lookup('framework.eventmanager').fireEvent(evtName, params);
}
function fireCMSEvent(evtName,params){
// needed to prevent name clash with the 'fireEvent' ie method on buttons/links
fireEvent(evtName,params);
}
function log(level, message) {
if (level == "error") {
window.top.window.frames['topframe'].workbench.log[level]("[ActionError]", message);
}
else {
window.top.window.frames['topframe'].workbench.log[level](message);
}
}
var refObj;
function checkReferences(pre, value, post, uri, myObj, standardUIAction)
{
refObj = myObj;
var url = '/explorer/countReferences'+uri;
var doAction = false;
var refOpt = {
onSuccess: function(t) {
var myC = t.responseXML;
var w = 605;
var h = 275;
var options = 'scrollbars=no,toolbar=no,location=no,resizable=no';
var count = myC.getElementsByTagName("count")[0].childNodes[0].nodeValue;
if (count > 0)
{
var mywin = window.open('/explorer/on_delete.html?uri='+uri+'&count='+count+'&standardUIAction='+standardUIAction,'on_delete','width='+w+',height='+h+','+options);
}
else
{
if (standardUIAction == "hippo.cms.movedocument")
{
doAction = true;
}
else // delete
{
doAction = (confirm(pre + value + post));
}
if(doAction)
{
myObj.onclick = "";
myObj.click();
}
}
},
onFailure: function(t) {
alert('Error ' + t.status + ' -- ' + t.statusText);
return false;
}
}
var doAction = new Ajax.Request(url,refOpt);
return false;
}
function addItemsToShelf(uris) {
var url = '/workbench/clipboard/addShelfItems?hrefs='+uris;
var addOpt = {
onSuccess: function(t) { alert(t.status + ' -- ' + t.statusText);},
onFailure: function(t) {
alert('Error ' + t.status + ' -- ' + t.statusText);
return false;
}
}
var doAction = new Ajax.Request(url,addOpt);
//alert(id);
}
function addToShelf(uri) {
var url = '/workbench/clipboard/addShelfItem?href='+uri;
var addOpt = {
onSuccess: function(t) { alert(t.status + ' -- ' + t.statusText);},
onFailure: function(t) {
alert('Error ' + t.status + ' -- ' + t.statusText);
return false;
}
}
var doAction = new Ajax.Request(url,addOpt);
//alert(id);
}
function removeFromShelf(uri) {
var url = '/workbench/clipboard/removeShelfItem?href='+uri;
var remOpt = {
onSuccess: function(t) { alert(t.status + ' -- ' + t.statusText);},
onFailure: function(t) {
alert('Error ' + t.status + ' -- ' + t.statusText);
return false;
}
}
var doAction = new Ajax.Request(url,remOpt);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -