IDEMPIERE-403 zk login can read messages from database instead of resource file

This commit is contained in:
David Peñuela 2012-09-11 17:40:53 -05:00
parent 42eb30488f
commit ca61e6d5ad
4 changed files with 51 additions and 23 deletions

View File

@ -0,0 +1,18 @@
-- Sep 10, 2012 6:08:27 PM COT
INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Language',null,200056,'D','5fd902a0-50b8-43f7-a611-b20f418bf0ae','Language','Y',TO_DATE('2012-09-10 18:08:26','YYYY-MM-DD HH24:MI:SS'),0,0,0,0,TO_DATE('2012-09-10 18:08:26','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 10, 2012 6:08:27 PM COT
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=200056 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)
;
-- Sep 10, 2012 6:11:10 PM COT
INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Role',null,200057,'D','b4f75e67-4543-4834-8a06-f8202384b3cf','Role','Y',TO_DATE('2012-09-10 18:11:09','YYYY-MM-DD HH24:MI:SS'),0,0,0,0,TO_DATE('2012-09-10 18:11:09','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 10, 2012 6:11:10 PM COT
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=200057 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('906_IDEMPIERE-403.sql') FROM dual
;

View File

@ -0,0 +1,18 @@
-- Sep 10, 2012 6:08:27 PM COT
INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Language',null,200056,'D','5fd902a0-50b8-43f7-a611-b20f418bf0ae','Language','Y',TO_TIMESTAMP('2012-09-10 18:08:26','YYYY-MM-DD HH24:MI:SS'),0,0,0,0,TO_TIMESTAMP('2012-09-10 18:08:26','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 10, 2012 6:08:27 PM COT
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=200056 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)
;
-- Sep 10, 2012 6:11:10 PM COT
INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Role',null,200057,'D','b4f75e67-4543-4834-8a06-f8202384b3cf','Role','Y',TO_TIMESTAMP('2012-09-10 18:11:09','YYYY-MM-DD HH24:MI:SS'),0,0,0,0,TO_TIMESTAMP('2012-09-10 18:11:09','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 10, 2012 6:11:10 PM COT
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=200057 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('906_IDEMPIERE-403.sql') FROM dual
;

View File

@ -29,7 +29,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Properties; import java.util.Properties;
import java.util.ResourceBundle;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.AdempiereIdGenerator; import org.adempiere.webui.AdempiereIdGenerator;
@ -98,10 +97,9 @@ public class LoginPanel extends Window implements EventListener<Event>
/** /**
* *
*/ */
private static final long serialVersionUID = -6308022048294680475L; private static final long serialVersionUID = -3181808670168474967L;
private static final String ON_LOAD_TOKEN = "onLoadToken"; private static final String ON_LOAD_TOKEN = "onLoadToken";
private static final String RESOURCE = "org.compiere.apps.ALoginRes";
private ResourceBundle res = ResourceBundle.getBundle(RESOURCE);
private static CLogger logger = CLogger.getCLogger(LoginPanel.class); private static CLogger logger = CLogger.getCLogger(LoginPanel.class);
private Properties ctx; private Properties ctx;
@ -448,14 +446,13 @@ public class LoginPanel extends Window implements EventListener<Event>
// Locales // Locales
Locale loc = language.getLocale(); Locale loc = language.getLocale();
Locale.setDefault(loc); Locale.setDefault(loc);
res = ResourceBundle.getBundle(RESOURCE, loc);
if (email_login) if (email_login)
lblUserId.setValue(res.getString("EMail")); lblUserId.setValue(Msg.getMsg(language, "EMail"));
else else
lblUserId.setValue(res.getString("User")); lblUserId.setValue(Msg.getMsg(language, "User"));
lblPassword.setValue(res.getString("Password")); lblPassword.setValue(Msg.getMsg(language, "Password"));
lblLanguage.setValue(res.getString("Language")); lblLanguage.setValue(Msg.getMsg(language, "Language"));
chkRememberMe.setLabel(Msg.getMsg(language, "RememberMe")); chkRememberMe.setLabel(Msg.getMsg(language, "RememberMe"));
chkSelectRole.setLabel(Msg.getMsg(language, "SelectRole")); chkSelectRole.setLabel(Msg.getMsg(language, "SelectRole"));
btnResetPassword.setLabel(Msg.getMsg(language, "ResetPassword")); btnResetPassword.setLabel(Msg.getMsg(language, "ResetPassword"));

View File

@ -25,7 +25,6 @@ package org.adempiere.webui.panel;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Properties; import java.util.Properties;
import java.util.ResourceBundle;
import org.adempiere.webui.AdempiereIdGenerator; import org.adempiere.webui.AdempiereIdGenerator;
import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.LayoutUtils;
@ -76,9 +75,7 @@ public class RolePanel extends Window implements EventListener, Deferrable
/** /**
* *
*/ */
private static final long serialVersionUID = 4403663665119775251L; private static final long serialVersionUID = 1071903027424763936L;
private static final String RESOURCE = "org.compiere.apps.ALoginRes";
private LoginWindow wndLogin; private LoginWindow wndLogin;
private Login login; private Login login;
@ -239,27 +236,25 @@ public class RolePanel extends Window implements EventListener, Deferrable
{ {
Language language = Env.getLanguage(m_ctx); Language language = Env.getLanguage(m_ctx);
ResourceBundle res = ResourceBundle.getBundle(RESOURCE, language.getLocale());
lblClient = new Label(); lblClient = new Label();
lblClient.setId("lblClient"); lblClient.setId("lblClient");
lblClient.setValue(res.getString("Client")); lblClient.setValue(Msg.getMsg(language,"Client"));
lblRole = new Label(); lblRole = new Label();
lblRole.setId("lblRole"); lblRole.setId("lblRole");
lblRole.setValue(res.getString("Role")); lblRole.setValue(Msg.getMsg(language,"Role"));
lblOrganisation = new Label(); lblOrganisation = new Label();
lblOrganisation.setId("lblOrganisation"); lblOrganisation.setId("lblOrganisation");
lblOrganisation.setValue(res.getString("Organization")); lblOrganisation.setValue(Msg.getMsg(language,"Organization"));
lblWarehouse = new Label(); lblWarehouse = new Label();
lblWarehouse.setId("lblWarehouse"); lblWarehouse.setId("lblWarehouse");
lblWarehouse.setValue(res.getString("Warehouse")); lblWarehouse.setValue(Msg.getMsg(language,"Warehouse"));
lblDate = new Label(); lblDate = new Label();
lblDate.setId("lblDate"); lblDate.setId("lblDate");
lblDate.setValue(res.getString("Date")); lblDate.setValue(Msg.getMsg(language,"Date"));
lstRole = new Combobox(); lstRole = new Combobox();
lstRole.setAutocomplete(true); lstRole.setAutocomplete(true);