<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% if session("admid")="" or Session("class")<>"1" then response.redirect"login.asp"%>
<!--#include file="conn.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
-->
</style>
</head>
<body>
<%
  Select Case Request.querystring("action")
         case "addtech"
		    Conn.Execute("Insert into tech([Name],SortID,[Number],Content,pic) values('"&Request.form("Name")&"',"&Request.form("SortID")&","&Request.form("Number")&",'"&Request.form("Content")&"','"&Replace(Request.Form("pic"),"../","")&"')")
			Response.Redirect("techer.asp")
		Case "edittech"
		    conn.Execute("update tech Set [Name]='"&Request.form("Name")&"',SortID="&request.form("SortID")&",[Number]="&request.form("Number")&",Content='"&Request.form("Content")&"',pic='"&Replace(Request.Form("pic"),"../","")&"' where id="&Cint(Request.querystring("id")))
			Response.Redirect("techer.asp")
		Case "del"
		    Conn.Execute("delete * from tech where id="&cint(request.querystring("id")))
			Response.redirect("techer.asp")
	   Case "add"				
%>
<table width="500" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#006d63" style="border-collapse: collapse">
  <tr bgcolor="#FFFFFF">
    <td height="25" colspan="2">+教师添加</td>
  </tr>
  <form  action="?action=addtech" method="post" name="myform">
  <tr bgcolor="#FFFFFF">
    <td width="114" height="25">教师学科</td>
    <td width="363" height="25"><select name="SortID" id="SortID">
	<%
	  Set rst=conn.Execute("Select * from booksort Order by id")
	      If not rst.eof then
		     do while not rst.eof
	%>
	    <option value="<%=Rst(0)%>"><%=Trim(Rst(1))%></option>
    <%
	         Rst.MoveNext
			 Loop
		  End If
	Set Rst=Nothing	  	 
	%>
	</select></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="25">教师姓名</td>
    <td height="25"><input name="Name" type="text" id="Name"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="25">简介</td>
    <td height="25"><textarea name="Content" cols="50" rows="6" id="Content"></textarea></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="25">教师图片</td>
    <td height="25"><input name="pic" type="text" id="pic">
    <input type="button" name="goimg2 " value="上传图片" onClick="window.open('upload_flash.asp?formname=myform&editname=pic&uppath=../upload&filelx=jpg','','status=no,scrollbars=no,top=220,left=220,width=420,height=165')"></td>
  </tr>
  <%
    Dim num
	 Set Rst=conn.Execute("Select max(number) from tech")
	    num=Rst(0)+1
     Set rst=nothing		
  %>
  <tr bgcolor="#FFFFFF">
    <td height="25">排序</td>
    <td height="25"><input name="Number" type="text" id="Number" size="10" value="<%=num%>"></td>
  </tr>
  <tr align="center" bgcolor="#FFFFFF">
    <td height="25" colspan="2"><input type="submit" name="Submit" value="提交"></td>
    </tr>
  </form>
</table>
<%
case "edit"
Set Rs=conn.Execute("Select * from tech where id="&cint(Request.querystring("id")))
%>
<table width="500" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#006d63" style="border-collapse: collapse">
  <tr bgcolor="#FFFFFF">
    <td height="25" colspan="2">+教师编辑</td>
  </tr>
  <form  action="?action=edittech&id=<%=Rs(0)%>" method="post" name="myform">
    <tr bgcolor="#FFFFFF">
      <td width="114" height="25">教师学科</td>
      <td width="363" height="25"><select name="SortID" id="SortID">
          <%
	  Set rst=conn.Execute("Select * from booksort Order by id")
	      If not rst.eof then
		     do while not rst.eof
	%>
          <option value="<%=Rst(0)%>" <%If Cint(Rst(0))=Cint(Rs("SortID")) Then Response.write("Selected")%>><%=Trim(Rst(1))%></option>
          <%
	         Rst.MoveNext
			 Loop
		  End If
	Set Rst=Nothing	  	 
	%>
      </select></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td height="25">教师姓名</td>
      <td height="25"><input name="Name" type="text" id="Name" value="<%=Trim(Rs("Name"))%>"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td height="25">简介</td>
      <td height="25"><textarea name="Content" cols="50" rows="6" id="Content"><%=Rs("Content")%></textarea></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td height="25">教师图片</td>
      <td height="25"><input name="pic" type="text" id="pic" value="<%=Rs("pic")%>">
        <input type="button" name="goimg2 " value="上传图片" onClick="window.open('upload_flash.asp?formname=myform&editname=pic&uppath=../upload&filelx=jpg','','status=no,scrollbars=no,top=220,left=220,width=420,height=165')"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td height="25">排序</td>
      <td height="25"><input name="Number" type="text" id="Number" size="10" value="<%=Rs("Number")%>"></td>
    </tr>
    <tr align="center" bgcolor="#FFFFFF">
      <td height="25" colspan="2"><input type="submit" name="Submit" value="提交"></td>
    </tr>
  </form>
</table>
<%
  Rs.Close
  Set Rs=Nothing
%>
<%end Select
  Conn.Close
  Set Conn=Nothing
%>
</body>
</html>
