<%@language=vbscript codepage=936 %>
<!--#include file="Admin.asp" -->
<!--#include file="cf.asp" -->
<!--#include file="adminconn.asp" -->
<!--#include file="../include/safe.asp"-->
<!--#include file="../include/config.asp"-->
<%
dim action,bigclassname,rs,founderr,errmsg
action=trim(request("action"))
uf=trim(request("DownloadUrl"))
bigclassid=trim(request("bigclassid"))
bigclassname=trim(request("bigclassname"))
url=trim(request("url"))
hide=request("hide")
if action="add" then
		dim classid
		set rs2 = server.CreateObject ("adodb.recordset")
		sql="select bigclassid from bigclass where bigclassid="+cstr(request("bigclassid"))
 		rs2.open sql,conn,1,1
		if not rs2.eof and not rs2.bof then
		rs2.close
		set rs2=nothing%>
		<script language=javascript>  
			alert( "错误：总类ID号有重复"  );
			location.href = "javascript:history.back()"  
		</script>
		<%
		response.End()
		end if
	if bigclassname="" then
		founderr=true
		errmsg=errmsg & "<br><li>发行时间不能为空！</li>"
	end if
	if bigclassid="" then
		founderr=true
		errmsg=errmsg & "<br><li>发行时间不能为空！</li>"
	end if
	if founderr<>true then
		set rs=server.createobject("adodb.recordset")
		rs.open "select * from bigclass where bigclassname='" & bigclassname & "'",conn,1,3
		if not (rs.bof and rs.eof) then
			founderr=true
			errmsg=errmsg & "<br><li>发行时间“" & bigclassname & "”有重复</li>"
		else
    	 	rs.addnew
     		rs("bigclassid")=bigclassid
			rs("bigclassname")=bigclassname
			rs("uf")=uf
			if hide="yse" then
			rs("hide")=true
			else
			rs("hide")=false
			end if
			rs("url")=url
			if url<>"" then
			rs("urlok")=true
			end if
    	 	rs.update
     		rs.close%>
			<%
			dim smallclassname,banmian,bigimage,firstimagename,i
for i=1 to 4
			smallclassname=trim(request("smallclassname_"&i))	
			banmian=trim(request("banmian_"&i))				
		
		
			set rs3=server.createobject("adodb.recordset")
			rs3.open "select * from smallclass where bigclassname='" & bigclassname & "'",conn,1,3				
		    rs3.addnew
		
			rs3("bigclassname")=bigclassname
    	 	rs3("smallclassname")=smallclassname				
			rs3("banmian")=banmian
     		rs3.update
			next 
	     	rs3.close
			
    	 	set rs3=nothing 
			   	
			%>
			<%
	     	set rs=nothing
    	 	call closeconn()
			response.redirect "classmanage.asp"  
		end if
	end if
end if
if founderr=true then
	response.Write ""&errmsg&""
else
%>

<link href="../include/css.css" type=text/css rel=stylesheet>
<script language="javascript" src="include/addata.js"></script>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="center" valign="top"> <br>
      <a href="classmanage.asp"><strong> 期 数 设 置</strong></a> <br>
      <form name="form1" method="post" action="classaddbig.asp" onsubmit="return checkbig()">
        <table width="95%" border="0" align="center" cellpadding="0" cellspacing="2" class="border">
          <tr bgcolor="#999999" class="title"> 
            <td height="25" colspan="3" align="center"><strong>添加期数</strong></td>
          </tr>
		  <tr bgcolor="#e3e3e3" class="tdbg"> 
            <td width="163" height="22" bgcolor="#c0c0c0"> <div align="right"><strong>期号：</strong></div></td>
            <td width="776" bgcolor="#e3e3e3" > <input name="bigclassid" type="text" size="20" maxlength="30" value="<%call addtotalsum()%>">（注：您已经添加过<font color="#FF0000"><b> <%call gettotalsum()%> </b></font>期报纸） 
          </td>
          </tr>
          <tr bgcolor="#e3e3e3" class="tdbg"> 
            <td width="163" height="22" bgcolor="#c0c0c0"> <div align="right"><strong>发行时间：</strong></div></td>
            <td bgcolor="#e3e3e3"> <label><input name="bigclassname" type="text" size="20" maxlength="20" onfocus="setday(this)" /></label>（注：点击左边文本框选择日期）
            </td>
          </tr>
		  
		 <tr bgcolor="#e3e3e3" class="tdbg"> 
             <td width="163" height="22" bgcolor="#c0c0c0"> <div align="right"><strong>下载地址：</strong></div>
            <td> <table><tr><td><input name="DownloadUrl" type="text" id="PhotoUrl2" size="30" maxlength="200"></td>
            <td> <iframe style="top:2px" ID="UploadFiles" src="../upload_Photo.asp?PhotoUrlID=1" frameborder=0 scrolling=no width="320" height="25"></iframe></td></tr></table></td>
          </tr>
		  
		  
		  
		  <tr bgcolor="#e3e3e3" class="tdbg"> 
            <td width="163" height="22" bgcolor="#c0c0c0"> <div align="right"><strong>版面添加：</strong></div></td>
            <td bgcolor="#e3e3e3" >
			<table width="300">
			<tr><td width="50%" align="center">版面</td><td width="50%" align="center">版面名称</td>			
			</tr>
			<tr><td width="50%" align="center"><input name="smallclassname_1" type="text" id="scn" size="18" maxlength="50" value="第一版"> </td><td width="50%"><input name="banmian_1" type="text" id="bm" size="19" maxlength="50" value="新闻版"> </td></tr>
			
			<tr><td width="50%" align="center"><input name="smallclassname_2" type="text" id="scn" size="18" maxlength="50" value="第二版"> </td><td width="50%"><input name="banmian_2" type="text" id="bm" size="19" maxlength="50" value="企业版"> </td></tr>
						
			<tr><td width="50%" align="center"><input name="smallclassname_3" type="text" id="scn" size="18" maxlength="50" value="第三版"> </td><td width="50%"><input name="banmian_3" type="text" id="bm" size="19" maxlength="50" value="副刊"> </td></tr>
						
			<tr><td width="50%" align="center"><input name="smallclassname_4" type="text" id="scn" size="18" maxlength="50" value="第四版"> </td><td width="50%"><input name="banmian_4" type="text" id="bm" size="19" maxlength="50" value="A04"> </td></tr>			
				</table>
            </td>
          </tr> 
<tr bgcolor="#e3e3e3" class="tdbg"> 
<td width="273" height="22" bgcolor="#c0c0c0"> <div align="right"><strong>外链接：</strong></div></td>
<td bgcolor="#e3e3e3" > <input name="url" type="text" id="url" size="20" maxlength="50"> 
不需要请留空            </td>
</tr>
<tr bgcolor="#e3e3e3" class="tdbg"> 
<td width="273" height="22" bgcolor="#c0c0c0"> <div align="right"><strong>首页显示：</strong></div></td>
<td width="517" bgcolor="#e3e3e3" ><label>
<input name="hide" type="checkbox" id="hide" value="yes" checked="checked" />
（指首页版块）</label></td>
</tr>
          <tr bgcolor="#c0c0c0" class="tdbg"> 
            <td height="22" align="center" bgcolor="#c0c0c0">&nbsp; </td>
            <td height="22" align="center" bgcolor="#e3e3e3" > <div align="left"> 
                <input name="action" type="hidden" id="action" value="add">
                <input name="add" type="submit" value=" 添 加 ">
              </div></td>
          </tr>
        </table>
      </form></td>
  </tr>
</table>
<%
end if
%>