<%@ Page Language="C#" Inherits="IWMS.Admin.Upload" MasterPageFile="admin_pop.master"%>
<asp:Content ContentPlaceHolderId="cphHead" runat="server">
	<script type="text/javascript" src="inc/dopost.js"></script>
	<script type="text/javascript">
	<!--
	function InsertBodyFlash(file)
	{
		var fst = document.getElementById("swfFst").value;
		var str;
		if (fst==""){
			str ="<center><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='480' height='360'><param name='movie' value='"+ file +"'/><param name='quality' value='high'/><param name='play' value='-1'><embed src='"+ file +"' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' quality='high' width='480' height='360'></embed></object></center>";
		}else{
			str ="<table align='center'><tr><td align='center'><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='480' height='360'><param name='movie' value='"+ file +"'/><param name='quality' value='high'/><param name='play' value='-1'><embed src='"+ file +"' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' quality='high' width='480' height='360'></embed></object><br/><br/><a href='"+ file +"'>"+ fst +"</a></td></tr></table>";
		}
		InsertBodyHtml(str);
	}
	
	function InsertBodyHtml(str)
	{
		var ed=opener.tinyMCE.get(opener.iwms.body);
		// chrome在没内容时无法插入的fix
		if(ed.getContent().length==0){
			ed.selection.collapse(false);
		}
		ed.execCommand("mceInsertContent",false,str);
	}
	
	var defaultNum = 1;
	function FileNumChange(add)
	{
		var arr = new Array();
		arr[0] = document.getElementById("<%=myFile1.ClientID%>");
		arr[1] = document.getElementById("<%=myFile2.ClientID%>");
		arr[2] = document.getElementById("<%=myFile3.ClientID%>");
		arr[3] = document.getElementById("<%=myFile4.ClientID%>");
		arr[4] = document.getElementById("<%=myFile5.ClientID%>");
		
		if (add && defaultNum<5){
			defaultNum++;
		}else if (!add && defaultNum>1){
			defaultNum-=1;
		}
		
		for(var i=0; i<arr.length; i++){
			if (i >= defaultNum){
				arr[i].disabled = true;
				arr[i].style.display = "none";
			}else{
				arr[i].disabled = false;
				arr[i].style.display = "block";
			}
		}
	}
	
	function SetAlt(str)
	{
		var o = document.getElementById("<%=imgAlt.ClientID%>");
		o.value = str;
	}
	-->
	</script>
	<asp:PlaceHolder id="phCropHead" Visible="false" runat="server">
		<script type="text/javascript" src="imgCropper/imgCropper.js"></script>
		<script type="text/javascript" src="imgCropper/Drag.js"></script>
		<script type="text/javascript" src="imgCropper/Resize.js"></script>
		<script type="text/javascript" src="inc/jquery.js"></script>
		<link rel="stylesheet" type="text/css" href="imgCropper/crop.css"/>
	</asp:PlaceHolder>
	
	<%RegisterOnSubmitStatement("dopost","dopost.show();");%>
</asp:Content>

<asp:Content ContentPlaceHolderId="cphMain" runat="server">
	<form id="holder" enctype="multipart/form-data" method="post" runat="server">
	<asp:PlaceHolder id="phUpload" runat="server">
	<div class="mframe">
	<div class="tl"></div>
	<div class="rt"></div>
	<div class="tm">
		<span class="tt">文件上传</span>
	</div>
	<div class="wrapper">
	<div class="ml"></div>
	<div class="mr"></div>
	<div class="mm">
		<table cellpadding="3" width="95%" align="center">
		<tr><td align="center">
			<asp:Label id="myLabel" style="display:block;text-align:center;padding:5px" EnableViewState="false" runat="server"/>
			<table align="center"><tr><td align="center">
			选择上传文件：<br/>
			<%if (!upSoft){%>
			<a href="javascript:FileNumChange(true);">加</a>&nbsp;
			<a href="javascript:FileNumChange(false);">减</a>
			<%}%>
			</td><td>
				<input type="file"  id="myFile1" size="15" style="display:block" runat="server"/> 
				<input type="file"  id="myFile2" size="15" style="display:none" Disabled="true" runat="server"/> 
				<input type="file"  id="myFile3" size="15" style="display:none" Disabled="true" runat="server"/> 
				<input type="file"  id="myFile4" size="15" style="display:none" Disabled="true" runat="server"/> 
				<input type="file"  id="myFile5" size="15" style="display:none" Disabled="true" runat="server"/>
				<asp:RequiredFieldValidator
					ControlToValidate="myFile1"
					ErrorMessage="必须选择上传文件"
					Display="Dynamic"
					runat="server"/>
	
			</td></tr>
			</table>
		</td></tr>
		<tr><td style="padding-left:30px">
			<asp:PlaceHolder id="phSoft" runat="server">
			上传文件地址添加至下载点
			<asp:DropDownList id="softPoint" runat="server"/>
			</asp:PlaceHolder>
			
			<asp:PlaceHolder id="phParam" runat="server">
			<table width="300" align="center">
			<tr><td colspan="2">
			<asp:CheckBox id="dispImage" Text="显示图片" Checked="true" runat="server"/>&nbsp;
			<asp:CheckBox id="dispExif" Text="显示元数据" Checked="false" runat="server"/>
			</td></tr>
			<tr><td>
			<asp:CheckBox id="getSmall" Text="生成小图" runat="server"/>
			</td><td>
			宽 <asp:DropDownList id="smallSize"
				runat="server" >
				<asp:ListItem value="800">800</asp:ListItem>
				<asp:ListItem value="640">640</asp:ListItem>
				<asp:ListItem value="480">480</asp:ListItem>
				<asp:ListItem value="360">360</asp:ListItem>
				<asp:ListItem value="240">240</asp:ListItem>
				<asp:ListItem value="120">120</asp:ListItem>
			</asp:DropDownList> px
			</td></tr>
			<tr><td colspan="2">
			<asp:CheckBox id="linkOri" Text="小图链接到原图" Checked="true" runat="server"/>
			</td></tr>
			<tr><td>
			<asp:CheckBox id="withMark" Text="图片加水印" runat="server"/>
			</td><td>
			<asp:DropDownList id="markAlign"
				runat="server">
				<asp:ListItem value="LT">左上</asp:ListItem>
				<asp:ListItem value="LB">左下</asp:ListItem>
				<asp:ListItem value="RT">右上</asp:ListItem>
				<asp:ListItem value="RB" Selected="true">右下</asp:ListItem>
				<asp:ListItem value="CT">居中</asp:ListItem>
			</asp:DropDownList>
			</td></tr>
			<tr><td colspan="2">
			图片说明/链接名：<asp:TextBox id="imgAlt" size="20" MaxLength="50" runat="server"/>
			<a href="javascript:SetAlt('下载文件');">下载</a>
			</td></tr>
			<tr class="trSplit"><td>
			<asp:CheckBox id="dispTitle" Text="生成标题图片" runat="server"/>
			</td><td>
			宽 <asp:DropDownList id="titleImgWidth"
				runat="server" >
				<asp:ListItem value="120">120</asp:ListItem>
				<asp:ListItem value="160">160</asp:ListItem>
				<asp:ListItem value="200">200</asp:ListItem>
				<asp:ListItem value="240">240</asp:ListItem>
				<asp:ListItem value="320">320</asp:ListItem>
				<asp:ListItem value="420">420</asp:ListItem>
			</asp:DropDownList> px
			高 <asp:DropDownList id="titleImgHeight"
				runat="server" >
				<asp:ListItem value="90">90</asp:ListItem>
				<asp:ListItem value="120">120</asp:ListItem>
				<asp:ListItem value="150">150</asp:ListItem>
				<asp:ListItem value="180">180</asp:ListItem>
				<asp:ListItem value="240">240</asp:ListItem>
				<asp:ListItem value="315">315</asp:ListItem>
			</asp:DropDownList> px
			</td></tr>
			<tr><td colspan="2">
			<asp:CheckBox id="cropImg" Text="选取图片区域生成标题图片" runat="server"/>
			</td></tr>
			<tr class="trSplit"><td colspan="2">
			Flash 全屏链接　：<input type="text" id="swfFst" size="20" maxlength="50" value="『全屏查看』"/>
			</td></tr>
			</table>
			</asp:PlaceHolder>
		</td></tr>
		<tr><td align="center">
		   <asp:Button id="Submit" text="上 传" onclick="Submit_OnClick" runat="server"/>
		</td> </tr>
		</table>
		<%if (!upSoft){%>
		&nbsp; <font color="gray">注：加水印和生成小图将导致元数据丢失<br/>&nbsp; 　　所以取元数据则不添加水印和生成小图</font>
		<%}%>
	</div>
	</div>
	<div class="bl"></div>
	<div class="br"></div>
	<div class="bm"></div>
	</div>
	
	
	</asp:PlaceHolder>
	
	
	<asp:PlaceHolder id="phCrop" Visible="false" runat="server">
	<table width="810" border="0" cellspacing="0" cellpadding="0" align="center" id="container">
	  <tr>
	    <td width="410"><div id="bgDiv">
	        <div id="dragDiv">
	          <div id="rRightDown"> </div>
	          <div id="rLeftDown"> </div>
	          <div id="rRightUp"> </div>
	          <div id="rLeftUp"> </div>
	          <div id="rRight"> </div>
	          <div id="rLeft"> </div>
	          <div id="rUp"> </div>
	          <div id="rDown"></div>
	        </div>
	      </div></td>
	    <td><div id="viewDiv"> </div></td>
	  </tr>
	  <tr>
	  	<td colspan="2" align="center">
				<br/>
				<input id="idColor" type="button" value="白色背景"/>　
				<input type="button" value="上一步" onclick="location.href='admin_upload.aspx'"/>　
				<asp:Button id="crop" onclick="crop_onClick" Text="确定图片区域" runat="server"/>
				
				<input type="hidden" id="picUrl" value="" runat="server"/>
				<input type="hidden" value="10" id="Pic_x" runat="server">
				<input type="hidden" value="10" id="Pic_y" runat="server">
				<input type="hidden" value="120" id="Pic_w" runat="server">
				<input type="hidden" value="90" id="Pic_h" runat="server">
	  	</td>
	  </tr>
	</table>
	<div id="loading">图片加载中...</div>
	
	<script type="text/javascript">
		var defaultRatio = {"width":<%=titleImgWidth.SelectedValue%>,"height":<%=titleImgHeight.SelectedValue%>};
	</script>
	<script type="text/javascript" src="imgCropper/crop.js"></script>
	
	</asp:PlaceHolder>
	
	<script type="text/javascript">
		<!--
		<asp:Literal id="ltScript" runat="server"/>
		-->
	</script>
	
	</form>
</asp:Content>