<%
Response.Buffer = EW_RESPONSE_BUFFER
%>
<!--#include file="ewcfg11.asp"-->
<!--#include file="websetinfo.asp"-->
<!--#include file="zlogininfo.asp"-->
<!--#include file="aspfn11.asp"-->
<!--#include file="md5.asp"-->
<!--#include file="userfn11.asp"-->
<% Session.Timeout = 900 %>
<% Call ew_Header(False, EW_CHARSET) %>
<%

' Define page object
Dim webset_view
Set webset_view = New cwebset_view
Set Page = webset_view

' Page init processing
webset_view.Page_Init()

' Page main processing
webset_view.Page_Main()

' Global Page Rendering event (in userfn*.asp)
Page_Rendering()

' Page Rendering event
webset_view.Page_Render()
%>
<!--#include file="header.asp"-->
<% If webset.Export = "" Then %>
<script type="text/javascript">
// Page object
var webset_view = new ew_Page("webset_view");
webset_view.PageID = "view"; // Page ID
var EW_PAGE_ID = webset_view.PageID; // For backward compatibility
// Form object
var fwebsetview = new ew_Form("fwebsetview");
// Form_CustomValidate event
fwebsetview.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 %>
fwebsetview.ValidateRequired = true; // Use JavaScript validation
<% Else %>
fwebsetview.ValidateRequired = false; // No JavaScript validation
<% End If %>
// Dynamic selection lists
// Form object for search
</script>
<script type="text/javascript">
// Write your client script here, no need to add script tags.
</script>
<% End If %>
<% If webset.Export = "" Then %>
<% Breadcrumb.Render() %>
<% End If %>
<% If webset.Export = "" Then %>
<div class="ewViewExportOptions">
<% webset_view.ExportOptions.Render "body", "", "", "", "", "" %>
<% If Not webset_view.ExportOptions.UseDropDownButton Then %>
</div>
<div class="ewViewOtherOptions">
<% End If %>
<%
	webset_view.ActionOptions.Render "body", "", "", "", "", ""
	webset_view.DetailOptions.Render "body", "", "", "", "", ""
%>
</div>
<% End If %>
<% webset_view.ShowPageHeader() %>
<% webset_view.ShowMessage %>
<% If webset.Export = "" Then %>
<form name="ewPagerForm" class="ewForm form-inline" action="<%= ew_CurrentPage %>">
<table class="ewPager">
<tr><td>
<% If Not IsObject(webset_view.Pager) Then Set webset_view.Pager = ew_NewPrevNextPager(webset_view.StartRec, webset_view.DisplayRecs, webset_view.TotalRecs) %>
<% If webset_view.Pager.RecordCount > 0 Then %>
<table class="ewStdTable"><tbody><tr><td>
	<%= Language.Phrase("Page") %>&nbsp;
<div class="input-prepend input-append">
<!--first page button-->
	<% If webset_view.Pager.FirstButton.Enabled Then %>
	<a class="btn btn-small" href="<%= webset_view.PageUrl %>start=<%= webset_view.Pager.FirstButton.Start %>"><i class="icon-step-backward"></i></a>
	<% Else %>
	<a class="btn btn-small disabled"><i class="icon-step-backward"></i></a>
	<% End If %>
<!--previous page button-->
	<% If webset_view.Pager.PrevButton.Enabled Then %>
	<a class="btn btn-small" href="<%= webset_view.PageUrl %>start=<%= webset_view.Pager.PrevButton.Start %>"><i class="icon-prev"></i></a>
	<% Else %>
	<a class="btn btn-small disabled"><i class="icon-prev"></i></a>
	<% End If %>
<!--current page number-->
	<input class="input-mini" type="text" name="<%= EW_TABLE_PAGE_NO %>" value="<%= webset_view.Pager.CurrentPage %>">
<!--next page button-->
	<% If webset_view.Pager.NextButton.Enabled Then %>
	<a class="btn btn-small" href="<%= webset_view.PageUrl %>start=<%= webset_view.Pager.NextButton.Start %>"><i class="icon-play"></i></a>
	<% Else %>
	<a class="btn btn-small disabled"><i class="icon-play"></i></a>
	<% End If %>
<!--last page button-->
	<% If webset_view.Pager.LastButton.Enabled Then %>
	<a class="btn btn-small" href="<%= webset_view.PageUrl %>start=<%= webset_view.Pager.LastButton.Start %>"><i class="icon-step-forward"></i></a>
	<% Else %>
	<a class="btn btn-small disabled"><i class="icon-step-forward"></i></a>
	<% End If %>
</div>
	&nbsp;<%= Language.Phrase("of") %>&nbsp;<%= webset_view.Pager.PageCount %>
</td>
</tr></tbody></table>
<% Else %>
	<p><%= Language.Phrase("NoRecord") %></p>
<% End If %>
</td>
</tr></table>
</form>
<% End If %>
<form name="fwebsetview" id="fwebsetview" class="ewForm form-inline" action="<%= ew_CurrentPage %>" method="post">
<input type="hidden" name="t" value="webset">
<table class="ewGrid"><tr><td>
<table id="tbl_websetview" class="table table-bordered table-striped">
<% If webset.id.Visible Then ' id %>
	<tr id="r_id">
		<td><span id="elh_webset_id"><%= webset.id.FldCaption %></span></td>
		<td<%= webset.id.CellAttributes %>>
<span id="el_webset_id" class="control-group">
<span<%= webset.id.ViewAttributes %>>
<%= webset.id.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.webname.Visible Then ' webname %>
	<tr id="r_webname">
		<td><span id="elh_webset_webname"><%= webset.webname.FldCaption %></span></td>
		<td<%= webset.webname.CellAttributes %>>
<span id="el_webset_webname" class="control-group">
<span<%= webset.webname.ViewAttributes %>>
<%= webset.webname.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.icp.Visible Then ' icp %>
	<tr id="r_icp">
		<td><span id="elh_webset_icp"><%= webset.icp.FldCaption %></span></td>
		<td<%= webset.icp.CellAttributes %>>
<span id="el_webset_icp" class="control-group">
<span<%= webset.icp.ViewAttributes %>>
<%= webset.icp.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.lxr.Visible Then ' lxr %>
	<tr id="r_lxr">
		<td><span id="elh_webset_lxr"><%= webset.lxr.FldCaption %></span></td>
		<td<%= webset.lxr.CellAttributes %>>
<span id="el_webset_lxr" class="control-group">
<span<%= webset.lxr.ViewAttributes %>>
<%= webset.lxr.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.sj.Visible Then ' sj %>
	<tr id="r_sj">
		<td><span id="elh_webset_sj"><%= webset.sj.FldCaption %></span></td>
		<td<%= webset.sj.CellAttributes %>>
<span id="el_webset_sj" class="control-group">
<span<%= webset.sj.ViewAttributes %>>
<%= webset.sj.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.zj.Visible Then ' zj %>
	<tr id="r_zj">
		<td><span id="elh_webset_zj"><%= webset.zj.FldCaption %></span></td>
		<td<%= webset.zj.CellAttributes %>>
<span id="el_webset_zj" class="control-group">
<span<%= webset.zj.ViewAttributes %>>
<%= webset.zj.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.cz.Visible Then ' cz %>
	<tr id="r_cz">
		<td><span id="elh_webset_cz"><%= webset.cz.FldCaption %></span></td>
		<td<%= webset.cz.CellAttributes %>>
<span id="el_webset_cz" class="control-group">
<span<%= webset.cz.ViewAttributes %>>
<%= webset.cz.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.dz.Visible Then ' dz %>
	<tr id="r_dz">
		<td><span id="elh_webset_dz"><%= webset.dz.FldCaption %></span></td>
		<td<%= webset.dz.CellAttributes %>>
<span id="el_webset_dz" class="control-group">
<span<%= webset.dz.ViewAttributes %>>
<%= webset.dz.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.yx.Visible Then ' yx %>
	<tr id="r_yx">
		<td><span id="elh_webset_yx"><%= webset.yx.FldCaption %></span></td>
		<td<%= webset.yx.CellAttributes %>>
<span id="el_webset_yx" class="control-group">
<span<%= webset.yx.ViewAttributes %>>
<%= webset.yx.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.phone400.Visible Then ' phone400 %>
	<tr id="r_phone400">
		<td><span id="elh_webset_phone400"><%= webset.phone400.FldCaption %></span></td>
		<td<%= webset.phone400.CellAttributes %>>
<span id="el_webset_phone400" class="control-group">
<span<%= webset.phone400.ViewAttributes %>>
<%= webset.phone400.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.qq1.Visible Then ' qq1 %>
	<tr id="r_qq1">
		<td><span id="elh_webset_qq1"><%= webset.qq1.FldCaption %></span></td>
		<td<%= webset.qq1.CellAttributes %>>
<span id="el_webset_qq1" class="control-group">
<span<%= webset.qq1.ViewAttributes %>>
<%= webset.qq1.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.qq2.Visible Then ' qq2 %>
	<tr id="r_qq2">
		<td><span id="elh_webset_qq2"><%= webset.qq2.FldCaption %></span></td>
		<td<%= webset.qq2.CellAttributes %>>
<span id="el_webset_qq2" class="control-group">
<span<%= webset.qq2.ViewAttributes %>>
<%= webset.qq2.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.qq3.Visible Then ' qq3 %>
	<tr id="r_qq3">
		<td><span id="elh_webset_qq3"><%= webset.qq3.FldCaption %></span></td>
		<td<%= webset.qq3.CellAttributes %>>
<span id="el_webset_qq3" class="control-group">
<span<%= webset.qq3.ViewAttributes %>>
<%= webset.qq3.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.qq4.Visible Then ' qq4 %>
	<tr id="r_qq4">
		<td><span id="elh_webset_qq4"><%= webset.qq4.FldCaption %></span></td>
		<td<%= webset.qq4.CellAttributes %>>
<span id="el_webset_qq4" class="control-group">
<span<%= webset.qq4.ViewAttributes %>>
<%= webset.qq4.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.ww1.Visible Then ' ww1 %>
	<tr id="r_ww1">
		<td><span id="elh_webset_ww1"><%= webset.ww1.FldCaption %></span></td>
		<td<%= webset.ww1.CellAttributes %>>
<span id="el_webset_ww1" class="control-group">
<span<%= webset.ww1.ViewAttributes %>>
<%= webset.ww1.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.ww2.Visible Then ' ww2 %>
	<tr id="r_ww2">
		<td><span id="elh_webset_ww2"><%= webset.ww2.FldCaption %></span></td>
		<td<%= webset.ww2.CellAttributes %>>
<span id="el_webset_ww2" class="control-group">
<span<%= webset.ww2.ViewAttributes %>>
<%= webset.ww2.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.ww3.Visible Then ' ww3 %>
	<tr id="r_ww3">
		<td><span id="elh_webset_ww3"><%= webset.ww3.FldCaption %></span></td>
		<td<%= webset.ww3.CellAttributes %>>
<span id="el_webset_ww3" class="control-group">
<span<%= webset.ww3.ViewAttributes %>>
<%= webset.ww3.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.tongji.Visible Then ' tongji %>
	<tr id="r_tongji">
		<td><span id="elh_webset_tongji"><%= webset.tongji.FldCaption %></span></td>
		<td<%= webset.tongji.CellAttributes %>>
<span id="el_webset_tongji" class="control-group">
<span<%= webset.tongji.ViewAttributes %>>
<%= webset.tongji.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.ishtml.Visible Then ' ishtml %>
	<tr id="r_ishtml">
		<td><span id="elh_webset_ishtml"><%= webset.ishtml.FldCaption %></span></td>
		<td<%= webset.ishtml.CellAttributes %>>
<span id="el_webset_ishtml" class="control-group">
<span<%= webset.ishtml.ViewAttributes %>>
<%= webset.ishtml.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.isqq.Visible Then ' isqq %>
	<tr id="r_isqq">
		<td><span id="elh_webset_isqq"><%= webset.isqq.FldCaption %></span></td>
		<td<%= webset.isqq.CellAttributes %>>
<span id="el_webset_isqq" class="control-group">
<span<%= webset.isqq.ViewAttributes %>>
<%= webset.isqq.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
<% If webset.logo.Visible Then ' logo %>
	<tr id="r_logo">
		<td><span id="elh_webset_logo"><%= webset.logo.FldCaption %></span></td>
		<td<%= webset.logo.CellAttributes %>>
<span id="el_webset_logo" class="control-group">
<span<%= webset.logo.ViewAttributes %>>
<%= webset.logo.ViewValue %>
</span>
</span>
</td>
	</tr>
<% End If %>
</table>
</td></tr></table>
<% If webset.Export = "" Then %>
<table class="ewPager">
<tr><td>
<% If Not IsObject(webset_view.Pager) Then Set webset_view.Pager = ew_NewPrevNextPager(webset_view.StartRec, webset_view.DisplayRecs, webset_view.TotalRecs) %>
<% If webset_view.Pager.RecordCount > 0 Then %>
<table class="ewStdTable"><tbody><tr><td>
	<%= Language.Phrase("Page") %>&nbsp;
<div class="input-prepend input-append">
<!--first page button-->
	<% If webset_view.Pager.FirstButton.Enabled Then %>
	<a class="btn btn-small" href="<%= webset_view.PageUrl %>start=<%= webset_view.Pager.FirstButton.Start %>"><i class="icon-step-backward"></i></a>
	<% Else %>
	<a class="btn btn-small disabled"><i class="icon-step-backward"></i></a>
	<% End If %>
<!--previous page button-->
	<% If webset_view.Pager.PrevButton.Enabled Then %>
	<a class="btn btn-small" href="<%= webset_view.PageUrl %>start=<%= webset_view.Pager.PrevButton.Start %>"><i class="icon-prev"></i></a>
	<% Else %>
	<a class="btn btn-small disabled"><i class="icon-prev"></i></a>
	<% End If %>
<!--current page number-->
	<input class="input-mini" type="text" name="<%= EW_TABLE_PAGE_NO %>" value="<%= webset_view.Pager.CurrentPage %>">
<!--next page button-->
	<% If webset_view.Pager.NextButton.Enabled Then %>
	<a class="btn btn-small" href="<%= webset_view.PageUrl %>start=<%= webset_view.Pager.NextButton.Start %>"><i class="icon-play"></i></a>
	<% Else %>
	<a class="btn btn-small disabled"><i class="icon-play"></i></a>
	<% End If %>
<!--last page button-->
	<% If webset_view.Pager.LastButton.Enabled Then %>
	<a class="btn btn-small" href="<%= webset_view.PageUrl %>start=<%= webset_view.Pager.LastButton.Start %>"><i class="icon-step-forward"></i></a>
	<% Else %>
	<a class="btn btn-small disabled"><i class="icon-step-forward"></i></a>
	<% End If %>
</div>
	&nbsp;<%= Language.Phrase("of") %>&nbsp;<%= webset_view.Pager.PageCount %>
</td>
</tr></tbody></table>
<% Else %>
	<p><%= Language.Phrase("NoRecord") %></p>
<% End If %>
</td>
</tr></table>
<% End If %>
</form>
<script type="text/javascript">
fwebsetview.Init();
</script>
<%
webset_view.ShowPageFooter()
If EW_DEBUG_ENABLED Then Response.Write ew_DebugMsg()
%>
<% If webset.Export = "" Then %>
<script type="text/javascript">
// Write your table-specific startup script here
// document.write("page loaded");
</script>
<% End If %>
<!--#include file="footer.asp"-->
<%

' Drop page object
Set webset_view = Nothing
%>
<%

' -----------------------------------------------------------------
' Page Class
'
Class cwebset_view

	' Page ID
	Public Property Get PageID()
		PageID = "view"
	End Property

	' Project ID
	Public Property Get ProjectID()
		ProjectID = "{9AC218D3-4571-402E-9408-D679EC504540}"
	End Property

	' Table Name
	Public Property Get TableName()
		TableName = "webset"
	End Property

	' Page Object Name
	Public Property Get PageObjName()
		PageObjName = "webset_view"
	End Property

	' Page Name
	Public Property Get PageName()
		PageName = ew_CurrentPage()
	End Property

	' Page Url
	Public Property Get PageUrl()
		PageUrl = ew_CurrentPage() & "?"
		If webset.UseTokenInUrl Then PageUrl = PageUrl & "t=" & webset.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

	' 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

	' 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"">&times;</button>" & sMessage
			html = html & "<div class=""alert alert-success ewSuccess"">" & 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"">&times;</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"">&times;</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"">&times;</button>" & sErrorMessage
			html = html & "<div class=""alert alert-error ewError"">" & sErrorMessage & "</div>"
			Session(EW_SESSION_FAILURE_MESSAGE) = "" ' Clear message in Session
		End If
		Response.Write "<table class=""ewStdTable""><tr><td><div class=""ewMessageDialog""" & ew_IIf(hidden, " style=""display: none;""", "") & ">" & html & "</div></td></tr></table>"
	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 webset.UseTokenInUrl Then
			IsPageRequest = False
			If Not (ObjForm Is Nothing) Then
				IsPageRequest = (webset.TableVar = ObjForm.GetValue("t"))
			End If
			If Request.QueryString("t").Count > 0 Then
				IsPageRequest = (webset.TableVar = Request.QueryString("t"))
			End If
		Else
			IsPageRequest = True
		End If
	End Function

	' -----------------------------------------------------------------
	'  Class initialize
	'  - init objects
	'  - open ADO connection
	'
	Private Sub Class_Initialize()
		If IsEmpty(StartTimer) Then StartTimer = Timer ' Init start time

		' Initialize language object
		If IsEmpty(Language) Then
			Set Language = New cLanguage
			Call Language.LoadPhrases()
		End If

		' Initialize table object
		If IsEmpty(webset) Then Set webset = New cwebset
		Set Table = webset

		' Initialize urls
		Dim KeyUrl
		KeyUrl = ""
		If Request.QueryString("id").Count > 0 Then
			ew_AddKey RecKey, "id", Request.QueryString("id")
			KeyUrl = KeyUrl & "&amp;id=" & Server.URLEncode(Request.QueryString("id"))
		End If
		ExportPrintUrl = PageUrl & "export=print" & KeyUrl
		ExportHtmlUrl = PageUrl & "export=html" & KeyUrl
		ExportExcelUrl = PageUrl & "export=excel" & KeyUrl
		ExportWordUrl = PageUrl & "export=word" & KeyUrl
		ExportXmlUrl = PageUrl & "export=xml" & KeyUrl
		ExportCsvUrl = PageUrl & "export=csv" & KeyUrl
		ExportPdfUrl = PageUrl & "export=pdf" & KeyUrl

		' Initialize other table object
		If IsEmpty(zlogin) Then Set zlogin = New czlogin

		' Initialize form object
		Set ObjForm = Nothing

		' Intialize page id (for backward compatibility)
		EW_PAGE_ID = "view"

		' Initialize table name (for backward compatibility)
		EW_TABLE_NAME = "webset"

		' Open connection to the database
		If IsEmpty(Conn) Then Call ew_Connect()

		' Export options
		Set ExportOptions = New cListOptions
		ExportOptions.TableVar = webset.TableVar
		ExportOptions.Tag = "div"
		ExportOptions.TagClassName = "ewExportOption"

		' Other options
		Set ActionOptions = New cListOptions
		ActionOptions.Tag = "div"
		ActionOptions.TagClassName = "ewActionOption"
		Set DetailOptions = New cListOptions
		DetailOptions.Tag = "div"
		DetailOptions.TagClassName = "ewDetailOption"
	End Sub

	' -----------------------------------------------------------------
	'  Subroutine Page_Init
	'  - called before page main
	'  - check Security
	'  - set up response header
	'  - call page load events
	'
	Sub Page_Init()
		Set Security = New cAdvancedSecurity
		If Not Security.IsLoggedIn() Then Call Security.AutoLogin()
		If Not Security.IsLoggedIn() Then
			Call Security.SaveLastUrl()
			Call Page_Terminate("login.asp")
		End If

		' Table Permission loading event
		Call Security.TablePermission_Loading()
		Call Security.LoadCurrentUserLevel(ProjectID & TableName)

		' Table Permission loaded event
		Call Security.TablePermission_Loaded()
		If Not Security.IsLoggedIn() Then
			Call Security.SaveLastUrl()
			Call Page_Terminate("login.asp")
		End If
		If Not Security.CanView Then
			Call Security.SaveLastUrl()
			Call Page_Terminate("websetlist.asp")
		End If

		' Global page loading event (in userfn7.asp)
		Page_Loading()

		' Page load event, used in current page
		Page_Load()
	End Sub

	' -----------------------------------------------------------------
	'  Class terminate
	'  - clean up page object
	'
	Private Sub Class_Terminate()
		Call Page_Terminate("")
	End Sub

	' -----------------------------------------------------------------
	'  Subroutine Page_Terminate
	'  - called when exit page
	'  - clean up ADO connection and objects
	'  - if url specified, redirect to url
	'
	Sub Page_Terminate(url)

		' Page unload event, used in current page
		Call Page_Unload()

		' Global page unloaded event (in userfn60.asp)
		Call Page_Unloaded()
		Dim sRedirectUrl
		sReDirectUrl = url
		Call Page_Redirecting(sReDirectUrl)
		If Not (Conn Is Nothing) Then Conn.Close ' Close Connection
		Set Conn = Nothing
		Set Security = Nothing
		Set webset = Nothing
		Set ObjForm = Nothing

		' Go to url if specified
		If sReDirectUrl <> "" Then
			If Response.Buffer Then Response.Clear
			Response.Redirect sReDirectUrl
		End If
	End Sub

	'
	'  Subroutine Page_Terminate (End)
	' ----------------------------------------

	Dim DisplayRecs ' Number of display records
	Dim StartRec, StopRec, TotalRecs, RecRange
	Dim RecCnt
	Dim RecKey
	Dim ExportOptions ' Export options
	Dim DetailOptions ' Other options (detail)
	Dim ActionOptions ' Other options (action)
	Dim Recordset

	' -----------------------------------------------------------------
	' Page main processing
	'
	Sub Page_Main()

		' Paging variables
		DisplayRecs = 1
		RecRange = 10

		' Load current record
		Dim bLoadCurrentRecord
		bLoadCurrentRecord = False
		Dim sReturnUrl
		sReturnUrl = ""
		Dim bMatchRecord
		bMatchRecord = False

		' Set up Breadcrumb
		SetupBreadcrumb()
		If IsPageRequest Then ' Validate request
			If Request.QueryString("id").Count > 0 Then
				webset.id.QueryStringValue = Request.QueryString("id")
			Else
				bLoadCurrentRecord = True
			End If

			' Get action
			webset.CurrentAction = "I" ' Display form
			Select Case webset.CurrentAction
				Case "I" ' Get a record to display
					StartRec = 1 ' Initialize start position
					Set Recordset = LoadRecordset() ' Load records
					TotalRecs = Recordset.RecordCount ' Get record count
					If TotalRecs <= 0 Then ' No record found
						If SuccessMessage = "" And FailureMessage = "" Then
							FailureMessage = Language.Phrase("NoRecord") ' Set no record message
						End If
						sReturnUrl = "websetlist.asp"
					ElseIf bLoadCurrentRecord Then ' Load current record position
						SetUpStartRec() ' Set up start record position

						' Point to current record
						If CLng(StartRec) <= CLng(TotalRecs) Then
							bMatchRecord = True
							Recordset.Move StartRec-1
						End If
					Else ' Match key values
						Do While Not Recordset.Eof
							If CStr(webset.id.CurrentValue&"") = CStr(Recordset("id")&"") Then
								webset.StartRecordNumber = StartRec ' Save record position
								bMatchRecord = True
								Exit Do
							Else
								StartRec = StartRec + 1
								Recordset.MoveNext
							End If
						Loop
					End If
					If Not bMatchRecord Then
						If SuccessMessage = "" And FailureMessage = "" Then
							FailureMessage = Language.Phrase("NoRecord") ' Set no record message
						End If
						sReturnUrl = "websetlist.asp" ' No matching record, return to list
					Else
						Call LoadRowValues(Recordset) ' Load row values
					End If
			End Select
		Else
			sReturnUrl = "websetlist.asp" ' Not page request, return to list
		End If
		If sReturnUrl <> "" Then Call Page_Terminate(sReturnUrl)

		' Render row
		webset.RowType = EW_ROWTYPE_VIEW
		Call webset.ResetAttrs()
		Call RenderRow()
	End Sub

	' Set up other options
	Sub SetupOtherOptions()
		Dim opt, item
		Set opt = ActionOptions

		' Add
		Call opt.Add("add")
		Set item = opt.GetItem("add")
		item.Body = "<a class=""ewAction ewAdd"" href=""" & ew_HtmlEncode(AddUrl) & """>" & Language.Phrase("ViewPageAddLink") & "</a>"
		item.Visible = (AddUrl <> "" And Security.CanAdd)

		' Edit
		Call opt.Add("edit")
		Set item = opt.GetItem("edit")
		item.Body = "<a class=""ewAction ewEdit"" href=""" & ew_HtmlEncode(EditUrl) & """>" & Language.Phrase("ViewPageEditLink") & "</a>"
		item.Visible = (EditUrl <> "" And Security.CanEdit)

		' Copy
		Call opt.Add("copy")
		Set item = opt.GetItem("copy")
		item.Body = "<a class=""ewAction ewCopy"" href=""" & ew_HtmlEncode(CopyUrl) & """>" & Language.Phrase("ViewPageCopyLink") & "</a>"
		item.Visible = (CopyUrl <> "" And Security.CanAdd)

		' Delete
		Call opt.Add("delete")
		Set item = opt.GetItem("delete")
		item.Body = "<a onclick=""return ew_Confirm(ewLanguage.Phrase('DeleteConfirmMsg'));"" class=""ewAction ewDelete"" href=""" & ew_HtmlEncode(DeleteUrl) & """>" & Language.Phrase("ViewPageDeleteLink") & "</a>"
		item.Visible = (DeleteUrl <> "" And Security.CanDelete)

		' Set up options default
		Set opt = ActionOptions
		opt.DropDownButtonPhrase = Language.Phrase("ButtonActions")
		opt.UseDropDownButton = False
		opt.UseButtonGroup = True
		Call opt.Add(opt.GroupOptionName)
		Set item = opt.GetItem(opt.GroupOptionName)
		item.Body = ""
		item.Visible = False
		Set opt = DetailOptions
		opt.DropDownButtonPhrase = Language.Phrase("ButtonDetails")
		opt.UseDropDownButton = False
		opt.UseButtonGroup = True
		Call opt.Add(opt.GroupOptionName)
		Set item = opt.GetItem(opt.GroupOptionName)
		item.Body = ""
		item.Visible = False
	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)
				webset.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
					webset.StartRecordNumber = StartRec
				End If
			End If
		End If
		StartRec = webset.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
			webset.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
			webset.StartRecordNumber = StartRec
		ElseIf (StartRec-1) Mod DisplayRecs <> 0 Then
			StartRec = ((StartRec-1)\DisplayRecs)*DisplayRecs+1 ' Point to page boundary
			webset.StartRecordNumber = StartRec
		End If
	End Sub

	' -----------------------------------------------------------------
	' Load recordset
	'
	Function LoadRecordset()

		' Call Recordset Selecting event
		Dim sFilter
		sFilter = webset.CurrentFilter
		Call webset.Recordset_Selecting(sFilter)
		webset.CurrentFilter = sFilter

		' Load list page sql
		Dim sSql
		sSql = webset.ListSQL
		Call ew_SetDebugMsg("LoadRecordset: " & sSql) ' Show SQL for debugging

		' Load recordset
		Dim RsRecordset
		Set RsRecordset = ew_LoadRecordset(sSql)

		' Call Recordset Selected event
		Call webset.Recordset_Selected(RsRecordset)
		Set LoadRecordset = RsRecordset
	End Function

	' -----------------------------------------------------------------
	' Load row based on key values
	'
	Function LoadRow()
		Dim RsRow, sSql, sFilter
		sFilter = webset.KeyFilter

		' Call Row Selecting event
		Call webset.Row_Selecting(sFilter)

		' Load sql based on filter
		webset.CurrentFilter = sFilter
		sSql = webset.SQL
		Call ew_SetDebugMsg("LoadRow: " & sSql) ' Show SQL for debugging
		Set RsRow = ew_LoadRow(sSql)
		If RsRow.Eof Then
			LoadRow = False
		Else
			LoadRow = True
			RsRow.MoveFirst
			Call LoadRowValues(RsRow) ' Load row values
		End If
		RsRow.Close
		Set RsRow = Nothing
	End Function

	' -----------------------------------------------------------------
	' Load row values from recordset
	'
	Sub LoadRowValues(RsRow)
		Dim sDetailFilter
		If Not EW_DEBUG_ENABLED Then On Error Resume Next
		If RsRow.Eof Then Exit Sub

		' Call Row Selected event
		Call webset.Row_Selected(RsRow)
		webset.id.DbValue = RsRow("id")
		webset.webname.DbValue = RsRow("webname")
		webset.icp.DbValue = RsRow("icp")
		webset.lxr.DbValue = RsRow("lxr")
		webset.sj.DbValue = RsRow("sj")
		webset.zj.DbValue = RsRow("zj")
		webset.cz.DbValue = RsRow("cz")
		webset.dz.DbValue = RsRow("dz")
		webset.yx.DbValue = RsRow("yx")
		webset.phone400.DbValue = RsRow("phone400")
		webset.qq1.DbValue = RsRow("qq1")
		webset.qq2.DbValue = RsRow("qq2")
		webset.qq3.DbValue = RsRow("qq3")
		webset.qq4.DbValue = RsRow("qq4")
		webset.ww1.DbValue = RsRow("ww1")
		webset.ww2.DbValue = RsRow("ww2")
		webset.ww3.DbValue = RsRow("ww3")
		webset.tongji.DbValue = RsRow("tongji")
		webset.ishtml.DbValue = RsRow("ishtml")
		webset.isqq.DbValue = RsRow("isqq")
		webset.logo.DbValue = RsRow("logo")
	End Sub

	' Load DbValue from recordset
	Sub LoadDbValues(Rs)
		If Not EW_DEBUG_ENABLED Then On Error Resume Next
		If Rs.Eof Then Exit Sub
		webset.id.m_DbValue = Rs("id")
		webset.webname.m_DbValue = Rs("webname")
		webset.icp.m_DbValue = Rs("icp")
		webset.lxr.m_DbValue = Rs("lxr")
		webset.sj.m_DbValue = Rs("sj")
		webset.zj.m_DbValue = Rs("zj")
		webset.cz.m_DbValue = Rs("cz")
		webset.dz.m_DbValue = Rs("dz")
		webset.yx.m_DbValue = Rs("yx")
		webset.phone400.m_DbValue = Rs("phone400")
		webset.qq1.m_DbValue = Rs("qq1")
		webset.qq2.m_DbValue = Rs("qq2")
		webset.qq3.m_DbValue = Rs("qq3")
		webset.qq4.m_DbValue = Rs("qq4")
		webset.ww1.m_DbValue = Rs("ww1")
		webset.ww2.m_DbValue = Rs("ww2")
		webset.ww3.m_DbValue = Rs("ww3")
		webset.tongji.m_DbValue = Rs("tongji")
		webset.ishtml.m_DbValue = Rs("ishtml")
		webset.isqq.m_DbValue = Rs("isqq")
		webset.logo.m_DbValue = Rs("logo")
	End Sub

	' -----------------------------------------------------------------
	' Render row values based on field settings
	'
	Sub RenderRow()

		' Initialize urls
		AddUrl = webset.AddUrl
		EditUrl = webset.EditUrl("")
		CopyUrl = webset.CopyUrl("")
		DeleteUrl = webset.DeleteUrl
		ListUrl = webset.ListUrl
		SetupOtherOptions()

		' Call Row Rendering event
		Call webset.Row_Rendering()

		' ---------------------------------------
		'  Common render codes for all row types
		' ---------------------------------------
		' id
		' webname
		' icp
		' lxr
		' sj
		' zj
		' cz
		' dz
		' yx
		' phone400
		' qq1
		' qq2
		' qq3
		' qq4
		' ww1
		' ww2
		' ww3
		' tongji
		' ishtml
		' isqq
		' logo
		' -----------
		'  View  Row
		' -----------

		If webset.RowType = EW_ROWTYPE_VIEW Then ' View row

			' id
			webset.id.ViewValue = webset.id.CurrentValue
			webset.id.ViewCustomAttributes = ""

			' webname
			webset.webname.ViewValue = webset.webname.CurrentValue
			webset.webname.ViewCustomAttributes = ""

			' icp
			webset.icp.ViewValue = webset.icp.CurrentValue
			webset.icp.ViewCustomAttributes = ""

			' lxr
			webset.lxr.ViewValue = webset.lxr.CurrentValue
			webset.lxr.ViewCustomAttributes = ""

			' sj
			webset.sj.ViewValue = webset.sj.CurrentValue
			webset.sj.ViewCustomAttributes = ""

			' zj
			webset.zj.ViewValue = webset.zj.CurrentValue
			webset.zj.ViewCustomAttributes = ""

			' cz
			webset.cz.ViewValue = webset.cz.CurrentValue
			webset.cz.ViewCustomAttributes = ""

			' dz
			webset.dz.ViewValue = webset.dz.CurrentValue
			webset.dz.ViewCustomAttributes = ""

			' yx
			webset.yx.ViewValue = webset.yx.CurrentValue
			webset.yx.ViewCustomAttributes = ""

			' phone400
			webset.phone400.ViewValue = webset.phone400.CurrentValue
			webset.phone400.ViewCustomAttributes = ""

			' qq1
			webset.qq1.ViewValue = webset.qq1.CurrentValue
			webset.qq1.ViewCustomAttributes = ""

			' qq2
			webset.qq2.ViewValue = webset.qq2.CurrentValue
			webset.qq2.ViewCustomAttributes = ""

			' qq3
			webset.qq3.ViewValue = webset.qq3.CurrentValue
			webset.qq3.ViewCustomAttributes = ""

			' qq4
			webset.qq4.ViewValue = webset.qq4.CurrentValue
			webset.qq4.ViewCustomAttributes = ""

			' ww1
			webset.ww1.ViewValue = webset.ww1.CurrentValue
			webset.ww1.ViewCustomAttributes = ""

			' ww2
			webset.ww2.ViewValue = webset.ww2.CurrentValue
			webset.ww2.ViewCustomAttributes = ""

			' ww3
			webset.ww3.ViewValue = webset.ww3.CurrentValue
			webset.ww3.ViewCustomAttributes = ""

			' tongji
			webset.tongji.ViewValue = webset.tongji.CurrentValue
			If Not IsNull(webset.tongji.ViewValue) Then
				webset.tongji.ViewValue = Replace(webset.tongji.ViewValue, vbLf, "<br>")
			End If
			webset.tongji.ViewCustomAttributes = ""

			' ishtml
			If Not IsNull(webset.ishtml.CurrentValue) Then
				Select Case webset.ishtml.CurrentValue & ""
					Case webset.ishtml.FldTagValue(1)
						webset.ishtml.ViewValue = ew_IIf(webset.ishtml.FldTagCaption(1) <> "", webset.ishtml.FldTagCaption(1), webset.ishtml.CurrentValue)
					Case webset.ishtml.FldTagValue(2)
						webset.ishtml.ViewValue = ew_IIf(webset.ishtml.FldTagCaption(2) <> "", webset.ishtml.FldTagCaption(2), webset.ishtml.CurrentValue)
					Case Else
						webset.ishtml.ViewValue = webset.ishtml.CurrentValue
				End Select
			Else
				webset.ishtml.ViewValue = Null
			End If
			webset.ishtml.ViewCustomAttributes = ""

			' isqq
			If Not IsNull(webset.isqq.CurrentValue) Then
				Select Case webset.isqq.CurrentValue & ""
					Case webset.isqq.FldTagValue(1)
						webset.isqq.ViewValue = ew_IIf(webset.isqq.FldTagCaption(1) <> "", webset.isqq.FldTagCaption(1), webset.isqq.CurrentValue)
					Case webset.isqq.FldTagValue(2)
						webset.isqq.ViewValue = ew_IIf(webset.isqq.FldTagCaption(2) <> "", webset.isqq.FldTagCaption(2), webset.isqq.CurrentValue)
					Case Else
						webset.isqq.ViewValue = webset.isqq.CurrentValue
				End Select
			Else
				webset.isqq.ViewValue = Null
			End If
			webset.isqq.ViewCustomAttributes = ""

			' logo
			webset.logo.ViewValue = webset.logo.CurrentValue
			webset.logo.ViewCustomAttributes = ""

			' View refer script
			' id

			webset.id.LinkCustomAttributes = ""
			webset.id.HrefValue = ""
			webset.id.TooltipValue = ""

			' webname
			webset.webname.LinkCustomAttributes = ""
			webset.webname.HrefValue = ""
			webset.webname.TooltipValue = ""

			' icp
			webset.icp.LinkCustomAttributes = ""
			webset.icp.HrefValue = ""
			webset.icp.TooltipValue = ""

			' lxr
			webset.lxr.LinkCustomAttributes = ""
			webset.lxr.HrefValue = ""
			webset.lxr.TooltipValue = ""

			' sj
			webset.sj.LinkCustomAttributes = ""
			webset.sj.HrefValue = ""
			webset.sj.TooltipValue = ""

			' zj
			webset.zj.LinkCustomAttributes = ""
			webset.zj.HrefValue = ""
			webset.zj.TooltipValue = ""

			' cz
			webset.cz.LinkCustomAttributes = ""
			webset.cz.HrefValue = ""
			webset.cz.TooltipValue = ""

			' dz
			webset.dz.LinkCustomAttributes = ""
			webset.dz.HrefValue = ""
			webset.dz.TooltipValue = ""

			' yx
			webset.yx.LinkCustomAttributes = ""
			webset.yx.HrefValue = ""
			webset.yx.TooltipValue = ""

			' phone400
			webset.phone400.LinkCustomAttributes = ""
			webset.phone400.HrefValue = ""
			webset.phone400.TooltipValue = ""

			' qq1
			webset.qq1.LinkCustomAttributes = ""
			webset.qq1.HrefValue = ""
			webset.qq1.TooltipValue = ""

			' qq2
			webset.qq2.LinkCustomAttributes = ""
			webset.qq2.HrefValue = ""
			webset.qq2.TooltipValue = ""

			' qq3
			webset.qq3.LinkCustomAttributes = ""
			webset.qq3.HrefValue = ""
			webset.qq3.TooltipValue = ""

			' qq4
			webset.qq4.LinkCustomAttributes = ""
			webset.qq4.HrefValue = ""
			webset.qq4.TooltipValue = ""

			' ww1
			webset.ww1.LinkCustomAttributes = ""
			webset.ww1.HrefValue = ""
			webset.ww1.TooltipValue = ""

			' ww2
			webset.ww2.LinkCustomAttributes = ""
			webset.ww2.HrefValue = ""
			webset.ww2.TooltipValue = ""

			' ww3
			webset.ww3.LinkCustomAttributes = ""
			webset.ww3.HrefValue = ""
			webset.ww3.TooltipValue = ""

			' tongji
			webset.tongji.LinkCustomAttributes = ""
			webset.tongji.HrefValue = ""
			webset.tongji.TooltipValue = ""

			' ishtml
			webset.ishtml.LinkCustomAttributes = ""
			webset.ishtml.HrefValue = ""
			webset.ishtml.TooltipValue = ""

			' isqq
			webset.isqq.LinkCustomAttributes = ""
			webset.isqq.HrefValue = ""
			webset.isqq.TooltipValue = ""

			' logo
			webset.logo.LinkCustomAttributes = ""
			webset.logo.HrefValue = ""
			webset.logo.TooltipValue = ""
		End If

		' Call Row Rendered event
		If webset.RowType <> EW_ROWTYPE_AGGREGATEINIT Then
			Call webset.Row_Rendered()
		End If
	End Sub

	' Set up Breadcrumb
	Sub SetupBreadcrumb()
		Dim PageId, url
		Set Breadcrumb = New cBreadcrumb
		Call Breadcrumb.Add("list", webset.TableVar, "websetlist.asp", webset.TableVar, True)
		PageId = "view"
		Call Breadcrumb.Add("view", PageId, ew_CurrentUrl, "", False)
	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
End Class
%>
