<%@ page contentType="text/html; charset=GBK" session="false"%>
<%@ taglib uri="/cmsTag" prefix="cms"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>上传视频</title>

		<!--加载 js -->

		<link href="../style/blue/css/main.css" type="text/css" rel="stylesheet" />
		<link href="../style/blue/css/reset-min.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../common/js/jquery-1.7.gzjs"></script>
		<script language="javascript" type="text/javascript" src="../javascript/commonUtil_src.js"></script>
		<script type="text/javascript" src="../javascript/dialog/lhgdialog.min.js?skin=iblue"></script>
		<script language="javascript" type="text/javascript" src="../extools/player/jwplayer/jwplayer.js"></script>
		


	</head>

	<body>

		<form method="post" name='uploadForm' id='uploadForm' enctype="multipart/form-data">

			<table border="0" cellspacing="2" cellpadding="0">
				<tr>
					<td width="120">
						<table>
							<tr>
								<td>
									<object id="showVideo" color="black" type="application/x-shockwave-flash" width="460" height="290" wmode="transparent" data="<cms:Domain/>/core/extools/player/jwplayer/5.9/player.swf?file=${param.videoFullURL}&screencolor=black&autoStart=${param.autoStart}&image=${param.snapshotImg}">
										<param name="movie" value="<cms:Domain/>/core/extools/player/jwplayer/5.9/player.swf?file=${param.videoFullURL}&screencolor=black&autoStart=${param.autoStart}&image=${param.snapshotImg}" />
										<param name="wmode" value="transparent" />
										<param name="quality" value="high" />
										<param name="allowfullscreen" value="true" />
										<param name="displayheight" value="0" />
									</object>
								</td>
							</tr>
						</table>
					</td>
					<td>

						<input name="videoFile" type="hidden" id='videoFile' value="${param.videoFile}">

						<input name="videoTmpFile" type="hidden" id='videoTmpFile' value="${param.videoFile}">
						
						<input name="relateUrl" type="hidden" id='relateUrl' value="${param.relateUrl}">
						
						<input name="oldRelateUrl" type="hidden" id='oldRelateUrl' value="${param.oldRelateUrl}">
						
						<input name="oldImageUrl" type="hidden" id='oldImageUrl' value="${param.oldImageUrl}">
						
						<input name="videoName" type="hidden" id='videoName' value="<cms:UrlParam target='${param.videoName}'/>">
					
					</td>
				</tr>
				<tr>
					<td>

					</td>
				</tr>
			</table>
			<input name="video" type="file" id='video' size="40" class="form-input-file">
			<a href="javascript:sumbitTempVideo(document.getElementById('video'));" class="btnwithico-single"> <img src="../../core/style/default/images/doc_add.png" alt="" /><b>上传视频&nbsp;</b> </a>
			<a href="javascript:snapshotImage();" class="btnwithico-single"> <img src="../../core/style/default/images/doc_add.png" alt="" /><b>视频截图&nbsp;</b> </a>
			

		</form>
	</body>
</html>
<script language="JavaScript" type="text/javascript">

window.parent.document.getElementById("showTime").value = '${param.showTime}';

//document.all.classImg.style.display='none';
//document.all.contentImg.style.display='none';
//document.all.headImg.style.display='none';

//alert(document.all.headImgFile.value);
//兼顾ff和IE，
//document.all.preImg1.src = (document.all.classImgURLsite.value=='') ? "images/addpicture.jpg" : document.all.classImgURLsite.value;
function sumbitTempVideo(file)
{
	if(!file.value.match(/.flv|.f4v|.swf|.avi|.mpg|.mpeg|.mp3|.wav|.mp4/i))
	{
		alert('文件类型必须是: flv swf avi mpg mpeg mp3 wav mp4 !');
		return;
	}

	var emptyFlag =true;


	if(document.all.video.value!='' )
	{
		emptyFlag=false;
	}



	if(emptyFlag)
	{
		alert('请选择视频！');
		return;
	}
	
 
	 //alert(document.all.classImg.value);
	document.all.uploadForm.action="../../content/uploadVideo.cmd";
	 //alert('ddddd');
	uploadForm.submit();

}

function snapshotImage()
{
	var pos =jwplayer().getPosition();
	
	
	if(pos <=0)
	{
		alert('视频截取时间超出范围!');
		return;
	}

    $.dialog.tips('正在处理视频...',60);
	    var postData = '?pos='+pos+'&classId='+window.parent.document.getElementById("classId").value+'&relateUrl='+document.getElementById('relateUrl').value+'&width='+window.parent.document.getElementById("width").value+'&height='+window.parent.document.getElementById("height").value+'&oldImageUrl='+document.getElementById("oldImageUrl").value+"&random="+Math.random();
 	   	var url = "../../content/snapshotImage.cmd"+postData;
 	
 		$.ajax
 		({
			type : 'POST',
			url  : encodeURI(url),
			success:
			function(data, textStatus)
			{
				if('no file' != data)
				{
				    var jsonObj = eval("("+data+")");
				
					window.parent.document.getElementById("snapshotImg").value = jsonObj.obj_0.relatePath;
			
					replaceUrlParam(window.location,'autoStart=false&snapshotImg='+jsonObj.obj_0.resizeImageUrl+'&oldImageUrl='+jsonObj.obj_0.relatePath);
					//alert(window.location.href);
				}
				else
				{
					alert('截取视频图片失败!');
				}
  			}
  		});
}

if("true" == "${param.editMode}")
{
//alert(document.getElementById("showVideo").data);
 // document.getElementById("preImg1").src="<cms:Domain/>/${param.imgFileName}";

}

</script>
