<%@ Language="VBScript" %>
<% option explicit %>
<%
dim webGen
%>
<!--#include file="../inc/dbconn.inc.asp"-->
<%
dim regEx,tag,imgTemp,imgInfo,strSrc,strBorderWidth,strAlign,strHSpace,strVSpace,strAltWord,iUploadFileSize
tag = Request("tag")

sql = "SELECT uploadFileSize FROM bs_fileSize"
set rs = conn.Execute(sql)
if not rs.EOF then
	iUploadFileSize = rs("uploadFileSize")
end if
rs.Close

set regEx = new RegExp
regEx.Pattern = "<IMG(.*)>"
regEx.IgnoreCase = false

if regEx.Test(tag) then
	Response.Write "<script> alert('"& tag &"'); "& vbCrLf &"</script>"
	imgTemp = split(str_replace("""","",right(tag,len(tag)-5))," ")
	for i=0 to ubound(imgTemp)
		imgInfo = split(imgTemp(i),"=")
		select case imgInfo(0)
			case "src"
				src = imgInfo(1)
			case "border"
				strBorderWidth = imgInfo(1)
			case "align"
				strAlign = imgInfo(1)
			case "hspace"
				strHSpace = imgInfo(1)
			case "vspace"
				strVSpace = imgInfo(1)
			case "alt"
				strAltWord = imgInfo(1)
		end select
	next
end if
%>
<html>
<head>
  <title>图片修改</title>
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  <link rel="stylesheet" type="text/css" href="css/syrise.css">
  <link rel="stylesheet" type="text/css" href="css/cn.css">
  <script language="JavaScript">
  <!--//
  window.focus();
  var imgUpload = true;
  function Syrise_CheckIt()
  {
	fileSuffix = ""+ document.edit.fileUp.value;
	fileSuffix = fileSuffix.substring(fileSuffix.length-3,fileSuffix.length);
	fileSuffix = fileSuffix.toLowerCase();
	if ((fileSuffix!="jpg")&&(fileSuffix!="gif")&&(fileSuffix!="swf"))
	{
		alert("请选择jpg或gif格式的图片");
		sel_staus = false;
	}
	else
	{
		sel_staus = true;
	}
	return sel_staus;
  }

  function Syrise_Check()
  {
	sel_ok = Syrise_CheckIt();
	if (sel_ok)
	{
		goedit_withouttxt();
	}
  }

  function Syrise_PreShow()
  {
	if(document.forms["edit"].elements["fileUp"].value!="")
	{
		sel_ok = Syrise_CheckIt();
		if (sel_ok)
		{
			fileSuffix=""+document.forms["edit"].elements["fileUp"].value;
			fileSuffix=fileSuffix.substring(fileSuffix.length-3,fileSuffix.length);
			fileSuffix=fileSuffix.toLowerCase();
			if (fileSuffix == "swf")
			{
				imgInfo.document.body.innerHTML = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\"><param name=movie value=\""+ document.forms["edit"].fileUp.value +"\"><param name=quality value=high><embed src=\""+ document.forms["edit"].fileUp.value +"\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\"></embed></object>";
			}
			else
				imgInfo.document.body.innerHTML = "<img src='"+document.forms["edit"].fileUp.value+"'>";
		}
	}
  }
  function Syrise_SavePic()
  {
	document.edit.imgFile.value = document.forms["edit"].fileUp.value;
	document.edit.submit();
  }

  function Syrise_Exit()
  {
	parent.window.returnValue=null;
	parent.window.close();
  }
  //-->
  </script>
  <script language="JavaScript" src="../Common/toolBar.js"></script>
</head>
<body bgcolor="MENU" leftmargin="5" marginwidth="5" topmargin="1" marginheight="1">
<table cellpadding="0" cellspacing="0" border="0" width="450" class="coolBar">
  <form name="edit" action="saveImg.asp" method="post" enctype="multipart/form-data">
  <input type="hidden" name="imgFile">
  <input type="hidden" name="uploadFileSize" value="<%=iUploadFileSize%>">
  <tr>
    <td colspan="2">
      <fieldset style="width:100%;margin-bottom:0;margin-left:0;margin-right:3;margin-top:3;" title="工具栏">
      <table cellpadding="0" cellspacing="0" border="0" width="100%">
        <tr class="coolButton">
          <td width="120px"><input type="file" name="fileUp" size="40" onFocus="Syrise_PreShow()" style="font-size:12px;"></td>
          <td style="width: 4;" width="22"><img src="images/separator.gif" width="2" height="18"></td>
          <td class="coolButton" onclick="Syrise_PreShow();" title="预览" width="22"><img src="images/imgPreview.gif" width="16" height="16"></td>
          <td style="width: 4;" width="22"><img src="images/separator.gif" width="2" height="18"></td>
          <td class="coolButton" onclick="Syrise_SavePic();" title="保存" width="22"><img src="images/save.gif" width="16" height="16"></td>
          <td style="width: 4;" width="22"><img src="images/separator.gif" width="2" height="18"></td>
          <td class="coolButton" onclick="Syrise_Exit();" title="退出" width="22"><img src="images/exit.gif" width="16" height="16"></td>
        </tr>
      </table>
      </fieldset>
    </td>
  </tr>
  <tr>
    <td width="330">
      <table cellpadding="0" cellspacing="0" border="0" width="330">
        <tr>
          <td colspan="3" class="Syrise_Body">图片预览框(图片大小最好不要超过 <% =iUploadFileSize %> KB)</td>
        </tr>
      </table>
      <fieldset style="width:325px;margin-top:3;" title="预览区">
        <iframe style="width:320px;height:196px;" id="imgInfo" marginheight="0" marginwidth="0" border="0" frameborder="1"></iframe>
      </fieldset>
    </td>
    <td width="120" valign="bottom" align="center">
      <fieldset style="width:120px;margin-top:3;" title="图片布局">
      <legend>图片布局</legend>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr height="24">
            <td>&nbsp;对齐:</td>
            <td>
              <select name="picAlign">
                <option value="">不设置</option>
                <option value="left"<% if strAlign="left" then Response.Write " selected" end if %>>左</option>
                <option value="right"<% if strAlign="right" then Response.Write " selected" end if %>>右</option>
                <option value="textTop"<% if strAlign="textTop" then Response.Write " selected" end if %>>文本上方</option>
                <option value="absMiddle"<% if strAlign="absMiddle" then Response.Write " selected" end if %>>正中央</option>
                <option value="baseline"<% if strAlign="baseline" then Response.Write " selected" end if %>>基线</option>
                <option value="absBottom"<% if strAlign="absBottom" then Response.Write " selected" end if %>>正下方</option>
                <option value="bottom"<% if strAlign="bottom" then Response.Write " selected" end if %>>下</option>
                <option value="center"<% if strAlign="center" then Response.Write " selected" end if %>>中</option>
                <option value="top"<% if strAlign="top" then Response.Write " selected" end if %>>上</option>
              </select>
            </td>
          </tr>
          <tr height="24">
            <td>&nbsp;边宽:</td>
            <td>
              <input type="text" name="border" size="10" value="<%=strBorderWidth%>">
            </td>
          </tr>
        </table>
      </fieldset>
      <fieldset style="width:120px;margin-top:3;" title="边距设置">
      <legend>边距设置</legend>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr height="24">
            <td>&nbsp;水平:</td>
            <td>
              <input type="text" name="hSpace" size="10" value="<%=strHSpace%>">
            </td>
          </tr>
          <tr height="24">
            <td>&nbsp;垂直:</td>
            <td>
              <input type="text" name="vSpace" size="10" value="<%=strVSpace%>">
            </td>
          </tr>
        </table>
      </fieldset>
      <fieldset style="width:120px;margin-top:3;" title="替换文字" align="center">
      <legend>替换文字</legend>
        <input type="text" name="alt" size="16" value="<%=strAltWord%>">
      </fieldset>
    </td>
  </tr>
</form>
</table>
<%
if strSrc <> "" then
	Response.Write "<script language=""javascript"">"& vbCrLf &"	document.all[""imgInfo""].src='"& strSrc &"'"& vbCrLf &"</script>"
end if
%>
</body>
</html>