<?php include $this->admin_tpl('meta', 'admin');?>
<title><?php echo L('edit_link');?> - YzmCMS内容管理系统</title>
</head>
<body>
<article class="page-container pad_bot_0">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)">
		<ul>
			 <li><label><span class="c-red">*</span>网站名称：</label>
			 	<input type="text" class="input" name="name" value="<?php echo $data['name'];?>">
			 </li>
			 <li><label><span class="c-red">*</span>网站网址：</label>
			 	<input type="text" class="input" value="<?php echo $data['url'];?>" name="url">
			 </li>	
			 <li><label>站长姓名：</label>
			 	<input type="text" class="input"  name="username" value="<?php echo $data['username'];?>">
			 </li>	
			 <li><label>站长邮箱：</label>
			 	<input type="email" class="input" name="email" value="<?php echo $data['email'];?>">
			 </li>
			 <li><label>链接类型：</label>
			 <span class="span_input">
			 	<label class="label_radio"><input name="linktype" type="radio" value="0" <?php if($data['linktype'] == 0) echo 'checked';?>> 文字链接</label>
			 	<label class="label_radio"><input name="linktype" type="radio" value="1" <?php if($data['linktype'] == 1) echo 'checked';?>> 图片链接</label>
			 </span>
			 </li>
			 <li><label>网站Logo：</label>
				<input class="input-text" type="text" name="logo" style="width:300px" id="uploadfile" value="<?php echo $data['logo'];?>" onmouseover="yzm_img_preview('uploadfile', this.value)"  onmouseout="layer.closeAll();">
				<a href="javascript:;" onclick="yzm_upload_att('<?php echo U('attachment/api/upload_box', array('module'=>ROUTE_M));?>')" class="btn btn-primary radius upload-btn"><i class="yzm-iconfont yzm-iconshangchuan"></i> 浏览文件</a>
			 </li>
			 <li>
			 <label>链接分类：</label>
			 <select  name="typeid" style="width:230px">
			   <option value="0" <?php if($data['typeid'] == 0) echo 'selected';?>>0-默认</option>			
			   <option value="1" <?php if($data['typeid'] == 1) echo 'selected';?>>1-首页</option>			
			   <option value="2" <?php if($data['typeid'] == 2) echo 'selected';?>>2-列表页</option>			
			   <option value="3" <?php if($data['typeid'] == 3) echo 'selected';?>>3-内容页</option>			
			 </select>
			 </li>
			 <li><label>网站介绍：</label>
			 	<span class="span_input"><textarea name="msg" class="textarea w_420"><?php echo $data['msg'];?></textarea></span>
			 </li>
			 <li class="yzm-explain-box"><label>排序：</label>
			 	<span class="span_input"><input type="text" class="input"  value="<?php echo $data['listorder'];?>" name="listorder" style="width:120px"></span>
			 	<span class="yzm-explain">由小到大排列</span>
			 </li>
			 <li><label>审核：</label>
			 <span class="span_input">
			 	<label class="label_radio"><input name="status" type="radio" value="1" <?php if($data['status'] == 1) echo 'checked';?>> 是</label>
			 	<label class="label_radio"><input name="status" type="radio" value="0" <?php if($data['status'] == 0) echo 'checked';?>> 否</label>
			 </span>
			 </li>			
			<li>
				<input type="hidden" name="id" value="<?php echo $data['id'];?>"><input type="hidden" name="dosubmit" value="1">
				<input class="dosubmit w_100 btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
				<input class="btn w_100 btn-default radius" type="button" value="取消" onclick="yzmcms_close()">
			</li>
		</ul>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer', 'admin');?>
<script type="text/javascript">
	function dosub(obj){
		 if(obj.name.value==''){
			 layer.msg('网站名称不能为空！', {icon:2});
			 return false;
		 }
		 if(obj.url.value=='' || obj.url.value=='http://'){
			 layer.msg('网站网址不能为空', {icon:2});
			 return false;
		 }
        $.ajax({
            type: 'POST',
            url: '<?php echo U('edit');?>', 
            data: $(obj).serialize(),
		    dataType: "json", 
            success: function (msg) {
				if(msg.status == 1){
					layer.msg(msg.message, {icon:1, time:800}, function(){
						parent.location.reload();
					});
			    }else{
					layer.msg(msg.message, {icon:2});
				}
            }
        })		 
		return false;			 
	}
</script> 

</body>
</html>