<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="admin/admin/template/style/admin.css" rel="stylesheet" type="text/css" />
<script src="include/js/jquery.js" type="text/javascript"></script>
<script src="include/js/uploadify/swfobject.js" type="text/javascript"></script>
<script src="include/js/uploadify/uploadify.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
	$("#files").uploadify({
		'script'         : 'admin.php',
		'scriptData'	 : {'c':'uploads','isfiles':'Filedata','session_id':'<?php echo session_id();?>'},
		'queueID'        : 'fileQueue',
		'auto'           : true,	//自动上传
		'multi'          : false,	//是否可以传多个文件
		'removeCompleted': true,	//完成移除进度条
		'sizeLimit'		 : <?php echo syExt('filesize') ?>,	//大小限制
		"onError": function (event,queueId,fileObj,errorObj){
				$("#err").empty();$("#fileQueue").empty();
				if(errorObj.type=="File Size"){
					var fSizes = errorObj.info/1024;
					$("#err").append("文件大小不能超过"+fSizes+"K");
				}else{
					$("#err").append("上传出错，请重新操作");
				}
		},
		'onOpen': function (){
				$("#err").empty();
				$("#err").append("<img src='include/js/uploadify/loading.gif' />");
		},
		'onComplete': function (event, queueID, fileObj, response, data){
				var strs=response.split(",");
				$("#err").empty();
				if(strs[0]!=0){
					$("#fileQueue").empty();
					$("#err").append(strs[0]);
				}else{
					$("#image").attr("value",strs[1]);
				}
		}
	});
});
</script>
</head>

<body>
<div class="maintop">当前位置：<?php echo $toptxt ?></div>
<?php if($Gets=='tadd' || $Gets=='tedit'){ ?>
    <div class="main"><div class="oper"><?php echo $opers ?></div>
        <div class="info">
        <form action="?c=ld_links&a=<?php echo $postgo ?>&run=1" method="post">
        <input name="taid" type="hidden" value="<?php echo $d['taid'] ?>" />
        <dl><dt>链接分类名称：</dt><dd><input name="name" type="text" class="int" value="<?php echo $d['name'] ?>" /></dd></dl>
        <dl><dt>&nbsp;</dt><dd><input type="submit" value="提 交" class="btnbig" /></dd></dl>
        </form>
        </div>
    </div>
<?php } ?>
<?php if($Gets==''){ ?>
    <div class="main"><div class="oper"><?php echo $opers ?></div>
    <table width="100%" class="tablist">
      <tr class="trbg">
        <td width="40">ID</td>
        <td width="150">操作</td>
        <td>链接分类名称</td>
        <td width="220">链接分类操作</td>
      </tr>
    <?php foreach($lists as $v){ ?>
      <tr>
        <td><?php echo $v['taid']; ?></td>
        <td><a href="?c=ld_links&a=add&taid=<?php echo $v['taid']; ?>">添加链接</a>&nbsp;&nbsp;<a href="?c=ld_links&a=adlist&taid=<?php echo $v['taid']; ?>">链接管理</a></td>
        <td class="tdleft"><a href="?c=ld_links&a=adlist&taid=<?php echo $v['taid']; ?>"><?php echo $v['name']; ?></a></td>
        <td><a href="?c=ld_links&a=tedit&taid=<?php echo $v['taid']; ?>">编辑</a>&nbsp;&nbsp;<a href="?c=ld_links&a=tdel&taid=<?php echo $v['taid']; ?>">删除</a></td>
      </tr>
    <?php } ?>
    </table>
    </div>
<?php } ?>
<?php if($Gets=='add' || $Gets=='edit'){ ?>
    <div class="main"><div class="oper"><?php echo $opers ?></div>
        <div class="info">
        <form action="?c=ld_links&a=<?php echo $postgo ?>&run=1" method="post">
        <input name="id" type="hidden" value="<?php echo $d['id'] ?>" />
        <dl><dt>链接分类：</dt><dd><select name="taid">
          <option>选择所属链接分类</option>
          <?php foreach($linkstype as $v){ ?>
          <option value="<?php echo $v['taid'] ?>"<?php if($d['taid']==$v['taid']||$ctaid==$v['taid'])echo ' selected="selected"'; ?>><?php echo $v['name'] ?></option>
          <?php } ?>
        </select></dd></dl>
        <dl><dt>链接名称：</dt><dd><input name="name" type="text" class="int" value="<?php echo $d['name'] ?>" /></dd></dl>
        <dl><dt>图片：</dt><dd><input name="image" id="image" type="text" class="int" value="<?php echo $d['image'] ?>" /></dd><dd><input name="files" id="files" type="file" /></dd><dd id="err"></dd><dd id="fileQueue"></dd></dd></dl>
        <dl id="gourl"><dt>链接地址：</dt><dd><input name="gourl" type="text" class="int" value="<?php echo $d['gourl'] ?>" /></dd></dl>
        <dl><dt>排序：</dt><dd><input name="orders" type="text" class="int" style="width:30px;" value="<?php if($d!=''){echo $d['orders'];}else{echo '0';} ?>" /></dd><dd class="t">越大越靠前</dd></dl>
        <dl><dt>状态：</dt><dd><input name="isshow" type="radio" value="1"<?php if($d['isshow']==1||$Gets=='add')echo ' checked="checked"'; ?> />显示&nbsp;<input name="isshow" type="radio" value="0"<?php if($d['isshow']==0 && $Gets=='edit')echo ' checked="checked"'; ?> />关闭</dd></dl>
        <dl><dt>&nbsp;</dt><dd><input type="submit" value="提 交" class="btnbig" /></dd></dl>
        </form>
        </div>
    </div>
<?php } ?>
<?php if($Gets=='adlist'){ ?>
    <div class="main"><div class="oper"><?php echo $opers ?></div>
    <table width="100%" class="tablist">
      <tr class="trbg">
        <td width="40">ID</td>
        <td width="150">链接分类</td>
        <td width="150">图片</td>
        <td width="200">链接名称</td>
        <td>地址</td>
        <td width="120">操作</td>
      </tr>
    <?php foreach($lists as $v){ ?>
      <tr>
        <td><?php echo $v['id']; ?></td>
        <td><?php echo linktype($v['taid']); ?></td>
        <td><?php if($v['image']!=''){ ?><a href="?c=ld_links&a=edit&id=<?php echo $v['id']; ?>"><img src="<?php echo $v['image']; ?>" height="32" /></a><?php } ?></td>
        <td class="tdleft"><a href="?c=ld_links&a=edit&id=<?php echo $v['id']; ?>"><?php echo $v['name']; ?></a></td>
        <td class="tdleft"><?php echo $v['gourl']; ?></td>
        <td><a href="?c=ld_links&a=edit&id=<?php echo $v['id']; ?>">编辑</a>&nbsp;&nbsp;<a href="?c=ld_links&a=del&id=<?php echo $v['id']; ?>">删除</a></td>
      </tr>
    <?php } ?>
    </table>
    </div>
<?php } ?>
</body>
</html>
