<!--{template 'head'}-->
<!--{if !AJAX}-->
<table cellpadding="0" cellspacing="0" border="0" align=center class="tableborder" width="100%">
	<tr>
		<td class="tablerow"><b>管理选项：</b><a href="plugin.php?plugin=site&action=manage">友情链接管理</a> | <a href="plugin.php?plugin=site&action=manage&verify=1">待审申请</a> | <a href="plugin.php?plugin=site&action=add">添加</a> | <a href="###" onclick="return qmeCms.dialogView.get('友情链接设置', 'plugin.php?plugin=site&action=set', {width:400});">设置</a></td>
	</tr>
</table>
<!--{/if}-->
<!--{if $action=='manage'}-->
<table cellpadding="0" cellspacing="0" class="tableborder bg mt5" id="mytable">
	<tr align="center">
		<td width="40" class="tablerowhighlight"></td>
		<td width="150" class="tablerowhighlight">logo</td>
		<td  class="tablerowhighlight">网站名</td>
		<td width="120" class="tablerowhighlight">添加时间</td>
		<td width="80"  class="tablerowhighlight">状态</td>
		<td width="100"  class="tablerowhighlight">管理操作</td>
	</tr>
	<!--{if $data}-->
	<!--{loop $data $item}-->
	<tr align="center" class="item" id="item-{$item['id']}">
		<td><input type="checkbox" name="id[]" id="ids_{$item[id]}" value="{$item[id]}" /></td>
		<td align="center"><!--{if $item['logo']}--><img src="{$item['logo']}" /><!--{/if}--></td>
		<td align="left" style="padding-left:15px"><a href="{$item['url']}" target="_blank" title="<!--{echo htmlspecialchars($item['description'])}-->">{$item['name']}</a></td>
		<td align="center"><!--{echo qbase::formatTime('Y-n-d H:i', $item[dateline])}--></td>
		<td><!--{if $item['status']}-->正常<!--{else}--><font color="red">待审</font><!--{/if}--></td>
		<td><a href='plugin.php?plugin=site&action=modify&id={$item[id]}'>修改</a> | <a href='plugin.php?plugin=site&action=delete&id={$item[id]}' onclick="return makeSure();">删除</a></td>
	</tr>
	<!--{/loop}-->
	<tr>
		<td colspan="7" class="tablerow">
			<!--{eval new Pager($total,$limit);}-->
		</td>
	</tr>
	<!--{else}-->
	<tr>
		<td colspan="7" class="tablerow"><p style="padding:25px;text-align:center">还没有相关数据</p></td>
	</tr>
	<!--{/if}-->
</table>
<!--{elseif $action == 'add' || $action == 'modify'}-->
<script type="text/javascript">
function checkSite(){
	if(!$('site_name').value.trim()){
		$('site_name').focus();
		return false;
	}
	var url = $('site_url').value.trim();
	if(!url || url.indexOf('http') != 0){
		$('site_url').focus();
		return false;
	}
	$('submit-act').disabled = true;
	return true;
}
</script>
<form action="plugin.php?plugin=site&action={$action}&id={$id}" method="post" onsubmit="return checkSite()">
	<table cellpadding="0" cellspacing="1" class="tableborder bg border">
		<tr>
			<td class="submenu" align=center width=100% height=26 colspan="2"> 添加/修改友情链接 </td>
		</tr>
		<tr>
			<td class="tablerowl" width="25%" style="text-align:right;padding-right:15px">网站名称</td>
			<td class="tablerow">
				<p style="padding-top:5px">
					<input type="text" class="f-text" size="30" name="param[name]" id="site_name" value="{$data['name']}" />
				</p>
				<p style="color:green;padding:5px 0">必填项</p>
			</td>
		</tr>
		<tr>
			<td class="tablerowl" style="text-align:right;padding-right:15px">网站地址</td>
			<td class="tablerow">
				<p style="padding-top:5px">
					<input type="text" class="f-text" style="width:350px" name="param[url]" id="site_url" value="{$data['url']}"/>
				</p>
				<p style="color:green;padding:5px 0">必填项</p>
			</td>
		</tr>
		<tr>
			<td class="tablerowl" style="text-align:right;padding-right:15px">网站logo</td>
			<td class="tablerow">
				<input type="text" class="f-text" style="width:350px" name="param[logo]" id="site_logo" value="{$data['logo']}" />
				<input type="button" value="上传图片" class="f-button" onclick="qmeCms.dialogView.iframe('上传图片','system.php?sys=upload&id=site_logo&path=attachment/site',{type:'abs'});" />
			</td>
		</tr>
		<tr>
			<td class="tablerowl" style="text-align:right;padding-right:15px">介绍</td>
			<td class="tablerow"><textarea  class="f-text" style="width:350px;height:60px"  name="param[description]">{$data['description']}</textarea></td>
		</tr>
		<tr>
			<td class="tablerowl" style="text-align:right;padding-right:15px">状态</td>
			<td class="tablerow"><input type="checkbox" value="1"  name="param[status]" id="site_status"<!--{if $data['status']}--> checked<!--{/if}--> /><label for="site_status" >启用</label></td>
		</tr>
		<tr>
			<td class="tablerowl" style="text-align:right;padding-right:15px">排序</td>
			<td class="tablerow">
				<p style="padding-top:5px">
					<input type="text" class="f-text" style="width:60px" name="param[ordering]" value="{$data['ordering']}" />
				</p>
				<p style="color:green;padding:5px 0">数字越大，越靠前</p>
			</td>
		</tr>
		<tr>
			<td class="tablerow"></td>
			<td class="tablerow">
				<input type="hidden" name="myFormAc"  value="update" />
				<input type="submit" id="submit-act" class="f-button" value=" 提交 " />
			</td>
		</tr>
	</table>
</form>
<!--{elseif $action == 'set'}-->
<form name="ajaxForm" id="ajaxForm" action="plugin.php?plugin=site&action=set" method="post">
	<p class="padding"><label for="site_open" class="f-label" style="width:160px">开启友情链接申请</label><input type="checkbox" value="1" id="site_open" name="plugin_site_open"<!--{if $_SET['plugin_site_open']}--> checked<!--{/if}--> /></p>
	<p class="padding"><label for="site_logo" class="f-label" style="width:160px">友情申请必须填写logo</label><input type="checkbox" value="1" id="site_logo" name="plugin_site_logo"<!--{if $_SET['plugin_site_logo']}--> checked<!--{/if}--> /></p>
</form>
<script type="text/javascript" reload="1">
(function(){	
	qmeCms.dialogView.setSubmit(true, "提交", function(){
		qmeCms.dialogView.setSubmit(true, "提交....", function(){});
		Form.send('ajaxForm', function(resp){
			qmeCms.dialogView.setMessage(resp);
			qmeCms.dialogView.setSubmit(false, "", function(){});
		});
	});
})();
</script>
<!--{/if}-->

<!--{template 'foot'}-->
