From b051da0beffd4789b56cd7a51f054d5404eceb4f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 23 Oct 2013 09:00:54 -0500 Subject: [PATCH 1/6] IDEMPIERE-1457 Bug in Calendar - java.lang.NullPointerException (based on patch from hieplq) --- .../adempiere/webui/component/Tabpanel.java | 6 ++--- .../webui/dashboard/CalendarWindow.java | 23 +++++++++++++++---- .../adempiere/webui/dashboard/DPCalendar.java | 9 ++++++-- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java index 793672eaf7..84d3fc68f3 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java @@ -75,10 +75,10 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel implements IdSpace public void onClose() { if (onCloseHandler != null) onCloseHandler.onClose(this); - else { - Tab tab = this.getLinkedTab(); + + Tab tab = this.getLinkedTab(); + if (tab != null) tab.close(); - } } public void setOnCloseHandler(ITabOnCloseHandler handler) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java index 04c66a9cc9..e66eb5276d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java @@ -30,7 +30,9 @@ import java.util.Map; import java.util.Properties; import java.util.TimeZone; +import org.adempiere.webui.component.Tabpanel; import org.adempiere.webui.component.Window; +import org.adempiere.webui.panel.ITabOnCloseHandler; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.theme.ThemeManager; import org.compiere.model.MSysConfig; @@ -72,12 +74,12 @@ import org.zkoss.zul.Toolbarbutton; * @author Elaine * */ -public class CalendarWindow extends Window implements EventListener { - +public class CalendarWindow extends Window implements EventListener, ITabOnCloseHandler { /** * */ - private static final long serialVersionUID = 5620139733919619691L; + private static final long serialVersionUID = 1576992746053720647L; + private Calendars calendars; private SimpleCalendarModel scm; private Toolbarbutton btnRefresh; @@ -185,6 +187,17 @@ public class CalendarWindow extends Window implements EventListener { calendars.addEventListener("onMouseOver", this); SessionManager.getAppDesktop().showWindow(this); + + // IDEMPIERE-1457: when show this window on tab, handle event close to remove calendars away scm + Component parentTab = this.getParent(); + if (parentTab != null && parentTab.getClass().equals(Tabpanel.class)) { + ((Tabpanel)parentTab).setOnCloseHandler(this); + } + } + + public void onClose(Tabpanel tabPanel){ + //IDEMPIERE-1457: On close, remove calendars away scm + calendars.setModel(null); } public void onEvent(Event e) throws Exception { @@ -231,7 +244,7 @@ public class CalendarWindow extends Window implements EventListener { ArrayList events = DPCalendar.getEvents(R_RequestType_ID, Env.getCtx()); for (ADCalendarEvent event : events) scm.add(event); - calendars.setModel(scm); + calendars.invalidate(); syncModel(); } @@ -368,7 +381,7 @@ public class CalendarWindow extends Window implements EventListener { ArrayList events = DPCalendar.getEvents(R_RequestType_ID, Env.getCtx()); for (ADCalendarEvent event : events) scm.add(event); - calendars.setModel(scm); + calendars.invalidate(); syncModel(); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java index 4152c9ab61..3f4bab01af 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java @@ -373,10 +373,15 @@ public class DPCalendar extends DashboardPanel implements EventListener, @Override public void updateUI() { - scm = new SimpleCalendarModel(); + if (scm == null) { + scm = new SimpleCalendarModel(); + calendars.setModel(scm); + } + + scm.clear(); for (ADCalendarEvent event : events) scm.add(event); - calendars.setModel(scm); + calendars.invalidate(); } From b72501542e2c59558c20500310fddcc69bb85bfc Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 23 Oct 2013 10:02:06 -0500 Subject: [PATCH 2/6] IDEMPIERE-1457 Bug in Calendar - java.lang.NullPointerException --- .../src/org/adempiere/webui/component/Tabpanel.java | 11 ++++++----- .../org/adempiere/webui/dashboard/CalendarWindow.java | 3 +++ .../org/adempiere/webui/panel/ITabOnCloseHandler.java | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java index 84d3fc68f3..d953027dd9 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java @@ -73,12 +73,13 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel implements IdSpace } public void onClose() { - if (onCloseHandler != null) + if (onCloseHandler != null) { onCloseHandler.onClose(this); - - Tab tab = this.getLinkedTab(); - if (tab != null) - tab.close(); + } else { + Tab tab = this.getLinkedTab(); + if (tab != null) + tab.close(); + } } public void setOnCloseHandler(ITabOnCloseHandler handler) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java index e66eb5276d..a173f2fc0d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java @@ -66,6 +66,7 @@ import org.zkoss.zul.Listbox; import org.zkoss.zul.Listitem; import org.zkoss.zul.Popup; import org.zkoss.zul.Span; +import org.zkoss.zul.Tab; import org.zkoss.zul.Timer; import org.zkoss.zul.Toolbarbutton; @@ -198,6 +199,8 @@ public class CalendarWindow extends Window implements EventListener, ITab public void onClose(Tabpanel tabPanel){ //IDEMPIERE-1457: On close, remove calendars away scm calendars.setModel(null); + Tab tab = tabPanel.getLinkedTab(); + tab.close(); } public void onEvent(Event e) throws Exception { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java index a643a772e1..36b1df1741 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java @@ -21,5 +21,7 @@ import org.adempiere.webui.component.Tabpanel; * */ public interface ITabOnCloseHandler { + + /* NOTE onClose method must implement the actual closing of the tab */ public void onClose(Tabpanel tabPanel); } From ba7c74ae5757a70a0940e73a129b677f4e515caf Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 22 Oct 2013 11:18:59 +0800 Subject: [PATCH 3/6] 1003372 Firefox: High CPU Usage and Part of the UI wouldn't update after about 5 minutes of continuous usage IDEMPIERE-1464 --- org.adempiere.ui.zk/WEB-INF/cwr/js/zk/utl.js | 1 + .../WEB-INF/cwr/js/zk/utl.src.js | 437 ++++++++++++++++++ org.adempiere.ui.zk/WEB-INF/zk.xml | 6 +- 3 files changed, 443 insertions(+), 1 deletion(-) create mode 100644 org.adempiere.ui.zk/WEB-INF/cwr/js/zk/utl.js create mode 100644 org.adempiere.ui.zk/WEB-INF/cwr/js/zk/utl.src.js diff --git a/org.adempiere.ui.zk/WEB-INF/cwr/js/zk/utl.js b/org.adempiere.ui.zk/WEB-INF/cwr/js/zk/utl.js new file mode 100644 index 0000000000..3823389874 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/cwr/js/zk/utl.js @@ -0,0 +1 @@ +(function(){var c={lt:"<",gt:">",amp:"&",quot:'"'},f={};for(var b in c){f[c[b]]=b}function g(k){var i=k.indexOf("//");if(i>0){i=k.indexOf("/",i+2);if(i>0){return k.substring(i)}}}function a(o,m){o.push(m);for(var i=m.frames,n=0,k=i.length;n0||k>0?m>k?j:i:o}zUtl={isChar:function(j,i){return(i.digit&&j>="0"&&j<="9")||(i.upper&&j>="A"&&j<="Z")||(i.lower&&j>="a"&&j<="z")||(i.whitespace&&(j==" "||j=="\t"||j=="\n"||j=="\r"))||i[j]},parseMap:function(r,n,j){var k={};if(r){var i=r.split(n||",");if(j){var m=[],u=new RegExp(j,"g"),q="",s,l;while((s=i.shift())!==undefined){if((l=(q+=s).match(u))&&l.length!=1){if(q){m.push(q)}q=""}else{q+=n}}i=m}for(var p=i.length;p--;){var q=i[p].trim(),o=q.indexOf("=");if(o!=-1){k[q.substring(0,o)]=q.substring(o+1,q.length).trim()}}}return k},encodeXML:function(t,i){t=t!=null?String(t):"";var u=t.length,o=i&&i.pre,m=o||(i&&i.multiline),l=i?i.maxlength:0;if(!m&&l&&u>l){var r=l;while(r>0&&t.charAt(r-1)==" "){--r}i.maxlength=0;return zUtl.encodeXML(t.substring(0,r)+"...",i)}var s=[],p=0,q;if(m||o){for(var r=0;r\n");p=r+1}else{if(o&&(n==" "||n=="\t")){s.push(t.substring(p,r)," ");if(n=="\t"){s.push("   ")}p=r+1}}}}}else{for(var r=0;r=0){var r=i.charAt(p+1)=="#"?String.fromCharCode(i.charAt(p+2).toLowerCase()=="x"?parseInt(i.substring(p+3,m),16):parseInt(i.substring(p+2,m),10)):c[i.substring(p+1,m)];if(r){q+=i.substring(o,p)+r;o=(p=m)+1}}}}return !o?i:o',i0:'',now:jq.now,today:function(i){var o=new Date(),m=0,k=0,l=0,n=0;if(typeof i=="string"){var j=i.toLowerCase();if(j.indexOf("h")>=0||j.indexOf("k")>=0){m=o.getHours()}if(i.indexOf("m")>=0){k=o.getMinutes()}if(i.indexOf("s")>=0){l=o.getSeconds()}if(i.indexOf("S")>=0){n=o.getMilliseconds()}}else{if(i){return o}}return new Date(o.getFullYear(),o.getMonth(),o.getDate(),m,k,l,n)},isAncestor:function(i,j){if(!i){return true}for(;j;j=j.getParent?j.getParent():j.parent){if(i==j){return true}}return false},progressbox:function(w,l,C,F,i){if(C&&zk.Page.contained.length){for(var H=zk.Page.contained.length,G=zk.Page.contained[--H];G;G=zk.Page.contained[--H]){if(!G._applyMask){G._applyMask=new zk.eff.Mask({id:G.uuid+"-mask",message:l,anchor:G.$n()})}}return}if(i&&i.busy){zk.busy++;jq.focusOut()}var r=jq.innerX(),q=jq.innerY(),D=' style="left:'+r+"px;top:"+q+'px"',k=w+"-t",E=w+"-m",s='
'+l+"
";if(F){s+='
'}jq(document.body).append(s+"
");var I=jq(w,zk),A=I[0],J=jq(k,zk),t=J[0],B=t.style;if(C){A.z_mask=new zk.eff.FullMask({mask:jq(E,zk)[0],zIndex:J.css("z-index")-1})}if(C&&J.length){B.left=jq.px((jq.innerWidth()-t.offsetWidth)/2+r);B.top=jq.px((jq.innerHeight()-t.offsetHeight)/2+q)}else{var o=zk.progPos;if(o){var j,u,z=jq.innerWidth(),v=jq.innerHeight(),K=z-zk(t).offsetWidth(),p=v-zk(t).offsetHeight();if(o.indexOf("mouse")>=0){var m=zk.currentPointer;j=m[0]+10;u=m[1]+10}else{if(o.indexOf("left")>=0){j=r}else{if(o.indexOf("right")>=0){j=r+K-1}else{if(o.indexOf("center")>=0){j=r+K/2}else{j=0}}}if(o.indexOf("top")>=0){u=q}else{if(o.indexOf("bottom")>=0){u=q+p-1}else{if(o.indexOf("center")>=0){u=q+p/2}else{u=0}}}j=j=0?m.substring(0,l):m,k=g(location.href);l=k.indexOf("#");if(l>=0){k=k.substring(0,l)}if(k!=i){return}}location.reload()}}},frames:function(i){var j=[];a(j,i);return j},intsToString:function(m){if(!m){return""}var n=[];for(var l=0,i=m.length;l=0?p.substring(m,l):p.substring(m)).trim();if(n.length==0){if(l<0){break}o.push(i)}else{o.push(zk.parseInt(n))}if(l<0){break}m=l+1}return o},mapToString:function(m,j,l){j=j||"=";l=l||" ";var k=[];for(var i in m){k.push(l,i,j,m[i])}k[0]="";return k.join("")},appendAttr:function(i,k,j){return k||j?" "+i+'="'+k+'"':""},fireSized:function(j,k){if(zUtl.isImageLoading()||zk.clientinfo){var i=arguments.callee;setTimeout(function(){return i(j,k)},20);return}j=h(j);if(!(k<0)){zWatch.fireDown("beforeSize",j,null,k>0)}zWatch.fireDown("onFitSize",j,{reverse:true});zWatch.fireDown("onSize",j)},fireShown:function(i,j){zWatch.fireDown("onShow",i);zUtl.fireSized(i,j)},loadImage:function(i){if(!e[i]){e[i]=true;d(i)}},isImageLoading:function(){for(var img in eo){if(img.complete){try{delete e[img.src]}catch(err){}try{delete eo[img.src]}catch(err){}}}for(var i in e){return true}return false}};var e={};var eo={};function d(j){var i=new Image(),k=function(){try{delete e[j]}catch(err){}try{delete eo[j]}catch(err){}};eo[j]=i;i.onerror=i.onload=i.onabort=k;i.src=j}})(); diff --git a/org.adempiere.ui.zk/WEB-INF/cwr/js/zk/utl.src.js b/org.adempiere.ui.zk/WEB-INF/cwr/js/zk/utl.src.js new file mode 100644 index 0000000000..accb6824aa --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/cwr/js/zk/utl.src.js @@ -0,0 +1,437 @@ + +(function () { + var _decs = {lt: '<', gt: '>', amp: '&', quot: '"'}, + _encs = {}; + for (var v in _decs) + _encs[_decs[v]] = v; + + function _pathname(url) { + var j = url.indexOf("//"); + if (j > 0) { + j = url.indexOf("/", j + 2); + if (j > 0) return url.substring(j); + } + } + + function _frames(ary, w) { + + ary.push(w); + for (var fs = w.frames, j = 0, l = fs.length; j < l; ++j) + _frames(ary, fs[j]); + } + + function _onSizeTarget(wgt) { + var r1 = wgt, p1 = r1, + j1 = -1; + for (; p1 && p1._hflex == 'min'; p1 = p1.parent) { + delete p1._hflexsz; + r1 = p1; + ++j1; + if (p1.ignoreFlexSize_('w')) + break; + } + + var r2 = wgt, p2 = r2, + j2 = -1; + for (; p2 && p2._vflex == 'min'; p2 = p2.parent) { + delete p2._vflexsz; + r2 = p2; + ++j2; + if (p2.ignoreFlexSize_('h')) + break; + } + return j1 > 0 || j2 > 0 ? j1 > j2 ? r1 : r2: wgt; + } + + +zUtl = { + + + isChar: function (cc, opts) { + return (opts.digit && cc >= '0' && cc <= '9') + || (opts.upper && cc >= 'A' && cc <= 'Z') + || (opts.lower && cc >= 'a' && cc <= 'z') + || (opts.whitespace && (cc == ' ' || cc == '\t' || cc == '\n' || cc == '\r')) + || opts[cc]; + }, + + + + parseMap: function (text, separator, quote) { + var map = {}; + if (text) { + var ps = text.split(separator || ','); + if (quote) { + var tmp = [], + re = new RegExp(quote, 'g'), + key = '', t, pair; + while((t = ps.shift()) !== undefined) { + if ((pair = (key += t).match(re)) && pair.length != 1) { + if (key) + tmp.push(key); + key = ''; + } else + key += separator; + } + ps = tmp; + } + for (var len = ps.length; len--;) { + var key = ps[len].trim(), + index = key.indexOf('='); + if (index != -1) + map[key.substring(0, index)] = key.substring(index + 1, key.length).trim(); + } + } + return map; + }, + + + encodeXML: function (txt, opts) { + txt = txt != null ? String(txt):''; + var tl = txt.length, + pre = opts && opts.pre, + multiline = pre || (opts && opts.multiline), + maxlength = opts ? opts.maxlength : 0; + + if (!multiline && maxlength && tl > maxlength) { + var j = maxlength; + while (j > 0 && txt.charAt(j - 1) == ' ') + --j; + opts.maxlength = 0; + return zUtl.encodeXML(txt.substring(0, j) + '...', opts); + } + + var out = [], k = 0, enc; + if (multiline || pre) + for (var j = 0; j < tl; ++j) { + var cc = txt.charAt(j); + if (enc = _encs[cc]) { + out.push(txt.substring(k, j), '&', enc, ';'); + k = j + 1; + } else if (multiline && cc == '\n') { + out.push(txt.substring(k, j), "
\n"); + k = j + 1; + } else if (pre && (cc == ' ' || cc == '\t')) { + out.push(txt.substring(k, j), " "); + if (cc == '\t') + out.push("   "); + k = j + 1; + } + } + else + for (var j = 0; j < tl; ++j) + if (enc = _encs[txt.charAt(j)]) { + out.push(txt.substring(k, j), '&', enc, ';'); + k = j + 1; + } + + if (!k) return txt; + if (k < tl) + out.push(txt.substring(k)); + return out.join(''); + }, + + decodeXML: function (txt) { + var out = ""; + if (!txt) return out; + + var k = 0, tl = txt.length; + for (var j = 0; j < tl; ++j) { + var cc = txt.charAt(j); + if (cc == '&') { + var l = txt.indexOf(';', j + 1); + if (l >= 0) { + var dec = txt.charAt(j + 1) == '#' ? + String.fromCharCode(txt.charAt(j + 2).toLowerCase() == 'x' ? + parseInt(txt.substring(j + 3, l), 16): + parseInt(txt.substring(j + 2, l), 10)): + _decs[txt.substring(j + 1, l)]; + if (dec) { + out += txt.substring(k, j) + dec; + k = (j = l) + 1; + } + } + } + } + return !k ? txt: + k < tl ? out + txt.substring(k): out; + }, + + + cellps0: ' cellpadding="0" cellspacing="0" border="0"', + + img0: '', + + i0: '', + + + now: jq.now, + + + today: function (fmt) { + var d = new Date(), hr = 0, min = 0, sec = 0, msec = 0; + if (typeof fmt == "string") { + var fmt0 = fmt.toLowerCase(); + if (fmt0.indexOf('h') >= 0 || fmt0.indexOf('k') >= 0) hr = d.getHours(); + if (fmt.indexOf('m') >= 0) min = d.getMinutes(); + if (fmt.indexOf('s') >= 0) sec = d.getSeconds(); + if (fmt.indexOf('S') >= 0) msec = d.getMilliseconds(); + } else if (fmt) + return d; + return new Date(d.getFullYear(), d.getMonth(), d.getDate(), + hr, min, sec, msec); + }, + + + isAncestor: function (p, c) { + if (!p) return true; + for (; c; c = c.getParent ? c.getParent(): c.parent) + if (p == c) + return true; + return false; + }, + + + + progressbox: function (id, msg, mask, icon, _opts) { + if (mask && zk.Page.contained.length) { + for (var c = zk.Page.contained.length, e = zk.Page.contained[--c]; e; e = zk.Page.contained[--c]) { + if (!e._applyMask) + e._applyMask = new zk.eff.Mask({ + id: e.uuid + "-mask", + message: msg, + anchor: e.$n() + }); + } + return; + } + + if (_opts && _opts.busy) { + zk.busy++; + jq.focusOut(); + } + + var x = jq.innerX(), y = jq.innerY(), + style = ' style="left:'+x+'px;top:'+y+'px"', + idtxt = id + '-t', + idmsk = id + '-m', + html = '
' + +msg+'
'; + if (icon) + html += '
'; + jq(document.body).append(html + ''); + + var $n = jq(id, zk), + n = $n[0], + $txt = jq(idtxt, zk), + txt = $txt[0], + st = txt.style; + if (mask) + n.z_mask = new zk.eff.FullMask({ + mask: jq(idmsk, zk)[0], + zIndex: $txt.css('z-index') - 1 + }); + + if (mask && $txt.length) { + st.left = jq.px((jq.innerWidth() - txt.offsetWidth) / 2 + x); + st.top = jq.px((jq.innerHeight() - txt.offsetHeight) / 2 + y); + } else { + var pos = zk.progPos; + if (pos) { + var left, + top, + width = jq.innerWidth(), + height = jq.innerHeight(), + wdgap = width - zk(txt).offsetWidth(), + hghgap = height - zk(txt).offsetHeight(); + + if (pos.indexOf("mouse") >= 0) { + var offset = zk.currentPointer; + left = offset[0] + 10; + top = offset[1] + 10; + } else { + if (pos.indexOf("left") >= 0) left = x; + else if (pos.indexOf("right") >= 0) left = x + wdgap -1; + else if (pos.indexOf("center") >= 0) left = x + wdgap / 2; + else left = 0; + + if (pos.indexOf("top") >= 0) top = y; + else if (pos.indexOf("bottom") >= 0) top = y + hghgap - 1; + else if (pos.indexOf("center") >= 0) top = y + hghgap / 2; + else top = 0; + + left = left < x ? x : left; + top = top < y ? y : top; + } + st.left = jq.px(left); + st.top = jq.px(top); + } + } + + $n.zk.cleanVisibility(); + }, + + destroyProgressbox: function (id, _opts) { + if (_opts && _opts.busy && --zk.busy < 0) + zk.busy = 0; + var $n = jq(id, zk), n; + if ($n.length) { + if (n = $n[0].z_mask) n.destroy(); + $n.remove(); + } + + for (var c = zk.Page.contained.length, e = zk.Page.contained[--c]; e; e = zk.Page.contained[--c]) + if (e._applyMask) { + e._applyMask.destroy(); + e._applyMask = null; + } + }, + + + + go: function (url, opts) { + opts = opts || {}; + if (opts.target) { + open(url, opts.target); + } else if (opts.overwrite) { + location.replace(url ? url: location.href); + } else { + if (url) { + location.href = url; + + var j = url.indexOf('#'); + + if(j < 0) + return; + + var un = j >= 0 ? url.substring(0, j): url, + pn = _pathname(location.href); + + j = pn.indexOf('#'); + if (j >= 0) pn = pn.substring(0, j); + if (pn != un) + return; + + } + location.reload(); + } + }, + + + frames: function (w) { + var ary = []; + _frames(ary, w); + return ary; + }, + + + intsToString: function (ary) { + if (!ary) return ""; + + var sb = []; + for (var j = 0, k = ary.length; j < k; ++j) + sb.push(ary[j]); + return sb.join(); + }, + + stringToInts: function (text, defaultValue) { + if (text == null) + return null; + + var list = []; + for (var j = 0;;) { + var k = text.indexOf(',', j), + s = (k >= 0 ? text.substring(j, k): text.substring(j)).trim(); + if (s.length == 0) { + if (k < 0) break; + list.push(defaultValue); + } else + list.push(zk.parseInt(s)); + + if (k < 0) break; + j = k + 1; + } + return list; + }, + + mapToString: function (map, assign, separator) { + assign = assign || '='; + separator = separator || ' '; + var out = []; + for (var v in map) + out.push(separator, v, assign, map[v]); + out[0] = ''; + return out.join(''); + }, + + + appendAttr: function (nm, val, force) { + return val || force ? ' ' + nm + '="' + val + '"': ""; + }, + + fireSized: function (wgt, bfsz) { + if (zUtl.isImageLoading() || zk.clientinfo) { + var f = arguments.callee; + setTimeout(function () { + return f(wgt, bfsz); + }, 20); + return; + } + wgt = _onSizeTarget(wgt); + if (!(bfsz < 0)) + zWatch.fireDown('beforeSize', wgt, null, bfsz > 0); + zWatch.fireDown('onFitSize', wgt, {reverse: true}); + zWatch.fireDown('onSize', wgt); + }, + + fireShown: function (wgt, bfsz) { + zWatch.fireDown('onShow', wgt); + zUtl.fireSized(wgt, bfsz); + }, + + loadImage: function (url) { + if (!_imgMap[url]) { + _imgMap[url] = true; + _loadImage(url); + } + }, + + isImageLoading: function () { + for (var img in _imgObjectMap) { + if (img.complete) { + try { + delete _imgMap[img.src]; + } catch (err) {} + try { + delete _imgObjectMap[img.src]; + } catch (err) {} + } + } + for (var n in _imgMap) { + return true; + } + return false; + } +}; + +var _imgMap = {}; +var _imgObjectMap = {}; +function _loadImage(url) { + var img = new Image(), + f = function () { + try { + delete _imgMap[url]; + } catch (err) {} + try { + delete _imgObjectMap[url]; + } catch (err) {} + }; + _imgObjectMap[url]=img; + img.onerror = img.onload = img.onabort = f; + img.src = url; +} +})(); diff --git a/org.adempiere.ui.zk/WEB-INF/zk.xml b/org.adempiere.ui.zk/WEB-INF/zk.xml index 8c0f5193a6..e62f5e90f0 100644 --- a/org.adempiere.ui.zk/WEB-INF/zk.xml +++ b/org.adempiere.ui.zk/WEB-INF/zk.xml @@ -89,7 +89,11 @@ org.zkoss.zul.borderlayout.animation.disabed true - + + org.zkoss.web.util.resource.dir + /WEB-INF/cwr + + org.zkoss.zk.ui.WebApp.name iDempiere From 84464e2b85331cc41e583763c4a10ebf3857c268 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 23 Oct 2013 18:13:26 +0800 Subject: [PATCH 4/6] 1003373 Lookup Box on Dashboard Preference window doesn't have fields IDEMPIERE-594 --- .../oracle/201310230810_1003373.sql | 21 +++++++++++++++++++ .../postgresql/201310230810_1003373.sql | 18 ++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 migration/i1.0c-release/oracle/201310230810_1003373.sql create mode 100644 migration/i1.0c-release/postgresql/201310230810_1003373.sql diff --git a/migration/i1.0c-release/oracle/201310230810_1003373.sql b/migration/i1.0c-release/oracle/201310230810_1003373.sql new file mode 100644 index 0000000000..6d464c294b --- /dev/null +++ b/migration/i1.0c-release/oracle/201310230810_1003373.sql @@ -0,0 +1,21 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Oct 23, 2013 6:07:31 PM MYT +-- 1003373 Lookup Box on Dashboard Preference window doesn't have fields +UPDATE AD_Column SET IsSelectionColumn='Y',Updated=TO_DATE('2013-10-23 18:07:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200327 +; + +-- Oct 23, 2013 6:07:44 PM MYT +-- 1003373 Lookup Box on Dashboard Preference window doesn't have fields +UPDATE AD_Column SET IsSelectionColumn='Y',Updated=TO_DATE('2013-10-23 18:07:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200328 +; + +-- Oct 23, 2013 6:08:14 PM MYT +-- 1003373 Lookup Box on Dashboard Preference window doesn't have fields +UPDATE AD_Column SET IsSelectionColumn='Y',Updated=TO_DATE('2013-10-23 18:08:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200350 +; + +SELECT register_migration_script('201310230810_1003373.sql') FROM dual +; + diff --git a/migration/i1.0c-release/postgresql/201310230810_1003373.sql b/migration/i1.0c-release/postgresql/201310230810_1003373.sql new file mode 100644 index 0000000000..b3473fd113 --- /dev/null +++ b/migration/i1.0c-release/postgresql/201310230810_1003373.sql @@ -0,0 +1,18 @@ +-- Oct 23, 2013 6:07:31 PM MYT +-- 1003373 Lookup Box on Dashboard Preference window doesn't have fields +UPDATE AD_Column SET IsSelectionColumn='Y',Updated=TO_TIMESTAMP('2013-10-23 18:07:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200327 +; + +-- Oct 23, 2013 6:07:44 PM MYT +-- 1003373 Lookup Box on Dashboard Preference window doesn't have fields +UPDATE AD_Column SET IsSelectionColumn='Y',Updated=TO_TIMESTAMP('2013-10-23 18:07:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200328 +; + +-- Oct 23, 2013 6:08:14 PM MYT +-- 1003373 Lookup Box on Dashboard Preference window doesn't have fields +UPDATE AD_Column SET IsSelectionColumn='Y',Updated=TO_TIMESTAMP('2013-10-23 18:08:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200350 +; + +SELECT register_migration_script('201310230810_1003373.sql') FROM dual +; + From de55755042a9ef650594a02eb9a479b11779a555 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 23 Oct 2013 10:51:58 -0500 Subject: [PATCH 5/6] IDEMPIERE-1381 Cant find - Record Detail for translation - bottom panel --- .../adempiere/webui/adwindow/ADTabpanel.java | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java index a00940eb9b..8a57c86561 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java @@ -308,22 +308,23 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer if (gridTab.isTreeTab()) AD_Tree_ID = MTree.getDefaultAD_Tree_ID ( Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName()); + + StringBuilder cssContent = new StringBuilder(); + cssContent.append(".adtab-form-borderlayout .z-south-colpsd:before { "); + cssContent.append("content: \""); + cssContent.append(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Detail"))); + cssContent.append("\"; "); + cssContent.append("position: relative; font-size: 12px; font-weight: bold; "); + cssContent.append("top: 3px; "); + cssContent.append("left: 4px; "); + cssContent.append("z-index: -1; "); + cssContent.append("} "); + Style style = new Style(); + style.setContent(cssContent.toString()); + appendChild(style); + if (gridTab.isTreeTab() && AD_Tree_ID != 0) { - StringBuilder cssContent = new StringBuilder(); - cssContent.append(".adtab-form-borderlayout .z-south-colpsd:before { "); - cssContent.append("content: \""); - cssContent.append(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Detail"))); - cssContent.append("\"; "); - cssContent.append("position: relative; font-size: 12px; font-weight: bold; "); - cssContent.append("top: 3px; "); - cssContent.append("left: 4px; "); - cssContent.append("z-index: -1; "); - cssContent.append("} "); - Style style = new Style(); - style.setContent(cssContent.toString()); - appendChild(style); - Borderlayout layout = new Borderlayout(); layout.setParent(this); layout.setSclass("adtab-form-borderlayout"); From 3bd98facaec775aada1e93554728da44b2c4eef4 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 23 Oct 2013 11:09:07 -0500 Subject: [PATCH 6/6] IDEMPIERE-1458 Report throws Exception --- org.adempiere.base/src/org/compiere/print/MPrintFormat.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/print/MPrintFormat.java b/org.adempiere.base/src/org/compiere/print/MPrintFormat.java index 8576718045..c17a9fa1f2 100644 --- a/org.adempiere.base/src/org/compiere/print/MPrintFormat.java +++ b/org.adempiere.base/src/org/compiere/print/MPrintFormat.java @@ -842,7 +842,7 @@ public class MPrintFormat extends X_AD_PrintFormat // Get Column List from Tab String sql = "SELECT AD_Column_ID " //, Name, IsDisplayed, SeqNo + "FROM AD_Field " - + "WHERE AD_Tab_ID=(SELECT MIN(AD_Tab_ID) FROM AD_Tab WHERE AD_Table_ID=?)" + + "WHERE IsActive='Y' AND AD_Tab_ID=(SELECT MIN(AD_Tab_ID) FROM AD_Tab WHERE AD_Table_ID=? AND IsActive='Y')" + " AND IsEncrypted='N' AND ObscureType IS NULL " + " AND AD_Column_ID NOT IN (SELECT pfi.AD_Column_ID FROM AD_PrintFormatItem pfi WHERE pfi.AD_PrintFormat_ID=? AND pfi.AD_Column_ID IS NOT NULL) " + "ORDER BY COALESCE(IsDisplayed,'N') DESC, SortNo, SeqNo, Name"; @@ -879,7 +879,7 @@ public class MPrintFormat extends X_AD_PrintFormat s_log.fine("From Table ..."); sql = "SELECT AD_Column_ID " + "FROM AD_Column " - + "WHERE AD_Table_ID=? " + + "WHERE IsActive='Y' AND AD_Table_ID=? " + " AND AD_Column_ID NOT IN (SELECT pfi.AD_Column_ID FROM AD_PrintFormatItem pfi WHERE pfi.AD_PrintFormat_ID=? AND pfi.AD_Column_ID IS NOT NULL) " + "ORDER BY IsIdentifier DESC, SeqNo, Name"; try