<%@ page language="C#" autoeventwireup="true" inherits="admin_common_swfupload_uploadsoft, DianCMS" enableviewstatemac="false" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>SWFUpload Demos - Overlay Demo</title>
	<link href="css/default.css" rel="stylesheet" type="text/css" />
	<style type="text/css">
		.swfupload { position: absolute; z-index: 1; }
	</style>
	<link id="CssName" rel="stylesheet" type="text/css" runat="server" />
	<script src="../../../js/Common.js" type="text/javascript"></script>
	<script type="text/javascript" src="swfupload/swfupload.js"></script>
	<script type="text/javascript" src="js/swfupload.swfobject.js"></script>
	<script type="text/javascript" src="js/swfupload.queue.js"></script>
	<script type="text/javascript" src="js/fileprogress.js"></script>
	<script type="text/javascript" src="js/handlers2.js"></script>
	<script type="text/javascript">
		var api = frameElement.api, W = api.opener;
	</script>
	<script type="text/javascript">
		var swfu;

		SWFUpload.onload = function () {
			var settings = {
				flash_url: "swfupload/swfupload.swf",
				upload_url: "upload.ashx",
				post_params: {
					"ASPSESSID": "<%=Session.SessionID %>",
					"AdminCookies": "" + getCookie("DianCMSAdmin") + "",
					"FilePicPath": "" + DianCMS_$("FilePicPath").value + ""
				},
				file_size_limit: "10000 MB",
				file_types: "*.*",
				file_types_description: "所有文件",
				file_upload_limit: 1,
				file_queue_limit: 1,
				custom_settings: {
					progressTarget: "fsUploadProgress",
					cancelButtonId: "btnCancel"
				},
				debug: false,

				// Button Settings
				button_placeholder_id: "spanButtonPlaceholder",
				button_width: 120,
				button_height: 30,
				button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
				button_cursor: SWFUpload.CURSOR.HAND,

				// The event handler functions are defined in handlers.js
				swfupload_loaded_handler: swfUploadLoaded,
				file_queued_handler: fileQueued,
				file_queue_error_handler: fileQueueError,
				file_dialog_complete_handler: fileDialogComplete,
				upload_start_handler: uploadStart,
				upload_progress_handler: uploadProgress,
				upload_error_handler: uploadError,
				upload_success_handler: uploadSuccess,
				upload_complete_handler: uploadComplete,
				//queue_complete_handler: queueComplete, // Queue plugin event

				// SWFObject settings
				minimum_flash_version: "9.0.28",
				swfupload_pre_load_handler: swfUploadPreLoad,
				swfupload_load_failed_handler: swfUploadLoadFailed
			};

			swfu = new SWFUpload(settings);
		}
		function getCookie(name) {
			var arg = name + "=";
			var alen = arg.length;
			var clen = document.cookie.length;
			var i = 0;
			while (i < clen) {
				var j = i + alen;
				if (document.cookie.substring(i, j) == arg) return getCookieVal(j);
				i = document.cookie.indexOf(" ", i) + 1;
				if (i == 0) break;
			}
			return null;
		}

		function getCookieVal(offset) {
			var endstr = document.cookie.indexOf(";", offset);
			if (endstr == -1) endstr = document.cookie.length;
			return document.cookie.substring(offset, endstr);
		}
	</script>
</head>
<body>
	<form id="form1" method="post" enctype="multipart/form-data" runat="server">
		<table width="100%">
			<tr>
				<td>
					<div id="divSWFUploadUI">
						<p>
							<span id="spanButtonPlaceholder"></span>
							<input id="btnUpload" type="button" class="btn" value="选择上传文件" style="width: 120px;" />
							<b id="divStatus" style="color: red;"></b>
							<input id="btnCancel" type="button" value="Cancel All Uploads" disabled="disabled" style="margin-left: 2px; height: 22px; font-size: 8pt; display: none" />
						</p>
						<br style="clear: both;" />
						<div id="fsUploadProgress">
						</div>
					</div>
				</td>
			</tr>
			<tr>
				<td style="text-align:center;">
					<asp:TextBox ID="FilePicPath" runat="server" style="display:none"></asp:TextBox>
					<asp:Button ID="Button1" runat="server" Text=" 确认 " CssClass="btn" OnClick="Button1_Click" style="width:120px;"/></td>
			</tr>
		</table>

	</form>
	<script>
		DianCMS_$('FilePicPath').value = W.document.getElementById('FilePicPath').value;
    </script>
</body>
</html>
