<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>维护 - 文章管理 - S2M Admin</title>
		<meta name="description" content="overview &amp; stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<#include "/admin/include/cssjs_up.html" encoding="UTF-8"/>
	</head>

	<body>
		<#assign adminMenuPosFlag="articles">
		<#include "/admin/include/head.html" encoding="UTF-8"/>
		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>
			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>
				<#include "/admin/include/menu.html" encoding="UTF-8"/>
				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="icon-home home-icon"></i>
								<a href="/admin/">Home</a>
							</li>
							<li>
								<a href="/admin/articles/list/">文章管理</a>
							</li>
							<li class="active">维护</li>
						</ul><!-- .breadcrumb -->
					</div>

					<div class="page-content">
						<div class="page-header">
							<h1>
								信息维护
								<small>
									<i class="icon-double-angle-right"></i>
									文章管理
								</small>
							</h1>
						</div>
						<div class="row">
							<div class="col-xs-12">
								<form role="form" class="form-horizontal" method="post" onsubmit="return checkFormMan(this)">
									<div class="form-group">
										<label for="form-field-2" class="col-sm-3 control-label no-padding-right"> 标题： </label>
										<div class="col-sm-9">
											<input type="text" class="col-xs-10 col-sm-5" name="title" placeholder="title"  value="${bean.title}">
										</div>
									</div>
									<div class="space-4"></div>
									<div class="form-group">
										<label for="form-field-2" class="col-sm-3 control-label no-padding-right"> 链接地址： </label>
										<div class="col-sm-9">
											<input type="text" class="col-xs-10 col-sm-5" name="url" placeholder="url"  value="${bean.url}">
										</div>
									</div>
									<div class="space-4"></div>
									<div class="form-group">
										<label for="form-field-2" class="col-sm-3 control-label no-padding-right"> 摘要： </label>
										<div class="col-sm-9">
											<textarea class="col-xs-10 col-sm-5" name="profile" placeholder="profile">${bean.profile}</textarea>
										</div>
									</div>
									<div class="space-4"></div>
									<div class="form-group">
										<label for="form-field-2" class="col-sm-3 control-label no-padding-right"> 作者： </label>
										<div class="col-sm-9">
											<input type="text" class="col-xs-10 col-sm-5" name="author" placeholder="author"  value="${bean.author!"s2m"}">
										</div>
									</div>
									<div class="space-4"></div>
									<div class="form-group">
										<label for="form-field-2" class="col-sm-3 control-label no-padding-right"> 封面图片地址： </label>
										<div class="col-sm-9">
											<input type="text" class="col-xs-10 col-sm-5" name="pic" placeholder="pic"  value="${bean.pic}">
										</div>
									</div>
									<div class="space-4"></div>
									<div class="form-group">
										<label for="form-field-2" class="col-sm-3 control-label no-padding-right"> 类型： </label>
										<div class="col-sm-9">
											<select class="col-xs-10 col-sm-5" name="type">
												<option value="0" ${(bean.type == 0)?string("selected","")}>普通</option>
												<option value="1" ${(bean.type == 1)?string("selected","")}>推荐</option>
											</select>
										</div>
									</div>
									<div class="space-4"></div>
									<div class="form-group">
										<label for="form-field-2" class="col-sm-3 control-label no-padding-right"> 标签： </label>
										<div class="col-sm-9">
											<#list tags as test>
											<label class="checkbox-inline">
												<#assign checedFlag = false>
												<#list tagsSel as sel>
												<#if sel.tid == test.id>
												<#assign checedFlag = true>
												<#break>
												</#if>
												</#list>
											  <input name="tags" type="checkbox" ${checedFlag?string("checked","")} value="${test.id}"> ${test.name}
											</label>
											</#list>
										</div>
									</div>
									<div class="space-4"></div>
									<div class="form-group">
										<label for="form-field-2" class="col-sm-3 control-label no-padding-right"> 内容： </label>
										<div class="col-sm-9">
											<script type="text/plain" name="content" id="editor" style="width:100%;height:360px;">${content.content}</script>
										</div>
									</div>
									<div class="space-4"></div>
									<div class="clearfix form-actions">
										<div class="col-md-offset-3 col-md-9">
											<button type="submit" class="btn btn-info">
												<i class="icon-ok bigger-110"></i>
												Submit
											</button>
											<input type="hidden" name="id" value="${bean.id}" />
											<input type="hidden" name="token" value="${token}" />
											&nbsp; &nbsp; &nbsp;
											<button type="reset" class="btn">
												<i class="icon-undo bigger-110"></i>
												Reset
											</button>
										</div>
									</div>
								</form>
							</div><!-- /.col -->
						</div><!-- /.row -->
					</div><!-- /.page-content -->
				</div><!-- /.main-content -->
			</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->
		<#include "/admin/include/cssjs_down.html" encoding="UTF-8"/>
		<link href="/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
		<script type="text/javascript" charset="utf-8" src="/umeditor/umeditor.config.js"></script>
		<script type="text/javascript" charset="utf-8" src="/umeditor/umeditor.min.js"></script>
		<script type="text/javascript" src="/umeditor/lang/zh-cn/zh-cn.js"></script>
		<script type="text/javascript">
		function checkFormMan(obj){
			$.post("/admin/articles/save",$(obj).serialize(),function(result){
				if(result == "success"){
					location.href="/admin/articles/list/";
				}else{
					alert("保存失败" + result);
				}
			});
			return false;
		}
		$(function(){
			var um = UM.getEditor('editor');
		});
		</script>
	</body>
</html>