2010-07-07 11:30:04 +07:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!--
|
|
|
|
Copyright (C) 2007 Ashley G Ramdass.
|
|
|
|
-->
|
|
|
|
<?page style="height:100%"?>
|
|
|
|
<?init zscript="theme.zs" ?>
|
2013-04-12 15:20:41 +07:00
|
|
|
<?meta http-equiv="X-UA-Compatible" content="IE=edge" ?>
|
2013-03-14 09:45:16 +07:00
|
|
|
<?meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" ?>
|
2017-10-18 20:05:12 +07:00
|
|
|
<?meta name="apple-mobile-web-app-capable" content="yes"?>
|
|
|
|
<?meta name="mobile-web-app-capable" content="yes"?>
|
2010-07-07 11:30:04 +07:00
|
|
|
<?link rel="icon" type="image/png" href="${browserIcon}"?>
|
|
|
|
<?link rel="stylesheet" type="text/css" href="${themeStyleSheet}"?>
|
|
|
|
<?link rel="stylesheet" type="text/css" href="${themeStyleSheetByBrowser}"?>
|
|
|
|
<?link rel="stylesheet" type="text/css" href="css/PAPanel.css"?>
|
2017-10-18 20:05:12 +07:00
|
|
|
<?link rel="manifest" href="manifest.json"?>
|
2010-07-07 11:30:04 +07:00
|
|
|
<zk>
|
2015-01-19 09:08:49 +07:00
|
|
|
<script><![CDATA[
|
2013-10-28 14:45:48 +07:00
|
|
|
zk.afterLoad(function() {
|
|
|
|
zk._Erbx.push = function(msg) {
|
|
|
|
if (console) console.log(msg);
|
2016-09-04 21:38:49 +07:00
|
|
|
};
|
2017-07-17 23:17:37 +07:00
|
|
|
|
|
|
|
// default non th, tr, td use clone method to create ghost element
|
|
|
|
// this code implement same behavior for li to get drag-drop effect
|
|
|
|
// still have room for improve: https://www.zkoss.org/wiki/ZK_Client-side_Reference/Customization/Drag-and-Drop_Effects
|
|
|
|
var superghost = zk.DnD.ghost;
|
|
|
|
zk.DnD.ghost = function (drag, ofs, msg) {
|
|
|
|
if (msg == null && drag.node){
|
|
|
|
var dragNode = jq(drag.node)[0];
|
|
|
|
var dragWg = zk.Widget.$(dragNode);
|
|
|
|
|
|
|
|
var textNote = dragWg.$n('real') || dragWg.getCaveNode();
|
|
|
|
|
|
|
|
if (jq.nodeName(dragNode, 'li')){
|
|
|
|
msg = textNote ? textNote.textContent || textNote.innerText || '' : '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return superghost(drag, ofs, msg);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-09-04 21:38:49 +07:00
|
|
|
zk.$package('id.zk');
|
|
|
|
|
|
|
|
id.zk.Extend = zk.$extends(zk.Object, {}, {
|
|
|
|
fakeOnchange: function (wgt) {
|
|
|
|
// just sent fake event when control is textfield and value is not yet sync to server
|
2020-02-26 17:33:16 +07:00
|
|
|
if ((wgt.$instanceof(zul.inp.Textbox) || wgt.$instanceof(zul.inp.Decimalbox)) && wgt.$n().value != wgt.getText())
|
2016-09-04 21:38:49 +07:00
|
|
|
zAu.send(new zk.Event(zk.Widget.$(wgt), 'onChange',{"value":wgt.$n().value}));
|
2017-03-30 02:57:57 +07:00
|
|
|
|
|
|
|
else if (zk.$import("ckez.CKeditor") != undefined && wgt.$instanceof(ckez.CKeditor)){//https://www.zkoss.org/javadoc/latest/jsdoc/_global_/zk.html#$import(_global_.String)
|
2017-03-29 16:57:38 +07:00
|
|
|
// CKEditor extend from zul.Widget not from wget zul.inp.InputWidget
|
|
|
|
// so some behavior is not same standard input
|
|
|
|
// this code bring from ckez.CKeditor.onBlur
|
|
|
|
var editor = wgt._editor;
|
|
|
|
|
|
|
|
if (wgt._tidChg) {
|
|
|
|
clearInterval(wgt._tidChg);
|
|
|
|
wgt._tidChg = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!editor.document)
|
|
|
|
editor.document = editor.element.getDocument();
|
|
|
|
|
|
|
|
if (wgt.$class._checkEditorDirty(editor)) { // Issue #13
|
|
|
|
var val = editor.getData();
|
|
|
|
wgt._value = val; //save for onRestore
|
|
|
|
//ZKCK-16, 17 use sendAhead to make sure onChange always happens first
|
|
|
|
wgt.fire('onChange', {value: val});
|
|
|
|
editor.resetDirty();
|
|
|
|
}
|
|
|
|
}
|
2016-09-29 17:38:37 +07:00
|
|
|
},
|
|
|
|
|
|
|
|
fireOnInitEdit: function (wgt) {
|
|
|
|
// sent even to indicate field is start edit, this event sent new value to server but now don't use this data.
|
|
|
|
if (wgt.$instanceof(zul.inp.Textbox))
|
|
|
|
zAu.send(new zk.Event(zk.Widget.$(wgt), 'onInitEdit',{"value":wgt.$n().value}));
|
2016-09-04 21:38:49 +07:00
|
|
|
}
|
|
|
|
});
|
2013-10-28 14:45:48 +07:00
|
|
|
});
|
2015-01-19 09:08:49 +07:00
|
|
|
|
|
|
|
zk.afterLoad(function() {
|
|
|
|
jq(window).unload(function () {
|
|
|
|
//rmDesktop not call in window.onbeforeunload (mount.js) when zk.confirmClose is not null
|
|
|
|
if (!zk.ie && zk.confirmClose){
|
|
|
|
rmDesktop();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
//function rmDesktop duplicated from mount.js ( zk.jar 7.0.3 )
|
|
|
|
function rmDesktop() {
|
|
|
|
var bRmDesktop = !zk.opera && !zk.keepDesktop;
|
|
|
|
if (bRmDesktop || zk.pfmeter) {
|
|
|
|
try {
|
|
|
|
var dts = zk.Desktop.all;
|
|
|
|
for (var dtid in dts)
|
|
|
|
zAu._rmDesktop(dts[dtid], !bRmDesktop);
|
|
|
|
} catch (e) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2015-08-09 23:15:14 +07:00
|
|
|
|
2016-09-04 10:51:01 +07:00
|
|
|
zk.afterLoad('zul.wgt', function () {
|
2016-09-13 14:43:24 +07:00
|
|
|
|
2016-09-04 10:51:01 +07:00
|
|
|
// should filter out for only component inside standard window or component wish fire this event,
|
|
|
|
// or ever rise other event like start editting to distinguish with true onChange event
|
|
|
|
zk.override(zul.inp.InputWidget.prototype, "doInput_", function (evt) {
|
|
|
|
this.$doInput_(evt);
|
2016-09-04 20:18:58 +07:00
|
|
|
|
2016-09-09 22:08:22 +07:00
|
|
|
if (this.get ("isOnStardardWindow") == 'false' || this.get ("isChangeEventWhenEditing") != true){
|
2016-09-04 20:18:58 +07:00
|
|
|
return; // don't waste time to check component don't lay on standard window
|
|
|
|
}
|
|
|
|
|
|
|
|
var domElemOfLayout = jq('#' + this.$n().id).closest(".adwindow-layout"); // return a array
|
|
|
|
if (domElemOfLayout.length == 0){
|
|
|
|
this.set ("isOnStardardWindow", "false");// next time don't waste time to check this component
|
|
|
|
// in case, you move this component to a standard window, please update this properties at client by javascript Widget.set ()
|
|
|
|
// or at server by java function component.setWidgetOverride
|
2016-09-04 10:51:01 +07:00
|
|
|
}else{
|
|
|
|
var winLayoutWg = zk.Widget.$(domElemOfLayout);
|
|
|
|
if (winLayoutWg == null){
|
2016-09-04 20:18:58 +07:00
|
|
|
;// do nothing, this case rare happen because ".adwindow-layout" always is a component
|
2016-09-04 10:51:01 +07:00
|
|
|
}else{
|
|
|
|
var isEditting = winLayoutWg.get ("isEditting");
|
|
|
|
// winLayoutWg should cache to improve perfomance
|
|
|
|
if (isEditting == "false"){
|
2016-09-29 17:38:37 +07:00
|
|
|
winLayoutWg.set ("isEditting", "true");
|
|
|
|
id.zk.Extend.fireOnInitEdit (this);//fire change event to move to edit
|
2016-09-04 10:51:01 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-13 14:43:24 +07:00
|
|
|
|
|
|
|
zk.override(zk.Widget.prototype, "onAutofill", function (evt) {
|
|
|
|
id.zk.Extend.fakeOnchange (this);//fire change event to move to edit
|
|
|
|
});
|
|
|
|
|
|
|
|
zk.override(zul.inp.Textbox.prototype, "bind_", function (dt, skipper, after) {
|
|
|
|
if (!this.$bind_)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this.$bind_(dt, skipper, after);
|
|
|
|
|
2020-02-20 04:05:18 +07:00
|
|
|
var txtid = this.getId()
|
|
|
|
if (txtid != "txtUserId" && txtid != "txtPassword" ){
|
2016-09-13 14:43:24 +07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.domListen_(this.$n(), "onChange", "onAutofill");
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
zk.override(zul.inp.Textbox.prototype, "unbind_", function (dt, skipper) {
|
|
|
|
if (!this.$unbind_)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this.$unbind_(dt, skipper);
|
|
|
|
|
2020-02-20 04:05:18 +07:00
|
|
|
var txtid = this.getId()
|
|
|
|
if (txtid != "txtUserId" && txtid != "txtPassword" ){
|
2016-09-13 14:43:24 +07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.domUnlisten_(this.$n(), "onChange", "onAutofill"); //unlisten
|
|
|
|
});
|
|
|
|
|
2017-07-18 11:09:56 +07:00
|
|
|
zk.override(zul.inp.Combobox.prototype, "doKeyDown_", function (evt) {
|
|
|
|
// avoid confuse of idempiere shortcut key and function key of combobox
|
|
|
|
if ( (evt.altKey || evt.ctrlKey || evt.shiftKey) &&
|
|
|
|
(evt.keyCode == 33 || evt.keyCode == 34 || evt.keyCode == 35 || evt.keyCode == 36 || evt.keyCode == 38 || evt.keyCode == 40 || evt.keyCode == 37 || evt.keyCode == 39) ){//page up | page down | end | home | up | down | left | write
|
|
|
|
|
|
|
|
if (this.isOpen())//close drop down if already open. it will let combobox select current item, it's consistent with lost focus
|
|
|
|
this.close({sendOnOpen: true});
|
|
|
|
|
|
|
|
return;
|
|
|
|
// TODO:current idempiere use alt + down/up to move child parrent tab, but combobox also use it to open, close drop down
|
|
|
|
// at the moment, idempiere shortcut is more useful, so just get it work
|
|
|
|
}else{
|
|
|
|
this.$doKeyDown_(evt);
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2016-09-04 10:51:01 +07:00
|
|
|
});
|
|
|
|
|
2015-08-09 23:15:14 +07:00
|
|
|
zk.afterLoad('zul.mesh', function () {
|
|
|
|
|
|
|
|
zk.override(zul.mesh.Paging.prototype, "bind_", function () {
|
|
|
|
this.$bind_.apply(this, arguments);
|
|
|
|
if (this._totalSize == 0x7fffffff){
|
|
|
|
jq(".z-paging-text", this).text("?");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
zk.override(zul.mesh.Paging.prototype, "infoText_",
|
|
|
|
function () {
|
|
|
|
//this.$infoText_.apply(this, arguments);
|
|
|
|
var acp = this._activePage,
|
|
|
|
psz = this._pageSize,
|
|
|
|
tsz = this._totalSize,
|
|
|
|
|
|
|
|
lastItem = (acp + 1) * psz,
|
|
|
|
dash = '';
|
|
|
|
|
|
|
|
if ('os' != this.getMold())
|
|
|
|
dash = ' - ' + (lastItem > tsz ? tsz : lastItem);
|
|
|
|
|
|
|
|
if (this._totalSize == 0x7fffffff)
|
|
|
|
tsz = "?";
|
|
|
|
|
|
|
|
return '[ ' + (acp * psz + 1) + dash + ' / ' + tsz + ' ]';
|
|
|
|
});
|
|
|
|
});
|
2017-10-20 11:25:52 +07:00
|
|
|
|
|
|
|
zk.afterLoad('calendar', function () {
|
|
|
|
zk.override(calendar.Event.prototype, "calculate_", function () {
|
|
|
|
if (typeof this.event === "undefined" || this.event == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.$calculate_.apply(this, arguments);
|
|
|
|
});
|
|
|
|
|
|
|
|
zk.override(calendar.Event.prototype, "unbind_", function() {
|
|
|
|
var node = this.$n();
|
|
|
|
if (typeof node === "undefined") {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (typeof this.$unbind_ === "undefined") {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.$unbind_.apply(this, arguments);
|
|
|
|
});
|
|
|
|
|
|
|
|
zk.override(calendar.CalendarsMonth.prototype, "onSize", function () {
|
|
|
|
var cmp = this.$n();
|
|
|
|
if (typeof cmp === "undefined" || cmp == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.$onSize.apply(this, arguments);
|
|
|
|
});
|
|
|
|
|
|
|
|
zk.override(calendar.CalendarsDefault.prototype, "onSize", function () {
|
|
|
|
var cmp = this.$n();
|
|
|
|
if (typeof cmp === "undefined" || cmp == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.$onSize.apply(this, arguments);
|
|
|
|
});
|
2017-12-06 21:59:38 +07:00
|
|
|
});
|
2015-08-09 23:15:14 +07:00
|
|
|
|
2017-12-06 21:59:38 +07:00
|
|
|
// overload for recalculate width of scroll when has frozen control
|
|
|
|
function syncScrollOVR (wgt){
|
|
|
|
var parent = wgt.parent;
|
|
|
|
|
|
|
|
if (parent.eheadtbl && parent._nativebar) {
|
|
|
|
var scroll = wgt.$n('scrollX');
|
|
|
|
var cells = parent._getFirstRowCells(parent.eheadrows);
|
|
|
|
var totalcols = cells.length;
|
|
|
|
var columns = wgt._columns;
|
|
|
|
var scrollScale = totalcols - columns - 1;
|
|
|
|
var leftWidth = 0;
|
|
|
|
|
|
|
|
var headerWidth = 0;
|
|
|
|
for (var i = 0; i < columns; i++)
|
|
|
|
headerWidth += cells[i].offsetWidth;
|
|
|
|
|
|
|
|
var bodyWidth = parent.$n('body').offsetWidth;
|
|
|
|
var extraWidth = parent.$n('body').offsetWidth - headerWidth;
|
|
|
|
var extraColumnNum = 0;
|
|
|
|
for (var i = totalcols - 1; i >= columns; i--){
|
|
|
|
extraWidth -= cells[i].offsetWidth;
|
|
|
|
if (cells[i].offsetWidth == 0)// when scroll to right, column at left has width = 0
|
|
|
|
continue;
|
|
|
|
if (extraWidth >= 0){
|
|
|
|
extraColumnNum++;
|
|
|
|
}else{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
scroll.firstChild.style.width = jq.px0(bodyWidth + 50 * (scrollScale - extraColumnNum));
|
|
|
|
}
|
|
|
|
|
|
|
|
wgt.$syncScroll ()
|
|
|
|
}
|
2020-03-02 09:04:04 +07:00
|
|
|
|
|
|
|
//Incorporate fix from https://tracker.zkoss.org/browse/ZK-4204
|
|
|
|
//Probably can be removed after the upgrade to zk9
|
|
|
|
zk.afterLoad('zk', function () {
|
|
|
|
if (navigator.sendBeacon && window.URLSearchParams) {
|
|
|
|
zAu._rmDesktop = function(dt, dummy) {
|
|
|
|
var url = zk.ajaxURI(null, {desktop: dt, au: true}),
|
|
|
|
data = jq.param({dtid: dt.id, cmd_0: dummy ? 'dummy' : 'rmDesktop', opt_0: 'i'}),
|
|
|
|
headers = {};
|
|
|
|
if (zk.pfmeter) {
|
|
|
|
var fakeReq = {
|
|
|
|
setRequestHeader: function (name, value) {
|
|
|
|
headers[name] = value;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
zAu._pfsend(dt, fakeReq, true, false);
|
|
|
|
}
|
|
|
|
var params = new URLSearchParams(data);
|
|
|
|
for (var key in headers) {
|
|
|
|
if (headers.hasOwnProperty(key))
|
|
|
|
params.append(key, headers[key]);
|
|
|
|
}
|
|
|
|
navigator.sendBeacon(url, zk.chrome // https://crbug.com/747787
|
|
|
|
? new Blob([params.toString()], {type: 'application/x-www-form-urlencoded'})
|
|
|
|
: params
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2015-01-19 09:08:49 +07:00
|
|
|
]]>
|
2013-10-28 14:45:48 +07:00
|
|
|
</script>
|
2013-05-21 22:43:22 +07:00
|
|
|
<include src="${themePreference}"/>
|
2010-07-07 11:30:04 +07:00
|
|
|
<window use="org.adempiere.webui.AdempiereWebUI"/>
|
2013-05-21 22:43:22 +07:00
|
|
|
</zk>
|