diff --git a/migration/i1.0z/oracle/201309121045_IDEMPIERE-1362.sql b/migration/i1.0z/oracle/201309121045_IDEMPIERE-1362.sql new file mode 100644 index 0000000000..204d3361fe --- /dev/null +++ b/migration/i1.0z/oracle/201309121045_IDEMPIERE-1362.sql @@ -0,0 +1,81 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Jul 11, 2013 1:51:57 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType) VALUES ('IsShowinLogin',202569,'IsShowinLogin','Show Login','2ab0a775-6946-4c57-9d54-cdf2a570521a',TO_DATE('2013-07-11 13:51:56','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-07-11 13:51:56','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y',0,'D') +; + +-- Jul 11, 2013 1:51:58 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=202569 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Jul 11, 2013 1:53:24 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Table_ID,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,DefaultValue,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,AD_Element_ID) VALUES (0,'N',0,50010,210650,'N','N','N',0,'N',1,'N',20,'N','N','Y','070bb901-b89f-4336-bcb7-e824928d4af7','Y','IsShowinLogin','Y','IsShowinLogin','Y',TO_DATE('2013-07-11 13:53:23','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2013-07-11 13:53:23','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N',202569) +; + +-- Jul 11, 2013 1:53:24 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=210650 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jul 11, 2013 1:53:38 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +ALTER TABLE PA_DashboardContent ADD IsShowinLogin CHAR(1) DEFAULT 'Y' CHECK (IsShowinLogin IN ('Y','N')) +; + +-- Jul 11, 2013 1:55:06 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,XPosition,AD_Client_ID,ColumnSpan) VALUES ('N',50010,1,'N','N',210650,210,'Y',202286,'N','D','IsShowinLogin','627c465f-3add-4a1e-afb4-781306a787c6','Y','N',100,0,TO_DATE('2013-07-11 13:55:05','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2013-07-11 13:55:05','YYYY-MM-DD HH24:MI:SS'),'Y',2,0,2) +; + +-- Jul 11, 2013 1:55:06 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=202286 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Jul 19, 2013 12:50:35 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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','Manage Gadgets',200211,'D','662b6b4e-185e-473d-a965-25d189d273df','ManageGadgets','Y',TO_DATE('2013-07-19 12:50:33','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-07-19 12:50:33','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 19, 2013 12:50:35 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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=200211 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) +; + +-- Jul 19, 2013 12:51:03 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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','Dashboard Gadgets',200212,'D','9f80d414-3ab4-4227-90cc-bc2662c59907','DashboardGadgets','Y',TO_DATE('2013-07-19 12:51:03','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-07-19 12:51:03','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 19, 2013 12:51:03 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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=200212 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) +; + +-- Jul 19, 2013 12:52:03 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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','Available',200213,'D','9716bbe6-4a78-48b9-bde4-099a32f6ebff','Available','Y',TO_DATE('2013-07-19 12:52:02','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-07-19 12:52:02','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 19, 2013 12:52:07 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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','Available',200214,'D','60510910-6569-4817-b0e4-abe0647fa87f','Available','Y',TO_DATE('2013-07-19 12:52:07','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-07-19 12:52:07','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 19, 2013 12:52:45 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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','Show',200215,'D','869943ba-5623-4fc6-b43b-dfa73435aa9c','Show','Y',TO_DATE('2013-07-19 12:52:44','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-07-19 12:52:44','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 19, 2013 12:52:45 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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=200215 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('201309121045_IDEMPIERE-1362.sql') FROM dual +; + diff --git a/migration/i1.0z/postgresql/201309121045_IDEMPIERE-1362.sql b/migration/i1.0z/postgresql/201309121045_IDEMPIERE-1362.sql new file mode 100644 index 0000000000..43ab72e7be --- /dev/null +++ b/migration/i1.0z/postgresql/201309121045_IDEMPIERE-1362.sql @@ -0,0 +1,79 @@ +-- Jul 11, 2013 1:51:57 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType) VALUES ('IsShowinLogin',202569,'IsShowinLogin','Show Login','2ab0a775-6946-4c57-9d54-cdf2a570521a',TO_TIMESTAMP('2013-07-11 13:51:56','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-07-11 13:51:56','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y',0,'D') +; + +-- Jul 11, 2013 1:51:58 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=202569 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID) +; + +-- Jul 11, 2013 1:53:24 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Table_ID,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,DefaultValue,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,AD_Element_ID) VALUES (0,'N',0,50010,210650,'N','N','N',0,'N',1,'N',20,'N','N','Y','070bb901-b89f-4336-bcb7-e824928d4af7','Y','IsShowinLogin','Y','IsShowinLogin','Y',TO_TIMESTAMP('2013-07-11 13:53:23','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2013-07-11 13:53:23','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N',202569) +; + +-- Jul 11, 2013 1:53:24 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=210650 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID) +; + +-- Jul 11, 2013 1:53:38 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +ALTER TABLE PA_DashboardContent ADD COLUMN IsShowinLogin CHAR(1) DEFAULT 'Y' CHECK (IsShowinLogin IN ('Y','N')) +; + +-- Jul 11, 2013 1:55:06 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,CreatedBy,Updated,IsActive,XPosition,AD_Client_ID,ColumnSpan) VALUES ('N',50010,1,'N','N',210650,210,'Y',202286,'N','D','IsShowinLogin','627c465f-3add-4a1e-afb4-781306a787c6','Y','N',100,0,TO_TIMESTAMP('2013-07-11 13:55:05','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2013-07-11 13:55:05','YYYY-MM-DD HH24:MI:SS'),'Y',2,0,2) +; + +-- Jul 11, 2013 1:55:06 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=202286 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Jul 19, 2013 12:50:35 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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','Manage Gadgets',200211,'D','662b6b4e-185e-473d-a965-25d189d273df','Manage Gadgets','Y',TO_TIMESTAMP('2013-07-19 12:50:33','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-07-19 12:50:33','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 19, 2013 12:50:35 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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=200211 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) +; + +-- Jul 19, 2013 12:51:03 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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','Dashboard Gadgets',200212,'D','9f80d414-3ab4-4227-90cc-bc2662c59907','Dashboard Gadgets','Y',TO_TIMESTAMP('2013-07-19 12:51:03','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-07-19 12:51:03','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 19, 2013 12:51:03 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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=200212 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) +; + +-- Jul 19, 2013 12:52:03 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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','Available',200213,'D','9716bbe6-4a78-48b9-bde4-099a32f6ebff','Available','Y',TO_TIMESTAMP('2013-07-19 12:52:02','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-07-19 12:52:02','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 19, 2013 12:52:07 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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','Available',200214,'D','60510910-6569-4817-b0e4-abe0647fa87f','Available','Y',TO_TIMESTAMP('2013-07-19 12:52:07','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-07-19 12:52:07','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 19, 2013 12:52:45 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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','Show',200215,'D','869943ba-5623-4fc6-b43b-dfa73435aa9c','Show','Y',TO_TIMESTAMP('2013-07-19 12:52:44','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-07-19 12:52:44','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 19, 2013 12:52:45 PM COT +-- Ticket #1002633: Feature Request: Implement button to register/unregister available dashboard content +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=200215 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('201309121045_IDEMPIERE-1362.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/MDashboardPreference.java b/org.adempiere.base/src/org/compiere/model/MDashboardPreference.java index 48f3207b21..6ea903579e 100644 --- a/org.adempiere.base/src/org/compiere/model/MDashboardPreference.java +++ b/org.adempiere.base/src/org/compiere/model/MDashboardPreference.java @@ -85,7 +85,7 @@ public class MDashboardPreference extends X_PA_DashboardPreference return new Query(ctx, Table_Name, whereClause.toString(), null) .setParameters(parameters) - .setOnlyActiveRecords(true) + .setOnlyActiveRecords(false) .setApplyAccessFilter(true, false) .setOrderBy(COLUMNNAME_ColumnNo+","+COLUMNNAME_AD_Client_ID+","+COLUMNNAME_Line); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java index 8f967a6137..49b9e858a6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java @@ -23,8 +23,10 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.logging.Level; +import org.adempiere.exceptions.AdempiereException; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.graph.WGraph; import org.adempiere.webui.apps.graph.WPerformanceDetail; @@ -37,6 +39,7 @@ import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.window.ZkReportViewerProvider; import org.compiere.model.I_AD_Menu; import org.compiere.model.MDashboardContent; +import org.compiere.model.MDashboardContentAccess; import org.compiere.model.MDashboardPreference; import org.compiere.model.MGoal; import org.compiere.model.MMenu; @@ -104,7 +107,8 @@ public class DashboardController implements EventListener { } public void render(Component parent, IDesktop desktopImpl, boolean isShowInDashboard) { - parent.appendChild(dashboardLayout); + dashboardLayout = new Anchorlayout(); + parent.appendChild(dashboardLayout); dashboardLayout.setSclass("slimScroll"); @@ -125,18 +129,30 @@ public class DashboardController implements EventListener { int AD_User_ID = Env.getAD_User_ID(Env.getCtx()); int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx()); - MDashboardPreference[] dps = MDashboardPreference.getForSession(AD_User_ID, AD_Role_ID); - if (dps.length == 0) - createDashboardPreference(); + MDashboardPreference[] dps = MDashboardPreference.getForSession(isShowInDashboard,AD_User_ID, AD_Role_ID); + MDashboardContent [] dcs = MDashboardContentAccess.get(Env.getCtx(), AD_Role_ID, AD_User_ID, null,isShowInDashboard); - dps = MDashboardPreference.getForSession(isShowInDashboard, AD_User_ID, AD_Role_ID); // based on user and role + if(dps.length == 0){ + createDashboardPreference(AD_User_ID, AD_Role_ID,isShowInDashboard); + dps = MDashboardPreference.getForSession(isShowInDashboard,AD_User_ID, AD_Role_ID); + }else{ + if(dps.length < dcs.length){ + updatePreferences(dps, dcs,Env.getCtx()); + dps = MDashboardPreference.getForSession(isShowInDashboard,AD_User_ID, AD_Role_ID); + } + } + noOfCols = MDashboardPreference.getForSessionColumnCount(isShowInDashboard, AD_User_ID, AD_Role_ID); int dashboardWidth = isShowInDashboard ? DEFAULT_DASHBOARD_WIDTH : 100; width = noOfCols <= 0 ? dashboardWidth : dashboardWidth / noOfCols; int extraWidth = 100 - (noOfCols <= 0 ? dashboardWidth : width * noOfCols) - (100 - dashboardWidth - 1); - for (final MDashboardPreference dp : dps) + for (final MDashboardPreference dp : dps) { + + if(!dp.isActive()) + continue; + MDashboardContent dc = new MDashboardContent(dp.getCtx(), dp.getPA_DashboardContent_ID(), dp.get_TrxName()); int columnNo = dp.getColumnNo(); @@ -332,6 +348,7 @@ public class DashboardController implements EventListener { } } catch (Exception e) { logger.log(Level.WARNING, "Failed to create components. zul="+url, e); + throw new AdempiereException(e); } } @@ -501,15 +518,15 @@ public class DashboardController implements EventListener { } } - private void createDashboardPreference() + private void createDashboardPreference(int AD_User_ID, int AD_Role_ID,boolean isshow) { - MDashboardContent[] dcs = MDashboardContent.getForSession(0, 0); + MDashboardContent[] dcs = MDashboardContentAccess.get(Env.getCtx(),AD_Role_ID, AD_User_ID, null,isshow); for (MDashboardContent dc : dcs) { MDashboardPreference preference = new MDashboardPreference(Env.getCtx(), 0, null); preference.setAD_Org_ID(Env.getAD_Org_ID(Env.getCtx())); - preference.setAD_Role_ID(Env.getAD_Role_ID(Env.getCtx())); - preference.set_ValueNoCheck("AD_User_ID", Env.getAD_User_ID(Env.getCtx())); + preference.setAD_Role_ID(AD_Role_ID); + preference.set_ValueNoCheck("AD_User_ID", AD_User_ID); preference.setColumnNo(dc.getColumnNo()); preference.setIsCollapsedByDefault(dc.isCollapsedByDefault()); preference.setIsShowInDashboard(dc.isShowInDashboard()); @@ -521,6 +538,32 @@ public class DashboardController implements EventListener { } } + + public void updatePreferences(MDashboardPreference[] dps,MDashboardContent[] dcs, Properties ctx) { + for (int i = 0; i < dcs.length; i++) { + boolean isNew = true; + for (int j = 0; j < dps.length; j++) { + if (dps[j].getPA_DashboardContent_ID() == dcs[i].getPA_DashboardContent_ID()) { + isNew = false; + } + } + if (isNew) { + MDashboardPreference preference = new MDashboardPreference(ctx,0, null); + preference.setAD_Org_ID(Env.getAD_Org_ID(Env.getCtx())); + preference.setAD_Role_ID(Env.getAD_Role_ID(ctx)); + preference.set_ValueNoCheck("AD_User_ID",Env.getAD_User_ID(ctx)); + preference.setColumnNo(dcs[i].getColumnNo()); + preference.setIsCollapsedByDefault(dcs[i].isCollapsedByDefault()); + preference.setIsShowInDashboard(dcs[i].isShowInDashboard()); + preference.setLine(dcs[i].getLine()); + preference.setPA_DashboardContent_ID(dcs[i].getPA_DashboardContent_ID()); + + preference.saveEx(); + } + + } + } + private void saveDashboardPreference(Vlayout layout) { Object value = layout.getAttribute("ColumnNo"); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java index 02fac1451b..5920aa9b4e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java @@ -189,8 +189,6 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria boolean menuCollapsed= pref.isPropertyBool(UserPreference.P_MENU_COLLAPSED); w.setOpen(!menuCollapsed); - sideController.render(w, this, false); - East e = layout.getEast(); e.addEventListener(Events.ON_OPEN, new EventListener() { @Override @@ -302,14 +300,18 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria pref.savePreference(); } - private void renderHomeTab() - { + public void renderHomeTab() + { homeTab.getChildren().clear(); //register as 0 registerWindow(homeTab); dashboardController.render(homeTab, this, true); + + West w = layout.getWest(); + w.getChildren().clear(); + sideController.render(w, this, false); Clients.response(new AuScript("$('.slimScroll .z-anchorlayout-body').slimScroll({height: '100%',railVisible: true, alwaysVisible: false});")); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java index 4a8b670e75..7e46b55a56 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java @@ -206,4 +206,6 @@ public interface IDesktop extends UIPart { public void updateHelpTooltip(GridField gridField); public boolean isPendingWindow(); + + public void renderHomeTab(); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WGadgets.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WGadgets.java new file mode 100644 index 0000000000..de7b6dc651 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WGadgets.java @@ -0,0 +1,539 @@ +/****************************************************************************** + * Copyright (C) 2013 Juliana * + * Copyright (C) 2013 hengsin * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui.window; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.adempiere.exceptions.AdempiereException; +import org.adempiere.webui.component.Button; +import org.adempiere.webui.component.ConfirmPanel; +import org.adempiere.webui.component.Label; +import org.adempiere.webui.component.ListHead; +import org.adempiere.webui.component.ListHeader; +import org.adempiere.webui.component.ListItem; +import org.adempiere.webui.component.Listbox; +import org.adempiere.webui.component.SimpleListModel; +import org.adempiere.webui.component.Window; +import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.theme.ThemeManager; +import org.compiere.model.MDashboardContent; +import org.compiere.model.MDashboardPreference; +import org.compiere.model.Query; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.compiere.util.Msg; +import org.compiere.util.NamePair; +import org.compiere.util.Trx; +import org.zkoss.zk.au.out.AuFocus; +import org.zkoss.zk.ui.event.DropEvent; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zk.ui.util.Clients; +import org.zkoss.zul.Hlayout; +import org.zkoss.zul.Vbox; +import org.zkoss.zul.Vlayout; + +/** + * @author juliana + * @author hengsin + */ +public class WGadgets extends Window implements EventListener{ + + /** + * + */ + private static final long serialVersionUID = 3652943562286386813L; + + + // UI variables + protected Label noLabel = new Label(); + protected Label yesLabel = new Label(); + protected Button bAdd = new Button(); + protected Button bRemove = new Button(); + protected ConfirmPanel panel; + // + protected SimpleListModel noModel = new SimpleListModel(); + protected SimpleListModel yesModel = new SimpleListModel(); + protected Listbox noList = new Listbox(); + protected Listbox yesList = new Listbox(); + protected ArrayList yesItems =new ArrayList(); + protected ArrayList noItems =new ArrayList(); + + protected Map dirtyList = new LinkedHashMap(); + + /** + * + */ + public WGadgets() { + init(); + refresh(); + } + + @Override + public void onEvent(Event event) throws Exception + { + if (Events.ON_CLICK.equals(event.getName())) + { + if (panel.getButton("Ok").equals(event.getTarget())) + { + Trx trx = Trx.get(Trx.createTrxName("ManagedGadgets"), true); + try { + trx.start(); + for(MDashboardPreference pre : dirtyList.values()) { + pre.saveEx(trx.getTrxName()); + } + trx.commit(true); + } catch (RuntimeException e) { + trx.rollback(); + throw e; + } finally { + trx.close(); + } + SessionManager.getAppDesktop().renderHomeTab(); + this.detach(); + } + else if (panel.getButton("Cancel").equals(event.getTarget())) + { + this.detach(); + } + } + + } + + public void init() + { + setSclass("popup-dialog"); + // + noLabel.setValue( Msg.translate(Env.getCtx(), "Available")); + yesLabel.setValue( Msg.translate(Env.getCtx(), "Show")); + + EventListener mouseListener = new EventListener() + { + + public void onEvent(Event event) throws Exception + { + if (Events.ON_CLICK.equals(event.getName())) + { + migrateValueAcrossLists(event); + } + } + }; + yesList.addDoubleClickListener(mouseListener); + noList.addDoubleClickListener(mouseListener); + // + EventListener actionListener = new EventListener() + { + public void onEvent(Event event) throws Exception { + migrateValueAcrossLists(event); + } + }; + yesList.setSeltype("multiple"); + noList.setSeltype("multiple"); + + bAdd.setImage(ThemeManager.getThemeResource("images/Next24.png")); + bAdd.addEventListener(Events.ON_CLICK, actionListener); + + bRemove.setImage(ThemeManager.getThemeResource("images/Previous24.png")); + bRemove.addEventListener(Events.ON_CLICK, actionListener); + + final EventListener crossListMouseListener = new DragListener(); + yesList.addOnDropListener(crossListMouseListener); + noList.addOnDropListener(crossListMouseListener); + yesList.setItemDraggable(true); + yesList.setDroppable("true"); + yesList.addEventListener(Events.ON_DROP, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + crossListMouseListener.onEvent(event); + } + }); + noList.setItemDraggable(true); + noList.setDroppable("true"); + noList.addEventListener(Events.ON_DROP, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + crossListMouseListener.onEvent(event); + } + }); + + ListHead listHead = new ListHead(); + listHead.setParent(yesList); + ListHeader listHeader = new ListHeader(); + listHeader.appendChild(yesLabel); + listHeader.setParent(listHead); + + listHead = new ListHead(); + listHead.setParent(noList); + listHeader = new ListHeader(); + listHeader.appendChild(noLabel); + listHeader.setParent(listHead); + + Hlayout hlayout = new Hlayout(); + hlayout.setVflex("true"); + hlayout.setHflex("true"); + hlayout.setStyle("padding: 2px 3px;"); + noList.setHflex("1"); + noList.setVflex(true); + hlayout.appendChild(noList); + Vbox vbox = new Vbox(); + vbox.appendChild(bAdd); + vbox.appendChild(bRemove); + vbox.setWidth("50px"); + hlayout.appendChild(vbox); + + yesList.setVflex(true); + yesList.setHflex("1"); + hlayout.appendChild(yesList); + + panel = new ConfirmPanel(true); + panel.setSclass("dialog-footer"); + panel.addActionListener(Events.ON_CLICK, this); + panel.setVflex("min"); + + Vlayout vlayout = new Vlayout(); + vlayout.setHeight("100%"); + vlayout.setWidth("100%"); + vlayout.setStyle("margin: 0px; border: none; padding: 0px"); + vlayout.appendChild(hlayout); + vlayout.appendChild(panel); + this.appendChild(vlayout); + this.setBorder("normal"); + } + + + public void loadItems() + { + Properties ctx = Env.getCtx(); + + int AD_CLient_ID =Env.getAD_Client_ID(ctx); + int AD_Role_ID = Env.getAD_Role_ID(ctx); + int AD_User_ID = Env.getAD_User_ID(ctx); + + noItems.removeAll(noItems); + yesItems.removeAll(yesItems); + String query = " SELECT ct.PA_DashboardContent_ID, ct.Name " + +" FROM PA_DashboardContent ct" + +" WHERE ct.AD_Client_ID IN (0,?)" + +" AND ct.PA_DashboardContent_ID NOT IN (" + +" SELECT pre.PA_DashboardContent_ID" + +" FROM PA_DashboardPreference pre" + +" WHERE pre.AD_Client_ID IN (0,?)" + +" AND pre.AD_Role_ID = ?" + +" AND pre.AD_User_ID = ?" + +" AND pre.IsActive='Y') "; + + ResultSet rs = null; + PreparedStatement pstmt = null; + + try { + pstmt = DB.prepareStatement(query, null); + pstmt.setInt(1, AD_CLient_ID); + pstmt.setInt(2, AD_CLient_ID); + pstmt.setInt(3, AD_Role_ID); + pstmt.setInt(4, AD_User_ID); + rs = pstmt.executeQuery(); + + while (rs.next()) { + + MDashboardContent content= new MDashboardContent(ctx, rs.getInt(1),null); + if (!dirtyList.containsKey(content.getPA_DashboardContent_ID())) { + noItems.add(content); + } + } + } catch (Exception e) { + throw new AdempiereException( "Error while loading dashboard contents"+e.getMessage()); + + } finally { + DB.close(rs, pstmt); + } + + String where=" AD_User_ID=?" + +" AND AD_Role_ID=?" + +" AND AD_Client_ID=?" + +" AND IsActive='Y'"; + + Query query1 =new Query(ctx,MDashboardPreference.Table_Name, where, null); + query1.setParameters(new Object[]{AD_User_ID,AD_Role_ID ,AD_CLient_ID}); + List preference=query1.list(); + + if(preference.size() > 0){ + for(int i = 0; i < preference.size() ; i++){ + int ID = preference.get(i).getPA_DashboardContent_ID(); + MDashboardContent content = new MDashboardContent(ctx, ID, null); + if (!dirtyList.containsKey(content.getPA_DashboardContent_ID())) { + yesItems.add(content); + } + } + } + + for(MDashboardPreference pre : dirtyList.values()) { + MDashboardContent content = (MDashboardContent) pre.getPA_DashboardContent(); + if (pre.isActive()) + yesItems.add(content); + else + noItems.add(content); + } + } + + /** + * @param event + */ + protected void migrateValueAcrossLists (Event event) + { + Object source = event.getTarget(); + if (source instanceof ListItem) { + source = ((ListItem)source).getListbox(); + } + Listbox listFrom = (source == bAdd || source == noList) ? noList : yesList; + Listbox listTo = (source == bAdd || source == noList) ? yesList : noList; + + migrateLists (listFrom,listTo); //,endIndex); + } // migrateValueAcrossLists + + protected void migrateLists (Listbox listFrom , Listbox listTo) // , int endIndex) + { + int index = 0; + SimpleListModel lmFrom = (listFrom == yesList) ? yesModel:noModel; + Set selectedItems = listFrom.getSelectedItems(); + List selObjects = new ArrayList(); + for (Object obj : selectedItems) { + ListItem listItem = (ListItem) obj; + index = listFrom.getIndexOfItem(listItem); + ListElement selObject = (ListElement)lmFrom.getElementAt(index); + selObjects.add(selObject); + } + index = 0; + Arrays.sort(selObjects.toArray()); + for (ListElement selObject : selObjects) + { + if (selObject == null) + continue; + + Properties ctx =Env.getCtx(); + int AD_User_ID= Env.getAD_User_ID(ctx); + int AD_Role_ID=Env.getAD_Role_ID(ctx); + int AD_Client_ID= Env.getAD_Client_ID(ctx); + + MDashboardContent content = new MDashboardContent(Env.getCtx(),selObject.m_key, null); + String where=" AD_Client_ID=?" + +" AND PA_DashboardContent_ID=?"; + Query query = new Query(ctx, MDashboardPreference.Table_Name, where, null); + query.setParameters(new Object[]{AD_Client_ID, content.getPA_DashboardContent_ID()}); + + MDashboardPreference pre = query.setOnlyActiveRecords(false).first(); + + if(listFrom.equals(noList)) { + if (pre != null){ + pre.setIsActive(true); + pre.setIsShowInDashboard(content.isShowInDashboard()); + }else{ + pre = new MDashboardPreference(Env.getCtx(), 0, null); + pre.setAD_Org_ID(Env.getAD_Org_ID(Env.getCtx())); + pre.setAD_Role_ID(AD_Role_ID); + pre.set_ValueNoCheck("AD_User_ID",AD_User_ID); + pre.setColumnNo(content.getColumnNo()); + pre.setIsCollapsedByDefault(content.isCollapsedByDefault()); + pre.setIsShowInDashboard(content.isShowInDashboard()); + pre.setLine(content.getLine()); + pre.setPA_DashboardContent_ID(content.getPA_DashboardContent_ID()); + } + dirtyList.put(pre.getPA_DashboardContent_ID(), pre); + }else{ + if(pre != null){ + pre.setIsActive(false); + dirtyList.put(pre.getPA_DashboardContent_ID(), pre); + } + } + } + refresh(); + if ( listTo.getSelectedItem() != null) + { + AuFocus focus = new AuFocus(listTo.getSelectedItem()); + Clients.response(focus); + } + } + + public void refresh() { + + this.loadItems(); + yesList.removeAllItems(); + noList.removeAllItems(); + + if (yesItems.size() > 0 && yesItems != null) { + yesModel.removeAllElements(); + for (int i=0 ; i < yesItems.size() ; i++) { + int ID= yesItems.get(i).get_ID(); + String name = yesItems.get(i).getName(); + yesList.addItem(new KeyNamePair(ID, name)); + yesModel.addElement(new ListElement(ID, name, yesItems.get(i).getName(), true, yesItems.get(i).getAD_Client_ID(), yesItems.get(i).getAD_Org_ID())); + } + } + + if (noItems.size() > 0 && noItems != null) { + noModel.removeAllElements(); + for (int i=0 ; i < noItems.size() ; i++) { + int ID= noItems.get(i).get_ID(); + String name = noItems.get(i).getName(); + noList.addItem(new KeyNamePair(ID, name)); + noModel.add(i,new ListElement(ID, name, noItems.get(i).getName(), false, noItems.get(i).getAD_Client_ID(), noItems.get(i).getAD_Org_ID())); + } + } + } + + + /** + * List Item + */ + public static class ListElement extends NamePair { + /** + * + */ + private static final long serialVersionUID = -5645910649588308798L; + private int m_key; + private int m_AD_Client_ID; + private int m_AD_Org_ID; + /** Initial seq number */ + private String m_namecontent; + /** Initial selection flag */ + private boolean m_isYes; + + + public ListElement(int key, String name, String namecontent, boolean isYes, int AD_Client_ID, int AD_Org_ID) { + super(name); + this.m_key = key; + this.m_AD_Client_ID = AD_Client_ID; + this.m_AD_Org_ID = AD_Org_ID; + this.m_namecontent = namecontent; + this.m_isYes = isYes; + + } + + public int getKey() { + return m_key; + } + + public String getM_namecontent() { + return m_namecontent; + } + + public void setM_namecontent(String m_namecontent) { + this.m_namecontent = m_namecontent; + } + + public void setIsYes(boolean value) { + m_isYes = value; + } + public boolean isYes() { + return m_isYes; + } + public int getAD_Client_ID() { + return m_AD_Client_ID; + } + public int getAD_Org_ID() { + return m_AD_Org_ID; + } + + @Override + public String getID() { + return m_key != -1 ? String.valueOf(m_key) : null; + } + @Override + public int hashCode() { + return m_key; + } + @Override + public boolean equals(Object obj) + { + if (obj instanceof ListElement) + { + ListElement li = (ListElement)obj; + return + li.getKey() == m_key + && li.getName() != null + && li.getName().equals(getName()) + && li.getAD_Client_ID() == m_AD_Client_ID + && li.getAD_Org_ID() == m_AD_Org_ID; + } + return false; + } // equals + + public String toString() { + String s = super.toString(); + if (s == null || s.trim().length() == 0) + s = "<" + getKey() + ">"; + return s; + } + } + + /** + * @author eslatis + * + */ + private class DragListener implements EventListener + { + + /** + * Creates a ADSortTab.DragListener. + */ + public DragListener() + { + } + + public void onEvent(Event event) throws Exception { + if (event instanceof DropEvent) + { + Listbox listFrom = null; + Listbox listTo = null; + + ListItem fromItem = null; + ListItem toItem = null; + + DropEvent me = (DropEvent) event; + Object target = me.getTarget(); + if (target instanceof ListItem) { + toItem = (ListItem) target; + listTo = (Listbox) toItem.getListbox(); + } else { + listTo = (Listbox) target; + } + fromItem = (ListItem) me.getDragged(); + listFrom = (Listbox) fromItem.getListbox(); + + if (!fromItem.isSelected()) + fromItem.setSelected(true); + + if (listFrom != listTo) + { + migrateLists (listFrom,listTo); //,endIndex); + } + else + { + //reordering not implemented + ; + } + } + } + } +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPreference.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPreference.java index e5d3c5fd53..cf49745a7a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPreference.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPreference.java @@ -13,21 +13,25 @@ *****************************************************************************/ package org.adempiere.webui.window; +import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.component.ToolBar; import org.adempiere.webui.component.ToolBarButton; +import org.adempiere.webui.component.Window; import org.adempiere.webui.editor.WYesNoEditor; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.UserPreference; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.A; import org.zkoss.zul.Div; import org.zkoss.zul.Popup; import org.zkoss.zul.Separator; - +import org.zkoss.zul.Window.Mode; /** * * @author hengsin @@ -43,6 +47,9 @@ public class WPreference extends Popup implements EventListener { private WYesNoEditor autoNew; private WYesNoEditor adempiereSys; private WYesNoEditor logMigrationScript; + private WGadgets gadgets; + private A addgadgets; + public WPreference() { super(); @@ -87,6 +94,13 @@ public class WPreference extends Popup implements EventListener { logMigrationScript.setValue(Env.getCtx().getProperty("LogMigrationScript")); } + div = new Div(); + div.setStyle("background-color: transparent !important; border: none; margin: 5px;"); + addgadgets= new A(); + addgadgets.setLabel( Msg.translate(Env.getCtx(), "ManageGadgets")); + addgadgets.addEventListener(Events.ON_CLICK, this); + div.appendChild(addgadgets); + this.appendChild(div); Separator separator = new Separator(); separator.setSpacing("20px"); div = new Div(); @@ -111,8 +125,25 @@ public class WPreference extends Popup implements EventListener { } public void onEvent(Event event) throws Exception { - if (Events.ON_CLICK.equals(event.getName())) { - onSave(); + String nameEvent=event.getName(); + Component com =event.getTarget(); + + if (Events.ON_CLICK.equals(nameEvent)) { + if (com instanceof ToolBarButton) { + onSave(); + } + + if (com == addgadgets) { + gadgets = new WGadgets(); + gadgets.setClosable(true); + gadgets.setSizable(true); + gadgets.setWidth("40%"); + gadgets.setHeight("60%"); + gadgets.setTitle( Msg.translate(Env.getCtx(), "DashboardGadgets")); + gadgets.setAttribute(Window.MODE_KEY, Mode.HIGHLIGHTED); + AEnv.showWindow(gadgets); + gadgets.focus(); + } } }