* Implement timeout page

* Reduce default session timeout period from 120 minutes to 60 minutes

Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2947703
This commit is contained in:
Heng Sin Low 2010-03-29 02:44:16 +00:00
parent 7af86a2af9
commit aff29fc575
7 changed files with 93 additions and 8 deletions

View File

@ -0,0 +1,10 @@
-- Mar 26, 2010 1:55:43 AM MYT
-- automatic logout after inactivity - ID: 2947703
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,53099,0,TO_DATE('2010-03-26 01:55:36','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','The page or component you request is no longer available. This is normally caused by timeout or rebooting the server.','I',TO_DATE('2010-03-26 01:55:36','YYYY-MM-DD HH24:MI:SS'),100,'SessionTimeoutText')
;
-- Mar 26, 2010 1:55:43 AM MYT
-- automatic logout after inactivity - ID: 2947703
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) 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 FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53099 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)
;

View File

@ -0,0 +1,10 @@
-- Mar 26, 2010 1:55:43 AM MYT
-- automatic logout after inactivity - ID: 2947703
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,53099,0,TO_TIMESTAMP('2010-03-26 01:55:36','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','The page or component you request is no longer available. This is normally caused by timeout or rebooting the server.','I',TO_TIMESTAMP('2010-03-26 01:55:36','YYYY-MM-DD HH24:MI:SS'),100,'SessionTimeoutText')
;
-- Mar 26, 2010 1:55:43 AM MYT
-- automatic logout after inactivity - ID: 2947703
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) 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 FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53099 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)
;

View File

@ -55,6 +55,7 @@ import org.compiere.util.KeyNamePair;
import org.compiere.util.Language;
import org.compiere.util.Login;
import org.compiere.util.Msg;
import org.zkoss.lang.Strings;
import org.zkoss.util.Locales;
import org.zkoss.zhtml.Div;
import org.zkoss.zhtml.Table;
@ -422,6 +423,9 @@ public class LoginPanel extends Window implements EventListener
Locales.setThreadLocal(language.getLocale());
Clients.response("zkLocaleJavaScript", new AuScript(null, ZkFns.outLocaleJavaScript()));
String timeoutText = getUpdateTimeoutTextScript();
if (!Strings.isEmpty(timeoutText))
Clients.response("zkLocaleJavaScript2", new AuScript(null, timeoutText));
}
// This temporary validation code is added to check the reported bug
@ -447,4 +451,14 @@ public class LoginPanel extends Window implements EventListener
}
private String getUpdateTimeoutTextScript() {
String msg = Msg.getMsg(Env.getCtx(), "SessionTimeoutText");
if (msg == null || msg.equals("SessionTimeoutText")) {
return null;
}
msg = Strings.escape(msg, "\"");
String s = "adempiere.store.set(\"zkTimeoutText\", \"" + msg + "\")";
return s;
}
}

View File

@ -80,7 +80,7 @@
<!-- /////////// -->
<!-- Miscellaneous -->
<session-config>
<session-timeout>120</session-timeout>
<session-timeout>60</session-timeout>
</session-config>
<!-- MIME mapping -->

View File

@ -5,6 +5,13 @@
-->
<zk>
<!-- Adempiere thread session context handler -->
<listener>
<description>ADempiere WebUI Context management</description>
<listener-class>org.adempiere.webui.session.SessionContextListener
</listener-class>
</listener>
<log>
<description>[Optional] Monitor i3-log.conf and register a
handler for the specified log-base</description>
@ -21,18 +28,26 @@
</language-config>
-->
<session-config>
<device-type>ajax</device-type>
<automatic-timeout/> <!-- the same as <automatic-timeout>true</automatic-timeout> -->
<timeout-uri>/timeout.zul</timeout-uri>
</session-config>
<!--
Turn on the following if used with WebLogic 9.1 <system-config>
<cache-provider-class>org.zkoss.zk.ui.sys.GlobalDesktopCacheProvider</cache-provider-class>
</system-config>
-->
<!-- Adempiere thread session context handler -->
<listener>
<description>ADempiere WebUI Context management</description>
<listener-class>org.adempiere.webui.session.SessionContextListener
</listener-class>
</listener>
<!--
polling - org.zkoss.zkex.ui.impl.PollingServerPush
comet - org.zkoss.zkmax.ui.comet.CometServerPush ( enterprise edition only )
-->
<device-config>
<device-type>ajax</device-type>
<server-push-class>org.zkoss.zkmax.ui.comet.CometServerPush</server-push-class>
</device-config>
<library-property>
<name>org.zkoss.zul.theme.fontSizeM

View File

@ -10,5 +10,9 @@ Copyright (C) 2007 Ashley G Ramdass.
<?link rel="stylesheet" type="text/css" href="${themeStyleSheetByBrowser}"?>
<?link rel="stylesheet" type="text/css" href="css/PAPanel.css"?>
<zk>
<script>
var zkTimeoutText = "The page or component you request is no longer available. This is normally caused by timeout or rebooting the server.";
adempiere.store.set("zkTimeoutText", zkTimeoutText);
</script>
<window use="org.adempiere.webui.AdempiereWebUI"/>
</zk>

32
zkwebui/timeout.zul Normal file
View File

@ -0,0 +1,32 @@
<?page title="Adempiere" contentType="text/html;charset=UTF-8"?>
<zk>
<zscript>
<![CDATA[
import org.compiere.util.Msg;
import org.compiere.util.Env;
var continueText = Msg.getMsg(Env.getCtx(),"continue");
]]>
</zscript>
<window width="60%" mode="highlighted">
<vbox style="padding: 5px">
<div id="timeoutText"></div>
<div style="margin-top: 10px">
<toolbarbutton href="/index.zul" label="${continueText}"/>
</div>
</vbox>
<script defer="true">
<![CDATA[
var callback = function(ok, val) {
if (ok && !!val)
{
$e("${timeoutText.uuid}").innerHTML = val;
}
};
adempiere.store.get("zkTimeoutText", callback);
]]>
</script>
</window>
</zk>