admin_teacher.asp

来自「eayanQuery思燕大学成绩查询系统 版本 V1.6」· ASP 代码 · 共 506 行 · 第 1/2 页

ASP
506
字号
<%option explicit%>
 <!--#include file="../Conn.asp"-->
<!--#include file="../include/md5.asp"-->
<!--#include file="../include/ReplaceHtml.asp"-->
<!--#include file="../include/PublicFunction.asp"-->
<!--#include file="../include/Session.asp"-->
<%
'强制浏览器重新访问服务器下载页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
'***************************
Dim Action
Action=request.QueryString("Action")
Select Case  Action
 Case "addTeacher"
  Call addTeacher()
 Case "showlist"
  Call TeacherList(0)'0代表是显示默认的教师列表,1代表是显示搜索结果的教师列表
 Case "Dlel_teacher" 
  Call Dlel_teacher()
 Case "EditTeacher" 
  Call Edit_Teacher()
 Case "InputTeacher" 
   Call ShowSearchForm() 
 Case "ShowSearchResult" 
   Call TeacherList(1) '1代表是显示搜索结果的教师列表
 Case Else
  Call Main(0)
End Select

Sub Main(Add_Or_Edit)
    Dim Form_State 'Add_Or_Edit
	'说明,0代表添加数据,1代表编辑现有数据
	If Add_Or_Edit=0 then Form_State=0
	If Add_Or_Edit=1 then 
	   Form_State=1
	     Dim Edit_Teacher_sql,Edit_Teacher_rs
         'Call OpenConn()
         Edit_Teacher_sql="select * from [teacher] where teacher_id='"&request.QueryString("teacher_id")&"'"
         Set Edit_Teacher_rs=server.CreateObject("adodb.recordset")
         Edit_Teacher_rs.open Edit_Teacher_sql,Initialize_Conn,1,3
 	End if
%>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Admin_Teacher.asp管理 </title>
<link href="images/my_style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<script language="javascript">	
function CheckMyForm() 
{
  if(theForm.teacher_name.value == '') {
    alert('请输入辅导员的名称!');
     theForm.teacher_name.focus();
    return false;
  }
  if (theForm.teacher_pass.value == '')
     {
	 alert("请输入教师的密码!");
 	 theForm.teacher_pass.focus();
	 return false; 
   }
 if (theForm.teacher_pass.value!=theForm.teacher_pass2.value)
     {
	 alert("两次密码输入不一致,请重新输入!");
 	 theForm.teacher_pass.focus();
	 return false; 
   }
 if (theForm.teacher_pass.value.length<6)
      {
	 alert("密码长度至少为6位,请重新输入!");
 	 theForm.teacher_pass.focus();
	 return false; 
   }   
   if (theForm.own_class_num.value!='' && (isNaN(theForm.own_class_num.value) || theForm.own_class_num.value<0))
     {
	 alert("所管理的班级数目应填有效数字!");
	 theForm.own_class_num.value="";
	 theForm.own_class_num.focus();
	 return false; 
   }
    if (theForm.department_id.value == '')
     {
	 alert("请选择辅导员所在的院系!");
 	 theForm.department_id.focus();
	 return false; 
   }   
 }
//-->
</script>
</head>
<body background="images/admin_MainBg.gif">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="22%" height="44">&nbsp;</td>
    <td width="28%">&nbsp;</td>
    <td width="28%">&nbsp;</td>
    <td width="22%">&nbsp;</td>
  </tr>
  <tr>
    <td height="28">&nbsp;</td>

    <td align="center" colspan="2"><%call showTeacherMenu()%></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="62">&nbsp;</td>
    <td align="center" colspan="2" rowspan="2">
   <form name="theForm" id="demo" onSubmit="return CheckMyForm()" method="post" action="Admin_Teacher.asp?action=addTeacher"> 
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="31%" height="35"><div align="right">辅导员姓名:</div></td>
        <td width="34%" align="center"><input value="<% if Form_State=1 then response.Write(Edit_Teacher_rs("teacher_name"))%>" type="text" name="teacher_name" onkeyup="value=value.replace(/[ -~]/g,'')" onkeydown="if(event.keyCode==13)event.keyCode=9"/></td>
        <td width="35%"><div align="left"><font color="red">*</font>&nbsp;必填项目,只允许使用中文</div></td>
      </tr>
      <tr>
        <td height="32"> <div align="right">密码:</div></td>
        <td align="center">
		<input title="默认密码是: xinhua.ah.cn" value="<% if Form_State=1 then 
		                    response.Write(Edit_Teacher_rs("teacher_pass"))
						  else 
						    response.Write("xinhua.ah.cn")
						  End if
							%>" 
		type="password" name="teacher_pass"  
		onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" 
		onkeydown="if(event.keyCode==13)event.keyCode=9"/></td>
        <td><div align="left"><%if Form_State=1 then 
		                           response.Write "<font color=red>若不修改密码,请不要编辑此文本框。</font>." 
		                         else
								   Response.Write("<font color=""red"">*</font> 必填")  
								End if 
		                         %> </div></td>
      </tr>
      <tr>
        <td height="26"><div align="right">确认密码:</div></td>
        <td align="center">
		<input title="默认密码是: xinhua.ah.cn" value="<% if Form_State=1 then 
		                    response.Write(Edit_Teacher_rs("teacher_pass"))
						  else 
						    response.Write("xinhua.ah.cn")
						  End if
							%>" 
		type="password" name="teacher_pass2"  
		onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" 
		onkeydown="if(event.keyCode==13)event.keyCode=9" /></td>
        <td><div align="left"><%if Form_State=1 then 
		                            response.Write "<font color=red>若不修改密码,请不要编辑此文本框。</font>." 
		                           else
								  Response.Write("<font color=""red"">*</font> 必填")  
								End if 
		                         %> </td>
      </tr>
      <tr>
        <td height="37"><div align="right">所在院系:</div></td>
        <td align="center">
 		  <%
		 if Form_State=1 then 
		   response.Write("<select name=""department_id"">")
 		   response.Write("<option value="""&Edit_Teacher_rs("department_id")&""">")
		                  Dim Teacher_orig_Depart_id,skip_id
						       'skip_id代表要跳过的院系编号,防止下列列表中有相同的选项  
						      'Teacher_orig_Depart_id没有修改前,辅导员先前所在院系的id编号
						  Teacher_orig_Depart_id=Edit_Teacher_rs("department_id")
						  skip_id=Edit_Teacher_rs("department_id")
		                  call Show_teacher_department(Teacher_orig_Depart_id,1)'根据编号返回辅导员所在院系的文字描述
		                  response.Write("</option>") '这里的参数为1,代表是不打印出<td></td>
		   call chooseDepart(skip_id)'显示所有院系的列表,此时为编辑模式,需要显示辅导员先前保存的所在院系
		   response.Write("</select>")
		  else
		   response.Write("<select name=""department_id"">")
           response.Write("<option value="""">请选择教师所在院系</option>") 
		   'Dim no_skim
		   call chooseDepart(0)'此时没有需要跳过的id
		   response.Write("</select>")
		 end if
		  %>
        
          <!--input value="< \ if Form_State=1 then response.Write(Edit_department_rs(4)) \>" type="text" name="class_num" onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeydown="if(event.keyCode==13)event.keyCode=9"/--></td>
        <td><div align="left"><font color="red">*</font> 必填 </div></td>
      </tr>
      <tr>
        <td height="31"><div align="right">管理班级数目:</div></td>
        <td align="center"><input value="<% if Form_State=1 then response.Write(Edit_Teacher_rs("own_class_num"))%>" type="text" name="own_class_num" onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeydown="if(event.keyCode==13)event.keyCode=9"/></td>
        <td><div align="left"><font color="red">*</font> 必须填,只允许使用数字,否则会出错</div></td>
      </tr>
      <tr>
        <td height="31"><div align="right">
	 <% if Form_State=1 then
	     response.Write("<input type=""submit"" name=""Submit"" value=""完成编辑"" /></div></td>")
		 response.Write("<input type=""hidden"" name=""Edit_model"" value=""1"">")
		 response.Write("<input type=hidden name=teacher_id value="""&Edit_teacher_rs(0)&""">")
		  else
		 response.Write("<input type=""submit"" name=""Submit"" value=""确定添加""/></div></td>")
		 end if
	 %>	 
        <td align="center"><input type="reset" name="Submit2" value="重新填写" /></td>
        <td align="center">&nbsp;</td>
      </tr>
    </table>
	</form> 	  
	</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="129">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="153">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
<%end sub
sub TeacherList(Is_SearchMode)
		Response.Write "<html>"
		Response.Write "<head>"
		Response.Write "<meta http-equiv=""Content-Type"" content=""text/html; chaRSet=gb2312"">"
		Response.Write "<title>院系管理</title>"
		Response.Write "<meta HTTP-EQUIV=""Content-Type"" Content=""text-html; charset=gb2312"">" 
		Response.Write "<link href=""images/my_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
 		Response.Write "</head>"
 	    Response.Write "<body background=""images/admin_MainBg.gif"" scroll=no topmargin=""0"" leftmargin=""0"">"
		Response.Write "<br>"
	    Response.Write "<br>"
	    Response.Write "<br>"
  '作用 显示院系的列表
    Call showTeacherMenu()   '显示页面顶部的菜单
    Dim TeacherList_rs,TeacherList_sql,page,epage
	Set TeacherList_rs=server.CreateObject("adodb.recordset")
        IF Is_SearchMode=1 then '此时是显示搜索结果的列表***************************
     		Dim SearchKey:SearchKey=HtmlEncode(request("teacher_name"))
            TeacherList_sql="select * from [teacher] where [teacher_name] like '%"&SearchKey&"%' order by [teacher_name] asc"
		 else  
 	       TeacherList_sql="select * from [teacher] order by teacher_id desc"

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?