Skip to content

Commit

Permalink
Merge pull request #8 from jonsayer/master
Browse files Browse the repository at this point in the history
Work up to June 29, 2019
  • Loading branch information
daveb-501commons authored Jul 2, 2019
2 parents 7ef8611 + d541648 commit 0e9db41
Show file tree
Hide file tree
Showing 13 changed files with 863 additions and 104 deletions.
6 changes: 4 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ How to Install
i) C501_ClassReg_CreateAcct
ii) C501_ClassReg_Home
iii) C501_ClassReg_Login
iii) C501_ClassReg_SelectLang
b) Set the site template to C501_ClassRegSiteTemplate
c) Configure the PubliC Access Settings to have access to all of the fields on the Contact, Account, and School Term objects that are needed (this will shift through the lifetime of this project)
d) Also, make sure the Public Access Settings have full access to the Class Site Login Attempt object.
c) Configure the Public Access Settings to have access to all of the fields on the Contact, Account, and School Term objects that are needed (this will shift through the lifetime of this project)
d) Also, make sure the Public Access Settings have full access to the Class Site Login Attempt object.
e) If you are supporting multiple languages, go to Setup -> Translation Workbench -> Translation Settings and enable the languages you mean to support
46 changes: 34 additions & 12 deletions src/classes/C501_CTRL_ClassReg_CreateAcct.cls
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
public class C501_CTRL_ClassReg_CreateAcct {

public String language {get; set;}

public Contact parent {get; set;}
public Contact child {get; set;}
public Account family {get; set;}
public String pageStatus {get; set;}
public ID loginID {get; set;}
public String schoolName {get; set;}
public String schoolRegion {get; set;}
public String schoolNameText {get; set;}
public String schoolRegion {
get{
if(schoolRegion == null){
schoolRegion = '';
}
return schoolRegion;
}
set;
}
public School_Term__c term {get; set;}
public String grade {get; set;}
private String RegType {get; set;}

public List<SelectOption> schoolList {
get {
if(schoolList == null ){
if(String.isBlank(schoolRegion)){
schoolList = getSelectOptionsActiveSchools( '' );
System.debug('List<SelectOption> schoolList run: schoolRegion is null');
} else {
schoolList = getSelectOptionsActiveSchools(schoolRegion);
System.debug('List<SelectOption> schoolList run: schoolRegion is: ' + schoolRegion);
}
schoolList = getSelectOptionsActiveSchools(schoolRegion);
}
System.debug('List<SelectOption> schoolList run: ' + schoolList);
return schoolList;
Expand All @@ -33,6 +38,10 @@ public class C501_CTRL_ClassReg_CreateAcct {
public List<Schema.FieldSetMember> childFieldSet {get; set;}

public C501_CTRL_ClassReg_CreateAcct(){
language = ApexPages.currentPage().getParameters().get('l');
if(language == null){
language = 'en_US';
}
Boolean loggedIn = false;
loginID = null;
RegType = null;
Expand Down Expand Up @@ -82,9 +91,9 @@ public class C501_CTRL_ClassReg_CreateAcct {
RegType = 'byText';
}

schoolRegion = '';
gradeList = C501_UTIL_ClassRegUtilities.listOfGrades();
schoolName = '';
schoolNameText = '';

Map<String, Schema.FieldSet> FsAcctMap = Schema.SObjectType.Account.fieldSets.getMap();
Map<String, Schema.FieldSet> FsContMap = Schema.SObjectType.Contact.fieldSets.getMap();
Expand Down Expand Up @@ -160,11 +169,15 @@ public class C501_CTRL_ClassReg_CreateAcct {
Boolean passValidation = true;

if(schoolName == null || schoolName == '' ){
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.WARNING,'Please Select a School') );
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Please Select a School') );
passValidation = false;
}
if(grade == null || grade == '' ){
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.WARNING,'Please Select a Grade') );
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Please Select a Grade') );
passValidation = false;
}
if( parent.Email == null && parent.HomePhone == null && parent.MobilePhone == null && parent.OtherPhone == null ){
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter a contact method (phone number or email) for the parent. We need to be able to contact you!') );
passValidation = false;
}
if(passValidation == false){
Expand All @@ -187,12 +200,16 @@ public class C501_CTRL_ClassReg_CreateAcct {
term.Parent__c = parent.Id;
term.School__c = schoolName;

schoolNameText = [Select id,Name from Account where id = :schoolName].Name;

// future version, need to make this dynamic
term.School_Year__c = C501_UTIL_ClassRegUtilities.currentSchoolYear( Date.today() );
term.C501_Sign_Up_Source__c = 'Online';

insert term;


pageStatus = 'finished';
return null;
}

Expand Down Expand Up @@ -246,5 +263,10 @@ public class C501_CTRL_ClassReg_CreateAcct {

return schoolOptions;
}


/*public map<string,list<SelectOption>> contactFieldName2Options(){
}*/


}
9 changes: 7 additions & 2 deletions src/classes/C501_CTRL_ClassReg_Login.cls
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
public class C501_CTRL_ClassReg_Login {

public String language {get;set;}
public String pageStatus {get;set;}
public String phoneNumber {get;set;}
public String identityInput {get;set;}
Expand All @@ -8,6 +9,10 @@ public class C501_CTRL_ClassReg_Login {
private ID acctID = null;

public C501_CTRL_ClassReg_Login(){
language = ApexPages.currentPage().getParameters().get('l');
if(language == null){
language = 'en_US';
}
pageStatus = 'start';
phoneNumber = '';
confirmation = '';
Expand All @@ -16,7 +21,7 @@ public class C501_CTRL_ClassReg_Login {
}

public PageReference confirmLoginBySendToAddress(){
PageReference nextPage = C501_UTIL_ClassRegUtilities.confirmLoginByCodeToAddress(confirmation, identityInput , remember );
PageReference nextPage = C501_UTIL_ClassRegUtilities.confirmLoginByCodeToAddress(confirmation, identityInput , remember , language);
if(nextPage == null){
pageStatus = 'confirm-fail';
return null;
Expand All @@ -41,7 +46,7 @@ public class C501_CTRL_ClassReg_Login {
//
//
public PageReference confirmLogin(){
PageReference nextPage = C501_UTIL_ClassRegUtilities.confirmLogin(confirmation,acctID,remember);
PageReference nextPage = C501_UTIL_ClassRegUtilities.confirmLogin(confirmation,acctID,remember,language);
if(nextPage == null){
pageStatus = 'confirm-fail';
return null;
Expand Down
27 changes: 27 additions & 0 deletions src/classes/C501_CTRL_ClassReg_SelectLang.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
public class C501_CTRL_ClassReg_SelectLang {
public string language {get;set;}

public List<SelectOption> getListOfLangs(){
List<SelectOption> langList = new List<SelectOption>();
langList.add(new SelectOption('en-us', 'English'));

//langList.add(new SelectOption('nl_NL', 'عربى'));
langList.add(new SelectOption('es_MX', 'Español'));
//langList.add(new SelectOption('fr', 'Francais'));
//langList.add(new SelectOption('zh_CN', '中文'));
//langList.add(new SelectOption('fi', 'Tiếng Việt'));

return langList;
}

public PageReference changeLang() {
Map<String,String> currentPageParameters = ApexPages.currentPage().getParameters();
return C501_UTIL_ClassRegUtilities.generatePageLink('C501_ClassReg_Login','l',language);
}

public C501_CTRL_ClassReg_SelectLang(){

language = System.currentPagereference().getParameters().get('lang');

}
}
5 changes: 5 additions & 0 deletions src/classes/C501_CTRL_ClassReg_SelectLang.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>46.0</apiVersion>
<status>Active</status>
</ApexClass>
9 changes: 5 additions & 4 deletions src/classes/C501_UTIL_ClassRegUtilities.cls
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class C501_UTIL_ClassRegUtilities {
return returnYear;
}

public static PageReference confirmLogin(String confirmation,ID acctID,Boolean remember){
public static PageReference confirmLogin(String confirmation,ID acctID,Boolean remember,String language){
String pageStatus = C501_UTIL_ClassRegUtilities.checkVerificationCode(confirmation,acctID);

if(pageStatus == 'success'){
Expand All @@ -57,12 +57,13 @@ public class C501_UTIL_ClassRegUtilities {
} else {
remString = '0';
}
return C501_UTIL_ClassRegUtilities.generatePageLink('C501_ClassReg_Home','a,s,r',acctID+','+confirmation.replaceAll('[^0-9]', '')+','+remString);
return C501_UTIL_ClassRegUtilities.generatePageLink('C501_ClassReg_Home','a,s,r,l',acctID+','+confirmation.replaceAll('[^0-9]', '')+','+remString+','+language);
} else {
return null;
}
}


public static Boolean confirmLoggedIn(String loginID, Boolean timeCare){
Integer timeModify = 0;
if(timeCare){
Expand All @@ -83,7 +84,7 @@ public class C501_UTIL_ClassRegUtilities {
return attList.size() > 0;
}

public static PageReference confirmLoginByCodeToAddress(String confirmation,String codeToAddress,Boolean remember){
public static PageReference confirmLoginByCodeToAddress(String confirmation,String codeToAddress,Boolean remember,String language){
String pageStatus = checkVerificationCodeByCodeToAddress(confirmation,codeToAddress);
if(pageStatus != 'confirm-fail'){
// redirect to the account manager page
Expand All @@ -93,7 +94,7 @@ public class C501_UTIL_ClassRegUtilities {
} else {
remString = '0';
}
return C501_UTIL_ClassRegUtilities.generatePageLink('C501_ClassReg_CreateAcct','a,r,c',pageStatus+','+remString+','+codeToAddress);
return C501_UTIL_ClassRegUtilities.generatePageLink('C501_ClassReg_CreateAcct','a,r,c,l',pageStatus+','+remString+','+codeToAddress+','+language);
} else {
return null;
}
Expand Down
21 changes: 21 additions & 0 deletions src/labels/CustomLabels.labels
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,13 @@ We may also look at your child’s school information, like attendance and cours
<shortDescription>C501_RegSite_CodeMismatch</shortDescription>
<value>That doesn&apos;t seem to match the code we sent you. Try again?</value>
</labels>
<labels>
<fullName>C501_RegSite_ConfirmMessageSite</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_RegSite_ConfirmMessageSite</shortDescription>
<value>We have received your application. We have sent a confirmation message to the Email Address or Phone Number you provided. A copy of your application is below. Feel free to save or print this for your records.</value>
</labels>
<labels>
<fullName>C501_RegSite_Continue</fullName>
<language>en_US</language>
Expand All @@ -349,6 +356,13 @@ We may also look at your child’s school information, like attendance and cours
<shortDescription>C501_RegSite_FamilyInformation</shortDescription>
<value>Family Information</value>
</labels>
<labels>
<fullName>C501_RegSite_FinishedApp</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_RegSite_FinishedApp</shortDescription>
<value>Your Application is Complete</value>
</labels>
<labels>
<fullName>C501_RegSite_FirstName</fullName>
<language>en_US</language>
Expand Down Expand Up @@ -391,6 +405,13 @@ We may also look at your child’s school information, like attendance and cours
<shortDescription>C501_RegSite_Login</shortDescription>
<value>Log in</value>
</labels>
<labels>
<fullName>C501_RegSite_NotProvided</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_RegSite_NotProvided</shortDescription>
<value>Not provided</value>
</labels>
<labels>
<fullName>C501_RegSite_ParentEmail</fullName>
<language>en_US</language>
Expand Down
Loading

0 comments on commit 0e9db41

Please sign in to comment.