{extend name="public/base"/}
{block name="body"}
<div class="main-box clearfix">
<header class="main-box-header clearfix">
<div class="pull-left">
<h2>{:isset($info['id'])?'编辑':'新增'}分类</h2>
</div>
</header>
<div class="main-box-body clearfix">
<form action="{:url()}" method="post" class="form form-horizontal">
<div class="tabs-wrapper">
<ul class="nav nav-tabs">
<li class="active">
<a href="#tab-base" data-toggle="tab">基 础</a>
</li>
<li><a href="#tab-better" data-toggle="tab">高 级</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="tab-base">
<div class="form-group">
<label class="col-lg-2 control-label">上级分类</label>
<div class="col-lg-8">
<input type="hidden" name="pid" value="{$category['id']|default=0}">
<input type="text" class="form-control" disabled="disabled" value="{$category['title']|default='无'}"/>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">分类名称</label>
<div class="col-lg-8">
<input type="text" name="title" class="form-control" value="{$info.title|default=''}">
<span class="help-block">(名称不能为空)</span>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">分类标识</label>
<div class="col-lg-8">
<input type="text" name="name" class="form-control" value="{$info.name|default=''}">
<span class="help-block">(英文字母)</span>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">分组定义</label>
<div class="col-lg-8">
<textarea name="groups" class="form-control">{$info.groups|default=''}</textarea>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">发布内容</label>
<div class="col-lg-8">
<label class="am-radio-inline"><input type="radio" name="allow_publish" value="0">不允许</label>
<label class="am-radio-inline"><input type="radio" name="allow_publish" value="1" checked>仅允许后台</label>
<label class="am-radio-inline"><input type="radio" name="allow_publish" value="2" >允许前后台</label>
<span class="help-block">(是否允许发布内容)</span>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">
是否审核
</label>
<div class="col-lg-8">
<label class="am-radio-inline"><input type="radio" name="check" value="0" checked>不需要</label>
<label class="am-radio-inline"><input type="radio" name="check" value="1">需要</label>
<span class="help-block">(在该分类下发布的内容是否需要审核)</span>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">分类图标</label>
<div class="col-lg-8">
{:widget('common/Form/show',array(array('name'=>'icon','type'=>'image'),$info))}
</div>
</div>
</div>
<div class="tab-pane fade" id="tab-better">
<div class="form-group">
<label class="col-lg-2 control-label">可见性</label>
<div class="col-lg-3">
<select name="display" class="form-control">
<option value="1">所有人可见</option>
<option value="0">不可见</option>
<option value="2">管理员可见</option>
</select>
<span class="help-block">(是否对用户可见,针对前台)</span>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">排序</label>
<div class="col-lg-2">
<input type="text" name="sort" class="form-control" value="{$info.sort|default=0}">
<span class="help-block">(仅对当前层级分类有效)</span>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">列表行数</label>
<div class="col-lg-5">
<input type="text" name="list_row" class="form-control" value="{$info.list_row|default=10}">
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">网页标题</label>
<div class="col-lg-8">
<input type="text" name="meta_title" class="form-control" value="{$info.meta_title|default=''}">
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">关键字</label>
<div class="col-lg-8">
<textarea class="form-control" name="keywords">{$info.keywords|default=''}</textarea>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">描述</label>
<div class="col-lg-8">
<textarea class="form-control" name="description">{$info.description|default=''}</textarea>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">频道模板</label>
<div class="col-lg-8">
<input type="text" name="template_index" class="form-control" value="{$info.template_index|default=''}">
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">列表模板</label>
<div class="col-lg-8">
<input type="text" name="template_lists" class="form-control" value="{$info.template_lists|default=''}">
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">详情模板</label>
<div class="col-lg-8">
<input type="text" name="template_detail" class="form-control" value="{$info.template_detail|default=''}">
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">编辑模板</label>
<div class="col-lg-8">
<input type="text" name="template_edit" class="form-control" value="{$info.template_edit|default=''}">
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<input type="hidden" name="id" value="{$info['id']|default=''}">
<button type="submit" class="btn btn-success submit-btn ajax-post" target-form="form">确认提交</button>
<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
</div>
</div>
</form>
</div>
</div>
{/block}
{block name="script"}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/webuploader/webuploader.css">
<script type="text/javascript" src="__PUBLIC__/plugs/webuploader/webuploader.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugs/webuploader/webuploader.custom.js"></script>
<script type="text/javascript">
{present name="info['id']"}
Sent.setValue("allow_publish", {$info.allow_publish|default=1});
Sent.setValue("check", {$info.check|default=0});
Sent.setValue("model[]", {$info.model|json_encode} || [1]);
Sent.setValue("model_sub[]", {$info.model_sub|json_encode} || [1]);
Sent.setValue("type[]", {$info.type|json_encode} || [2]);
Sent.setValue("display", {$info.display|default=1});
Sent.setValue("reply", {$info.reply|default=0});
Sent.setValue("reply_model[]", {$info.reply_model|json_encode} || [1]);
{/present}
$(function(){
$("input[name=reply]").change(function(){
var $reply = $(".form-group.reply");
parseInt(this.value) ? $reply.show() : $reply.hide();
}).filter(":checked").change();
});
</script>
{/block}
{extend name="public/base"/}
{block name="style"}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/bootstrap-editable.css">
{/block}
{block name="body"}
<div class="main-box no-header clearfix">
<header class="main-box-header clearfix">
<div class="pull-left">
<h2>{$meta_title}</h2>
</div>
<div class="pull-right">
<a class="btn btn-primary" href="{:url('add')}"><i class="fa fa-plus-circle fa-lg"></i> 新 增</a>
</div>
</header>
<div class="main-box-body clearfix">
<!-- 表格列表 -->
<div class="table-responsive clearfix">
<table class="table table-hover">
<thead>
<tr>
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
<th width="60">ID</th>
<th>名称</th>
<th width="120">排序</th>
<th width="120">发布</th>
<th width="120">状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{volist name="tree" id="list"}
<tr>
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$list.id}"></td>
<td>{$list['id']}</td>
<td>
{$list['level_show']}
<a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="title" data-type="text" data-pk="{$list['id']}" data-url="{:url('editable')}">{$list['title']}</a>
<a class="add-sub-cate" title="添加子分类" href="{:url('add?pid='.$list['id'])}">
<i class="fa fa-plus-square"></i>
</a>
</td>
<td><a href="#" class="editable editable-click" data-id="{$list['id']}" data-name="sort" data-type="text" data-pk="{$list['id']}" data-url="{:url('editable')}">{$list['sort']}</a></td>
<td>{$list['allow_publish']?'是':'否'}</td>
<td>
{if $list['status']}
<span class="label label-primary">启用</span>
{else/}
<span class="label label-danger">禁用</span>
{/if}
</td>
<td>
<a title="编辑" href="{:url('edit?id='.$list['id'].'&pid='.$list['pid'])}">编辑</a>
{if $list['status']}
<a href="{:url('status?id='.$list['id'].'&status=0')}" class="ajax-get">禁用</a>
{else/}
<a href="{:url('status?id='.$list['id'].'&status=1')}" class="ajax-get">启用</a>
{/if}
<a title="删除" href="{:url('remove?id='.$list['id'])}" class="confirm ajax-get">删除</a>
<a title="移动" href="{:url('operate?type=move&from='.$list['id'])}">移动</a>
<a title="合并" href="{:url('operate?type=merge&from='.$list['id'])}">合并</a>
</td>
</tr>
{/volist}
</tbody>
</table>
</div>
<!-- /表格列表 -->
</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable.min.js"></script>
<script type="text/javascript">