details: /erp/devel/pi/rev/0a345984a59e
changeset: 6648:0a345984a59e
user: Asier Lostalé <asier.lostale <at> openbravo.com>
date: Mon Mar 08 17:41:42 2010 +0100
summary: Reformat Login.java
details: /erp/devel/pi/rev/08c31c4416ab
changeset: 6649:08c31c4416ab
user: Asier Lostalé <asier.lostale <at> openbravo.com>
date: Tue Mar 09 11:07:27 2010 +0100
summary: fixed bug 12451: Login window can not be included in a theme
diffstat:
src/org/openbravo/erpCommon/security/Login.java | 68 +++++++++++-------------
1 files changed, 30 insertions(+), 38 deletions(-)
diffs (124 lines):
diff -r ecfee246ed08 -r 08c31c4416ab
src/org/openbravo/erpCommon/security/Login.java
--- a/src/org/openbravo/erpCommon/security/Login.java Tue Mar 09 10:53:28
2010 +0100
+++ b/src/org/openbravo/erpCommon/security/Login.java Tue Mar 09 11:07:27
2010 +0100
@@ -11,7 +11,7 @@
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SL
- * All portions are Copyright (C) 2001-2009 Openbravo SL
+ * All portions are Copyright (C) 2001-2010 Openbravo SL
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
@@ -27,6 +27,7 @@
import org.openbravo.base.HttpBaseServlet;
import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.dal.core.OBContext;
import org.openbravo.dal.service.OBDal;
import org.openbravo.erpCommon.utility.Utility;
import org.openbravo.model.ad.system.Client;
@@ -39,28 +40,39 @@
ServletException {
VariablesSecureApp vars = new VariablesSecureApp(request);
+ Client systemClient = OBDal.getInstance().get(Client.class, "0");
+
+ // Get theme (skin)
+ OBContext.enableAsAdminContext();
+ String strTheme = "";
+ try {
+ org.openbravo.model.ad.system.System sys = OBDal.getInstance().get(
+ org.openbravo.model.ad.system.System.class, "0");
+ if (sys != null && !sys.getTADTheme().isEmpty()) {
+ strTheme = (systemClient.getLanguage().isRTLLanguage() ? "rtl/" :
"ltr/")
+ + sys.getTADTheme();
+ }
+ } finally {
+ OBContext.resetAsAdminContext();
+ }
+ if (strTheme.isEmpty()) {
+ strTheme = "ltr/Default";
+ }
+
if (vars.commandIn("LOGIN")) {
- if (log4j.isDebugEnabled())
- log4j.debug("Command: Login");
- String strTheme = "ltr/Default";
- if (!vars.getTheme().equals(""))
- strTheme = vars.getTheme();
- vars.clearSession(false);
+ log4j.debug("Command: Login");
- Client systemClient = OBDal.getInstance().get(Client.class, "0");
+ vars.clearSession(false);
- String cacheMsg = Utility.messageBD(this, "OUTDATED_FILES_CACHED",
systemClient
- .getLanguage().getLanguage());
+ 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());
+ 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")) {
@@ -71,29 +83,10 @@
out.print(checkString);
out.close();
} else if (vars.commandIn("WELCOME")) {
- String strTheme = "ltr/Default";
- if (!vars.getTheme().equals(""))
- strTheme = vars.getTheme();
- if (log4j.isDebugEnabled())
- log4j.debug("Command: Welcome");
+ log4j.debug("Command: Welcome");
printPageWelcome(response, strTheme);
} else if (vars.commandIn("LOGO")) {
printPageLogo(response, vars);
-
- // } else if (vars.commandIn("LOGED")) {
- // String target = vars.getSessionValue("target");
- // printPageFrameIdentificacion(response,
- // "../utility/VerticalMenu.html",
- // (target.equals("")?"../utility/Home.html":target));
- //
- // } else if (vars.commandIn("CLOSE_SESSION")) {
- // vars.clearSession(true);
- // if (log4j.isDebugEnabled()) log4j.debug("Cerrando session");
- // if (!vars.getDBSession().equals(""))
- // SessionLoginData.saveProcessed(this, vars.getUser(),
- // vars.getDBSession());
- // response.sendRedirect(strDireccion + request.getServletPath());
-
} else {
String textDirection = vars.getSessionValue("#TextDirection", "LTR");
printPageFrameIdentificacion(response,
"Login_Welcome.html?Command=WELCOME",
@@ -165,7 +158,7 @@
out.close();
}
- private void printPageIdentificacion(HttpServletResponse response, String
strTheme,
+ 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();
@@ -185,8 +178,7 @@
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
+ 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"));
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits