<%
Response.Buffer = EW_RESPONSE_BUFFER
%>
<!--#include file="ewcfg7.asp"-->
<!--#include file="bhlminfo.asp"-->
<!--#include file="zlogininfo.asp"-->
<!--#include file="aspfn7.asp"-->
<!--#include file="userfn7.asp"-->
<% Session.Timeout = 900 %>
<%
Response.Expires = 0
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", "private, no-cache, no-store, must-revalidate"
%>
<%

' Define page object
Dim bhlm_list
Set bhlm_list = New cbhlm_list
Set Page = bhlm_list

' Page init processing
Call bhlm_list.Page_Init()

' Page main processing
Call bhlm_list.Page_Main()
%>
<!--#include file="header.asp"-->
<% If bhlm.Export = "" Then %>
<script type="text/javascript">
<!--
// Create page object
var bhlm_list = new ew_Page("bhlm_list");
// page properties
bhlm_list.PageID = "list"; // page ID
var EW_PAGE_ID = bhlm_list.PageID; // for backward compatibility
// extend page with Form_CustomValidate function
bhlm_list.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!
 	// Your custom validation code here, return false if invalid. 
 	return true;
 }
bhlm_list.SelectAllKey = function(elem) {
	ew_SelectAll(elem);
}
<% If EW_CLIENT_VALIDATE Then %>
bhlm_list.ValidateRequired = true; // uses JavaScript validation
<% Else %>
bhlm_list.ValidateRequired = false; // no JavaScript validation
<% End If %>
//-->
</script>
<script type="text/javascript">
<!--
var ew_DHTMLEditors = [];
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js"); 
//-->
</script>
<% End If %>
<% If bhlm.Export = "" Then %>
<% End If %>
<%

' Load recordset
Set Rs = bhlm_list.LoadRecordset()
	bhlm_list.lTotalRecs = Rs.RecordCount
	bhlm_list.lStartRec = 1
	If bhlm_list.lDisplayRecs <= 0 Then ' Display all records
		bhlm_list.lDisplayRecs = bhlm_list.lTotalRecs
	End If
	If Not (bhlm.ExportAll And bhlm.Export <> "") Then
		bhlm_list.SetUpStartRec() ' Set up start record position
	End If
%>
<p style='display:none'><span class="aspmaker" style="white-space: nowrap;">表: 信息栏目
</span></p>
<% bhlm_list.ShowMessage %>
<br>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<% If bhlm.Export = "" Then %>
<div class="ewGridUpperPanel">
<% If bhlm.CurrentAction <> "gridadd" And bhlm.CurrentAction <> "gridedit" Then %>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<%= ew_CurrentPage %>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td>
<% If Not IsObject(bhlm_list.Pager) Then Set bhlm_list.Pager = ew_NewPrevNextPager(bhlm_list.lStartRec, bhlm_list.lDisplayRecs, bhlm_list.lTotalRecs) %>
<% If bhlm_list.Pager.RecordCount > 0 Then %>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="aspmaker">页&nbsp;</span></td>
<!--first page button-->
	<% If bhlm_list.Pager.FirstButton.Enabled Then %>
	<td><a href="<%= bhlm_list.PageUrl %>start=<%= bhlm_list.Pager.FirstButton.Start %>"><img src="images/first.gif" alt="首页" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/firstdisab.gif" alt="首页" width="16" height="16" border="0"></td>
	<% End If %>
<!--previous page button-->
	<% If bhlm_list.Pager.PrevButton.Enabled Then %>
	<td><a href="<%= bhlm_list.PageUrl %>start=<%= bhlm_list.Pager.PrevButton.Start %>"><img src="images/prev.gif" alt="上一页" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/prevdisab.gif" alt="上一页" width="16" height="16" border="0"></td>
	<% End If %>
<!--current page number-->
	<td><input type="text" name="<%= EW_TABLE_PAGE_NO %>" id="<%= EW_TABLE_PAGE_NO %>" value="<%= bhlm_list.Pager.CurrentPage %>" size="4"></td>
<!--next page button-->
	<% If bhlm_list.Pager.NextButton.Enabled Then %>
	<td><a href="<%= bhlm_list.PageUrl %>start=<%= bhlm_list.Pager.NextButton.Start %>"><img src="images/next.gif" alt="下一页" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/nextdisab.gif" alt="下一页" width="16" height="16" border="0"></td>
	<% End If %>
<!--last page button-->
	<% If bhlm_list.Pager.LastButton.Enabled Then %>
	<td><a href="<%= bhlm_list.PageUrl %>start=<%= bhlm_list.Pager.LastButton.Start %>"><img src="images/last.gif" alt="尾页" width="16" height="16" border="0"></a></td>	
	<% Else %>
	<td><img src="images/lastdisab.gif" alt="尾页" width="16" height="16" border="0"></td>
	<% End If %>
	<td><span class="aspmaker">&nbsp;的 <%= bhlm_list.Pager.PageCount %></span></td>
	</tr></table>
	</td>	
	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
	<td>
	<span class="aspmaker">记录数 <%= bhlm_list.Pager.FromIndex %> 到 <%= bhlm_list.Pager.ToIndex %> 的 <%= bhlm_list.Pager.RecordCount %></span>
<% Else %>
	<% If Security.CanList Then %>
	<% If bhlm_list.sSrchWhere = "0=101" Then %>
	<span class="aspmaker">请输入查询条件</span>
	<% Else %>
	<span class="aspmaker">没有找到记录</span>
	<% End If %>
	<% Else %>
	<span class="aspmaker">你无权查看</span>
	<% End If %>
<% End If %>
		</td>
	</tr>
</table>
</form>
<% End If %>
<span class="aspmaker">
<% If Security.CanAdd Then %>
<a href="<%= bhlm.AddUrl %>">增加</a>&nbsp;&nbsp;
<% End If %>
<% If bhlm_list.lTotalRecs > 0 Then %>
<% If Security.CanDelete Then %>
<a href="" onclick="if (!ew_KeySelected(document.fbhlmlist)) alert('没有选择记录'); else {document.fbhlmlist.action='bhlmdelete.asp';document.fbhlmlist.encoding='application/x-www-form-urlencoded';document.fbhlmlist.submit();};return false;">删除所选记录</a>&nbsp;&nbsp;
<% End If %>
<% End If %>
</span>
</div>
<% End If %>
<div class="ewGridMiddlePanel">
<form name="fbhlmlist" id="fbhlmlist" class="ewForm" action="" method="post">
<% If bhlm_list.lTotalRecs > 0 Then %>
<table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
<%
	bhlm_list.lOptionCnt = 0
If Security.CanView Then
	bhlm_list.lOptionCnt = bhlm_list.lOptionCnt + 1 ' View
End If
If Security.CanEdit Then
	bhlm_list.lOptionCnt = bhlm_list.lOptionCnt + 1 ' Edit
End If
If Security.CanAdd Then
	bhlm_list.lOptionCnt = bhlm_list.lOptionCnt + 1 ' Copy
End If
If Security.AllowList("xwlm") Then
	bhlm_list.lOptionCnt = bhlm_list.lOptionCnt + 1 ' Detail
End If
If Security.AllowList("xwfb") Then
	bhlm_list.lOptionCnt = bhlm_list.lOptionCnt + 1 ' Detail
End If
If Security.CanDelete Then
	bhlm_list.lOptionCnt = bhlm_list.lOptionCnt + 1 ' Multi-select
End If
	bhlm_list.lOptionCnt = bhlm_list.lOptionCnt + bhlm_list.ListOptions.Items.Count ' Custom list options
%>
<%= bhlm.TableCustomInnerHTML %>
<thead><!-- Table header -->
	<tr class="ewTableHeader">
<% If bhlm.bh.Visible Then ' bh %>
	<% If bhlm.SortUrl(bhlm.bh) = "" Then %>
		<td>编号</td>
	<% Else %>
		<td class="ewPointer" onmousedown="ew_Sort(event,'<%= bhlm.SortUrl(bhlm.bh) %>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><tr><td>编号</td><td style="width: 10px;"><% If bhlm.bh.Sort = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf bhlm.bh.Sort = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></td></tr></table>
		</td>
	<% End If %>
<% End If %>		
<% If bhlm.bhmc.Visible Then ' bhmc %>
	<% If bhlm.SortUrl(bhlm.bhmc) = "" Then %>
		<td>编号名称</td>
	<% Else %>
		<td class="ewPointer" onmousedown="ew_Sort(event,'<%= bhlm.SortUrl(bhlm.bhmc) %>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><tr><td>编号名称</td><td style="width: 10px;"><% If bhlm.bhmc.Sort = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf bhlm.bhmc.Sort = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></td></tr></table>
		</td>
	<% End If %>
<% End If %>		
<% If bhlm.px.Visible Then ' px %>
	<% If bhlm.SortUrl(bhlm.px) = "" Then %>
		<td>排序</td>
	<% Else %>
		<td class="ewPointer" onmousedown="ew_Sort(event,'<%= bhlm.SortUrl(bhlm.px) %>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><tr><td>排序</td><td style="width: 10px;"><% If bhlm.px.Sort = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf bhlm.px.Sort = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></td></tr></table>
		</td>
	<% End If %>
<% End If %>		
<% If bhlm.urllb.Visible Then ' urllb %>
	<% If bhlm.SortUrl(bhlm.urllb) = "" Then %>
		<td>展示类别</td>
	<% Else %>
		<td class="ewPointer" onmousedown="ew_Sort(event,'<%= bhlm.SortUrl(bhlm.urllb) %>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><tr><td>展示类别</td><td style="width: 10px;"><% If bhlm.urllb.Sort = "ASC" Then %><img src="images/sortup.gif" width="10" height="9" border="0"><% ElseIf bhlm.urllb.Sort = "DESC" Then %><img src="images/sortdown.gif" width="10" height="9" border="0"><% End If %></td></tr></table>
		</td>
	<% End If %>
<% End If %>		
<% If bhlm.Export = "" Then %>
<% If Security.CanView Then %>
<td style="white-space: nowrap;">&nbsp;</td>
<% End If %>
<% If Security.CanEdit Then %>
<td style="white-space: nowrap;">&nbsp;</td>
<% End If %>
<% If Security.CanAdd Then %>
<td style="white-space: nowrap;">&nbsp;</td>
<% End If %>
<% If Security.AllowList("xwlm") Then %>
<td style="white-space: nowrap;">&nbsp;</td>
<% End If %>
<% If Security.AllowList("xwfb") Then %>
<td style="white-space: nowrap;">&nbsp;</td>
<% End If %>
<% If Security.CanDelete Then %>
<td style="white-space: nowrap;">
<input type="checkbox" name="key" id="key" class="aspmaker" onclick="bhlm_list.SelectAllKey(this);">
</td>
<% End If %>
<%

' Custom list options
For i = 0 to bhlm_list.ListOptions.Items.Count -1
	If bhlm_list.ListOptions.Items(i).Visible Then Response.Write bhlm_list.ListOptions.Items(i).HeaderCellHtml
Next
%>
<% End If %>
	</tr>
</thead>
<tbody><!-- Table body -->
<%
If (bhlm.ExportAll And bhlm.Export <> "") Then
	bhlm_list.lStopRec = bhlm_list.lTotalRecs
Else
	bhlm_list.lStopRec = bhlm_list.lStartRec + bhlm_list.lDisplayRecs - 1 ' Set the last record to display
End If

' Move to first record
bhlm_list.lRecCnt = bhlm_list.lStartRec - 1
If Not Rs.Eof Then
	Rs.MoveFirst
	If bhlm_list.lStartRec > 1 Then Rs.Move bhlm_list.lStartRec - 1
End If
bhlm_list.lRowCnt = 0

' Output date rows
Do While (Not Rs.Eof Or bhlm.CurrentAction = "gridadd") And (bhlm_list.lRecCnt < bhlm_list.lStopRec)
	bhlm_list.lRecCnt = bhlm_list.lRecCnt + 1
	If CLng(bhlm_list.lRecCnt) >= CLng(bhlm_list.lStartRec) Then
		bhlm_list.lRowCnt = bhlm_list.lRowCnt + 1
	bhlm.CssClass = ""
	bhlm.CssStyle = ""
	bhlm.RowClientEvents = "onmouseover='ew_MouseOver(event, this);' onmouseout='ew_MouseOut(event, this);' onclick='ew_Click(event, this);'"
	If bhlm.CurrentAction = "gridadd" Then
		Call bhlm_list.LoadDefaultValues() ' Load default values
	Else
		Call bhlm_list.LoadRowValues(Rs) ' Load row values
	End If
	bhlm.RowType = EW_ROWTYPE_VIEW ' Render view

	' Render row
	Call bhlm_list.RenderRow()
%>
	<tr<%= bhlm.RowAttributes %>>
	<% If bhlm.bh.Visible Then ' bh %>
		<td<%= bhlm.bh.CellAttributes %>>
<div<%= bhlm.bh.ViewAttributes %>><%= bhlm.bh.ListViewValue %></div>
</td>
	<% End If %>
	<% If bhlm.bhmc.Visible Then ' bhmc %>
		<td<%= bhlm.bhmc.CellAttributes %>>
<div<%= bhlm.bhmc.ViewAttributes %>><%= bhlm.bhmc.ListViewValue %></div>
</td>
	<% End If %>
	<% If bhlm.px.Visible Then ' px %>
		<td<%= bhlm.px.CellAttributes %>>
<div<%= bhlm.px.ViewAttributes %>><%= bhlm.px.ListViewValue %></div>
</td>
	<% End If %>
	<% If bhlm.urllb.Visible Then ' urllb %>
		<td<%= bhlm.urllb.CellAttributes %>>
<div<%= bhlm.urllb.ViewAttributes %>><%= bhlm.urllb.ListViewValue %></div>
</td>
	<% End If %>
<% If bhlm.Export = "" Then %>
<% If Security.CanView Then %>
<td style="white-space: nowrap;"><span class="aspmaker">
<a href="<%= bhlm.ViewUrl %>">查看</a>
</span></td>
<% End If %>
<% If Security.CanEdit Then %>
<td style="white-space: nowrap;"><span class="aspmaker">
<a href="<%= bhlm.EditUrl %>">编辑</a>
</span></td>
<% End If %>
<% If Security.CanAdd Then %>
<td style="white-space: nowrap;"><span class="aspmaker">
<a href="<%= bhlm.CopyUrl %>">复制</a>
</span></td>
<% End If %>
<% If Security.AllowList("xwlm") Then %>
<td style="white-space: nowrap;"><span class="aspmaker">
<a href="xwlmlist.asp?<%= EW_TABLE_SHOW_MASTER %>=bhlm&bh=<%= Server.URLEncode(bhlm.bh.CurrentValue&"") %>">信息二级栏目...</a>
</span></td>
<% End If %>
<% If Security.AllowList("xwfb") Then %>
<td style="white-space: nowrap;"><span class="aspmaker">
<a href="xwfblist.asp?<%= EW_TABLE_SHOW_MASTER %>=bhlm&bh=<%= Server.URLEncode(bhlm.bh.CurrentValue&"") %>">信息管理...</a>
</span></td>
<% End If %>
<% If Security.CanDelete Then %>
<td style="white-space: nowrap;"><span class="aspmaker">
<input type="checkbox" name="key_m" id="key_m" value="<%= Server.HtmlEncode(bhlm.bh.CurrentValue) %>" class="aspmaker" onclick='ew_ClickMultiCheckbox(this);'>
</span></td>
<% End If %>
<%

' Custom list options
For i = 0 to bhlm_list.ListOptions.Items.Count -1
	If bhlm_list.ListOptions.Items(i).Visible Then Response.Write bhlm_list.ListOptions.Items(i).BodyCellHtml
Next
%>
<% End If %>
	</tr>
<%
	End If
	If bhlm.CurrentAction <> "gridadd" Then Rs.MoveNext
Loop
%>
</tbody>
</table>
<% End If %>
</form>
<%

' Close recordset and connection
Rs.Close
Set Rs = Nothing
%>
</div>
<% If bhlm_list.lTotalRecs > 0 Then %>
<% If bhlm.Export = "" Then %>
<div class="ewGridLowerPanel">
<% If bhlm.CurrentAction <> "gridadd" And bhlm.CurrentAction <> "gridedit" Then %>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<%= ew_CurrentPage %>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td>
<% If Not IsObject(bhlm_list.Pager) Then Set bhlm_list.Pager = ew_NewPrevNextPager(bhlm_list.lStartRec, bhlm_list.lDisplayRecs, bhlm_list.lTotalRecs) %>
<% If bhlm_list.Pager.RecordCount > 0 Then %>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="aspmaker">页&nbsp;</span></td>
<!--first page button-->
	<% If bhlm_list.Pager.FirstButton.Enabled Then %>
	<td><a href="<%= bhlm_list.PageUrl %>start=<%= bhlm_list.Pager.FirstButton.Start %>"><img src="images/first.gif" alt="首页" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/firstdisab.gif" alt="首页" width="16" height="16" border="0"></td>
	<% End If %>
<!--previous page button-->
	<% If bhlm_list.Pager.PrevButton.Enabled Then %>
	<td><a href="<%= bhlm_list.PageUrl %>start=<%= bhlm_list.Pager.PrevButton.Start %>"><img src="images/prev.gif" alt="上一页" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/prevdisab.gif" alt="上一页" width="16" height="16" border="0"></td>
	<% End If %>
<!--current page number-->
	<td><input type="text" name="<%= EW_TABLE_PAGE_NO %>" id="<%= EW_TABLE_PAGE_NO %>" value="<%= bhlm_list.Pager.CurrentPage %>" size="4"></td>
<!--next page button-->
	<% If bhlm_list.Pager.NextButton.Enabled Then %>
	<td><a href="<%= bhlm_list.PageUrl %>start=<%= bhlm_list.Pager.NextButton.Start %>"><img src="images/next.gif" alt="下一页" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/nextdisab.gif" alt="下一页" width="16" height="16" border="0"></td>
	<% End If %>
<!--last page button-->
	<% If bhlm_list.Pager.LastButton.Enabled Then %>
	<td><a href="<%= bhlm_list.PageUrl %>start=<%= bhlm_list.Pager.LastButton.Start %>"><img src="images/last.gif" alt="尾页" width="16" height="16" border="0"></a></td>	
	<% Else %>
	<td><img src="images/lastdisab.gif" alt="尾页" width="16" height="16" border="0"></td>
	<% End If %>
	<td><span class="aspmaker">&nbsp;的 <%= bhlm_list.Pager.PageCount %></span></td>
	</tr></table>
	</td>	
	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
	<td>
	<span class="aspmaker">记录数 <%= bhlm_list.Pager.FromIndex %> 到 <%= bhlm_list.Pager.ToIndex %> 的 <%= bhlm_list.Pager.RecordCount %></span>
<% Else %>
	<% If Security.CanList Then %>
	<% If bhlm_list.sSrchWhere = "0=101" Then %>
	<span class="aspmaker">请输入查询条件</span>
	<% Else %>
	<span class="aspmaker">没有找到记录</span>
	<% End If %>
	<% Else %>
	<span class="aspmaker">你无权查看</span>
	<% End If %>
<% End If %>
		</td>
	</tr>
</table>
</form>
<% End If %>
<% 'If bhlm_list.lTotalRecs > 0 Then %>
<span class="aspmaker">
<% If Security.CanAdd Then %>
<a href="<%= bhlm.AddUrl %>">增加</a>&nbsp;&nbsp;
<% End If %>
<% If bhlm_list.lTotalRecs > 0 Then %>
<% If Security.CanDelete Then %>
<a href="" onclick="if (!ew_KeySelected(document.fbhlmlist)) alert('没有选择记录'); else {document.fbhlmlist.action='bhlmdelete.asp';document.fbhlmlist.encoding='application/x-www-form-urlencoded';document.fbhlmlist.submit();};return false;">删除所选记录</a>&nbsp;&nbsp;
<% End If %>
<% End If %>
</span>
<% 'End If %>
</div>
<% End If %>
<% End If %>
</td></tr></table>
<% If bhlm.Export = "" And bhlm.CurrentAction = "" Then %>
<script type="text/javascript">
<!--
//ew_ToggleSearchPanel(bhlm_list); // uncomment to init search panel as collapsed
//-->
</script>
<% End If %>
<% If bhlm.Export = "" Then %>
<script language="JavaScript" 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 bhlm_list = Nothing
%>
<%

' -----------------------------------------------------------------
' Page Class
'
Class cbhlm_list

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

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

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

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

	' Page Url
	Public Property Get PageUrl()
		PageUrl = ew_CurrentPage() & "?"
		If bhlm.UseTokenInUrl Then PageUrl = PageUrl & "t=" & bhlm.TableVar & "&" ' add page token
	End Property

	' Message
	Public Property Get Message()
		Message = Session(EW_SESSION_MESSAGE)
	End Property

	Public Property Let Message(v)
		If Session(EW_SESSION_MESSAGE) <> "" Then ' Append
			Session(EW_SESSION_MESSAGE) = Session(EW_SESSION_MESSAGE) & "<br>" & v
		Else
			Session(EW_SESSION_MESSAGE) = v
		End If
	End Property

	' Show Message
	Public Sub ShowMessage()
		If Message <> "" Then ' Message in Session, display
			Response.Write "<p><span class=""ewMessage"">" & Message & "</span></p>"
			Session(EW_SESSION_MESSAGE) = "" ' Clear message in Session
		End If
	End Sub

	' -----------------------
	'  Validate Page request
	'
	Public Function IsPageRequest()
		If bhlm.UseTokenInUrl Then
			IsPageRequest = False
			If Not (ObjForm Is Nothing) Then
				IsPageRequest = (bhlm.TableVar = ObjForm.GetValue("t"))
			End If
			If Request.QueryString("t").Count > 0 Then
				IsPageRequest = (bhlm.TableVar = Request.QueryString("t"))
			End If
		Else
			IsPageRequest = True
		End If
	End Function

	' -----------------------------------------------------------------
	'  Class initialize
	'  - init objects
	'  - open ADO connection
	'
	Private Sub Class_Initialize()

		' Initialize table object
		Set bhlm = New cbhlm

		' Initialize other table object
		Set zlogin = New czlogin

		' Initialize form object
		Set ObjForm = Nothing

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

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

		' Open connection to the database
		Set Conn = Server.CreateObject("ADODB.Connection")
		Conn.Open EW_DB_CONNECTION_STRING

		' Initialize list options
		Set ListOptions = New cListOptions
	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(TableName)

		' Table Permission loaded event
		Call Security.TablePermission_Loaded()
		If Not Security.CanList Then
			Call Security.SaveLastUrl()
			Call Page_Terminate("login.asp")
		End If
		bhlm.Export = Request.QueryString("export") ' Get export parameter
		gsExport = bhlm.Export ' Get export parameter, used in header
		gsExportFile = bhlm.TableVar ' Get export file, used in header

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

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

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

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

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

		' Global page unloaded event (in userfn60.asp)
		Call Page_Unloaded()
		If Not (Conn Is Nothing) Then Conn.Close ' Close Connection
		Set Conn = Nothing
		Set Security = Nothing
		Set bhlm = Nothing
		Set ListOptions = Nothing

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

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

	Dim lDisplayRecs ' Number of display records
	Dim lStartRec, lStopRec, lTotalRecs, lRecRange
	Dim sSrchWhere
	Dim lRecCnt
	Dim lEditRowCnt
	Dim lRowCnt, lRowIndex
	Dim lOptionCnt
	Dim lRecPerRow, lColCnt
	Dim sDeleteConfirmMsg ' Delete confirm message
	Dim sDbMasterFilter, sDbDetailFilter
	Dim bMasterRecordExists
	Dim ListOptions
	Dim sMultiSelectKey

	' -----------------------------------------------------------------
	' Page main processing
	'
	Sub Page_Main()
		lDisplayRecs = 20
		lRecRange = 10
		lRecCnt = 0 ' Record count

		' Search filters
		Dim sSrchAdvanced, sSrchBasic, sFilter
		sSrchAdvanced = "" ' Advanced search filter
		sSrchBasic = "" ' Basic search filter
		sSrchWhere = "" ' Search where clause
		sFilter = ""

		' Master/Detail
		sDbMasterFilter = "" ' Master filter
		sDbDetailFilter = "" ' Detail filter
		If IsPageRequest Then ' Validate request

			' Handle reset command
			ResetCmd()

			' Set Up Sorting Order
			SetUpSortOrder()
		End If ' End Validate Request

		' Restore display records
		If bhlm.RecordsPerPage <> "" Then
			lDisplayRecs = bhlm.RecordsPerPage ' Restore from Session
		Else
			lDisplayRecs = 20 ' Load default
		End If

		' Load Sorting Order
		LoadSortOrder()

		' Build filter
		sFilter = ""
		If Not Security.CanList Then
			sFilter = "(0=1)" ' Filter all records
		End If
		If sDbDetailFilter <> "" Then
			If sFilter <> "" Then
				sFilter = "(" & sFilter & ") AND (" & sDbDetailFilter & ")"
			Else
				sFilter = sDbDetailFilter
			End If
		End If
		If sSrchWhere <> "" Then
			If sFilter <> "" Then
				sFilter = "(" & sFilter & ") AND (" & sSrchWhere & ")"
			Else
				sFilter = sSrchWhere
			End If
		End If

		' Set up filter in Session
		bhlm.SessionWhere = sFilter
		bhlm.CurrentFilter = ""
	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
			bhlm.CurrentOrder = Request.QueryString("order")
			bhlm.CurrentOrderType = Request.QueryString("ordertype")

			' Field bh
			Call bhlm.UpdateSort(bhlm.bh)

			' Field bhmc
			Call bhlm.UpdateSort(bhlm.bhmc)

			' Field px
			Call bhlm.UpdateSort(bhlm.px)

			' Field urllb
			Call bhlm.UpdateSort(bhlm.urllb)
			bhlm.StartRecordNumber = 1 ' Reset start position
		End If
	End Sub

	' -----------------------------------------------------------------
	' Load Sort Order parameters
	'
	Sub LoadSortOrder()
		Dim sOrderBy
		sOrderBy = bhlm.SessionOrderBy ' Get order by from Session
		If sOrderBy = "" Then
			If bhlm.SqlOrderBy <> "" Then
				sOrderBy = bhlm.SqlOrderBy
				bhlm.SessionOrderBy = sOrderBy
			End If
		End If
	End Sub

	' -----------------------------------------------------------------
	' Reset command based on querystring parameter cmd=
	' - RESET: reset search parameters
	' - RESETALL: reset search & master/detail parameters
	' - RESETSORT: reset sort parameters
	'
	Sub ResetCmd()
		Dim sCmd

		' Get reset cmd
		If Request.QueryString("cmd").Count > 0 Then
			sCmd = Request.QueryString("cmd")

			' Reset Sort Criteria
			If LCase(sCmd) = "resetsort" Then
				Dim sOrderBy
				sOrderBy = ""
				bhlm.SessionOrderBy = sOrderBy
				bhlm.bh.Sort = ""
				bhlm.bhmc.Sort = ""
				bhlm.px.Sort = ""
				bhlm.urllb.Sort = ""
			End If

			' Reset start position
			lStartRec = 1
			bhlm.StartRecordNumber = lStartRec
		End If
	End Sub
	Dim Pager

	' -----------------------------------------------------------------
	' Set up Starting Record parameters based on Pager Navigation
	'
	Sub SetUpStartRec()
		Dim nPageNo

		' Exit if lDisplayRecs = 0
		If lDisplayRecs = 0 Then Exit Sub
		If IsPageRequest Then ' Validate request

			' Check for a START parameter
			If Request.QueryString(EW_TABLE_START_REC).Count > 0 Then
				lStartRec = Request.QueryString(EW_TABLE_START_REC)
				bhlm.StartRecordNumber = lStartRec
			ElseIf Request.QueryString(EW_TABLE_PAGE_NO).Count > 0 Then
				nPageNo = Request.QueryString(EW_TABLE_PAGE_NO)
				If IsNumeric(nPageNo) Then
					lStartRec = (nPageNo-1)*lDisplayRecs+1
					If lStartRec <= 0 Then
						lStartRec = 1
					ElseIf lStartRec >= ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 Then
						lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1
					End If
					bhlm.StartRecordNumber = lStartRec
				End If
			End If
		End If
		lStartRec = bhlm.StartRecordNumber

		' Check if correct start record counter
		If Not IsNumeric(lStartRec) Or lStartRec = "" Then ' Avoid invalid start record counter
			lStartRec = 1 ' Reset start record counter
			bhlm.StartRecordNumber = lStartRec
		ElseIf CLng(lStartRec) > CLng(lTotalRecs) Then ' Avoid starting record > total records
			lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to last page first record
			bhlm.StartRecordNumber = lStartRec
		ElseIf (lStartRec-1) Mod lDisplayRecs <> 0 Then
			lStartRec = ((lStartRec-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to page boundary
			bhlm.StartRecordNumber = lStartRec
		End If
	End Sub

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

		' Call Recordset Selecting event
		Call bhlm.Recordset_Selecting(bhlm.CurrentFilter)

		' Load list page sql
		Dim sSql
		sSql = bhlm.ListSQL
		If EW_DEBUG_ENABLED Then Response.Write sSql ' Show SQL for debugging

		' Load recordset
		Dim RsRecordset
		Set RsRecordset = Server.CreateObject("ADODB.Recordset")
		RsRecordset.CursorLocation = EW_CURSORLOCATION
		RsRecordset.Open sSql, Conn, 1, 2

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

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

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

		' Load sql based on filter
		bhlm.CurrentFilter = sFilter
		sSql = bhlm.SQL
		If EW_DEBUG_ENABLED Then Response.Write sSql ' Show SQL for debugging
		Set RsRow = Server.CreateObject("ADODB.Recordset")
		RsRow.Open sSql, Conn
		If RsRow.Eof Then
			LoadRow = False
		Else
			LoadRow = True
			RsRow.MoveFirst
			Call LoadRowValues(RsRow) ' Load row values

			' Call Row Selected event
			Call bhlm.Row_Selected(RsRow)
		End If
		RsRow.Close
		Set RsRow = Nothing
	End Function

	' -----------------------------------------------------------------
	' Load row values from recordset
	'
	Sub LoadRowValues(RsRow)
		bhlm.bh.DbValue = RsRow("bh")
		bhlm.bhmc.DbValue = RsRow("bhmc")
		bhlm.px.DbValue = RsRow("px")
		bhlm.urllb.DbValue = RsRow("urllb")
	End Sub

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

		' Call Row Rendering event
		Call bhlm.Row_Rendering()

		' ---------------------------------------
		'  Common render codes for all row types
		' ---------------------------------------
		' bh

		bhlm.bh.CellCssStyle = ""
		bhlm.bh.CellCssClass = ""

		' bhmc
		bhlm.bhmc.CellCssStyle = ""
		bhlm.bhmc.CellCssClass = ""

		' px
		bhlm.px.CellCssStyle = ""
		bhlm.px.CellCssClass = ""

		' urllb
		bhlm.urllb.CellCssStyle = ""
		bhlm.urllb.CellCssClass = ""

		' -----------
		'  View  Row
		' -----------

		If bhlm.RowType = EW_ROWTYPE_VIEW Then ' View row

			' bh
			bhlm.bh.ViewValue = bhlm.bh.CurrentValue
			bhlm.bh.CssStyle = ""
			bhlm.bh.CssClass = ""
			bhlm.bh.ViewCustomAttributes = ""

			' bhmc
			bhlm.bhmc.ViewValue = bhlm.bhmc.CurrentValue
			bhlm.bhmc.CssStyle = ""
			bhlm.bhmc.CssClass = ""
			bhlm.bhmc.ViewCustomAttributes = ""

			' px
			bhlm.px.ViewValue = bhlm.px.CurrentValue
			bhlm.px.CssStyle = ""
			bhlm.px.CssClass = ""
			bhlm.px.ViewCustomAttributes = ""

			' urllb
			If Not IsNull(bhlm.urllb.CurrentValue) Then
				Select Case bhlm.urllb.CurrentValue
					Case "0"
						bhlm.urllb.ViewValue = "列表"
					Case "1"
						bhlm.urllb.ViewValue = "单页"
					Case "2"
						bhlm.urllb.ViewValue = "图片列表"
					Case Else
						bhlm.urllb.ViewValue = bhlm.urllb.CurrentValue
				End Select
			Else
				bhlm.urllb.ViewValue = Null
			End If
			bhlm.urllb.CssStyle = ""
			bhlm.urllb.CssClass = ""
			bhlm.urllb.ViewCustomAttributes = ""

			' View refer script
			' bh

			bhlm.bh.HrefValue = ""

			' bhmc
			bhlm.bhmc.HrefValue = ""

			' px
			bhlm.px.HrefValue = ""

			' urllb
			bhlm.urllb.HrefValue = ""
		End If

		' Call Row Rendered event
		Call bhlm.Row_Rendered()
	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

	' Form Custom Validate event
	Function Form_CustomValidate(CustomError)

		'Return error message in CustomError
		Form_CustomValidate = True
	End Function
End Class
%>
