<!--#include file="Admin_Const.asp"-->
<%
if Not Cl.TrueOtherPurview("Plus") then Admin_ShowErr("<br /><li>您无此操作权限！</li>")
dim Action,Num
Dim ID,PlusID,PlusName,PlusIntro,OrderID,PlusSetting,PlusConn,UserGroup,PlusAdmin,UserPoint,UserMoney,PlusMenu,IsUse,PlusType,PlusLink,arrPlusSetting,ModulePlus,PagePlus,UseOn,UseOff,AdminOnly
Num=0
UseOn="":UseOff=""
const MaxPerPage=30
Action=Trim(Request("Action"))
CurrentPage=Cl.ChkClng(request("page"))
Header
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">  <tr class="title">    <td height="22" colspan="2"  align="center"><strong>插 件 管 理</strong></td>  </tr>  <tr class="tdbg">    <td width="70" height="30" ><strong>管理导航：</strong></td><td><a href="Admin_Plus.asp">插件管理首页</a>&nbsp;|&nbsp;<a href="Admin_Plus.asp?Action=Add">添加新插件</a>&nbsp;|&nbsp;<a href="Admin_Plus.asp?Action=Output">插件数据导出</a>&nbsp;|&nbsp;<a href="Admin_Plus.asp?Action=Input">插件数据导入</a></td>
  </tr>
</table>
<br />
<%
Select Case Action
Case "Add","Modify"
	Call MyPlus()
Case "SaveAdd","SaveModify"
	Call SavePlus()
Case "Del"
	Call DelPlus()
Case "Input"
	Call InputPlus()
Case "Output"
	Call OutputPlus()
Case "CreatePlus"
	Call createPlus()
Case "LoadPlus"
	Call LoadPlus()
Case "LoadInPlus"
	Call LoadInPlus()
Case "Delout"
	Call Delout()
Case else
	Call main()
End Select

Footer

Sub Main()
	Set rs=Server.CreateObject("Adodb.RecordSet")
	Sql="Select ID,PlusName,OrderID,PlusIntro,PlusID,IsUse From Cl_Plus Order by OrderID,ID Desc"
	OpenConn : rs.Open sql,Conn,1,1
%>
<form name="myform" method="post" action="">
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="border" align=center>
	<tr align="center" class="title">
		<td width="50" height="22">插件ID</td>
		<td width="100" height="22">插件名称</td>
		<td width="60">优先级</td>
		<td>插件说明</td>
		<td width="60" height="22">是否使用</td>
		<td width="80" align="center">操作</td>
	</tr>
<%
 if rs.eof and rs.bof then
	TotalPut=0
	response.write "<tr class='tdbg'><td align='center' colspan='6'>没有任何记录！</td></tr>"
else
   	TotalPut=rs.recordcount
   	if (TotalPut mod MaxPerPage)=0 then
    	TotalPages = TotalPut \ MaxPerPage
	else
	  	TotalPages = TotalPut \ MaxPerPage + 1
	end if
	if CurrentPage > TotalPages then CurrentPage=TotalPages
	if CurrentPage < 1 then CurrentPage=1
   	rs.move (CurrentPage-1)*MaxPerPage
	SQL=Rs.GetRows(MaxPerPage)
	For i=0 to Ubound(SQL,2)%>
	<tr class="tdbg">
		<td width="50" align="center"><%=SQL(4,i)%></td>
		<td width="100" align="center"><a href="Admin_Plus.asp?Action=Modify&ID=<%=SQL(0,i)%>"><%=SQL(1,i)%></a></td>
		<td align="center"><%=SQL(2,i)%></td>
		<td><%=SQL(3,i)%></td>
		<td width="60" align="center"><strong><%

		If SQL(5,i)=0 Then

		Response.write "<font color='green'>√</font>"
	
	Else

		Response.write "<font color='Red'>×</font>"

		End if
		%></strong></td>

		<td width="80" align="center"><a href="Admin_Plus.asp?Action=Modify&ID=<%=SQL(0,i)%>">修改</a>&nbsp;&nbsp;<a href="Admin_Plus.asp?Action=Del&ID=<%=SQL(0,i)%>" onclick="return confirm('真的要删除此插件吗？如果有文件或模板中使用此插件，请注意修改！');">删除</a></td>
	</tr>
	<%
	Next
	
end if
%>
</table>
</form>
<%
	Response.write Cl.showpage ("Admin_Plus.asp",TotalPut,MaxPerPage,"条","记录")
	SQL=Empty
	Rs.close:Set Rs=Nothing
End Sub

Sub MyPlus()
Dim StrAction,StrSubmit
if Action="Modify" then
	StrAction="SaveModify"
	StrSubmit=" 修改插件 "
	ID=Cl.ChkClng(Request("ID"))
	Set Rs=Cl.Execute("Select * From Cl_Plus Where ID="&ID&"")
	if rs.bof or rs.eof Then
		Call Cl.OutMsg("该插件不存在。","Admin_Plus.asp")
	else
		PlusID=Rs("PlusID")
		PlusName=Rs("PlusName")
		PlusIntro=Rs("PlusIntro")
		OrderID=Rs("OrderID")
		UserGroup=Rs("UserGroup")
		PlusAdmin=Rs("PlusAdmin")
		PlusMenu=Rs("PlusMenu")
		PlusLink=Rs("PlusLink")
		PlusType=Rs("PlusType")
		IsUse=Rs("IsUse")
		arrPlusSetting=Split(Rs("PlusSetting"),",")
		AdminOnly=Cl.ChkClng(rs("AdminOnly"))
		If PlusType=1 Then:ModulePlus="checked":PagePlus="":Else:ModulePlus="":PagePlus="checked":end if
		If IsUse=1 Then:UseOn="":UseOff="checked":Else:UseOn="checked":UseOff="":end if
	End if
	Rs.Close : Set Rs=Nothing
else
	StrAction="SaveAdd"
	StrSubmit=" 添加插件 "
	ID=""
	PlusID="New_Plus"
	PlusName=""
	PlusIntro=""
	OrderID=1
	PlusMenu="XX插件|Admin_XXX.asp"
	PlusSetting="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"
	arrPlusSetting= Split(PlusSetting,",")
	UseOn="checked"
	PagePlus="checked"
	AdminOnly=0
end if
%>
<script language = "JavaScript">
function CheckForm(){
  if (document.myform.PlusName.value==""){
     alert("插件名不能为空！");
     document.myform.PlusName.focus();
     return false;
  }
  if (document.myform.PlusID.value==""){
     alert("插件ID不能为空！");
     document.myform.PlusID.focus();
     return false;
  }
  if (document.myform.OrderID.value==""){
     alert("优 先 等级不能为空！");
     document.myform.OrderID.focus();
     return false;
  }
  return true;  
}
</script>
<form action="Admin_Plus.asp" method="post" name="myform" id="myform" onSubmit="return CheckForm();">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
	<tr class="title" height="22">
		<td  align="center"><strong><%=StrSubmit%></strong></td>
	</tr>
	<tr class="title2" height="22">
		<td  align="center"><strong>插件管理设置</strong></td>
	</tr>
	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="100" align="center"><strong>插件名称：</strong></td>
					<td><input name="PlusName" type="text" id="PlusName" size="50" maxlength="50" value="<%=PlusName%>"><br /><font color="blue">直接输入名称,用于后台管理显示。</font></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="100" align="center"><strong>插件说明：</strong></td>
					<td><textarea name="PlusIntro" style="width:96%" rows="3" id="PlusIntro"><%=PlusIntro%></textarea><br />
					<a href="javascript:admin_Size(-3,'PlusIntro')"><img src="images/minus.gif" unselectable="on" border='0'></a> <a href="javascript:admin_Size(3,'PlusIntro')"><img src="images/plus.gif" unselectable="on" border='0'></a>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="100" align="center"><strong>插件类型：</strong></td>
					<td>
						<input type="radio" name="PlusType" value="0" onClick="Link.style.display='';Menu.style.display='none';" <%=PagePlus%>> 单页插件 
						<input type="radio" name="PlusType" value="1" onClick="Link.style.display='none';Menu.style.display='';" <%=ModulePlus%>> 模块插件 		
					<td width="10"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr id="Link" class="tdbg"<%if ModulePlus="checked" then%>style="display:'none';"<%:end if%>>
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="100" align="center"><strong>管理地址：</strong></td>
					<td><input name="PlusLink" type="text" id="PlusLink" size="50" maxlength="100" value="<%=PlusLink%>" /><font color="#FF0000">插件管理页面的访问路径，没有留空。</font></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr id="Menu" class="tdbg" <%if PagePlus="checked" then%>style="display:'none';"<%:end if%>>
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="100" align="center"><strong>管理菜单：</strong></td>
					<td><textarea name="PlusMenu" style="width:96%" rows="5" id="PlusMenu"><%=PlusMenu%></textarea>
					<br /><font color="#FF0000">注意：请输入带链接的HTML代码，每个行用回车分隔开；</font>如：<font color="#0000ff">&lt;a href="Admin_Forum.asp?Action=Add" target="main"&gt;网站论坛添加&lt;/a&gt; | &lt;a href="Admin_Forum.asp" target="main">管理&lt;/a&gt;</font>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="100" align="center"><strong>插件排序：</strong></td>
					<td><input name="OrderID" type="text" id="OrderID" size="10" maxlength="100" value="<%=OrderID%>"><font color="#FF0000">数字越小，插件排序越靠前。</font></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="100" align="center"><strong>是否使用：</strong></td>
					<td>
						<input type="radio" name="IsUse" value="0"  <%=UseOn%> > 是 &nbsp;&nbsp;&nbsp;&nbsp; 
						<input type="radio" name="IsUse" value="1" <%=UseOff%>> 否 &nbsp;&nbsp;&nbsp;&nbsp;	不使用该插件可以关闭。</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr class="title2" height="22">
		<td  align="center"><strong>插件参数设置</strong></td>
	</tr>
	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="100" align="center"><strong>插件ID：</strong></td>
					<td><input name="PlusID" type="text" id="PlusID" size="30" maxlength="50" value="<%=PlusID%>">
					<font color="#FF0000">这是你插件的唯一的标识，注意不能有重复的。 <A href="#">获得插件ID和信息</A></font></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="100" align="center"><strong>使用权限：</strong></td>
					<td>
					<input name="UserGroup" type="hidden" id="UserGroup" value="<%=UserGroup%>">
					<input name="UserGroupView" type="text" id="UserGroupView" size="50" maxlength="250" value="<%=Cl.GetUserGroupName(UserGroup)%>" onclick="SelectUserGroup('UserGroup');" Readonly>
					<font color="#FF0000">点击可设置可以使用插件的用户组</font></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr>
					<td width="100" align="center"><strong>管理员名单：</strong></td>
					<td><input name="PlusAdmin" type="text" id="PlusAdmin" size="70" maxlength="100" value="<%=PlusAdmin%>" <%if AdminOnly=1 then%>Disabled<%end if%> >&nbsp;<input name="AdminOnly" type="checkbox" value="1" onclick="document.myform.PlusAdmin.disabled=this.checked" <%if AdminOnly=1 then%>checked<%end if%>>&nbsp;只能登陆后台后使用。
					<br />这里设置插件的管理员，每个用户名用,隔开.系统管理员可以管理插件，如果您不需要另外设置管理员，此项可以不填。
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr class="title2" height="22">
		<td  align="center"><strong>使用限制项</strong></td>
	</tr>
	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(0)：</strong></td>
					<td><input name="PlusSetting(0)" type="text" id="PlusSetting(0)" size="6" maxlength="10" value="<%=arrPlusSetting(0)%>">
					<font color="#FF0000">访问点数下限:用户点数低于此值则不能访问。</font></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(1)：</strong></td>
					<td><input name="PlusSetting(1)" type="text" id="PlusSetting(1)" size="6" maxlength="10" value="<%=arrPlusSetting(1)%>">
					<font color="#FF0000">访问金钱下限：用户金钱低于此值则不能访问。</font></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr class="title2" height="22">
		<td  align="center"><strong>使用更新项</strong></td>
	</tr>
	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(2)：</strong></td>
					<td><input name="PlusSetting(2)" type="text" id="PlusSetting(2)" size="6" maxlength="10" value="<%=arrPlusSetting(2)%>">
					<font color="#FF0000">使用点数变化：正值增多，负值减少。</font></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(3)：</strong></td>
					<td><input name="PlusSetting(3)" type="text" id="PlusSetting(3)" size="6" maxlength="10" value="<%=arrPlusSetting(3)%>">
					<font color="#FF0000">使用金钱变化：正值增多，负值减少。</font></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr class="title2" height="22">
		<td  align="center"><strong>插件自定字段设置</strong></td>
	</tr>
	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(4)：</strong></td>
					<td><input name="PlusSetting(4)" type="text" id="PlusSetting(4)" size="6" maxlength="10" value="<%=arrPlusSetting(4)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(5)：</strong></td>
					<td><input name="PlusSetting(5)" type="text" id="PlusSetting(5)" size="6" maxlength="10" value="<%=arrPlusSetting(5)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(6)：</strong></td>
					<td><input name="PlusSetting(6)" type="text" id="PlusSetting(6)" size="6" maxlength="10" value="<%=arrPlusSetting(6)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(7)：</strong></td>
					<td><input name="PlusSetting(7)" type="text" id="PlusSetting(7)" size="6" maxlength="10" value="<%=arrPlusSetting(7)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(8)：</strong></td>
					<td><input name="PlusSetting(8)" type="text" id="PlusSetting(8)" size="6" maxlength="10" value="<%=arrPlusSetting(8)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(9)：</strong></td>
					<td><input name="PlusSetting(9)" type="text" id="PlusSetting(9)" size="6" maxlength="10" value="<%=arrPlusSetting(9)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(10)：</strong></td>
					<td><input name="PlusSetting(10)" type="text" id="PlusSetting(10)" size="6" maxlength="10" value="<%=arrPlusSetting(10)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(11)：</strong></td>
					<td><input name="PlusSetting(11)" type="text" id="PlusSetting(11)" size="6" maxlength="10" value="<%=arrPlusSetting(11)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(12)：</strong></td>
					<td><input name="PlusSetting(12)" type="text" id="PlusSetting(12)" size="6" maxlength="10" value="<%=arrPlusSetting(12)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(13)：</strong></td>
					<td><input name="PlusSetting(13)" type="text" id="PlusSetting(13)" size="6" maxlength="10" value="<%=arrPlusSetting(13)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(14)：</strong></td>
					<td><input name="PlusSetting(14)" type="text" id="PlusSetting(14)" size="6" maxlength="10" value="<%=arrPlusSetting(14)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(15)：</strong></td>
					<td><input name="PlusSetting(15)" type="text" id="PlusSetting(15)" size="6" maxlength="10" value="<%=arrPlusSetting(15)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(16)：</strong></td>
					<td><input name="PlusSetting(16)" type="text" id="PlusSetting(16)" size="6" maxlength="10" value="<%=arrPlusSetting(16)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(17)：</strong></td>
					<td><input name="PlusSetting(17)" type="text" id="PlusSetting(17)" size="6" maxlength="10" value="<%=arrPlusSetting(17)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(18)：</strong></td>
					<td><input name="PlusSetting(18)" type="text" id="PlusSetting(18)" size="6" maxlength="10" value="<%=arrPlusSetting(18)%>">
				</tr>
			</table>
		</td>
	</tr>	<tr class="tdbg">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" >
				<tr>
					<td width="150" align="center"><strong>Plus.Setting(19)：</strong></td>
					<td><input name="PlusSetting(19)" type="text" id="PlusSetting(19)" size="6" maxlength="10" value="<%=arrPlusSetting(19)%>">
				</tr>
			</table>
		</td>
	</tr>
	<tr class="tdbg">
		<td>
		说明：由于每个插件的设置不可能完全一样，设置字段的定义也不一样，这些都交给插件作者自行修改了。
		</td>
	</tr>
	<tr class="tdbg">
		<td height="40" align="center">
		<input name="ID" type="hidden" id="ID" value="<%=ID%>">
		<input name="Action" type="hidden" id="Action" value="<%=StrAction%>">
		<input name="Submit" type="submit" id="Submit" value="<%=StrSubmit%>">
		</td>
	</tr>
</table>
</form>
<%
End Sub

Sub SavePlus()
	ID		= Trim(Request("ID"))
	PlusID		= Trim(Request("PlusID"))
	PlusName	= Trim(Request("PlusName"))
	PlusLink	= Trim(Request("PlusLink"))
	UserGroup	= Trim(Request("UserGroup"))
	PlusIntro	= Trim(Request("PlusIntro"))
	PlusMenu	= Trim(Request("PlusMenu"))
	PlusAdmin	= Trim(Request("PlusAdmin"))
	AdminOnly	= Cl.ChkClng(Request("AdminOnly"))
	IsUse		= Cl.ChkClng(Request("IsUse"))
	PlusType	= Cl.ChkClng(Request("PlusType"))
	OrderID		= Cl.ChkClng(Request("OrderID"))
	PlusSetting	= Cl.ChkClng(Request("PlusSetting(0)"))
	for i=1 to 19
	PlusSetting	= PlusSetting & "," & Cl.ChkClng(Request("PlusSetting"))
	next
	if Action="SaveModify" and Not IsNumeric(ID) then
		Call Cl.OutMsg("请指定要修改插件的正确ID。","javascript:history.go(-1)")
	end if
	if PlusName="" then Call Cl.OutMsg("插件名不能为空。","javascript:history.go(-1)")
	if Not IsNumeric(OrderID) then Call Cl.OutMsg("请输入合法的优先级数字，必需为数字。","javascript:history.go(-1)")
	if PlusID="" then Call Cl.OutMsg("插件ID不能为空。","javascript:history.go(-1)")
	if AdminOnly<>0 and AdminOnly<>1 then AdminOnly=0
	if Action="SaveModify" then
		Cl.Execute("Update Cl_Plus Set PlusName='"&Cl.CheckStr(PlusName)&"',PlusIntro='"&Cl.CheckStr(PlusIntro)&"',OrderID="&OrderID&",PlusSetting='"&Cl.CheckStr(PlusSetting)&"',PlusMenu='"&Cl.CheckStr(PlusMenu)&"',PlusAdmin='"&Cl.CheckStr(PlusAdmin)&"',PlusType='"&Cl.CheckStr(PlusType)&"',UserGroup='"&Cl.CheckStr(UserGroup)&"',IsUse='"&Cl.CheckStr(IsUse)&"',PlusID='"&Cl.CheckStr(PlusID)&"',PlusLink='"&Cl.CheckStr(PlusLink)&"',AdminOnly="&Cl.ChkClng(AdminOnly)&" where ID="&Clng(ID)&"")
		'Cl.DelCahe("ReplacePlus")
		Response.Write "<script language='JavaScript' type='text/JavaScript'>" &vbcrlf
		Response.Write "parent.left.location.reload();" &vbcrlf
		Response.Write "</script>"
		Call Cl.OutMsg("修改插件成功。","Admin_Plus.asp")
	else
		'Cl.Execute("Insert Into [Cl_Plus] (PlusName,PlusInero,OrderID,PlusSetting) Values ('"&PlusName&"','"&PlusInero&"','"&OrderID&"','"&PlusSetting&"')")
		Set rs=Server.CreateObject("Adodb.RecordSet")
		Sql="Select * From Cl_Plus where PlusID='"&PlusID&"'"
		OpenConn : rs.Open sql,Conn,1,3
		if Not (Rs.bof and Rs.eof) then
			Rs.Close:Set Rs=Nothing
			Call Cl.OutMsg("插件ID已经存在，请重新换一个插件ID。","javascript:history.go(-1)")
		end if

		Rs.Addnew
		Rs("PlusID")=PlusID
		Rs("PlusName")=PlusName
		Rs("PlusLink")=PlusLink
		Rs("UserGroup")=UserGroup
		Rs("PlusMenu")=PlusMenu
		Rs("PlusAdmin")=PlusAdmin
		Rs("IsUse")=IsUse
		Rs("PlusType")=PlusType
		Rs("PlusIntro")=PlusIntro
		Rs("OrderID")=Clng(OrderID)
		Rs("AdminOnly")=AdminOnly
		Rs("PlusSetting")=PlusSetting
		Rs.Update
		Rs.Close:Set Rs=Nothing
		'Cl.DelCahe("ReplacePlus")
		Cl.SaveAdminLog
		Response.Write "<script language='JavaScript' type='text/JavaScript'>" &vbcrlf
		Response.Write "parent.left.location.reload();" &vbcrlf
		Response.Write "</script>"
		Call Cl.OutMsg("添加插件成功。","Admin_Plus.asp")
	end if
end Sub

Sub DelPlus()
	ID=Trim(Request("ID"))
	if Not IsNumeric(ID) then
		Call Cl.OutMsg("请正确指定要删除插件的ID。","javascript:history.go(-1)")
	end if
	Cl.Execute("delete * from Cl_Plus where ID="&Clng(ID)&"")
	Cl.DelCahe("ReplacePlus")
	Cl.SaveAdminLog
	Response.Write "<script language='JavaScript' type='text/JavaScript'>" &vbcrlf
	Response.Write "parent.left.location.reload();" &vbcrlf
	Response.Write "</script>"
	Call Cl.OutMsg("删除插件成功。","Admin_Plus.asp")
End Sub

Sub InputPlus()
%>
	<form action="?action=LoadPlus" method=post>
	<table border="0"  cellspacing="1" cellpadding="5" height="1" align=center width="95%" class="Border">
	<tr><td colspan="2" class="title">导入插件</td></tr>
	<tr>
	<td width="20%" class="tdbg">导入插件数据库名：</td>
	<td width="80%" class="tdbg">
	<input type="text" name="Plusmdb" size="30" value="../Skins/Cl_Plus.mdb">
	<input type="hidden" name="ReAct" value="ShowPlus">
	</td>
	</tr>
	<tr><td colspan="2" class="tdbg"><input type="submit" name="submit" value="下一步"></td></tr>
	</table></form>
<%
End Sub

Sub OutputPlus()
Set rs=Server.CreateObject("Adodb.RecordSet")
Sql="Select ID,PlusID,PlusName,PlusIntro From Cl_Plus Order by ID Desc"
OpenConn : rs.Open sql,Conn,1,1
%>
<script language="JavaScript" type="text/javascript">
<!--
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall'){
	e.checked = form.chkall.checked;
	}
   }
  }
//-->
</script>
	<form action="?action=CreatePlus" method=post>
	<table border="0" cellspacing="1" cellpadding="5" align=center width="95%" class="Border">
	<tr><td width="100%" colspan="5" class="title">导出网站插件列表</td></tr>
	<tr class="title2">
	<td width="10%"  align="center">插件ID</td>
	<td width="25%"  align="center">插件名称</td>
	<td width="45%"  align="center">插件说明</td>
	<td width="5%"  align="center">选择</td>
	</tr>
<%
 if rs.eof and rs.bof then
	response.write "<tr class='tdbg'><td align='center' colspan='5'><br />没有任何记录！<br /></td></tr>"
else
	do while not rs.EOF%>
	<tr class="tdbg">
		<td width="10%" align="center"><%=rs("PlusID")%></td>
		<td width="25%" align="center"><a href="Admin_Plus.asp?Action=Modify&ID=<%=rs("ID")%>"><%=rs("PlusName")%></a></td>
		<td width="45%" align="center"><%=rs("PlusIntro")%></td>
		<td><input type="checkbox" name="ID" value="<%=rs("ID")%>"></td>
	</tr>
	<%
		rs.MoveNext
	loop
%>
	<tr>
	<td colspan="5" align="right" class="tdbg">
	导出的数据库：<input type="text" name="Plusmdb" size="30" value="../Skins/Cl_Plus.mdb">
	<input type="submit" name="submit" value="导出">
	<input type=checkbox name=chkall value=on onclick="CheckAll(this.form)">全选</td>
	</tr>
<%
rs.Close:Set rs=Nothing 
end if
%>
</table>
</form>
<%
End Sub

Sub CreatePlus()
	dim mdbname
	ID=Cl.checkstr(Request("ID"))
	mdbname=Cl.Checkstr(Trim(Request.form("Plusmdb")))
	If ID="" or isnull(ID) or Not Isnumeric(Replace(Replace(ID,",","")," ","")) Then
		Admin_ShowErr("<br /><li>您还未选取要导入的插件")
	End If
	If mdbname="" Then
		Admin_ShowErr("<br /><li>请填写导入插件数据库名")
	End If
	Call DataBaseConnection(mdbname)
	Dim Rs1,Rs2,Sql1,Sql2
	Set Rs1=Server.CreateObject("ADODB.Recordset")
	Set Rs2=Server.CreateObject("ADODB.Recordset")
	Sql1 = "Select * from Cl_Plus where ID in ("&ID&")"
	openconn : rs1.open sql1,conn,1,1
	do while not rs1.EOF
		Sql2 = "Select * from Cl_Plus where PlusName='"&rs1("PlusName")&"'"
		rs2.open sql2,PlusConn,3,3
		If rs2.eof and rs2.bof Then
			rs2.addnew
			rs2("PlusName")=rs1("PlusName")
			rs2("PlusIntro")=rs1("PlusIntro")
			rs2("OrderID")=rs1("OrderID")
			rs2("PlusSetting")=rs1("PlusSetting")
			Rs2("PlusID")=rs1("PlusID")
			Rs2("PlusLink")=rs1("PlusLink")
			Rs2("UserGroup")=rs1("UserGroup")
			Rs2("PlusMenu")=rs1("PlusMenu")
			Rs2("PlusAdmin")=rs1("PlusAdmin")
			Rs2("IsUse")=rs1("IsUse")
			Rs2("AdminOnly")=rs1("AdminOnly")
			Rs2("PlusType")=rs1("PlusType")
			rs2.update
		Else
			Admin_ShowErr("<br /><li>插件数据库中中存在插件"&rs2("PlusName")&",如果要导入请先删除插件数据库中的该插件。")
		End if
		rs1.MoveNext
		rs2.Close
	loop
	rs1.Close:Set rs1=Nothing:Set rs2=Nothing
	Call Cl.OutMsg("插件数据导出成功。","Admin_Plus.asp")
End Sub

Sub LoadPlus()
	dim mdbname
	mdbname=Cl.Checkstr(Trim(Request.form("Plusmdb")))
	Call DataBaseConnection(mdbname)
	Set rs=Server.CreateObject("Adodb.RecordSet")
	Sql="Select ID,PlusID,PlusName,PlusIntro From Cl_Plus Order by ID Desc"
	rs.Open sql,PlusConn,1,1
%>
	<script language="JavaScript" type="text/javascript">
	<!--
	function CheckAll(form)  {
	  for (var i=0;i<form.elements.length;i++)    {
	    var e = form.elements[i];
	    if (e.name != 'chkall'){
		e.checked = form.chkall.checked;
		}
 	  }
  	}
	//-->
	</script>
	<form action="?action=LoadInPlus" method=post>
	<table border="0" cellspacing="1" cellpadding="5" align=center width="95%" class="Border">
	<tr><td width="100%" colspan="5" class="title">导入网站插件列表</td></tr>
	<tr class="title2">
	<td width="10%"  align="center">插件ID</td>
	<td width="25%"  align="center">插件名称</td>
	<td width="45%"  align="center">插件说明</td>
	<td width="5%"  align="center">选择</td>
	<td width="5%"  align="center">操作</td>
	</tr>
<%
	if rs.eof and rs.bof then
		response.write "<tr class='tdbg'><td align='center' colspan='5'><br />没有任何记录！<br /></td></tr>"
	else
		do while not rs.EOF%>
		<tr class="tdbg">
		<td width="10%" align="center"><%=rs("PlusID")%></td>
		<td width="25%" align="center"><%=rs("PlusName")%></td>
		<td width="45%" align="center"><%=rs("PlusIntro")%></td>
		<td><a href="?Action=Delout&ID=<%=rs("ID")%>&dbpath=<%=mdbname%>">删除</a></td>
		<td><input type="checkbox" name="ID" value="<%=rs("ID")%>"></td>
		</tr>
		<%
			rs.MoveNext
		loop
%>
	<tr>
	<td colspan="5" align="right" class="tdbg">
	<input type="hidden" name="mdbname" id="mdbname" value="<%=mdbname%>">
	<input type="submit" name="submit" value="导入">
	<input type=checkbox name=chkall value=on onclick="CheckAll(this.form)">全选</td>
	</tr>
<%
	rs.Close:Set rs=Nothing 
	end if
	%>
	</table>
	</form>
<%
End Sub

Sub LoadInPlus()
	dim mdbname
	mdbname=Cl.Checkstr(Trim(Request.form("mdbname")))
	Call DataBaseConnection(mdbname)
	ID=Cl.checkstr(Request("ID"))
	If ID="" or isnull(ID) or Not Isnumeric(Replace(Replace(ID,",","")," ","")) Then
		Admin_ShowErr("<br /><li>您还未选取要导入的插件")
	End If
	If mdbname="" Then
		Admin_ShowErr("<br /><li>请填写导入插件数据库名")
	End If
	Dim Rs1,Rs2,Sql1,Sql2
	Set Rs1=Server.CreateObject("ADODB.Recordset")
	Set Rs2=Server.CreateObject("ADODB.Recordset")
	Sql1 = "Select * from Cl_Plus where ID in ("&ID&")"
	OpenConn : rs1.open sql1,PlusConn,1,1
	do while not rs1.EOF
		Sql2 = "Select * from Cl_Plus where PlusName='"&rs1("PlusName")&"'"
		rs2.open sql2,conn,3,3
		If rs2.eof and rs2.bof Then
			rs2.addnew
			rs2("PlusName")=rs1("PlusName")
			rs2("PlusIntro")=rs1("PlusIntro")
			rs2("OrderID")=rs1("OrderID")
			rs2("PlusSetting")=rs1("PlusSetting")
			Rs2("PlusID")=rs1("PlusID")
			Rs2("PlusLink")=rs1("PlusLink")
			Rs2("UserGroup")=rs1("UserGroup")
			Rs2("PlusMenu")=rs1("PlusMenu")
			Rs2("PlusAdmin")=rs1("PlusAdmin")
			Rs2("IsUse")=rs1("IsUse")
			Rs2("AdminOnly")=rs1("AdminOnly")
			Rs2("PlusType")=rs1("PlusType")
			rs2.update
		Else
			Admin_ShowErr("<br /><li>系统中存在插件"&rs2("PlusName")&",如果要导入请先删除系统中原插件。")
		End if
		rs1.MoveNext
		rs2.Close
	loop
	rs1.Close:Set rs1=Nothing:Set rs2=Nothing
	Response.Write "<script language='JavaScript' type='text/JavaScript'>" &vbcrlf
	Response.Write "parent.left.location.reload();" &vbcrlf
	Response.Write "</script>"
	Call Cl.OutMsg("插件数据导入成功。","Admin_Plus.asp")
End Sub

Sub Delout()
	dim dbpath
	dbpath=Cl.Checkstr(Trim(Request("dbpath")))
	Call DatabaseConnection(dbpath)
	ID=Trim(Request("ID"))
	if Not IsNumeric(ID) then
		Call Cl.OutMsg("请正确指定要删除插件的ID。","javascript:history.go(-1)")
	end if
	If dbpath="" Then
		Admin_ShowErr("<br /><li>请填写导入插件数据库名")
	End If
	Dim sql,rs
	Set Rs=Server.CreateObject("ADODB.Recordset")
	sql="Delete * from Cl_Plus where ID="&Clng(ID)&""
	rs.open sql,PlusConn,1,3
	Call Cl.OutMsg("插件删除成功。","javascript:history.go(-1)")
End Sub

Sub DataBaseConnection(mdbname)
	On Error Resume Next 
	Set PlusConn = Server.CreateObject("ADODB.Connection")
	PlusConn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(mdbname)
	If Err.Number ="-2147467259"  Then 
		Admin_ShowErr("<li>"&Server.MapPath(mdbname)&"数据库不存在。")
		Response.end
	End If
End Sub

%>
