{:tpl head}
<table cellpadding="0" cellspacing="1" class="table_list">
 <caption>栏目管理</caption>
  <tr>
   <td>
    <strong>管理选项：</strong>
    <a href="?c=category&a=add">添加栏目</a> |
    <a href="?c=category">管理栏目</a>
   </td>
  </tr>
</table>
<!--{:if $a == 'add'}-->
<!--{:if $step == 1}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>添加栏目</caption>
 <form name="addcategory" action="?c=category&a=add" method="post">
 <input type="hidden" name="step" value="2" />
 <tr>
   <td align="right" width="25%">上级栏目：</td>
   <td>
     <select name="pid" id="pid">
      <option value="0">无（作为一级栏目）</option>
      {:Tag::tree("<option value='\$catid'\$selected>\$tab\$name</option>",$pid,'',0,'0,1')}
     </select> <span class="fred">*这里不显示外部链接</span>
   </td>
 </tr>
 <tr>
   <td align="right">栏目类型：</td>
   <td>
   <input type="radio" name="type" value="0"{:Tag::checked($type,0)} onClick="set_display(set_model,'')">内部栏目（可绑定内容模型，并支持在栏目下建立子栏目或发布信息）<br/>
   <input type="radio" name="type" value="1"{:Tag::checked($type,1)} onClick="set_display(set_model,'none')">单网页（可发布单网页内容，并支持在栏目下建立子栏目）<br/>
   <input type="radio" name="type" value="2"{:Tag::checked($type,2)} onClick="set_display(set_model,'none')">外部链接（可建立一个链接并指向任意网址）
   </td>
 </tr>
 <tbody id="set_model"{:if $type} style="display:none"{:/if}>
 <tr>
  <td align="right">绑定模块：</td>
  <td><select name="moduleid">{:loop $module $k $v}{:if $v['usecategory']}<option value="{:$k}"{:Tag::selected($k, $moduleid)}>{:$v['title']}</option>{:/if}{:/loop}</select></td>
 </tr>
 <tr>
  <td align="right">添加栏目数：</td>
  <td><input type="text" name="addnum" value="5" size="4" maxlength="2"> <span class="fblue">* 请填写需要添加的当前级别分类个数</span></td>
 </tr>
 </tbody>
 <tr>
  <td height="30" colspan="2" align="center">
  <button type="submit" name="next">下一步</button>
  <button type="button" name="back" onclick="history.back()">返回</button>
  </td>
 </tr>
 </form>
</table>
<!--{:elseif $type == 0}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>添加{:$module['title']}栏目</caption>
 <tr>
  <th width="15%">栏目名称(<span class="fred">*</span>)</th>
  <th width="15%">栏目目录</th>
  <th width="12%">显示方式</th>
  <th width="15%" title="针对搜索引擎设置的标题">Seotitle(标题)</th>
  <th title="针对搜索引擎设置的关键词">Meta Keywords(关键词)</th>
  <th title="针对搜索引擎设置的描述">Meta Description(描述)</th>
 </tr>
 <form name="addcategory" action="?c=category&a=add" method="post">
 <input name="moduleid" value="{:$module['id']}" type="hidden" />
 <input name="type" value="0" type="hidden" />
 <input name="pid" value="{:$pid}" type="hidden" />
 {:loop Tag::intArray(1, $addnum) $i}
 <tr align="center">
   <td><input type="text" name="info[{:$i}][name]" id="name{:$i}" size="15" onblur="makename('name{:$i}','dir{:$i}',1)"></td>
   <td><input type="text" name="info[{:$i}][dir]" id="dir{:$i}" size="15" require="" datatype="dir" msg="栏目目录格式错误"></td>
   <td>
   <select name="info[{:$i}][showtype]">
    <option value="1" selected="selected">均显示</option>
    <option value="2">菜单显示</option>
    <option value="3">列表显示</option>
    <option value="0">不显示</option>
   </select>   
   </td>
   <td><input type="text" name="info[{:$i}][seotitle]" size="15"></td>
   <td><textarea name="info[{:$i}][keywords]" style="width:98%;height:50px"></textarea></td>
   <td><textarea name="info[{:$i}][description]" style="width:98%;height:50px"></textarea></td>
 </tr>
 {:/loop}
 <tr>
  <td colspan="6" height="30" align="center">
   <button type="submit" name="submit">提交</button>
   <button type="button" name="back" onclick="history.back()">返回</button>
   <span class="fred">* 必填，填几行就添加几个栏目</span></td>
 </tr>
 </form>
</table>
 <!--{:elseif $type == 1}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>添加单网页栏目</caption>
 <form name="addcategory" action="?c=category&a={:$a}" method="post">
 <input type="hidden" name="type" value="1" />
 <tr>
  <td align="right" width="25%">栏目名称：</td>
  <td><input name="name" id="name" type="text" size="20" value="" require="true" datatype="require" msg="栏目名称不能为空"> <span class="fred">*</span></td>
 </tr>
 <tr>
   <td align="right">上级栏目：</td>
   <td>
     <select name="pid" id="pid">
      <option value="0">无（作为一级栏目）</option>
      {:Tag::tree("<option value='\$catid'\$selected>\$tab\$name</option>",$pid,0,0,'0,1')}
     </select> <span class="fred">*这里不显示外部链接</span>
   </td>
 </tr>
 <tr>
  <td align="right">显示方式：</td>
  <td>
   <select name="showtype">
    {:Tag::option('0_不显示|2_菜单显示', 2)}
   </select>
  </td>
 </tr>
 <tr>
  <td align="right">显示模式：</td>
  <td>
   <select name="showmode">
    {:Tag::option('0_默认|3_转入子分类', 0)}
   </select>
  </td>
 </tr>
 <tr>
  <td align="right">栏目目录：</td>
  <td>
   <input type="text" size="15" name="dir" id="dir" value="" require="" datatype="dir" msg="栏目目录格式错误"> <span class="fblue">只能是数字、字母、横杠</span><input type="checkbox" name="istransfer" value="1" checked />传递给子栏目&nbsp;<button type="button" onclick="makename('name','dir',1)">生成</button><br />
   <span class="fred">*父级栏目这里设置的是目录(对应的文件名为index)，子级栏目这里设置的是文件名！</span>
  </td>
 </tr>
 <tr>
  <td colspan="2" height="30" align="center">
   <button type="submit" name="submit">提交</button>
   <button type="button" name="back" onclick="history.back()">返回</button>
  </td>
 </tr>
 </form>
</table>
 <!--{:elseif $type == 2}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>添加外部链接</caption>
 <form name="addcategory" action="?c=category&a={:$a}" method="post">
 <input type="hidden" name="type" value="2" />
 <tr>
  <td align="right" width="20%">链接名称：</td>
  <td><input name="name" type="text" size="20" value="" require="true" datatype="require" msg="链接名称不能为空"> <span class="fred">*</span></td>
 </tr>
 <tr>
   <td align="right">上级栏目：</td>
   <td>
     <select name="pid" id="pid">
      <option value="0">无（作为一级栏目）</option>
      {:Tag::tree("<option value='\$catid'\$selected>\$tab\$name</option>",$pid,0,0,'0,1')}
     </select> <span class="fred">*这里不显示外部链接</span>
   </td>
 </tr>
 <tr>
  <td align="right">显示方式：</td>
  <td>
   <select name="showtype">
    <option value="0">不显示</option>
    <option value="2" selected="selected">菜单显示</option>
   </select>
  </td>
 </tr>
 <tr>
  <td align="right">链接地址：</td>
  <td>
   <input type="text" size="47" name="linkurl" value="" require="true" datatype="url" msg="请正确填写链接地址"> <span class="fred">*</span>
  </td>
 </tr>
 <tr>
  <td colspan="2" height="30" align="center">
   <button type="submit" name="submit">提 交</button>
   <button type="button" name="back" onclick="history.back()">返回</button>
  </td>
 </tr>
 </form>
</table>
<!--{:/if}-->
<script type="text/javascript" src="../../statics/js/validator.js"></script>
<script language="javascript" type="text/javascript">
$(function(){
	$('form').checkForm(1);
})
</script>
<!--{:elseif $a == 'edit'}-->
<!--{:if $data['type'] == 0}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>编辑{:$module[$data['moduleid']]['title']}（内部）栏目</caption>
 <form name="addcategory" action="?c=category&a=edit" method="post">
 <input type="hidden" name="catid" value="{:$data['catid']}" />
 <input type="hidden" name="type" value="{:$data['type']}" />
 <input type="hidden" name="forward" value="{:$referer}" />
 <tr>
  <td align="right" width="20%">栏目名称：</td>
  <td>
   <input name="name" id="name" type="text" size="20" value="{:$data['name']}"> 
   <button type="button" onclick="Upperfirst('name')" title="首字母大写">↑</button>
   <span class="fred">*</span>
  </td>
 </tr>
 <tr>
   <td align="right">上级栏目：</td>
   <td>
     <select name="pid" id="pid">
      <option value="0">无（作为一级栏目）</option>
      {:Tag::tree("<option value='\$catid'\$selected>\$tab\$name</option>",$data['pid'],0,0,'0,1')}
     </select> <span class="fred">*这里不显示外部链接</span>
   </td>
 </tr>
 <tr>
   <td align="right">所属模块：</td>
   <td>
     <select name="moduleid">{:loop $module $k $v}<option value="{:$k}"{:Tag::selected($k, $data['moduleid'])}>{:$v['title']}</option>{:/loop}</select>
   </td>
 </tr>
 <tr>
  <td align="right">显示方式：</td>
  <td>
   <select name="showtype">
    {:Tag::option('0_不显示|1_均显示|2_菜单显示|3_列表显示', $data['showtype'])}
   </select>
  </td>
 </tr>
 <tr>
  <td align="right">显示模式：</td>
  <td>
   <select name="showmode">
    {:Tag::option('0_默认|1_栏目|2_列表|3_转入子分类', $data['showmode'])}
   </select> <span class="fred">默认：父级分类用栏目方式，子级分类用列表方式</span>
  </td>
 </tr>
 <tr>
  <td align="right">栏目目录：</td>
  <td>
   <input type="text" size="15" id="dir" name="dir" value="{:$data['dir']}"> <span class="fblue">只能是数字、字母、横杠</span><input type="checkbox" name="istransfer" value="1"{:Tag::checked($data['istransfer'], 1)} />传递给子栏目&nbsp;<button type="button" onclick="makename('name','dir',1)">生成</button>
  </td>
 </tr>
 <tr>
  <td align="right">列表每页显示条数：</td>
  <td><input type="text" size="4" name="listnum" value="{:$data['listnum']}"> <span class="fblue">设为0表示采用上级设置，一级栏目设为0则表示采用系统设置</span></td>
 </tr>
 <tr>
  <td align="right">栏目风格：</td>
  <td>
   <select name="style">
   <option value="">不选择</option>
   {:loop $style $tmp}<option value="{:$tmp}"{:Tag::selected($tmp, $data['style'])}>{:$tmp}</option>{:/loop}</select> 
   <span class="fred">默认继承上级设置，对应的内容风格也是继承上级设置</span></td>
 </tr>
 <tr>
  <td align="right">栏目模板：</td>
  <td><input type="text" size="12" name="listtpl" value="{:$data['listtpl']}"> <span class="fblue">设置名称，不要加后缀，仅当前栏目有效</span></td>
 </tr> 
 <tr>
  <td align="right">内容模板：</td>
  <td><input type="text" size="12" name="conttpl" value="{:$data['conttpl']}"> <span class="fblue">设置名称，不要加后缀，仅当前栏目下内容有效</span></td>
 </tr>
 <tr>
  <td align="right">Seotitle(标题)：</td>
  <td>
   <input type="text" size="80" name="seotitle" id="seotitle" value="{:$data['seotitle']}">&nbsp;<button type="button" onclick="Upperfirst('seotitle')" title="首字母大写">↑</button>
  </td>
 </tr>
 <tr>
   <td align="right">Meta Keywords(关键词)：</td>
   <td>
     <textarea name="keywords" id="keywords" style="width:510px;height:50px">{:$data['keywords']}</textarea>&nbsp;<button type="button" onclick="Upperfirst('keywords')" title="首字母大写">↑</button>
   </td>
 </tr>
 <tr>
  <td align="right">Meta Description(描述)：</td>
  <td>
   <textarea name="description" id="description" style="width:510px;height:50px">{:$data['description']}</textarea>&nbsp;<button type="button" onclick="Upperfirst('description')" title="首字母大写">↑</button>
  </td>
 </tr>
 <tr>
  <td colspan="2" height="30" align="center">
  <button name="submit" type="submit">提交</button>
  <button type="button" name="back" onclick="history.back()">返回</button>
  </td>
 </tr>
 </form>
</table>
<!--{:elseif $data['type'] == 1}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>编辑单网页栏目</caption>
 <form name="addcategory" action="?c=category&a=edit" method="post">
 <input type="hidden" name="catid" value="{:$data['catid']}" />
 <input type="hidden" name="type" value="1" />
 <input type="hidden" name="forward" value="{:$referer}" />
 <tr>
  <td align="right">栏目名称：</td>
  <td><input name="name" id="name" type="text" size="20" value="{:$data['name']}"> <span class="fred">*</span></td>
 </tr>
 <tr>
   <td align="right">上级栏目：</td>
   <td>
     <select name="pid" id="pid">
      <option value="0">无（作为一级栏目）</option>
      {:Tag::tree("<option value='\$catid'\$selected>\$tab\$name</option>",$data['pid'],0,0,'0,1')}
     </select> <span class="fred">*这里不显示外部链接</span>
   </td>
 </tr>
 <tr>
  <td align="right">显示方式：</td>
  <td>
   <select name="showtype">
    {:Tag::option('0_不显示|2_菜单显示', $data['showtype'])}
   </select>
  </td>
 </tr>
 <tr>
  <td align="right">显示模式：</td>
  <td>
   <select name="showmode">
    {:Tag::option('0_默认|3_转入子分类', $data['showmode'])}
   </select>
  </td>
 </tr>
 <tr>
  <td align="right">栏目风格：</td>
  <td>
   <select name="style">
   <option value="">不选择</option>
   {:loop $style $tmp}<option value="{:$tmp}"{:Tag::selected($tmp, $data['style'])}>{:$tmp}</option>{:/loop}</select>&nbsp;
   <span class="fblue">默认继承上级设置</span></td>
 </tr>
 <tr>
  <td align="right">栏目目录：</td>
  <td>
   <input type="text" size="15" name="dir" id="dir" value="{:$data['dir']}"> <span class="fblue">只能是数字、字母、横杠</span><input type="checkbox" name="istransfer" value="1"{:Tag::checked($data['istransfer'], 1)} />传递给子栏目&nbsp;<button type="button" onclick="makename('name','dir',1)">生成</button><br />
   <span class="fred">*父级栏目这里设置的是目录(对应的文件名为index)，子级栏目这里设置的是文件名！</span>
  </td>
 </tr>
 <tr>
  <td colspan="2" height="30" align="center">
  <button type="submit" name="submit">提交</button>
  <button type="button" name="back" onclick="history.back()">返回</button>
  </td>
 </tr>
 </form>
</table>
 <!--{:elseif $data['type'] == 2}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>编辑外部链接</caption>
 <form name="addcategory" action="?c=category&a=edit" method="post">
 <input type="hidden" name="catid" value="{:$data['catid']}" />
 <input type="hidden" name="type" value="2" />
 <input type="hidden" name="forward" value="{:$referer}" />
 <tr>
  <td align="right">链接名称：</td>
  <td><input name="name" type="text" size="20" value="{:$data['name']}"> <span class="fred">*</span></td>
 </tr>
 <tr>
   <td align="right">上级栏目：</td>
   <td>
     <select name="pid" id="pid">
      <option value="0">无（作为一级栏目）</option>
      {:Tag::tree("<option value='\$catid'\$selected>\$tab\$name</option>",$data['pid'],0,0,'0,1')}
     </select> <span class="fred">*这里不显示外部链接</span>
   </td>
 </tr>
 <tr>
  <td align="right">显示方式：</td>
  <td>
   <select name="showtype">
    <option value="0"{:Tag::selected($data['showtype'],0)}>不显示</option>
    <option value="2"{:Tag::selected($data['showtype'],2)}>显示</option>
   </select>
  </td>
 </tr>
 <tr>
  <td align="right">链接地址：</td>
  <td>
   <input type="text" size="60" name="linkurl" value="{:$data['linkurl']}"> <span class="fred">*</span>
  </td>
 </tr>
 <tr>
  <td colspan="2" height="30" align="center">
  <button type="submit" name="submit">提交</button>
  <button type="button" name="back" onclick="history.back()">返回</button>
  </td>
 </tr>
 </form>
</table>
<!--{:/if}-->
<!--{:elseif $a == 'defaults'}-->
<form name="myform" method="post" action="">
<input type="hidden" name="selids" value="">
<table cellpadding="0" cellspacing="1" class="table_list">
 <caption>管理栏目</caption>
 <tr align="center">
  <th width="5%"><input name="checkbox" type="checkbox" onclick="checkorno(this,this.form.ids)" /></th>
  <th width="20%">名称</th>
  <th width="10%">ID</th>
  <th width="10%">排序</th>
  <th width="15%">类型</th>
  <th width="15%">模块</th>
  <th>管理操作</th>
 </tr>
 {:loop $data $v}
 <tr align="center">
  <td><input name="ids" type="checkbox" value="{:$v['catid']}"></td>
  <td><a href="{:Url::getListUrl($v['catid'])}" target="_blank">{:$v['name']}</a>{:if $v['elite']}<span class="fred"> 荐</span>{:/if}</td>
  <td>{:$v['catid']}</td>
  <td><input name="orderid[{:$v['catid']}]" type="text" size="2" value="{:$v['orderid']}"></td>
  <td>{:if $v['type'] == 0}内部栏目{:elseif $v['type'] == 1}单网页{:else}外部链接{:/if}</td>
  <td>{:$module[$v['moduleid']]['title']}</td>
  <td>
   {:if $category[$v['catid']]['subnum']}<a href="?c=category&pid={:$v['catid']}" title="查看子栏目">子栏目</a>{:else}<span class="fgray">子栏目</span>{:/if} | 
   <a href="?c=category&a=add&pid={:$v['catid']}" title="添加子栏目">添加</a> | 
   <a href="?c=category&a=edit&catid={:$v['catid']}">修改</a> | 
   <a href="?c=category&a=del&selids={:$v['catid']}">删除</a>
  </td>
 </tr>
 {:/loop}
 <tr>
  <td height="20" colspan="7" align="center">
   <button name="select1" onClick="selAll(this.form.ids)" type="button">全选</button>
   <button name="select2" onClick="noSelAll(this.form.ids)" type="button">反选</button>
   推荐<button name="submittjyes" type="button" onClick="subform(this.form,this.form.ids,'?c=category&a=elite&val=1','')">是</button> <button name="submittjno" type="button" onClick="subform(this.form,this.form.ids,'?c=category&a=elite&val=0','')">否</button>
   <button name="del" type="button" onClick="subform(this.form,this.form.ids,'?c=category&a=del','确认删除吗？此操作不可恢复。')">删除选定栏目</button>
   <button name="order" type="button" onClick="subform(this.form,this.form.ids,'?c=category&a=order','')">排序</button>
   <button name="reset" type="reset">重置</button>
   <!--{:if $pid}-->
   <button name="back" type="button" onclick="redirect('?c=category&pid={:$category[$pid]['pid']}')">返回上级</button>
   <!--{:/if}-->
  </td>
 </tr>
</table>
</form>
{:if $pages}<div class="pages">{:$pages}</div>{:/if}
<!--{:/if}-->
{:tpl foot}