www.gusucode.com > 25175 学生同学录管理系统 2007 build 1231D源码程序 > inc/tem_contacts_type_inc.asp

    <%
Dim Contacts_name
action=che(request("action"))
id=che(request("id"))
Dim msgtype,msginfo,msgurl,msggoto
const MaxPerPage=10
Function fun_contacts()
	select Case action
	Case "list"
		fun_contacts="<div id='contacts'><h1>通讯录类别管理</h1>"&_
		"<table cellspacing='1' cellpadding='0' width='95%' align='center' border=0 class='list'>"&_
		"	<FORM METHOD=POST ACTION='?action=del'>"&_
		"<tr>"&_
		"<th style='width:40px;'><label for=""chkAll"" style=""float:left;"">全选</label></th>"&_
		"<th style='width:400px;text-align:left;'>类别名称</th>"&_
		"<th style='width:auto;'>&nbsp;</th>"&_
		"</tr>"
		sql=Sqlinfo("id,Contacts_name","Contacts_type","user_id="&user25175(0),"id","1","")
		strFileName="?action="&action
		colnum="3"
		formaction="?action=del"
		fun_contacts = fun_contacts & funsqllist(sql,colnum,strFileName,formaction)
		If outcom=True Then
		fun_contacts = fun_contacts & showContent
		fun_contacts = fun_contacts & showpages
		End If
		fun_contacts=fun_contacts & "</table></div>"
	Case "add"
		fun_contacts="<div id='contacts'><h1>通讯录类别资料添加</h1>"&_
			"<table width='95%' border='0' align='center' cellpadding='0' cellspacing='0' class='tab_add'>"&_
			"	<FORM METHOD=POST ACTION='?action=save'>"&_
			"<TR><TD width='20%'>类别名称:</TD><TD>&nbsp;"&_
			"<INPUT TYPE='text' NAME='Contacts_name' style='width:200px'>"&_
			"</TD></TR>"&_
			"	<TR>"&_
			"	<TD>&nbsp;</TD>"&_
			"	<TD>&nbsp;<INPUT TYPE='submit' value=' 确 认 ' class='buttons'></TD>"&_
			"</TR>"&_
			"</FORM>"&_
			"</TABLE></div>"
	Case "save"
		jstable
		If Contacts_name = "" Then
			msgtype="err"
			msginfo="<li>参数错误"
		else
			set rs=server.createobject("adodb.recordset")
			Sql = "SELECT * FROM [Contacts_type] WHERE id=0"
			rs.Open Sql, Conn, 1, 3
			rs.AddNew
			sqltable "add"
			rs("user_id") = user25175(0)
			rs.Update
			rs.close
			msgtype="rig"
			msginfo="<li>已成功添加一个通讯录类别"
			msgurl="?action=list"
			msggoto="通讯录类别列表"
		End If
	Case "edit"
		If id="" Then 
			msgtype="err"
			msginfo="<li>参数错误"
		else
			sql=Sqlinfo("Contacts_name","Contacts_type"," ID = "&id&" and user_id="&user25175(0),"","","")
			rs_edit = connopen(sql)
			If isArray(rs_edit) Then
				fun_contacts="<div id='contacts'><h1>通讯录类别资料修改</h1>"&_
				"<table width='95%' border='0' align='center' cellpadding='0' cellspacing='0' class='tab_add'>"&_
				"<FORM METHOD=POST ACTION='Contacts_type.asp?action=mod'>"&_
				"<TR><TD width='20%'>类别名称:</TD><TD>&nbsp;"&_
				"<INPUT TYPE='text' NAME='contacts_name' value='"&rs_edit(0,0)&"'>"&_
				"</TD></TR>"
			Else
				msgtype="err"
				msginfo="<li>参数错误"
			End If
		End If
		fun_contacts=fun_contacts&"<TR>"&_
			"	<TD> </TD>"&_
			"	<TD>&nbsp;<INPUT TYPE='submit' value=' 确 认 ' class='buttons'><INPUT TYPE='hidden' NAME='id' value='"&id&"'></TD>"&_
			"</TR>"&_
			"</FORM>"&_
			"</TABLE></div>"
	Case "mod"
		jstable
		set rs=server.createobject("adodb.recordset")
		Sql = "SELECT * FROM [Contacts_type] WHERE id="&id
		rs.Open Sql, Conn, 1, 3
		If Not rs.Eof Then
		sqltable "mod"
		rs.Update
		Else
		errormsg "参数错误"
		End If
		rs.close
		msgtype="rig"
		msginfo="<li>已成功修改一个通讯录类别名称"
		msgurl="?action=list"
		msggoto="通讯录类别列表"
	Case "del"
		If Len(id)=0 Then
			msgtype="err"
			msginfo="<li>已成功修改一个通讯录类别名称"
		Else
			sqldel "Contacts_type",""
			msgtype="rig"
			msginfo="<li>成功删除选定的通讯录信息!"
			msgurl="?action=list"
			msggoto="通讯录类别列表"
		End If
	End select
	If msgtype<>"" Then fun_contacts=msg(msgtype,msginfo,msgurl,msggoto)
End Function
Function showContent
	dim i
	i=0
	do while not rs.eof
		showContent=showContent& "<tr> "&_
		"<td align='center'>"&_
		"	<input name='id' type='checkbox' class='chek' onclick='unselectall()' id='ArticleID' value='"&Rs(0)&"' style=' border: 0px'> "&_
		"</td>"&_
		"<td>&nbsp;<A HREF='Contacts_type.asp?action=edit&id="&Rs(0)&"'>"&Rs(1)&"</A></td>"&_
		"<td>&nbsp;</td>"&_
		"</tr>"
	i=i+1
	if i>=MaxPerPage then exit do
	rs.movenext
	loop
end Function
Sub jstable()
Contacts_name = che(request("Contacts_name"))
End Sub

Sub sqltable(types)
	rs("Contacts_name") = Contacts_name
End Sub
%>