core-jgi/org.adempiere.ui.zk/index.zul

159 lines
5.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2007 Ashley G Ramdass.
-->
<?page style="height:100%"?>
<?init zscript="theme.zs" ?>
<?meta http-equiv="X-UA-Compatible" content="IE=edge" ?>
<?meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" ?>
<?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"?>
<zk>
<script><![CDATA[
zk.afterLoad(function() {
zk._Erbx.push = function(msg) {
if (console) console.log(msg);
};
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
if (wgt.$instanceof(zul.inp.Textbox) && wgt.$n().value != wgt.getText())
zAu.send(new zk.Event(zk.Widget.$(wgt), 'onChange',{"value":wgt.$n().value}));
},
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}));
}
});
});
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) {
}
}
}
});
zk.afterLoad('zul.wgt', function () {
// 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);
if (this.get ("isOnStardardWindow") == 'false' || this.get ("isChangeEventWhenEditing") != true){
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
}else{
var winLayoutWg = zk.Widget.$(domElemOfLayout);
if (winLayoutWg == null){
;// do nothing, this case rare happen because ".adwindow-layout" always is a component
}else{
var isEditting = winLayoutWg.get ("isEditting");
// winLayoutWg should cache to improve perfomance
if (isEditting == "false"){
winLayoutWg.set ("isEditting", "true");
id.zk.Extend.fireOnInitEdit (this);//fire change event to move to edit
}
}
}
});
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);
if (this.getType () != "password"){
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);
if (this.getType () != "password"){
return;
}
this.domUnlisten_(this.$n(), "onChange", "onAutofill"); //unlisten
});
});
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 + ' ]';
});
});
]]>
</script>
<include src="${themePreference}"/>
<window use="org.adempiere.webui.AdempiereWebUI"/>
</zk>