From 8a4c86665e06b859a33db468de6c8110026b030a Mon Sep 17 00:00:00 2001 From: devil_gong Date: Wed, 8 Aug 2018 18:43:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E8=88=AA=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/Application/Admin/Conf/config.php | 16 +- .../Controller/CustomViewController.class.php | 379 ++++++++++++++++++ .../Admin/Controller/LinkController.class.php | 170 ++++++++ .../Controller/NavFooterController.class.php | 235 +++++++++++ .../Controller/NavHeaderController.class.php | 269 +++++++++++++ .../Controller/ThemeController.class.php | 256 ++++++++++++ .../Admin/Lang/zh-cn/customview.php | 21 + service/Application/Admin/Lang/zh-cn/link.php | 24 ++ .../Admin/Lang/zh-cn/navfooter.php | 37 ++ .../Admin/Lang/zh-cn/navheader.php | 46 +++ .../Application/Admin/Lang/zh-cn/theme.php | 20 + .../Admin/Model/LinkModel.class.php | 63 +++ .../Admin/Model/NavigationModel.class.php | 116 ++++++ .../Admin/View/Default/CustomView/Index.html | 151 +++++++ .../View/Default/CustomView/SaveInfo.html | 42 ++ .../Admin/View/Default/Link/Index.html | 92 +++++ .../Admin/View/Default/NavFooter/Index.html | 173 ++++++++ .../Admin/View/Default/NavHeader/Index.html | 279 +++++++++++++ .../Admin/View/Default/NavHeader/Nav.html | 8 + .../Admin/View/Default/Theme/Index.html | 47 +++ .../Admin/View/Default/Theme/Nav.html | 8 + .../Admin/View/Default/Theme/Upload.html | 30 ++ service/Application/Common/Lang/zh-cn.php | 25 ++ .../Temp/8cde93cbd070139d84f31d26f8ea8f4d.php | 2 +- .../Temp/a58f8070835be94249ea77f3601c6647.php | 2 +- .../Public/Admin/Default/Css/CustomView.css | 16 + service/Public/Admin/Default/Css/Theme.css | 7 + service/Public/Admin/Default/Js/CustomView.js | 0 service/Public/Admin/Default/Js/Link.js | 18 + service/Public/Admin/Default/Js/NavFooter.js | 26 ++ service/Public/Admin/Default/Js/NavHeader.js | 26 ++ service/Public/Admin/Default/Js/Theme.js | 49 +++ service/Public/Common/Js/Common.js | 3 +- 33 files changed, 2645 insertions(+), 11 deletions(-) create mode 100755 service/Application/Admin/Controller/CustomViewController.class.php create mode 100755 service/Application/Admin/Controller/LinkController.class.php create mode 100755 service/Application/Admin/Controller/NavFooterController.class.php create mode 100755 service/Application/Admin/Controller/NavHeaderController.class.php create mode 100755 service/Application/Admin/Controller/ThemeController.class.php create mode 100755 service/Application/Admin/Lang/zh-cn/customview.php create mode 100755 service/Application/Admin/Lang/zh-cn/link.php create mode 100755 service/Application/Admin/Lang/zh-cn/navfooter.php create mode 100755 service/Application/Admin/Lang/zh-cn/navheader.php create mode 100755 service/Application/Admin/Lang/zh-cn/theme.php create mode 100755 service/Application/Admin/Model/LinkModel.class.php create mode 100755 service/Application/Admin/Model/NavigationModel.class.php create mode 100755 service/Application/Admin/View/Default/CustomView/Index.html create mode 100755 service/Application/Admin/View/Default/CustomView/SaveInfo.html create mode 100755 service/Application/Admin/View/Default/Link/Index.html create mode 100755 service/Application/Admin/View/Default/NavFooter/Index.html create mode 100755 service/Application/Admin/View/Default/NavHeader/Index.html create mode 100755 service/Application/Admin/View/Default/NavHeader/Nav.html create mode 100755 service/Application/Admin/View/Default/Theme/Index.html create mode 100755 service/Application/Admin/View/Default/Theme/Nav.html create mode 100755 service/Application/Admin/View/Default/Theme/Upload.html create mode 100755 service/Public/Admin/Default/Css/CustomView.css create mode 100755 service/Public/Admin/Default/Css/Theme.css create mode 100755 service/Public/Admin/Default/Js/CustomView.js create mode 100755 service/Public/Admin/Default/Js/Link.js create mode 100755 service/Public/Admin/Default/Js/NavFooter.js create mode 100755 service/Public/Admin/Default/Js/NavHeader.js create mode 100755 service/Public/Admin/Default/Js/Theme.js diff --git a/service/Application/Admin/Conf/config.php b/service/Application/Admin/Conf/config.php index 5f8117015..d60fedbd5 100755 --- a/service/Application/Admin/Conf/config.php +++ b/service/Application/Admin/Conf/config.php @@ -50,7 +50,7 @@ return array( 'imageUrlPrefix' => '', // 上传保存路径,可以自定义保存路径和文件名格式 - 'imagePathFormat' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'Other').'/image/{yyyy}/{mm}/{dd}/{time}{rand:6}', + 'imagePathFormat' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'other').'/image/{yyyy}/{mm}/{dd}/{time}{rand:6}', // 涂鸦图片上传配置项 @@ -61,7 +61,7 @@ return array( 'scrawlFieldName' => 'upfile', // 上传保存路径,可以自定义保存路径和文件名格式 - 'scrawlPathFormat' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'Other').'/scrawl/{yyyy}/{mm}/{dd}/{time}{rand:6}', + 'scrawlPathFormat' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'other').'/scrawl/{yyyy}/{mm}/{dd}/{time}{rand:6}', // 上传大小限制,单位B 'scrawlMaxSize' => MyC('home_max_limit_image', 2048000, true), @@ -78,7 +78,7 @@ return array( 'snapscreenActionName' => 'uploadimage', // 上传保存路径,可以自定义保存路径和文件名格式 - 'snapscreenPathFormat' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'Other').'/screenshot/{yyyy}/{mm}/{dd}/{time}{rand:6}', + 'snapscreenPathFormat' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'other').'/screenshot/{yyyy}/{mm}/{dd}/{time}{rand:6}', // 图片访问路径前缀 'snapscreenUrlPrefix' => '', @@ -98,7 +98,7 @@ return array( 'catcherFieldName' => 'source', // 上传保存路径,可以自定义保存路径和文件名格式 - 'catcherPathFormat' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'Other').'/catchimage/{yyyy}/{mm}/{dd}/{time}{rand:6}', + 'catcherPathFormat' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'other').'/catchimage/{yyyy}/{mm}/{dd}/{time}{rand:6}', // 图片访问路径前缀 'catcherUrlPrefix' => '', @@ -118,7 +118,7 @@ return array( 'videoFieldName' => 'upfile', // 上传保存路径,可以自定义保存路径和文件名格式 - 'videoPathFormat' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'Other').'/video/{yyyy}/{mm}/{dd}/{time}{rand:6}', + 'videoPathFormat' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'other').'/video/{yyyy}/{mm}/{dd}/{time}{rand:6}', // 视频访问路径前缀 'videoUrlPrefix' => '', @@ -138,7 +138,7 @@ return array( 'fileFieldName' => 'upfile', // 上传保存路径,可以自定义保存路径和文件名格式 - 'filePathFormat' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'Other').'/file/{yyyy}/{mm}/{dd}/{time}{rand:6}', + 'filePathFormat' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'other').'/file/{yyyy}/{mm}/{dd}/{time}{rand:6}', // 文件访问路径前缀 'fileUrlPrefix' => '', @@ -155,7 +155,7 @@ return array( 'imageManagerActionName'=> 'listimage', // 指定要列出图片的目录 - 'imageManagerListPath' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'Other').'/image/', + 'imageManagerListPath' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'other').'/image/', // 每次列出文件数量 'imageManagerListSize' => 20, @@ -175,7 +175,7 @@ return array( 'fileManagerActionName' => 'listfile', // 指定要列出文件的目录 - 'fileManagerListPath' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'Other').'/file/', + 'fileManagerListPath' => __ROOT__.'/Public/Upload/'.I('get.path_type', 'other').'/file/', // 文件访问路径前缀 'fileManagerUrlPrefix' => '', diff --git a/service/Application/Admin/Controller/CustomViewController.class.php b/service/Application/Admin/Controller/CustomViewController.class.php new file mode 100755 index 000000000..3df223571 --- /dev/null +++ b/service/Application/Admin/Controller/CustomViewController.class.php @@ -0,0 +1,379 @@ +Is_Login(); + + // 权限校验 + $this->Is_Power(); + } + + /** + * [Index 文章列表] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-06T21:31:53+0800 + */ + public function Index() + { + // 参数 + $param = array_merge($_POST, $_GET); + + // 模型对象 + $m = M('CustomView'); + + // 条件 + $where = $this->GetIndexWhere(); + + // 分页 + $number = MyC('admin_page_number'); + $page_param = array( + 'number' => $number, + 'total' => $m->where($where)->count(), + 'where' => $param, + 'url' => U('Admin/CustomView/Index'), + ); + $page = new \Library\Page($page_param); + + // 获取列表 + $list = $this->SetDataHandle($m->where($where)->limit($page->GetPageStarNumber(), $number)->order('id desc')->select()); + + // 是否启用 + $this->assign('common_is_enable_list', L('common_is_enable_list')); + + // 是否包含头部 + $this->assign('common_is_header_list', L('common_is_header_list')); + + // 是否包含尾部 + $this->assign('common_is_footer_list', L('common_is_footer_list')); + + // 是否满屏 + $this->assign('common_is_full_screen_list', L('common_is_full_screen_list')); + + // 参数 + $this->assign('param', $param); + + // 分页 + $this->assign('page_html', $page->GetPageHtml()); + + // 数据列表 + $this->assign('list', $list); + + $this->display('Index'); + } + + /** + * [SetDataHandle 数据处理] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-29T21:27:15+0800 + * @param [array] $data [文章数据] + * @return [array] [处理好的数据] + */ + private function SetDataHandle($data) + { + if(!empty($data)) + { + foreach($data as $k=>$v) + { + // 时间 + $data[$k]['add_time'] = date('Y-m-d H:i:s', $v['add_time']); + $data[$k]['upd_time'] = date('Y-m-d H:i:s', $v['upd_time']); + + // 是否启用 + $data[$k]['is_enable_text'] = L('common_is_enable_list')[$v['is_enable']]['name']; + } + } + return $data; + } + + /** + * [GetIndexWhere 文章列表条件] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-10T22:16:29+0800 + */ + private function GetIndexWhere() + { + $where = array(); + + // 模糊 + if(!empty($_REQUEST['keyword'])) + { + $where[] = array( + 'title' => array('like', '%'.I('keyword').'%'), + ); + } + + // 是否更多条件 + if(I('is_more', 0) == 1) + { + // 等值 + if(I('is_enable', -1) > -1) + { + $where['is_enable'] = intval(I('is_enable', 1)); + } + if(I('is_header', -1) > -1) + { + $where['is_header'] = intval(I('is_header')); + } + if(I('is_footer', -1) > -1) + { + $where['is_footer'] = intval(I('is_footer')); + } + + // 表达式 + if(!empty($_REQUEST['time_start'])) + { + $where['add_time'][] = array('gt', strtotime(I('time_start'))); + } + if(!empty($_REQUEST['time_end'])) + { + $where['add_time'][] = array('lt', strtotime(I('time_end'))); + } + } + return $where; + } + + /** + * [SaveInfo 添加/编辑页面] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-14T21:37:02+0800 + */ + public function SaveInfo() + { + // 数据 + if(empty($_REQUEST['id'])) + { + $data = array(); + } else { + $data = M('CustomView')->find(I('id')); + if(!empty($data['content'])) + { + // 静态资源地址处理 + $data['content'] = ContentStaticReplace($data['content'], 'get'); + } + } + $this->assign('data', $data); + + // 是否启用 + $this->assign('common_is_enable_list', L('common_is_enable_list')); + + // 是否包含头部 + $this->assign('common_is_header_list', L('common_is_header_list')); + + // 是否包含尾部 + $this->assign('common_is_footer_list', L('common_is_footer_list')); + + // 是否满屏 + $this->assign('common_is_full_screen_list', L('common_is_full_screen_list')); + + $this->display('SaveInfo'); + } + + /** + * [Save 添加/编辑] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-14T21:37:02+0800 + */ + public function Save() + { + // 是否ajax请求 + if(!IS_AJAX) + { + $this->error(L('common_unauthorized_access')); + } + + // 添加 + if(empty($_POST['id'])) + { + $this->Add(); + + // 编辑 + } else { + $this->Edit(); + } + } + + /** + * [Add 添加] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-18T16:20:59+0800 + */ + private function Add() + { + // 模型 + $m = D('CustomView'); + + // 数据自动校验 + if($m->create($_POST, 1)) + { + // 额外数据处理 + $m->add_time = time(); + $m->upd_time = time(); + $m->title = I('title'); + + // 静态资源地址处理 + $m->content = ContentStaticReplace($m->content, 'add'); + + // 正则匹配文章图片 + $temp_image = $this->MatchContentImage($m->content); + $m->image = serialize($temp_image); + $m->image_count = count($temp_image); + + // 数据添加 + if($m->add()) + { + $this->ajaxReturn(L('common_operation_add_success')); + } else { + $this->ajaxReturn(L('common_operation_add_error'), -100); + } + } else { + $this->ajaxReturn($m->getError(), -1); + } + } + + /** + * [Edit 编辑] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-17T22:13:40+0800 + */ + private function Edit() + { + // 模型 + $m = D('CustomView'); + + // 数据自动校验 + if($m->create($_POST, 2)) + { + // 静态资源地址处理 + $m->content = ContentStaticReplace($m->content, 'add'); + + // 正则匹配文章图片 + $temp_image = $this->MatchContentImage($m->content); + $m->image = serialize($temp_image); + $m->image_count = count($temp_image); + $m->upd_time = time(); + $m->title = I('title'); + + // 数据更新 + if($m->where(array('id'=>I('id')))->save()) + { + $this->ajaxReturn(L('common_operation_edit_success')); + } else { + $this->ajaxReturn(L('common_operation_edit_error'), -100); + } + } else { + $this->ajaxReturn($m->getError(), -1); + } + } + + /** + * [MatchContentImage 正则匹配文章图片] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-01-22T18:06:53+0800 + * @param [string] $content [文章内容] + * @return [array] [文章图片数组(一维)] + */ + private function MatchContentImage($content) + { + if(!empty($content)) + { + $pattern = '//'; + preg_match_all($pattern, $content, $match); + return empty($match[1]) ? array() : $match[1]; + } + return array(); + } + + /** + * [Delete 删除] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-15T11:03:30+0800 + */ + public function Delete() + { + // 是否ajax请求 + if(!IS_AJAX) + { + $this->error(L('common_unauthorized_access')); + } + + // 删除数据 + if(!empty($_POST['id'])) + { + // 更新 + if(M('CustomView')->delete(I('id'))) + { + $this->ajaxReturn(L('common_operation_delete_success')); + } else { + $this->ajaxReturn(L('common_operation_delete_error'), -100); + } + } else { + $this->ajaxReturn(L('common_param_error'), -1); + } + } + + /** + * [StatusUpdate 状态更新] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-01-12T22:23:06+0800 + */ + public function StatusUpdate() + { + // 参数 + if(empty($_POST['id']) || !isset($_POST['state'])) + { + $this->ajaxReturn(L('common_param_error'), -1); + } + $field = i('field', 'is_enable'); + + // 数据更新 + if(M('CustomView')->where(['id'=>I('id')])->save([$field=>intval(I('state'))])) + { + $this->ajaxReturn(L('common_operation_edit_success')); + } else { + $this->ajaxReturn(L('common_operation_edit_error'), -100); + } + } +} +?> \ No newline at end of file diff --git a/service/Application/Admin/Controller/LinkController.class.php b/service/Application/Admin/Controller/LinkController.class.php new file mode 100755 index 000000000..6bbbc07b7 --- /dev/null +++ b/service/Application/Admin/Controller/LinkController.class.php @@ -0,0 +1,170 @@ +Is_Login(); + + // 权限校验 + $this->Is_Power(); + } + + /** + * [Index 列表] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-06T21:31:53+0800 + */ + public function Index() + { + // 获取导航列表 + $list = M('Link')->field(array('id', 'name', 'url', 'describe', 'sort', 'is_enable', 'is_new_window_open'))->order('sort')->select(); + $this->assign('list', $list); + + // 是否新窗口打开 + $this->assign('common_is_new_window_open_list', L('common_is_new_window_open_list')); + + // 是否启用 + $this->assign('common_is_enable_list', L('common_is_enable_list')); + + $this->display('Index'); + } + + /** + * [Save 数据保存] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-02-05T20:12:30+0800 + */ + public function Save() + { + // 是否ajax请求 + if(!IS_AJAX) + { + $this->error(L('common_unauthorized_access')); + } + + // id为空则表示是新增 + $m = D('Link'); + + // 公共额外数据处理 + $m->sort = intval(I('sort')); + $m->describe = I('describe'); + + // 添加 + if(empty($_POST['id'])) + { + if($m->create($_POST, 1)) + { + // 额外数据处理 + $m->add_time = time(); + $m->name = I('name'); + $m->describe = I('describe'); + + // 写入数据库 + if($m->add()) + { + $this->ajaxReturn(L('common_operation_add_success')); + } else { + $this->ajaxReturn(L('common_operation_add_error'), -100); + } + } + } else { + // 编辑 + if($m->create($_POST, 2)) + { + // 额外数据处理 + $m->name = I('name'); + $m->describe = I('describe'); + + // 移除 id + unset($m->id); + + // 更新数据库 + if($m->where(array('id'=>I('id')))->save()) + { + $this->ajaxReturn(L('common_operation_edit_success')); + } else { + $this->ajaxReturn(L('common_operation_edit_error'), -100); + } + } + } + $this->ajaxReturn($m->getError(), -1); + } + + /** + * [Delete 删除] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-09T21:13:47+0800 + */ + public function Delete() + { + if(!IS_AJAX) + { + $this->error(L('common_unauthorized_access')); + } + + $m = D('Link'); + if($m->create($_POST, 4)) + { + if($m->delete($id)) + { + $this->ajaxReturn(L('common_operation_delete_success')); + } else { + $this->ajaxReturn(L('common_operation_delete_error'), -100); + } + } else { + $this->ajaxReturn($m->getError(), -1); + } + } + + /** + * [StatusUpdate 状态更新] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-01-12T22:23:06+0800 + */ + public function StatusUpdate() + { + // 参数 + if(empty($_POST['id']) || !isset($_POST['state'])) + { + $this->ajaxReturn(L('common_param_error'), -1); + } + + // 数据更新 + if(M('Link')->where(array('id'=>I('id')))->save(array('is_enable'=>I('state')))) + { + $this->ajaxReturn(L('common_operation_edit_success')); + } else { + $this->ajaxReturn(L('common_operation_edit_error'), -100); + } + } +} +?> \ No newline at end of file diff --git a/service/Application/Admin/Controller/NavFooterController.class.php b/service/Application/Admin/Controller/NavFooterController.class.php new file mode 100755 index 000000000..9763f723d --- /dev/null +++ b/service/Application/Admin/Controller/NavFooterController.class.php @@ -0,0 +1,235 @@ +Is_Login(); + + // 权限校验 + $this->Is_Power(); + } + + /** + * [Index 导航列表] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-06T21:31:53+0800 + */ + public function Index() + { + // 获取导航列表 + $this->assign('list', $this->GetNavList()); + + // 文章分类 + $this->assign('article_category_list', M('ArticleCategory')->field(array('id', 'name'))->where(array('is_enable'=>1))->select()); + + // 自定义页面 + $this->assign('customview_list', M('CustomView')->field(array('id', 'title'))->where(array('is_enable'=>1))->select()); + + // 是否新窗口打开 + $this->assign('common_is_new_window_open_list', L('common_is_new_window_open_list')); + + // 是否显示 + $this->assign('common_is_show_list', L('common_is_show_list')); + + $this->display('Index'); + } + + /** + * [GetNavList 获取数据列表] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-10T22:16:29+0800 + */ + private function GetNavList() + { + $m = M('Navigation'); + $field = array('id', 'name', 'url', 'value', 'data_type', 'sort', 'is_show', 'is_new_window_open'); + return NavDataDealWith($m->field($field)->where(array('nav_type'=>'footer'))->order('sort')->select()); + } + + /** + * [Save 添加/编辑] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-07T21:58:19+0800 + */ + public function Save() + { + // 是否ajax请求 + if(!IS_AJAX) + { + $this->error(L('common_unauthorized_access')); + } + + // 请求类型 + switch(I('data_type')) + { + // 自定义导航 + case 'custom': + $this->DataSave(5); + break; + + // 文章分类导航 + case 'article_category': + $this->DataSave(6); + break; + + // 自定义页面导航 + case 'customview': + $this->DataSave(7); + break; + } + $this->ajaxReturn(L('common_param_error'), -1); + } + + /** + * [DataSave 导航数据保存] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-02-05T20:12:30+0800 + * @param [int] $check_type [校验类型] + */ + private function DataSave($check_type) + { + $m = D('Navigation'); + + // 数据校验 + if($m->create($_POST, $check_type)) + { + // 非自定义导航数据处理 + if(empty($_POST['name'])) + { + switch(I('data_type')) + { + // 文章分类导航 + case 'article_category': + $temp_name = M('ArticleCategory')->where(array('id'=>I('value')))->getField('name'); + break; + + // 自定义页面导航 + case 'customview': + $temp_name = M('CustomView')->where(array('id'=>I('value')))->getField('title'); + break; + } + // 只截取16个字符 + $m->name = mb_substr($temp_name, 0, 16, C('DEFAULT_CHARSET')); + } else { + $m->name = I('name'); + } + + // 清除缓存 + S(C('cache_common_home_nav_footer_key'), null); + + // id为空则表示是新增 + if(empty($_POST['id'])) + { + // 额外数据处理 + $m->add_time = time(); + $m->nav_type = 'footer'; + + // 写入数据库 + if($m->add()) + { + $this->ajaxReturn(L('common_operation_add_success')); + } else { + $this->ajaxReturn(L('common_operation_add_error'), -100); + } + } else { + // 数据编辑 + if($m->where(array('id'=>I('id')))->save()) + { + $this->ajaxReturn(L('common_operation_edit_success')); + } else { + $this->ajaxReturn(L('common_operation_edit_error'), -100); + } + } + } else { + $this->ajaxReturn($m->getError(), -1); + } + } + + /** + * [Delete 删除] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-09T21:13:47+0800 + */ + public function Delete() + { + if(!IS_AJAX) + { + $this->error(L('common_unauthorized_access')); + } + + $m = D('Navigation'); + if($m->create($_POST, 4)) + { + if($m->delete($id)) + { + // 清除缓存 + S(C('cache_common_home_nav_footer_key'), null); + + $this->ajaxReturn(L('common_operation_delete_success')); + } else { + $this->ajaxReturn(L('common_operation_delete_error'), -100); + } + } else { + $this->ajaxReturn($m->getError(), -1); + } + } + + /** + * [StatusUpdate 状态更新] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-01-12T22:23:06+0800 + */ + public function StatusUpdate() + { + // 参数 + if(empty($_POST['id']) || !isset($_POST['state'])) + { + $this->ajaxReturn(L('common_param_error'), -1); + } + + // 数据更新 + if(M('Navigation')->where(array('id'=>I('id')))->save(array('is_show'=>I('state')))) + { + // 清除缓存 + S(C('cache_common_home_nav_footer_key'), null); + + $this->ajaxReturn(L('common_operation_edit_success')); + } else { + $this->ajaxReturn(L('common_operation_edit_error'), -100); + } + } +} +?> \ No newline at end of file diff --git a/service/Application/Admin/Controller/NavHeaderController.class.php b/service/Application/Admin/Controller/NavHeaderController.class.php new file mode 100755 index 000000000..511459b02 --- /dev/null +++ b/service/Application/Admin/Controller/NavHeaderController.class.php @@ -0,0 +1,269 @@ +Is_Login(); + + // 权限校验 + $this->Is_Power(); + + // 导航类型 + $this->nav_type = I('nav_type', 'header'); + } + + /** + * [Index 导航列表] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-06T21:31:53+0800 + */ + public function Index() + { + // 获取导航列表 + $this->assign('list', $this->GetNavList()); + + // 一级分类 + $this->assign('nav_header_pid_list', M('Navigation')->field(array('id', 'name'))->where(array('is_show'=>1, 'pid'=>0, 'nav_type'=>$this->nav_type))->select()); + + // 文章分类 + $this->assign('article_category_list', M('ArticleCategory')->field(array('id', 'name'))->where(array('is_enable'=>1))->select()); + + // 商品分类 + $this->assign('goods_category_list', M('GoodsCategory')->field(array('id', 'name'))->where(array('is_enable'=>1))->select()); + + // 自定义页面 + $this->assign('customview_list', M('CustomView')->field(array('id', 'title'))->where(array('is_enable'=>1))->select()); + + // 是否新窗口打开 + $this->assign('common_is_new_window_open_list', L('common_is_new_window_open_list')); + + // 是否显示 + $this->assign('common_is_show_list', L('common_is_show_list')); + + $this->assign('nav_type', $this->nav_type); + + $this->display('Index'); + } + + /** + * [GetNavList 获取数据列表] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-10T22:16:29+0800 + */ + private function GetNavList() + { + $m = M('Navigation'); + $field = array('id', 'pid', 'name', 'url', 'value', 'data_type', 'sort', 'is_show', 'is_new_window_open'); + $data = NavDataDealWith($m->field($field)->where(array('nav_type'=>$this->nav_type, 'pid'=>0))->order('sort')->select()); + if(!empty($data)) + { + foreach($data as $k=>$v) + { + $data[$k]['item'] = NavDataDealWith($m->field($field)->where(array('nav_type'=>$this->nav_type, 'pid'=>$v['id']))->order('sort')->select()); + } + } + return $data; + } + + /** + * [Save 添加/编辑] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-07T21:58:19+0800 + */ + public function Save() + { + // 是否ajax请求 + if(!IS_AJAX) + { + $this->error(L('common_unauthorized_access')); + } + + // 请求类型 + switch(I('data_type')) + { + // 自定义导航 + case 'custom': + $this->DataSave(5); + break; + + // 文章分类导航 + case 'article_category': + $this->DataSave(6); + break; + + // 自定义页面导航 + case 'customview': + $this->DataSave(7); + break; + + // 商品分类导航 + case 'goods_category': + $this->DataSave(8); + break; + } + $this->ajaxReturn(L('common_param_error'), -1); + } + + /** + * [DataSave 导航数据保存] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-02-05T20:12:30+0800 + * @param [int] $check_type [校验类型] + */ + private function DataSave($check_type) + { + $m = D('Navigation'); + + // 数据校验 + if($m->create($_POST, $check_type)) + { + // 非自定义导航数据处理 + if(empty($_POST['name'])) + { + switch(I('data_type')) + { + // 文章分类导航 + case 'article_category': + $temp_name = M('ArticleCategory')->where(array('id'=>I('value')))->getField('name'); + break; + + // 自定义页面导航 + case 'customview': + $temp_name = M('CustomView')->where(array('id'=>I('value')))->getField('title'); + break; + + // 商品分类导航 + case 'goods_category': + $temp_name = M('GoodsCategory')->where(array('id'=>I('value')))->getField('name'); + break; + } + // 只截取16个字符 + $m->name = mb_substr($temp_name, 0, 16, C('DEFAULT_CHARSET')); + } else { + $m->name = I('name'); + } + + // 清除缓存 + S(C('cache_common_home_nav_header_key'), null); + + // id为空则表示是新增 + if(empty($_POST['id'])) + { + // 额外数据处理 + $m->add_time = time(); + $m->nav_type = $this->nav_type; + + // 写入数据库 + if($m->add()) + { + $this->ajaxReturn(L('common_operation_add_success')); + } else { + $this->ajaxReturn(L('common_operation_add_error'), -100); + } + } else { + // 额外数据处理 + $m->upd_time = time(); + + // 数据编辑 + if($m->where(array('id'=>I('id')))->save()) + { + $this->ajaxReturn(L('common_operation_edit_success')); + } else { + $this->ajaxReturn(L('common_operation_edit_error'), -100); + } + } + } else { + $this->ajaxReturn($m->getError(), -1); + } + } + + /** + * [Delete 删除] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-09T21:13:47+0800 + */ + public function Delete() + { + if(!IS_AJAX) + { + $this->error(L('common_unauthorized_access')); + } + + $m = D('Navigation'); + if($m->create($_POST, 4)) + { + if($m->delete($id)) + { + // 清除缓存 + S(C('cache_common_home_nav_header_key'), null); + + $this->ajaxReturn(L('common_operation_delete_success')); + } else { + $this->ajaxReturn(L('common_operation_delete_error'), -100); + } + } else { + $this->ajaxReturn($m->getError(), -1); + } + } + + /** + * [StatusUpdate 状态更新] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-01-12T22:23:06+0800 + */ + public function StatusUpdate() + { + // 参数 + if(empty($_POST['id']) || !isset($_POST['state'])) + { + $this->ajaxReturn(L('common_param_error'), -1); + } + + // 数据更新 + if(M('Navigation')->where(array('id'=>I('id')))->save(array('is_show'=>I('state')))) + { + // 清除缓存 + S(C('cache_common_home_nav_header_key'), null); + + $this->ajaxReturn(L('common_operation_edit_success')); + } else { + $this->ajaxReturn(L('common_operation_edit_error'), -100); + } + } +} +?> \ No newline at end of file diff --git a/service/Application/Admin/Controller/ThemeController.class.php b/service/Application/Admin/Controller/ThemeController.class.php new file mode 100755 index 000000000..6bc5a79c6 --- /dev/null +++ b/service/Application/Admin/Controller/ThemeController.class.php @@ -0,0 +1,256 @@ +Is_Login(); + + // 权限校验 + $this->Is_Power(); + + // 静态目录和html目录 + $this->html_path = 'Application'.DS.'Home'.DS.'View'.DS; + $this->static_path = 'Public'.DS.'Home'.DS; + } + + /** + * [Index 列表] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-06T21:31:53+0800 + */ + public function Index() + { + // 导航参数 + $view_type = I('view_type', 'home'); + $this->assign('view_type', $view_type); + + // 模板 + switch($view_type) + { + // 模板安装 + case 'upload': + $this->display('Upload'); + break; + + // 当前模板 + default: + // 模板列表 + $this->assign('data', $this->GetThemeList()); + + // 默认主题 + $theme = S('cache_common_default_theme_data'); + $this->assign('theme', empty($theme) ? 'Default' : $theme); + + $this->display('Index'); + } + } + + /** + * [GetThemeList 获取模板列表] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-05-10T10:24:40+0800 + * @return [array] [模板列表] + */ + private function GetThemeList() + { + $result = array(); + $dir = 'Application'.DS.'Home'.DS.'View'.DS; + if(is_dir($dir)) + { + if($dh = opendir($dir)) + { + $default_preview = 'Public'.DS.'Common'.DS.'Images'.DS.'default-preview.jpg'; + while(($temp_file = readdir($dh)) !== false) + { + $config = $dir.$temp_file.DS.'config.json'; + if(!file_exists($config)) + { + continue; + } + + // 读取配置文件 + $data = json_decode(file_get_contents($config), true); + if(!empty($data) && is_array($data)) + { + if(empty($data['name']) || empty($data['ver']) || empty($data['author'])) + { + continue; + } + $result[] = array( + 'theme' => $temp_file, + 'name' => I('data.name', '', '',$data), + 'ver' => str_replace(array(',',','), ', ', I('data.ver', '', '',$data)), + 'author' => I('data.author', '', '',$data), + 'home' => I('data.home', '', '',$data), + 'preview' => file_exists($dir.$temp_file.DS.'preview.jpg') ? $dir.$temp_file.DS.'preview.jpg' : $default_preview, + ); + } + } + closedir($dh); + } + } + return $result; + } + + /** + * [Save 数据保存] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-02-05T20:12:30+0800 + */ + public function Save() + { + // 配置更新 + $this->MyConfigSave(); + } + + /** + * [Delete 删除] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-09T21:13:47+0800 + */ + public function Delete() + { + // 是否ajax + if(!IS_AJAX) + { + $this->error(L('common_unauthorized_access')); + } + + // 主题 + $id = str_replace(array('.', '/', '\\'), '', strip_tags(I('id'))); + if(empty($id)) + { + $this->error(L('theme_empty_error')); + } + + // 默认主题 + $theme = S('cache_common_default_theme_data'); + $theme = empty($theme) ? 'Default' : $theme; + + // 不能删除正在使用的主题 + if($theme == $id) + { + $this->ajaxReturn(L('theme_delete_error'), -2); + } + + // 开始删除主题 + if(DelDirFile($this->html_path.$id, true) && DelDirFile($this->static_path.$id, true)) + { + $this->ajaxReturn(L('common_operation_delete_success')); + } else { + $this->ajaxReturn(L('common_operation_delete_error'), -100); + } + } + + /** + * [Upload 模板上传安装] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-05-10T16:27:09+0800 + */ + public function Upload() + { + // 是否ajax + if(!IS_AJAX) + { + $this->error(L('common_unauthorized_access')); + } + + // 文件上传校验 + $error = FileUploadError('theme'); + if($error !== true) + { + $this->ajaxReturn($error, -1); + } + + // 文件格式化校验 + $type = array('application/zip', 'application/octet-stream'); + if(!in_array($_FILES['theme']['type'], $type)) + { + $this->ajaxReturn(L('theme_upload_error'), -2); + } + + // 开始解压文件 + $resource = zip_open($_FILES['theme']['tmp_name']); + while(($temp_resource = zip_read($resource)) !== false) + { + if(zip_entry_open($resource, $temp_resource)) + { + // 当前压缩包中项目名称 + $file = zip_entry_name($temp_resource); + + // 排除临时文件和临时目录 + if(strpos($file, '/.') === false && strpos($file, '__') === false) + { + // 拼接路径 + if(strpos($file, '_Html') !== false) + { + $file = $this->html_path.$file; + } else if(strpos($file, '_Static') !== false) + { + $file = $this->static_path.$file; + } else { + continue; + } + $file = str_replace(array('_Static/', '_Html/'), '', $file); + + // 截取文件路径 + $file_path = substr($file, 0, strrpos($file, '/')); + + // 路径不存在则创建 + if(!is_dir($file_path)) + { + mkdir($file_path, 0777, true); + } + + // 如果不是目录则写入文件 + if(!is_dir($file)) + { + // 读取这个文件 + $file_size = zip_entry_filesize($temp_resource); + $file_content = zip_entry_read($temp_resource, $file_size); + file_put_contents($file, $file_content); + } + // 关闭目录项 + zip_entry_close($temp_resource); + } + + } + } + $this->ajaxReturn(L('common_operation_success')); + } +} +?> \ No newline at end of file diff --git a/service/Application/Admin/Lang/zh-cn/customview.php b/service/Application/Admin/Lang/zh-cn/customview.php new file mode 100755 index 000000000..98854b23b --- /dev/null +++ b/service/Application/Admin/Lang/zh-cn/customview.php @@ -0,0 +1,21 @@ + '自定义页面添加', + 'customview_edit_name' => '自定义页面编辑', + 'customview_title_text' => '标题', + 'customview_content_text' => '内容', + 'customview_title_format' => '标题长度 3~60 个字符', + 'customview_content_format' => '内容长度最少 50~105000 个字符', + 'customview_content_format_mobile' => '更多编辑功能请使用电脑访问', + 'customview_so_keyword_tips' => '标题关键字', +); +?> \ No newline at end of file diff --git a/service/Application/Admin/Lang/zh-cn/link.php b/service/Application/Admin/Lang/zh-cn/link.php new file mode 100755 index 000000000..e3df36dd2 --- /dev/null +++ b/service/Application/Admin/Lang/zh-cn/link.php @@ -0,0 +1,24 @@ + '友情链接添加', + 'link_edit_name' => '友情链接编辑', + + // 自定义导航 + 'link_name_text' => '名称', + 'link_name_format' => '名称格式 2~16 个字符', + 'link_describe_text' => '描述', + 'link_describe_format' => '描述不能大于60个字符', + 'link_url_text' => '链接地址', + 'link_url_text_tips' => '带http://', + 'link_url_format' => '链接地址格式有误', +); +?> \ No newline at end of file diff --git a/service/Application/Admin/Lang/zh-cn/navfooter.php b/service/Application/Admin/Lang/zh-cn/navfooter.php new file mode 100755 index 000000000..232e4552d --- /dev/null +++ b/service/Application/Admin/Lang/zh-cn/navfooter.php @@ -0,0 +1,37 @@ + '导航添加', + 'navheader_edit_name' => '导航编辑', + 'navheader_custom_operation_add' => '自定义', + 'navheader_article_category_operation_add' => '分类', + 'navheader_customview_operation_add' => '页面', + 'navheader_article_category_name_format' => '默认文章分类名称', + 'navheader_customview_name_format' => '默认自定义页面名称', + + // 自定义导航 + 'navheader_level_text' => '导航级别', + 'navheader_level_format' => '导航级别选择错误', + 'navheader_name_text' => '导航名称', + 'navheader_name_format' => '导航名称格式 2~16 个字符', + 'navheader_url_text' => 'url地址', + 'navheader_url_text_tips' => '带http://', + 'navheader_url_format' => 'url格式有误', + + // 文章分类导航 + 'navheader_article_category_id_text' => '文章分类', + 'navheader_article_category_id_format' => '文章分类选择有误', + + // 自定义页面导航 + 'navheader_customview_id_text' => '自定义页面', + 'navheader_customview_id_format' => '自定义页面选择有误', +); +?> \ No newline at end of file diff --git a/service/Application/Admin/Lang/zh-cn/navheader.php b/service/Application/Admin/Lang/zh-cn/navheader.php new file mode 100755 index 000000000..5d1dee54c --- /dev/null +++ b/service/Application/Admin/Lang/zh-cn/navheader.php @@ -0,0 +1,46 @@ + '导航添加', + 'navheader_edit_name' => '导航编辑', + 'navheader_custom_operation_add' => '自定义', + 'navheader_article_category_operation_add' => '文字分类', + 'navheader_customview_operation_add' => '自定义页面', + 'navheader_goods_category_operation_add' => '商品分类页面', + 'navheader_article_category_name_format' => '默认文章分类名称', + 'navheader_customview_name_format' => '默认自定义页面名称', + 'navheader_goods_category_name_format' => '默认商品分类名称', + + // 自定义导航 + 'navheader_level_text' => '导航级别', + 'navheader_level_format' => '导航级别选择错误', + 'navheader_name_text' => '导航名称', + 'navheader_name_format' => '导航名称格式 2~16 个字符', + 'navheader_url_text' => 'url地址', + 'navheader_url_text_tips' => '带http://', + 'navheader_url_format' => 'url格式有误', + + // 文章分类导航 + 'navheader_article_category_id_text' => '文章分类', + 'navheader_article_category_id_format' => '文章分类选择有误', + + // 自定义页面导航 + 'navheader_customview_id_text' => '自定义页面', + 'navheader_customview_id_format' => '自定义页面选择有误', + + // 商品分类导航 + 'navheader_goods_category_id_text' => '商品分类', + 'navheader_goods_category_id_format' => '商品分类选择有误', + + 'navheader_nav_header_name' => '中间导航', + 'navheader_nav_footer_name' => '底部导航', +); +?> \ No newline at end of file diff --git a/service/Application/Admin/Lang/zh-cn/theme.php b/service/Application/Admin/Lang/zh-cn/theme.php new file mode 100755 index 000000000..5056fa728 --- /dev/null +++ b/service/Application/Admin/Lang/zh-cn/theme.php @@ -0,0 +1,20 @@ + '当前主题', + 'theme_nav_upload' => '主题安装', + 'theme_upload_tips' => '上传一个zip压缩格式的主题安装包', + 'theme_upload_error' => '文件格式有误,请上传zip压缩包', + 'theme_delete_error' => '不能删除正在使用的主题', + 'theme_author_text' => '作者:', + 'theme_ver_text' => '适用版本:', + 'theme_empty_error' => '主题名称有误', +); +?> \ No newline at end of file diff --git a/service/Application/Admin/Model/LinkModel.class.php b/service/Application/Admin/Model/LinkModel.class.php new file mode 100755 index 000000000..f66675364 --- /dev/null +++ b/service/Application/Admin/Model/LinkModel.class.php @@ -0,0 +1,63 @@ += 2 && $len <= 16); + } + + /** + * [CheckDescribe 描述校验] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-13T19:29:30+0800 + */ + public function CheckDescribe() + { + $len = Utf8Strlen(I('describe')); + return ($len <= 60); + } + + /** + * [CheckUrl url地址校验] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-13T15:12:32+0800 + */ + public function CheckUrl() + { + return (preg_match('/'.L('common_regex_url').'/', I('url')) == 1) ? true : false; + } +} +?> \ No newline at end of file diff --git a/service/Application/Admin/Model/NavigationModel.class.php b/service/Application/Admin/Model/NavigationModel.class.php new file mode 100755 index 000000000..8bbe7dc9e --- /dev/null +++ b/service/Application/Admin/Model/NavigationModel.class.php @@ -0,0 +1,116 @@ += 2 && $len <= 16); + } + + /** + * [CheckUrl url地址校验] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-13T15:12:32+0800 + */ + public function CheckUrl() + { + return (preg_match('/'.L('common_regex_url').'/', I('url')) == 1) ? true : false; + } + + /** + * [CheckArticleCategoryValue 文章分类id校验] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-13T15:12:32+0800 + */ + public function CheckArticleCategoryValue() + { + return ($this->db(0)->table('__ARTICLE_CATEGORY__')->where(array('id'=>I('value')))->count() == 1); + } + + /** + * [CheckCustomViewValue 自定义页面id校验] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-13T15:12:32+0800 + */ + public function CheckCustomViewValue() + { + return ($this->db(0)->table('__CUSTOM_VIEW__')->where(array('id'=>I('value')))->count() == 1); + } + + /** + * [IsExistSon 校验节点下是否存在子级数据] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-10T14:09:40+0800 + */ + public function IsExistSon() + { + return ($this->db(0)->where(array('pid'=>I('id')))->count() == 0); + } + + /** + * [CheckGoodsCategoryValue 商品分类id校验] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-13T15:12:32+0800 + */ + public function CheckGoodsCategoryValue() + { + return ($this->db(0)->table('__GOODS_CATEGORY__')->where(array('id'=>I('value')))->count() == 1); + } +} +?> \ No newline at end of file diff --git a/service/Application/Admin/View/Default/CustomView/Index.html b/service/Application/Admin/View/Default/CustomView/Index.html new file mode 100755 index 000000000..2d481d5fb --- /dev/null +++ b/service/Application/Admin/View/Default/CustomView/Index.html @@ -0,0 +1,151 @@ + + + +
+
+ +
+
+ value="{{$param.keyword}}" /> + + + +
none"> + + + +
+ value="{{$param.time_start}}"/> + ~ + value="{{$param.time_end}}"/> +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + class="am-active"> + + + + + + + + + + + + + + +
{{:L('customview_title_text')}}{{:L('common_view_status_title')}}{{:L('common_view_is_header_text')}}{{:L('common_view_is_footer_text')}}{{:L('common_view_is_full_screen_text')}}{{:L('common_view_access_count_text')}}{{:L('common_more_name')}}{{:L('common_operation_name')}}
+ {{$v.title}} + + am-successam-default" data-url="{{:U('Admin/CustomView/StatusUpdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_enable']}}" data-field="is_enable" data-is-update-status="1"> + + am-successam-default" data-url="{{:U('Admin/CustomView/StatusUpdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_header']}}" data-field="is_header"> + + am-successam-default" data-url="{{:U('Admin/CustomView/StatusUpdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_footer']}}" data-field="is_footer"> + + am-successam-default" data-url="{{:U('Admin/CustomView/StatusUpdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_full_screen']}}" data-field="is_full_screen"> + {{$v.access_count}} + {{:L('common_see_more_name')}} +
+
+
+

{{:L('common_detail_content')}}

+ × +
+
+
+
{{:L('customview_title_text')}}
+
{{$v.title}}
+ +
{{:L('common_view_enable_title')}}
+
{{$v.is_enable_text}}
+ +
{{:L('common_view_is_header_text')}}
+
{{:L('common_is_header_list')[$v['is_header']]['name']}}
+ +
{{:L('common_view_is_footer_text')}}
+
{{:L('common_is_footer_list')[$v['is_footer']]['name']}}
+ +
{{:L('common_view_is_full_screen_text')}}
+
{{:L('common_is_full_screen_list')[$v['is_full_screen']]['name']}}
+ +
{{:L('common_view_access_count_text')}}
+
{{$v.access_count}}
+ +
{{:L('common_create_time_name')}}
+
{{$v.add_time}}
+ +
{{:L('common_upd_time_name')}}
+
{{$v.upd_time}}
+
+
+
+
+
+ + + + +
{{:L('common_not_data_tips')}}
+ + + + + {{$page_html}} + + +
+
+ + + + + \ No newline at end of file diff --git a/service/Application/Admin/View/Default/CustomView/SaveInfo.html b/service/Application/Admin/View/Default/CustomView/SaveInfo.html new file mode 100755 index 000000000..57a5d33e6 --- /dev/null +++ b/service/Application/Admin/View/Default/CustomView/SaveInfo.html @@ -0,0 +1,42 @@ + + + +
+
+ +
+ + + + {{:L('customview_add_name')}} + + {{:L('customview_edit_name')}} + + + {{:L('common_operation_back')}} + +
+ + value="{{$data.title}}" required /> +
+ + + + +
+ + +
+
+ value="{{$data.id}}"" /> + +
+ + +
+
+ + + + + \ No newline at end of file diff --git a/service/Application/Admin/View/Default/Link/Index.html b/service/Application/Admin/View/Default/Link/Index.html new file mode 100755 index 000000000..a748fa8f0 --- /dev/null +++ b/service/Application/Admin/View/Default/Link/Index.html @@ -0,0 +1,92 @@ + + + +
+
+ +
+ +
+ + + +
+
+
+

{{:L('link_add_name')}}

+ × +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ + +
+
+ + +
+ + +
+
+
+ + + + + + + + + + + + + + + + class="am-active"> + + + + + + + + + + +
{{:L('link_name_text')}}{{:L('link_describe_text')}}{{:L('common_view_status_title')}}{{:L('common_operation_name')}}
{{$v.name}} + + + + {{$v.describe}} + am-successam-default" data-url="{{:U('Admin/Link/StatusUpdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_enable']}}"> + + + +
{{:L('common_not_data_tips')}}
+ +
+
+ + + + + \ No newline at end of file diff --git a/service/Application/Admin/View/Default/NavFooter/Index.html b/service/Application/Admin/View/Default/NavFooter/Index.html new file mode 100755 index 000000000..5ebd86779 --- /dev/null +++ b/service/Application/Admin/View/Default/NavFooter/Index.html @@ -0,0 +1,173 @@ + + + +
+
+ +
+ + + +
+ + + + + + + +
+
+
+

{{:L('navheader_article_category_operation_add')}}{{:L('navheader_add_name')}}

+ × +
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + class="am-active"> + + + + + + + + + + +
{{:L('navheader_name_text')}}{{:L('common_nav_type_name')}}{{:L('common_view_status_title')}}{{:L('common_operation_name')}}
{{$v.name}} + + + + {{:L('common_nav_type_list')[$v['data_type']]}} + am-successam-default" data-url="{{:U('Admin/NavFooter/StatusUpdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_show']}}" data-is-update-status="1"> + + + +
{{:L('common_not_data_tips')}}
+ +
+
+ + + + + \ No newline at end of file diff --git a/service/Application/Admin/View/Default/NavHeader/Index.html b/service/Application/Admin/View/Default/NavHeader/Index.html new file mode 100755 index 000000000..df66713c5 --- /dev/null +++ b/service/Application/Admin/View/Default/NavHeader/Index.html @@ -0,0 +1,279 @@ + + + +
+
+ + + + + +
+ + + + +
+ + + + + + + +
+
+
+

{{:L('navheader_article_category_operation_add')}}{{:L('navheader_add_name')}}

+ × +
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + class="am-active"> + + + + + + + + class="am-active"> + + + + + + + + + + + + +
{{:L('navheader_name_text')}}{{:L('common_nav_type_name')}}{{:L('common_view_status_title')}}{{:L('common_operation_name')}}
{{$v.name}} + + + + {{:L('common_nav_type_list')[$v['data_type']]}} + am-successam-default" data-url="{{:U('Admin/NavHeader/StatusUpdate')}}" data-id="{{$v.id}}" data-state="{{$v['is_show']}}" data-is-update-status="1"> + + + +
{{$vs.name}} + + + + {{:L('common_nav_type_list')[$vs['data_type']]}} + am-successam-default" data-url="{{:U('Admin/NavHeader/StatusUpdate')}}" data-id="{{$vs.id}}" data-state="{{$vs['is_show']}}" data-is-update-status="1"> + + + +
{{:L('common_not_data_tips')}}
+ +
+
+ + + + + \ No newline at end of file diff --git a/service/Application/Admin/View/Default/NavHeader/Nav.html b/service/Application/Admin/View/Default/NavHeader/Nav.html new file mode 100755 index 000000000..c09f057ac --- /dev/null +++ b/service/Application/Admin/View/Default/NavHeader/Nav.html @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/service/Application/Admin/View/Default/Theme/Index.html b/service/Application/Admin/View/Default/Theme/Index.html new file mode 100755 index 000000000..b7d908280 --- /dev/null +++ b/service/Application/Admin/View/Default/Theme/Index.html @@ -0,0 +1,47 @@ + + + +
+
+ + + + + + +
+
+ + + + + \ No newline at end of file diff --git a/service/Application/Admin/View/Default/Theme/Nav.html b/service/Application/Admin/View/Default/Theme/Nav.html new file mode 100755 index 000000000..808c14b13 --- /dev/null +++ b/service/Application/Admin/View/Default/Theme/Nav.html @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/service/Application/Admin/View/Default/Theme/Upload.html b/service/Application/Admin/View/Default/Theme/Upload.html new file mode 100755 index 000000000..1104d631e --- /dev/null +++ b/service/Application/Admin/View/Default/Theme/Upload.html @@ -0,0 +1,30 @@ + + + +
+
+ + + + +
+ +
+ + + {{:L('theme_upload_tips')}} +
+
+
+ +
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/service/Application/Common/Lang/zh-cn.php b/service/Application/Common/Lang/zh-cn.php index 53612d26f..15f392963 100755 --- a/service/Application/Common/Lang/zh-cn.php +++ b/service/Application/Common/Lang/zh-cn.php @@ -433,6 +433,31 @@ return array( 1 => array('id' => 1, 'name' => '是'), ), + // 是否新窗口打开 + 'common_is_new_window_open_list' => array( + 0 => array('id' => 0, 'name' => '否', 'checked' => true), + 1 => array('id' => 1, 'name' => '是'), + ), + + // 导航数据类型 + 'common_nav_type_list' => array( + 'custom' => '自定义', + 'article_category' => '文章分类', + 'customview' => '自定义页面', + ), + + // 是否含头部 + 'common_is_header_list' => array( + 0 => array('id' => 0, 'name' => '否'), + 1 => array('id' => 1, 'name' => '是', 'checked' => true), + ), + + // 是否含尾部 + 'common_is_footer_list' => array( + 0 => array('id' => 0, 'name' => '否'), + 1 => array('id' => 1, 'name' => '是', 'checked' => true), + ), + // 色彩值 'common_color_list' => array( diff --git a/service/Application/Runtime/Temp/8cde93cbd070139d84f31d26f8ea8f4d.php b/service/Application/Runtime/Temp/8cde93cbd070139d84f31d26f8ea8f4d.php index e50ff2267..43ba89996 100644 --- a/service/Application/Runtime/Temp/8cde93cbd070139d84f31d26f8ea8f4d.php +++ b/service/Application/Runtime/Temp/8cde93cbd070139d84f31d26f8ea8f4d.php @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/service/Application/Runtime/Temp/a58f8070835be94249ea77f3601c6647.php b/service/Application/Runtime/Temp/a58f8070835be94249ea77f3601c6647.php index 625309e7e..603b0b370 100644 --- a/service/Application/Runtime/Temp/a58f8070835be94249ea77f3601c6647.php +++ b/service/Application/Runtime/Temp/a58f8070835be94249ea77f3601c6647.php @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/service/Public/Admin/Default/Css/CustomView.css b/service/Public/Admin/Default/Css/CustomView.css new file mode 100755 index 000000000..dc9f2123f --- /dev/null +++ b/service/Public/Admin/Default/Css/CustomView.css @@ -0,0 +1,16 @@ +/** + * 列表 + */ +.form-keyword { width: 55% !important; display: initial !important; } +.more-submit input { display: none; } +.param-where, .param-date input { display: initial !important; } +@media only screen and (max-width: 641px) { + .param-where { width: 100% !important; margin-left: 0px !important; } + .param-date input { width: 47% !important; } + .view-operation button { margin: 2px 0px; } +} +@media only screen and (min-width: 641px) { + .param-where { width: 22% !important; float: left; } + .param-date input { width: 43% !important; } +} +.td-title { width: 30%; } \ No newline at end of file diff --git a/service/Public/Admin/Default/Css/Theme.css b/service/Public/Admin/Default/Css/Theme.css new file mode 100755 index 000000000..df84d1ae2 --- /dev/null +++ b/service/Public/Admin/Default/Css/Theme.css @@ -0,0 +1,7 @@ +.am-gallery-item-bottom { background: #f7f7f7; padding: 0px 8px 5px 8px; } +.am-gallery-desc * { font-size: 12px; } +.am-gallery-item:hover { border: 1px solid #f60; } +.theme-active { border: 3px solid #5eb95e !important; } +#form-theme-tips { } +input[name="theme"] { width: 105px !important; height: 32px; } +.am-gallery-title .submit-delete { color:#C13932 !important; } \ No newline at end of file diff --git a/service/Public/Admin/Default/Js/CustomView.js b/service/Public/Admin/Default/Js/CustomView.js new file mode 100755 index 000000000..e69de29bb diff --git a/service/Public/Admin/Default/Js/Link.js b/service/Public/Admin/Default/Js/Link.js new file mode 100755 index 000000000..3dbb40924 --- /dev/null +++ b/service/Public/Admin/Default/Js/Link.js @@ -0,0 +1,18 @@ +/** + * 添加 + */ +$('.submit-add').on('click', function() +{ + // 更改窗口名称 + $title = $('#data-save-win').find('.am-popup-title'); + $title.text($title.data('add-title')); + + // 清空表单 + FormDataFill({"id":"", "name":"", "url":"", "describe":"", "sort":0, "is_enable":1}); + + // 校验成功状态增加失去焦点 + $('form.form-validation').find('.am-field-valid').each(function() + { + $(this).blur(); + }); +}); \ No newline at end of file diff --git a/service/Public/Admin/Default/Js/NavFooter.js b/service/Public/Admin/Default/Js/NavFooter.js new file mode 100755 index 000000000..2430f69cc --- /dev/null +++ b/service/Public/Admin/Default/Js/NavFooter.js @@ -0,0 +1,26 @@ +// 表单初始化 +FromInit('form.form-validation-article_category'); +FromInit('form.form-validation-customview'); +FromInit('form.form-validation-goods_category'); + +/** + * 添加 + */ +$('.submit-add').on('click', function() +{ + // 获取标签 + var tag = $(this).data('tag'); + + // 更改窗口名称 + $title = $('#'+tag).find('.am-popup-title'); + $title.text($title.data('add-title')); + + // 清空表单 + FormDataFill({"id":"", "name":"", "url":"", "value":"", "sort":0, "is_show":1, "is_new_window_open":0}, '#'+tag); + + // 校验成功状态增加失去焦点 + $('#'+tag).find('form').find('.am-field-valid').each(function() + { + $(this).blur(); + }); +}); \ No newline at end of file diff --git a/service/Public/Admin/Default/Js/NavHeader.js b/service/Public/Admin/Default/Js/NavHeader.js new file mode 100755 index 000000000..2a7724fd0 --- /dev/null +++ b/service/Public/Admin/Default/Js/NavHeader.js @@ -0,0 +1,26 @@ +// 表单初始化 +FromInit('form.form-validation-article_category'); +FromInit('form.form-validation-customview'); +FromInit('form.form-validation-goods_category'); + +/** + * 添加 + */ +$('.submit-add').on('click', function() +{ + // 获取标签 + var tag = $(this).data('tag'); + + // 更改窗口名称 + $title = $('#'+tag).find('.am-popup-title'); + $title.text($title.data('add-title')); + + // 清空表单 + FormDataFill({"id":"", "pid":0, "name":"", "url":"", "value":"", "sort":0, "is_show":1, "is_new_window_open":0}, '#'+tag); + + // 校验成功状态增加失去焦点 + $('#'+tag).find('form').find('.am-field-valid').each(function() + { + $(this).blur(); + }); +}); \ No newline at end of file diff --git a/service/Public/Admin/Default/Js/Theme.js b/service/Public/Admin/Default/Js/Theme.js new file mode 100755 index 000000000..b08f889f4 --- /dev/null +++ b/service/Public/Admin/Default/Js/Theme.js @@ -0,0 +1,49 @@ +$(function() +{ + // 模板切换 + $('.select-theme').on('click', function() + { + var theme = $(this).data('theme'); + if(!$(this).parent().hasClass('theme-active')) + { + var $this = $(this); + if(theme != undefined) + { + // ajax请求 + $.ajax({ + url:$('.data-list').data('select-url'), + type:'POST', + dataType:"json", + timeout:10000, + data:{"common_default_theme":theme}, + success:function(result) + { + if(result.code == 0) + { + $('.am-gallery-item').removeClass('theme-active'); + $this.parent().addClass('theme-active'); + Prompt(result.msg, 'success'); + } else { + Prompt(result.msg); + } + }, + error:function() + { + Prompt('网络异常错误'); + } + }); + } + } + }); + + // 模板上传选择名称展示 + $('input[name="theme"]').on('change', function() + { + var fileNames = ''; + $.each(this.files, function() + { + fileNames += '' + this.name + ' '; + }); + $('#form-theme-tips').html(fileNames); + }); +}); \ No newline at end of file diff --git a/service/Public/Common/Js/Common.js b/service/Public/Common/Js/Common.js index 25efadb40..9226087b6 100755 --- a/service/Public/Common/Js/Common.js +++ b/service/Public/Common/Js/Common.js @@ -646,6 +646,7 @@ $(function() var id = $tag.data('id'); var state = ($tag.data('state') == 1) ? 0 : 1; var url = $tag.data('url'); + var field = $tag.data('field') || ''; var is_update_status = $tag.data('is-update-status') || 0; if(id == undefined || url == undefined) { @@ -659,7 +660,7 @@ $(function() type:'POST', dataType:"json", timeout:10000, - data:{"id":id, "state":state}, + data:{"id":id, "state":state, "field":field}, success:function(result) { if(result.code == 0)