<!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');
}
)
function showType(v){
	$('#upload').hide();
	$('#js').hide();
	$('#link').show();
	switch(v){
		case 'picture':
		case 'swf':
			$('#upload').show();
		break;
		case 'code':
		case 'html':
			$('#js').show();
			$('#link').hide();
		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 ($('#type').val() == 'picture' || $('#type').val() =='swf'){
		if (document.form1.height.value == ''){
			alert('请填写图片或者FLASH的高度');
			document.form1.height.focus();
			return false;
		}
		if (document.form1.width.value == ''){
			alert('请填写图片或者FLASH的宽度');
			document.form1.width.focus();
			return false;
		}
		if (document.form1.file.value == ''){
			alert('请上传广告文件');
			document.form1.file.focus();
			return false;
		}
	}
	if (document.form1.tag.value == ''){
		alert('请填写调用标记!限20个字符内!');
		document.form1.tag.focus();
		return false;
	}
	if (document.form1.title.value == ''){
		alert('请填广告说明!限100个字符内!');
		document.form1.title.focus();
		return false;
	}
	return true;
}
function getTag(v){
	if (v){
		var clipBoardContent=''; 
		clipBoardContent = '<!--{func：adrs=bill tag='+v+'}-->'; 
		if (document.all){
			window.clipboardData.setData("Text",clipBoardContent.replace('：', ':'));
			alert('代码已经复制到粘贴板!');
		}else{
			alert('您正在使用的不是IE浏览器,无法使用复制代码功能')
		}
		
	}else{
		alert('广告记录有错误!未设置调用标记!请重新编辑修改')
	}
}
</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;?>bill/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="text">文字广告</option>
	          <option value="code">JS代码广告</option>
	          <option value="html">html代码</option>
	          </select>
	      *必选
	        </td>
	  </tr>
	  <tr class="row">
	    <td class="align-right">广告位置：</td>
	    <td><select name="position" id="position" onchange="showTag(this.value)">
		 <option value="">请选择广告位置</option>
		<?php foreach($this->position as $key=>$position){?>
	      <option value="<?php echo $key;?>"><?php echo $position;?></option>
		  <?php }?>
		  <option value="tag">自定义</option>
	      </select>	    </td>
	    </tr>
	  <tr class="row">
	    <td class="align-right">调用标签：</td>
	    <td><input name="tag" type="text" id="tag" maxlength="20" />
	      *20字符</td>
	  </tr>
	  <tr class="row None" id="js">
	    <td class="align-right">代码内容：</td>
	    <td><textarea name="code" cols="50" rows="4" id="code"></textarea></td>
	    </tr>
	  <tr class="row" id="upload">
	    <td class="align-right">图片/SWF：</td>
	    <td><input type="file" name="file" />
	    *只允许上传图片文件以及FLASH文件</td>
	    </tr>
	  <tr class="row">
	    <td class="align-right">尺寸：</td>
	    <td>宽：
	      <input name="width" type="text" id="width" size="5" maxlength="5" />
	      高：
	      <input name="height" type="text" id="height" size="5" maxlength="5" /> 
	      *选择图片或者FLASH时请填写宽与高 </td>
	    </tr>
	  <tr class="row">
	    <td class="align-right">广告说明：</td>
	    <td><input name="title" type="text" id="title" size="50" />
	      *</td>
	  </tr>
	  <tr class="row" id="link">
	    <td class="align-right">连接地址：</td>
	    <td><input name="url" type="text" id="url" value="http://" 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="8%" class="align-center">编号</td>
	    <td width="19%" class="align-center">广告说明</td>
	    <td width="10%" class="align-center">广告位置</td>
	    <td width="9%" class="align-center">类型</td>
	    <td width="20%" class="align-center">广告文件</td>
	    <td width="11%" class="align-center">录入人员</td>
	    <td width="6%" class="align-center">状态</td>
	    <td width="17%" 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="" title="点击查看"><?php echo $row['title'];?></a></td>
	    <td><?php echo $this->position[$row['position']];?></td>
	    <td><?php echo $this->type[$row['type']];?></td>
	    <td><a href="<?php echo $row['url'];?>" target="_blank"><?php if(strrchr($row['filename'],'.') != '.swf' && $row['filename']){ echo '<img src="'.$this->basedir.$row['filename'].'" width="100">';}else{echo $row['filename'];};?></a></td>
	    <td><?php echo $row['admin'];?></td>
	    <td><a href="<?php echo $this->installdir;?>bill/locked/id/<?php echo $row['id'];?>/"><?php echo $row['locked'] ? '禁用中' : '启用中';?></a></td>
	    <td><a href="<?php echo $this->installdir;?>bill/modify/id/<?php echo $row['id'];?>/">编辑</a> <a href="<?php echo $this->installdir;?>bill/delete/id/<?php echo $row['id'];?>/" onclick="return confirm('确认删除吗?')">删除</a>&nbsp;<a href="javascript:getTag('<?php echo $row['tag'];?>')">获取调用</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>