<!--#include file="Cls_JS.asp" -->
<%
'==============================================================================
'软件名称：风讯网站信息管理系统
'当前版本：Foosun Content Manager System 2.0 
'最新更新：2004.12
'==============================================================================
'商业注册联系：028-85098980-601,602 技术支持：028-85098980-606、607,客户支持：608
'产品咨询QQ：159410,655071,66252421
'技术支持:所有程序使用问题，请提问到bbs.foosun.net我们将及时回答您
'程序开发：风讯开发组 & 风讯插件开发组
'论坛支持：风讯在线论坛(http://bbs.foosun.net)
'官方网站：www.Foosun.net  演示站点：test.cooin.com    
'网站建设专区：www.cooin.com
'==============================================================================
'免费版本请在新闻首页保留版权信息，并做上本站LOGO友情连接
'==============================================================================
  Dim MoveOrCopyClassPara
  If Request("MoveOrCopyClassPara")="" then
     Response.Write("<script>alert(""参数传递错误"");window.close();</script>")
	 Response.End
  Else
  MoveOrCopyClassPara = Request("MoveOrCopyClassPara")
	Dim MoveTF,MoveTFText,ResultString,IntentEName,IntentCName,SourceCName,SourceEName,DoNews,IntentObj,SourceObj,IntentFileSql,IntentFileObj,SourceFileObj
	MoveTF = GetParaValue(MoveOrCopyClassPara,"MoveTF")
	If MoveTF="true" then
	MoveTFText = "移动"
	Else
	MoveTFText = "复制"
	End If
	IntentEName = GetParaValue(MoveOrCopyClassPara,"ObjectClass") '目的JS
	SourceEName = GetParaValue(MoveOrCopyClassPara,"SourceClass") '源JS
	DoNews = GetParaValue(MoveOrCopyClassPara,"SourceNews") '操作新闻 
	Set IntentObj = Conn.Execute("Select CName from FreeJS where EName='"&IntentEName&"'")
	If IntentObj.eof then
	   Response.Write("<script>alert(""目的JS已经不存在,请刷新后再进行操作"");dialogArguments.location.reload();window.close();</script>")
	   Response.End
	Else
		IntentCName = IntentObj("CName")
	End if
	Set SourceObj = Conn.Execute("Select CName from FreeJS where EName='"&SourceEName&"'")
	If SourceObj.eof then
	   Response.Write("<script>alert(""源JS已经不存在,请刷新后再进行操作"");dialogArguments.location.reload();window.close();</script>")
	   Response.End
	Else
		SourceCName = SourceObj("CName")
	End if
	If MoveTF = "true" and Cstr(IntentEName) = Cstr(SourceEName) then
	   Response.Write("<script>alert(""源JS和目的JS不能相同"");window.close();</script>")
	   Response.End
	End if
	If Request.Form("action")="trues" then
		Dim JSMoCoArray,JM_i
		JSMoCoArray = Array("")
		JSMoCoArray = Split(DoNews,",")
		For JM_i = 0 to UBound(JSMoCoArray)
			If MoveTF = "true" then '移动新闻 
			   Conn.Execute("Update FreeJsFile set JSName='"&IntentEName&"',ToJsTime='"&now()&"' where ID="&Clng(JSMoCoArray(JM_i))&"")
			   ResultString = "新闻移动成功"
			Else '复制新闻
				Set SourceFileObj = Conn.Execute("Select * from FreeJsFile where ID="&Clng(JSMoCoArray(JM_i))&"")
				Set IntentFileObj=server.createobject("adodb.recordset") '目的新闻
				IntentFileSql="Select * from FreeJsFile"
				IntentFileObj.open IntentFileSql,Conn,3,3
				IntentFileObj.AddNew
				If Cstr(IntentEName) <> Cstr(SourceEName) then
					IntentFileObj("Title") = SourceFileObj("Title")
				Else
					IntentFileObj("Title") = "复件"&SourceFileObj("Title")
				End If
				IntentFileObj("JSName") = IntentEName
				IntentFileObj("FileName") = SourceFileObj("FileName")
				IntentFileObj("PicPath") = SourceFileObj("PicPath")
				IntentFileObj("ClassID") = SourceFileObj("ClassID")
				IntentFileObj("NewsTime") = SourceFileObj("NewsTime")
				IntentFileObj("ToJsTime") = now()
				IntentFileObj.Update
				IntentFileObj.Close
				Set IntentFileObj = Nothing
				ResultString = "新闻拷贝成功"
			End if
		Next
		If ResultString <> "" then
		
		  '----------重新生成JS文件--------------
		  Dim CreaJSIntentObj,CreaJSSourceObj
		      Set CreaJSIntentObj = Conn.Execute("Select Manner from FreeJS where EName='"&IntentEName&"'")
			  Select case CreaJSIntentObj("Manner")
				 case "1"   WCssA IntentEName,True
				 case "2"   WCssB IntentEName,True
				 case "3"   WCssC IntentEName,True
				 case "4"   WCssD IntentEName,True
				 case "5"   WCssE IntentEName,True
				 case "6"   PCssA IntentEName,True
				 case "7"   PCssB IntentEName,True
				 case "8"   PCssC IntentEName,True
				 case "9"   PCssD IntentEName,True
				 case "10"   PCssE IntentEName,True
				 case "11"   PCssF IntentEName,True
				 case "12"   PCssG IntentEName,True
				 case "13"   PCssH IntentEName,True
				 case "14"   PCssI IntentEName,True
				 case "15"   PCssJ IntentEName,True
				 case "16"   PCssK IntentEName,True
				 case "17"   PCssL IntentEName,True
			   End Select
		  Set CreaJSSourceObj = Conn.Execute("Select Manner from FreeJS where EName='"&SourceEName&"'")
			  Select case CreaJSSourceObj("Manner")
				 case "1"   WCssA SourceEName,True
				 case "2"   WCssB SourceEName,True
				 case "3"   WCssC SourceEName,True
				 case "4"   WCssD SourceEName,True
				 case "5"   WCssE SourceEName,True
				 case "6"   PCssA SourceEName,True
				 case "7"   PCssB SourceEName,True
				 case "8"   PCssC SourceEName,True
				 case "9"   PCssD SourceEName,True
				 case "10"   PCssE SourceEName,True
				 case "11"   PCssF SourceEName,True
				 case "12"   PCssG SourceEName,True
				 case "13"   PCssH SourceEName,True
				 case "14"   PCssI SourceEName,True
				 case "15"   PCssJ SourceEName,True
				 case "16"   PCssK SourceEName,True
				 case "17"   PCssL SourceEName,True
			   End Select
		  '--------------------------------------
		   Response.Write("<script>dialogArguments.location.reload();window.close();</script>")
		   Response.End
		End If
	End If  
  End If
  
Function GetParaValue(ParaStr,ParaName)
	Dim BeginIndex,EndIndex
	BeginIndex = InStr(ParaStr,ParaName)+Len(ParaName)+1
	EndIndex = InStr(BeginIndex,ParaStr,";")
	GetParaValue = Mid(ParaStr,BeginIndex,EndIndex-BeginIndex)
End Function

%>

<html>
<head>
<link href="../Inc/ModeWindow.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>移动或复制JS新闻</title>
</head>
<body topmargin="0" leftmargin="0" >
<form action="" method="post" name="MoveForm">
<table width="100%" border="0" cellspacing="3" cellpadding="0">
  <tr> 
    <td colspan="2"><div align="center"><img src="../Images/Question.gif" width="39" height="37"></div></td>
    <td colspan="2">您确定要将此新闻从<font color="red"><%=SourceCName%></font><font color="blue"><%=MoveTFText%></font>到<font color="red"><%=IntentCName%></font>?</td>
    </tr>
  <tr> 
    <td colspan="4"><div align="center"> 
          <input type="submit" name="Submit" value=" 确 定 ">
          <input type="hidden" name="action" value="trues">
          <input type="button" name="Submit2" value=" 取 消 " onClick="window.close();">
      </div></td>
    </tr>
</table>
</form>
</body>
</html>
