<!--#include file="Cls_JS.asp" -->
<%
    dim FileID,FileObj,Types,TempResultStr,FreeJSObj
	    if Request("JSID")<>"" then
			FileID = Request("JSID")
			Types = Cstr(Request("Types"))
		else
			 Response.Write("<script>alert(""参数传递错误"");</script>")
			 response.end
		end if
%>
<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>
<script src="../JS/PublicJS.js" language="JavaScript"></script>
<body leftmargin="0" topmargin="0">
<% if Types = "Mod" then
	Set FileObj = Conn.Execute("Select PicPath,JSName from FreeJsFile where ID="&Clng(FileID)&"")
	if FileObj.eof then
		 Response.Write("<script>alert(""参数传递错误"");</script>")
		 response.end
	end if
	Set FreeJSObj = Conn.Execute("Select Manner from FreeJS where EName='"&FileObj("JSName")&"'")
%>
<form action="" name="FMForm" method="post" >
  <table width="100%" border="0" cellspacing="5" cellpadding="0">
    <tr> 
      <td height="8"></td>
    </tr>
    <tr> 
      <td><div align="center">
          <input name="PicPath" type="text" size="30" value="<%=FileObj("PicPath")%>">
          <input type="button" name="Submit" value="选择图片" onClick="OpenWindowAndSetValue('../inc/SelectPic.asp?CurrPath=/<% = UpFiles %>',550,300,window,document.FMForm.PicPath);">
      </div></td>
    </tr>
    <tr> 
      <td height="5"></td>
    </tr>
    <tr> 
      <td> <div align="center">
          <input type="submit" name="Submit2" value=" 修 改 ">
          <input name="action" type="hidden" id="action2" value="mod">
          <input type="button" name="Submit3" value=" 取 消 " onClick="window.close();">
      </div></td>
    </tr>
  </table>
</form>
<% elseif Types = "Del" then%>
<form name="JSDellForm" action="" method="post">
  <table width="100%" border="0" cellspacing="5" cellpadding="0">
    <tr> 
      <td><div align="center"><img src="../Images/Question.gif" width="39" height="37"></div></td>
      <td width="76%">您确定要从JS中删除所选新闻?</td>
    </tr>
    <tr> 
      <td colspan="2"><div align="center"> 
          <input type="submit" name="Submit4" value=" 确 定 ">
          <input name="DAction" type="hidden" id="DAction" value="trues">
          <input type="button" name="Submit5" value=" 取 消 " onclick="window.close();">
      </div></td>
    </tr>
  </table>
</form>
  <% end if %>
</body>
</html>
<%
  if Request("action")="mod" then
     if Request.Form("PicPath")<>"" then
	     dim PicStr
		 PicStr = Cstr(Request.Form("PicPath"))
		 Conn.Execute("Update FreeJsFile set PicPath='"&PicStr&"' where ID="&FileID&"")
		 TempResultStr = "JS新闻图片修改成功"
	  '--------------------重新生成JS文件---------------------------------
		  Select case FreeJSObj("Manner")
		 case "1"   WCssA FileObj("JSName"),True
		 case "2"   WCssB FileObj("JSName"),True
		 case "3"   WCssC FileObj("JSName"),True
		 case "4"   WCssD FileObj("JSName"),True
		 case "5"   WCssE FileObj("JSName"),True
		 case "6"   PCssA FileObj("JSName"),True
		 case "7"   PCssB FileObj("JSName"),True
		 case "8"   PCssC FileObj("JSName"),True
		 case "9"   PCssD FileObj("JSName"),True
		 case "10"   PCssE FileObj("JSName"),True
		 case "11"   PCssF FileObj("JSName"),True
		 case "12"   PCssG FileObj("JSName"),True
		 case "13"   PCssH FileObj("JSName"),True
		 case "14"   PCssI FileObj("JSName"),True
		 case "15"   PCssJ FileObj("JSName"),True
		 case "16"   PCssK FileObj("JSName"),True
		 case "17"   PCssL FileObj("JSName"),True
	   End Select
	  FreeJSObj.Close
	  Set FreeJSObj = Nothing 
	 end if
  end if
  
  if Request.Form("DAction")="trues" then
  	Dim DFArray,DF_i,CreaFileObj,CcreFileObj
	DFArray = Array("")
	DFArray = Split(FileID,",")
	For DF_i = 0 to UBound(DFArray)
		 Conn.Execute("delete from FreeJsFile where ID="&DFArray(DF_i)&"")
	Next
	Set CreaFileObj = Conn.Execute("Select distinct JSName from FreeJsFile where ID in ("&FileID&")")
	Do while Not CreaFileObj.eof
		Set CcreFileObj = Conn.Execute("Select Manner,EName from FreeJS where EName='"&CreaFileObj("JSName")&"'")
		If Not CcreFileObj.eof then
	  '--------------------重新生成JS文件---------------------------------
		  Select case FreeJSObj("Manner")
		 case "1"   WCssA FileObj("JSName"),True
		 case "2"   WCssB FileObj("JSName"),True
		 case "3"   WCssC FileObj("JSName"),True
		 case "4"   WCssD FileObj("JSName"),True
		 case "5"   WCssE FileObj("JSName"),True
		 case "6"   PCssA FileObj("JSName"),True
		 case "7"   PCssB FileObj("JSName"),True
		 case "8"   PCssC FileObj("JSName"),True
		 case "9"   PCssD FileObj("JSName"),True
		 case "10"   PCssE FileObj("JSName"),True
		 case "11"   PCssF FileObj("JSName"),True
		 case "12"   PCssG FileObj("JSName"),True
		 case "13"   PCssH FileObj("JSName"),True
		 case "14"   PCssI FileObj("JSName"),True
		 case "15"   PCssJ FileObj("JSName"),True
		 case "16"   PCssK FileObj("JSName"),True
		 case "17"   PCssL FileObj("JSName"),True
	   End Select
	  End If
	  CcreFileObj.Close
	  Set CcreFileObj = Nothing
	  CreaFileObj.MoveNext
	Loop
 TempResultStr = "成功删除JS新闻"
 end if
 If TempResultStr<>"" then
	 Response.write("<script>dialogArguments.location.reload();window.close();</script>")
	 Response.end
  End If
%>