正在显示
69 个修改的文件
包含
4681 行增加
和
1 行删除
addons/cms/Cms.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace addons\cms; | ||
4 | + | ||
5 | +use addons\cms\model\Archives; | ||
6 | +use addons\cms\model\Channel; | ||
7 | +use app\common\library\Auth; | ||
8 | +use app\common\library\Menu; | ||
9 | +use fast\Tree; | ||
10 | +use think\Addons; | ||
11 | +use think\Request; | ||
12 | +use think\View; | ||
13 | + | ||
14 | +/** | ||
15 | + * CMS插件 | ||
16 | + */ | ||
17 | +class Cms extends Addons | ||
18 | +{ | ||
19 | + /** | ||
20 | + * 插件安装方法 | ||
21 | + * @return bool | ||
22 | + */ | ||
23 | + public function install() | ||
24 | + { | ||
25 | + $menu = [ | ||
26 | + [ | ||
27 | + 'name' => 'cms', | ||
28 | + 'title' => 'CMS管理', | ||
29 | + 'sublist' => [ | ||
30 | + [ | ||
31 | + 'name' => 'cms/archives', | ||
32 | + 'title' => '内容管理', | ||
33 | + 'icon' => 'fa fa-file-text-o', | ||
34 | + 'sublist' => [ | ||
35 | + ['name' => 'cms/archives/index', 'title' => '查看'], | ||
36 | + ['name' => 'cms/archives/content', 'title' => '副表管理', 'remark' => '用于管理模型副表的数据列表,不建议在此进行删除操作'], | ||
37 | + ['name' => 'cms/archives/add', 'title' => '添加'], | ||
38 | + ['name' => 'cms/archives/edit', 'title' => '修改'], | ||
39 | + ['name' => 'cms/archives/del', 'title' => '删除'], | ||
40 | + ['name' => 'cms/archives/multi', 'title' => '批量更新'], | ||
41 | + ] | ||
42 | + ], | ||
43 | + [ | ||
44 | + 'name' => 'cms/channel', | ||
45 | + 'title' => '栏目管理', | ||
46 | + 'icon' => 'fa fa-list', | ||
47 | + 'sublist' => [ | ||
48 | + ['name' => 'cms/channel/index', 'title' => '查看'], | ||
49 | + ['name' => 'cms/channel/add', 'title' => '添加'], | ||
50 | + ['name' => 'cms/channel/edit', 'title' => '修改'], | ||
51 | + ['name' => 'cms/channel/del', 'title' => '删除'], | ||
52 | + ['name' => 'cms/channel/multi', 'title' => '批量更新'], | ||
53 | + ['name' => 'cms/channel/admin', 'title' => '栏目授权'], | ||
54 | + ], | ||
55 | + 'remark' => '用于管理网站的分类,可进行无限级分类,注意只有类型为列表的才可以添加文章' | ||
56 | + ], | ||
57 | + [ | ||
58 | + 'name' => 'cms/modelx', | ||
59 | + 'title' => '模型管理', | ||
60 | + 'icon' => 'fa fa-th', | ||
61 | + 'sublist' => [ | ||
62 | + ['name' => 'cms/modelx/index', 'title' => '查看'], | ||
63 | + ['name' => 'cms/modelx/add', 'title' => '添加'], | ||
64 | + ['name' => 'cms/modelx/edit', 'title' => '修改'], | ||
65 | + ['name' => 'cms/modelx/del', 'title' => '删除'], | ||
66 | + ['name' => 'cms/modelx/multi', 'title' => '批量更新'], | ||
67 | + [ | ||
68 | + 'name' => 'cms/fields', | ||
69 | + 'title' => '字段管理', | ||
70 | + 'icon' => 'fa fa-fields', | ||
71 | + 'ismenu' => 0, | ||
72 | + 'sublist' => [ | ||
73 | + ['name' => 'cms/fields/index', 'title' => '查看'], | ||
74 | + ['name' => 'cms/fields/add', 'title' => '添加'], | ||
75 | + ['name' => 'cms/fields/edit', 'title' => '修改'], | ||
76 | + ['name' => 'cms/fields/del', 'title' => '删除'], | ||
77 | + ['name' => 'cms/fields/multi', 'title' => '批量更新'], | ||
78 | + ], | ||
79 | + 'remark' => '用于管理模型或表单的字段,进行相关的增删改操作' | ||
80 | + ] | ||
81 | + ], | ||
82 | + 'remark' => '在线添加修改删除模型,管理模型字段和相关模型数据' | ||
83 | + ], | ||
84 | + [ | ||
85 | + 'name' => 'cms/tags', | ||
86 | + 'title' => '标签管理', | ||
87 | + 'icon' => 'fa fa-tags', | ||
88 | + 'sublist' => [ | ||
89 | + ['name' => 'cms/tags/index', 'title' => '查看'], | ||
90 | + ['name' => 'cms/tags/add', 'title' => '添加'], | ||
91 | + ['name' => 'cms/tags/edit', 'title' => '修改'], | ||
92 | + ['name' => 'cms/tags/del', 'title' => '删除'], | ||
93 | + ['name' => 'cms/tags/multi', 'title' => '批量更新'], | ||
94 | + ], | ||
95 | + 'remark' => '用于管理文章关联的标签,标签的添加在添加文章时自动维护,无需手动添加标签' | ||
96 | + ], | ||
97 | + [ | ||
98 | + 'name' => 'cms/block', | ||
99 | + 'title' => '区块管理', | ||
100 | + 'icon' => 'fa fa-th-large', | ||
101 | + 'sublist' => [ | ||
102 | + ['name' => 'cms/block/index', 'title' => '查看'], | ||
103 | + ['name' => 'cms/block/add', 'title' => '添加'], | ||
104 | + ['name' => 'cms/block/edit', 'title' => '修改'], | ||
105 | + ['name' => 'cms/block/del', 'title' => '删除'], | ||
106 | + ['name' => 'cms/block/multi', 'title' => '批量更新'], | ||
107 | + ], | ||
108 | + 'remark' => '用于管理站点的自定义区块内容,常用于广告、JS脚本、焦点图、片段代码等' | ||
109 | + ], | ||
110 | + [ | ||
111 | + 'name' => 'cms/page', | ||
112 | + 'title' => '单页管理', | ||
113 | + 'icon' => 'fa fa-file', | ||
114 | + 'sublist' => [ | ||
115 | + ['name' => 'cms/page/index', 'title' => '查看'], | ||
116 | + ['name' => 'cms/page/add', 'title' => '添加'], | ||
117 | + ['name' => 'cms/page/edit', 'title' => '修改'], | ||
118 | + ['name' => 'cms/page/del', 'title' => '删除'], | ||
119 | + ['name' => 'cms/page/multi', 'title' => '批量更新'], | ||
120 | + ], | ||
121 | + 'remark' => '用于管理网站的单页面,可任意创建修改删除单页面' | ||
122 | + ], | ||
123 | + [ | ||
124 | + 'name' => 'cms/comment', | ||
125 | + 'title' => '评论管理', | ||
126 | + 'icon' => 'fa fa-comment', | ||
127 | + 'sublist' => [ | ||
128 | + ['name' => 'cms/comment/index', 'title' => '查看'], | ||
129 | + ['name' => 'cms/comment/add', 'title' => '添加'], | ||
130 | + ['name' => 'cms/comment/edit', 'title' => '修改'], | ||
131 | + ['name' => 'cms/comment/del', 'title' => '删除'], | ||
132 | + ['name' => 'cms/comment/multi', 'title' => '批量更新'], | ||
133 | + ], | ||
134 | + 'remark' => '用于管理用户在网站上发表的评论,可任意修改或隐藏评论' | ||
135 | + ], | ||
136 | + [ | ||
137 | + 'name' => 'cms/diyform', | ||
138 | + 'title' => '自定义表单管理', | ||
139 | + 'icon' => 'fa fa-list', | ||
140 | + 'sublist' => [ | ||
141 | + ['name' => 'cms/diyform/index', 'title' => '查看'], | ||
142 | + ['name' => 'cms/diyform/add', 'title' => '添加'], | ||
143 | + ['name' => 'cms/diyform/edit', 'title' => '修改'], | ||
144 | + ['name' => 'cms/diyform/del', 'title' => '删除'], | ||
145 | + ['name' => 'cms/diyform/multi', 'title' => '批量更新'], | ||
146 | + ], | ||
147 | + 'remark' => '可在线创建自定义表单,管理表单字段和数据列表' | ||
148 | + ], | ||
149 | + [ | ||
150 | + 'name' => 'cms/diydata', | ||
151 | + 'title' => '自定义表单数据管理', | ||
152 | + 'icon' => 'fa fa-list', | ||
153 | + 'ismenu' => 0, | ||
154 | + 'sublist' => [ | ||
155 | + ['name' => 'cms/diydata/index', 'title' => '查看'], | ||
156 | + ['name' => 'cms/diydata/add', 'title' => '添加'], | ||
157 | + ['name' => 'cms/diydata/edit', 'title' => '修改'], | ||
158 | + ['name' => 'cms/diydata/del', 'title' => '删除'], | ||
159 | + ['name' => 'cms/diydata/multi', 'title' => '批量更新'], | ||
160 | + ], | ||
161 | + 'remark' => '可在线管理自定义表单的数据列表' | ||
162 | + ], | ||
163 | + [ | ||
164 | + 'name' => 'cms/order', | ||
165 | + 'title' => '订单管理', | ||
166 | + 'icon' => 'fa fa-cny', | ||
167 | + 'ismenu' => 1, | ||
168 | + 'sublist' => [ | ||
169 | + ['name' => 'cms/order/index', 'title' => '查看'], | ||
170 | + ['name' => 'cms/order/add', 'title' => '添加'], | ||
171 | + ['name' => 'cms/order/edit', 'title' => '修改'], | ||
172 | + ['name' => 'cms/order/del', 'title' => '删除'], | ||
173 | + ['name' => 'cms/order/multi', 'title' => '批量更新'], | ||
174 | + ], | ||
175 | + 'remark' => '可在线管理付费查看所产生的订单' | ||
176 | + ] | ||
177 | + ] | ||
178 | + ] | ||
179 | + ]; | ||
180 | + Menu::create($menu); | ||
181 | + return true; | ||
182 | + } | ||
183 | + | ||
184 | + /** | ||
185 | + * 插件卸载方法 | ||
186 | + * @return bool | ||
187 | + */ | ||
188 | + public function uninstall() | ||
189 | + { | ||
190 | + Menu::delete('cms'); | ||
191 | + return true; | ||
192 | + } | ||
193 | + | ||
194 | + /** | ||
195 | + * 插件启用方法 | ||
196 | + */ | ||
197 | + public function enable() | ||
198 | + { | ||
199 | + Menu::enable('cms'); | ||
200 | + } | ||
201 | + | ||
202 | + /** | ||
203 | + * 插件禁用方法 | ||
204 | + */ | ||
205 | + public function disable() | ||
206 | + { | ||
207 | + Menu::disable('cms'); | ||
208 | + } | ||
209 | + | ||
210 | + /** | ||
211 | + * 会员中心边栏后 | ||
212 | + * @return mixed | ||
213 | + * @throws \Exception | ||
214 | + */ | ||
215 | + public function userSidenavAfter() | ||
216 | + { | ||
217 | + $request = Request::instance(); | ||
218 | + $actionname = strtolower($request->action()); | ||
219 | + $data = [ | ||
220 | + 'actionname' => $actionname | ||
221 | + ]; | ||
222 | + return $this->fetch('view/hook/user_sidenav_after', $data); | ||
223 | + } | ||
224 | + | ||
225 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\cms; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * Ajax | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + * @internal | ||
12 | + */ | ||
13 | +class Ajax extends Backend | ||
14 | +{ | ||
15 | + | ||
16 | + /** | ||
17 | + * 模型对象 | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + protected $noNeedRight = ['*']; | ||
21 | + | ||
22 | + public function _initialize() | ||
23 | + { | ||
24 | + parent::_initialize(); | ||
25 | + } | ||
26 | + | ||
27 | + /** | ||
28 | + * 获取模板列表 | ||
29 | + * @internal | ||
30 | + */ | ||
31 | + public function get_template_list() | ||
32 | + { | ||
33 | + $files = []; | ||
34 | + $keyValue = $this->request->request("keyValue"); | ||
35 | + if (!$keyValue) { | ||
36 | + $type = $this->request->request("type"); | ||
37 | + $name = $this->request->request("name"); | ||
38 | + if ($name) { | ||
39 | + //$files[] = ['name' => $name . '.html']; | ||
40 | + } | ||
41 | + //设置过滤方法 | ||
42 | + $this->request->filter(['strip_tags']); | ||
43 | + $config = get_addon_config('cms'); | ||
44 | + $themeDir = ADDON_PATH . 'cms' . DS . 'view' . DS . $config['theme'] . DS; | ||
45 | + $dh = opendir($themeDir); | ||
46 | + while (false !== ($filename = readdir($dh))) { | ||
47 | + if ($filename == '.' || $filename == '..') | ||
48 | + continue; | ||
49 | + if ($type) { | ||
50 | + if (!preg_match("/^{$type}(.*)/i", $filename)) { | ||
51 | + continue; | ||
52 | + } | ||
53 | + } | ||
54 | + $files[] = ['name' => $filename]; | ||
55 | + } | ||
56 | + } else { | ||
57 | + $files[] = ['name' => $keyValue]; | ||
58 | + } | ||
59 | + return $result = ['total' => count($files), 'list' => $files]; | ||
60 | + } | ||
61 | + | ||
62 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\cms; | ||
4 | + | ||
5 | +use app\admin\model\cms\Channel; | ||
6 | +use app\admin\model\cms\ChannelAdmin; | ||
7 | +use app\admin\model\cms\Modelx; | ||
8 | +use app\common\controller\Backend; | ||
9 | +use fast\Tree; | ||
10 | +use think\Db; | ||
11 | +use think\db\Query; | ||
12 | + | ||
13 | +/** | ||
14 | + * 内容表 | ||
15 | + * | ||
16 | + * @icon fa fa-circle-o | ||
17 | + */ | ||
18 | +class Archives extends Backend | ||
19 | +{ | ||
20 | + | ||
21 | + /** | ||
22 | + * Archives模型对象 | ||
23 | + */ | ||
24 | + protected $model = null; | ||
25 | + protected $noNeedRight = ['get_channel_fields', 'check_element_available']; | ||
26 | + protected $channelIds = []; | ||
27 | + protected $isSuperAdmin = false; | ||
28 | + protected $searchFields = 'id,title'; | ||
29 | + | ||
30 | + public function _initialize() | ||
31 | + { | ||
32 | + parent::_initialize(); | ||
33 | + $this->model = new \app\admin\model\cms\Archives; | ||
34 | + | ||
35 | + //是否超级管理员 | ||
36 | + $this->isSuperAdmin = $this->auth->isSuperAdmin(); | ||
37 | + $channelList = []; | ||
38 | + $disabledIds = []; | ||
39 | + $all = collection(Channel::order("weigh desc,id desc")->select())->toArray(); | ||
40 | + | ||
41 | + //允许的栏目 | ||
42 | + $this->channelIds = $this->isSuperAdmin ? Channel::column('id') : ChannelAdmin::getAdminChanneIds(); | ||
43 | + $parentChannelIds = Channel::where('id', 'in', $this->channelIds)->column('parent_id'); | ||
44 | + foreach ($all as $k => $v) { | ||
45 | + $state = ['opened' => true]; | ||
46 | + if ($v['type'] != 'list') { | ||
47 | + $disabledIds[] = $v['id']; | ||
48 | + } | ||
49 | + if ($v['type'] == 'link') { | ||
50 | + $state['checkbox_disabled'] = true; | ||
51 | + } | ||
52 | + if (!$this->isSuperAdmin) { | ||
53 | + if (($v['type'] != 'list' && !in_array($v['id'], $parentChannelIds)) || ($v['type'] == 'list' && !in_array($v['id'], $this->channelIds))) { | ||
54 | + unset($all[$k]); | ||
55 | + continue; | ||
56 | + } | ||
57 | + } | ||
58 | + $channelList[] = [ | ||
59 | + 'id' => $v['id'], | ||
60 | + 'parent' => $v['parent_id'] ? $v['parent_id'] : '#', | ||
61 | + 'text' => __($v['name']), | ||
62 | + 'type' => $v['type'], | ||
63 | + 'state' => $state | ||
64 | + ]; | ||
65 | + } | ||
66 | + $tree = Tree::instance()->init($all, 'parent_id'); | ||
67 | + $channelOptions = $tree->getTree(0, "<option value=@id @selected @disabled>@spacer@name</option>", '', $disabledIds); | ||
68 | + $this->view->assign('channelOptions', $channelOptions); | ||
69 | + $this->assignconfig('channelList', $channelList); | ||
70 | + | ||
71 | + $this->view->assign("flagList", $this->model->getFlagList()); | ||
72 | + $this->view->assign("statusList", $this->model->getStatusList()); | ||
73 | + | ||
74 | + $cms = get_addon_config('cms'); | ||
75 | + $this->assignconfig('cms', ['archiveseditmode' => $cms['archiveseditmode']]); | ||
76 | + | ||
77 | + } | ||
78 | + | ||
79 | + /** | ||
80 | + * 查看 | ||
81 | + */ | ||
82 | + public function index() | ||
83 | + { | ||
84 | + //设置过滤方法 | ||
85 | + $this->request->filter(['strip_tags']); | ||
86 | + if ($this->request->isAjax()) { | ||
87 | + $this->relationSearch = TRUE; | ||
88 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
89 | + if ($this->request->request('keyField')) { | ||
90 | + return $this->selectpage(); | ||
91 | + } | ||
92 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
93 | + if (!$this->auth->isSuperAdmin()) { | ||
94 | + $this->model->where('channel_id', 'in', $this->channelIds); | ||
95 | + } | ||
96 | + $total = $this->model | ||
97 | + ->with('Channel') | ||
98 | + ->where($where) | ||
99 | + ->order($sort, $order) | ||
100 | + ->count(); | ||
101 | + if (!$this->auth->isSuperAdmin()) { | ||
102 | + $this->model->where('channel_id', 'in', $this->channelIds); | ||
103 | + } | ||
104 | + $list = $this->model | ||
105 | + ->with('Channel') | ||
106 | + ->where($where) | ||
107 | + ->order($sort, $order) | ||
108 | + ->limit($offset, $limit) | ||
109 | + ->select(); | ||
110 | + | ||
111 | + $result = array("total" => $total, "rows" => $list); | ||
112 | + | ||
113 | + return json($result); | ||
114 | + } | ||
115 | + | ||
116 | + $modelList = \app\admin\model\cms\Modelx::all(); | ||
117 | + $this->view->assign('modelList', $modelList); | ||
118 | + return $this->view->fetch(); | ||
119 | + } | ||
120 | + | ||
121 | + /** | ||
122 | + * 副表内容 | ||
123 | + */ | ||
124 | + public function content($model_id = null) | ||
125 | + { | ||
126 | + $model = \app\admin\model\cms\Modelx::get($model_id); | ||
127 | + if (!$model) { | ||
128 | + $this->error('未找到对应模型'); | ||
129 | + } | ||
130 | + $fieldsList = \app\admin\model\cms\Fields::where('model_id', $model['id'])->where('type', '<>', 'text')->select(); | ||
131 | + | ||
132 | + //设置过滤方法 | ||
133 | + $this->request->filter(['strip_tags']); | ||
134 | + if ($this->request->isAjax()) { | ||
135 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
136 | + if ($this->request->request('keyField')) { | ||
137 | + return $this->selectpage(); | ||
138 | + } | ||
139 | + $fields = []; | ||
140 | + foreach ($fieldsList as $index => $item) { | ||
141 | + $fields[] = "addon." . $item['name']; | ||
142 | + } | ||
143 | + $table = $this->model->getTable(); | ||
144 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
145 | + $sort = 'main.id'; | ||
146 | + $isSuperAdmin = $this->isSuperAdmin; | ||
147 | + $channelIds = $this->channelIds; | ||
148 | + $customWhere = function ($query) use ($isSuperAdmin, $channelIds, $model_id) { | ||
149 | + if (!$isSuperAdmin) { | ||
150 | + $query->where('main.channel_id', 'in', $channelIds); | ||
151 | + } | ||
152 | + if ($model_id) { | ||
153 | + $query->where('main.model_id', $model_id); | ||
154 | + } | ||
155 | + }; | ||
156 | + $total = Db::table($table) | ||
157 | + ->alias('main') | ||
158 | + ->join('cms_channel channel', 'channel.id=main.channel_id', 'LEFT') | ||
159 | + ->join($model['table'] . ' addon', 'addon.id=main.id', 'LEFT') | ||
160 | + ->field('main.id,main.channel_id,main.title,channel.name as channel_name,addon.id as aid' . ($fields ? ',' . implode(',', $fields) : '')) | ||
161 | + ->where($customWhere) | ||
162 | + ->where($where) | ||
163 | + ->order($sort, $order) | ||
164 | + ->count(); | ||
165 | + | ||
166 | + $list = Db::table($table) | ||
167 | + ->alias('main') | ||
168 | + ->join('cms_channel channel', 'channel.id=main.channel_id', 'LEFT') | ||
169 | + ->join($model['table'] . ' addon', 'addon.id=main.id', 'LEFT') | ||
170 | + ->field('main.id,main.channel_id,main.title,channel.name as channel_name,addon.id as aid' . ($fields ? ',' . implode(',', $fields) : '')) | ||
171 | + ->where($customWhere) | ||
172 | + ->where($where) | ||
173 | + ->order($sort, $order) | ||
174 | + ->limit($offset, $limit) | ||
175 | + ->select(); | ||
176 | + $result = array("total" => $total, "rows" => $list); | ||
177 | + | ||
178 | + return json($result); | ||
179 | + } | ||
180 | + $fields = []; | ||
181 | + foreach ($fieldsList as $index => $item) { | ||
182 | + $fields[] = ['field' => $item['name'], 'title' => $item['title'], 'type' => $item['type'], 'content' => $item['content_list']]; | ||
183 | + } | ||
184 | + $this->assignconfig('fields', $fields); | ||
185 | + $this->view->assign('fieldsList', $fieldsList); | ||
186 | + $this->view->assign('model', $model); | ||
187 | + $this->assignconfig('model_id', $model_id); | ||
188 | + $modelList = \app\admin\model\cms\Modelx::all(); | ||
189 | + $this->view->assign('modelList', $modelList); | ||
190 | + return $this->view->fetch(); | ||
191 | + } | ||
192 | + | ||
193 | + /** | ||
194 | + * 编辑 | ||
195 | + * | ||
196 | + * @param mixed $ids | ||
197 | + * @return string | ||
198 | + */ | ||
199 | + public function edit($ids = NULL) | ||
200 | + { | ||
201 | + $row = $this->model->get($ids); | ||
202 | + if (!$row) | ||
203 | + $this->error(__('No Results were found')); | ||
204 | + $adminIds = $this->getDataLimitAdminIds(); | ||
205 | + if (is_array($adminIds)) { | ||
206 | + if (!in_array($row[$this->dataLimitField], $adminIds)) { | ||
207 | + $this->error(__('You have no permission')); | ||
208 | + } | ||
209 | + } | ||
210 | + if (!$this->isSuperAdmin && !in_array($row['channel_id'], $this->channelIds)) { | ||
211 | + $this->error(__('You have no permission')); | ||
212 | + } | ||
213 | + if ($this->request->isPost()) { | ||
214 | + return parent::edit($ids); | ||
215 | + } | ||
216 | + $channel = Channel::get($row['channel_id']); | ||
217 | + if (!$channel) { | ||
218 | + $this->error(__('No specified channel found')); | ||
219 | + } | ||
220 | + $model = \app\admin\model\cms\Modelx::get($channel['model_id']); | ||
221 | + if (!$model) { | ||
222 | + $this->error(__('No specified model found')); | ||
223 | + } | ||
224 | + $addon = db($model['table'])->where('id', $row['id'])->find(); | ||
225 | + if ($addon) { | ||
226 | + $row = array_merge($row->toArray(), $addon); | ||
227 | + } | ||
228 | + | ||
229 | + $disabledIds = []; | ||
230 | + $all = collection(Channel::order("weigh desc,id desc")->select())->toArray(); | ||
231 | + foreach ($all as $k => $v) { | ||
232 | + if ($v['type'] != 'list' || $v['model_id'] != $channel['model_id']) { | ||
233 | + $disabledIds[] = $v['id']; | ||
234 | + } | ||
235 | + } | ||
236 | + $tree = Tree::instance()->init($all, 'parent_id'); | ||
237 | + $channelOptions = $tree->getTree(0, "<option value=@id @selected @disabled>@spacer@name</option>", $row['channel_id'], $disabledIds); | ||
238 | + $this->view->assign('channelOptions', $channelOptions); | ||
239 | + $this->view->assign("row", $row); | ||
240 | + return $this->view->fetch(); | ||
241 | + } | ||
242 | + | ||
243 | + /** | ||
244 | + * 删除 | ||
245 | + * @param mixed $ids | ||
246 | + */ | ||
247 | + public function del($ids = "") | ||
248 | + { | ||
249 | + \app\admin\model\cms\Archives::event('after_delete', function ($row) { | ||
250 | + Channel::where('id', $row['channel_id'])->where('items', '>', 0)->setDec('items'); | ||
251 | + }); | ||
252 | + parent::del($ids); | ||
253 | + } | ||
254 | + | ||
255 | + /** | ||
256 | + * 销毁 | ||
257 | + * @param string $ids | ||
258 | + */ | ||
259 | + public function destroy($ids = "") | ||
260 | + { | ||
261 | + \app\admin\model\cms\Archives::event('after_delete', function ($row) { | ||
262 | + //删除副表 | ||
263 | + $channel = Channel::get($row->channel_id); | ||
264 | + if ($channel) { | ||
265 | + $model = Modelx::get($channel['model_id']); | ||
266 | + if ($model) { | ||
267 | + db($model['table'])->where("id", $row['id'])->delete(); | ||
268 | + } | ||
269 | + } | ||
270 | + }); | ||
271 | + parent::destroy($ids); | ||
272 | + } | ||
273 | + | ||
274 | + /** | ||
275 | + * 还原 | ||
276 | + * @param mixed $ids | ||
277 | + */ | ||
278 | + public function restore($ids = "") | ||
279 | + { | ||
280 | + $pk = $this->model->getPk(); | ||
281 | + $adminIds = $this->getDataLimitAdminIds(); | ||
282 | + if (is_array($adminIds)) { | ||
283 | + $this->model->where($this->dataLimitField, 'in', $adminIds); | ||
284 | + } | ||
285 | + if ($ids) { | ||
286 | + $this->model->where($pk, 'in', $ids); | ||
287 | + } | ||
288 | + $archivesChannelIds = $this->model->onlyTrashed()->column('id,channel_id'); | ||
289 | + $archivesChannelIds = array_filter($archivesChannelIds); | ||
290 | + $this->model->where('id', 'in', array_keys($archivesChannelIds)); | ||
291 | + $count = $this->model->restore('1=1'); | ||
292 | + if ($count) { | ||
293 | + $channelNums = array_count_values($archivesChannelIds); | ||
294 | + foreach ($channelNums as $k => $v) { | ||
295 | + Channel::where('id', $k)->setInc('items', $v); | ||
296 | + } | ||
297 | + $this->success(); | ||
298 | + } | ||
299 | + $this->error(__('No rows were updated')); | ||
300 | + | ||
301 | + } | ||
302 | + | ||
303 | + /** | ||
304 | + * 移动 | ||
305 | + * @param string $ids | ||
306 | + */ | ||
307 | + public function move($ids = "") | ||
308 | + { | ||
309 | + if ($ids) { | ||
310 | + $channel_id = $this->request->post('channel_id'); | ||
311 | + $pk = $this->model->getPk(); | ||
312 | + $adminIds = $this->getDataLimitAdminIds(); | ||
313 | + if (is_array($adminIds)) { | ||
314 | + $this->model->where($this->dataLimitField, 'in', $adminIds); | ||
315 | + } | ||
316 | + $this->model->where($pk, 'in', $ids); | ||
317 | + $channel = Channel::get($channel_id); | ||
318 | + if ($channel && $channel['type'] === 'list') { | ||
319 | + $channelNums = \app\admin\model\cms\Archives:: | ||
320 | + with('channel') | ||
321 | + ->where('archives.' . $pk, 'in', $ids) | ||
322 | + ->where('channel_id', '<>', $channel['id']) | ||
323 | + ->field('channel_id,COUNT(*) AS nums') | ||
324 | + ->group('channel_id') | ||
325 | + ->select(); | ||
326 | + $result = $this->model | ||
327 | + ->where('model_id', '=', $channel['model_id']) | ||
328 | + ->where('channel_id', '<>', $channel['id']) | ||
329 | + ->update(['channel_id' => $channel_id]); | ||
330 | + if ($result) { | ||
331 | + $count = 0; | ||
332 | + foreach ($channelNums as $k => $v) { | ||
333 | + if ($v['channel']) { | ||
334 | + Channel::where('id', $v['channel_id'])->where('items', '>', 0)->setDec('items', min($v['channel']['items'], $v['nums'])); | ||
335 | + } | ||
336 | + $count += $v['nums']; | ||
337 | + } | ||
338 | + Channel::where('id', $channel_id)->setInc('items', $count); | ||
339 | + $this->success(); | ||
340 | + } else { | ||
341 | + $this->error(__('No rows were updated')); | ||
342 | + } | ||
343 | + } else { | ||
344 | + $this->error(__('No rows were updated')); | ||
345 | + } | ||
346 | + $this->error(__('Parameter %s can not be empty', 'ids')); | ||
347 | + } | ||
348 | + } | ||
349 | + | ||
350 | + /** | ||
351 | + * 获取栏目列表 | ||
352 | + * @internal | ||
353 | + */ | ||
354 | + public function get_channel_fields() | ||
355 | + { | ||
356 | + $this->view->engine->layout(false); | ||
357 | + $channel_id = $this->request->post('channel_id'); | ||
358 | + $archives_id = $this->request->post('archives_id'); | ||
359 | + $channel = Channel::get($channel_id, 'model'); | ||
360 | + dump($channel); | ||
361 | + echo 1111; | ||
362 | + exit(); | ||
363 | + if ($channel && $channel['type'] === 'list') { | ||
364 | + | ||
365 | + $values = []; | ||
366 | + if ($archives_id) { | ||
367 | + $values = db($channel['model']['table'])->where('id', $archives_id)->find(); | ||
368 | + } | ||
369 | + | ||
370 | + $fields = \app\admin\model\cms\Fields::where('model_id', $channel['model_id']) | ||
371 | + ->order('weigh desc,id desc') | ||
372 | + ->select(); | ||
373 | + foreach ($fields as $k => $v) { | ||
374 | + //优先取编辑的值,再次取默认值 | ||
375 | + $v->value = isset($values[$v['name']]) ? $values[$v['name']] : (is_null($v['defaultvalue']) ? '' : $v['defaultvalue']); | ||
376 | + $v->rule = str_replace(',', '; ', $v->rule); | ||
377 | + if (in_array($v->type, ['checkbox', 'lists', 'images'])) { | ||
378 | + $checked = ''; | ||
379 | + if ($v['minimum'] && $v['maximum']) | ||
380 | + $checked = "{$v['minimum']}~{$v['maximum']}"; | ||
381 | + else if ($v['minimum']) | ||
382 | + $checked = "{$v['minimum']}~"; | ||
383 | + else if ($v['maximum']) | ||
384 | + $checked = "~{$v['maximum']}"; | ||
385 | + if ($checked) | ||
386 | + $v->rule .= (';checked(' . $checked . ')'); | ||
387 | + } | ||
388 | + if (in_array($v->type, ['checkbox', 'radio']) && stripos($v->rule, 'required') !== false) { | ||
389 | + $v->rule = str_replace('required', 'checked', $v->rule); | ||
390 | + } | ||
391 | + if (in_array($v->type, ['selects'])) { | ||
392 | + $v->extend .= (' ' . 'data-max-options="' . $v['maximum'] . '"'); | ||
393 | + } | ||
394 | + } | ||
395 | + | ||
396 | + $this->view->assign('fields', $fields); | ||
397 | + $this->view->assign('values', $values); | ||
398 | + $this->success('', null, ['html' => $this->view->fetch('fields')]); | ||
399 | + } else { | ||
400 | + $this->error(__('Please select channel')); | ||
401 | + } | ||
402 | + $this->error(__('Parameter %s can not be empty', 'ids')); | ||
403 | + } | ||
404 | + | ||
405 | + /** | ||
406 | + * 检测元素是否可用 | ||
407 | + * @internal | ||
408 | + */ | ||
409 | + public function check_element_available() | ||
410 | + { | ||
411 | + $id = $this->request->request('id'); | ||
412 | + $name = $this->request->request('name'); | ||
413 | + $value = $this->request->request('value'); | ||
414 | + $name = substr($name, 4, -1); | ||
415 | + if (!$name) { | ||
416 | + $this->error(__('Parameter %s can not be empty', 'name')); | ||
417 | + } | ||
418 | + if ($id) { | ||
419 | + $this->model->where('id', '<>', $id); | ||
420 | + } | ||
421 | + $exist = $this->model->where($name, $value)->find(); | ||
422 | + if ($exist) { | ||
423 | + $this->error(__('The data already exist')); | ||
424 | + } else { | ||
425 | + $this->success(); | ||
426 | + } | ||
427 | + } | ||
428 | + | ||
429 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\cms; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 区块表 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class Block extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Block模型对象 | ||
17 | + */ | ||
18 | + protected $model = null; | ||
19 | + | ||
20 | + public function _initialize() | ||
21 | + { | ||
22 | + parent::_initialize(); | ||
23 | + $this->model = new \app\admin\model\cms\Block; | ||
24 | + $this->view->assign("statusList", $this->model->getStatusList()); | ||
25 | + } | ||
26 | + | ||
27 | + public function index() | ||
28 | + { | ||
29 | + $typeArr = \app\admin\model\cms\Block::distinct('type')->column('type'); | ||
30 | + $this->view->assign('typeList', $typeArr); | ||
31 | + $this->assignconfig('typeList', $typeArr); | ||
32 | + return parent::index(); | ||
33 | + } | ||
34 | + | ||
35 | + public function selectpage_type() | ||
36 | + { | ||
37 | + $list = []; | ||
38 | + $word = (array)$this->request->request("q_word/a"); | ||
39 | + $field = $this->request->request('showField'); | ||
40 | + $keyValue = $this->request->request('keyValue'); | ||
41 | + if (!$keyValue) { | ||
42 | + if (array_filter($word)) { | ||
43 | + foreach ($word as $k => $v) { | ||
44 | + $list[] = ['id' => $v, $field => $v]; | ||
45 | + } | ||
46 | + } | ||
47 | + $typeArr = \app\admin\model\cms\Block::column('type'); | ||
48 | + $typeArr = array_unique($typeArr); | ||
49 | + foreach ($typeArr as $index => $item) { | ||
50 | + $list[] = ['id' => $item, $field => $item]; | ||
51 | + } | ||
52 | + } else { | ||
53 | + $list[] = ['id' => $keyValue, $field => $keyValue]; | ||
54 | + } | ||
55 | + return json(['total' => count($list), 'list' => $list]); | ||
56 | + } | ||
57 | + | ||
58 | + public function import() | ||
59 | + { | ||
60 | + return parent::import(); | ||
61 | + } | ||
62 | + | ||
63 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\cms; | ||
4 | + | ||
5 | +use app\admin\model\Admin; | ||
6 | +use app\admin\model\AuthGroupAccess; | ||
7 | +use app\admin\model\cms\ChannelAdmin; | ||
8 | +use app\common\controller\Backend; | ||
9 | +use app\admin\model\cms\Channel as ChannelModel; | ||
10 | +use fast\Tree; | ||
11 | +use think\Exception; | ||
12 | + | ||
13 | +/** | ||
14 | + * 栏目表 | ||
15 | + * | ||
16 | + * @icon fa fa-circle-o | ||
17 | + */ | ||
18 | +class Channel extends Backend | ||
19 | +{ | ||
20 | + | ||
21 | + protected $channelList = []; | ||
22 | + protected $modelList = []; | ||
23 | + protected $multiFields = ['weigh', 'status']; | ||
24 | + | ||
25 | + /** | ||
26 | + * Channel模型对象 | ||
27 | + */ | ||
28 | + protected $model = null; | ||
29 | + protected $noNeedRight = ['check_element_available']; | ||
30 | + | ||
31 | + public function _initialize() | ||
32 | + { | ||
33 | + parent::_initialize(); | ||
34 | + $this->request->filter(['strip_tags']); | ||
35 | + $this->model = new \app\admin\model\cms\Channel; | ||
36 | + | ||
37 | + $tree = Tree::instance(); | ||
38 | + $tree->init(collection($this->model->order('weigh desc,id desc')->select())->toArray(), 'parent_id'); | ||
39 | + $this->channelList = $tree->getTreeList($tree->getTreeArray(0), 'name'); | ||
40 | + $this->modelList = \app\admin\model\cms\Modelx::order('id asc')->select(); | ||
41 | + | ||
42 | + $this->view->assign("modelList", $this->modelList); | ||
43 | + $this->view->assign("channelList", $this->channelList); | ||
44 | + $this->view->assign("typeList", ChannelModel::getTypeList()); | ||
45 | + $this->view->assign("statusList", ChannelModel::getStatusList()); | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * 查看 | ||
50 | + */ | ||
51 | + public function index() | ||
52 | + { | ||
53 | + | ||
54 | + if ($this->request->isAjax()) { | ||
55 | + $search = $this->request->request("search"); | ||
56 | + $model_id = $this->request->request("model_id"); | ||
57 | + //构造父类select列表选项数据 | ||
58 | + $list = []; | ||
59 | + if ($search) { | ||
60 | + foreach ($this->channelList as $k => $v) { | ||
61 | + if (stripos($v['name'], $search) !== false || stripos($v['nickname'], $search) !== false) { | ||
62 | + $list[] = $v; | ||
63 | + } | ||
64 | + } | ||
65 | + } else { | ||
66 | + $list = $this->channelList; | ||
67 | + } | ||
68 | + foreach ($list as $index => $item) { | ||
69 | + if ($model_id && $model_id != $item['model_id']) { | ||
70 | + unset($list[$index]); | ||
71 | + } | ||
72 | + } | ||
73 | + $list = array_values($list); | ||
74 | + $modelNameArr = []; | ||
75 | + foreach ($this->modelList as $k => $v) { | ||
76 | + $modelNameArr[$v['id']] = $v['name']; | ||
77 | + } | ||
78 | + foreach ($list as $k => &$v) { | ||
79 | + $v['model_name'] = $v['model_id'] && isset($modelNameArr[$v['model_id']]) ? $modelNameArr[$v['model_id']] : __('None'); | ||
80 | + } | ||
81 | + $total = count($list); | ||
82 | + $result = array("total" => $total, "rows" => $list); | ||
83 | + | ||
84 | + return json($result); | ||
85 | + } | ||
86 | + return $this->view->fetch(); | ||
87 | + } | ||
88 | + | ||
89 | + /** | ||
90 | + * 添加 | ||
91 | + */ | ||
92 | + public function add() | ||
93 | + { | ||
94 | + if ($this->request->isPost()) { | ||
95 | + $params = $this->request->post("row/a"); | ||
96 | + if ($params) { | ||
97 | + if ($this->dataLimit && $this->dataLimitFieldAutoFill) { | ||
98 | + $params[$this->dataLimitField] = $this->auth->id; | ||
99 | + } | ||
100 | + try { | ||
101 | + //是否采用模型验证 | ||
102 | + if ($this->modelValidate) { | ||
103 | + $name = basename(str_replace('\\', '/', get_class($this->model))); | ||
104 | + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : true) : $this->modelValidate; | ||
105 | + $this->model->validate($validate); | ||
106 | + } | ||
107 | + $nameArr = array_filter(explode("\n", str_replace("\r\n", "\n", $params['name']))); | ||
108 | + if (count($nameArr) > 1) { | ||
109 | + foreach ($nameArr as $index => $item) { | ||
110 | + $itemArr = array_filter(explode('|', $item)); | ||
111 | + $params['name'] = $itemArr[0]; | ||
112 | + $params['diyname'] = isset($itemArr[1]) ? $itemArr[1] : ''; | ||
113 | + $result = $this->model->allowField(true)->isUpdate(false)->data($params)->save(); | ||
114 | + } | ||
115 | + } else { | ||
116 | + $result = $this->model->allowField(true)->save($params); | ||
117 | + } | ||
118 | + if ($result !== false) { | ||
119 | + $this->success(); | ||
120 | + } else { | ||
121 | + $this->error($this->model->getError()); | ||
122 | + } | ||
123 | + } catch (\think\exception\PDOException $e) { | ||
124 | + $this->error($e->getMessage()); | ||
125 | + } | ||
126 | + } | ||
127 | + $this->error(__('Parameter %s can not be empty', '')); | ||
128 | + } | ||
129 | + return $this->view->fetch(); | ||
130 | + } | ||
131 | + | ||
132 | + /** | ||
133 | + * 栏目授权 | ||
134 | + */ | ||
135 | + public function admin() | ||
136 | + { | ||
137 | + $act = $this->request->param('act'); | ||
138 | + $ids = $this->request->param('ids'); | ||
139 | + if ($act == 'remove') { | ||
140 | + ChannelAdmin::where('admin_id', $ids)->delete(); | ||
141 | + $this->success('删除成功!'); | ||
142 | + } else if ($act == 'authorization') { | ||
143 | + $selected = ChannelAdmin::getAdminChanneIds($ids); | ||
144 | + $all = collection(ChannelModel::order("weigh desc,id desc")->select())->toArray(); | ||
145 | + foreach ($all as $k => $v) { | ||
146 | + $state = ['opened' => true]; | ||
147 | + if ($v['type'] != 'list') { | ||
148 | + $disabledIds[] = $v['id']; | ||
149 | + } | ||
150 | + if ($v['type'] == 'link') { | ||
151 | + $state['checkbox_disabled'] = true; | ||
152 | + } | ||
153 | + $state['selected'] = in_array($v['id'], $selected); | ||
154 | + $channelList[] = [ | ||
155 | + 'id' => $v['id'], | ||
156 | + 'parent' => $v['parent_id'] ? $v['parent_id'] : '#', | ||
157 | + 'text' => __($v['name']), | ||
158 | + 'type' => $v['type'], | ||
159 | + 'state' => $state | ||
160 | + ]; | ||
161 | + } | ||
162 | + $this->success('成功', '', $channelList); | ||
163 | + } else if ($act == 'save') { | ||
164 | + \think\Db::startTrans(); | ||
165 | + try { | ||
166 | + ChannelAdmin::where('admin_id', $ids)->delete(); | ||
167 | + $channelIds = explode(",", $this->request->post("ids")); | ||
168 | + if ($channelIds) { | ||
169 | + $listChannelIds = ChannelModel::where('type', 'list')->column('id'); | ||
170 | + $channelIds = array_intersect($channelIds, $listChannelIds); | ||
171 | + $data = []; | ||
172 | + foreach ($channelIds as $key => $item) { | ||
173 | + $data[] = ['admin_id' => $ids, 'channel_id' => $item]; | ||
174 | + } | ||
175 | + $model = new ChannelAdmin(); | ||
176 | + $model->saveAll($data, true); | ||
177 | + } | ||
178 | + \think\Db::commit(); | ||
179 | + } catch (Exception $e) { | ||
180 | + \think\Db::rollback(); | ||
181 | + $this->error($e->getMessage()); | ||
182 | + } | ||
183 | + $this->success("保存成功!"); | ||
184 | + | ||
185 | + } | ||
186 | + | ||
187 | + if ($this->request->isAjax()) { | ||
188 | + $list = \think\Db::name("cms_channel_admin") | ||
189 | + ->group("admin_id") | ||
190 | + ->field("COUNT(*) as channels,admin_id") | ||
191 | + ->select(); | ||
192 | + $adminChannelList = []; | ||
193 | + foreach ($list as $index => $item) { | ||
194 | + $adminChannelList[$item['admin_id']] = $item['channels']; | ||
195 | + } | ||
196 | + | ||
197 | + $superAdminIds = AuthGroupAccess::where('group_id', 1)->column('uid'); | ||
198 | + | ||
199 | + $adminList = Admin::order('id', 'desc')->field('id,username')->select(); | ||
200 | + foreach ($adminList as $index => $item) { | ||
201 | + $item->channels = isset($adminChannelList[$item['id']]) ? $adminChannelList[$item['id']] : 0; | ||
202 | + $item->superadmin = in_array($item['id'], $superAdminIds); | ||
203 | + } | ||
204 | + $total = count($adminList); | ||
205 | + $result = array("total" => $total, "rows" => $adminList); | ||
206 | + | ||
207 | + return json($result); | ||
208 | + } | ||
209 | + return $this->view->fetch(); | ||
210 | + } | ||
211 | + | ||
212 | + /** | ||
213 | + * Selectpage搜索 | ||
214 | + * | ||
215 | + * @internal | ||
216 | + */ | ||
217 | + public function selectpage() | ||
218 | + { | ||
219 | + return parent::selectpage(); | ||
220 | + } | ||
221 | + | ||
222 | + /** | ||
223 | + * 检测元素是否可用 | ||
224 | + * @internal | ||
225 | + */ | ||
226 | + public function check_element_available() | ||
227 | + { | ||
228 | + $id = $this->request->request('id'); | ||
229 | + $name = $this->request->request('name'); | ||
230 | + $value = $this->request->request('value'); | ||
231 | + $name = substr($name, 4, -1); | ||
232 | + if (!$name) { | ||
233 | + $this->error(__('Parameter %s can not be empty', 'name')); | ||
234 | + } | ||
235 | + if ($name == 'diyname') { | ||
236 | + if ($id) { | ||
237 | + $this->model->where('id', '<>', $id); | ||
238 | + } | ||
239 | + $exist = $this->model->where($name, $value)->find(); | ||
240 | + if ($exist) { | ||
241 | + $this->error(__('The data already exist')); | ||
242 | + } else { | ||
243 | + $this->success(); | ||
244 | + } | ||
245 | + } else if ($name == 'name') { | ||
246 | + $nameArr = array_filter(explode("\n", str_replace("\r\n", "\n", $value))); | ||
247 | + if (count($nameArr) > 1) { | ||
248 | + foreach ($nameArr as $index => $item) { | ||
249 | + $itemArr = array_filter(explode('|', $item)); | ||
250 | + if (!isset($itemArr[1])) { | ||
251 | + $this->error('格式:分类名称|自定义名称'); | ||
252 | + } | ||
253 | + $exist = \app\admin\model\cms\Channel::getByDiyname($itemArr[1]); | ||
254 | + if ($exist) { | ||
255 | + $this->error('自定义名称[' . $itemArr[1] . ']已经存在'); | ||
256 | + } | ||
257 | + } | ||
258 | + $this->success(); | ||
259 | + } else { | ||
260 | + $this->success(); | ||
261 | + } | ||
262 | + } | ||
263 | + } | ||
264 | + | ||
265 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\cms; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 评论管理 | ||
9 | + * | ||
10 | + * @icon fa fa-comment | ||
11 | + */ | ||
12 | +class Comment extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Comment模型对象 | ||
17 | + */ | ||
18 | + protected $model = null; | ||
19 | + | ||
20 | + public function _initialize() | ||
21 | + { | ||
22 | + parent::_initialize(); | ||
23 | + $this->model = new \app\admin\model\cms\Comment; | ||
24 | + $this->view->assign("typeList", $this->model->getTypeList()); | ||
25 | + $this->view->assign("statusList", $this->model->getStatusList()); | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * 查看 | ||
30 | + */ | ||
31 | + public function index() | ||
32 | + { | ||
33 | + $this->relationSearch = true; | ||
34 | + //设置过滤方法 | ||
35 | + $this->request->filter(['strip_tags']); | ||
36 | + if ($this->request->isAjax()) | ||
37 | + { | ||
38 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
39 | + if ($this->request->request('keyField')) | ||
40 | + { | ||
41 | + return $this->selectpage(); | ||
42 | + } | ||
43 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
44 | + $total = $this->model | ||
45 | + ->with('archives') | ||
46 | + ->where($where) | ||
47 | + ->order($sort, $order) | ||
48 | + ->count(); | ||
49 | + | ||
50 | + $list = $this->model | ||
51 | + ->with('archives') | ||
52 | + ->where($where) | ||
53 | + ->order($sort, $order) | ||
54 | + ->limit($offset, $limit) | ||
55 | + ->select(); | ||
56 | + | ||
57 | + $list = collection($list)->toArray(); | ||
58 | + $result = array("total" => $total, "rows" => $list); | ||
59 | + | ||
60 | + return json($result); | ||
61 | + } | ||
62 | + $this->assignconfig("typeList", $this->model->getTypeList()); | ||
63 | + return $this->view->fetch(); | ||
64 | + } | ||
65 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\cms; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 自定义表单数据表 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class Diydata extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * 自定义表单模型对象 | ||
17 | + */ | ||
18 | + protected $diyform = null; | ||
19 | + /** | ||
20 | + * 定义表单数据表模型 | ||
21 | + * @var null | ||
22 | + */ | ||
23 | + protected $model = null; | ||
24 | + | ||
25 | + public function _initialize() | ||
26 | + { | ||
27 | + parent::_initialize(); | ||
28 | + $diyform_id = $this->request->param('diyform_id'); | ||
29 | + $this->diyform = \app\admin\model\cms\Diyform::get($diyform_id); | ||
30 | + if (!$this->diyform) { | ||
31 | + $this->error('未找到对应自定义表单'); | ||
32 | + } | ||
33 | + $this->model = \think\Db::name($this->diyform['table']); | ||
34 | + $this->assignconfig('diyform_id', $diyform_id); | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * 查看 | ||
39 | + */ | ||
40 | + public function index() | ||
41 | + { | ||
42 | + $fieldsList = \app\admin\model\cms\Fields::where('diyform_id', $this->diyform['id'])->where('type', '<>', 'text')->select(); | ||
43 | + $fields = []; | ||
44 | + foreach ($fieldsList as $index => $item) { | ||
45 | + $fields[] = ['field' => $item['name'], 'title' => $item['title'], 'type' => $item['type'], 'content' => $item['content_list']]; | ||
46 | + } | ||
47 | + $this->assignconfig('fields', $fields); | ||
48 | + $diyformList = \app\admin\model\cms\Diyform::all(); | ||
49 | + $this->view->assign('diyform', $this->diyform); | ||
50 | + $this->view->assign('diyformList', $diyformList); | ||
51 | + return parent::index(); | ||
52 | + } | ||
53 | + | ||
54 | + /** | ||
55 | + * 添加 | ||
56 | + */ | ||
57 | + public function add() | ||
58 | + { | ||
59 | + $this->assignFields(); | ||
60 | + if ($this->request->isPost()) { | ||
61 | + $params = $this->request->post("row/a"); | ||
62 | + if ($params) { | ||
63 | + if ($this->dataLimit && $this->dataLimitFieldAutoFill) { | ||
64 | + $params[$this->dataLimitField] = $this->auth->id; | ||
65 | + } | ||
66 | + try { | ||
67 | + $result = $this->model->insert($params); | ||
68 | + if ($result !== false) { | ||
69 | + $this->success(); | ||
70 | + } else { | ||
71 | + $this->error($this->model->getError()); | ||
72 | + } | ||
73 | + } catch (\think\exception\PDOException $e) { | ||
74 | + $this->error($e->getMessage()); | ||
75 | + } catch (\think\Exception $e) { | ||
76 | + $this->error($e->getMessage()); | ||
77 | + } | ||
78 | + } | ||
79 | + $this->error(__('Parameter %s can not be empty', '')); | ||
80 | + } | ||
81 | + return $this->view->fetch(); | ||
82 | + } | ||
83 | + | ||
84 | + /** | ||
85 | + * 编辑 | ||
86 | + */ | ||
87 | + public function edit($ids = NULL) | ||
88 | + { | ||
89 | + $row = $this->model->where('id', $ids)->find(); | ||
90 | + if (!$row) | ||
91 | + $this->error(__('No Results were found')); | ||
92 | + $adminIds = $this->getDataLimitAdminIds(); | ||
93 | + if (is_array($adminIds)) { | ||
94 | + if (!in_array($row[$this->dataLimitField], $adminIds)) { | ||
95 | + $this->error(__('You have no permission')); | ||
96 | + } | ||
97 | + } | ||
98 | + if ($this->request->isPost()) { | ||
99 | + $params = $this->request->post("row/a"); | ||
100 | + if ($params) { | ||
101 | + try { | ||
102 | + $result = $this->model->where('id', $ids)->update($params); | ||
103 | + if ($result !== false) { | ||
104 | + $this->success(); | ||
105 | + } else { | ||
106 | + $this->error($row->getError()); | ||
107 | + } | ||
108 | + } catch (\think\exception\PDOException $e) { | ||
109 | + $this->error($e->getMessage()); | ||
110 | + } catch (\think\Exception $e) { | ||
111 | + $this->error($e->getMessage()); | ||
112 | + } | ||
113 | + } | ||
114 | + $this->error(__('Parameter %s can not be empty', '')); | ||
115 | + } | ||
116 | + | ||
117 | + $this->assignFields($ids); | ||
118 | + $this->view->assign("row", $row); | ||
119 | + return $this->view->fetch(); | ||
120 | + } | ||
121 | + | ||
122 | + /** | ||
123 | + * 删除 | ||
124 | + */ | ||
125 | + public function del($ids = "") | ||
126 | + { | ||
127 | + if ($ids) { | ||
128 | + $pk = $this->model->getPk(); | ||
129 | + $adminIds = $this->getDataLimitAdminIds(); | ||
130 | + if (is_array($adminIds)) { | ||
131 | + $count = $this->model->where($this->dataLimitField, 'in', $adminIds); | ||
132 | + } | ||
133 | + $count = $this->model->where($pk, 'in', $ids)->delete(); | ||
134 | + if ($count) { | ||
135 | + $this->success(); | ||
136 | + } else { | ||
137 | + $this->error(__('No rows were deleted')); | ||
138 | + } | ||
139 | + } | ||
140 | + $this->error(__('Parameter %s can not be empty', 'ids')); | ||
141 | + } | ||
142 | + | ||
143 | + private function assignFields($diydata_id = 0) | ||
144 | + { | ||
145 | + $values = []; | ||
146 | + if ($diydata_id) { | ||
147 | + $values = db($this->diyform['table'])->where('id', $diydata_id)->find(); | ||
148 | + } | ||
149 | + $fields = \app\admin\model\cms\Fields::where('diyform_id', $this->diyform['id']) | ||
150 | + ->order('weigh desc,id desc') | ||
151 | + ->select(); | ||
152 | + foreach ($fields as $k => $v) { | ||
153 | + $v->value = isset($values[$v['name']]) ? $values[$v['name']] : ''; | ||
154 | + $v->rule = str_replace(',', '; ', $v->rule); | ||
155 | + if (in_array($v->type, ['checkbox', 'lists', 'images'])) { | ||
156 | + $checked = ''; | ||
157 | + if ($v['minimum'] && $v['maximum']) | ||
158 | + $checked = "{$v['minimum']}~{$v['maximum']}"; | ||
159 | + else if ($v['minimum']) | ||
160 | + $checked = "{$v['minimum']}~"; | ||
161 | + else if ($v['maximum']) | ||
162 | + $checked = "~{$v['maximum']}"; | ||
163 | + if ($checked) | ||
164 | + $v->rule .= (';checked(' . $checked . ')'); | ||
165 | + } | ||
166 | + if (in_array($v->type, ['checkbox', 'radio']) && stripos($v->rule, 'required') !== false) { | ||
167 | + $v->rule = str_replace('required', 'checked', $v->rule); | ||
168 | + } | ||
169 | + if (in_array($v->type, ['selects'])) { | ||
170 | + $v->extend .= (' ' . 'data-max-options="' . $v['maximum'] . '"'); | ||
171 | + } | ||
172 | + } | ||
173 | + | ||
174 | + $this->view->assign('fields', $fields); | ||
175 | + $this->view->assign('values', $values); | ||
176 | + } | ||
177 | + | ||
178 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\cms; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 自定义表单表 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class Diyform extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Model模型对象 | ||
17 | + */ | ||
18 | + protected $model = null; | ||
19 | + | ||
20 | + public function _initialize() | ||
21 | + { | ||
22 | + parent::_initialize(); | ||
23 | + $this->model = new \app\admin\model\cms\Diyform; | ||
24 | + $this->view->assign("statusList", $this->model->getStatusList()); | ||
25 | + } | ||
26 | + | ||
27 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\cms; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | +use app\common\model\Config; | ||
7 | + | ||
8 | +/** | ||
9 | + * 模型字段表 | ||
10 | + * | ||
11 | + * @icon fa fa-circle-o | ||
12 | + */ | ||
13 | +class Fields extends Backend | ||
14 | +{ | ||
15 | + | ||
16 | + /** | ||
17 | + * Fields模型对象 | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + protected $modelValidate = true; | ||
21 | + protected $modelSceneValidate = true; | ||
22 | + | ||
23 | + protected $noNeedRight = ['rulelist']; | ||
24 | + | ||
25 | + public function _initialize() | ||
26 | + { | ||
27 | + parent::_initialize(); | ||
28 | + $this->model = new \app\admin\model\cms\Fields; | ||
29 | + $this->view->assign("statusList", $this->model->getStatusList()); | ||
30 | + $this->view->assign('typeList', Config::getTypeList()); | ||
31 | + $this->view->assign('regexList', Config::getRegexList()); | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * 查看 | ||
36 | + */ | ||
37 | + public function index() | ||
38 | + { | ||
39 | + $model_id = $this->request->param('model_id', 0); | ||
40 | + $diyform_id = $this->request->param('diyform_id', 0); | ||
41 | + $condition = $model_id ? ['model_id' => $model_id] : ['diyform_id' => $diyform_id]; | ||
42 | + //设置过滤方法 | ||
43 | + $this->request->filter(['strip_tags']); | ||
44 | + if ($this->request->isAjax()) { | ||
45 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
46 | + $total = $this->model | ||
47 | + ->where($condition) | ||
48 | + ->where($where) | ||
49 | + ->order($sort, $order) | ||
50 | + ->count(); | ||
51 | + | ||
52 | + $list = $this->model | ||
53 | + ->where($condition) | ||
54 | + ->where($where) | ||
55 | + ->order($sort, $order) | ||
56 | + ->limit($offset, $limit) | ||
57 | + ->select(); | ||
58 | + | ||
59 | + $result = array("total" => $total, "rows" => $list); | ||
60 | + | ||
61 | + return json($result); | ||
62 | + } | ||
63 | + $this->assignconfig('model_id', $model_id); | ||
64 | + $this->assignconfig('diyform_id', $diyform_id); | ||
65 | + $this->view->assign('model_id', $model_id); | ||
66 | + $this->view->assign('diyform_id', $diyform_id); | ||
67 | + | ||
68 | + $model = $model_id ? \app\admin\model\cms\Modelx::get($model_id) : \app\admin\model\cms\Diyform::get($diyform_id); | ||
69 | + $this->view->assign('model', $model); | ||
70 | + $modelList = $model_id ? \app\admin\model\cms\Modelx::all() : \app\admin\model\cms\Diyform::all(); | ||
71 | + $this->view->assign('modelList', $modelList); | ||
72 | + | ||
73 | + return $this->view->fetch(); | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * 添加 | ||
78 | + */ | ||
79 | + public function add() | ||
80 | + { | ||
81 | + $model_id = $this->request->param('model_id', 0); | ||
82 | + $diyform_id = $this->request->param('diyform_id', 0); | ||
83 | + $this->view->assign('model_id', $model_id); | ||
84 | + $this->view->assign('diyform_id', $diyform_id); | ||
85 | + return parent::add(); | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * 批量操作 | ||
90 | + * @param string $ids | ||
91 | + */ | ||
92 | + public function multi($ids = "") | ||
93 | + { | ||
94 | + $params = $this->request->request('params'); | ||
95 | + parse_str($params, $paramsArr); | ||
96 | + if (isset($paramsArr['isfilter'])) { | ||
97 | + $field = \app\admin\model\cms\Fields::get($ids); | ||
98 | + if (!$field || !in_array($field['type'], ['radio', 'checkbox', 'select', 'selects', 'array'])) { | ||
99 | + $this->error('只有类型为单选、复选、下拉列表、数组才可以加入列表筛选'); | ||
100 | + } | ||
101 | + } | ||
102 | + return parent::multi($ids); | ||
103 | + } | ||
104 | + | ||
105 | + /** | ||
106 | + * 规则列表 | ||
107 | + * @internal | ||
108 | + */ | ||
109 | + public function rulelist() | ||
110 | + { | ||
111 | + //主键 | ||
112 | + $primarykey = $this->request->request("keyField"); | ||
113 | + //主键值 | ||
114 | + $keyValue = $this->request->request("keyValue", ""); | ||
115 | + | ||
116 | + $keyValueArr = array_filter(explode(',', $keyValue)); | ||
117 | + $regexList = Config::getRegexList(); | ||
118 | + $list = []; | ||
119 | + foreach ($regexList as $k => $v) { | ||
120 | + if ($keyValueArr) { | ||
121 | + if (in_array($k, $keyValueArr)) { | ||
122 | + $list[] = ['id' => $k, 'name' => $v]; | ||
123 | + } | ||
124 | + } else { | ||
125 | + $list[] = ['id' => $k, 'name' => $v]; | ||
126 | + } | ||
127 | + } | ||
128 | + return json(['list' => $list]); | ||
129 | + } | ||
130 | + | ||
131 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\cms; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 内容模型表 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class Modelx extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Model模型对象 | ||
17 | + */ | ||
18 | + protected $model = null; | ||
19 | + | ||
20 | + public function _initialize() | ||
21 | + { | ||
22 | + parent::_initialize(); | ||
23 | + $this->model = new \app\admin\model\cms\Modelx; | ||
24 | + } | ||
25 | + | ||
26 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\cms; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 订单管理 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class Order extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Order模型对象 | ||
17 | + * @var \app\admin\model\cms\Order | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\cms\Order; | ||
25 | + $this->view->assign("statusList", $this->model->getStatusList()); | ||
26 | + } | ||
27 | + | ||
28 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\cms; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 单页表 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class Page extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Page模型对象 | ||
17 | + */ | ||
18 | + protected $model = null; | ||
19 | + protected $noNeedRight = ['selectpage_type']; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\cms\Page; | ||
25 | + $this->view->assign("flagList", $this->model->getFlagList()); | ||
26 | + $this->view->assign("statusList", $this->model->getStatusList()); | ||
27 | + } | ||
28 | + | ||
29 | + public function index() | ||
30 | + { | ||
31 | + $typeArr = \app\admin\model\cms\Page::distinct('type')->column('type'); | ||
32 | + $this->view->assign('typeList', $typeArr); | ||
33 | + $this->assignconfig('typeList', $typeArr); | ||
34 | + return parent::index(); | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * 动态下拉选择类型 | ||
39 | + * @internal | ||
40 | + */ | ||
41 | + public function selectpage_type() | ||
42 | + { | ||
43 | + $list = []; | ||
44 | + $word = (array)$this->request->request("q_word/a"); | ||
45 | + $field = $this->request->request('showField'); | ||
46 | + $keyValue = $this->request->request('keyValue'); | ||
47 | + if (!$keyValue) { | ||
48 | + if (array_filter($word)) { | ||
49 | + foreach ($word as $k => $v) { | ||
50 | + $list[] = ['id' => $v, $field => $v]; | ||
51 | + } | ||
52 | + } | ||
53 | + $typeArr = \app\admin\model\cms\Page::column('type'); | ||
54 | + $typeArr = array_unique($typeArr); | ||
55 | + foreach ($typeArr as $index => $item) { | ||
56 | + $list[] = ['id' => $item, $field => $item]; | ||
57 | + } | ||
58 | + } else { | ||
59 | + $list[] = ['id' => $keyValue, $field => $keyValue]; | ||
60 | + } | ||
61 | + return json(['total' => count($list), 'list' => $list]); | ||
62 | + } | ||
63 | + | ||
64 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller\cms; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 标签表 | ||
9 | + * | ||
10 | + * @icon tags | ||
11 | + */ | ||
12 | +class Tags extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Tags模型对象 | ||
17 | + */ | ||
18 | + protected $model = null; | ||
19 | + | ||
20 | + public function _initialize() | ||
21 | + { | ||
22 | + parent::_initialize(); | ||
23 | + $this->model = new \app\admin\model\cms\Tags; | ||
24 | + } | ||
25 | + | ||
26 | + /** | ||
27 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个方法 | ||
28 | + * 因此在当前控制器中可不用编写增删改查的代码,如果需要自己控制这部分逻辑 | ||
29 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
30 | + */ | ||
31 | + public function selectpage() | ||
32 | + { | ||
33 | + $response = parent::selectpage(); | ||
34 | + $word = (array)$this->request->request("q_word/a"); | ||
35 | + if (array_filter($word)) { | ||
36 | + $result = $response->getData(); | ||
37 | + foreach ($word as $k => $v) { | ||
38 | + array_unshift($result['list'], ['id' => $v, 'name' => $v]); | ||
39 | + $result['total']++; | ||
40 | + } | ||
41 | + $response->data($result); | ||
42 | + } | ||
43 | + return $response; | ||
44 | + } | ||
45 | + | ||
46 | +} |
1 | +<?php | ||
2 | + | ||
3 | +return [ | ||
4 | + 'Channel' => '栏目', | ||
5 | + 'Channel_id' => '栏目ID', | ||
6 | + 'Channel_name' => '栏目名称', | ||
7 | + 'Channel list' => '栏目列表', | ||
8 | + 'Addon list' => '副表列表', | ||
9 | + 'Model' => '模型', | ||
10 | + 'Model_id' => '模型ID', | ||
11 | + 'User_id' => '发布会员', | ||
12 | + 'Title' => '文章标题', | ||
13 | + 'Flag' => '标志', | ||
14 | + 'Image' => '缩略图', | ||
15 | + 'Keywords' => '关键字', | ||
16 | + 'Description' => '描述', | ||
17 | + 'Tags' => 'TAG', | ||
18 | + 'Weigh' => '权重', | ||
19 | + 'Views' => '浏览', | ||
20 | + 'Comments' => '评论', | ||
21 | + 'Likes' => '点赞', | ||
22 | + 'Dislikes' => '点踩', | ||
23 | + 'Diyname' => '自定义URL', | ||
24 | + 'Createtime' => '创建时间', | ||
25 | + 'Updatetime' => '更新时间', | ||
26 | + 'Deletetime' => '删除时间', | ||
27 | + 'Recycle bin' => '回收站', | ||
28 | + 'Restore' => '还原', | ||
29 | + 'Restore all' => '还原全部', | ||
30 | + 'Destroy' => '销毁', | ||
31 | + 'Destroy all' => '清空回收站', | ||
32 | + 'Nothing need restore' => '没有需要还原的数据', | ||
33 | + 'Move tips' => '只能将数据移动到相同模型的栏目下,不同模型的数据移动将被忽略', | ||
34 | + 'Are you sure you want to truncate?' => '确认清空回收站?', | ||
35 | + 'Can not be digital' => '不能为数字', | ||
36 | + 'Please select channel' => '请选择分类', | ||
37 | + 'The data already exist' => '已经存在', | ||
38 | + 'Status' => '状态', | ||
39 | + 'Status normal' => '正常', | ||
40 | + 'Status hidden' => '隐藏', | ||
41 | + 'Status rejected' => '已拒绝', | ||
42 | + 'Status pulloff' => '已下线', | ||
43 | + 'Set to rejected' => '设为拒绝', | ||
44 | + 'Set to pulloff' => '设为下线', | ||
45 | + 'Array key' => '键', | ||
46 | + 'Array value' => '值', | ||
47 | + 'Publish' => '发布' | ||
48 | +]; |
1 | +<?php | ||
2 | + | ||
3 | +return [ | ||
4 | + 'Type' => '类型', | ||
5 | + 'Model_id' => '模型ID', | ||
6 | + 'Model_name' => '模型名称', | ||
7 | + 'Parent_id' => '父ID', | ||
8 | + 'Parent_ids' => '父ID集合', | ||
9 | + 'Child_ids' => '子ID集合', | ||
10 | + 'Name' => '名称', | ||
11 | + 'Image' => '图片', | ||
12 | + 'Keywords' => '关键字', | ||
13 | + 'Description' => '描述', | ||
14 | + 'Diyname' => '自定义名称', | ||
15 | + 'Outlink' => '外部链接', | ||
16 | + 'Items' => '文章数量', | ||
17 | + 'Channels' => '栏目数量', | ||
18 | + 'Authorization' => '授权', | ||
19 | + 'Save' => '保存', | ||
20 | + 'Weigh' => '权重', | ||
21 | + 'Channeltpl' => '栏目页模板', | ||
22 | + 'Listtpl' => '列表页模板', | ||
23 | + 'Showtpl' => '详情页模板', | ||
24 | + 'Pagesize' => '分页大小', | ||
25 | + 'Remove' => '移除', | ||
26 | + 'Createtime' => '创建时间', | ||
27 | + 'Updatetime' => '更新时间', | ||
28 | + 'The data already exist' => '已经存在', | ||
29 | + 'You must choose at least one channel' => '必须选择一个栏目', | ||
30 | + 'Are you sure you want to remove this item?' => '确认要取消此管理员的所有栏目授权?', | ||
31 | + 'Iscontribute' => '是否允许投稿', | ||
32 | + 'Status' => '状态', | ||
33 | + 'Channel' => '栏目', | ||
34 | + 'List' => '列表', | ||
35 | + 'Link' => '外部链接' | ||
36 | +]; |
1 | +<?php | ||
2 | + | ||
3 | +return [ | ||
4 | + 'Id' => 'ID', | ||
5 | + 'Type' => '类型', | ||
6 | + 'Archives' => '文档', | ||
7 | + 'Page' => '单页', | ||
8 | + 'Aid' => '关联ID', | ||
9 | + 'Pid' => '父ID', | ||
10 | + 'User_id' => '会员ID', | ||
11 | + 'Content' => '内容', | ||
12 | + 'Comments' => '评论数', | ||
13 | + 'Ip' => 'IP', | ||
14 | + 'Useragent' => 'User Agent', | ||
15 | + 'Subscribe' => '订阅', | ||
16 | + 'Createtime' => '创建时间', | ||
17 | + 'Updatetime' => '更新时间', | ||
18 | + 'Status' => '状态' | ||
19 | +]; |
1 | +<?php | ||
2 | + | ||
3 | +return [ | ||
4 | + 'Type' => '类型', | ||
5 | + 'Name' => '名称', | ||
6 | + 'Table' => '表名', | ||
7 | + 'Keywords' => '关键字', | ||
8 | + 'Description' => '描述', | ||
9 | + 'Successtips' => '成功提交提示文字', | ||
10 | + 'Diyname' => '自定义名称', | ||
11 | + 'Needlogin' => '是否需要登录', | ||
12 | + 'Formtpl' => '表单模板', | ||
13 | + 'Createtime' => '添加时间', | ||
14 | + 'Updatetime' => '更新时间', | ||
15 | + 'Status' => '状态' | ||
16 | +]; |
1 | +<?php | ||
2 | + | ||
3 | +return [ | ||
4 | + 'Model_id' => '模型ID', | ||
5 | + 'Name' => '名称', | ||
6 | + 'Type' => '类型', | ||
7 | + 'Title' => '标题', | ||
8 | + 'Content' => '条目列表', | ||
9 | + 'Rule' => '验证规则', | ||
10 | + 'Validate Msg' => '错误消息', | ||
11 | + 'Validate Ok' => '成功消息', | ||
12 | + 'Validate Tip' => '提示消息', | ||
13 | + 'Extend' => '扩展信息', | ||
14 | + 'Weigh' => '排序', | ||
15 | + 'Setting' => '字段设置', | ||
16 | + 'Length' => '字段长度', | ||
17 | + 'Decimals' => '小数点长度', | ||
18 | + 'Minimum' => '最少选择', | ||
19 | + 'Maximum' => '最大选择', | ||
20 | + 'Defaultvalue' => '默认值', | ||
21 | + 'Iscontribute' => '是否可投稿', | ||
22 | + 'Isfilter' => '是否列表筛选', | ||
23 | + 'String' => '字符', | ||
24 | + 'Text' => '文本', | ||
25 | + 'Editor' => '编辑器', | ||
26 | + 'Number' => '数字', | ||
27 | + 'Date' => '日期', | ||
28 | + 'Time' => '时间', | ||
29 | + 'Datetime' => '日期时间', | ||
30 | + 'Image' => '图片', | ||
31 | + 'Images' => '图片(多)', | ||
32 | + 'File' => '文件', | ||
33 | + 'Files' => '文件(多)', | ||
34 | + 'Select' => '列表', | ||
35 | + 'Selects' => '列表(多选)', | ||
36 | + 'Switch' => '开关', | ||
37 | + 'Checkbox' => '复选', | ||
38 | + 'Radio' => '单选', | ||
39 | + 'Array' => '数组', | ||
40 | + 'Array key' => '键名', | ||
41 | + 'Array value' => '键值', | ||
42 | + 'Createtime' => '添加时间', | ||
43 | + 'Updatetime' => '更新时间', | ||
44 | + 'Status' => '状态' | ||
45 | +]; |
1 | +<?php | ||
2 | + | ||
3 | +return [ | ||
4 | + 'Name' => '模型名称', | ||
5 | + 'Table' => '表名', | ||
6 | + 'Fields' => '字段列表', | ||
7 | + 'Channeltpl' => '栏目页模板', | ||
8 | + 'Listtpl' => '列表页模板', | ||
9 | + 'Showtpl' => '详情页模板', | ||
10 | + 'Main list' => '主表列表', | ||
11 | + 'Addon list' => '副表列表', | ||
12 | + 'Createtime' => '创建时间', | ||
13 | + 'Updatetime' => '更新时间', | ||
14 | + 'Setting' => '配置' | ||
15 | +]; |
1 | +<?php | ||
2 | + | ||
3 | +return [ | ||
4 | + 'Id' => '订单ID', | ||
5 | + 'User_id' => '会员ID', | ||
6 | + 'Archives_id' => '文档ID', | ||
7 | + 'Title' => '订单标题', | ||
8 | + 'Amount' => '订单金额', | ||
9 | + 'Payamount' => '支付金额', | ||
10 | + 'Paytype' => '支付类型', | ||
11 | + 'Paytime' => '支付时间', | ||
12 | + 'Ip' => 'IP地址', | ||
13 | + 'Useragent' => 'UserAgent', | ||
14 | + 'Memo' => '备注', | ||
15 | + 'Createtime' => '添加时间', | ||
16 | + 'Updatetime' => '更新时间', | ||
17 | + 'Status' => '状态', | ||
18 | + 'Paid' => '已支付', | ||
19 | + 'Expired' => '已过期', | ||
20 | + 'Created' => '未支付', | ||
21 | + 'Set to created' => '设为未支付', | ||
22 | + 'Set to paid' => '设为已支付', | ||
23 | + 'Set to expired' => '设为已过期', | ||
24 | +]; |
1 | +<?php | ||
2 | + | ||
3 | +return [ | ||
4 | + 'Id' => 'ID', | ||
5 | + 'Category_id' => '分类ID', | ||
6 | + 'Type' => '类型', | ||
7 | + 'Title' => '标题', | ||
8 | + 'Keywords' => '关键字', | ||
9 | + 'Description' => '描述', | ||
10 | + 'Flag' => '标志', | ||
11 | + 'Image' => '图片', | ||
12 | + 'Content' => '内容', | ||
13 | + 'Icon' => '图标', | ||
14 | + 'Views' => '点击', | ||
15 | + 'Comments' => '评论', | ||
16 | + 'Diyname' => '自定义', | ||
17 | + 'Showtpl' => '视图模板', | ||
18 | + 'Createtime' => '创建时间', | ||
19 | + 'Updatetime' => '更新时间', | ||
20 | + 'Weigh' => '权重', | ||
21 | + 'Status' => '状态' | ||
22 | +]; |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\cms; | ||
4 | + | ||
5 | +use app\common\model\Config; | ||
6 | +use think\Model; | ||
7 | +use traits\model\SoftDelete; | ||
8 | + | ||
9 | +class Archives extends Model | ||
10 | +{ | ||
11 | + | ||
12 | + use SoftDelete; | ||
13 | + | ||
14 | + // 表名 | ||
15 | + protected $name = 'cms_archives'; | ||
16 | + // 自动写入时间戳字段 | ||
17 | + protected $autoWriteTimestamp = 'int'; | ||
18 | + // 定义时间戳字段名 | ||
19 | + protected $createTime = 'createtime'; | ||
20 | + protected $updateTime = 'updatetime'; | ||
21 | + protected $deleteTime = 'deletetime'; | ||
22 | + // 追加属性 | ||
23 | + protected $append = [ | ||
24 | + 'flag_text', | ||
25 | + 'status_text', | ||
26 | + 'publishtime_text', | ||
27 | + 'url', | ||
28 | + ]; | ||
29 | + | ||
30 | + public function getUrlAttr($value, $data) | ||
31 | + { | ||
32 | + $diyname = $data['diyname'] ? $data['diyname'] : $data['id']; | ||
33 | + return addon_url('cms/archives/index', [':id' => $data['id'], ':diyname' => $diyname, ':channel' => $data['channel_id']]); | ||
34 | + } | ||
35 | + | ||
36 | + protected static function init() | ||
37 | + { | ||
38 | + self::afterInsert(function ($row) { | ||
39 | + $pk = $row->getPk(); | ||
40 | + $channel = Channel::get($row['channel_id']); | ||
41 | + $row->getQuery()->where($pk, $row[$pk])->update(['model_id' => $channel ? $channel['model_id'] : 0, 'weigh' => $row[$pk]]); | ||
42 | + Channel::where('id', $row['channel_id'])->setInc('items'); | ||
43 | + }); | ||
44 | + self::beforeWrite(function ($row) { | ||
45 | + //在更新之前对数组进行处理 | ||
46 | + foreach ($row->getData() as $k => $value) { | ||
47 | + if (is_array($value) && isset($value['field'])) { | ||
48 | + $value = json_encode(Config::getArrayData($value), JSON_UNESCAPED_UNICODE); | ||
49 | + } else { | ||
50 | + $value = is_array($value) ? implode(',', $value) : $value; | ||
51 | + } | ||
52 | + $row->$k = $value; | ||
53 | + } | ||
54 | + }); | ||
55 | + self::afterWrite(function ($row) { | ||
56 | + if (isset($row['channel_id'])) { | ||
57 | + //在更新成功后刷新副表、TAGS表数据、栏目表 | ||
58 | + $channel = Channel::get($row->channel_id); | ||
59 | + if ($channel) { | ||
60 | + $model = Modelx::get($channel['model_id']); | ||
61 | + if ($model && isset($row['content'])) { | ||
62 | + $values = array_intersect_key($row->getData(), array_flip($model->fields)); | ||
63 | + $values['id'] = $row['id']; | ||
64 | + $values['content'] = $row['content']; | ||
65 | + db($model['table'])->insert($values, TRUE); | ||
66 | + } | ||
67 | + } | ||
68 | + } | ||
69 | + if (isset($row['tags'])) { | ||
70 | + $tags = array_filter(explode(',', $row['tags'])); | ||
71 | + if ($tags) { | ||
72 | + $tagslist = Tags::where('name', 'in', $tags)->select(); | ||
73 | + foreach ($tagslist as $k => $v) { | ||
74 | + $archives = explode(',', $v['archives']); | ||
75 | + if (!in_array($row['id'], $archives)) { | ||
76 | + $archives[] = $row['id']; | ||
77 | + $v->archives = implode(',', $archives); | ||
78 | + $v->nums++; | ||
79 | + $v->save(); | ||
80 | + } | ||
81 | + $tags = array_diff($tags, [$v['name']]); | ||
82 | + } | ||
83 | + $list = []; | ||
84 | + foreach ($tags as $k => $v) { | ||
85 | + $list[] = ['name' => $v, 'archives' => $row['id'], 'nums' => 1]; | ||
86 | + } | ||
87 | + if ($list) { | ||
88 | + (new Tags())->saveAll($list); | ||
89 | + } | ||
90 | + } | ||
91 | + } | ||
92 | + }); | ||
93 | + } | ||
94 | + | ||
95 | + public function getFlagList() | ||
96 | + { | ||
97 | + return ['hot' => __('Hot'), 'new' => __('New'), 'recommend' => __('Recommend')]; | ||
98 | + } | ||
99 | + | ||
100 | + public function getStatusList() | ||
101 | + { | ||
102 | + return ['normal' => __('Normal'), 'hidden' => __('Hidden'), 'rejected' => __('Status rejected'), 'pulloff' => __('Status pulloff')]; | ||
103 | + } | ||
104 | + | ||
105 | + public function getFlagTextAttr($value, $data) | ||
106 | + { | ||
107 | + $value = $value ? $value : $data['flag']; | ||
108 | + $valueArr = $value ? explode(',', $value) : []; | ||
109 | + $list = $this->getFlagList(); | ||
110 | + return implode(',', array_intersect_key($list, array_flip($valueArr))); | ||
111 | + } | ||
112 | + | ||
113 | + public function getStatusTextAttr($value, $data) | ||
114 | + { | ||
115 | + $value = $value ? $value : $data['status']; | ||
116 | + $list = $this->getStatusList(); | ||
117 | + return isset($list[$value]) ? $list[$value] : ''; | ||
118 | + } | ||
119 | + | ||
120 | + public function getPublishtimeTextAttr($value, $data) | ||
121 | + { | ||
122 | + $value = $value ? $value : $data['publishtime']; | ||
123 | + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; | ||
124 | + } | ||
125 | + | ||
126 | + protected function setPublishtimeAttr($value) | ||
127 | + { | ||
128 | + return $value && !is_numeric($value) ? strtotime($value) : $value; | ||
129 | + } | ||
130 | + | ||
131 | + public function channel() | ||
132 | + { | ||
133 | + return $this->belongsTo('Channel', 'channel_id', '', [], 'LEFT')->setEagerlyType(0); | ||
134 | + } | ||
135 | + | ||
136 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\cms; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | +class Block extends Model | ||
8 | +{ | ||
9 | + | ||
10 | + // 表名 | ||
11 | + protected $name = 'cms_block'; | ||
12 | + // 自动写入时间戳字段 | ||
13 | + protected $autoWriteTimestamp = 'int'; | ||
14 | + // 定义时间戳字段名 | ||
15 | + protected $createTime = 'createtime'; | ||
16 | + protected $updateTime = 'updatetime'; | ||
17 | + // 追加属性 | ||
18 | + protected $append = [ | ||
19 | + 'status_text' | ||
20 | + ]; | ||
21 | + | ||
22 | + public function getStatusList() | ||
23 | + { | ||
24 | + return ['normal' => __('Normal'), 'hidden' => __('Hidden')]; | ||
25 | + } | ||
26 | + | ||
27 | + public function getStatusTextAttr($value, $data) | ||
28 | + { | ||
29 | + $value = $value ? $value : $data['status']; | ||
30 | + $list = $this->getStatusList(); | ||
31 | + return isset($list[$value]) ? $list[$value] : ''; | ||
32 | + } | ||
33 | + | ||
34 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\cms; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | +class Channel extends Model | ||
8 | +{ | ||
9 | + | ||
10 | + // 表名 | ||
11 | + protected $name = 'cms_channel'; | ||
12 | + // 自动写入时间戳字段 | ||
13 | + protected $autoWriteTimestamp = 'int'; | ||
14 | + // 定义时间戳字段名 | ||
15 | + protected $createTime = 'createtime'; | ||
16 | + protected $updateTime = 'updatetime'; | ||
17 | + // 追加属性 | ||
18 | + protected $append = [ | ||
19 | + 'type_text', | ||
20 | + 'status_text', | ||
21 | + 'url' | ||
22 | + ]; | ||
23 | + | ||
24 | + public function getUrlAttr($value, $data) | ||
25 | + { | ||
26 | + $diyname = $data['diyname'] ? $data['diyname'] : $data['id']; | ||
27 | + return isset($data['type']) && isset($data['outlink']) && $data['type'] == 'link' ? $data['outlink'] : addon_url('cms/channel/index', [':id' => $data['id'], ':diyname' => $diyname]); | ||
28 | + } | ||
29 | + | ||
30 | + protected static function init() | ||
31 | + { | ||
32 | + self::afterInsert(function ($row) { | ||
33 | + //创建时自动添加权重值 | ||
34 | + $pk = $row->getPk(); | ||
35 | + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); | ||
36 | + }); | ||
37 | + self::afterDelete(function ($row) { | ||
38 | + //删除时,删除子节点,同时将所有相关文档移入回收站 | ||
39 | + static $tree; | ||
40 | + if (!$tree) { | ||
41 | + $tree = \fast\Tree::instance(); | ||
42 | + $tree->init(collection(Channel::order('weigh desc,id desc')->field('id,parent_id,name,type,diyname,status')->select())->toArray(), 'parent_id'); | ||
43 | + } | ||
44 | + $childIds = $tree->getChildrenIds($row['id']); | ||
45 | + if ($childIds) { | ||
46 | + Channel::destroy(function ($query) use ($childIds) { | ||
47 | + $query->where('id', 'in', $childIds); | ||
48 | + }); | ||
49 | + } | ||
50 | + $childIds[] = $row['id']; | ||
51 | + db('cms_archives')->where('channel_id', 'in', $childIds)->update(['deletetime' => time()]); | ||
52 | + }); | ||
53 | + self::afterWrite(function ($row) { | ||
54 | + $changed = $row->getChangedData(); | ||
55 | + //隐藏时判断是否有子节点,有则隐藏 | ||
56 | + if (isset($changed['status']) && $changed['status'] == 'hidden') { | ||
57 | + static $tree; | ||
58 | + if (!$tree) { | ||
59 | + $tree = \fast\Tree::instance(); | ||
60 | + $tree->init(collection(Channel::order('weigh desc,id desc')->field('id,parent_id,name,type,diyname,status')->select())->toArray(), 'parent_id'); | ||
61 | + } | ||
62 | + $childIds = $tree->getChildrenIds($row['id']); | ||
63 | + db('cms_channel')->where('id', 'in', $childIds)->update(['status' => 'hidden']); | ||
64 | + } | ||
65 | + }); | ||
66 | + } | ||
67 | + | ||
68 | + public static function getTypeList() | ||
69 | + { | ||
70 | + return ['channel' => __('Channel'), 'list' => __('List'), 'link' => __('Link')]; | ||
71 | + } | ||
72 | + | ||
73 | + public static function getStatusList() | ||
74 | + { | ||
75 | + return ['normal' => __('Normal'), 'hidden' => __('Hidden')]; | ||
76 | + } | ||
77 | + | ||
78 | + public function getTypeTextAttr($value, $data) | ||
79 | + { | ||
80 | + $value = $value ? $value : $data['type']; | ||
81 | + $list = $this->getTypeList(); | ||
82 | + return isset($list[$value]) ? $list[$value] : ''; | ||
83 | + } | ||
84 | + | ||
85 | + public function getStatusTextAttr($value, $data) | ||
86 | + { | ||
87 | + $value = $value ? $value : $data['status']; | ||
88 | + $list = $this->getStatusList(); | ||
89 | + return isset($list[$value]) ? $list[$value] : ''; | ||
90 | + } | ||
91 | + | ||
92 | + public function model() | ||
93 | + { | ||
94 | + return $this->belongsTo('Modelx', 'model_id')->setEagerlyType(0); | ||
95 | + } | ||
96 | + | ||
97 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\cms; | ||
4 | + | ||
5 | +use app\admin\library\Auth; | ||
6 | +use think\Model; | ||
7 | + | ||
8 | +class ChannelAdmin extends Model | ||
9 | +{ | ||
10 | + | ||
11 | + // 表名 | ||
12 | + protected $name = 'cms_channel_admin'; | ||
13 | + // 自动写入时间戳字段 | ||
14 | + protected $autoWriteTimestamp = 'int'; | ||
15 | + // 定义时间戳字段名 | ||
16 | + protected $createTime = false; | ||
17 | + protected $updateTime = false; | ||
18 | + // 追加属性 | ||
19 | + protected $append = [ | ||
20 | + ]; | ||
21 | + | ||
22 | + public static function getAdminChanneIds($admin_id = null) | ||
23 | + { | ||
24 | + $admin_id = $admin_id ? $admin_id : Auth::instance()->id; | ||
25 | + $selected = ChannelAdmin::where('admin_id', $admin_id)->column('channel_id'); | ||
26 | + return $selected; | ||
27 | + } | ||
28 | + | ||
29 | + public function admin() | ||
30 | + { | ||
31 | + return $this->belongsTo('\app\admin\model\Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0); | ||
32 | + } | ||
33 | + | ||
34 | + public function channel() | ||
35 | + { | ||
36 | + return $this->belongsTo('\app\admin\model\cms\Channel', 'channel_id', 'id', [], 'LEFT')->setEagerlyType(0); | ||
37 | + } | ||
38 | + | ||
39 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\cms; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | +class Comment extends Model | ||
8 | +{ | ||
9 | + // 表名 | ||
10 | + protected $name = 'cms_comment'; | ||
11 | + | ||
12 | + // 自动写入时间戳字段 | ||
13 | + protected $autoWriteTimestamp = 'int'; | ||
14 | + | ||
15 | + // 定义时间戳字段名 | ||
16 | + protected $createTime = 'createtime'; | ||
17 | + protected $updateTime = 'updatetime'; | ||
18 | + | ||
19 | + // 追加属性 | ||
20 | + protected $append = [ | ||
21 | + 'type_text', | ||
22 | + 'status_text' | ||
23 | + ]; | ||
24 | + | ||
25 | + | ||
26 | + public function getTypeList() | ||
27 | + { | ||
28 | + return ['archives' => __('Archives'), 'page' => __('Page')]; | ||
29 | + } | ||
30 | + | ||
31 | + public function getStatusList() | ||
32 | + { | ||
33 | + return ['normal' => __('Normal'), 'hidden' => __('Hidden')]; | ||
34 | + } | ||
35 | + | ||
36 | + | ||
37 | + public function getTypeTextAttr($value, $data) | ||
38 | + { | ||
39 | + $value = $value ? $value : $data['type']; | ||
40 | + $list = $this->getTypeList(); | ||
41 | + return isset($list[$value]) ? $list[$value] : ''; | ||
42 | + } | ||
43 | + | ||
44 | + | ||
45 | + public function getStatusTextAttr($value, $data) | ||
46 | + { | ||
47 | + $value = $value ? $value : $data['status']; | ||
48 | + $list = $this->getStatusList(); | ||
49 | + return isset($list[$value]) ? $list[$value] : ''; | ||
50 | + } | ||
51 | + | ||
52 | + | ||
53 | + public function archives() | ||
54 | + { | ||
55 | + return $this->belongsTo('Archives', 'aid', '', [], 'LEFT')->setEagerlyType(0); | ||
56 | + } | ||
57 | + | ||
58 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\cms; | ||
4 | + | ||
5 | +use think\Config; | ||
6 | +use think\Model; | ||
7 | + | ||
8 | +class Diyform extends Model | ||
9 | +{ | ||
10 | + | ||
11 | + // 表名 | ||
12 | + protected $name = 'cms_diyform'; | ||
13 | + // 自动写入时间戳字段 | ||
14 | + protected $autoWriteTimestamp = 'int'; | ||
15 | + // 定义时间戳字段名 | ||
16 | + protected $createTime = 'createtime'; | ||
17 | + protected $updateTime = 'updatetime'; | ||
18 | + // 追加属性 | ||
19 | + protected $append = [ | ||
20 | + 'url' | ||
21 | + ]; | ||
22 | + | ||
23 | + public static function init() | ||
24 | + { | ||
25 | + self::afterInsert(function ($row) { | ||
26 | + $prefix = Config::get('database.prefix'); | ||
27 | + $sql = "CREATE TABLE `{$prefix}{$row['table']}` ( | ||
28 | + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, | ||
29 | + `user_id` int(10) DEFAULT NULL COMMENT '会员ID', | ||
30 | + `createtime` int(10) DEFAULT NULL COMMENT '添加时间', | ||
31 | + `updatetime` int(10) DEFAULT NULL COMMENT '更新时间', | ||
32 | + PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='{$row['name']}'"; | ||
33 | + db()->query($sql); | ||
34 | + }); | ||
35 | + } | ||
36 | + | ||
37 | + public function getUrlAttr($value, $data) | ||
38 | + { | ||
39 | + $diyname = $data['diyname'] ? $data['diyname'] : $data['id']; | ||
40 | + return addon_url('cms/diyform/index', [':id' => $data['id'], ':diyname' => $diyname]); | ||
41 | + } | ||
42 | + | ||
43 | + public function getFieldsAttr($value, $data) | ||
44 | + { | ||
45 | + return is_array($value) ? $value : ($value ? explode(',', $value) : []); | ||
46 | + } | ||
47 | + public function getStatusList() | ||
48 | + { | ||
49 | + return ['normal' => __('Normal'), 'hidden' => __('Hidden')]; | ||
50 | + } | ||
51 | + | ||
52 | + public function getStatusTextAttr($value, $data) | ||
53 | + { | ||
54 | + $value = $value ? $value : $data['status']; | ||
55 | + $list = $this->getStatusList(); | ||
56 | + return isset($list[$value]) ? $list[$value] : ''; | ||
57 | + } | ||
58 | + | ||
59 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\cms; | ||
4 | + | ||
5 | +use addons\cms\library\Alter; | ||
6 | +use app\common\model\Config; | ||
7 | +use think\Exception; | ||
8 | +use think\exception\PDOException; | ||
9 | +use think\Model; | ||
10 | + | ||
11 | +class Fields extends Model | ||
12 | +{ | ||
13 | + | ||
14 | + // 表名 | ||
15 | + protected $name = 'cms_fields'; | ||
16 | + // 自动写入时间戳字段 | ||
17 | + protected $autoWriteTimestamp = 'int'; | ||
18 | + // 定义时间戳字段名 | ||
19 | + protected $createTime = 'createtime'; | ||
20 | + protected $updateTime = 'updatetime'; | ||
21 | + // 追加属性 | ||
22 | + protected $append = [ | ||
23 | + 'status_text', | ||
24 | + 'content_list', | ||
25 | + ]; | ||
26 | + protected static $listField = ['select', 'selects', 'checkbox', 'radio', 'array']; | ||
27 | + | ||
28 | + public function setError($error) | ||
29 | + { | ||
30 | + $this->error = $error; | ||
31 | + } | ||
32 | + | ||
33 | + protected static function init() | ||
34 | + { | ||
35 | + $beforeUpdateCallback = function ($row) { | ||
36 | + | ||
37 | + }; | ||
38 | + | ||
39 | + $afterInsertCallback = function ($row) { | ||
40 | + //为了避免引起更新的事件回调,这里采用直接执行SQL的写法 | ||
41 | + $row->query($row->fetchSql(true)->update(['id' => $row['id'], 'weigh' => $row['id']])); | ||
42 | + $field = $row['model_id'] ? 'model_id' : 'diyform_id'; | ||
43 | + $model = $row['model_id'] ? Modelx::get($row[$field]) : Diyform::get($row[$field]); | ||
44 | + if ($model) { | ||
45 | + $sql = Alter::instance() | ||
46 | + ->setTable($model['table']) | ||
47 | + ->setName($row['name']) | ||
48 | + ->setLength($row['length']) | ||
49 | + ->setContent($row['content']) | ||
50 | + ->setDecimals($row['decimals']) | ||
51 | + ->setDefaultvalue($row['defaultvalue']) | ||
52 | + ->setComment($row['title']) | ||
53 | + ->setType($row['type']) | ||
54 | + ->getAddSql(); | ||
55 | + try { | ||
56 | + db()->query($sql); | ||
57 | + $fields = Fields::where($field, $model['id'])->field('name')->column('name'); | ||
58 | + $model->fields = implode(',', $fields); | ||
59 | + $model->save(); | ||
60 | + } catch (PDOException $e) { | ||
61 | + $row->getQuery()->where('id', $row->id)->delete(); | ||
62 | + throw new Exception($e->getMessage()); | ||
63 | + } | ||
64 | + } | ||
65 | + }; | ||
66 | + $afterUpdateCallback = function ($row) { | ||
67 | + $field = $row['model_id'] ? 'model_id' : 'diyform_id'; | ||
68 | + $model = $row['model_id'] ? Modelx::get($row[$field]) : Diyform::get($row[$field]); | ||
69 | + if ($model) { | ||
70 | + $alter = Alter::instance(); | ||
71 | + if (isset($row['oldname']) && $row['oldname'] != $row['name']) { | ||
72 | + $alter->setOldname($row['oldname']); | ||
73 | + } | ||
74 | + $sql = $alter | ||
75 | + ->setTable($model['table']) | ||
76 | + ->setName($row['name']) | ||
77 | + ->setLength($row['length']) | ||
78 | + ->setContent($row['content']) | ||
79 | + ->setDecimals($row['decimals']) | ||
80 | + ->setDefaultvalue($row['defaultvalue']) | ||
81 | + ->setComment($row['title']) | ||
82 | + ->setType($row['type']) | ||
83 | + ->getModifySql(); | ||
84 | + db()->query($sql); | ||
85 | + $fields = Fields::where($field, $model['id'])->field('name')->column('name'); | ||
86 | + $model->fields = implode(',', $fields); | ||
87 | + $model->save(); | ||
88 | + } | ||
89 | + }; | ||
90 | + | ||
91 | + self::beforeInsert($beforeUpdateCallback); | ||
92 | + self::beforeUpdate($beforeUpdateCallback); | ||
93 | + | ||
94 | + self::afterInsert($afterInsertCallback); | ||
95 | + self::afterUpdate($afterUpdateCallback); | ||
96 | + | ||
97 | + self::afterDelete(function ($row) { | ||
98 | + $field = $row['model_id'] ? 'model_id' : 'diyform_id'; | ||
99 | + $model = $row['model_id'] ? Modelx::get($row[$field]) : Diyform::get($row[$field]); | ||
100 | + if ($model) { | ||
101 | + $sql = Alter::instance() | ||
102 | + ->setTable($model['table']) | ||
103 | + ->setName($row['name']) | ||
104 | + ->getDropSql(); | ||
105 | + try { | ||
106 | + db()->query($sql); | ||
107 | + } catch (PDOException $e) { | ||
108 | + | ||
109 | + } | ||
110 | + } | ||
111 | + }); | ||
112 | + } | ||
113 | + | ||
114 | + public function getContentListAttr($value, $data) | ||
115 | + { | ||
116 | + return in_array($data['type'], self::$listField) ? Config::decode($data['content']) : $data['content']; | ||
117 | + } | ||
118 | + | ||
119 | + public function getStatusList() | ||
120 | + { | ||
121 | + return ['normal' => __('Normal'), 'hidden' => __('Hidden')]; | ||
122 | + } | ||
123 | + | ||
124 | + public function getStatusTextAttr($value, $data) | ||
125 | + { | ||
126 | + $value = $value ? $value : $data['status']; | ||
127 | + $list = $this->getStatusList(); | ||
128 | + return isset($list[$value]) ? $list[$value] : ''; | ||
129 | + } | ||
130 | + | ||
131 | + public function model() | ||
132 | + { | ||
133 | + return $this->belongsTo('Modelx', 'model_id')->setEagerlyType(0); | ||
134 | + } | ||
135 | + | ||
136 | + public function diyform() | ||
137 | + { | ||
138 | + return $this->belongsTo('Diyform', 'diyform_id')->setEagerlyType(0); | ||
139 | + } | ||
140 | + | ||
141 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\cms; | ||
4 | + | ||
5 | +use think\Config; | ||
6 | +use think\Model; | ||
7 | + | ||
8 | +class Modelx extends Model | ||
9 | +{ | ||
10 | + | ||
11 | + // 表名 | ||
12 | + protected $name = 'cms_model'; | ||
13 | + // 自动写入时间戳字段 | ||
14 | + protected $autoWriteTimestamp = 'int'; | ||
15 | + // 定义时间戳字段名 | ||
16 | + protected $createTime = 'createtime'; | ||
17 | + protected $updateTime = 'updatetime'; | ||
18 | + // 追加属性 | ||
19 | + protected $append = [ | ||
20 | + ]; | ||
21 | + | ||
22 | + public static function init() | ||
23 | + { | ||
24 | + self::afterInsert(function ($row) { | ||
25 | + $prefix = Config::get('database.prefix'); | ||
26 | + $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']}'"; | ||
27 | + db()->query($sql); | ||
28 | + }); | ||
29 | + } | ||
30 | + | ||
31 | + public function getFieldsAttr($value, $data) | ||
32 | + { | ||
33 | + return is_array($value) ? $value : ($value ? explode(',', $value) : []); | ||
34 | + } | ||
35 | + | ||
36 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\cms; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | +class Order extends Model | ||
8 | +{ | ||
9 | + // 表名 | ||
10 | + protected $name = 'cms_order'; | ||
11 | + | ||
12 | + // 自动写入时间戳字段 | ||
13 | + protected $autoWriteTimestamp = 'int'; | ||
14 | + | ||
15 | + // 定义时间戳字段名 | ||
16 | + protected $createTime = 'createtime'; | ||
17 | + protected $updateTime = 'updatetime'; | ||
18 | + | ||
19 | + // 追加属性 | ||
20 | + protected $append = [ | ||
21 | + 'paytime_text', | ||
22 | + 'status_text' | ||
23 | + ]; | ||
24 | + | ||
25 | + public function getStatusList() | ||
26 | + { | ||
27 | + return ['created' => __('Created'), 'paid' => __('Paid'), 'expired' => __('Expired')]; | ||
28 | + } | ||
29 | + | ||
30 | + public function getPaytimeTextAttr($value, $data) | ||
31 | + { | ||
32 | + $value = $value ? $value : (isset($data['paytime']) ? $data['paytime'] : ''); | ||
33 | + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; | ||
34 | + } | ||
35 | + | ||
36 | + public function getStatusTextAttr($value, $data) | ||
37 | + { | ||
38 | + $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); | ||
39 | + $list = $this->getStatusList(); | ||
40 | + return isset($list[$value]) ? $list[$value] : ''; | ||
41 | + } | ||
42 | + | ||
43 | + protected function setPaytimeAttr($value) | ||
44 | + { | ||
45 | + return $value && !is_numeric($value) ? strtotime($value) : $value; | ||
46 | + } | ||
47 | + | ||
48 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\cms; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | +class Page extends Model | ||
8 | +{ | ||
9 | + | ||
10 | + // 表名 | ||
11 | + protected $name = 'cms_page'; | ||
12 | + // 自动写入时间戳字段 | ||
13 | + protected $autoWriteTimestamp = 'int'; | ||
14 | + // 定义时间戳字段名 | ||
15 | + protected $createTime = 'createtime'; | ||
16 | + protected $updateTime = 'updatetime'; | ||
17 | + // 追加属性 | ||
18 | + protected $append = [ | ||
19 | + 'flag_text', | ||
20 | + 'status_text', | ||
21 | + 'url' | ||
22 | + ]; | ||
23 | + | ||
24 | + protected static function init() | ||
25 | + { | ||
26 | + self::afterInsert(function ($row) { | ||
27 | + $row->save(['weigh' => $row['id']]); | ||
28 | + }); | ||
29 | + } | ||
30 | + | ||
31 | + public function getUrlAttr($value, $data) | ||
32 | + { | ||
33 | + return addon_url('cms/page/index', [':diyname' => $data['diyname']]); | ||
34 | + } | ||
35 | + | ||
36 | + public function getStatusList() | ||
37 | + { | ||
38 | + return ['normal' => __('Normal'), 'hidden' => __('Hidden')]; | ||
39 | + } | ||
40 | + | ||
41 | + public function getStatusTextAttr($value, $data) | ||
42 | + { | ||
43 | + $value = $value ? $value : $data['status']; | ||
44 | + $list = $this->getStatusList(); | ||
45 | + return isset($list[$value]) ? $list[$value] : ''; | ||
46 | + } | ||
47 | + | ||
48 | + public function getFlagList() | ||
49 | + { | ||
50 | + return ['hot' => __('Hot'), 'index' => __('Index'), 'recommend' => __('Recommend')]; | ||
51 | + } | ||
52 | + | ||
53 | + public function getFlagTextAttr($value, $data) | ||
54 | + { | ||
55 | + $value = $value ? $value : $data['flag']; | ||
56 | + $valueArr = explode(',', $value); | ||
57 | + $list = $this->getFlagList(); | ||
58 | + return implode(',', array_intersect_key($list, array_flip($valueArr))); | ||
59 | + } | ||
60 | + | ||
61 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model\cms; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | +class Tags extends Model | ||
8 | +{ | ||
9 | + | ||
10 | + // 表名 | ||
11 | + protected $name = 'cms_tags'; | ||
12 | + // 自动写入时间戳字段 | ||
13 | + protected $autoWriteTimestamp = false; | ||
14 | + // 定义时间戳字段名 | ||
15 | + protected $createTime = false; | ||
16 | + protected $updateTime = false; | ||
17 | + // 追加属性 | ||
18 | + protected $append = [ | ||
19 | + 'url' | ||
20 | + ]; | ||
21 | + | ||
22 | + public function getUrlAttr($value, $data) | ||
23 | + { | ||
24 | + return addon_url('cms/tags/index', [':name' => $data['name']]); | ||
25 | + } | ||
26 | + | ||
27 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate\cms; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Archives extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate\cms; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Block extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate\cms; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Channel extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate\cms; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Comment extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate\cms; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Fields extends Validate | ||
8 | +{ | ||
9 | + | ||
10 | + /** | ||
11 | + * 验证规则 | ||
12 | + */ | ||
13 | + protected $rule = [ | ||
14 | + 'name|名称' => 'require|unique:cms_fields,model_id^name', | ||
15 | + 'title|管理员' => 'require', | ||
16 | + 'model_id|模型ID' => 'require|integer', | ||
17 | + 'status|状态' => 'require|in:normal,hidden', | ||
18 | + ]; | ||
19 | + | ||
20 | + /** | ||
21 | + * 提示消息 | ||
22 | + */ | ||
23 | + protected $message = [ | ||
24 | + ]; | ||
25 | + | ||
26 | + /** | ||
27 | + * 验证场景 | ||
28 | + */ | ||
29 | + protected $scene = [ | ||
30 | + 'add' => [ | ||
31 | + 'name', 'title', 'model_id', 'status' | ||
32 | + ], | ||
33 | + 'edit' => [ | ||
34 | + 'name', 'title', 'model_id', 'status' | ||
35 | + ], | ||
36 | + ]; | ||
37 | + | ||
38 | + public function __construct(array $rules = array(), $message = array(), $field = array()) | ||
39 | + { | ||
40 | + //如果是编辑模式,则排除下主键 | ||
41 | + $ids = request()->param("ids"); | ||
42 | + if ($ids) | ||
43 | + { | ||
44 | + $this->rule['name|名称'] .= ",{$ids}"; | ||
45 | + } | ||
46 | + parent::__construct($rules, $message, $field); | ||
47 | + } | ||
48 | + | ||
49 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate\cms; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Modelx extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate\cms; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Order extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate\cms; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Page extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate\cms; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Tags extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
1 | +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + <div class="row"> | ||
3 | + <div class="col-md-9 col-sm-12"> | ||
4 | + <div class="panel panel-default panel-intro"> | ||
5 | + <div class="panel-heading"> | ||
6 | + <ul class="nav nav-tabs"> | ||
7 | + <li class="active"><a href="#basic" data-toggle="tab">基础信息</a></li> | ||
8 | + </ul> | ||
9 | + </div> | ||
10 | + <div class="panel-body"> | ||
11 | + | ||
12 | + <div id="myTabContent" class="tab-content"> | ||
13 | + <div class="tab-pane fade active in" id="basic"> | ||
14 | + <div class="form-group"> | ||
15 | + <label for="c-channel_id" class="control-label col-xs-12 col-sm-2">{:__('Channel_id')}:</label> | ||
16 | + <div class="col-xs-12 col-sm-8"> | ||
17 | + <select id="c-channel_id" data-rule="required" class="form-control selectpicker" data-live-search="true" name="row[channel_id]"> | ||
18 | + {$channelOptions} | ||
19 | + </select> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | + <div class="form-group"> | ||
23 | + <label for="c-channel_id" class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label> | ||
24 | + <div class="col-xs-12 col-sm-8"> | ||
25 | + <input type="text" class="form-control selectpage" data-source="user/user/index" placeholder="发布会员,可为空" data-field="nickname" name="row[user_id]" /> | ||
26 | + </div> | ||
27 | + </div> | ||
28 | + <div class="form-group"> | ||
29 | + <label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> | ||
30 | + <div class="col-xs-12 col-sm-8"> | ||
31 | + <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value=""> | ||
32 | + </div> | ||
33 | + </div> | ||
34 | + | ||
35 | + <div class="form-group"> | ||
36 | + <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> | ||
37 | + <div class="col-xs-12 col-sm-8"> | ||
38 | + <div class="input-group"> | ||
39 | + <input id="c-image" class="form-control" size="50" name="row[image]" type="text" value=""> | ||
40 | + <div class="input-group-addon no-border no-padding"> | ||
41 | + <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> | ||
42 | + <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> | ||
43 | + </div> | ||
44 | + <span class="msg-box n-right" for="c-image"></span> | ||
45 | + </div> | ||
46 | + <ul class="row list-inline plupload-preview" id="p-image"></ul> | ||
47 | + </div> | ||
48 | + </div> | ||
49 | + <div class="form-group"> | ||
50 | + <label for="c-tags" class="control-label col-xs-12 col-sm-2">{:__('Tags')}:</label> | ||
51 | + <div class="col-xs-12 col-sm-8"> | ||
52 | + <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=""> | ||
53 | + </div> | ||
54 | + </div> | ||
55 | + | ||
56 | + <div class="form-group"> | ||
57 | + <label for="c-diyname" class="control-label col-xs-12 col-sm-2">{:__('Diyname')}:</label> | ||
58 | + <div class="col-xs-12 col-sm-8"> | ||
59 | + <div class="input-group"> | ||
60 | + <div class="input-group-btn"> | ||
61 | + <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">{:addon_url('cms/archives/index', [':diyname'=>''])}</button> | ||
62 | + </div> | ||
63 | + <input type="text" id="c-diyname" data-rule="diyname" name="row[diyname]" class="form-control" placeholder="请输入自定义的名称,为空将使用主键ID" /> | ||
64 | + </div> | ||
65 | + </div> | ||
66 | + </div> | ||
67 | + <div class="form-group"> | ||
68 | + <label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label> | ||
69 | + <div class="col-xs-12 col-sm-8"> | ||
70 | + <textarea id="c-content" data-rule="required" class="form-control editor" name="row[content]" rows="15" ></textarea> | ||
71 | + </div> | ||
72 | + </div> | ||
73 | + <div class="form-group"> | ||
74 | + <label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label> | ||
75 | + <div class="col-xs-12 col-sm-8"> | ||
76 | + <input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" type="text" value=""> | ||
77 | + </div> | ||
78 | + </div> | ||
79 | + <div class="form-group"> | ||
80 | + <label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label> | ||
81 | + <div class="col-xs-12 col-sm-8"> | ||
82 | + <textarea id="c-description" cols="60" rows="5" data-rule="" class="form-control" name="row[description]"></textarea> | ||
83 | + </div> | ||
84 | + </div> | ||
85 | + <div id="extend"></div> | ||
86 | + </div> | ||
87 | + </div> | ||
88 | + <div class="form-group layer-footer"> | ||
89 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
90 | + <div class="col-xs-12 col-sm-8"> | ||
91 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
92 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
93 | + </div> | ||
94 | + </div> | ||
95 | + </div> | ||
96 | + | ||
97 | + </div> | ||
98 | + | ||
99 | + </div> | ||
100 | + <div class="col-md-3 col-sm-12"> | ||
101 | + <div class="panel panel-default panel-intro"> | ||
102 | + <div class="panel-heading"> | ||
103 | + <div class="panel-lead"><em>相关信息</em></div> | ||
104 | + </div> | ||
105 | + <div class="panel-body"> | ||
106 | + <div class="tab-content"> | ||
107 | + <div class="tab-pane fade active in"> | ||
108 | + <div class="form-group"> | ||
109 | + <label for="c-views" class="control-label col-xs-12 col-sm-3">{:__('Views')}:</label> | ||
110 | + <div class="col-xs-12 col-sm-8"> | ||
111 | + <div class="input-group margin-bottom-sm"> | ||
112 | + | ||
113 | + <input id="c-views" data-rule="required" class="form-control" name="row[views]" placeholder="{:__('Views')}" type="number" value="0"> | ||
114 | + <span class="input-group-addon"><i class="fa fa-eye text-success"></i></span> | ||
115 | + </div> | ||
116 | + </div> | ||
117 | + </div> | ||
118 | + <div class="form-group"> | ||
119 | + <label for="c-comments" class="control-label col-xs-12 col-sm-3">{:__('Comments')}:</label> | ||
120 | + <div class="col-xs-12 col-sm-8"> | ||
121 | + <div class="input-group margin-bottom-sm"> | ||
122 | + | ||
123 | + <input id="c-comments" data-rule="required" class="form-control" name="row[comments]" placeholder="{:__('Comments')}" type="number" value="0"> | ||
124 | + <span class="input-group-addon"><i class="fa fa-comment text-info"></i></span> | ||
125 | + </div> | ||
126 | + </div> | ||
127 | + </div> | ||
128 | + <div class="form-group"> | ||
129 | + <label for="c-likes" class="control-label col-xs-12 col-sm-3">{:__('Likes')}:</label> | ||
130 | + <div class="col-xs-12 col-sm-8"> | ||
131 | + <div class="input-group margin-bottom-sm"> | ||
132 | + | ||
133 | + <input id="c-likes" data-rule="required" class="form-control" name="row[likes]" placeholder="{:__('Likes')}" type="number" value="0"> | ||
134 | + <span class="input-group-addon"><i class="fa fa-thumbs-up text-danger"></i></span> | ||
135 | + </div> | ||
136 | + </div> | ||
137 | + </div> | ||
138 | + <div class="form-group"> | ||
139 | + <label for="c-dislikes" class="control-label col-xs-12 col-sm-3">{:__('Dislikes')}:</label> | ||
140 | + <div class="col-xs-12 col-sm-8"> | ||
141 | + <div class="input-group margin-bottom-sm"> | ||
142 | + <input id="c-dislikes" data-rule="required" class="form-control" name="row[dislikes]" placeholder="{:__('Dislikes')}" type="number" value="0"> | ||
143 | + <span class="input-group-addon"><i class="fa fa-thumbs-down text-gray"></i></span> | ||
144 | + </div> | ||
145 | + </div> | ||
146 | + </div> | ||
147 | + </div> | ||
148 | + | ||
149 | + </div> | ||
150 | + </div> | ||
151 | + </div> | ||
152 | + <div class="panel panel-default panel-intro"> | ||
153 | + <div class="panel-heading"> | ||
154 | + <div class="panel-lead"><em>状态</em></div> | ||
155 | + </div> | ||
156 | + <div class="panel-body"> | ||
157 | + <div class="tab-content"> | ||
158 | + <div class="tab-pane fade active in"> | ||
159 | + <div class="form-group"> | ||
160 | + <label for="c-flag" class="control-label col-xs-12 col-sm-3">{:__('Flag')}:</label> | ||
161 | + <div class="col-xs-12 col-sm-8"> | ||
162 | + | ||
163 | + <select id="c-flag" class="form-control selectpicker" multiple="" name="row[flag][]"> | ||
164 | + {foreach name="flagList" item="vo"} | ||
165 | + <option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option> | ||
166 | + {/foreach} | ||
167 | + </select> | ||
168 | + | ||
169 | + </div> | ||
170 | + </div> | ||
171 | + <div class="form-group"> | ||
172 | + <label class="control-label col-xs-12 col-sm-3">{:__('Status')}:</label> | ||
173 | + <div class="col-xs-12 col-sm-8"> | ||
174 | + <select id="c-status" class="form-control selectpicker" name="row[status]"> | ||
175 | + {foreach name="statusList" item="vo"} | ||
176 | + <option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option> | ||
177 | + {/foreach} | ||
178 | + </select> | ||
179 | + </div> | ||
180 | + </div> | ||
181 | + <div class="form-group"> | ||
182 | + <label class="control-label col-xs-12 col-sm-3">{:__('Publish')}:</label> | ||
183 | + <div class="col-xs-12 col-sm-8"> | ||
184 | + <div class='input-group date'> | ||
185 | + <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" /> | ||
186 | + <span class="input-group-addon"> | ||
187 | + <span class="fa fa-calendar"></span> | ||
188 | + </span> | ||
189 | + </div> | ||
190 | + </div> | ||
191 | + </div> | ||
192 | + </div> | ||
193 | + </div> | ||
194 | + </div> | ||
195 | + </div> | ||
196 | + </div> | ||
197 | + </div> | ||
198 | +</form> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + | ||
3 | + <div class="panel-heading"> | ||
4 | + {:build_heading(null,FALSE)} | ||
5 | + <ul class="nav nav-tabs" data-field="main.model_id"> | ||
6 | + {foreach name="modelList" item="vo"} | ||
7 | + <li class="{:$model['id']==$vo['id']?'active':''}"><a href="cms/archives/content/model_id/{$vo.id}" data-value="{$vo.id}">{$vo.name}</a></li> | ||
8 | + {/foreach} | ||
9 | + </ul> | ||
10 | + </div> | ||
11 | + | ||
12 | + <div class="panel-body"> | ||
13 | + <div id="myTabContent" class="tab-content"> | ||
14 | + <div class="tab-pane fade active in" id="one"> | ||
15 | + <div class="widget-body no-padding"> | ||
16 | + <div id="toolbar" class="toolbar"> | ||
17 | + {:build_toolbar('refresh,edit,del')} | ||
18 | + </div> | ||
19 | + <table id="table" class="table table-striped table-bordered table-hover" | ||
20 | + data-operate-edit="{:$auth->check('cms/model/edit')}" | ||
21 | + data-operate-del="{:$auth->check('cms/model/del')}" | ||
22 | + width="100%"> | ||
23 | + </table> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + | ||
27 | + </div> | ||
28 | + </div> | ||
29 | +</div> |
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + <input type="hidden" value="{$row.id}" id="archive-id"/> | ||
3 | + <div class="row"> | ||
4 | + <div class="col-md-9 col-sm-12"> | ||
5 | + <div class="panel panel-default panel-intro"> | ||
6 | + <div class="panel-heading"> | ||
7 | + <ul class="nav nav-tabs"> | ||
8 | + <li class="active"><a href="#basic" data-toggle="tab">基础信息</a></li> | ||
9 | + </ul> | ||
10 | + </div> | ||
11 | + <div class="panel-body"> | ||
12 | + | ||
13 | + <div id="myTabContent" class="tab-content"> | ||
14 | + <div class="tab-pane fade active in" id="basic"> | ||
15 | + <div class="form-group"> | ||
16 | + <label for="c-channel_id" class="control-label col-xs-12 col-sm-2">{:__('Channel_id')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <select id="c-channel_id" data-rule="required" class="form-control selectpicker" data-live-search="true" name="row[channel_id]"> | ||
19 | + {$channelOptions} | ||
20 | + </select> | ||
21 | + </div> | ||
22 | + </div> | ||
23 | + <div class="form-group"> | ||
24 | + <label for="c-channel_id" class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label> | ||
25 | + <div class="col-xs-12 col-sm-8"> | ||
26 | + <input type="text" class="form-control selectpage" data-source="user/user/index" placeholder="发布会员,可为空" data-field="nickname" name="row[user_id]" value="{$row.user_id}"/> | ||
27 | + </div> | ||
28 | + </div> | ||
29 | + <div class="form-group"> | ||
30 | + <label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> | ||
31 | + <div class="col-xs-12 col-sm-8"> | ||
32 | + <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title}"> | ||
33 | + </div> | ||
34 | + </div> | ||
35 | + | ||
36 | + <div class="form-group"> | ||
37 | + <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> | ||
38 | + <div class="col-xs-12 col-sm-8"> | ||
39 | + <div class="input-group"> | ||
40 | + <input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="{$row.image}"> | ||
41 | + <div class="input-group-addon no-border no-padding"> | ||
42 | + <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> | ||
43 | + <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> | ||
44 | + </div> | ||
45 | + <span class="msg-box n-right" for="c-image"></span> | ||
46 | + </div> | ||
47 | + <ul class="row list-inline plupload-preview" id="p-image"></ul> | ||
48 | + </div> | ||
49 | + </div> | ||
50 | + <div class="form-group"> | ||
51 | + <label for="c-tags" class="control-label col-xs-12 col-sm-2">{:__('Tags')}:</label> | ||
52 | + <div class="col-xs-12 col-sm-8"> | ||
53 | + <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}"> | ||
54 | + </div> | ||
55 | + </div> | ||
56 | + | ||
57 | + <div class="form-group"> | ||
58 | + <label for="c-diyname" class="control-label col-xs-12 col-sm-2">{:__('Diyname')}:</label> | ||
59 | + <div class="col-xs-12 col-sm-8"> | ||
60 | + <div class="input-group"> | ||
61 | + <div class="input-group-btn"> | ||
62 | + <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">{:addon_url('cms/archives/index', [':diyname'=>''])}</button> | ||
63 | + </div> | ||
64 | + <input type="text" id="c-diyname" data-rule="diyname" name="row[diyname]" class="form-control" placeholder="请输入自定义的名称,为空将使用主键ID" value="{$row.diyname}"/> | ||
65 | + </div> | ||
66 | + </div> | ||
67 | + </div> | ||
68 | + <div class="form-group"> | ||
69 | + <label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label> | ||
70 | + <div class="col-xs-12 col-sm-8"> | ||
71 | + <textarea id="c-content" data-rule="required" class="form-control editor" name="row[content]" rows="15">{$row.content}</textarea> | ||
72 | + </div> | ||
73 | + </div> | ||
74 | + <div class="form-group"> | ||
75 | + <label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label> | ||
76 | + <div class="col-xs-12 col-sm-8"> | ||
77 | + <input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" type="text" value="{$row.keywords}"> | ||
78 | + </div> | ||
79 | + </div> | ||
80 | + <div class="form-group"> | ||
81 | + <label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label> | ||
82 | + <div class="col-xs-12 col-sm-8"> | ||
83 | + <textarea id="c-description" cols="60" rows="5" data-rule="" class="form-control" name="row[description]">{$row.description}</textarea> | ||
84 | + </div> | ||
85 | + </div> | ||
86 | + <div id="extend"></div> | ||
87 | + </div> | ||
88 | + </div> | ||
89 | + <div class="form-group layer-footer"> | ||
90 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
91 | + <div class="col-xs-12 col-sm-8"> | ||
92 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
93 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
94 | + </div> | ||
95 | + </div> | ||
96 | + </div> | ||
97 | + | ||
98 | + </div> | ||
99 | + | ||
100 | + </div> | ||
101 | + <div class="col-md-3 col-sm-12"> | ||
102 | + <div class="panel panel-default panel-intro"> | ||
103 | + <div class="panel-heading"> | ||
104 | + <div class="panel-lead"><em>相关信息</em></div> | ||
105 | + </div> | ||
106 | + <div class="panel-body"> | ||
107 | + <div class="tab-content"> | ||
108 | + <div class="tab-pane fade active in"> | ||
109 | + <div class="form-group"> | ||
110 | + <label for="c-views" class="control-label col-xs-12 col-sm-3">{:__('Views')}:</label> | ||
111 | + <div class="col-xs-12 col-sm-8"> | ||
112 | + <div class="input-group margin-bottom-sm"> | ||
113 | + | ||
114 | + <input id="c-views" data-rule="required" class="form-control" name="row[views]" placeholder="{:__('Views')}" type="number" value="{$row.views}"> | ||
115 | + <span class="input-group-addon"><i class="fa fa-eye text-success"></i></span> | ||
116 | + </div> | ||
117 | + </div> | ||
118 | + </div> | ||
119 | + <div class="form-group"> | ||
120 | + <label for="c-comments" class="control-label col-xs-12 col-sm-3">{:__('Comments')}:</label> | ||
121 | + <div class="col-xs-12 col-sm-8"> | ||
122 | + <div class="input-group margin-bottom-sm"> | ||
123 | + | ||
124 | + <input id="c-comments" data-rule="required" class="form-control" name="row[comments]" placeholder="{:__('Comments')}" type="number" value="{$row.comments}"> | ||
125 | + <span class="input-group-addon"><i class="fa fa-comment text-info"></i></span> | ||
126 | + </div> | ||
127 | + </div> | ||
128 | + </div> | ||
129 | + <div class="form-group"> | ||
130 | + <label for="c-likes" class="control-label col-xs-12 col-sm-3">{:__('Likes')}:</label> | ||
131 | + <div class="col-xs-12 col-sm-8"> | ||
132 | + <div class="input-group margin-bottom-sm"> | ||
133 | + | ||
134 | + <input id="c-likes" data-rule="required" class="form-control" name="row[likes]" placeholder="{:__('Likes')}" type="number" value="{$row.likes}"> | ||
135 | + <span class="input-group-addon"><i class="fa fa-thumbs-up text-danger"></i></span> | ||
136 | + </div> | ||
137 | + </div> | ||
138 | + </div> | ||
139 | + <div class="form-group"> | ||
140 | + <label for="c-dislikes" class="control-label col-xs-12 col-sm-3">{:__('Dislikes')}:</label> | ||
141 | + <div class="col-xs-12 col-sm-8"> | ||
142 | + <div class="input-group margin-bottom-sm"> | ||
143 | + <input id="c-dislikes" data-rule="required" class="form-control" name="row[dislikes]" placeholder="{:__('Dislikes')}" type="number" value="{$row.dislikes}"> | ||
144 | + <span class="input-group-addon"><i class="fa fa-thumbs-down text-gray"></i></span> | ||
145 | + </div> | ||
146 | + </div> | ||
147 | + </div> | ||
148 | + <div class="form-group"> | ||
149 | + <label for="c-weigh" class="control-label col-xs-12 col-sm-3">{:__('Weigh')}:</label> | ||
150 | + <div class="col-xs-12 col-sm-8"> | ||
151 | + <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" placeholder="{:__('Weigh')}" type="number" value="{$row.weigh}"> | ||
152 | + </div> | ||
153 | + </div> | ||
154 | + </div> | ||
155 | + | ||
156 | + </div> | ||
157 | + </div> | ||
158 | + </div> | ||
159 | + <div class="panel panel-default panel-intro"> | ||
160 | + <div class="panel-heading"> | ||
161 | + <div class="panel-lead"><em>状态</em></div> | ||
162 | + </div> | ||
163 | + <div class="panel-body"> | ||
164 | + <div class="tab-content"> | ||
165 | + <div class="tab-pane fade active in"> | ||
166 | + <div class="form-group"> | ||
167 | + <label for="c-flag" class="control-label col-xs-12 col-sm-3">{:__('Flag')}:</label> | ||
168 | + <div class="col-xs-12 col-sm-8"> | ||
169 | + | ||
170 | + <select id="c-flag" class="form-control selectpicker" multiple="" name="row[flag][]"> | ||
171 | + {foreach name="flagList" item="vo"} | ||
172 | + <option value="{$key}" {in name="key" value="$row.flag"}selected{/in}>{$vo}</option> | ||
173 | + {/foreach} | ||
174 | + </select> | ||
175 | + | ||
176 | + </div> | ||
177 | + </div> | ||
178 | + <div class="form-group"> | ||
179 | + <label class="control-label col-xs-12 col-sm-3">{:__('Status')}:</label> | ||
180 | + <div class="col-xs-12 col-sm-8"> | ||
181 | + <select id="c-status" class="form-control selectpicker" name="row[status]"> | ||
182 | + {foreach name="statusList" item="vo"} | ||
183 | + <option value="{$key}" {in name="key" value="$row.status"}selected{/in}>{$vo}</option> | ||
184 | + {/foreach} | ||
185 | + </select> | ||
186 | + </div> | ||
187 | + </div> | ||
188 | + <div class="form-group"> | ||
189 | + <label class="control-label col-xs-12 col-sm-3">{:__('Publish')}:</label> | ||
190 | + <div class="col-xs-12 col-sm-8"> | ||
191 | + <div class='input-group date datetimepicker'> | ||
192 | + <input type='text' name="row[publishtime]" data-date-format="YYYY-MM-DD 00:00:00" value="{$row.publishtime_text}" class="form-control datetimepicker"/> | ||
193 | + <span class="input-group-addon"> | ||
194 | + <span class="fa fa-calendar"></span> | ||
195 | + </span> | ||
196 | + </div> | ||
197 | + </div> | ||
198 | + </div> | ||
199 | + </div> | ||
200 | + </div> | ||
201 | + </div> | ||
202 | + </div> | ||
203 | + </div> | ||
204 | + </div> | ||
205 | +</form> |
1 | +<style> | ||
2 | + .radio-inline, .checkbox-inline { | ||
3 | + padding-left:0; | ||
4 | + } | ||
5 | +</style> | ||
6 | +{foreach $fields as $item} | ||
7 | + | ||
8 | +<div class="form-group"> | ||
9 | + <div class="control-label col-xs-12 col-sm-2">{$item.title}</div> | ||
10 | + <div class="col-xs-12 col-sm-8"> | ||
11 | + {switch $item.type} | ||
12 | + {case string} | ||
13 | + <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} /> | ||
14 | + {/case} | ||
15 | + {case value="text" break="0"}{/case} | ||
16 | + {case editor} | ||
17 | + <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> | ||
18 | + {/case} | ||
19 | + {case array} | ||
20 | + {php}$arrList=isset($values[$item['name']])?(array)json_decode($item['value'],true):$item['content_list'];{/php} | ||
21 | + <dl class="fieldlist" rel="{$arrList|count}" data-name="row[{$item.name}]"> | ||
22 | + <dd> | ||
23 | + <ins>{:__('Array key')}</ins> | ||
24 | + <ins>{:__('Array value')}</ins> | ||
25 | + </dd> | ||
26 | + | ||
27 | + {foreach $arrList as $key => $vo} | ||
28 | + <dd class="form-inline"> | ||
29 | + <input type="text" name="row[{$item.name}][field][{$key}]" class="form-control" value="{$key}" size="10" /> | ||
30 | + <input type="text" name="row[{$item.name}][value][{$key}]" class="form-control" value="{$vo}" size="40" /> | ||
31 | + <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> | ||
32 | + <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span> | ||
33 | + </dd> | ||
34 | + {/foreach} | ||
35 | + <dd><a href="javascript:;" class="append btn btn-sm btn-success"><i class="fa fa-plus"></i> {:__('Append')}</a></dd> | ||
36 | + </dl> | ||
37 | + {/case} | ||
38 | + {case date} | ||
39 | + <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} /> | ||
40 | + {/case} | ||
41 | + {case time} | ||
42 | + <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} /> | ||
43 | + {/case} | ||
44 | + {case datetime} | ||
45 | + <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} /> | ||
46 | + {/case} | ||
47 | + {case number} | ||
48 | + <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} /> | ||
49 | + {/case} | ||
50 | + {case checkbox} | ||
51 | + {foreach name="item.content_list" item="vo"} | ||
52 | + <div class="checkbox checkbox-inline"> | ||
53 | + <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> | ||
54 | + </div> | ||
55 | + {/foreach} | ||
56 | + {/case} | ||
57 | + {case radio} | ||
58 | + {foreach name="item.content_list" item="vo"} | ||
59 | + <div class="radio radio-inline"> | ||
60 | + <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> | ||
61 | + </div> | ||
62 | + {/foreach} | ||
63 | + {/case} | ||
64 | + {case value="select" break="0"}{/case} | ||
65 | + {case value="selects"} | ||
66 | + <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':''}> | ||
67 | + {foreach name="item.content_list" item="vo"} | ||
68 | + <option value="{$key}" {in name="key" value="$item.value"}selected{/in}>{$vo}</option> | ||
69 | + {/foreach} | ||
70 | + </select> | ||
71 | + {/case} | ||
72 | + {case value="image" break="0"}{/case} | ||
73 | + {case value="images"} | ||
74 | + <div class="input-group"> | ||
75 | + <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}"> | ||
76 | + <div class="input-group-addon no-border no-padding"> | ||
77 | + <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> | ||
78 | + <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> | ||
79 | + </div> | ||
80 | + <span class="msg-box n-right" for="c-{$item.name}"></span> | ||
81 | + </div> | ||
82 | + <ul class="row list-inline plupload-preview" id="p-{$item.name}"></ul> | ||
83 | + {/case} | ||
84 | + {case value="file" break="0"}{/case} | ||
85 | + {case value="files"} | ||
86 | + <div class="input-group"> | ||
87 | + <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}"> | ||
88 | + <div class="input-group-addon no-border no-padding"> | ||
89 | + <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> | ||
90 | + <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> | ||
91 | + </div> | ||
92 | + <span class="msg-box n-right" for="c-{$item.name}"></span> | ||
93 | + </div> | ||
94 | + {/case} | ||
95 | + {case switch} | ||
96 | + <input id="c-{$item.name}" name="row[{$item.name}]" type="hidden" value="{:$item.value?1:0}"> | ||
97 | + <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-{$item.name}" data-yes="1" data-no="0" > | ||
98 | + <i class="fa fa-toggle-on text-success {if !$item.value}fa-flip-horizontal text-gray{/if} fa-2x"></i> | ||
99 | + </a> | ||
100 | + {/case} | ||
101 | + {case bool} | ||
102 | + <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> | ||
103 | + <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> | ||
104 | + {/case} | ||
105 | + {case custom} | ||
106 | + {$item.content} | ||
107 | + {/case} | ||
108 | + {/switch} | ||
109 | + </div> | ||
110 | +</div> | ||
111 | +{/foreach} |
1 | +<style> | ||
2 | + .form-commonsearch .form-group { | ||
3 | + margin-left: 0; | ||
4 | + margin-right: 0; | ||
5 | + padding: 0; | ||
6 | + } | ||
7 | + | ||
8 | + form.form-commonsearch .control-label { | ||
9 | + padding-right: 0; | ||
10 | + } | ||
11 | + | ||
12 | + .tdtitle { | ||
13 | + margin-bottom: 5px; | ||
14 | + font-weight: 600; | ||
15 | + } | ||
16 | + | ||
17 | + #channeltree { | ||
18 | + margin-left: -6px; | ||
19 | + } | ||
20 | + | ||
21 | + #channelbar .panel-heading { | ||
22 | + height: 55px; | ||
23 | + line-height: 25px; | ||
24 | + font-size:14px; | ||
25 | + } | ||
26 | + | ||
27 | + @media (max-width: 1230px) { | ||
28 | + | ||
29 | + .fixed-table-toolbar .search .form-control { | ||
30 | + display: none; | ||
31 | + } | ||
32 | + } | ||
33 | + | ||
34 | + @media (min-width: 1200px) { | ||
35 | + | ||
36 | + #channelbar { | ||
37 | + width: 20%; | ||
38 | + } | ||
39 | + | ||
40 | + #archivespanel { | ||
41 | + width: 80%; | ||
42 | + } | ||
43 | + } | ||
44 | + | ||
45 | +</style> | ||
46 | +<div class="row"> | ||
47 | + <div class="col-md-3 hidden-xs hidden-sm" id="channelbar" style="padding-right:0;"> | ||
48 | + <div class="panel panel-default panel-intro"> | ||
49 | + <div class="panel-heading"> | ||
50 | + <div class="panel-lead"> | ||
51 | + <em>{:__('Channel list')}</em> | ||
52 | + </div> | ||
53 | + </div> | ||
54 | + <div class="panel-body"> | ||
55 | + <span class="text-muted"><input type="checkbox" name="" id="checkall"/> <label for="checkall"><small>{:__('Check all')}</small></label></span> | ||
56 | + <span class="text-muted"><input type="checkbox" name="" id="expandall" checked=""/> <label for="expandall"><small>{:__('Expand all')}</small></label></span> | ||
57 | + <div id="channeltree"> | ||
58 | + </div> | ||
59 | + </div> | ||
60 | + </div> | ||
61 | + </div> | ||
62 | + <div class="col-xs-12 col-md-9" id="archivespanel"> | ||
63 | + <div class="panel panel-default panel-intro" style="background: #f1f4f6;padding-top: 0;padding-bottom: 0;box-shadow: none;"> | ||
64 | + <div class="panel-heading"> | ||
65 | + {:build_heading(null,FALSE)} | ||
66 | + <ul class="nav nav-tabs" data-field="status"> | ||
67 | + <li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li> | ||
68 | + {foreach name="statusList" item="vo"} | ||
69 | + <li><a href="#t-{$vo}" data-value="{$key}" data-toggle="tab">{$vo}</a></li> | ||
70 | + {/foreach} | ||
71 | + </ul> | ||
72 | + </div> | ||
73 | + <div id="myTabContent" class="tab-content" style="background:#fff;padding:15px;"> | ||
74 | + <div class="tab-pane fade active in" id="one"> | ||
75 | + <div class="widget-body no-padding"> | ||
76 | + <div id="toolbar" class="toolbar"> | ||
77 | + {:build_toolbar('refresh,add,del')} | ||
78 | + <a class="btn btn-info btn-move dropdown-toggle btn-disabled disabled"><i class="fa fa-arrow-right"></i> {:__('Move')}</a> | ||
79 | + <div class="dropdown btn-group {:$auth->check('cms/archives/multi')?'':'hide'}"> | ||
80 | + <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> | ||
81 | + <ul class="dropdown-menu text-left" role="menu"> | ||
82 | + <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> | ||
83 | + <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> | ||
84 | + <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> | ||
85 | + <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> | ||
86 | + </ul> | ||
87 | + </div> | ||
88 | + <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> | ||
89 | + | ||
90 | + <div class="dropdown btn-group {:$auth->check('cms/archives/content')?'':'hide'}"> | ||
91 | + <a href="javascript:;" class="btn btn-info dropdown-toggle" title="{:__('Addon list')}" data-toggle="dropdown"><i class="fa fa-file"></i> {:__('Addon list')}</a> | ||
92 | + <ul class="dropdown-menu text-left" role="menu"> | ||
93 | + {volist name="modelList" id="item"} | ||
94 | + <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> | ||
95 | + {/volist} | ||
96 | + </ul> | ||
97 | + </div> | ||
98 | + <a href="javascript:;" class="btn btn-default btn-channel hidden-xs hidden-sm"><i class="fa fa-bars"></i></a> | ||
99 | + </div> | ||
100 | + <table id="table" class="table table-striped table-bordered table-hover" | ||
101 | + data-operate-edit="{:$auth->check('cms/archives/edit')}" | ||
102 | + data-operate-del="{:$auth->check('cms/archives/del')}" | ||
103 | + width="100%"> | ||
104 | + </table> | ||
105 | + </div> | ||
106 | + </div> | ||
107 | + | ||
108 | + </div> | ||
109 | + </div> | ||
110 | + </div> | ||
111 | +</div> | ||
112 | +<script id="channeltpl" type="text/html"> | ||
113 | + <div class="box box-solid bg-red-gradient"> | ||
114 | + <div class="box-header ui-sortable-handle" style="cursor: move;"> | ||
115 | + {:__('Warning')} | ||
116 | + </div> | ||
117 | + <!-- /.box-header --> | ||
118 | + <div class="box-body"> | ||
119 | + {:__('Move tips')} | ||
120 | + </div> | ||
121 | + <!-- /.box-body --> | ||
122 | + <div class="box-footer text-black"> | ||
123 | + <div class="row"> | ||
124 | + <div class="col-sm-12"> | ||
125 | + <select name="channel" class="form-control" id=""> | ||
126 | + <option value="0">{:__('Please select channel')}</option> | ||
127 | + {$channelOptions} | ||
128 | + </select> | ||
129 | + </div> | ||
130 | + </div> | ||
131 | + <!-- /.row --> | ||
132 | + </div> | ||
133 | + </div> | ||
134 | +</script> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + {:build_toolbar('refresh')} | ||
10 | + <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> | ||
11 | + <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> | ||
12 | + <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> | ||
13 | + <a class="btn btn-danger btn-destroyall" href="{:url('cms.archives/destroy')}" title="{:__('Destroy all')}"><i class="fa fa-times"></i> {:__('Destroy all')}</a> | ||
14 | + </div> | ||
15 | + <table id="table" class="table table-striped table-bordered table-hover" | ||
16 | + width="100%"> | ||
17 | + </table> | ||
18 | + </div> | ||
19 | + </div> | ||
20 | + | ||
21 | + </div> | ||
22 | + </div> | ||
23 | +</div> |
1 | +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <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=""> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group"> | ||
16 | + <label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text"> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <div class="form-group"> | ||
22 | + <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> | ||
23 | + <div class="col-xs-12 col-sm-8"> | ||
24 | + <div class="input-group"> | ||
25 | + <input id="c-image" data-rule="" class="form-control" size="50" name="row[image]" type="text" value=""> | ||
26 | + <div class="input-group-addon no-border no-padding"> | ||
27 | + <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> | ||
28 | + <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> | ||
29 | + </div> | ||
30 | + <span class="msg-box n-right" for="c-image"></span> | ||
31 | + </div> | ||
32 | + <ul class="row list-inline plupload-preview" id="p-image"></ul> | ||
33 | + </div> | ||
34 | + </div> | ||
35 | + <div class="form-group"> | ||
36 | + <label for="c-url" class="control-label col-xs-12 col-sm-2">{:__('Url')}:</label> | ||
37 | + <div class="col-xs-12 col-sm-8"> | ||
38 | + <input id="c-url" data-rule="" class="form-control" name="row[url]" type="text" value=""> | ||
39 | + </div> | ||
40 | + </div> | ||
41 | + <div class="form-group"> | ||
42 | + <label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label> | ||
43 | + <div class="col-xs-12 col-sm-8"> | ||
44 | + <textarea id="c-content" data-rule="" class="form-control editor" rows="15" name="row[content]" cols="50"></textarea> | ||
45 | + </div> | ||
46 | + </div> | ||
47 | + <div class="form-group"> | ||
48 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
49 | + <div class="col-xs-12 col-sm-8"> | ||
50 | + | ||
51 | + <div class="radio"> | ||
52 | + {foreach name="statusList" item="vo"} | ||
53 | + <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> | ||
54 | + {/foreach} | ||
55 | + </div> | ||
56 | + | ||
57 | + </div> | ||
58 | + </div> | ||
59 | + <div class="form-group layer-footer"> | ||
60 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
61 | + <div class="col-xs-12 col-sm-8"> | ||
62 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
63 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
64 | + </div> | ||
65 | + </div> | ||
66 | +</form> |
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <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}"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name}"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group"> | ||
16 | + <label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title}"> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <div class="form-group"> | ||
22 | + <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> | ||
23 | + <div class="col-xs-12 col-sm-8"> | ||
24 | + <div class="input-group"> | ||
25 | + <input id="c-image" data-rule="" class="form-control" size="50" name="row[image]" type="text" value="{$row.image}"> | ||
26 | + <div class="input-group-addon no-border no-padding"> | ||
27 | + <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> | ||
28 | + <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> | ||
29 | + </div> | ||
30 | + <span class="msg-box n-right" for="c-image"></span> | ||
31 | + </div> | ||
32 | + <ul class="row list-inline plupload-preview" id="p-image"></ul> | ||
33 | + </div> | ||
34 | + </div> | ||
35 | + <div class="form-group"> | ||
36 | + <label for="c-url" class="control-label col-xs-12 col-sm-2">{:__('Url')}:</label> | ||
37 | + <div class="col-xs-12 col-sm-8"> | ||
38 | + <input id="c-url" data-rule="" class="form-control" name="row[url]" type="text" value="{$row.url}"> | ||
39 | + </div> | ||
40 | + </div> | ||
41 | + <div class="form-group"> | ||
42 | + <label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label> | ||
43 | + <div class="col-xs-12 col-sm-8"> | ||
44 | + <textarea id="c-content" data-rule="" class="form-control editor" rows="15" name="row[content]" cols="50">{$row.content}</textarea> | ||
45 | + </div> | ||
46 | + </div> | ||
47 | + <div class="form-group"> | ||
48 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
49 | + <div class="col-xs-12 col-sm-8"> | ||
50 | + | ||
51 | + <div class="radio"> | ||
52 | + {foreach name="statusList" item="vo"} | ||
53 | + <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> | ||
54 | + {/foreach} | ||
55 | + </div> | ||
56 | + | ||
57 | + </div> | ||
58 | + </div> | ||
59 | + <div class="form-group layer-footer"> | ||
60 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
61 | + <div class="col-xs-12 col-sm-8"> | ||
62 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
63 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
64 | + </div> | ||
65 | + </div> | ||
66 | +</form> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + <div class="panel-heading"> | ||
3 | + {:build_heading(null,FALSE)} | ||
4 | + <ul class="nav nav-tabs" data-field="type"> | ||
5 | + <li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li> | ||
6 | + {foreach name="typeList" item="vo"} | ||
7 | + <li><a href="#t-{$vo}" data-value="{$vo}" data-toggle="tab">{$vo}</a></li> | ||
8 | + {/foreach} | ||
9 | + </ul> | ||
10 | + </div> | ||
11 | + | ||
12 | + <div class="panel-body"> | ||
13 | + <div id="myTabContent" class="tab-content"> | ||
14 | + <div class="tab-pane fade active in" id="one"> | ||
15 | + <div class="widget-body no-padding"> | ||
16 | + <div id="toolbar" class="toolbar"> | ||
17 | + {:build_toolbar('refresh,add,edit,del')} | ||
18 | + <div class="dropdown btn-group {:$auth->check('cms/block/multi')?'':'hide'}"> | ||
19 | + <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> | ||
20 | + <ul class="dropdown-menu text-left" role="menu"> | ||
21 | + <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> | ||
22 | + <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> | ||
23 | + </ul> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + <table id="table" class="table table-striped table-bordered table-hover" | ||
27 | + data-operate-edit="{:$auth->check('cms/block/edit')}" | ||
28 | + data-operate-del="{:$auth->check('cms/block/del')}" | ||
29 | + width="100%"> | ||
30 | + </table> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + | ||
34 | + </div> | ||
35 | + </div> | ||
36 | +</div> |
1 | +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + | ||
7 | + <div class="radio"> | ||
8 | + {foreach name="typeList" item="vo"} | ||
9 | + <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> | ||
10 | + {/foreach} | ||
11 | + </div> | ||
12 | + <div class="margin" style="margin-left:0;"> | ||
13 | + <div class="alert alert-dismissable bg-info"> | ||
14 | + <button type="button" class="close" data-dismiss="alert">×</button> | ||
15 | + <strong>栏目</strong>: 栏目类型下不可以发布文章,但可以添加子栏目、列表、链接<br> | ||
16 | + <strong>列表</strong>: 列表类型下可以发布文章,但不能添加子栏目<br> | ||
17 | + <strong>链接</strong>: 链接类型下不可以发布文章和子级栏目<br> | ||
18 | + </div> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | + <div class="form-group tf tf-list tf-channel"> | ||
23 | + <label for="c-model_id" class="control-label col-xs-12 col-sm-2">{:__('Model_id')}:</label> | ||
24 | + <div class="col-xs-12 col-sm-8"> | ||
25 | + <select name="row[model_id]" id="c-model_id" class="form-control"> | ||
26 | + {foreach name="modelList" item="vo"} | ||
27 | + <option value="{$vo.id}" data-channeltpl="{$vo.channeltpl}" data-listtpl="{$vo.listtpl}" data-showtpl="{$vo.showtpl}">{$vo.name}</option> | ||
28 | + {/foreach} | ||
29 | + </select> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + <div class="form-group"> | ||
33 | + <label for="parent_id" class="control-label col-xs-12 col-sm-2">{:__('上级栏目')}:</label> | ||
34 | + <div class="col-xs-12 col-sm-8"> | ||
35 | + <select name="row[parent_id]" data-rule="required" id="parent_id" class="form-control"> | ||
36 | + <option value="0">{:__('None')}</option> | ||
37 | + {foreach name="channelList" item="vo"} | ||
38 | + <option value="{$vo.id}" {if $vo.type=='link'}disabled{else /}data-model="{$vo.model_id}"{/if}>{$vo.name}</option> | ||
39 | + {/foreach} | ||
40 | + </select> | ||
41 | + </div> | ||
42 | + </div> | ||
43 | + <div class="form-group"> | ||
44 | + <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label> | ||
45 | + <div class="col-xs-12 col-sm-8"> | ||
46 | + <textarea id="c-name" data-rule="required; channelname" class="form-control" name="row[name]" data-toggle="tooltip" title="如果需要多个一次录入多个分类时请换行输入,录入多个时将忽略自定义名称,批量录入格式:分类名称|自定义名称"></textarea> | ||
47 | + </div> | ||
48 | + </div> | ||
49 | + <div class="form-group"> | ||
50 | + <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> | ||
51 | + <div class="col-xs-12 col-sm-8"> | ||
52 | + <div class="input-group"> | ||
53 | + <input id="c-image" data-rule="" class="form-control" size="50" name="row[image]" type="text"> | ||
54 | + <div class="input-group-addon no-border no-padding"> | ||
55 | + <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> | ||
56 | + <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> | ||
57 | + </div> | ||
58 | + <span class="msg-box n-right" for="c-image"></span> | ||
59 | + </div> | ||
60 | + <ul class="row list-inline plupload-preview" id="p-image"></ul> | ||
61 | + </div> | ||
62 | + </div> | ||
63 | + <div class="form-group tf tf-channel tf tf-list"> | ||
64 | + <label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label> | ||
65 | + <div class="col-xs-12 col-sm-8"> | ||
66 | + <input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" type="text"> | ||
67 | + </div> | ||
68 | + </div> | ||
69 | + <div class="form-group tf tf-channel tf tf-list"> | ||
70 | + <label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label> | ||
71 | + <div class="col-xs-12 col-sm-8"> | ||
72 | + <textarea id="c-description" data-rule="" class="form-control" name="row[description]"></textarea> | ||
73 | + </div> | ||
74 | + </div> | ||
75 | + <div class="form-group"> | ||
76 | + <label for="c-diyname" class="control-label col-xs-12 col-sm-2">{:__('Diyname')}:</label> | ||
77 | + <div class="col-xs-12 col-sm-4"> | ||
78 | + <input id="c-diyname" data-rule="required(single); diyname" class="form-control" name="row[diyname]" type="text"> | ||
79 | + </div> | ||
80 | + </div> | ||
81 | + <div class="form-group tf tf-link"> | ||
82 | + <label for="c-outlink" class="control-label col-xs-12 col-sm-2">{:__('Outlink')}:</label> | ||
83 | + <div class="col-xs-12 col-sm-8"> | ||
84 | + <input id="c-outlink" data-rule="required" class="form-control" name="row[outlink]" type="text"> | ||
85 | + </div> | ||
86 | + </div> | ||
87 | + <div class="form-group tf tf-channel"> | ||
88 | + <label for="c-channeltpl" class="control-label col-xs-12 col-sm-2">{:__('Channeltpl')}:</label> | ||
89 | + <div class="col-xs-12 col-sm-4"> | ||
90 | + <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开头"> | ||
91 | + </div> | ||
92 | + </div> | ||
93 | + <div class="form-group tf tf-list"> | ||
94 | + <label for="c-listtpl" class="control-label col-xs-12 col-sm-2">{:__('Listtpl')}:</label> | ||
95 | + <div class="col-xs-12 col-sm-4"> | ||
96 | + <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开头"> | ||
97 | + </div> | ||
98 | + </div> | ||
99 | + <div class="form-group tf tf-list"> | ||
100 | + <label for="c-showtpl" class="control-label col-xs-12 col-sm-2">{:__('Showtpl')}:</label> | ||
101 | + <div class="col-xs-12 col-sm-4"> | ||
102 | + <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开头"> | ||
103 | + </div> | ||
104 | + </div> | ||
105 | + <div class="form-group tf tf-list"> | ||
106 | + <label for="c-pagesize" class="control-label col-xs-12 col-sm-2">{:__('Pagesize')}:</label> | ||
107 | + <div class="col-xs-12 col-sm-4"> | ||
108 | + <input id="c-pagesize" data-rule="required" class="form-control" name="row[pagesize]" type="number" value="10"> | ||
109 | + </div> | ||
110 | + </div> | ||
111 | + <div class="form-group"> | ||
112 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
113 | + <div class="col-xs-12 col-sm-8"> | ||
114 | + | ||
115 | + <div class="radio"> | ||
116 | + {foreach name="statusList" item="vo"} | ||
117 | + <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> | ||
118 | + {/foreach} | ||
119 | + </div> | ||
120 | + | ||
121 | + </div> | ||
122 | + </div> | ||
123 | + <div class="form-group layer-footer"> | ||
124 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
125 | + <div class="col-xs-12 col-sm-8"> | ||
126 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
127 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
128 | + </div> | ||
129 | + </div> | ||
130 | +</form> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + | ||
3 | + {:build_heading()} | ||
4 | + | ||
5 | + <div class="panel-body"> | ||
6 | + <div id="myTabContent" class="tab-content"> | ||
7 | + <div class="tab-pane fade active in" id="one"> | ||
8 | + <div class="widget-body no-padding"> | ||
9 | + <div id="toolbar" class="toolbar"> | ||
10 | + {:build_toolbar('refresh')} | ||
11 | + </div> | ||
12 | + <table id="table" class="table table-striped table-bordered table-hover" width="100%"> | ||
13 | + </table> | ||
14 | + </div> | ||
15 | + </div> | ||
16 | + | ||
17 | + </div> | ||
18 | + </div> | ||
19 | +</div> | ||
20 | + | ||
21 | +<script id="authorizationtpl" type="text/html"> | ||
22 | + <div class="content"> | ||
23 | + <span class="text-muted"><input type="checkbox" name="" id="checkall" /> <label for="checkall"><small>{:__('Check all')}</small></label></span> | ||
24 | + <span class="text-muted"><input type="checkbox" name="" id="expandall" checked="" /> <label for="expandall"><small>{:__('Expand all')}</small></label></span> | ||
25 | + <div id="channeltree"></div> | ||
26 | + </div> | ||
27 | +</script> |
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + <input type="hidden" value="{$row.id}" id="channel-id" /> | ||
3 | + <div class="form-group"> | ||
4 | + <label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + | ||
7 | + <div class="radio"> | ||
8 | + {foreach name="typeList" item="vo"} | ||
9 | + <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> | ||
10 | + {/foreach} | ||
11 | + </div> | ||
12 | + <div class="margin" style="margin-left:0;"> | ||
13 | + <div class="alert alert-dismissable bg-info"> | ||
14 | + <button type="button" class="close" data-dismiss="alert">×</button> | ||
15 | + <strong>栏目</strong>: 栏目类型下不可以发布文章,但可以添加子栏目、列表、链接<br> | ||
16 | + <strong>列表</strong>: 列表类型下可以发布文章,但不能添加子栏目<br> | ||
17 | + <strong>链接</strong>: 链接类型下不可以发布文章和子级栏目<br> | ||
18 | + </div> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | + <div class="form-group tf tf-list tf-channel"> | ||
23 | + <label for="c-model_id" class="control-label col-xs-12 col-sm-2">{:__('Model_id')}:</label> | ||
24 | + <div class="col-xs-12 col-sm-8"> | ||
25 | + <select name="row[model_id]" id="c-model_id" class="form-control " disabled> | ||
26 | + {foreach name="modelList" item="vo"} | ||
27 | + <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> | ||
28 | + {/foreach} | ||
29 | + </select> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + <div class="form-group"> | ||
33 | + <label for="parent_id" class="control-label col-xs-12 col-sm-2">{:__('上级栏目')}:</label> | ||
34 | + <div class="col-xs-12 col-sm-8"> | ||
35 | + <select name="row[parent_id]" data-rule="required" id="parent_id" class="form-control"> | ||
36 | + <option value="0">{:__('None')}</option> | ||
37 | + {foreach name="channelList" item="vo"} | ||
38 | + <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> | ||
39 | + {/foreach} | ||
40 | + </select> | ||
41 | + </div> | ||
42 | + </div> | ||
43 | + <div class="form-group"> | ||
44 | + <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label> | ||
45 | + <div class="col-xs-12 col-sm-4"> | ||
46 | + <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name}" /> | ||
47 | + </div> | ||
48 | + </div> | ||
49 | + <div class="form-group"> | ||
50 | + <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> | ||
51 | + <div class="col-xs-12 col-sm-8"> | ||
52 | + <div class="input-group"> | ||
53 | + <input id="c-image" data-rule="" class="form-control" size="50" name="row[image]" type="text" value="{$row.image}"> | ||
54 | + <div class="input-group-addon no-border no-padding"> | ||
55 | + <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> | ||
56 | + <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> | ||
57 | + </div> | ||
58 | + <span class="msg-box n-right" for="c-image"></span> | ||
59 | + </div> | ||
60 | + <ul class="row list-inline plupload-preview" id="p-image"></ul> | ||
61 | + </div> | ||
62 | + </div> | ||
63 | + <div class="form-group tf tf-channel tf tf-list"> | ||
64 | + <label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label> | ||
65 | + <div class="col-xs-12 col-sm-8"> | ||
66 | + <input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" type="text" value="{$row.keywords}"> | ||
67 | + </div> | ||
68 | + </div> | ||
69 | + <div class="form-group tf tf-channel tf tf-list"> | ||
70 | + <label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label> | ||
71 | + <div class="col-xs-12 col-sm-8"> | ||
72 | + <textarea id="c-description" data-rule="" class="form-control" name="row[description]">{$row.description}</textarea> | ||
73 | + </div> | ||
74 | + </div> | ||
75 | + <div class="form-group"> | ||
76 | + <label for="c-diyname" class="control-label col-xs-12 col-sm-2">{:__('Diyname')}:</label> | ||
77 | + <div class="col-xs-12 col-sm-4"> | ||
78 | + <input id="c-diyname" data-rule="required; diyname" class="form-control" name="row[diyname]" type="text" value="{$row.diyname}"> | ||
79 | + </div> | ||
80 | + </div> | ||
81 | + <div class="form-group tf tf-link"> | ||
82 | + <label for="c-outlink" class="control-label col-xs-12 col-sm-2">{:__('Outlink')}:</label> | ||
83 | + <div class="col-xs-12 col-sm-8"> | ||
84 | + <input id="c-outlink" data-rule="required" class="form-control" name="row[outlink]" type="text" value="{$row.outlink}"> | ||
85 | + </div> | ||
86 | + </div> | ||
87 | + <div class="form-group tf tf-channel"> | ||
88 | + <label for="c-channeltpl" class="control-label col-xs-12 col-sm-2">{:__('Channeltpl')}:</label> | ||
89 | + <div class="col-xs-12 col-sm-4"> | ||
90 | + <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开头"> | ||
91 | + </div> | ||
92 | + </div> | ||
93 | + <div class="form-group tf tf-list"> | ||
94 | + <label for="c-listtpl" class="control-label col-xs-12 col-sm-2">{:__('Listtpl')}:</label> | ||
95 | + <div class="col-xs-12 col-sm-4"> | ||
96 | + <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开头"> | ||
97 | + </div> | ||
98 | + </div> | ||
99 | + <div class="form-group tf tf-list"> | ||
100 | + <label for="c-showtpl" class="control-label col-xs-12 col-sm-2">{:__('Showtpl')}:</label> | ||
101 | + <div class="col-xs-12 col-sm-4"> | ||
102 | + <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开头"> | ||
103 | + </div> | ||
104 | + </div> | ||
105 | + <div class="form-group tf tf-list"> | ||
106 | + <label for="c-pagesize" class="control-label col-xs-12 col-sm-2">{:__('Pagesize')}:</label> | ||
107 | + <div class="col-xs-12 col-sm-4"> | ||
108 | + <input id="c-pagesize" data-rule="required" class="form-control" name="row[pagesize]" type="number" value="{$row.pagesize}"> | ||
109 | + </div> | ||
110 | + </div> | ||
111 | + <div class="form-group"> | ||
112 | + <label for="c-weigh" class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> | ||
113 | + <div class="col-xs-12 col-sm-4"> | ||
114 | + <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh}"> | ||
115 | + </div> | ||
116 | + </div> | ||
117 | + <div class="form-group"> | ||
118 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
119 | + <div class="col-xs-12 col-sm-8"> | ||
120 | + | ||
121 | + <div class="radio"> | ||
122 | + {foreach name="statusList" item="vo"} | ||
123 | + <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> | ||
124 | + {/foreach} | ||
125 | + </div> | ||
126 | + | ||
127 | + </div> | ||
128 | + </div> | ||
129 | + <div class="form-group layer-footer"> | ||
130 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
131 | + <div class="col-xs-12 col-sm-8"> | ||
132 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
133 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
134 | + </div> | ||
135 | + </div> | ||
136 | +</form> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + | ||
3 | + <div class="panel-heading"> | ||
4 | + {:build_heading(null,FALSE)} | ||
5 | + <ul class="nav nav-tabs" data-field="model_id"> | ||
6 | + <li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li> | ||
7 | + {foreach name="modelList" item="vo"} | ||
8 | + <li><a href="#t-{$vo.id}" data-value="{$vo.id}" data-toggle="tab">{$vo.name}</a></li> | ||
9 | + {/foreach} | ||
10 | + </ul> | ||
11 | + </div> | ||
12 | + | ||
13 | + <div class="panel-body"> | ||
14 | + <div id="myTabContent" class="tab-content"> | ||
15 | + <div class="tab-pane fade active in" id="one"> | ||
16 | + <div class="widget-body no-padding"> | ||
17 | + <div id="toolbar" class="toolbar"> | ||
18 | + {:build_toolbar('refresh,add,edit,del')} | ||
19 | + <div class="dropdown btn-group {:$auth->check('cms/channel/multi')?'':'hide'}"> | ||
20 | + <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> | ||
21 | + <ul class="dropdown-menu text-left" role="menu"> | ||
22 | + <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> | ||
23 | + <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> | ||
24 | + </ul> | ||
25 | + </div> | ||
26 | + {if $auth->check('cms/channel/admin')} | ||
27 | + <a class="btn btn-warning btn-dialog" href="{:url('cms.channel/admin')}" title="{:__('栏目授权')}"><i class="fa fa-cog"></i> {:__('栏目授权')}</a> | ||
28 | + {/if} | ||
29 | + </div> | ||
30 | + <table id="table" class="table table-striped table-bordered table-hover" | ||
31 | + data-operate-edit="{:$auth->check('cms/channel/edit')}" | ||
32 | + data-operate-del="{:$auth->check('cms/channel/del')}" | ||
33 | + width="100%"> | ||
34 | + </table> | ||
35 | + </div> | ||
36 | + </div> | ||
37 | + | ||
38 | + </div> | ||
39 | + </div> | ||
40 | +</div> |
1 | +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + | ||
7 | + <select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]"> | ||
8 | + {foreach name="typeList" item="vo"} | ||
9 | + <option value="{$key}" {in name="key" value="archives"}selected{/in}>{$vo}</option> | ||
10 | + {/foreach} | ||
11 | + </select> | ||
12 | + | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group"> | ||
16 | + <label for="c-aid" class="control-label col-xs-12 col-sm-2">{:__('Aid')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <input id="c-aid" data-rule="required" class="form-control" name="row[aid]" type="number" value="0"> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <div class="form-group"> | ||
22 | + <label for="c-pid" class="control-label col-xs-12 col-sm-2">{:__('Pid')}:</label> | ||
23 | + <div class="col-xs-12 col-sm-8"> | ||
24 | + <input id="c-pid" data-rule="required" class="form-control" name="row[pid]" type="number" value="0"> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | + <div class="form-group"> | ||
28 | + <label for="c-user_id" class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label> | ||
29 | + <div class="col-xs-12 col-sm-8"> | ||
30 | + <input id="c-user_id" data-rule="required" class="form-control" name="row[user_id]" type="text" value="0"> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + <div class="form-group"> | ||
34 | + <label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label> | ||
35 | + <div class="col-xs-12 col-sm-8"> | ||
36 | + <textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea> | ||
37 | + </div> | ||
38 | + </div> | ||
39 | + <div class="form-group"> | ||
40 | + <label for="c-comments" class="control-label col-xs-12 col-sm-2">{:__('Comments')}:</label> | ||
41 | + <div class="col-xs-12 col-sm-8"> | ||
42 | + <input id="c-comments" data-rule="required" class="form-control" name="row[comments]" type="number" value="0"> | ||
43 | + </div> | ||
44 | + </div> | ||
45 | + <div class="form-group"> | ||
46 | + <label for="c-ip" class="control-label col-xs-12 col-sm-2">{:__('Ip')}:</label> | ||
47 | + <div class="col-xs-12 col-sm-8"> | ||
48 | + <input id="c-ip" data-rule="" class="form-control" name="row[ip]" type="text" value=""> | ||
49 | + </div> | ||
50 | + </div> | ||
51 | + <div class="form-group"> | ||
52 | + <label for="c-useragent" class="control-label col-xs-12 col-sm-2">{:__('Useragent')}:</label> | ||
53 | + <div class="col-xs-12 col-sm-8"> | ||
54 | + <input id="c-useragent" data-rule="" class="form-control" name="row[useragent]" type="text" value=""> | ||
55 | + </div> | ||
56 | + </div> | ||
57 | + <div class="form-group"> | ||
58 | + <label for="c-subscribe" class="control-label col-xs-12 col-sm-2">{:__('Subscribe')}:</label> | ||
59 | + <div class="col-xs-12 col-sm-8"> | ||
60 | + {:build_radios('row[subscribe]', [1=>'是', 0=>'否'])} | ||
61 | + </div> | ||
62 | + </div> | ||
63 | + <div class="form-group"> | ||
64 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
65 | + <div class="col-xs-12 col-sm-8"> | ||
66 | + | ||
67 | + <div class="radio"> | ||
68 | + {foreach name="statusList" item="vo"} | ||
69 | + <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> | ||
70 | + {/foreach} | ||
71 | + </div> | ||
72 | + | ||
73 | + </div> | ||
74 | + </div> | ||
75 | + <div class="form-group layer-footer"> | ||
76 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
77 | + <div class="col-xs-12 col-sm-8"> | ||
78 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
79 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
80 | + </div> | ||
81 | + </div> | ||
82 | +</form> |
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + | ||
7 | + <select id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]"> | ||
8 | + {foreach name="typeList" item="vo"} | ||
9 | + <option value="{$key}" {in name="key" value="$row.type"}selected{/in}>{$vo}</option> | ||
10 | + {/foreach} | ||
11 | + </select> | ||
12 | + | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group"> | ||
16 | + <label for="c-aid" class="control-label col-xs-12 col-sm-2">{:__('Aid')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <input id="c-aid" data-rule="required" class="form-control" name="row[aid]" type="number" value="{$row.aid}"> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <div class="form-group"> | ||
22 | + <label for="c-pid" class="control-label col-xs-12 col-sm-2">{:__('Pid')}:</label> | ||
23 | + <div class="col-xs-12 col-sm-8"> | ||
24 | + <input id="c-pid" data-rule="required" class="form-control" name="row[pid]" type="number" value="{$row.pid}"> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | + <div class="form-group"> | ||
28 | + <label for="c-user_id" class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label> | ||
29 | + <div class="col-xs-12 col-sm-8"> | ||
30 | + <input id="c-user_id" data-rule="required" class="form-control" name="row[user_id]" type="text" value="{$row.user_id}"> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + <div class="form-group"> | ||
34 | + <label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label> | ||
35 | + <div class="col-xs-12 col-sm-8"> | ||
36 | + <textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content}</textarea> | ||
37 | + </div> | ||
38 | + </div> | ||
39 | + <div class="form-group"> | ||
40 | + <label for="c-comments" class="control-label col-xs-12 col-sm-2">{:__('Comments')}:</label> | ||
41 | + <div class="col-xs-12 col-sm-8"> | ||
42 | + <input id="c-comments" data-rule="required" class="form-control" name="row[comments]" type="number" value="{$row.comments}"> | ||
43 | + </div> | ||
44 | + </div> | ||
45 | + <div class="form-group"> | ||
46 | + <label for="c-ip" class="control-label col-xs-12 col-sm-2">{:__('Ip')}:</label> | ||
47 | + <div class="col-xs-12 col-sm-8"> | ||
48 | + <input id="c-ip" data-rule="required" class="form-control" name="row[ip]" type="text" value="{$row.ip}"> | ||
49 | + </div> | ||
50 | + </div> | ||
51 | + <div class="form-group"> | ||
52 | + <label for="c-useragent" class="control-label col-xs-12 col-sm-2">{:__('Useragent')}:</label> | ||
53 | + <div class="col-xs-12 col-sm-8"> | ||
54 | + <input id="c-useragent" data-rule="required" class="form-control" name="row[useragent]" type="text" value="{$row.useragent}"> | ||
55 | + </div> | ||
56 | + </div> | ||
57 | + <div class="form-group"> | ||
58 | + <label for="c-subscribe" class="control-label col-xs-12 col-sm-2">{:__('Subscribe')}:</label> | ||
59 | + <div class="col-xs-12 col-sm-8"> | ||
60 | + {:build_radios('row[subscribe]', [1=>'是', 0=>'否'], $row['subscribe'])} | ||
61 | + </div> | ||
62 | + </div> | ||
63 | + <div class="form-group"> | ||
64 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
65 | + <div class="col-xs-12 col-sm-8"> | ||
66 | + | ||
67 | + <div class="radio"> | ||
68 | + {foreach name="statusList" item="vo"} | ||
69 | + <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> | ||
70 | + {/foreach} | ||
71 | + </div> | ||
72 | + | ||
73 | + </div> | ||
74 | + </div> | ||
75 | + <div class="form-group layer-footer"> | ||
76 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
77 | + <div class="col-xs-12 col-sm-8"> | ||
78 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
79 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
80 | + </div> | ||
81 | + </div> | ||
82 | +</form> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + <div class="panel-heading"> | ||
3 | + {:build_heading(null,FALSE)} | ||
4 | + <ul class="nav nav-tabs" data-field="type"> | ||
5 | + <li class="active"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li> | ||
6 | + {foreach name="typeList" item="vo"} | ||
7 | + <li><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li> | ||
8 | + {/foreach} | ||
9 | + </ul> | ||
10 | + </div> | ||
11 | + | ||
12 | + <div class="panel-body"> | ||
13 | + <div id="myTabContent" class="tab-content"> | ||
14 | + <div class="tab-pane fade active in" id="one"> | ||
15 | + <div class="widget-body no-padding"> | ||
16 | + <div id="toolbar" class="toolbar"> | ||
17 | + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | ||
18 | + <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> | ||
19 | + <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> | ||
20 | + <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> | ||
21 | + | ||
22 | + <div class="dropdown btn-group {:$auth->check('cms/comment/multi')?'':'hide'}"> | ||
23 | + <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a> | ||
24 | + <ul class="dropdown-menu text-left" role="menu"> | ||
25 | + <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> | ||
26 | + <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> | ||
27 | + </ul> | ||
28 | + </div> | ||
29 | + </div> | ||
30 | + <table id="table" class="table table-striped table-bordered table-hover" | ||
31 | + data-operate-edit="{:$auth->check('cms/comment/edit')}" | ||
32 | + data-operate-del="{:$auth->check('cms/comment/del')}" | ||
33 | + width="100%"> | ||
34 | + </table> | ||
35 | + </div> | ||
36 | + </div> | ||
37 | + | ||
38 | + </div> | ||
39 | + </div> | ||
40 | +</div> |
1 | +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-user_id" data-source="user/user/index" data-field='nickname' class="form-control selectpage" name="row[user_id]" type="text" value=""> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + {include file="cms/diydata/fields"} | ||
10 | + <div class="form-group layer-footer"> | ||
11 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
12 | + <div class="col-xs-12 col-sm-8"> | ||
13 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
14 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | +</form> |
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <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}"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + {include file="cms/diydata/fields"} | ||
10 | + <div class="form-group layer-footer"> | ||
11 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
12 | + <div class="col-xs-12 col-sm-8"> | ||
13 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
14 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | +</form> |
1 | +{foreach $fields as $item} | ||
2 | + | ||
3 | +<div class="form-group"> | ||
4 | + <div class="control-label col-xs-12 col-sm-2">{$item.title}</div> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + {switch $item.type} | ||
7 | + {case string} | ||
8 | + <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} /> | ||
9 | + {/case} | ||
10 | + {case value="text" break="0"}{/case} | ||
11 | + {case editor} | ||
12 | + <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> | ||
13 | + {/case} | ||
14 | + {case array} | ||
15 | + {php}$arrList=isset($values[$item['name']])?(array)json_decode($item['value'],true):$item['content_list'];{/php} | ||
16 | + <dl class="fieldlist" rel="{$arrList|count}" data-name="row[{$item.name}]"> | ||
17 | + <dd> | ||
18 | + <ins>{:__('Array key')}</ins> | ||
19 | + <ins>{:__('Array value')}</ins> | ||
20 | + </dd> | ||
21 | + | ||
22 | + {foreach $arrList as $key => $vo} | ||
23 | + <dd class="form-inline"> | ||
24 | + <input type="text" name="row[{$item.name}][field][{$key}]" class="form-control" value="{$key}" size="10" /> | ||
25 | + <input type="text" name="row[{$item.name}][value][{$key}]" class="form-control" value="{$vo}" size="40" /> | ||
26 | + <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> | ||
27 | + <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span> | ||
28 | + </dd> | ||
29 | + {/foreach} | ||
30 | + <dd><a href="javascript:;" class="append btn btn-sm btn-success"><i class="fa fa-plus"></i> {:__('Append')}</a></dd> | ||
31 | + </dl> | ||
32 | + {/case} | ||
33 | + {case date} | ||
34 | + <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} /> | ||
35 | + {/case} | ||
36 | + {case time} | ||
37 | + <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} /> | ||
38 | + {/case} | ||
39 | + {case datetime} | ||
40 | + <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} /> | ||
41 | + {/case} | ||
42 | + {case number} | ||
43 | + <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} /> | ||
44 | + {/case} | ||
45 | + {case checkbox} | ||
46 | + {foreach name="item.content_list" item="vo"} | ||
47 | + <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> | ||
48 | + {/foreach} | ||
49 | + {/case} | ||
50 | + {case radio} | ||
51 | + {foreach name="item.content_list" item="vo"} | ||
52 | + <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> | ||
53 | + {/foreach} | ||
54 | + {/case} | ||
55 | + {case value="select" break="0"}{/case} | ||
56 | + {case value="selects"} | ||
57 | + <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':''}> | ||
58 | + {foreach name="item.content_list" item="vo"} | ||
59 | + <option value="{$key}" {in name="key" value="$item.value"}selected{/in}>{$vo}</option> | ||
60 | + {/foreach} | ||
61 | + </select> | ||
62 | + {/case} | ||
63 | + {case value="image" break="0"}{/case} | ||
64 | + {case value="images"} | ||
65 | + <div class="input-group"> | ||
66 | + <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}"> | ||
67 | + <div class="input-group-addon no-border no-padding"> | ||
68 | + <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> | ||
69 | + <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> | ||
70 | + </div> | ||
71 | + <span class="msg-box n-right" for="c-{$item.name}"></span> | ||
72 | + </div> | ||
73 | + <ul class="row list-inline plupload-preview" id="p-{$item.name}"></ul> | ||
74 | + {/case} | ||
75 | + {case value="file" break="0"}{/case} | ||
76 | + {case value="files"} | ||
77 | + <div class="input-group"> | ||
78 | + <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}"> | ||
79 | + <div class="input-group-addon no-border no-padding"> | ||
80 | + <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> | ||
81 | + <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> | ||
82 | + </div> | ||
83 | + <span class="msg-box n-right" for="c-{$item.name}"></span> | ||
84 | + </div> | ||
85 | + {/case} | ||
86 | + {case switch} | ||
87 | + <input id="c-{$item.name}" name="row[{$item.name}]" type="hidden" value="{:$item.value?1:0}"> | ||
88 | + <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-{$item.name}" data-yes="1" data-no="0" > | ||
89 | + <i class="fa fa-toggle-on text-success {if !$item.value}fa-flip-horizontal text-gray{/if} fa-2x"></i> | ||
90 | + </a> | ||
91 | + {/case} | ||
92 | + {case bool} | ||
93 | + <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> | ||
94 | + <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> | ||
95 | + {/case} | ||
96 | + {case custom} | ||
97 | + {$item.content} | ||
98 | + {/case} | ||
99 | + {/switch} | ||
100 | + </div> | ||
101 | +</div> | ||
102 | +{/foreach} |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + | ||
3 | + <div class="panel-heading"> | ||
4 | + {:build_heading(null,FALSE)} | ||
5 | + <ul class="nav nav-tabs" data-field="diyform_id"> | ||
6 | + {foreach name="diyformList" item="vo"} | ||
7 | + <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> | ||
8 | + {/foreach} | ||
9 | + </ul> | ||
10 | + </div> | ||
11 | + | ||
12 | + <div class="panel-body"> | ||
13 | + <div id="myTabContent" class="tab-content"> | ||
14 | + <div class="tab-pane fade active in" id="one"> | ||
15 | + <div class="widget-body no-padding"> | ||
16 | + <div id="toolbar" class="toolbar"> | ||
17 | + {:build_toolbar('refresh,add,edit,del')} | ||
18 | + </div> | ||
19 | + <table id="table" class="table table-striped table-bordered table-hover" | ||
20 | + data-operate-edit="{:$auth->check('cms/block/edit')}" | ||
21 | + data-operate-del="{:$auth->check('cms/block/del')}" | ||
22 | + width="100%"> | ||
23 | + </table> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + | ||
27 | + </div> | ||
28 | + </div> | ||
29 | +</div> |
1 | +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group"> | ||
16 | + <label for="c-table" class="control-label col-xs-12 col-sm-2">{:__('Table')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <input id="c-table" data-rule="required" class="form-control" name="row[table]" type="text"> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <div class="form-group"> | ||
22 | + <label for="c-diyname" class="control-label col-xs-12 col-sm-2">{:__('Diyname')}:</label> | ||
23 | + <div class="col-xs-12 col-sm-8"> | ||
24 | + <input id="c-diyname" data-rule="" class="form-control" name="row[diyname]" type="text" value=""> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | + <div class="form-group"> | ||
28 | + <label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label> | ||
29 | + <div class="col-xs-12 col-sm-8"> | ||
30 | + <input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" type="text" value=""> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + <div class="form-group"> | ||
34 | + <label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label> | ||
35 | + <div class="col-xs-12 col-sm-8"> | ||
36 | + <textarea id="c-description" cols="60" rows="5" data-rule="" class="form-control" name="row[description]"></textarea> | ||
37 | + </div> | ||
38 | + </div> | ||
39 | + <div class="form-group"> | ||
40 | + <label for="c-successtips" class="control-label col-xs-12 col-sm-2">{:__('Successtips')}:</label> | ||
41 | + <div class="col-xs-12 col-sm-8"> | ||
42 | + <textarea id="c-successtips" cols="60" rows="5" data-rule="" class="form-control" name="row[successtips]"></textarea> | ||
43 | + </div> | ||
44 | + </div> | ||
45 | + <div class="form-group"> | ||
46 | + <label for="c-formtpl" class="control-label col-xs-12 col-sm-2">{:__('Formtpl')}:</label> | ||
47 | + <div class="col-xs-12 col-sm-8"> | ||
48 | + <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开头"> | ||
49 | + </div> | ||
50 | + </div> | ||
51 | + <div class="form-group"> | ||
52 | + <label class="control-label col-xs-12 col-sm-2">{:__('Needlogin')}:</label> | ||
53 | + <div class="col-xs-12 col-sm-8"> | ||
54 | + <input id="c-needlogin" name="row[needlogin]" type="hidden" value="0"> | ||
55 | + <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-needlogin" data-yes="1" data-no="0" > | ||
56 | + <i class="fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x"></i> | ||
57 | + </a> | ||
58 | + </div> | ||
59 | + </div> | ||
60 | + <div class="form-group"> | ||
61 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
62 | + <div class="col-xs-12 col-sm-8"> | ||
63 | + | ||
64 | + <div class="radio"> | ||
65 | + {foreach name="statusList" item="vo"} | ||
66 | + <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> | ||
67 | + {/foreach} | ||
68 | + </div> | ||
69 | + | ||
70 | + </div> | ||
71 | + </div> | ||
72 | + <div class="form-group layer-footer"> | ||
73 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
74 | + <div class="col-xs-12 col-sm-8"> | ||
75 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
76 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
77 | + </div> | ||
78 | + </div> | ||
79 | +</form> |
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name}"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title}"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group"> | ||
16 | + <label for="c-table" class="control-label col-xs-12 col-sm-2">{:__('Table')}:</label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <input id="c-table" data-rule="required" class="form-control" name="row[table]" readonly="" type="text" value="{$row.table}"> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + <div class="form-group"> | ||
22 | + <label for="c-diyname" class="control-label col-xs-12 col-sm-2">{:__('Diyname')}:</label> | ||
23 | + <div class="col-xs-12 col-sm-8"> | ||
24 | + <input id="c-diyname" data-rule="" class="form-control" name="row[diyname]" type="text" value="{$row.diyname}"> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | + <div class="form-group"> | ||
28 | + <label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}:</label> | ||
29 | + <div class="col-xs-12 col-sm-8"> | ||
30 | + <input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" type="text" value="{$row.keywords}"> | ||
31 | + </div> | ||
32 | + </div> | ||
33 | + <div class="form-group"> | ||
34 | + <label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label> | ||
35 | + <div class="col-xs-12 col-sm-8"> | ||
36 | + <textarea id="c-description" cols="60" rows="5" data-rule="" class="form-control" name="row[description]">{$row.description}</textarea> | ||
37 | + </div> | ||
38 | + </div> | ||
39 | + <div class="form-group"> | ||
40 | + <label for="c-successtips" class="control-label col-xs-12 col-sm-2">{:__('Successtips')}:</label> | ||
41 | + <div class="col-xs-12 col-sm-8"> | ||
42 | + <textarea id="c-successtips" cols="60" rows="5" data-rule="" class="form-control" name="row[successtips]">{$row.successtips}</textarea> | ||
43 | + </div> | ||
44 | + </div> | ||
45 | + <div class="form-group"> | ||
46 | + <label for="c-formtpl" class="control-label col-xs-12 col-sm-2">{:__('Formtpl')}:</label> | ||
47 | + <div class="col-xs-12 col-sm-8"> | ||
48 | + <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}"> | ||
49 | + </div> | ||
50 | + </div> | ||
51 | + <div class="form-group"> | ||
52 | + <label class="control-label col-xs-12 col-sm-2">{:__('Needlogin')}:</label> | ||
53 | + <div class="col-xs-12 col-sm-8"> | ||
54 | + <input id="c-iscontribute" name="row[needlogin]" type="hidden" value="{$row.needlogin}"> | ||
55 | + <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-needlogin" data-yes="1" data-no="0"> | ||
56 | + <i class="fa fa-toggle-on text-success {eq name=" $row.needlogin" value="0"}fa-flip-horizontal text-gray{/eq} fa-2x"></i> | ||
57 | + </a> | ||
58 | + </div> | ||
59 | + </div> | ||
60 | + <div class="form-group"> | ||
61 | + <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label> | ||
62 | + <div class="col-xs-12 col-sm-8"> | ||
63 | + | ||
64 | + <div class="radio"> | ||
65 | + {foreach name="statusList" item="vo"} | ||
66 | + <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> | ||
67 | + {/foreach} | ||
68 | + </div> | ||
69 | + | ||
70 | + </div> | ||
71 | + </div> | ||
72 | + <div class="form-group layer-footer"> | ||
73 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
74 | + <div class="col-xs-12 col-sm-8"> | ||
75 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
76 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
77 | + </div> | ||
78 | + </div> | ||
79 | +</form> |
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + {:build_toolbar('refresh,add,edit,del')} | ||
10 | + </div> | ||
11 | + <table id="table" class="table table-striped table-bordered table-hover" | ||
12 | + data-buttons-index="{:$auth->check('cms/archives/index')}" | ||
13 | + data-buttons-content="{:$auth->check('cms/archives/content')}" | ||
14 | + data-buttons-fields="{:$auth->check('cms/fields/index')}" | ||
15 | + data-operate-edit="{:$auth->check('cms/model/edit')}" | ||
16 | + data-operate-del="{:$auth->check('cms/model/del')}" | ||
17 | + width="100%"> | ||
18 | + </table> | ||
19 | + </div> | ||
20 | + </div> | ||
21 | + | ||
22 | + </div> | ||
23 | + </div> | ||
24 | +</div> |
1 | +<script> | ||
2 | + var typelist = {$typeList|json_encode}; | ||
3 | + var contentlist = {$row.content??'[]'}; | ||
4 | +</script> | ||
5 | +<style> | ||
6 | + .iteminner {margin-bottom:15px;border-bottom:1px solid #ddd;background:#fff;} | ||
7 | +</style> | ||
8 | +<script id="itemtpl" type="text/html"> | ||
9 | + <div class="col-xs-6 iteminner"> | ||
10 | + <div class="form-group"> | ||
11 | + <div class="control-label col-xs-4"><span class="text-danger">*</span> 类型</div> | ||
12 | + <div class="col-xs-8"> | ||
13 | + <select name="row[content][<%=i%>][type]" <%=readonly?'readonly':''%> class="form-control"> | ||
14 | + <%for(var m in typelist){%> | ||
15 | + <option value="<%=m%>" <%=m==type?'selected':''%>><%=typelist[m]%></option> | ||
16 | + <%}%> | ||
17 | + </select> | ||
18 | + </div> | ||
19 | + </div> | ||
20 | + <div class="form-group"> | ||
21 | + <div class="control-label col-xs-4"><span class="text-danger">*</span> 变量名</div> | ||
22 | + <div class="col-xs-8"> | ||
23 | + <input type="text" name="row[content][<%=i%>][name]" <%=readonly?'readonly':''%> class="form-control" value="<%=name%>" /> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + <div class="form-group"> | ||
27 | + <div class="control-label col-xs-4"><span class="text-danger">*</span> 标题</div> | ||
28 | + <div class="col-xs-8"> | ||
29 | + <input type="text" name="row[content][<%=i%>][title]" <%=readonly?'readonly':''%> class="form-control" value="<%=title%>" /> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + <div class="form-group"> | ||
33 | + <div class="control-label col-xs-4">默认值</div> | ||
34 | + <div class="col-xs-8"> | ||
35 | + <input type="text" name="row[content][<%=i%>][value]" class="form-control" value="<%=value%>" /> | ||
36 | + </div> | ||
37 | + </div> | ||
38 | + <div class="form-group"> | ||
39 | + <div class="control-label col-xs-4">校验规则</div> | ||
40 | + <div class="col-xs-8"> | ||
41 | + <input type="text" name="row[content][<%=i%>][rule]" <%=readonly?'readonly':''%> class="form-control" value="<%=rule%>" /> | ||
42 | + </div> | ||
43 | + </div> | ||
44 | + <div class="form-group multiple"> | ||
45 | + <div class="control-label col-xs-4">数据列表</div> | ||
46 | + <div class="col-xs-8"> | ||
47 | + <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> | ||
48 | + </div> | ||
49 | + </div> | ||
50 | + <div class="form-group"> | ||
51 | + <div class="control-label col-xs-4">扩展属性</div> | ||
52 | + <div class="col-xs-8"> | ||
53 | + <textarea name="row[content][<%=i%>][extend]" id="extend" cols="30" rows="3" class="form-control"><%=extend%></textarea> | ||
54 | + </div> | ||
55 | + </div> | ||
56 | + <div class="form-group"> | ||
57 | + <div class="control-label col-xs-4"></div> | ||
58 | + <div class="col-xs-8"> | ||
59 | + <a href="javascript:;" class="btn btn-primary btn-dragsort btn-xs"><i class="fa fa-arrows"></i></a> | ||
60 | + <%if(['mobile', 'name', 'gender', 'ethnic'].indexOf(name)==-1){%> | ||
61 | + <a href="javascript:;" class="btn btn-danger btn-delone btn-xs"><i class="fa fa-trash"></i></a> | ||
62 | + <%}%> | ||
63 | + </div> | ||
64 | + </div> | ||
65 | + </div> | ||
66 | +</script> |
-
请 注册 或 登录 后发表评论