<%@ CodePage=1252 %> <% 'Include Common Files @1-BE743B53 %> <% 'End Include Common Files 'Initialize Page @1-15D4B4DB ' Variables Dim PathToRoot, ScriptPath, TemplateFilePath Dim FileName Dim Redirect Dim Tpl, HTMLTemplate Dim TemplateFileName Dim ComponentName Dim PathToCurrentPage Dim Attributes ' Events Dim CCSEvents Dim CCSEventResult ' Connections Dim DBConnection1 ' Page controls Dim feedback Dim ChildControls Redirect = "" TemplateFileName = "feedback_maint.html" Set CCSEvents = CreateObject("Scripting.Dictionary") PathToCurrentPage = "./" FileName = "feedback_maint.asp" PathToRoot = "./" ScriptPath = Left(Request.ServerVariables("PATH_TRANSLATED"), Len(Request.ServerVariables("PATH_TRANSLATED")) - Len(FileName)) TemplateFilePath = ScriptPath 'End Initialize Page 'Authenticate User @1-78185724 CCSecurityRedirect "1", Empty 'End Authenticate User 'Initialize Objects @1-C97459BD Set DBConnection1 = New clsDBConnection1 DBConnection1.Open Set Attributes = New clsAttributes ' Controls Set feedback = new clsRecordfeedback feedback.Initialize DBConnection1 CCSEventResult = CCRaiseEvent(CCSEvents, "AfterInitialize", Nothing) 'End Initialize Objects 'Execute Components @1-3CBF94D3 feedback.Operation 'End Execute Components 'Go to destination page @1-6D35F4FD If NOT ( Redirect = "" ) Then UnloadPage Response.Redirect Redirect End If 'End Go to destination page 'Initialize HTML Template @1-2E9DB4BC CCSEventResult = CCRaiseEvent(CCSEvents, "OnInitializeView", Nothing) Set HTMLTemplate = new clsTemplate Set HTMLTemplate.Cache = TemplatesRepository HTMLTemplate.LoadTemplate TemplateFilePath & TemplateFileName HTMLTemplate.SetVar "@CCS_PathToRoot", PathToRoot Set Tpl = HTMLTemplate.Block("main") CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeShow", Nothing) 'End Initialize HTML Template 'Show Page @1-7FB75EF9 Attributes.Show HTMLTemplate, "page:" Set ChildControls = CCCreateCollection(Tpl, Null, ccsParseOverwrite, _ Array(feedback)) ChildControls.Show Dim MainHTML HTMLTemplate.Parse "main", False MainHTML = HTMLTemplate.GetHTML("main") CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeOutput", Nothing) If CCSEventResult Then Response.Write MainHTML 'End Show Page 'Unload Page @1-CB210C62 UnloadPage Set Tpl = Nothing Set HTMLTemplate = Nothing 'End Unload Page 'UnloadPage Sub @1-8B14DB86 Sub UnloadPage() CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeUnload", Nothing) If DBConnection1.State = adStateOpen Then _ DBConnection1.Close Set DBConnection1 = Nothing Set CCSEvents = Nothing Set Attributes = Nothing Set feedback = Nothing End Sub 'End UnloadPage Sub Class clsRecordfeedback 'feedback Class @2-1974B93A 'feedback Variables @2-B40D68AC ' Public variables Public ComponentName Public HTMLFormAction Public PressedButton Public Errors Public FormSubmitted Public EditMode Public Visible Public Recordset Public TemplateBlock Public Attributes Public CCSEvents Private CCSEventResult Public InsertAllowed Public UpdateAllowed Public DeleteAllowed Public ReadAllowed Public DataSource Public Command Public ValidatingControls Public Controls ' Class variables Dim subject Dim user_login_fb Dim dateFB Dim feedback Dim Button_Insert Dim Button_Update Dim Button_Delete 'End feedback Variables 'feedback Class_Initialize Event @2-B3EADE68 Private Sub Class_Initialize() Visible = True Set Errors = New clsErrors Set CCSEvents = CreateObject("Scripting.Dictionary") Set Attributes = New clsAttributes Set DataSource = New clsfeedbackDataSource Set Command = New clsCommand InsertAllowed = True UpdateAllowed = True DeleteAllowed = True ReadAllowed = True Dim Method Dim OperationMode OperationMode = Split(CCGetFromGet("ccsForm", Empty), ":") If UBound(OperationMode) > -1 Then FormSubmitted = (OperationMode(0) = "feedback") End If If UBound(OperationMode) > 0 Then EditMode = (OperationMode(1) = "Edit") End If ComponentName = "feedback" Method = IIf(FormSubmitted, ccsPost, ccsGet) Set subject = CCCreateControl(ccsHidden, "subject", Empty, ccsInteger, Empty, CCGetRequestParam("subject", Method)) Set user_login_fb = CCCreateControl(ccsHidden, "user_login_fb", Empty, ccsInteger, Empty, CCGetRequestParam("user_login_fb", Method)) Set dateFB = CCCreateControl(ccsHidden, "dateFB", Empty, ccsDate, DefaultDateFormat, CCGetRequestParam("dateFB", Method)) Set feedback = CCCreateControl(ccsTextArea, "feedback", "Feedback", ccsMemo, Empty, CCGetRequestParam("feedback", Method)) Set Button_Insert = CCCreateButton("Button_Insert", Method) Set Button_Update = CCCreateButton("Button_Update", Method) Set Button_Delete = CCCreateButton("Button_Delete", Method) Set ValidatingControls = new clsControls ValidatingControls.addControls Array(subject, user_login_fb, dateFB, feedback) If Not FormSubmitted Then If IsEmpty(subject.Value) Then _ subject.Value = 8 If IsEmpty(user_login_fb.Value) Then _ user_login_fb.Value = session("userid") If IsEmpty(dateFB.Value) Then _ dateFB.Value = Date End If End Sub 'End feedback Class_Initialize Event 'feedback Initialize Method @2-F12247EA Sub Initialize(objConnection) If NOT Visible Then Exit Sub Set DataSource.Connection = objConnection With DataSource .Parameters("urlID") = CCGetRequestParam("ID", ccsGET) End With End Sub 'End feedback Initialize Method 'feedback Class_Terminate Event @2-0C5D276C Private Sub Class_Terminate() Set Errors = Nothing Set Attributes = Nothing End Sub 'End feedback Class_Terminate Event 'feedback Validate Method @2-B9D513CF Function Validate() Dim Validation ValidatingControls.Validate CCSEventResult = CCRaiseEvent(CCSEvents, "OnValidate", Me) Validate = ValidatingControls.isValid() And (Errors.Count = 0) End Function 'End feedback Validate Method 'feedback Operation Method @2-074518BF Sub Operation() If NOT ( Visible AND FormSubmitted ) Then Exit Sub If FormSubmitted Then PressedButton = IIf(EditMode, "Button_Update", "Button_Insert") If Button_Insert.Pressed Then PressedButton = "Button_Insert" ElseIf Button_Update.Pressed Then PressedButton = "Button_Update" ElseIf Button_Delete.Pressed Then PressedButton = "Button_Delete" End If End If Redirect = "../html/mainpage.htm?" & CCGetQueryString("QueryString", Array("ccsForm", "Button_Insert.x", "Button_Insert.y", "Button_Insert", "Button_Update.x", "Button_Update.y", "Button_Update", "Button_Delete.x", "Button_Delete.y", "Button_Delete")) If PressedButton = "Button_Delete" Then If NOT Button_Delete.OnClick OR NOT DeleteRow() Then Redirect = "" End If ElseIf Validate() Then If PressedButton = "Button_Insert" Then If NOT Button_Insert.OnClick() OR NOT InsertRow() Then Redirect = "" End If ElseIf PressedButton = "Button_Update" Then If NOT Button_Update.OnClick() OR NOT UpdateRow() Then Redirect = "" End If End If Else Redirect = "" End If End Sub 'End feedback Operation Method 'feedback InsertRow Method @2-767408E3 Function InsertRow() CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeInsert", Me) If NOT InsertAllowed Then InsertRow = False : Exit Function DataSource.subject.Value = subject.Value DataSource.user_login_fb.Value = user_login_fb.Value DataSource.dateFB.Value = dateFB.Value DataSource.feedback.Value = feedback.Value DataSource.Insert(Command) CCSEventResult = CCRaiseEvent(CCSEvents, "AfterInsert", Me) If DataSource.Errors.Count > 0 Then Errors.AddErrors(DataSource.Errors) DataSource.Errors.Clear End If InsertRow = (Errors.Count = 0) End Function 'End feedback InsertRow Method 'feedback UpdateRow Method @2-0D26C4E0 Function UpdateRow() CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeUpdate", Me) If NOT UpdateAllowed Then UpdateRow = False : Exit Function DataSource.subject.Value = subject.Value DataSource.user_login_fb.Value = user_login_fb.Value DataSource.dateFB.Value = dateFB.Value DataSource.feedback.Value = feedback.Value DataSource.Update(Command) CCSEventResult = CCRaiseEvent(CCSEvents, "AfterUpdate", Me) If DataSource.Errors.Count > 0 Then Errors.AddErrors(DataSource.Errors) DataSource.Errors.Clear End If UpdateRow = (Errors.Count = 0) End Function 'End feedback UpdateRow Method 'feedback DeleteRow Method @2-D5C1DF24 Function DeleteRow() CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeDelete", Me) If NOT DeleteAllowed Then DeleteRow = False : Exit Function DataSource.Delete(Command) CCSEventResult = CCRaiseEvent(CCSEvents, "AfterDelete", Me) If DataSource.Errors.Count > 0 Then Errors.AddErrors(DataSource.Errors) DataSource.Errors.Clear End If DeleteRow = (Errors.Count = 0) End Function 'End feedback DeleteRow Method 'feedback Show Method @2-190BFDF3 Sub Show(Tpl) If NOT Visible Then Exit Sub CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeSelect", Me) Set Recordset = DataSource.Open(Command) EditMode = Recordset.EditMode(ReadAllowed) HTMLFormAction = FileName & "?" & CCAddParam(Request.ServerVariables("QUERY_STRING"), "ccsForm", "feedback" & IIf(EditMode, ":Edit", "")) Set TemplateBlock = Tpl.Block("Record " & ComponentName) If TemplateBlock is Nothing Then Exit Sub TemplateBlock.Variable("HTMLFormName") = ComponentName TemplateBlock.Variable("HTMLFormEnctype") ="application/x-www-form-urlencoded" If DataSource.Errors.Count > 0 Then Errors.AddErrors(DataSource.Errors) DataSource.Errors.Clear With TemplateBlock.Block("Error") .Variable("Error") = Errors.ToString .Parse False End With End If Set Controls = CCCreateCollection(TemplateBlock, Null, ccsParseOverwrite, _ Array(subject, user_login_fb, dateFB, feedback, Button_Insert, Button_Update, Button_Delete)) If EditMode AND ReadAllowed Then If Errors.Count = 0 Then If Recordset.Errors.Count > 0 Then With TemplateBlock.Block("Error") .Variable("Error") = Recordset.Errors.ToString .Parse False End With ElseIf Recordset.CanPopulate() Then If Not FormSubmitted Then subject.Value = Recordset.Fields("subject") user_login_fb.Value = Recordset.Fields("user_login_fb") dateFB.Value = Recordset.Fields("dateFB") feedback.Value = Recordset.Fields("feedback") End If Else EditMode = False End If End If End If If Not FormSubmitted Then End If If FormSubmitted Then Errors.AddErrors subject.Errors Errors.AddErrors user_login_fb.Errors Errors.AddErrors dateFB.Errors Errors.AddErrors feedback.Errors Errors.AddErrors DataSource.Errors With TemplateBlock.Block("Error") .Variable("Error") = Errors.ToString() .Parse False End With End If TemplateBlock.Variable("Action") = HTMLFormAction Button_Insert.Visible = NOT EditMode AND InsertAllowed Button_Update.Visible = EditMode AND UpdateAllowed Button_Delete.Visible = EditMode AND DeleteAllowed CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeShow", Me) If Visible Then Attributes.Show TemplateBlock, "feedback" & ":" Controls.Show End If End Sub 'End feedback Show Method End Class 'End feedback Class @2-A61BA892 Class clsfeedbackDataSource 'feedbackDataSource Class @2-C6BFCC6A 'DataSource Variables @2-5E3D2C76 Public Errors, Connection, Parameters, CCSEvents Public Recordset Public SQL, CountSQL, Order, Where, Orders, StaticOrder Public PageSize Public PageCount Public AbsolutePage Public Fields Dim WhereParameters Public AllParamsSet Public CmdExecution Public InsertOmitIfEmpty Public UpdateOmitIfEmpty Private CurrentOperation Private CCSEventResult ' Datasource fields Public subject Public user_login_fb Public dateFB Public feedback 'End DataSource Variables 'DataSource Class_Initialize Event @2-4DE0C722 Private Sub Class_Initialize() Set CCSEvents = CreateObject("Scripting.Dictionary") Set Fields = New clsFields Set Recordset = New clsDataSource Set Recordset.DataSource = Me Set Errors = New clsErrors Set Connection = Nothing AllParamsSet = True Set subject = CCCreateField("subject", "subject", ccsInteger, Empty, Recordset) Set user_login_fb = CCCreateField("user_login_fb", "user_login_fb", ccsInteger, Empty, Recordset) Set dateFB = CCCreateField("dateFB", "dateFB", ccsDate, Array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"), Recordset) Set feedback = CCCreateField("feedback", "feedback", ccsMemo, Empty, Recordset) Fields.AddFields Array(subject, user_login_fb, dateFB, feedback) Set InsertOmitIfEmpty = CreateObject("Scripting.Dictionary") InsertOmitIfEmpty.Add "subject", True InsertOmitIfEmpty.Add "user_login_fb", True InsertOmitIfEmpty.Add "dateFB", True InsertOmitIfEmpty.Add "feedback", True Set UpdateOmitIfEmpty = CreateObject("Scripting.Dictionary") UpdateOmitIfEmpty.Add "subject", True UpdateOmitIfEmpty.Add "user_login_fb", True UpdateOmitIfEmpty.Add "dateFB", True UpdateOmitIfEmpty.Add "feedback", True Set Parameters = Server.CreateObject("Scripting.Dictionary") Set WhereParameters = Nothing SQL = "SELECT * " & vbLf & _ "FROM feedback {SQL_Where} {SQL_OrderBy}" Where = "" Order = "" StaticOrder = "" End Sub 'End DataSource Class_Initialize Event 'BuildTableWhere Method @2-65DC853B Public Sub BuildTableWhere() Dim WhereParams If Not WhereParameters Is Nothing Then _ Exit Sub Set WhereParameters = new clsSQLParameters With WhereParameters Set .Connection = Connection Set .ParameterSources = Parameters Set .DataSource = Me .AddParameter 1, "urlID", ccsInteger, Empty, Empty, Empty, False AllParamsSet = .AllParamsSet .Criterion(1) = .Operation(opEqual, False, "ID", .getParamByID(1)) .AssembledWhere = .Criterion(1) WhereParams = .AssembledWhere If Len(Where) > 0 Then If Len(WhereParams) > 0 Then _ Where = Where & " AND " & WhereParams Else If Len(WhereParams) > 0 Then _ Where = WhereParams End If End With End Sub 'End BuildTableWhere Method 'Open Method @2-BAB6187B Function Open(Cmd) Errors.Clear If Connection Is Nothing Then Set Open = New clsEmptyDataSource Exit Function End If Set Cmd.Connection = Connection Cmd.CommandOperation = cmdOpen Cmd.PageSize = PageSize Cmd.ActivePage = AbsolutePage Cmd.CommandType = dsTable CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeBuildSelect", Me) Cmd.SQL = SQL BuildTableWhere Cmd.Where = Where Cmd.OrderBy = Order If(Len(StaticOrder)>0) Then If Len(Order)>0 Then Cmd.OrderBy = ", "+Cmd.OrderBy Cmd.OrderBy = StaticOrder + Cmd.OrderBy End If Cmd.Options("CLAUSE") = " TOP {SqlParam_endRecord}" Cmd.Options("SYNTAX") = "Top" Cmd.Options("PLACE") = "beforeFrom" If Not AllParamsSet Then Set Open = New clsEmptyDataSource Exit Function End If CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeExecuteSelect", Me) If Errors.Count = 0 And CCSEventResult Then _ Set Recordset = Cmd.Exec(Errors) CCSEventResult = CCRaiseEvent(CCSEvents, "AfterExecuteSelect", Me) Set Recordset.FieldsCollection = Fields Set Open = Recordset End Function 'End Open Method 'DataSource Class_Terminate Event @2-41B4B08D Private Sub Class_Terminate() If Recordset.State = adStateOpen Then _ Recordset.Close Set Recordset = Nothing Set Parameters = Nothing Set Errors = Nothing End Sub 'End DataSource Class_Terminate Event 'Delete Method @2-D2262074 Sub Delete(Cmd) CmdExecution = True CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeBuildDelete", Me) Set Cmd.Connection = Connection Cmd.CommandOperation = cmdExec Cmd.CommandType = dsTable Cmd.CommandParameters = Empty BuildTableWhere If NOT AllParamsSet Then Errors.AddError(CCSLocales.GetText("CCS_CustomOperationError_MissingParameters", Empty)) End If Cmd.SQL = "DELETE FROM feedback" & IIf(Len(Where) > 0, " WHERE " & Where, "") CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeExecuteDelete", Me) If Errors.Count = 0 And CmdExecution Then Cmd.Exec(Errors) CCSEventResult = CCRaiseEvent(CCSEvents, "AfterExecuteDelete", Me) End If End Sub 'End Delete Method 'Update Method @2-DDA3292F Sub Update(Cmd) CmdExecution = True CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeBuildUpdate", Me) Set Cmd.Connection = Connection Cmd.CommandOperation = cmdExec Cmd.CommandType = dsTable Cmd.CommandParameters = Empty Cmd.Prepared = True BuildTableWhere If NOT AllParamsSet Then Errors.AddError(CCSLocales.GetText("CCS_CustomOperationError_MissingParameters", Empty)) End If Dim IsDef_subject : IsDef_subject = CCIsDefined("subject", "Form") Dim IsDef_user_login_fb : IsDef_user_login_fb = CCIsDefined("user_login_fb", "Form") Dim IsDef_dateFB : IsDef_dateFB = CCIsDefined("dateFB", "Form") Dim IsDef_feedback : IsDef_feedback = CCIsDefined("feedback", "Form") If Not UpdateOmitIfEmpty("subject") Or IsDef_subject Then Cmd.AddSQLStrings "subject=" & Connection.ToSQL(subject, subject.DataType), Empty If Not UpdateOmitIfEmpty("user_login_fb") Or IsDef_user_login_fb Then Cmd.AddSQLStrings "user_login_fb=" & Connection.ToSQL(user_login_fb, user_login_fb.DataType), Empty If Not UpdateOmitIfEmpty("dateFB") Or IsDef_dateFB Then Cmd.AddSQLStrings "[dateFB]=" & Connection.ToSQL(dateFB, dateFB.DataType), Empty If Not UpdateOmitIfEmpty("feedback") Or IsDef_feedback Then Cmd.AddSQLStrings "feedback=" & "?", Empty CmdExecution = Cmd.PrepareSQL("Update", "feedback", Where) Cmd.CommandParameters = Array( _ IIF(IsDef_feedback,Array("feedback", adLongVarChar, adParamInput, 2147483647, feedback.Value), Empty)) CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeExecuteUpdate", Me) If Errors.Count = 0 And CmdExecution Then Cmd.Exec(Errors) CCSEventResult = CCRaiseEvent(CCSEvents, "AfterExecuteUpdate", Me) End If End Sub 'End Update Method 'Insert Method @2-0F2FF754 Sub Insert(Cmd) CmdExecution = True CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeBuildInsert", Me) Set Cmd.Connection = Connection Cmd.CommandOperation = cmdExec Cmd.CommandType = dsTable Cmd.CommandParameters = Empty Cmd.Prepared = True Dim IsDef_subject : IsDef_subject = CCIsDefined("subject", "Form") Dim IsDef_user_login_fb : IsDef_user_login_fb = CCIsDefined("user_login_fb", "Form") Dim IsDef_dateFB : IsDef_dateFB = CCIsDefined("dateFB", "Form") Dim IsDef_feedback : IsDef_feedback = CCIsDefined("feedback", "Form") If Not InsertOmitIfEmpty("subject") Or IsDef_subject Then Cmd.AddSQLStrings "subject", Connection.ToSQL(subject, subject.DataType) If Not InsertOmitIfEmpty("user_login_fb") Or IsDef_user_login_fb Then Cmd.AddSQLStrings "user_login_fb", Connection.ToSQL(user_login_fb, user_login_fb.DataType) If Not InsertOmitIfEmpty("dateFB") Or IsDef_dateFB Then Cmd.AddSQLStrings "[dateFB]", Connection.ToSQL(dateFB, dateFB.DataType) If Not InsertOmitIfEmpty("feedback") Or IsDef_feedback Then Cmd.AddSQLStrings "feedback", "?" CmdExecution = Cmd.PrepareSQL("Insert", "feedback", Empty) Cmd.CommandParameters = Array( _ IIF(IsDef_feedback,Array("feedback", adLongVarChar, adParamInput,2147483647, feedback.Value), Empty) _ ) CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeExecuteInsert", Me) If Errors.Count = 0 And CmdExecution Then Cmd.Exec(Errors) CCSEventResult = CCRaiseEvent(CCSEvents, "AfterExecuteInsert", Me) End If End Sub 'End Insert Method End Class 'End feedbackDataSource Class @2-A61BA892 %>