<%@ CodePage="1252" LCID="1046" %> <% Response.Buffer = EW_RESPONSE_BUFFER %> <% Session.Timeout = 20 %> <% Call ew_Header(False, EW_CHARSET) %> <% ' Define page object Dim funcionarios_list Set funcionarios_list = New cfuncionarios_list Set Page = funcionarios_list ' Page init processing Call funcionarios_list.Page_Init() ' Page main processing Call funcionarios_list.Page_Main() %> <% If funcionarios.Export = "" Then %> <% End If %> <% If (funcionarios.Export = "") Or (EW_EXPORT_MASTER_RECORD And funcionarios.Export = "print") Then %> <% End If %> <% funcionarios_list.ShowPageHeader() %> <% ' Load recordset Set funcionarios_list.Recordset = funcionarios_list.LoadRecordset() funcionarios_list.TotalRecs = funcionarios_list.Recordset.RecordCount funcionarios_list.StartRec = 1 If funcionarios_list.DisplayRecs <= 0 Then ' Display all records funcionarios_list.DisplayRecs = funcionarios_list.TotalRecs End If If Not (funcionarios.ExportAll And funcionarios.Export <> "") Then funcionarios_list.SetUpStartRec() ' Set up start record position End If %>

<%= Language.Phrase("TblTypeTABLE") %><%= funcionarios.TableCaption %>   <% funcionarios_list.ExportOptions.Render "body", "" %>

<% If funcionarios.Export = "" And funcionarios.CurrentAction = "" Then %>  <%= Language.Phrase("Search") %>
    
<% End If %> <% funcionarios_list.ShowMessage %>
<% If funcionarios.Export = "" Then %>
<% If funcionarios.CurrentAction <> "gridadd" And funcionarios.CurrentAction <> "gridedit" Then %>
<% If Not IsObject(funcionarios_list.Pager) Then Set funcionarios_list.Pager = ew_NewPrevNextPager(funcionarios_list.StartRec, funcionarios_list.DisplayRecs, funcionarios_list.TotalRecs) %> <% If funcionarios_list.Pager.RecordCount > 0 Then %> <% If funcionarios_list.Pager.FirstButton.Enabled Then %> <% Else %> <% End If %> <% If funcionarios_list.Pager.PrevButton.Enabled Then %> <% Else %> <% End If %> <% If funcionarios_list.Pager.NextButton.Enabled Then %> <% Else %> <% End If %> <% If funcionarios_list.Pager.LastButton.Enabled Then %> <% Else %> <% End If %>
<%= Language.Phrase("Page") %>  <%= Language.Phrase(" width="16" height="16" border="0"><%= Language.Phrase(" width="16" height="16" border="0"><%= Language.Phrase(" width="16" height="16" border="0"><%= Language.Phrase(" width="16" height="16" border="0"> <%= Language.Phrase(" width="16" height="16" border="0"><%= Language.Phrase(" width="16" height="16" border="0"><%= Language.Phrase(" width="16" height="16" border="0"><%= Language.Phrase(" width="16" height="16" border="0"> <%= Language.Phrase("Of") %> <%= funcionarios_list.Pager.PageCount %>
     <%= Language.Phrase("Record") %> <%= funcionarios_list.Pager.FromIndex %> <%= Language.Phrase("To") %> <%= funcionarios_list.Pager.ToIndex %> <%= Language.Phrase("Of") %> <%= funcionarios_list.Pager.RecordCount %> <% Else %> <% If funcionarios_list.SearchWhere = "0=101" Then %> <%= Language.Phrase("EnterSearchCriteria") %> <% Else %> <%= Language.Phrase("NoRecord") %> <% End If %> <% End If %>
<% End If %> <%= Language.Phrase("AddLink") %>   <% If funcionarios_list.TotalRecs > 0 Then %> <%= Language.Phrase("DeleteSelectedLink") %>   <% End If %>
<% End If %>
<% If funcionarios_list.TotalRecs > 0 Then %> <%= funcionarios.TableCustomInnerHTML %> <% Call funcionarios_list.RenderListOptions() ' Render list options (header, left) funcionarios_list.ListOptions.Render "header", "left" %> <% If funcionarios.ID.Visible Then ' ID %> <% If funcionarios.SortUrl(funcionarios.ID) = "" Then %> <% Else %> <% End If %> <% End If %> <% If funcionarios.NOME.Visible Then ' NOME %> <% If funcionarios.SortUrl(funcionarios.NOME) = "" Then %> <% Else %> <% End If %> <% End If %> <% If funcionarios.zLOGIN.Visible Then ' LOGIN %> <% If funcionarios.SortUrl(funcionarios.zLOGIN) = "" Then %> <% Else %> <% End If %> <% End If %> <% If funcionarios.SENHA.Visible Then ' SENHA %> <% If funcionarios.SortUrl(funcionarios.SENHA) = "" Then %> <% Else %> <% End If %> <% End If %> <% ' Render list options (header, right) funcionarios_list.ListOptions.Render "header", "right" %> <% If (funcionarios.ExportAll And funcionarios.Export <> "") Then funcionarios_list.StopRec = funcionarios_list.TotalRecs Else ' Set the last record to display If funcionarios_list.TotalRecs > funcionarios_list.StartRec + funcionarios_list.DisplayRecs - 1 Then funcionarios_list.StopRec = funcionarios_list.StartRec + funcionarios_list.DisplayRecs - 1 Else funcionarios_list.StopRec = funcionarios_list.TotalRecs End If End If ' Move to first record funcionarios_list.RecCnt = funcionarios_list.StartRec - 1 If Not funcionarios_list.Recordset.Eof Then funcionarios_list.Recordset.MoveFirst If funcionarios_list.StartRec > 1 Then funcionarios_list.Recordset.Move funcionarios_list.StartRec - 1 ElseIf Not funcionarios.AllowAddDeleteRow And funcionarios_list.StopRec = 0 Then funcionarios_list.StopRec = funcionarios.GridAddRowCount End If ' Initialize Aggregate funcionarios.RowType = EW_ROWTYPE_AGGREGATEINIT Call funcionarios.ResetAttrs() Call funcionarios_list.RenderRow() funcionarios_list.RowCnt = 0 ' Output date rows Do While CLng(funcionarios_list.RecCnt) < CLng(funcionarios_list.StopRec) funcionarios_list.RecCnt = funcionarios_list.RecCnt + 1 If CLng(funcionarios_list.RecCnt) >= CLng(funcionarios_list.StartRec) Then funcionarios_list.RowCnt = funcionarios_list.RowCnt + 1 ' Set up key count funcionarios_list.KeyCount = funcionarios_list.RowIndex Call funcionarios.ResetAttrs() funcionarios.CssClass = "" If funcionarios.CurrentAction = "gridadd" Then Else Call funcionarios_list.LoadRowValues(funcionarios_list.Recordset) ' Load row values End If funcionarios.RowType = EW_ROWTYPE_VIEW ' Render view funcionarios.RowAttrs.AddAttributes Array(Array("onmouseover", "ew_MouseOver(event, this);"), Array("onmouseout", "ew_MouseOut(event, this);"), Array("onclick", "ew_Click(event, this);")) ' Render row Call funcionarios_list.RenderRow() ' Render list options Call funcionarios_list.RenderListOptions() %> > <% ' Render list options (body, left) funcionarios_list.ListOptions.Render "body", "left" %> <% If funcionarios.ID.Visible Then ' ID %> > ><%= funcionarios.ID.ListViewValue %> " id="<%= funcionarios_list.PageObjName & "_row_" & funcionarios_list.RowCnt %>"> <% End If %> <% If funcionarios.NOME.Visible Then ' NOME %> > ><%= funcionarios.NOME.ListViewValue %> <% End If %> <% If funcionarios.zLOGIN.Visible Then ' LOGIN %> > ><%= funcionarios.zLOGIN.ListViewValue %> <% End If %> <% If funcionarios.SENHA.Visible Then ' SENHA %> > ><%= funcionarios.SENHA.ListViewValue %> <% End If %> <% ' Render list options (body, right) funcionarios_list.ListOptions.Render "body", "right" %> <% End If If funcionarios.CurrentAction <> "gridadd" Then funcionarios_list.Recordset.MoveNext() End If Loop %>
<%= funcionarios.ID.FldCaption %>
<%= funcionarios.ID.FldCaption %><% If funcionarios.ID.Sort = "ASC" Then %><% ElseIf funcionarios.ID.Sort = "DESC" Then %><% End If %>
<%= funcionarios.NOME.FldCaption %>
<%= funcionarios.NOME.FldCaption %><%= Language.Phrase("SrchLegend") %><% If funcionarios.NOME.Sort = "ASC" Then %><% ElseIf funcionarios.NOME.Sort = "DESC" Then %><% End If %>
<%= funcionarios.zLOGIN.FldCaption %>
<%= funcionarios.zLOGIN.FldCaption %><%= Language.Phrase("SrchLegend") %><% If funcionarios.zLOGIN.Sort = "ASC" Then %><% ElseIf funcionarios.zLOGIN.Sort = "DESC" Then %><% End If %>
<%= funcionarios.SENHA.FldCaption %>
<%= funcionarios.SENHA.FldCaption %><% If funcionarios.SENHA.Sort = "ASC" Then %><% ElseIf funcionarios.SENHA.Sort = "DESC" Then %><% End If %>
<% End If %>
<% ' Close recordset and connection funcionarios_list.Recordset.Close Set funcionarios_list.Recordset = Nothing %> <% If funcionarios_list.TotalRecs > 0 Then %> <% If funcionarios.Export = "" Then %>
<% If funcionarios.CurrentAction <> "gridadd" And funcionarios.CurrentAction <> "gridedit" Then %>
<% If Not IsObject(funcionarios_list.Pager) Then Set funcionarios_list.Pager = ew_NewPrevNextPager(funcionarios_list.StartRec, funcionarios_list.DisplayRecs, funcionarios_list.TotalRecs) %> <% If funcionarios_list.Pager.RecordCount > 0 Then %> <% If funcionarios_list.Pager.FirstButton.Enabled Then %> <% Else %> <% End If %> <% If funcionarios_list.Pager.PrevButton.Enabled Then %> <% Else %> <% End If %> <% If funcionarios_list.Pager.NextButton.Enabled Then %> <% Else %> <% End If %> <% If funcionarios_list.Pager.LastButton.Enabled Then %> <% Else %> <% End If %>
<%= Language.Phrase("Page") %>  <%= Language.Phrase(" width="16" height="16" border="0"><%= Language.Phrase(" width="16" height="16" border="0"><%= Language.Phrase(" width="16" height="16" border="0"><%= Language.Phrase(" width="16" height="16" border="0"> <%= Language.Phrase(" width="16" height="16" border="0"><%= Language.Phrase(" width="16" height="16" border="0"><%= Language.Phrase(" width="16" height="16" border="0"><%= Language.Phrase(" width="16" height="16" border="0"> <%= Language.Phrase("Of") %> <%= funcionarios_list.Pager.PageCount %>
     <%= Language.Phrase("Record") %> <%= funcionarios_list.Pager.FromIndex %> <%= Language.Phrase("To") %> <%= funcionarios_list.Pager.ToIndex %> <%= Language.Phrase("Of") %> <%= funcionarios_list.Pager.RecordCount %> <% Else %> <% If funcionarios_list.SearchWhere = "0=101" Then %> <%= Language.Phrase("EnterSearchCriteria") %> <% Else %> <%= Language.Phrase("NoRecord") %> <% End If %> <% End If %>
<% End If %> <%= Language.Phrase("AddLink") %>   <% If funcionarios_list.TotalRecs > 0 Then %> <%= Language.Phrase("DeleteSelectedLink") %>   <% End If %>
<% End If %> <% End If %>
<% If funcionarios.Export = "" And funcionarios.CurrentAction = "" Then %> <% End If %> <% funcionarios_list.ShowPageFooter() If EW_DEBUG_ENABLED Then Response.Write ew_DebugMsg() %> <% If funcionarios.Export = "" Then %> <% End If %> <% ' Drop page object Set funcionarios_list = Nothing %> <% ' ----------------------------------------------------------------- ' Page Class ' Class cfuncionarios_list ' Page ID Public Property Get PageID() PageID = "list" End Property ' Table Name Public Property Get TableName() TableName = "funcionarios" End Property ' Page Object Name Public Property Get PageObjName() PageObjName = "funcionarios_list" End Property ' Page Name Public Property Get PageName() PageName = ew_CurrentPage() End Property ' Page Url Public Property Get PageUrl() PageUrl = ew_CurrentPage() & "?" If funcionarios.UseTokenInUrl Then PageUrl = PageUrl & "t=" & funcionarios.TableVar & "&" ' add page token End Property ' Common urls Dim AddUrl Dim EditUrl Dim CopyUrl Dim DeleteUrl Dim ViewUrl Dim ListUrl ' Export urls Dim ExportPrintUrl Dim ExportHtmlUrl Dim ExportExcelUrl Dim ExportWordUrl Dim ExportXmlUrl Dim ExportCsvUrl ' Inline urls Dim InlineAddUrl Dim InlineCopyUrl Dim InlineEditUrl Dim GridAddUrl Dim GridEditUrl Dim MultiDeleteUrl Dim MultiUpdateUrl ' Message Public Property Get Message() Message = Session(EW_SESSION_MESSAGE) End Property Public Property Let Message(v) Dim msg msg = Session(EW_SESSION_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_MESSAGE) = msg End Property Public Property Get FailureMessage() FailureMessage = Session(EW_SESSION_FAILURE_MESSAGE) End Property Public Property Let FailureMessage(v) Dim msg msg = Session(EW_SESSION_FAILURE_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_FAILURE_MESSAGE) = msg End Property Public Property Get SuccessMessage() SuccessMessage = Session(EW_SESSION_SUCCESS_MESSAGE) End Property Public Property Let SuccessMessage(v) Dim msg msg = Session(EW_SESSION_SUCCESS_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_SUCCESS_MESSAGE) = msg End Property ' Show Message Public Sub ShowMessage() Dim sMessage sMessage = Message Call Message_Showing(sMessage, "") If sMessage <> "" Then Response.Write "

" & sMessage & "

" Session(EW_SESSION_MESSAGE) = "" ' Clear message in Session ' Success message Dim sSuccessMessage sSuccessMessage = SuccessMessage Call Message_Showing(sSuccessMessage, "success") If sSuccessMessage <> "" Then Response.Write "

" & sSuccessMessage & "

" Session(EW_SESSION_SUCCESS_MESSAGE) = "" ' Clear message in Session ' Failure message Dim sErrorMessage sErrorMessage = FailureMessage Call Message_Showing(sErrorMessage, "failure") If sErrorMessage <> "" Then Response.Write "

" & sErrorMessage & "

" Session(EW_SESSION_FAILURE_MESSAGE) = "" ' Clear message in Session End Sub Dim PageHeader Dim PageFooter ' Show Page Header Public Sub ShowPageHeader() Dim sHeader sHeader = PageHeader Call Page_DataRendering(sHeader) If sHeader <> "" Then ' Header exists, display Response.Write "

" & sHeader & "

" End If End Sub ' Show Page Footer Public Sub ShowPageFooter() Dim sFooter sFooter = PageFooter Call Page_DataRendered(sFooter) If sFooter <> "" Then ' Footer exists, display Response.Write "

" & sFooter & "

" End If End Sub ' ----------------------- ' Validate Page request ' Public Function IsPageRequest() If funcionarios.UseTokenInUrl Then IsPageRequest = False If Not (ObjForm Is Nothing) Then IsPageRequest = (funcionarios.TableVar = ObjForm.GetValue("t")) End If If Request.QueryString("t").Count > 0 Then IsPageRequest = (funcionarios.TableVar = Request.QueryString("t")) End If Else IsPageRequest = True End If End Function ' ----------------------------------------------------------------- ' Class initialize ' - init objects ' - open ADO connection ' Private Sub Class_Initialize() If IsEmpty(StartTimer) Then StartTimer = Timer ' Init start time ' Initialize language object If IsEmpty(Language) Then Set Language = New cLanguage Call Language.LoadPhrases() End If ' Initialize table object If IsEmpty(funcionarios) Then Set funcionarios = New cfuncionarios Set Table = funcionarios ' Initialize urls ExportPrintUrl = PageUrl & "export=print" ExportExcelUrl = PageUrl & "export=excel" ExportWordUrl = PageUrl & "export=word" ExportHtmlUrl = PageUrl & "export=html" ExportXmlUrl = PageUrl & "export=xml" ExportCsvUrl = PageUrl & "export=csv" AddUrl = "funcionariosadd.asp" InlineAddUrl = PageUrl & "a=add" GridAddUrl = PageUrl & "a=gridadd" GridEditUrl = PageUrl & "a=gridedit" MultiDeleteUrl = "funcionariosdelete.asp" MultiUpdateUrl = "funcionariosupdate.asp" ' Initialize form object Set ObjForm = Nothing ' Intialize page id (for backward compatibility) EW_PAGE_ID = "list" ' Initialize table name (for backward compatibility) EW_TABLE_NAME = "funcionarios" ' Open connection to the database If IsEmpty(Conn) Then Call ew_Connect() ' Initialize list options Set ListOptions = New cListOptions ' Export options Set ExportOptions = New cListOptions ExportOptions.Tag = "span" ExportOptions.Separator = "  " End Sub ' ----------------------------------------------------------------- ' Subroutine Page_Init ' - called before page main ' - check Security ' - set up response header ' - call page load events ' Sub Page_Init() ' Get export parameters If Request.QueryString("export").Count > 0 Then funcionarios.Export = Request.QueryString("export") ElseIf Request.ServerVariables("HTTP_CONTENT_TYPE") = "application/x-www-form-urlencoded" Then If Request.Form("exporttype").Count > 0 Then funcionarios.Export = Request.Form("exporttype") End If Else funcionarios.ExportReturnUrl = ew_CurrentUrl() End If gsExport = funcionarios.Export ' Get export parameter, used in header gsExportFile = funcionarios.TableVar ' Get export file, used in header Dim Charset ' Charset used in header If EW_CHARSET <> "" Then Charset = ";charset=" & EW_CHARSET Else Charset = "" End If If funcionarios.Export = "excel" Then Response.ContentType = "application/vnd.ms-excel" & Charset Response.AddHeader "Content-Disposition", "attachment; filename=" & gsExportFile & ".xls" End If If funcionarios.Export = "csv" Then Response.ContentType = "application/csv" & Charset Response.AddHeader "Content-Disposition:", "attachment; filename=" & gsExportFile & ".csv" End If ' Get grid add count Dim gridaddcnt gridaddcnt = Request.QueryString(EW_TABLE_GRID_ADD_ROW_COUNT) If IsNumeric(gridaddcnt) Then If gridaddcnt > 0 Then funcionarios.GridAddRowCount = gridaddcnt End If End If ' Set up list options SetupListOptions() ' Setup export options SetupExportOptions() ' Global page loading event (in userfn7.asp) Call Page_Loading() ' Page load event, used in current page Call Page_Load() End Sub ' ----------------------------------------------------------------- ' Class terminate ' - clean up page object ' Private Sub Class_Terminate() Call Page_Terminate("") End Sub ' ----------------------------------------------------------------- ' Subroutine Page_Terminate ' - called when exit page ' - clean up ADO connection and objects ' - if url specified, redirect to url ' Sub Page_Terminate(url) ' Page unload event, used in current page Call Page_Unload() ' Global page unloaded event (in userfn60.asp) Call Page_Unloaded() Dim sRedirectUrl sReDirectUrl = url Call Page_Redirecting(sReDirectUrl) If Not (Conn Is Nothing) Then Conn.Close ' Close Connection Set Conn = Nothing Set funcionarios = Nothing Set ListOptions = Nothing Set ObjForm = Nothing ' Go to url if specified If sReDirectUrl <> "" Then If Response.Buffer Then Response.Clear Response.Redirect sReDirectUrl End If End Sub ' ' Subroutine Page_Terminate (End) ' ---------------------------------------- Dim DisplayRecs ' Number of display records Dim StartRec, StopRec, TotalRecs, RecRange Dim SearchWhere Dim RecCnt Dim EditRowCnt Dim RowCnt, RowIndex Dim RecPerRow, ColCnt Dim KeyCount Dim RowAction Dim RowOldKey ' Row old key (for copy) Dim DbMasterFilter, DbDetailFilter Dim MasterRecordExists Dim ListOptions Dim ExportOptions Dim MultiSelectKey Dim RestoreSearch Dim Recordset, OldRecordset ' ----------------------------------------------------------------- ' Page main processing ' Sub Page_Main() DisplayRecs = 20 RecRange = 10 RecCnt = 0 ' Record count KeyCount = 0 ' Key count ' Search filters Dim sSrchAdvanced, sSrchBasic, sFilter sSrchAdvanced = "" ' Advanced search filter sSrchBasic = "" ' Basic search filter SearchWhere = "" ' Search where clause sFilter = "" ' Master/Detail DbMasterFilter = "" ' Master filter DbDetailFilter = "" ' Detail filter If IsPageRequest Then ' Validate request ' Handle reset command ResetCmd() ' Hide all options If funcionarios.Export <> "" Or funcionarios.CurrentAction = "gridadd" Or funcionarios.CurrentAction = "gridedit" Then ListOptions.HideAllOptions() ExportOptions.HideAllOptions() End If ' Get basic search values Call LoadBasicSearchValues() ' Restore search parms from Session Call RestoreSearchParms() ' Call Recordset SearchValidated event Call funcionarios.Recordset_SearchValidated() ' Set Up Sorting Order SetUpSortOrder() ' Get basic search criteria If gsSearchError = "" Then sSrchBasic = BasicSearchWhere() End If End If ' End Validate Request ' Restore display records If funcionarios.RecordsPerPage <> "" Then DisplayRecs = funcionarios.RecordsPerPage ' Restore from Session Else DisplayRecs = 20 ' Load default End If ' Load Sorting Order LoadSortOrder() ' Build search criteria Call ew_AddFilter(SearchWhere, sSrchAdvanced) Call ew_AddFilter(SearchWhere, sSrchBasic) ' Call Recordset Searching event Call funcionarios.Recordset_Searching(SearchWhere) ' Save search criteria If SearchWhere <> "" Then If sSrchBasic = "" Then Call ResetBasicSearchParms() funcionarios.SearchWhere = SearchWhere ' Save to Session If Not RestoreSearch Then StartRec = 1 ' Reset start record counter funcionarios.StartRecordNumber = StartRec End If Else SearchWhere = funcionarios.SearchWhere End If sFilter = "" Call ew_AddFilter(sFilter, DbDetailFilter) Call ew_AddFilter(sFilter, SearchWhere) ' Set up filter in Session funcionarios.SessionWhere = sFilter funcionarios.CurrentFilter = "" ' Export Data only If funcionarios.Export = "html" Or funcionarios.Export = "csv" Or funcionarios.Export = "word" Or funcionarios.Export = "excel" Or funcionarios.Export = "xml" Then Call ExportData() Call Page_Terminate("") ' Clean up Response.End ' Terminate response ElseIf funcionarios.Export = "email" Then Call ExportData() Response.End End If End Sub ' ----------------------------------------------------------------- ' Return Basic Search sql ' Function BasicSearchSQL(Keyword) Dim sWhere sWhere = "" Call BuildBasicSearchSQL(sWhere, funcionarios.NOME, Keyword) Call BuildBasicSearchSQL(sWhere, funcionarios.zLOGIN, Keyword) BasicSearchSQL = sWhere End Function ' ----------------------------------------------------------------- ' Build basic search sql ' Sub BuildBasicSearchSql(Where, Fld, Keyword) Dim sFldExpression, lFldDataType Dim sWrk If Fld.FldVirtualExpression <> "" Then sFldExpression = Fld.FldVirtualExpression Else sFldExpression = Fld.FldExpression End If lFldDataType = Fld.FldDataType If Fld.FldIsVirtual Then lFldDataType = EW_DATATYPE_STRING If lFldDataType = EW_DATATYPE_NUMBER Then sWrk = sFldExpression & " = " & ew_QuotedValue(Keyword, lFldDataType) Else sWrk = sFldExpression & ew_Like(ew_QuotedValue("%" & Keyword & "%", lFldDataType)) End If If Where <> "" Then Where = Where & " OR " Where = Where & sWrk End Sub ' ----------------------------------------------------------------- ' Return Basic Search Where based on search keyword and type ' Function BasicSearchWhere() Dim sSearchStr, sSearchKeyword, sSearchType Dim sSearch, arKeyword, sKeyword sSearchStr = "" sSearchKeyword = funcionarios.BasicSearchKeyword sSearchType = funcionarios.BasicSearchType If sSearchKeyword <> "" Then sSearch = Trim(sSearchKeyword) If sSearchType <> "" Then While InStr(sSearch, " ") > 0 sSearch = Replace(sSearch, " ", " ") Wend arKeyword = Split(Trim(sSearch), " ") For Each sKeyword In arKeyword If sSearchStr <> "" Then sSearchStr = sSearchStr & " " & sSearchType & " " sSearchStr = sSearchStr & "(" & BasicSearchSQL(sKeyword) & ")" Next Else sSearchStr = BasicSearchSQL(sSearch) End If End If If sSearchKeyword <> "" then funcionarios.SessionBasicSearchKeyword = sSearchKeyword funcionarios.SessionBasicSearchType = sSearchType End If BasicSearchWhere = sSearchStr End Function ' ----------------------------------------------------------------- ' Clear all search parameters ' Sub ResetSearchParms() ' Clear search where SearchWhere = "" funcionarios.SearchWhere = SearchWhere ' Clear basic search parameters Call ResetBasicSearchParms() End Sub ' ----------------------------------------------------------------- ' Clear all basic search parameters ' Sub ResetBasicSearchParms() ' Clear basic search parameters funcionarios.SessionBasicSearchKeyword = "" funcionarios.SessionBasicSearchType = "" End Sub ' ----------------------------------------------------------------- ' Restore all search parameters ' Sub RestoreSearchParms() Dim bRestore bRestore = True If funcionarios.BasicSearchKeyword & "" <> "" Then bRestore = False RestoreSearch = bRestore If bRestore Then ' Restore basic search values funcionarios.BasicSearchKeyword = funcionarios.SessionBasicSearchKeyword funcionarios.BasicSearchType = funcionarios.SessionBasicSearchType End If End Sub ' ----------------------------------------------------------------- ' Set up Sort parameters based on Sort Links clicked ' Sub SetUpSortOrder() Dim sOrderBy Dim sSortField, sLastSort, sThisSort Dim bCtrl ' Check for an Order parameter If Request.QueryString("order").Count > 0 Then funcionarios.CurrentOrder = Request.QueryString("order") funcionarios.CurrentOrderType = Request.QueryString("ordertype") ' Field ID Call funcionarios.UpdateSort(funcionarios.ID) ' Field NOME Call funcionarios.UpdateSort(funcionarios.NOME) ' Field LOGIN Call funcionarios.UpdateSort(funcionarios.zLOGIN) ' Field SENHA Call funcionarios.UpdateSort(funcionarios.SENHA) funcionarios.StartRecordNumber = 1 ' Reset start position End If End Sub ' ----------------------------------------------------------------- ' Load Sort Order parameters ' Sub LoadSortOrder() Dim sOrderBy sOrderBy = funcionarios.SessionOrderBy ' Get order by from Session If sOrderBy = "" Then If funcionarios.SqlOrderBy <> "" Then sOrderBy = funcionarios.SqlOrderBy funcionarios.SessionOrderBy = sOrderBy End If End If End Sub ' ----------------------------------------------------------------- ' Reset command based on querystring parameter cmd= ' - RESET: reset search parameters ' - RESETALL: reset search & master/detail parameters ' - RESETSORT: reset sort parameters ' Sub ResetCmd() Dim sCmd ' Get reset cmd If Request.QueryString("cmd").Count > 0 Then sCmd = Request.QueryString("cmd") ' Reset search criteria If LCase(sCmd) = "reset" Or LCase(sCmd) = "resetall" Then Call ResetSearchParms() End If ' Reset Sort Criteria If LCase(sCmd) = "resetsort" Then Dim sOrderBy sOrderBy = "" funcionarios.SessionOrderBy = sOrderBy funcionarios.ID.Sort = "" funcionarios.NOME.Sort = "" funcionarios.zLOGIN.Sort = "" funcionarios.SENHA.Sort = "" End If ' Reset start position StartRec = 1 funcionarios.StartRecordNumber = StartRec End If End Sub ' Set up list options Sub SetupListOptions() Dim item ListOptions.Add("edit") ListOptions.GetItem("edit").CssStyle = "white-space: nowrap;" ListOptions.GetItem("edit").Visible = True ListOptions.GetItem("edit").OnLeft = True ListOptions.Add("checkbox") ListOptions.GetItem("checkbox").CssStyle = "white-space: nowrap;" ListOptions.GetItem("checkbox").Visible = True ListOptions.GetItem("checkbox").OnLeft = True ListOptions.MoveItem "checkbox", 0 ' Move to first column ListOptions.GetItem("checkbox").Header = "" Call ListOptions_Load() End Sub ' Render list options Sub RenderListOptions() Dim item, links ListOptions.LoadDefault() If ListOptions.GetItem("edit").Visible Then Set item = ListOptions.GetItem("edit") item.Body = "" & Language.Phrase("EditLink") & "" End If If ListOptions.GetItem("checkbox").Visible Then ListOptions.GetItem("checkbox").Body = "" End If Call RenderListOptionsExt() Call ListOptions_Rendered() End Sub Function RenderListOptionsExt() End Function Dim Pager ' ----------------------------------------------------------------- ' Set up Starting Record parameters based on Pager Navigation ' Sub SetUpStartRec() Dim PageNo ' Exit if DisplayRecs = 0 If DisplayRecs = 0 Then Exit Sub If IsPageRequest Then ' Validate request ' Check for a START parameter If Request.QueryString(EW_TABLE_START_REC).Count > 0 Then StartRec = Request.QueryString(EW_TABLE_START_REC) funcionarios.StartRecordNumber = StartRec ElseIf Request.QueryString(EW_TABLE_PAGE_NO).Count > 0 Then PageNo = Request.QueryString(EW_TABLE_PAGE_NO) If IsNumeric(PageNo) Then StartRec = (PageNo-1)*DisplayRecs+1 If StartRec <= 0 Then StartRec = 1 ElseIf StartRec >= ((TotalRecs-1)\DisplayRecs)*DisplayRecs+1 Then StartRec = ((TotalRecs-1)\DisplayRecs)*DisplayRecs+1 End If funcionarios.StartRecordNumber = StartRec End If End If End If StartRec = funcionarios.StartRecordNumber ' Check if correct start record counter If Not IsNumeric(StartRec) Or StartRec = "" Then ' Avoid invalid start record counter StartRec = 1 ' Reset start record counter funcionarios.StartRecordNumber = StartRec ElseIf CLng(StartRec) > CLng(TotalRecs) Then ' Avoid starting record > total records StartRec = ((TotalRecs-1)\DisplayRecs)*DisplayRecs+1 ' Point to last page first record funcionarios.StartRecordNumber = StartRec ElseIf (StartRec-1) Mod DisplayRecs <> 0 Then StartRec = ((StartRec-1)\DisplayRecs)*DisplayRecs+1 ' Point to page boundary funcionarios.StartRecordNumber = StartRec End If End Sub ' ----------------------------------------------------------------- ' Load basic search values ' Function LoadBasicSearchValues() funcionarios.BasicSearchKeyword = Request.QueryString(EW_TABLE_BASIC_SEARCH) funcionarios.BasicSearchType = Request.QueryString(EW_TABLE_BASIC_SEARCH_TYPE) End Function ' ----------------------------------------------------------------- ' Load recordset ' Function LoadRecordset() ' Call Recordset Selecting event Dim sFilter sFilter = funcionarios.CurrentFilter Call funcionarios.Recordset_Selecting(sFilter) funcionarios.CurrentFilter = sFilter ' Load list page sql Dim sSql sSql = funcionarios.ListSQL Call ew_SetDebugMsg("LoadRecordset: " & sSql) ' Show SQL for debugging ' Load recordset Dim RsRecordset Set RsRecordset = ew_LoadRecordset(sSql) ' Call Recordset Selected event Call funcionarios.Recordset_Selected(RsRecordset) Set LoadRecordset = RsRecordset End Function ' ----------------------------------------------------------------- ' Load row based on key values ' Function LoadRow() Dim RsRow, sSql, sFilter sFilter = funcionarios.KeyFilter ' Call Row Selecting event Call funcionarios.Row_Selecting(sFilter) ' Load sql based on filter funcionarios.CurrentFilter = sFilter sSql = funcionarios.SQL Call ew_SetDebugMsg("LoadRow: " & sSql) ' Show SQL for debugging Set RsRow = ew_LoadRow(sSql) If RsRow.Eof Then LoadRow = False Else LoadRow = True RsRow.MoveFirst Call LoadRowValues(RsRow) ' Load row values End If RsRow.Close Set RsRow = Nothing End Function ' ----------------------------------------------------------------- ' Load row values from recordset ' Sub LoadRowValues(RsRow) Dim sDetailFilter If RsRow.Eof Then Exit Sub ' Call Row Selected event Call funcionarios.Row_Selected(RsRow) funcionarios.ID.DbValue = RsRow("ID") funcionarios.NOME.DbValue = RsRow("NOME") funcionarios.zLOGIN.DbValue = RsRow("LOGIN") funcionarios.SENHA.DbValue = RsRow("SENHA") End Sub ' Load old record Function LoadOldRecord() ' Load key values from Session Dim bValidKey bValidKey = True If funcionarios.GetKey("ID")&"" <> "" Then funcionarios.ID.CurrentValue = funcionarios.GetKey("ID") ' ID Else bValidKey = False End If ' Load old recordset If bValidKey Then funcionarios.CurrentFilter = funcionarios.KeyFilter Dim sSql sSql = funcionarios.SQL Set OldRecordset = ew_LoadRecordset(sSql) Call LoadRowValues(OldRecordset) ' Load row values Else OldRecordset = Null End If LoadOldRecord = bValidKey End Function ' ----------------------------------------------------------------- ' Render row values based on field settings ' Sub RenderRow() ' Initialize urls ViewUrl = funcionarios.ViewUrl EditUrl = funcionarios.EditUrl("") InlineEditUrl = funcionarios.InlineEditUrl CopyUrl = funcionarios.CopyUrl("") InlineCopyUrl = funcionarios.InlineCopyUrl DeleteUrl = funcionarios.DeleteUrl ' Call Row Rendering event Call funcionarios.Row_Rendering() ' --------------------------------------- ' Common render codes for all row types ' --------------------------------------- ' ID ' NOME ' LOGIN ' SENHA ' ----------- ' View Row ' ----------- If funcionarios.RowType = EW_ROWTYPE_VIEW Then ' View row ' ID funcionarios.ID.ViewValue = funcionarios.ID.CurrentValue funcionarios.ID.CssStyle = "text-align:center;" funcionarios.ID.ViewCustomAttributes = "" ' NOME funcionarios.NOME.ViewValue = funcionarios.NOME.CurrentValue funcionarios.NOME.CssStyle = "text-align:center;" funcionarios.NOME.ViewCustomAttributes = "" ' LOGIN funcionarios.zLOGIN.ViewValue = funcionarios.zLOGIN.CurrentValue funcionarios.zLOGIN.CssStyle = "text-align:center;" funcionarios.zLOGIN.ViewCustomAttributes = "" ' SENHA funcionarios.SENHA.ViewValue = funcionarios.SENHA.CurrentValue funcionarios.SENHA.CssStyle = "text-align:center;" funcionarios.SENHA.ViewCustomAttributes = "" ' View refer script ' ID funcionarios.ID.LinkCustomAttributes = "" funcionarios.ID.HrefValue = "" funcionarios.ID.TooltipValue = "" ' NOME funcionarios.NOME.LinkCustomAttributes = "" funcionarios.NOME.HrefValue = "" funcionarios.NOME.TooltipValue = "" ' LOGIN funcionarios.zLOGIN.LinkCustomAttributes = "" funcionarios.zLOGIN.HrefValue = "" funcionarios.zLOGIN.TooltipValue = "" ' SENHA funcionarios.SENHA.LinkCustomAttributes = "" funcionarios.SENHA.HrefValue = "" funcionarios.SENHA.TooltipValue = "" End If ' Call Row Rendered event If funcionarios.RowType <> EW_ROWTYPE_AGGREGATEINIT Then Call funcionarios.Row_Rendered() End If End Sub ' Set up export options Sub SetupExportOptions() Dim item ' Printer friendly ExportOptions.Add("print") Set item = ExportOptions.GetItem("print") item.Body = "" & Language.Phrase("PrinterFriendly") & "" item.Visible = True ' Export to Excel ExportOptions.Add("excel") Set item = ExportOptions.GetItem("excel") item.Body = "" & Language.Phrase("ExportToExcel") & "" item.Visible = True ' Export to Word ExportOptions.Add("word") Set item = ExportOptions.GetItem("word") item.Body = "" & Language.Phrase("ExportToWord") & "" item.Visible = False ' Export to Html ExportOptions.Add("html") Set item = ExportOptions.GetItem("html") item.Body = "" & Language.Phrase("ExportToHtml") & "" item.Visible = False ' Export to Xml ExportOptions.Add("xml") Set item = ExportOptions.GetItem("xml") item.Body = "" & Language.Phrase("ExportToXml") & "" item.Visible = False ' Export to Csv ExportOptions.Add("csv") Set item = ExportOptions.GetItem("csv") item.Body = "" & Language.Phrase("ExportToCsv") & "" item.Visible = True ' Export to Email ExportOptions.Add("email") Set item = ExportOptions.GetItem("email") item.Body = "" & Language.Phrase("ExportToEmail") & "" item.Visible = False ' Hide options for export/action If funcionarios.Export <> "" Or funcionarios.CurrentAction <> "" Then ExportOptions.HideAllOptions() End If End Sub ' ----------------------------------------------------------------- ' Export data in HTML/CSV/Word/Excel/XML/Email format ' Sub ExportData() Dim XmlDoc Dim ExportDoc Dim ExportStyle ' Default export style ExportStyle = "h" ' Load recordset Set Rs = LoadRecordset() TotalRecs = Rs.RecordCount StartRec = 1 ' Export all If funcionarios.ExportAll Then StopRec = TotalRecs ' Export 1 page only Else SetUpStartRec() ' Set Up Start Record Position ' Set the last record to display If DisplayRecs < 0 Then StopRec = TotalRecs Else StopRec = StartRec + DisplayRecs - 1 End If End If If funcionarios.Export = "xml" Then Set XmlDoc = New cXMLDocument Else Set ExportDoc = New cExportDocument Set ExportDoc.Table = funcionarios Call ExportDoc.ChangeStyle("h") End If Dim ParentTable ParentTable = "" If funcionarios.Export = "xml" Then Call funcionarios.ExportXmlDocument(XmlDoc, (ParentTable <> ""), rs, StartRec, StopRec, "") Else Dim sHeader sHeader = PageHeader Call Page_DataRendering(sHeader) ExportDoc.Text = ExportDoc.Text & sHeader Call funcionarios.ExportDocument(ExportDoc, rs, StartRec, StopRec, "") Dim sFooter sFooter = PageFooter Call Page_DataRendered(sFooter) ExportDoc.Text = ExportDoc.Text & sFooter End If ' Close recordset and connection Rs.Close Set Rs = Nothing ' Export header and footer If funcionarios.Export <> "xml" Then Call ExportDoc.ExportHeaderAndFooter() End If If funcionarios.Export = "xml" Then XmlDoc.Output Set XmlDoc = Nothing Else If funcionarios.Export = "email" Then Call ExportEmail(ExportDoc.Text) Call Page_Terminate(funcionarios.ExportReturnUrl) Else Response.Write ExportDoc.Text End If Set ExportDoc = Nothing End If End Sub ' Page Load event Sub Page_Load() 'Response.Write "Page Load" End Sub ' Page Unload event Sub Page_Unload() 'Response.Write "Page Unload" End Sub ' Page Redirecting event Sub Page_Redirecting(url) 'url = newurl End Sub ' Message Showing event ' typ = ""|"success"|"failure" Sub Message_Showing(msg, typ) ' Example: 'If typ = "success" Then msg = "your success message" End Sub ' Page Data Rendering event Sub Page_DataRendering(header) ' Example: 'header = "your header" End Sub ' Page Data Rendered event Sub Page_DataRendered(footer) ' Example: 'footer = "your footer" End Sub ' Form Custom Validate event Function Form_CustomValidate(CustomError) 'Return error message in CustomError Form_CustomValidate = True End Function ' ListOptions Load event Sub ListOptions_Load() 'Example: ' Dim opt ' Set opt = ListOptions.Add("new") ' opt.OnLeft = True ' Link on left ' opt.MoveTo 0 ' Move to first column End Sub ' ListOptions Rendered event Sub ListOptions_Rendered() 'Example: 'ListOptions.GetItem("new").Body = "xxx" End Sub End Class %>