#INCLUDE WCONNECT.H
DEFINE CLASS JobBoardSubmit AS rbPage
FUNCTION Page()
STORE .NULL. to This.oData
This.oData = This.DataObject("JobBoard","JobBoardID",'-1')
This.Content = this.MergeToString('JobBoardSubmit.htm')
This.PageTitle = [Submit a Job]
This.Merge('TemplatePage.htm')
ENDFUNC
FUNCTION Submit()
This.PageTitle = [Submit Job]
This.oData = This.ReadForm("JobBoard","JobBoardID")
This.oData.Approved = .F.
This.oData.DatePosted = DATE()
IF this.Validate(This.oData) AND This.Save("JobBoard","JobBoardID",This.oData)
this.EmailToAdmin()
this.EmailToJobPoster(This.oData.Email)
This.WaitWindow("Record Saved!", "/Home.Page.fox?SessionID=_6ZN10ZXFE")
ELSE
This.Content = this.MergeToString('JobBoardSubmit.htm')
This.Merge('TemplatePage.htm')
ENDIF
ENDFUNC
HIDDEN Function Validate(toData)
This.ErrorMessage = []
This.AddConditionalError(EMPTY(toData.Company), [Company must not be blank])
This.AddConditionalError(EMPTY(toData.Contact), [Contact must not be blank])
This.AddConditionalError(EMPTY(toData.Phone), [Phone must not be blank])
This.AddConditionalError(EMPTY(toData.Fax), [Fax must not be blank])
This.AddConditionalError(EMPTY(toData.Email), [Email must not be blank])
This.AddConditionalError(EMPTY(toData.Position), [Position must not be blank])
This.AddConditionalError(EMPTY(toData.Description), [Description must not be blank])
RETURN EMPTY(This.ErrorMessage)
ENDFUNC
HIDDEN Function EMailToAdmin()
Server.SendMail( ;
"mail.bricksoftware.com",;
Site.SiteName, ;
'website@' + site.SiteName + '.org' ,;
'webmaster@' + site.SiteName + '.org', ;
[], ;
"New Job for Approval",;
'http://www.' + site.SiteName + '.org/JobBoardApprove.page.fox?SessionID=_6ZN10ZXFE' )
ENDFUNC
HIDDEN Function EMailToJobPoster(tcEmailTo)
Server.SendMail( ;
"mail.bricksoftware.com",;
site.SiteName, ;
'website@' + site.SiteName + '.org' ,;
tcEmailTo, ;
[], ;
"Thanks for Submitting Your Job",;
'An Adminsitrator will review your Job Posting and add it to the web site.' )
ENDFUNC
ENDDEFINE
csCodeParser v0.9 stats: 147 lines in 0.00 seconds.