<?php include $this->admin_tpl('meta', 'admin');?>
<title><?php echo L('add_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=""></li>
			 <li><label><span class="c-red">*</span>网站网址：</label><input type="text" class="input" value="http://" name="url"></li>	
			 <li><label>站长姓名：</label><input type="text" class="input"  name="username"></li>	
			 <li><label>站长邮箱：</label><input type="email" class="input" name="email"></li>
			 <li><label>链接类型：</label>
			 <span class="span_input">
			 	<label class="label_radio"><input name="linktype" type="radio" value="0" checked> 文字链接</label>
			 	<label class="label_radio"><input name="linktype" type="radio" value="1" > 图片链接</label>
			 </span>
			 </li>
			 <li><label>网站Logo：</label>
				<input class="input-text" type="text" name="logo" style="width:300px" id="uploadfile" 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" style="height:30px;font-size: 14px"><i class="Hui-iconfont">&#xe642;</i> 浏览文件</a>
			 </li>
			 <li>
			 <label>链接分类：</label>
			 <select  name="typeid" class="select" style="width:230px">
			   <option value="0">0-默认</option>			
			   <option value="1">1-首页</option>			
			   <option value="2">2-列表页</option>			
			   <option value="3">3-内容页</option>			
			 </select>

			 </li>
			 <li><label>网站介绍：</label><span class="span_input"><textarea name="msg" class="textarea w_420"></textarea></span></li>
			 <li class="yzm-explain-box"><label>排序：</label><span class="span_input"><input type="text" class="input"  value="1" name="listorder" style="margin-left:0;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" checked> 是</label>
			 	<label class="label_radio"><input name="status" type="radio" value="0" > 否</label>
			 </span>
			 </li>			 
			<li>
				<input type="hidden" name="dosubmit" value="1">
			<input class="dosubmit w_120 btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			<input class="btn w_120 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('add');?>', 
            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>