<?php include $this->admin_tpl('meta');?>
<title>添加栏目 - YzmCMS内容管理系统</title>
</head>
<body>
<div class="page-container">
	<form class="form form-horizontal" method="" action="" onsubmit="return dosub(this)">
		<div id="tab_system" class="HuiTab">
			<div class="tabBar cl"><span>基本选项</span><span>其他设置</span></div>
			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>上级栏目：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<span class="select-box">
						 <?php echo select_category('parentid', $catid, '', 0, '', false, false); ?>
						</span>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>栏目名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="catname" value="" class="input-text" placeholder="例如：YzmCMS官网">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>链接地址：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="pclink" value="" class="input-text" placeholder="例如：http://www.yzmcms.com">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">栏目图片：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input class="input-text" type="text" name="catimg" style="width:400px" 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"><i class="Hui-iconfont">&#xe642;</i> 浏览文件</a>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">在导航显示：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<label class="label_radio"><input name="display" type="radio" value="1" checked> 是</label>
						<label class="label_radio"><input name="display" type="radio" value="0"> 否</label>
					</div>
				</div>		
			</div>
			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">栏目副标题：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="subtitle" value="" placeholder="栏目副标题可留空" class="input-text">
					</div>
				</div>	
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">手机版名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="mobname" value="" placeholder="手机版栏目名称，为空则与电脑端一致" class="input-text">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">手机版地址：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="moblink" value="" placeholder="手机版栏目地址，为空则为系统默认" class="input-text">
					</div>
				</div>	
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">栏目排序：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="listorder" value="0" class="input-text" style="width:200px">
					</div>
				</div>				
			</div>

		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<input type="hidden" name="dosubmit" value="1"><input type="hidden" name="type" value="<?php echo $type;?>">
				<input class="dosubmit w_120 btn-primary radius" type="submit" value="提交">
			 	<input class="btn w_120 btn-default radius h35" type="button" value="取消" onclick="yzmcms_close()">
			</div>
		</div>
	</form>
</div>

<?php include $this->admin_tpl('footer');?>

<script type="text/javascript">
function dosub(obj){
	if($("input[name='catname']").val()==''){
		layer.msg('栏目名称不能为空！');
		return false;
	}
	if($("input[name='pclink']").val()==''){
		layer.msg('链接地址不能为空！');
		return false;
	}
	$.ajax({
		type: 'POST',
		url: '<?php echo U('add');?>', 
		data: $(obj).serialize(),
		dataType: "json", 
		success: function (msg) {
			if(msg.status == 1){
				parent.location.reload();       
			}else{
				layer.msg(msg.message);
			}
		}
	})
	return false;		
}

$(function(){
	$.Huitab("#tab_system .tabBar span","#tab_system .tabCon","current","click","<?php echo isset($_GET['tab']) ? intval($_GET['tab']) : '0'?>");
});
</script>

</body>
</html>