📄 genericpicker.js
字号:
function GenericPicker(url) {
var c;
c = new PopupWindow();
c.getXYPosition=GP_getXYPosition;
c.baseurl='/editing/cf2/picker-wrapper.html';
c.pickerurl=url;
c.offsetX = -152;
c.offsetY = 25;
c.setSize(800,300);
c.autoHide();
c.select = GP_select;
c.ancestorShowPopup=PopupWindow_showPopup;
c.showPopup=GP_showPopup;
c.hidePopup=PopupWindow_hidePopup;
c.initPopupWindow=GP_InitPopupWindow;
c.cssPrefix="";
c.choose=GP_choose;
c.passArgs=new Array();
c.initWndLoopCount=1;
c.myCallBackFunction= function (){ c.choose(arguments); }
c.callbackFunction = function (){ alert("Default callback function"); }
return c;
}
function GlobalInitWindow_callback(wnd){
return function(){
wnd.initPopupWindow();
}
}
function GP_InitPopupWindow(){
var inited=(this.popupWindow.document != null);
if (inited) inited = (this.popupWindow.document.getElementsByTagName('body').length > 0);
if (inited) inited = (this.popupWindow.document.getElementsByTagName('body').item(0) != null);
if (inited) {
var htmlBody = this.popupWindow.document.getElementsByTagName('body').item(0).getAttribute('innerHTML');
inited = (htmlBody != '');
}
if (!inited) {
if (this.initWndLoopCount < 10){
this.initWndLoopCount++;
var fnc = GlobalInitWindow_callback(this);
window.setTimeout(fnc,1);
}
}
else{
this.popupWindow.opener._return=this.myCallBackFunction;
this.popupWindow.choose=this.myCallBackFunction;
this.popupWindow.forms_getLink=this.myCallBackFunction;
this.popupWindow.chooseFile=this.myCallBackFunction;
this.popupWindow.pickItem=this.myCallBackFunction;
}
}
function GP_showPopup(){
if (pickerWrapper != null) pickerWrapper.reference=this;
var tmp=this.baseurl+'?key='+escape(this.passArgs.key)+'&pickerUrl='+escape(this.pickerurl);
try{
var document = getWorkbench().perspectiveManager.getPerspectiveById('editing').document;
if(document!=null && document != undefined) tmp+='&document='+escape(document);
}
catch(e){
//empty
}
this.setUrl(tmp);
this.ancestorShowPopup();
if (pickerWrapper == null){
this.initPopupWindow();
}
/* this.popupWindow.opener.forms_getLink=this.myCallBackFunction;
this.popupWindow.opener.chooseFile=this.myCallBackFunction;
this.popupWindow.pickItem=this.myCallBackFunction;
this.popupWindow.choose=this.myCallBackFunction;
this.popupWindow.popupInitialized=true; */
// GP_GlobalInitWindow(this);
}
function GP_initTargets(element,sourceProps,targetProps){
this.targets=this.loadElements(element,targetProps);
this.sourceElements=this.loadElements(element,sourceProps);
if (this.sourceElements.length <= 0 || this.targets.length <= 0){ alert('No target fields defined'); return null;}
if (this.sourceElements[0].obj.value != '' && this.sourceElements[0].obj.value != null){
this.assignTargets(this.sourceElements[0].obj.value);
}
}
function GP_choose(){
if (arguments[0].length > 0){
this.callbackFunction(arguments[0]);
this.hidePopup();
}
}
function GP_getXYPosition(){
var coords=new Object();
coords.x=100;
coords.y=100;
}
// Set the prefix to be added to all CSS classes when writing output
function GP_setCssPrefix(val) {
this.cssPrefix = val;
}
// Simple method to interface popup calendar with a text-entry box
function GP_select() {
window.Dialog = new Object(); // prevent JS error from popup.js
window.Dialog._arguments = {};
window.Dialog._return = function(arg){};
this.callbackFunction = arguments[0];
this.passArgs=arguments[1];
this.showPopup();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -