⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resourcepopup.js

📁 Hippo CMS是一个以信息为中心的开源内容管理系统。Hippo CMS目标是供中,大型企业来管理其发布在互连网
💻 JS
字号:
// CONSTRUCTOR for the CalendarPopup Object
function ResourcePopup(lockObject,rootNode,pickerType) {
	var c;
 c = new PopupWindow();
	c.getXYPosition=RP_getXYPosition;
	c.setUrl("/explorer/picker.html?rootNode="+rootNode+"&pickerType="+pickerType);
	c.offsetX = -152;
	c.offsetY = 25;
	c.setSize(300,300);
	c.autoHide();
	c.select = RP_select;
	c.ancestorShowPopup=PopupWindow_showPopup;
	c.showPopup=RP_showPopup;
	c.hidePopup=PopupWindow_hidePopup;
	c.returnFunction = "RP_returnFunction";
	c.cssPrefix="";
	c.choose=RP_choose;
	c.setReturnFunction = RP_setReturnFunction;
	c.lockObject=lockObject;
	c.targetElem=null;
	c.targetAttr=null;
	c.targets=null;
	c.initTargets=RP_initTargets;
	c.loadElements=RP_loadElements;
	c.loadTargets=RP_loadTargets;
	c.sourceElements=null;
	c.assignTargets=RP_assignTargets;
	c.findWidgetElement=RP_findWidgetElement;
	return c;
	}
	
// Set the name of the functions to call to get the clicked item
function RP_setReturnFunction(name) { this.returnFunction = name; }
function RP_setReturnMonthFunction(name) { this.returnMonthFunction = name; }
function RP_setReturnQuarterFunction(name) { this.returnQuarterFunction = name; }
function RP_setReturnYearFunction(name) { this.returnYearFunction = name; }

function RP_showPopup(){	
	
	this.ancestorShowPopup();	
	this.popupWindow.opener.forms_getLink=this.lockObject.callBack;
}

function RP_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 RP_assignTargets(value){	  
  	 var i;
  	 var finalValue;
   	for (i=0; i<this.targets.length; i++){
   		 if (this.targets[i].properties.format!=null)
   		   finalValue=this.targets[i].properties.format(value);
   		 else
   		   finalValue=value;
   		 if (this.targets[i].properties.attr != null){
				  	 this.targets[i].obj.setAttribute(this.targets[i].properties.attr,finalValue)
   		 } else {
   		 	this.targets[i].obj.innerHTML=finalValue;
   		 }   		 
   	}
}

function RP_choose(){
  if (arguments[0].length > 0){
  	 this.assignTargets(arguments[0][0]);
 		 this.hidePopup(); 
 		 this.lockObject.reference=null;	 
	 }
}

function RP_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 RP_setCssPrefix(val) { 
	this.cssPrefix = val; 
	}

function RP_findWidgetElement(el){
	 if (el.getAttribute('id') == 'hc_widget') 
	    return el;
	 if (el.parentNode!=null) 
	    return this.findWidgetElement(el.parentNode);
	 return null;
}

function RP_loadElements(element,props){
	  var parentElement=this.findWidgetElement(element);
	  var targets=new Array();
			var i;
			var children;
		 var j;
		 var found;
			for (i=0; i<props.length; i++){
				 children = parentElement.getElementsByTagName(props[i].el);
				 found=0;
				 j=0;
				 while ( (j < children.length) && (found != 1)){		 	
				 	// check for element
				 	//alert(children.item(j).getAttribute("id"));
				 	if (children.item(j).nodeType == 1 && 
				 	 ( (children.item(j).getAttribute("id")!= null && children.item(j).getAttribute("id") == props[i].id) || props[i].id == null)){
				 		 targets[targets.length]={'obj':children.item(j),'properties':props[i]}; 
				 		 found=1;
				 	 } 
				 	 j++;
				} 
			}
			return targets;
}

function RP_loadTargets(element,props){
			this.targets=this.loadElements(element,props);
}

// Simple method to interface popup calendar with a text-entry box
function RP_select(element,props) {	
	this.lockObject.reference=this;
	
	this.loadTargets(element,props);
//	if (parentElement == null || !parentElement.childNodes || props == null || props.el == null || props.attr == null) return alert("No parent element defined or no valid target element.");
	if (this.targets.length <= 0){ alert('No target fields defined'); return null;}
	
	this.showPopup();
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -