Fixed issue 12327 and 12333: Now Login_F1 messages are messageBD
authorDavid Baz Fayos <david.baz@openbravo.com>
Tue, 02 Mar 2010 20:19:03 +0100
changeset 6553 f58ffdba8c78
parent 6552 e8ac46d4297c
child 6554 ad2e6b14c421
Fixed issue 12327 and 12333: Now Login_F1 messages are messageBD
src-db/database/sourcedata/AD_MESSAGE.xml
src/org/openbravo/erpCommon/ad_forms/InstanceManagement.html
src/org/openbravo/erpCommon/ad_forms/InstanceManagement.java
src/org/openbravo/erpCommon/ad_forms/InstanceManagement.xml
src/org/openbravo/erpCommon/security/Login.java
src/org/openbravo/erpCommon/security/Login_F1.html
src/org/openbravo/erpCommon/security/Login_F1.xml
web/js/utils.js
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Mar 02 18:47:40 2010 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Mar 02 20:19:03 2010 +0100
@@ -30916,6 +30916,39 @@
 <!--5D3624FE019649CCB3B5900F32E59E17-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--5D3624FE019649CCB3B5900F32E59E17--></AD_MESSAGE>
 
+<!--5D3624FE019649CCB3B5900F32E59E18--><AD_MESSAGE>
+<!--5D3624FE019649CCB3B5900F32E59E18-->  <AD_MESSAGE_ID><![CDATA[5D3624FE019649CCB3B5900F32E59E18]]></AD_MESSAGE_ID>
+<!--5D3624FE019649CCB3B5900F32E59E18-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5D3624FE019649CCB3B5900F32E59E18-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5D3624FE019649CCB3B5900F32E59E18-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5D3624FE019649CCB3B5900F32E59E18-->  <VALUE><![CDATA[OUTDATED_FILES_CACHED]]></VALUE>
+<!--5D3624FE019649CCB3B5900F32E59E18-->  <MSGTEXT><![CDATA[Your browser's cache has outdated files. Please clean it and reload the page.]]></MSGTEXT>
+<!--5D3624FE019649CCB3B5900F32E59E18-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--5D3624FE019649CCB3B5900F32E59E18-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--5D3624FE019649CCB3B5900F32E59E18--></AD_MESSAGE>
+
+<!--5D3624FE019649CCB3B5900F32E59E19--><AD_MESSAGE>
+<!--5D3624FE019649CCB3B5900F32E59E19-->  <AD_MESSAGE_ID><![CDATA[5D3624FE019649CCB3B5900F32E59E19]]></AD_MESSAGE_ID>
+<!--5D3624FE019649CCB3B5900F32E59E19-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5D3624FE019649CCB3B5900F32E59E19-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5D3624FE019649CCB3B5900F32E59E19-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5D3624FE019649CCB3B5900F32E59E19-->  <VALUE><![CDATA[BROWSER_NOT_SUPPORTED]]></VALUE>
+<!--5D3624FE019649CCB3B5900F32E59E19-->  <MSGTEXT><![CDATA[Your browser is not officially supported.\n\nYou can continue at your own risk or access the application with one of the supported browsers:]]></MSGTEXT>
+<!--5D3624FE019649CCB3B5900F32E59E19-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--5D3624FE019649CCB3B5900F32E59E19-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--5D3624FE019649CCB3B5900F32E59E19--></AD_MESSAGE>
+
+<!--5D3624FE019649CCB3B5900F32E59E20--><AD_MESSAGE>
+<!--5D3624FE019649CCB3B5900F32E59E20-->  <AD_MESSAGE_ID><![CDATA[5D3624FE019649CCB3B5900F32E59E20]]></AD_MESSAGE_ID>
+<!--5D3624FE019649CCB3B5900F32E59E20-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5D3624FE019649CCB3B5900F32E59E20-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5D3624FE019649CCB3B5900F32E59E20-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5D3624FE019649CCB3B5900F32E59E20-->  <VALUE><![CDATA[OR_HIGHER_TEXT]]></VALUE>
+<!--5D3624FE019649CCB3B5900F32E59E20-->  <MSGTEXT><![CDATA[or higher]]></MSGTEXT>
+<!--5D3624FE019649CCB3B5900F32E59E20-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--5D3624FE019649CCB3B5900F32E59E20-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--5D3624FE019649CCB3B5900F32E59E20--></AD_MESSAGE>
+
 <!--5DDBAC99880F4F159204247F691227DB--><AD_MESSAGE>
 <!--5DDBAC99880F4F159204247F691227DB-->  <AD_MESSAGE_ID><![CDATA[5DDBAC99880F4F159204247F691227DB]]></AD_MESSAGE_ID>
 <!--5DDBAC99880F4F159204247F691227DB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.html	Tue Mar 02 18:47:40 2010 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.html	Tue Mar 02 20:19:03 2010 +0100
@@ -41,19 +41,16 @@
 <script language="JavaScript" src="../../../../../web/js/appStatus.js" type="text/javascript"></script>
 <script language="JavaScript" src="../utility/CheckCleanCache.js?cache=true" type="text/javascript"></script>
 <script language="JavaScript" src="../utility/CheckCleanCache.js?cache=false" type="text/javascript"></script>
+<script language="JavaScript" type="text/javascript" id="cacheMsg">var cacheMsg = "xx";</script>
 <script language="JavaScript" type="text/javascript">
-  
   function submitActivate(action) {
     submitCommandForm(action, true, null, 'InstanceManagement.html', '_self', null, true);
     return false;
   }
   
   function onloadFunctions() {
-    setProcessingMode('window',false);
-    
+    setProcessingMode('window', false);
   }
-  
-
 </script>
   <script language="JavaScript" type="text/javascript">
   function onLoadDo(){
@@ -74,10 +71,10 @@
     } catch (e) {}
 
     resizeArea();
-
+alert(cacheMsg);
     if (isOpsInstance() != isOpsInstanceCached()) {
-        alert("Your browser's cache has outdated files. Please clean it and reload the page.");
-    } 
+      alert(cacheMsg);
+    }
   }
 
   function onResizeDo(){
--- a/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.java	Tue Mar 02 18:47:40 2010 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.java	Tue Mar 02 20:19:03 2010 +0100
@@ -264,6 +264,11 @@
         xmlDocument.setParameter("OPSdaysLeft", Utility.messageBD(this, "OPSUnlimitedUsers",
             vars.getLanguage()).replace("\\n", "\n"));
     }
+
+    String cacheMsg = Utility.messageBD(this, "OUTDATED_FILES_CACHED", vars.getLanguage()).replace("\\n", "\n");
+    cacheMsg = "var cacheMsg = \"" + cacheMsg + "\"";
+    xmlDocument.setParameter("cacheMsg", cacheMsg);
+
     PrintWriter out = response.getWriter();
     out.println(xmlDocument.print());
     out.close();
--- a/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.xml	Tue Mar 02 18:47:40 2010 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/InstanceManagement.xml	Tue Mar 02 20:19:03 2010 +0100
@@ -30,5 +30,5 @@
   <PARAMETER id="messageBoxIDMessage" name="messageMessage" default=""/>
   <PARAMETER id="instanceInfo" name="instanceInfo" default=""/>
   <PARAMETER id="OPSdaysLeft" name="OPSdaysLeft" dafault=""/>
-
+  <PARAMETER id="cacheMsg" name="cacheMsg" default=""/>
 </REPORT>
--- a/src/org/openbravo/erpCommon/security/Login.java	Tue Mar 02 18:47:40 2010 +0100
+++ b/src/org/openbravo/erpCommon/security/Login.java	Tue Mar 02 20:19:03 2010 +0100
@@ -27,7 +27,9 @@
 
 import org.openbravo.base.HttpBaseServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.utility.Utility;
+import org.openbravo.model.ad.system.Client;
 import org.openbravo.xmlEngine.XmlDocument;
 
 public class Login extends HttpBaseServlet {
@@ -43,13 +45,22 @@
       String strTheme = "ltr/Default";
       if (!vars.getTheme().equals(""))
         strTheme = vars.getTheme();
-      vars.clearSession(false);
-      printPageIdentificacion(response, strTheme);
+        vars.clearSession(false);
 
-      // } else if (vars.commandIn("OPTIONS")) {
-      // if (vars.getUser().equals("")) printPageIdentificacion(response);
-      // else printPageOptions(response, vars);
+      Client systemClient = OBDal.getInstance().get(Client.class, "0");
 
+      String cacheMsg = Utility.messageBD(this, "OUTDATED_FILES_CACHED", systemClient
+          .getLanguage().getLanguage());
+      String browserMsg = Utility.messageBD(this, "BROWSER_NOT_SUPPORTED", systemClient
+          .getLanguage().getLanguage());
+      String orHigherMsg = Utility.messageBD(this, "OR_HIGHER_TEXT", systemClient
+          .getLanguage().getLanguage());
+
+      printPageIdentificacion(response, strTheme, cacheMsg, browserMsg, orHigherMsg);
+
+ // } else if (vars.commandIn("OPTIONS")) {
+ //   if (vars.getUser().equals("")) printPageIdentificacion(response);
+ //   else printPageOptions(response, vars);
     } else if (vars.commandIn("BLANK")) {
       printPageBlank(response, vars);
     } else if (vars.commandIn("CHECK")) {
@@ -154,8 +165,8 @@
     out.close();
   }
 
-  private void printPageIdentificacion(HttpServletResponse response, String strTheme)
-      throws IOException, ServletException {
+  private void printPageIdentificacion(HttpServletResponse response, String strTheme, 
+      String cacheMsg, String browserMsg, String orHigherMsg) throws IOException, ServletException {
     XmlDocument xmlDocument = xmlEngine
         .readXmlTemplate("org/openbravo/erpCommon/security/Login_F1").createXmlDocument();
 
@@ -163,6 +174,23 @@
     xmlDocument.setParameter("theme", strTheme);
     xmlDocument.setParameter("itService", SessionLoginData.selectSupportContact(this));
 
+    String cacheMsgFinal = (cacheMsg != null && !cacheMsg.equals("")) ? cacheMsg
+        : "Your browser's cache has outdated files. Please clean it and reload the page.";
+    cacheMsgFinal = "var cacheMsg = \"" + cacheMsgFinal + "\"";
+    xmlDocument.setParameter("cacheMsg", cacheMsgFinal.replaceAll("\\n", "\n"));
+
+    String orHigherMsgFinal = (orHigherMsg != null && !orHigherMsg.equals("")) ? orHigherMsg
+        : "or higher";
+
+    String browserMsgFinal = (browserMsg != null && !browserMsg.equals("")) ? browserMsg
+        : "Your browser is not officially supported.\n\nYou can continue at your own risk or access the application with one of the supported browsers:";
+
+    browserMsgFinal = browserMsgFinal
+        + "\\n * Mozilla Firefox 3.0 " + orHigherMsgFinal
+        + "\\n * Microsoft Internet Explorer 7.0 " + orHigherMsgFinal;
+    browserMsgFinal = "var browserMsg = \"" + browserMsgFinal + "\"";
+    xmlDocument.setParameter("browserMsg", browserMsgFinal.replaceAll("\\n", "\n"));
+
     response.setContentType("text/html; charset=UTF-8");
     PrintWriter out = response.getWriter();
     out.println(xmlDocument.print());
--- a/src/org/openbravo/erpCommon/security/Login_F1.html	Tue Mar 02 18:47:40 2010 +0100
+++ b/src/org/openbravo/erpCommon/security/Login_F1.html	Tue Mar 02 20:19:03 2010 +0100
@@ -30,6 +30,8 @@
 <script language="JavaScript" type="text/javascript" id="paramLanguage">    defaultLang = "en_US";</script>
 <script language="JavaScript" src="../utility/CheckCleanCache.js?cache=true" type="text/javascript"></script>
 <script language="JavaScript" src="../utility/CheckCleanCache.js?cache=false" type="text/javascript"></script>
+<script language="JavaScript" type="text/javascript" id="cacheMsg">var cacheMsg = "xx";</script>
+<script language="JavaScript" type="text/javascript" id="browserMsg">var browserMsg = "xx";</script>
 <script language="JavaScript" type="text/javascript">
 
 function validate(action)
@@ -88,12 +90,12 @@
       clearForm();
     } catch (e) {}
     setWindowElementFocus('firstElement');
-    if ((!revisionControl('6543')) || (isOpsInstance() != isOpsInstanceCached())) {
-      alert("Your browser's cache has outdated files. Please clean it and reload the page.");
+    if ((!revisionControl('6553')) || (isOpsInstance() != isOpsInstanceCached())) {
+      alert(cacheMsg);
     }
 
     if (!checkBrowserCompatibility()) {
-      alert("Your browser is not officially supported.\n\nYou can continue at your own risk or access the application with one of the supported browsers:\n * Mozilla Firefox 3.0 or higher\n * Microsoft Internet Explorer 7.0 or higher");
+      alert(browserMsg);
     }
   }
 
--- a/src/org/openbravo/erpCommon/security/Login_F1.xml	Tue Mar 02 18:47:40 2010 +0100
+++ b/src/org/openbravo/erpCommon/security/Login_F1.xml	Tue Mar 02 20:19:03 2010 +0100
@@ -18,8 +18,10 @@
  ************************************************************************
 -->
 <REPORT>
-	<template file="Login_F1.html"/>
-	<PARAMETER id="paramDirectory" name="directory" default=""/>
-	<PARAMETER id="paramCSS" name="theme" attribute="href" replace="Default"/>	
-    <PARAMETER id="itService" name="itService" default=""/>    
+  <template file="Login_F1.html"/>
+  <PARAMETER id="paramDirectory" name="directory" default=""/>
+  <PARAMETER id="paramCSS" name="theme" attribute="href" replace="Default"/>
+  <PARAMETER id="itService" name="itService" default=""/>
+  <PARAMETER id="cacheMsg" name="cacheMsg" default=""/>
+  <PARAMETER id="browserMsg" name="browserMsg" default=""/>
 </REPORT>
--- a/web/js/utils.js	Tue Mar 02 18:47:40 2010 +0100
+++ b/web/js/utils.js	Tue Mar 02 20:19:03 2010 +0100
@@ -74,7 +74,7 @@
 * Return a number that would be checked at the Login screen to know if the file is cached with the correct version
 */
 function getCurrentRevision() {
-  var number = '6543';
+  var number = '6553';
   return number;
 }