diff --git a/src/classes/GW_CTRL_SettingsTabCampMbr.cls b/src/classes/GW_CTRL_SettingsTabCampMbr.cls new file mode 100644 index 0000000..7365f56 --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabCampMbr.cls @@ -0,0 +1,105 @@ +public with sharing class GW_CTRL_SettingsTabCampMbr { + + // constructor + public GW_CTRL_SettingsTabCampMbr(GW_CTRL_SettingsWizard cWiz) { + ctrlWizard = cWiz; + isEditingTab = false; + } + + public List listCampMbrSettings { + get { + if (listCampMbrSettings == null) { + listCampMbrSettings = Campaign_Mbr_Status_Settings__c.getall().values(); + AddEmptyRows(); + } + return listCampMbrSettings; + } + set; + } + + + public PageReference AddEmptyRows() { + for (integer i = 0; i < GW_CTRL_SettingsWizard.cEmptyRows; i++) { + listCampMbrSettings.add(new Campaign_Mbr_Status_Settings__c()); + } + return null; + } + + private GW_CTRL_SettingsWizard ctrlWizard { get; set; } + + public boolean isEditingTab { get; set; } + + public PageReference editTab() { + isEditingTab = true; + ctrlWizard.strCurrentTab = 'tabCampMbr'; + return null; + } + + public PageReference saveTab() { + list listCStoDel = new list(); + + // go thru the campaign member settings, and delete empty ones + for (integer i = listCampMbrSettings.size()-1; i >= 0; i--) { + Campaign_Mbr_Status_Settings__c cs = listCampMbrSettings[i]; + if (isnullStr(cs.Campaign_Subtype__c) && + isnullStr(cs.Campaign_Type__c) && + isnullStr(cs.Status_Label__c)) { + if (cs.Id == null) { + // it's a new empty dls; just remove it + listCampMbrSettings.remove(i); + } else { + // it's an existing, but cleared entry; delete it. + listCampMbrSettings.remove(i); + listCStoDel.add(cs); + } + } + } + + // name new settings + ctrlWizard.nameNewSettings(listCampMbrSettings, 'CampaignMemberSetting'); + + if (listCStoDel.size() > 0) delete listCStoDel; + try { + system.debug(listCampMbrSettings); + upsert listCampMbrSettings; + } catch (exception ex) { + ApexPages.addMessages(ex); + return null; + } + AddEmptyRows(); + isEditingTab = false; + ctrlWizard.strCurrentTab = 'tabCampMbr'; + return null; + } + + public PageReference cancelTab() { + isEditingTab = false; + listCampMbrSettings = null; + PageReference p = new PageReference('/apex/Settings_Page?currentTab=tabCampMbr' + ctrlWizard.strSalesforceTabNameParam); + p.setRedirect(true); + return p; + } + + private boolean isnullStr(string str) { + return (str == null || str == ''); + } + + private boolean isnullNum(decimal num) { + return (num == null || num == 0); + } + + //---------------------------------------- TEST CODE ------------------------------------------------- + static testmethod void TestTabCampMbr() { + GW_CTRL_SettingsWizard ctrl = new GW_CTRL_SettingsWizard(); + system.assert(ctrl.ctabCampMbr != null); + system.assertEquals(ctrl.ctabCampMbr.ctrlWizard, ctrl); + system.assertEquals(ctrl.ctabCampMbr.isEditingTab, false); + ctrl.ctabCampMbr.editTab(); + system.assertEquals(ctrl.strCurrentEditTab, 'tabCampMbr'); + ctrl.ctabCampMbr.saveTab(); + system.assertEquals(ctrl.strCurrentEditTab, null); + system.assert(ctrl.ctabCampMbr.cancelTab() != null); + } + + +} \ No newline at end of file diff --git a/src/classes/GW_CTRL_SettingsTabCampMbr.cls-meta.xml b/src/classes/GW_CTRL_SettingsTabCampMbr.cls-meta.xml new file mode 100644 index 0000000..307ce73 --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabCampMbr.cls-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + Active + diff --git a/src/classes/GW_CTRL_SettingsTabLead.cls b/src/classes/GW_CTRL_SettingsTabLead.cls new file mode 100644 index 0000000..626a284 --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabLead.cls @@ -0,0 +1,103 @@ +public with sharing class GW_CTRL_SettingsTabLead { + + // constructor + public GW_CTRL_SettingsTabLead(GW_CTRL_SettingsWizard cWiz) { + ctrlWizard = cWiz; + isEditingTab = false; + } + + private GW_CTRL_SettingsWizard ctrlWizard { get; set; } + + public List listLeadSettings { + get { + if (listLeadSettings == null) { + listLeadSettings = Lead_Converter_Field_Map__c.getall().values(); + AddEmptyRows(); + } + return listLeadSettings; + } + set; + } + + public PageReference AddEmptyRows() { + for (integer i = 0; i < GW_CTRL_SettingsWizard.cEmptyRows; i++) { + listLeadSettings.add(new Lead_Converter_Field_Map__c()); + } + return null; + } + + public boolean isEditingTab { get; set; } + + public PageReference editTab() { + isEditingTab = true; + ctrlWizard.strCurrentTab = 'tabLead'; + return null; + } + + public PageReference saveTab() { + list listLStoDel = new list(); + + // go thru the frequency settings, and delete empty ones + for (integer i = listLeadSettings.size()-1; i >= 0; i--) { + Lead_Converter_Field_Map__c ls = listLeadSettings[i]; + if (isnullStr(ls.Contact_Field__c) && + isnullStr(ls.Field_Type__c)) { + if (ls.Id == null) { + // it's a new empty dls; just remove it + listLeadSettings.remove(i); + } else { + // it's an existing, but cleared entry; delete it. + listLeadSettings.remove(i); + listLStoDel.add(ls); + } + } + } + + // name new settings + ctrlWizard.nameNewSettings(listLeadSettings, 'LeadConversionSetting'); + + if (listLStoDel.size() > 0) delete listLStoDel; + try { + system.debug(listLeadSettings); + upsert listLeadSettings; + } catch (exception ex) { + ApexPages.addMessages(ex); + return null; + } + AddEmptyRows(); + isEditingTab = false; + ctrlWizard.strCurrentTab = 'tabLead'; + return null; + } + + public PageReference cancelTab() { + isEditingTab = false; + listLeadSettings = null; + PageReference p = new PageReference('/apex/Settings_Page?currentTab=tabLead' + ctrlWizard.strSalesforceTabNameParam); + p.setRedirect(true); + return p; + } + + private boolean isnullStr(string str) { + return (str == null || str == ''); + } + + private boolean isnullNum(decimal num) { + return (num == null || num == 0); + } + + //---------------------------------------- TEST CODE ------------------------------------------------- + static testmethod void TestTabLead() { + GW_CTRL_SettingsWizard ctrl = new GW_CTRL_SettingsWizard(); + system.assert(ctrl.ctabLead != null); + system.assertEquals(ctrl.ctabLead.ctrlWizard, ctrl); + system.assertEquals(ctrl.ctabLead.isEditingTab, false); + system.assert(ctrl.ctabLead.listLeadSettings != null); + ctrl.ctabLead.editTab(); + system.assertEquals(ctrl.strCurrentEditTab, 'tabLead'); + ctrl.ctabLead.saveTab(); + system.assertEquals(ctrl.strCurrentEditTab, null); + system.assert(ctrl.ctabLead.cancelTab() != null); + } + +} \ No newline at end of file diff --git a/src/classes/GW_CTRL_SettingsTabLead.cls-meta.xml b/src/classes/GW_CTRL_SettingsTabLead.cls-meta.xml new file mode 100644 index 0000000..307ce73 --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabLead.cls-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + Active + diff --git a/src/classes/GW_CTRL_SettingsTabMisc.cls b/src/classes/GW_CTRL_SettingsTabMisc.cls new file mode 100644 index 0000000..7fccb5b --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabMisc.cls @@ -0,0 +1,49 @@ +public with sharing class GW_CTRL_SettingsTabMisc { + + // constructor + public GW_CTRL_SettingsTabMisc(GW_CTRL_SettingsWizard cWiz) { + ctrlWizard = cWiz; + isEditingTab = false; + } + + private GW_CTRL_SettingsWizard ctrlWizard { get; set; } + + public boolean isEditingTab { get; set; } + + public PageReference editTab() { + isEditingTab = true; + ctrlWizard.strCurrentTab = 'tabMisc'; + return null; + } + + public PageReference saveTab() { + upsert ctrlWizard.mSettings; + isEditingTab = false; + ctrlWizard.strCurrentTab = 'tabMisc'; + return null; + } + + public PageReference cancelTab() { + isEditingTab = false; + ctrlWizard.mSettings = null; + PageReference p = new PageReference('/apex/Settings_Page?currentTab=tabMisc' + ctrlWizard.strSalesforceTabNameParam); + p.setRedirect(true); + return p; + } + + //---------------------------------------- TEST CODE ------------------------------------------------- + static testmethod void TestTabMisc() { + GW_CTRL_SettingsWizard ctrl = new GW_CTRL_SettingsWizard(); + system.assert(ctrl.ctabMisc != null); + system.assertEquals(ctrl.ctabMisc.ctrlWizard, ctrl); + system.assertEquals(ctrl.ctabMisc.isEditingTab, false); + system.assert(ctrl.ctabMisc.ctrlWizard.mSettings != null); + ctrl.ctabMisc.editTab(); + system.assertEquals(ctrl.strCurrentEditTab, 'tabGeneral'); + ctrl.ctabMisc.saveTab(); + system.assertEquals(ctrl.strCurrentEditTab, null); + system.assert(ctrl.ctabMisc.cancelTab() != null); + } + + +} \ No newline at end of file diff --git a/src/classes/GW_CTRL_SettingsTabMisc.cls-meta.xml b/src/classes/GW_CTRL_SettingsTabMisc.cls-meta.xml new file mode 100644 index 0000000..307ce73 --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabMisc.cls-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + Active + diff --git a/src/classes/GW_CTRL_SettingsTabOpp.cls b/src/classes/GW_CTRL_SettingsTabOpp.cls new file mode 100644 index 0000000..5f2180a --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabOpp.cls @@ -0,0 +1,49 @@ +public with sharing class GW_CTRL_SettingsTabOpp { + + // constructor + public GW_CTRL_SettingsTabOpp(GW_CTRL_SettingsWizard cWiz) { + ctrlWizard = cWiz; + isEditingTab = false; + } + + private GW_CTRL_SettingsWizard ctrlWizard { get; set; } + + public boolean isEditingTab { get; set; } + + public PageReference editTab() { + isEditingTab = true; + ctrlWizard.strCurrentTab = 'tabOpp'; + return null; + } + + public PageReference saveTab() { + upsert ctrlWizard.oSettings; + isEditingTab = false; + ctrlWizard.strCurrentTab = 'tabOpp'; + return null; + } + + public PageReference cancelTab() { + isEditingTab = false; + ctrlWizard.oSettings = null; + PageReference p = new PageReference('/apex/Settings_Page?currentTab=tabOpp' + ctrlWizard.strSalesforceTabNameParam); + p.setRedirect(true); + return p; + } + + //---------------------------------------- TEST CODE ------------------------------------------------- + static testmethod void TestTabOpp() { + GW_CTRL_SettingsWizard ctrl = new GW_CTRL_SettingsWizard(); + system.assert(ctrl.ctabOpp != null); + system.assertEquals(ctrl.ctabOpp.ctrlWizard, ctrl); + system.assertEquals(ctrl.ctabOpp.isEditingTab, false); + system.assert(ctrl.ctabOpp.ctrlWizard.oSettings != null); + ctrl.ctabOpp.editTab(); + system.assertEquals(ctrl.strCurrentEditTab, 'tabOpp'); + ctrl.ctabOpp.saveTab(); + system.assertEquals(ctrl.strCurrentEditTab, null); + system.assert(ctrl.ctabOpp.cancelTab() != null); + } + + +} \ No newline at end of file diff --git a/src/classes/GW_CTRL_SettingsTabOpp.cls-meta.xml b/src/classes/GW_CTRL_SettingsTabOpp.cls-meta.xml new file mode 100644 index 0000000..307ce73 --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabOpp.cls-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + Active + diff --git a/src/classes/GW_CTRL_SettingsTabOrg.cls b/src/classes/GW_CTRL_SettingsTabOrg.cls new file mode 100644 index 0000000..515acf0 --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabOrg.cls @@ -0,0 +1,100 @@ +public with sharing class GW_CTRL_SettingsTabOrg { + + // constructor + public GW_CTRL_SettingsTabOrg(GW_CTRL_SettingsWizard cWiz) { + ctrlWizard = cWiz; + isEditingTab = false; + } + + private GW_CTRL_SettingsWizard ctrlWizard { get; set; } + + public List listOrgSettings { + get { + if (listOrgSettings == null) { + listOrgSettings = OrgConRole_Settings__c.getall().values(); + AddEmptyRows(); + } + return listOrgSettings; + } + set; + } + + public PageReference AddEmptyRows() { + for (integer i = 0; i < GW_CTRL_SettingsWizard.cEmptyRows; i++) { + listOrgSettings.add(new OrgConRole_Settings__c()); + } + return null; + } + + public boolean isEditingTab { get; set; } + + public PageReference editTab() { + isEditingTab = true; + ctrlWizard.strCurrentTab = 'tabOrg'; + return null; + } + + public PageReference saveTab() { + list listOStoDel = new list(); + + // go thru the frequency settings, and delete empty ones + for (integer i = listOrgSettings.size()-1; i >= 0; i--) { + OrgConRole_Settings__c os = listOrgSettings[i]; + if (isnullStr(os.Primary_Contact_Role__c) && + isnullStr(os.Name)) { + if (os.Id == null) { + // it's a new empty dls; just remove it + listOrgSettings.remove(i); + } else { + // it's an existing, but cleared entry; delete it. + listOrgSettings.remove(i); + listOStoDel.add(os); + } + } + } + + if (listOStoDel.size() > 0) delete listOStoDel; + try { + system.debug(listOrgSettings); + upsert listOrgSettings; + } catch (exception ex) { + ApexPages.addMessages(ex); + return null; + } + AddEmptyRows(); + isEditingTab = false; + ctrlWizard.strCurrentTab = 'tabOrg'; + return null; + } + + public PageReference cancelTab() { + isEditingTab = false; + listOrgSettings = null; + PageReference p = new PageReference('/apex/Settings_Page?currentTab=tabOrg' + ctrlWizard.strSalesforceTabNameParam); + p.setRedirect(true); + return p; + } + + private boolean isnullStr(string str) { + return (str == null || str == ''); + } + + private boolean isnullNum(decimal num) { + return (num == null || num == 0); + } + + //---------------------------------------- TEST CODE ------------------------------------------------- + static testmethod void TestTabOrg() { + GW_CTRL_SettingsWizard ctrl = new GW_CTRL_SettingsWizard(); + system.assert(ctrl.ctabOrg != null); + system.assertEquals(ctrl.ctabOrg.ctrlWizard, ctrl); + system.assertEquals(ctrl.ctabOrg.isEditingTab, false); + system.assert(ctrl.ctabOrg.listOrgSettings != null); + ctrl.ctabOrg.editTab(); + system.assertEquals(ctrl.strCurrentEditTab, 'tabOrg'); + ctrl.ctabOrg.saveTab(); + system.assertEquals(ctrl.strCurrentEditTab, null); + system.assert(ctrl.ctabOrg.cancelTab() != null); + } + +} \ No newline at end of file diff --git a/src/classes/GW_CTRL_SettingsTabOrg.cls-meta.xml b/src/classes/GW_CTRL_SettingsTabOrg.cls-meta.xml new file mode 100644 index 0000000..307ce73 --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabOrg.cls-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + Active + diff --git a/src/classes/GW_CTRL_SettingsTabRoles.cls b/src/classes/GW_CTRL_SettingsTabRoles.cls new file mode 100644 index 0000000..1a9396d --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabRoles.cls @@ -0,0 +1,99 @@ +public with sharing class GW_CTRL_SettingsTabRoles { + + // constructor + public GW_CTRL_SettingsTabRoles(GW_CTRL_SettingsWizard cWiz) { + ctrlWizard = cWiz; + isEditingTab = false; + } + + private GW_CTRL_SettingsWizard ctrlWizard { get; set; } + + public List listRoleSettings { + get { + if (listRoleSettings == null) { + listRoleSettings = ConRole_Settings__c.getall().values(); + AddEmptyRows(); + } + return listRoleSettings; + } + set; + } + + public PageReference AddEmptyRows() { + for (integer i = 0; i < GW_CTRL_SettingsWizard.cEmptyRows; i++) { + listRoleSettings.add(new ConRole_Settings__c()); + } + return null; + } + + public boolean isEditingTab { get; set; } + + public PageReference editTab() { + isEditingTab = true; + ctrlWizard.strCurrentTab = 'tabRoles'; + return null; + } + + public PageReference saveTab() { + list listRStoDel = new list(); + + // go thru the frequency settings, and delete empty ones + for (integer i = listRoleSettings.size()-1; i >= 0; i--) { + ConRole_Settings__c rs = listRoleSettings[i]; + if (isnullStr(rs.Primary__c)) { + if (rs.Id == null) { + // it's a new empty dls; just remove it + listRoleSettings.remove(i); + } else { + // it's an existing, but cleared entry; delete it. + listRoleSettings.remove(i); + listRStoDel.add(rs); + } + } + } + + if (listRStoDel.size() > 0) delete listRStoDel; + try { + system.debug(listRoleSettings); + upsert listRoleSettings; + } catch (exception ex) { + ApexPages.addMessages(ex); + return null; + } + AddEmptyRows(); + isEditingTab = false; + ctrlWizard.strCurrentTab = 'tabRoles'; + return null; + } + + public PageReference cancelTab() { + isEditingTab = false; + listRoleSettings = null; + PageReference p = new PageReference('/apex/Settings_Page?currentTab=tabRoles' + ctrlWizard.strSalesforceTabNameParam); + p.setRedirect(true); + return p; + } + + private boolean isnullStr(string str) { + return (str == null || str == ''); + } + + private boolean isnullNum(decimal num) { + return (num == null || num == 0); + } + + //---------------------------------------- TEST CODE ------------------------------------------------- + static testmethod void TestTabRoles() { + GW_CTRL_SettingsWizard ctrl = new GW_CTRL_SettingsWizard(); + system.assert(ctrl.ctabRoles != null); + system.assertEquals(ctrl.ctabRoles.ctrlWizard, ctrl); + system.assertEquals(ctrl.ctabRoles.isEditingTab, false); + system.assert(ctrl.ctabRoles.listRoleSettings != null); + ctrl.ctabRoles.editTab(); + system.assertEquals(ctrl.strCurrentEditTab, 'tabRoles'); + ctrl.ctabRoles.saveTab(); + system.assertEquals(ctrl.strCurrentEditTab, null); + system.assert(ctrl.ctabRoles.cancelTab() != null); + } + +} \ No newline at end of file diff --git a/src/classes/GW_CTRL_SettingsTabRoles.cls-meta.xml b/src/classes/GW_CTRL_SettingsTabRoles.cls-meta.xml new file mode 100644 index 0000000..307ce73 --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabRoles.cls-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + Active + diff --git a/src/classes/GW_CTRL_SettingsTabTrigger.cls b/src/classes/GW_CTRL_SettingsTabTrigger.cls new file mode 100644 index 0000000..c97179f --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabTrigger.cls @@ -0,0 +1,49 @@ +public with sharing class GW_CTRL_SettingsTabTrigger { + + // constructor + public GW_CTRL_SettingsTabTrigger(GW_CTRL_SettingsWizard cWiz) { + ctrlWizard = cWiz; + isEditingTab = false; + } + + private GW_CTRL_SettingsWizard ctrlWizard { get; set; } + + public boolean isEditingTab { get; set; } + + public PageReference editTab() { + isEditingTab = true; + ctrlWizard.strCurrentTab = 'tabTrigger'; + return null; + } + + public PageReference saveTab() { + upsert ctrlWizard.tSettings; + isEditingTab = false; + ctrlWizard.strCurrentTab = 'tabTrigger'; + return null; + } + + public PageReference cancelTab() { + isEditingTab = false; + ctrlWizard.tSettings = null; + PageReference p = new PageReference('/apex/Settings_Page?currentTab=tabTrigger' + ctrlWizard.strSalesforceTabNameParam); + p.setRedirect(true); + return p; + } + + //---------------------------------------- TEST CODE ------------------------------------------------- + static testmethod void TestTabTrigger() { + GW_CTRL_SettingsWizard ctrl = new GW_CTRL_SettingsWizard(); + system.assert(ctrl.ctabTrigger != null); + system.assertEquals(ctrl.ctabTrigger.ctrlWizard, ctrl); + system.assertEquals(ctrl.ctabTrigger.isEditingTab, false); + system.assert(ctrl.ctabTrigger.ctrlWizard.tSettings != null); + ctrl.ctabTrigger.editTab(); + system.assertEquals(ctrl.strCurrentEditTab, 'tabTrigger'); + ctrl.ctabTrigger.saveTab(); + system.assertEquals(ctrl.strCurrentEditTab, null); + system.assert(ctrl.ctabTrigger.cancelTab() != null); + } + + +} \ No newline at end of file diff --git a/src/classes/GW_CTRL_SettingsTabTrigger.cls-meta.xml b/src/classes/GW_CTRL_SettingsTabTrigger.cls-meta.xml new file mode 100644 index 0000000..307ce73 --- /dev/null +++ b/src/classes/GW_CTRL_SettingsTabTrigger.cls-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + Active + diff --git a/src/classes/GW_CTRL_SettingsWizard.cls b/src/classes/GW_CTRL_SettingsWizard.cls new file mode 100644 index 0000000..d562875 --- /dev/null +++ b/src/classes/GW_CTRL_SettingsWizard.cls @@ -0,0 +1,423 @@ +public with sharing class GW_CTRL_SettingsWizard { + + // constructor + public GW_CTRL_SettingsWizard() { + + map params = ApexPages.currentPage().getParameters(); + string str = params.get('currentTab'); + if (str != null && str != '') { + strCurrentTab = str; + } else { + strCurrentTab = 'tabOpp'; + } + str = params.get('sfdc.tabName'); + if (str != null && str != '') { + strSalesforceTabNameParam = '&sfdc.tabName=' + str; + } else { + strSalesforceTabNameParam = ''; + } + } + + public boolean inEditMode { + get { + return + ctabLead.isEditingTab || + ctabOrg.isEditingTab || + ctabRoles.isEditingTab || + ctabTrigger.isEditingTab || + ctabMisc.isEditingTab || + ctabOpp.isEditingTab || + ctabCampMbr.isEditingTab; + + } + set; + } + + public string strSalesforceTabNameParam { get; set; } + + public string strCurrentEditTab { + get { + if (ctabCampMbr.isEditingTab) return 'tabCampMbr'; + if (ctabLead.isEditingTab) return 'tabLead'; + if (ctabOrg.isEditingTab) return 'tabOrg'; + if (ctabRoles.isEditingTab) return 'tabRoles'; + if (ctabMisc.isEditingTab) return 'tabMisc'; + if (ctabTrigger.isEditingTab) return 'tabTrigger'; + if (ctabOpp.isEditingTab) return 'tabOpp'; + + return null; + } + set; + } + + // tabPanel sets this thru an ajax call. + public string strCurrentTab { get; set; } + + + public GW_CTRL_SettingsTabCampMbr ctabCampMbr { + get { + if (ctabCampMbr == null) ctabCampMbr = new GW_CTRL_SettingsTabCampMbr(this); + return ctabCampMbr; + } + set; + } + + public GW_CTRL_SettingsTabLead ctabLead { + get { + if (ctabLead == null) ctabLead = new GW_CTRL_SettingsTabLead(this); + return ctabLead; + } + set; + } + + public GW_CTRL_SettingsTabMisc ctabMisc { + get { + if (ctabMisc == null) ctabMisc = new GW_CTRL_SettingsTabMisc(this); + return ctabMisc; + } + set; + } + + public GW_CTRL_SettingsTabRoles ctabRoles { + get { + if (ctabRoles == null) ctabRoles = new GW_CTRL_SettingsTabRoles(this); + return ctabRoles; + } + set; + } + + public GW_CTRL_SettingsTabTrigger ctabTrigger { + get { + if (ctabTrigger == null) ctabTrigger = new GW_CTRL_SettingsTabTrigger(this); + return ctabTrigger; + } + set; + } + + public GW_CTRL_SettingsTabOrg ctabOrg { + get { + if (ctabOrg == null) ctabOrg = new GW_CTRL_SettingsTabOrg(this); + return ctabOrg; + } + set; + } + + public GW_CTRL_SettingsTabOpp ctabOpp { + get { + if (ctabOpp == null) ctabOpp = new GW_CTRL_SettingsTabOpp(this); + return ctabOpp; + } + set; + } + + public OppRollupSettings__c oSettings { + get { + if (oSettings == null) oSettings = OppRollupSettings__c.getOrgDefaults(); + return oSettings; + } + set; + } + + public TriggerSettings__c tSettings { + get { + if (tSettings == null) tSettings = TriggerSettings__c.getOrgDefaults(); + return tSettings; + } + set; + } + + public MiscellaneousBaseSettings__c mSettings { + get { + if (mSettings == null) mSettings = MiscellaneousBaseSettings__c.getOrgDefaults(); + return mSettings; + } + set; + } + + + + + + // utility to create unique new names for the list of objects that don't have names. + public void nameNewSettings(list listSobj, string strPrefix) { + if (listSobj == null || strPrefix == null) return; + + // name new settings, by first finding the last name used. + integer iUsedMax = 0; + for (integer i = 0; i < listSobj.size(); i++ ) { + string strName = string.valueOf(listSobj[i].get('name')); + if (strName != null && strName.startsWith(strPrefix)) { + integer iNum = integer.valueOf(strName.subString(strPrefix.length())); + if (iNum > iUsedMax) { + iUsedMax = iNum; + } + } + } + for (integer i = 0; i < listSobj.size(); i++ ) { + if (listSobj[i].get('id') == null) { + listSobj[i].put('name', strPrefix + string.valueOf(++iUsedMax)); + } + } + } + + + + + // the list of Engagement Levels to put in the dropdowns (not in use for GWBASE) + /* + public list listSOLevels { + get { + if (listSOLevels == null) { + list listSO = new list(); + listSO.add(new SelectOption('', '')); + for (integer i = 1; i <= 8; i++) { + string strLevel = 'Level_' + string.valueOf(i) + '_Name__c'; + string strLevelName = string.valueOf(etSettings.get(strLevel)); + if (strLevelName != null && strLevelName != '') { + listSO.add(new SelectOption(string.valueOf(i) + '.0', strLevelName)); + } + } + listSOLevels = listSO; + } + return listSOLevels; + } + set; + } + */ + // set used to keep track of which contact fields are boolean, + // so we can automaticaly mark them as checkbox when saving Contact Field Settings. + public set setCheckboxFields { get; set; } + + // the list of Contact Fields to put in the dropdowns + public list listSOContactFields { + get { + if (listSOContactFields == null) { + list listSO = new list(); + listSO.add(new SelectOption('', '')); + Map mapS = Schema.SObjectType.Contact.fields.getMap(); + + // create temp list of strings to sort by alpha + list listStr = new list(); + setCheckboxFields = new set(); + for (Schema.SObjectField sf : mapS.values()) { + Schema.DescribeFieldResult f = sf.getDescribe(); + listStr.add(f.Label + '.' + f.Name); + if (f.Type == Schema.DisplayType.Boolean) { + setCheckboxFields.add(f.Name); + } + } + listStr.sort(); + + for (string str : listStr) { + list listPair = str.split('\\.'); // need to escape the dot char since this is regex + listSO.add(new SelectOption(listPair[1], listPair[0])); + } + + listSOContactFields = listSO; + } + return listSOContactFields; + } + set; + } + + // helper to say whether this instance has any campaign record types defined. + // used by several tabs to hide a campaign record type column, when not needed. + public boolean hasCampaignRecordTypes { + get { + return (listSOCampaignRecordTypes.size() > 1); + } + } + + // the list of Campaign Record Types to put in the dropdowns + public list listSOCampaignRecordTypes { + get { + if (listSOCampaignRecordTypes == null) { + list listSO = new list(); + listSO.add(new SelectOption('', '')); + for (RecordType rt : [SELECT Name FROM RecordType WHERE SobjectType='Campaign']) { + listSO.add(new SelectOption(rt.Name, rt.Name)); + } + listSOCampaignRecordTypes = listSO; + } + return listSOCampaignRecordTypes; + } + set; + } + + // the list of Campaign Types to put in the dropdowns + public list listSOCampaignTypes { + get { + if (listSOCampaignTypes == null) { + list listSO = new list(); + listSO.add(new SelectOption('', '')); + + Schema.DescribeFieldResult F = Campaign.Type.getDescribe(); + for (Schema.PicklistEntry pe : F.getPicklistValues()) { + listSO.add(new SelectOption(pe.Value, pe.Label)); + } + listSOCampaignTypes = listSO; + } + return listSOCampaignTypes; + } + set; + } + + + // the list of Opportunity Stages to put in the dropdowns + public list listSOOppStages { + get { + if (listSOOppStages == null) { + list listSO = new list(); + listSO.add(new SelectOption('', '')); + + Schema.DescribeFieldResult F = Opportunity.StageName.getDescribe(); + for (Schema.PicklistEntry pe : F.getPicklistValues()) { + listSO.add(new SelectOption(pe.Value, pe.Label)); + } + listSOOppStages = listSO; + } + return listSOOppStages; + } + set; + } + + // the list of Opportunity Types to put in the dropdowns + public list listSOOppTypes { + get { + if (listSOOppTypes == null) { + list listSO = new list(); + listSO.add(new SelectOption('', '')); + + Schema.DescribeFieldResult F = Opportunity.Type.getDescribe(); + for (Schema.PicklistEntry pe : F.getPicklistValues()) { + listSO.add(new SelectOption(pe.Value, pe.Label)); + } + listSOOppTypes = listSO; + } + return listSOOppTypes; + } + set; + } + + + // the list of Opportunity Record Types to put in the dropdowns + public list listSOOppRecordTypes { + get { + if (listSOOppRecordTypes == null) { + + list listSO = new list(); + for (RecordType rt : [SELECT Name FROM RecordType WHERE SobjectType='Opportunity']) { + + listSO.add(new SelectOption(rt.Name, rt.Name)); + } + listSOOppRecordTypes = listSO; + } + return listSOOppRecordTypes; + } + set; + } + + // the list of Opportunity Contact Roles to put in the dropdowns + public list listSOContactRoles { + get { + if (listSOContactRoles == null) { + list listSO = new list(); + listSO.add(new SelectOption('', '')); + + Schema.DescribeFieldResult F = OpportunityContactRole.Role.getDescribe(); + for (Schema.PicklistEntry pe : F.getPicklistValues()) { + listSO.add(new SelectOption(pe.Value, pe.Label)); + } + listSOContactRoles = listSO; + } + return listSOContactRoles; + } + set; + } + + // the list of Campaign Member Statuses to put in the dropdowns + public list listSOMbrStatus { + get { + if (listSOMbrStatus == null) { + list listSO = new list(); + listSO.add(new SelectOption('', '')); + + Schema.DescribeFieldResult F = CampaignMember.Status.getDescribe(); + for (Schema.PicklistEntry pe : F.getPicklistValues()) { + listSO.add(new SelectOption(pe.Value, pe.Label)); + } + listSOMbrStatus = listSO; + } + return listSOMbrStatus; + } + set; + } + + + // the list of Campaign Sub Types to put in the dropdowns + public list listSOCampaignSubTypes { + get { + if (listSOCampaignSubTypes == null) { + list listSO = new list(); + listSO.add(new SelectOption('', '')); + + if (GW_BATCH_EngagementRollup.IsGWBaseInstalled) { + Map M = Schema.SObjectType.Campaign.fields.getMap(); + String sub_type = GW_BATCH_EngagementRollup.addNSPrefixET('Campaign_Sub_Type__c', false, false); + Schema.DescribeFieldResult F = M.get(sub_type).getDescribe(); + for (Schema.PicklistEntry pe : F.getPicklistValues()) { + listSO.add(new SelectOption(pe.Value, pe.Label)); + } + } + + listSOCampaignSubTypes = listSO; + } + return listSOCampaignSubTypes; + } + set; + } + + // helper used to hide Campaign Sub Type columns when not running with GWBase. + public boolean IsGWBaseInstalled { + get { + return (GW_BATCH_EngagementRollup.IsGWBaseInstalled); + } + } + + public boolean isnullStr(string str) { + return (str == null || str == ''); + } + + public boolean isnullNum(decimal num) { + return (num == null || num == 0); + } + + public static integer cEmptyRows = 3; + + //---------------------------------------- TEST CODE ------------------------------------------------- + static testmethod void TestWizard() { + GW_CTRL_SettingsWizard ctrl = new GW_CTRL_SettingsWizard(); + + system.assert(ctrl.ctabOpp != null); + system.assert(ctrl.ctabRoles != null); + system.assert(ctrl.ctabOrg != null); + system.assert(ctrl.ctabTrigger != null); + system.assert(ctrl.ctabCampMbr!= null); + system.assert(ctrl.ctabLead != null); + system.assert(ctrl.ctabMisc != null); + system.assert(ctrl.inEditMode == false); + system.assert(ctrl.strCurrentEditTab == null); + system.assert(ctrl.strCurrentTab == 'tabLevels'); + system.assert(ctrl.tSettings != null); + system.assert(ctrl.oSettings != null); + system.assert(ctrl.mSettings != null); + system.assert(ctrl.listSOContactFields != null); + system.assert(ctrl.listSOCampaignRecordTypes != null); + system.assert(ctrl.listSOCampaignTypes != null); + system.assert(ctrl.setCheckboxFields != null); + system.assert(ctrl.hasCampaignRecordTypes == (ctrl.listSOCampaignRecordTypes.size() > 1)); + system.assert(ctrl.IsGWBaseInstalled == GW_BATCH_EngagementRollup.IsGWBaseInstalled); + + + } +} \ No newline at end of file diff --git a/src/classes/GW_CTRL_SettingsWizard.cls-meta.xml b/src/classes/GW_CTRL_SettingsWizard.cls-meta.xml new file mode 100644 index 0000000..307ce73 --- /dev/null +++ b/src/classes/GW_CTRL_SettingsWizard.cls-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + Active + diff --git a/src/pages/SettingsTabCampMbr.page b/src/pages/SettingsTabCampMbr.page new file mode 100644 index 0000000..413b2cf --- /dev/null +++ b/src/pages/SettingsTabCampMbr.page @@ -0,0 +1,75 @@ + + + + + + +
+
Campaign Member
+
Default and available statuses for Campaign Members, by Campaign Type and Sub Type.
+
Help
+ +
+
+ + +    + +

+ + + + + + + del + + + With
Campaign Type ___
+ + + +
+ + + And Campaign SubType
____
+ + + +
+ + Counts as
Responded?
+ +
+ + Default Status?
(One Per Type)
+ +
+ +

And Status Label
___
+ + + + + + + + +

+ +    + + + + + + \ No newline at end of file diff --git a/src/pages/SettingsTabCampMbr.page-meta.xml b/src/pages/SettingsTabCampMbr.page-meta.xml new file mode 100644 index 0000000..649b62d --- /dev/null +++ b/src/pages/SettingsTabCampMbr.page-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + + diff --git a/src/pages/SettingsTabLead.page b/src/pages/SettingsTabLead.page new file mode 100644 index 0000000..795672a --- /dev/null +++ b/src/pages/SettingsTabLead.page @@ -0,0 +1,58 @@ + + + + + + +
+

Lead Conversion
+
Fields that the Lead Converter (Importer) Visualforce page should automatically transfer from leads to contacts during conversion.
+
Help
+ +
+
+ + +    + +

+ + + + + + + del + + +

Contact Field
+ + + + + +
And Field Type
+ + +
+ + + + + + +

+ +    + + + + + + \ No newline at end of file diff --git a/src/pages/SettingsTabLead.page-meta.xml b/src/pages/SettingsTabLead.page-meta.xml new file mode 100644 index 0000000..b75882a --- /dev/null +++ b/src/pages/SettingsTabLead.page-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + + diff --git a/src/pages/SettingsTabMisc.page b/src/pages/SettingsTabMisc.page new file mode 100644 index 0000000..8ba3761 --- /dev/null +++ b/src/pages/SettingsTabMisc.page @@ -0,0 +1,66 @@ + + + + + + +
+

Miscellaneous Settings
+
Miscellaneous settings used by GWBase..
+ + +
+
+ + +    + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ +    + + + + + \ No newline at end of file diff --git a/src/pages/SettingsTabMisc.page-meta.xml b/src/pages/SettingsTabMisc.page-meta.xml new file mode 100644 index 0000000..eb0aebe --- /dev/null +++ b/src/pages/SettingsTabMisc.page-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + + diff --git a/src/pages/SettingsTabOpp.page b/src/pages/SettingsTabOpp.page new file mode 100644 index 0000000..1e0ce63 --- /dev/null +++ b/src/pages/SettingsTabOpp.page @@ -0,0 +1,200 @@ + + + + + + +
+

Opportunity and Rollup Settings
+
Settings for Opportunities and Rollups.
+ +
+
+ + +    + +

+ + + + + + + +
Help
+

+ + + + + + + + + + + + + + + + + + + + + + +
Help
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +

+ +    + + + + + \ No newline at end of file diff --git a/src/pages/SettingsTabOpp.page-meta.xml b/src/pages/SettingsTabOpp.page-meta.xml new file mode 100644 index 0000000..e948df0 --- /dev/null +++ b/src/pages/SettingsTabOpp.page-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + + diff --git a/src/pages/SettingsTabOrg.page b/src/pages/SettingsTabOrg.page new file mode 100644 index 0000000..4a184e3 --- /dev/null +++ b/src/pages/SettingsTabOrg.page @@ -0,0 +1,50 @@ + + + + + + +
+

Org Contact Roles
+
Specify the default Primary Contact Role for each Opportunity Record Type for Opportunities applied to Organizations.
+ +
+ + +    + +

+ + + + + + + del + + + {!$ObjectType.OrgConRole_Settings__c.Fields.Primary_Contact_Role__c.Label} + + + + + Organization Opportunity Record Type + + + + + + + + + +

+ +    + + + + + \ No newline at end of file diff --git a/src/pages/SettingsTabOrg.page-meta.xml b/src/pages/SettingsTabOrg.page-meta.xml new file mode 100644 index 0000000..dc8c750 --- /dev/null +++ b/src/pages/SettingsTabOrg.page-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + + diff --git a/src/pages/SettingsTabRole.page b/src/pages/SettingsTabRole.page new file mode 100644 index 0000000..b3f9bf0 --- /dev/null +++ b/src/pages/SettingsTabRole.page @@ -0,0 +1,50 @@ + + + + + + +
+

Contact Roles
+
Specify the default Primary Contact Role for each Opportunity Record Type for Opportunities applied to Contacts.
+ +
+ + +    + +

+ + + + + + + del + + + {!$ObjectType.ConRole_Settings__c.Fields.Primary__c.Label} + + + + + Opportunity Record Type + + + + + + + + + +

+ +    + + + + + \ No newline at end of file diff --git a/src/pages/SettingsTabRole.page-meta.xml b/src/pages/SettingsTabRole.page-meta.xml new file mode 100644 index 0000000..e87e4dc --- /dev/null +++ b/src/pages/SettingsTabRole.page-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + + diff --git a/src/pages/SettingsTabTrigger.page b/src/pages/SettingsTabTrigger.page new file mode 100644 index 0000000..d4720e3 --- /dev/null +++ b/src/pages/SettingsTabTrigger.page @@ -0,0 +1,84 @@ + + + + + + +
+

Trigger Settings
+
Enable or disable all trigger based functionality for GWBase..
+
Help
+ +
+
+ + +    + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ +    + + + + + \ No newline at end of file diff --git a/src/pages/SettingsTabTrigger.page-meta.xml b/src/pages/SettingsTabTrigger.page-meta.xml new file mode 100644 index 0000000..05feb61 --- /dev/null +++ b/src/pages/SettingsTabTrigger.page-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + + diff --git a/src/pages/Settings_Page.page b/src/pages/Settings_Page.page new file mode 100644 index 0000000..51fb6ad --- /dev/null +++ b/src/pages/Settings_Page.page @@ -0,0 +1,190 @@ + + + + + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/src/pages/Settings_Page.page-meta.xml b/src/pages/Settings_Page.page-meta.xml new file mode 100644 index 0000000..19262b1 --- /dev/null +++ b/src/pages/Settings_Page.page-meta.xml @@ -0,0 +1,5 @@ + + + 25.0 + +