<% if session("admid")="" or Session("class")<>"1" then response.redirect"login.asp"%>
<!--#include file="conn.asp"-->
<title>学期考试名称设置</title>
<link rel="stylesheet" type="text/css" href="style.css">
<%
function err(strin)                             'err("×　请填写...")
Response.Write("<script language=javascript>")
Response.Write("alert('")
Response.Write(strin)
Response.Write("');")
Response.Write("history.go(-1);")
Response.Write("</script>")
Response.End()
end function
%>
<!--显示-->
<%if request("do")="" then%>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
-->
</style><br>
<br>
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#006d63" style="border-collapse: collapse">
<tr><td align="center" bgcolor="#006d63" style="border-bottom:1px solid #FFFFFF;"><b><font color="#FFFFFF">Syllabuss&Component Information设置</font></b></td>
</tr>
<tr><td align="center" bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
  <tr>
    <td bgcolor="#FFFFFF">　</td>
  </tr>
  <tr>
    <td align="center" bgcolor="#FFFFFF"><table border="0" cellpadding="0" style="border-collapse: collapse" width="100%">
        <form id="addadmin" method="POST" action="?do=edit">
          <tr>
            <td style="border-bottom-style: dotted; border-bottom-width: 1px; padding: 0" colspan="4">&nbsp;+&nbsp;添加
			syllabuss:</td>
          </tr>

          <tr>
            <td align=center width="45%">syllabuss名称:</td>
			<td align=center width="18%">Candidate:</td>
			<td align=center width="15%">syllabuss名称:</td>

          </tr>

          <tr>
           
            <td width="45%" >
			<p align="center"><input type="text" name="syllabusname" size="60"></td>
           
			<td width="18%" >
			<p align="center"><input type="text" name="Candidate" size="20"></td>
            <td width="15%" >
  
      <p align="center">
  
      <select name="subjectid" id="N_class">
      <%sql_subject="select * from subject"
set rs_subject=server.createobject("adodb.recordset")
rs_subject.open sql_subject,conn,1,1
if rs_subject.eof And rs_subject.bof then 
response.write "<option>没有subject，请在subject管理创建</option>"
else
do while not rs_subject.eof 
%>      
        <option value="<%=rs_subject("subject_id")%>"><%=rs_subject("subject_name")%></option>
       
<%
rs_subject.movenext
loop
end if
rs_subject.close
%>        
        </select>



</td>

            <td width="22%" ><input type="submit" value="添加" name="addadmin"></td>
          </tr>
        </form>
    </table></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF" height="5">
	<p align="center"><font color="#FF0000">！！请不要使用/ &amp; 等特殊字符</font></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#FFFFFF">
	<table border="0" cellpadding="0" style="border-collapse: collapse" width="971">
        <tr >
          <td colspan="4">&nbsp;--&nbsp;已有syllabuss:</td>
        </tr>
        <%
sql="select * from syllabus"
rs.open sql,conn,1,1
If rs.eof And rs.bof Then 
response.write "<tr><td>没有添加syllabuss信息</td></tr>"
else
do while not rs.eof
%>
        <tr>
          <form id="editadmin" method="POST" action="?do=edit&id=<%=rs("syllabus_id")%>">
            <td   align="center" width="437" >
			<input name="syllabusname" size="60" value="<%=rs("syllabus_name")%>"></td>
            <td  align="center" width="174">
			<input type="text" name="Candidate" size="20" value="<%=rs("Candidate")%>">
			　</td>




            <td  align="center" width="145"><select name="subjectid" id="N_class">

        <%sql_subject="select * from subject"
set rs_subject=server.createobject("adodb.recordset")
rs_subject.open sql_subject,conn,1,1
if rs_subject.eof And rs_subject.bof then 
response.write "<option>没有栏目，请在栏目管理创建</option>"
else
do while not rs_subject.eof 
	
%>      
        <option value="<%=rs_subject("subject_id")%>"  <%If rs("subject_id")=CLng(rs_subject("subject_id")) Then response.write "selected" End if%>><%=rs_subject("subject_name")%></option>
       
<%
rs_subject.movenext
loop
end if
rs_subject.close
%>        

        </select>


</td>
            <td  style="border-top-style: dotted; border-top-width: 1px; border-bottom-style: dotted; border-bottom-width: 1px; padding: 0" width="215"><input type="submit" value="修改" name="editadmin">
              <input value="删除" onClick="window.location.href='?do=del&id=<%=rs("syllabus_id")%>'" type="reset" name="deladmin"></td>
          </form>
        </tr>
        <%
rs.movenext
loop
rs.close
End if
%>
    </table></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">
	<p align="center"><font color="#FF0000">××× 删除syllabuss请慎重，如果已经录入本学期成绩数据，这些数据将全部丢失！！！×××</font></td>
  </tr>
</table></td>
</tr>
</table>
<%end if%>
<!--添加修改-->
<%if request("do")="edit" then%>
<%

'response.write  request("sortname")
'response.end

if  request("syllabusname")="" then

err("×　请填写内容...")
end if


if request("id")<>"" then
	sql="select * from syllabus where syllabus_id="&request("id")
	rs.open sql,conn,3,2
else
	sql="select * from syllabus  where syllabus_name='"&request("syllabusname")&"'"
	rs.open sql,conn,3,2
	if rs.eof then
	rs.addnew
	else %>
<script language=javascript>alert("该学期已存在！");this.location.href='?'</script>
<%end if 
end if
	
	'rs("sort_id")=request("sortid")
	rs("syllabus_name")=request("syllabusname")
	rs("subject_id")=request("subjectid")
	rs("Candidate")=request("Candidate")

    'rs("class")=request("flag")
	rs.update
	rs.close
response.redirect ("syllabus_list.asp")
%>
<%end if%>
<!--删除-->
<%if request("do")="del" then%>
<%
sql="select * from syllabus where syllabus_id="&request("id")
rs.open sql,conn,1,3
rs.delete
rs.update
rs.close
response.redirect ("syllabus_list.asp")
%>
<%end if%>