<!--#include file=conn.asp--><!--#include file=../function.asp-->
<%
checkadmin 
qx=conn.execute("select qx from admin where id="&session("userid")&"")(0)

Id=Trim(request("id"))
requestTB=LCase(request("tb"))
tbName="TB_"&requestTB&"Content"
TableName="TB_"&requestTB&"Class"

Select Case LCase(requestTB)
Case "news":TipsTitle="文章"':		If InStr(qx,",6,")<=0 Then alertmsg "权限不够","",true
Case "honor":TipsTitle="公司荣誉"':If InStr(qx,",9,")<=0 Then alertmsg "权限不够","",true
Case "case":TipsTitle="案例"':If InStr(qx,",12,")<=0 Then alertmsg "权限不够","",true
Case "product" :TipsTitle="产品"':If InStr(qx,",15,")<=0 Then alertmsg "权限不够","",true
End Select 
id=request("id")
If Len(id)<=0 Or Not IsNumeric(id) Then id=0

If request("a")="g" Then 
	
	title=request("title")
	content=request("content")
	Addtime=request("Addtime")
	Hits=request("Hits")
	CID=request("ClassID")
	Pic=request("Pic")
	Addtime=request("Addtime")
		pinpai=request("pinpai")
		xinghao=request("xinghao")
		istop=request("istop")
		isgood=request("isgood")

If istop="" Or Not IsNumeric(istop) Then istop=0
If isgood="" Or Not IsNumeric(isgood) Then isgood=0
If CID="" Or Not IsNumeric(CID) Then CID=0
If CID=0 Then AlertMsg "请选择分类!","",True

Set rs=getRs
	rs.open "select * from "&TableName&" where classid="&CID&"",conn,1,1
	If Not rs.eof Then 
		'ClassID=Rs("ClassID")
		If Rs("BigClass")=0 Then 
			RootClassID=CID
			ClassID=CID
		End If 
		If Rs("BigClass")>0 Then 
			ClassID=CID
			RootClassID=Rs("BigClass")
		End If 
	End If 
	'response.write "classid:"&classid&"<br>rootclassid:"&rootclassid:response.end
rs.close

	Set Rs=getRs
	rs.open "select * from "&tbName&" where id="&id&"",conn,1,3
	If rs.eof Then rs.addnew
		Rs("title")=title
		Rs("content")=content
		Rs("Addtime")=Addtime
		Rs("Hits")=Hits
		Rs("ClassID")=ClassID
		Rs("RootClassID")=RootClassID
		Rs("Pic")=Pic
		Rs("top")=0
		rs("istop")=istop
		rs("isgood")=isgood
	If requestTB="product" Then 
		Rs("pinpai")=pinpai
		rs("xinghao")=xinghao
	End If 
	rs.update
	rs.close
	AlertMsg "操作成功","news_list.asp?tb="&requestTB&"",True
End If 

Set Rs=getRs
rs.open "select * from "&tbName&" where id="&id&"",conn,1,1
If Not rs.eof Then 
	title=Rs("title")
	content=Rs("content")
	Addtime=Rs("Addtime")
	Hits=Rs("Hits")
	ClassID=Rs("ClassID")
	Pic=Rs("Pic")
		s_istop=Rs("istop")
		s_isgood=Rs("isgood")
	If requestTB="product" Then 
		pinpai=Rs("pinpai")
		xinghao=rs("xinghao")
	End If 
Else
	Addtime=Now()
	ClassID=0
	Hits=0
	s_istop=0
	s_isgood=0
End If 
rs.close
%>
<!--#include file=top.asp-->
<script language="Javascript">
editor1.html(htmlspecialchars(content&""))
</Script>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td height="100" class="tTitle"><div align="center">
        <table width="1000" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><div align="left"><%=TipsTitle%>添加/修改</div>
				<div align="left" class=tTitleTips> </div>
			</td>
          </tr>
        </table>
      </div></td>
    </tr>
  </table>
  <table width="1000" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td height="10"></td>
    </tr>
  </table>
  <table width="1000" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="110" align="left" valign="top">
	  
	  
	  <!--#include file=left.asp-->
	  
	  
	  
	  
	  
	  
	  </td>
      <td width="890" align="right" valign="top">
	  
	  
	  
	  
	  
	  
<table width="890" border="0" cellspacing="1" cellpadding="0" bgcolor="#c3e9ff">
  <tr bgcolor="#F6F8F1">
    <td height="30" bgcolor="#FFFFFF" align="left"><div align="center">
      <table width="840" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="30" width="140" style="border-bottom:1px dashed #99d9ff"><div align="left"><%=TipsTitle%>添加/修改</div></td>
          <td height="30" width="700" style="border-bottom:1px dashed #99d9ff"><div align="right"></div></td>
        </tr>
      </table>
      <br />


      <table width="840" border="0" cellspacing="0" cellpadding="0" >
        <form action="?a=g&id=<%=id%>&tb=<%=requestTB%>" method=post name=f1 onsubmit="javascript:editor1.sync();">
		
        <tr>
          <td width="100" height=40><div align="right">信息标题：</div></td>
          <td width="740"><div align="left">
            <input name="title" value="<%=title%>" type="text" class="reginput" onmouseover="this.className='reginputhover'" onmouseout="this.className='reginput'" />
			
			<label title='顶部'><input type="checkbox" name="istop" value=1
	<%If s_istop=1 Then response.write "checked"%>
	>顶</label>&nbsp;&nbsp;
	<label title='推荐'><input type="checkbox" name="isgood" value=1
	<%If s_isgood=1 Then response.write "checked"%>
	>荐</label>
          </div></td>
        </tr>
		 <tr>
          <td  height=40><div align="right">信息分类：</div></td>
          <td ><div align="left">
					<%If id<=0 Then %>
					<% Call ShowClass(TableName) %> <font color="red">*</font>
					<%else%>
					<% Call EditShowClass(TableName,ClassID) %> <font color="red">*</font>
					<%End if%>
          </div></td>
        </tr>
        <tr title="缩略图大小:产品类 204*204 荣誉案例类:175*130 单位像素">
          <td  height=40><div align="right">缩略图：</div></td>
          <td><div align="left">
             <table border=0 width=100%>
				  <tr>
					<td><input name="pic" value="<%=pic%>" id=pic type="text" class="reginput" onmouseover="this.className='reginputhover'" onmouseout="this.className='reginput'" /> </td>
					<td align=left><iframe src=UpFile/UpFile.asp?action=add style="width:400px;height:30px;" frameborder=0 scrolling=no></iframe></td>
				  </tr>
				  </table>
          </div></td>
        </tr>
		<%If requestTB="product" Then %>
        <tr>
          <td width="100" height=40><div align="right">品牌：</div></td>
          <td width="740"><div align="left">
            <input name="pinpai" value="<%=pinpai%>" type="text" class="reginput" onmouseover="this.className='reginputhover'" onmouseout="this.className='reginput'" />
          </div></td>
        </tr>
        <tr>
          <td width="100" height=40><div align="right">型号：</div></td>
          <td width="740"><div align="left">
            <input name="xinghao" value="<%=xinghao%>" type="text" class="reginput" onmouseover="this.className='reginputhover'" onmouseout="this.className='reginput'" />
          </div></td>
        </tr>
		<%End if%>
        <tr>
          <td  height=40><div align="right">浏览量：</div></td>
          <td ><div align="left">
            <input name="hits" value="<%=hits%>" type="text" class="reginput" onmouseover="this.className='reginputhover'" onmouseout="this.className='reginput'" /> 次
          </div></td>
        </tr>
        <tr>
          <td  height=40><div align="right">添加时间：</div></td>
          <td ><div align="left">
            <input name="Addtime" value="<%=Addtime%>" type="text" class="reginput" onmouseover="this.className='reginputhover'" onmouseout="this.className='reginput'" /> 
          </div></td>
        </tr>

       
        
		<tr>
          <td height=40 colspan="2"><div align="center">
		 
		  <textarea name="content" style="width:800px;height:500px;visibility:hidden;"><%=(content)%></textarea>
		  
          </div></td>
          </tr>

		<tr>
          <td height=40 colspan="2"><div align="center"><br>
            <input type="submit" value="  提  交  " class="btn" onmouseover="this.className='btn2'" onmouseout="this.className='btn'" />
          </div></td>
          </tr>
		  </form>
      </table>
      <br />












    </div></td>
  </tr>
</table>
	  
	  
	  
	  
	  </td>
    </tr>
  </table>
  
  <!--#include file=bottom.asp-->