<!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=<!--{$page_charset}-->" />

<title>问卷专题</title>
<!--{include file="<!--{$cptplpath}-->headerjs.tpl"}-->
<!--{assign var='pluginevent' value=XHook::doAction('adm_head')}-->
</head>
<body>
<!--{include file="<!--{$cptplpath}-->lang_all.tpl"}-->
<!--{if $a eq "run"}-->
<div class="main-wrap">
  <div class="path"><p>当前位置：模块管理<span>&gt;&gt;</span>调查征集<span>&gt;&gt;</span>问卷主题</p></div>
  <div class="main-cont">
    <h3 class="title">
	  <a href="<!--{$cpfile}-->?c=<!--{$c}-->&a=add" class="btn-general"><span>添加问卷主题</span></a>问卷主题
	</h3>
	<div class="search-area ">
	  <form method="post" id="search_form" action="<!--{$cpfile}-->?c=<!--{$c}-->" />
	  <div class="item">
		主题：<input type="text" id="stopicname" name="stopicname" size="15" class="input-txt" value="<!--{$stopicname}-->" />&nbsp;
		&nbsp;&nbsp;<input type="submit" class="button_s" value="搜 索" />
	  </div>
	  </form>
	</div>
	<form action="<!--{$cpfile}-->?c=<!--{$c}-->" method="post" name="myform" id="myform" style="margin:0">
	<input type='hidden' name='a' id='a'>
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table" align="center">
	  <thead class="tb-tit-bg">
	  <tr>
		<th width="10%"><div class="th-gap">选择</div></th>
		<th width="30%"><div class="th-gap">问卷主题</div></th>
		<th width="15%"><div class="th-gap">录入时间</div></th>
	    <th width="8%"><div class="th-gap">状态</div></th>
		<th width="8%"><div class="th-gap">题目</div></th>
		<th width="15%"><div class="th-gap">截止投票</div></th>
		<th><div class="th-gap">操作</div></th>
	  </tr>
	  </thead>
	  <tfoot class="tb-foot-bg"></tfoot>
	  <!--{if empty($quetopic)}-->
	  <tr>
	    <td colspan="7" align="center">没有找到符合条件的信息</td>
	  </tr>
	  <!--{else}-->
	  <!--{foreach $quetopic as $volist}-->
	  <tr onMouseOver="overColor(this)" onMouseOut="outColor(this)">
	    <td align="center"><input name="id[]" type="checkbox" value="<!--{$volist.topicid}-->" onClick="checkItem(this, 'chkAll')"><!--{$volist.topicid}--></td>
		<td><!--{$volist.topicname}--></td>
		<td align="center"><!--{$volist.addtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>

		<td align="center">
		<!--{if $volist.flag=='0'}-->
			<input type="hidden" id="attr_flag<!--{$volist.topicid}-->" value="flagopen" />
			<img id="flag<!--{$volist.topicid}-->" src="<!--{$urlpath}-->tpl/static/images/no.gif" onClick="javascript:fetch_ajax('flag','<!--{$volist.topicid}-->');" style="cursor:pointer;">
		<!--{else}-->
			<input type="hidden" id="attr_flag<!--{$volist.topicid}-->" value="flagclose" />
			<img id="flag<!--{$volist.topicid}-->" src="<!--{$urlpath}-->tpl/static/images/yes.gif" onClick="javascript:fetch_ajax('flag','<!--{$volist.topicid}-->');" style="cursor:pointer;">	
		<!--{/if}-->
        </td>
		</td>
		<td align="center"><!--{$volist.quenums}--></td>
		<td align="center"><!--{$volist.endtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
		<td align="center">
		  <a href="<!--{$cpfile}-->?c=<!--{$c}-->&a=edit&id=<!--{$volist.topicid}-->">编辑</a>&nbsp;&nbsp;
		  <a href="<!--{$cpfile}-->?c=<!--{$c}-->&a=del&id[]=<!--{$volist.topicid}-->" onClick="{if(confirm('确定要删除吗？')){return true;} return false;}">删除</a>&nbsp;&nbsp;
		  <a href="<!--{$cpfile}-->?c=question&a=add&stopicid=<!--{$volist.topicid}-->">添加题目</a>
		</td>
	  </tr>
	  <!--{/foreach}-->
	  <tr>
		<td align="center"><input name="chkAll" type="checkbox" id="chkAll" onClick="checkAll(this, 'id[]')" value="checkbox"></td>
		<td class="hback" colspan="6">
		<input class="button" name="btn_del" type="button" value="删 除" onClick="{if(confirm('确定要删除吗？')){$('#a').val('del');$('#myform').submit();return true;}return false;}" class="button">
		
		&nbsp;&nbsp;共[ <b><!--{$total}--></b> ]条记录</td>
	  </tr>
	  
	  <!--{/if}-->
	</table>
	</form>
  </div>
</div>
<!--{/if}-->

<!--{if $a eq "add"}-->
<div class="main-wrap">
  <div class="path"><p>当前位置：模块管理<span>&gt;&gt;</span>调查征集<span>&gt;&gt;</span><a href="<!--{$cpfile}-->?c=<!--{$c}-->&a=add">添加问卷主题</a></p></div>
  <div class="main-cont">
	<h3 class="title"><a href="<!--{$cpfile}-->?c=<!--{$c}-->" class="btn-general"><span>返回列表</span></a>添加问卷主题</h3>
    <form name="myform" id="myform" method="post" action="<!--{$cpfile}-->?c=<!--{$c}-->" />
    <input type="hidden" name="a" value="saveadd" />
	<table cellpadding='1' cellspacing='1' class='tab'>
	  <tr>
		<td class='hback_1' width='15%'>问卷主题 <span class="f_red">*</span> </td>
		<td class='hback' width='85%'><input type="text" name="topicname" id="topicname" class="input-txt" /> <span id='dtopicname' class='f_red'></span> </td>
	  </tr>
	  <tr>
		<td class='hback_1'>截止投票 <span class="f_red">*</span></td>
		<td class='hback'>
		  <input type="text" name="endtime" id="endtime" class="input-150" readonly="only" value="" />
		  <span id='dendtime' class='f_red'></span>
		  <script>
			laydate({
				elem: "#endtime",
				format: "YYYY-MM-DD hh:mm:ss",
				istime: true,
				choose: function(datas){}
			});
		  </script>
		</td>
	  </tr>
	  <tr>
		<td class='hback_1'>问卷描述 <span class="f_red"></span></td>
		<td class='hback'>
		  <textarea name="intro" id="intro" style="width:40%;height:80px;overflow:auto;"></textarea>
		  <span id='dintro' class='f_red'></span>
		</td>
	  </tr>
	  <tr>
		<td class='hback_1'>状态 <span class="f_red"></span></td>
		<td class='hback'>
		  <select name="flag" id="flag">
		    <option value="">=请选择=</option>
			<option value="0">待审核</option>
			<option value="1" selected>已通过</option>
		  </select>
		  <span id='dintro' class='f_red'></span>
		</td>
	  </tr>
	  <tr>
		<td class='hback_none'></td>
		<td class='hback_none'><input type="button" f="submitform" data-form="myform" name="btn_save" class="button" value="添加保存" /></td>
	  </tr>
	</table>
	</form>
  </div>
  <div style="clear:both;"></div>
</div>
<!--{/if}-->

<!--{if $a eq "edit"}-->
<div class="main-wrap">
  <div class="path"><p>当前位置：模块管理<span>&gt;&gt;</span>调查征集<span>&gt;&gt;</span>编辑问卷主题</p></div>
  <div class="main-cont">
	<h3 class="title"><a href="<!--{$cpfile}-->?c=<!--{$c}-->&<!--{$comeurl}-->" class="btn-general"><span>返回列表</span></a>编辑问卷主题</h3>
    <form name="myform" id="myform" method="post" action="<!--{$cpfile}-->?c=<!--{$c}-->" />
    <input type="hidden" name="a" value="saveedit" />
	<input type="hidden" name="id" value="<!--{$id}-->" />
	<table cellpadding='1' cellspacing='1' class='tab'>
	  <tr>
		<td class='hback_1' width='15%'>问卷主题 <span class="f_red">*</span> </td>
		<td class='hback' width='85%'><input type="text" name="topicname" id="topicname" class="input-txt" value="<!--{$quetopic.topicname}-->" /> <span id='dtopicname' class='f_red'></span> </td>
	  </tr>
	  <tr>
		<td class='hback_1'>截止投票 <span class="f_red">*</span></td>
		<td class='hback'>
		  <input type="text" name="endtime" id="endtime" class="input-150" readonly="only" value="<!--{if $quetopic.endtime>0}--><!--{$quetopic.endtime|date_format:"%Y-%m-%d %H:%M:%S"}--><!--{/if}-->" />
		  <span id='dendtime' class='f_red'></span>
		  <script>
			laydate({
				elem: "#endtime",
				format: "YYYY-MM-DD hh:mm:ss",
				istime: true,
				choose: function(datas){}
			});
		  </script>
		</td>
	  </tr>
	  <tr>
		<td class='hback_1'>问卷描述 <span class="f_red"></span></td>
		<td class='hback'>
		  <textarea name="intro" id="intro" style="width:40%;height:80px;overflow:auto;"><!--{$quetopic.intro}--></textarea>
		  <span id='dintro' class='f_red'></span>
		</td>
	  </tr>
	  <tr>
		<td class='hback_1'>状态 <span class="f_red"></span></td>
		<td class='hback'>
		  <select name="flag" id="flag">
		    <option value="">=请选择=</option>
			<option value="0"<!--{if $quetopic.flag == '0'}--> selected<!--{/if}-->>待审核</option>
			<option value="1"<!--{if $quetopic.flag == '1'}--> selected<!--{/if}-->>已通过</option>
		  </select>
		  <span id='dintro' class='f_red'></span>
		</td>
	  </tr>
	  <tr>
		<td class='hback_none'></td>
		<td class='hback_none'><input type="button" f="submitform" data-form="myform" name="btn_save" class="button" value="编辑保存" /></td>
	  </tr>
	</table>
	</form>
  </div>
  <div style="clear:both;"></div>
</div>
<!--{/if}-->
<!--{assign var='pluginevent' value=XHook::doAction('adm_footer')}-->
<script type="text/javascript">
$(function(){
	//提交保存
	$("[f='submitform']").bind("click", function(){
		$_form = $(this).attr("data-form");
		$_input = "";
		
		$_input = "topicname";
		if ($("#"+$_input).val().length == 0) {
			dmsg("请填写问卷主题", $_input);
			return false;
		}

		$_input = "endtime";
		if ($("#"+$_input).val().length == 0) {
			dmsg("请填写投票截止时间", $_input);
			return false;
		}
		$("#"+$_form).submit();

	});
});
</script>
</body>
</html>