<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->
<!--{if $a == "run"}-->
<div class="oemarry_layout">
  <div class="oe_top_nav"><i></i>单页管理->单页分类</div>
  <div class="oe_content">
	
	<form id="serform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
	<div class="oe_txtwrap">
	  分类名称：<input type="text" name="scatname" id="scatname" class="input-150" value="<!--{$scatname}-->" />&nbsp;
	  &nbsp;&nbsp;&nbsp;<input type="submit" name="btn_search" id="btn_search" class="button_2" value="搜索" />
	</div>
	</form>

    <div class="oe_tools_bar clearfix">
      <a class="icon-checkbox-unchecked" href="javascript:;" id="selAll" onclick="oemarrySelectAll(this, 'selall');">选择</a>
      <a class="icon-remove-2" onclick="oemarryDialogFormDel('myform');">删除</a>
      <span class="fr"><a class="icon-plus" href="<!--{$oefile}-->&c=<!--{$c}-->&a=add">添加</a></span>
    </div>
    
	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&a=del" method="post">
    <table class="oe_table_list table_cs">
	  <tr>
	    <th width="10%">ID</th>
		<th width="30%">分类名</th>
		<th width="10%">图标</th>
		<th width="10%">排序</th>
		<th width="10%">推荐</th>
		<th width="15%">添加时间</th>
		<th>操作</th>
	  </tr>
	  <!--{if empty($aboutcat)}-->
	  <tr>
	    <td class="text_center" colspan="8">没有符合条件的信息！</td>
	  </tr>
	  <!--{else}-->
	  <!--{foreach $aboutcat as $volist}-->
	  <tr>
	    <td class="text_center"><input type="checkbox" name="id[]" id="id[]" class="selall" value="<!--{$volist.catid}-->" /><!--{$volist.catid}--></td>
		<td><!--{$volist.catname}--></td>
		<td class="text_center">
		<!--{if !empty($volist.catimg)}-->
		<img src="<!--{$urlpath}--><!--{$volist.catimg}-->" width="20px" height="20px" f="viewimg" />
		<!--{else}-->
		~~
		<!--{/if}-->
		</td>
		<td class="text_center"><!--{$volist.orders}--></td>
		<td class="text_center">
		<!--{if $volist.elite=='0'}-->
			<input type="hidden" id="attr_elite<!--{$volist.catid}-->" value="eliteopen" />
			<img id="elite<!--{$volist.catid}-->" src="<!--{$urlpath}-->tpl/static/images/img_close.gif" onClick="oemarryUpdateFlag('elite', '<!--{$volist.catid}-->');" style="cursor:pointer;">
		<!--{else}-->
			<input type="hidden" id="attr_elite<!--{$volist.catid}-->" value="eliteclose" />
			<img id="elite<!--{$volist.catid}-->" src="<!--{$urlpath}-->tpl/static/images/img_open.gif" onClick="oemarryUpdateFlag('elite', '<!--{$volist.catid}-->');" style="cursor:pointer;">	
		<!--{/if}-->
		</td>
		<td><!--{$volist.addtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
		<td class="text_center">
		 <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.catid}-->&<!--{$comeurl}-->" class="oe_ico_blue">编辑</a>
		 <a href="javascript:;" onclick="oemarryDialogUrlDel('<!--{$oefile}-->&c=<!--{$c}-->&a=del&id[]=<!--{$volist.catid}-->&<!--{$comeurl}-->');" class="oe_ico_red">删除</a>
		</td>
	  </tr>
	  <!--{/foreach}-->
	  <!--{/if}-->
	</table>
	</form>

	<div class="oe_page_box"><!--{$showpage}--></div>

  </div>
</div>
<!--{/if}-->

<!--{if $a == 'add'}-->
<div class="oemarry_layout">
  <div class="oe_top_nav">
	<i></i>单页管理->单页分类->添加
	<span><a href="<!--{$oefile}-->&c=<!--{$c}-->">&lt;&lt;返回列表</a></span>
  </div>
  <div class="oe_content">
    <h6>添加单页分类</h6>
	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post" />
	<input type="hidden" name="a" id="a" value="saveadd" />
    <table class="oe_table_wrap">
	  <tr>
	    <th width="15%">分类名称：<span class="f_red">*</span></th>
		<td width="85%">
		  <input type="text" name="catname" id="catname" class="input-b" />
		  <span class="oe_trap"></span>
		</td>
	  </tr>
	  <tr>
	    <th>图标：<span class="f_red"></span></th>
		<td>
		  <table class="oe_table_wrap">
		    <tr>
			  <td width="150px">
				  <div class="oe_img_upload">
					<label class="_uploadbtn">点击上传<input type="file" name="img" id="img" value="" /></label>
					<label class="_uploading" id="img_loading">
					  <img src="<!--{$urlpath}-->tpl/admin/images/loading.gif" />上传中...
					</label>
					<input type="hidden" id="img_thumb" name="img_thumb" value="" />
					<input type="hidden" id="img_url" name="catimg" value="" />
				  </div>
				  <script type="text/javascript">
				  $(function(){
					  $("#img").live("change", function(){
						oemarryUploadImg("img", "<!--{$oefile}-->&c=index&a=uploadimg&module=upload&forbidcom=1&forbidwater=1");
					  });
				  });
				  </script>
			  </td>
			  <td width="50px">预览：</td>
			  <td width="80px">
			    <img src="<!--{$urlpath}-->tpl/static/images/waitimg.jpg" width="30px" height="30px" id="img_preview" f="viewimg" />
				<a href="javascript:;" class="_removeimg" f="removeimg" data-preview="img_preview" data-draw="img_url">移除</a>
			  </td>
			  <td></td>
			</tr>
		  </table>
		</td>
	  </tr>
	  <tr>
		<th>排序：</th>
		<td><input type="text" name="orders" id="orders" class="input-s" value="<!--{$orders}-->" /></td>
	  </tr>
	  <tr>
		<th>推荐：</th>
		<td>
		  <input type="radio" name="elite" id="elite" value="1" />是，
		  <input type="radio" name="elite" id="elite" value="0" checked />否
		</td>
	  </tr>
	  <tr>
	    <td></td>
		<td>
		<input type="button" id="btn_save" class="button_2" value="添加保存" /> 
	    <span id="submit_tips" class="error"></span>
		</td>
	  </tr>
	</table>
	</form>
  </div>
</div>
<script type="text/javascript">
$(function(){

	$("#catname").bind("blur", function(){ //检测标识
		if ($(this).val().length > 0) {
			$.ajax({
				type: "POST",
				url: "<!--{$oefile}-->&c=<!--{$c}-->",
				cache: false,
				data: {a:"check", name:$(this).val(), r:get_rndnum(8)},
				dataType: "json",
				success: function(data) {
					$json = eval(data);
					$response = $json.response;
					$result = $json.result;
					if ($response == '1') {
						oemarryCheckOk("catname", "该名称可用");
					}
					else {
						if ($result.length == 0) {
							$result = "该名称已存在";
						}
						oemarryCheckError("catname", $result);
					}
				},
				error: function() {
					ToastShow("检测失败，请检查网络...");
				}
			});
		}
	});

	$("#btn_save").bind("click", function(){
		if ($("#catname").val().length == 0) {
			ToastShow("请填写分类名称", "catname");
			return false;
		}
		$("#myform").submit();
	});

});
</script>

<!--{/if}-->


<!--{if $a == 'edit'}-->
<div class="oemarry_layout">
  <div class="oe_top_nav">
	<i></i>单页管理->单页分类->编辑
	<span><a href="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->">&lt;&lt;返回列表</a></span>
  </div>
  <div class="oe_content">
    <h6>编辑单页分类</h6>
	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" method="post" />
	<input type="hidden" name="a" id="a" value="saveedit" />
	<input type="hidden" name="id" id="id" value="<!--{$id}-->" />
    <table class="oe_table_wrap">
	  <tr>
	    <th width="15%">分类名称：<span class="f_red">*</span></th>
		<td width="85%">
		  <input type="text" name="catname" id="catname" class="input-b" value="<!--{$aboutcat.catname}-->" />
		  <span class="oe_trap"></span>
		</td>
	  </tr>
	  <tr>
	    <th>图标：<span class="f_red"></span></th>
		<td>
		  <table class="oe_table_wrap">
		    <tr>
			  <td width="150px">
				  <div class="oe_img_upload">
					<label class="_uploadbtn">点击上传<input type="file" name="img" id="img" value="" /></label>
					<label class="_uploading" id="img_loading">
					  <img src="<!--{$urlpath}-->tpl/admin/images/loading.gif" />上传中...
					</label>
					<input type="hidden" id="img_thumb" name="img_thumb" value="" />
					<input type="hidden" id="img_url" name="catimg" value="<!--{$aboutcat.catimg}-->" />
				  </div>
				  <script type="text/javascript">
				  $(function(){
					  $("#img").live("change", function(){
						oemarryUploadImg("img", "<!--{$oefile}-->&c=index&a=uploadimg&module=upload&forbidcom=1&forbidwater=1");
					  });
				  });
				  </script>
			  </td>
			  <td width="50px">预览：</td>
			  <td width="30px">
			    <!--{if !empty($aboutcat.catimg)}-->
				<img src="<!--{$urlpath}--><!--{$aboutcat.catimg}-->" width="30px;" height="30px" id="img_preview" f="viewimg" />
				<!--{else}-->
			    <img src="<!--{$urlpath}-->tpl/static/images/waitimg.jpg" width="30px" height="30px" id="img_preview" f="viewimg" />
				<!--{/if}-->
				<a href="javascript:;" class="_removeimg" f="removeimg" data-preview="img_preview" data-draw="img_url">移除</a>
			  </td>
			  <td></td>
			</tr>
		  </table>
		</td>
	  </tr>
	  <tr>
		<th>排序：</th>
		<td><input type="text" name="orders" id="orders" class="input-s" value="<!--{$aboutcat.orders}-->" /></td>
	  </tr>
	  <tr>
		<th>推荐：</th>
		<td>
		  <input type="radio" name="elite" id="elite" value="1"<!--{if $aboutcat.elite == '1'}--> checked<!--{/if}--> />是，
		  <input type="radio" name="elite" id="elite" value="0"<!--{if $aboutcat.elite == '0'}--> checked<!--{/if}--> />否
		</td>
	  </tr>
	  <tr>
	    <td></td>
		<td>
		  <input type="button" id="btn_save" class="button_2" value="编辑保存" /> 
		  <span id="submit_tips" class="error"></span>
		</td>
	  </tr>
	</table>
	</form>
  </div>
</div>
<script type="text/javascript">
$(function(){

	$("#catname").bind("blur", function(){ //检测标识
		if ($(this).val().length > 0) {
			$.ajax({
				type: "POST",
				url: "<!--{$oefile}-->&c=<!--{$c}-->",
				cache: false,
				data: {a:"check", name:$(this).val(), catid:"<!--{$id}-->", r:get_rndnum(8)},
				dataType: "json",
				success: function(data) {
					$json = eval(data);
					$response = $json.response;
					$result = $json.result;
					if ($response == '1') {
						oemarryCheckOk("catname", "该名称可用");
					}
					else {
						if ($result.length == 0) {
							$result = "该名称已存在";
						}
						oemarryCheckError("catname", $result);
					}
				},
				error: function() {
					ToastShow("检测失败，请检查网络...");
				}
			});
		}
	});

	$("#btn_save").bind("click", function(){
		if ($("#catname").val().length == 0) {
			ToastShow("请填写分类名称", "catname");
			return false;
		}
		$("#myform").submit();
	});

});
</script>

<!--{/if}-->
</body>
</html>