
<%@ Register TagPrefix="uc1" TagName="UIHead" Src="Controls/UIHead.ascx" %>
<%@ Register TagPrefix="uc1" TagName="UIFrameTop" Src="Controls/UIFrameTop.ascx" %>
<%@ Register TagPrefix="uc1" TagName="UIFrameLeft" Src="Controls/UIFrameLeft.ascx" %>
<%@ Page CodeBehind="Photo_Upload.aspx.cs" Language="c#" AutoEventWireup="True" Inherits="Typhoto.Photo_Upload" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
  <HEAD>
		<META http-equiv="Content-Type" content="text/html; charset=gb2312">
		
		<SCRIPT type="text/javascript" src="js/flash.js"></SCRIPT>
		<SCRIPT language="javascript">
var ColorImg;
var ColorValue;
var currint=0;
function hideColourPallete() {
	document.getElementById("colourPalette").style.visibility="hidden";
}
function Getcolor(img_val,input_val){
	var obj = document.getElementById("colourPalette");
	ColorImg = img_val;
	ColorValue = document.getElementById(input_val);
	if (obj){
	obj.style.left = getOffsetLeft(ColorImg) + "px";
	obj.style.top = (getOffsetTop(ColorImg) + ColorImg.offsetHeight) + "px";
	if (obj.style.visibility=="hidden")
	{
	obj.style.visibility="visible";
	}else {
	obj.style.visibility="hidden";
	}
	}
}
function getOffsetTop(elm) {
	var mOffsetTop = elm.offsetTop;
	var mOffsetParent = elm.offsetParent;
	while(mOffsetParent){
		mOffsetTop += mOffsetParent.offsetTop;
		mOffsetParent = mOffsetParent.offsetParent;
	}
	return mOffsetTop;
}
function getOffsetLeft(elm) {
	var mOffsetLeft = elm.offsetLeft;
	var mOffsetParent = elm.offsetParent;
	while(mOffsetParent) {
		mOffsetLeft += mOffsetParent.offsetLeft;
		mOffsetParent = mOffsetParent.offsetParent;
	}
	return mOffsetLeft;
}
function setColor(color)
{
	if (ColorValue){if (color!=500) ColorValue.value = color;else ColorValue.value =""}
	if (ColorImg){if (color!=500) ColorImg.style.backgroundColor = color;else ColorImg.style.backgroundColor =""}
	document.getElementById("colourPalette").style.visibility="hidden";
}
function selectImage(objname)
{
	window.open("Photo_Sel.aspx",'','scrollbars=yes,resizable=no,status=no,toolbar=no,menubar=no,location=no,width=700,height=500');
}
var alias,rdMarkText,txtMarkText,txtMarkPic,postion,selsize,selbold,selfont,color1,color2,tag,autos,countlength,currlength,arrLocation,fileliststr,fulllist;

function Isgetlist_callback(res)
{
	if ((fulllist==null) || (fulllist=="")) fileliststr = res.value;
	else fileliststr =fulllist;
	document.all.loading.style.top =Math.round((document.body.clientHeight-100)/2)+document.body.scrollTop-50;
	document.all.loading.style.left =Math.round((document.body.clientWidth-100)/2)-100;
	document.all.loading.style.display='';
	var lwater,lpostion;
	if (document.all.iwater0.checked) lwater="0";
	else if (document.all.iwater1.checked) lwater="1";
	else if (document.all.iwater2.checked) lwater="2";
	
	if (document.all.postion1.checked) lpostion="1";
	else if (document.all.postion2.checked) lpostion="2";
	else if (document.all.postion3.checked) lpostion="3";
	else if (document.all.postion4.checked) lpostion="4";
	else if (document.all.postion5.checked) lpostion="5";
	document.getElementById("piccount").innerHTML=countlength;
	
	alias=document.all.hidalias.value;
	rdMarkText=lwater;
	txtMarkText=document.all.txtMarkText.value;
	txtMarkPic=document.all.txtMarkPic.value;
	postion=lpostion;
	selsize=document.all.selsize.value;
	selbold=document.all.selbold.checked;
	selfont=document.all.selfont.value;
	color1=document.all.color1.value;
	color2=document.all.color2.value;
	tag=document.all.tag.value;
	autos=document.all.autos.checked;
	arrLocation=fileliststr.split(",");
	window.frames['pro'].location.href = 'photopro.aspx?filelist='+escape(arrLocation[currlength]).replace(/\+/g, '%2b')+'&alias='+escape(alias)+'&rdMarkText='+escape(rdMarkText)+'&txtMarkText='+escape(txtMarkText)+'&txtMarkPic='+escape(txtMarkPic)+'&postion='+postion+'&selsize='+selsize+'&selbold='+selbold+'&selfont='+escape(selfont)+'&color1='+escape(color1)+'&color2='+escape(color2)+'&tag='+escape(tag)+'&autos='+autos;
}
function UploadComplete(UrlList)
{
	countlength=UrlList;
	currlength=0;
	if ((fulllist==null) || (fulllist=="")) 
		Typhoto.Photo_Upload.GetUploadList(Isgetlist_callback);
	else 
		Isgetlist_callback(fulllist);
}
function UploadComplete2(UrlList)
{
	fulllist=UrlList;
}
function UploadPro()
{
	document.all.loading.style.top =Math.round((document.body.clientHeight-100)/2)+document.body.scrollTop-50;
	document.all.loading.style.left =Math.round((document.body.clientWidth-100)/2)-100;
	document.all.loading.style.display='';
	currlength=parseInt(currlength)+1;
	if (currlength < arrLocation.length) window.frames['pro'].location.href = 'photopro.aspx?filelist='+escape(arrLocation[currlength]).replace(/\+/g, '%2b')+'&alias='+escape(alias)+'&rdMarkText='+escape(rdMarkText)+'&txtMarkText='+escape(txtMarkText)+'&txtMarkPic='+escape(txtMarkPic)+'&postion='+postion+'&selsize='+selsize+'&selbold='+selbold+'&selfont='+escape(selfont)+'&color1='+escape(color1)+'&color2='+escape(color2)+'&tag='+escape(tag)+'&autos='+autos;
	currint++;
	document.getElementById("piccurr").innerHTML=currint;
	if (document.getElementById("piccurr").innerHTML==document.getElementById("piccount").innerHTML) window.location="Album_Photos.aspx?DirID="+document.all.hidalias.value;
}
		</SCRIPT>
        <style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
        </style>
</HEAD>
	<body class=body_1 scroll=no onLoad="javascript:writeflash('<%=GetFlashVars%>');">
		<div id="loading" style=" BORDER-RIGHT:#dbdce3 1px solid; BORDER-TOP:#dbdce3 1px solid; DISPLAY:none; BORDER-LEFT:#dbdce3 1px solid; BORDER-BOTTOM:#dbdce3 1px solid; POSITION:absolute; BACKGROUND-COLOR:#ffffae"><img src="images/loading.gif" width="32" height="32" align="absMiddle">
			<b>正在生成缩略图，请稍候，共<span id='piccount'>0</span>张，已处理<span id='piccurr'>0</span>张</b></div>
		<iframe id="colourPalette" style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: gray 1px solid; BORDER-BOTTOM: gray 1px solid; POSITION: absolute; TOP: 0px"
			src="selcolor.htm" frameBorder="0" width="260" scrolling="no" height="165"></iframe>
		<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
			<tr>
				<td height="60"><uc1:uihead id="UIHead1" runat="server"></uc1:uihead></td>
			</tr>
			<tr>
				<td height="10"><uc1:uiframetop id="UIFrameTop1" runat="server"></uc1:uiframetop></td>
			</tr>
			<tr>
				<td>
					<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
						<tr>
							<td class="frame_left_1" vAlign="top" width="193"><uc1:uiframeleft id="UIFrameLeft1" runat="server" Current="UploadPhoto"></uc1:uiframeleft></td>
							<td class="frame_body_1" vAlign="top">
								<table cellSpacing="0" cellPadding="0" width="100%" border="0">
									<tr>
										<td class="main_title_1" height="32">
											<table cellSpacing="2" cellPadding="3" width="100%" border="0">
												<tr>
													<td><IMG src="images/icon_2_4.gif" align="absMiddle">&nbsp; 上传照片</td>
													<td width="56"><A href="javascript:history.back();"><IMG src="images/link_back.gif" align="absMiddle"></A></td>
												</tr>
											</table>
										</td>
									</tr>
									<tr>
										<td class="main_content_1" vAlign="top">
											<form id="Form1" name="Form1" encType="multipart/form-data" runat="server">
												<table width="100%" border="0" cellPadding="0" cellSpacing="3">
													<tr>
														<td width="88" height="27">相　　册：</td>
														<td width="709"><b><%=album%></b></td>
													</tr>
													<tr>
														<td height="27">上传方式：													    </td>
<td><input name="mode" type="radio" id="mode1" value="1" checked onClick="javascript:document.all.show4.style.display='';document.all.show5.style.display='';document.all.show6.style.display='none';document.all.show7.style.display='none';">
															<label for="mode1">批量上传</label>
														  <label for="mode2"></label>
															<input id="mode3" type="radio" value="3" name="mode" onClick="javascript:document.all.show4.style.display='none';document.all.show5.style.display='none';document.all.show6.style.display='';document.all.show7.style.display='';">
															<label for="mode3">网络图片下载</label></td>
													</tr>
													<tr id="waterset" runat="server">
														<td height="27">水印设定：													    </td>
										  <td><input id="iwater0" onClick="javascript:document.all.show1.style.display='none';document.all.show2.style.display='none';document.all.show3.style.display='none';"
																type="radio" CHECKED value="0" name="water">
															<label for="iwater0">不使用水印</label>
															<input id="iwater1" onClick="javascript:document.all.show1.style.display='';document.all.show2.style.display='none';document.all.show3.style.display='';"
																type="radio" value="1" name="water">
															<label for="iwater1">使用文字水印</label>
															<input id="iwater2" onClick="javascript:document.all.show1.style.display='none';document.all.show2.style.display='';document.all.show3.style.display='';"
																type="radio" value="2" name="water">
															<label for="iwater2">使用图片水印</label></td>
													</tr>
													<tr id="show1" style="DISPLAY: none">
														<td height="27">文字水印：</td>
														<td height="27">字体：
															<select id="selfont" name="selfont">
																<option value="宋体">宋体</option>
																<option value="楷体_GB2312">楷体</option>
																<option value="新宋体">新宋体</option>
																<option value="黑体">黑体</option>
																<option value="隶书">隶书</option>
																<option value="Andale Mono" selected>Andale Mono</option>
																<option value="Arial">Arial</option>
																<option value="Arial Black">Arial Black</option>
																<option value="Book Antiqua">Book Antiqua</option>
																<option value="Century Gothic">Century Gothic</option>
																<option value="Comic Sans MS">Comic Sans MS</option>
																<option value="Courier New">Courier New</option>
																<option value="Georgia">Georgia</option>
																<option value="Impact">Impact</option>
																<option value="Tahoma">Tahoma</option>
																<option value="Times New Roman">Times New Roman</option>
																<option value="Trebuchet MS">Trebuchet MS</option>
																<option value="Script MT Bold">Script MT Bold</option>
																<option value="Stencil">Stencil</option>
																<option value="Verdana">Verdana</option>
																<option value="Lucida Console">Lucida Console</option>
															</select>
															字号：
															<select id="selsize" name="selsize">
																<option value="9">9</option>
																<option value="10">10</option>
																<option value="12" selected>12</option>
																<option value="14">14</option>
																<option value="16">16</option>
																<option value="18">18</option>
																<option value="24">24</option>
																<option value="36">36</option>
															</select>
															文字颜色：<span class="ForumRowHighlight"><IMG title="选取颜色" style="CURSOR: pointer; BACKGROUND-COLOR: #ffffff" onClick="Getcolor(this,'color1');"
																	height="17" src="images/rect.gif" width="18" border="0"></span>文字背景：<span class="ForumRowHighlight"><IMG title="选取颜色" style="CURSOR: pointer" onClick="Getcolor(this,'color2');" height="17"
																	src="images/rect.gif" width="18" border="0"></span>
															<input id="selbold" type="checkbox" value="checkbox" name="selbold"> 粗 <input class="b1a1989d7 l19" id="txtMarkText" value="此处输入水印文字" name="txtMarkText">
															<INPUT id="color1" style="WIDTH: 16px; HEIGHT: 22px" type="hidden" size="1" value="#FFFFFF"
																name="color1"> <INPUT id="color2" style="WIDTH: 22px; HEIGHT: 22px" type="hidden" size="1" name="color2">														</td>
													</tr>
													<tr id="show2" style="DISPLAY: none">
														<td height="27">图片水印：</td>
														<td height="27"><INPUT class="btn" id="btnselect" onClick="selectImage();" type="button" value="选择水印图片…"
																name="btnselect"><INPUT id="txtMarkPic" type="hidden" size="1" name="txtMarkPic">&nbsp;&nbsp;<IMG id="tuwater" style="DISPLAY: none" alt="" src="" name="tuwater"></td>
													</tr>
													<tr id="show3" style="DISPLAY: none">
														<td height="27">水印位置：</td>
														<td height="27"><input id="postion1" type="radio" value="1" name="postion">
															<label for="postion1">左上角</label>
															<input id="postion2" type="radio" value="2" name="postion">
															<label for="postion2">左下角</label>
															<input id="postion3" type="radio" value="3" name="postion">
															<label for="postion3">居中</label>
															<input id="postion4" type="radio" value="4" name="postion">
															<label for="postion4">左上角</label>
															<input id="postion5" type="radio" CHECKED value="5" name="postion">
															<label for="postion5">右下角</label></td>
													</tr>
													<tr>
                                                      <td>添加标签：</td>
													  <td><FONT face=宋体>
                                                        <INPUT class=kuan id=tag type=text name=tag>
													    &nbsp;<IMG 
                        alt="一般用相片拍摄的时间、 地点、 人物、 事件来作为标签,多个标签使用半角空格分开，以便于其它人索引" 
                        src="Images/wenhao.gif" align=absMiddle>（不填则使用相册标签）</FONT></td>
												  </tr>
													<tr id="showautos" runat="server">
													  <td>压缩选项：</td>
													  <td><INPUT name=autos type=checkbox id=autos 
                  runat="server">
                  <label for=autos>自动缩小过大的照片到标准大小（可留出更多的空间容量及使照片大图浏览速度更快）</label></td>
												  </tr>
													<tr id="show4">
														<td height="27">上传照片：</td>
														<td>
															<div id="flash"><font color="#ff0000">正在载入上传控件，请稍候……</font></div>														</td>
													</tr>
													<tr id="show5">
														<td>&nbsp;</td>
														<td><input id="hidalias" type="hidden" size="1" name="hidalias" runat="server"><INPUT id="Hidpath" type="hidden" size="1" name="Hidpath" runat="server">
													  <font color="gray">系统支持的照片格式有 GIF JPEG&nbsp;JPG BMP PNG，可同时</font><span class="STYLE1">选择多张照片</span><font color="gray">一次上传</font> <iframe id=pro name=pro src="about:blank" frameBorder=0 width=0 scrolling=no height=0></iframe></td>
													</tr>
													<tr id="show6" style="DISPLAY: none">
														<td>外部下载：</td>
														<td><textarea name="textBoxFileURL" cols="50" rows="10" id="textBoxFileURL"></textarea>
															<br>
															<INPUT class="btn" id="progressStartButton" type="button" value=" 下 载 " name="progressStartButton"
																onClick="StartEverything(this);"> &nbsp;<INPUT class="btn" id="btn_return2" type="button" value=" 返 回 " name="btn_return1" onClick="javascript:history.go(-1);">
															<p>
															<p>
															<p>
															<p><asp:literal id="progressVariables" runat="server"></asp:literal></p>
															<div id="progressNotices" style="FONT-WEIGHT: bold; FONT-SIZE: 12px; FONT-FAMILY: Verdana; HEIGHT: 14px"></div>
															<div id="progressBarArea" style="DISPLAY: none">
																<div style="BORDER-RIGHT: gray 1px inset; PADDING-RIGHT: 1px; BORDER-TOP: gray 1px inset; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; MARGIN: 14px; BORDER-LEFT: gray 1px inset; PADDING-TOP: 1px; BORDER-BOTTOM: gray 1px inset"><FONT face="宋体"></FONT>
																	<div id="progressBar" style="WIDTH: 0%; COLOR: navy; HEIGHT: 22px; BACKGROUND-COLOR: navy"></div>
																</div>
																<asp:literal id="progressAlert" runat="server"></asp:literal>
															</div>
															<iframe id="progressIFrame" name="progressIFrame" src="about:blank" frameborder="0" width="0"
																style="POSITION:absolute" scrolling="no" height="0"></iframe>
															<DIV></DIV>
															<DIV></DIV>														</td>
													</tr>
													<tr id="show7" style="DISPLAY: none">
														<td>&nbsp;</td>
														<td><font color="gray">请填写外部图片地址，每行一个，回车输下个，例：http://www.xxx.com/xxx.jpg</font></td>
													</tr>
												</table>
										  </form>
										</td>
									</tr>
									<tr>
										<td class="main_title_1" height="32">&nbsp;</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<script language="javascript">
	function getUrlParam(paramName){	
		var s=location.search;
		if(s!=null&&s.length>1){
		var sarr=s.substr(1).split("&");
		var tarr;
		for(i=0;i<sarr.length;i++){
		tarr=sarr[i].split("=");
		if(tarr.length==2&&tarr[0].toLowerCase()==paramName){
		return tarr[1];
		}
		}
		return null;
		}
	}
	function StartEverything(callingButton){
		if (document.getElementById('progressStartButton').value ==' 停 止 ')
		{
			document.getElementById('progressStartButton').value =' 下 载 ';
			document.getElementById('progressNotices').innerHTML='';
			document.getElementById('progressBarArea').style.display = 'none';
			window.frames['progressIFrame'].location.href = 'about:blank';
		}
		else
		{
			document.getElementById('progressNotices').innerHTML='正在处理，请稍候……';
			window.frames['progressIFrame'].location.href = UniqueUrl(AppendArgument("downworker.aspx"));
		}
	}
	var objMessage = null;
	var objBar = null;
	var maxReached = false;
	function SetProgress(percentage, message){
		if(percentage <= 100){
			if(objMessage == null){
				objMessage = document.getElementById('progressNotices');
			}
			if(objBar == null){
				objBar = document.getElementById('progressBar');
			}
			if(message != null && message != ''){
				objMessage.innerHTML = message;
			}
			if(percentage > 0){
				objBar.innerHTML = '.';
			}else{
				objBar.innerHTML = '';
			}
			objBar.style.width = percentage.toString() + '%';
			if(percentage == 100){
				SetDisplay(false);
			}
		}else{
			maxReached = true;
		}
	}
	function SetDisplay(progressIsRunning){
		var progressBarArea = document.getElementById('progressBarArea');
		progressBarArea.style.display = (progressIsRunning ? 'block' : 'none');
		document.getElementById('progressStartButton').value = (progressIsRunning ? ' 停 止 ' : ' 下 载 ');
	}
	function Say(message){
		if(message == null || message == ''){
			message = '(null)';
		}
		alert(message);
	}
	function AppendArgument(url){
		if(url.indexOf('?') > 0){
			url += '&';
		}else{
			url += '?';
		}
		url += "file";
		
		var argValue=document.all.textBoxFileURL.value;
		var reg=new RegExp("\r\n","gi");
		argValue=argValue.replace(reg,",");		
		if(argValue != null && argValue != ''){
			if(url.indexOf('=') != (url.length - 1)){
				url += '=';
			}
			url += escape(argValue);
		}
		else
		{
			alert('请输入下载文件的外部地址！');
			return;
		}
		url +='&dirid='+getUrlParam('dirid');
		
		var lwater,lpostion;
		if (document.all.iwater0.checked) lwater="0";
		else if (document.all.iwater1.checked) lwater="1";
		else if (document.all.iwater2.checked) lwater="2";
		
		if (document.all.postion1.checked) lpostion="1";
		else if (document.all.postion2.checked) lpostion="2";
		else if (document.all.postion3.checked) lpostion="3";
		else if (document.all.postion4.checked) lpostion="4";
		else if (document.all.postion5.checked) lpostion="5";
		url +='&rdMarkText='+lwater+'&txtMarkText='+escape(document.all.txtMarkText.value)+'&txtMarkPic='+document.all.txtMarkPic.value+'&postion='+lpostion+'&selsize='+document.all.selsize.value+'&selbold='+document.all.selbold.checked+'&selfont='+escape(document.all.selfont.value)+'&color1='+escape(document.all.color1.value)+'&color2='+escape(document.all.color2.value)+'&tag='+escape(document.all.tag.value)+'&autos='+document.all.autos.checked;
		SetDisplay(true);
		return url;
	}
	function UniqueUrl(url){
		var randomNum, uniqifier;
		if(url == null || url == ''){
			url = 'UrlUndefined';
		}else if(url.indexOf('Unique') > 0){
			randomNum = Math.random();
			url = ReplaceArgumentValue(url, 'Unique', randomNum.toString().substr(2));
		}else{
			randomNum = Math.random();
			uniqifier = 'Unique=' + randomNum.toString().substr(2);
			if(url.indexOf('?') > 0){
				url += '&' + uniqifier;
			}else{
				url += '?' + uniqifier;
			}
		}
		return url;
	}
	function ReplaceArgumentValue(searchArgs, argName, newArgValue){
		var newSearchArgs;
		argName += '=';
		var indexStart = searchArgs.indexOf(argName);
		if(indexStart >= 0){
			var indexEnd = searchArgs.indexOf('&', indexStart);
			newSearchArgs = searchArgs.substr(0, indexStart + argName.length);
			newSearchArgs += newArgValue;
			if(indexEnd > indexStart){
				newSearchArgs += searchArgs.substr(indexEnd);
			}
			return newSearchArgs;
		}else{
			return searchArgs;
		}
	}
		</script>
	</body>
</HTML>
