重新定义模型
This commit is contained in:
@@ -46,19 +46,7 @@ class Attribute extends Admin {
|
||||
* @author colin <colin@tensent.cn>
|
||||
*/
|
||||
public function index($model_id = null) {
|
||||
$map['model_id'] = $model_id;
|
||||
if (!$model_id) {
|
||||
return $this->error("非法操作!");
|
||||
}
|
||||
|
||||
$list = model('Attribute')->where($map)->order('id desc')->paginate(25);
|
||||
|
||||
$data = array(
|
||||
'list' => $list,
|
||||
'model_id' => $model_id,
|
||||
'page' => $list->render(),
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->getAttributeList($model_id);
|
||||
$this->setMeta('字段管理');
|
||||
return $this->fetch();
|
||||
}
|
||||
@@ -120,13 +108,15 @@ class Attribute extends Admin {
|
||||
* @var delattr 是否删除字段表里的字段
|
||||
* @author colin <colin@tensent.cn>
|
||||
*/
|
||||
public function del() {
|
||||
$id = input('id', '', 'trim,intval');
|
||||
public function del(\think\Request $request) {
|
||||
$id = $request->param('id');
|
||||
$model_id = $request->param('model_id');
|
||||
|
||||
if (!$id) {
|
||||
return $this->error("非法操作!");
|
||||
}
|
||||
|
||||
$result = $this->model->del($id);
|
||||
$result = $this->model->del($id, $model_id);
|
||||
if ($result) {
|
||||
return $this->success("删除成功!");
|
||||
} else {
|
||||
@@ -134,6 +124,47 @@ class Attribute extends Admin {
|
||||
}
|
||||
}
|
||||
|
||||
public function generate($id = '') {
|
||||
if ($id) {
|
||||
$model = model('Model')->where('id', $id)->find();
|
||||
$result = $this->model->generate($model);
|
||||
if (false !== $result) {
|
||||
return $this->success('生成成功!', url('admin/model/index'));
|
||||
} else {
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
} else {
|
||||
return $this->error('非法操作!');
|
||||
}
|
||||
}
|
||||
|
||||
public function insert(\think\Request $request) {
|
||||
if (IS_POST) {
|
||||
$model_id = $request->param('id');
|
||||
$attr = db('Model')->where('id', $model_id)->value('attribute_list');
|
||||
$attr = explode(',', $attr);
|
||||
$post = $request->post();
|
||||
$attribute = array_merge($attr, $post['id']);
|
||||
|
||||
$data = array(
|
||||
'attribute_list' => implode(',', $attribute),
|
||||
'table_status' => 2,
|
||||
'status' => 0,
|
||||
);
|
||||
$result = db('Model')->where('id', $model_id)->update($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('成功导入!');
|
||||
}else{
|
||||
return $this->error('导入失败!');
|
||||
}
|
||||
} else {
|
||||
$this->getAttributeList();
|
||||
$this->assign('id', $request->param('id'));
|
||||
$this->setMeta('导入字段');
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
//字段编辑所需字段
|
||||
protected function getField() {
|
||||
return array(
|
||||
@@ -161,4 +192,21 @@ class Attribute extends Admin {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
protected function getAttributeList($model_id = '') {
|
||||
$map = array();
|
||||
if ($model_id) {
|
||||
$attribute = db('Model')->where('id', $model_id)->value('attribute_list');
|
||||
$map['id'] = array('IN', $attribute);
|
||||
}
|
||||
|
||||
$list = model('Attribute')->where($map)->order('id desc')->paginate(25);
|
||||
|
||||
$data = array(
|
||||
'list' => $list,
|
||||
'model_id' => $model_id,
|
||||
'page' => $list->render(),
|
||||
);
|
||||
$this->assign($data);
|
||||
}
|
||||
}
|
||||
@@ -16,20 +16,13 @@ class Content extends Admin {
|
||||
parent::_initialize();
|
||||
$this->getContentMenu();
|
||||
$this->model_id = $model_id = $this->request->param('model_id');
|
||||
$row = db('Model')->select();
|
||||
foreach ($row as $key => $value) {
|
||||
$list[$value['id']] = $value;
|
||||
}
|
||||
$list = db('Model')->column('*', 'id');
|
||||
|
||||
if (empty($list[$model_id])) {
|
||||
return $this->error("无此模型!");
|
||||
} else {
|
||||
$this->modelInfo = $list[$model_id];
|
||||
if ($this->modelInfo['extend'] > 1) {
|
||||
$this->model = model('Content')->extend($this->modelInfo['name']);
|
||||
} else {
|
||||
$this->model = model('Document')->extend($this->modelInfo['name']);
|
||||
}
|
||||
$this->model = model('Content')->extend($this->modelInfo['name']);
|
||||
}
|
||||
|
||||
$this->assign('model_id', $model_id);
|
||||
@@ -49,11 +42,7 @@ class Content extends Admin {
|
||||
$order = "id desc";
|
||||
$map = $this->buildMap();
|
||||
$field = array_filter($grid_list['fields']);
|
||||
if ($this->modelInfo['extend'] == 1) {
|
||||
array_push($field, 'is_top');
|
||||
} else {
|
||||
unset($map['model_id']);
|
||||
}
|
||||
|
||||
|
||||
$list = $this->model->lists($map, $order);
|
||||
|
||||
@@ -247,7 +236,7 @@ class Content extends Admin {
|
||||
*/
|
||||
protected function buildMap() {
|
||||
$map = array();
|
||||
$data = $this->request->get();
|
||||
$data = $this->request->param();
|
||||
foreach ($data as $key => $value) {
|
||||
if ($value) {
|
||||
if ($key == 'keyword') {
|
||||
@@ -264,12 +253,6 @@ class Content extends Admin {
|
||||
if (isset($map['page'])) {
|
||||
unset($map['page']);
|
||||
}
|
||||
if ($this->modelInfo['extend'] == 1) {
|
||||
$category = isset($data['category']) ? $data['category'] : '';
|
||||
$cate_list = parse_field_bind('category', $category, 0);
|
||||
$map['model_id'] = $this->model_id;
|
||||
$this->assign('cate_list', $cate_list);
|
||||
}
|
||||
$this->assign($data);
|
||||
return $map;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ class Model extends Admin {
|
||||
public function _initialize() {
|
||||
parent::_initialize();
|
||||
$this->getContentMenu();
|
||||
$this->model = model('Model');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,7 +26,7 @@ class Model extends Admin {
|
||||
$map = array('status' => array('gt', -1));
|
||||
|
||||
$order = "id desc";
|
||||
$list = model('Model')->where($map)->order($order)->paginate(10);
|
||||
$list = $this->model->where($map)->order($order)->paginate(10);
|
||||
|
||||
$data = array(
|
||||
'list' => $list,
|
||||
@@ -44,75 +45,73 @@ class Model extends Admin {
|
||||
* 新增页面初始化
|
||||
* @author huajie <banhuajie@163.com>
|
||||
*/
|
||||
public function add() {
|
||||
|
||||
//获取所有的模型
|
||||
$models = db('Model')->where(array('extend' => 0))->field('id,title')->select();
|
||||
|
||||
$this->assign('models', $models);
|
||||
$this->setMeta('新增模型');
|
||||
return $this->fetch();
|
||||
public function add(\think\Request $request) {
|
||||
if (IS_POST) {
|
||||
$result = $this->model->validate('Model.add')->save($request->post());
|
||||
if (false !== $result) {
|
||||
$this->success('创建成功!', url('admin/model/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$this->setMeta('新增模型');
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑页面初始化
|
||||
* @author huajie <banhuajie@163.com>
|
||||
* @author molong <molong@tensent.cn>
|
||||
*/
|
||||
public function edit() {
|
||||
$id = input('id', '', 'trim,intval');
|
||||
if (empty($id)) {
|
||||
return $this->error('参数不能为空!');
|
||||
}
|
||||
|
||||
/*获取一条记录的详细数据*/
|
||||
$model = model('Model');
|
||||
$data = $model::find($id);
|
||||
if (!$data) {
|
||||
return $this->error($Model->getError());
|
||||
}
|
||||
$data['attribute_list'] = empty($data['attribute_list']) ? '' : explode(",", $data['attribute_list']);
|
||||
|
||||
// 是否继承了其他模型
|
||||
if ($data['extend'] == 1) {
|
||||
$map['model_id'] = array('IN', array($data['id'], $data['extend']));
|
||||
} else {
|
||||
$map['model_id'] = $data['id'];
|
||||
}
|
||||
$map['is_show'] = 1;
|
||||
$fields = db('Attribute')->where($map)->select();
|
||||
|
||||
// 梳理属性的可见性
|
||||
foreach ($fields as $key => $field) {
|
||||
if (!empty($data['attribute_list']) && !in_array($field['id'], $data['attribute_list'])) {
|
||||
$field['is_show'] = 0;
|
||||
public function edit(\think\Request $request) {
|
||||
if (IS_POST) {
|
||||
$result = $this->model->validate('Model.edit')->save($request->post(), array('id'=>$request->post('id')));
|
||||
if (false !== $result) {
|
||||
$this->success('更新成功!', url('admin/model/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
$field['group'] = -1;
|
||||
$field['sort'] = 0;
|
||||
$fields_tem[$field['id']] = $field;
|
||||
}
|
||||
}else{
|
||||
$info = $this->model->where('id', $request->param('id'))->find();
|
||||
|
||||
// 获取模型排序字段
|
||||
$field_sort = json_decode($data['field_sort'], true);
|
||||
if (!empty($field_sort)) {
|
||||
foreach ($field_sort as $group => $ids) {
|
||||
foreach ($ids as $key => $value) {
|
||||
if (!empty($fields_tem[$value])) {
|
||||
$fields_tem[$value]['group'] = $group;
|
||||
$fields_tem[$value]['sort'] = $key;
|
||||
//获取字段列表
|
||||
if ($info['attribute_list']) {
|
||||
$fields = model('Attribute')->where('id', 'IN', $info['attribute_list'])->where('is_show', 1)->select();
|
||||
// 梳理属性的可见性
|
||||
foreach ($fields as $key => $field) {
|
||||
$field['group'] = -1;
|
||||
$field['sort'] = 0;
|
||||
$fields_tem[$field['id']] = $field->toArray(); //数据对象转换为数组
|
||||
}
|
||||
|
||||
// 获取模型排序字段
|
||||
$field_sort = json_decode($info['attribute_sort'], true);//dump($field_sort);exit();
|
||||
if (!empty($field_sort)) {
|
||||
foreach ($field_sort as $group => $ids) {
|
||||
foreach ($ids as $key => $value) {
|
||||
if (!empty($fields_tem[$value])) {
|
||||
$fields_tem[$value]['group'] = $group;
|
||||
$fields_tem[$value]['sort'] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($fields_tem) && $fields_tem) {
|
||||
// 模型字段列表排序
|
||||
$fields = list_sort_by($fields_tem, "sort");
|
||||
}
|
||||
}else{
|
||||
$fields = array();
|
||||
}
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'fields' => $fields
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta('编辑模型');
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
if (isset($fields_tem) && $fields_tem) {
|
||||
// 模型字段列表排序
|
||||
$fields = list_sort_by($fields_tem, "sort");
|
||||
}
|
||||
|
||||
$this->assign('fields', $fields);
|
||||
$this->assign('info', $data);
|
||||
$this->setMeta('编辑模型');
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,12 +119,11 @@ class Model extends Admin {
|
||||
* @author huajie <banhuajie@163.com>
|
||||
*/
|
||||
public function del() {
|
||||
$mdoel = model('Model');
|
||||
$result = $mdoel->del();
|
||||
$result = $this->model->del();
|
||||
if ($result) {
|
||||
return $this->success('删除模型成功!');
|
||||
} else {
|
||||
return $this->error($mdoel->getError());
|
||||
return $this->error($this->mdoel->getError());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,24 +144,27 @@ class Model extends Admin {
|
||||
* 更新数据
|
||||
* @author colin <colin@tensent.cn>
|
||||
*/
|
||||
public function status() {
|
||||
$map['id'] = $this->request->param('ids');
|
||||
if (null == $map['id']) {
|
||||
public function status(\think\Request $request) {
|
||||
$map['id'] = $request->param('id');
|
||||
|
||||
$data['status'] = $request->param('status');
|
||||
|
||||
if (null == $map['id'] || null == $data['status']) {
|
||||
return $this->error('参数不正确!');
|
||||
}
|
||||
|
||||
$data['status'] = input('get.status');
|
||||
|
||||
if (null == $data['status']) {
|
||||
//实现单条数据数据修改
|
||||
$status = db('Model')->where($map)->field('status')->find();
|
||||
$data['status'] = $status['status'] ? 0 : 1;
|
||||
db('Model')->where($map)->update($data);
|
||||
} else {
|
||||
//实现多条数据同时修改
|
||||
$map['id'] = array('IN', $map['id']);
|
||||
db('Model')->where($map)->update($data);
|
||||
$model = $this->model->where($map)->find();
|
||||
if ($model['table_status'] != 1 && $data['status'] == 1) {
|
||||
return $this->error('数据表未创建或更新');
|
||||
}
|
||||
if ($model['list_grid'] == '' && $data['status'] == 1) {
|
||||
return $this->error('模型列表未定义');
|
||||
}
|
||||
$result = $this->model->where($map)->update($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('状态设置成功!');
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
return $this->success('状态设置成功!');
|
||||
}
|
||||
}
|
||||
@@ -7270,4 +7270,6 @@ to {
|
||||
padding-left:48px;
|
||||
}
|
||||
}
|
||||
span.reloadverify{padding: 0; overflow: hidden; cursor: pointer;}
|
||||
span.reloadverify{padding: 0; overflow: hidden; cursor: pointer;}
|
||||
.footer-bar{position: fixed; bottom: 0; left: 0; right: 0; background: #fff; overflow: hidden; padding: 10px; text-align: right; z-index: 10000;}
|
||||
.dialog-body{padding: 10px; padding-bottom: 60px;}
|
||||
@@ -6,9 +6,13 @@
|
||||
<h2>{$meta_title}</h2>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-info" href="{:url('Model/index')}">返回</a>
|
||||
<a class="btn btn-primary" href="{:url('add',array('model_id'=>$model_id))}">新 增</a>
|
||||
<button class="btn btn-danger ajax-post confirm" url="{:url('del')}" target-form="ids">删 除</button>
|
||||
<a class="btn btn-danger" href="{:url('add',array('model_id'=>$model_id))}"><i class="fa fa-plus"></i> 新 增</a>
|
||||
{if $model_id}
|
||||
<button class="btn btn-primary openDilog" url="{:url('insert?id='.$model_id)}">导入字段</button>
|
||||
<button class="btn btn-primary ajax-get" url="{:url('generate?id='.$model_id)}">生成数据库</button>
|
||||
{/if}
|
||||
<!-- <button class="btn btn-danger ajax-post confirm" url="{:url('del')}" target-form="ids"><i class="fa fa-remove"></i> 删 除</button> -->
|
||||
<a class="btn btn-warning" href="{:url('Model/index')}"><i class="fa fa-reply"></i> 返回</a>
|
||||
</div>
|
||||
</header>
|
||||
<div class="main-box-body clearfix">
|
||||
@@ -36,7 +40,7 @@
|
||||
<td>{$item['value']}</td>
|
||||
<td>
|
||||
<a href="{:url('edit',array('id'=>$item['id']))}">编辑</a>
|
||||
<a href="{:url('del',array('id'=>$item['id']))}" class="confirm ajax-get">删除</a>
|
||||
<a href="{:url('del',array('id'=>$item['id'], 'model_id'=>$model_id))}" class="confirm ajax-get">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
@@ -46,4 +50,19 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="script"}
|
||||
<script type="text/javascript" src="__PUBLIC__/plugs/layer/layer.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('.openDilog').click(function(){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
area: ['900px', '560px'],
|
||||
content: $('.openDilog').attr('url')
|
||||
});
|
||||
});
|
||||
})
|
||||
</script>
|
||||
{/block}
|
||||
60
application/admin/view/attribute/insert.html
Normal file
60
application/admin/view/attribute/insert.html
Normal file
@@ -0,0 +1,60 @@
|
||||
{include file="admin@public/header" /}
|
||||
<div class="dialog-body">
|
||||
<div class="main-box clearfix">
|
||||
<header class="main-box-header clearfix">
|
||||
<div class="pull-left">
|
||||
<h2>{$meta_title}</h2>
|
||||
</div>
|
||||
</header>
|
||||
<div class="main-box-body clearfix">
|
||||
<div class="table-responsive clearfix">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input class="checkbox check-all" type="checkbox"></th>
|
||||
<th>表单标题</th>
|
||||
<th>字段名</th>
|
||||
<th>字段类型</th>
|
||||
<th>字段长度</th>
|
||||
<th>默认值</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="list" id="item"}
|
||||
<tr>
|
||||
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$item['id']}"></td>
|
||||
<td>{$item['title']}</td>
|
||||
<td>{$item['name']}</td>
|
||||
<td>{$item['type_text']}</td>
|
||||
<td>{$item['length']}</td>
|
||||
<td>{$item['value']}</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
{$page}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer-bar">
|
||||
<button class="btn btn-primary insert-btn">确认导入</button>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
|
||||
//关闭iframe
|
||||
$('button.insert-btn').click(function(){
|
||||
$.ajax({
|
||||
url : "{:url('admin/attribute/insert?id='.$id)}",
|
||||
data : $('input.ids:checked').serialize(),
|
||||
type : "POST",
|
||||
success : function(res){
|
||||
if (res.code == 1) {
|
||||
parent.layer.close(index);
|
||||
}
|
||||
},
|
||||
dataType : 'json'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{include file="admin@public/footer" /}
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="main-box-body clearfix">
|
||||
|
||||
<!-- 表单 -->
|
||||
<form id="form" action="{:url('update')}" method="post" class="form-horizontal form">
|
||||
<form id="form" method="post" class="form-horizontal form">
|
||||
<!-- 基础 -->
|
||||
<div id="tab1" class="tab-pane in tab1">
|
||||
<div class="form-group">
|
||||
@@ -29,50 +29,6 @@
|
||||
<span class="help-block">(请输入模型的名称)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型类型</label>
|
||||
<div class="col-lg-3 col-sm-10">
|
||||
<select name="extend" class="form-control" style="width:auto">
|
||||
<option value="2">独立模型</option>
|
||||
<option value="1" selected="selected">文档模型</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-3 col-sm-10">
|
||||
<select name="engine_type" class="form-control" style="width:auto">
|
||||
<option value="MyISAM">MyISAM</option>
|
||||
<option value="InnoDB">InnoDB</option>
|
||||
<option value="MEMORY">MEMORY</option>
|
||||
<option value="BLACKHOLE">BLACKHOLE</option>
|
||||
<option value="MRG_MYISAM">MRG_MYISAM</option>
|
||||
<option value="ARCHIVE">ARCHIVE</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-10">
|
||||
<select name="need_pk" class="form-control" style="width:auto">
|
||||
<option value="1" selected="selected">是</option>
|
||||
<option value="0">否</option>
|
||||
</select>
|
||||
<span class="help-block">(选“是”则会新建默认的id字段作为主键)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">是否会员显示</label>
|
||||
<div class="col-lg-10">
|
||||
<select name="is_user_show" class="form-control" style="width:auto">
|
||||
<option value="1" selected="selected">是</option>
|
||||
<option value="0">否</option>
|
||||
</select>
|
||||
<span class="help-block">(选“是”则会新建默认的id字段作为主键)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型图标</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
@@ -85,7 +41,6 @@
|
||||
<!-- 按钮 -->
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-2 col-lg-10">
|
||||
<input type="hidden" name="id" value="{$info.id|default=''}">
|
||||
<button class="btn btn-success submit-btn ajax-post" type="submit" target-form="form-horizontal">确 定</button>
|
||||
<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||
</div>
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
<div class="main-box clearfix">
|
||||
<header class="main-box-header clearfix">
|
||||
<div class="pull-left">
|
||||
<h2>{if condition="ACTION_NAME eq 'add'"}新增{else/}编辑{/if}模型</h2>
|
||||
<h2>编辑模型</h2>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
</header>
|
||||
<div class="main-box-body clearfix">
|
||||
<form id="form" action="{:url('update')}" method="post" class="form form-horizontal">
|
||||
<form id="form" method="post" class="form form-horizontal">
|
||||
<div class="tabs-wrapper">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#tab1" data-toggle="tab">基 础</a></li>
|
||||
@@ -25,7 +25,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型标识</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control disabled" name="name" value="{$info.name}" disabled>
|
||||
<input type="text" class="form-control disabled" name="name" value="{$info['name']}" disabled>
|
||||
<span class="help-block">(请输入文档模型标识)</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -36,27 +36,6 @@
|
||||
<span class="help-block">(请输入模型的名称)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型类型</label>
|
||||
<div class="col-lg-3 col-sm-10">
|
||||
<select name="extend" class="form-control disabled" readonly disabled>
|
||||
<option value="0" {if condition="$info['extend'] eq '0'"}selected{/if}>--请选择--</option>
|
||||
<option value="1" {if condition="$info['extend'] eq '1'"}selected{/if}>文档模型</option>
|
||||
<option value="2" {if condition="$info['extend'] eq '2'"}selected{/if}>独立模型</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-10">
|
||||
<select name="is_user_show" class="form-control" style="width:auto">
|
||||
<option value="1" {if $info['is_user_show'] ==1}selected="selected"{/if}>是</option>
|
||||
<option value="0" {if $info['is_user_show'] ==0}selected="selected"{/if}>否</option>
|
||||
</select>
|
||||
<span class="help-block">(选“是”则会新建默认的id字段作为主键)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">模型图标</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
@@ -70,21 +49,21 @@
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">字段别名定义</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<textarea name="attribute_alias" class="form-control">{$info.attribute_alias}</textarea>
|
||||
<textarea name="attribute_alias" class="form-control">{$info['attribute_alias']}</textarea>
|
||||
<span class="help-block">(用于表单显示的名称)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">表单显示分组</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control" name="field_group" value="{$info.field_group}">
|
||||
<input type="text" class="form-control" name="attribute_group" value="{$info['attribute_group']}">
|
||||
<span class="help-block">(用于表单显示的分组,以及设置该模型表单排序的显示)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">表单显示排序</label>
|
||||
<div class="col-lg-10 boards" id="field_group_sort">
|
||||
{volist name=":parse_field_attr($info['field_group'])" id="vo"}
|
||||
<div class="col-lg-10 boards" id="attribute_group_sort">
|
||||
{volist name=":parse_field_attr($info['attribute_group'])" id="vo"}
|
||||
<div class="board panel panel-info">
|
||||
<div class="panel-heading">{$vo}</div>
|
||||
<div class="panel-body">
|
||||
@@ -93,7 +72,7 @@
|
||||
{if (($field['group'] == -1) or ($field['group'] eq $key))}
|
||||
<div class="board-item">
|
||||
<span data="{$field['id']}">{$field['title']} [{$field['name']}]</span>
|
||||
<input type="hidden" name="field_sort[{$key}][]" value="{$field['id']}"/>
|
||||
<input type="hidden" name="attribute_sort[{$key}][]" value="{$field['id']}"/>
|
||||
</div>
|
||||
{php}
|
||||
unset($fields[$k]);
|
||||
@@ -112,7 +91,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">列表定义</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<textarea name="list_grid" class="form-control">{$info.list_grid}</textarea>
|
||||
<textarea name="list_grid" class="form-control">{$info['list_grid']}</textarea>
|
||||
<span class="help-block">(默认列表模板的展示规则)</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -120,14 +99,14 @@
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">默认搜索字段</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control" name="search_key" value="{$info.search_key}">
|
||||
<input type="text" class="form-control" name="search_key" value="{$info['search_key']}">
|
||||
<span class="help-block">(默认列表模板的默认搜索项)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 control-label">高级搜索字段</label>
|
||||
<div class="col-lg-6 col-sm-10">
|
||||
<input type="text" class="form-control" name="search_list" value="{$info.search_list}">
|
||||
<input type="text" class="form-control" name="search_list" value="{$info['search_list']}">
|
||||
<span class="help-block">(默认列表模板的高级搜索项)</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -180,11 +159,11 @@
|
||||
<script type="text/javascript" src="__PUBLIC__/plugs/board/board.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('.form-group #field_sort').boards();
|
||||
$('.form-group #field_group_sort').boards({
|
||||
$('.form-group #attribute_sort').boards();
|
||||
$('.form-group #attribute_group_sort').boards({
|
||||
drop: function(e){
|
||||
var group = e.target.closest('.board').find('.board-list').attr('data-group');
|
||||
e.element.find('input').attr('name','field_sort[' + group + '][]')
|
||||
e.element.find('input').attr('name','attribute_sort[' + group + '][]')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-success" href="{:url('Model/add')}">新 增</a>
|
||||
<button class="btn btn-info ajax-post" target-form="ids" url="{:url('Model/status',array('status'=>1))}">启 用</button>
|
||||
<button class="btn ajax-post" target-form="ids" url="{:url('Model/status',array('status'=>0))}">禁 用</button>
|
||||
</div>
|
||||
</header>
|
||||
@@ -36,7 +35,7 @@
|
||||
<input class="ids" type="checkbox" name="ids[]" value="{$item['id']}" />
|
||||
</td>
|
||||
<td>{$item['id']}</td>
|
||||
<td>{$item['name']}</td>
|
||||
<td><i class="fa fa-{$item['icon']}"></i> {$item['name']}</td>
|
||||
<td>
|
||||
<a data-id="{$item.id}" href="{:url('model/edit?id='.$item['id'])}">{$item.title}</a>
|
||||
</td>
|
||||
@@ -52,17 +51,15 @@
|
||||
</td>
|
||||
<td>
|
||||
<a href="{:url('admin/attribute/index?model_id='.$item['id'])}">字段</a>
|
||||
<a href="{:url('model/status?ids='.$item['id'].'&status='.abs(1-$item['status']))}" class="ajax-get">{$item['status']|show_status_op}</a>
|
||||
<a href="{:url('model/status?id='.$item['id'].'&status='.abs(1-$item['status']))}" class="ajax-get">{$item['status']|show_status_op}</a>
|
||||
<a href="{:url('model/edit?id='.$item['id'])}">编辑</a>
|
||||
<a href="{:url('model/del?id='.$item['id'])}" class="confirm ajax-get">删除</a>
|
||||
{if $item['extend']}
|
||||
<a href="{:url('admin/content/index?model_id='.$item['id'])}">数据</a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
{else/}
|
||||
<td colspan="7" class="text-center">aOh! 暂时还没有内容!</td>
|
||||
<td colspan="7" class="text-center">aOh! 暂时还没有创建模型!</td>
|
||||
{/notempty}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,28 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
<title>SentCMS网站管理系统后台</title>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/bootstrap/bootstrap.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/font-awesome.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/nanoscroller.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/common.css"/>
|
||||
<!-- <link href='//fonts.googleapis.com/css?family=Open+Sans:400,600,700,300|Titillium+Web:200,300,400' rel='stylesheet' type='text/css'> -->
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/style.css"/>
|
||||
<script src="__PUBLIC__/js/jquery.js"></script>
|
||||
<script type="text/javascript">
|
||||
var BASE_URL = "{:config('base_url')}"; //根目录地址
|
||||
</script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="__PUBLIC__/js/html5shiv.js"></script>
|
||||
<script src="__PUBLIC__/js/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
{include file="admin@public/header" /}
|
||||
{block name="style"}{/block}
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="theme-wrapper">
|
||||
<header class="navbar" id="header-navbar">
|
||||
<div class="container">
|
||||
@@ -232,28 +209,5 @@
|
||||
</div>
|
||||
</div>
|
||||
{include file="admin@public/tool" /}
|
||||
<script src="__PUBLIC__/js/bootstrap.js"></script>
|
||||
<script src="__PUBLIC__/js/jquery.nanoscroller.min.js"></script>
|
||||
<script src="__PUBLIC__/js/pace.min.js"></script>
|
||||
|
||||
<script src="__PUBLIC__/js/hopscotch.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/hopscotch.css">
|
||||
|
||||
<script src="__PUBLIC__/js/messager.js"></script>
|
||||
<script src="__JS__/app.js"></script>
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
var SentCMS = window.Sent = {
|
||||
"ROOT" : "__ROOT__", //当前网站地址
|
||||
"APP" : "__APP__", //当前项目地址
|
||||
"PUBLIC" : "__PUBLIC__", //项目公共目录地址
|
||||
"DEEP" : "{:config('URL_PATHINFO_DEPR')}", //PATHINFO分割符
|
||||
"MODEL" : ["{:config('URL_MODEL')}", "{:config('URL_CASE_INSENSITIVE')}", "{:config('URL_HTML_SUFFIX')}"],
|
||||
"VAR" : ["{:config('VAR_MODULE')}", "{:config('VAR_CONTROLLER')}", "{:config('VAR_ACTION')}"]
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<script src="__PUBLIC__/js/core.js"></script>
|
||||
{block name="script"}{/block}
|
||||
</body>
|
||||
</html>
|
||||
{include file="admin@public/footer" /}
|
||||
{block name="script"}{/block}
|
||||
24
application/admin/view/public/footer.html
Normal file
24
application/admin/view/public/footer.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<script src="__PUBLIC__/js/bootstrap.js"></script>
|
||||
<script src="__PUBLIC__/js/jquery.nanoscroller.min.js"></script>
|
||||
<script src="__PUBLIC__/js/pace.min.js"></script>
|
||||
|
||||
<script src="__PUBLIC__/js/hopscotch.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/hopscotch.css">
|
||||
|
||||
<script src="__PUBLIC__/js/messager.js"></script>
|
||||
<script src="__JS__/app.js"></script>
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
var SentCMS = window.Sent = {
|
||||
"ROOT" : "__ROOT__", //当前网站地址
|
||||
"APP" : "__APP__", //当前项目地址
|
||||
"PUBLIC" : "__PUBLIC__", //项目公共目录地址
|
||||
"DEEP" : "{:config('URL_PATHINFO_DEPR')}", //PATHINFO分割符
|
||||
"MODEL" : ["{:config('URL_MODEL')}", "{:config('URL_CASE_INSENSITIVE')}", "{:config('URL_HTML_SUFFIX')}"],
|
||||
"VAR" : ["{:config('VAR_MODULE')}", "{:config('VAR_CONTROLLER')}", "{:config('VAR_ACTION')}"]
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<script src="__PUBLIC__/js/core.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
23
application/admin/view/public/header.html
Normal file
23
application/admin/view/public/header.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
<title>SentCMS网站管理系统后台</title>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/bootstrap/bootstrap.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/font-awesome.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/libs/nanoscroller.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/common.css"/>
|
||||
<!-- <link href='//fonts.googleapis.com/css?family=Open+Sans:400,600,700,300|Titillium+Web:200,300,400' rel='stylesheet' type='text/css'> -->
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/style.css"/>
|
||||
<script src="__PUBLIC__/js/jquery.js"></script>
|
||||
<script type="text/javascript">
|
||||
var BASE_URL = "{:config('base_url')}"; //根目录地址
|
||||
</script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="__PUBLIC__/js/html5shiv.js"></script>
|
||||
<script src="__PUBLIC__/js/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
Reference in New Issue
Block a user