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

📄 au.js

📁 ZK 基础介绍 功能操作 模块 结合数据库操作
💻 JS
📖 第 1 页 / 共 4 页
字号:
			cmp.style.left = dg.z_x;			cmp.style.top = dg.z_y;			delete dg.z_x;			delete dg.z_y;		}		delete zkau._revertpending; //exec once	};	return false;};if (zk.ie) {//In IE, we have to detach and attach. We cannot simply restore position!!//Otherwise, a strange bar appear	zkau._fixie4drop = function (el, orgpos) {		var p = el.parentNode;		var n = el.nextSibling;		zk.remove(el);		el.style.position = orgpos;		if (n) p.insertBefore(el, n);		else p.appendChild(el);	};}zkau._enddrag = function (cmp, evt) {	zkau._cleanLastDrop(zkau._drags[cmp.id]);	var pointer = [Event.pointerX(evt), Event.pointerY(evt)];	var e = zkau._getDrop(cmp, pointer);	if (e) {		var keys = "";		if (evt) {			if (evt.altKey) keys += 'a';			if (evt.ctrlKey) keys += 'c';			if (evt.shiftKey) keys += 's';		}		setTimeout("zkau._sendDrop('"+cmp.id+"','"+e.id+"','"+pointer[0]+"','"+pointer[1]+"','"+keys+"')", 38);			//In IE, listitem is selected after _enddrag, so we have to			//delay the sending of onDrop	}};zkau._sendDrop = function (dragged, dropped, x, y, keys) {	zkau.send({uuid: dropped, cmd: "onDrop", data: [dragged, x, y, keys]});};zkau._getDrop = function (cmp, pointer) {	var dragType = getZKAttr(cmp, "drag");	var found = null;	l_next:	for (var j = 0; j < zkau._drops.length; ++j) {		var e = zkau._drops[j];		if (e == cmp) continue; //dropping to itself not allowed		var dropTypes = getZKAttr(e, "drop");		if (dropTypes != "true") { //accept all			if (dragType == "true") continue; //anonymous drag type			for (var k = 0;;) {				var l = dropTypes.indexOf(',', k);				var s = l >= 0 ? dropTypes.substring(k, l): dropTypes.substring(k);				if (s.trim() == dragType) break; //found				if (l < 0) continue l_next;				k = l + 1;			}		}		var cross = Position.withinScroll(e, pointer[0], pointer[1]);		if (!cross && (zk.gecko || zk.safari)) { //Bug 1789428 			var real = $real(e);			if (real != e)				cross = Position.withinScroll(real, pointer[0], pointer[1])		}		if (cross && (!found || found.style.zIndex < e.style.zIndex))			found = e;	}	return found;};zkau._cleanLastDrop = function (dg) {	if (dg && dg.zk_lastDrop) {		Droppable_effect(dg.zk_lastDrop, true);		dg.zk_lastDrop = null;	}};zkau._ghostdrag = function (dg, ghosting) {//Tom Yeh: 20060227: Use a 'fake' DIV if//1) FF cannot handle z-index well if listitem is dragged across two listboxes//2) Safari's ghosting position is wrong//3) Opera's width is wrong if cloned//Bug 1783363: Due to the use of "position:relative",//a side effect of Bug 1766244, we no longer clone even if zk.ie	var special;	if (ghosting) {		var tn = $tag(dg.element);		zk.zk_special = special = "TR" == tn || "TD" == tn || "TH" == tn;	} else {		special = zk.zk_special;	}	if (ghosting) {		var ofs = zkau.beginGhostToDIV(dg);		if (special) {			var el = dg.element;			document.body.insertAdjacentHTML("afterbegin",				'<div id="zk_ddghost" style="position:absolute;top:'				+ofs[1]+'px;left:'+ofs[0]+'px;width:'				+zk.offsetWidth(el)+'px;height:'+zk.offsetHeight(el)				+'px;border:1px dotted black"></div>');						}else {			var el  = dg.element.cloneNode(true);			el.id = "zk_ddghost";			el.style.position = "absolute";			el.style.top = ofs[1] + "px";			el.style.left = ofs[0] + "px";					document.body.appendChild(el);		}		dg.element = $e("zk_ddghost");	} else {		zkau.endGhostToDIV(dg);	}	return false	};/** Prepares to ghost dg.element to a DIV. * It is used when you want to ghost with a div. * @return the offset of dg.element. */zkau.beginGhostToDIV = function (dg) {	zk.dragging = true;	dg.delta = dg.currentDelta();	dg.z_elorg = dg.element;		var ofs = Position.cumulativeOffset(dg.element);	dg.z_scrl = Position.realOffset(dg.element);	dg.z_scrl[0] -= zk.innerX(); dg.z_scrl[1] -= zk.innerY();		//Store scrolling offset since Draggable.draw not handle DIV well		ofs[0] -= dg.z_scrl[0]; ofs[1] -= dg.z_scrl[1];		return ofs;};/** Returns the origin element before ghosted. * <p>Note: the ghosted DIV is dg.element. * It is called between beginGhostToDIV and endGhostToDIV */zkau.getGhostOrgin = function (dg) {	return dg.z_elorg;};/** Clean and remove the ghosted DIV. */zkau.endGhostToDIV = function (dg) {	setTimeout("zk.dragging=false", 0);		//we have to reset it later since onclick is fired later (after onmouseup)	if (dg.z_elorg && dg.element != dg.z_elorg) {		zk.remove(dg.element);		dg.element = dg.z_elorg;		delete dg.z_elorg;	}};//Perfomance Meter//zkau._pfj = 0; //an indexzkau._pfIds = ""; //what are processedzkau._pfsend = function (req, dtid) {	req.setRequestHeader("ZK-Client-Start",		dtid + "-" + zkau._pfj++ + "=" + Math.round($now()));	if (zkau._pfIds) {		req.setRequestHeader("ZK-Client-Complete", zkau._pfIds);		zkau._pfIds = "";	}};zkau._pfrecv = function (req) {	//ZK-Client-Complete from the server is a list of requestId	//separated with ' '	var ids = req.getResponseHeader("ZK-Client-Complete");	if (ids && (ids = ids.trim())) {		if (zkau._pfIds) zkau._pfIds += ',';		zkau._pfIds += ids + "=" + Math.round($now());	}};//Upload///** Begins upload (called when the submit button is pressed) * @param wndid id of window to close, if any */zkau.beginUpload = function (wndid) {	zkau.endUpload();	zkau._upldWndId = wndid;	zkau._tmupload = setInterval(function () {		zkau.send({dtid: zkau.dtid(wndid), cmd: "getUploadInfo", data: null});	}, 660);};zkau.updateUploadInfo = function (p, cb) {	if (cb <= 0) zkau.endUpload();	else if (zkau._tmupload) {		var img = $e("zk_upload!img");		if (!img) {			var html = '<div id="zk_upload" style="position:absolute;border:1px solid #77a;padding:9px;background-color:#fec;z-index:79000">'				+'<div style="width:202px;border:1px inset"><img id="zk_upload!img" src="'+zk.getUpdateURI('/web/zk/img/prgmeter.gif')				+'"/></div><br/>'+mesg.FILE_SIZE+Math.round(cb/1024)+mesg.KBYTES				+'<br/><input type="button" value="'+mesg.CANCEL+'" onclick="zkau._cancelUpload()"</div>';			document.body.insertAdjacentHTML("afterbegin", html);			zk.center($e("zk_upload"));			img = $e("zk_upload!img");		}		if (p >= 0 && p <= 100) {			img.style.height = "10px"; //avoid being scaled when setting width			img.style.width = (p * 2) + "px";		}	}};zkau._cancelUpload = function () {	zkau.endUpload();	if (zkau._upldWndId) {		zkau.sendOnClose(zkau._upldWndId);		zkau._upldWndId = null;	}};/** Called to end the upload. It must be called if beginUpload is called. */zkau.endUpload = function () {	zk.focus(window);		//focus might be in iframe of fileupload dlg, so get it back		//otherwise, IE might lose focus forever (see also Bug 1526542)	zk.remove($e("zk_upload"));	if (zkau._tmupload) {		clearInterval(zkau._tmupload);		zkau._tmupload = null;	}};//Miscellanous//zkau.history = new zk.History();//Commands//zkau.cmd0 = { //no uuid at all	bookmark: function (dt0) {		zkau.history.bookmark(dt0);	},	obsolete: function (dt0, dt1) { //desktop timeout		zkau._cleanupOnFatal();		zk.error(dt1);	},	alert: function (msg) {		alert(msg);	},	redirect: function (url, target) {		try {			zk.go(url, false, target);		} catch (ex) {			if (!zkau.confirmClose) throw ex;		}	},	title: function (dt0) {		document.title = dt0;	},	script: function (dt0) {		eval(dt0);	},	echo: function (dtid) {		zkau.send({dtid: dtid, cmd: "dummy", data: null, ignorable: true});	},	clientInfo: function (dtid) {		zkau._cInfoReg = true;		zkau.send({dtid: dtid, cmd: "onClientInfo", data: [			new Date().getTimezoneOffset(),			screen.width, screen.height, screen.colorDepth,			zk.innerWidth(), zk.innerHeight(), zk.innerX(), zk.innerY()		]});	},	download: function (url) {		if (url) {			var ifr = $e('zk_download');			if (ifr) {				ifr.src = url; //It is OK to reuse the same iframe			} else {				var html = '<iframe src="'+url+'" id="zk_download" name="zk_download" style="display:none;width:0;height:0;border:0"></iframe>';				zk.insertHTMLBeforeEnd(document.body, html);			}		}	},	print: function () {		window.print();	},	scrollBy: function (x, y) {		window.scrollBy(x, y);	},	scrollTo: function (x, y) {		window.scrollTo(x, y);	},	resizeBy: function (x, y) {		window.resizeBy(x, y);	},	resizeTo: function (x, y) {		window.resizeTo(x, y);	},	moveBy: function (x, y) {		window.moveBy(x, y);	},	moveTo: function (x, y) {		window.moveTo(x, y);	},	cfmClose: function (msg) {		zkau.confirmClose = msg;	}};zkau.cmd1 = {	wrongValue: function (uuid, cmp, dt1) {		if (cmp) {			cmp = $real(cmp); //refer to INPUT (e.g., datebox)			//we have to update default value so validation will be done again			var old = cmp.value;			cmp.defaultValue = old + "_err"; //enforce to validate			if (old != cmp.value) cmp.value = old; //Bug 1490079 (FF only)			if (zkau.valid) zkau.valid.errbox(cmp.id, dt1);			else alert(dt1);		} else {			alert(dt1);		}	},	setAttr: function (uuid, cmp, dt1, dt2) {		if (dt1 == "z.init" || dt1 == "z.chchg") { //initialize			//Note: cmp might be null because it might be removed			if (cmp) {				var type = $type(cmp);				if (type) {					zk.loadByType(cmp);					if (zk.loading) {						zk.addInitCmp(cmp);					} else {						zk.eval(cmp, dt1 == "z.init" ? "init": "childchg", type);					}				}			}			return; //done		}		var done = false;		if ("z.drag" == dt1) {			if (!getZKAttr(cmp, "drag")) zkau.initdrag(cmp);			zkau.setAttr(cmp, dt1, dt2);			done = true;		} else if ("z.drop" == dt1) {			if (!getZKAttr(cmp, "drop")) zkau.initdrop(cmp);			zkau.setAttr(cmp, dt1, dt2);			done = true;		} else if ("zid" == dt1) {			zkau.cleanzid(cmp);			if (dt2) zkau.initzid(cmp, dt2);		}		if (zk.eval(cmp, "setAttr", null, dt1, dt2)) //NOTE: cmp is NOT converted to real!			return; //done		if (!done)			zkau.setAttr(cmp, dt1, dt2);	},	rmAttr: function (uuid, cmp, dt1) {		var done = false;		if ("z.drag" == dt1) {			zkau.cleandrag(cmp);			zkau.rmAttr(cmp, dt1);			done = true;		} else if ("z.drop" == dt1) {			zkau.cleandrop(cmp);			zkau.rmAttr(cmp, dt1);			done = true;		}		if (zk.eval(cmp, "rmAttr", null, dt1)) //NOTE: cmp is NOT converted to real!			return; //done		if (!done)			zkau.rmAttr(cmp, dt1);	},	outer: function (uuid, cmp, html) {		zk.unsetChildVParent(cmp);		zk.cleanupAt(cmp);		var from = cmp.previousSibling, from2 = cmp.parentNode,			to = cmp.nextSibling;		zk.setOuterHTML(cmp, html);		if (from) zkau._initSibs(from, to, true);		else zkau._initChildren(from2, to);		if (zkau.valid) zkau.valid.fixerrboxes();	},	addAft: function (uuid, cmp, html) {		var v = zk.isVParent(cmp);		if (v) zk.unsetVParent(cmp);		var n = $childExterior(cmp);		var to = n.nextSibling;		zk.insertHTMLAfter(n, html);		zkau._initSibs(n, to, true);		if (v) zk.setVParent(cmp);	},	addBfr: function (uuid, cmp, html) {		var v = zk.isVParent(cmp);		if (v) zk.unsetVParent(cmp);		var n = $childExterior(cmp);		var to = n.previousSibling;		zk.insertHTMLBefore(n, html);		zkau._initSibs(n, to, false);		if (v) zk.setVParent(cmp);	},	addChd: function (uuid, cmp, html) {		/* To add the first child properly, it checks as follows.		//1) a function called addFirstChild		2) uuid + "!cave" (as parent)		3) an attribute called z.cave to hold id (as parent)		4) uuid + "!child" (as next sibling)		5) uuid + "!real" (as parent)		 */		//if (zk.eval(cmp, "addFirstChild", html))		//	return;		var n = $e(uuid + "!cave");		if (!n) {			n = getZKAttr(cmp, "cave");			if (n) n = $e(n);		}		if (n) { //as last child of n			zkau._insertAndInitBeforeEnd(n, html);			return;		}		n = $e(uuid + "!child");		if (n) { //as previous sibling of n			var to = n.previousSibling;			zk.insertHTMLBefore(n, html);			zkau._initSibs(n, to, false);			return;		}		cmp = $real(cmp); //go into the real tag (e.g., tabpanel)		zkau._insertAndInitBeforeEnd(cmp, html);	},	rm: function (uuid, cmp) {		//NOTE: it is possible the server asking removing a non-exist cmp		//so keep silent if not found		if (cmp) {			zk.unsetChildVParent(cmp);			zk.cleanupAt(cmp);			cmp = $childExterior(cmp);			zk.remove(cmp);		}		if (zkau.valid) zkau.valid.fixerrboxes();	},	focus: function (uuid, cmp) {		if (!zk.eval(cmp, "focus")) {			zkau.autoZIndex(cmp); //some, say, window, not listen to onfocus			cmp = $real(cmp); //focus goes to inner tag			zk.asyncFocus(cmp.id, 10);				//delay it since some comp, e.g., endModal, uses timer				//to do the multiple-step operation		}	},	closeErrbox: function (uuid, cmp) {		if (zkau.valid)			zkau.valid.closeErrbox(uuid);	},	submit: function (uuid, cmp) {		setTimeout(function (){if (cmp && cmp.submit) cmp.submit();}, 50);	},	invoke: function (uuid, cmp, func, arg0, arg1, arg2) {		zk.eval(cmp, func, null, arg0, arg1, arg2);	},	popup: function (uuid, cmp, mode, x, y) {		var type = $type(cmp);		if (type) {			if (mode == "0") { //close				for (var j = zkau.floats.length; --j >= 0;) {					var n = zkau.floats[j];					var f = n["close"];					if (f && f.apply(n, [cmp.id]))						return;				}				zkau.closeFloats();			} else {				var ref;				if (mode == "1") { //ref					ref = $e(x);					if (ref) {						var ofs = Position.cumulativeOffset($e(x));						x = ofs[0];						y = ofs[1] + zk.offsetHeight(ref);					}				}				cmp.style.position = "absolute";				zk.setVParent(cmp); //FF: Bug 1486840, IE: Bug 1766244				zkau._autopos(cmp, $int(x), $int(y));				zk.eval(cmp, "context", type, ref);			}		}	}};zkau.cmd1.cmd = zkau.cmd1.invoke; //backward compatibility (2.4.1 or before)} //if (!window.zkau)

⌨️ 快捷键说明

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