作者 sgj

添加插件

正在显示 69 个修改的文件 包含 4681 行增加1 行删除

要显示太多修改。

为保证性能只显示 69 of 69+ 个文件。

/nbproject/
/runtime/*
/addons/*
/application/admin/command/Install/*.lock
/public/assets/libs/
/public/assets/addons/*
... ...
<?php
namespace addons\cms;
use addons\cms\model\Archives;
use addons\cms\model\Channel;
use app\common\library\Auth;
use app\common\library\Menu;
use fast\Tree;
use think\Addons;
use think\Request;
use think\View;
/**
* CMS插件
*/
class Cms extends Addons
{
/**
* 插件安装方法
* @return bool
*/
public function install()
{
$menu = [
[
'name' => 'cms',
'title' => 'CMS管理',
'sublist' => [
[
'name' => 'cms/archives',
'title' => '内容管理',
'icon' => 'fa fa-file-text-o',
'sublist' => [
['name' => 'cms/archives/index', 'title' => '查看'],
['name' => 'cms/archives/content', 'title' => '副表管理', 'remark' => '用于管理模型副表的数据列表,不建议在此进行删除操作'],
['name' => 'cms/archives/add', 'title' => '添加'],
['name' => 'cms/archives/edit', 'title' => '修改'],
['name' => 'cms/archives/del', 'title' => '删除'],
['name' => 'cms/archives/multi', 'title' => '批量更新'],
]
],
[
'name' => 'cms/channel',
'title' => '栏目管理',
'icon' => 'fa fa-list',
'sublist' => [
['name' => 'cms/channel/index', 'title' => '查看'],
['name' => 'cms/channel/add', 'title' => '添加'],
['name' => 'cms/channel/edit', 'title' => '修改'],
['name' => 'cms/channel/del', 'title' => '删除'],
['name' => 'cms/channel/multi', 'title' => '批量更新'],
['name' => 'cms/channel/admin', 'title' => '栏目授权'],
],
'remark' => '用于管理网站的分类,可进行无限级分类,注意只有类型为列表的才可以添加文章'
],
[
'name' => 'cms/modelx',
'title' => '模型管理',
'icon' => 'fa fa-th',
'sublist' => [
['name' => 'cms/modelx/index', 'title' => '查看'],
['name' => 'cms/modelx/add', 'title' => '添加'],
['name' => 'cms/modelx/edit', 'title' => '修改'],
['name' => 'cms/modelx/del', 'title' => '删除'],
['name' => 'cms/modelx/multi', 'title' => '批量更新'],
[
'name' => 'cms/fields',
'title' => '字段管理',
'icon' => 'fa fa-fields',
'ismenu' => 0,
'sublist' => [
['name' => 'cms/fields/index', 'title' => '查看'],
['name' => 'cms/fields/add', 'title' => '添加'],
['name' => 'cms/fields/edit', 'title' => '修改'],
['name' => 'cms/fields/del', 'title' => '删除'],
['name' => 'cms/fields/multi', 'title' => '批量更新'],
],
'remark' => '用于管理模型或表单的字段,进行相关的增删改操作'
]
],
'remark' => '在线添加修改删除模型,管理模型字段和相关模型数据'
],
[
'name' => 'cms/tags',
'title' => '标签管理',
'icon' => 'fa fa-tags',
'sublist' => [
['name' => 'cms/tags/index', 'title' => '查看'],
['name' => 'cms/tags/add', 'title' => '添加'],
['name' => 'cms/tags/edit', 'title' => '修改'],
['name' => 'cms/tags/del', 'title' => '删除'],
['name' => 'cms/tags/multi', 'title' => '批量更新'],
],
'remark' => '用于管理文章关联的标签,标签的添加在添加文章时自动维护,无需手动添加标签'
],
[
'name' => 'cms/block',
'title' => '区块管理',
'icon' => 'fa fa-th-large',
'sublist' => [
['name' => 'cms/block/index', 'title' => '查看'],
['name' => 'cms/block/add', 'title' => '添加'],
['name' => 'cms/block/edit', 'title' => '修改'],
['name' => 'cms/block/del', 'title' => '删除'],
['name' => 'cms/block/multi', 'title' => '批量更新'],
],
'remark' => '用于管理站点的自定义区块内容,常用于广告、JS脚本、焦点图、片段代码等'
],
[
'name' => 'cms/page',
'title' => '单页管理',
'icon' => 'fa fa-file',
'sublist' => [
['name' => 'cms/page/index', 'title' => '查看'],
['name' => 'cms/page/add', 'title' => '添加'],
['name' => 'cms/page/edit', 'title' => '修改'],
['name' => 'cms/page/del', 'title' => '删除'],
['name' => 'cms/page/multi', 'title' => '批量更新'],
],
'remark' => '用于管理网站的单页面,可任意创建修改删除单页面'
],
[
'name' => 'cms/comment',
'title' => '评论管理',
'icon' => 'fa fa-comment',
'sublist' => [
['name' => 'cms/comment/index', 'title' => '查看'],
['name' => 'cms/comment/add', 'title' => '添加'],
['name' => 'cms/comment/edit', 'title' => '修改'],
['name' => 'cms/comment/del', 'title' => '删除'],
['name' => 'cms/comment/multi', 'title' => '批量更新'],
],
'remark' => '用于管理用户在网站上发表的评论,可任意修改或隐藏评论'
],
[
'name' => 'cms/diyform',
'title' => '自定义表单管理',
'icon' => 'fa fa-list',
'sublist' => [
['name' => 'cms/diyform/index', 'title' => '查看'],
['name' => 'cms/diyform/add', 'title' => '添加'],
['name' => 'cms/diyform/edit', 'title' => '修改'],
['name' => 'cms/diyform/del', 'title' => '删除'],
['name' => 'cms/diyform/multi', 'title' => '批量更新'],
],
'remark' => '可在线创建自定义表单,管理表单字段和数据列表'
],
[
'name' => 'cms/diydata',
'title' => '自定义表单数据管理',
'icon' => 'fa fa-list',
'ismenu' => 0,
'sublist' => [
['name' => 'cms/diydata/index', 'title' => '查看'],
['name' => 'cms/diydata/add', 'title' => '添加'],
['name' => 'cms/diydata/edit', 'title' => '修改'],
['name' => 'cms/diydata/del', 'title' => '删除'],
['name' => 'cms/diydata/multi', 'title' => '批量更新'],
],
'remark' => '可在线管理自定义表单的数据列表'
],
[
'name' => 'cms/order',
'title' => '订单管理',
'icon' => 'fa fa-cny',
'ismenu' => 1,
'sublist' => [
['name' => 'cms/order/index', 'title' => '查看'],
['name' => 'cms/order/add', 'title' => '添加'],
['name' => 'cms/order/edit', 'title' => '修改'],
['name' => 'cms/order/del', 'title' => '删除'],
['name' => 'cms/order/multi', 'title' => '批量更新'],
],
'remark' => '可在线管理付费查看所产生的订单'
]
]
]
];
Menu::create($menu);
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall()
{
Menu::delete('cms');
return true;
}
/**
* 插件启用方法
*/
public function enable()
{
Menu::enable('cms');
}
/**
* 插件禁用方法
*/
public function disable()
{
Menu::disable('cms');
}
/**
* 会员中心边栏后
* @return mixed
* @throws \Exception
*/
public function userSidenavAfter()
{
$request = Request::instance();
$actionname = strtolower($request->action());
$data = [
'actionname' => $actionname
];
return $this->fetch('view/hook/user_sidenav_after', $data);
}
}
... ...
<?php
namespace app\admin\controller\cms;
use app\common\controller\Backend;
/**
* Ajax
*
* @icon fa fa-circle-o
* @internal
*/
class Ajax extends Backend
{
/**
* 模型对象
*/
protected $model = null;
protected $noNeedRight = ['*'];
public function _initialize()
{
parent::_initialize();
}
/**
* 获取模板列表
* @internal
*/
public function get_template_list()
{
$files = [];
$keyValue = $this->request->request("keyValue");
if (!$keyValue) {
$type = $this->request->request("type");
$name = $this->request->request("name");
if ($name) {
//$files[] = ['name' => $name . '.html'];
}
//设置过滤方法
$this->request->filter(['strip_tags']);
$config = get_addon_config('cms');
$themeDir = ADDON_PATH . 'cms' . DS . 'view' . DS . $config['theme'] . DS;
$dh = opendir($themeDir);
while (false !== ($filename = readdir($dh))) {
if ($filename == '.' || $filename == '..')
continue;
if ($type) {
if (!preg_match("/^{$type}(.*)/i", $filename)) {
continue;
}
}
$files[] = ['name' => $filename];
}
} else {
$files[] = ['name' => $keyValue];
}
return $result = ['total' => count($files), 'list' => $files];
}
}
... ...
<?php
namespace app\admin\controller\cms;
use app\admin\model\cms\Channel;
use app\admin\model\cms\ChannelAdmin;
use app\admin\model\cms\Modelx;
use app\common\controller\Backend;
use fast\Tree;
use think\Db;
use think\db\Query;
/**
* 内容表
*
* @icon fa fa-circle-o
*/
class Archives extends Backend
{
/**
* Archives模型对象
*/
protected $model = null;
protected $noNeedRight = ['get_channel_fields', 'check_element_available'];
protected $channelIds = [];
protected $isSuperAdmin = false;
protected $searchFields = 'id,title';
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\cms\Archives;
//是否超级管理员
$this->isSuperAdmin = $this->auth->isSuperAdmin();
$channelList = [];
$disabledIds = [];
$all = collection(Channel::order("weigh desc,id desc")->select())->toArray();
//允许的栏目
$this->channelIds = $this->isSuperAdmin ? Channel::column('id') : ChannelAdmin::getAdminChanneIds();
$parentChannelIds = Channel::where('id', 'in', $this->channelIds)->column('parent_id');
foreach ($all as $k => $v) {
$state = ['opened' => true];
if ($v['type'] != 'list') {
$disabledIds[] = $v['id'];
}
if ($v['type'] == 'link') {
$state['checkbox_disabled'] = true;
}
if (!$this->isSuperAdmin) {
if (($v['type'] != 'list' && !in_array($v['id'], $parentChannelIds)) || ($v['type'] == 'list' && !in_array($v['id'], $this->channelIds))) {
unset($all[$k]);
continue;
}
}
$channelList[] = [
'id' => $v['id'],
'parent' => $v['parent_id'] ? $v['parent_id'] : '#',
'text' => __($v['name']),
'type' => $v['type'],
'state' => $state
];
}
$tree = Tree::instance()->init($all, 'parent_id');
$channelOptions = $tree->getTree(0, "<option value=@id @selected @disabled>@spacer@name</option>", '', $disabledIds);
$this->view->assign('channelOptions', $channelOptions);
$this->assignconfig('channelList', $channelList);
$this->view->assign("flagList", $this->model->getFlagList());
$this->view->assign("statusList", $this->model->getStatusList());
$cms = get_addon_config('cms');
$this->assignconfig('cms', ['archiveseditmode' => $cms['archiveseditmode']]);
}
/**
* 查看
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags']);
if ($this->request->isAjax()) {
$this->relationSearch = TRUE;
//如果发送的来源是Selectpage,则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
if (!$this->auth->isSuperAdmin()) {
$this->model->where('channel_id', 'in', $this->channelIds);
}
$total = $this->model
->with('Channel')
->where($where)
->order($sort, $order)
->count();
if (!$this->auth->isSuperAdmin()) {
$this->model->where('channel_id', 'in', $this->channelIds);
}
$list = $this->model
->with('Channel')
->where($where)
->order($sort, $order)
->limit($offset, $limit)
->select();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
$modelList = \app\admin\model\cms\Modelx::all();
$this->view->assign('modelList', $modelList);
return $this->view->fetch();
}
/**
* 副表内容
*/
public function content($model_id = null)
{
$model = \app\admin\model\cms\Modelx::get($model_id);
if (!$model) {
$this->error('未找到对应模型');
}
$fieldsList = \app\admin\model\cms\Fields::where('model_id', $model['id'])->where('type', '<>', 'text')->select();
//设置过滤方法
$this->request->filter(['strip_tags']);
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage,则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
$fields = [];
foreach ($fieldsList as $index => $item) {
$fields[] = "addon." . $item['name'];
}
$table = $this->model->getTable();
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$sort = 'main.id';
$isSuperAdmin = $this->isSuperAdmin;
$channelIds = $this->channelIds;
$customWhere = function ($query) use ($isSuperAdmin, $channelIds, $model_id) {
if (!$isSuperAdmin) {
$query->where('main.channel_id', 'in', $channelIds);
}
if ($model_id) {
$query->where('main.model_id', $model_id);
}
};
$total = Db::table($table)
->alias('main')
->join('cms_channel channel', 'channel.id=main.channel_id', 'LEFT')
->join($model['table'] . ' addon', 'addon.id=main.id', 'LEFT')
->field('main.id,main.channel_id,main.title,channel.name as channel_name,addon.id as aid' . ($fields ? ',' . implode(',', $fields) : ''))
->where($customWhere)
->where($where)
->order($sort, $order)
->count();
$list = Db::table($table)
->alias('main')
->join('cms_channel channel', 'channel.id=main.channel_id', 'LEFT')
->join($model['table'] . ' addon', 'addon.id=main.id', 'LEFT')
->field('main.id,main.channel_id,main.title,channel.name as channel_name,addon.id as aid' . ($fields ? ',' . implode(',', $fields) : ''))
->where($customWhere)
->where($where)
->order($sort, $order)
->limit($offset, $limit)
->select();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
$fields = [];
foreach ($fieldsList as $index => $item) {
$fields[] = ['field' => $item['name'], 'title' => $item['title'], 'type' => $item['type'], 'content' => $item['content_list']];
}
$this->assignconfig('fields', $fields);
$this->view->assign('fieldsList', $fieldsList);
$this->view->assign('model', $model);
$this->assignconfig('model_id', $model_id);
$modelList = \app\admin\model\cms\Modelx::all();
$this->view->assign('modelList', $modelList);
return $this->view->fetch();
}
/**
* 编辑
*
* @param mixed $ids
* @return string
*/
public function edit($ids = NULL)
{
$row = $this->model->get($ids);
if (!$row)
$this->error(__('No Results were found'));
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
if (!in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
}
if (!$this->isSuperAdmin && !in_array($row['channel_id'], $this->channelIds)) {
$this->error(__('You have no permission'));
}
if ($this->request->isPost()) {
return parent::edit($ids);
}
$channel = Channel::get($row['channel_id']);
if (!$channel) {
$this->error(__('No specified channel found'));
}
$model = \app\admin\model\cms\Modelx::get($channel['model_id']);
if (!$model) {
$this->error(__('No specified model found'));
}
$addon = db($model['table'])->where('id', $row['id'])->find();
if ($addon) {
$row = array_merge($row->toArray(), $addon);
}
$disabledIds = [];
$all = collection(Channel::order("weigh desc,id desc")->select())->toArray();
foreach ($all as $k => $v) {
if ($v['type'] != 'list' || $v['model_id'] != $channel['model_id']) {
$disabledIds[] = $v['id'];
}
}
$tree = Tree::instance()->init($all, 'parent_id');
$channelOptions = $tree->getTree(0, "<option value=@id @selected @disabled>@spacer@name</option>", $row['channel_id'], $disabledIds);
$this->view->assign('channelOptions', $channelOptions);
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
* @param mixed $ids
*/
public function del($ids = "")
{
\app\admin\model\cms\Archives::event('after_delete', function ($row) {
Channel::where('id', $row['channel_id'])->where('items', '>', 0)->setDec('items');
});
parent::del($ids);
}
/**
* 销毁
* @param string $ids
*/
public function destroy($ids = "")
{
\app\admin\model\cms\Archives::event('after_delete', function ($row) {
//删除副表
$channel = Channel::get($row->channel_id);
if ($channel) {
$model = Modelx::get($channel['model_id']);
if ($model) {
db($model['table'])->where("id", $row['id'])->delete();
}
}
});
parent::destroy($ids);
}
/**
* 还原
* @param mixed $ids
*/
public function restore($ids = "")
{
$pk = $this->model->getPk();
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
$this->model->where($this->dataLimitField, 'in', $adminIds);
}
if ($ids) {
$this->model->where($pk, 'in', $ids);
}
$archivesChannelIds = $this->model->onlyTrashed()->column('id,channel_id');
$archivesChannelIds = array_filter($archivesChannelIds);
$this->model->where('id', 'in', array_keys($archivesChannelIds));
$count = $this->model->restore('1=1');
if ($count) {
$channelNums = array_count_values($archivesChannelIds);
foreach ($channelNums as $k => $v) {
Channel::where('id', $k)->setInc('items', $v);
}
$this->success();
}
$this->error(__('No rows were updated'));
}
/**
* 移动
* @param string $ids
*/
public function move($ids = "")
{
if ($ids) {
$channel_id = $this->request->post('channel_id');
$pk = $this->model->getPk();
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
$this->model->where($this->dataLimitField, 'in', $adminIds);
}
$this->model->where($pk, 'in', $ids);
$channel = Channel::get($channel_id);
if ($channel && $channel['type'] === 'list') {
$channelNums = \app\admin\model\cms\Archives::
with('channel')
->where('archives.' . $pk, 'in', $ids)
->where('channel_id', '<>', $channel['id'])
->field('channel_id,COUNT(*) AS nums')
->group('channel_id')
->select();
$result = $this->model
->where('model_id', '=', $channel['model_id'])
->where('channel_id', '<>', $channel['id'])
->update(['channel_id' => $channel_id]);
if ($result) {
$count = 0;
foreach ($channelNums as $k => $v) {
if ($v['channel']) {
Channel::where('id', $v['channel_id'])->where('items', '>', 0)->setDec('items', min($v['channel']['items'], $v['nums']));
}
$count += $v['nums'];
}
Channel::where('id', $channel_id)->setInc('items', $count);
$this->success();
} else {
$this->error(__('No rows were updated'));
}
} else {
$this->error(__('No rows were updated'));
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
}
/**
* 获取栏目列表
* @internal
*/
public function get_channel_fields()
{
$this->view->engine->layout(false);
$channel_id = $this->request->post('channel_id');
$archives_id = $this->request->post('archives_id');
$channel = Channel::get($channel_id, 'model');
dump($channel);
echo 1111;
exit();
if ($channel && $channel['type'] === 'list') {
$values = [];
if ($archives_id) {
$values = db($channel['model']['table'])->where('id', $archives_id)->find();
}
$fields = \app\admin\model\cms\Fields::where('model_id', $channel['model_id'])
->order('weigh desc,id desc')
->select();
foreach ($fields as $k => $v) {
//优先取编辑的值,再次取默认值
$v->value = isset($values[$v['name']]) ? $values[$v['name']] : (is_null($v['defaultvalue']) ? '' : $v['defaultvalue']);
$v->rule = str_replace(',', '; ', $v->rule);
if (in_array($v->type, ['checkbox', 'lists', 'images'])) {
$checked = '';
if ($v['minimum'] && $v['maximum'])
$checked = "{$v['minimum']}~{$v['maximum']}";
else if ($v['minimum'])
$checked = "{$v['minimum']}~";
else if ($v['maximum'])
$checked = "~{$v['maximum']}";
if ($checked)
$v->rule .= (';checked(' . $checked . ')');
}
if (in_array($v->type, ['checkbox', 'radio']) && stripos($v->rule, 'required') !== false) {
$v->rule = str_replace('required', 'checked', $v->rule);
}
if (in_array($v->type, ['selects'])) {
$v->extend .= (' ' . 'data-max-options="' . $v['maximum'] . '"');
}
}
$this->view->assign('fields', $fields);
$this->view->assign('values', $values);
$this->success('', null, ['html' => $this->view->fetch('fields')]);
} else {
$this->error(__('Please select channel'));
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
/**
* 检测元素是否可用
* @internal
*/
public function check_element_available()
{
$id = $this->request->request('id');
$name = $this->request->request('name');
$value = $this->request->request('value');
$name = substr($name, 4, -1);
if (!$name) {
$this->error(__('Parameter %s can not be empty', 'name'));
}
if ($id) {
$this->model->where('id', '<>', $id);
}
$exist = $this->model->where($name, $value)->find();
if ($exist) {
$this->error(__('The data already exist'));
} else {
$this->success();
}
}
}
... ...
<?php
namespace app\admin\controller\cms;
use app\common\controller\Backend;
/**
* 区块表
*
* @icon fa fa-circle-o
*/
class Block extends Backend
{
/**
* Block模型对象
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\cms\Block;
$this->view->assign("statusList", $this->model->getStatusList());
}
public function index()
{
$typeArr = \app\admin\model\cms\Block::distinct('type')->column('type');
$this->view->assign('typeList', $typeArr);
$this->assignconfig('typeList', $typeArr);
return parent::index();
}
public function selectpage_type()
{
$list = [];
$word = (array)$this->request->request("q_word/a");
$field = $this->request->request('showField');
$keyValue = $this->request->request('keyValue');
if (!$keyValue) {
if (array_filter($word)) {
foreach ($word as $k => $v) {
$list[] = ['id' => $v, $field => $v];
}
}
$typeArr = \app\admin\model\cms\Block::column('type');
$typeArr = array_unique($typeArr);
foreach ($typeArr as $index => $item) {
$list[] = ['id' => $item, $field => $item];
}
} else {
$list[] = ['id' => $keyValue, $field => $keyValue];
}
return json(['total' => count($list), 'list' => $list]);
}
public function import()
{
return parent::import();
}
}
... ...
<?php
namespace app\admin\controller\cms;
use app\admin\model\Admin;
use app\admin\model\AuthGroupAccess;
use app\admin\model\cms\ChannelAdmin;
use app\common\controller\Backend;
use app\admin\model\cms\Channel as ChannelModel;
use fast\Tree;
use think\Exception;
/**
* 栏目表
*
* @icon fa fa-circle-o
*/
class Channel extends Backend
{
protected $channelList = [];
protected $modelList = [];
protected $multiFields = ['weigh', 'status'];
/**
* Channel模型对象
*/
protected $model = null;
protected $noNeedRight = ['check_element_available'];
public function _initialize()
{
parent::_initialize();
$this->request->filter(['strip_tags']);
$this->model = new \app\admin\model\cms\Channel;
$tree = Tree::instance();
$tree->init(collection($this->model->order('weigh desc,id desc')->select())->toArray(), 'parent_id');
$this->channelList = $tree->getTreeList($tree->getTreeArray(0), 'name');
$this->modelList = \app\admin\model\cms\Modelx::order('id asc')->select();
$this->view->assign("modelList", $this->modelList);
$this->view->assign("channelList", $this->channelList);
$this->view->assign("typeList", ChannelModel::getTypeList());
$this->view->assign("statusList", ChannelModel::getStatusList());
}
/**
* 查看
*/
public function index()
{
if ($this->request->isAjax()) {
$search = $this->request->request("search");
$model_id = $this->request->request("model_id");
//构造父类select列表选项数据
$list = [];
if ($search) {
foreach ($this->channelList as $k => $v) {
if (stripos($v['name'], $search) !== false || stripos($v['nickname'], $search) !== false) {
$list[] = $v;
}
}
} else {
$list = $this->channelList;
}
foreach ($list as $index => $item) {
if ($model_id && $model_id != $item['model_id']) {
unset($list[$index]);
}
}
$list = array_values($list);
$modelNameArr = [];
foreach ($this->modelList as $k => $v) {
$modelNameArr[$v['id']] = $v['name'];
}
foreach ($list as $k => &$v) {
$v['model_name'] = $v['model_id'] && isset($modelNameArr[$v['model_id']]) ? $modelNameArr[$v['model_id']] : __('None');
}
$total = count($list);
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
/**
* 添加
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
$params[$this->dataLimitField] = $this->auth->id;
}
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = basename(str_replace('\\', '/', get_class($this->model)));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : true) : $this->modelValidate;
$this->model->validate($validate);
}
$nameArr = array_filter(explode("\n", str_replace("\r\n", "\n", $params['name'])));
if (count($nameArr) > 1) {
foreach ($nameArr as $index => $item) {
$itemArr = array_filter(explode('|', $item));
$params['name'] = $itemArr[0];
$params['diyname'] = isset($itemArr[1]) ? $itemArr[1] : '';
$result = $this->model->allowField(true)->isUpdate(false)->data($params)->save();
}
} else {
$result = $this->model->allowField(true)->save($params);
}
if ($result !== false) {
$this->success();
} else {
$this->error($this->model->getError());
}
} catch (\think\exception\PDOException $e) {
$this->error($e->getMessage());
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 栏目授权
*/
public function admin()
{
$act = $this->request->param('act');
$ids = $this->request->param('ids');
if ($act == 'remove') {
ChannelAdmin::where('admin_id', $ids)->delete();
$this->success('删除成功!');
} else if ($act == 'authorization') {
$selected = ChannelAdmin::getAdminChanneIds($ids);
$all = collection(ChannelModel::order("weigh desc,id desc")->select())->toArray();
foreach ($all as $k => $v) {
$state = ['opened' => true];
if ($v['type'] != 'list') {
$disabledIds[] = $v['id'];
}
if ($v['type'] == 'link') {
$state['checkbox_disabled'] = true;
}
$state['selected'] = in_array($v['id'], $selected);
$channelList[] = [
'id' => $v['id'],
'parent' => $v['parent_id'] ? $v['parent_id'] : '#',
'text' => __($v['name']),
'type' => $v['type'],
'state' => $state
];
}
$this->success('成功', '', $channelList);
} else if ($act == 'save') {
\think\Db::startTrans();
try {
ChannelAdmin::where('admin_id', $ids)->delete();
$channelIds = explode(",", $this->request->post("ids"));
if ($channelIds) {
$listChannelIds = ChannelModel::where('type', 'list')->column('id');
$channelIds = array_intersect($channelIds, $listChannelIds);
$data = [];
foreach ($channelIds as $key => $item) {
$data[] = ['admin_id' => $ids, 'channel_id' => $item];
}
$model = new ChannelAdmin();
$model->saveAll($data, true);
}
\think\Db::commit();
} catch (Exception $e) {
\think\Db::rollback();
$this->error($e->getMessage());
}
$this->success("保存成功!");
}
if ($this->request->isAjax()) {
$list = \think\Db::name("cms_channel_admin")
->group("admin_id")
->field("COUNT(*) as channels,admin_id")
->select();
$adminChannelList = [];
foreach ($list as $index => $item) {
$adminChannelList[$item['admin_id']] = $item['channels'];
}
$superAdminIds = AuthGroupAccess::where('group_id', 1)->column('uid');
$adminList = Admin::order('id', 'desc')->field('id,username')->select();
foreach ($adminList as $index => $item) {
$item->channels = isset($adminChannelList[$item['id']]) ? $adminChannelList[$item['id']] : 0;
$item->superadmin = in_array($item['id'], $superAdminIds);
}
$total = count($adminList);
$result = array("total" => $total, "rows" => $adminList);
return json($result);
}
return $this->view->fetch();
}
/**
* Selectpage搜索
*
* @internal
*/
public function selectpage()
{
return parent::selectpage();
}
/**
* 检测元素是否可用
* @internal
*/
public function check_element_available()
{
$id = $this->request->request('id');
$name = $this->request->request('name');
$value = $this->request->request('value');
$name = substr($name, 4, -1);
if (!$name) {
$this->error(__('Parameter %s can not be empty', 'name'));
}
if ($name == 'diyname') {
if ($id) {
$this->model->where('id', '<>', $id);
}
$exist = $this->model->where($name, $value)->find();
if ($exist) {
$this->error(__('The data already exist'));
} else {
$this->success();
}
} else if ($name == 'name') {
$nameArr = array_filter(explode("\n", str_replace("\r\n", "\n", $value)));
if (count($nameArr) > 1) {
foreach ($nameArr as $index => $item) {
$itemArr = array_filter(explode('|', $item));
if (!isset($itemArr[1])) {
$this->error('格式:分类名称|自定义名称');
}
$exist = \app\admin\model\cms\Channel::getByDiyname($itemArr[1]);
if ($exist) {
$this->error('自定义名称[' . $itemArr[1] . ']已经存在');
}
}
$this->success();
} else {
$this->success();
}
}
}
}
... ...
<?php
namespace app\admin\controller\cms;
use app\common\controller\Backend;
/**
* 评论管理
*
* @icon fa fa-comment
*/
class Comment extends Backend
{
/**
* Comment模型对象
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\cms\Comment;
$this->view->assign("typeList", $this->model->getTypeList());
$this->view->assign("statusList", $this->model->getStatusList());
}
/**
* 查看
*/
public function index()
{
$this->relationSearch = true;
//设置过滤方法
$this->request->filter(['strip_tags']);
if ($this->request->isAjax())
{
//如果发送的来源是Selectpage,则转发到Selectpage
if ($this->request->request('keyField'))
{
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->with('archives')
->where($where)
->order($sort, $order)
->count();
$list = $this->model
->with('archives')
->where($where)
->order($sort, $order)
->limit($offset, $limit)
->select();
$list = collection($list)->toArray();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
$this->assignconfig("typeList", $this->model->getTypeList());
return $this->view->fetch();
}
}
... ...
<?php
namespace app\admin\controller\cms;
use app\common\controller\Backend;
/**
* 自定义表单数据表
*
* @icon fa fa-circle-o
*/
class Diydata extends Backend
{
/**
* 自定义表单模型对象
*/
protected $diyform = null;
/**
* 定义表单数据表模型
* @var null
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$diyform_id = $this->request->param('diyform_id');
$this->diyform = \app\admin\model\cms\Diyform::get($diyform_id);
if (!$this->diyform) {
$this->error('未找到对应自定义表单');
}
$this->model = \think\Db::name($this->diyform['table']);
$this->assignconfig('diyform_id', $diyform_id);
}
/**
* 查看
*/
public function index()
{
$fieldsList = \app\admin\model\cms\Fields::where('diyform_id', $this->diyform['id'])->where('type', '<>', 'text')->select();
$fields = [];
foreach ($fieldsList as $index => $item) {
$fields[] = ['field' => $item['name'], 'title' => $item['title'], 'type' => $item['type'], 'content' => $item['content_list']];
}
$this->assignconfig('fields', $fields);
$diyformList = \app\admin\model\cms\Diyform::all();
$this->view->assign('diyform', $this->diyform);
$this->view->assign('diyformList', $diyformList);
return parent::index();
}
/**
* 添加
*/
public function add()
{
$this->assignFields();
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
$params[$this->dataLimitField] = $this->auth->id;
}
try {
$result = $this->model->insert($params);
if ($result !== false) {
$this->success();
} else {
$this->error($this->model->getError());
}
} catch (\think\exception\PDOException $e) {
$this->error($e->getMessage());
} catch (\think\Exception $e) {
$this->error($e->getMessage());
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = NULL)
{
$row = $this->model->where('id', $ids)->find();
if (!$row)
$this->error(__('No Results were found'));
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
if (!in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
try {
$result = $this->model->where('id', $ids)->update($params);
if ($result !== false) {
$this->success();
} else {
$this->error($row->getError());
}
} catch (\think\exception\PDOException $e) {
$this->error($e->getMessage());
} catch (\think\Exception $e) {
$this->error($e->getMessage());
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$this->assignFields($ids);
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if ($ids) {
$pk = $this->model->getPk();
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
$count = $this->model->where($this->dataLimitField, 'in', $adminIds);
}
$count = $this->model->where($pk, 'in', $ids)->delete();
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
private function assignFields($diydata_id = 0)
{
$values = [];
if ($diydata_id) {
$values = db($this->diyform['table'])->where('id', $diydata_id)->find();
}
$fields = \app\admin\model\cms\Fields::where('diyform_id', $this->diyform['id'])
->order('weigh desc,id desc')
->select();
foreach ($fields as $k => $v) {
$v->value = isset($values[$v['name']]) ? $values[$v['name']] : '';
$v->rule = str_replace(',', '; ', $v->rule);
if (in_array($v->type, ['checkbox', 'lists', 'images'])) {
$checked = '';
if ($v['minimum'] && $v['maximum'])
$checked = "{$v['minimum']}~{$v['maximum']}";
else if ($v['minimum'])
$checked = "{$v['minimum']}~";
else if ($v['maximum'])
$checked = "~{$v['maximum']}";
if ($checked)
$v->rule .= (';checked(' . $checked . ')');
}
if (in_array($v->type, ['checkbox', 'radio']) && stripos($v->rule, 'required') !== false) {
$v->rule = str_replace('required', 'checked', $v->rule);
}
if (in_array($v->type, ['selects'])) {
$v->extend .= (' ' . 'data-max-options="' . $v['maximum'] . '"');
}
}
$this->view->assign('fields', $fields);
$this->view->assign('values', $values);
}
}
... ...
<?php
namespace app\admin\controller\cms;
use app\common\controller\Backend;
/**
* 自定义表单表
*
* @icon fa fa-circle-o
*/
class Diyform extends Backend
{
/**
* Model模型对象
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\cms\Diyform;
$this->view->assign("statusList", $this->model->getStatusList());
}
}
... ...
<?php
namespace app\admin\controller\cms;
use app\common\controller\Backend;
use app\common\model\Config;
/**
* 模型字段表
*
* @icon fa fa-circle-o
*/
class Fields extends Backend
{
/**
* Fields模型对象
*/
protected $model = null;
protected $modelValidate = true;
protected $modelSceneValidate = true;
protected $noNeedRight = ['rulelist'];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\cms\Fields;
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign('typeList', Config::getTypeList());
$this->view->assign('regexList', Config::getRegexList());
}
/**
* 查看
*/
public function index()
{
$model_id = $this->request->param('model_id', 0);
$diyform_id = $this->request->param('diyform_id', 0);
$condition = $model_id ? ['model_id' => $model_id] : ['diyform_id' => $diyform_id];
//设置过滤方法
$this->request->filter(['strip_tags']);
if ($this->request->isAjax()) {
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->where($condition)
->where($where)
->order($sort, $order)
->count();
$list = $this->model
->where($condition)
->where($where)
->order($sort, $order)
->limit($offset, $limit)
->select();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
$this->assignconfig('model_id', $model_id);
$this->assignconfig('diyform_id', $diyform_id);
$this->view->assign('model_id', $model_id);
$this->view->assign('diyform_id', $diyform_id);
$model = $model_id ? \app\admin\model\cms\Modelx::get($model_id) : \app\admin\model\cms\Diyform::get($diyform_id);
$this->view->assign('model', $model);
$modelList = $model_id ? \app\admin\model\cms\Modelx::all() : \app\admin\model\cms\Diyform::all();
$this->view->assign('modelList', $modelList);
return $this->view->fetch();
}
/**
* 添加
*/
public function add()
{
$model_id = $this->request->param('model_id', 0);
$diyform_id = $this->request->param('diyform_id', 0);
$this->view->assign('model_id', $model_id);
$this->view->assign('diyform_id', $diyform_id);
return parent::add();
}
/**
* 批量操作
* @param string $ids
*/
public function multi($ids = "")
{
$params = $this->request->request('params');
parse_str($params, $paramsArr);
if (isset($paramsArr['isfilter'])) {
$field = \app\admin\model\cms\Fields::get($ids);
if (!$field || !in_array($field['type'], ['radio', 'checkbox', 'select', 'selects', 'array'])) {
$this->error('只有类型为单选、复选、下拉列表、数组才可以加入列表筛选');
}
}
return parent::multi($ids);
}
/**
* 规则列表
* @internal
*/
public function rulelist()
{
//主键
$primarykey = $this->request->request("keyField");
//主键值
$keyValue = $this->request->request("keyValue", "");
$keyValueArr = array_filter(explode(',', $keyValue));
$regexList = Config::getRegexList();
$list = [];
foreach ($regexList as $k => $v) {
if ($keyValueArr) {
if (in_array($k, $keyValueArr)) {
$list[] = ['id' => $k, 'name' => $v];
}
} else {
$list[] = ['id' => $k, 'name' => $v];
}
}
return json(['list' => $list]);
}
}
... ...
<?php
namespace app\admin\controller\cms;
use app\common\controller\Backend;
/**
* 内容模型表
*
* @icon fa fa-circle-o
*/
class Modelx extends Backend
{
/**
* Model模型对象
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\cms\Modelx;
}
}
... ...
<?php
namespace app\admin\controller\cms;
use app\common\controller\Backend;
/**
* 订单管理
*
* @icon fa fa-circle-o
*/
class Order extends Backend
{
/**
* Order模型对象
* @var \app\admin\model\cms\Order
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\cms\Order;
$this->view->assign("statusList", $this->model->getStatusList());
}
}
... ...
<?php
namespace app\admin\controller\cms;
use app\common\controller\Backend;
/**
* 单页表
*
* @icon fa fa-circle-o
*/
class Page extends Backend
{
/**
* Page模型对象
*/
protected $model = null;
protected $noNeedRight = ['selectpage_type'];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\cms\Page;
$this->view->assign("flagList", $this->model->getFlagList());
$this->view->assign("statusList", $this->model->getStatusList());
}
public function index()
{
$typeArr = \app\admin\model\cms\Page::distinct('type')->column('type');
$this->view->assign('typeList', $typeArr);
$this->assignconfig('typeList', $typeArr);
return parent::index();
}
/**
* 动态下拉选择类型
* @internal
*/
public function selectpage_type()
{
$list = [];
$word = (array)$this->request->request("q_word/a");
$field = $this->request->request('showField');
$keyValue = $this->request->request('keyValue');
if (!$keyValue) {
if (array_filter($word)) {
foreach ($word as $k => $v) {
$list[] = ['id' => $v, $field => $v];
}
}
$typeArr = \app\admin\model\cms\Page::column('type');
$typeArr = array_unique($typeArr);
foreach ($typeArr as $index => $item) {
$list[] = ['id' => $item, $field => $item];
}
} else {
$list[] = ['id' => $keyValue, $field => $keyValue];
}
return json(['total' => count($list), 'list' => $list]);
}
}
... ...
<?php
namespace app\admin\controller\cms;
use app\common\controller\Backend;
/**
* 标签表
*
* @icon tags
*/
class Tags extends Backend
{
/**
* Tags模型对象
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\cms\Tags;
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个方法
* 因此在当前控制器中可不用编写增删改查的代码,如果需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function selectpage()
{
$response = parent::selectpage();
$word = (array)$this->request->request("q_word/a");
if (array_filter($word)) {
$result = $response->getData();
foreach ($word as $k => $v) {
array_unshift($result['list'], ['id' => $v, 'name' => $v]);
$result['total']++;
}
$response->data($result);
}
return $response;
}
}
... ...
<?php
return [
'Channel' => '栏目',
'Channel_id' => '栏目ID',
'Channel_name' => '栏目名称',
'Channel list' => '栏目列表',
'Addon list' => '副表列表',
'Model' => '模型',
'Model_id' => '模型ID',
'User_id' => '发布会员',
'Title' => '文章标题',
'Flag' => '标志',
'Image' => '缩略图',
'Keywords' => '关键字',
'Description' => '描述',
'Tags' => 'TAG',
'Weigh' => '权重',
'Views' => '浏览',
'Comments' => '评论',
'Likes' => '点赞',
'Dislikes' => '点踩',
'Diyname' => '自定义URL',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Deletetime' => '删除时间',
'Recycle bin' => '回收站',
'Restore' => '还原',
'Restore all' => '还原全部',
'Destroy' => '销毁',
'Destroy all' => '清空回收站',
'Nothing need restore' => '没有需要还原的数据',
'Move tips' => '只能将数据移动到相同模型的栏目下,不同模型的数据移动将被忽略',
'Are you sure you want to truncate?' => '确认清空回收站?',
'Can not be digital' => '不能为数字',
'Please select channel' => '请选择分类',
'The data already exist' => '已经存在',
'Status' => '状态',
'Status normal' => '正常',
'Status hidden' => '隐藏',
'Status rejected' => '已拒绝',
'Status pulloff' => '已下线',
'Set to rejected' => '设为拒绝',
'Set to pulloff' => '设为下线',
'Array key' => '键',
'Array value' => '值',
'Publish' => '发布'
];
\ No newline at end of file
... ...
<?php
return [
'Type' => '类型',
'Name' => '名称',
'Title' => '标题',
'Image' => '图片',
'Url' => '链接',
'Content' => '内容',
'Createtime' => '添加时间',
'Updatetime' => '更新时间',
'Status' => '状态'
];
... ...
<?php
return [
'Type' => '类型',
'Model_id' => '模型ID',
'Model_name' => '模型名称',
'Parent_id' => '父ID',
'Parent_ids' => '父ID集合',
'Child_ids' => '子ID集合',
'Name' => '名称',
'Image' => '图片',
'Keywords' => '关键字',
'Description' => '描述',
'Diyname' => '自定义名称',
'Outlink' => '外部链接',
'Items' => '文章数量',
'Channels' => '栏目数量',
'Authorization' => '授权',
'Save' => '保存',
'Weigh' => '权重',
'Channeltpl' => '栏目页模板',
'Listtpl' => '列表页模板',
'Showtpl' => '详情页模板',
'Pagesize' => '分页大小',
'Remove' => '移除',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'The data already exist' => '已经存在',
'You must choose at least one channel' => '必须选择一个栏目',
'Are you sure you want to remove this item?' => '确认要取消此管理员的所有栏目授权?',
'Iscontribute' => '是否允许投稿',
'Status' => '状态',
'Channel' => '栏目',
'List' => '列表',
'Link' => '外部链接'
];
... ...
<?php
return [
'Id' => 'ID',
'Type' => '类型',
'Archives' => '文档',
'Page' => '单页',
'Aid' => '关联ID',
'Pid' => '父ID',
'User_id' => '会员ID',
'Content' => '内容',
'Comments' => '评论数',
'Ip' => 'IP',
'Useragent' => 'User Agent',
'Subscribe' => '订阅',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Status' => '状态'
];
... ...
<?php
return [
'User_id' => '会员ID',
'Createtime' => '添加时间',
'Updatetime' => '更新时间',
'Status' => '状态'
];
... ...
<?php
return [
'Type' => '类型',
'Name' => '名称',
'Table' => '表名',
'Keywords' => '关键字',
'Description' => '描述',
'Successtips' => '成功提交提示文字',
'Diyname' => '自定义名称',
'Needlogin' => '是否需要登录',
'Formtpl' => '表单模板',
'Createtime' => '添加时间',
'Updatetime' => '更新时间',
'Status' => '状态'
];
... ...
<?php
return [
'Model_id' => '模型ID',
'Name' => '名称',
'Type' => '类型',
'Title' => '标题',
'Content' => '条目列表',
'Rule' => '验证规则',
'Validate Msg' => '错误消息',
'Validate Ok' => '成功消息',
'Validate Tip' => '提示消息',
'Extend' => '扩展信息',
'Weigh' => '排序',
'Setting' => '字段设置',
'Length' => '字段长度',
'Decimals' => '小数点长度',
'Minimum' => '最少选择',
'Maximum' => '最大选择',
'Defaultvalue' => '默认值',
'Iscontribute' => '是否可投稿',
'Isfilter' => '是否列表筛选',
'String' => '字符',
'Text' => '文本',
'Editor' => '编辑器',
'Number' => '数字',
'Date' => '日期',
'Time' => '时间',
'Datetime' => '日期时间',
'Image' => '图片',
'Images' => '图片(多)',
'File' => '文件',
'Files' => '文件(多)',
'Select' => '列表',
'Selects' => '列表(多选)',
'Switch' => '开关',
'Checkbox' => '复选',
'Radio' => '单选',
'Array' => '数组',
'Array key' => '键名',
'Array value' => '键值',
'Createtime' => '添加时间',
'Updatetime' => '更新时间',
'Status' => '状态'
];
... ...
<?php
return [
'Name' => '模型名称',
'Table' => '表名',
'Fields' => '字段列表',
'Channeltpl' => '栏目页模板',
'Listtpl' => '列表页模板',
'Showtpl' => '详情页模板',
'Main list' => '主表列表',
'Addon list' => '副表列表',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Setting' => '配置'
];
... ...
<?php
return [
'Id' => '订单ID',
'User_id' => '会员ID',
'Archives_id' => '文档ID',
'Title' => '订单标题',
'Amount' => '订单金额',
'Payamount' => '支付金额',
'Paytype' => '支付类型',
'Paytime' => '支付时间',
'Ip' => 'IP地址',
'Useragent' => 'UserAgent',
'Memo' => '备注',
'Createtime' => '添加时间',
'Updatetime' => '更新时间',
'Status' => '状态',
'Paid' => '已支付',
'Expired' => '已过期',
'Created' => '未支付',
'Set to created' => '设为未支付',
'Set to paid' => '设为已支付',
'Set to expired' => '设为已过期',
];
... ...
<?php
return [
'Id' => 'ID',
'Category_id' => '分类ID',
'Type' => '类型',
'Title' => '标题',
'Keywords' => '关键字',
'Description' => '描述',
'Flag' => '标志',
'Image' => '图片',
'Content' => '内容',
'Icon' => '图标',
'Views' => '点击',
'Comments' => '评论',
'Diyname' => '自定义',
'Showtpl' => '视图模板',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Weigh' => '权重',
'Status' => '状态'
];
... ...
<?php
return [
'Name' => '标签名称',
'Archives' => '文档ID集合',
'Nums' => '文档数量'
];
... ...
<?php
namespace app\admin\model\cms;
use app\common\model\Config;
use think\Model;
use traits\model\SoftDelete;
class Archives extends Model
{
use SoftDelete;
// 表名
protected $name = 'cms_archives';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'flag_text',
'status_text',
'publishtime_text',
'url',
];
public function getUrlAttr($value, $data)
{
$diyname = $data['diyname'] ? $data['diyname'] : $data['id'];
return addon_url('cms/archives/index', [':id' => $data['id'], ':diyname' => $diyname, ':channel' => $data['channel_id']]);
}
protected static function init()
{
self::afterInsert(function ($row) {
$pk = $row->getPk();
$channel = Channel::get($row['channel_id']);
$row->getQuery()->where($pk, $row[$pk])->update(['model_id' => $channel ? $channel['model_id'] : 0, 'weigh' => $row[$pk]]);
Channel::where('id', $row['channel_id'])->setInc('items');
});
self::beforeWrite(function ($row) {
//在更新之前对数组进行处理
foreach ($row->getData() as $k => $value) {
if (is_array($value) && isset($value['field'])) {
$value = json_encode(Config::getArrayData($value), JSON_UNESCAPED_UNICODE);
} else {
$value = is_array($value) ? implode(',', $value) : $value;
}
$row->$k = $value;
}
});
self::afterWrite(function ($row) {
if (isset($row['channel_id'])) {
//在更新成功后刷新副表、TAGS表数据、栏目表
$channel = Channel::get($row->channel_id);
if ($channel) {
$model = Modelx::get($channel['model_id']);
if ($model && isset($row['content'])) {
$values = array_intersect_key($row->getData(), array_flip($model->fields));
$values['id'] = $row['id'];
$values['content'] = $row['content'];
db($model['table'])->insert($values, TRUE);
}
}
}
if (isset($row['tags'])) {
$tags = array_filter(explode(',', $row['tags']));
if ($tags) {
$tagslist = Tags::where('name', 'in', $tags)->select();
foreach ($tagslist as $k => $v) {
$archives = explode(',', $v['archives']);
if (!in_array($row['id'], $archives)) {
$archives[] = $row['id'];
$v->archives = implode(',', $archives);
$v->nums++;
$v->save();
}
$tags = array_diff($tags, [$v['name']]);
}
$list = [];
foreach ($tags as $k => $v) {
$list[] = ['name' => $v, 'archives' => $row['id'], 'nums' => 1];
}
if ($list) {
(new Tags())->saveAll($list);
}
}
}
});
}
public function getFlagList()
{
return ['hot' => __('Hot'), 'new' => __('New'), 'recommend' => __('Recommend')];
}
public function getStatusList()
{
return ['normal' => __('Normal'), 'hidden' => __('Hidden'), 'rejected' => __('Status rejected'), 'pulloff' => __('Status pulloff')];
}
public function getFlagTextAttr($value, $data)
{
$value = $value ? $value : $data['flag'];
$valueArr = $value ? explode(',', $value) : [];
$list = $this->getFlagList();
return implode(',', array_intersect_key($list, array_flip($valueArr)));
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : $data['status'];
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getPublishtimeTextAttr($value, $data)
{
$value = $value ? $value : $data['publishtime'];
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
protected function setPublishtimeAttr($value)
{
return $value && !is_numeric($value) ? strtotime($value) : $value;
}
public function channel()
{
return $this->belongsTo('Channel', 'channel_id', '', [], 'LEFT')->setEagerlyType(0);
}
}
... ...
<?php
namespace app\admin\model\cms;
use think\Model;
class Block extends Model
{
// 表名
protected $name = 'cms_block';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [
'status_text'
];
public function getStatusList()
{
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : $data['status'];
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
}
... ...
<?php
namespace app\admin\model\cms;
use think\Model;
class Channel extends Model
{
// 表名
protected $name = 'cms_channel';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [
'type_text',
'status_text',
'url'
];
public function getUrlAttr($value, $data)
{
$diyname = $data['diyname'] ? $data['diyname'] : $data['id'];
return isset($data['type']) && isset($data['outlink']) && $data['type'] == 'link' ? $data['outlink'] : addon_url('cms/channel/index', [':id' => $data['id'], ':diyname' => $diyname]);
}
protected static function init()
{
self::afterInsert(function ($row) {
//创建时自动添加权重值
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
});
self::afterDelete(function ($row) {
//删除时,删除子节点,同时将所有相关文档移入回收站
static $tree;
if (!$tree) {
$tree = \fast\Tree::instance();
$tree->init(collection(Channel::order('weigh desc,id desc')->field('id,parent_id,name,type,diyname,status')->select())->toArray(), 'parent_id');
}
$childIds = $tree->getChildrenIds($row['id']);
if ($childIds) {
Channel::destroy(function ($query) use ($childIds) {
$query->where('id', 'in', $childIds);
});
}
$childIds[] = $row['id'];
db('cms_archives')->where('channel_id', 'in', $childIds)->update(['deletetime' => time()]);
});
self::afterWrite(function ($row) {
$changed = $row->getChangedData();
//隐藏时判断是否有子节点,有则隐藏
if (isset($changed['status']) && $changed['status'] == 'hidden') {
static $tree;
if (!$tree) {
$tree = \fast\Tree::instance();
$tree->init(collection(Channel::order('weigh desc,id desc')->field('id,parent_id,name,type,diyname,status')->select())->toArray(), 'parent_id');
}
$childIds = $tree->getChildrenIds($row['id']);
db('cms_channel')->where('id', 'in', $childIds)->update(['status' => 'hidden']);
}
});
}
public static function getTypeList()
{
return ['channel' => __('Channel'), 'list' => __('List'), 'link' => __('Link')];
}
public static function getStatusList()
{
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
}
public function getTypeTextAttr($value, $data)
{
$value = $value ? $value : $data['type'];
$list = $this->getTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : $data['status'];
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function model()
{
return $this->belongsTo('Modelx', 'model_id')->setEagerlyType(0);
}
}
... ...
<?php
namespace app\admin\model\cms;
use app\admin\library\Auth;
use think\Model;
class ChannelAdmin extends Model
{
// 表名
protected $name = 'cms_channel_admin';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = false;
protected $updateTime = false;
// 追加属性
protected $append = [
];
public static function getAdminChanneIds($admin_id = null)
{
$admin_id = $admin_id ? $admin_id : Auth::instance()->id;
$selected = ChannelAdmin::where('admin_id', $admin_id)->column('channel_id');
return $selected;
}
public function admin()
{
return $this->belongsTo('\app\admin\model\Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function channel()
{
return $this->belongsTo('\app\admin\model\cms\Channel', 'channel_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}
... ...
<?php
namespace app\admin\model\cms;
use think\Model;
class Comment extends Model
{
// 表名
protected $name = 'cms_comment';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [
'type_text',
'status_text'
];
public function getTypeList()
{
return ['archives' => __('Archives'), 'page' => __('Page')];
}
public function getStatusList()
{
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
}
public function getTypeTextAttr($value, $data)
{
$value = $value ? $value : $data['type'];
$list = $this->getTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : $data['status'];
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function archives()
{
return $this->belongsTo('Archives', 'aid', '', [], 'LEFT')->setEagerlyType(0);
}
}
... ...
<?php
namespace app\admin\model\cms;
use think\Config;
use think\Model;
class Diyform extends Model
{
// 表名
protected $name = 'cms_diyform';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [
'url'
];
public static function init()
{
self::afterInsert(function ($row) {
$prefix = Config::get('database.prefix');
$sql = "CREATE TABLE `{$prefix}{$row['table']}` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` int(10) DEFAULT NULL COMMENT '会员ID',
`createtime` int(10) DEFAULT NULL COMMENT '添加时间',
`updatetime` int(10) DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='{$row['name']}'";
db()->query($sql);
});
}
public function getUrlAttr($value, $data)
{
$diyname = $data['diyname'] ? $data['diyname'] : $data['id'];
return addon_url('cms/diyform/index', [':id' => $data['id'], ':diyname' => $diyname]);
}
public function getFieldsAttr($value, $data)
{
return is_array($value) ? $value : ($value ? explode(',', $value) : []);
}
public function getStatusList()
{
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : $data['status'];
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
}
... ...
<?php
namespace app\admin\model\cms;
use addons\cms\library\Alter;
use app\common\model\Config;
use think\Exception;
use think\exception\PDOException;
use think\Model;
class Fields extends Model
{
// 表名
protected $name = 'cms_fields';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [
'status_text',
'content_list',
];
protected static $listField = ['select', 'selects', 'checkbox', 'radio', 'array'];
public function setError($error)
{
$this->error = $error;
}
protected static function init()
{
$beforeUpdateCallback = function ($row) {
};
$afterInsertCallback = function ($row) {
//为了避免引起更新的事件回调,这里采用直接执行SQL的写法
$row->query($row->fetchSql(true)->update(['id' => $row['id'], 'weigh' => $row['id']]));
$field = $row['model_id'] ? 'model_id' : 'diyform_id';
$model = $row['model_id'] ? Modelx::get($row[$field]) : Diyform::get($row[$field]);
if ($model) {
$sql = Alter::instance()
->setTable($model['table'])
->setName($row['name'])
->setLength($row['length'])
->setContent($row['content'])
->setDecimals($row['decimals'])
->setDefaultvalue($row['defaultvalue'])
->setComment($row['title'])
->setType($row['type'])
->getAddSql();
try {
db()->query($sql);
$fields = Fields::where($field, $model['id'])->field('name')->column('name');
$model->fields = implode(',', $fields);
$model->save();
} catch (PDOException $e) {
$row->getQuery()->where('id', $row->id)->delete();
throw new Exception($e->getMessage());
}
}
};
$afterUpdateCallback = function ($row) {
$field = $row['model_id'] ? 'model_id' : 'diyform_id';
$model = $row['model_id'] ? Modelx::get($row[$field]) : Diyform::get($row[$field]);
if ($model) {
$alter = Alter::instance();
if (isset($row['oldname']) && $row['oldname'] != $row['name']) {
$alter->setOldname($row['oldname']);
}
$sql = $alter
->setTable($model['table'])
->setName($row['name'])
->setLength($row['length'])
->setContent($row['content'])
->setDecimals($row['decimals'])
->setDefaultvalue($row['defaultvalue'])
->setComment($row['title'])
->setType($row['type'])
->getModifySql();
db()->query($sql);
$fields = Fields::where($field, $model['id'])->field('name')->column('name');
$model->fields = implode(',', $fields);
$model->save();
}
};
self::beforeInsert($beforeUpdateCallback);
self::beforeUpdate($beforeUpdateCallback);
self::afterInsert($afterInsertCallback);
self::afterUpdate($afterUpdateCallback);
self::afterDelete(function ($row) {
$field = $row['model_id'] ? 'model_id' : 'diyform_id';
$model = $row['model_id'] ? Modelx::get($row[$field]) : Diyform::get($row[$field]);
if ($model) {
$sql = Alter::instance()
->setTable($model['table'])
->setName($row['name'])
->getDropSql();
try {
db()->query($sql);
} catch (PDOException $e) {
}
}
});
}
public function getContentListAttr($value, $data)
{
return in_array($data['type'], self::$listField) ? Config::decode($data['content']) : $data['content'];
}
public function getStatusList()
{
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : $data['status'];
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function model()
{
return $this->belongsTo('Modelx', 'model_id')->setEagerlyType(0);
}
public function diyform()
{
return $this->belongsTo('Diyform', 'diyform_id')->setEagerlyType(0);
}
}
... ...
<?php
namespace app\admin\model\cms;
use think\Config;
use think\Model;
class Modelx extends Model
{
// 表名
protected $name = 'cms_model';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [
];
public static function init()
{
self::afterInsert(function ($row) {
$prefix = Config::get('database.prefix');
$sql = "CREATE TABLE `{$prefix}{$row['table']}` (`id` int(10) NOT NULL,`content` longtext NOT NULL,PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='{$row['name']}'";
db()->query($sql);
});
}
public function getFieldsAttr($value, $data)
{
return is_array($value) ? $value : ($value ? explode(',', $value) : []);
}
}
... ...
<?php
namespace app\admin\model\cms;
use think\Model;
class Order extends Model
{
// 表名
protected $name = 'cms_order';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [
'paytime_text',
'status_text'
];
public function getStatusList()
{
return ['created' => __('Created'), 'paid' => __('Paid'), 'expired' => __('Expired')];
}
public function getPaytimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['paytime']) ? $data['paytime'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
protected function setPaytimeAttr($value)
{
return $value && !is_numeric($value) ? strtotime($value) : $value;
}
}
... ...
<?php
namespace app\admin\model\cms;
use think\Model;
class Page extends Model
{
// 表名
protected $name = 'cms_page';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [
'flag_text',
'status_text',
'url'
];
protected static function init()
{
self::afterInsert(function ($row) {
$row->save(['weigh' => $row['id']]);
});
}
public function getUrlAttr($value, $data)
{
return addon_url('cms/page/index', [':diyname' => $data['diyname']]);
}
public function getStatusList()
{
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : $data['status'];
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getFlagList()
{
return ['hot' => __('Hot'), 'index' => __('Index'), 'recommend' => __('Recommend')];
}
public function getFlagTextAttr($value, $data)
{
$value = $value ? $value : $data['flag'];
$valueArr = explode(',', $value);
$list = $this->getFlagList();
return implode(',', array_intersect_key($list, array_flip($valueArr)));
}
}
... ...
<?php
namespace app\admin\model\cms;
use think\Model;
class Tags extends Model
{
// 表名
protected $name = 'cms_tags';
// 自动写入时间戳字段
protected $autoWriteTimestamp = false;
// 定义时间戳字段名
protected $createTime = false;
protected $updateTime = false;
// 追加属性
protected $append = [
'url'
];
public function getUrlAttr($value, $data)
{
return addon_url('cms/tags/index', [':name' => $data['name']]);
}
}
... ...
<?php
namespace app\admin\validate\cms;
use think\Validate;
class Archives extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<?php
namespace app\admin\validate\cms;
use think\Validate;
class Block extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<?php
namespace app\admin\validate\cms;
use think\Validate;
class Channel extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<?php
namespace app\admin\validate\cms;
use think\Validate;
class Comment extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<?php
namespace app\admin\validate\cms;
use think\Validate;
class Fields extends Validate
{
/**
* 验证规则
*/
protected $rule = [
'name|名称' => 'require|unique:cms_fields,model_id^name',
'title|管理员' => 'require',
'model_id|模型ID' => 'require|integer',
'status|状态' => 'require|in:normal,hidden',
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [
'name', 'title', 'model_id', 'status'
],
'edit' => [
'name', 'title', 'model_id', 'status'
],
];
public function __construct(array $rules = array(), $message = array(), $field = array())
{
//如果是编辑模式,则排除下主键
$ids = request()->param("ids");
if ($ids)
{
$this->rule['name|名称'] .= ",{$ids}";
}
parent::__construct($rules, $message, $field);
}
}
... ...
<?php
namespace app\admin\validate\cms;
use think\Validate;
class Modelx extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<?php
namespace app\admin\validate\cms;
use think\Validate;
class Order extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<?php
namespace app\admin\validate\cms;
use think\Validate;
class Page extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<?php
namespace app\admin\validate\cms;
use think\Validate;
class Tags extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}
... ...
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="row">
<div class="col-md-9 col-sm-12">
<div class="panel panel-default panel-intro">
<div class="panel-heading">
<ul class="nav nav-tabs">
<li class="active"><a href="#basic" data-toggle="tab">基础信息</a></li>
</ul>
</div>
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="basic">
<div class="form-group">
<label for="c-channel_id" class="control-label col-xs-12 col-sm-2">{:__('Channel_id')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-channel_id" data-rule="required" class="form-control selectpicker" data-live-search="true" name="row[channel_id]">
{$channelOptions}
</select>
</div>
</div>
<div class="form-group">
<label for="c-channel_id" class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input type="text" class="form-control selectpage" data-source="user/user/index" placeholder="发布会员,可为空" data-field="nickname" name="row[user_id]" />
</div>
</div>
<div class="form-group">
<label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-image"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-image"></ul>
</div>
</div>
<div class="form-group">
<label for="c-tags" class="control-label col-xs-12 col-sm-2">{:__('Tags')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tags" data-rule="" class="form-control selectpage" placeholder="请手动输入或选择标签" data-source="cms/tags/selectpage" data-primary-key="name" data-multiple="true" name="row[tags]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-diyname" class="control-label col-xs-12 col-sm-2">{:__('Diyname')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">{:addon_url('cms/archives/index', [':diyname'=>''])}</button>
</div>
<input type="text" id="c-diyname" data-rule="diyname" name="row[diyname]" class="form-control" placeholder="请输入自定义的名称,为空将使用主键ID" />
</div>
</div>
</div>
<div class="form-group">
<label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" data-rule="required" class="form-control editor" name="row[content]" rows="15" ></textarea>
</div>
</div>
<div class="form-group">
<label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-description" cols="60" rows="5" data-rule="" class="form-control" name="row[description]"></textarea>
</div>
</div>
<div id="extend"></div>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-12">
<div class="panel panel-default panel-intro">
<div class="panel-heading">
<div class="panel-lead"><em>相关信息</em></div>
</div>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane fade active in">
<div class="form-group">
<label for="c-views" class="control-label col-xs-12 col-sm-3">{:__('Views')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group margin-bottom-sm">
<input id="c-views" data-rule="required" class="form-control" name="row[views]" placeholder="{:__('Views')}" type="number" value="0">
<span class="input-group-addon"><i class="fa fa-eye text-success"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label for="c-comments" class="control-label col-xs-12 col-sm-3">{:__('Comments')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group margin-bottom-sm">
<input id="c-comments" data-rule="required" class="form-control" name="row[comments]" placeholder="{:__('Comments')}" type="number" value="0">
<span class="input-group-addon"><i class="fa fa-comment text-info"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label for="c-likes" class="control-label col-xs-12 col-sm-3">{:__('Likes')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group margin-bottom-sm">
<input id="c-likes" data-rule="required" class="form-control" name="row[likes]" placeholder="{:__('Likes')}" type="number" value="0">
<span class="input-group-addon"><i class="fa fa-thumbs-up text-danger"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label for="c-dislikes" class="control-label col-xs-12 col-sm-3">{:__('Dislikes')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group margin-bottom-sm">
<input id="c-dislikes" data-rule="required" class="form-control" name="row[dislikes]" placeholder="{:__('Dislikes')}" type="number" value="0">
<span class="input-group-addon"><i class="fa fa-thumbs-down text-gray"></i></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default panel-intro">
<div class="panel-heading">
<div class="panel-lead"><em>状态</em></div>
</div>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane fade active in">
<div class="form-group">
<label for="c-flag" class="control-label col-xs-12 col-sm-3">{:__('Flag')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-flag" class="form-control selectpicker" multiple="" name="row[flag][]">
{foreach name="flagList" item="vo"}
<option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-status" class="form-control selectpicker" name="row[status]">
{foreach name="statusList" item="vo"}
<option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Publish')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='input-group date'>
<input type='text' name="row[publishtime]" data-date-format="YYYY-MM-DD 00:00:00" value="{:date('Y-m-d H:i:s')}" class="form-control datetimepicker" />
<span class="input-group-addon">
<span class="fa fa-calendar"></span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
\ No newline at end of file
... ...
<div class="panel panel-default panel-intro">
<div class="panel-heading">
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs" data-field="main.model_id">
{foreach name="modelList" item="vo"}
<li class="{:$model['id']==$vo['id']?'active':''}"><a href="cms/archives/content/model_id/{$vo.id}" data-value="{$vo.id}">{$vo.name}</a></li>
{/foreach}
</ul>
</div>
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
{:build_toolbar('refresh,edit,del')}
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-edit="{:$auth->check('cms/model/edit')}"
data-operate-del="{:$auth->check('cms/model/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
... ...
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<input type="hidden" value="{$row.id}" id="archive-id"/>
<div class="row">
<div class="col-md-9 col-sm-12">
<div class="panel panel-default panel-intro">
<div class="panel-heading">
<ul class="nav nav-tabs">
<li class="active"><a href="#basic" data-toggle="tab">基础信息</a></li>
</ul>
</div>
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="basic">
<div class="form-group">
<label for="c-channel_id" class="control-label col-xs-12 col-sm-2">{:__('Channel_id')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-channel_id" data-rule="required" class="form-control selectpicker" data-live-search="true" name="row[channel_id]">
{$channelOptions}
</select>
</div>
</div>
<div class="form-group">
<label for="c-channel_id" class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input type="text" class="form-control selectpage" data-source="user/user/index" placeholder="发布会员,可为空" data-field="nickname" name="row[user_id]" value="{$row.user_id}"/>
</div>
</div>
<div class="form-group">
<label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title}">
</div>
</div>
<div class="form-group">
<label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="{$row.image}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-image"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-image"></ul>
</div>
</div>
<div class="form-group">
<label for="c-tags" class="control-label col-xs-12 col-sm-2">{:__('Tags')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-tags" data-rule="" class="form-control selectpage" placeholder="请手动输入或选择标签" data-source="cms/tags/selectpage" data-primary-key="name" data-multiple="true" name="row[tags]" type="text" value="{$row.tags}">
</div>
</div>
<div class="form-group">
<label for="c-diyname" class="control-label col-xs-12 col-sm-2">{:__('Diyname')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">{:addon_url('cms/archives/index', [':diyname'=>''])}</button>
</div>
<input type="text" id="c-diyname" data-rule="diyname" name="row[diyname]" class="form-control" placeholder="请输入自定义的名称,为空将使用主键ID" value="{$row.diyname}"/>
</div>
</div>
</div>
<div class="form-group">
<label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" data-rule="required" class="form-control editor" name="row[content]" rows="15">{$row.content}</textarea>
</div>
</div>
<div class="form-group">
<label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" type="text" value="{$row.keywords}">
</div>
</div>
<div class="form-group">
<label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-description" cols="60" rows="5" data-rule="" class="form-control" name="row[description]">{$row.description}</textarea>
</div>
</div>
<div id="extend"></div>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-12">
<div class="panel panel-default panel-intro">
<div class="panel-heading">
<div class="panel-lead"><em>相关信息</em></div>
</div>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane fade active in">
<div class="form-group">
<label for="c-views" class="control-label col-xs-12 col-sm-3">{:__('Views')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group margin-bottom-sm">
<input id="c-views" data-rule="required" class="form-control" name="row[views]" placeholder="{:__('Views')}" type="number" value="{$row.views}">
<span class="input-group-addon"><i class="fa fa-eye text-success"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label for="c-comments" class="control-label col-xs-12 col-sm-3">{:__('Comments')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group margin-bottom-sm">
<input id="c-comments" data-rule="required" class="form-control" name="row[comments]" placeholder="{:__('Comments')}" type="number" value="{$row.comments}">
<span class="input-group-addon"><i class="fa fa-comment text-info"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label for="c-likes" class="control-label col-xs-12 col-sm-3">{:__('Likes')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group margin-bottom-sm">
<input id="c-likes" data-rule="required" class="form-control" name="row[likes]" placeholder="{:__('Likes')}" type="number" value="{$row.likes}">
<span class="input-group-addon"><i class="fa fa-thumbs-up text-danger"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label for="c-dislikes" class="control-label col-xs-12 col-sm-3">{:__('Dislikes')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group margin-bottom-sm">
<input id="c-dislikes" data-rule="required" class="form-control" name="row[dislikes]" placeholder="{:__('Dislikes')}" type="number" value="{$row.dislikes}">
<span class="input-group-addon"><i class="fa fa-thumbs-down text-gray"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label for="c-weigh" class="control-label col-xs-12 col-sm-3">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" placeholder="{:__('Weigh')}" type="number" value="{$row.weigh}">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default panel-intro">
<div class="panel-heading">
<div class="panel-lead"><em>状态</em></div>
</div>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane fade active in">
<div class="form-group">
<label for="c-flag" class="control-label col-xs-12 col-sm-3">{:__('Flag')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-flag" class="form-control selectpicker" multiple="" name="row[flag][]">
{foreach name="flagList" item="vo"}
<option value="{$key}" {in name="key" value="$row.flag"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-status" class="form-control selectpicker" name="row[status]">
{foreach name="statusList" item="vo"}
<option value="{$key}" {in name="key" value="$row.status"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3">{:__('Publish')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='input-group date datetimepicker'>
<input type='text' name="row[publishtime]" data-date-format="YYYY-MM-DD 00:00:00" value="{$row.publishtime_text}" class="form-control datetimepicker"/>
<span class="input-group-addon">
<span class="fa fa-calendar"></span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
\ No newline at end of file
... ...
<style>
.radio-inline, .checkbox-inline {
padding-left:0;
}
</style>
{foreach $fields as $item}
<div class="form-group">
<div class="control-label col-xs-12 col-sm-2">{$item.title}</div>
<div class="col-xs-12 col-sm-8">
{switch $item.type}
{case string}
<input type="text" name="row[{$item.name}]" id="c-{$item.name}" value="{$item.value}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}" {$item.extend} />
{/case}
{case value="text" break="0"}{/case}
{case editor}
<textarea name="row[{$item.name}]" id="c-{$item.name}" class="form-control {eq name='$item.type' value='editor'}editor{/eq}" data-rule="{$item.rule}" rows="5" data-tip="{$item.tip}" {$item.extend}>{$item.value}</textarea>
{/case}
{case array}
{php}$arrList=isset($values[$item['name']])?(array)json_decode($item['value'],true):$item['content_list'];{/php}
<dl class="fieldlist" rel="{$arrList|count}" data-name="row[{$item.name}]">
<dd>
<ins>{:__('Array key')}</ins>
<ins>{:__('Array value')}</ins>
</dd>
{foreach $arrList as $key => $vo}
<dd class="form-inline">
<input type="text" name="row[{$item.name}][field][{$key}]" class="form-control" value="{$key}" size="10" />
<input type="text" name="row[{$item.name}][value][{$key}]" class="form-control" value="{$vo}" size="40" />
<span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
<span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
</dd>
{/foreach}
<dd><a href="javascript:;" class="append btn btn-sm btn-success"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
</dl>
{/case}
{case date}
<input type="text" name="row[{$item.name}]" id="c-{$item.name}" value="{$item.value}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-tip="{$item.tip}" data-rule="{$item.rule}" {$item.extend} />
{/case}
{case time}
<input type="text" name="row[{$item.name}]" id="c-{$item.name}" value="{$item.value}" class="form-control datetimepicker" data-date-format="HH:mm:ss" data-tip="{$item.tip}" data-rule="{$item.rule}" {$item.extend} />
{/case}
{case datetime}
<input type="text" name="row[{$item.name}]" id="c-{$item.name}" value="{$item.value}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-tip="{$item.tip}" data-rule="{$item.rule}" {$item.extend} />
{/case}
{case number}
<input type="number" name="row[{$item.name}]" id="c-{$item.name}" value="{$item.value}" class="form-control" data-tip="{$item.tip}" data-rule="{$item.rule}" {$item.extend} />
{/case}
{case checkbox}
{foreach name="item.content_list" item="vo"}
<div class="checkbox checkbox-inline">
<label for="row[{$item.name}][]-{$key}"><input id="row[{$item.name}][]-{$key}" name="row[{$item.name}][]" type="checkbox" value="{$key}" data-rule="{$item.rule}" data-tip="{$item.tip}" {in name="key" value="$item.value"}checked{/in} /> {$vo}</label>
</div>
{/foreach}
{/case}
{case radio}
{foreach name="item.content_list" item="vo"}
<div class="radio radio-inline">
<label for="row[{$item.name}]-{$key}"><input id="row[{$item.name}]-{$key}" name="row[{$item.name}]" type="radio" value="{$key}" data-rule="{$item.rule}" data-tip="{$item.tip}" {in name="key" value="$item.value"}checked{/in} /> {$vo}</label>
</div>
{/foreach}
{/case}
{case value="select" break="0"}{/case}
{case value="selects"}
<select name="row[{$item.name}]{$item.type=='selects'?'[]':''}" class="form-control selectpicker" data-rule="{$item.rule}" data-tip="{$item.tip}" {$item.extend} {$item.type=='selects'?'multiple':''}>
{foreach name="item.content_list" item="vo"}
<option value="{$key}" {in name="key" value="$item.value"}selected{/in}>{$vo}</option>
{/foreach}
</select>
{/case}
{case value="image" break="0"}{/case}
{case value="images"}
<div class="input-group">
<input id="c-{$item.name}" class="form-control" name="row[{$item.name}]" type="text" value="{$item.value}" data-rule="{$item.rule}" data-tip="{$item.tip}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-{$item.name}" class="btn btn-danger plupload" data-input-id="c-{$item.name}" data-preview-id="p-{$item.name}" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="{$item.type=='file'?'false':'true'}" {if $item.maximum}data-maxcount="{$item.maximum}"{/if}><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-{$item.name}" class="btn btn-primary fachoose" data-input-id="c-{$item.name}" data-preview-id="p-{$item.name}" data-mimetype="image/*" data-multiple="{$item.type=='file'?'false':'true'}" {if $item.maximum}data-maxcount="{$item.maximum}"{/if}><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-{$item.name}"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-{$item.name}"></ul>
{/case}
{case value="file" break="0"}{/case}
{case value="files"}
<div class="input-group">
<input id="c-{$item.name}" class="form-control" name="row[{$item.name}]" type="text" value="{$item.value}" data-rule="{$item.rule}" data-tip="{$item.tip}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-{$item.name}" class="btn btn-danger plupload" data-input-id="c-{$item.name}" data-multiple="{$item.type=='file'?'false':'true'}" {if $item.maximum}data-maxcount="{$item.maximum}"{/if}><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-{$item.name}" class="btn btn-primary fachoose" data-input-id="c-{$item.name}" data-multiple="{$item.type=='file'?'false':'true'}" {if $item.maximum}data-maxcount="{$item.maximum}"{/if}><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-{$item.name}"></span>
</div>
{/case}
{case switch}
<input id="c-{$item.name}" name="row[{$item.name}]" type="hidden" value="{:$item.value?1:0}">
<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-{$item.name}" data-yes="1" data-no="0" >
<i class="fa fa-toggle-on text-success {if !$item.value}fa-flip-horizontal text-gray{/if} fa-2x"></i>
</a>
{/case}
{case bool}
<label for="row[{$item.name}]-yes"><input id="row[{$item.name}]-yes" name="row[{$item.name}]" type="radio" value="1" {$item.value?'checked':''} data-tip="{$item.tip}" /> {:__('Yes')}</label>
<label for="row[{$item.name}]-no"><input id="row[{$item.name}]-no" name="row[{$item.name}]" type="radio" value="0" {$item.value?'':'checked'} data-tip="{$item.tip}" /> {:__('No')}</label>
{/case}
{case custom}
{$item.content}
{/case}
{/switch}
</div>
</div>
{/foreach}
\ No newline at end of file
... ...
<style>
.form-commonsearch .form-group {
margin-left: 0;
margin-right: 0;
padding: 0;
}
form.form-commonsearch .control-label {
padding-right: 0;
}
.tdtitle {
margin-bottom: 5px;
font-weight: 600;
}
#channeltree {
margin-left: -6px;
}
#channelbar .panel-heading {
height: 55px;
line-height: 25px;
font-size:14px;
}
@media (max-width: 1230px) {
.fixed-table-toolbar .search .form-control {
display: none;
}
}
@media (min-width: 1200px) {
#channelbar {
width: 20%;
}
#archivespanel {
width: 80%;
}
}
</style>
<div class="row">
<div class="col-md-3 hidden-xs hidden-sm" id="channelbar" style="padding-right:0;">
<div class="panel panel-default panel-intro">
<div class="panel-heading">
<div class="panel-lead">
<em>{:__('Channel list')}</em>
</div>
</div>
<div class="panel-body">
<span class="text-muted"><input type="checkbox" name="" id="checkall"/> <label for="checkall"><small>{:__('Check all')}</small></label></span>
<span class="text-muted"><input type="checkbox" name="" id="expandall" checked=""/> <label for="expandall"><small>{:__('Expand all')}</small></label></span>
<div id="channeltree">
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-md-9" id="archivespanel">
<div class="panel panel-default panel-intro" style="background: #f1f4f6;padding-top: 0;padding-bottom: 0;box-shadow: none;">
<div class="panel-heading">
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs" data-field="status">
<li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
{foreach name="statusList" item="vo"}
<li><a href="#t-{$vo}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
{/foreach}
</ul>
</div>
<div id="myTabContent" class="tab-content" style="background:#fff;padding:15px;">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
{:build_toolbar('refresh,add,del')}
<a class="btn btn-info btn-move dropdown-toggle btn-disabled disabled"><i class="fa fa-arrow-right"></i> {:__('Move')}</a>
<div class="dropdown btn-group {:$auth->check('cms/archives/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=rejected"><i class="fa fa-exclamation-circle"></i> {:__('Set to rejected')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=pulloff"><i class="fa fa-arrow-circle-down"></i> {:__('Set to pulloff')}</a></li>
</ul>
</div>
<a class="btn btn-success btn-recyclebin btn-dialog" href="cms/archives/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>
<div class="dropdown btn-group {:$auth->check('cms/archives/content')?'':'hide'}">
<a href="javascript:;" class="btn btn-info dropdown-toggle" title="{:__('Addon list')}" data-toggle="dropdown"><i class="fa fa-file"></i> {:__('Addon list')}</a>
<ul class="dropdown-menu text-left" role="menu">
{volist name="modelList" id="item"}
<li><a class="btn btn-link btn-addtabs" href="{:url('cms.archives/content')}/model_id/{$item.id}" title="{$item.name}"><i class="fa fa-file"></i> {$item.name}</a></li>
{/volist}
</ul>
</div>
<a href="javascript:;" class="btn btn-default btn-channel hidden-xs hidden-sm"><i class="fa fa-bars"></i></a>
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-edit="{:$auth->check('cms/archives/edit')}"
data-operate-del="{:$auth->check('cms/archives/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<script id="channeltpl" type="text/html">
<div class="box box-solid bg-red-gradient">
<div class="box-header ui-sortable-handle" style="cursor: move;">
{:__('Warning')}
</div>
<!-- /.box-header -->
<div class="box-body">
{:__('Move tips')}
</div>
<!-- /.box-body -->
<div class="box-footer text-black">
<div class="row">
<div class="col-sm-12">
<select name="channel" class="form-control" id="">
<option value="0">{:__('Please select channel')}</option>
{$channelOptions}
</select>
</div>
</div>
<!-- /.row -->
</div>
</div>
</script>
... ...
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
{:build_toolbar('refresh')}
<a class="btn btn-info btn-multi btn-disabled disabled" href="javascript:;" data-url="{:url('cms.archives/restore')}" data-action="restore"><i class="fa fa-rotate-left"></i> {:__('Restore')}</a>
<a class="btn btn-danger btn-multi btn-disabled disabled" href="javascript:;" data-url="{:url('cms.archives/destroy')}" data-action="destroy"><i class="fa fa-times"></i> {:__('Destroy')}</a>
<a class="btn btn-success btn-restoreall" href="{:url('cms.archives/restore')}" title="{:__('Restore all')}"><i class="fa fa-rotate-left"></i> {:__('Restore all')}</a>
<a class="btn btn-danger btn-destroyall" href="{:url('cms.archives/destroy')}" title="{:__('Destroy all')}"><i class="fa fa-times"></i> {:__('Destroy all')}</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-type" data-rule="required" class="form-control selectpage" data-source="cms/block/selectpage_type" placeholder="请手动输入或选择类型" data-primary-key="type" data-field="type" name="row[type]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
</div>
</div>
<div class="form-group">
<label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text">
</div>
</div>
<div class="form-group">
<label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-image" data-rule="" class="form-control" size="50" name="row[image]" type="text" value="">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-image"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-image"></ul>
</div>
</div>
<div class="form-group">
<label for="c-url" class="control-label col-xs-12 col-sm-2">{:__('Url')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-url" data-rule="" class="form-control" name="row[url]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" data-rule="" class="form-control editor" rows="15" name="row[content]" cols="50"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="normal"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-type" data-rule="required" class="form-control selectpage" data-source="cms/block/selectpage_type" placeholder="请手动输入或选择类型" data-primary-key="type" data-field="type" name="row[type]" type="text" value="{$row.type}">
</div>
</div>
<div class="form-group">
<label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name}">
</div>
</div>
<div class="form-group">
<label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title}">
</div>
</div>
<div class="form-group">
<label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-image" data-rule="" class="form-control" size="50" name="row[image]" type="text" value="{$row.image}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-image"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-image"></ul>
</div>
</div>
<div class="form-group">
<label for="c-url" class="control-label col-xs-12 col-sm-2">{:__('Url')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-url" data-rule="" class="form-control" name="row[url]" type="text" value="{$row.url}">
</div>
</div>
<div class="form-group">
<label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" data-rule="" class="form-control editor" rows="15" name="row[content]" cols="50">{$row.content}</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<div class="panel panel-default panel-intro">
<div class="panel-heading">
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs" data-field="type">
<li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
{foreach name="typeList" item="vo"}
<li><a href="#t-{$vo}" data-value="{$vo}" data-toggle="tab">{$vo}</a></li>
{/foreach}
</ul>
</div>
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
{:build_toolbar('refresh,add,edit,del')}
<div class="dropdown btn-group {:$auth->check('cms/block/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
</ul>
</div>
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-edit="{:$auth->check('cms/block/edit')}"
data-operate-del="{:$auth->check('cms/block/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="typeList" item="vo"}
<label for="row[type]-{$key}"><input id="row[type]-{$key}" name="row[type]" type="radio" value="{$key}" {in name="key" value="channel"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
<div class="margin" style="margin-left:0;">
<div class="alert alert-dismissable bg-info">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>栏目</strong>: 栏目类型下不可以发布文章,但可以添加子栏目、列表、链接<br>
<strong>列表</strong>: 列表类型下可以发布文章,但不能添加子栏目<br>
<strong>链接</strong>: 链接类型下不可以发布文章和子级栏目<br>
</div>
</div>
</div>
</div>
<div class="form-group tf tf-list tf-channel">
<label for="c-model_id" class="control-label col-xs-12 col-sm-2">{:__('Model_id')}:</label>
<div class="col-xs-12 col-sm-8">
<select name="row[model_id]" id="c-model_id" class="form-control">
{foreach name="modelList" item="vo"}
<option value="{$vo.id}" data-channeltpl="{$vo.channeltpl}" data-listtpl="{$vo.listtpl}" data-showtpl="{$vo.showtpl}">{$vo.name}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label for="parent_id" class="control-label col-xs-12 col-sm-2">{:__('上级栏目')}:</label>
<div class="col-xs-12 col-sm-8">
<select name="row[parent_id]" data-rule="required" id="parent_id" class="form-control">
<option value="0">{:__('None')}</option>
{foreach name="channelList" item="vo"}
<option value="{$vo.id}" {if $vo.type=='link'}disabled{else /}data-model="{$vo.model_id}"{/if}>{$vo.name}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-name" data-rule="required; channelname" class="form-control" name="row[name]" data-toggle="tooltip" title="如果需要多个一次录入多个分类时请换行输入,录入多个时将忽略自定义名称,批量录入格式:分类名称|自定义名称"></textarea>
</div>
</div>
<div class="form-group">
<label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-image" data-rule="" class="form-control" size="50" name="row[image]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-image"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-image"></ul>
</div>
</div>
<div class="form-group tf tf-channel tf tf-list">
<label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" type="text">
</div>
</div>
<div class="form-group tf tf-channel tf tf-list">
<label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-description" data-rule="" class="form-control" name="row[description]"></textarea>
</div>
</div>
<div class="form-group">
<label for="c-diyname" class="control-label col-xs-12 col-sm-2">{:__('Diyname')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-diyname" data-rule="required(single); diyname" class="form-control" name="row[diyname]" type="text">
</div>
</div>
<div class="form-group tf tf-link">
<label for="c-outlink" class="control-label col-xs-12 col-sm-2">{:__('Outlink')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-outlink" data-rule="required" class="form-control" name="row[outlink]" type="text">
</div>
</div>
<div class="form-group tf tf-channel">
<label for="c-channeltpl" class="control-label col-xs-12 col-sm-2">{:__('Channeltpl')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-channeltpl" data-rule="required" class="form-control selectpage" name="row[channeltpl]" data-source="cms/ajax/get_template_list" data-params='{"type":"channel"}' data-primary-key="name" data-field="name" type="text" placeholder="自定义模板文件必须以channel开头">
</div>
</div>
<div class="form-group tf tf-list">
<label for="c-listtpl" class="control-label col-xs-12 col-sm-2">{:__('Listtpl')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-listtpl" data-rule="required" class="form-control selectpage" name="row[listtpl]" data-source="cms/ajax/get_template_list" data-params='{"type":"list"}' data-primary-key="name" data-field="name" type="text" placeholder="自定义模板文件必须以list开头">
</div>
</div>
<div class="form-group tf tf-list">
<label for="c-showtpl" class="control-label col-xs-12 col-sm-2">{:__('Showtpl')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-showtpl" data-rule="required" class="form-control selectpage" name="row[showtpl]" data-source="cms/ajax/get_template_list" data-params='{"type":"show"}' data-primary-key="name" data-field="name" type="text" placeholder="自定义模板文件必须以show开头">
</div>
</div>
<div class="form-group tf tf-list">
<label for="c-pagesize" class="control-label col-xs-12 col-sm-2">{:__('Pagesize')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-pagesize" data-rule="required" class="form-control" name="row[pagesize]" type="number" value="10">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="normal"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
{:build_toolbar('refresh')}
</div>
<table id="table" class="table table-striped table-bordered table-hover" width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
<script id="authorizationtpl" type="text/html">
<div class="content">
<span class="text-muted"><input type="checkbox" name="" id="checkall" /> <label for="checkall"><small>{:__('Check all')}</small></label></span>
<span class="text-muted"><input type="checkbox" name="" id="expandall" checked="" /> <label for="expandall"><small>{:__('Expand all')}</small></label></span>
<div id="channeltree"></div>
</div>
</script>
\ No newline at end of file
... ...
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<input type="hidden" value="{$row.id}" id="channel-id" />
<div class="form-group">
<label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="typeList" item="vo"}
<label for="row[type]-{$key}"><input id="row[type]-{$key}" name="row[type]" disabled type="radio" value="{$key}" {in name="key" value="$row.type"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
<div class="margin" style="margin-left:0;">
<div class="alert alert-dismissable bg-info">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>栏目</strong>: 栏目类型下不可以发布文章,但可以添加子栏目、列表、链接<br>
<strong>列表</strong>: 列表类型下可以发布文章,但不能添加子栏目<br>
<strong>链接</strong>: 链接类型下不可以发布文章和子级栏目<br>
</div>
</div>
</div>
</div>
<div class="form-group tf tf-list tf-channel">
<label for="c-model_id" class="control-label col-xs-12 col-sm-2">{:__('Model_id')}:</label>
<div class="col-xs-12 col-sm-8">
<select name="row[model_id]" id="c-model_id" class="form-control " disabled>
{foreach name="modelList" item="vo"}
<option {in name="vo.id" value="$row.model_id"}selected="selected"{/in} value="{$vo.id}" data-channeltpl="{$vo.channeltpl}" data-listtpl="{$vo.listtpl}" data-showtpl="{$vo.showtpl}">{$vo.name}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label for="parent_id" class="control-label col-xs-12 col-sm-2">{:__('上级栏目')}:</label>
<div class="col-xs-12 col-sm-8">
<select name="row[parent_id]" data-rule="required" id="parent_id" class="form-control">
<option value="0">{:__('None')}</option>
{foreach name="channelList" item="vo"}
<option value="{$vo.id}" {if $vo.type!=='link'}data-model="{$vo.model_id}"{/if} {if $vo.type=='link' || $vo.id==$row.id || $vo.model_id!=$row.model_id}disabled{/if} {if $vo.id==$row.parent_id}selected{/if}>{$vo.name}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name}" />
</div>
</div>
<div class="form-group">
<label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-image" data-rule="" class="form-control" size="50" name="row[image]" type="text" value="{$row.image}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-image"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-image"></ul>
</div>
</div>
<div class="form-group tf tf-channel tf tf-list">
<label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" type="text" value="{$row.keywords}">
</div>
</div>
<div class="form-group tf tf-channel tf tf-list">
<label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-description" data-rule="" class="form-control" name="row[description]">{$row.description}</textarea>
</div>
</div>
<div class="form-group">
<label for="c-diyname" class="control-label col-xs-12 col-sm-2">{:__('Diyname')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-diyname" data-rule="required; diyname" class="form-control" name="row[diyname]" type="text" value="{$row.diyname}">
</div>
</div>
<div class="form-group tf tf-link">
<label for="c-outlink" class="control-label col-xs-12 col-sm-2">{:__('Outlink')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-outlink" data-rule="required" class="form-control" name="row[outlink]" type="text" value="{$row.outlink}">
</div>
</div>
<div class="form-group tf tf-channel">
<label for="c-channeltpl" class="control-label col-xs-12 col-sm-2">{:__('Channeltpl')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-channeltpl" data-rule="required" class="form-control selectpage" name="row[channeltpl]" data-source="cms/ajax/get_template_list" data-params='{"type":"channel"}' data-primary-key="name" data-field="name" type="text" value="{$row.channeltpl}" placeholder="自定义模板文件必须以channel开头">
</div>
</div>
<div class="form-group tf tf-list">
<label for="c-listtpl" class="control-label col-xs-12 col-sm-2">{:__('Listtpl')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-listtpl" data-rule="required" class="form-control selectpage" name="row[listtpl]" data-source="cms/ajax/get_template_list" data-params='{"type":"list"}' data-primary-key="name" data-field="name" type="text" value="{$row.listtpl}" placeholder="自定义模板文件必须以list开头">
</div>
</div>
<div class="form-group tf tf-list">
<label for="c-showtpl" class="control-label col-xs-12 col-sm-2">{:__('Showtpl')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-showtpl" data-rule="required" class="form-control selectpage" name="row[showtpl]" data-source="cms/ajax/get_template_list" data-params='{"type":"show"}' data-primary-key="name" data-field="name" type="text" value="{$row.showtpl}" placeholder="自定义模板文件必须以show开头">
</div>
</div>
<div class="form-group tf tf-list">
<label for="c-pagesize" class="control-label col-xs-12 col-sm-2">{:__('Pagesize')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-pagesize" data-rule="required" class="form-control" name="row[pagesize]" type="number" value="{$row.pagesize}">
</div>
</div>
<div class="form-group">
<label for="c-weigh" class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<div class="panel panel-default panel-intro">
<div class="panel-heading">
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs" data-field="model_id">
<li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
{foreach name="modelList" item="vo"}
<li><a href="#t-{$vo.id}" data-value="{$vo.id}" data-toggle="tab">{$vo.name}</a></li>
{/foreach}
</ul>
</div>
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
{:build_toolbar('refresh,add,edit,del')}
<div class="dropdown btn-group {:$auth->check('cms/channel/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
</ul>
</div>
{if $auth->check('cms/channel/admin')}
<a class="btn btn-warning btn-dialog" href="{:url('cms.channel/admin')}" title="{:__('栏目授权')}"><i class="fa fa-cog"></i> {:__('栏目授权')}</a>
{/if}
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-edit="{:$auth->check('cms/channel/edit')}"
data-operate-del="{:$auth->check('cms/channel/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
{foreach name="typeList" item="vo"}
<option value="{$key}" {in name="key" value="archives"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label for="c-aid" class="control-label col-xs-12 col-sm-2">{:__('Aid')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-aid" data-rule="required" class="form-control" name="row[aid]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label for="c-pid" class="control-label col-xs-12 col-sm-2">{:__('Pid')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-pid" data-rule="required" class="form-control" name="row[pid]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label for="c-user_id" class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" class="form-control" name="row[user_id]" type="text" value="0">
</div>
</div>
<div class="form-group">
<label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
</div>
</div>
<div class="form-group">
<label for="c-comments" class="control-label col-xs-12 col-sm-2">{:__('Comments')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-comments" data-rule="required" class="form-control" name="row[comments]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label for="c-ip" class="control-label col-xs-12 col-sm-2">{:__('Ip')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-ip" data-rule="" class="form-control" name="row[ip]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-useragent" class="control-label col-xs-12 col-sm-2">{:__('Useragent')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-useragent" data-rule="" class="form-control" name="row[useragent]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-subscribe" class="control-label col-xs-12 col-sm-2">{:__('Subscribe')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[subscribe]', [1=>'是', 0=>'否'])}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="normal"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
{foreach name="typeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.type"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label for="c-aid" class="control-label col-xs-12 col-sm-2">{:__('Aid')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-aid" data-rule="required" class="form-control" name="row[aid]" type="number" value="{$row.aid}">
</div>
</div>
<div class="form-group">
<label for="c-pid" class="control-label col-xs-12 col-sm-2">{:__('Pid')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-pid" data-rule="required" class="form-control" name="row[pid]" type="number" value="{$row.pid}">
</div>
</div>
<div class="form-group">
<label for="c-user_id" class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" class="form-control" name="row[user_id]" type="text" value="{$row.user_id}">
</div>
</div>
<div class="form-group">
<label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content}</textarea>
</div>
</div>
<div class="form-group">
<label for="c-comments" class="control-label col-xs-12 col-sm-2">{:__('Comments')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-comments" data-rule="required" class="form-control" name="row[comments]" type="number" value="{$row.comments}">
</div>
</div>
<div class="form-group">
<label for="c-ip" class="control-label col-xs-12 col-sm-2">{:__('Ip')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-ip" data-rule="required" class="form-control" name="row[ip]" type="text" value="{$row.ip}">
</div>
</div>
<div class="form-group">
<label for="c-useragent" class="control-label col-xs-12 col-sm-2">{:__('Useragent')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-useragent" data-rule="required" class="form-control" name="row[useragent]" type="text" value="{$row.useragent}">
</div>
</div>
<div class="form-group">
<label for="c-subscribe" class="control-label col-xs-12 col-sm-2">{:__('Subscribe')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[subscribe]', [1=>'是', 0=>'否'], $row['subscribe'])}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<div class="panel panel-default panel-intro">
<div class="panel-heading">
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs" data-field="type">
<li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
{foreach name="typeList" item="vo"}
<li><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
{/foreach}
</ul>
</div>
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('cms/comment/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('cms/comment/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('cms/comment/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<div class="dropdown btn-group {:$auth->check('cms/comment/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
</ul>
</div>
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-edit="{:$auth->check('cms/comment/edit')}"
data-operate-del="{:$auth->check('cms/comment/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-source="user/user/index" data-field='nickname' class="form-control selectpage" name="row[user_id]" type="text" value="">
</div>
</div>
{include file="cms/diydata/fields"}
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-source="user/user/index" data-field='nickname' class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id}">
</div>
</div>
{include file="cms/diydata/fields"}
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
{foreach $fields as $item}
<div class="form-group">
<div class="control-label col-xs-12 col-sm-2">{$item.title}</div>
<div class="col-xs-12 col-sm-8">
{switch $item.type}
{case string}
<input type="text" name="row[{$item.name}]" id="c-{$item.name}" value="{$item.value}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}" {$item.extend} />
{/case}
{case value="text" break="0"}{/case}
{case editor}
<textarea name="row[{$item.name}]" id="c-{$item.name}" class="form-control {eq name='$item.type' value='editor'}editor{/eq}" data-rule="{$item.rule}" rows="5" data-tip="{$item.tip}" {$item.extend}>{$item.value}</textarea>
{/case}
{case array}
{php}$arrList=isset($values[$item['name']])?(array)json_decode($item['value'],true):$item['content_list'];{/php}
<dl class="fieldlist" rel="{$arrList|count}" data-name="row[{$item.name}]">
<dd>
<ins>{:__('Array key')}</ins>
<ins>{:__('Array value')}</ins>
</dd>
{foreach $arrList as $key => $vo}
<dd class="form-inline">
<input type="text" name="row[{$item.name}][field][{$key}]" class="form-control" value="{$key}" size="10" />
<input type="text" name="row[{$item.name}][value][{$key}]" class="form-control" value="{$vo}" size="40" />
<span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
<span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
</dd>
{/foreach}
<dd><a href="javascript:;" class="append btn btn-sm btn-success"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
</dl>
{/case}
{case date}
<input type="text" name="row[{$item.name}]" id="c-{$item.name}" value="{$item.value}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-tip="{$item.tip}" data-rule="{$item.rule}" {$item.extend} />
{/case}
{case time}
<input type="text" name="row[{$item.name}]" id="c-{$item.name}" value="{$item.value}" class="form-control datetimepicker" data-date-format="HH:mm:ss" data-tip="{$item.tip}" data-rule="{$item.rule}" {$item.extend} />
{/case}
{case datetime}
<input type="text" name="row[{$item.name}]" id="c-{$item.name}" value="{$item.value}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-tip="{$item.tip}" data-rule="{$item.rule}" {$item.extend} />
{/case}
{case number}
<input type="number" name="row[{$item.name}]" id="c-{$item.name}" value="{$item.value}" class="form-control" data-tip="{$item.tip}" data-rule="{$item.rule}" {$item.extend} />
{/case}
{case checkbox}
{foreach name="item.content_list" item="vo"}
<label for="row[{$item.name}][]-{$key}"><input id="row[{$item.name}][]-{$key}" name="row[{$item.name}][]" type="checkbox" value="{$key}" data-rule="{$item.rule}" data-tip="{$item.tip}" {in name="key" value="$item.value"}checked{/in} /> {$vo}</label>
{/foreach}
{/case}
{case radio}
{foreach name="item.content_list" item="vo"}
<label for="row[{$item.name}]-{$key}"><input id="row[{$item.name}]-{$key}" name="row[{$item.name}]" type="radio" value="{$key}" data-rule="{$item.rule}" data-tip="{$item.tip}" {in name="key" value="$item.value"}checked{/in} /> {$vo}</label>
{/foreach}
{/case}
{case value="select" break="0"}{/case}
{case value="selects"}
<select name="row[{$item.name}]{$item.type=='selects'?'[]':''}" class="form-control selectpicker" data-rule="{$item.rule}" data-tip="{$item.tip}" {$item.extend} {$item.type=='selects'?'multiple':''}>
{foreach name="item.content_list" item="vo"}
<option value="{$key}" {in name="key" value="$item.value"}selected{/in}>{$vo}</option>
{/foreach}
</select>
{/case}
{case value="image" break="0"}{/case}
{case value="images"}
<div class="input-group">
<input id="c-{$item.name}" class="form-control" name="row[{$item.name}]" type="text" value="{$item.value}" data-rule="{$item.rule}" data-tip="{$item.tip}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-{$item.name}" class="btn btn-danger plupload" data-input-id="c-{$item.name}" data-preview-id="p-{$item.name}" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="{$item.type=='file'?'false':'true'}" {if $item.maximum}data-maxcount="{$item.maximum}"{/if}><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-{$item.name}" class="btn btn-primary fachoose" data-input-id="c-{$item.name}" data-preview-id="p-{$item.name}" data-mimetype="image/*" data-multiple="{$item.type=='file'?'false':'true'}" {if $item.maximum}data-maxcount="{$item.maximum}"{/if}><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-{$item.name}"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-{$item.name}"></ul>
{/case}
{case value="file" break="0"}{/case}
{case value="files"}
<div class="input-group">
<input id="c-{$item.name}" class="form-control" name="row[{$item.name}]" type="text" value="{$item.value}" data-rule="{$item.rule}" data-tip="{$item.tip}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-{$item.name}" class="btn btn-danger plupload" data-input-id="c-{$item.name}" data-multiple="{$item.type=='file'?'false':'true'}" {if $item.maximum}data-maxcount="{$item.maximum}"{/if}><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-{$item.name}" class="btn btn-primary fachoose" data-input-id="c-{$item.name}" data-multiple="{$item.type=='file'?'false':'true'}" {if $item.maximum}data-maxcount="{$item.maximum}"{/if}><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-{$item.name}"></span>
</div>
{/case}
{case switch}
<input id="c-{$item.name}" name="row[{$item.name}]" type="hidden" value="{:$item.value?1:0}">
<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-{$item.name}" data-yes="1" data-no="0" >
<i class="fa fa-toggle-on text-success {if !$item.value}fa-flip-horizontal text-gray{/if} fa-2x"></i>
</a>
{/case}
{case bool}
<label for="row[{$item.name}]-yes"><input id="row[{$item.name}]-yes" name="row[{$item.name}]" type="radio" value="1" {$item.value?'checked':''} data-tip="{$item.tip}" /> {:__('Yes')}</label>
<label for="row[{$item.name}]-no"><input id="row[{$item.name}]-no" name="row[{$item.name}]" type="radio" value="0" {$item.value?'':'checked'} data-tip="{$item.tip}" /> {:__('No')}</label>
{/case}
{case custom}
{$item.content}
{/case}
{/switch}
</div>
</div>
{/foreach}
\ No newline at end of file
... ...
<div class="panel panel-default panel-intro">
<div class="panel-heading">
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs" data-field="diyform_id">
{foreach name="diyformList" item="vo"}
<li class="{:$diyform['id']==$vo['id']?'active':''}"><a href="{:url('cms.diydata/index')}/diyform_id/{$vo.id}" data-value="{$vo.id}">{$vo.name}</a></li>
{/foreach}
</ul>
</div>
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
{:build_toolbar('refresh,add,edit,del')}
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-edit="{:$auth->check('cms/block/edit')}"
data-operate-del="{:$auth->check('cms/block/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
</div>
</div>
<div class="form-group">
<label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text">
</div>
</div>
<div class="form-group">
<label for="c-table" class="control-label col-xs-12 col-sm-2">{:__('Table')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-table" data-rule="required" class="form-control" name="row[table]" type="text">
</div>
</div>
<div class="form-group">
<label for="c-diyname" class="control-label col-xs-12 col-sm-2">{:__('Diyname')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-diyname" data-rule="" class="form-control" name="row[diyname]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-description" cols="60" rows="5" data-rule="" class="form-control" name="row[description]"></textarea>
</div>
</div>
<div class="form-group">
<label for="c-successtips" class="control-label col-xs-12 col-sm-2">{:__('Successtips')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-successtips" cols="60" rows="5" data-rule="" class="form-control" name="row[successtips]"></textarea>
</div>
</div>
<div class="form-group">
<label for="c-formtpl" class="control-label col-xs-12 col-sm-2">{:__('Formtpl')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-formtpl" data-rule="required" class="form-control selectpage" name="row[formtpl]" data-source="cms/ajax/get_template_list" data-params='{"type":"diyform"}' data-primary-key="name" data-field="name" type="text" placeholder="自定义模板文件必须以diyform开头">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Needlogin')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-needlogin" name="row[needlogin]" type="hidden" value="0">
<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-needlogin" data-yes="1" data-no="0" >
<i class="fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x"></i>
</a>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="normal" }checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name}">
</div>
</div>
<div class="form-group">
<label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title}">
</div>
</div>
<div class="form-group">
<label for="c-table" class="control-label col-xs-12 col-sm-2">{:__('Table')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-table" data-rule="required" class="form-control" name="row[table]" readonly="" type="text" value="{$row.table}">
</div>
</div>
<div class="form-group">
<label for="c-diyname" class="control-label col-xs-12 col-sm-2">{:__('Diyname')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-diyname" data-rule="" class="form-control" name="row[diyname]" type="text" value="{$row.diyname}">
</div>
</div>
<div class="form-group">
<label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" type="text" value="{$row.keywords}">
</div>
</div>
<div class="form-group">
<label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-description" cols="60" rows="5" data-rule="" class="form-control" name="row[description]">{$row.description}</textarea>
</div>
</div>
<div class="form-group">
<label for="c-successtips" class="control-label col-xs-12 col-sm-2">{:__('Successtips')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-successtips" cols="60" rows="5" data-rule="" class="form-control" name="row[successtips]">{$row.successtips}</textarea>
</div>
</div>
<div class="form-group">
<label for="c-formtpl" class="control-label col-xs-12 col-sm-2">{:__('Formtpl')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-formtpl" data-rule="required" class="form-control selectpage" name="row[formtpl]" data-source="cms/ajax/get_template_list" data-params='{"type":"diyform"}' data-primary-key="name" data-field="name" type="text" placeholder="自定义模板文件必须以diyform开头" value="{$row.formtpl}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Needlogin')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-iscontribute" name="row[needlogin]" type="hidden" value="{$row.needlogin}">
<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-needlogin" data-yes="1" data-no="0">
<i class="fa fa-toggle-on text-success {eq name=" $row.needlogin" value="0"}fa-flip-horizontal text-gray{/eq} fa-2x"></i>
</a>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status" }checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
{:build_toolbar('refresh,add,edit,del')}
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-buttons-index="{:$auth->check('cms/archives/index')}"
data-buttons-content="{:$auth->check('cms/archives/content')}"
data-buttons-fields="{:$auth->check('cms/fields/index')}"
data-operate-edit="{:$auth->check('cms/model/edit')}"
data-operate-del="{:$auth->check('cms/model/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
... ...
<script>
var typelist = {$typeList|json_encode};
var contentlist = {$row.content??'[]'};
</script>
<style>
.iteminner {margin-bottom:15px;border-bottom:1px solid #ddd;background:#fff;}
</style>
<script id="itemtpl" type="text/html">
<div class="col-xs-6 iteminner">
<div class="form-group">
<div class="control-label col-xs-4"><span class="text-danger">*</span> 类型</div>
<div class="col-xs-8">
<select name="row[content][<%=i%>][type]" <%=readonly?'readonly':''%> class="form-control">
<%for(var m in typelist){%>
<option value="<%=m%>" <%=m==type?'selected':''%>><%=typelist[m]%></option>
<%}%>
</select>
</div>
</div>
<div class="form-group">
<div class="control-label col-xs-4"><span class="text-danger">*</span> 变量名</div>
<div class="col-xs-8">
<input type="text" name="row[content][<%=i%>][name]" <%=readonly?'readonly':''%> class="form-control" value="<%=name%>" />
</div>
</div>
<div class="form-group">
<div class="control-label col-xs-4"><span class="text-danger">*</span> 标题</div>
<div class="col-xs-8">
<input type="text" name="row[content][<%=i%>][title]" <%=readonly?'readonly':''%> class="form-control" value="<%=title%>" />
</div>
</div>
<div class="form-group">
<div class="control-label col-xs-4">默认值</div>
<div class="col-xs-8">
<input type="text" name="row[content][<%=i%>][value]" class="form-control" value="<%=value%>" />
</div>
</div>
<div class="form-group">
<div class="control-label col-xs-4">校验规则</div>
<div class="col-xs-8">
<input type="text" name="row[content][<%=i%>][rule]" <%=readonly?'readonly':''%> class="form-control" value="<%=rule%>" />
</div>
</div>
<div class="form-group multiple">
<div class="control-label col-xs-4">数据列表</div>
<div class="col-xs-8">
<textarea name="row[content][<%=i%>][content]" <%=['select','selects','checkbox','radio'].indexOf(type)>-1?'':'readonly'%> cols="30" rows="3" class="form-control" data-rule="required"><%=content%></textarea>
</div>
</div>
<div class="form-group">
<div class="control-label col-xs-4">扩展属性</div>
<div class="col-xs-8">
<textarea name="row[content][<%=i%>][extend]" id="extend" cols="30" rows="3" class="form-control"><%=extend%></textarea>
</div>
</div>
<div class="form-group">
<div class="control-label col-xs-4"></div>
<div class="col-xs-8">
<a href="javascript:;" class="btn btn-primary btn-dragsort btn-xs"><i class="fa fa-arrows"></i></a>
<%if(['mobile', 'name', 'gender', 'ethnic'].indexOf(name)==-1){%>
<a href="javascript:;" class="btn btn-danger btn-delone btn-xs"><i class="fa fa-trash"></i></a>
<%}%>
</div>
</div>
</div>
</script>
\ No newline at end of file
... ...