% '======================================================================================================================= ' Flash Message Class '======================================================================================================================= Class Flash_Class Private m_errors_key Private m_success_key Private Sub Class_Initialize m_errors_key = "mvc.flash.errors_array" m_success_key = "mvc.flash.success_message" End Sub 'helper methods to avoid if..then statements in views Public Sub ShowErrorsIfPresent if HasErrors then ShowErrors End Sub Public Sub ShowSuccessIfPresent if HasSuccess then ShowSuccess End Sub '--------------------------------------------------------------------------------------------------------------------- ' Errors '--------------------------------------------------------------------------------------------------------------------- Public Property Get HasErrors HasErrors = (Not IsEmpty(Session(m_errors_key))) End Property Public Property Get Errors Errors = Session(m_errors_key) End Property Public Property Let Errors(ary) Session(m_errors_key) = ary End Property Public Sub AddError(msg) dim ary if IsEmpty(Session(m_errors_key)) then ary = Array() redim ary(-1) else ary = Session(m_errors_key) end if redim preserve ary(ubound(ary) + 1) ary(ubound(ary)) = msg Session(m_errors_key) = ary End Sub 'Public Sub ShowErrors ' ClearErrors 'End Sub Public Sub ShowErrors if HasErrors then %>