hg merge release-6.2 (merge release6.2 into default)

This commit is contained in:
Carlos Ruiz 2019-04-27 14:18:37 +02:00
commit 7753c90af0
13 changed files with 226 additions and 68 deletions

View File

@ -0,0 +1,15 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-3956 Add Close Windows to the Left/Right - expanding IDEMPIERE-2335
-- Apr 25, 2019, 4:43:29 PM CEST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Close Windows to the Right',0,0,'Y',TO_DATE('2019-04-25 16:43:29','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-04-25 16:43:29','YYYY-MM-DD HH24:MI:SS'),100,200510,'CloseWindowsToTheRight','D','b90cf739-eb4d-41eb-a8cb-7c1960e7af2a')
;
-- Apr 25, 2019, 4:44:18 PM CEST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Close Windows to the Left',0,0,'Y',TO_DATE('2019-04-25 16:44:17','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-04-25 16:44:17','YYYY-MM-DD HH24:MI:SS'),100,200511,'CloseWindowsToTheLeft','D','c150a69a-ae19-4403-8d03-0040e7714ef9')
;
SELECT register_migration_script('201904251644_IDEMPIERE-3956.sql') FROM dual
;

View File

@ -0,0 +1,11 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- CPH::ERP Comments:
-- 26. apr. 2019 20.56.39 CEST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','No query columns found',0,0,'Y',TO_DATE('2019-04-26 20:56:38','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-04-26 20:56:38','YYYY-MM-DD HH24:MI:SS'),100,200512,'NoQueryColumnsFound','C','6c8ad45a-43a1-4386-96e1-b3958844fd4a')
;
SELECT register_migration_script('201904271403_IDEMPIERE-3957.sql') FROM dual
;

View File

@ -0,0 +1,12 @@
-- IDEMPIERE-3956 Add Close Windows to the Left/Right - expanding IDEMPIERE-2335
-- Apr 25, 2019, 4:43:29 PM CEST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Close Windows to the Right',0,0,'Y',TO_TIMESTAMP('2019-04-25 16:43:29','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-04-25 16:43:29','YYYY-MM-DD HH24:MI:SS'),100,200510,'CloseWindowsToTheRight','D','b90cf739-eb4d-41eb-a8cb-7c1960e7af2a')
;
-- Apr 25, 2019, 4:44:18 PM CEST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Close Windows to the Left',0,0,'Y',TO_TIMESTAMP('2019-04-25 16:44:17','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-04-25 16:44:17','YYYY-MM-DD HH24:MI:SS'),100,200511,'CloseWindowsToTheLeft','D','c150a69a-ae19-4403-8d03-0040e7714ef9')
;
SELECT register_migration_script('201904251644_IDEMPIERE-3956.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- CPH::ERP Comments:
-- 26. apr. 2019 20.56.39 CEST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','No query columns found',0,0,'Y',TO_TIMESTAMP('2019-04-26 20:56:38','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-04-26 20:56:38','YYYY-MM-DD HH24:MI:SS'),100,200512,'NoQueryColumnsFound','C','6c8ad45a-43a1-4386-96e1-b3958844fd4a')
;
SELECT register_migration_script('201904271403_IDEMPIERE-3957.sql') FROM dual
;

View File

@ -3,7 +3,7 @@ Version: 6.2
Section: web
Priority: extra
Architecture: all
Pre-Depends: openjdk-11-jdk|openjdk-12-jdk, postgresql-11|postgresql-10|postgresql-9.6, postgresql-contrib, adduser
Pre-Depends: openjdk-11-jdk|openjdk-12-jdk, postgresql-11|postgresql-10|postgresql-contrib-9.6, adduser
Suggests: firefox
Installed-Size: 968668
Maintainer: Carlos Ruiz <carg67@gmail.com>

View File

@ -550,7 +550,7 @@ configure()
configure_perform
CONFIGURE_RUN=true
write_sysconfig
echo To access the iDempiere Server Home Page, start the server with '/etc/init.d/idempiere start'
echo To access the iDempiere Server Home Page, start the server with 'systemctl start idempiere'
echo and then go to \"http://127.0.0.1:${ADEMPIERE_WEB_PORT}\"
}

View File

@ -54,6 +54,14 @@
<param-value>org.adempiere.web.server.ServerApplication</param-value>
</init-param>
</servlet> -->
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
<init-param>
<param-name>dirAllowed</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>JnlpDownloadServlet</servlet-name>
<url-pattern>*.jnlp</url-pattern>

View File

@ -1633,10 +1633,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
dataSql = dataSql + " " + otherClause;
}
if (indexOrderColumn > -1)
dataSql = dataSql + getUserOrderClause();
else
dataSql = dataSql + m_sqlOrder;
dataSql = dataSql + getUserOrderClause();
if (end > start && isUseDatabasePaging() && DB.getDatabase().isPagingSupported())
{

View File

@ -415,7 +415,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener<Event>
// Miminum check
if (m_queryColumns.size() == 0)
{
FDialog.error(p_WindowNo, this, "Error", "No query columns found");
FDialog.error(p_WindowNo, this, "Error", Msg.getMsg(Env.getCtx(),"NoQueryColumnsFound"));
log.log(Level.SEVERE, "No query columns found");
return false;
}

View File

@ -63,6 +63,7 @@ import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.event.WTableModelEvent;
import org.adempiere.webui.event.WTableModelListener;
import org.adempiere.webui.factory.InfoManager;
import org.adempiere.webui.info.InfoWindow;
import org.adempiere.webui.part.ITabOnSelectHandler;
import org.adempiere.webui.part.WindowContainer;
import org.adempiere.webui.session.SessionManager;
@ -374,6 +375,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
private String m_sqlUserOrder;
/* sql column of infocolumn (can be alias) */
protected int indexOrderColumn = -1;
protected String sqlOrderColumn;
protected Boolean isColumnSortAscending = null;
/**ValueChange listeners */
private ArrayList<ValueChangeListener> listeners = new ArrayList<ValueChangeListener>();
@ -1041,10 +1043,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
int index = sql.lastIndexOf(" WHERE");
sql.delete(index, sql.length());
}
if (indexOrderColumn > -1)
sql.append(getUserOrderClause());
else
sql.append(m_sqlOrder);
sql.append(getUserOrderClause());
dataSql = Msg.parseTranslation(Env.getCtx(), sql.toString()); // Variables
dataSql = MRole.getDefault().addAccessSQL(dataSql, getTableName(),
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
@ -1055,14 +1056,40 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
return dataSql;
}
/**
* column of grid isn't fix, it can change by display logic of column each time load data
* {@link InfoWindow#prepareTable(ColumnInfo[], String, String, String)}
* so need to validate it by compare sql of current sort column
*/
protected void validateOrderIndex() {
if (indexOrderColumn > 0 && (indexOrderColumn + 1 > p_layout.length || !p_layout[indexOrderColumn].getColSQL().trim().equals(sqlOrderColumn))) {
// try to find out new index of ordered column, in case has other column is hide or display
for (int testIndex = 0; testIndex < p_layout.length; testIndex++) {
if (p_layout[testIndex].getColSQL().trim().equals(sqlOrderColumn)) {
indexOrderColumn = testIndex;
break;
}
}
// index still incorrect and can't find out new index (ordered column become hide column)
if (indexOrderColumn > 0 && (indexOrderColumn + 1 > p_layout.length || !p_layout[indexOrderColumn].getColSQL().trim().equals(sqlOrderColumn))) {
indexOrderColumn = -1;
sqlOrderColumn = null;
m_sqlUserOrder = null;
}
}
}
/**
* build order clause of current sort order, and save it to m_sqlUserOrder
* @return
*/
protected String getUserOrderClause() {
validateOrderIndex();
if (indexOrderColumn < 0) {
return null;
return m_sqlOrder;
}
if (m_sqlUserOrder == null) {
m_sqlUserOrder = getUserOrderClause (indexOrderColumn);
}
@ -2296,24 +2323,26 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
}
}
protected void correctHeaderOrderIndicator() {
Listhead listHead = contentPanel.getListHead();
if (listHead != null) {
List<?> headers = listHead.getChildren();
for(Object obj : headers)
{
Listheader header = (Listheader) obj;
// idempiere use mix method. sometime call model method, sometime call component method
// so index can be difference on complicate case, just wait to fix
if (header.getColumnIndex() == indexOrderColumn)
header.setSortDirection(isColumnSortAscending?"ascending":"descending");
else
header.setSortDirection("natural");
}
}
}
public void onQueryCallback(Event event)
{
try
{
Listhead listHead = contentPanel.getListHead();
if (listHead != null) {
List<?> headers = listHead.getChildren();
for(Object obj : headers)
{
Listheader header = (Listheader) obj;
// idempiere use mix method. sometime call model method, sometime call component method
// so index can be difference on complicate case, just wait to fix
if (header.getColumnIndex() == indexOrderColumn)
header.setSortDirection(isColumnSortAscending?"ascending":"descending");
else
header.setSortDirection("natural");
}
}
// m_sqlUserOrder="";
// event == null mean direct call from reset button
if (event == null)
@ -2321,7 +2350,10 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
else
executeQuery();
renderItems();
renderItems();
correctHeaderOrderIndicator();
// IDEMPIERE-1334 after refresh, restore prev selected item start
// just evaluate display logic of process button when requery by use click requery button
if (isQueryByUser){
@ -2454,6 +2486,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
int col = lsc.getColumnIndex();
indexOrderColumn = col;
isColumnSortAscending = ascending;
sqlOrderColumn = p_layout[col].getColSQL().trim();
m_sqlUserOrder = null; // clear cache value
if (m_useDatabasePaging)

View File

@ -39,6 +39,7 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.KeyEvent;
import org.zkoss.zk.ui.event.OpenEvent;
import org.zkoss.zk.ui.event.SwipeEvent;
import org.zkoss.zul.Menuitem;
@ -49,6 +50,12 @@ import org.zkoss.zul.Menuitem;
*/
public class WindowContainer extends AbstractUIPart implements EventListener<Event>
{
private static final String OPTION_CLOSE = "Close";
private static final String OPTION_CLOSE_OTHER_WINDOWS = "CloseOtherWindows";
private static final String OPTION_CLOSE_WINDOWS_TO_THE_LEFT = "CloseWindowsToTheLeft";
private static final String OPTION_CLOSE_WINDOWS_TO_THE_RIGHT = "CloseWindowsToTheRight";
private static final String OPTION_CLOSE_ALL_WINDOWS = "CloseAllWindows";
public static final String ON_MOBILE_SET_SELECTED_TAB = "onMobileSetSelectedTab";
private static final String ON_AFTER_TAB_CLOSE = "onAfterTabClose";
@ -279,6 +286,8 @@ public class WindowContainer extends AbstractUIPart implements EventListener<Eve
}
}
};
popupClose.addEventListener(Events.ON_OPEN, this);
popupClose.setAttribute("tab", tab);
tab.setDecorateInfo(decorateInfo);
if (title != null)
{
@ -358,68 +367,87 @@ public class WindowContainer extends AbstractUIPart implements EventListener<Eve
}
Menuitem mi;
if(tab.getIndex()!=0){
mi = new Menuitem(Msg.getMsg(Env.getCtx(), "Close"));
if (tab.getIndex() != 0) {
mi = new Menuitem(Msg.getMsg(Env.getCtx(), OPTION_CLOSE));
mi.setAttribute("option", OPTION_CLOSE);
popupClose.appendChild(mi);
mi.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
int currentTabIndex = tab.getIndex();
int focusTabIndex = currentTabIndex;
int tabsSizeBeforeClose = tabbox.getTabs().getChildren().size();
if ( tabsSizeBeforeClose == currentTabIndex + 1 ) {
currentTabIndex--;
}
if ( tab.getPreviousSibling() != null ) {
tab.onClose();
// Update the current tab index.
if ( tabsSizeBeforeClose != tabbox.getTabs().getChildren().size() )
tabbox.setSelectedIndex( currentTabIndex );
Events.postEvent(ON_AFTER_TAB_CLOSE, tabbox, null);
if (tabsSizeBeforeClose == currentTabIndex + 1) {
focusTabIndex = currentTabIndex - 1;
}
closeTabs(tab, currentTabIndex, currentTabIndex, focusTabIndex);
}
});
mi = new Menuitem(Msg.getMsg(Env.getCtx(), "CloseOtherWindows"));
mi = new Menuitem(Msg.getMsg(Env.getCtx(), OPTION_CLOSE_OTHER_WINDOWS));
mi.setAttribute("option", OPTION_CLOSE_OTHER_WINDOWS);
popupClose.appendChild(mi);
mi.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
int currentTabIndex = tab.getIndex();
closeTabs(tab, currentTabIndex + 1, -1, currentTabIndex); // Right
int focusTabIndex = 1;
List<Component> tabs = tabbox.getTabs().getChildren();
for ( int i = tabs.size() - 1; i > 0; i-- ) {
if(!((Tab)tabs.get( i )).equals(tab)){
((Tab)tabs.get( i )).setSelected(false);
closeTabs(tab, 1, currentTabIndex - 1, focusTabIndex); // Left
}
});
((Tab)tabs.get( i )).onClose();
}
}
tabbox.setSelectedIndex(focusTabIndex);
Events.postEvent(ON_AFTER_TAB_CLOSE, tabbox, null);
mi = new Menuitem(Msg.getMsg(Env.getCtx(), OPTION_CLOSE_WINDOWS_TO_THE_LEFT));
mi.setAttribute("option", OPTION_CLOSE_WINDOWS_TO_THE_LEFT);
popupClose.appendChild(mi);
mi.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
int currentTabIndex = tab.getIndex();
int focusTabIndex = 1;
closeTabs(tab, 1, currentTabIndex - 1, focusTabIndex);
}
});
mi = new Menuitem(Msg.getMsg(Env.getCtx(), OPTION_CLOSE_WINDOWS_TO_THE_RIGHT));
mi.setAttribute("option", OPTION_CLOSE_WINDOWS_TO_THE_RIGHT);
popupClose.appendChild(mi);
mi.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
int currentTabIndex = tab.getIndex();
closeTabs(tab, currentTabIndex + 1, -1, currentTabIndex);
}
});
}
mi = new Menuitem(Msg.getMsg(Env.getCtx(), "CloseAllWindows"));
mi.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
int focusTabIndex = 0;
List<Component> tabs = tabbox.getTabs().getChildren();
for ( int i = tabs.size() - 1; i > 0; i-- ) {
((Tab)tabs.get( i )).setSelected(false);
((Tab)tabs.get( i )).onClose();
}
tabbox.setSelectedIndex( focusTabIndex );
Events.postEvent(ON_AFTER_TAB_CLOSE, tabbox, null);
}
});
popupClose.appendChild(mi);
ZKUpdateUtil.setWidth(popupClose, "auto");
popupClose.setPage(tab.getPage());
tab.setContext(popupClose);
mi = new Menuitem(Msg.getMsg(Env.getCtx(), OPTION_CLOSE_ALL_WINDOWS));
mi.setAttribute("option", OPTION_CLOSE_ALL_WINDOWS);
popupClose.appendChild(mi);
mi.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
int focusTabIndex = 0;
closeTabs(tab, 1, -1, focusTabIndex);
}
});
ZKUpdateUtil.setWidth(popupClose, "auto");
popupClose.setPage(tab.getPage());
tab.setContext(popupClose);
updateTabListButton();
return tab;
}
protected void closeTabs(Tab tab, int start, int end, int focus) {
List<Component> tabs = tabbox.getTabs().getChildren();
if (end == -1) {
end = tabs.size() - 1;
}
for (int i = end; i >= start; i--) {
((Tab)tabs.get( i )).setSelected(false);
((Tab)tabs.get( i )).onClose();
}
tabbox.setSelectedIndex(focus);
Events.postEvent(ON_AFTER_TAB_CLOSE, tabbox, null);
}
private void updateTabListButton() {
if (isMobile() && tabListBtn != null) {
int cnt = tabbox.getTabs().getChildren().size()-1;
@ -593,6 +621,37 @@ public class WindowContainer extends AbstractUIPart implements EventListener<Eve
try {
SessionManager.getSessionApplication().getKeylistener().addEventListener(Events.ON_CTRL_KEY, this);
} catch (Exception e) {}
}else if (event instanceof OpenEvent && event.getTarget() instanceof Menupopup) {
if (((OpenEvent)event).isOpen()) {
Menupopup popup = (Menupopup) event.getTarget();
List<Component> tabs = tabbox.getTabs().getChildren();
int tabsSize = tabs.size();
int currentTabIdx = -1;
if (popup.getAttribute("tab") != null) {
Tab currentTab = (Tab) popup.getAttribute("tab");
for ( int i = tabsSize - 1; i > 0; i-- ) {
Tab tab = ((Tab)tabs.get(i));
if (currentTab.equals(tab)) {
currentTabIdx = i;
break;
}
}
}
if (currentTabIdx > 0) {
List<Component> items = popup.getChildren();
for (Component item : items) {
if (item instanceof Menuitem) {
String option = (String) item.getAttribute("option");
boolean visible =
(OPTION_CLOSE.equals(option))
|| (tabsSize > 2 && (OPTION_CLOSE_OTHER_WINDOWS.equals(option) || OPTION_CLOSE_ALL_WINDOWS.equals(option)))
|| (currentTabIdx < tabsSize - 1 && OPTION_CLOSE_WINDOWS_TO_THE_RIGHT.equals(option))
|| (currentTabIdx > 1 && OPTION_CLOSE_WINDOWS_TO_THE_LEFT.equals(option));
item.setVisible(visible);
}
}
}
}
}else if (Events.ON_CTRL_KEY.equals(event.getName())) {
KeyEvent keyEvent = (KeyEvent) event;
if (keyEvent.isAltKey() && keyEvent.getKeyCode() == KeyEvent.PAGE_DOWN

View File

@ -35,6 +35,14 @@
<!-- Remove async-supported if you are not using Servlet 3.0 -->
<async-supported>true</async-supported>
</servlet>
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
<init-param>
<param-name>dirAllowed</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>AtmosphereServlet</servlet-name>
<url-pattern>/zkau/comet</url-pattern>

View File

@ -27,7 +27,14 @@
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
<init-param>
<param-name>dirAllowed</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>