⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clsadm_class.asp

📁 酷虎网同学录V1.0
💻 ASP
字号:
<!--#INCLUDE FILE="setup.asp" -->
<!--#INCLUDE FILE="char.asp" -->
<!--#INCLUDE FILE="checkuser.asp" -->
<!--#INCLUDE FILE="theme.asp" -->
<%locat="班级管理"
act="修改班级信息"
if membername="" then
  	errmsg=errmsg+"<br>"+"<li>您还没有<a href=login.asp>登录</a>。"
	call top(1,1)
	call error("Information",errmsg)
else
	joinstatus=chkjoinclass(clsid)
	if joinstatus<>"" then
		call top(1,1)
		call error("Exclamation",joinstatus)
	else
		call top(2,1)
		if isclassadmin(0)=0 and not sysadmin then
			errmsg=errmsg+"<br><li>对不起!您不是班级管理员。"
			call error("Exclamation",errmsg)
		else
			if request("action")="update" then
				call update()
			else 
				call classinfo()
			end if
		end if
	end if
end if


sub classinfo()
dim rs
set rs=conn.execute("Select * from class where classid="&clsid)
%>
<br><br><br><p>
<p><p>
<FORM action="clsadm_class.asp" name=clsfrm method=post onsubmit="submitonce(this)">
<input type=hidden name=action value="update">
<table cellpadding=0 cellspacing=0 border=0 width=500 bgcolor=#ccccff align=center>
        <tr>
            <td>
                <table cellpadding=3 cellspacing=1 border=0 width=100% bgcolor=<%=Tablebordercolor%>>
  <TBODY>
  <TR align=middle bgcolor=<%=tabletitlecolor%>>
    <Th colSpan=2 height=24><b>修改班级属性</b></Th></TR>
  <TR bgcolor=<%=tablebodycolor2%>>
    <TD width=150> &nbsp;班 级 名 **</TD>
    <TD>&nbsp;<INPUT maxLength=16 size=31 name=classname  value="<%=htmlencode(rs("classname"))%>"> </TD></TR>
  <TR bgcolor=<%=tablebodycolor2%>>
    <TD width=150> &nbsp;入学年份  **</TD>
    <TD>&nbsp;<select name="enyear" size="1" class="txt">
	<%currentyear=cint(year(date()))
startyear=currentyear-50
for i=startyear to currentyear%>
<option value="<%=i%>" <%if i=cint(rs("enyear")) then response.write "selected"%>><%=i%></option>
<%next%>
      </select> 
    </TD></TR>
	<TR bgcolor=<%=tablebodycolor2%>>
    <TD width=150> &nbsp;班级主页 </TD>
    <TD>&nbsp;<INPUT maxLength=50 size=31 name=homepage  value="<%=htmlencode(rs("homepage"))%>"> 
    </TD></TR>
	<TR bgcolor=<%=tablebodycolor2%>>
    <TD width=150> &nbsp;班级宣言 </TD>
    <TD>&nbsp;<TEXTAREA name=pronouncement rows=5 wrap=PHYSICAL cols=30 class=txt value=""><%=htmlencode(rs("pronouncement"))%></TEXTAREA> 
	</TD></TR>

		<TR bgcolor=<%=tablebodycolor2%>>
    <TD width=150> &nbsp;附加通讯录 </TD>
    <TD>&nbsp;<input type="checkbox" name="isappendshow" value="1" <%if rs("isappendshow")=true then response.write "checked"%>>显示附加通讯录
	</TD></TR>
  <TR id="pwd" bgcolor="<%=tablebodycolor2%>" <%if rs("openlevel")<>1 then%>style="DISPLAY: none"<%end if%>>
    <TD width=150> &nbsp;班级密码 </TD>
    <TD>&nbsp;<INPUT maxLength=16 size=13 name=classpwd  value="<%=htmlencode(rs("classpwd"))%>"> </TD></TR>
	<TR bgcolor=<%=tablebodycolor2%>>
    <TD width=150> &nbsp;开放等级 </TD>
    <TD>&nbsp;<select name="openlevel" onchange="if(this.selectedIndex==1){pwd.style.display=''}else{pwd.style.display='none'}">
<option value="0" <%if rs("openlevel")=0 then%>selected<%end if%>>完全开放 
<option value="1" <%if rs("openlevel")=1 then%>selected<%end if%>>密码验证 
<option value="2" <%if rs("openlevel")=2 then%>selected<%end if%>>班长审核 
<option value="3" <%if rs("openlevel")=3 then%>selected<%end if%>>锁定班级 
</select></TR>

	<TR align=middle bgcolor=<%=Tablebodycolor1%>>
    <TD colSpan=2><DIV align=center><INPUT value="更 新" name=Submit type=submit class=btn> <INPUT type=reset value="重 写" name=Submit2 class=btn> 
</DIV></TD></TR></TBODY></TABLE></td></tr></table>
</FORM>
</body>
</html>
<%
end sub


sub update()
dim rs,strsql
dim openlevel,pronouncement,classpwd
dim classname,enyear,isappendshow,homepage

classname=trim(request.form("classname"))
if classname="" then
	errmsg=errmsg+"<br><li>请输入班级名称!"
	founderr=true
elseif strlength(classname)<5 or strlength(classname)>28 then
	errmsg=errmsg+"<br><li>请输入班级名5-28个字符!"
	founderr=true
else
	strsql="select classid from [class] where classname='"&classname&"' and classid<>"&clsid
	set rs=conn.execute(strsql)
		if not rs.eof then
		errmsg=errmsg+"<br>"+"<li>"+"您输入的班级名已经存在,请重新输入其他班级名!"
		founderr=true
	end if

end if


enyear=request.form("enyear")

thisyear=cint(year(date()))
startyear=thisyear-50

if not isinteger(enyear) or not (cint(enyear)>=startyear and cint(enyear)<=thisyear ) then
		errmsg=errmsg+"<br>"+"<li>"+"您输入的入学年份不正确!"
		founderr=true
end if

if request("isappendshow")="1" then
	isappendshow=true
else
	isappendshow=false
end if
homepage=trim(request("homepage"))
pronouncement=trim(request("pronouncement"))
openlevel=cint(request.form("openlevel"))

if openlevel=1 then
	classpwd=trim(request("classpwd"))
	if classpwd="" then
		errmsg=errmsg+"<br><li>如果您选择班级开放等级为密码验证,则需输入班级密码!"
		founderr=true
	elseif strlength(classpwd)<6 or strlength(classpwd)>10 then
		errmsg=errmsg+"<br>"+"<li>班级密码不能少于六个字符或多余十个字符!"
		founderr=true
	elseif isValidstring(classpwd)<>"" then
		if isValidstring(classpwd)=" " then invld="空格" else invld=isValidstring(classpwd)
		errmsg=errmsg+"<br>"+"<li>密码中含有非法字符&nbsp;<font color=#cc0000>"&invld&"</font>&nbsp;。"
		founderr=true
	end if
else
	classpwd=""
end if


if founderr=true then
	call error("Information",errmsg)
	exit sub
end if

Set rs = Server.CreateObject("ADODB.Recordset")
StrSQL = "select * from class where classid="&clsid
rs.open StrSQL,conn,1,3

if not rs.eof then
	if rs("openlevel")=2 and (openlevel=0) then

		conn.execute("update [student] set point=point+"&pJoinClass&" where userid"&_
		" in(select userid from [joinclass] where isauditing=true and classid="&clsid&")")
		set studpass=conn.execute("select count(userid) from [joinclass] where isauditing=true and classid="&clsid)
		conn.execute("update [class] set studcount=studcount+"&studpass(0)&" where classid="&clsid)
		conn.execute("update [joinclass] set isauditing=false,jointime=now(),lastvisit=now() where isauditing=true and classid="&clsid)


	elseif rs("openlevel")=2 and (openlevel=3 or openlevel=1) then
		conn.execute("update [student] set classcount=classcount-1 where userid"&_
		" in(select userid from [joinclass] where isauditing=true and classid="&clsid&")")
		conn.execute("delete from [joinclass] where isauditing=true and classid="&clsid)

	end if

	rs("classname")=classname
	rs("enyear")=enyear
    if pronouncement="" then rs("pronouncement")=null else rs("pronouncement")=pronouncement
	if homepage="" then rs("homepage")=null else rs("homepage")=homepage
	rs("isappendshow")=isappendshow
	rs("openlevel")=openlevel
	if classpwd="" then	rs("classpwd")=null	else rs("classpwd")=classpwd
	rs.Update

	stitle="修改班级属性"
	smsg="恭喜您,班级属性修改成功!"
	call success(stitle,smsg)
end if

end sub


%>
</td></tr></table>
<%call footer%>

⌨️ 快捷键说明

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