Server IP : 103.118.17.23 / Your IP : 216.73.216.169 Web Server : Microsoft-IIS/10.0 System : Windows NT RESELLERPLESK22 10.0 build 20348 (Windows Server 2016) AMD64 User : IWAM_plesk(default) ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : E:/Inetpub/vhosts/mesa.org.in/httpdocs/panel/ |
Upload File : |
<%@ CodePage="65001" %> <% Response.Buffer = EW_RESPONSE_BUFFER %> <!--#include file="ewcfg.asp"--> <!--#include file="polymenudetailsinfo.asp"--> <!--#include file="aspfn.asp"--> <!--#include file="userfn.asp"--> <% Call ew_Header(False, EW_CHARSET, False) %> <% ' Define page object Dim polymenudetails_list Set polymenudetails_list = New cpolymenudetails_list Set Page = polymenudetails_list ' Page init processing Call polymenudetails_list.Page_Init ' Page main Call polymenudetails_list.Page_Main ' Global Page Rendering event (in userfn*.asp) Page_Rendering() ' Page Render event polymenudetails_list.Page_Render() %> <!--#include file="header.asp"--> <% If polymenudetails.Export = "" Then %> <script type="text/javascript"> // Form object var CurrentPageID = EW_PAGE_ID = "list"; var CurrentForm = fpolymenudetailslist = new ew_Form("fpolymenudetailslist", "list"); fpolymenudetailslist.FormKeyCountName = '<%= polymenudetails_list.FormKeyCountName %>'; // Form_CustomValidate event fpolymenudetailslist.Form_CustomValidate = function(fobj) { // DO NOT CHANGE THIS LINE! // Your custom validation code here, return false if invalid. return true; } // Use JavaScript validation or not <% If EW_CLIENT_VALIDATE Then %> fpolymenudetailslist.ValidateRequired = true; // Use JavaScript validation <% Else %> fpolymenudetailslist.ValidateRequired = false; // No JavaScript validation <% End If %> // Dynamic selection lists <% Set arAS = Nothing %> // Form object for search var CurrentSearchForm = fpolymenudetailslistsrch = new ew_Form("fpolymenudetailslistsrch"); </script> <script type="text/javascript"> // Write your client script here, no need to add script tags. </script> <% End If %> <% If polymenudetails.Export = "" Then %> <div class="ewToolbar"> <% If polymenudetails_list.TotalRecs > 0 And polymenudetails_list.ExportOptions.Visible Then %> <% Call polymenudetails_list.ExportOptions.Render("body", "", "", "", "", "") %> <% End If %> <% If polymenudetails_list.SearchOptions.Visible Then %> <% Call polymenudetails_list.SearchOptions.Render("body", "", "", "", "", "") %> <% End If %> <% If polymenudetails_list.FilterOptions.Visible Then %> <% Call polymenudetails_list.FilterOptions.Render("body", "", "", "", "", "") %> <% End If %> <div class="clearfix"></div> </div> <% End If %> <% If polymenudetails.Export = "" Or EW_EXPORT_MASTER_RECORD And polymenudetails.Export = "print" Then %> <% End If %> <% 'polymenudetails_list.TotalRecs = polymenudetails_list.Recordset.RecordCount ' Already loaded ' ASP polymenudetails_list.StartRec = 1 If polymenudetails_list.DisplayRecs <= 0 Then ' Display all records polymenudetails_list.DisplayRecs = polymenudetails_list.TotalRecs End If If Not (polymenudetails.ExportAll And polymenudetails.Export <> "") Then Call polymenudetails_list.SetupStartRec ' Set up start record position End If ' Load records ' ASP Set polymenudetails_list.Recordset = polymenudetails_list.LoadRecordset(polymenudetails_list.StartRec-1, polymenudetails_list.DisplayRecs) ' Set no record found message If polymenudetails.CurrentAction = "" And polymenudetails_list.TotalRecs = 0 Then If polymenudetails_list.SearchWhere = "0=101" Then polymenudetails_list.WarningMessage = Language.Phrase("EnterSearchCriteria") Else polymenudetails_list.WarningMessage = Language.Phrase("NoRecord") End If End If Call polymenudetails_list.RenderOtherOptions %> <% If Security.IsLoggedIn() Then %> <% If polymenudetails.Export = "" And polymenudetails.CurrentAction = "" Then %> <form name="fpolymenudetailslistsrch" id="fpolymenudetailslistsrch" class="form-inline ewForm ewExtSearchForm" action="<%= ew_CurrentPage %>"> <% SearchPanelClass = ew_IIf(polymenudetails_list.SearchWhere <> "", " in", " in") %> <div id="fpolymenudetailslistsrch_SearchPanel" class="ewSearchPanel collapse<%= SearchPanelClass %>"> <input type="hidden" name="cmd" value="search"> <input type="hidden" name="t" value="polymenudetails"> <div class="ewBasicSearch"> <div id="xsr_1" class="ewRow"> <div class="ewQuickSearch input-group"> <input type="text" name="<%= EW_TABLE_BASIC_SEARCH %>" id="<%= EW_TABLE_BASIC_SEARCH %>" class="form-control" value="<%= ew_HtmlEncode(polymenudetails.BasicSearch.getKeyword()) %>" placeholder="<%= ew_HtmlEncode(Language.Phrase("Search")) %>"> <input type="hidden" name="<%= EW_TABLE_BASIC_SEARCH_TYPE %>" id="<%= EW_TABLE_BASIC_SEARCH_TYPE %>" value="<%= ew_HtmlEncode(polymenudetails.BasicSearch.getSearchType()) %>"> <div class="input-group-btn"> <button type="button" data-toggle="dropdown" class="btn btn-default"><span id="searchtype"><%= polymenudetails.BasicSearch.getSearchTypeNameShort() %></span><span class="caret"></span></button> <ul class="dropdown-menu pull-right" role="menu"> <li<% If polymenudetails.BasicSearch.getSearchType() = "" Then Response.Write " class=""active""" %>><a href="javascript:void(0);" onclick="ew_SetSearchType(this)"><%= Language.Phrase("QuickSearchAuto") %></a></li> <li<% If polymenudetails.BasicSearch.getSearchType() = "=" Then Response.Write " class=""active""" %>><a href="javascript:void(0);" onclick="ew_SetSearchType(this,'=')"><%= Language.Phrase("QuickSearchExact") %></a></li> <li<% If polymenudetails.BasicSearch.getSearchType() = "AND" Then Response.Write " class=""active""" %>><a href="javascript:void(0);" onclick="ew_SetSearchType(this,'AND')"><%= Language.Phrase("QuickSearchAll") %></a></li> <li<% If polymenudetails.BasicSearch.getSearchType() = "OR" Then Response.Write " class=""active""" %>><a href="javascript:void(0);" onclick="ew_SetSearchType(this,'OR')"><%= Language.Phrase("QuickSearchAny") %></a></li> </ul> <button class="btn btn-primary ewButton" name="btnsubmit" id="btnsubmit" type="submit"><%= Language.Phrase("SearchBtn") %></button> </div> </div> </div> </div> </div> </form> <% End If %> <% End If %> <% Call polymenudetails_list.ShowPageHeader %> <% Call polymenudetails_list.ShowMessage %> <% If polymenudetails_list.TotalRecs > 0 Or polymenudetails.CurrentAction <> "" Then %> <div class="box ewBox ewGrid<% If polymenudetails.IsAddOrEdit() Then %> ewGridAddEdit<% End If %> polymenudetails"> <% If polymenudetails.Export = "" Then %> <div class="box-header ewGridUpperPanel"> <% If polymenudetails.CurrentAction <> "gridadd" And polymenudetails.CurrentAction <> "gridedit" Then %> <form name="ewPagerForm" class="form-inline ewForm ewPagerForm" action="<%= ew_CurrentPage %>"> <% If ew_Empty(polymenudetails_list.Pager) Then Set polymenudetails_list.Pager = ew_NewNumericPagerBase(polymenudetails_list.StartRec, polymenudetails_list.DisplayRecs, polymenudetails_list.TotalRecs, polymenudetails_list.RecRange, polymenudetails_list.AutoHidePager) %> <% If polymenudetails_list.Pager.RecordCount > 0 And polymenudetails_list.Pager.Visible Then %> <div class="ewPager"> <div class="ewNumericPage"><ul class="pagination"> <% If polymenudetails_list.Pager.FirstButton.Enabled Then %> <li><a href="<%= polymenudetails_list.PageUrl %>start=<%= polymenudetails_list.Pager.FirstButton.Start %>"><%= Language.Phrase("PagerFirst") %></a></li> <% End If %> <% If polymenudetails_list.Pager.PrevButton.Enabled Then %> <li><a href="<%= polymenudetails_list.PageUrl %>start=<%= polymenudetails_list.Pager.PrevButton.Start %>"><%= Language.Phrase("PagerPrevious") %></a></li> <% End If %> <% For Each PagerItem In polymenudetails_list.Pager.Items %> <li<% if Not PagerItem.Enabled Then Response.Write " class=""active""" End If %>><a href="<% If PagerItem.Enabled Then Response.Write polymenudetails_list.PageUrl & "start=" & PagerItem.Start Else Response.Write "#" End If %>"><%= PagerItem.Text %></a></li> <% Next %> <% If polymenudetails_list.Pager.NextButton.Enabled Then %> <li><a href="<%= polymenudetails_list.PageUrl %>start=<%= polymenudetails_list.Pager.NextButton.Start %>"><%= Language.Phrase("PagerNext") %></a></li> <% End If %> <% If polymenudetails_list.Pager.LastButton.Enabled Then %> <li><a href="<%= polymenudetails_list.PageUrl %>start=<%= polymenudetails_list.Pager.LastButton.Start %>"><%= Language.Phrase("PagerLast") %></a></li> <% End If %> </ul></div> </div> <% End If %> <% If polymenudetails_list.Pager.RecordCount > 0 Then %> <div class="ewPager ewRec"> <span><%= Language.Phrase("Record") %> <%= polymenudetails_list.Pager.FromIndex %> <%= Language.Phrase("To") %> <%= polymenudetails_list.Pager.ToIndex %> <%= Language.Phrase("Of") %> <%= polymenudetails_list.Pager.RecordCount %></span> </div> <% End If %> </form> <% End If %> <div class="ewListOtherOptions"> <% Call polymenudetails_list.AddEditOptions.Render("body", "", "", "", "", "") Call polymenudetails_list.DetailOptions.Render("body", "", "", "", "", "") Call polymenudetails_list.ActionOptions.Render("body", "", "", "", "", "") %> </div> <div class="clearfix"></div> </div> <% End If %> <form name="fpolymenudetailslist" id="fpolymenudetailslist" class="form-inline ewForm ewListForm" action="<%= ew_CurrentPage %>" method="post"> <% If polymenudetails_list.CheckToken Then %> <input type="hidden" name="<%= EW_TOKEN_NAME %>" value="<%= polymenudetails_list.Token %>"> <% End If %> <input type="hidden" name="t" value="polymenudetails"> <div id="gmp_polymenudetails" class="<% If ew_IsResponsiveLayout() Then %>table-responsive <% End If %>ewGridMiddlePanel"> <% If polymenudetails_list.TotalRecs > 0 Or polymenudetails.CurrentAction = "gridedit" Then %> <table id="tbl_polymenudetailslist" class="table ewTable"> <thead> <tr class="ewTableHeader"> <% ' Header row polymenudetails.RowType = EW_ROWTYPE_HEADER Call polymenudetails_list.RenderListOptions ' Render list options (header, left) Call polymenudetails_list.ListOptions.Render("header", "left", "", "", "", "") %> <% If polymenudetails.ID.Visible Then ' ID %> <% If polymenudetails.SortUrl(polymenudetails.ID) = "" Then %> <th data-name="ID" class="<%= polymenudetails.ID.HeaderCellClass() %>"><div id="elh_polymenudetails_ID" class="polymenudetails_ID"><div class="ewTableHeaderCaption"><%= polymenudetails.ID.FldCaption %></div></div></th> <% Else %> <th data-name="ID" class="<%= polymenudetails.ID.HeaderCellClass() %>"><div class="ewPointer" onclick="ew_Sort(event,'<%= polymenudetails.SortUrl(polymenudetails.ID) %>',1);"><div id="elh_polymenudetails_ID" class="polymenudetails_ID"> <div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><%= polymenudetails.ID.FldCaption %></span><span class="ewTableHeaderSort"><% If polymenudetails.ID.Sort = "ASC" Then %><span class="caret ewSortUp"></span><% ElseIf polymenudetails.ID.Sort = "DESC" Then %><span class="caret"></span><% End If %></span></div> </div></div></th> <% End If %> <% End If %> <% If polymenudetails.zMenu.Visible Then ' Menu %> <% If polymenudetails.SortUrl(polymenudetails.zMenu) = "" Then %> <th data-name="zMenu" class="<%= polymenudetails.zMenu.HeaderCellClass() %>"><div id="elh_polymenudetails_zMenu" class="polymenudetails_zMenu"><div class="ewTableHeaderCaption"><%= polymenudetails.zMenu.FldCaption %></div></div></th> <% Else %> <th data-name="zMenu" class="<%= polymenudetails.zMenu.HeaderCellClass() %>"><div class="ewPointer" onclick="ew_Sort(event,'<%= polymenudetails.SortUrl(polymenudetails.zMenu) %>',1);"><div id="elh_polymenudetails_zMenu" class="polymenudetails_zMenu"> <div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><%= polymenudetails.zMenu.FldCaption %><%= Language.Phrase("SrchLegend") %></span><span class="ewTableHeaderSort"><% If polymenudetails.zMenu.Sort = "ASC" Then %><span class="caret ewSortUp"></span><% ElseIf polymenudetails.zMenu.Sort = "DESC" Then %><span class="caret"></span><% End If %></span></div> </div></div></th> <% End If %> <% End If %> <% If polymenudetails.URL.Visible Then ' URL %> <% If polymenudetails.SortUrl(polymenudetails.URL) = "" Then %> <th data-name="URL" class="<%= polymenudetails.URL.HeaderCellClass() %>"><div id="elh_polymenudetails_URL" class="polymenudetails_URL"><div class="ewTableHeaderCaption"><%= polymenudetails.URL.FldCaption %></div></div></th> <% Else %> <th data-name="URL" class="<%= polymenudetails.URL.HeaderCellClass() %>"><div class="ewPointer" onclick="ew_Sort(event,'<%= polymenudetails.SortUrl(polymenudetails.URL) %>',1);"><div id="elh_polymenudetails_URL" class="polymenudetails_URL"> <div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><%= polymenudetails.URL.FldCaption %><%= Language.Phrase("SrchLegend") %></span><span class="ewTableHeaderSort"><% If polymenudetails.URL.Sort = "ASC" Then %><span class="caret ewSortUp"></span><% ElseIf polymenudetails.URL.Sort = "DESC" Then %><span class="caret"></span><% End If %></span></div> </div></div></th> <% End If %> <% End If %> <% If polymenudetails.Parent_id.Visible Then ' Parent_id %> <% If polymenudetails.SortUrl(polymenudetails.Parent_id) = "" Then %> <th data-name="Parent_id" class="<%= polymenudetails.Parent_id.HeaderCellClass() %>"><div id="elh_polymenudetails_Parent_id" class="polymenudetails_Parent_id"><div class="ewTableHeaderCaption"><%= polymenudetails.Parent_id.FldCaption %></div></div></th> <% Else %> <th data-name="Parent_id" class="<%= polymenudetails.Parent_id.HeaderCellClass() %>"><div class="ewPointer" onclick="ew_Sort(event,'<%= polymenudetails.SortUrl(polymenudetails.Parent_id) %>',1);"><div id="elh_polymenudetails_Parent_id" class="polymenudetails_Parent_id"> <div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><%= polymenudetails.Parent_id.FldCaption %></span><span class="ewTableHeaderSort"><% If polymenudetails.Parent_id.Sort = "ASC" Then %><span class="caret ewSortUp"></span><% ElseIf polymenudetails.Parent_id.Sort = "DESC" Then %><span class="caret"></span><% End If %></span></div> </div></div></th> <% End If %> <% End If %> <% If polymenudetails.Sequence.Visible Then ' Sequence %> <% If polymenudetails.SortUrl(polymenudetails.Sequence) = "" Then %> <th data-name="Sequence" class="<%= polymenudetails.Sequence.HeaderCellClass() %>"><div id="elh_polymenudetails_Sequence" class="polymenudetails_Sequence"><div class="ewTableHeaderCaption"><%= polymenudetails.Sequence.FldCaption %></div></div></th> <% Else %> <th data-name="Sequence" class="<%= polymenudetails.Sequence.HeaderCellClass() %>"><div class="ewPointer" onclick="ew_Sort(event,'<%= polymenudetails.SortUrl(polymenudetails.Sequence) %>',1);"><div id="elh_polymenudetails_Sequence" class="polymenudetails_Sequence"> <div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><%= polymenudetails.Sequence.FldCaption %></span><span class="ewTableHeaderSort"><% If polymenudetails.Sequence.Sort = "ASC" Then %><span class="caret ewSortUp"></span><% ElseIf polymenudetails.Sequence.Sort = "DESC" Then %><span class="caret"></span><% End If %></span></div> </div></div></th> <% End If %> <% End If %> <% ' Render list options (header, right) Call polymenudetails_list.ListOptions.Render("header", "right", "", "", "", "") %> </tr> </thead> <tbody><!-- Table body --> <% If polymenudetails.ExportAll And polymenudetails.Export <> "" Then polymenudetails_list.StopRec = polymenudetails_list.TotalRecs Else ' Set the last record to display If polymenudetails_list.TotalRecs > polymenudetails_list.StartRec + polymenudetails_list.DisplayRecs - 1 Then polymenudetails_list.StopRec = polymenudetails_list.StartRec + polymenudetails_list.DisplayRecs - 1 Else polymenudetails_list.StopRec = polymenudetails_list.TotalRecs End If End If ' Move to first record polymenudetails_list.RecCnt = polymenudetails_list.StartRec - 1 If Not polymenudetails_list.Recordset.EOF Then ' Already positioned at first record, no need to move 'polymenudetails_list.Recordset.MoveFirst 'If polymenudetails_list.StartRec > 1 Then polymenudetails_list.Recordset.Move polymenudetails_list.StartRec - 1 ElseIf Not polymenudetails.AllowAddDeleteRow And polymenudetails_list.StopRec = 0 Then polymenudetails_list.StopRec = polymenudetails.GridAddRowCount End If ' Initialize Aggregate polymenudetails.RowType = EW_ROWTYPE_AGGREGATEINIT Call polymenudetails.ResetAttrs Call polymenudetails_list.RenderRow polymenudetails_list.RowCnt = 0 Do While CLng(polymenudetails_list.RecCnt) < CLng(polymenudetails_list.StopRec) polymenudetails_list.RecCnt = polymenudetails_list.RecCnt + 1 If CLng(polymenudetails_list.RecCnt) >= CLng(polymenudetails_list.StartRec) Then polymenudetails_list.RowCnt = polymenudetails_list.RowCnt + 1 ' Set up key count polymenudetails_list.KeyCount = polymenudetails_list.RowIndex Call polymenudetails.ResetAttrs polymenudetails.CssClass = "" If polymenudetails.CurrentAction = "gridadd" Then Else Call polymenudetails_list.LoadRowValues(polymenudetails_list.Recordset) ' Load row values End If polymenudetails.RowType = EW_ROWTYPE_VIEW ' Render view ' Set up row id / data-rowindex Call polymenudetails.RowAttrs.AddAttributes(Array(Array("data-rowindex", polymenudetails_list.RowCnt), Array("id", "r" & polymenudetails_list.RowCnt & "_polymenudetails"), Array("data-rowtype", polymenudetails.RowType))) ' Render row Call polymenudetails_list.RenderRow ' Render list options Call polymenudetails_list.RenderListOptions %> <tr<%= polymenudetails.RowAttributes %>> <% ' Render list options (body, left) Call polymenudetails_list.ListOptions.Render("body", "left", polymenudetails_list.RowCnt, "", "", "") %> <% If polymenudetails.ID.Visible Then ' ID %> <td data-name="ID"<%= polymenudetails.ID.CellAttributes %>> <span id="el<%= polymenudetails_list.RowCnt %>_polymenudetails_ID" class="polymenudetails_ID"> <span<%= polymenudetails.ID.ViewAttributes %>> <%= polymenudetails.ID.ListViewValue %> </span> </span> </td> <% End If %> <% If polymenudetails.zMenu.Visible Then ' Menu %> <td data-name="zMenu"<%= polymenudetails.zMenu.CellAttributes %>> <span id="el<%= polymenudetails_list.RowCnt %>_polymenudetails_zMenu" class="polymenudetails_zMenu"> <span<%= polymenudetails.zMenu.ViewAttributes %>> <%= polymenudetails.zMenu.ListViewValue %> </span> </span> </td> <% End If %> <% If polymenudetails.URL.Visible Then ' URL %> <td data-name="URL"<%= polymenudetails.URL.CellAttributes %>> <span id="el<%= polymenudetails_list.RowCnt %>_polymenudetails_URL" class="polymenudetails_URL"> <span<%= polymenudetails.URL.ViewAttributes %>> <%= polymenudetails.URL.ListViewValue %> </span> </span> </td> <% End If %> <% If polymenudetails.Parent_id.Visible Then ' Parent_id %> <td data-name="Parent_id"<%= polymenudetails.Parent_id.CellAttributes %>> <span id="el<%= polymenudetails_list.RowCnt %>_polymenudetails_Parent_id" class="polymenudetails_Parent_id"> <span<%= polymenudetails.Parent_id.ViewAttributes %>> <%= polymenudetails.Parent_id.ListViewValue %> </span> </span> </td> <% End If %> <% If polymenudetails.Sequence.Visible Then ' Sequence %> <td data-name="Sequence"<%= polymenudetails.Sequence.CellAttributes %>> <span id="el<%= polymenudetails_list.RowCnt %>_polymenudetails_Sequence" class="polymenudetails_Sequence"> <span<%= polymenudetails.Sequence.ViewAttributes %>> <%= polymenudetails.Sequence.ListViewValue %> </span> </span> </td> <% End If %> <% ' Render list options (body, right) Call polymenudetails_list.ListOptions.Render("body", "right", polymenudetails_list.RowCnt, "", "", "") %> </tr> <% End If If polymenudetails.CurrentAction <> "gridadd" Then polymenudetails_list.Recordset.MoveNext End If Loop %> </tbody> </table> <% End If %> <% If polymenudetails.CurrentAction = "" Then %> <input type="hidden" name="a_list" id="a_list" value=""> <% End If %> </div> </form> <% ' Close recordset and connection polymenudetails_list.Recordset.Close Set polymenudetails_list.Recordset = Nothing %> <% If polymenudetails.Export = "" Then %> <div class="box-footer ewGridLowerPanel"> <% If polymenudetails.CurrentAction <> "gridadd" And polymenudetails.CurrentAction <> "gridedit" Then %> <form name="ewPagerForm" class="ewForm form-inline ewPagerForm" action="<%= ew_CurrentPage %>"> <% If ew_Empty(polymenudetails_list.Pager) Then Set polymenudetails_list.Pager = ew_NewNumericPagerBase(polymenudetails_list.StartRec, polymenudetails_list.DisplayRecs, polymenudetails_list.TotalRecs, polymenudetails_list.RecRange, polymenudetails_list.AutoHidePager) %> <% If polymenudetails_list.Pager.RecordCount > 0 And polymenudetails_list.Pager.Visible Then %> <div class="ewPager"> <div class="ewNumericPage"><ul class="pagination"> <% If polymenudetails_list.Pager.FirstButton.Enabled Then %> <li><a href="<%= polymenudetails_list.PageUrl %>start=<%= polymenudetails_list.Pager.FirstButton.Start %>"><%= Language.Phrase("PagerFirst") %></a></li> <% End If %> <% If polymenudetails_list.Pager.PrevButton.Enabled Then %> <li><a href="<%= polymenudetails_list.PageUrl %>start=<%= polymenudetails_list.Pager.PrevButton.Start %>"><%= Language.Phrase("PagerPrevious") %></a></li> <% End If %> <% For Each PagerItem In polymenudetails_list.Pager.Items %> <li<% if Not PagerItem.Enabled Then Response.Write " class=""active""" End If %>><a href="<% If PagerItem.Enabled Then Response.Write polymenudetails_list.PageUrl & "start=" & PagerItem.Start Else Response.Write "#" End If %>"><%= PagerItem.Text %></a></li> <% Next %> <% If polymenudetails_list.Pager.NextButton.Enabled Then %> <li><a href="<%= polymenudetails_list.PageUrl %>start=<%= polymenudetails_list.Pager.NextButton.Start %>"><%= Language.Phrase("PagerNext") %></a></li> <% End If %> <% If polymenudetails_list.Pager.LastButton.Enabled Then %> <li><a href="<%= polymenudetails_list.PageUrl %>start=<%= polymenudetails_list.Pager.LastButton.Start %>"><%= Language.Phrase("PagerLast") %></a></li> <% End If %> </ul></div> </div> <% End If %> <% If polymenudetails_list.Pager.RecordCount > 0 Then %> <div class="ewPager ewRec"> <span><%= Language.Phrase("Record") %> <%= polymenudetails_list.Pager.FromIndex %> <%= Language.Phrase("To") %> <%= polymenudetails_list.Pager.ToIndex %> <%= Language.Phrase("Of") %> <%= polymenudetails_list.Pager.RecordCount %></span> </div> <% End If %> </form> <% End If %> <div class="ewListOtherOptions"> <% Call polymenudetails_list.AddEditOptions.Render("body", "bottom", "", "", "", "") Call polymenudetails_list.DetailOptions.Render("body", "bottom", "", "", "", "") Call polymenudetails_list.ActionOptions.Render("body", "bottom", "", "", "", "") %> </div> <div class="clearfix"></div> </div> <% End If %> </div> <% End If %> <% If polymenudetails_list.TotalRecs = 0 And polymenudetails.CurrentAction = "" Then ' Show other options %> <div class="ewListOtherOptions"> <% Call polymenudetails_list.AddEditOptions.Render("body", "", "", "", "", "") Call polymenudetails_list.DetailOptions.Render("body", "", "", "", "", "") Call polymenudetails_list.ActionOptions.Render("body", "", "", "", "", "") %> </div> <div class="clearfix"></div> <% End If %> <% If polymenudetails.Export <> "" Then %> <script type="text/javascript"> ew_ApplyTemplate("body", "", "polymenudetailslist", "<%= polymenudetails.CustomExport %>"); </script> <% End If %> <% If polymenudetails.Export = "" Then %> <script type="text/javascript"> fpolymenudetailslistsrch.FilterList = <%= polymenudetails_list.GetFilterList() %>; fpolymenudetailslistsrch.Init(); fpolymenudetailslist.Init(); </script> <% End If %> <% Call polymenudetails_list.ShowPageFooter If EW_DEBUG_ENABLED Then Response.Write ew_DebugMsg() %> <% If polymenudetails.Export = "" Then %> <script type="text/javascript"> // Write your table-specific startup script here // document.write("page loaded"); </script> <% End If %> <!--#include file="footer.asp"--> <% ' Clean up and drop page object Call polymenudetails_list.Page_Terminate("") Set polymenudetails_list = Nothing %> <% ' ' Page Class ' Class cpolymenudetails_list ' Page ID Public Property Get PageID PageID = "list" End Property ' Project ID Public Property Get ProjectID ProjectID = "panel" End Property ' Table Name Public Property Get TableName TableName = "polymenudetails" End Property ' Page Object Name Public Property Get PageObjName PageObjName = "polymenudetails_list" End Property ' Field (ID) Public Property Get ID Set ID = polymenudetails.ID End Property ' Field (Menu) Public Property Get zMenu Set zMenu = polymenudetails.zMenu End Property ' Field (URL) Public Property Get URL Set URL = polymenudetails.URL End Property ' Field (Parent_id) Public Property Get Parent_id Set Parent_id = polymenudetails.Parent_id End Property ' Field (Sequence) Public Property Get Sequence Set Sequence = polymenudetails.Sequence End Property ' Get field object dictionary (ASP) Public Property Get Fields Set Fields = polymenudetails.Fields End Property ' Get field object by name (alias of Fields) (ASP) Public Function GetField(Name) Set GetField = Fields.Get(Name) End Function ' Get field object by parm (ASP) Public Function GetFieldByParm(Parm) Dim keys, key keys = Fields.Keys() For Each key In keys If Fields.Get(key).FldParm = Parm Then Set GetFieldByParm = Fields.Get(key) Exit Function End If Next Set GetFieldByParm = Nothing End Function ' Custom actions (ASP) Dim CustomActions ' Export document (ASP) Dim ExportDoc ' Grid form hidden field names Dim FormName Dim FormActionName Dim FormKeyName Dim FormOldKeyName Dim FormBlankRowName Dim FormKeyCountName ' Page headings Dim Heading Dim Subheading ' Page heading Function PageHeading() PageHeading = "" If Heading <> "" Then PageHeading = Heading ElseIf ew_NotEmpty(polymenudetails) Then PageHeading = polymenudetails.TableCaption End If End Function ' Page subheading Function PageSubheading() If Subheading <> "" Then PageSubheading = Subheading Else PageSubheading = "" If TableName <> "" Then PageSubheading = Language.Phrase(PageID) End If End If End Function ' Page Name Public Property Get PageName PageName = ew_CurrentPage() End Property ' Page Url Public Property Get PageUrl PageUrl = ew_CurrentPage() & "?" If polymenudetails.UseTokenInUrl Then PageUrl = PageUrl & "t=" & polymenudetails.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 = "<button type=""button"" class=""close"" data-dismiss=""alert"">×</button>" & sMessage html = html & "<div class=""alert alert-info ewInfo"">" & sMessage & "</div>" 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 = "<button type=""button"" class=""close"" data-dismiss=""alert"">×</button>" & sWarningMessage html = html & "<div class=""alert alert-warning ewWarning"">" & sWarningMessage & "</div>" 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 = "<button type=""button"" class=""close"" data-dismiss=""alert"">×</button>" & sSuccessMessage html = html & "<div class=""alert alert-success ewSuccess"">" & sSuccessMessage & "</div>" 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 = "<button type=""button"" class=""close"" data-dismiss=""alert"">×</button>" & sErrorMessage html = html & "<div class=""alert alert-danger ewError"">" & sErrorMessage & "</div>" Session(EW_SESSION_FAILURE_MESSAGE) = "" ' Clear message in Session End If Response.Write "<div class=""ewMessageDialog""" & ew_IIf(hidden, " style=""display: none;""", "") & ">" & html & "</div>" 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 "<p>" & sHeader & "</p>" 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 "<p>" & sFooter & "</p>" End If End Sub ' ' Validate Page request ' Public Function IsPageRequest() If polymenudetails.UseTokenInUrl Then IsPageRequest = False If ew_NotEmpty(ObjForm) Then IsPageRequest = (polymenudetails.TableVar = ObjForm.GetValue("t")) End If If Request.QueryString("t").Count > 0 Then IsPageRequest = (polymenudetails.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_IsPost() 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 ' Private Sub Class_Initialize() Session.LCID = 1033 ' Always use US locale id If IsEmpty(StartTimer) Then StartTimer = Timer ' Init start time ' Grid form hidden field names FormName = "fpolymenudetailslist" 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(polymenudetails) Then Set polymenudetails = New cpolymenudetails Set Table = polymenudetails 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 = "polymenudetailsadd.asp" InlineAddUrl = PageUrl & "a=add" GridAddUrl = PageUrl & "a=gridadd" GridEditUrl = PageUrl & "a=gridedit" MultiDeleteUrl = "polymenudetailsdelete.asp" MultiUpdateUrl = "polymenudetailsupdate.asp" ' Initialize form object Set ObjForm = Nothing ' Get resize object Call ew_GetResizeObj ' Intialize page id (for backward compatibility) EW_PAGE_ID = "list" ' Initialize table name (for backward compatibility) EW_TABLE_NAME = "polymenudetails" ' Debug message Call ew_LoadDebugMsg ' Open connection to the database If IsEmpty(Conn) Then Set Conn = ew_Connect(polymenudetails.TableDBID) End If ' List options Set ListOptions = New cListOptions ListOptions.TableVar = polymenudetails.TableVar ' Custom actions Set CustomActions = Dictionary() ' Export options Set ExportOptions = New cListOptions ExportOptions.TableVar = polymenudetails.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 fpolymenudetailslistsrch" ' List actions Set ListActions = New cListActions End Sub ' ' Page_Init ' Sub Page_Init() ' User profile Set UserProfile = New cUserProfile ' Security Set Security = New cAdvancedSecurity If Not Security.IsLoggedIn() Then Security.AutoLogin() Call Security.LoadCurrentUserLevel(ProjectID & TableName) If Not Security.CanList Then Call Security.SaveLastUrl Call Page_Terminate(ew_GetUrl("default.asp")) 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 polymenudetails.GridAddRowCount = gridaddcnt End If End If ' Set up list options Call SetupListOptions Call polymenudetails.ID.SetVisibility(polymenudetails) If polymenudetails.IsAdd() Or polymenudetails.IsCopy() Or polymenudetails.IsGridAdd() Then polymenudetails.ID.Visible = False End If Call polymenudetails.zMenu.SetVisibility(polymenudetails) Call polymenudetails.URL.SetVisibility(polymenudetails) Call polymenudetails.Parent_id.SetVisibility(polymenudetails) Call polymenudetails.Sequence.SetVisibility(polymenudetails) ' Global page loading event (in userfn*.asp) Call Page_Loading ' Page load event, used in current page Call 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 = polymenudetails.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 Call CreateToken ' Setup other options Call SetupOtherOptions ' Set up custom action (backward compatibility) Dim sKey, sAction For Each sKey In CustomActions.Keys() sAction = CustomActions.Get(sKey) 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(i) If listact.SelectType = EW_ACTION_MULTIPLE And listact.Allow Then ListOptions("checkbox").Visible = True Exit For End If Next End Sub ' ' Page_Terminate ' 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 ew_NotEmpty(polymenudetails) Then If polymenudetails.Export <> "" And Request.Form("data").Count > 0 Then Dim sContent sContent = Request.Form("data") gsExportFile = Request.Form("filename") If gsExportFile = "" Then gsExportFile = polymenudetails.TableVar If polymenudetails.Export = "pdf" Then Call ExportPdf(sContent) ElseIf polymenudetails.Export = "email" Then Response.Write ExportEmail(sContent) ElseIf polymenudetails.Export = "excel" Then Call ExportExcel(sContent) ElseIf polymenudetails.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 Security = Nothing Set ListOptions = Nothing Set CustomActions = Nothing ' ASP Set ObjForm = Nothing Set gResizeObj = Nothing ' Go to URL if specified If gsExport & "" = "" Then If sRedirectUrl <> "" Then If Response.Buffer Then Response.Clear Call ew_SaveDebugMsg Response.Redirect sRedirectUrl End If End If Set polymenudetails = Nothing Call ew_CleanUp End Sub ' ' 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 AutoHidePager, AutoHidePageSizeSelector 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 ' Sub Page_Main() SelectedCount = 0 SelectedIndex = 0 DisplayRecs = 20 RecRange = 10 AutoHidePager = EW_AUTO_HIDE_PAGER AutoHidePageSizeSelector = EW_AUTO_HIDE_PAGE_SIZE_SELECTOR 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 Call ResetCmd ' Set up Breadcrumb If polymenudetails.Export = "" Then Call SetupBreadcrumb End If ' Hide list options If polymenudetails.Export <> "" Then Call ListOptions.HideAllOptions(Array("sequence")) ListOptions.UseDropDownButton = False ' Disable drop down button ListOptions.UseButtonGroup = False ' Disable button group ElseIf polymenudetails.CurrentAction = "gridadd" Or polymenudetails.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 polymenudetails.Export <> "" Or polymenudetails.CurrentAction <> "" Then Call ExportOptions.HideAllOptions(Array()) Call FilterOptions.HideAllOptions(Array()) End If ' Hide other options If polymenudetails.Export <> "" Then Call AddEditOptions.HideAllOptions(Array()) Call DetailOptions.HideAllOptions(Array()) Call 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 (polymenudetails.Export <> "" Or Command <> "search" And Command <> "reset" And Command <> "resetall") And Command <> "json" And CheckSearchParms() Then Call RestoreSearchParms End If ' Call Recordset SearchValidated event Call polymenudetails.Recordset_SearchValidated() ' Set Up Sorting Order Call SetupSortOrder ' Get basic search criteria If gsSearchError = "" Then sSrchBasic = BasicSearchWhere(False) End If End If ' End Validate Request ' Restore display records If Command <> "json" And polymenudetails.RecordsPerPage <> "" Then DisplayRecs = polymenudetails.RecordsPerPage ' Restore from Session Else DisplayRecs = 20 ' Load default End If ' Load Sorting Order If Command <> "json" Then Call LoadSortOrder ' Load search default if no existing search criteria If Not CheckSearchParms() Then ' Load basic search from default polymenudetails.BasicSearch.Keyword = polymenudetails.BasicSearch.KeywordDefault polymenudetails.BasicSearch.SearchType = polymenudetails.BasicSearch.SearchTypeDefault Call polymenudetails.BasicSearch.setSearchType(polymenudetails.BasicSearch.SearchTypeDefault) If polymenudetails.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 polymenudetails.Recordset_Searching(SearchWhere) ' Save search criteria If Command = "search" And Not RestoreSearch Then polymenudetails.SearchWhere = SearchWhere ' Save to Session StartRec = 1 ' Reset start record counter polymenudetails.StartRecordNumber = StartRec ElseIf Command <> "json" Then SearchWhere = polymenudetails.SearchWhere End If sFilter = "" Call ew_AddFilter(sFilter, DbDetailFilter) Call ew_AddFilter(sFilter, SearchWhere) ' Set up filter If Command = "json" Then polymenudetails.UseSessionForListSQL = False ' Do not use session for ListSQL polymenudetails.CurrentFilter = sFilter Else polymenudetails.SessionWhere = sFilter polymenudetails.CurrentFilter = "" End If ' Load record count first ' ASP TotalRecs = polymenudetails.ListRecordCount() ' Search options Call 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 = polymenudetails.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 polymenudetails.ID.FormValue = arrKeyFlds(0) If Not IsNumeric(polymenudetails.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 ' Initialize sFilterList = "" sSavedFilterList = "" sFilterList = ew_Concat(sFilterList, polymenudetails.ID.AdvancedSearch.ToJson(), ",") ' Field ID sFilterList = ew_Concat(sFilterList, polymenudetails.zMenu.AdvancedSearch.ToJson(), ",") ' Field Menu sFilterList = ew_Concat(sFilterList, polymenudetails.URL.AdvancedSearch.ToJson(), ",") ' Field URL sFilterList = ew_Concat(sFilterList, polymenudetails.Parent_id.AdvancedSearch.ToJson(), ",") ' Field Parent_id sFilterList = ew_Concat(sFilterList, polymenudetails.Sequence.AdvancedSearch.ToJson(), ",") ' Field Sequence If polymenudetails.BasicSearch.Keyword <> "" Then sWrk = """" & EW_TABLE_BASIC_SEARCH & """:""" & ew_JsEncode2(polymenudetails.BasicSearch.Keyword) & """,""" & EW_TABLE_BASIC_SEARCH_TYPE & """:""" & ew_JsEncode2(polymenudetails.BasicSearch.SearchType) & """" sFilterList = ew_Concat(sFilterList, sWrk, ",") End If sFilterList = ew_RegExReplace(",$", 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(), "fpolymenudetailslistsrch", filters) ' Clean output buffer If Response.Buffer Then Response.Clear Set result = Dictionary() Call result.Add("success", True) Call ResponseJson Response.Write "[" & result.ToJson() & "]" Set result = Nothing Call Page_Terminate("") Response.End ElseIf Request.Form("cmd") = "resetfilter" Then 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")) Command = "search" ' Field ID If filter.Exists("x_ID") Then polymenudetails.ID.AdvancedSearch.SearchValue = filter("x_ID") End If If filter.Exists("z_ID") Then polymenudetails.ID.AdvancedSearch.SearchOperator = filter("z_ID") End If If filter.Exists("v_ID") Then polymenudetails.ID.AdvancedSearch.SearchCondition = filter("v_ID") End If If filter.Exists("y_ID") Then polymenudetails.ID.AdvancedSearch.SearchValue2 = filter("y_ID") End If If filter.Exists("w_ID") Then polymenudetails.ID.AdvancedSearch.SearchOperator2 = filter("w_ID") End If Call polymenudetails.ID.AdvancedSearch.Save ' Field Menu If filter.Exists("x_zMenu") Then polymenudetails.zMenu.AdvancedSearch.SearchValue = filter("x_zMenu") End If If filter.Exists("z_zMenu") Then polymenudetails.zMenu.AdvancedSearch.SearchOperator = filter("z_zMenu") End If If filter.Exists("v_zMenu") Then polymenudetails.zMenu.AdvancedSearch.SearchCondition = filter("v_zMenu") End If If filter.Exists("y_zMenu") Then polymenudetails.zMenu.AdvancedSearch.SearchValue2 = filter("y_zMenu") End If If filter.Exists("w_zMenu") Then polymenudetails.zMenu.AdvancedSearch.SearchOperator2 = filter("w_zMenu") End If Call polymenudetails.zMenu.AdvancedSearch.Save ' Field URL If filter.Exists("x_URL") Then polymenudetails.URL.AdvancedSearch.SearchValue = filter("x_URL") End If If filter.Exists("z_URL") Then polymenudetails.URL.AdvancedSearch.SearchOperator = filter("z_URL") End If If filter.Exists("v_URL") Then polymenudetails.URL.AdvancedSearch.SearchCondition = filter("v_URL") End If If filter.Exists("y_URL") Then polymenudetails.URL.AdvancedSearch.SearchValue2 = filter("y_URL") End If If filter.Exists("w_URL") Then polymenudetails.URL.AdvancedSearch.SearchOperator2 = filter("w_URL") End If Call polymenudetails.URL.AdvancedSearch.Save ' Field Parent_id If filter.Exists("x_Parent_id") Then polymenudetails.Parent_id.AdvancedSearch.SearchValue = filter("x_Parent_id") End If If filter.Exists("z_Parent_id") Then polymenudetails.Parent_id.AdvancedSearch.SearchOperator = filter("z_Parent_id") End If If filter.Exists("v_Parent_id") Then polymenudetails.Parent_id.AdvancedSearch.SearchCondition = filter("v_Parent_id") End If If filter.Exists("y_Parent_id") Then polymenudetails.Parent_id.AdvancedSearch.SearchValue2 = filter("y_Parent_id") End If If filter.Exists("w_Parent_id") Then polymenudetails.Parent_id.AdvancedSearch.SearchOperator2 = filter("w_Parent_id") End If Call polymenudetails.Parent_id.AdvancedSearch.Save ' Field Sequence If filter.Exists("x_Sequence") Then polymenudetails.Sequence.AdvancedSearch.SearchValue = filter("x_Sequence") End If If filter.Exists("z_Sequence") Then polymenudetails.Sequence.AdvancedSearch.SearchOperator = filter("z_Sequence") End If If filter.Exists("v_Sequence") Then polymenudetails.Sequence.AdvancedSearch.SearchCondition = filter("v_Sequence") End If If filter.Exists("y_Sequence") Then polymenudetails.Sequence.AdvancedSearch.SearchValue2 = filter("y_Sequence") End If If filter.Exists("w_Sequence") Then polymenudetails.Sequence.AdvancedSearch.SearchOperator2 = filter("w_Sequence") End If Call polymenudetails.Sequence.AdvancedSearch.Save If filter.Exists(EW_TABLE_BASIC_SEARCH) Then Call polymenudetails.BasicSearch.setKeyword(filter(EW_TABLE_BASIC_SEARCH)) End If If filter.Exists(EW_TABLE_BASIC_SEARCH_TYPE) Then Call polymenudetails.BasicSearch.setSearchType(filter(EW_TABLE_BASIC_SEARCH_TYPE)) End If Set filter = Nothing End If End Function ' ' Return basic search SQL ' Function BasicSearchSQL(arKeywords, typ) Dim sWhere sWhere = "" Call BuildBasicSearchSQL(sWhere, polymenudetails.zMenu, arKeywords, typ) Call BuildBasicSearchSQL(sWhere, polymenudetails.URL, 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, polymenudetails.TableDBID), polymenudetails.TableDBID) ElseIf Fld.FldDataType <> EW_DATATYPE_NUMBER Or IsNumeric(Keyword) Then sWrk = Fld.FldBasicSearchExpression & ew_Like(ew_QuotedValueBase("%" & Keyword & "%", EW_DATATYPE_STRING, polymenudetails.TableDBID), polymenudetails.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(bDefault) Dim sSearchStr, sSearchKeyword, sSearchType Dim sSearch, arKeyword, sKeyword, ar, Match, Matches, p, str, i sSearchStr = "" sSearchKeyword = ew_IIf(bDefault, polymenudetails.BasicSearch.KeywordDefault, polymenudetails.BasicSearch.Keyword) sSearchType = ew_IIf(bDefault, polymenudetails.BasicSearch.SearchTypeDefault, polymenudetails.BasicSearch.SearchType) ' Get search SQL If sSearchKeyword <> "" Then ar = polymenudetails.BasicSearch.KeywordList(bDefault) ' Search keyword in any fields If (sSearchType = "OR" Or sSearchType = "AND") And polymenudetails.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 If Not bDefault And ew_InArray(Command, Array("", "reset", "resetall")) Then Command = "search" End If If Not bDefault And Command = "search" Then Call polymenudetails.BasicSearch.setKeyword(sSearchKeyword) Call polymenudetails.BasicSearch.setSearchType(sSearchType) End If BasicSearchWhere = sSearchStr End Function ' Check if search parm exists Function CheckSearchParms() ' Check basic search If polymenudetails.BasicSearch.IssetSession() Then CheckSearchParms = True Exit Function End If CheckSearchParms = False End Function ' Clear all search parameters Sub ResetSearchParms() ' Clear search where SearchWhere = "" polymenudetails.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() Call polymenudetails.BasicSearch.UnsetSession End Sub ' ' Restore all search parameters ' Sub RestoreSearchParms() ' Restore search flag RestoreSearch = True ' Restore basic search values Call polymenudetails.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 polymenudetails.CurrentOrder = Request.QueryString("order") polymenudetails.CurrentOrderType = Request.QueryString("ordertype") ' Field ID Call polymenudetails.UpdateSort(polymenudetails.ID) ' Field Menu Call polymenudetails.UpdateSort(polymenudetails.zMenu) ' Field URL Call polymenudetails.UpdateSort(polymenudetails.URL) ' Field Parent_id Call polymenudetails.UpdateSort(polymenudetails.Parent_id) ' Field Sequence Call polymenudetails.UpdateSort(polymenudetails.Sequence) polymenudetails.StartRecordNumber = 1 ' Reset start position End If End Sub ' ' Load Sort Order parameters ' Sub LoadSortOrder() Dim sOrderBy sOrderBy = polymenudetails.SessionOrderBy ' Get order by from Session If sOrderBy = "" Then If polymenudetails.SqlOrderBy <> "" Then sOrderBy = polymenudetails.SqlOrderBy polymenudetails.SessionOrderBy = sOrderBy End If End If End Sub ' ' Reset command based on querystring parameter "cmd" ' 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 = "" polymenudetails.SessionOrderBy = sOrderBy polymenudetails.ID.Sort = "" polymenudetails.zMenu.Sort = "" polymenudetails.URL.Sort = "" polymenudetails.Parent_id.Sort = "" polymenudetails.Sequence.Sort = "" End If ' Reset start position StartRec = 1 polymenudetails.StartRecordNumber = StartRec End If End Sub ' Set up list options Sub SetupListOptions() Dim item ' Add group option item Set item = ListOptions.Add(ListOptions.GroupOptionName) item.Body = "" item.OnLeft = False item.Visible = False ' View Set item = ListOptions.Add("view") item.CssClass = "text-nowrap;" item.Visible = Security.IsLoggedIn() item.OnLeft = False ' Edit Set item = ListOptions.Add("edit") item.CssClass = "text-nowrap;" item.Visible = Security.IsLoggedIn() item.OnLeft = False ' List actions Set item = ListOptions.Add("listactions") item.CssClass = "text-nowrap;" item.OnLeft = False item.Visible = False item.ShowInButtonGroup = False item.ShowInDropDown = False ' Checkbox Set item = ListOptions.Add("checkbox") item.Visible = Security.IsLoggedIn() item.OnLeft = False item.Header = "<input type=""checkbox"" name=""key"" id=""key"" onclick=""ew_SelectAllKey(this);"">" 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(ListOptions.GroupOptionName).Visible = ListOptions.GroupOptionVisible End Sub ' Render list options Sub RenderListOptions() Dim item, links, cancelurl Call ListOptions.LoadDefault ' Call ListOptions_Rendering event Call ListOptions_Rendering Dim viewcaption viewcaption = ew_HtmlTitle(Language.Phrase("ViewLink")) If Security.IsLoggedIn() Then ListOptions("view").Body = "<a class=""ewRowLink ewView"" title=""" & viewcaption & """ data-caption=""" & viewcaption & """ href=""" & ew_HtmlEncode(ViewUrl) & """>" & Language.Phrase("ViewLink") & "</a>" Else ListOptions("view").Body = "" End If Dim editcaption Set item = ListOptions("edit") editcaption = ew_HtmlTitle(Language.Phrase("EditLink")) If Security.IsLoggedIn() Then item.Body = "<a class=""ewRowLink ewEdit"" title=""" & editcaption & """ data-caption=""" & editcaption & """ href=""" & ew_HtmlEncode(EditUrl) & """>" & Language.Phrase("EditLink") & "</a>" Else item.Body = "" End If ' Set up list action buttons Dim oListOpt, body, content, link Dim listact, action, caption, icon Set oListOpt = ListOptions("listactions") If ew_NotEmpty(oListOpt) And polymenudetails.Export = "" And polymenudetails.CurrentAction = "" Then body = "" links = Array() For i = 0 to ListActions.Count - 1 Set listact = ListActions(i) If listact.SelectType = EW_ACTION_SINGLE And listact.Allow Then action = listact.Action caption = listact.Caption icon = ew_IIf(listact.Icon <> "", "<span class=""" & ew_HtmlEncode(Replace(listact.Icon, " ewIcon", "")) & """ data-caption=""" & ew_HtmlTitle(caption) & """></span> " , "") If UBound(links) < 0 Then ReDim links(0) Else ReDim Preserve links(UBound(links)+1) End If links(UBound(links)) = "<li><a class=""ewAction ewListAction"" data-action=""" & ew_HtmlEncode(action) & """ data-caption=""" & ew_HtmlTitle(caption) & """ href="""" onclick=""ew_SubmitAction(event,jQuery.extend({key:" & polymenudetails.KeyToJson() & ",data:{rnd:" & ew_Random() & "}}," & listact.ToJson(True) & "));return false;"">" & icon & listact.Caption & "</a></li>" If UBound(links) = 0 Then ' Single button body = "<a class=""ewAction ewListAction"" data-action=""" & ew_HtmlEncode(action) & """ title=""" & ew_HtmlTitle(caption) & """ data-caption=""" & ew_HtmlTitle(caption) & """ href="""" onclick=""ew_SubmitAction(event,jQuery.extend({key:" & polymenudetails.KeyToJson() & ",data:{rnd:" & ew_Random() & "}}," & listact.ToJson(True) & "));return false;"">" & Language.Phrase("ListActionButton") & "</a>" End If End If Next If UBound(links) > 0 Then ' More than one buttons, use dropdown body = "<button class=""dropdown-toggle btn btn-default btn-sm ewActions"" title=""" & ew_HtmlTitle(Language.Phrase("ListActionButton")) & """ data-toggle=""dropdown"">" & Language.Phrase("ListActionButton") & "<b class=""caret""></b></button>" content = "" For Each link In links content = content & "<li>" & link & "</li>" Next body = body & "<ul class=""dropdown-menu" & ew_IIf(oListOpt.OnLeft, "", " dropdown-menu-right") & """>" & content & "</ul>" body = "<div class=""btn-group"">" & body & "</div>" End If If UBound(links) >= 0 Then oListOpt.Body = body oListOpt.Visible = True End If End If ListOptions("checkbox").Body = "<input type=""checkbox"" name=""key_m"" class=""ewMultiSelect"" value=""" & ew_HtmlEncode(polymenudetails.ID.CurrentValue) & """ onclick=""ew_ClickMultiCheckbox(event);"">" Call RenderListOptionsExt Call ListOptions_Rendered End Sub ' Set up other options Sub SetupOtherOptions() Dim opt, item, DetailTableLink, ar, i, caption, url, addcaption Set opt = AddEditOptions ' Add Set item = opt.Add("add") addcaption = ew_HtmlTitle(Language.Phrase("AddLink")) item.Body = "<a class=""ewAddEdit ewAdd"" title=""" & addcaption & """ data-caption=""" & addcaption & """ href=""" & ew_HtmlEncode(AddUrl) & """>" & Language.Phrase("AddLink") & "</a>" item.Visible = (AddUrl <> "" And Security.IsLoggedIn()) Set opt = ActionOptions ' Add multi delete Set item = opt.Add("multidelete") item.Body = "<a class=""ewAction ewMultiDelete"" title=""" & ew_HtmlTitle(Language.Phrase("DeleteSelectedLink")) & """ data-caption=""" & ew_HtmlTitle(Language.Phrase("DeleteSelectedLink")) & """ href="""" onclick=""ew_SubmitAction(event,{f:document.fpolymenudetailslist,url:'" & MultiDeleteUrl & "'});return false;"">" & Language.Phrase("DeleteSelectedLink") & "</a>" item.Visible = (Security.IsLoggedIn()) ' 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 Set item = opt.Add(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 Set item = opt.Add(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 Set item = opt.Add(opt.GroupOptionName) item.Body = "" item.Visible = False ' Filter button Set opt = FilterOptions Set item = opt.Add("savecurrentfilter") item.Body = "<a class=""ewSaveFilter"" data-form=""fpolymenudetailslistsrch"" href=""#"">" & Language.Phrase("SaveCurrentFilter") & "</a>" item.Visible = True Set item = opt.Add("deletefilter") item.Body = "<a class=""ewDeleteFilter"" data-form=""fpolymenudetailslistsrch"" href=""#"">" & Language.Phrase("DeleteFilter") & "</a>" item.Visible = True opt.UseDropDownButton = True opt.UseButtonGroup = Not FilterOptions.UseDropDownButton opt.DropDownButtonPhrase = Language.Phrase("Filters") ' Add group option item Set item = opt.Add(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(i) If listact.SelectType = EW_ACTION_MULTIPLE Then action = listact.Action caption = listact.Caption icon = ew_IIf(listact.Icon <> "", "<span class=""" & ew_HtmlEncode(listact.Icon) & """ data-caption=""" & ew_HtmlEncode(caption) & """></span> ", caption) Set item = opt.Add("custom_" & Action) item.Body = "<a class=""ewAction ewListAction"" title=""" & ew_HtmlEncode(caption) & """ data-caption=""" & ew_HtmlEncode(caption) & """ href="""" onclick=""ew_SubmitAction(event,jQuery.extend({f:document.fpolymenudetailslist}," & listact.ToJson(True) & "));return false;"">" & icon & "</a>" item.Visible = listact.Allow End If Next ' Hide grid edit and other options If TotalRecs <= 0 Then Set opt = AddEditOptions Set item = opt("gridedit") If ew_NotEmpty(item) Then item.Visible = False Set opt = ActionOptions Call opt.HideAllOptions(Array()) End If End Sub ' Process list action Function ProcessListAction() Dim userlist, user, sFilter, UserAction, Processed, ActionCaption userlist = "" user = "" sFilter = polymenudetails.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(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 "<p class=""text-danger"">" & errmsg & "</p>" Else FailureMessage = errmsg End If ProcessListAction = False End If End If Dim cnn, sSql polymenudetails.CurrentFilter = sFilter sSql = polymenudetails.SQL Set cnn = polymenudetails.TableConnection cnn.BeginTrans polymenudetails.CurrentAction = UserAction ' Load recordset Dim Rs Set Rs = ew_LoadRecordsetByDbid(sSql, polymenudetails.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 Processed = Row_CustomAction(UserAction, Rs) 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 polymenudetails.CancelMessage <> "" Then FailureMessage = polymenudetails.CancelMessage polymenudetails.CancelMessage = "" Else FailureMessage = Replace(Language.Phrase("CustomActionFailed"), "%s", ActionCaption) End If End If polymenudetails.CurrentAction = "" ' Clear action If Request.Form("ajax") = UserAction Then ' Ajax If SuccessMessage <> "" Then Response.Write "<p class=""text-success"">" & SuccessMessage & "</p>" Call ClearSuccessMessage ' Clear message End If If FailureMessage <> "" Then Response.Write "<p class=""text-danger"">" & FailureMessage & "</p>" 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 = polymenudetails.TableVar ExportOptions.Tag = "div" SearchOptions.TagClassName = "ewSearchOption" ' Search button Set item = SearchOptions.Add("searchtoggle") SearchToggleClass = ew_IIf(SearchWhere <> "", " active", " active") item.Body = "<button type=""button"" class=""btn btn-default ewSearchToggle" & SearchToggleClass & """ title=""" & Language.Phrase("SearchPanel") & """ data-caption=""" & Language.Phrase("SearchPanel") & """ data-toggle=""button"" data-form=""fpolymenudetailslistsrch"">" & Language.Phrase("SearchLink") & "</button>" item.Visible = True ' Show all button Set item = SearchOptions.Add("showall") item.Body = "<a class=""btn btn-default ewShowAll"" title=""" & Language.Phrase("ShowAll") & """ data-caption=""" & Language.Phrase("ShowAll") & """ href=""" & PageUrl & "cmd=reset"">" & Language.Phrase("ShowAllBtn") & "</a>" 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 Set item = SearchOptions.Add(SearchOptions.GroupOptionName) item.Body = "" item.Visible = False ' Hide search options If polymenudetails.Export <> "" Or polymenudetails.CurrentAction <> "" Then Call SearchOptions.HideAllOptions(Array()) End If End Sub Sub SetupListOptionsExt() End Sub Sub RenderListOptionsExt() End Sub 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) polymenudetails.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 polymenudetails.StartRecordNumber = StartRec End If End If End If StartRec = polymenudetails.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 polymenudetails.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 polymenudetails.StartRecordNumber = StartRec ElseIf (StartRec-1) Mod DisplayRecs <> 0 Then StartRec = ((StartRec-1)\DisplayRecs)*DisplayRecs+1 ' Point to page boundary polymenudetails.StartRecordNumber = StartRec End If End Sub ' ' Load basic search values ' Sub LoadBasicSearchValues() polymenudetails.BasicSearch.Keyword = Request.QueryString(EW_TABLE_BASIC_SEARCH)&"" If polymenudetails.BasicSearch.Keyword <> "" And Command = "" Then Command = "search" polymenudetails.BasicSearch.SearchType = Request.QueryString(EW_TABLE_BASIC_SEARCH_TYPE)&"" End Sub ' ' Load recordset ' Function LoadRecordset(offset, rowcnt) Dim sSql, rs, useSelectLimit, dbType, hasOrderBy useSelectLimit = rowcnt > 0 And offset >= 0 dbType = ew_GetConnectionType(polymenudetails.TableDBID) If dbType = "MSSQL" Then If ew_IsMsSql2012(polymenudetails.TableDBID) Then dbType = "MSSQL2012" ' ASP End If ' Load List page SQL sSql = polymenudetails.ListSQL If useSelectLimit Then hasOrderBy = polymenudetails.SqlOrderBy <> "" Or polymenudetails.SessionOrderBy <> "" sSql = ew_GetSelectLimitSql(sSql, rowcnt, offset, hasOrderBy, dbType) End If ' Load recordset Set rs = ew_LoadRecordsetByDbid(sSql, polymenudetails.TableDBID) If Not useSelectLimit Or dbType <> "MSSQL2012" And dbType <> "MYSQL" And dbType <> "POSTGRESQL" Then ' ASP If offset > 0 And Not rs.EOF Then rs.Move offset End If ' Call Recordset Selected event Call polymenudetails.Recordset_Selected(rs) Set LoadRecordset = rs End Function ' ' Load row based on key values ' Function LoadRow() Dim RsRow, sSql, sFilter sFilter = polymenudetails.KeyFilter ' Call Row Selecting event Call polymenudetails.Row_Selecting(sFilter) ' Load SQL based on filter polymenudetails.CurrentFilter = sFilter sSql = polymenudetails.SQL Call ew_SetDebugMsg("LoadRow: " & sSql) ' Show SQL for debugging Set RsRow = ew_LoadRowByDbid(sSql, polymenudetails.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 IsNull(RsRow) Then Set RsRow = NewRow() End If ' Call Row Selected event Call polymenudetails.Row_Selected(RsRow) If ew_Empty(RsRow) Then Exit Sub If RsRow.EOF Then Exit Sub polymenudetails.ID.DbValue = RsRow("ID") polymenudetails.zMenu.DbValue = RsRow("Menu") polymenudetails.URL.DbValue = RsRow("URL") polymenudetails.Parent_id.DbValue = RsRow("Parent_id") polymenudetails.Sequence.DbValue = RsRow("Sequence") End Sub ' Return a row with default values Function NewRow Dim cnn, rs, sSql, sFilter ' Clear any previous errors Err.Clear Set cnn = polymenudetails.TableConnection sFilter = polymenudetails.CurrentFilter polymenudetails.CurrentFilter = "(0 = 1)" sSql = polymenudetails.SQL polymenudetails.CurrentFilter = sFilter Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = 3 ' adUseClient Call ew_SetDebugMsg("NewRow: " & sSql) ' Show SQL for debugging rs.Open sSql, cnn, 3, 4 ' adOpenStatic, adLockBatchOptimistic ' Disconnect the Recordset Set rs.ActiveConnection = Nothing ' Add new record rs.AddNew rs("Menu") = Null rs("URL") = Null rs("Parent_id") = Null rs("Sequence") = Null ' Return the recordset If Err.Number = 0 Then Set NewRow = rs Else Set NewRow = Nothing End If End Function ' Load DbValue from recordset Sub LoadDbValues(Rs) If Not EW_DEBUG_ENABLED Then On Error Resume Next If ew_Empty(Rs) Then Exit Sub If Rs.EOF Then Exit Sub polymenudetails.ID.m_DbValue = Rs("ID") polymenudetails.zMenu.m_DbValue = Rs("Menu") polymenudetails.URL.m_DbValue = Rs("URL") polymenudetails.Parent_id.m_DbValue = Rs("Parent_id") polymenudetails.Sequence.m_DbValue = Rs("Sequence") End Sub ' Load old record Function LoadOldRecord() ' Load key values from Session Dim bValidKey bValidKey = True If polymenudetails.GetKey("ID")&"" <> "" Then polymenudetails.ID.CurrentValue = polymenudetails.GetKey("ID") ' ID Else bValidKey = False End If ' Load old record OldRecordset = Null If bValidKey Then polymenudetails.CurrentFilter = polymenudetails.KeyFilter Dim sSql sSql = polymenudetails.SQL Set OldRecordset = ew_LoadRecordsetByDbid(sSql, polymenudetails.TableDBID) End If Call LoadRowValues(OldRecordset) ' Load row values LoadOldRecord = bValidKey End Function ' ' Render row values based on field settings ' Sub RenderRow() ' Initialize URLs ViewUrl = polymenudetails.ViewUrl("") EditUrl = polymenudetails.EditUrl("") InlineEditUrl = polymenudetails.InlineEditUrl CopyUrl = polymenudetails.CopyUrl("") InlineCopyUrl = polymenudetails.InlineCopyUrl DeleteUrl = polymenudetails.DeleteUrl ' Call Row Rendering event Call polymenudetails.Row_Rendering ' ' Common render codes for all row types ' ' ID ' Menu ' URL ' Parent_id ' Sequence ' ' View Row ' If polymenudetails.RowType = EW_ROWTYPE_VIEW Then ' View row ' ID polymenudetails.ID.ViewValue = polymenudetails.ID.CurrentValue polymenudetails.ID.ViewCustomAttributes = "" ' Menu polymenudetails.zMenu.ViewValue = polymenudetails.zMenu.CurrentValue polymenudetails.zMenu.ViewCustomAttributes = "" ' URL polymenudetails.URL.ViewValue = polymenudetails.URL.CurrentValue polymenudetails.URL.ViewCustomAttributes = "" ' Parent_id polymenudetails.Parent_id.ViewValue = polymenudetails.Parent_id.CurrentValue polymenudetails.Parent_id.ViewCustomAttributes = "" ' Sequence polymenudetails.Sequence.ViewValue = polymenudetails.Sequence.CurrentValue polymenudetails.Sequence.ViewCustomAttributes = "" ' View refer script ' ID polymenudetails.ID.LinkCustomAttributes = "" polymenudetails.ID.HrefValue = "" polymenudetails.ID.TooltipValue = "" ' Menu polymenudetails.zMenu.LinkCustomAttributes = "" polymenudetails.zMenu.HrefValue = "" polymenudetails.zMenu.TooltipValue = "" ' URL polymenudetails.URL.LinkCustomAttributes = "" polymenudetails.URL.HrefValue = "" polymenudetails.URL.TooltipValue = "" ' Parent_id polymenudetails.Parent_id.LinkCustomAttributes = "" polymenudetails.Parent_id.HrefValue = "" polymenudetails.Parent_id.TooltipValue = "" ' Sequence polymenudetails.Sequence.LinkCustomAttributes = "" polymenudetails.Sequence.HrefValue = "" polymenudetails.Sequence.TooltipValue = "" End If ' Call Row Rendered event If polymenudetails.RowType <> EW_ROWTYPE_AGGREGATEINIT Then Call polymenudetails.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", polymenudetails.TableVar, url, "", polymenudetails.TableVar, True) End Sub ' Setup lookup filters of a field Sub SetupLookupFilters(fld, pageId) pageId = ew_IIf(ew_EmptyStr(pageId), polymenudetails_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_EmptyStr(pageId), polymenudetails_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 ' Call opt.MoveTo(0) ' Move to first column End Sub ' ListOptions Rendering event Sub ListOptions_Rendering() 'Example: ' xxx.DetailAdd = (...condition...) ' Set to True or False conditionally ' xxx.DetailEdit = (...condition...) ' Set to True or False conditionally ' xxx.DetailView = (...condition...) ' Set to True or False conditionally 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() '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 ' ExportDoc = export document object Sub Row_Export(rs) 'ExportDoc.Text = ExportDoc.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() 'ExportDoc.Text = ExportDoc.Text & "my footer" ' Export footer 'Response.Write ExportDoc.Text End Sub End Class %>