<?php 
	require_once('_approot.php');
	$ls_msg="修改视频操作";

	$id=$_GET['id'];
	
	$video_sql="select * from ls_video where ID=".$id." ";
	$video_query=$opendb->query($video_sql);
	$video_rows=mysqli_fetch_assoc($video_query);
 	if($video_rows['videoPic'] == ""){
		$videoPicPath = "images/picture.gif";
 	}else{
		$videoPicPath = "../".$videoFolders."/".$video_rows['videoPic'];
	}
 	$title_sql = "select * from ls_config";
	$title_query = $opendb->query($title_sql);
	$title_value = mysqli_fetch_assoc($title_query);
	
	$pos = strpos($title_value['companyName'], '-', 1);
	$subCompanyName = substr($title_value['companyName'], (mb_strlen($title_value['companyName'],'utf-8') - $pos) * -1 );

	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<link href="css/admin.css" rel="stylesheet" type="text/css">
        <script language="JavaScript" src="js/jquery.js"></script>
		<script language="JavaScript" src="js/ls.js"></script>
		<title>无标题文档</title>
         <link rel="stylesheet" href="css/style2.css" />
	<script type="text/javascript">  
    function preview(file)
    {
        var prevDiv = document.getElementById('preview');
        if (file.files && file.files[0])
        {
        var reader = new FileReader();
        reader.onload = function(evt){
        prevDiv.innerHTML = '<img src="' + evt.target.result + '" height="100px"  border="1" name="pic" />';
        }  
        reader.readAsDataURL(file.files[0]);
        }
        else  
        {
            prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
        }
    }
    </script>		
	</head>
	<body>
		<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
		
            <tr>
                				<td height="18" style="border-bottom: 2px solid #00c0ef; padding-bottom:5px;"><div align="center"><font color="#3c8dbc" style="font-size:16px;">修改视频</font></div>
				</td>
			</tr>
			<tr>
				<td height="213" valign="top"><br>
				 <form name="myform" enctype="multipart/form-data" method="post" action="savevideo.php" onSubmit="return CheckaddVideo()">
					<input type="hidden" value="update" name="ls">
					<input type="hidden" value="<?= $id?>" name="id">
					<input type="hidden" value="<?= $video_rows['videoFile']?>" name="Pic">
					<input type="hidden" name="ChangecatePagePic" value="no">
					<table border="0" width="98%" align="center">
						<tr>
							<td>提示：<font color="#FF0000"><?= $ls_msg; ?></font></td>
							<td align="right"><img src="images/shao.gif">&nbsp;<a href="video.php">返回</a></td>
						</tr>
					</table>
					<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#f0f0ee">
					  <tr bgcolor="#f0f0ee">
					    <td height="28" colspan="4"></td>
				      </tr>
					  <tr>
					    <td height="52" style="padding-left:20px;">类别</td>
					    <td><input type="text" name="cateName" id="cateName" style="width:50%;"  value="<?= $video_rows['cateName']?>" />
					      <select name="selecttype<?=$acc_rows['ID']?>2" id="selecttype<?=$acc_rows['ID']?>"  onchange="this.form.cateName.value=this.options[this.selectedIndex].text">
					        <option value="0">选择类别：</option>
						   <?php
                           $videoa=explode(",",$defaultvideo);
                           foreach($videoa as $av){
                               echo "<option value=''>".$av."</option>";
                           }
                            $select_sql="select distinct cateName from ls_video where cateName!='live' and cateName!='video' and cateName!='broadcast'   order by cateName asc ";
			$select_query=$opendb->query($select_sql);
			while($select_rows2=mysql_fetch_assoc($select_query))
		  	{
            	echo "<option value=".$select_rows2['ID'].">".$select_rows2['cateName']."</option>";
            } ?>
				          </select></td>
					    <td width="11%" height="28">开始时间</td>
					    <td width="38%" height="28"><input type="text" name="date" id="date" style="width:40%;"   value="<?=$video_rows['date']?>"/>
					      结束：
					      <input type="text" name="endtime" id="endtime" style="width:32%;"   value="<?=$video_rows['endtime']?>"/></td>
				      </tr>
                      <tr bgcolor="#f0f0ee" height="37"> 
						<td style="padding-left:20px;" width="11%">名称 *</td>
						<td width="40%"><input type="text" name="videoName" id="videoName" style="width:90%;" value="<?= $video_rows['videoName']?>" ></td>
                        <td colspan="2" rowspan="2"><table border="0" width="98%">
						  <tr height="37">
						    <td width="27%" bgcolor="#f0f0ee" >标题 Title *</td>
						    <td width="73%"><input name="newsTitle" id="newsTitle" type="text" value="<?= $video_rows['newsTitle']?>" style="width:90%;"  /></td>
					      </tr>
						    <tr height="37">
						    <td bgcolor="#f0f0ee" >关键字 Keywords</td>
						    <td><input name="newsKeywords" id="newsKeywords" type="text" value="<?= $video_rows['newsKeywords']?>" style="width:90%;" /></td>
					      </tr>
						    <tr height="37">
						    <td bgcolor="#f0f0ee"  >描述 Description *</td>
						 <td><textarea name="newsDescription" style="width:90%;"  rows="3" id="newsDescription"><?= $video_rows['newsDescription']?></textarea>
						   <?=$promlv>1?$seo:""?></td>
					      </tr>
					    </table></td>
                      </tr>
                      <tr bgcolor="#f0f0ee"> 
						<td style="padding-left:20px;" width="11%">简介</td>
						<td><textarea name="videoText" id='videoText' style="width:90%; height:80px;" ><?= $video_rows['videoText']?></textarea></td>
                      </tr>
					  <!--<tr bgcolor="#f4f4f4"> 
						<td style="padding-left:50px;" >*缩略图：</td>
						<td style="padding-left:5px;" >
							<img src="<?= "../".$videoFolders."/".$SmallFoldersProducts."/".$video_rows['videoPic']?>" width="<?= $SmallPicW ?>" height="<?= $SmallPicH?>" border="1" name="pic" ><br />
                            <input type="file" name="productPic" style="width:300px;" onBlur="document.pic.src=myform.productPic.value"; onChange="myform.ChangecatePagePic.value='yes';">
						</td>
					  </tr>-->
					</table>
                    <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1"  bgcolor="#f0f0ee" >
                      <tr > 
						<td style="padding-left:20px;" width="11%">视频链接 *</td>
						<td><textarea name="videoCode" style="width:95%;height:50px;" ><?= $video_rows['code']?></textarea></td>
					  </tr>
                      <tr >
                        <td height="180" style="padding-left:20px;" >封面图片</td>
                        <td> <div id="preview"><img src="<?php echo $videoPicPath ?>" name="pic" width="" height="100" border="1" id="pic" /><?=$video_rows['videoPic']?></div>
                        <input type="file" name="videoPic" style="width:26%;" onchange="myform.ChangevideoPic.value='yes';document.pic.src=myform.videoPic.value;preview(this);"/>
                        <input type="hidden" name="ChangevideoPic" value="no" />
                        <input type="hidden" name="OldPic" value="<?=$video_rows['videoPic']?>" />                        <?=$nmpic_tips?></td>  
                      </tr>
                      <tr > 
						<td style="padding-left:20px;" >视频文件 *</td>
						<td><?=$video_rows['videoFile']?>
						  <input type="file" name="videoFile" style="width:16%;" onChange="myform.Changevideo.value='yes';">
						  <input type="hidden" name="Changevideo" value="no" />
						  <input type="hidden" name="OldVideo" value="<?=$video_rows['videoFile']?>" />
						  <span style="padding-left:10px;">
						  <?=$video_tips?>
						  </span></td>
					  </tr>
                      <tr height="37"> 
						<td style="padding-left:50px;" >&nbsp;</td>
						<td>宽度：<input type="text" name="videoW" style="width:20%;" value="<?= $video_rows['videoW']?>" > &nbsp; &nbsp; 高度：<input type="text" name="videoH" style="width:20%;" value="<?= $video_rows['videoH']?>" ></td>
					  </tr>
					  <tr height="47">
						<td height="47" colspan="2" align="center"><button type="submit" value="保存">保存</button>
							&nbsp;<button type="button" value="刷新本页" onClick="JavaScript:history.go(0);">刷新本页</button>
                            &nbsp;<button type="button" name="button" id="button" value="SEO"  onclick="
                            if(confirm('您确定要修改SEO设置吗？')){
                            $('#newsTitle').val($('#videoName').val()+'<?php if(strpos($title_value['companyName'],"-")){echo " ".$subCompanyName;}else{echo " - ".$title_value['companyName'];}?>');
						$('#newsKeywords').val('<?=$title_value['siteKeywords']?>');
						$('#newsDescription').val($('#videoText').val().substr(0, 267).replace(/<[^>]+>/g,'').replace(/	/g, '').replace(/\n/g, ''));
	}else{
		return false;
	}"/>SEO</button></td>
					  </tr>
					  <tr height="47">
					    <td height="62" colspan="2" align="left"  style="padding-left:20px;">1、 视频链接优先显示，如为空则显示视频文件 <br />
2、
			            视频格式建议MP4 </td>
				      </tr>
					</table>
				</form>
				</td>
			</tr>
		</table>
	</body>
</html>