<%@ CodePage="65001" %> <% Response.Buffer = EW_RESPONSE_BUFFER %> <% Call ew_Header(False, EW_CHARSET) %> <% ' Define page object Dim Panorama_list Set Panorama_list = New cPanorama_list Set Page = Panorama_list ' Page init processing Panorama_list.Page_Init() ' Page main processing Panorama_list.Page_Main() ' Global Page Rendering event (in userfn*.asp) Page_Rendering() ' Page Render event Panorama_list.Page_Render() %> <% If Panorama.Export = "" Then %> <% End If %> <% If Panorama.Export = "" Then %>
<% If Panorama.Export = "" Then %> <% Breadcrumb.Render() %> <% End If %> <% If Panorama_list.TotalRecs > 0 And Panorama_list.ExportOptions.Visible Then %> <% Panorama_list.ExportOptions.Render "body", "", "", "", "", "" %> <% End If %> <% If Panorama_list.SearchOptions.Visible Then %> <% Panorama_list.SearchOptions.Render "body", "", "", "", "", "" %> <% End If %> <% If Panorama_list.FilterOptions.Visible Then %> <% Panorama_list.FilterOptions.Render "body", "", "", "", "", "" %> <% End If %> <% If Panorama.Export = "" Then %> <%= Language.SelectionForm %> <% End If %>
<% End If %> <% If Panorama.Export = "" Or EW_EXPORT_MASTER_RECORD And Panorama.Export = "print" Then %> <% End If %> <% ' Load recordset 'Set Panorama_list.Recordset = Panorama_list.LoadRecordset() Panorama_list.TotalRecs = Panorama_list.Recordset.RecordCount Panorama_list.StartRec = 1 If Panorama_list.DisplayRecs <= 0 Then ' Display all records Panorama_list.DisplayRecs = Panorama_list.TotalRecs End If If Not (Panorama.ExportAll And Panorama.Export <> "") Then Panorama_list.SetUpStartRec() ' Set up start record position End If ' Set no record found message If Panorama.CurrentAction = "" And Panorama_list.TotalRecs = 0 Then If Panorama_list.SearchWhere = "0=101" Then Panorama_list.WarningMessage = Language.Phrase("EnterSearchCriteria") Else Panorama_list.WarningMessage = Language.Phrase("NoRecord") End If End If Panorama_list.RenderOtherOptions() %> <% If Panorama.Export = "" And Panorama.CurrentAction = "" Then %>
<% SearchPanelClass = ew_IIf(Panorama_list.SearchWhere <> "", " in", " in") %>
<% End If %> <% Panorama_list.ShowPageHeader() %> <% Panorama_list.ShowMessage %> <% If Panorama_list.TotalRecs > 0 Or Panorama.CurrentAction <> "" Then %>
<% If Panorama.Export = "" Then %>
<% If Panorama.CurrentAction <> "gridadd" And Panorama.CurrentAction <> "gridedit" Then %>
<% If Not IsObject(Panorama_list.Pager) Then Set Panorama_list.Pager = ew_NewPrevNextPager(Panorama_list.StartRec, Panorama_list.DisplayRecs, Panorama_list.TotalRecs) %> <% If Panorama_list.Pager.RecordCount > 0 And Panorama_list.Pager.Visible Then %>
<%= Language.Phrase("Page") %> 
<% If Panorama_list.Pager.FirstButton.Enabled Then %> " href="<%= Panorama_list.PageUrl %>start=<%= Panorama_list.Pager.FirstButton.Start %>"> <% Else %> "> <% End If %> <% If Panorama_list.Pager.PrevButton.Enabled Then %> " href="<%= Panorama_list.PageUrl %>start=<%= Panorama_list.Pager.PrevButton.Start %>"> <% Else %> "> <% End If %>
<% If Panorama_list.Pager.NextButton.Enabled Then %> " href="<%= Panorama_list.PageUrl %>start=<%= Panorama_list.Pager.NextButton.Start %>"> <% Else %> "> <% End If %> <% If Panorama_list.Pager.LastButton.Enabled Then %> " href="<%= Panorama_list.PageUrl %>start=<%= Panorama_list.Pager.LastButton.Start %>"> <% Else %> "> <% End If %>
 <%= Language.Phrase("of") %> <%= Panorama_list.Pager.PageCount %>
<%= Language.Phrase("Record") %> <%= Panorama_list.Pager.FromIndex %> <%= Language.Phrase("To") %> <%= Panorama_list.Pager.ToIndex %> <%= Language.Phrase("Of") %> <%= Panorama_list.Pager.RecordCount %>
<% End If %>
<% End If %>
<% Panorama_list.AddEditOptions.Render "body", "", "", "", "", "" Panorama_list.DetailOptions.Render "body", "", "", "", "", "" Panorama_list.ActionOptions.Render "body", "", "", "", "", "" %>
<% End If %>
<% If Panorama_list.CheckToken Then %> <% End If %>
ewGridMiddlePanel"> <% If Panorama_list.TotalRecs > 0 Or Panorama.CurrentAction = "gridedit" Then %> <%= Panorama.TableCustomInnerHtml %> <% ' Header row Panorama.RowType = EW_ROWTYPE_HEADER Call Panorama_list.RenderListOptions() ' Render list options (header, left) Panorama_list.ListOptions.Render "header", "left", "", "", "", "" %> <% If Panorama.Jaar2C_nummer2C_datum.Visible Then ' Jaar, nummer, datum %> <% If Panorama.SortUrl(Panorama.Jaar2C_nummer2C_datum) = "" Then %> <% Else %> <% End If %> <% End If %> <% If Panorama.Bladzijde.Visible Then ' Bladzijde %> <% If Panorama.SortUrl(Panorama.Bladzijde) = "" Then %> <% Else %> <% End If %> <% End If %> <% If Panorama.Klik_op_afbeelding_voor_PDF.Visible Then ' Klik op afbeelding voor PDF %> <% If Panorama.SortUrl(Panorama.Klik_op_afbeelding_voor_PDF) = "" Then %> <% Else %> <% End If %> <% End If %> <% ' Render list options (header, right) Panorama_list.ListOptions.Render "header", "right", "", "", "", "" %> <% If Panorama.ExportAll And Panorama.Export <> "" Then Panorama_list.StopRec = Panorama_list.TotalRecs Else ' Set the last record to display If Panorama_list.TotalRecs > Panorama_list.StartRec + Panorama_list.DisplayRecs - 1 Then Panorama_list.StopRec = Panorama_list.StartRec + Panorama_list.DisplayRecs - 1 Else Panorama_list.StopRec = Panorama_list.TotalRecs End If End If ' Move to first record Panorama_list.RecCnt = Panorama_list.StartRec - 1 If Not Panorama_list.Recordset.Eof Then Panorama_list.Recordset.MoveFirst If Panorama_list.StartRec > 1 Then Panorama_list.Recordset.Move Panorama_list.StartRec - 1 ElseIf Not Panorama.AllowAddDeleteRow And Panorama_list.StopRec = 0 Then Panorama_list.StopRec = Panorama.GridAddRowCount End If ' Initialize Aggregate Panorama.RowType = EW_ROWTYPE_AGGREGATEINIT Call Panorama.ResetAttrs() Call Panorama_list.RenderRow() Panorama_list.RowCnt = 0 ' Output date rows Do While CLng(Panorama_list.RecCnt) < CLng(Panorama_list.StopRec) Panorama_list.RecCnt = Panorama_list.RecCnt + 1 If CLng(Panorama_list.RecCnt) >= CLng(Panorama_list.StartRec) Then Panorama_list.RowCnt = Panorama_list.RowCnt + 1 ' Set up key count Panorama_list.KeyCount = Panorama_list.RowIndex Call Panorama.ResetAttrs() Panorama.CssClass = "" If Panorama.CurrentAction = "gridadd" Then Else Call Panorama_list.LoadRowValues(Panorama_list.Recordset) ' Load row values End If Panorama.RowType = EW_ROWTYPE_VIEW ' Render view ' Set up row id / data-rowindex Panorama.RowAttrs.AddAttributes Array(Array("data-rowindex", Panorama_list.RowCnt), Array("id", "r" & Panorama_list.RowCnt & "_Panorama"), Array("data-rowtype", Panorama.RowType)) ' Render row Call Panorama_list.RenderRow() ' Render list options Call Panorama_list.RenderListOptions() %> > <% ' Render list options (body, left) Panorama_list.ListOptions.Render "body", "left", Panorama_list.RowCnt, "", "", "" %> <% If Panorama.Jaar2C_nummer2C_datum.Visible Then ' Jaar, nummer, datum %> <% End If %> <% If Panorama.Bladzijde.Visible Then ' Bladzijde %> <% End If %> <% If Panorama.Klik_op_afbeelding_voor_PDF.Visible Then ' Klik op afbeelding voor PDF %> <% End If %> <% ' Render list options (body, right) Panorama_list.ListOptions.Render "body", "right", Panorama_list.RowCnt, "", "", "" %> <% End If If Panorama.CurrentAction <> "gridadd" Then Panorama_list.Recordset.MoveNext() End If Loop %>
<%= Panorama.Jaar2C_nummer2C_datum.FldCaption %>
<%= Panorama.Jaar2C_nummer2C_datum.FldCaption %><%= Language.Phrase("SrchLegend") %><% If Panorama.Jaar2C_nummer2C_datum.Sort = "ASC" Then %><% ElseIf Panorama.Jaar2C_nummer2C_datum.Sort = "DESC" Then %><% End If %>
<%= Panorama.Bladzijde.FldCaption %>
<%= Panorama.Bladzijde.FldCaption %><%= Language.Phrase("SrchLegend") %><% If Panorama.Bladzijde.Sort = "ASC" Then %><% ElseIf Panorama.Bladzijde.Sort = "DESC" Then %><% End If %>
<%= Panorama.Klik_op_afbeelding_voor_PDF.FldCaption %>
<%= Panorama.Klik_op_afbeelding_voor_PDF.FldCaption %><% If Panorama.Klik_op_afbeelding_voor_PDF.Sort = "ASC" Then %><% ElseIf Panorama.Klik_op_afbeelding_voor_PDF.Sort = "DESC" Then %><% End If %>
> > <%= Panorama.Jaar2C_nummer2C_datum.ListViewValue %> ">> > <%= Panorama.Bladzijde.ListViewValue %> > <%= ew_GetImgViewTag(Panorama.Klik_op_afbeelding_voor_PDF, Panorama.Klik_op_afbeelding_voor_PDF.ListViewValue) %>
<% End If %> <% If Panorama.CurrentAction = "" Then %> <% End If %>
<% ' Close recordset and connection Panorama_list.Recordset.Close Set Panorama_list.Recordset = Nothing %> <% If Panorama.Export = "" Then %> <% End If %>
<% End If %> <% If Panorama_list.TotalRecs = 0 And Panorama.CurrentAction = "" Then ' Show other options %>
<% Panorama_list.AddEditOptions.Render "body", "", "", "", "", "" Panorama_list.DetailOptions.Render "body", "", "", "", "", "" Panorama_list.ActionOptions.Render "body", "", "", "", "", "" %>
<% End If %> <% If Panorama.Export <> "" Then %> <% End If %> <% If Panorama.Export = "" Then %> <% End If %> <% Panorama_list.ShowPageFooter() If EW_DEBUG_ENABLED Then Response.Write ew_DebugMsg() %> <% If Panorama.Export = "" Then %> <% End If %> <% ' Clean up and drop page object Call Panorama_list.Page_Terminate("") Set Panorama_list = Nothing %> <% ' ----------------------------------------------------------------- ' Page Class ' Class cPanorama_list ' Page ID Public Property Get PageID() PageID = "list" End Property ' Project ID Public Property Get ProjectID() ProjectID = "{605938BF-07B5-4FA1-89F8-A44200B8B235}" End Property ' Table Name Public Property Get TableName() TableName = "Panorama" End Property ' Page Object Name Public Property Get PageObjName() PageObjName = "Panorama_list" End Property ' Grid form hidden field names Dim FormName Dim FormActionName Dim FormKeyName Dim FormOldKeyName Dim FormBlankRowName Dim FormKeyCountName ' Page Name Public Property Get PageName() PageName = ew_CurrentPage() End Property ' Page Url Public Property Get PageUrl() PageUrl = ew_CurrentPage() & "?" If Panorama.UseTokenInUrl Then PageUrl = PageUrl & "t=" & Panorama.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 Dim ExportPdfUrl ' Custom export Dim ExportExcelCustom Dim ExportWordCustom Dim ExportPdfCustom Dim ExportEmailCustom ' 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 Public Property Get WarningMessage() WarningMessage = Session(EW_SESSION_WARNING_MESSAGE) End Property Public Property Let WarningMessage(v) Dim msg msg = Session(EW_SESSION_WARNING_MESSAGE) Call ew_AddMessage(msg, v) Session(EW_SESSION_WARNING_MESSAGE) = msg End Property ' Methods to clear message Public Sub ClearMessage() Session(EW_SESSION_MESSAGE) = "" End Sub Public Sub ClearFailureMessage() Session(EW_SESSION_FAILURE_MESSAGE) = "" End Sub Public Sub ClearSuccessMessage() Session(EW_SESSION_SUCCESS_MESSAGE) = "" End Sub Public Sub ClearWarningMessage() Session(EW_SESSION_WARNING_MESSAGE) = "" End Sub Public Sub ClearMessages() Session(EW_SESSION_MESSAGE) = "" Session(EW_SESSION_FAILURE_MESSAGE) = "" Session(EW_SESSION_SUCCESS_MESSAGE) = "" Session(EW_SESSION_WARNING_MESSAGE) = "" End Sub ' Show Message Public Sub ShowMessage() Dim hidden, html, sMessage hidden = False html = "" ' Message sMessage = Message Call Message_Showing(sMessage, "") If sMessage <> "" Then ' Message in Session, display If Not hidden Then sMessage = "" & sMessage html = html & "
" & sMessage & "
" Session(EW_SESSION_MESSAGE) = "" ' Clear message in Session End If ' Warning message Dim sWarningMessage sWarningMessage = WarningMessage Call Message_Showing(sWarningMessage, "warning") If sWarningMessage <> "" Then ' Message in Session, display If Not hidden Then sWarningMessage = "" & sWarningMessage html = html & "
" & sWarningMessage & "
" Session(EW_SESSION_WARNING_MESSAGE) = "" ' Clear message in Session End If ' Success message Dim sSuccessMessage sSuccessMessage = SuccessMessage Call Message_Showing(sSuccessMessage, "success") If sSuccessMessage <> "" Then ' Message in Session, display If Not hidden Then sSuccessMessage = "" & sSuccessMessage html = html & "
" & sSuccessMessage & "
" Session(EW_SESSION_SUCCESS_MESSAGE) = "" ' Clear message in Session End If ' Failure message Dim sErrorMessage sErrorMessage = FailureMessage Call Message_Showing(sErrorMessage, "failure") If sErrorMessage <> "" Then ' Message in Session, display If Not hidden Then sErrorMessage = "" & sErrorMessage html = html & "
" & sErrorMessage & "
" Session(EW_SESSION_FAILURE_MESSAGE) = "" ' Clear message in Session End If Response.Write "
" & html & "
" 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 Panorama.UseTokenInUrl Then IsPageRequest = False If Not (ObjForm Is Nothing) Then IsPageRequest = (Panorama.TableVar = ObjForm.GetValue("t")) End If If Request.QueryString("t").Count > 0 Then IsPageRequest = (Panorama.TableVar = Request.QueryString("t")) End If Else IsPageRequest = True End If End Function Dim Token Dim CheckToken Dim TokenTimeout ' Valid Post Function ValidPost() If Not CheckToken Or Not ew_IsHttpPost() Then ValidPost = True Exit Function End If If Request.Form(EW_TOKEN_NAME).Count = 0 Then ValidPost = False Exit Function End If ValidPost = ew_CheckToken(Request.Form(EW_TOKEN_NAME),TokenTimeout) End Function ' Create Token Sub CreateToken() If CheckToken And Token = "" Then Token = ew_CreateToken() gsToken = Token ' Save to global variable End If End Sub ' ----------------------------------------------------------------- ' Class initialize ' - init objects ' - open ADO connection ' Private Sub Class_Initialize() If IsEmpty(StartTimer) Then StartTimer = Timer ' Init start time ' Grid form hidden field names FormName = "fPanoramalist" FormActionName = "k_action" FormKeyName = "k_key" FormOldKeyName = "k_oldkey" FormBlankRowName = "k_blankrow" FormKeyCountName = "key_count" ' Check Token Token = "" CheckToken = EW_CHECK_TOKEN TokenTimeout = 0 TokenTimeout = ew_SessionTimeoutTime() ' Initialize language object If IsEmpty(Language) Then Set Language = New cLanguage Call Language.LoadPhrases() End If ' Initialize table object If IsEmpty(Panorama) Then Set Panorama = New cPanorama Set Table = Panorama ExportExcelCustom = False ExportWordCustom = False ExportPdfCustom = True ' Always use ew_ApplyTemplate ExportEmailCustom = True ' Always use ew_ApplyTemplate ' 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" ExportPdfUrl = PageUrl & "export=pdf" AddUrl = "Panoramaadd.asp" InlineAddUrl = PageUrl & "a=add" GridAddUrl = PageUrl & "a=gridadd" GridEditUrl = PageUrl & "a=gridedit" MultiDeleteUrl = "Panoramadelete.asp" MultiUpdateUrl = "Panoramaupdate.asp" ' Initialize form object Set ObjForm = Nothing ' Get resize object ew_GetResizeObj() ' Intialize page id (for backward compatibility) EW_PAGE_ID = "list" ' Initialize table name (for backward compatibility) EW_TABLE_NAME = "Panorama" ' Open connection to the database If IsEmpty(Conn) Then Set Conn = ew_Connect(Panorama.TableDBID) ' List options Set ListOptions = New cListOptions ListOptions.TableVar = Panorama.TableVar ' Export options Set ExportOptions = New cListOptions ExportOptions.TableVar = Panorama.TableVar ExportOptions.Tag = "div" ExportOptions.TagClassName = "ewExportOption" ' Other options Set AddEditOptions = New cListOptions AddEditOptions.Tag = "div" AddEditOptions.TagClassName = "ewAddEditOption" Set DetailOptions = New cListOptions DetailOptions.Tag = "div" DetailOptions.TagClassName = "ewDetailOption" Set ActionOptions = New cListOptions ActionOptions.Tag = "div" ActionOptions.TagClassName = "ewActionOption" ' Filter options Set FilterOptions = New cListOptions FilterOptions.Tag = "div" FilterOptions.TagClassName = "ewFilterOption fPanoramalistsrch" ' List actions Set ListActions = New cListActions End Sub ' ----------------------------------------------------------------- ' Subroutine Page_Init ' - called before page main ' - check Security ' - set up response header ' - call page load events ' Sub Page_Init() ' Get grid add count Dim gridaddcnt gridaddcnt = Request.QueryString(EW_TABLE_GRID_ADD_ROW_COUNT) If IsNumeric(gridaddcnt) Then If gridaddcnt > 0 Then Panorama.GridAddRowCount = gridaddcnt End If End If ' Set up list options SetupListOptions() Call Panorama.Jaar2C_nummer2C_datum.SetVisibility(Panorama) Call Panorama.Bladzijde.SetVisibility(Panorama) Call Panorama.Klik_op_afbeelding_voor_PDF.SetVisibility(Panorama) ' Global page loading event (in userfn*.asp) Page_Loading() ' Page load event, used in current page Page_Load() ' Check token If Not ValidPost() Then Response.Write Language.Phrase("InvalidPostRequest") Call Page_Terminate("") Response.End End If ' Process auto fill Dim results If Request.Form("ajax") = "autofill" Then results = Panorama.GetAutoFill(Request.Form("name"), Request.Form("q")) If results <> "" Then ' Clean output buffer If Response.Buffer Then Response.Clear Response.Write results Call Page_Terminate("") Response.End End If End If ' Create Token CreateToken() ' Setup other options SetupOtherOptions() ' Set up custom action (compatible with old version) Dim sKey, sAction For i = 0 to UBound(Panorama.CustomActions.CustomArray) sAction = Panorama.CustomActions.CustomArray(i)(1) sKey = Panorama.CustomActions.CustomArray(i)(0) Call ListActions.Add(sKey, sAction, True, EW_ACTION_POSTBACK, EW_ACTION_MULTIPLE, "", "glyphicon glyphicon-star ewIcon") Next ' Show checkbox column if multiple action Dim listact For i = 0 to ListActions.Count - 1 Set listact = ListActions.GetItem(i) If listact.SelectType = EW_ACTION_MULTIPLE And listact.Allow Then ListOptions.GetItem("checkbox").Visible = True Exit For End If Next 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) If Request.Form("customexport")&"" = "" Then ' Page unload event, used in current page Call Page_Unload() ' Global page unloaded event (in userfn*.asp) Call Page_Unloaded() End If ' Export If Not Panorama Is Nothing Then If Panorama.Export <> "" And Request.Form("data").Count > 0 Then Dim sContent sContent = Request.Form("data") gsExportFile = Request.Form("filename") If gsExportFile = "" Then gsExportFile = Panorama.TableVar If Panorama.Export = "pdf" Then Call ExportPdf(sContent) ElseIf Panorama.Export = "email" Then Response.Write ExportEmail(sContent) ElseIf Panorama.Export = "excel" Then Call ExportExcel(sContent) ElseIf Panorama.Export = "word" Then Call ExportWord(sContent) End If End If End If Dim sRedirectUrl sRedirectUrl = url Call Page_Redirecting(sRedirectUrl) Call ew_CloseConn() ' Close Connection Set Panorama = Nothing Set ListOptions = Nothing Set ObjForm = Nothing Set gResizeObj = Nothing ' Go to url if specified If gsExport & "" = "" Then If sRedirectUrl <> "" Then If Response.Buffer Then Response.Clear Response.Redirect sRedirectUrl End If End If End Sub ' ' Subroutine Page_Terminate (End) ' ---------------------------------------- Dim ListOptions ' List options Dim ExportOptions ' Export options Dim SearchOptions ' Search options Dim AddEditOptions ' Other options (add edit) Dim DetailOptions ' Other options (detail) Dim ActionOptions ' Other options (action) Dim FilterOptions ' Filter options Dim ListActions ' List actions Dim SelectedCount Dim SelectedIndex Dim DisplayRecs ' Number of display records Dim StartRec, StopRec, TotalRecs, RecRange Dim DefaultSearchWhere ' Default search WHERE clause Dim SearchWhere Dim RecCnt Dim EditRowCnt Dim StartRowCnt Dim RowCnt, RowIndex Dim Attrs Dim RecPerRow Dim MultiColumnClass Dim MultiColumnEditClass Dim MultiColumnCnt Dim MultiColumnEditCnt Dim GridCnt Dim ColCnt Dim KeyCount Dim RowAction Dim RowOldKey ' Row old key (for copy) Dim DbMasterFilter, DbDetailFilter Dim MasterRecordExists Dim MultiSelectKey Dim Command Dim RestoreSearch Dim Recordset, OldRecordset, DetailPages ' ----------------------------------------------------------------- ' Page main processing ' Sub Page_Main() SelectedCount = 0 SelectedIndex = 0 DisplayRecs = 5 RecRange = 10 RecCnt = 0 ' Record count KeyCount = 0 ' Key count StartRowCnt = 1 ' Search filters Dim sSrchAdvanced, sSrchBasic, sFilter sSrchAdvanced = "" ' Advanced search filter sSrchBasic = "" ' Basic search filter SearchWhere = "" ' Search where clause DefaultSearchWhere = "" sFilter = "" ' Restore search RestoreSearch = False ' Get command Command = LCase(Request.QueryString("cmd")&"") ' Master/Detail DbMasterFilter = "" ' Master filter DbDetailFilter = "" ' Detail filter If IsPageRequest Then ' Validate request ' Process list action first If ProcessListAction() Then ' Ajax request Call Page_Terminate("") Response.End End If ' Handle reset command ResetCmd() ' Set up Breadcrumb If Panorama.Export = "" Then SetupBreadcrumb() End If ' Hide list options If Panorama.Export <> "" Then Call ListOptions.HideAllOptions(Array("sequence")) ListOptions.UseDropDownButton = False ' Disable drop down button ListOptions.UseButtonGroup = False ' Disable button group ElseIf Panorama.CurrentAction = "gridadd" Or Panorama.CurrentAction = "gridedit" Then Call ListOptions.HideAllOptions(Array()) ListOptions.UseDropDownButton = False ' Disable drop down button ListOptions.UseButtonGroup = False ' Disable button group End If ' Hide options If Panorama.Export <> "" Or Panorama.CurrentAction <> "" Then ExportOptions.HideAllOptions(Array()) FilterOptions.HideAllOptions(Array()) End If ' Hide other options If Panorama.Export <> "" Then AddEditOptions.HideAllOptions(Array()) DetailOptions.HideAllOptions(Array()) ActionOptions.HideAllOptions(Array()) End If ' Get default search criteria Call ew_AddFilter(DefaultSearchWhere, BasicSearchWhere(True)) ' Get basic search values Call LoadBasicSearchValues() ' Restore filter list Call ProcessFilterList() ' Restore search parms from Session if not searching / reset / export If Panorama.Export <> "" Or Command <> "search" And Command <> "reset" And Command <> "resetall" And CheckSearchParms() Then Call RestoreSearchParms() End If ' Call Recordset SearchValidated event Call Panorama.Recordset_SearchValidated() ' Set Up Sorting Order SetUpSortOrder() ' Get basic search criteria If gsSearchError = "" Then sSrchBasic = BasicSearchWhere(False) End If End If ' End Validate Request ' Restore display records If Panorama.RecordsPerPage <> "" Then DisplayRecs = Panorama.RecordsPerPage ' Restore from Session Else DisplayRecs = 5 ' Load default End If ' Load Sorting Order LoadSortOrder() ' Load search default if no existing search criteria If Not CheckSearchParms() Then ' Load basic search from default Panorama.BasicSearch.Keyword = Panorama.BasicSearch.KeywordDefault Panorama.BasicSearch.SearchType = Panorama.BasicSearch.SearchTypeDefault Panorama.BasicSearch.setSearchType(Panorama.BasicSearch.SearchTypeDefault) If Panorama.BasicSearch.Keyword <> "" Then sSrchBasic = BasicSearchWhere(False) End If End If ' Build search criteria Call ew_AddFilter(SearchWhere, sSrchAdvanced) Call ew_AddFilter(SearchWhere, sSrchBasic) ' Call Recordset Searching event Call Panorama.Recordset_Searching(SearchWhere) ' Save search criteria If Command = "search" And Not RestoreSearch Then Panorama.SearchWhere = SearchWhere ' Save to Session StartRec = 1 ' Reset start record counter Panorama.StartRecordNumber = StartRec Else SearchWhere = Panorama.SearchWhere End If sFilter = "" Call ew_AddFilter(sFilter, DbDetailFilter) Call ew_AddFilter(sFilter, SearchWhere) ' Set up filter in Session Panorama.SessionWhere = sFilter Panorama.CurrentFilter = "" ' Load record count first Set Recordset = LoadRecordset() TotalRecs = Recordset.RecordCount ' Search options SetupSearchOptions() End Sub ' ----------------------------------------------------------------- ' Build filter for all keys ' Function BuildKeyFilter() Dim rowindex, sThisKey Dim sKey Dim sWrkFilter, sFilter sWrkFilter = "" ' Update row index and get row key rowindex = 1 ObjForm.Index = rowindex sThisKey = ObjForm.GetValue("k_key") & "" Do While (sThisKey <> "") If SetupKeyValues(sThisKey) Then sFilter = Panorama.KeyFilter If sWrkFilter <> "" Then sWrkFilter = sWrkFilter & " OR " sWrkFilter = sWrkFilter & sFilter Else sWrkFilter = "0=1" Exit Do End If ' Update row index and get row key rowindex = rowindex + 1 ' Next row ObjForm.Index = rowindex sThisKey = ObjForm.GetValue("k_key") & "" Loop BuildKeyFilter = sWrkFilter End Function ' ----------------------------------------------------------------- ' Set up key values ' Function SetupKeyValues(key) Dim arrKeyFlds arrKeyFlds = Split(key&"", EW_COMPOSITE_KEY_SEPARATOR) If UBound(arrKeyFlds) >= 0 Then Panorama.Id.FormValue = arrKeyFlds(0) If Not IsNumeric(Panorama.Id.FormValue) Then SetupKeyValues = False Exit Function End If End If SetupKeyValues = True End Function ' Get list of filters Function GetFilterList() ' Initialize Dim sFilterList, sWrk, sSavedFilterList ' Load server side filters If EW_SEARCH_FILTER_OPTION = "Server" Then sSavedFilterList = UserProfile.GetSearchFilters(CurrentUserName(), "fPanoramalistsrch") Else sSavedFilterList = "" End If sFilterList = "" If Panorama.BasicSearch.Keyword <> "" Then sWrk = """" & EW_TABLE_BASIC_SEARCH & """:""" & ew_JsEncode2(Panorama.BasicSearch.Keyword) & """,""" & EW_TABLE_BASIC_SEARCH_TYPE & """:""" & ew_JsEncode2(Panorama.BasicSearch.SearchType) & """" sFilterList = ew_Concat(sFilterList, sWrk, ",") End If Dim regEx Set regex = New RegExp regex.IgnoreCase = True regex.Pattern = ",$" sFilterList = regEx.Replace(sFilterList, "") ' Return filter list in json If sFilterList <> "" Then sFilterList = """data"":{" & sFilterList & "}" End If If sSavedFilterList <> "" Then If sFilterList <> "" Then sFilterList = sFilterList & "," End If sFilterList = sFilterList & """filters"":" & sSavedFilterList End If GetFilterList = ew_IIf(sFilterList <> "", "{" & sFilterList & "}" , "null") End Function ' Process filter list Sub ProcessFilterList() Dim filters, result If Request.Form("ajax") = "savefilters" Then filters = Request.Form("filters") Call UserProfile.SetSearchFilters(CurrentUserName(), "fPanoramalistsrch", filters) ' Clean output buffer If Response.Buffer Then Response.Clear ReDim result(0,0) result(0,0) = Array("success", True) Response.Write ew_ArrayToJson(result, 0) Call Page_Terminate("") Response.End ElseIf Request.Form("cmd") = "resetfilter" Then Call RestoreFilterList() End If End Sub ' Restore list of filters Function RestoreFilterList() Dim filter ' Return if not reset filter If Request.Form("cmd") & "" <> "resetfilter" Then RestoreFilterList = False Exit Function End If If Request.form("filter").Count > 0 Then Set filter = ew_JsonDecode(Request.Form("filter"), True) Command = "search" If filter.Exists(EW_TABLE_BASIC_SEARCH) Then Panorama.BasicSearch.setKeyword(filter(EW_TABLE_BASIC_SEARCH)) End If If filter.Exists(EW_TABLE_BASIC_SEARCH_TYPE) Then Panorama.BasicSearch.setSearchType(filter(EW_TABLE_BASIC_SEARCH_TYPE)) End If filter.RemoveAll Set filter = Nothing End If End Function ' ----------------------------------------------------------------- ' Return Basic Search sql ' Function BasicSearchSQL(arKeywords, typ) Dim sWhere sWhere = "" Call BuildBasicSearchSQL(sWhere, Panorama.Jaar2C_nummer2C_datum, arKeywords, typ) Call BuildBasicSearchSQL(sWhere, Panorama.Bladzijde, arKeywords, typ) Call BuildBasicSearchSQL(sWhere, Panorama.Tekst_per_bladzijde, arKeywords, typ) BasicSearchSQL = sWhere End Function ' ----------------------------------------------------------------- ' Build basic search sql ' Sub BuildBasicSearchSQL(Where, Fld, arKeywords, typ) Dim sDefcond, arSQL, arCond, cnt, i, j, ar Dim Keyword, sWrk, sFldExpression, bQuoted, sSql sDefCond = ew_IIf(typ = "OR", "OR", "AND") arSQL = Array() ' Array for SQL parts arCond = Array() ' Array for search conditions cnt = UBound(arKeywords)+1 j = 0 ' Number of SQL parts For i = 0 to cnt-1 Keyword = arKeywords(i) Keyword = Trim(Keyword) If EW_BASIC_SEARCH_IGNORE_PATTERN <> "" Then Keyword = ew_RegExReplace(EW_BASIC_SEARCH_IGNORE_PATTERN, Keyword, "\") ar = Split(Keyword, "\") Else ar = Array(Keyword) End If For Each Keyword In ar If Keyword <> "" Then sWrk = "" If Keyword = "OR" And typ = "" Then If j > 0 Then arCond(j-1) = "OR" End If ElseIf Keyword = EW_NULL_VALUE Then sWrk = Fld.FldExpression & " IS NULL" ElseIf Keyword = EW_NOT_NULL_VALUE Then sWrk = Fld.FldExpression & " IS NOT NULL" ElseIf Fld.FldIsVirtual Then sWrk = Fld.FldVirtualExpression & ew_Like(ew_QuotedValueBase("%" & Keyword & "%", EW_DATATYPE_STRING, Panorama.TableDBID), Panorama.TableDBID) ElseIf Fld.FldDataType <> EW_DATATYPE_NUMBER Or IsNumeric(Keyword) Then sWrk = Fld.FldBasicSearchExpression & ew_Like(ew_QuotedValueBase("%" & Keyword & "%", EW_DATATYPE_STRING, Panorama.TableDBID), Panorama.TableDBID) End If If sWrk <> "" Then If j > 0 Then ReDim Preserve arSQL(j) ReDim Preserve arCond(j) Else ReDim arSQL(0) ReDim arCond(0) End If arSQL(j) = sWrk arCond(j) = sDefCond j = j + 1 End If End If Next Next cnt = UBound(arSQL)+1 bQuoted = False sSql = "" If cnt > 0 Then For i = 0 to cnt-2 If arCond(i) = "OR" Then If Not bQuoted Then sSql = sSql & "(" bQuoted = True End If sSql = sSql & arSQL(i) If bQuoted And arCond(i) <> "OR" Then sSql = sSql & ")" bQuoted = False End If sSql = sSql & " " & arCond(i) & " " Next sSql = sSql & arSQL(cnt-1) If bQuoted Then sSql = sSql & ")" End If End If If sSql <> "" Then If Where <> "" Then Where = Where & " OR " Where = Where & "(" & sSql & ")" End If End Sub ' ----------------------------------------------------------------- ' Return Basic Search Where based on search keyword and type ' Function BasicSearchWhere(Default) Dim sSearchStr, sSearchKeyword, sSearchType Dim sSearch, arKeyword, sKeyword, ar, Match, Matches, p, str, i sSearchStr = "" sSearchKeyword = ew_IIf(Default, Panorama.BasicSearch.KeywordDefault, Panorama.BasicSearch.Keyword) sSearchType = ew_IIf(Default, Panorama.BasicSearch.SearchTypeDefault, Panorama.BasicSearch.SearchType) If sSearchKeyword <> "" Then sSearch = Trim(sSearchKeyword) If sSearchType <> "=" Then ' Match quoted keywords (i.e.: "...") If ew_RegExMatch("""([^""]*)""", sSearch, Matches) Then For Each Match in Matches p = InStr(sSearch, Match.SubMatches(0)) str = Mid(sSearch, 1, p-2) sSearch = Mid(sSearch, p + Len(Match.SubMatches(0)) + 1) If Len(Trim(str)) > 0 Then ar = ew_ArrayMerge(ar, Split(Trim(str), " ")) End If ar = ew_ArrayMerge(ar, Array(Match.SubMatches(0))) ' Save quoted keyword Next End If ' Match individual keywords If Len(Trim(sSearch)) > 0 Then ar = ew_ArrayMerge(ar, Split(Trim(sSearch), " ")) End If ' Search keyword in any fields If (sSearchType = "OR" Or sSearchType = "AND") And Panorama.BasicSearch.BasicSearchAnyFields Then For i = 0 to UBound(ar) sKeyword = ar(i) If sKeyword <> "" Then If sSearchStr <> "" Then sSearchStr = sSearchStr & " " & sSearchType & " " sSearchStr = sSearchStr & "(" & BasicSearchSQL(Array(sKeyword), sSearchType) & ")" End If Next Else sSearchStr = BasicSearchSQL(ar, sSearchType) End If Else sSearchStr = BasicSearchSQL(Array(sSearch), sSearchType) End If If Not Default Then Command = "search" End If If Not Default And Command = "search" Then Panorama.BasicSearch.setKeyword(sSearchKeyword) Panorama.BasicSearch.setSearchType(sSearchType) End If BasicSearchWhere = sSearchStr End Function ' Check if search parm exists Function CheckSearchParms() ' Check basic search If Panorama.BasicSearch.IssetSession() Then CheckSearchParms = True Exit Function End If CheckSearchParms = False End Function ' Clear all search parameters Sub ResetSearchParms() ' Clear search where SearchWhere = "" Panorama.SearchWhere = SearchWhere ' Clear basic search parameters Call ResetBasicSearchParms() End Sub ' Load advanced search default values Function LoadAdvancedSearchDefault() LoadAdvancedSearchDefault = False End Function ' Clear all basic search parameters Sub ResetBasicSearchParms() Panorama.BasicSearch.UnsetSession() End Sub ' ----------------------------------------------------------------- ' Restore all search parameters ' Sub RestoreSearchParms() ' Restore search flag RestoreSearch = True ' Restore basic search values Call Panorama.BasicSearch.Load() 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 Panorama.CurrentOrder = Request.QueryString("order") Panorama.CurrentOrderType = Request.QueryString("ordertype") ' Field Jaar, nummer, datum Call Panorama.UpdateSort(Panorama.Jaar2C_nummer2C_datum) ' Field Bladzijde Call Panorama.UpdateSort(Panorama.Bladzijde) ' Field Klik op afbeelding voor PDF Call Panorama.UpdateSort(Panorama.Klik_op_afbeelding_voor_PDF) Panorama.StartRecordNumber = 1 ' Reset start position End If End Sub ' ----------------------------------------------------------------- ' Load Sort Order parameters ' Sub LoadSortOrder() Dim sOrderBy sOrderBy = Panorama.SessionOrderBy ' Get order by from Session If sOrderBy = "" Then If Panorama.SqlOrderBy <> "" Then sOrderBy = Panorama.SqlOrderBy Panorama.SessionOrderBy = sOrderBy Panorama.Klik_op_afbeelding_voor_PDF.Sort = "ASC" Panorama.Bladzijde.Sort = "ASC" 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() ' Check if reset command If Left(Command,5) = "reset" Then ' Reset search criteria If Command = "reset" Or Command = "resetall" Then Call ResetSearchParms() End If ' Reset Sort Criteria If Command = "resetsort" Then Dim sOrderBy sOrderBy = "" Panorama.SessionOrderBy = sOrderBy Panorama.Jaar2C_nummer2C_datum.Sort = "" Panorama.Bladzijde.Sort = "" Panorama.Klik_op_afbeelding_voor_PDF.Sort = "" End If ' Reset start position StartRec = 1 Panorama.StartRecordNumber = StartRec End If End Sub ' Set up list options Sub SetupListOptions() Dim item ' Add group option item ListOptions.Add(ListOptions.GroupOptionName) Set item = ListOptions.GetItem(ListOptions.GroupOptionName) item.Body = "" item.OnLeft = False item.Visible = False ' List actions ListOptions.Add("listactions") Set item = ListOptions.GetItem("listactions") item.CssStyle = "white-space: nowrap;" item.OnLeft = False item.Visible = FALSE item.ShowInButtonGroup = FALSE item.ShowInDropDown = FALSE ' Checkbox ListOptions.Add("checkbox") Set item = ListOptions.GetItem("checkbox") item.Visible = False item.OnLeft = False item.Header = "" item.ShowInDropDown = False item.ShowInButtonGroup = False ' Drop down button for ListOptions ListOptions.UseImageAndText = True ListOptions.UseDropDownButton = False ListOptions.DropDownButtonPhrase = Language.Phrase("ButtonListOptions") ListOptions.UseButtonGroup = False If ListOptions.UseButtonGroup And ew_IsMobile() Then ListOptions.UseDropDownButton = True End If ListOptions.ButtonClass = "btn-sm" ' Class for button group Call ListOptions_Load() Call SetupListOptionsExt() ' Set up group item visibility ListOptions.GetItem(ListOptions.GroupOptionName).Visible = ListOptions.GroupOptionVisible End Sub ' Render list options Sub RenderListOptions() Dim item, links, cancelurl ListOptions.LoadDefault() ' Set up list action buttons Dim oListOpt, body, content, link Dim listact, action, caption, icon Set oListOpt = ListOptions.GetItem("listactions") If Not oListOpt Is Nothing And Panorama.Export = "" And Panorama.CurrentAction = "" Then body = "" links = Array() For i = 0 to ListActions.Count - 1 Set listact = ListActions.GetItem(i) If listact.SelectType = EW_ACTION_SINGLE And listact.Allow Then action = listact.Action caption = listact.Caption icon = ew_IIf(listact.Icon <> "", " " , "") If UBound(links) < 0 Then ReDim links(0) Else ReDim Preserve links(UBound(links)+1) End If links(UBound(links)) = "
  • " & icon & listact.Caption & "
  • " If UBound(links) = 0 Then ' Single button body = "" & Language.Phrase("ListActionButton") & "" End If End If Next If UBound(links) > 0 Then ' More than one buttons, use dropdown body = "" content = "" For Each link in links content = content & "
  • " & link & "
  • " Next body = body & "" body = "
    " & body & "
    " End If If UBound(links) >= 0 Then oListOpt.Body = body oListOpt.Visible = True End If End If ListOptions.GetItem("checkbox").Body = "" Call RenderListOptionsExt() Call ListOptions_Rendered() End Sub ' Set up other options Sub SetupOtherOptions() Dim opt, item, DetailTableLink, ar, i, caption, url, addcaption Set opt = ActionOptions ' Set up options default Set opt = AddEditOptions opt.UseImageAndText = True opt.DropDownButtonPhrase = Language.Phrase("ButtonAddEdit") opt.UseDropDownButton = False opt.UseButtonGroup = True opt.ButtonClass = "btn-sm" ' Class for button group Call opt.Add(opt.GroupOptionName) Set item = opt.GetItem(opt.GroupOptionName) item.Body = "" item.Visible = False Set opt = DetailOptions opt.UseImageAndText = True opt.DropDownButtonPhrase = Language.Phrase("ButtonDetails") opt.UseDropDownButton = False opt.UseButtonGroup = True opt.ButtonClass = "btn-sm" ' Class for button group Call opt.Add(opt.GroupOptionName) Set item = opt.GetItem(opt.GroupOptionName) item.Body = "" item.Visible = False Set opt = ActionOptions opt.UseImageAndText = True opt.DropDownButtonPhrase = Language.Phrase("ButtonActions") opt.UseDropDownButton = False opt.UseButtonGroup = True opt.ButtonClass = "btn-sm" ' Class for button group Call opt.Add(opt.GroupOptionName) Set item = opt.GetItem(opt.GroupOptionName) item.Body = "" item.Visible = False ' Filter button Set opt = FilterOptions Call opt.Add("savecurrentfilter") Set item = opt.GetItem("savecurrentfilter") item.Body = "" & Language.Phrase("SaveCurrentFilter") & "" item.Visible = True Call opt.Add("deletefilter") Set item = opt.GetItem("deletefilter") item.Body = "" & Language.Phrase("DeleteFilter") & "" item.Visible = True opt.UseDropDownButton = True opt.UseButtonGroup = Not FilterOptions.UseDropDownButton opt.DropDownButtonPhrase = Language.Phrase("Filters") ' Add group option item Call opt.Add(FilterOptions.GroupOptionName) Set item = opt.GetItem(FilterOptions.GroupOptionName) item.Body = "" item.Visible = False End Sub ' Render other options Sub RenderOtherOptions() Dim opt, item, i, action, caption, icon, Name, cancelurl Set opt = ActionOptions opt.UseImageAndText = True ' Set up list action buttons Dim listact For i = 0 to ListActions.Count - 1 Set listact = ListActions.GetItem(i) If listact.SelectType = EW_ACTION_MULTIPLE Then action = listact.Action caption = listact.Caption icon = ew_IIf(listact.Icon <> "", " ", caption) Call opt.Add("custom_" & Action) Set item = opt.GetItem("custom_" & Action) item.Body = "" & icon & "" item.Visible = listact.Allow End If Next ' Hide grid edit and other options If TotalRecs <= 0 Then Set opt = AddEditOptions Set item = opt.GetItem("gridedit") If Not item Is Nothing Then item.Visible = False Set opt = ActionOptions opt.HideAllOptions(Array()) End If End Sub ' Process list action Function ProcessListAction() Dim userlist, user, sFilter, UserAction, Processed, ActionCaption userlist = "" user = "" sFilter = Panorama.GetKeyFilter UserAction = Request.Form("useraction") & "" Processed = False If sFilter <> "" And UserAction <> "" Then ' Check permission first Dim listact ActionCaption = UserAction If ListActions.Exists(UserAction) Then Set listact = ListActions.GetItem(UserAction) ActionCaption = listact.Caption If Not listact.Allow Then errmsg = Replace(Language.Phrase("CustomActionNotAllowed"), "%s", ActionCaption) If Request.Form("ajax") = UserAction Then ' Ajax Response.Write "

    " & errmsg & "

    " Else FailureMessage = errmsg End If ProcessListAction = False End If End If Dim cnn, sSql Panorama.CurrentFilter = sFilter sSql = Panorama.SQL Set cnn = Panorama.TableConnection cnn.BeginTrans Panorama.CurrentAction = UserAction ' Load recordset Dim Rs, row Set Rs = ew_LoadRecordsetByDbid(sSql, Panorama.TableDBID) If Not Rs.Eof Then Rs.MoveFirst ' Call row custom action event SelectedCount = Rs.RecordCount SelectedIndex = 0 Do While (Not Rs.Eof) SelectedIndex = SelectedIndex + 1 Set row = Rs.Clone Processed = Row_CustomAction(UserAction, row) If Not Processed Then Exit Do End If Rs.MoveNext Loop Rs.Close Set Rs = Nothing If Processed Then cnn.CommitTrans ' Commit the changes If SuccessMessage = "" Then SuccessMessage = Replace(Language.Phrase("CustomActionCompleted"), "%s", ActionCaption) ' Set up success message End If Else cnn.RollbackTrans ' Rollback transaction ' Set up error message If SuccessMessage <> "" Or FailureMessage <> "" Then ' Use the message, do nothing ElseIf Panorama.CancelMessage <> "" Then FailureMessage = Panorama.CancelMessage Panorama.CancelMessage = "" Else FailureMessage = Replace(Language.Phrase("CustomActionFailed"), "%s", ActionCaption) End If End If Panorama.CurrentAction = "" ' Clear action If Request.Form("ajax") = UserAction Then ' Ajax If SuccessMessage <> "" Then Response.Write "

    " & SuccessMessage & "

    " Call ClearSuccessMessage() ' Clear message End If If FailureMessage <> "" Then Response.Write "

    " & FailureMessage & "

    " Call ClearFailureMessage() ' Clear message End If ProcessListAction = True End If Else ProcessListAction = False ' Not ajax request End If End Function ' Set up search options Sub SetupSearchOptions() Dim item, SearchToggleClass Set SearchOptions = New cListOptions SearchOptions.TableVar = Panorama.TableVar ExportOptions.Tag = "div" SearchOptions.TagClassName = "ewSearchOption" ' Search button SearchOptions.Add("searchtoggle") Set item = SearchOptions.GetItem("searchtoggle") SearchToggleClass = ew_IIf(SearchWhere <> "", " active", " active") item.Body = "" item.Visible = True ' Show all button SearchOptions.Add("showall") Set item = SearchOptions.GetItem("showall") item.Body = "" & Language.Phrase("ShowAllBtn") & "" item.Visible = (SearchWhere <> DefaultSearchWhere And SearchWhere <> "0=101") ' Button group for search SearchOptions.UseDropDownButton = False SearchOptions.UseImageAndText = True SearchOptions.UseButtonGroup = True SearchOptions.DropDownButtonPhrase = Language.Phrase("ButtonSearch") ' Add group option item SearchOptions.Add(SearchOptions.GroupOptionName) Set item = SearchOptions.GetItem(SearchOptions.GroupOptionName) item.Body = "" item.Visible = False ' Hide search options If Panorama.Export <> "" Or Panorama.CurrentAction <> "" Then SearchOptions.HideAllOptions(Array()) End If End Sub Function SetupListOptionsExt() End Function 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) Panorama.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 Panorama.StartRecordNumber = StartRec End If End If End If StartRec = Panorama.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 Panorama.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 Panorama.StartRecordNumber = StartRec ElseIf (StartRec-1) Mod DisplayRecs <> 0 Then StartRec = ((StartRec-1)\DisplayRecs)*DisplayRecs+1 ' Point to page boundary Panorama.StartRecordNumber = StartRec End If End Sub ' ----------------------------------------------------------------- ' Load basic search values ' Function LoadBasicSearchValues() Panorama.BasicSearch.Keyword = Request.QueryString(EW_TABLE_BASIC_SEARCH)&"" If Panorama.BasicSearch.Keyword <> "" Then Command = "search" Panorama.BasicSearch.SearchType = Request.QueryString(EW_TABLE_BASIC_SEARCH_TYPE)&"" End Function ' ----------------------------------------------------------------- ' Load recordset ' Function LoadRecordset() ' Load list page sql Dim sSql, RsRecordset, dbtype sSql = Panorama.SelectSQL Call ew_SetDebugMsg("LoadRecordset: " & sSql) ' Show SQL for debugging ' ' Load recordset Set RsRecordset = ew_LoadRecordsetByDbid(sSql, Panorama.TableDBID) ' Call Recordset Selected event Call Panorama.Recordset_Selected(RsRecordset) Set LoadRecordset = RsRecordset End Function ' ----------------------------------------------------------------- ' Load row based on key values ' Function LoadRow() Dim RsRow, sSql, sFilter sFilter = Panorama.KeyFilter ' Call Row Selecting event Call Panorama.Row_Selecting(sFilter) ' Load sql based on filter Panorama.CurrentFilter = sFilter sSql = Panorama.SQL Call ew_SetDebugMsg("LoadRow: " & sSql) ' Show SQL for debugging Set RsRow = ew_LoadRowByDbid(sSql, Panorama.TableDBID) 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 Not EW_DEBUG_ENABLED Then On Error Resume Next If RsRow.Eof Then Exit Sub ' Call Row Selected event Call Panorama.Row_Selected(RsRow) Panorama.Id.DbValue = RsRow("Id") Panorama.Jaar2C_nummer2C_datum.DbValue = RsRow("Jaar, nummer, datum") Panorama.Bladzijde.DbValue = RsRow("Bladzijde") Panorama.Tekst_per_bladzijde.DbValue = RsRow("Tekst per bladzijde") Panorama.Bron.DbValue = RsRow("Bron") Panorama.PDF_van_dit_nummer.DbValue = RsRow("PDF van dit nummer") Panorama.Volgende_blad.DbValue = RsRow("Volgende blad") Panorama.Vorige_blad.DbValue = RsRow("Vorige blad") Panorama.Klik_op_afbeelding_voor_PDF.DbValue = RsRow("Klik op afbeelding voor PDF") End Sub ' Load DbValue from recordset Sub LoadDbValues(Rs) If Not EW_DEBUG_ENABLED Then On Error Resume Next If Rs.Eof Then Exit Sub Panorama.Id.m_DbValue = Rs("Id") Panorama.Jaar2C_nummer2C_datum.m_DbValue = Rs("Jaar, nummer, datum") Panorama.Bladzijde.m_DbValue = Rs("Bladzijde") Panorama.Tekst_per_bladzijde.m_DbValue = Rs("Tekst per bladzijde") Panorama.Bron.m_DbValue = Rs("Bron") Panorama.PDF_van_dit_nummer.m_DbValue = Rs("PDF van dit nummer") Panorama.Volgende_blad.m_DbValue = Rs("Volgende blad") Panorama.Vorige_blad.m_DbValue = Rs("Vorige blad") Panorama.Klik_op_afbeelding_voor_PDF.m_DbValue = Rs("Klik op afbeelding voor PDF") End Sub ' Load old record Function LoadOldRecord() ' Load key values from Session Dim bValidKey bValidKey = True If Panorama.GetKey("Id")&"" <> "" Then Panorama.Id.CurrentValue = Panorama.GetKey("Id") ' Id Else bValidKey = False End If ' Load old recordset If bValidKey Then Panorama.CurrentFilter = Panorama.KeyFilter Dim sSql sSql = Panorama.SQL Set OldRecordset = ew_LoadRecordsetByDbid(sSql, Panorama.TableDBID) 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 = Panorama.ViewUrl("") EditUrl = Panorama.EditUrl("") InlineEditUrl = Panorama.InlineEditUrl CopyUrl = Panorama.CopyUrl("") InlineCopyUrl = Panorama.InlineCopyUrl DeleteUrl = Panorama.DeleteUrl ' Call Row Rendering event Call Panorama.Row_Rendering() ' --------------------------------------- ' Common render codes for all row types ' --------------------------------------- ' Id Panorama.Id.CellCssStyle = "white-space: nowrap;" ' Jaar, nummer, datum Panorama.Jaar2C_nummer2C_datum.CellCssStyle = "white-space: nowrap;" ' Bladzijde Panorama.Bladzijde.CellCssStyle = "white-space: nowrap;" ' Tekst per bladzijde Panorama.Tekst_per_bladzijde.CellCssStyle = "white-space: nowrap;" ' Bron Panorama.Bron.CellCssStyle = "white-space: nowrap;" ' PDF van dit nummer Panorama.PDF_van_dit_nummer.CellCssStyle = "white-space: nowrap;" ' Volgende blad Panorama.Volgende_blad.CellCssStyle = "white-space: nowrap;" ' Vorige blad Panorama.Vorige_blad.CellCssStyle = "white-space: nowrap;" ' Klik op afbeelding voor PDF Panorama.Klik_op_afbeelding_voor_PDF.CellCssStyle = "white-space: nowrap;" ' ----------- ' View Row ' ----------- If Panorama.RowType = EW_ROWTYPE_VIEW Then ' View row ' Jaar, nummer, datum Panorama.Jaar2C_nummer2C_datum.ViewValue = Panorama.Jaar2C_nummer2C_datum.CurrentValue Panorama.Jaar2C_nummer2C_datum.ViewCustomAttributes = "" ' Bladzijde Panorama.Bladzijde.ViewValue = Panorama.Bladzijde.CurrentValue Panorama.Bladzijde.ViewCustomAttributes = "" ' Klik op afbeelding voor PDF Panorama.Klik_op_afbeelding_voor_PDF.ViewValue = Panorama.Klik_op_afbeelding_voor_PDF.CurrentValue Panorama.Klik_op_afbeelding_voor_PDF.ImageAlt = Panorama.Klik_op_afbeelding_voor_PDF.FldAlt Panorama.Klik_op_afbeelding_voor_PDF.ViewCustomAttributes = "" ' View refer script ' Jaar, nummer, datum Panorama.Jaar2C_nummer2C_datum.LinkCustomAttributes = "" Panorama.Jaar2C_nummer2C_datum.HrefValue = "" Panorama.Jaar2C_nummer2C_datum.TooltipValue = "" ' Bladzijde Panorama.Bladzijde.LinkCustomAttributes = "" Panorama.Bladzijde.HrefValue = "" Panorama.Bladzijde.TooltipValue = "" ' Klik op afbeelding voor PDF Panorama.Klik_op_afbeelding_voor_PDF.LinkCustomAttributes = "" If Not ew_Empty(Panorama.PDF_van_dit_nummer.CurrentValue) And Panorama.Export = "" Then Panorama.Klik_op_afbeelding_voor_PDF.HrefValue = "http://molenzicht.net/panorama/" & ew_IIf(Panorama.PDF_van_dit_nummer.ViewValue<>"", ew_RemoveHtml(Panorama.PDF_van_dit_nummer.ViewValue), Panorama.PDF_van_dit_nummer.CurrentValue) & ".pdf" Panorama.Klik_op_afbeelding_voor_PDF.LinkAttrs.UpdateAttribute "target", "" If Panorama.Export <> "" Then Panorama.Klik_op_afbeelding_voor_PDF.HrefValue = ew_ConvertFullUrl(Panorama.Klik_op_afbeelding_voor_PDF.HrefValue) Else Panorama.Klik_op_afbeelding_voor_PDF.HrefValue = "" End If Panorama.Klik_op_afbeelding_voor_PDF.TooltipValue = "" End If ' Call Row Rendered event If Panorama.RowType <> EW_ROWTYPE_AGGREGATEINIT Then Call Panorama.Row_Rendered() End If End Sub ' Set up Breadcrumb Sub SetupBreadcrumb() Dim PageId, url Set Breadcrumb = New cBreadcrumb url = Mid(ew_CurrentUrl, InStrRev(ew_CurrentUrl, "/")+1) url = ew_RegExReplace("\?cmd=reset(all){0,1}$", url, "") ' Remove cmd=reset / cmd=resetall Call Breadcrumb.Add("list", Panorama.TableVar, url, "", Panorama.TableVar, True) End Sub ' Setup lookup filters of a field Sub SetupLookupFilters(fld, pageId) pageId = ew_IIf(pageId&"" = "", Panorama_list.PageID, pageId) Select Case fld.FldVar End Select End Sub ' Setup AutoSuggest filters of a field Sub SetupAutoSuggestFilters(fld, pageId) pageId = ew_IIF(ew_Empty(pageId), Panorama_list.PageID, pageId) Select Case fld.FldVar End Select End Sub Sub ExportPdf(html) Response.Write html 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"|"warning" Sub Message_Showing(msg, typ) ' Example: 'If typ = "success" Then ' msg = "your success message" 'ElseIf typ = "failure" Then ' msg = "your failure message" 'ElseIf typ = "warning" Then ' msg = "your warning message" 'Else ' msg = "your message" 'End If End Sub ' Page Render event Sub Page_Render() 'Response.Write "Page Render" 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 ' Row Custom Action event Function Row_CustomAction(action, rs) ' Return False to abort Row_CustomAction = True End Function ' Page Exporting event ' ExportDoc = export document object Function Page_Exporting() 'Table.ExportDoc.Text = "my header" ' Export header 'Page_Exporting = False ' Return False to skip default export and use Row_Export event Page_Exporting = True ' Return True to use default export and skip Row_Export event End Function ' Row Export event ' Table.ExportDoc = export document object Sub Row_Export(rs) 'Dim Doc 'Set Doc = Table.ExportDoc 'Doc.Text = Doc.Text & "my content" ' Build HTML with field value: rs("MyField") or MyField.ViewValue End Sub ' Page Exported event ' ExportDoc = export document object Sub Page_Exported() 'Table.ExportDoc.Text = Table.ExportDoc.Text & "my footer" ' Export footer 'Response.Write Table.ExportDoc.Text End Sub End Class %>