<!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>
<title>vodcms.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="../../images/admin/public.css" rel="stylesheet" type="text/css" />
<link href="../../images/admin/style.css" rel="stylesheet" type="text/css" />
<script src="<?php echo $this->basedir;?>js/jquery.js" language="javascript"></script>
<script language="javascript">
$(document).ready(function() {
	//setime(10);
	//$('#float').floatdiv('middle');
	$('#upload').hide();
	$('#js').hide();
	$('#link').hide();
	$('#shipin').hide();
	$('#time').hide();
	$('#code').hide();

}
)
function showType(v){
	$('#upload').hide();
	$('#js').hide();
	$('#link').hide();
	$('#shipin').hide();
	$('#time').hide();
	$('#code').hide();
	switch(v){
		case 'picture':
		case 'swf':
			$('#upload').show();
		break;
		case 'video':
		case 'flv':
			$('#shipin').show();
		break;
		case 'code':
		$('#code').show();
		break;
	}
}
function showTag(v){
	if (v == 'tag'){
		$('#tag').val('');
		$('#tag').attr('readonly', '');
	}else{
		$('#tag').val(v);
		$('#tag').attr('readonly', 'ture');
	}
}
function check(){
	if (document.form1.type.value == 0){
		alert('请选择广告类型');
		document.form1.type.focus();
		return false;
	}
	if (document.form1.position.value == ''){
		alert('请选择广告位置');
		document.form1.position.focus();
		return false;
	}
	if (document.form1.title.value == ''){
		alert('请选择广告名称');
		document.form1.title.focus();
		return false;
	}
	if (document.form1.type.value == 'code'){
		if (document.form1.code.value == ''){
			alert('请选择广告代码');
			document.form1.code.focus();
			return false;
		}
	}
	if (document.form1.position.value == 3){
		if (document.form1.start.value == ''){
			alert('请填写广告开始时间:单位秒');
			document.form1.start.focus();
			return false;
		}
		if (document.form1.end.value == ''){
			alert('请填写广告播放的时间:单位秒');
			document.form1.end.focus();
			return false;
		}
	}
	if ($('#type').val() == 'picture' || $('#type').val() =='swf'){
		if (document.form1.filename.value == ''){
			alert('请上传广告文件');
			document.form1.filename.focus();
			return false;
		}
	}
	if ($('#type').val() == 'video' || $('#type').val() =='flv'){
		if (document.form1.video.value == '' || document.form1.video.value == 'http://'){
			alert('请填写视频文件地址');
			document.form1.video.focus();
			return false;
		}
	}
	if (document.form1.title.value == ''){
		alert('请填广告说明!限100个字符内!');
		document.form1.title.focus();
		return false;
	}
	return true;
}
function showtime(v){
	if (v == 3){
		$('#time').show();
	}
}
</script>
<body>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
  <tr align="center" valign="top">
    <td width="*" align="center" valign="top">
	<!-- ######### begin ######### -->
      <div class="Block">
      <div class="BlockBar">发布视频插播广告</div>
	  <form action="<?php echo $this->installdir;?>smil/add/" method="post" enctype="multipart/form-data" name="form1" id="form1" onsubmit="return check();">
      <table width="100%" border="0" cellpadding="1" cellspacing="1" class="tab">
	  <tr class="row">
	    <td width="12%" class="align-right">广告类型：</td>
	    <td width="88%">
		<select name="type" id="type" onchange="showType(this.value)">
	          <option value="0">请选择广告类型</option>
	          <option value="picture">图片广告</option>
	          <option value="swf">FLASH广告</option>
	          <option value="video">视频广告</option>
	          <option value="flv">FLV广告</option>
	          <option value="code">JS或者HTML</option>
	          </select>
	      *必选	        </td>
	  </tr>
	  <tr class="row">
	    <td class="align-right">广告名称：</td>
	    <td><input name="title" type="text" id="title" size="30" />
	      *请填写广告的描述（50个字符）</td>
	    </tr>
	  <tr class="row" id="code">
	    <td class="align-right">JS&amp;HTML：</td>
	    <td><textarea name="code" cols="50" rows="4" id="code"></textarea></td>
	    </tr>
	  <tr class="row">
	    <td class="align-right">广告位置：</td>
	    <td><select name="position" id="position" onchange="showtime(this.value)">
	      <option value="0">片头广告</option>
	      <option value="1">片尾广告</option>
	      <option value="2">缓冲广告</option>
	      <option value="3">自定义时间</option>
	      </select>	    </td>
	    </tr>
	  <tr class="row">
	    <td class="align-right">广告时长：</td>
	    <td><input name="end" type="text" id="end" value="10" size="7" />
	      *广告播放的时间</td>
	    </tr>
	  <tr class="row" id="time">
	    <td class="align-right">广开始时间：</td>
	    <td><input name="start" type="text" id="start" size="7" /></td>
	    </tr>
	  <tr class="row" id="shipin">
	    <td class="align-right">视频文件地址：</td>
	    <td><input name="video" type="text" id="video" value="http://" size="50" />	      
	      *目前只支持flv rmvb wmv rm 格式</td>
	    </tr>
	  <tr class="row" id="upload">
	    <td class="align-right">图片/SWF：</td>
	    <td><input name="filename" type="file" id="filename" />
	    *只允许上传图片文件以及FLASH文件</td>
	    </tr>
	  <tr class="row" id="link">
	    <td class="align-right">连接：</td>
	    <td><input name="url" type="text" id="url" size="50" />
	      图片或者字幕滚动时候的连接地址</td>
	    </tr>
	  <tr class="row">
	    <td class="align-right">&nbsp;</td>
	    <td>
	      <input type="submit" class="btn" value=" 添 加 " /></td>
	    </tr>
      </table>
	  </form>
      <div class="BlockBar">广告列表</div>
      <table border="0" cellpadding="1" cellspacing="1" class="tab">
	  <tr class="sub">
	    <td width="10%" class="align-center">编号</td>
	    <td width="20%" class="align-center">广告说明</td>
	    <td width="10%" class="align-center">广告位置</td>
	    <td width="9%" class="align-center">类型</td>
	    <td width="34%" class="align-center">广告文件</td>
	    <td width="7%" class="align-center">状态</td>
	    <td width="10%" class="align-center">管理</td>
	  </tr>
	  <?php
	  if (count($this->rows) > 0){
	  foreach($this->rows as $row){?>
	  <tr class="row align-center">
	    <td ><?php echo $row['id'];?></td>
	    <td><a href="<?php echo $this->installdir;?>smil/modify/id/<?php echo $row['id'];?>/" title="点击编辑"><?php echo $row['title'];?></a></td>
	    <td><?php echo $this->position[$row['position']];?></td>
	    <td><?php echo $this->type[$row['type']];?></td>
	    <td><?php if ($row['filename']){echo $row['filename'];}elseif($row['video']){echo $row['video'];}?></td>
	    <td><a href="<?php echo $this->installdir;?>smil/locked/id/<?php echo $row['id'];?>/"><?php echo $row['locked'] ? '禁用中' : '启用中';?></a></td>
	    <td><a href="<?php echo $this->installdir;?>smil/modify/id/<?php echo $row['id'];?>/">编辑</a> <a href="<?php echo $this->installdir;?>smil/delete/id/<?php echo $row['id'];?>/" onclick="return confirm('确认删除吗?')">删除</a></td>
	  </tr>
	  <?php } }else{?>
	  <tr><td colspan="8">暂无数据</td></tr>
	  <?php }?>
      </table>

	  <table width="100%" border="0">
        <tr>
          <td><?php echo $this->printpage;?></td>
        </tr>
      </table>
      </div>
    </td>
  </tr>
</table>

<?php
echo $this->render('copyright');
?>
</body>
</html>