403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : E:/Inetpub/vhosts/mesa.org.in/httpdocs/panel/polymenudetailsinfo.asp
<%


Dim polymenudetails

' Define table class
Class cpolymenudetails
	Dim TableDBID
	Dim UpdateTable
	Dim Fields ' Fields
	Dim Rows ' Data for Custom Template

	' Column CSS classes
	Dim LeftColumnClass, RightColumnClass, OffsetColumnClass
	Dim UseSessionForListSQL

	' Class Initialize
	Private Sub Class_Initialize()
		Set Fields = Dictionary()
		Set Rows = Dictionary()
		UseTokenInUrl = EW_USE_TOKEN_IN_URL
		ExportAll = True
		UpdateTable = "dbo.polymenudetails"
		TableDBID = "DB"
		ExportPageBreakCount = 0 ' Page break per every n record (PDF only)
		ExportPageOrientation = "portrait" ' Page orientation (PDF only)
		ExportPageSize = "a4" ' Page size (PDF only)
		Set RowAttrs = New cAttributes ' Row attributes
		AllowAddDeleteRow = ew_AllowAddDeleteRow() ' Allow add/delete row
		DetailAdd = False ' Allow detail add
		DetailEdit = False ' Allow detail edit
		DetailView = False ' Allow detail view
		ShowMultipleDetails = False ' Show multiple details
		GridAddRowCount = 5 ' Grid add row count
		ValidateKey = True ' Validate key
		Visible = True
		BasicSearch.TblVar = TableVar
		BasicSearch.KeywordDefault = ""
		BasicSearch.SearchTypeDefault = ""
		UserIDAllowSecurity = 0 ' User ID Allow
		Call Fields.Add("ID", ID)
		Call Fields.Add("Menu", zMenu)
		Call Fields.Add("URL", URL)
		Call Fields.Add("Parent_id", Parent_id)
		Call Fields.Add("Sequence", Sequence)
		LeftColumnClass = "col-sm-2 control-label ewLabel"
		RightColumnClass = "col-sm-10"
		OffsetColumnClass = "col-sm-10 col-sm-offset-2"
		UseSessionForListSQL = True
	End Sub

	' Connection
	Function TableConnection()
		Set TableConnection = ew_GetConn(TableDBID)
	End Function

	' Database type
	Function TableDbType()
		TableDbType = ew_GetConnectionType(TableDBID)
	End Function

	' Cursor location
	Function TableCursorLocation()
		TableCursorLocation = 3
	End Function

	' Record lock type
	Function TableRecordsetLockType()
		TableRecordsetLockType = 2
	End Function

	' Reset attributes for table object
	Public Sub ResetAttrs()
		CssClass = ""
		CssStyle = ""
		Call RowAttrs.Clear
		Dim fld, keys, key
		If IsDictionary(Fields) Then
			keys = Fields.Keys()
			For Each key In keys
				Set fld = Fields.Get(key)
				Call fld.ResetAttrs
			Next
		End If
	End Sub

	' Setup field titles
	Public Sub SetupFieldTitles()
		Dim fld, keys, key
		If IsDictionary(Fields) Then
			keys = Fields.Keys()
			For Each key In keys
				Set fld = Fields.Get(key)
				If fld.FldTitle <> "" Then
					Call fld.EditAttrs.Update("data-toggle", "tooltip")
					Call fld.EditAttrs.Update("title", ew_HtmlEncode(fld.FldTitle))
				End If
			Next
		End If
	End Sub

	' Get field cell attributes
	Function FieldCellAttributes()
		Dim fld, values, keys, key
		Set values = Dictionary()
		If IsDictionary(Fields) Then
			keys = Fields.Keys()
			For Each key In keys
				Set fld = Fields.Get(key)
				Call values.Add(fld.FldParm, fld.CellAttributes)
			Next
		End If
		FieldCellAttributes = values
	End Function

	' Get field DB values for Custom Template
	Function CustomTemplateFieldValues()
		Dim fld, values, keys, key
		Set values = Dictionary()
		If IsDictionary(Fields) Then
			keys = Fields.Keys()
			For Each key In keys
				Set fld = Fields.Get(key)
				If ew_InArray(fld.FldDataType, EW_CUSTOM_TEMPLATE_DATATYPES) Then
					If VarType(fld.DbValue) = 8 Then ' VarType = vbString
						If Len(fld.DbValue) > EW_DATA_STRING_MAX_LENGTH Then
							Call values.Add(fld.FldParm, Left(fld.DbValue, EW_DATA_STRING_MAX_LENGTH))
						Else
							Call values.Add(fld.FldParm, fld.DbValue)
						End If
					Else
						Call values.Add(fld.FldParm, fld.DbValue)
					End If
				End If
			Next
		End If
		Set CustomTemplateFieldValues = values
	End Function

	' Define table level constants
	' Use table token in Url

	Dim UseTokenInUrl

	' Table variable
	Public Property Get TableVar
		TableVar = "polymenudetails"
	End Property

	' Table name
	Public Property Get TableName
		TableName = "polymenudetails"
	End Property

	' Table type
	Public Property Get TableType
		TableType = "TABLE"
	End Property

	' Table caption
	Dim Caption

	Public Property Let TableCaption(v)
		Caption = v
	End Property

	Public Property Get TableCaption
		If Caption & "" <> "" Then
			TableCaption = Caption
		Else
			TableCaption = Language.TablePhrase(TableVar, "TblCaption")
		End If
	End Property

	' Page caption
	Dim PgCaption

	Public Property Let PageCaption(Page, v)
		If Not IsArray(PgCaption) Then
			ReDim PgCaption(Page)
		ElseIf Page > UBound(PgCaption) Then
			ReDim Preserve PgCaption(Page)
		End If
		PgCaption(Page) = v
	End Property

	Public Property Get PageCaption(Page)
		PageCaption = ""
		If IsArray(PgCaption) Then
			If Page <= UBound(PgCaption) Then
				PageCaption = PgCaption(Page)
			End If
		End If
		If PageCaption = "" Then PageCaption = Language.TablePhrase(TableVar, "TblPageCaption" & Page)
		If PageCaption = "" Then PageCaption = "Page " & Page
	End Property
	Dim Visible

	' Export Return Page
	Public Property Get ExportReturnUrl
		If Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_EXPORT_RETURN_URL) <> "" Then
			ExportReturnUrl = Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_EXPORT_RETURN_URL)
		Else
			ExportReturnUrl = ew_CurrentPage
		End If
	End Property

	Public Property Let ExportReturnUrl(v)
		Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_EXPORT_RETURN_URL) = v
	End Property

	' Records per page
	Public Property Get RecordsPerPage
		RecordsPerPage = Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_REC_PER_PAGE)
	End Property

	Public Property Let RecordsPerPage(v)
		Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_REC_PER_PAGE) = v
	End Property

	' Start record number
	Public Property Get StartRecordNumber
		StartRecordNumber = Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_START_REC)
	End Property

	Public Property Let StartRecordNumber(v)
		Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_START_REC) = v
	End Property

	' Search Highlight Name
	Public Property Get HighlightName
		HighlightName = "polymenudetails_Highlight"
	End Property

	' Search highlight value
	Public Function HighlightValue(fld)
		Dim kwlist, dict, akw, src, src1, pos1, pos2, val, Match, Matches
		kwlist = BasicSearch.KeywordList(False)
		If BasicSearch.SearchType = "" Then ' Auto, remove ALL "OR"
			kwlist = ew_ArrayDiff(kwlist, Array("OR"))
		End If
		Set dict = Dictionary(kwlist)
		akw = fld.AdvancedSearch.GetValue("x")
		If Len(akw) > 0 Then dict.Push akw
		akw = fld.AdvancedSearch.GetValue("y")
		If Len(akw) > 0 Then dict.Push akw
		src = fld.ViewValue & ""
		If dict.Count() = 0 Then
			HighlightValue = src
			Exit Function
		End If
		pos1 = 0
		val = ""
		If ew_RegExMatch("<([^>]*)>", src, Matches) Then
			For Each Match In Matches
				pos2 = Match.FirstIndex
				If pos2 > pos1 Then
					src1 = Mid(src, pos1+1, pos2-pos1)
					val = val & Highlight(dict.ToArray(), src1)
				End If
				val = val & Match
				pos1 = pos2 + Len(Match)
			Next
		End If
		pos2 = Len(src)
		If pos2 > pos1 Then
			src1 = Mid(src, pos1+1, pos2-pos1)
			val = val & Highlight(dict.ToArray(), src1)
		End If
		HighlightValue = val
	End Function

	' Highlight keyword
	Private Function Highlight(kwlist, src)
		Dim pattern, kw, RE, dest
		pattern = ""
		For Each kw In kwlist
			pattern = pattern & ew_IIf(pattern = "", "", "|") & ew_RegExEscape(kw)
		Next
		If pattern = "" Then
			Highlight = src
			Exit Function
		End If
		pattern = "(" & pattern & ")"
		dest = "<span class=""" & HighlightName() & " ewHighlightSearch"">$1</span>"
		If EW_HIGHLIGHT_COMPARE Then
			src = ew_RegExReplace(pattern, src, dest, "ig")
		ELSE
			src = ew_RegExReplace(pattern, src, dest, "g")
		End If
		Highlight = src
	End Function

	' Search where clause
	Public Property Get SearchWhere
		SearchWhere = Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_SEARCH_WHERE)
	End Property

	Public Property Let SearchWhere(v)
		Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_SEARCH_WHERE) = v
	End Property

	' Field Visibility
	Function GetFieldVisibility(fldparm)

		' Returns original value
		GetFieldVisibility = GetFieldByParm(fldparm).Visible
	End Function

	' Set left column class (must be predefined col-*-* classes of Bootstrap grid system)
	Function SetLeftColumnClass(sClass)
		Dim matches, m
		If ew_RegExMatch("^col\-(\w+)\-(\d+)$", sClass, matches) Then
			Set m = matches(0)
			LeftColumnClass = sClass & " control-label ewLabel"
			RightColumnClass = "col-" & m.SubMatches(0) & "-" & CStr(12 - CInt(m.SubMatches(1)))
			OffsetColumnClass = RightColumnClass & " " & Replace(sClass, m.SubMatches(0), m.SubMatches(0) + "-offset")
			Set m = Nothing
		End If
	End Function

	' Single column sort
	Public Sub UpdateSort(ofld)
		Dim sSortField, sLastSort, sThisSort
		If CurrentOrder = ofld.FldName Then
			sSortField = ofld.FldExpression
			sLastSort = ofld.Sort
			If CurrentOrderType = "ASC" Or CurrentOrderType = "DESC" Then
				sThisSort = CurrentOrderType
			Else
				If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
			End If
			ofld.Sort = sThisSort
			SessionOrderBy = sSortField & " " & sThisSort ' Save to Session
		Else
			ofld.Sort = ""
		End If
	End Sub

	' BasicSearch Object
	Private m_BasicSearch

	Public Property Get BasicSearch
		If ew_Empty(m_BasicSearch) Then
			Set m_BasicSearch = New cBasicSearch
		End If
		Set BasicSearch = m_BasicSearch
	End Property

	' Session WHERE Clause
	Public Property Get SessionWhere
		SessionWhere = Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_WHERE)
	End Property

	Public Property Let SessionWhere(v)
		Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_WHERE) = v
	End Property

	' Session ORDER BY
	Public Property Get SessionOrderBy
		SessionOrderBy = Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_ORDER_BY)
	End Property

	Public Property Let SessionOrderBy(v)
		Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_ORDER_BY) = v
	End Property

	' Session Key
	Public Function GetKey(fld)
		GetKey = Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_KEY & "_" & fld)
	End Function

	Public Function SetKey(fld, v)
		Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_KEY & "_" & fld) = v
	End Function

	' Table level SQL
	' From
	Private zSqlFrom

	Public Property Get SqlFrom
		SqlFrom = ew_IIf(zSqlFrom & "" <> "", zSqlFrom, "dbo.polymenudetails")
	End Property

	Public Property Let SqlFrom(v)
		zSqlFrom = v
	End Property

	' Select
	Private zSqlSelect

	Public Property Get SqlSelect
		SqlSelect = ew_IIf(zSqlSelect & "" <> "", zSqlSelect, "SELECT * FROM dbo.polymenudetails")
	End Property

	Public Property Let SqlSelect(v)
		zSqlSelect = v
	End Property

	Private Property Get TableFilter
		TableFilter = ""
	End Property

	' Where
	Private zSqlWhere

	Public Property Get SqlWhere
		Dim sWhere
		sWhere = ew_IIf(zSqlWhere & "" <> "", zSqlWhere, "")
		Call ew_AddFilter(sWhere, TableFilter)
		SqlWhere = sWhere
	End Property

	Public Property Let SqlWhere(v)
		zSqlWhere = v
	End Property

	' Group By
	Private zSqlGroupBy

	Public Property Get SqlGroupBy
		SqlGroupBy = ew_IIf(zSqlGroupBy & "" <> "", zSqlGroupBy, "")
	End Property

	Public Property Let SqlGroupBy(v)
		zSqlGroupBy = v
	End Property

	' Having
	Private zSqlHaving

	Public Property Get SqlHaving
		SqlHaving = ew_IIf(zSqlHaving & "" <> "", zSqlHaving, "")
	End Property

	Public Property Let SqlHaving(v)
		zSqlHaving = v
	End Property

	' Order By
	Private zSqlOrderBy

	Public Property Get SqlOrderBy
		SqlOrderBy = ew_IIf(zSqlOrderBy & "" <> "", zSqlOrderBy, "")
	End Property

	Public Property Let SqlOrderBy(v)
		zSqlOrderBy = v
	End Property

	' SQL variables
	Dim CurrentFilter ' Current filter
	Dim CurrentOrder ' Current order
	Dim CurrentOrderType ' Current order type

	' Get SQL
	Public Function GetSQL(where, orderby)
		GetSQL = ew_BuildSelectSql(SqlSelect, SqlWhere, SqlGroupBy, SqlHaving, SqlOrderBy, where, orderby)
	End Function

	' Table SQL
	Public Property Get SQL
		Dim sFilter, sSort
		sFilter = CurrentFilter
		sSort = SessionOrderBy
		SQL = GetSQL(sFilter, sSort)
	End Property

	' Select SQL for Insert/Update/Delete
	Public Property Get UpdateTableSQL
		Dim sSelect, sFilter
		sSelect = ew_IIf(UpdateTable <> "", "SELECT * FROM " & UpdateTable, SqlSelect)
		sFilter = CurrentFilter
		UpdateTableSQL = ew_BuildSelectSql(sSelect, SqlWhere, SqlGroupBy, SqlHaving, "", sFilter, "")
	End Property

	' Return table SQL with list page filter
	Public Property Get ListSQL
		Dim sFilter, sSort, sSelect
		sFilter = ew_IIf(UseSessionForListSQL, SessionWhere, "")
		Call ew_AddFilter(sFilter, CurrentFilter)
		Call Recordset_Selecting(sFilter)
		sSelect = SqlSelect
		sSort = ew_IIf(UseSessionForListSQL, SessionOrderBy, "")
		ListSQL = ew_BuildSelectSql(sSelect, SqlWhere, SqlGroupBy, SqlHaving, SqlOrderBy, sFilter, sSort)
	End Property

	' Key filter for table
	Private Property Get SqlKeyFilter
		SqlKeyFilter = "ID = @ID@"
	End Property

	' Return Key filter for table
	Public Property Get KeyFilter
		Dim sKeyFilter
		sKeyFilter = SqlKeyFilter
		If Not IsNumeric(ID.CurrentValue) Then
			KeyFilter = "0=1" ' Invalid key
			Exit Property
		End If
		If IsNull(ID.CurrentValue) Then
			KeyFilter = "0=1" ' Invalid key
			Exit Property
		Else
			sKeyFilter = Replace(sKeyFilter, "@ID@", ew_AdjustSqlBase(ID.CurrentValue, TableDBID)) ' Replace key value
		End If
		KeyFilter = sKeyFilter
	End Property

	' Return URL
	Public Property Get ReturnUrl

		' Get referer URL automatically
		If Request.ServerVariables("HTTP_REFERER") <> "" Then
			If ew_ReferPage <> ew_CurrentPage And ew_ReferPage <> "login.asp" Then ' Referer not same page or login page
				Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_RETURN_URL) = Request.ServerVariables("HTTP_REFERER") ' Save to Session
			End If
		End If
		If Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_RETURN_URL) <> "" Then
			ReturnUrl = Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_RETURN_URL)
		Else
			ReturnUrl = "polymenudetailslist.asp"
		End If
	End Property

	' Get modal caption
	Public Function GetModalCaption(pageName)
		If pageName = "polymenudetailsview.asp" Then
			GetModalCaption = Language.Phrase("View")
		ElseIf pageName = "polymenudetailsedit.asp" Then
			GetModalCaption = Language.Phrase("Edit")
		ElseIf pageName = "polymenudetailsadd.asp" Then
			GetModalCaption = Language.Phrase("Add")
		Else
			GetModalCaption = ""
		End If
	End Function

	' List URL
	Public Function ListUrl()
		ListUrl = "polymenudetailslist.asp"
	End Function

	' View URL
	Public Function ViewUrl(parm)
		Dim url
		If parm <> "" Then
			url = KeyUrl("polymenudetailsview.asp", UrlParm(parm))
		Else
			url = KeyUrl("polymenudetailsview.asp", UrlParm(EW_TABLE_SHOW_DETAIL & "="))
		End If
		ViewUrl = AddMasterUrl(url)
	End Function

	' Add URL
	Public Function AddUrl(parm)
		Dim url
		If parm <> "" Then
			url = "polymenudetailsadd.asp?" & UrlParm(parm)
		Else
			url = "polymenudetailsadd.asp"
		End If
		AddUrl = AddMasterUrl(url)
	End Function

	' Edit URL
	Public Function EditUrl(parm)
		Dim url
		url = KeyUrl("polymenudetailsedit.asp", UrlParm(parm))
		EditUrl = AddMasterUrl(url)
	End Function

	' Inline edit URL
	Public Function InlineEditUrl()
		Dim url
		url = KeyUrl(ew_CurrentPage, UrlParm("a=edit"))
		InlineEditUrl = AddMasterUrl(url)
	End Function

	' Copy URL
	Public Function CopyUrl(parm)
		Dim url
		url = KeyUrl("polymenudetailsadd.asp", UrlParm(parm))
		CopyUrl = AddMasterUrl(url)
	End Function

	' Inline copy URL
	Public Function InlineCopyUrl()
		Dim url
		url = KeyUrl(ew_CurrentPage, UrlParm("a=copy"))
		InlineCopyUrl = AddMasterUrl(url)
	End Function

	' Delete URL
	Public Function DeleteUrl()
		DeleteUrl = KeyUrl("polymenudetailsdelete.asp", UrlParm(""))
	End Function

	' Add master URL
	Public Function AddMasterUrl(url)
		Dim wrkurl
		wrkurl = url
		AddMasterUrl = wrkurl
	End Function

	' Key to JSON
	Public Function KeyToJson()
		Dim json
		json = ""
		json = json & ("ID:" & ew_VarToJson(ID.CurrentValue, "number", "'"))
		KeyToJson = "{" & json & "}"
	End Function

	' Key URL
	Public Function KeyUrl(url, parm)
		Dim sUrl: sUrl = url & "?"
		If parm <> "" Then sUrl = sUrl & parm & "&"
		If Not IsNull(ID.CurrentValue) Then
			sUrl = sUrl & "ID=" & ID.CurrentValue
		Else
			KeyUrl = "javascript:ew_Alert(ewLanguage.Phrase('InvalidRecord'));"
			Exit Function
		End If
		KeyUrl = sUrl
	End Function

	' Sort URL
	Public Property Get SortUrl(fld)
		If CurrentAction <> "" Or Export <> "" Or (fld.FldType = 201 Or fld.FldType = 203 Or fld.FldType = 205 Or fld.FldType = 141) Then
			SortUrl = ""
		ElseIf fld.Sortable Then
			SortUrl = ew_CurrentPage
			Dim sUrlParm
			sUrlParm = UrlParm("order=" & ew_UrlEncode(fld.FldName) & "&amp;ordertype=" & fld.ReverseSort)
			SortUrl = AddMasterUrl(SortUrl & "?" & sUrlParm)
		Else
			SortUrl = ""
		End If
	End Property

	' URL parm
	Function UrlParm(parm)
		If UseTokenInUrl Then
			UrlParm = "t=polymenudetails"
		Else
			UrlParm = ""
		End If
		If parm <> "" Then
			If UrlParm <> "" Then UrlParm = UrlParm & "&"
			UrlParm = UrlParm & parm
		End If
	End Function

	' Get record keys from Form/QueryString/Session
	Public Function GetRecordKeys()
		Dim arKeys, arKey, cnt, i, bHasKey
		bHasKey = False

		' Check ObjForm first
		If ew_NotEmpty(ObjForm) Then
			ObjForm.Index = -1
			If ObjForm.HasValue("key_m") Then
				arKeys = ObjForm.GetValue("key_m")
				If Not IsArray(arKeys) Then
					arKeys = Array(arKeys)
				End If
				bHasKey = True
			End If
		End If

		' Check Form/QueryString
		If Not bHasKey Then
			If Request.Form("key_m").Count > 0 Then
				cnt = Request.Form("key_m").Count
				ReDim arKeys(cnt-1)
				For i = 1 to cnt ' Set up keys
					arKeys(i-1) = Request.Form("key_m")(i)
				Next
			ElseIf Request.QueryString("key_m").Count > 0 Then
				cnt = Request.QueryString("key_m").Count
				ReDim arKeys(cnt-1)
				For i = 1 to cnt ' Set up keys
					arKeys(i-1) = Request.QueryString("key_m")(i)
				Next
			ElseIf Request.QueryString <> "" Or Request.Form <> "" Then
				Dim isPost
				isPost = ew_IsHttpPost()
				ReDim arKeys(0)
				If isPost And Request.Form("ID").Count > 0 Then
					arKeys(0) = Request.Form("ID")
				ElseIf Request.QueryString("ID").Count > 0 Then
					arKeys(0) = Request.QueryString("ID")
				Else
					arKeys = "" ' Do not setup
				End If

				'GetRecordKeys = arKeys ' Do not return yet, so the values will also be checked by the following code
			End If
		End If

		' Check keys
		Dim ar, key
		If IsArray(arKeys) Then
			For i = 0 to UBound(arKeys)
				key = arKeys(i)
						Dim skip
						skip = False
						If Not IsNumeric(key) Then skip = True
						If Not skip Then
							If IsArray(ar) Then
								ReDim Preserve ar(UBound(ar)+1)
							Else
								ReDim ar(0)
							End If
							ar(UBound(ar)) = key
						End If
			Next
		End If
		GetRecordKeys = ar
	End Function

	' Get key filter
	Public Function GetKeyFilter()
		Dim arKeys, sKeyFilter, i, key
		arKeys = GetRecordKeys()
		sKeyFilter = ""
		If IsArray(arKeys) Then
			For i = 0 to UBound(arKeys)
				key = arKeys(i)
				If sKeyFilter <> "" Then sKeyFilter = sKeyFilter & " OR "
				ID.CurrentValue = key
				sKeyFilter = sKeyFilter & "(" & KeyFilter & ")"
			Next
		End If
		GetKeyFilter = sKeyFilter
	End Function

	' Get record count based on filter (for detail record count in master table pages)
	Public Function LoadRecordCount(filter)
		Dim sql, cnt, cnn, sFilter, rs, sSelect, sGroupBy, sHaving
		sFilter = filter
		Call Recordset_Selecting(sFilter)
		sSelect = ew_IIf(TableType = "CUSTOMVIEW", SqlSelect, "SELECT * FROM " & SqlFrom)
		sGroupBy = ew_IIf(TableType = "CUSTOMVIEW", SqlGroupBy, "")
		sHaving = ew_IIf(TableType = "CUSTOMVIEW", SqlHaving, "")
		sql = ew_BuildSelectSql(sSelect, SqlWhere, sGroupBy, sHaving, "", sFilter, "")
		cnt = ew_GetRecordCount(sql, TableDBID) ' ASP
		If cnt = -1 Then
			Set cnn = TableConnection()
			Set rs = cnn.Execute(sql)
			cnt = rs.RecordCount
			rs.Close()
			Set rs = Nothing
			Set cnn = Nothing
		End If
		LoadRecordCount = cnt
	End Function

	' Get record count (for current List page)
	Public Function ListRecordCount()
		Dim sql, cnt, cnn, sFilter, rs, sSelect, sGroupBy, sHaving
		sFilter = SessionWhere
		Call ew_AddFilter(sFilter, CurrentFilter)
		Call Recordset_Selecting(sFilter)
		sSelect = ew_IIf(TableType = "CUSTOMVIEW", SqlSelect, "SELECT * FROM " & SqlFrom)
		sGroupBy = ew_IIf(TableType = "CUSTOMVIEW", SqlGroupBy, "")
		sHaving = ew_IIf(TableType = "CUSTOMVIEW", SqlHaving, "")
		sql = ew_BuildSelectSql(sSelect, SqlWhere, sGroupBy, sHaving, "", sFilter, "")
		cnt = ew_GetRecordCount(sql, TableDBID) ' ASP
		If cnt = -1 Then
			Set cnn = TableConnection()
			Set rs = cnn.Execute(sql)
			cnt = rs.RecordCount
			rs.Close()
			Set rs = Nothing
			Set cnn = Nothing
		End If
		ListRecordCount = cnt
	End Function

	' Function LoadRs
	' Load Rows based on filter
	Public Function LoadRs(filter)
		If Not EW_DEBUG_ENABLED Then On Error Resume Next
		Dim cnn, RsRows, sql

		' Set up filter (SQL WHERE Clause) and get SQL
		'CurrentFilter = filter
		'sSql = SQL

		sql = GetSQL(filter, "")
		Set cnn = TableConnection
		Err.Clear
		Set RsRows = Server.CreateObject("ADODB.Recordset")
		RsRows.CursorLocation = TableCursorLocation
		Call ew_SetDebugMsg("LoadRs: " & sql) ' Show SQL for debugging
		RsRows.Open sql, cnn, 3, 1, 1 ' adOpenStatic, adLockReadOnly, adCmdText
		If Err.Number <> 0 Then
			Err.Clear
			Set LoadRs = Nothing
			RsRows.Close
			Set RsRows = Nothing
		ElseIf RsRows.EOF Then
			Set LoadRs = Nothing
			RsRows.Close
			Set RsRows = Nothing
		Else
			Set LoadRs = RsRows
		End If
	End Function

	' Load row values from recordset
	Public Sub LoadListRowValues(RsRow)
		ID.DbValue = RsRow("ID")
		zMenu.DbValue = RsRow("Menu")
		URL.DbValue = RsRow("URL")
		Parent_id.DbValue = RsRow("Parent_id")
		Sequence.DbValue = RsRow("Sequence")
	End Sub

	' Render list row values
	Sub RenderListRow()

		'
		' Common render codes
		'
		' ID
		' Menu
		' URL
		' Parent_id
		' Sequence
		' Call Row Rendering event

		Call Row_Rendering

		'
		' Render for View
		'
		' ID

		ID.ViewValue = ID.CurrentValue
		ID.ViewCustomAttributes = ""

		' Menu
		zMenu.ViewValue = zMenu.CurrentValue
		zMenu.ViewCustomAttributes = ""

		' URL
		URL.ViewValue = URL.CurrentValue
		URL.ViewCustomAttributes = ""

		' Parent_id
		Parent_id.ViewValue = Parent_id.CurrentValue
		Parent_id.ViewCustomAttributes = ""

		' Sequence
		Sequence.ViewValue = Sequence.CurrentValue
		Sequence.ViewCustomAttributes = ""

		' ID
		ID.LinkCustomAttributes = ""
		ID.HrefValue = ""
		ID.TooltipValue = ""

		' Menu
		zMenu.LinkCustomAttributes = ""
		zMenu.HrefValue = ""
		zMenu.TooltipValue = ""

		' URL
		URL.LinkCustomAttributes = ""
		URL.HrefValue = ""
		URL.TooltipValue = ""

		' Parent_id
		Parent_id.LinkCustomAttributes = ""
		Parent_id.HrefValue = ""
		Parent_id.TooltipValue = ""

		' Sequence
		Sequence.LinkCustomAttributes = ""
		Sequence.HrefValue = ""
		Sequence.TooltipValue = ""

		' Call Row Rendered event
		If RowType <> EW_ROWTYPE_AGGREGATEINIT Then
			Call Row_Rendered
		End If

		' Save data for Custom Template
		Call Rows.Push(CustomTemplateFieldValues())
	End Sub

	' Render edit row values
	Public Sub RenderEditRow()

		' Call Row Rendering event
		Call Row_Rendering

		' ID
		Call ID.EditAttrs.UpdateAttribute("class", "form-control")
		ID.EditCustomAttributes = ""
		ID.EditValue = ID.CurrentValue
		ID.ViewCustomAttributes = ""

		' Menu
		Call zMenu.EditAttrs.UpdateAttribute("class", "form-control")
		zMenu.EditCustomAttributes = ""
		zMenu.EditValue = zMenu.CurrentValue
		zMenu.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(zMenu.FldCaption))

		' URL
		Call URL.EditAttrs.UpdateAttribute("class", "form-control")
		URL.EditCustomAttributes = ""
		URL.EditValue = URL.CurrentValue
		URL.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(URL.FldCaption))

		' Parent_id
		Call Parent_id.EditAttrs.UpdateAttribute("class", "form-control")
		Parent_id.EditCustomAttributes = ""
		Parent_id.EditValue = Parent_id.CurrentValue
		Parent_id.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Parent_id.FldCaption))

		' Sequence
		Call Sequence.EditAttrs.UpdateAttribute("class", "form-control")
		Sequence.EditCustomAttributes = ""
		Sequence.EditValue = Sequence.CurrentValue
		Sequence.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Sequence.FldCaption))

		' Call Row Rendered event
		Call Row_Rendered
	End Sub

	' Aggregate list row values
	Public Sub AggregateListRowValues()
	End Sub

	' Aggregate list row (for rendering)
	Sub AggregateListRow()

		' Call Row Rendered event
		Call Row_Rendered
	End Sub

	' Update detail records
	Function UpdateDetailRecords(RsOld, RsNew)
		Dim bUpdate, sFieldList, sWhereList, sSql, rscascade, rscascadenew, cnn
		On Error Resume Next
		UpdateDetailRecords = True
	End Function

	' Delete detail records
	Function DeleteDetailRecords(Rs, Where)
		On Error Resume Next
		Dim sWhereList, sWhereWrk, sSql, cnn, bNullRs, RsWrk, rscascade
		bNullRs = IsNull(Rs)
		DeleteDetailRecords = True

		' Delete upload files if necessary
		If bNullRs Then
			Dim rsfile
			sSql = "SELECT * FROM dbo.polymenudetails WHERE " & Where
			Set cnn = TableConnection
			Set rsfile = cnn.Execute(sSql)
			If Not rsfile.EOF Then rsfile.MoveFirst
			Do While Not rsfile.EOF
				Call LoadListRowValues(rsfile)
				rsfile.MoveNext
			Loop
			rsfile.Close
			Set rsfile = Nothing
		End If
	End Function

	' Export data in Xml Format
	Public Sub ExportXmlDocument(XmlDoc, HasParent, Recordset, StartRec, StopRec, ExportPageType)
		If ew_Empty(Recordset) Or ew_Empty(XmlDoc) Then
			Exit Sub
		End If
		If Not HasParent Then
			Call XmlDoc.AddRoot(TableVar)
		End If

		' Move to first record
		Dim RecCnt, RowCnt
		RecCnt = StartRec - 1
		If Not Recordset.EOF Then

			' Already positioned at first record, no need to move
			'Recordset.MoveFirst
			'If StartRec > 1 Then Recordset.Move(StartRec - 1)

		End If
		Do While Not Recordset.EOF And RecCnt < StopRec
			RecCnt = RecCnt + 1
			If CLng(RecCnt) >= CLng(StartRec) Then
				RowCnt = CLng(RecCnt) - CLng(StartRec) + 1
				Call LoadListRowValues(Recordset)

				' Render row
				RowType = EW_ROWTYPE_VIEW ' Render view
				Call ResetAttrs
				Call RenderListRow
				If HasParent Then
					Call XmlDoc.AddRow(TableVar, "")
				Else
					Call XmlDoc.AddRow("", "")
				End If
				If ExportPageType = "view" Then
					Call XmlDoc.AddField("ID", ID.ExportValue(Export))
					Call XmlDoc.AddField("zMenu", zMenu.ExportValue(Export))
					Call XmlDoc.AddField("URL", URL.ExportValue(Export))
					Call XmlDoc.AddField("Parent_id", Parent_id.ExportValue(Export))
					Call XmlDoc.AddField("Sequence", Sequence.ExportValue(Export))
				Else
					Call XmlDoc.AddField("ID", ID.ExportValue(Export))
					Call XmlDoc.AddField("zMenu", zMenu.ExportValue(Export))
					Call XmlDoc.AddField("URL", URL.ExportValue(Export))
					Call XmlDoc.AddField("Parent_id", Parent_id.ExportValue(Export))
					Call XmlDoc.AddField("Sequence", Sequence.ExportValue(Export))
				End If
			End If
			Recordset.MoveNext
		Loop
	End Sub

	' Export data in HTML/CSV/Word/Excel/Email format
	Public Sub ExportDocument(Doc, Recordset, StartRec, StopRec, ExportPageType)
		If ew_Empty(Recordset) Or ew_Empty(Doc) Then
			Exit Sub
		End If
		If Not Doc.ExportCustom Then

			' Write header
			Call Doc.ExportTableHeader
			If Doc.Horizontal Then ' Horizontal format, write header
				Call Doc.BeginExportRow(0)
				If ExportPageType = "view" Then
					If ID.Exportable Then Call Doc.ExportCaption(ID)
					If zMenu.Exportable Then Call Doc.ExportCaption(zMenu)
					If URL.Exportable Then Call Doc.ExportCaption(URL)
					If Parent_id.Exportable Then Call Doc.ExportCaption(Parent_id)
					If Sequence.Exportable Then Call Doc.ExportCaption(Sequence)
				Else
					If ID.Exportable Then Call Doc.ExportCaption(ID)
					If zMenu.Exportable Then Call Doc.ExportCaption(zMenu)
					If URL.Exportable Then Call Doc.ExportCaption(URL)
					If Parent_id.Exportable Then Call Doc.ExportCaption(Parent_id)
					If Sequence.Exportable Then Call Doc.ExportCaption(Sequence)
				End If
				Call Doc.EndExportRow(0)
			End If
		End If

		' Move to first record
		Dim RecCnt, RowCnt
		RecCnt = StartRec - 1
		If Not Recordset.EOF Then

			' Already positioned at first record, no need to move
			'Recordset.MoveFirst
			'If StartRec > 1 Then Recordset.Move(StartRec - 1)

		End If
		Do While Not Recordset.EOF And CLng(RecCnt) < CLng(StopRec)
			RecCnt = RecCnt + 1
			If CLng(RecCnt) >= CLng(StartRec) Then
				RowCnt = CLng(RecCnt) - CLng(StartRec) + 1

				' Page break
				If ExportPageBreakCount > 0 Then
					If RowCnt > 1 And ((RowCnt - 1) Mod ExportPageBreakCount = 0) Then
						Call Doc.ExportPageBreak
					End If
				End If
				Call LoadListRowValues(Recordset)

				' Render row
				RowType = EW_ROWTYPE_VIEW ' Render view
				Call ResetAttrs
				Call RenderListRow
				If Not Doc.ExportCustom Then
					Call Doc.BeginExportRow(RowCnt)
					If ExportPageType = "view" Then
						If ID.Exportable Then Call Doc.ExportField(ID)
						If zMenu.Exportable Then Call Doc.ExportField(zMenu)
						If URL.Exportable Then Call Doc.ExportField(URL)
						If Parent_id.Exportable Then Call Doc.ExportField(Parent_id)
						If Sequence.Exportable Then Call Doc.ExportField(Sequence)
					Else
						If ID.Exportable Then Call Doc.ExportField(ID)
						If zMenu.Exportable Then Call Doc.ExportField(zMenu)
						If URL.Exportable Then Call Doc.ExportField(URL)
						If Parent_id.Exportable Then Call Doc.ExportField(Parent_id)
						If Sequence.Exportable Then Call Doc.ExportField(Sequence)
					End If
					Call Doc.EndExportRow(RowCnt)
				End If
			End If

			' Call Row Export server event
			If Doc.ExportCustom And ew_NotEmpty(Page) Then ' ASP
				Call Page.Row_Export(Recordset)
			End If
			Recordset.MoveNext
		Loop
		If Not Doc.ExportCustom Then
			Call Doc.ExportTableFooter
		End If
	End Sub

	Public Function ApplyUserIDFilters(Filter)

		' Add user id filter
		Dim sFilter
		sFilter = Filter
		ApplyUserIDFilters = sFilter
	End Function

	' Check if User ID security allows view all
	Dim UserIDAllowSecurity

	Function UserIDAllow(id)
		Dim allow
		allow = EW_USER_ID_ALLOW
		Select Case id
			Case "add", "copy", "gridadd", "register", "addopt"
				UserIDAllow = ((allow And EW_ALLOW_ADD) = EW_ALLOW_ADD)
			Case "edit", "gridedit", "update", "changepwd", "forgotpwd"
				UserIDAllow = ((allow And EW_ALLOW_EDIT) = EW_ALLOW_EDIT)
			Case "delete"
				UserIDAllow = ((allow And EW_ALLOW_DELETE) = EW_ALLOW_DELETE)
			Case "view"
				UserIDAllow = ((allow And EW_ALLOW_VIEW) = EW_ALLOW_VIEW)
			Case "search"
				UserIDAllow = ((allow And EW_ALLOW_SEARCH) = EW_ALLOW_SEARCH)
			Case Else
				UserIDAllow = ((allow And EW_ALLOW_LIST) = EW_ALLOW_LIST)
		End Select
	End Function

	' Get auto fill value
	Public Function GetAutoFill(id, val)
		Dim cnn, rs, rsArr, str, i, j, rowcnt
		rowcnt = 0

		' Output
		If IsArray(rsArr) And rowcnt > 0 Then
			For j = 0 To UBound(rsArr, 2)
				For i = 0 To UBound(rsArr, 1)
					str = rsArr(i, j) & ""
					If Request.Form("keepCRLF").Count > 0 Then
						str = Replace(str, vbCr, "\\r")
						str = Replace(str, vbLf, "\\n")
					Else
						str = Replace(str, vbCr, " ")
						str = Replace(str, vbLf, " ")
					End If
					rsArr(i, j) = str
				Next
			Next
			GetAutoFill = ew_ArrayToJson(rsArr)
		Else
			GetAutoFill = ""
		End If
	End Function
	Dim CurrentAction ' Current action
	Dim LastAction ' Last action
	Dim CurrentMode ' Current mode
	Dim UpdateConflict ' Update conflict
	Dim EventName ' Event name
	Dim EventCancelled ' Event cancelled
	Dim CancelMessage ' Cancel message
	Dim AllowAddDeleteRow ' Allow add/delete row
	Dim ValidateKey ' Validate key
	Dim DetailAdd ' Allow detail add
	Dim DetailEdit ' Allow detail edit
	Dim DetailView ' Allow detail view
	Dim ShowMultipleDetails ' Show multiple details
	Dim GridAddRowCount ' Grid add row count

	' Check current action
	' Add
	Public Function IsAdd()
		IsAdd = (CurrentAction = "add")
	End Function

	' Copy
	Public Function IsCopy()
		IsCopy = (CurrentAction = "copy" Or CurrentAction = "C")
	End Function

	' Edit
	Public Function IsEdit()
		IsEdit = (CurrentAction = "edit")
	End Function

	' Delete
	Public Function IsDelete()
		IsDelete = (CurrentAction = "D")
	End Function

	' Confirm
	Public Function IsConfirm()
		IsConfirm = (CurrentAction = "F")
	End Function

	' Overwrite
	Public Function IsOverwrite()
		IsOverwrite = (CurrentAction = "overwrite")
	End Function

	' Cancel
	Public Function IsCancel()
		IsCancel = (CurrentAction = "cancel")
	End Function

	' Grid add
	Public Function IsGridAdd()
		IsGridAdd = (CurrentAction = "gridadd")
	End Function

	' Grid edit
	Public Function IsGridEdit()
		IsGridEdit = (CurrentAction = "gridedit")
	End Function

	' Add/Copy/Edit/GridAdd/GridEdit
	Public Function IsAddOrEdit()
		IsAddOrEdit = IsAdd() Or IsCopy() Or IsEdit() Or IsGridAdd() Or IsGridEdit()
	End Function

	' Insert
	Public Function IsInsert()
		IsInsert = (CurrentAction = "insert" Or CurrentAction = "A")
	End Function

	' Update
	Public Function IsUpdate()
		IsUpdate = (CurrentAction = "update" Or CurrentAction = "U")
	End Function

	' Grid update
	Public Function IsGridUpdate()
		IsGridUpdate = (CurrentAction = "gridupdate")
	End Function

	' Grid insert
	Public Function IsGridInsert()
		IsGridInsert = (CurrentAction = "gridinsert")
	End Function

	' Grid overwrite
	Public Function IsGridOverwrite()
		IsGridOverwrite = (CurrentAction = "gridoverwrite")
	End Function

	' Check last action
	' Cancelled
	Public Function IsCancelled()
		IsCancelled = (LastAction = "cancel" And CurrentAction = "")
	End Function

	' Inline inserted
	Public Function IsInlineInserted()
		IsInlineInserted = (LastAction = "insert" And CurrentAction = "")
	End Function

	' Inline updated
	Public Function IsInlineUpdated()
		IsInlineUpdated = (LastAction = "update" And CurrentAction = "")
	End Function

	' Grid updated
	Public Function IsGridUpdated()
		IsGridUpdated = (LastAction = "gridupdate" And CurrentAction = "")
	End Function

	' Grid inserted
	Public Function IsGridInserted()
		IsGridInserted = (LastAction = "gridinsert" And CurrentAction = "")
	End Function

	' Row Type
	Private m_RowType

	Public Property Get RowType
		RowType = m_RowType
	End Property

	Public Property Let RowType(v)
		m_RowType = v
	End Property
	Dim CssClass ' CSS class
	Dim CssStyle' CSS style
	Dim RowAttrs ' Row attributes

	' Row Styles
	Public Property Get RowStyles
		Dim sAtt, Value
		Dim sStyle, sClass
		sAtt = ""
		sStyle = CssStyle
		If RowAttrs.Exists("style") Then
			Value = RowAttrs("style")
			If Trim(Value) <> "" Then
				sStyle = sStyle & " " & Value
			End If
		End If
		sClass = CssClass
		If RowAttrs.Exists("class") Then
			Value = RowAttrs("class")
			If Trim(Value) <> "" Then
				sClass = sClass & " " & Value
			End If
		End If
		If Trim(sStyle) <> "" Then
			sAtt = sAtt & " style=""" & Trim(sStyle) & """"
		End If
		If Trim(sClass) <> "" Then
			sAtt = sAtt & " class=""" & Trim(sClass) & """"
		End If
		RowStyles = sAtt
	End Property

	' Row Attribute
	Public Property Get RowAttributes
		Dim sAtt, dict, sStyle, sClass
		If Export = "" Then
			Set dict = Dictionary()
			sStyle = Trim(CssStyle&"")
			If sStyle <> "" Then
				dict.Add "style", sStyle
			End If
			sClass = Trim(CssClass&"")
			If sClass <> "" Then
				dict.Add "class", sClass
			End If
			sAtt = sAtt & RowAttrs.ToString(dict)
			Set dict = Nothing
		Else
			sAtt = RowStyles
		End If
		RowAttributes = sAtt
	End Property

	' Export
	Dim Export
	Dim CustomExport

	' Export All
	Dim ExportAll
	Dim ExportPageBreakCount ' Page break per every n record (PDF only)
	Dim ExportPageOrientation ' Page orientation (PDF only)
	Dim ExportPageSize ' Page size (PDF only)

	' Send Email
	Dim SendEmail

	'
	' Field objects
	'
	' Field (ID)
	Private m_ID

	Public Property Get ID
		If ew_Empty(m_ID) Then
			Set m_ID = NewFldObj("polymenudetails", "polymenudetails", "x_ID", "ID", "ID", "ID", 3, 0, "ID", False, False, False, "FORMATTED TEXT", "NO")
			m_ID.Sortable = True ' Allow sort
			m_ID.FldDefaultErrMsg = Language.Phrase("IncorrectInteger")
		End If
		Set ID = m_ID
	End Property

	' Field (Menu)
	Private m_zMenu

	Public Property Get zMenu
		If ew_Empty(m_zMenu) Then
			Set m_zMenu = NewFldObj("polymenudetails", "polymenudetails", "x_zMenu", "Menu", "Menu", "Menu", 202, 0, "Menu", False, False, False, "FORMATTED TEXT", "TEXT")
			m_zMenu.Sortable = True ' Allow sort
		End If
		Set zMenu = m_zMenu
	End Property

	' Field (URL)
	Private m_URL

	Public Property Get URL
		If ew_Empty(m_URL) Then
			Set m_URL = NewFldObj("polymenudetails", "polymenudetails", "x_URL", "URL", "URL", "URL", 202, 0, "URL", False, False, False, "FORMATTED TEXT", "TEXT")
			m_URL.Sortable = True ' Allow sort
		End If
		Set URL = m_URL
	End Property

	' Field (Parent_id)
	Private m_Parent_id

	Public Property Get Parent_id
		If ew_Empty(m_Parent_id) Then
			Set m_Parent_id = NewFldObj("polymenudetails", "polymenudetails", "x_Parent_id", "Parent_id", "Parent_id", "Parent_id", 3, 0, "Parent_id", False, False, False, "FORMATTED TEXT", "TEXT")
			m_Parent_id.Sortable = True ' Allow sort
			m_Parent_id.FldDefaultErrMsg = Language.Phrase("IncorrectInteger")
		End If
		Set Parent_id = m_Parent_id
	End Property

	' Field (Sequence)
	Private m_Sequence

	Public Property Get Sequence
		If ew_Empty(m_Sequence) Then
			Set m_Sequence = NewFldObj("polymenudetails", "polymenudetails", "x_Sequence", "Sequence", "Sequence", "Sequence", 3, 0, "Sequence", False, False, False, "FORMATTED TEXT", "TEXT")
			m_Sequence.Sortable = True ' Allow sort
			m_Sequence.FldDefaultErrMsg = Language.Phrase("IncorrectInteger")
		End If
		Set Sequence = m_Sequence
	End Property

	' Get field object by name
	Public Function GetField(Name)
		Set GetField = Fields.Get(Name)
	End Function

	' Get field object by parm
	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

	' Create new field object
	Private Function NewFldObj(TblVar, TblName, FldVar, FldName, FldExpression, FldBasicSearchExpression, FldType, FldDtFormat, FldVirtualExp, FldVirtual, FldForceSelect, FldVirtualSearch, FldViewTag, FldHtmlTag)
		Dim fld
		Set fld = New cField
		fld.TblVar = TblVar
		fld.TblName = TblName
		fld.FldVar = FldVar
		fld.FldName = FldName
		fld.FldExpression = FldExpression
		fld.FldBasicSearchExpression = FldBasicSearchExpression
		fld.FldType = FldType
		fld.FldDataType = ew_FieldDataType(FldType)
		fld.FldDateTimeFormat = FldDtFormat
		fld.FldVirtualExpression = FldVirtualExp
		fld.FldIsVirtual = FldVirtual
		fld.FldForceSelection = FldForceSelect
		fld.FldVirtualSearch = FldVirtualSearch
		fld.FldViewTag = FldViewTag
		fld.AdvancedSearch.TblVar = TblVar
		fld.AdvancedSearch.FldVar = FldVar
		fld.FldHtmlTag = FldHtmlTag
		Set NewFldObj = fld
	End Function

	' Table level events
	' Recordset Selecting event
	Sub Recordset_Selecting(filter)
		If Not EW_DEBUG_ENABLED Then On Error Resume Next

		' Enter your code here	
	End Sub

	' Recordset Selected event
	Sub Recordset_Selected(rs)

		'Response.Write "Recordset Selected"
	End Sub

	' Recordset Search Validated event
	Sub Recordset_SearchValidated()
		If Not EW_DEBUG_ENABLED Then On Error Resume Next

		' Enter your code here
	End Sub

	' Recordset Searching event
	Sub Recordset_Searching(filter)
		If Not EW_DEBUG_ENABLED Then On Error Resume Next

		' Enter your code here	
	End Sub

	' Row_Selecting event
	Sub Row_Selecting(filter)
		If Not EW_DEBUG_ENABLED Then On Error Resume Next

		' Enter your code here	
	End Sub

	' Row Selected event
	Sub Row_Selected(rs)

		'Response.Write "Row Selected"
	End Sub

	' Row Inserting event
	Function Row_Inserting(rsold, rsnew)
		If Not EW_DEBUG_ENABLED Then On Error Resume Next

		' Enter your code here
		' To cancel, set return value to False

		Row_Inserting = True
	End Function

	' Row Inserted event
	Sub Row_Inserted(rsold, rsnew)

		' Response.Write "Row Inserted"
	End Sub

	' Row Updating event
	Function Row_Updating(rsold, rsnew)
		If Not EW_DEBUG_ENABLED Then On Error Resume Next

		' Enter your code here
		' To cancel, set return value to False

		Row_Updating = True
	End Function

	' Row Updated event
	Sub Row_Updated(rsold, rsnew)

		' Response.Write "Row Updated"
	End Sub

	' Row Update Conflict event
	Function Row_UpdateConflict(rsold, rsnew)
		If Not EW_DEBUG_ENABLED Then On Error Resume Next

		' Enter your code here
		' To ignore conflict, set return value to False

		Row_UpdateConflict = True
	End Function

	' Grid Inserting event
	Function Grid_Inserting()

		' Enter your code here
		' To reject grid insert, set return value to False

		Grid_Inserting = True
	End Function

	' Grid Inserted event
	Sub Grid_Inserted(rsnew)

		'Response.Write "Grid Inserted"
	End sub

	' Grid Updating event
	Function Grid_Updating(rsold)

		' Enter your code here
		' To reject grid update, set return value to False

		Grid_Updating = True
	End Function

	' Grid Updated event
	Sub Grid_Updated(rsold, rsnew)

		'Response.Write "Grid Updated"
	End Sub

	' Row Deleting event
	Function Row_Deleting(rs)
		If Not EW_DEBUG_ENABLED Then On Error Resume Next

		' Enter your code here
		' To cancel, set return value to False

		Row_Deleting = True
	End Function

	' Row Deleted event
	Sub Row_Deleted(rs)

		' Response.Write "Row Deleted"
	End Sub

	' Email Sending event
	Function Email_Sending(Email, Args)

		'Response.Write Email.AsString
		'Response.Write "Keys of Args: " & Join(Args.Keys, ", ")
		'Response.End

		Email_Sending = True
	End Function

	' Lookup Selecting event
	Sub Lookup_Selecting(fld, filter)

		' Uncomment to below code view the SQL and the filters
		' Response.Write fld.LookupFilters.ToJson()

	End Sub

	' Row Rendering event
	Sub Row_Rendering()
		If Not EW_DEBUG_ENABLED Then On Error Resume Next

		' Enter your code here	
	End Sub

	' Row Rendered event
	Sub Row_Rendered()

		' To view properties of field class, use:
		' Response.Write <FieldName>.AsString() 

	End Sub

	' User ID Filtering event
	Sub UserID_Filtering(filter)

		' Enter your code here
	End Sub

	' Class terminate
	Private Sub Class_Terminate()
		If ew_NotEmpty(m_ID) Then Set m_ID = Nothing
		If ew_NotEmpty(m_zMenu) Then Set m_zMenu = Nothing
		If ew_NotEmpty(m_URL) Then Set m_URL = Nothing
		If ew_NotEmpty(m_Parent_id) Then Set m_Parent_id = Nothing
		If ew_NotEmpty(m_Sequence) Then Set m_Sequence = Nothing
		Set RowAttrs = Nothing
	End Sub
End Class
%>

Youez - 2016 - github.com/yon3zu
LinuXploit