{include "header.inc.html"}
<div class="content_box">
	<div class="toolbar_box">
		<div class="toolbar"> <span> <strong>{$lang.admin.hotkey.name}</strong><br />
		<span class="english">{$lang.admin.hotkey.name_en}</span> </span> </div>
	</div>
 {if $smarty.get.act=="edit" || $smarty.get.act=="add"}
<div class="hotkeyForm">
<form class="form" action="" method="post" id="keyForm">
<input type="hidden" name="act" value="{$smarty.get.act}" /><input type="hidden" name="inajax" value="1" />
{if $smarty.get.act=="edit"}
<input type="hidden" name="id" value="{$smarty.get.id}" />
{/if}
<div class="form-line"><label class="label">关键词名称：</label><div class="element"><input type="text" class="text w200" name="name" value="{$hotkeyInfo.name}" /></div></div>
<div class="form-line"><label class="label">关键词颜色：</label><div class="element"><input type="text" class="text w60" name="color" value="{$hotkeyInfo.color}" maxlength="7" /> 请填写标准16进制颜色，如 #FF0000 代表使用红色。</div></div>
<div class="form-line"><label class="label">链接网址：</label><div class="element"><input type="text" class="text w200" name="url" value="{$hotkeyInfo.url}" /></div></div>
<div class="form-line">
<label class="label">排序：</label><div class="element"><input type="text" class="text w200" name="sortId" value="{$hotkeyInfo.sortId|default:50}" /></div>
</div>
<div class="form-line">
<label class="label"></label><div class="element"><input class="btn_sub" type="submit" value="{$lang.form.submit}"></div>
</div>
</form>
</div>
 {else}
 <table class="table-ca table_1" id="tInfo">
 <tr>
<th class="w60">编号</th><th>标题</th><th class="">链接网址</th><th class="w50">排序</th><th class="w100">添加时间</th><th class="w100">操作</th>
 </tr>
{hotkey limit="false"}
<tr sid="{$item.id}">
<td>{$item.id}</td><td><span style="{if $item.color}color:{$item.color}{/if}">{$item.name}</span></td><td>{$item.link}	</td><td>{$item.sortId}</td><td>{$item.posttime|date_format:"Y-m-d"}</td><td><a href="{$adminUrl}hotkey/act/edit/id/{$item.id}" title="{$lang.edit}" class="modBtn">{$lang.edit}</a> <a href="javascript:void(0)" class="delBtn" title="{$lang.del}">{$lang.del}</a></td>
</tr>
{/hotkey}
</table>
{/if}
</div><!--.content_box-->
<script type="text/javascript">
$(function(){
	$("#keyForm").ajaxForm({ dataType:'json',success:function(json){ icon='warn'; if(json.success){ icon='success'; if($("#keyForm input[name='act']").val()=='add'){ $("#keyForm input:text").val(''); } }  qlib.tips({ icon:icon,msg:json.message});  }});
	$("a.delBtn").click(function(){
		var tr=$(this).parent("td").parent("tr"),id=tr.attr("sid");
		$.ajax({ type:'post',url:'{$adminUrl}hotkey',data:{ act:'del',inajax:1,id:id },dataType:'json',success:function(json){  if(json.success){ tr.remove(); }else{ alert(json.message); } }}); 
	});
});
</script>
{include "footer.inc.html"}