<%@ Control Language="VB" Inherits="WanerSoft.Provider.BaseControl" AutoEventWireup="false" EnableViewState="false"%>
<%@ Import Namespace="WanerSoft" %>
<%@ Import Namespace="WanerSoft.Provider" %>
<%@ Import Namespace="WanerSoft.Provider.Validate" %>
<%@ Import Namespace="WanerSoft.Model" %>
<%@ Import Namespace="WanerSoft.Data.Factory" %>
<%@ Import Namespace="System.Data" %>
<script runat="server">
Private B As New Ws_BookList
Private C As New Ws_BookChapter
Private BookLink,VolumeLink,ReadAllLink,UpUrl,UpText,DownUrl,DownText As String
Protected Overrides Sub CreateChildControls()
   B = Ws.Instance.WebBookSelect(WanerSoft.Common.Request.Sift("id", "int", 0))
   C = Ws.Instance.BookChapterMakeSelectInfo(WanerSoft.Common.Request.Sift("chapterid", "int", 0))
  If C.id = 0 Then
      Throw New Exception("未找到该编号的章节数据")
  End If
  If C.booktextonoff = False Then
       Throw New Exception("章节还未审核")
  End If
  If C.booktexttemp Then
       Throw New Exception("章节为草稿,还未审核")
  End If
  If C.booktextvip Then
       Throw New Exception("非公众章节")
  End If
   BookLink=ReUrl(B.id,InfoUrl.BookUrlR,InfoUrl.BookUrl)
   VolumeLink=VolumeUrl(B.bookhtml,B.id)
   ReadAllLink=ReadAllUrl(B.bookhtml,B.id)
   C.booktexttype=Ws.Instance.BookChapterSelectText(C,InfoBook)
   If InfoSys.CheckContent.Equals("0") = False Then
       Dim Cc() As String = InfoSys.CheckContent.Split(",")
       For x As Integer = 0 To Cc.Length - 1
           C.booktexttype = C.booktexttype.Replace(Cc(x).Split("|")(0), Cc(x).Split("|")(1))
       Next
       Cc = Nothing
   End If
   If InfoSys.CheckHtml Then
      C.booktexttype = WanerSoft.Common.Strings.HtmlBook(C.booktexttype)
   End If
   C.booktexttype = WanerSoft.Common.Strings.Make(C.booktexttype)
   C.booktexttype = WanerSoft.Common.Strings.RndString(C.booktexttype, InfoSys.HideClass, InfoSys.HideWord)
   If InfoSys.CheckUBB Then
      C.booktexttype = WanerSoft.Common.Strings.UBBCode(C.booktexttype)
   End If
   Dim Dtc As DataTable = New DataTable
   Dtc=Ws.Instance.BookChapterAndVolumeListAll(B.id, False)
   For i As Integer = 0 To Dtc.Rows.Count - 1
       If C.id.ToString = Dtc.Rows(i).Item("id").ToString Then
            If i < Dtc.Rows.Count - 1 Then
                DownUrl = ChapterUrl(B.bookhtml,B.id,Dtc.Rows(i + 1).Item("id"))
				DownText = "<a href=""javascript:document.location=nextpage"">翻下页</a>"
            Else
			    If B.bookvip Then
                     If InfoSys.UrlReWrite Then
                          DownUrl = String.Format(InfoUrl.BookUrlR, InfoSys.RootFolder, B.id, InfoSys.UrlReWriteExtName)
                     Else
                          DownUrl = String.Format(InfoUrl.BookUrl, InfoSys.RootFolder, B.id)
                     End If
                Else
                          DownUrl = InfoSys.RootFolder + "Book/ReadEnd.aspx?id=" + B.id.ToString
                End If
                DownText = "<a href=""javascript:document.location=nextpage"">翻下页</a>"
            End If
            If i > 0 Then
                UpUrl = ChapterUrl(B.bookhtml,B.id,Dtc.Rows(i - 1).Item("id"))
                UpText = "<a href=""javascript:document.location=prevpage"">翻上页</a>"
            Else
                UpUrl = VolumeLink
                UpText = "无上页"
            End If
            Exit For
        End If
   Next
   Dtc.Clear()
   Dtc.Dispose()
End Sub
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=B.booktitle%> <%=C.nclass%> <%=C.booktexttitle%> - <%=InfoSys.HomeTitle%> - <%=InfoSys.HomePageText%></title>
<meta HTTP-EQUIV="Window-target" content="_top" />
<meta HTTP-EQUIV="pragma" content="no-cache" />
<meta HTTP-EQUIV="Cache-Control" content="no-cache, must-revalidate" />
<meta HTTP-EQUIV="expires" content="Wed, 26 Feb 1997 08:21:57 GMT" />
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312" />
<meta name="robots" content="all" />
<meta name="keywords" content="<%=C.nclass%> <%=C.booktexttitle%>,<%=B.booktitle%>,<%=InfoSys.HomeTitle%>" />
<meta name="keywords" content="<%=InfoSys.HomeKeyWords%>" />
<meta name="description" content="<%=InfoSys.HomeDescription%>" />
<link href="/Skin/Default/Css/Common.Css" rel="stylesheet" type="text/css" />
<link href="/Skin/Default/Css/Book.Css" rel="stylesheet" type="text/css" />
</head>

<body bgColor="#f1f1f1">
<script src="/js/Html/BookMenu.js"></script>
<script src="/js/Html/Footer.js"></script>
<script language="javascript">
<!--
document.onkeydown=nextpage
var prevpage="<%=UpUrl%>";
var nextpage="<%=DownUrl%>";
var gotobook="<%=BookLink%>";
function nextpage() {
	if (event.keyCode==37) location=prevpage;
	if (event.keyCode==39) location=nextpage;
	if (event.keyCode==13) location=gotobook;
}
//-->
</SCRIPT>
<center>
  <div id="Ws">
    <div id="Top">
      <div id="Menu"><script>ShowTopMenu(1,'<%=InfoSys.HomeTitle%>','<%=InfoSys.RootFolder%>','<%=ReadAllLink%>','<%=VolumeLink%>','<%=BookLink%>','<%=ReUrl(B.id,InfoUrl.UserBookReComUrlR,InfoUrl.UserBookReComUrl)%>','<%=ReUrl(B.id,InfoUrl.UserBookSaveUrlR,InfoUrl.UserBookSaveUrl)%>','<%=ReTUrl(B.id,C.id,InfoUrl.UserBookMarkUrlR,InfoUrl.UserBookMarkUrl)%>');</script></div>
      <div id="TextSelect"><script src="/js/Html/TextSet.js"></script></div>
	  <div id="AdsT"><script src="/js/readadtop.js"></script></div>
	</div>
	<div id="Content">
      <div id="TextTitle"><span class="newstitle"> <%=C.nclass%> <%=C.booktexttitle%></span></div>
	  <div id="BookText"><br /><%=C.booktexttype%><br /><br /></div>
	  <div id="EndMenu"><script>ShowEndMenu(1,'<%=InfoSys.RootFolder%>','<%=ReadAllLink%>','<%=VolumeLink%>','<%=BookLink%>','<%=ReUrl(B.id,InfoUrl.UserBookReComUrlR,InfoUrl.UserBookReComUrl)%>','<%=ReUrl(B.id,InfoUrl.UserBookSaveUrlR,InfoUrl.UserBookSaveUrl)%>','<%=ReTUrl(B.id,C.id,InfoUrl.UserBookMarkUrlR,InfoUrl.UserBookMarkUrl)%>');</script></div>
	  <hr id="TopLine3" size="1" noshade />
	  <div id="LinkMenu"><script>ShowLinkMenu('<%=UpText%>','<%=VolumeLink%>','<%=DownText%>');</script>
	  </div>
	</div>
    <div id="End">
     <div id="EndType">
	    <div id="AdsE"><script src="/js/readadend.js"></script></div>
        <hr id="TopLine4" size="1" noshade />
	    <div id="Links"><script>ShowLinks();</script></div>
	    <hr id="TopLine5" size="1" noshade />
	    <div id="CopyRight"><script>ShowCopyRight();</script></div>
	 </div>
  </div>
  </div>
</center>
<script src="/js/BookText.js"></script>
<script src='/js/Html/BookSum.aspx?id=<%=B.id%>&chapter=<%=C.id%>'></script>
<script src="/js/gb.js"></script>
</body>
</html>
<%
B=Nothing
C=Nothing
%>