{:tpl head}
<table cellpadding="0" cellspacing="1" class="table_list">
 <caption>关联链接管理</caption>
  <tr>
   <td>
    <strong>管理选项：</strong>
    <a href="?c=relatedlink&a=add">添加关联链接</a> |
	<a href="?c=relatedlink&a=add_more">批量添加关联链接</a> |
    <a href="?c=relatedlink">管理关联链接</a>
   </td>
  </tr>
</table>
<!--{:if $a == 'add' or $a == 'edit'}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>{:if $a == 'add'}添加{:else}修改{:/if}关联链接</caption>
 <form name="myform" action="?c=relatedlink&a={:$a}" method="post">
 <input type="hidden" name="info[id]" value="{:$data['id']}" />
 <input type="hidden" name="forward" value="{:$referer}" />
 <tr>
  <td width="25%" align="right">链接文字：</td>
  <td>
   <input name="info[name]" type="text" value="{:$data['name']}" size="60" require="true" datatype="require" msg="链接文字不能为空">&nbsp;<span class="fred">*</span></td>
 </tr>
 <tr>
  <td align="right">链接地址：</td>
  <td>
   <input name="info[url]" type="text" value="{:$data['url']}" size="60" require="true" datatype="require" msg="链接地址不能为空">&nbsp;<span class="fred">*</span></td>
 </tr>
 <tr>
  <td align="right">优先级：</td>
  <td><input name="info[priority]" type="text" value="{:$data['priority']}" size="4">&nbsp;<span class="fblue">* 默认生成顺序是链接文字从长到短，优先级数字越大，越早生成链接</span></td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td ><button type="submit" name="submit" value="submit">提交</button></td>
 </tr>
 </form>
</table>
<script type="text/javascript" src="../../statics/js/validator.js"></script>
<script language="javascript" type="text/javascript">
$(function(){
	$('form').checkForm(1);
})
</script>
<!--{:elseif $a == 'add_more'}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>批量添加关联链接</caption>
 <form name="myform" action="?c=relatedlink&a={:$a}" method="post">
 <tr>
  <td align="center">
   <textarea name="relatedlinks" cols="80" rows="18" require="true" datatype="require" msg="链接信息不能为空"></textarea><br /><span class="fblue">* 格式：“链接文字|链接地址|优先级”，“链接文字|链接地址”是必须的，一行一个</span></td>
 </tr>
 <tr>
  <td align="center"><button type="submit" name="submit" value="submit">提交</button></td>
 </tr>
 </form>
</table>
<script type="text/javascript" src="../../statics/js/validator.js"></script>
<script language="javascript" type="text/javascript">
$(function(){
	$('form').checkForm(1);
})
</script>
<!--{:elseif $a == 'defaults'}-->
<table cellpadding="0" cellspacing="1" class="table_list">
 <caption>管理关联链接</caption>
 <form name="myform" method="post">
 <input type="hidden" value="" name="selids" />
 <tr align="center">
  <th width="6%"><input name="checkbox" type="checkbox" onclick="checkorno(this,this.form.ids)"></th>
  <th width="24%"><a href="{:$orderurl}&field=name&order={:$order}">链接文字</a></th>
  <th width="40%"><a href="{:$orderurl}&field=url&order={:$order}">链接地址</a></th>
  <th width="10%"><a href="{:$orderurl}&field=priority&order={:$order}">优先级</a></th>
  <th>操作</th>
 </tr>
 {:loop $data $v}
 <tr align="center">
  <td><input name="ids" type="checkbox" value="{:$v['id']}" /></td>
  <td align="left">{:$v['name']}{:if $v['elite']}<span class="fred"> 荐</span>{:/if}</td>
  <td align="left">{:$v['url']}</td>
  <td>{:$v['priority']}</td>
  <td>
   <a href="?c=relatedlink&a=edit&id={:$v['id']}">修改</a> | <a href="?c=relatedlink&a=del&selids={:$v['id']}">删除</a>
  </td>
 </tr>
 {:/loop}
 <tr>
  <td height="20" colspan="5" 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 type="button" name="btn2" onClick="subform(this.form,this.form.ids,'?c=relatedlink&a=del','确认删除吗？此操作不可恢复。')">删除关联链接</button>
   </td>
 </tr>
 </form>
</table>
{:if $pages}<div class="pages">{:$pages}</div>{:/if}
<!--{:/if}-->
{:tpl foot}