<% 'Include Common Files @1-D6EDE132 %> <% 'End Include Common Files 'Initialize Page @1-3B642C0A ' Variables Dim PathToRoot, ScriptPath, PathToCurrentPage Dim FileName Dim Redirect Dim Tpl, HTMLTemplate Dim TemplateFileName Dim ComponentName ' Events Dim CCSEvents Dim CCSEventResult ' Connections Dim DBConnection1 ' Page controls Dim Header Dim linksSearch Dim links Dim Footer Redirect = "" TemplateFileName = "default.html" Set CCSEvents = CreateObject("Scripting.Dictionary") FileName = "default.asp" PathToRoot = "./" PathToCurrentPage = "./" ScriptPath = Left(Request("PATH_TRANSLATED"), Len(Request("PATH_TRANSLATED")) - Len(FileName)) 'End Initialize Page 'Initialize Objects @1-7B6FFB7F Set DBConnection1 = New clsDBConnection1 DBConnection1.Open ' Controls Set Header = New clsHeader Header.BindEvents Header.Initialize Set linksSearch = new clsRecordlinksSearch Set links = New clsGridlinks Set Footer = New clsFooter Footer.BindEvents Footer.Initialize links.Initialize DBConnection1 CCSEventResult = CCRaiseEvent(CCSEvents, "AfterInitialize", Nothing) 'End Initialize Objects 'Execute Components @1-F6F3E1E9 Header.Operations linksSearch.Operation Footer.Operations '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-0155E1BE CCSEventResult = CCRaiseEvent(CCSEvents, "OnInitializeView", Nothing) Set HTMLTemplate = new clsTemplate Set HTMLTemplate.Cache = TemplatesRepository HTMLTemplate.LoadTemplate ScriptPath & TemplateFileName Set Tpl = HTMLTemplate.Block("main") CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeShow", Nothing) 'End Initialize HTML Template 'Show Page @1-F6397957 Header.Show Tpl, "Header" linksSearch.Show Tpl links.Show Tpl Footer.Show Tpl, "Footer" HTMLTemplate.PParse "main", False 'End Show Page 'Unload Page @1-CB210C62 UnloadPage Set Tpl = Nothing Set HTMLTemplate = Nothing 'End Unload Page 'UnloadPage Sub @1-FB151B8B Sub UnloadPage() CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeUnload", Nothing) If DBConnection1.State = adStateOpen Then _ DBConnection1.Close Set DBConnection1 = Nothing Set Header = Nothing Set linksSearch = Nothing Set links = Nothing Set Footer = Nothing End Sub 'End UnloadPage Sub 'Include Page Implementation @16-EB31621C %> <% 'End Include Page Implementation Class clsRecordlinksSearch 'linksSearch Class @2-251E64CA 'Variables @2-B7390A44 ' Public variables Public ComponentName Public HTMLFormAction Public PressedButton Public Errors Public FormSubmitted Public EditMode Public Visible Public Recordset Public TemplateBlock Public CCSEvents Private CCSEventResult Public DataSource Public Command Private ValidatingControls Private Controls ' Class variables Dim s_link_desc Dim DoSearch 'End Variables 'Class_Initialize Event @2-025E8D03 Private Sub Class_Initialize() Visible = True Set Errors = New clsErrors Set CCSEvents = CreateObject("Scripting.Dictionary") Dim Method Dim OperationMode If Visible Then OperationMode = Split(Request.QueryString("ccsForm"), ":") If UBound(OperationMode) > -1 Then _ FormSubmitted = (OperationMode(0) = "linksSearch") If UBound(OperationMode) > 0 Then _ EditMode = (OperationMode(1) = "Edit") ComponentName = "linksSearch" Method = IIf(FormSubmitted, ccsPost, ccsGet) Set s_link_desc = CCCreateControl(ccsTextBox, "s_link_desc", "s_link_desc", ccsMemo, Empty, CCGetRequestParam("s_link_desc", Method)) Set DoSearch = CCCreateButton("DoSearch") Set ValidatingControls = new clsControls ValidatingControls.addControls Array(s_link_desc) End If End Sub 'End Class_Initialize Event 'Class_Terminate Event @2-32B847C9 Private Sub Class_Terminate() Set Errors = Nothing End Sub 'End Class_Terminate Event 'Validate Method @2-7AE5264D Function Validate() Dim Validation Validation = ValidatingControls.Validate CCSEventResult = CCRaiseEvent(CCSEvents, "OnValidate", Me) Validate = Validation And (Errors.Count = 0) End Function 'End Validate Method 'Operation Method @2-BB4AA715 Sub Operation() If NOT ( Visible AND FormSubmitted ) Then _ Exit Sub If FormSubmitted Then PressedButton = "DoSearch" If Not IsEmpty(CCGetParam("DoSearch", Empty)) Then PressedButton = "DoSearch" End If End If Redirect = "default.asp?" & CCGetQueryString("Form", Array("DoSearch","ccsForm")) If Validate() Then If PressedButton = "DoSearch" Then If NOT DoSearch.OnClick() Then Redirect = "" Else Redirect = "default.asp?" & CCGetQueryString("Form", Array("DoSearch")) End If End If Else Redirect = "" End If End Sub 'End Operation Method 'Show Method @2-13D519C9 Sub Show(Tpl) If NOT Visible Then _ Exit Sub EditMode = False HTMLFormAction = FileName & "?" & CCAddParam(Request.ServerVariables("QUERY_STRING"), "ccsForm", "linksSearch" & IIf(EditMode, ":Edit", "")) Set TemplateBlock = Tpl.Block("Record " & ComponentName) Set Controls = new clsControls Set Controls = CCCreateCollection(TemplateBlock, Null, ccsParseOverwrite, _ Array(s_link_desc, DoSearch)) If Not FormSubmitted Then End If If FormSubmitted Then With TemplateBlock.Block("Error") .Variable("Error") = ValidatingControls.GetErrors & Errors.ToString .Parse False End With End If TemplateBlock.Variable("Action") = HTMLFormAction CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeShow", Me) If Visible Then _ Controls.Show End Sub 'End Show Method End Class 'End linksSearch Class @2-A61BA892 Class clsGridlinks 'links Class @5-E5B4E79D 'Variables @5-C0F09B3E ' Public variables Public ComponentName, CCSEvents Public Visible, Errors Public DataSource, PageSize Public PageNumber Public Command Public TemplateBlock Public ActiveSorter, SortingDirection Public Recordset Private CCSEventResult ' Grid Controls Public StaticControls, RowControls Dim Sorter_link_name Dim Sorter_link_url Dim Sorter_link_cat Dim Sorter_link_date Dim Detail Dim link_name Dim link_url Dim link_cat Dim date_add Dim Navigator 'End Variables 'Class_Initialize Event @5-7BB259D7 Private Sub Class_Initialize() ComponentName = "links" Visible = True Set CCSEvents = CreateObject("Scripting.Dictionary") Set Errors = New clsErrors Set DataSource = New clslinksDataSource Set Command = New clsCommand PageSize = CCGetParam(ComponentName & "PageSize", Empty) If NOT IsNumeric(PageSize) OR IsEmpty(PageSize) Then _ PageSize = 10 _ Else _ PageSize = CInt(PageSize) PageNumber = CInt(CCGetParam(ComponentName & "Page", 1)) ActiveSorter = CCGetParam("linksOrder", Empty) SortingDirection = CCGetParam("linksDir", Empty) If NOT(SortingDirection = "asc" OR SortingDirection = "desc") Then _ SortingDirection = Empty Set Detail = CCCreateControl(ccsLink, "Detail", "Detail", ccsText, Empty, CCGetRequestParam("Detail", ccsGet)) Set link_name = CCCreateControl(ccsLabel, "link_name", "link_name", ccsText, Empty, CCGetRequestParam("link_name", ccsGet)) Set link_url = CCCreateControl(ccsLabel, "link_url", "link_url", ccsText, Empty, CCGetRequestParam("link_url", ccsGet)) Set link_cat = CCCreateControl(ccsLabel, "link_cat", "link_cat", ccsText, Empty, CCGetRequestParam("link_cat", ccsGet)) Set date_add = CCCreateControl(ccsLabel, "date_add", "date_add", ccsDate, Empty, CCGetRequestParam("date_add", ccsGet)) Set Sorter_link_name = CCCreateSorter("Sorter_link_name", Me, FileName) Set Sorter_link_url = CCCreateSorter("Sorter_link_url", Me, FileName) Set Sorter_link_cat = CCCreateSorter("Sorter_link_cat", Me, FileName) Set Sorter_link_date = CCCreateSorter("Sorter_link_date", Me, FileName) Set Navigator = CCCreateNavigator(ComponentName, "Navigator", FileName, 5, tpCentered) End Sub 'End Class_Initialize Event 'Initialize Method @5-2AEA3975 Sub Initialize(objConnection) If NOT Visible Then Exit Sub Set DataSource.Connection = objConnection DataSource.PageSize = PageSize DataSource.SetOrder ActiveSorter, SortingDirection DataSource.AbsolutePage = PageNumber End Sub 'End Initialize Method 'Class_Terminate Event @5-E1528F98 Private Sub Class_Terminate() Set DataSource = Nothing Set Command = Nothing Set Errors = Nothing End Sub 'End Class_Terminate Event 'Show Method @5-4A109C40 Sub Show(Tpl) If NOT Visible Then Exit Sub Dim RecordCounter, ShownRecords Dim RowBlock With DataSource .Parameters("urls_link_desc") = Request.QueryString("s_link_desc") End With Set Recordset = DataSource.Open(Command) Set TemplateBlock = Tpl.Block("Grid " & ComponentName) Set RowBlock = TemplateBlock.Block("Row") Set StaticControls = CCCreateCollection(TemplateBlock, Null, ccsParseOverwrite, _ Array(Sorter_link_name, Sorter_link_url, Sorter_link_cat, Sorter_link_date, Navigator)) Set RowControls = CCCreateCollection(RowBlock, Null, ccsParseAccumulate, _ Array(Detail, link_name, link_url, link_cat, date_add)) CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeShow", Me) If NOT Visible Then Exit Sub Errors.AddErrors DataSource.Errors If Errors.Count > 0 Then TemplateBlock.HTML = CCFormatError("Grid links", Errors) Else ' Show NoRecords block if no records are found If Recordset.EOF Then TemplateBlock.Block("NoRecords").Parse ccsParseOverwrite End If While NOT Recordset.EOF AND ShownRecords < PageSize Detail.Parameters = CCGetQueryString("QueryString", Array("ccsForm")) Detail.Parameters = CCAddParam(Detail.Parameters, "link_id", Recordset.Fields("link_id")) Detail.Page = "LinkDetails.asp" link_name.SetDBValue Recordset.Fields("link_name") link_url.SetDBValue Recordset.Fields("link_url") link_cat.SetDBValue Recordset.Fields("category_name") date_add.SetDBValue Recordset.Fields("add_date") CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeShowRow", Me) RowControls.Show Recordset.MoveNext ShownRecords = ShownRecords + 1 Wend Navigator.SetDataSource Recordset StaticControls.Show End If End Sub 'End Show Method End Class 'End links Class @5-A61BA892 Class clslinksDataSource 'linksDataSource Class @5-23817085 'Variables @5-9C73379B Public Errors, Connection, Parameters, CCSEvents Public Recordset Public SQL, CountSQL, Order, Where Public RecordsCount Public PageSize Public AbsolutePage Dim WhereParameters Private CurrentOperation Private CCSEventResult, objFields ' Datasource fields Public link_name Public link_url Public link_cat Public date_add 'End Variables 'Class_Initialize Event @5-B76D4249 Private Sub Class_Initialize() Set CCSEvents = CreateObject("Scripting.Dictionary") Set objFields = New clsFields Set Recordset = New clsDataSource Set Errors = New clsErrors Set link_name = CCCreateField("link_name", "link_name", ccsText, Empty, Recordset) Set link_url = CCCreateField("link_url", "link_url", ccsText, Empty, Recordset) Set link_cat = CCCreateField("category_name", "category_name", ccsText, Empty, Recordset) Set date_add = CCCreateField("add_date", "add_date", ccsDate, Array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"), Recordset) objFields.AddFields Array(link_name, link_url, link_cat, date_add) Set Parameters = Server.CreateObject("Scripting.Dictionary") Set WhereParameters = Nothing SQL = "SELECT links.*, category_name " & _ "FROM links INNER JOIN category ON links.category_id = category.category_id" CountSQL = "SELECT COUNT(*) " & _ "FROM links INNER JOIN category ON links.category_id = category.category_id" Where = "" Order = "add_date desc" End Sub 'End Class_Initialize Event 'SetOrder Method @5-BA212669 Sub SetOrder(Column, Direction) Order = Recordset.GetOrder(Order, Column, Direction, _ Array(Array("Sorter_link_name", "link_name", ""), _ Array("Sorter_link_url", "link_url", ""), _ Array("Sorter_link_cat", "link_url", ""), _ Array("Sorter_link_date", "link_url", ""))) End Sub 'End SetOrder Method 'BuildTableWhere Method @5-2F0ABDA7 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, "urls_link_desc", ccsMemo, Empty, Empty, Empty .Criterion(1) = .Operation(opContains, False, "[link_desc]", .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 @5-02D5CB9A Function Open(Cmd) Errors.Clear Set Recordset.DataSource = Me Set Cmd.Connection = Connection Cmd.CommandOperation = cmdOpen Cmd.PageSize = PageSize Cmd.ActivePage = AbsolutePage Cmd.CommandType = dsTable CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeBuildSelect", Me) Cmd.SQL = SQL Cmd.CountSQL = CountSQL BuildTableWhere Cmd.Where = Where Cmd.OrderBy = Order CCSEventResult = CCRaiseEvent(CCSEvents, "BeforeExecuteSelect", Me) If Errors.Count = 0 Then _ Set Recordset = Cmd.Exec(Errors) CCSEventResult = CCRaiseEvent(CCSEvents, "AfterExecuteSelect", Me) Set Recordset.FieldsCollection = objFields Set Open = Recordset End Function 'End Open Method 'Class_Terminate Event @5-41B4B08D Private Sub Class_Terminate() If Recordset.State = adStateOpen Then _ Recordset.Close Set Recordset = Nothing Set Parameters = Nothing Set Errors = Nothing End Sub 'End Class_Terminate Event End Class 'End linksDataSource Class @5-A61BA892 'Include Page Implementation @17-D3201AFB %> <% 'End Include Page Implementation %>