IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows / use case 2
This commit is contained in:
parent
241f515480
commit
f81147ec4d
|
@ -0,0 +1,12 @@
|
||||||
|
-- Jul 18, 2013 9:41:34 AM COT
|
||||||
|
-- IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows
|
||||||
|
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','You''re trying to close this tab.',200208,'D','2955ff22-87ac-401a-b5f8-66be72ad82a2','CloseTabFromBrowser?','Y',TO_DATE('2013-07-18 09:41:33','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-07-18 09:41:33','YYYY-MM-DD HH24:MI:SS'),0)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 18, 2013 9:41:34 AM COT
|
||||||
|
-- IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows
|
||||||
|
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200208 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||||
|
;
|
||||||
|
SELECT register_migration_script('20130718094134_IDEMPIERE-984.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
-- Jul 18, 2013 9:41:34 AM COT
|
||||||
|
-- IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows
|
||||||
|
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','You''re trying to close this tab.',200208,'D','2955ff22-87ac-401a-b5f8-66be72ad82a2','CloseTabFromBrowser?','Y',TO_TIMESTAMP('2013-07-18 09:41:33','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-07-18 09:41:33','YYYY-MM-DD HH24:MI:SS'),0)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 18, 2013 9:41:34 AM COT
|
||||||
|
-- IDEMPIERE-984 Change Role and Logout must check for unsaved records on open windows
|
||||||
|
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200208 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||||
|
;
|
||||||
|
SELECT register_migration_script('20130718094134_IDEMPIERE-984.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -411,6 +411,17 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
//redirect to login page
|
//redirect to login page
|
||||||
Executions.sendRedirect("index.zul");
|
Executions.sendRedirect("index.zul");
|
||||||
}
|
}
|
||||||
|
public void logoutAfterTabDestroyed(){
|
||||||
|
Session session = logout0();
|
||||||
|
|
||||||
|
//clear context, invalidate session
|
||||||
|
Env.getCtx().clear();
|
||||||
|
session.invalidate();
|
||||||
|
|
||||||
|
//redirect to login page
|
||||||
|
Executions.sendRedirect("index.zul");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected Session logout0() {
|
protected Session logout0() {
|
||||||
Session session = Executions.getCurrent().getDesktop().getSession();
|
Session session = Executions.getCurrent().getDesktop().getSession();
|
||||||
|
|
|
@ -33,6 +33,10 @@ public interface IWebClient {
|
||||||
* logout
|
* logout
|
||||||
*/
|
*/
|
||||||
public void logout();
|
public void logout();
|
||||||
|
/**
|
||||||
|
* logout after browser destroyed
|
||||||
|
*/
|
||||||
|
public void logoutAfterTabDestroyed();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
import org.zkoss.zk.ui.event.KeyEvent;
|
import org.zkoss.zk.ui.event.KeyEvent;
|
||||||
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
import org.zkoss.zk.ui.util.Composer;
|
import org.zkoss.zk.ui.util.Composer;
|
||||||
import org.zkoss.zul.Menuitem;
|
import org.zkoss.zul.Menuitem;
|
||||||
import org.zkoss.zul.impl.LabelImageElement;
|
import org.zkoss.zul.impl.LabelImageElement;
|
||||||
|
@ -76,7 +77,9 @@ public class UserPanel implements EventListener<Event>, Composer<Component>
|
||||||
|
|
||||||
protected void onCreate()
|
protected void onCreate()
|
||||||
{
|
{
|
||||||
lblUserNameValue = (Label) component.getFellowIfAny("loginUserAndRole", true);
|
String s = Msg.getMsg(Env.getCtx(), "CloseTabFromBrowser?").replace("\n", "<br>");
|
||||||
|
Clients.confirmClose(s);
|
||||||
|
lblUserNameValue = (Label) component.getFellowIfAny("loginUserAndRole", true);
|
||||||
lblUserNameValue.setValue(getUserName() + "@" + getClientName() + "." + getOrgName()+"/"+this.getRoleName());
|
lblUserNameValue.setValue(getUserName() + "@" + getClientName() + "." + getOrgName()+"/"+this.getRoleName());
|
||||||
lblUserNameValue.addEventListener(Events.ON_CLICK, this);
|
lblUserNameValue.addEventListener(Events.ON_CLICK, this);
|
||||||
|
|
||||||
|
|
|
@ -319,6 +319,7 @@ public class SessionContextListener implements ExecutionInit,
|
||||||
|
|
||||||
if (ServerContext.getCurrentInstance().isEmpty() || !isContextValid())
|
if (ServerContext.getCurrentInstance().isEmpty() || !isContextValid())
|
||||||
{
|
{
|
||||||
|
SessionManager.logoutSessionAfterBrowserDestroyed();
|
||||||
setupExecutionContextFromSession(Executions.getCurrent());
|
setupExecutionContextFromSession(Executions.getCurrent());
|
||||||
}
|
}
|
||||||
int AD_Session_ID = Env.getContextAsInt(Env.getCtx(), "#AD_Session_ID");
|
int AD_Session_ID = Env.getContextAsInt(Env.getCtx(), "#AD_Session_ID");
|
||||||
|
|
|
@ -100,6 +100,12 @@ public class SessionManager
|
||||||
if (app != null)
|
if (app != null)
|
||||||
app.logout();
|
app.logout();
|
||||||
}
|
}
|
||||||
|
public static void logoutSessionAfterBrowserDestroyed()
|
||||||
|
{
|
||||||
|
IWebClient app = getSessionApplication();
|
||||||
|
if (app != null)
|
||||||
|
app.logoutAfterTabDestroyed();
|
||||||
|
}
|
||||||
|
|
||||||
public static void changeRole(MUser user){
|
public static void changeRole(MUser user){
|
||||||
IWebClient app = getSessionApplication();
|
IWebClient app = getSessionApplication();
|
||||||
|
|
Loading…
Reference in New Issue