diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 000000000..d38e6b2a2 --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,22 @@ +on: + workflow_dispatch: + push: + branches: [ afwe ] + +name: Mirror GitHub Selected Repos to Gitee +jobs: + run: + name: Run + runs-on: ubuntu-latest + steps: + - name: Checkout source codes + uses: actions/checkout@v2 + - name: Mirror Github to Gitee with white list + uses: Yikun/hub-mirror-action@master + with: + src: github/Perinze + dst: gitee/perinze + dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} + dst_token: ${{ secrets.GITEE_TOKEN }} + static_list: 'OnlineJudge' + force_update: true diff --git a/.gitignore b/.gitignore index 90ac674ee..99734abc2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /.idea .DS_Store +node_modules diff --git a/README.md b/README.md index c130f29cd..1e956967e 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,21 @@ -# ACM@WUT MainPage & OnlineJudge业务系统 +# Online Judge Front-end +WUT OJ 前端项目 -## 技术栈 +## Usage -### 服务端 +```bash +$ npm install # 安装依赖 +$ npm run serve # 启动本地开发(无MockData) +``` -- 语言:PHP -- 框架:ThinkPHP 5.1 +## MockServer -### 前端 +在后端尚未开发完时可以使用 MockServer 来 Mock data -- 框架:Vue2 -- UI:手撸 -- 代码编辑器:CodeMirror -- 页面最小分辨率:1280*660 小于该尺寸Warning +```bash +$ npm run mock # 启动Mock服务器 +$ npm run dev # 启动Mock本地开发 +``` -## 相关项目地址 - -- [FinalRank](https://github.com/DarkKris/FinalRank) (By 王熠弘、李劲巍、周景尧、曾嘉豪、黄融 Private Repo) -- [爬虫业务](https://github.com/IengY/flaskvj) (By 冷瑜) -- [评测内核](https://github.com/hr567/Ana) (By 黄融) - -## 参与开发 - -列出了 OnlineJudge 的所有贡献者 - -包括单不限于本 repo 所包含的主页及业务系统的开发者 - -- 王熠弘(2017 级):OnlineJudge 前端页面、主页及部分评测核心的对接任务 -- 李劲巍(2017 级):后端业务逻辑、部分评测核心对接任务 -- 曾嘉豪(2017 级):项目运维及评测核心对接任务 -- 黄融(2018 级):评测核心及其对接任务 -- 郑文伟(2017 级):WUTOJ 的设计工作 -- 周景尧(2017 级):OnlineJudge 前端页面 -- 冷瑜(2016 级):Python 爬虫部分 -- 刘福鑫(2017 级):主页 - -## 版权信息 - -版权所有 Copyright © 2019 by 武汉理工大学 ACM 协会 - -All rights reserved +把数据放在`/front_end/mock_server/data/`下即可 diff --git a/front_end/assets/background/apple.png b/assets/background/apple.png similarity index 100% rename from front_end/assets/background/apple.png rename to assets/background/apple.png diff --git a/front_end/assets/background/background-main.png b/assets/background/background-main.png similarity index 100% rename from front_end/assets/background/background-main.png rename to assets/background/background-main.png diff --git a/front_end/assets/background/knowledgeTree.png b/assets/background/knowledgeTree.png similarity index 100% rename from front_end/assets/background/knowledgeTree.png rename to assets/background/knowledgeTree.png diff --git a/front_end/assets/font/DINCondensed.otf b/assets/font/DINCondensed.otf similarity index 100% rename from front_end/assets/font/DINCondensed.otf rename to assets/font/DINCondensed.otf diff --git a/front_end/assets/font/DINCondensed_min.ttf b/assets/font/DINCondensed_min.ttf similarity index 100% rename from front_end/assets/font/DINCondensed_min.ttf rename to assets/font/DINCondensed_min.ttf diff --git a/front_end/assets/font/DINNext.otf b/assets/font/DINNext.otf similarity index 100% rename from front_end/assets/font/DINNext.otf rename to assets/font/DINNext.otf diff --git a/front_end/assets/font/DINNext_min.ttf b/assets/font/DINNext_min.ttf similarity index 100% rename from front_end/assets/font/DINNext_min.ttf rename to assets/font/DINNext_min.ttf diff --git a/front_end/assets/font/Infinity.ttf b/assets/font/Infinity.ttf similarity index 100% rename from front_end/assets/font/Infinity.ttf rename to assets/font/Infinity.ttf diff --git a/front_end/assets/font/RobotoMono-Regular.ttf b/assets/font/RobotoMono-Regular.ttf similarity index 100% rename from front_end/assets/font/RobotoMono-Regular.ttf rename to assets/font/RobotoMono-Regular.ttf diff --git a/front_end/assets/font/countdown.ttf b/assets/font/countdown.ttf similarity index 100% rename from front_end/assets/font/countdown.ttf rename to assets/font/countdown.ttf diff --git a/front_end/assets/icon/404.svg b/assets/icon/404.svg similarity index 100% rename from front_end/assets/icon/404.svg rename to assets/icon/404.svg diff --git a/front_end/assets/icon/account.svg b/assets/icon/account.svg similarity index 100% rename from front_end/assets/icon/account.svg rename to assets/icon/account.svg diff --git a/front_end/assets/icon/achievement.svg b/assets/icon/achievement.svg similarity index 100% rename from front_end/assets/icon/achievement.svg rename to assets/icon/achievement.svg diff --git a/front_end/assets/icon/arrow-bottom.svg b/assets/icon/arrow-bottom.svg similarity index 100% rename from front_end/assets/icon/arrow-bottom.svg rename to assets/icon/arrow-bottom.svg diff --git a/front_end/assets/icon/arrow-down.svg b/assets/icon/arrow-down.svg similarity index 100% rename from front_end/assets/icon/arrow-down.svg rename to assets/icon/arrow-down.svg diff --git a/front_end/assets/icon/arrow-up.svg b/assets/icon/arrow-up.svg similarity index 100% rename from front_end/assets/icon/arrow-up.svg rename to assets/icon/arrow-up.svg diff --git a/front_end/assets/icon/backward.svg b/assets/icon/backward.svg similarity index 100% rename from front_end/assets/icon/backward.svg rename to assets/icon/backward.svg diff --git a/front_end/assets/icon/class.svg b/assets/icon/class.svg similarity index 100% rename from front_end/assets/icon/class.svg rename to assets/icon/class.svg diff --git a/front_end/assets/icon/contac.svg b/assets/icon/contac.svg similarity index 100% rename from front_end/assets/icon/contac.svg rename to assets/icon/contac.svg diff --git a/front_end/assets/icon/contest.svg b/assets/icon/contest.svg similarity index 100% rename from front_end/assets/icon/contest.svg rename to assets/icon/contest.svg diff --git a/front_end/assets/icon/discussion.svg b/assets/icon/discussion.svg similarity index 100% rename from front_end/assets/icon/discussion.svg rename to assets/icon/discussion.svg diff --git a/front_end/assets/icon/edit.svg b/assets/icon/edit.svg similarity index 100% rename from front_end/assets/icon/edit.svg rename to assets/icon/edit.svg diff --git a/front_end/assets/icon/eye-hide.svg b/assets/icon/eye-hide.svg similarity index 100% rename from front_end/assets/icon/eye-hide.svg rename to assets/icon/eye-hide.svg diff --git a/front_end/assets/icon/eye.svg b/assets/icon/eye.svg similarity index 100% rename from front_end/assets/icon/eye.svg rename to assets/icon/eye.svg diff --git a/front_end/assets/icon/feedback.svg b/assets/icon/feedback.svg similarity index 100% rename from front_end/assets/icon/feedback.svg rename to assets/icon/feedback.svg diff --git a/front_end/assets/icon/group.svg b/assets/icon/group.svg similarity index 100% rename from front_end/assets/icon/group.svg rename to assets/icon/group.svg diff --git a/front_end/assets/icon/home.svg b/assets/icon/home.svg similarity index 100% rename from front_end/assets/icon/home.svg rename to assets/icon/home.svg diff --git a/front_end/assets/icon/info.svg b/assets/icon/info.svg similarity index 100% rename from front_end/assets/icon/info.svg rename to assets/icon/info.svg diff --git a/front_end/assets/icon/lock.svg b/assets/icon/lock.svg similarity index 100% rename from front_end/assets/icon/lock.svg rename to assets/icon/lock.svg diff --git a/front_end/assets/icon/logout.svg b/assets/icon/logout.svg similarity index 100% rename from front_end/assets/icon/logout.svg rename to assets/icon/logout.svg diff --git a/front_end/assets/icon/mail.svg b/assets/icon/mail.svg similarity index 100% rename from front_end/assets/icon/mail.svg rename to assets/icon/mail.svg diff --git a/front_end/assets/icon/major.svg b/assets/icon/major.svg similarity index 100% rename from front_end/assets/icon/major.svg rename to assets/icon/major.svg diff --git a/front_end/assets/icon/menu.svg b/assets/icon/menu.svg similarity index 100% rename from front_end/assets/icon/menu.svg rename to assets/icon/menu.svg diff --git a/front_end/assets/icon/next.svg b/assets/icon/next.svg similarity index 100% rename from front_end/assets/icon/next.svg rename to assets/icon/next.svg diff --git a/front_end/assets/icon/no.svg b/assets/icon/no.svg similarity index 100% rename from front_end/assets/icon/no.svg rename to assets/icon/no.svg diff --git a/front_end/assets/icon/packup.svg b/assets/icon/packup.svg similarity index 100% rename from front_end/assets/icon/packup.svg rename to assets/icon/packup.svg diff --git a/front_end/assets/icon/problem.svg b/assets/icon/problem.svg similarity index 100% rename from front_end/assets/icon/problem.svg rename to assets/icon/problem.svg diff --git a/front_end/assets/icon/rank.svg b/assets/icon/rank.svg similarity index 100% rename from front_end/assets/icon/rank.svg rename to assets/icon/rank.svg diff --git a/front_end/assets/icon/school.svg b/assets/icon/school.svg similarity index 100% rename from front_end/assets/icon/school.svg rename to assets/icon/school.svg diff --git a/front_end/assets/icon/search.svg b/assets/icon/search.svg similarity index 100% rename from front_end/assets/icon/search.svg rename to assets/icon/search.svg diff --git a/front_end/assets/icon/star.svg b/assets/icon/star.svg similarity index 100% rename from front_end/assets/icon/star.svg rename to assets/icon/star.svg diff --git a/front_end/assets/icon/submission.svg b/assets/icon/submission.svg similarity index 100% rename from front_end/assets/icon/submission.svg rename to assets/icon/submission.svg diff --git a/front_end/assets/icon/unlock.svg b/assets/icon/unlock.svg similarity index 100% rename from front_end/assets/icon/unlock.svg rename to assets/icon/unlock.svg diff --git a/front_end/assets/icon/yes.svg b/assets/icon/yes.svg similarity index 100% rename from front_end/assets/icon/yes.svg rename to assets/icon/yes.svg diff --git a/front_end/assets/json/static.json b/assets/json/static.json similarity index 100% rename from front_end/assets/json/static.json rename to assets/json/static.json diff --git a/front_end/assets/media/arrow-end.png b/assets/media/arrow-end.png similarity index 100% rename from front_end/assets/media/arrow-end.png rename to assets/media/arrow-end.png diff --git a/front_end/assets/media/arrow-next.png b/assets/media/arrow-next.png similarity index 100% rename from front_end/assets/media/arrow-next.png rename to assets/media/arrow-next.png diff --git a/front_end/assets/media/arrow-prev.png b/assets/media/arrow-prev.png similarity index 100% rename from front_end/assets/media/arrow-prev.png rename to assets/media/arrow-prev.png diff --git a/front_end/assets/media/arrow-start.png b/assets/media/arrow-start.png similarity index 100% rename from front_end/assets/media/arrow-start.png rename to assets/media/arrow-start.png diff --git a/front_end/assets/media/avator.png b/assets/media/avator.png similarity index 100% rename from front_end/assets/media/avator.png rename to assets/media/avator.png diff --git a/front_end/assets/media/choose.png b/assets/media/choose.png similarity index 100% rename from front_end/assets/media/choose.png rename to assets/media/choose.png diff --git a/front_end/assets/media/contest-mini.jpeg b/assets/media/contest-mini.jpeg similarity index 100% rename from front_end/assets/media/contest-mini.jpeg rename to assets/media/contest-mini.jpeg diff --git a/front_end/assets/media/contest.jpeg b/assets/media/contest.jpeg similarity index 100% rename from front_end/assets/media/contest.jpeg rename to assets/media/contest.jpeg diff --git a/front_end/assets/media/defualt-avator.png b/assets/media/defualt-avator.png similarity index 100% rename from front_end/assets/media/defualt-avator.png rename to assets/media/defualt-avator.png diff --git a/front_end/assets/media/delete.png b/assets/media/delete.png similarity index 100% rename from front_end/assets/media/delete.png rename to assets/media/delete.png diff --git a/assets/media/knowledge.png b/assets/media/knowledge.png new file mode 100644 index 000000000..38e2d9c43 Binary files /dev/null and b/assets/media/knowledge.png differ diff --git a/front_end/assets/media/login_bg.png b/assets/media/login_bg.png similarity index 100% rename from front_end/assets/media/login_bg.png rename to assets/media/login_bg.png diff --git a/front_end/assets/media/logo.png b/assets/media/logo.png similarity index 100% rename from front_end/assets/media/logo.png rename to assets/media/logo.png diff --git a/front_end/assets/media/notice1.png b/assets/media/notice1.png similarity index 100% rename from front_end/assets/media/notice1.png rename to assets/media/notice1.png diff --git a/front_end/assets/media/notice2.png b/assets/media/notice2.png similarity index 100% rename from front_end/assets/media/notice2.png rename to assets/media/notice2.png diff --git a/front_end/assets/media/notice3.png b/assets/media/notice3.png similarity index 100% rename from front_end/assets/media/notice3.png rename to assets/media/notice3.png diff --git a/front_end/assets/media/selected.png b/assets/media/selected.png similarity index 100% rename from front_end/assets/media/selected.png rename to assets/media/selected.png diff --git a/front_end/assets/media/submenu-pots.png b/assets/media/submenu-pots.png similarity index 100% rename from front_end/assets/media/submenu-pots.png rename to assets/media/submenu-pots.png diff --git a/front_end/assets/media/unselected.png b/assets/media/unselected.png similarity index 100% rename from front_end/assets/media/unselected.png rename to assets/media/unselected.png diff --git a/front_end/assets/media/vue-logo.png b/assets/media/vue-logo.png similarity index 100% rename from front_end/assets/media/vue-logo.png rename to assets/media/vue-logo.png diff --git a/front_end/assets/media/welcome-bezier-1.svg b/assets/media/welcome-bezier-1.svg similarity index 100% rename from front_end/assets/media/welcome-bezier-1.svg rename to assets/media/welcome-bezier-1.svg diff --git a/front_end/babel.config.js b/babel.config.js similarity index 100% rename from front_end/babel.config.js rename to babel.config.js diff --git a/back_end/.gitignore b/back_end/.gitignore deleted file mode 100644 index 8e098ede6..000000000 --- a/back_end/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/.idea -/.vscode -*.log -.env \ No newline at end of file diff --git a/back_end/.travis.yml b/back_end/.travis.yml deleted file mode 100644 index 36f7b6f90..000000000 --- a/back_end/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -sudo: false - -language: php - -branches: - only: - - stable - -cache: - directories: - - $HOME/.composer/cache - -before_install: - - composer self-update - -install: - - composer install --no-dev --no-interaction --ignore-platform-reqs - - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip . - - composer require --update-no-dev --no-interaction "topthink/think-image:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0" - - composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0" - - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip . - -script: - - php think unit - -deploy: - provider: releases - api_key: - secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw= - file: - - ThinkPHP_Core.zip - - ThinkPHP_Full.zip - skip_cleanup: true - on: - tags: true diff --git a/back_end/LICENSE.txt b/back_end/LICENSE.txt deleted file mode 100644 index 574a39c40..000000000 --- a/back_end/LICENSE.txt +++ /dev/null @@ -1,32 +0,0 @@ - -ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 -版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn) -All rights reserved。 -ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 - -Apache Licence是著名的非盈利开源组织Apache采用的协议。 -该协议和BSD类似,鼓励代码共享和尊重原作者的著作权, -允许代码修改,再作为开源或商业软件发布。需要满足 -的条件: -1. 需要给代码的用户一份Apache Licence ; -2. 如果你修改了代码,需要在被修改的文件中说明; -3. 在延伸的代码中(修改和有源代码衍生的代码中)需要 -带有原来代码中的协议,商标,专利声明和其他原来作者规 -定需要包含的说明; -4. 如果再发布的产品中包含一个Notice文件,则在Notice文 -件中需要带有本协议内容。你可以在Notice中增加自己的 -许可,但不可以表现为对Apache Licence构成更改。 -具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/back_end/application/.htaccess b/back_end/application/.htaccess deleted file mode 100644 index 3418e55a6..000000000 --- a/back_end/application/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/back_end/application/admin/controller/Feedback.php b/back_end/application/admin/controller/Feedback.php deleted file mode 100644 index 3977fad86..000000000 --- a/back_end/application/admin/controller/Feedback.php +++ /dev/null @@ -1,373 +0,0 @@ -fetch(); - } - /** - * @return \think\response\Json - * 获取反馈信息列表 - */ - public function get_list() - { - $feedback = new FeedbackModel(); - $resp = $feedback->get_all_list(); - $data['data'] = empty($resp['data']) ? array() : $resp['data']; - $data['recordsTotal'] = count($data['data']); - $data['recordsFiltered'] = count($data['data']); - echo json_encode($data); - } - - /** - * - * 获取删除的反馈列表 - */ - public function get_delete_list() - { - $feedback = new FeedbackModel(); - $where['del'] = 1; - $resp = $feedback->get_the_list($where); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @return \think\response\Json - * 获取反馈类型列表 - */ - public function get_all_type() - { - $feedback_type = new FeedbackTypeModel(); - $resp = $feedback_type->get_all_type(); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function get_the_type() - { - $data = input('post.'); - $feedback_type = new FeedbackTypeModel(); - $feedback_validate = new FeedbackValidate(); - $rel = $feedback_validate->scene('get_the_type')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_validate->getError(), ''); - } - $resp = $feedback_type->get_the_type($data['id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - public function problem() - { - $data = input('get.'); - $this->assign('rel', $data); - return $this->fetch(); - } - public function get_all_problem() - { - $data = input('get.'); - $feedback_type = new FeedbackProblemModel(); -// $feedback_validate = new FeedbackValidate(); -// $rel = $feedback_validate->scene('get_the_type')->check($data); -// if ($rel != VALIDATE_PASS) { -// return apiReturn(CODE_PARAM_ERROR, $feedback_validate->getError(), ''); -// } - $resp = $feedback_type->get_all_problem(isset($data['type']) ? $data['type'] : 0); - //halt($resp); - $resp_data['data'] = empty($resp['data']) ? array() : $resp['data']; - $resp_data['recordsTotal'] = count($resp_data['data']); - $resp_data['recordsFiltered'] = count($resp_data['data']); - echo json_encode($resp_data); - //return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - public function get_the_problem() - { - $data = input('get.'); - $feedback_problem = new FeedbackProblemModel(); - $feedback_validate = new FeedbackValidate(); - $rel = $feedback_validate->scene('get_the_problem')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_validate->getError(), ''); - } - $resp = $feedback_problem->get_the_problem($data['id']); - $this->assign('rel', $resp['data']); - return $this->fetch('feedback/edit_problem'); - //return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - /** - * - * 获取删除的反馈类型列表 - */ - public function get_delete_type() - { - $feedback_type = new FeedbackTypeModel(); - $where['del'] = 1; - $resp = $feedback_type->get_the_type($where); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @return \think\response\Json - * 查看单个反馈信息 - */ - public function look_feedback() - { - $data = input("get."); - $feedback_validate = new FeedbackValidate(); - $rel = $feedback_validate->scene('look_feedback')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_validate->getError(), ''); - } - //获取反馈信息id号,根据id号返回对应数据 - $id = $data['id']; - $feedback_model = new FeedbackModel(); - $where = [ - 'id' => $id, - ]; - $resp = $feedback_model->get_the_list($where); - $resp['data']['img_url'] = json_decode($resp['data']['img_url'], false); - if(isset($resp['data']['type'])){ - $resp['data']['type'] = $resp['data']['type'] == 1 ? 'ios' : 'android'; - } - $realname = empty(Session::get('panel_user.realname', 'iwut')) - ?'匿名':Session::get('panel_user.realname', 'iwut'); - $this->assign('rel', $resp['data']); - $this->assign('realname', $realname); - $this->assign('id', $data['id']); - return $this->fetch(); - //return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @return \think\response\Json - * 后台人员回复提问 - */ - public function add_reply() - { - $data = input("post."); - $feedback_validate = new FeedbackValidate(); - $rel = $feedback_validate->scene('add_reply')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_validate->getError(), ''); - } - $id =$data['id']; - $reply_model = new FeedbackReplyModel(); - $reply_data = array( - 'feedback_id' => $id, - 'content' =>$data['content'], - 'reply_person' => $data['reply_person'], - ); - $user_model = new FeedbackModel(); - $where['id'] = $id; - $resp_data = $user_model->get_the_list($where); - $res = file_get_contents("https://push.wutnews.net/portal/sms.php?user=".$resp_data['data']['phone']."&summary=".urlencode($data['content'])); - if(isset($res['message']) && $res['message'] == '成功'){ - return apiReturn(CODE_ERROR, '发送短信失败', ''); - } - $resp = $reply_model->add_reply($reply_data); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * - * 后台人员删除回复 - */ - public function delete_reply() - { - $data = input("post."); - $feedback_validate = new FeedbackValidate(); - $rel = $feedback_validate->scene('delete_reply')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_validate->getError(), ''); - } - $reply_model = new FeedbackReplyModel(); - $resp = $reply_model->delete_reply($data['id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * - * 后台人员恢复回复内容 - */ - public function recover_reply() - { - $data = input("post."); - $feedback_validate = new FeedbackValidate(); - $rel = $feedback_validate->scene('recover_reply')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_validate->getError(), ''); - } - $reply_model = new FeedbackReplyModel(); - $resp = $reply_model->recover_reply($data['id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - /** - * - * 后台人员删除反馈类别 - */ - public function delete_type() - { - $data = input("post."); - $feedback_type_validate = new FeedbackTypeValidate(); - $rel = $feedback_type_validate->scene('delete_type')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_type_validate->getError(), ''); - } - $type_model = new FeedbackTypeModel(); - $resp = $type_model->delete_type($data['id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * - * 后台人员恢复反馈类别 - */ - public function recover_type() - { - $data = input("post."); - $feedback_type_validate = new FeedbackTypeValidate(); - $rel = $feedback_type_validate->scene('recover_type')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_type_validate->getError(), ''); - } - $type_model = new FeedbackTypeModel(); - $resp = $type_model->recover_type($data['id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - public function add_type() - { - return $this->fetch(); - } - /** - * - * 后台人员添加反馈类别 - */ - public function add_the_type() - { - $data = input("post."); - $feedback_type_validate = new FeedbackTypeValidate(); - $rel = $feedback_type_validate->scene('add_the_type')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_type_validate->getError(), ''); - } - $type_model = new FeedbackTypeModel(); - $type_arr = array( - 'content' => $data['content'], - 'sort' => $data['sort'], - 'count' => 0, - ); - $resp = $type_model->add_type($type_arr); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - public function edit_type() - { - return $this->fetch(); - } - /** - * - * 后台人员更新反馈类别 - */ - public function update_type() - { - $data = input("post."); - $feedback_type_validate = new FeedbackTypeValidate(); - $rel = $feedback_type_validate->scene('update_type')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_type_validate->getError(), ''); - } - $type_model = new FeedbackTypeModel(); - $type_arr = array( - 'id' => $data['id'], - 'content' => $data['content'], - ); - $resp = $type_model->update_type($type_arr); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function update_type_sort() - { - $data = input("post."); - $feedback_type_validate = new FeedbackTypeValidate(); - $rel = $feedback_type_validate->scene('update_type_sort')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_type_validate->getError(), ''); - } - $type_model = new FeedbackTypeModel(); - $i = 0; - $resp = array(); - foreach ($data as $value){ - $type_arr[$i++] = array( - 'id' => $value['id'], - 'sort' => $value['sort'], - ); - $resp = $type_model->update_sort($type_arr); - } - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - public function add_problem() - { - return $this->fetch(); - } - public function add_the_problem() - { - $data = input("post."); - $feedback_validate = new FeedbackProblemValidate(); - $rel = $feedback_validate->scene('add_the_problem')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_validate->getError(), ''); - } - $problem_model = new FeedbackProblemModel(); - $problem_arr = array( - 'problem' => $data['problem'], - 'content' => $data['content'], - 'type' => $data['type'], - ); - $resp = $problem_model->add_problem($problem_arr); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function delete_problem() - { - $data = input("get."); - $feedback_validate = new FeedbackProblemValidate(); - $rel = $feedback_validate->scene('delete_problem')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_validate->getError(), ''); - } - $problem_model = new FeedbackProblemModel(); - - $resp = $problem_model->delete_problem($data['id']); - return $this->fetch('feedback/problem'); - //return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function update_problem() - { - $data = input("post."); - $feedback_validate = new FeedbackProblemValidate(); - $rel = $feedback_validate->scene('update_problem')->check($data); - if ($rel != VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $feedback_validate->getError(), ''); - } - $problem_model = new FeedbackProblemModel(); - - $resp = $problem_model->delete_problem($data['id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } -} diff --git a/back_end/application/admin/model/FeedbackModel.php b/back_end/application/admin/model/FeedbackModel.php deleted file mode 100644 index cbe651c7f..000000000 --- a/back_end/application/admin/model/FeedbackModel.php +++ /dev/null @@ -1,86 +0,0 @@ -where([['del', '=', 0], ['status' ,'=' , 0]])->field('id, title, time, type, status')->select()->toArray(); - if (empty($info)) { - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => $this->getError()]; - } else { - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function get_the_list($where) - { - try { - $info = $this->where($where)->find(); - if (empty($info)) { - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => $this->getError()]; - } else { - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function get_delete_item() - { - try { - $info = $this->where('del', 1)->select()->toArray(); - if (empty($info)) { - return ['code' => CODE_ERROR, 'msg' => '获取失败', 'data' => $this->getError()]; - } else { - return ['code' => CODE_SUCCESS, 'msg' => '获取成功', 'data' => $info]; - } - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function delete_item($id) - { - try { - $info = $this->update(['del' => 1, 'id' => $id]); - if (empty($info)) { - return ['code' => CODE_ERROR, 'msg' => '删除失败', 'data' => $this->getError()]; - } else { - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => $info]; - } - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function recover_item($id) - { - try { - $info = $this->update(['del' => 1, 'id' => $id]); - if (empty($info)) { - return ['code' => CODE_ERROR, 'msg' => '恢复失败', 'data' => $this->getError()]; - } else { - return ['code' => CODE_SUCCESS, 'msg' => '恢复成功', 'data' => $info]; - } - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - -} \ No newline at end of file diff --git a/back_end/application/admin/validate/FeedbackValidate.php b/back_end/application/admin/validate/FeedbackValidate.php deleted file mode 100644 index 50d16b587..000000000 --- a/back_end/application/admin/validate/FeedbackValidate.php +++ /dev/null @@ -1,42 +0,0 @@ - 'require', - 'id' => 'require', - 'content' => 'require', - 'realname' => 'require', - 'cardno' => 'require', - 'type' => 'require', - ]; - - // 不符规则的错误提示 - protected $message = [ - //'token.require' => '未获取到token令牌', - 'id.require' => '未获取到反馈序号', - 'content.require' => '未获取到反馈内容', - 'realname.require' => '未获取到真实姓名', - 'cardno.require' => '未获取到学号', - 'type.require' => '未获取到问题种类', - ]; - - // 场景验证 - protected $scene = [ - 'look_feedback' => ['id'], - 'add_reply' => ['id', 'content'], - 'delete_reply' => ['id'], - 'recover_reply' => ['id'], - 'get_the_problem' => ['id'], - ]; -} \ No newline at end of file diff --git a/back_end/application/command.php b/back_end/application/command.php deleted file mode 100644 index 826bb2b23..000000000 --- a/back_end/application/command.php +++ /dev/null @@ -1,12 +0,0 @@ - -// +---------------------------------------------------------------------- - -return []; diff --git a/back_end/application/common.php b/back_end/application/common.php deleted file mode 100644 index 08b80fdce..000000000 --- a/back_end/application/common.php +++ /dev/null @@ -1,80 +0,0 @@ - -// +---------------------------------------------------------------------- -define("VALIDATE_PASS", true); -define("VALIDATE_ERROR", false); -define("CODE_SUCCESS", 0); -define("CODE_ERROR", -1); - -define("CODE_PARAM_ERROR", -2); -define("NO_LOGIN", -3); - -define("USERNAME_NOT_EXIST", 10001); // 登录用户名不存在 -define("LOGIN_PASSWORD_WRONG", 10002); // 登录密码错误 -define("LOGIN_STATUS_WRONG", 10003); // 登录状态异常 -define("USERNAME_IS_EXIST", 10004); // 注册用户名已存在 - -define('ADMINISTRATOR', 3); -define('TEACHER', 2); -define('TRAINING_TEAM_MEMBER', 1); -define('ORDINARY_MEMBER', 0); - -define('CREATOR', 2); -define('OPERATOR', 1); -define('MEMBER', 0); - -define('BANNED', 0); -define('USING', 1); -define('CONTEST', 2); -define('VALID_TIME', 600); - -define('Report_Accepted',0); -define('Report_WrongAnswer ', 1); -define('Report_TimeLimitExceeded', 2); -define('Report_MemoryLimitExceeded', 3); -define('Report_RuntimeError', 4); -define('Report_CompileError', 5); -define('Report_SystemError', 6); -define('Judging', 9); - -// 应用公共文件 -function apiReturn($status, $message, $data=[], $httpCode=200) -{ - return json([ - 'status' => $status, - 'message' => $message, - 'data' => $data, - ], $httpCode); -} - -function post($url, $data = array(), $type = 'text') { - $curl = curl_init(); - curl_setopt($curl, CURLOPT_URL, $url); - curl_setopt($curl, CURLOPT_POST, true); - if (!empty($data)) curl_setopt($curl, CURLOPT_POSTFIELDS, $data); - if ($type == 'json') curl_setopt($curl, CURLOPT_HTTPHEADER, array( - 'Content-Type: application/json', - 'Content-Length: ' . strlen($data)) - ); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curl, CURLOPT_HEADER, false); - $content = curl_exec($curl); - curl_close($curl); - return $content; -} - -function handle_problem($problem, $problem_array) -{ - $new_array = array(); - foreach ($problem as $item){ - $new_array[] = chr(array_search($item, $problem_array, false) + 65); - } - return $new_array; -} \ No newline at end of file diff --git a/back_end/application/common/model/FindPasswordModel.php b/back_end/application/common/model/FindPasswordModel.php deleted file mode 100644 index 62c027c79..000000000 --- a/back_end/application/common/model/FindPasswordModel.php +++ /dev/null @@ -1,53 +0,0 @@ -get_password_cache($user_name); - if($info['code'] === CODE_SUCCESS){ - return ['code' => CODE_ERROR, 'msg' => '你已有验证码', 'data' => '']; - } - $code = ''; - for($i = 0; $i < $length; $i++){ - $code = $code.$codeSet[mt_rand(0, strlen($codeSet) - 1)]; - } - $resp = $oj_cache_model->set_password_cache($code, $user_name); - if($resp['code'] !== CODE_SUCCESS){ - return ['code' => CODE_ERROR, 'msg' => '生成失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '生成成功', 'data' => $code]; - } catch (Exception $e){ - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function check_token($nick, $token) - { - try{ - $oj_cache_model = new OJCacheModel(); - $info = $oj_cache_model->get_password_cache($nick); - if($info['code'] !== CODE_SUCCESS || $info['data'] !== $token){ - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '验证成功', 'data' => '']; - } catch (Exception $e){ - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/common/model/NotificationModel.php b/back_end/application/common/model/NotificationModel.php deleted file mode 100644 index a75ce7214..000000000 --- a/back_end/application/common/model/NotificationModel.php +++ /dev/null @@ -1,160 +0,0 @@ -field($field) - ->where($where) - ->limit($offset, $limit) - ->withAttr('status', function($value) { - $status = [0=>'不可用', 1=>'可用']; - return $status[$value]; - }) - ->select(); - if($info === false){ - return ['code' => CODE_ERROR,'msg' => '返回值异常','data' => $this->getError()]; - } - return ['code' => CODE_SUCCESS, 'msg' => '获取成功', 'data' => $info->toArray()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR,'msg' => '操作数据库异常','data' => $e->getMessage()]; - } - } - - public function getNotificationByID($id) { - try { - $info = $this - ->field(['id', 'title', 'content', 'submit_time', 'modify_time', 'user_id', 'status']) - ->where(['id' => $id])->find(); - if (!$info) { - return ['code' => CODE_ERROR, 'msg' => 'id不存在', 'data' => '']; - } else { - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function getNotificationByContest($contest_id) { - $OJCacheModel = new OJCacheModel(); - $cache = $OJCacheModel->get_contest_notification_cache($contest_id); - if ($cache['code'] == CODE_SUCCESS) { - return ['code' => $cache['code'], 'msg' => '查询成功', 'data' => $cache['data']]; - } - try { - $where = ['contest_id' => $contest_id]; - $info = $this - ->field(['id', 'title', 'content', 'submit_time', 'modify_time', 'user_id']) - ->where($where)->where(['status' => 1])->select(); - if (!$info) { - return ['code' => CODE_ERROR, 'msg' => 'id不存在', 'data' => '']; - } else { - $OJCacheModel->set_contest_notification_cache($contest_id, $info); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function getPublicNotification() { - $OJCacheModel = new OJCacheModel(); - $cache = $OJCacheModel->get_public_notification_cache(); - if ($cache['code'] == CODE_SUCCESS) { - return ['code' => $cache['code'], 'msg' => '查询成功', 'data' => $cache['data']]; - } - try { - $where = ['contest_id' => null]; - $info = $this - ->field(['id', 'title', 'content', 'submit_time', 'modify_time', 'user_id']) - ->where($where)->where(['status' => 1])->select(); - if (!$info) { - return ['code' => CODE_ERROR, 'msg' => 'id不存在', 'data' => '']; - } else { - $OJCacheModel->set_public_notification_cache($info); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - - public function addNotification($data) { - try { - $info = $this->insert($data); - if ($info === false) { - return ['code' => CODE_ERROR, 'msg' => '添加失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => '']; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function modifyNotification($id, $data) { - try{ - $info = $this->where('id', $id)->update($data); - if ($info !== 0) { - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } - return ['code' => CODE_ERROR, 'msg' => '更新失败', 'data' => '']; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function deleteNotification($id) { - try{ - $info = $this->where('id', $id)->delete(); - if ($info !== 0) { - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => $info]; - } - return ['code' => CODE_ERROR, 'msg' => '删除失败', 'data' => '']; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function changeNotificationStatus($id) { - try { - $where = ['id' => $id]; - $info = $this->where($where)->find(); - if (!$info) { - return ['code' => CODE_ERROR, 'msg' => 'id不存在', 'data' => '']; - } else { - $res = $this->where($where)->update(['status' => 1-$info['status']]); - if ($res !== 0) { - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } - return ['code' => CODE_ERROR, 'msg' => '更新失败', 'data' => '']; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/common/validate/NotificationValidate.php b/back_end/application/common/validate/NotificationValidate.php deleted file mode 100644 index 3f304c639..000000000 --- a/back_end/application/common/validate/NotificationValidate.php +++ /dev/null @@ -1,30 +0,0 @@ - 'require|number', - 'id' => 'require|number', - 'title' => 'require', - 'content' => 'require', - 'user_id' => 'require' - ]; - - protected $message = [ - 'contest_id.require' => '缺少比赛ID', - 'id.require' => '缺少通知ID', - 'title.require' => '缺少标题', - 'content.require' => '缺少通知内容', - 'user_id.require' => '缺少用户id', - ]; - - protected $scene = [ - 'getNotificationByID' => ['id'], - 'getNotificationByUser' => ['user_id'], - ]; -} \ No newline at end of file diff --git a/back_end/application/discuss/config/app.php b/back_end/application/discuss/config/app.php deleted file mode 100644 index cfe43d9f3..000000000 --- a/back_end/application/discuss/config/app.php +++ /dev/null @@ -1,142 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 应用设置 -// +---------------------------------------------------------------------- - -return [ - // 应用名称 - 'app_name' => '', - // 应用地址 - 'app_host' => '', - // 应用调试模式 - 'app_debug' => true, - // 应用Trace - 'app_trace' => false, - // 是否支持多模块 - 'app_multi_module' => true, - // 入口自动绑定模块 - 'auto_bind_module' => false, - // 注册的根命名空间 - 'root_namespace' => [], - // 默认输出类型 - 'default_return_type' => 'html', - // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', - // 默认JSONP格式返回的处理方法 - 'default_jsonp_handler' => 'jsonpReturn', - // 默认JSONP处理方法 - 'var_jsonp_handler' => 'callback', - // 默认时区 - 'default_timezone' => 'Asia/Shanghai', - // 是否开启多语言 - 'lang_switch_on' => false, - // 默认全局过滤方法 用逗号分隔多个 - 'default_filter' => '', - // 默认语言 - 'default_lang' => 'zh-cn', - // 应用类库后缀 - 'class_suffix' => false, - // 控制器类后缀 - 'controller_suffix' => false, - - // +---------------------------------------------------------------------- - // | 模块设置 - // +---------------------------------------------------------------------- - - // 默认模块名 - 'default_module' => 'index', - // 禁止访问模块 - 'deny_module_list' => ['common'], - // 默认控制器名 - 'default_controller' => 'Index', - // 默认操作名 - 'default_action' => 'index', - // 默认验证器 - 'default_validate' => '', - // 默认的空模块名 - 'empty_module' => '', - // 默认的空控制器名 - 'empty_controller' => 'Error', - // 操作方法前缀 - 'use_action_prefix' => false, - // 操作方法后缀 - 'action_suffix' => '', - // 自动搜索控制器 - 'controller_auto_search' => false, - - // +---------------------------------------------------------------------- - // | URL设置 - // +---------------------------------------------------------------------- - - // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', - // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], - // pathinfo分隔符 - 'pathinfo_depr' => '/', - // HTTPS代理标识 - 'https_agent_name' => '', - // IP代理获取标识 - 'http_agent_ip' => 'X-REAL-IP', - // URL伪静态后缀 - 'url_html_suffix' => 'html', - // URL普通方式参数 用于自动生成 - 'url_common_param' => false, - // URL参数方式 0 按名称成对解析 1 按顺序解析 - 'url_param_type' => 0, - // 是否开启路由延迟解析 - 'url_lazy_route' => false, - // 是否强制使用路由 - 'url_route_must' => false, - // 合并路由规则 - 'route_rule_merge' => false, - // 路由是否完全匹配 - 'route_complete_match' => false, - // 使用注解路由 - 'route_annotation' => false, - // 域名根,如thinkphp.cn - 'url_domain_root' => '', - // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, - // 默认的访问控制器层 - 'url_controller_layer' => 'controller', - // 表单请求类型伪装变量 - 'var_method' => '_method', - // 表单ajax伪装变量 - 'var_ajax' => '_ajax', - // 表单pjax伪装变量 - 'var_pjax' => '_pjax', - // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, - // 请求缓存有效期 - 'request_cache_expire' => null, - // 全局请求缓存排除规则 - 'request_cache_except' => [], - - // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', -// 'dispatch_success_tmpl' => Env::get('app_path') . 'index/view/extra/jump.html', -// 'dispatch_error_tmpl' => Env::get('app_path') . 'index/view/extra/jump.html', - 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - - // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', - - // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', - // 显示错误信息 - 'show_error_msg' => false, - // 异常处理handle类 留空使用 \think\exception\Handle - 'exception_handle' => '', - -]; diff --git a/back_end/application/discuss/config/cache.php b/back_end/application/discuss/config/cache.php deleted file mode 100644 index 985dbb1c4..000000000 --- a/back_end/application/discuss/config/cache.php +++ /dev/null @@ -1,25 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 缓存设置 -// +---------------------------------------------------------------------- - -return [ - // 驱动方式 - 'type' => 'File', - // 缓存保存目录 - 'path' => '', - // 缓存前缀 - 'prefix' => '', - // 缓存有效期 0表示永久缓存 - 'expire' => 0, -]; diff --git a/back_end/application/discuss/config/console.php b/back_end/application/discuss/config/console.php deleted file mode 100644 index b0f9165ac..000000000 --- a/back_end/application/discuss/config/console.php +++ /dev/null @@ -1,19 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 控制台配置 -// +---------------------------------------------------------------------- -return [ - 'name' => 'Think Console', - 'version' => '0.1', - 'user' => null, -]; diff --git a/back_end/application/discuss/config/cookie.php b/back_end/application/discuss/config/cookie.php deleted file mode 100644 index 1de07082a..000000000 --- a/back_end/application/discuss/config/cookie.php +++ /dev/null @@ -1,30 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | Cookie设置 -// +---------------------------------------------------------------------- -return [ - // cookie 名称前缀 - 'prefix' => '', - // cookie 保存时间 - 'expire' => 0, - // cookie 保存路径 - 'path' => '/', - // cookie 有效域名 - 'domain' => '', - // cookie 启用安全传输 - 'secure' => false, - // httponly设置 - 'httponly' => '', - // 是否使用 setcookie - 'setcookie' => true, -]; diff --git a/back_end/application/discuss/config/database.php b/back_end/application/discuss/config/database.php deleted file mode 100644 index 4bb4f0dc1..000000000 --- a/back_end/application/discuss/config/database.php +++ /dev/null @@ -1,63 +0,0 @@ - -// +---------------------------------------------------------------------- - -return [ - // 数据库类型 - 'type' => 'mysql', - // 服务器地址 - 'hostname' => '127.0.0.1', - // 数据库名 - 'database' => 'online_judge', - // 用户名 - 'username' => 'root', - // 密码 - 'password' => 'root', - // 端口 - 'hostport' => '8889', - // 连接dsn - 'dsn' => '', - // 数据库连接参数 - 'params' => [], - // 数据库编码默认采用utf8 - 'charset' => 'utf8', - // 数据库表前缀 - 'prefix' => '', - // 数据库调试模式 - 'debug' => true, - // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, - // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, - // 读写分离后 主服务器数量 - 'master_num' => 1, - // 指定从服务器序号 - 'slave_no' => '', - // 自动读取主库数据 - 'read_master' => false, - // 是否严格检查字段是否存在 - 'fields_strict' => true, - // 数据集返回类型 - 'resultset_type' => 'array', - // 自动写入时间戳字段 - 'auto_timestamp' => false, - // 时间字段取出后的默认时间格式 - 'datetime_format' => 'Y-m-d H:i:s', - // 是否需要进行SQL性能分析 - 'sql_explain' => false, - // Builder类 - 'builder' => '', - // Query类 - 'query' => '\\think\\db\\Query', - // 是否需要断线重连 - 'break_reconnect' => false, - // 断线标识字符串 - 'break_match_str' => [], -]; diff --git a/back_end/application/discuss/config/log.php b/back_end/application/discuss/config/log.php deleted file mode 100644 index b3d87b4a9..000000000 --- a/back_end/application/discuss/config/log.php +++ /dev/null @@ -1,30 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 日志设置 -// +---------------------------------------------------------------------- -return [ - // 日志记录方式,内置 file socket 支持扩展 - 'type' => 'File', - // 日志保存目录 - 'path' => '', - // 日志记录级别 - 'level' => [], - // 单文件日志写入 - 'single' => false, - // 独立日志级别 - 'apart_level' => [], - // 最大日志文件数量 - 'max_files' => 0, - // 是否关闭日志写入 - 'close' => false, -]; diff --git a/back_end/application/discuss/config/session.php b/back_end/application/discuss/config/session.php deleted file mode 100644 index 1d7b6c60f..000000000 --- a/back_end/application/discuss/config/session.php +++ /dev/null @@ -1,26 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 会话设置 -// +---------------------------------------------------------------------- - -return [ - 'id' => '', - // SESSION_ID的提交变量,解决flash上传跨域 - 'var_session_id' => '', - // SESSION 前缀 - 'prefix' => 'think', - // 驱动方式 支持redis memcache memcached - 'type' => '', - // 是否自动开启 SESSION - 'auto_start' => true, -]; diff --git a/back_end/application/discuss/config/template.php b/back_end/application/discuss/config/template.php deleted file mode 100644 index 299bd6f43..000000000 --- a/back_end/application/discuss/config/template.php +++ /dev/null @@ -1,35 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 模板设置 -// +---------------------------------------------------------------------- - -return [ - // 模板引擎类型 支持 php think 支持扩展 - 'type' => 'Think', - // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 - 'auto_rule' => 1, - // 模板路径 - 'view_path' => '', - // 模板后缀 - 'view_suffix' => 'html', - // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, - // 模板引擎普通标签开始标记 - 'tpl_begin' => '{', - // 模板引擎普通标签结束标记 - 'tpl_end' => '}', - // 标签库标签开始标记 - 'taglib_begin' => '{', - // 标签库标签结束标记 - 'taglib_end' => '}', -]; diff --git a/back_end/application/discuss/config/trace.php b/back_end/application/discuss/config/trace.php deleted file mode 100644 index 425d30148..000000000 --- a/back_end/application/discuss/config/trace.php +++ /dev/null @@ -1,18 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | Trace设置 开启 app_trace 后 有效 -// +---------------------------------------------------------------------- -return [ - // 内置Html Console 支持扩展 - 'type' => 'Html', -]; diff --git a/back_end/application/discuss/controller/Test.php b/back_end/application/discuss/controller/Test.php deleted file mode 100644 index 6fdcc8488..000000000 --- a/back_end/application/discuss/controller/Test.php +++ /dev/null @@ -1,36 +0,0 @@ -insert($data); - if($res) { - return ['code'=>CODE_SUCCESS, 'msg'=>'评论成功', 'data'=>'']; - }else{ - return ['code'=>CODE_ERROR, 'msg'=>'评论失败', 'data'=>'']; - } - }catch(Exception $e){ - return ['code'=>CODE_ERROR, 'msg'=>'数据库错误', 'data'=>$e->getMessage()]; - } - } - - /** - * 查找评论 - * @param $comment_id - * @return array - */ - public function searchComment($comment_id) { - try { - $content = $this->where('comment_id', $comment_id)->find(); - if(!empty($content)) { - return ['code'=>CODE_SUCCESS, 'msg'=>'查找成功', 'data'=>$content]; - }else{ - return ['code'=>CODE_ERROR, 'msg'=>'查找失败', 'data'=>'不存在查找项']; - } - }catch(Exception $e){ - return ['code'=>CODE_ERROR, 'msg'=>'数据库错误', 'data'=>$e->getMessage()]; - } - } - - /** - * 编辑回复 - * 只允许admin权限使用 - * @param $comment_id - */ - public function deleComment($comment_id) { - - } -} \ No newline at end of file diff --git a/back_end/application/discuss/model/QuestionModel.php b/back_end/application/discuss/model/QuestionModel.php deleted file mode 100644 index ec8e5c0ab..000000000 --- a/back_end/application/discuss/model/QuestionModel.php +++ /dev/null @@ -1,96 +0,0 @@ -insert($data); - if($res){ - return ['code'=>CODE_SUCCESS, 'msg'=>'发表问题成功', 'data'=>'']; - }else{ - return ['code'=>CODE_ERROR, 'msg'=>'发表问题失败', 'data'=>'重复发表']; - } - }catch(Exception $e) { - return ['code'=>CODE_ERROR, 'msg'=>'数据库错误', 'data'=>$e->getMessage()]; - } - } - - /** - * 删除Question - * 该function在大部分时候不应该被调用 - * @param $question_id - * @return array - */ - public function deleQuestion($question_id) { - try { - $res = $this->where('question_id',$question_id)->delete(); - if($res){ - return ['code'=>CODE_SUCCESS, 'msg'=>'删除问题成功', 'data'=>'']; - }else{ - return ['code'=>CODE_ERROR, 'msg'=>'删除问题失败', 'data'=>'']; - } - }catch(Exception $e) { - return ['code'=>CODE_ERROR, 'msg'=>'数据库错误', 'data'=>$e->getMessage()]; - } - } - - /** - * 根据比赛编号(可能是null)-题目编号来查找question项 - * 若比赛编号是null,则在全部公共题目里查找question项 - * @param $contest_id - * @param $problem_id - * @return array - */ - public function searchQuestionByContestProblem($contest_id, $problem_id) { // TODO check logic of if not-in-contest ,there has some bugs - try { - $condition = []; - if($contest_id!=null){ - $condition = ['contest_id'=>$contest_id, 'problem_id'=>$problem_id]; - }else{ - $condition = ['problem_id'=>$problem_id]; - } - $content = $this->where($condition)->select(); - if(!empty($res)){ - return ['code'=>CODE_SUCCESS, 'msg'=>'查找成功', 'data'=>$content]; - }else{ - return ['code'=>CODE_ERROR, 'msg'=>'查找失败', 'data'=>'不存在查找项']; - } - }catch(Exception $e) { - return ['code'=>CODE_ERROR, 'msg'=>'数据库错误', 'data'=>$e->getMessage()]; - } - } - - /** - * 根据question编号找到question项 - * @param $question_id - * @return array - */ - public function searchQuestion($question_id) { - try { - $content = $this->where('question_id',$question_id)->select(); - if(!empty($res)){ - return ['code'=>CODE_SUCCESS, 'msg'=>'查找成功', 'data'=>$content]; - }else{ - return ['code'=>CODE_ERROR, 'msg'=>'查找失败', 'data'=>'']; - } - }catch(Exception $e) { - return ['code'=>CODE_ERROR, 'msg'=>'数据库错误', 'data'=>$e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/http/middleware/CrossDomain.php b/back_end/application/http/middleware/CrossDomain.php deleted file mode 100644 index f0d8c47cd..000000000 --- a/back_end/application/http/middleware/CrossDomain.php +++ /dev/null @@ -1,20 +0,0 @@ -method()) == "OPTIONS") { - return Response::create()->send(); - } - - return $next($request); - } -} diff --git a/back_end/application/index/config/app.php b/back_end/application/index/config/app.php deleted file mode 100644 index 3c04a1d6c..000000000 --- a/back_end/application/index/config/app.php +++ /dev/null @@ -1,142 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 应用设置 -// +---------------------------------------------------------------------- - -return [ - // 应用名称 - 'app_name' => '', - // 应用地址 - 'app_host' => '', - // 应用调试模式 - 'app_debug' => false, - // 应用Trace - 'app_trace' => false, - // 是否支持多模块 - 'app_multi_module' => true, - // 入口自动绑定模块 - 'auto_bind_module' => false, - // 注册的根命名空间 - 'root_namespace' => [], - // 默认输出类型 - 'default_return_type' => 'html', - // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', - // 默认JSONP格式返回的处理方法 - 'default_jsonp_handler' => 'jsonpReturn', - // 默认JSONP处理方法 - 'var_jsonp_handler' => 'callback', - // 默认时区 - 'default_timezone' => 'Asia/Shanghai', - // 是否开启多语言 - 'lang_switch_on' => false, - // 默认全局过滤方法 用逗号分隔多个 - 'default_filter' => '', - // 默认语言 - 'default_lang' => 'zh-cn', - // 应用类库后缀 - 'class_suffix' => false, - // 控制器类后缀 - 'controller_suffix' => false, - - // +---------------------------------------------------------------------- - // | 模块设置 - // +---------------------------------------------------------------------- - - // 默认模块名 - 'default_module' => 'index', - // 禁止访问模块 - 'deny_module_list' => ['common'], - // 默认控制器名 - 'default_controller' => 'Index', - // 默认操作名 - 'default_action' => 'index', - // 默认验证器 - 'default_validate' => '', - // 默认的空模块名 - 'empty_module' => '', - // 默认的空控制器名 - 'empty_controller' => 'Error', - // 操作方法前缀 - 'use_action_prefix' => false, - // 操作方法后缀 - 'action_suffix' => '', - // 自动搜索控制器 - 'controller_auto_search' => false, - - // +---------------------------------------------------------------------- - // | URL设置 - // +---------------------------------------------------------------------- - - // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', - // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], - // pathinfo分隔符 - 'pathinfo_depr' => '/', - // HTTPS代理标识 - 'https_agent_name' => '', - // IP代理获取标识 - 'http_agent_ip' => 'X-REAL-IP', - // URL伪静态后缀 - 'url_html_suffix' => 'html', - // URL普通方式参数 用于自动生成 - 'url_common_param' => false, - // URL参数方式 0 按名称成对解析 1 按顺序解析 - 'url_param_type' => 0, - // 是否开启路由延迟解析 - 'url_lazy_route' => false, - // 是否强制使用路由 - 'url_route_must' => false, - // 合并路由规则 - 'route_rule_merge' => false, - // 路由是否完全匹配 - 'route_complete_match' => false, - // 使用注解路由 - 'route_annotation' => false, - // 域名根,如thinkphp.cn - 'url_domain_root' => '', - // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, - // 默认的访问控制器层 - 'url_controller_layer' => 'controller', - // 表单请求类型伪装变量 - 'var_method' => '_method', - // 表单ajax伪装变量 - 'var_ajax' => '_ajax', - // 表单pjax伪装变量 - 'var_pjax' => '_pjax', - // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, - // 请求缓存有效期 - 'request_cache_expire' => null, - // 全局请求缓存排除规则 - 'request_cache_except' => [], - - // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', -// 'dispatch_success_tmpl' => Env::get('app_path') . 'index/view/extra/jump.html', -// 'dispatch_error_tmpl' => Env::get('app_path') . 'index/view/extra/jump.html', - 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - - // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', - - // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', - // 显示错误信息 - 'show_error_msg' => false, - // 异常处理handle类 留空使用 \think\exception\Handle - 'exception_handle' => '', - -]; diff --git a/back_end/application/index/config/cache.php b/back_end/application/index/config/cache.php deleted file mode 100644 index 985dbb1c4..000000000 --- a/back_end/application/index/config/cache.php +++ /dev/null @@ -1,25 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 缓存设置 -// +---------------------------------------------------------------------- - -return [ - // 驱动方式 - 'type' => 'File', - // 缓存保存目录 - 'path' => '', - // 缓存前缀 - 'prefix' => '', - // 缓存有效期 0表示永久缓存 - 'expire' => 0, -]; diff --git a/back_end/application/index/config/console.php b/back_end/application/index/config/console.php deleted file mode 100644 index b0f9165ac..000000000 --- a/back_end/application/index/config/console.php +++ /dev/null @@ -1,19 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 控制台配置 -// +---------------------------------------------------------------------- -return [ - 'name' => 'Think Console', - 'version' => '0.1', - 'user' => null, -]; diff --git a/back_end/application/index/config/cookie.php b/back_end/application/index/config/cookie.php deleted file mode 100644 index 1de07082a..000000000 --- a/back_end/application/index/config/cookie.php +++ /dev/null @@ -1,30 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | Cookie设置 -// +---------------------------------------------------------------------- -return [ - // cookie 名称前缀 - 'prefix' => '', - // cookie 保存时间 - 'expire' => 0, - // cookie 保存路径 - 'path' => '/', - // cookie 有效域名 - 'domain' => '', - // cookie 启用安全传输 - 'secure' => false, - // httponly设置 - 'httponly' => '', - // 是否使用 setcookie - 'setcookie' => true, -]; diff --git a/back_end/application/index/config/database.php b/back_end/application/index/config/database.php deleted file mode 100644 index bd4b1df72..000000000 --- a/back_end/application/index/config/database.php +++ /dev/null @@ -1,63 +0,0 @@ - -// +---------------------------------------------------------------------- - -return [ - // 数据库类型 - 'type' => 'mysql', - // 服务器地址 - 'hostname' => '115.159.77.141', - // 数据库名 - 'database' => 'openjudge_db', - // 用户名 - 'username' => 'root', - // 密码 - 'password' => 'acmWhut+123', - // 端口 - 'hostport' => '3306', - // 连接dsn - 'dsn' => '', - // 数据库连接参数 - 'params' => [], - // 数据库编码默认采用utf8 - 'charset' => 'utf8', - // 数据库表前缀 - 'prefix' => '', - // 数据库调试模式 - 'debug' => true, - // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, - // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, - // 读写分离后 主服务器数量 - 'master_num' => 1, - // 指定从服务器序号 - 'slave_no' => '', - // 自动读取主库数据 - 'read_master' => false, - // 是否严格检查字段是否存在 - 'fields_strict' => true, - // 数据集返回类型 - 'resultset_type' => 'array', - // 自动写入时间戳字段 - 'auto_timestamp' => false, - // 时间字段取出后的默认时间格式 - 'datetime_format' => 'Y-m-d H:i:s', - // 是否需要进行SQL性能分析 - 'sql_explain' => false, - // Builder类 - 'builder' => '', - // Query类 - 'query' => '\\think\\db\\Query', - // 是否需要断线重连 - 'break_reconnect' => false, - // 断线标识字符串 - 'break_match_str' => [], -]; diff --git a/back_end/application/index/config/log.php b/back_end/application/index/config/log.php deleted file mode 100644 index b3d87b4a9..000000000 --- a/back_end/application/index/config/log.php +++ /dev/null @@ -1,30 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 日志设置 -// +---------------------------------------------------------------------- -return [ - // 日志记录方式,内置 file socket 支持扩展 - 'type' => 'File', - // 日志保存目录 - 'path' => '', - // 日志记录级别 - 'level' => [], - // 单文件日志写入 - 'single' => false, - // 独立日志级别 - 'apart_level' => [], - // 最大日志文件数量 - 'max_files' => 0, - // 是否关闭日志写入 - 'close' => false, -]; diff --git a/back_end/application/index/config/session.php b/back_end/application/index/config/session.php deleted file mode 100644 index 1d7b6c60f..000000000 --- a/back_end/application/index/config/session.php +++ /dev/null @@ -1,26 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 会话设置 -// +---------------------------------------------------------------------- - -return [ - 'id' => '', - // SESSION_ID的提交变量,解决flash上传跨域 - 'var_session_id' => '', - // SESSION 前缀 - 'prefix' => 'think', - // 驱动方式 支持redis memcache memcached - 'type' => '', - // 是否自动开启 SESSION - 'auto_start' => true, -]; diff --git a/back_end/application/index/config/template.php b/back_end/application/index/config/template.php deleted file mode 100644 index 299bd6f43..000000000 --- a/back_end/application/index/config/template.php +++ /dev/null @@ -1,35 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 模板设置 -// +---------------------------------------------------------------------- - -return [ - // 模板引擎类型 支持 php think 支持扩展 - 'type' => 'Think', - // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 - 'auto_rule' => 1, - // 模板路径 - 'view_path' => '', - // 模板后缀 - 'view_suffix' => 'html', - // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, - // 模板引擎普通标签开始标记 - 'tpl_begin' => '{', - // 模板引擎普通标签结束标记 - 'tpl_end' => '}', - // 标签库标签开始标记 - 'taglib_begin' => '{', - // 标签库标签结束标记 - 'taglib_end' => '}', -]; diff --git a/back_end/application/index/config/trace.php b/back_end/application/index/config/trace.php deleted file mode 100644 index 425d30148..000000000 --- a/back_end/application/index/config/trace.php +++ /dev/null @@ -1,18 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | Trace设置 开启 app_trace 后 有效 -// +---------------------------------------------------------------------- -return [ - // 内置Html Console 支持扩展 - 'type' => 'Html', -]; diff --git a/back_end/application/index/controller/Base.php b/back_end/application/index/controller/Base.php deleted file mode 100644 index 4f8873d64..000000000 --- a/back_end/application/index/controller/Base.php +++ /dev/null @@ -1,159 +0,0 @@ -pull($token); - if($data)return true; - } - return false; - } - - /** - * 检查用户身份级别 - * @param $userId - * @return array|null|\PDOStatement|string|\think\Model - */ - protected function checkUserType($userId) - { - try { - $result = Db('user')->where('userId', $userId)->field('userType')->find();//TODO check - return $result; - }catch (Exception $e) { - return -1; - } - } - - /** - * 检查邀请码有效性 - * @param $rcode - * @return bool - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\ModelNotFoundException - * @throws \think\exception\DbException - */ - protected function checkRcode($rcode) - { - if(strlen($rcode)==16) - { - $rcode = Db('rcode')->where('code',$rcode); - $data = $rcode->find(); - if($data['isUsed']==false) - { - $rcode->setField('isUsed',true); - return true; - } - } - return false; - } - - /** - * 重写success - * @access protected - * @param mixed $msg 提示信息 - * @param string $url 跳转的URL地址 - * @param mixed $data 返回的数据 - * @param integer $wait 跳转等待时间 - * @param array $header 发送的Header信息 - * @return void - */ -// protected function success($msg = '', $url = null, $data = '', $wait = 3, array $header = []) -// { -// if (is_null($url) && isset($_SERVER["HTTP_REFERER"])) { -// $url = $_SERVER["HTTP_REFERER"]; -// } elseif ('' !== $url) { -// $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : Container::get('url')->build($url); -// } -// -// $result = [ -// 'code' => 1, -// 'msg' => $msg, -// 'data' => $data, -// 'url' => $url, -// 'wait' => $wait, -// ]; -// -// $type = $this->getResponseType(); -// // 把跳转模板的渲染下沉,这样在 response_send 行为里通过getData()获得的数据是一致性的格式 -// if ('html' == strtolower($type)) { -// $type = 'jump'; -// } -// -// $response = Response::create($result, $type)->header($header)->options(['jump_template' => Container::get('config')->get('dispatch_success_tmpl')]); -// -// throw new HttpResponseException($response); -// } - - /** - * 重写error - * @access protected - * @param mixed $msg 提示信息 - * @param string $url 跳转的URL地址 - * @param mixed $data 返回的数据 - * @param integer $wait 跳转等待时间 - * @param array $header 发送的Header信息 - * @return void - */ -// protected function error($msg = '', $url = null, $data = '', $wait = 3, array $header = []) -// { -// if (is_null($url)) { -// $url = Container::get('request')->isAjax() ? '' : 'javascript:history.back(-1);'; -// } elseif ('' !== $url) { -// $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : Container::get('url')->build($url); -// } -// -// $result = [ -// 'code' => 0, -// 'msg' => $msg, -// 'data' => $data, -// 'url' => $url, -// 'wait' => $wait, -// ]; -// -// $type = $this->getResponseType(); -// if ('html' == strtolower($type)) { -// $type = 'jump'; -// } -// -// $response = Response::create($result, $type)->header($header)->options(['jump_template' => Container::get('config')->get('dispatch_error_tmpl')]); -// -// throw new HttpResponseException($response); -// } -} \ No newline at end of file diff --git a/back_end/application/index/controller/Comment.php b/back_end/application/index/controller/Comment.php deleted file mode 100644 index e9283f469..000000000 --- a/back_end/application/index/controller/Comment.php +++ /dev/null @@ -1,27 +0,0 @@ -checkToken(input('post.token'))!==true) - { - $ret = array('errCode'=>403,'errMsg'=>'token error','data'=>null); - return json($ret); - } - - if(session('userId')==null) - { - $ret = array('errCode'=>405,'errMsg'=>'用户未登录','data'=>null); - return json($ret); - } - - //TODO add commentFunction - } -} \ No newline at end of file diff --git a/back_end/application/index/controller/Contest.php b/back_end/application/index/controller/Contest.php deleted file mode 100644 index 1d8617d85..000000000 --- a/back_end/application/index/controller/Contest.php +++ /dev/null @@ -1,42 +0,0 @@ -checkToken(input('post.token'))!==true) - { - $ret = array('errCode'=>403,'errMsg'=>'token error','data'=>null); - return json($ret); - } - - if(session('userId')==null) - { - $ret = array('errCode'=>405,'errMsg'=>'用户未登录','data'=>null); - return json($ret); - } - - $userInfo = Db('user')->where('userId',session('userId'))->find(); - $contestInfo = Db('contest')->where('contestId',$contestId)->find(); - - $teamInfo = array( - 'contestId'=>$contestId, - 'account'=>,//账号 - 'password'=>,//密码 - ); - - if($contestInfo['type']=="新生赛") - { - $teamInfo['CNname']=$userInfo['name']; - - }else{ - - } - } -} \ No newline at end of file diff --git a/back_end/application/index/controller/Index.php b/back_end/application/index/controller/Index.php deleted file mode 100644 index 276bf3d71..000000000 --- a/back_end/application/index/controller/Index.php +++ /dev/null @@ -1,17 +0,0 @@ -*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

:)

ThinkPHP V5.1
12载初心不改(2006-2018) - 你值得信赖的PHP框架

'; - } - - public function hello($name = 'ThinkPHP5') - { - return 'hello,' . $name; - } -} diff --git a/back_end/application/index/controller/Judger.php b/back_end/application/index/controller/Judger.php deleted file mode 100644 index a74325863..000000000 --- a/back_end/application/index/controller/Judger.php +++ /dev/null @@ -1,48 +0,0 @@ -python3 = '/Users/wdhhdzyhb/PycharmProjects/DoTA2Analysis/venv/bin/python3'; - } - - public function judge() - { - #sudo ./final_judger.py - # --problem /home/darkkris/下载/pcijudger/problem/A.GSS_and_CQ - # --code /home/darkkris/下载/A.cpp - # --language go.go - # --action judge - - /* - { - "used_time": 0.0032994747161865234, - "detail": [], - "exe_time": 0.0, - "exit_code": 0, - "verdict": "SE", - "exe_memory": 0, - "success": true - } - */ - $command = $this->python3." ./final_judger.py"; - $command .= " --problem " . ""; - $command .= " --code" . ""; - $command .= " --language " . ""; - $command .= " --action judge"; - exec($command,$rtn); -// $json = explode(" ",$rtn); - $json = json_decode($rtn); - $json['verdict'];//AC WA SE CE - } -} \ No newline at end of file diff --git a/back_end/application/index/controller/Login.php b/back_end/application/index/controller/Login.php deleted file mode 100644 index b40b9b1aa..000000000 --- a/back_end/application/index/controller/Login.php +++ /dev/null @@ -1,72 +0,0 @@ -0,'errMsg'=>'OK','data'=>null); - $data = array( - 'account' => input('post.account'), - 'password' => md5(base64_encode(input('post.password'))) - ); - if(true === $this->validate($data,'app\index\validate\UserValidate.login')) - { - $user = Db('user')->where($data)->find(); - if($user) - { - session('userId',$user['userId']); -// session('userType',$user['userType']); - session('userName', $user['userName']); - }else{ - $ret = array('errCode'=>102,'errMsg'=>'用户名或密码错误','data'=>null); - } - } - return json($ret); - } - - /** - * 管理员登陆 - */ - public function adminlogin(Request $request) { - if(session('userId')!=null) - { - if($this->checkUserType(session('userId'))>=2) - { - $this->redirect('index/Panel/index'); - } - } - if($request->isPost()) - { - $user = new UserModel(); - $account = input('post.account'); - $password = md5(base64_encode(input('post.password'))); - $info = $user->checkAdmin($account,$password); - if($info !== false) - { - session('userId',$info['userId']); - session('userName', $info['userName']); - $this->redirect('index/Panel/index'); - }else{ - $this->error('用户名密码错误或不是管理员'); - } - } - return $this->fetch('panel/login'); - } -} \ No newline at end of file diff --git a/back_end/application/index/controller/Notice.php b/back_end/application/index/controller/Notice.php deleted file mode 100644 index 5977b0e89..000000000 --- a/back_end/application/index/controller/Notice.php +++ /dev/null @@ -1,51 +0,0 @@ -checkToken(input('post.token'))!==true) - { - $this->error('Token错误','index/Panel/notice'); - } - - if($this->checkUserType(session('userId'))<=1) - { - $ret = array('errCode'=>403,'errMsg'=>'没有操作权限','data'=>null); - return json($ret); - } - - $info = input('post.'); - $data = array( - 'title' => $info['title'], - 'href' => $info['href'], - 'time' => time(), - 'user' => session('userId'), - 'status' => $info['display'] - ); - $notice = new NoticeModel(); - $result = $notice->addnotice($data); - - if($result){ - $panel = new Panel(); - $panel->notice(); - }else{ - $this->error('发布失败','index/Panel/notice'); - } - } - - public function getdisplaylist() - { - $notice = new NoticeModel(); - $info = $notice->getnotcielist(['status'=>1]); - return json(array_values($info)); - } -} \ No newline at end of file diff --git a/back_end/application/index/controller/Panel.php b/back_end/application/index/controller/Panel.php deleted file mode 100644 index 75c5cad4a..000000000 --- a/back_end/application/index/controller/Panel.php +++ /dev/null @@ -1,103 +0,0 @@ -checkUserType(session('userId'))<=1) - { - $this->error('没有操作权限','index/Login/adminlogin'); - } - } - - public function index() - { - $this->assign('type','index'); - return $this->fetch('panel/index'); - } - - public function notice() - { - $user = new UserModel(); - $notice = new NoticeModel(); - $list = $notice->getnotcielist()['data']; - $cnt=0; - foreach($list as $v){ - $v['status']=$v['status']==1?'Dispaly':'Not Display'; - $v['user']=$user->getinfo($v['user'])['userName']; - $v['num']=($cnt++); - } - - $this->assign('list',$list); - $this->assign('type','notice'); - return $this->fetch('panel/notice'); - } - - public function user() - { - $user = new UserModel(); - $list = $user->getuserinfo(); - $cnt=0; - foreach($list as $v) { - $v['userStat']=$v['userStat']==0?'退役':'现役'; - $v['userGender']=$v['userGender']==0?'女':'男'; - switch($v['userType']) - { - case -1:$v['userType']='黑名单';break; - case 0:$v['userType']='会员';break; - case 1:$v['userType']='正式成员';break; - case 2:$v['userType']='管理员';break; - } - $v['num']=($cnt++); - $list[$cnt-1]=$v; - } - - $this->assign('list',$list); - $this->assign('type','user'); - return $this->fetch('panel/user'); - } - - public function recruit() - { - $sign = new SignModel(); - $info = $sign->getsign()['data']; - $cnt=0; - foreach ($info as $v) - { - $v['sex'] = $v['sex']==1?'男':'女'; - $v['star']= $v['star']==1?'':'-empty'; - $info[$cnt++]=$v; - } - $this->assign('list',$info); - $this->assign('type','recruit'); - return $this->fetch('panel/recruit'); - } - - public function problem() - { - $this->assign('type','problem'); - return $this->fetch('panel/problem'); - } - - public function contest() - { - $this->assign('type','contest'); - return $this->fetch('panel/contest'); - } - - public function article(){ - $this->assign('type','article'); - return $this->fetch('panel/article'); - } -} \ No newline at end of file diff --git a/back_end/application/index/controller/Problem.php b/back_end/application/index/controller/Problem.php deleted file mode 100644 index dad10767d..000000000 --- a/back_end/application/index/controller/Problem.php +++ /dev/null @@ -1,42 +0,0 @@ -python3 = '/Users/wdhhdzyhb/PycharmProjects/DoTA2Analysis/venv/bin/python3'; - } - - /** - * 构建题目 - */ - public function build() - { - //构建题目 - $command = $this->python3 . "./final_judge"; - $command .= "--problem ".""; - $command .= "--dest ".""; - $command .= "--action build"; - exec($command,$str); - } - - /** - * 检查题目 - */ - public function check() - { - //检查题目 - $command = $this->python3 . "./final_judge"; - $command .= "--problem ".""; - $command .= "--action check"; - exec($command,$str); - } -} \ No newline at end of file diff --git a/back_end/application/index/controller/Register.php b/back_end/application/index/controller/Register.php deleted file mode 100644 index 75196919f..000000000 --- a/back_end/application/index/controller/Register.php +++ /dev/null @@ -1,96 +0,0 @@ -checkToken(input('post.token'))!==true) - { - $ret = array('errCode'=>403,'errMsg'=>'token error','data'=>null); - return json($ret); - } - } - - /** - * 用户注册 - * TODO 重构 with UserModel - * @return \think\response\Json - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\ModelNotFoundException - * @throws \think\exception\DbException - */ - public function registe() - { - $rcode = input('post.rcode'); - $password = input('post.password'); - $repassword = input('post.repassword'); - if($repassword!=$password) - { - $ret = array('errCode'=>102,'errMsg'=>'两次密码不相同','data'=>null); - return json($ret); - } - $data = array( - 'account' => input('post.account'), - 'password' => md5(base64_encode($password)), - 'mail' => input('post.mail'), - 'phone' => input('post.phone'), - 'name' => input('post.name'), - 'gender' => input('post.gender'), - 'joinTime' => date("Y-m-d h:i:s",time()), - 'type' => $this->checkRcode($rcode)?0:1, - ); - if($this->validate($data,'app\index\validate\UserValidate.register')) { - unset($data['token']); - $userId = Db('user')->insertGetId($data); - if ($userId) { - $ret = array('errCode' => 0, 'errMsg' => 'OK', 'data' => null); - return json($ret); - }else{ - $ret = array('errCode' => 102, 'errMsg' => '注册失败', 'data' => null); - return json($ret); - } - }else{ - $ret = array('errCode' => 102, 'errMsg' => '表单信息错误', 'data' => null); - return json($ret); - } - } - - /** - * 批量产生邀请码 - * @param $num - * @return \think\response\Json - * @throws \Exception - */ - public function newRcode($num) - { - if($this->checkUserType(session('userId'))<=1) - { - $ret = array('errCode'=>403,'errMsg'=>'没有操作权限','data'=>null); - return json($ret); - } - - $i=1; - while($i<=$num) - { - $rcode = bin2hex(random_bytes(8)); - $result = Db('rcode')->insert([ - 'code'=>$rcode, - 'isUsed'=>false - ]); - if($result)$i++; - } - - $ret = array('errCode'=>0,'errMsg'=>'OK','data'=>null); - return json($ret); - } -} \ No newline at end of file diff --git a/back_end/application/index/controller/Swoole.php b/back_end/application/index/controller/Swoole.php deleted file mode 100644 index 3c03cd5e3..000000000 --- a/back_end/application/index/controller/Swoole.php +++ /dev/null @@ -1,29 +0,0 @@ -ws = new swoole_websocket_server("0.0.0.0",8812); - - $this->ws->set( - [ - 'worker_num' => 2, - 'task_worker_num' => 2, - ] - ); - - $this->ws->on("open",[$this, 'onOpen']); - $this->ws->on("message",[$this, 'onMessage']); - } -} \ No newline at end of file diff --git a/back_end/application/index/controller/Token.php b/back_end/application/index/controller/Token.php deleted file mode 100644 index 47f1d6d69..000000000 --- a/back_end/application/index/controller/Token.php +++ /dev/null @@ -1,22 +0,0 @@ -checkToken(input('post.token'))!==true) - { - $ret = array('errCode'=>403,'errMsg'=>'token error','data'=>null); - return json($ret); - } - } - - public function starsb() - { - if($this->checkUserType(session('userId'))<=1) - { - $ret = array('errCode'=>403,'errMsg'=>'没有操作权限','data'=>null); - return json($ret); - } - - $cardNo = input('post.cardNo'); - try { - Db::name('sign')->where('cardNo', $cardNo)->update(['star' => 1]); - } catch (Exception $e) { - } - } - - /** - * 更新个人资料 - * @param $userId - * @param $mail - * @param $phone - * @param $name - * @param $gender - * @param $desc - * @param $class - * @return \think\response\Json - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\ModelNotFoundException - * @throws \think\exception\DbException - */ - public function changeInfo($userId,$mail,$phone,$name,$gender,$desc,$class) - { - if(session('userId')!=$userId) - { - $ret = array('errCode'=>403,'errMsg'=>'没有操作权限','data'=>null); - return json($ret); - } - - $userInfo = Db('user')->where('userId',$userId)->find(); - - $info = json(array('desc'=>$desc,'class'=>$class)); - - $data = array(); - if($mail!=$userInfo['mail'])$data['mail']=$mail; - if($phone!=$userInfo['phone'])$data['phone']=$phone; - if($name!=$userInfo['name'])$data['name']=$name; - if($gender!=$userInfo['gender'])$data['gender']=$gender; - if($info!=$userInfo['info'])$data['info']=$info; - - $result = $this->validate($data,'app\index\validate\UserValidate.change'); - if($result !== true) - { - $ret = array('errCode' => 102, 'errMsg' => '表单数据格式有误', 'data' => $result); - return json($ret); - } - - $result = Db('user')->where('userId',$userId)->setField($data); - if($result) - { - $ret = array('errCode' => 0, 'errMsg' => 'OK', 'data' => null); - }else{ - $ret = array('errCode' => 102, 'errMsg' => '更新个人信息失败', 'data' => null); - } - return json($ret); - } - - /** - * 更改用户身份级别与在役状态 - * @param $userId - * @param $type - * @return \think\response\Json - */ - public function changeStatus() - { - if($this->checkUserType(session('userId'))<=1) - { - $ret = array('errCode'=>403,'errMsg'=>'没有操作权限','data'=>null); - return json($ret); - } - - $userId = input('post.userId'); - $type = input('post.type'); - $status = input('post.status'); - $star = input('post.star'); - - $user = new UserModel(); - $result = $user->changeInfo($userId,'userType',$type); - $result &= $user->changeInfo($userId,'userStatus',$status); - $result &= $user->changeInfo($userId,'star',$star); - - if(!$result) - { - $ret = array('errCode'=>102,'errMsg'=>'修改失败','data'=>null); - return json($ret); - }else { - $time = date("Y-m-d H:i:s",time()); - $sessionuid = session('userId'); - Log::info("Opt {$time} [{$sessionuid}] Change User $userId"); - $ret = array('errCode' => 0, 'errMsg' => 'OK', 'data' => null); - return json($ret); - } - } - - /** - * 更改密码 - * @return \think\response\Json - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\ModelNotFoundException - * @throws \think\exception\DbException - */ - public function changePassword() - { - $userId = input('post.userId'); - - if(session('userId')!=$userId) - { - $ret = array('errCode'=>403,'errMsg'=>'没有操作权限','data'=>null); - return json($ret); - } - - $oriPassword = input('post.oriPassword'); - $newPassword = input('post.newPassword'); - $rePassword = input('post.rePassword'); - - $check = Db('user')->where(array('userId'=>$userId,'password'=>md5(base64_encode($oriPassword))))->find(); - if($check) - { - if($newPassword!=$rePassword) - { - $ret = array('errCode'=>102,'errMsg'=>'两次密码不一致','data'=>null); - return json($ret); - }else{ - $result = Db('user')->where('userId',$userId)->setField('password',md5(base64_encode($newPassword))); - if(!$result) - { - $ret = array('errCode'=>102,'errMsg'=>'新密码与旧密码不能相同','data'=>null); - return json($ret); - } - } - }else{ - $ret = array('errCode'=>102,'errMsg'=>'原密码错误','data'=>null); - return json($ret); - } - $ret = array('errCode' => 0, 'errMsg' => 'OK', 'data' => null); - return json($ret); - } - - /** - * 删除成员(仅有非正式成员可以删除) - * @param $userId - * @return \think\response\Json - * @throws \think\Exception - * @throws \think\exception\PDOException - */ - public function deleteUser($userId) - { - if($this->checkUserType(session('userId'))<=1) - { - $ret = array('errCode'=>403,'errMsg'=>'没有操作权限','data'=>null); - return json($ret); - } - - if($this->checkUserType($userId)>=1) - { - $ret = array('errCode'=>102,'errMsg'=>'管理员与正式成员无法删除,请使用数据库','data'=>null); - return json($ret); - }else{ - $result = Db('user')->where('userId',$userId)->delete(); - if($result) - { - $time = date("Y-m-d H:i:s",time()); - $sessionuid = session('userId'); - Log::info("Opt {$time} [{$sessionuid}] Delete User $userId"); - }else{ - $ret = array('errCode'=>102,'errMsg'=>'用户不存在','data'=>null); - return json($ret); - } - } - $ret = array('errCode' => 0, 'errMsg' => 'OK', 'data' => null); - return json($ret); - } - - public function adminAddUser() - { - - } -} \ No newline at end of file diff --git a/back_end/application/index/controller/UserValidate.php b/back_end/application/index/controller/UserValidate.php deleted file mode 100644 index a243256ec..000000000 --- a/back_end/application/index/controller/UserValidate.php +++ /dev/null @@ -1,27 +0,0 @@ - 'require|max:25|unique:user', - 'mail' => 'email', - 'password' => 'require', - 'phone' => 'mobile', - 'name' => 'cls', - 'gender' => [ 'regex'=>'/^(男|女)$/'], - ]; - - protected $scene = [ - 'register' => ['account','mail','password','phone','name','gender'], - 'login' => ['account','password'], - 'change' => ['mail','phone','name','gender'], - ]; -} \ No newline at end of file diff --git a/back_end/application/index/model/ArticleModel.php b/back_end/application/index/model/ArticleModel.php deleted file mode 100644 index 469d3bb30..000000000 --- a/back_end/application/index/model/ArticleModel.php +++ /dev/null @@ -1,14 +0,0 @@ -insertGetId($data); - if($result) - { - return ['code' => 0, 'msg' => 'Success', 'data' => $result]; - }else{ - return ['code' => -1, 'msg' => $this->getError(), 'data' => $result]; - } - }catch (PDOException $e) { - return ['code' => -1, 'msg' => $e->getMessage(), 'data' => '']; - } - } - - public function changestatus($noticeid,$status) - { - try{ - $info = $this->where('noticeId',$noticeid)->setField('status',$status); - if($info){ - return ['code' => 0, 'msg' => 'Success', 'data' => $info]; - }else{ - return ['code' => -1, 'msg' => $this->getError(), 'data' => $info]; - } - }catch (PDOException $e) { - return ['code' => -1, 'msg' => $e->getMessage(), 'data' => '']; - } - } - - public function deletenotice($noticeid) - { - try{ - $info = $this->where('noticeId',$noticeid)->delete(); - if($info){ - return ['code' => 0, 'msg' => 'Success', 'data' => $info]; - }else{ - return ['code' => -1, 'msg' => $this->getError(), 'data' => $info]; - } - }catch (PDOException $e) { - return ['code' => -1, 'msg' => $e->getMessage(), 'data' => '']; - } - } - - public function getnotcielist($where=null) - { - try{ - if($where==null)$info = $this->select(); - else $info = $this->where($where)->select(); - - if($info){ - foreach ($info as $v) - { - $v['title'] = htmlspecialchars($v['title']); - }//防 X-S-S - return ['code' => 0, 'msg' => 'Success', 'data' => $info]; - }else{ - return ['code' => -1, 'msg' => $this->getError(), 'data' => $info]; - } - }catch (DbException $e) { - return ['code' => -1, 'msg' => $e->getMessage(), 'data' => '']; - } - } -} \ No newline at end of file diff --git a/back_end/application/index/model/UserModel.php b/back_end/application/index/model/UserModel.php deleted file mode 100644 index 3456449ac..000000000 --- a/back_end/application/index/model/UserModel.php +++ /dev/null @@ -1,94 +0,0 @@ -insertGetId($data); - return $id; - }catch (Exception $e){ - return false; - } - return false; - } - - - public function checkAdmin($uid,$passwd) - { - try{ - $info = $this->where([ - 'userNick'=>$uid, - 'userPasswd'=>$passwd - ])->find(); - if($info) - if($info['userType']>=2) - return $info->toArray(); - }catch (DbException $e) { - return false; - } - return false; - } - - public function getinfo($uid) - { - try{ - $info = $this->where([ - 'userId'=>$uid - ])->find(); - if($info)return $info->toArray(); - }catch (DbException $e) { - return false; - } - return false; - } - - public function getuserinfo() - { - try{ - $info = $this->order(['userType'=>'desc','star'=>'desc']) - ->field('userId,userType,userStat,userGender,userMail,userPhone,userName,userNick') - ->select(); - if($info)return $info->toArray(); - }catch (DbException $e) { - return false; - } - return false; - } - - public function changeInfo($userId,$field,$data) - { - try{ - $info = $this->where('userId',$userId); - $result = $info->field($field)->find(); - if(!$result)return false; - if($info->field($field)->find()!=$data) - { - $result = $info->setField($field,$data); - if($result) - { - return true; - }else{ - return false; - } - }else{ - return true; - } - }catch(DbException $e) { - return false; - } - return false; - } -} \ No newline at end of file diff --git a/back_end/application/index/view/extra/jump.html b/back_end/application/index/view/extra/jump.html deleted file mode 100644 index 9620a15c5..000000000 --- a/back_end/application/index/view/extra/jump.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/index/view/panel/article.html b/back_end/application/index/view/panel/article.html deleted file mode 100644 index a5451cd62..000000000 --- a/back_end/application/index/view/panel/article.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Article - {include file='panel/part/head'} - - -
- {include file='panel/part/nav'} -
-
- - -
-
-

- Article Article console -

-
-
- - - {include file='panel/part/footer'} -
-
-
- - \ No newline at end of file diff --git a/back_end/application/index/view/panel/contest.html b/back_end/application/index/view/panel/contest.html deleted file mode 100644 index 1e76b8478..000000000 --- a/back_end/application/index/view/panel/contest.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Contest - {include file='panel/part/head'} - - -
- {include file='panel/part/nav'} -
-
- - -
-
-

- Contest Contest console -

-
-
- - - {include file='panel/part/footer'} -
-
-
- - \ No newline at end of file diff --git a/back_end/application/index/view/panel/index.html b/back_end/application/index/view/panel/index.html deleted file mode 100755 index cbdf3504f..000000000 --- a/back_end/application/index/view/panel/index.html +++ /dev/null @@ -1,293 +0,0 @@ - - - - - Home - {include file='panel/part/head'} - - -
- {include file='panel/part/nav'} -
-
- - -
-
-

- Dashboard Main console -

- - - - - -
-
- - - - -
-
-
-
- - -
-
-

8,457

- Daily Visits -
-
-
-
-
-
- -
- -
-

52,160

- Sales - -
-
-
-
-
-
- - -
-
-

15,823

- Comments - -
-
-
-
-
-
- - -
-
-

36,752

- No. of Visits - -
-
-
-
-
-
-
-
- Area Chart -
-
-
-
-
-
- -
-
-
- Line Chart -
-
-
-
-
-
- -
-
-
-
-
-

Customers

-
82% -
-
-
-
-
-
-
-

Sales

-
55% -
-
-
-
-
-
-
-

Profits

-
84% -
-
-
-
-
-
-
-

No. of Visits

-
46% -
-
-
-
-
-
-
-
-
- Bar Chart Example -
-
-
-
-
-
-
-
-
- Donut Chart Example -
-
-
-
-
-
- -
-
-
- -
-
- -
- -
- -
-
- Responsive Table Example -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
S No.First NameLast NameUser NameEmail ID.
1JohnDoeJohn15482name@site.com
2KimsilaMarriyeKim1425name@site.com
3RossyeNermalRossy1245name@site.com
4RichardOriealRich5685name@site.com
5JacobHielsarJac4587name@site.com
6WrapelDereWrap4585name@site.com
-
-
-
- -
-
- - {include file='panel/part/footer'} -
- -
-
- - \ No newline at end of file diff --git a/back_end/application/index/view/panel/login.html b/back_end/application/index/view/panel/login.html deleted file mode 100644 index f16bd38c4..000000000 --- a/back_end/application/index/view/panel/login.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - Model - {include file='panel/part/head'} - - -
- - -
-
- -
-
-

- Login Admin sign up -

-
-
- -
-
-
- - - - -
- -
-
-
- - {include file='panel/part/footer'} -
-
-
- - \ No newline at end of file diff --git a/back_end/application/index/view/panel/model.html b/back_end/application/index/view/panel/model.html deleted file mode 100644 index 462238f97..000000000 --- a/back_end/application/index/view/panel/model.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Model - {include file='panel/part/head'} - - -
- {include file='panel/part/nav'} -
-
- - -
-
-

- Model Summary of your App -

-
-
- - - {include file='panel/part/footer'} -
-
-
- - \ No newline at end of file diff --git a/back_end/application/index/view/panel/notice.html b/back_end/application/index/view/panel/notice.html deleted file mode 100644 index b94adb240..000000000 --- a/back_end/application/index/view/panel/notice.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - Notice - {include file='panel/part/head'} - - -
- {include file='panel/part/nav'} -
-
- - -
-
-

- Notice Notice console -

-
-
- -
-
-
-
- Add new notice -
-
-
- - - - - - -
- -
-
-
-
- -
-
-
- Change notice -
-
-
- - - - -
- - -

- -
-
-
-
-
- -
-
- -
-
- Notice Table -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - {volist name="list" id="v"} - {if $v.num % 2 == 0} - - {else /} - - {/if} - - - - - - - - {/volist} - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
- -
-
- - {include file='panel/part/footer'} -
-
-
- - \ No newline at end of file diff --git a/back_end/application/index/view/panel/part/footer.html b/back_end/application/index/view/panel/part/footer.html deleted file mode 100644 index 7de38864a..000000000 --- a/back_end/application/index/view/panel/part/footer.html +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/back_end/application/index/view/panel/part/head.html b/back_end/application/index/view/panel/part/head.html deleted file mode 100644 index c0558ad76..000000000 --- a/back_end/application/index/view/panel/part/head.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/index/view/panel/part/nav.html b/back_end/application/index/view/panel/part/nav.html deleted file mode 100644 index 3fd217adf..000000000 --- a/back_end/application/index/view/panel/part/nav.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - \ No newline at end of file diff --git a/back_end/application/index/view/panel/problem.html b/back_end/application/index/view/panel/problem.html deleted file mode 100644 index ceee9f5e4..000000000 --- a/back_end/application/index/view/panel/problem.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Problem - {include file='panel/part/head'} - - -
- {include file='panel/part/nav'} -
-
- - -
-
-

- Problem Problem console -

-
-
- - - {include file='panel/part/footer'} -
-
-
- - \ No newline at end of file diff --git a/back_end/application/index/view/panel/recruit.html b/back_end/application/index/view/panel/recruit.html deleted file mode 100644 index 9b530dfb1..000000000 --- a/back_end/application/index/view/panel/recruit.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - Recruit - {include file='panel/part/head'} - - -
- {include file='panel/part/nav'} -
-
- - -
-
-

- Recruit Applying for Recruit -

-
-
- -
-
-
-
- Star somebody -
-
-
- - -
- -
-
-
-
- -
-
-
- Sign in for someone -
-
- -
- - -
- -
-
-
-
- -
-
-
- Danger zoom -
-
- - -
- - -
-
-
-
- -
-
- -
-
- Recruit Table -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - {volist name="list" id="v" key="k"} - {if $k % 2 == 0} - - {else /} - - {/if} - - - - - - - - - - - - {/volist} - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
- -
-
- - {include file='panel/part/footer'} -
-
-
- - \ No newline at end of file diff --git a/back_end/application/index/view/panel/user.html b/back_end/application/index/view/panel/user.html deleted file mode 100644 index 45299ced6..000000000 --- a/back_end/application/index/view/panel/user.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - - User - {include file='panel/part/head'} - - -
- {include file='panel/part/nav'} -
-
- - -
-
-

- User User console -

-
-
- -
-
-
-
- Add new user -
-
-
-
-
- - -
-
- - -
-
- - - - -
-
- - -
-
- - -
-
-
-
- - -
-
- -
- -
-
-
-
-
-
- -
-
-
- Change userInfo -
-
-
- - - - - - - - - -
- -
-
-
-
- -
-
-
- Danger Zoom -
-
-
-
-
- - -
-
- -
- -
-
-
-
-
-
-
- -
-
- -
-
- User Table -
-
-
-
-
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - {volist name="list" id="v" key="k"} - {if $k % 2 == 0} - - {else /} - - {/if} - - - - - - - - - - {/volist} - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
- -
-
- - {include file='panel/part/footer'} -
-
-
- - \ No newline at end of file diff --git a/back_end/application/oj/config/app.php b/back_end/application/oj/config/app.php deleted file mode 100644 index cfe43d9f3..000000000 --- a/back_end/application/oj/config/app.php +++ /dev/null @@ -1,142 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 应用设置 -// +---------------------------------------------------------------------- - -return [ - // 应用名称 - 'app_name' => '', - // 应用地址 - 'app_host' => '', - // 应用调试模式 - 'app_debug' => true, - // 应用Trace - 'app_trace' => false, - // 是否支持多模块 - 'app_multi_module' => true, - // 入口自动绑定模块 - 'auto_bind_module' => false, - // 注册的根命名空间 - 'root_namespace' => [], - // 默认输出类型 - 'default_return_type' => 'html', - // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', - // 默认JSONP格式返回的处理方法 - 'default_jsonp_handler' => 'jsonpReturn', - // 默认JSONP处理方法 - 'var_jsonp_handler' => 'callback', - // 默认时区 - 'default_timezone' => 'Asia/Shanghai', - // 是否开启多语言 - 'lang_switch_on' => false, - // 默认全局过滤方法 用逗号分隔多个 - 'default_filter' => '', - // 默认语言 - 'default_lang' => 'zh-cn', - // 应用类库后缀 - 'class_suffix' => false, - // 控制器类后缀 - 'controller_suffix' => false, - - // +---------------------------------------------------------------------- - // | 模块设置 - // +---------------------------------------------------------------------- - - // 默认模块名 - 'default_module' => 'index', - // 禁止访问模块 - 'deny_module_list' => ['common'], - // 默认控制器名 - 'default_controller' => 'Index', - // 默认操作名 - 'default_action' => 'index', - // 默认验证器 - 'default_validate' => '', - // 默认的空模块名 - 'empty_module' => '', - // 默认的空控制器名 - 'empty_controller' => 'Error', - // 操作方法前缀 - 'use_action_prefix' => false, - // 操作方法后缀 - 'action_suffix' => '', - // 自动搜索控制器 - 'controller_auto_search' => false, - - // +---------------------------------------------------------------------- - // | URL设置 - // +---------------------------------------------------------------------- - - // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', - // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], - // pathinfo分隔符 - 'pathinfo_depr' => '/', - // HTTPS代理标识 - 'https_agent_name' => '', - // IP代理获取标识 - 'http_agent_ip' => 'X-REAL-IP', - // URL伪静态后缀 - 'url_html_suffix' => 'html', - // URL普通方式参数 用于自动生成 - 'url_common_param' => false, - // URL参数方式 0 按名称成对解析 1 按顺序解析 - 'url_param_type' => 0, - // 是否开启路由延迟解析 - 'url_lazy_route' => false, - // 是否强制使用路由 - 'url_route_must' => false, - // 合并路由规则 - 'route_rule_merge' => false, - // 路由是否完全匹配 - 'route_complete_match' => false, - // 使用注解路由 - 'route_annotation' => false, - // 域名根,如thinkphp.cn - 'url_domain_root' => '', - // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, - // 默认的访问控制器层 - 'url_controller_layer' => 'controller', - // 表单请求类型伪装变量 - 'var_method' => '_method', - // 表单ajax伪装变量 - 'var_ajax' => '_ajax', - // 表单pjax伪装变量 - 'var_pjax' => '_pjax', - // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, - // 请求缓存有效期 - 'request_cache_expire' => null, - // 全局请求缓存排除规则 - 'request_cache_except' => [], - - // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', -// 'dispatch_success_tmpl' => Env::get('app_path') . 'index/view/extra/jump.html', -// 'dispatch_error_tmpl' => Env::get('app_path') . 'index/view/extra/jump.html', - 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - - // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', - - // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', - // 显示错误信息 - 'show_error_msg' => false, - // 异常处理handle类 留空使用 \think\exception\Handle - 'exception_handle' => '', - -]; diff --git a/back_end/application/oj/config/cache.php b/back_end/application/oj/config/cache.php deleted file mode 100644 index 4579e217d..000000000 --- a/back_end/application/oj/config/cache.php +++ /dev/null @@ -1,37 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 缓存设置 -// +---------------------------------------------------------------------- - -return [ - // 缓存配置为复合类型 - 'type' => 'complex', - 'default' => [ - 'type' => 'file', - // 全局缓存有效期(0为永久有效) - 'expire'=> 5, - // 缓存前缀 - 'prefix'=> 'think', - // 缓存目录 - 'path' => '../runtime/cache/', - ], - 'redis' => [ - 'type' => 'redis', - 'host' => '172.17.0.1', - // 全局缓存有效期(0为永久有效) - 'expire'=> 5, - // 缓存前缀 - 'prefix'=> 'think', - ], - // 添加更多的缓存类型设置 -]; diff --git a/back_end/application/oj/config/console.php b/back_end/application/oj/config/console.php deleted file mode 100644 index b0f9165ac..000000000 --- a/back_end/application/oj/config/console.php +++ /dev/null @@ -1,19 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 控制台配置 -// +---------------------------------------------------------------------- -return [ - 'name' => 'Think Console', - 'version' => '0.1', - 'user' => null, -]; diff --git a/back_end/application/oj/config/cookie.php b/back_end/application/oj/config/cookie.php deleted file mode 100644 index 1de07082a..000000000 --- a/back_end/application/oj/config/cookie.php +++ /dev/null @@ -1,30 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | Cookie设置 -// +---------------------------------------------------------------------- -return [ - // cookie 名称前缀 - 'prefix' => '', - // cookie 保存时间 - 'expire' => 0, - // cookie 保存路径 - 'path' => '/', - // cookie 有效域名 - 'domain' => '', - // cookie 启用安全传输 - 'secure' => false, - // httponly设置 - 'httponly' => '', - // 是否使用 setcookie - 'setcookie' => true, -]; diff --git a/back_end/application/oj/config/database.php b/back_end/application/oj/config/database.php deleted file mode 100644 index b54c735dc..000000000 --- a/back_end/application/oj/config/database.php +++ /dev/null @@ -1,63 +0,0 @@ - -// +---------------------------------------------------------------------- - -return [ - // 数据库类型 - 'type' => 'mysql', - // 服务器地址 - 'hostname' => '127.0.0.1', - // 数据库名 - 'database' => 'online_judge', - // 用户名 - 'username' => 'root', - // 密码 - 'password' => '', - // 端口 - 'hostport' => '3306', - // 连接dsn - 'dsn' => '', - // 数据库连接参数 - 'params' => [], - // 数据库编码默认采用utf8 - 'charset' => 'utf8', - // 数据库表前缀 - 'prefix' => '', - // 数据库调试模式 - 'debug' => true, - // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, - // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, - // 读写分离后 主服务器数量 - 'master_num' => 1, - // 指定从服务器序号 - 'slave_no' => '', - // 自动读取主库数据 - 'read_master' => false, - // 是否严格检查字段是否存在 - 'fields_strict' => true, - // 数据集返回类型 - 'resultset_type' => 'array', - // 自动写入时间戳字段 - 'auto_timestamp' => false, - // 时间字段取出后的默认时间格式 - 'datetime_format' => 'Y-m-d H:i:s', - // 是否需要进行SQL性能分析 - 'sql_explain' => false, - // Builder类 - 'builder' => '', - // Query类 - 'query' => '\\think\\db\\Query', - // 是否需要断线重连 - 'break_reconnect' => false, - // 断线标识字符串 - 'break_match_str' => [], -]; diff --git a/back_end/application/oj/config/log.php b/back_end/application/oj/config/log.php deleted file mode 100644 index b3d87b4a9..000000000 --- a/back_end/application/oj/config/log.php +++ /dev/null @@ -1,30 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 日志设置 -// +---------------------------------------------------------------------- -return [ - // 日志记录方式,内置 file socket 支持扩展 - 'type' => 'File', - // 日志保存目录 - 'path' => '', - // 日志记录级别 - 'level' => [], - // 单文件日志写入 - 'single' => false, - // 独立日志级别 - 'apart_level' => [], - // 最大日志文件数量 - 'max_files' => 0, - // 是否关闭日志写入 - 'close' => false, -]; diff --git a/back_end/application/oj/config/session.php b/back_end/application/oj/config/session.php deleted file mode 100644 index 1d7b6c60f..000000000 --- a/back_end/application/oj/config/session.php +++ /dev/null @@ -1,26 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 会话设置 -// +---------------------------------------------------------------------- - -return [ - 'id' => '', - // SESSION_ID的提交变量,解决flash上传跨域 - 'var_session_id' => '', - // SESSION 前缀 - 'prefix' => 'think', - // 驱动方式 支持redis memcache memcached - 'type' => '', - // 是否自动开启 SESSION - 'auto_start' => true, -]; diff --git a/back_end/application/oj/config/template.php b/back_end/application/oj/config/template.php deleted file mode 100644 index 299bd6f43..000000000 --- a/back_end/application/oj/config/template.php +++ /dev/null @@ -1,35 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 模板设置 -// +---------------------------------------------------------------------- - -return [ - // 模板引擎类型 支持 php think 支持扩展 - 'type' => 'Think', - // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 - 'auto_rule' => 1, - // 模板路径 - 'view_path' => '', - // 模板后缀 - 'view_suffix' => 'html', - // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, - // 模板引擎普通标签开始标记 - 'tpl_begin' => '{', - // 模板引擎普通标签结束标记 - 'tpl_end' => '}', - // 标签库标签开始标记 - 'taglib_begin' => '{', - // 标签库标签结束标记 - 'taglib_end' => '}', -]; diff --git a/back_end/application/oj/config/trace.php b/back_end/application/oj/config/trace.php deleted file mode 100644 index 425d30148..000000000 --- a/back_end/application/oj/config/trace.php +++ /dev/null @@ -1,18 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | Trace设置 开启 app_trace 后 有效 -// +---------------------------------------------------------------------- -return [ - // 内置Html Console 支持扩展 - 'type' => 'Html', -]; diff --git a/back_end/application/oj/controller/Base.php b/back_end/application/oj/controller/Base.php deleted file mode 100644 index 53e0937f2..000000000 --- a/back_end/application/oj/controller/Base.php +++ /dev/null @@ -1,23 +0,0 @@ -redirect('http://xxx.xxx.xxx/'); -// } - } -} \ No newline at end of file diff --git a/back_end/application/oj/controller/Contest.php b/back_end/application/oj/controller/Contest.php deleted file mode 100644 index 0233adeac..000000000 --- a/back_end/application/oj/controller/Contest.php +++ /dev/null @@ -1,168 +0,0 @@ -searchContest(); - // if array then decode columns problems and colors; - if(is_array($resp)){ - foreach ($resp['data'] as &$item){ - $item['problems'] = json_decode($item['problems'], true); - $item['colors'] = json_decode($item['colors'], true); - } - } - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 获取比赛详情 - */ - public function getTheContest() - { - $contest_model = new ContestModel(); - $contest_validate = new ContestValidate(); - $req = input('post.'); - $result = $contest_validate->scene('searchContest1')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $contest_validate->getError(), ''); - } - $resp = $contest_model->searchContest($req['contest_id']); - // format columns - if(isset($resp['data']['problems'])){ - $resp['data']['problems'] = json_decode($resp['data']['problems'], true); - } - if(isset($resp['data']['colors'])){ - $resp['data']['colors'] = json_decode($resp['data']['colors'], true); - } - if(isset($resp['data']['prize'])){ - $resp['data']['prize'] = json_decode($resp['data']['prize'], true); - } - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 搜索比赛 - */ - public function searchContest() - { - $contest_model = new ContestModel(); - $contest_validate = new ContestValidate(); - $req = input('post.'); - $result = $contest_validate->scene('searchContest')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $contest_validate->getError(), ''); - } - $resp = $contest_model->searchContest(0, $req['contest_name']); - // if array then decode columns problems and colors; - if(is_array($resp['data'])){ - foreach ($resp['data'] as &$item){ - $item['problems'] = json_decode($item['problems'], true); - $item['colors'] = json_decode($item['colors'], true); - } - } - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 加入比赛 - */ - public function joinContest() - { - $contest_user_model = new ContestUserModel(); - $contest_model = new ContestModel(); - $user_group_model = new UsergroupModel(); - $contest_validate = new ContestValidate(); - // join - $req = input('post.'); - $result = $contest_validate->scene('searchContest1')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $contest_validate->getError(), ''); - } - // check login - $user_id = Session::get('user_id'); - if (empty($user_id)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - //judge contest exists or not - $contest_id = $req['contest_id']; - $resp = $contest_model->searchContest($contest_id); - if($resp['code'] !== CODE_SUCCESS){ - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - $group_id = $resp['data']['group_id']; - if($group_id !== 0){ - $resp = $user_group_model->searchRelation($group_id, $user_id); - if($resp['code'] !== CODE_SUCCESS){ - return apiReturn($resp['code'], '你不在该团队内', ''); - } - } - // judge join info - $resp = $contest_user_model->searchUser($contest_id, $user_id); - if($resp['code'] === CODE_ERROR){ - $resp = $contest_user_model->addInfo($contest_id, $user_id); - } - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 检查参加比赛状态 - */ - public function checkContest() - { - $contest_user_model = new ContestUserModel(); - $contest_validate = new ContestValidate(); - $req = input('post.'); - $result = $contest_validate->scene('searchContest1')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $contest_validate->getError(), ''); - } - // check login - $user_id = Session::get('user_id'); - if (empty($user_id)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - //judge join info - $contest_id = $req['contest_id']; - $resp = $contest_user_model->searchUser($contest_id, $user_id); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function getUserContest() - { - $contest_user_model = new ContestUserModel(); - // check login - $user_id = Session::get('user_id'); - if (empty($user_id)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - // get the user all contests info - $resp = $contest_user_model->searchUserContest($user_id); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - -} \ No newline at end of file diff --git a/back_end/application/oj/controller/Discuss.php b/back_end/application/oj/controller/Discuss.php deleted file mode 100644 index f2a4f4ef5..000000000 --- a/back_end/application/oj/controller/Discuss.php +++ /dev/null @@ -1,184 +0,0 @@ -scene('add_discuss')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $discuss_validate->getError(), ''); - } - - /** - * add discuss - * if the user is administrator, the discuss is a notice - */ - $identity = Session::get('identity'); - $stauts = 0; - if($identity === ADMINISTRATOR){ - $stauts = 8; // notice status equals 8 - } - $data = array( - 'contest_id' => isset($req['contest_id']) ? $req['contest_id'] : 0, - 'problem_id' => $req['problem_id'], - 'user_id' => $user_id, - 'content' => $req['content'], - 'title' => $req['title'], - 'status' => $stauts - ); - $resp = $discuss_model->add_discuss($data); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function add_reply() - { - $reply_model = new ReplyModel(); - $discuss_model = new DiscussModel(); - $reply_validate = new ReplyValidate(); - $req = input('post.'); - - // check login - $user_id = Session::get('user_id'); - if (empty($user_id)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - $result = $reply_validate->scene('add_reply')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $reply_validate->getError(), ''); - } - - /** - * judge identity - * if the user is administrator, this discuss will be changed status - */ - $identity = Session::get('identity'); - if($identity === ADMINISTRATOR){ - $tmp = $discuss_model->get_the_discuss($req['id']); - if($tmp['code'] !== CODE_SUCCESS){ - return apiReturn($tmp['code'], $tmp['msg'], $tmp['data']); - } - $status = 1; - if($tmp['data']['status'] == 8){ - $status = 8; - } - $data = array( - 'id' => $req['id'], - 'status' => $status, - ); - $discuss_model->update_discuss($data); - } - $data = array( - 'discuss_id' => $req['id'], - 'user_id' => $user_id, - 'content' => $req['content'], - ); - $resp = $reply_model->add_reply($data); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function getAllTopic() - { - $discuss_model = new DiscussModel(); - // TODO 上redis - $req = input('post.'); - $resp = $discuss_model->get_all_topic(isset($req['contest']) ? 1 : 0, isset($req['page']) ? $req['page'] : 0); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function getAllDiscuss() - { - // TODO 上redis - $discuss_model = new DiscussModel(); - - // get all discuss - $req = input('post.'); - if(!isset($req['contest_id']) && !isset($req['problem_id'])){ - return apiReturn(CODE_ERROR, '未填写id', ''); - } - - $resp = $discuss_model->get_all_discuss(isset($req['contest_id']) ? $req['contest_id'] : 0, - isset($req['problem_id']) ? $req['problem_id'] : 0, - isset($req['page']) ? $req['page'] : 0); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function getTheDiscuss() - { - $discuss_model = new DiscussModel(); - $reply_model = new ReplyModel(); - $req = input('post.'); - if(!isset($req['discuss_id'])){ - return apiReturn(CODE_ERROR, '未填写讨论id', ''); - } - // get discuss and it's replies - $resp = $discuss_model->get_the_discuss($req['discuss_id']); - if(empty($resp['data'])){ - return apiReturn(CODE_ERROR, '没有这个讨论', ''); - } - $data['discuss'] = $resp['data'];// discuss - $resp = $reply_model->get_the_discuss($req['discuss_id'], isset($req['page']) ? $req['page'] : 0); - $data['reply'] = $resp['data'];// reply - - return apiReturn($resp['code'], $resp['msg'], $data); - } - - public function getUserDiscuss() - { - $discuss_model = new DiscussModel(); - $req = input('post.'); - - // check login - $user_id = Session::get('user_id'); - if (empty($user_id)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - if(!isset($req['contest_id'])){ - return apiReturn(CODE_ERROR, '未填写比赛id', ''); - } - $contest_id = $req['contest_id']; - - // check this user authority - $info = $this->checkContest($contest_id, $user_id); - if($info['code'] !== CODE_SUCCESS){ - return apiReturn($info['code'], $info['msg'], $info['data']); - } - $resp = $discuss_model->get_user_discuss($user_id, $contest_id, isset($req['page']) ? $req['page'] : 0); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 检查参加比赛状态 - */ - private function checkContest($contest_id, $user_id) - { - $contest_user_model = new ContestUserModel(); - return $contest_user_model->searchUser($contest_id, $user_id); - } -} \ No newline at end of file diff --git a/back_end/application/oj/controller/Feedback.php b/back_end/application/oj/controller/Feedback.php deleted file mode 100644 index bc12538bf..000000000 --- a/back_end/application/oj/controller/Feedback.php +++ /dev/null @@ -1,75 +0,0 @@ -scene('add_feedback')->check($data); - if ($rel !== VALIDATE_PASS) { - return apiReturn(CODE_PARAM_ERROR, $add_feedback_validate->getError(), ''); - } - // add - $img = []; - if(isset($data['img'])){ - $img = $data['img']; - if(!is_array($img)){ - return apiReturn(CODE_ERROR, '图片url格式不正确', ''); - } - } - $add_data = array( - 'title' => $data['title'], - 'content' => $data['content'], - 'user_id' => $user_id, - 'img_url' => json_encode($img), - ); - $add_model = new FeedbackModel(); - $resp = $add_model->add_feedback($add_data); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function get_code() - { - $appcode = 'fyQsFidmKNJknSzqGOoezUslGFX7HJ54q2rLytgsZkA2XPO49pAlY9B5mLdSKcDJ'; - $saltstring = 'fuckjwc_token123'; - $timestamp = (string)time(); - $nonce = $this->rand(); - $resp['access_token'] = md5(substr($appcode, 0, 32).substr($timestamp, 0, strlen($timestamp) - 4) - .substr($appcode, 32, 32).$nonce.$saltstring); - $resp['nonce'] = $nonce; - return apiReturn(CODE_SUCCESS, '成功', $resp); - } - public function rand() - { - $str = ''; - for($i = 0; $i < 16; $i++){ - $str .= chr(mt_rand(97, 122)); - } - return $str; - } -} \ No newline at end of file diff --git a/back_end/application/oj/controller/Group.php b/back_end/application/oj/controller/Group.php deleted file mode 100644 index cae216efa..000000000 --- a/back_end/application/oj/controller/Group.php +++ /dev/null @@ -1,342 +0,0 @@ -get_all_group(isset($req['page']) ? $req['page'] : 0); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 获取一个用户加入的所有团队 - */ - public function user_get_all_group() - { - $usergroup_model = new UsergroupModel(); - $session = Session::get('user_id'); - if (empty($session)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - $req = input('post.'); - $resp = $usergroup_model->find_group($session, isset($req['page']) ? $req['page'] : 0); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 获取某个团队的基本信息 - */ - public function get_the_group() - { - $group_validate = new GroupValidate(); - $usergroup_model = new UsergroupModel(); - $group_model = new GroupModel(); - $knowledge_model = new KnowledgeModel(); - - $req = input('post.'); - $result = $group_validate->scene('get_the_group')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $group_validate->getError(), ''); - } - $resp = $usergroup_model->find_user($req['group_id']);// find all users who joined this group - $resp1 = $group_model->get_the_group($req['group_id']);// get this group's info - $user_data = $resp['data']; - $group_data = $resp1['data']; - if ($resp['code'] == CODE_SUCCESS) { - for ($i = 0; $i < sizeof($user_data); $i++) { - $user_data[$i]['point'] = $knowledge_model->getUserKnowledgePoint($user_data[$i]['user_id'])['data']; - } - } - return apiReturn($resp['code'], $resp['msg'], array( - 'user' => $user_data, - 'group' => $group_data - )); - } - - /** - * 添加一个团队 - * TODO 限制一个用户可创建团队数目 - */ - public function add_group() - { - $group_validate = new GroupValidate(); - $group_model = new GroupModel(); - - // check login - $session = Session::get('user_id'); - if (empty($session)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - - // add - $req = input('post.'); - $result = $group_validate->scene('add_group')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $group_validate->getError(), ''); - } - $user_id = isset($req['user_id']) ? $req['user_id'] : array(); - if(!is_array($user_id)){ - return apiReturn(CODE_ERROR, '添加用户格式错误', ''); - } - $resp = $group_model->newGroup(array( - 'group_name' => $req['group_name'], - 'avatar' => isset($req['avatar']) ? $req['avatar'] : '', - 'desc' => $req['desc'], - 'join_code' => isset($req['join_code']) ? strlen($req['join_code']) > 16 ? substr($req['join_code'], 0, 16) : $req['join_code'] : '', - 'group_creator' => $session, - ), $user_id); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 加入一个团队 - */ - public function join_group() - { - $group_validate = new GroupValidate(); - $usergroup_model = new UsergroupModel(); - $group_model = new GroupModel(); - $session = Session::get('user_id'); - - // check login - if (empty($session)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - $req = input('post.'); - $result = $group_validate->scene('join_group')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $group_validate->getError(), ''); - } - $join_code = $group_model->get_the_group($req['group_id']); - if($join_code['code'] !== CODE_SUCCESS){ - return apiReturn($join_code['code'], $join_code['msg'], $join_code['data']); - } - if($join_code['data']['join_code'] !== $req['join_code']){ - return apiReturn(CODE_ERROR, '加群码错误', ''); - } - $resp = $usergroup_model->addRelation($req['group_id'], $session, 0); - if(strpos($resp['data'], 'Duplicate entry') !== false){ - $resp['msg'] = '已在群组内'; - $resp['data'] = ''; - } - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 退出团队 - */ - public function out_group() - { - $group_validate = new GroupValidate(); - $usergroup_model = new UsergroupModel(); - - // check login - $session = Session::get('user_id'); - if (empty($session)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - - $req = input('post.'); - $result = $group_validate->scene('out_group')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $group_validate->getError(), ''); - } - $resp = $usergroup_model->deleRelation($req['group_id'], $session['user_id']); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 管理员同意一个用户的加入申请 - */ - public function accept() - { - $group_validate = new GroupValidate(); - $usergroup_model = new UsergroupModel(); - $group_model = new GroupModel(); - - // check login - $session = Session::get('user_id'); - if (empty($session)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - - $req = input('post.'); - $result = $group_validate->scene('accept_group')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $group_validate->getError(), ''); - } - $resp = $group_model->get_the_group($req['group_id']); - if ($resp['code'] !== CODE_SUCCESS) { - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - if ($resp['data']['group_creator'] !== $session['user_id']) {// TODO 团队管理员权限 - return apiReturn(CODE_ERROR, '你没有权限', ''); - } - $resp = $usergroup_model->addRelation($req['group_id'], $req['user_id'], 0); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - - public function addContest() - { - $contest_model = new ContestModel(); - $user_group_model = new UsergroupModel(); - $contest_validate = new ContestValidate(); - - $req = input('post.'); - $result = $contest_validate->scene('addContest')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $contest_validate->getError(), ''); - } - // check login - $user_id = Session::get('user_id'); - if (empty($user_id)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - - $resp = $user_group_model->searchRelation($req['group_id'], $user_id); - if($resp['code'] !== CODE_SUCCESS || $resp['data']['identity'] === MEMBER){ - return apiReturn($resp['code'], '你不是该团队中的管理员', ''); - } - if(isset($req['colors']) && !is_array($req['colors'])){ - return apiReturn(CODE_ERROR, '数据格式错误', ''); - } - if(!isset($req['problems']) && !is_array($req['problems'])){ - return apiReturn(CODE_ERROR, '数据格式错误', ''); - } - foreach ($req['problems'] as $item){ - - } - $resp = $contest_model->newContest(array( - 'contest_name' => $req['contest_name'], - 'begin_time' => $req['begin_time'], - 'end_time' => $req['end_time'], - 'frozen' => $req['frozen'], - 'colors' => json_encode(isset($req['colors']) ? $req['colors'] : array()), - 'problems' => json_encode($req['problems']), - )); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function addGroupProblem() - { - $problem_model = new ProblemModel(); - $user_group_model = new UsergroupModel(); - $group_problem_model = new GroupproblemModel(); - - $req = input('post.'); - - if(!isset($req['problems']) || !is_array($req['problems'])){ - return apiReturn(CODE_ERROR, '未填写题目列表或格式错误',''); - } - if(!isset($req['group_id'])){ - return apiReturn(CODE_ERROR, '未填写团队id',''); - } - - // check login - $user_id = Session::get('user_id'); - if (empty($user_id)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - $group_id = $req['group_id']; - $resp = $user_group_model->searchRelation($group_id, $user_id); - if($resp['code'] !== CODE_SUCCESS || $resp['data']['identity'] === MEMBER){ - return apiReturn(CODE_ERROR, '你不是该团队中的管理员', ''); - } - $flag = true; - $msg = '成功'; - foreach ($req['problems'] as $item){ - $resp = $problem_model->searchProblemById($item); - if($resp['code'] !== CODE_SUCCESS || $resp['data']['status'] !== USING){ - continue; - } - $resp = $group_problem_model->addRelation($group_id, $item); - if($flag && strpos($resp['data'], 'Duplicate entry') !== false){ - $msg = '部分题目添加失败'; - } - } - - return apiReturn($resp['code'], $msg, ''); - } - - public function getAllProblem() - { - $user_group_model = new UsergroupModel(); - $group_problem_model = new GroupproblemModel(); - - $req = input('post.'); - - if(!isset($req['group_id'])){ - return apiReturn(CODE_ERROR, '未填写团队id',''); - } - - // check login - $user_id = Session::get('user_id'); - if (empty($user_id)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - $group_id = $req['group_id']; - $resp = $user_group_model->searchRelation($group_id, $user_id); - if($resp['code'] !== CODE_SUCCESS){ - return apiReturn(CODE_ERROR, '你不是该团队中的成员', ''); - } - - $resp = $group_problem_model->getAllProblem($group_id, isset($req['page']) ? $req['page'] : 0); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function getAllContest() - { - $user_group_model = new UsergroupModel(); - $contest_model = new ContestModel(); - $req = input('post.'); - - if(!isset($req['group_id'])){ - return apiReturn(CODE_ERROR, '未填写团队id',''); - } - - // check login - $user_id = Session::get('user_id'); - if (empty($user_id)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - $group_id = $req['group_id']; - $resp = $user_group_model->searchRelation($group_id, $user_id); - if($resp['code'] !== CODE_SUCCESS){ - return apiReturn(CODE_ERROR, '你不是该团队中的成员', ''); - } - - $resp = $contest_model->getAllGroupContest($group_id, isset($req['page']) ? $req['page'] : 0); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } -} \ No newline at end of file diff --git a/back_end/application/oj/controller/Index.php b/back_end/application/oj/controller/Index.php deleted file mode 100644 index 52e041fb2..000000000 --- a/back_end/application/oj/controller/Index.php +++ /dev/null @@ -1,77 +0,0 @@ -get_all_notice(); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 首页轮播图 - */ - public function rotation() - { - $rotation_model = new RotationModel(); - $resp = $rotation_model->get_all_rotation(); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 首页数据 - */ - public function data() - { - $submitlog_model = new SubmitlogModel(); - $resp = $submitlog_model->get_the_log(); - $data = $submitlog_model->get_all_log(); - $resp['data'][] = $data['data']; - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 首页显示比赛 - * TODO 限制条数 - */ - public function contest() - { - $submit_model = new SubmitModel(); - halt($submit_model->get_all_submit([])); - } - - public function date() - { - - } - - public function all_num() - { - - } - - public function test() - { - var_dump(session('identity')); - } -} \ No newline at end of file diff --git a/back_end/application/oj/controller/Knowledge.php b/back_end/application/oj/controller/Knowledge.php deleted file mode 100644 index c5db2a01c..000000000 --- a/back_end/application/oj/controller/Knowledge.php +++ /dev/null @@ -1,503 +0,0 @@ -getKnowledge(""); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @usage 模糊查询知识点 - * @method get - * @param string knowledge - * @return json - */ - public function getKnowledgeByKey() { - $req = input('post.'); - $knowledgeModel = new KnowledgeModel(); - $knowledge = isset($req['knowledge'])?$req['knowledge']:''; - $resp = $knowledgeModel->getKnowledge($knowledge); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @usage 精确查询知识点 - * @method get - * @param string knowledge - * @return json - */ - public function getSpecificKnowledge() { - $req = input('post.'); - $knowledgeModel = new KnowledgeModel(); - $knowledge = isset($req['knowledge'])?$req['knowledge']:''; - $resp = $knowledgeModel->getSpecificKnowledge($knowledge); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @usage 添加知识点 - * @method post - * @param string knowledge - * @return json - */ - public function addKnowledge() { - $req = input('post.'); - $knowledgeModel = new KnowledgeModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('add_knowledge')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $data = [ - 'name' => $req['knowledge'] - ]; - $resp = $knowledgeModel->addKnowledge($data); - return apiReturn($resp['code'], $resp['msg'], ''); - } - - /** - * @usage 删除知识点 - * @method post - * @param string knowledge - * @return json - */ - public function deleteKnowledge() { - $req = input('post.'); - $knowledgeModel = new KnowledgeModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('delete_knowledge')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $data = [ - 'name' => $req['knowledge'] - ]; - $resp = $knowledgeModel->deleteKnowledge($data); - return apiReturn($resp['code'], $resp['msg'], ''); - } - - /** - * @usage 添加知识点关系 - * @method post - * @param string knowledge - * @param string pre_knowledge - * @param boolean is_core - * @return json - */ - public function addKnowledgeRelation() { - $req = input('post.'); - $knowledgeRelationModel = new KnowledgeRelationModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('add_knowledge_relation')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $data = [ - 'name' => $req['knowledge'], - 'pre_name' => $req['pre_knowledge'], - 'is_core' => isset($req['is_core'])?$req['is_core']:0 - ]; - $resp = $knowledgeRelationModel->addRelation($data); - return apiReturn($resp['code'], $resp['msg'], ''); - } - - /** - * @usage 删除知识点关系 - * @method post - * @param string knowledge - * @param string pre_knowledge - * @return json - */ - public function deleteKnowledgeRelation() { - $req = input('post.'); - $knowledgeRelationModel = new KnowledgeRelationModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('delete_knowledge_relation')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $data = [ - 'name' => $req['knowledge'], - 'pre_name' => $req['pre_knowledge'], - ]; - $resp = $knowledgeRelationModel->deleteRelation($data); - return apiReturn($resp['code'], $resp['msg'], ''); - } - - /** - * @usage 获取前置知识点 - * @method get - * @param string knowledge - * @param boolean core_only - * @return json - */ - public function getPreKnowledge() { - $req = input('post.'); - $knowledgeRelationModel = new KnowledgeRelationModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('get_knowledge')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $knowledge = $req['knowledge']; - $core_only = isset($req['core_only'])?$req['core_only']:0; - $resp = $knowledgeRelationModel->getPreKnowledge($knowledge, $core_only); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @usage 获取后置知识点 - * @method get - * @param string knowledge - * @param boolean core_only - * @return json - */ - public function getAfterKnowledge() { - $req = input('post.'); - $knowledgeRelationModel = new KnowledgeRelationModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('get_knowledge')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $knowledge = $req['knowledge']; - $core_only = isset($req['core_only'])?$req['core_only']:0; - $resp = $knowledgeRelationModel->getAfterKnowledge($knowledge, $core_only); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @usage 切换知识点对为必须 - * @method post - * @param string knowledge - * @param string pre_knowledge - * @return json - */ - public function setKnowledgeRelationCore() { - $req = input('post.'); - $knowledgeRelationModel = new KnowledgeRelationModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('set_knowledge_relation')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $data = [ - 'name' => $req['knowledge'], - 'pre_name' => $req['pre_knowledge'] - ]; - $resp = $knowledgeRelationModel->setCore($data); - return apiReturn($resp['code'], $resp['msg'], ''); - } - - /** - * @usage 切换知识点对为必须 - * @method post - * @param string knowledge - * @param string pre_knowledge - * @return json - */ - public function unsetKnowledgeRelationCore() { - $req = input('post.'); - $knowledgeRelationModel = new KnowledgeRelationModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('set_knowledge_relation')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $data = [ - 'name' => $req['knowledge'], - 'pre_name' => $req['pre_knowledge'] - ]; - $resp = $knowledgeRelationModel->unsetCore($data); - return apiReturn($resp['code'], $resp['msg'], ''); - } - - /** - * @usage 获取知识点的问题列表 - * @method get - * @param string knowledge - * @param boolean core_only - * @return json - */ - public function getProblemByKnowledge() { - $req = input('post.'); - $problemKnowledgeModel = new KnowledgeProblemModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('get_problem_by_knowledge')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $knowledge = $req['knowledge']; - $core_only = isset($req['core_only'])?$req['core_only']:0; - $resp = $problemKnowledgeModel->getProblemByKnowledge($knowledge, $core_only); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @usage 获取问题的知识点列表 - * @method get - * @param string problem - * @param boolean core_only - * @return json - */ - public function getKnowledgeByProblem() { - $req = input('post.'); - $problemKnowledgeModel = new KnowledgeProblemModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('get_knowledge_by_problem')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $problem = $req['problem']; - $core_only = isset($req['core_only'])?$req['core_only']:0; - $resp = $problemKnowledgeModel->getKnowledgeByProblem($problem, $core_only); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @usage 添加问题知识点关系 - * @method post - * @param string problem - * @param string knowledge - * @param boolean is_core - * @return json - */ - public function addProblemKnowledgeRelation() { - $req = input('post.'); - $problemKnowledgeModel = new KnowledgeProblemModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('handle_knowledge_problem_relation')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $data = [ - 'problem_id' => $req['problem'], - 'knowledge' => $req['knowledge'], - 'is_core' => isset($req['is_core'])?$req['is_core']:0 - ]; - $resp = $problemKnowledgeModel->addRelation($data); - return apiReturn($resp['code'], $resp['msg'], ''); - } - - /** - * @usage 删除问题知识点关系 - * @method post - * @param string problem - * @param string knowledge - * @return json - */ - public function deleteProblemKnowledgeRelation() { - $req = input('post.'); - $problemKnowledgeModel = new KnowledgeProblemModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('handle_knowledge_problem_relation')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $data = [ - 'problem_id' => $req['problem'], - 'knowledge' => $req['knowledge'], - ]; - $resp = $problemKnowledgeModel->deleteRelation($data); - return apiReturn($resp['code'], $resp['msg'], ''); - } - - /** - * @usage 设置问题知识点关系为必要 - * @method post - * @param string problem - * @param string knowledge - * @return json - */ - public function setProblemKnowledgeRelationCore() { - $req = input('post.'); - $problemKnowledgeModel = new KnowledgeProblemModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('handle_knowledge_problem_relation')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $data = [ - 'problem_id' => $req['problem'], - 'knowledge' => $req['knowledge'], - ]; - $resp = $problemKnowledgeModel->setCore($data); - return apiReturn($resp['code'], $resp['msg'], ''); - } - - /** - * @usage 设置问题知识点关系为不必要 - * @method post - * @param string problem - * @param string knowledge - * @return json - */ - public function unsetProblemKnowledgeRelationCore() { - $req = input('post.'); - $problemKnowledgeModel = new KnowledgeProblemModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('handle_knowledge_problem_relation')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $data = [ - 'problem_id' => $req['problem'], - 'knowledge' => $req['knowledge'], - ]; - $resp = $problemKnowledgeModel->unsetCore($data); - return apiReturn($resp['code'], $resp['msg'], ''); - } - - /** - * @usage 获取用户所有进行中的知识点 - * @method get - * @param int user_id - * @return json - */ - public function getUserAllDoingKnowledge() { - $req = input('post.'); - $userKnowledgeModel = new KnowledgeUserModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('user_all_knowledge')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $resp = $userKnowledgeModel->getAllDoingKnowledge($req['user_id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @usage 获取用户所有完成的知识点 - * @method get - * @param int user_id - * @return json - */ - public function getUserAllDoneKnowledge() { - $req = input('post.'); - $userKnowledgeModel = new KnowledgeUserModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('user_all_knowledge')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $resp = $userKnowledgeModel->getAllDoneKnowledge($req['user_id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @usage 获取用户某知识点的状态 - * @method get - * @param int user_id - * @param string knowledge - * @return Json - */ - public function getUserKnowledgeStatus() { - $req = input('post.'); - $userKnowledgeModel = new KnowledgeUserModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('user_specific_knowledge')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $resp = $userKnowledgeModel->getKnowledgeStatus($req['user_id'], $req['knowledge']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @usage 添加正在进行的知识点 - * @method post - * @param int user_id - * @param string knowledge - * @return Json - */ - public function addUserDoingKnowledge() { - $req = input('post.'); - $userKnowledgeModel = new KnowledgeUserModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('user_specific_knowledge')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $resp = $userKnowledgeModel->addDoingKnowledge($req['user_id'], $req['knowledge']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @usage 添加完成的知识点 - * @method post - * @param int user_id - * @param string knowledge - * @return Json - */ - public function addUserDoneKnowledge() { - $req = input('post.'); - $userKnowledgeModel = new KnowledgeUserModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('user_specific_knowledge')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $resp = $userKnowledgeModel->addDoneKnowledge($req['user_id'], $req['knowledge']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @usage 获取成就点 - * @method get - * @param int user_id - * @return Json - */ - public function getUserKnowledgePoint() { - $req = input('post.'); - $userKnowledgeModel = new KnowledgeUserModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('user_all_knowledge')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $resp = $userKnowledgeModel->getAllDoneKnowledge($req['user_id']); - $score = 0; - foreach ($resp['data'] as $item) { - $score += $item->score; - } - return apiReturn($resp['code'], $resp['msg'], ['score' => $score]); - } - - /** - * @usage 获取标签 - * @method get - * @param int knowledge_id - * @return Json - */ - public function getAllTag() { - $req = input('post.'); - $knowledgeTagModel = new KnowledgeTagModel(); - $knowledgeValidate = new KnowledgeValidate(); - $result = $knowledgeValidate->scene('knowledge_id')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $knowledgeValidate->getError(), ''); - } - $resp = $knowledgeTagModel->getKnowledgeTag($req['knowledge_id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data'], 200); - } -} \ No newline at end of file diff --git a/back_end/application/oj/controller/Login.php b/back_end/application/oj/controller/Login.php deleted file mode 100644 index 090d64412..000000000 --- a/back_end/application/oj/controller/Login.php +++ /dev/null @@ -1,131 +0,0 @@ -scene('login')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $user_validate->getError(), ''); - } - // 密码加密 - $req['password'] = md5(base64_encode($req['password'])); - // 身份验证 - $result = $user_model->loginCheck($req); - $data = array(); - if ($result['code'] === CODE_SUCCESS) { - // 验证成功,session分配 - $data = array( - 'userId' => $result['data']['user_id'], - 'nick' => $result['data']['nick'], - 'desc' => $result['data']['desc'], - 'avatar' => $result['data']['avatar'], - 'all_problems' => $result['data']['all_problems'] - ); - session('user_id', $result['data']['user_id']); - session('nick', $result['data']['nick']); - session('identity', $result['data']['identity']); - session('data', $data); - } - - return apiReturn($result['code'], $result['msg'], $data); - } - - /** - * 注销 - */ - public function do_logout() - { - session(null); - return apiReturn(CODE_SUCCESS, '注销成功', ''); - } - - /** - * 检测是否登录 - */ - public function checkLogin() { - $req = input('post.'); - if (Session::has('user_id')) { - if(isset($req['user_id'])) { - if($req['user_id']==Session::get('user_id')) { - return apiReturn(CODE_SUCCESS, '已经登陆,且账号相符', ''); - }else{ - return apiReturn(CODE_SUCCESS, '已经登陆,账号不符', Session::get('user_id')); - } - } - return apiReturn(CODE_SUCCESS, '已经登陆', ''); - } - return apiReturn(CODE_ERROR, '未登陆', ''); - } - - /** - * 忘记密码,重设密码操作 - */ - public function forgetPassword() - { - $user_validate = new UserValidate(); - $find_model = new FindPasswordModel(); - $user_model = new UserModel(); - $mail = new Mailer(); - - $req = input('post.'); - $result = $user_validate->scene('forget')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $user_validate->getError(), ''); - } - - // check user email address - $info = $user_model->searchUserByNick($req['nick']); - if ($info['code'] !== CODE_SUCCESS) { - return apiReturn(CODE_ERROR, $info['msg'], ''); - } - if($info['data']['mail'] !== $req['mail']){ - return apiReturn(CODE_ERROR, '邮箱不一致', ''); - } - - // gen code - $code = $find_model->create_token($req['nick']); - if ($code['code'] !== CODE_SUCCESS) { - return apiReturn(CODE_ERROR, '发送失败', $code['data']); - } - - // send mail - $info = $mail->sendMail($info['data']['mail'], $req['nick'], '验证码发送', '本次验证码为' . $code['data'] . '该邮件不需要回复'); - if ($info !== true) { - return apiReturn(CODE_ERROR, '发送失败', ''); - } - - return apiReturn(CODE_SUCCESS, '发送成功', ''); - } -} \ No newline at end of file diff --git a/back_end/application/oj/controller/Notification.php b/back_end/application/oj/controller/Notification.php deleted file mode 100644 index 40ffa3711..000000000 --- a/back_end/application/oj/controller/Notification.php +++ /dev/null @@ -1,50 +0,0 @@ -getNotificationByContest($req['contest_id']); - } else { - $resp = $notificationModel->getPublicNotification(); - } - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * @usage 由ID获取通知 - * @method get - * @param void - * @return json - */ - public function getNotificationByID() { - $req = input('post.'); - $notificationModel = new NotificationModel(); - $notificationValidate = new NotificationValidate(); - $result = $notificationValidate->scene('getNotificationByID')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $notificationValidate->getError(), ''); - } - $resp = $notificationModel->getNotificationByID($req['id']); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - -} \ No newline at end of file diff --git a/back_end/application/oj/controller/Problem.php b/back_end/application/oj/controller/Problem.php deleted file mode 100644 index 1b7af4d0a..000000000 --- a/back_end/application/oj/controller/Problem.php +++ /dev/null @@ -1,150 +0,0 @@ -get_all_problem($page, $user_id); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 展示具体的一个题目内容 - */ - public function displayProblem() - { - $problem_validate = new ProblemValidate(); - $problem_model = new ProblemModel(); - $sample_model = new SampleModel(); - $contest_model = new ContestModel(); - $contest_user_model = new ContestUserModel(); - - $req = input('post.'); - $time = time(); - $result = $problem_validate->scene('displayProblem')->check($req); - if ($result !== VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $problem_validate->getError(), ''); - } - - $user_id = Session::get('user_id'); - $identity = Session::get('identity'); - - /** - * check problem status - * banned: return - * contest: check authority - */ - $resp = $problem_model->searchProblemById($req['problem_id']); - if (empty($resp['data']['status']) || $resp['data']['status'] !== USING) { - if($resp['data']['status'] === CONTEST){ - if (isset($req['contest_id'])) { - // check contest exist or not - $contest_id = $req['contest_id']; - $contest = $contest_model->searchContest($contest_id); - if ($contest['code'] !== CODE_SUCCESS) { - return apiReturn($contest['code'], $contest['msg'], $contest['data']); - } - $problems = json_decode($contest['data']['problems'], false); - if(!in_array($req['problem_id'], $problems,false)){ - return apiReturn(CODE_ERROR,'该题不是比赛试题', ''); - } - // check authority - $info = $contest_user_model->searchUser($contest_id, $user_id); - if ($info['code'] !== CODE_SUCCESS) { - return apiReturn($info['code'], $info['msg'], $info['data']); - } - if ($time < strtotime($contest['data']['begin_time']) && $identity !== ADMINISTRATOR) { - return apiReturn(CODE_ERROR, '比赛未开始', ''); - } - if ($time > strtotime($contest['data']['end_time'])) { - $problem_model->editProblem($req['problem_id'], ['status' => 1]); - } - } else { - return apiReturn(CODE_ERROR, '缺少比赛ID', ''); - } - } else { - return apiReturn($resp['code'], '题目不可用', ''); - } - } - - // get the problem samples - $sample = $sample_model->searchSampleByProblemID($req['problem_id']); - if($sample['code'] !== CODE_SUCCESS){ - return apiReturn($sample['code'], $sample['msg'], ''); - } - $resp['data']['sample'] = $sample['data']; - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 模糊查询题目 - */ - public function searchProblem() - { - // TODO 返回数据格式化,减少返回数据 - $problem_validate = new ProblemValidate(); - $problem_model = new ProblemModel(); - - $req = input('post.'); - $result = $problem_validate->scene('search')->check($req); - if ($result !== VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $problem_validate->getError(), ''); - } - - $resp1 = $problem_model->searchProblemById($req['search']); - $resp2 = $problem_model->searchProblemByTitle($req['search']); - if ($resp1['code'] !== CODE_SUCCESS && $resp2['code'] !== CODE_SUCCESS) { - return apiReturn(CODE_ERROR, '暂无数据', ''); - } - $page_limit = config('wutoj_config.page_limit'); - $page = isset($req['page']) ? $req['page'] : 0; - $resp['data'] = []; - $resp['count'] = 0; - if ($resp1['code'] === CODE_SUCCESS) { - $resp['data'][] = $resp1['data']; - $resp['count'] += 1; - } - if ($resp2['code'] === CODE_SUCCESS) { - $count = count($resp2['data']['data']); - $start = $page * $page_limit - $resp['count']; - $start = $start > 0 ? $start : 0; - $end = $start + $page_limit; - for ($i = $start; $i < $count && $i < $end; $i++) { - $resp['data'][] = $resp2['data']['data'][$i]; - } - $resp['count'] += $count; - } - - return apiReturn(CODE_SUCCESS, '查询成功', $resp); - } - -} \ No newline at end of file diff --git a/back_end/application/oj/controller/Rank.php b/back_end/application/oj/controller/Rank.php deleted file mode 100644 index e55b11f8c..000000000 --- a/back_end/application/oj/controller/Rank.php +++ /dev/null @@ -1,164 +0,0 @@ -user_rank(); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 团队排名 - * TODO 完善排行榜 - */ - public function group_rank() - { - $group_model = new GroupModel(); - $resp = $group_model->group_rank(); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 比赛排名 - */ - public function contest_rank() - { - $submit_model = new SubmitModel(); - $contest_model = new ContestModel(); - $rankCache_model = new OJCacheModel(); - - $req = input('post.'); - if (!isset($req['contest_id'])) { - return apiReturn(CODE_ERROR, '缺少contest字段', ''); - } - - $contest_id = $req['contest_id']; - // 如果有缓存,则直接返回缓存数据,减少服务器负担 - $cache = $rankCache_model->get_rank_cache($contest_id); - if ($cache['code'] === CODE_SUCCESS) { - return apiReturn($cache['code'], $cache['msg'], $cache['data']); - } - - $info = $contest_model->searchContest($contest_id); - if ($info['code'] !== CODE_SUCCESS) { - return apiReturn($info['code'], $info['msg'], $info['data']); - } - - $begin_time = $info['data']['begin_time']; - $end_time = $info['data']['end_time']; - if (time() < $begin_time) { - return apiReturn(CODE_ERROR, '比赛还没开放', ''); - } - - // search limit - $where[] = ['submit_time', '>= time', strtotime($begin_time)]; - $where[] = ['contest_id', '=', $contest_id]; - if ($info['data']['end_time'] < time()) { - $where[] = ['submit_time', '<= time', strtotime($end_time)]; - } else { - $where[] = ['submit_time', '<= time', strtotime($begin_time) - + (strtotime($end_time) - strtotime($begin_time)) * (1 - $info['data']['frozen'])];// 封榜逻辑 - } - $resp = $submit_model->get_all_submit($where); - - // TODO 处理榜单 - $problems = json_decode($info['data']['problems'], true); - $data = $this->handle_rank($resp['data'], $begin_time, $problems); - // 缓存表单数据,失败没有影响 - $cache = $rankCache_model->set_rank_cache($data, $contest_id); - - return apiReturn($resp['code'], $resp['msg'], $data); - } - - public function handle_rank($data, $begin_time, $problems) - { - $rank = []; - $begin_time = strtotime($begin_time); - // 数据清理 - foreach ($data as $item) { - $user_id = $item['user_id']; - $problem_id = array_search($item['problem_id'], $problems, false); - if($problem_id === false){ - continue; - } - $problem_id = chr($problem_id + 65); - if (!isset($rank[$user_id])) { - $rank[$user_id] = ['nick' => $item['nick'], 'penalty' => 0, 'ac_num' => 0]; - } - if (!isset($rank[$user_id][$problem_id])) { - $rank[$user_id][$problem_id] = ['success_time' => '', 'times' => 0]; - } - if (empty($rank[$user_id][$problem_id]['success_time'])) { - if ($item['status'] !== 'AC') { - if($item['status'] !== 'CE'){ - $rank[$user_id][$problem_id]['times']++; - } - } else { - $rank[$user_id][$problem_id]['success_time'] = strtotime($item['submit_time']) - $begin_time; - $rank[$user_id]['penalty'] += strtotime($item['submit_time']) - $begin_time + $rank[$user_id][$problem_id]['times'] * 1200; - $rank[$user_id]['ac_num']++; - } - } - } - $new_rank = []; - // 格式化数据 - foreach ($rank as $key => $item) { - $problem = []; - foreach ($item as $key1 => $value) { - if (is_array($value)) { - $problem[] = [ - 'problem_id' => $key1, - 'success_time' => $value['success_time'], - 'times' => $value['times'], - ]; - } - } - $new_rank[] = [ - 'user_id' => $key, - 'nick' => $item['nick'], - 'penalty' => $item['penalty'], - 'ac_num' => $item['ac_num'], - 'problem_id' => $problem, - ]; - } - // 排序 - // TODO 按照run_id排序 - usort($new_rank, [$this, 'compare_arr']); - return $new_rank; - } - - public function compare_arr($x, $y) - { - if ($x['ac_num'] > $y['ac_num']) { - return -1; - } else if ($x['ac_num'] < $y['ac_num']) { - return 1; - } else { - if ($x['penalty'] < $y['penalty']) { - return -1; - } else { - return 1; - } - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/controller/Register.php b/back_end/application/oj/controller/Register.php deleted file mode 100644 index 3791238d6..000000000 --- a/back_end/application/oj/controller/Register.php +++ /dev/null @@ -1,49 +0,0 @@ -scene('register')->check($req); - if ($result != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $user_validate->getError(), ''); - } - if ($req['password'] !== $req['password_check']) { - return apiReturn(CODE_ERROR, '两次输入密码不一致', ''); - } - - // register - $resp = $user_model->addUser(array( - 'nick' => $req['nick'], - 'password' => md5(base64_encode($req['password'])), - 'avatar' => isset($req['avatar']) ? $req['avatar'] : 'null', - 'realname' => $req['realname'], - 'school' => $req['school'], - 'major' => $req['major'], - 'class' => $req['class'], - 'contact' => $req['contact'], - 'mail' => $req['mail'], - )); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } -} \ No newline at end of file diff --git a/back_end/application/oj/controller/Submit.php b/back_end/application/oj/controller/Submit.php deleted file mode 100644 index 6bea3895f..000000000 --- a/back_end/application/oj/controller/Submit.php +++ /dev/null @@ -1,299 +0,0 @@ -searchContest($contest_id); - if ($contest['code'] !== CODE_SUCCESS) { - return apiReturn($contest['code'], $contest['msg'], $contest['data']); - } - if ($time < $contest['data']['begin_time']) { - return apiReturn(CODE_ERROR, '比赛未开始', ''); - } - // administrator can get all - if ($identify === ADMINISTRATOR || $time > strtotime($contest['data']['end_time'])) { - $where = $this->get_where_info($req); - } else { - $req['user_id'] = $user_id; - $where = $this->get_where_info($req);; - } - $temp = $submit_model->get_all_submit($where); - $resp['data']['submit_info'] = $temp['data']; - $resp['code'] = $temp['code']; - $resp['msg'] = $temp['msg']; - // format - $resp['data']['penalty'] = $this->handle_data($resp['data']['submit_info'], $contest['data']['begin_time'], json_decode($contest['data']['problems'], true)); - $temp = $submit_model->get_the_submit($where, $page); - $resp['data']['submit_info'] = $temp['data']['submit_info']; - $resp['code'] = $temp['code']; - $resp['msg'] = $temp['msg']; - $resp['data']['count'] = $temp['data']['count']; - $cache = $rankCache_model->get_rank_cache($req['contest_id']); - if ($cache['code'] === CODE_SUCCESS) { - $resp['data']['rank'] = $this->getRank($cache['data'], $user_id); - } else { - $resp['data']['rank'] = 1; - } - } else { - $req['contest_id'] = 0; - $where = $this->get_where_info($req); - $resp = $submit_model->get_the_submit($where, $page); - } - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 交题 - */ - public function submit() - { - $submit_model = new SubmitModel(); - $problem_model = new ProblemModel(); - $submit_validate = new SubmitValidate(); - $contest_model = new ContestModel(); - $contest_user_model = new ContestUserModel(); - $oj_cache_model = new OJCacheModel(); - - $language = config('wutoj_config.language'); - $time = time(); - $req = input('post.'); - $result = $submit_validate->scene('submit')->check($req); - if ($result !== VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $submit_validate->getError(), ''); - } - - if(array_search($req['language'], $language, false) === false){ - return apiReturn(CODE_ERROR, '暂不支持该语言', ''); - } - - /** - * check problem - * banned: return - * contest: check authority - */ - $problem = $problem_model->searchProblemById($req['problem_id']); - if ($problem['code'] !== CODE_SUCCESS) { - return apiReturn($problem['code'], $problem['msg'], $problem['data']); - } - if ($problem['data']['status'] === BANNED) { - return apiReturn(CODE_ERROR, '题目暂不可用', ''); - } - - $user_id = Session::get('user_id'); - $identity = Session::get('identity'); - if (empty($user_id)) { - return apiReturn(CODE_ERROR, '未登录', ''); - } - $contest_id = 0; -/* $interval_time = config('wutoj_config.interval_time');// 交题时间限制 - $ok = $oj_cache_model->get_submit_cache($user_id); - if($ok['code'] === CODE_SUCCESS){ - return apiReturn(CODE_ERROR, '请'.$interval_time.'S后再交题'); - }*/ - - // check user authority - if ($problem['data']['status'] === CONTEST) { - if (isset($req['contest_id'])) { - $contest_id = $req['contest_id']; - $contest = $contest_model->searchContest($contest_id); - if ($contest['code'] !== CODE_SUCCESS) { - return apiReturn($contest['code'], $contest['msg'], $contest['data']); - } - $problems = json_decode($contest['data']['problems'], false); - if(!in_array($req['problem_id'], $problems,false)){ - return apiReturn(CODE_ERROR,'该题不是比赛试题', ''); - } - $info = $contest_user_model->searchUser($contest_id, $user_id); - if ($info['code'] !== CODE_SUCCESS) { - return apiReturn($info['code'], $info['msg'], $info['data']); - } - if ($time < strtotime($contest['data']['begin_time']) && $identity !== ADMINISTRATOR) { - return apiReturn(CODE_ERROR, '比赛未开始', ''); - } - if ($time > strtotime($contest['data']['end_time'])) { - $problem_model->editProblem($req['problem_id'], ['status' => 1]); - $contest_id = 0; - } - } else { - return apiReturn(CODE_ERROR, '缺少比赛ID', ''); - } - } - $info = $submit_model->add_submit(array( - 'user_id' => $user_id, - 'nick' => Session::get('nick'), - 'problem_id' => $req['problem_id'], - 'contest_id' => $contest_id, - 'source_code' => $req['source_code'], - 'language' => array_search($req['language'], $language, false), - 'status' => 'Judging', - 'time' => 0, - 'memory' => 0, - )); - if ($info['code'] !== CODE_SUCCESS) { - return apiReturn($info['code'], $info['msg'], $info['data']); - } - $submit_url = config('wutoj_config.submit_url'); - $length = count($submit_url); - $oj_cache_model->set_submit_cache($user_id); - - // post to the random judger - post($submit_url[mt_rand(0, $length - 1)], json_encode(array( - 'id' => (string)$info['data'], - 'pid' => (string)$req['problem_id'], - 'env' => (string)config('wutoj_config.environment'), - 'source' => [ - 'language' => $req['language'], - 'code' => $req['source_code'], - ] - ), true)); - - return apiReturn(CODE_SUCCESS, '提交成功', $info['data']); - } - - /** - * 获取某次提交的状态 - * TODO 判断一个人是否已经通过一个题,若通过则可查看其他人代码 - */ - public function getSubmitStatus() { - $submit_model = new SubmitModel(); - $submit_validate = new SubmitValidate(); - - $req = input('post.'); - $chk=$submit_validate->scene('getSubmitStatus')->check($req); - if($chk !== VALIDATE_PASS){ - return apiReturn(CODE_ERROR, $submit_validate->getError(), ''); - } - - $info = $submit_model->get_a_submit(array( - 'id' => $req['status_id'] - )); - if($info['code'] !== CODE_SUCCESS) { - return apiReturn($info['code'], $info['msg'], $info['data']); - } - $info['data'] = $info['data'][0]; - $user_id = Session::get('user_id'); - $identity = Session::get('identity'); - if($user_id !== $info['data']['user_id'] && $identity !== ADMINISTRATOR){ - return apiReturn(CODE_ERROR, '不要查看其他人代码', ''); - } - - $identity = Session::get('identity'); - if($identity !== ADMINISTRATOR && $info['data']['status'] !== 'CE'){ - $info['data']['msg'] = ''; - } - return apiReturn(CODE_SUCCESS, '请求成功', $info['data']); - } - - /** - * 格式化数据 - */ - private function handle_data($data, $begin_time, $problem) - { - $begin_time = strtotime($begin_time); - $re_data = array( - 'nick' => isset($data[0]['nick']) ? $data[0]['nick'] : '', - 'penalty' => 0, - 'acnum' => 0, - 'problem' => array(), - ); - foreach ($data as $item){ - $p = array_search($item['problem_id'], $problem, false); - if($p === false){ - continue; - } - $p = chr($p + 65); - if(!isset($re_data['problem'][$p])){ - $re_data['problem'][$p] = ['success_time' => '', 'times' => 0]; - } - if(empty($re_data['problem'][$p]['success_time'])){ - if($item['status'] !== 'AC'){ - if($item['status'] !== 'CE'){ - $re_data['problem'][$p]['times']++; - } - } else { - $re_data['problem'][$p]['success_time'] = strtotime($item['submit_time']) - $begin_time; - $re_data['penalty'] += strtotime($item['submit_time']) - $begin_time + $re_data['problem'][$p]['times'] * 1200; - $re_data['acnum']++; - } - } - } - return $re_data; - } - - private function getRank($data, $user_id) - { - $i = 1; - foreach ($data as $item){ - if($item['user_id'] === $user_id){ - return $i; - } - $i++; - } - } -} diff --git a/back_end/application/oj/controller/Test.php b/back_end/application/oj/controller/Test.php deleted file mode 100644 index 254d25d67..000000000 --- a/back_end/application/oj/controller/Test.php +++ /dev/null @@ -1,372 +0,0 @@ - 'ljw', - 'password' => md5(base64_encode('ljwdl')), - 'desc' => json_encode([ - 'phone' => '123123123', - 'sex' => 'female' - ]) - ]; - - $res = $user->addUser($data); - if ($res['code'] == CODE_SUCCESS) { - echo 'add success'; - } else { - halt($res); - } - - echo '
'; - - $res = $user->searchUserByNick($data['nick']); - if ($res['code'] == CODE_SUCCESS) { - echo 'search name success : '; - dump($res['data']); - } else { - halt($res); - } - - $user_id = $res['data']['user_id']; - - echo '
'; - - $res = $user->searchUserById($user_id); - if ($res['code'] == CODE_SUCCESS) { - echo 'search id success : '; - dump($res['data']); - } else { - halt($res); - } - - $new_data = [ - 'nick' => 'darkkris', - 'password' => md5(base64_encode('219909')), - 'desc' => json_encode([ - 'phone' => '18454353727', - 'sex' => 'male' - ]) - ]; - - $res = $user->editUser($user_id, $new_data); - if ($res['code'] == CODE_SUCCESS) { - echo 'edit success'; - } else { - halt($res); - } - - echo '
'; - - $res = $user->searchUserById($user_id); - if ($res['code'] == CODE_SUCCESS) { - echo 'search id success : '; - dump($res['data']); - } else { - halt($res); - } - echo '
'; - - $res = $user->deleUser($user_id); - if ($res['code'] == CODE_SUCCESS) { - echo 'delete success'; - } else { - halt($res); - } - - echo '
'; - } - - public function sampleModel() - { - $problem_id = '1'; - $input = '1 2'; - $output = '1 1'; - - $sample = new SampleModel(); - $res = $sample->addSample($problem_id, $input, $output); - if ($res['code'] == CODE_SUCCESS) { - echo 'add sample success'; - } else { - halt($res); - } - echo '
'; - - $res = $sample->searchSampleByProblemID($problem_id); - if ($res['code'] == CODE_SUCCESS) { - echo 'search pid success :
'; - dump($res['data']); - } else { - halt($res); - } - echo '
'; - - $sample_id = ''; - foreach ($res['data'] as $key => $value) { - $sample_id = $value['sample_id']; - break; - } - echo $sample_id . '
'; - - $res = $sample->searchSampleByID($sample_id); - if ($res['code'] == CODE_SUCCESS) { - echo 'search id success :
'; - dump($res['data']); - } else { - halt($res); - } - echo '
'; - - - $input = 'input'; - $output = 'output'; - - $res = $sample->editSample($sample_id, $input, $output); - if ($res['code'] == CODE_SUCCESS) { - echo 'edit success :
'; - } else { - halt($res); - } - echo '
'; - - $res = $sample->searchSampleByID($sample_id); - if ($res['code'] == CODE_SUCCESS) { - echo 'search id success :
'; - dump($res['data']); - } else { - halt($res); - } - echo '
'; - - $res = $sample->deleSample($sample_id); - if ($res['code'] == CODE_SUCCESS) { - echo 'delete success'; - } else { - halt($res); - } - echo '
'; - } - - public function UsergroupModel() - { -// $group = new GroupModel(); -// $res = $group->get_the_group(1); -// halt($res);// for debug - - $user_group = new UsergroupModel(); - - $res = $user_group->addRelation(1, 1); - if ($res['code'] == CODE_SUCCESS) { - $user_group->addRelation(2, 1); - $user_group->addRelation(1, 2); - echo 'add relation success'; - } else { - halt($res); - } - echo '
'; - - $res = $user_group->searchRelation(1, 1); - if ($res['code'] == CODE_SUCCESS) { - echo 'searchRealtion success : '; - dump($res['data']); - } else { - halt($res); - } - echo '
'; - - - /* - * TODO has problem (maybe in the GroupModel) - */ - $res = $user_group->find_group(1); - if ($res['code'] == CODE_SUCCESS) { - echo 'find group success : '; - dump($res['data']); - } else { - halt($res); - } - echo '
'; - - $res = $user_group->find_user(1); - if ($res['code'] == CODE_SUCCESS) { - echo 'find user success : '; - dump($res['data']); - } else { - halt($res); - } - echo '
'; - /* - * problem end - */ - - $res = $user_group->deleRelation(1, 1); - if ($res['code'] == CODE_SUCCESS) { - $user_group->deleRelation(2, 1); - $user_group->deleRelation(1, 2); - echo 'delete Relation success'; - } else { - halt($res); - } - - echo 'test success'; - -// $res1 = $user_group->addRelation(1,1); -// $res2 = $user_group->addRelation(1,2); -// dump($res1); -// dump($res2); - - } - - public function groupModel() - { - $group = new GroupModel(); - - $data = [ - 'group_name' => 'test', - 'desc' => 'group describe', - 'group_creator' => 1 - ]; - - $res = $group->newGroup($data); - if ($res) { - echo 'new group success'; - } else { - halt($res); - } - echo '
'; - - $res = $group->get_all_group(); - dump($res); - - $group_id = $res['data'][0]['group_id']; - echo 'group_id : ' . $group_id; - echo '
'; - - $res = $group->get_the_group($group_id); - if ($res) { - echo 'get_the_group success : '; - dump($res['data']); - } else { - halt($res['data']); - } - echo '
'; - - $new_data = [ - 'group_name' => 'testForEdit', - 'desc' => 'IKIJIBIKI', - 'group_creator' => 2 - ]; - - $res = $group->editGroup($group_id, $new_data); - if ($res) { - echo 'edit Group success'; - } else { - halt($res); - } - $res = $group->get_the_group($group_id); - dump($res['data']); - echo '
'; - - $res = $group->deleGroup($group_id); - if ($res) { - echo 'delete Success'; - } else { - halt($res); - } - - } - - public function privilegeModel() - { - $privilege = new PrivilegeModel(); - - $res = $privilege->addPrivilege(1, 'p1'); - if ($res['code'] == CODE_SUCCESS) { - $privilege->addPrivilege(1, 'g1'); - $privilege->addPrivilege(1, 'p1'); - $privilege->addPrivilege(1, 'admin'); - echo 'add privilege success'; - } else { - halt($res); - } - echo '
'; - - $res = $privilege->searchOnesAllPrivilege(1); - if ($res['code'] == CODE_SUCCESS) { - echo 'search ones all privilege success : '; - dump($res['data']); - } else { - halt($res); - } - echo '
'; - - $res = $privilege->searchPrivilege(1, 'admin'); - if ($res['code'] == CODE_SUCCESS) { - echo 'search privilege success : '; - dump($res); - } else { - halt($res); - } - echo '
'; - - $res = $privilege->delePrivilege(1, 'admin'); - if ($res['code'] == CODE_SUCCESS) { - $privilege->delePrivilege(1, 'p1'); - $privilege->delePrivilege(1, 'g1'); - echo 'delete privilege success'; - } else { - halt($res); - } - echo '
'; - echo 'test success'; - } - - public function loginController() - { - return view('login'); - } - - public function userController() - { - - } - - public function groupController() - { - - } - - public function problemController() - { - - } - -} \ No newline at end of file diff --git a/back_end/application/oj/controller/Upload.php b/back_end/application/oj/controller/Upload.php deleted file mode 100644 index 3ba61156f..000000000 --- a/back_end/application/oj/controller/Upload.php +++ /dev/null @@ -1,134 +0,0 @@ - 500000, - 'ext' => 'jpg,png,gif,jpeg', - ]; - private $path = '../uploads/image/'; - private $data_path = '../uploads/data'; - - public function upload_image() - { - $user_id = session('user_id'); - if(empty($user_id)){ - return apiReturn(CODE_ERROR, '未登录', ''); - } - $file = request()->file('image'); - if(empty($file)){ - return apiReturn(CODE_ERROR, '请上传图片', ''); - } - $info = $file->validate($this->validate)->move($this->path); - if ($info) { - $url = $this->path.$info->getSaveName(); - return apiReturn(CODE_SUCCESS, '上传成功', $url); - } - return apiReturn(CODE_ERROR, $file->getError(), ''); - } - public function upload_avatar() - { - $user_id = session('user_id'); - if(empty($user_id)){ - return apiReturn(CODE_ERROR, '未登录', ''); - } - $req = input('post.'); - if(!isset($req['url'])){ - return apiReturn(CODE_ERROR, '未填写头像url', ''); - } - $user_model = new UserModel(); - $resp = $user_model->editUser($user_id, ['avatar' => $req['url']]); - return apiReturn($resp['code'], $resp['msg'], ''); - } - - /** - * 上传题目数据接口, 支持多组数据 - */ - public function upload_data_file() - { - $common_model = new CommonModel(); - - $resp = $common_model->checkIdentity(); - if ($resp['code'] !== CODE_SUCCESS) { - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - $files = request()->file(''); - $req = input('post.'); - $data = []; - foreach($files['file'] as $file) { - //halt($file); - $info = $file->move($this->path); - if ($info != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $file->getError(), ''); - } else { - $file_path = $this->data_path . $info->getSaveName(); - $str = file_get_contents($file_path); - //$str = str_replace("\r\n", '\n', $str); - $filename = substr($file->getInfo()['name'], 0, strpos($file->getInfo()['name'], '.')); - if (!isset($data[$filename])) { - if ($info->getExtension() === 'in') { - $data[$filename] = array( - 'in' => $str, - 'out' => '' - ); - } else { - $data[$filename] = array( - 'in' => '', - 'out' => $str - ); - } - } else { - if ($info->getExtension() === 'in') { - $data[$filename]['in'] = $str; - } else { - $data[$filename]['out'] = $str; - } - } - } - } - - if(!isset($req['sqj'])){ - $re_data = array( - 'type' => 'Normal', - 'time_limit' => isset($req['time']) ? $req['time'] : 1000000000, - 'memory_limit' => isset($req['memory']) ? $req['memory'] : 33554432, - 'test_cases' => array() - ); - } else { - $re_data = array( - 'type' => 'Special', - 'time_limit' => isset($req['time']) ? $req['time'] : 1000000000, - 'memory_limit' => isset($req['memory']) ? $req['memory'] : 33554432, - 'spj' => array( - 'language' => $req['language'], - 'code' => $req['code'] - ), - 'test_cases' => array() - ); - } - foreach ($data as $item){ - $re_data['test_cases'][] = array( - 'input' => $item['in'], - 'answer' => $item['out'], - ); - } - - // 数据文件输出 - $json_data = json_encode($re_data); - $json_data = str_replace('\r\n', '\n', $json_data); - file_put_contents($this->data_path . $req['problem_id'] . '.json', $json_data); - } -} \ No newline at end of file diff --git a/back_end/application/oj/controller/User.php b/back_end/application/oj/controller/User.php deleted file mode 100644 index 1808d0f4b..000000000 --- a/back_end/application/oj/controller/User.php +++ /dev/null @@ -1,159 +0,0 @@ -get_update_cache($user_id); - if($data['code'] === CODE_SUCCESS){ - return apiReturn(CODE_ERROR, '请不要频繁更新, 更新时间为1天',''); - } - - $req = input('post.'); - $result = $user_validate->scene('editUser')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $user_validate->getError(), ''); - } - - $user = $user_model->searchUserById($user_id); - if($user['code'] !== CODE_SUCCESS){ - return apiReturn($user['code'], $user['msg'], ''); - } - - // edit - $data = $user['data']; - $resp = $user_model->editUser($user_id, [ - 'user_id' => $user_id, - 'realname' => isset($req['realname']) ? $req['realname'] : $data['realname'], - 'avatar' => isset($req['avatar']) ? $req['avatar'] : $data['avatar'], - 'school' => isset($req['school']) ? $req['school'] : $data['school'], - 'contact' => isset($req['contact']) ? $req['contact'] : $data['contact'], - 'major' => isset($req['major']) ? $req['major'] : $data['major'], - 'class' => isset($req['class']) ? $req['class'] : $data['class'], - 'desc' => isset($req['desc']) ? $req['desc'] : $data['desc'], - ]); - // 更新时间间隔 - $oj_cache_model->set_update_cache($user_id); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 模糊查询用户 - */ - public function searchUser() - { - $user_validate = new UserValidate(); - $user_model = new UserModel(); - - $req = input('post.'); - $result = $user_validate->scene('searchUser_id')->check($req); - if ($result != true) { - $result = $user_validate->scene('searchUser_nick')->check($req); - if ($result != true) { - return apiReturn(CODE_ERROR, $user_validate->getError(), ''); - } - $resp = $user_model->searchUserByNick($req['nick']); - } else { - $resp = $user_model->searchUserById($req['user_id']); - } - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 忘记密码后修改密码操作 - */ - public function forget_password() - { - $user_model = new UserModel(); - $user_validate = new UserValidate(); - $find_password_model = new FindPasswordModel(); - - $req = input('post.'); - $result = $user_validate->scene('forget_password')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $user_validate->getError(), ''); - } - - // check code - $info = $find_password_model->check_token($req['nick'], $req['check']); - if($info['code'] !== CODE_SUCCESS){ - return apiReturn(CODE_ERROR, '修改失败', ''); - } - if ($req['password'] !== $req['password_check']) { - return apiReturn(CODE_ERROR, '两次输入密码不一致', ''); - } - - // update - $resp = $user_model->editUser(array( - 'password' => md5(base64_encode($req['password'])) - ), $req['nick']); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 更换密码 - */ - public function change_password() - { - $user_model = new UserModel(); - $user_validate = new UserValidate(); - - $user_id = Session::get('user_id'); - if(empty($user_id)){ - return apiReturn(CODE_ERROR, '未登录', ''); - } - - $req = input('post.'); - $result = $user_validate->scene('change_password')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $user_validate->getError(), ''); - } - // 原密码校验 - $info = $user_model->loginCheck(['nick' => $req['nick'], 'password' => md5(base64_encode($req['old_password']))]); - if($info['code'] !== CODE_SUCCESS){ - return apiReturn($info['code'], $info['msg'], ''); - } - // 两次密码校验 - if($req['password'] !== $req['password_check']){ - return apiReturn(CODE_ERROR, '两次输入密码不一致', ''); - } - $resp = $user_model->editUser($user_id, array( - 'password' => md5(base64_encode($req['password'])) - )); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } -} \ No newline at end of file diff --git a/back_end/application/oj/middleware.php b/back_end/application/oj/middleware.php deleted file mode 100644 index 017bf945c..000000000 --- a/back_end/application/oj/middleware.php +++ /dev/null @@ -1,4 +0,0 @@ - CODE_ERROR, 'msg' => '未登录', 'data' => '']; - } - $user = $user_model->searchUserById($session); - isset($user['data']['identity']) ? $identity = $user['data']['identity'] : $identity = 0; - if ($identity !== ADMINISTRATOR) { - return ['code' => CODE_ERROR, 'msg' => '你没有权限', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '权限正常', 'data' => '']; - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/ContestModel.php b/back_end/application/oj/model/ContestModel.php deleted file mode 100644 index 8fffbf858..000000000 --- a/back_end/application/oj/model/ContestModel.php +++ /dev/null @@ -1,99 +0,0 @@ -where('status', '<>', 0)->where('group_id', 0)->select()->toArray(); - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } else if ($contest_id !== 0) { - $content = $this->where('contest_id', $contest_id)->find(); - if (empty($content)) { - return ['code' => CODE_ERROR, 'msg' => '未找到数据', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } else { - $content = $this->where('contest_name', 'like', '%' . $contest_name . '%')->select()->toArray(); - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function newContest($data) - { - try { - $res = $this->insert($data); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '新建比赛成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '新建比赛失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function deleContest($contest_id) - { - try { - $res = $this->where('contest_id', $contest_id)->update(['state' => 0]); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '删除比赛成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '删除比赛失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function editContest($contest_id, $data) - { - try { - $res = $this->where('contest_id', $contest_id)->update($data); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '编辑比赛成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '编辑比赛失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function getAllGroupContest($group_id, $page) - { - try{ - $page_limit = config('wutoj_config.page_limit'); - $info['data'] = $this - ->where('group_id', $group_id) - ->limit($page * $page_limit, $page_limit) - ->select() - ->toArray(); - $info['count'] = $this->where('group_id', $group_id)->count(); - if(empty($info)){ - return ['code' => CODE_ERROR, 'msg' => '无题目数据', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e){ - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/ContestUserModel.php b/back_end/application/oj/model/ContestUserModel.php deleted file mode 100644 index fb13c4eee..000000000 --- a/back_end/application/oj/model/ContestUserModel.php +++ /dev/null @@ -1,55 +0,0 @@ -where([['contest_id', '=', $contest_id], ['user_id', '=', $user_id]])->find(); - if(empty($info)){ - return ['code' => CODE_ERROR, 'msg' => '未参加比赛', 'data' => '']; - } else { - return ['code' => CODE_SUCCESS, 'msg' => '已参加比赛', 'data' => '']; - } - } catch (Exception $e) { - return ['code' => CODE_PARAM_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function searchUserContest($user_id) - { - try{ - $info = $this->where('user_id', $user_id)->select()->toArray(); - if(empty($info)){ - return ['code' => CODE_ERROR, 'msg' => '无比赛信息', 'data' => '']; - } else { - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } - } catch (Exception $e) { - return ['code' => CODE_PARAM_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function addInfo($contest_id, $user_id) - { - try{ - $info = $this->insert(['contest_id' => $contest_id, 'user_id' => $user_id]); - if($info === false){ - return ['code' => CODE_ERROR, 'msg' => '参加失败,请重试', 'data' => '']; - } else { - return ['code' => CODE_SUCCESS, 'msg' => '参加成功', 'data' => '']; - } - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/DiscussModel.php b/back_end/application/oj/model/DiscussModel.php deleted file mode 100644 index edfc9a690..000000000 --- a/back_end/application/oj/model/DiscussModel.php +++ /dev/null @@ -1,149 +0,0 @@ -strict(false)->insert($data); - if($info === false){ - return ['code' => CODE_ERROR, 'msg' => '添加失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function update_discuss($data) - { - try{ - $info = $this->where('id', $data['id'])->update($data); - if ($info !== 0) { - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } - return ['code' => CODE_ERROR, 'msg' => '更新失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function get_all_topic($contest, $page) - { - try{ - $page_limit = config('wutoj_config.page_limit'); - if($contest === 0){ - $info['data'] = $this - ->field(['discuss.id as id', 'discuss.problem_id as problem_id', 'problem.title as title', 'background', 'count(*) as count']) - ->where('contest_id', 0) - ->rightjoin('problem','discuss.problem_id = problem.problem_id') - ->group('problem.problem_id') - ->limit($page * $page_limit, $page_limit) - ->select() - ->toArray(); - $info['count'] = $this - ->where('contest_id', 0) - ->rightjoin('problem','discuss.problem_id = problem.problem_id') - ->group('problem.problem_id') - ->count(); - } else { - $info['data'] = $this - ->field(['discuss.id as id', 'discuss.contest_id as contest_id', 'contest_name', 'begin_time', 'end_time', 'count(*) as count']) - ->where('discuss.contest_id', '<>', 0) - ->rightjoin('contest','discuss.contest_id = contest.contest_id') - ->group('contest.contest_id') - ->limit($page * $page_limit, $page_limit) - ->select() - ->toArray(); - $info['count'] = $this - ->where('discuss.contest_id', '<>', 0) - ->rightjoin('contest','discuss.contest_id = contest.contest_id') - ->group('contest.contest_id') - ->count(); - } - if(empty($info['data'])){ - return ['code' => CODE_ERROR, 'msg' => '暂无数据', 'data' => $info]; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - public function get_all_discuss($contest_id, $problem_id, $page) - { - try{ - $page_limit = config('wutoj_config.page_limit'); - $field = ['discuss.id as id','problem_id','discuss.user_id as user_id', 'users.nick as nick', 'title', 'avatar', 'content', 'time', 'discuss.status as status']; - if($contest_id !== 0){ - $info['data'] = $this - ->field($field) - ->where('contest_id', $contest_id) - ->join('users','discuss.user_id = users.user_id') - ->limit($page * $page_limit, $page_limit) - ->select() - ->toArray(); - $info['count'] = $this - ->where('contest_id', $contest_id) - ->count(); - } else { - $info['data'] = $this - ->field($field) - ->where('problem_id', $problem_id) - ->where('contest_id', 0) - ->join('users','discuss.user_id = users.user_id') - ->limit($page * $page_limit, $page_limit) - ->select() - ->toArray(); - $info['count'] = $this - ->where('problem_id', $problem_id) - ->where('contest_id', 0) - ->count(); - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function get_the_discuss($discuss_id) - { - try{ - $info = $this - ->field(['discuss.id as id','problem_id','contest_id','discuss.user_id as user_id', 'users.nick as nick', 'avatar', 'title', 'content', 'time', 'discuss.status as status']) - ->join('users','discuss.user_id = users.user_id') - ->where('id', $discuss_id) - ->find(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function get_user_discuss($user_id, $contest_id, $page) - { - try{ - $where = '(`contest_id` = '.$contest_id.' AND `discuss`.`user_id` = '.(string)$user_id.')'.'OR (`contest_id` = '.$contest_id.' AND `discuss`.`status` = 8)'; - $page_limit = config('wutoj_config.page_limit'); - $info['data'] = $this - ->field(['discuss.id as id','problem_id','contest_id','discuss.user_id as user_id', 'users.nick as nick', 'avatar', 'title', 'content', 'time', 'discuss.status as status']) - ->where($where) - ->join('users','discuss.user_id = users.user_id') - ->limit($page * $page_limit, $page_limit) - ->select() - ->toArray(); - $info['count'] = $this->where($where)->join('users','discuss.user_id = users.user_id')->count(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/FeedbackModel.php b/back_end/application/oj/model/FeedbackModel.php deleted file mode 100644 index 8510b48dc..000000000 --- a/back_end/application/oj/model/FeedbackModel.php +++ /dev/null @@ -1,29 +0,0 @@ -strict(false)->insert($data); - if ($ok == false) { - return ['code' => CODE_ERROR, 'msg' => '添加失败', 'data' => $this->getError()]; - } else { - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => '']; - } - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/GroupModel.php b/back_end/application/oj/model/GroupModel.php deleted file mode 100644 index 41e487d7f..000000000 --- a/back_end/application/oj/model/GroupModel.php +++ /dev/null @@ -1,108 +0,0 @@ -field(['group_id', 'group_name', 'group_creator', 'desc']) - ->where('status', 0) - ->limit($page * $page_limit, $page_limit) - ->select() - ->toArray(); - if (empty($info['data'])) { - return ['code' => CODE_ERROR, 'msg' => '分组不存在', 'data' => $this->getError()]; - } - $info['count'] = count($info['data']); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => '']; - } - } - - public function get_the_group($group_id) - { - try { - $info = $this->where([['group_id', '=', $group_id], ['status', '=', 0]])->find(); - if (empty($info)) { - return ['code' => CODE_ERROR, 'msg' => '分组不存在', 'data' => $this->getError()]; - } - $info['count'] = Db::table('user_group')->where('group_id', $group_id)->count(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @param $data - * @return array $data : $group_name $desc $group_creator - */ - public function newGroup($data, $user_id) - { - try { - $res = $this->insertGetId($data); - if ($res) { - $usergroup_model = new UsergroupModel(); - $resp = $usergroup_model->addRelation($res, $data['group_creator'], 2); - foreach ($user_id as $item){ - $resp = $usergroup_model->addRelation($res, $item['user_id'], (int)($item['identity'] === 1)); - } - if ($resp['code'] !== CODE_SUCCESS) { - return ['code' => CODE_ERROR, 'msg' => '创建分组失败', 'data' => $resp['data']]; - } - return ['code' => CODE_SUCCESS, 'msg' => '创建分组成功', 'data' => $res]; - } - return ['code' => CODE_ERROR, 'msg' => '创建分组失败', 'data' => $this->getError()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function editGroup($group_id, $data) - { - try { - $res = $this->where('group_id', $group_id)->update($data); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '修改分组成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '修改分组失败', 'data' => $this->getError()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function deleGroup($group_id) - { - try { - $res = $this->where('group_id', $group_id)->delete(); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '删除分组成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '删除分组失败', 'data' => $this->getError()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function group_rank() - { - - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/GroupproblemModel.php b/back_end/application/oj/model/GroupproblemModel.php deleted file mode 100644 index 691afddcb..000000000 --- a/back_end/application/oj/model/GroupproblemModel.php +++ /dev/null @@ -1,47 +0,0 @@ -insert(['group_id' => $group_id, 'problem_id' => $problem_id]); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '已在题库中', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function getAllProblem($group_id, $page) - { - try{ - $page_limit = config('wutoj_config.page_limit'); - $info['data'] = $this->alias('g') - ->field(['problem.problem_id as problem_id', 'title', 'tag']) - ->where('group_id', $group_id) - ->leftJoin('problem', 'problem.problem_id = g.problem_id') - ->limit($page * $page_limit, $page_limit) - ->select() - ->toArray(); - $info['count'] = $this->where('group_id', $group_id)->count(); - if(empty($info)){ - return ['code' => CODE_ERROR, 'msg' => '无题目数据', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e){ - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/KnowledgeModel.php b/back_end/application/oj/model/KnowledgeModel.php deleted file mode 100644 index 295a83a3a..000000000 --- a/back_end/application/oj/model/KnowledgeModel.php +++ /dev/null @@ -1,153 +0,0 @@ -where('name', 'like', '%'.$name.'%')->select(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取成就点 - * @param int user_id - * @return mixed int|array - */ - public function getUserKnowledgePoint($user_id) { - try { - $userKnowledgeModel = new KnowledgeUserModel(); - $resp = $userKnowledgeModel->getAllDoneKnowledge($user_id); - $score = 0; - if ($resp['data'] != []) { - foreach ($resp['data'] as $item) { - $score += $item->score; - } - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $score]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取知识点 - * @param string $name - * @return array ['code', 'msg', 'data'] - */ - public function getSpecificKnowledge($name) { - try { - $result = $this->where(['name' => $name])->find(); - if ($result) { - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '无此知识点', 'data' => $name]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function getKnowledgeByID($id) { - try { - $result = $this->where(['id' => $id])->find(); - if ($result) { - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '无此知识点', 'data' => $id]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取一对知识点 - * @param array $data ['name', 'pre_name'] - * @return array ['code', 'msg', 'data'] - */ - public function getKnowledgePairID($data) { - try { - $msg = $this->getSpecificKnowledge($data['name']); - if ($msg['code'] == CODE_SUCCESS) { - $knowledge_id = $msg['data']['id']; - } else { - return ['code' => CODE_ERROR, 'msg' => '知识点不存在', 'data' => []]; - } - $msg = $this->getSpecificKnowledge($data['pre_name']); - if ($msg['code'] == CODE_SUCCESS) { - $pre_knowledge_id = $msg['data']['id']; - } else { - return ['code' => CODE_ERROR, 'msg' => '前置知识点不存在', 'data' => []]; - } - $returnData = [ - 'knowledge_id' => $knowledge_id, - 'pre_knowledge_id'=> $pre_knowledge_id - ]; - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $returnData]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - - /** - * @usage 添加知识点 - * @param array $data ['name', 'point'] - * @return array ['code', 'msg', 'data'] - */ - public function addKnowledge($data) { - try { - $where = ['name' => $data['name']]; - $msg = $this->where($where)->find(); - if ($msg) { - return ['code' => CODE_ERROR, 'msg' => '已存在此知识点', 'data' => $msg]; - } else { - $insertData = ['name' => $data['name'], 'point' => $data['point']]; - $info = $this->insertGetId($data); - return ['code' => CODE_SUCCESS, 'msg' => '插入成功', 'data' => $info]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 删除知识点 - * @param array $data ['name'] - * @return array ['code', 'msg', 'data'] - */ - public function deleteKnowledge($data) { - try { - $where = ['name' => $data['name']]; - $msg = $this->where($where)->find(); - if ($msg) { - $knowledgeUserModel = new KnowledgeUserModel(); - if ($knowledgeUserModel->deleteKnowledge($data['name']) == false) { - return ['code' => CODE_ERROR, 'msg' => '删除失败', 'data' => []]; - } - $info = $this->where($where)->delete(); - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '不存在此知识点', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/KnowledgeProblemModel.php b/back_end/application/oj/model/KnowledgeProblemModel.php deleted file mode 100644 index 70c2e60bb..000000000 --- a/back_end/application/oj/model/KnowledgeProblemModel.php +++ /dev/null @@ -1,264 +0,0 @@ -getSpecificKnowledge($knowledge); - if ($msg['code'] == CODE_SUCCESS) { - $where = [ - 'a.knowledge_id' => $msg['data']['id'], - ]; - if ($core_only) { - $where['a.is_core'] = 1; - } - $result = $this->alias('a') - ->join(['problem' => 'p'], 'p.problem_id = a.problem_id') - ->where($where) - ->field(['p.problem_id', 'a.is_core']) - ->select(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '知识点不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取问题知识点 - * @param int $problem_id - * @param boolean $core_only - * @return array ['code', 'msg', 'data'] - */ - public function getKnowledgeByProblem($problem_id, $core_only = false) { - $OJCacheModel = new OJCacheModel(); - $cache = $OJCacheModel->getProblemKnowledgeCache($problem_id, $core_only); - if ($cache['code'] == CODE_SUCCESS) { - return ['code' => $cache['code'], 'msg' => '查询成功', 'data' => $cache['data']]; - } - try { - $problemModel = new ProblemModel(); - $msg = $problemModel->searchProblemById($problem_id); - if ($msg['code'] == CODE_SUCCESS) { - $where = ['a.problem_id' => $problem_id]; - if ($core_only == true) { - $where['is_core'] = 1; - } - $result = $this->alias('a') - ->join(['knowledge' => 'k'], 'k.id = a.knowledge_id') - ->where($where) - ->field(['k.id', 'k.name', 'a.is_core']) - ->select(); - $OJCacheModel->setProblemKnowledgeCache($result, $problem_id, $core_only); - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '知识点不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 添加关系 - * @param array $data ['problem_id', 'knowledge', 'is_core'] - * @return array ['code', 'msg', 'data'] - */ - public function addRelation($data) { - try { - $msg = $this->getRelationPair($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - return ['code' => CODE_ERROR, 'msg' => '关系已存在', 'data' => []]; - } else { - $insertData = [ - 'problem_id' => $id_pair['problem_id'], - 'knowledge_id' => $id_pair['knowledge_id'], - 'is_core' => isset($data['is_core'])?$data['is_core']:0, - ]; - $info = $this->insertGetId($insertData); - $OJCacheModel = new OJCacheModel(); - $OJCacheModel->unsetProblemKnowledgeCache($insertData['problem_id'], $insertData['is_core']); - return ['code' => CODE_SUCCESS, 'msg' => '插入成功', 'data' => $info]; - } - - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取关系对id - * @param array $data ['problem_id', 'knowledge'] - * @return array ['code', 'msg', 'data'] - */ - public function getRelationPair($data) { - $knowledgeModel = new KnowledgeModel(); - $problemModel = new ProblemModel(); - $msg = $knowledgeModel->getSpecificKnowledge($data['knowledge']); - if ($msg['code'] == CODE_SUCCESS) { - $knowledge_id = $msg['data']['id']; - } else { - return $msg; - } - $msg = $problemModel->searchProblemById($data['problem_id']); - if ($msg['code'] == CODE_ERROR) { - return ['code' => CODE_ERROR, 'msg' => '题目编号不存在', 'data' => []]; - } - $returnData = [ - 'knowledge_id' => $knowledge_id, - 'problem_id' => $data['problem_id'] - ]; - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $returnData]; - } - - - /** - * @usage 删除关系 - * @param array $data ['problem_id', 'knowledge'] - * @return array ['code', 'msg', 'data'] - */ - public function deleteRelation($data) { - try { - $msg = $this->getRelationPair($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ - 'id' => $msg['id'], - ]; - $info = $this->where($where)->delete(); - $OJCacheModel = new OJCacheModel(); - $OJCacheModel->unsetProblemKnowledgeCache($data['problem_id'], true); - $OJCacheModel->unsetProblemKnowledgeCache($data['problem_id'], false); - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 切换必要题目 - * @param array $data ['problem_id', 'knowledge'] - * @return array ['code', 'msg', 'data'] - */ - public function switchCore($data) { - try { - $msg = $this->getRelationPair($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ 'id' => $msg['id']]; - if ($msg['is_core'] == 1) { - $updateData = ['is_core' => 0]; - } else { - $updateData = ['is_core' => 1]; - } - $info = $this->where($where)->update($updateData); - $OJCacheModel = new OJCacheModel(); - $OJCacheModel->unsetProblemKnowledgeCache($data['problem_id'], true); - $OJCacheModel->unsetProblemKnowledgeCache($data['problem_id'], false); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 设置必要题目 - * @param array $data ['problem_id', 'knowledge'] - * @return array ['code', 'msg', 'data'] - */ - public function setCore($data) { - try { - $msg = $this->getRelationPair($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ 'id' => $msg['id']]; - $updateData = ['is_core' => 1]; - $info = $this->where($where)->update($updateData); - $OJCacheModel = new OJCacheModel(); - $OJCacheModel->unsetProblemKnowledgeCache($data['problem_id'], true); - $OJCacheModel->unsetProblemKnowledgeCache($data['problem_id'], false); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 取消设置必要题目 - * @param array $data ['problem_id', 'knowledge'] - * @return array ['code', 'msg', 'data'] - */ - public function unsetCore($data) { - try { - $msg = $this->getRelationPair($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ 'id' => $msg['id']]; - $updateData = ['is_core' => 0]; - $info = $this->where($where)->update($updateData); - $OJCacheModel = new OJCacheModel(); - $OJCacheModel->unsetProblemKnowledgeCache($data['problem_id'], true); - $OJCacheModel->unsetProblemKnowledgeCache($data['problem_id'], false); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/KnowledgeRelationModel.php b/back_end/application/oj/model/KnowledgeRelationModel.php deleted file mode 100644 index 8c7db4a03..000000000 --- a/back_end/application/oj/model/KnowledgeRelationModel.php +++ /dev/null @@ -1,249 +0,0 @@ - CODE_ERROR, 'msg' => '前后知识点相同', 'data' => []]; - } - $knowledgeModel = new KnowledgeModel(); - $msg = $knowledgeModel->getKnowledgePairID($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - return ['code' => CODE_ERROR, 'msg' => '关系已存在', 'data' => []]; - } else { - $insertData = [ - 'knowledge_id' => $id_pair['knowledge_id'], - 'pre_knowledge_id' => $id_pair['pre_knowledge_id'], - 'is_core' => isset($data['is_core'])?$data['is_core']:0, - ]; - $info = $this->insertGetId($insertData); - return ['code' => CODE_SUCCESS, 'msg' => '插入成功', 'data' => $info]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 删除知识点关系 - * @param array $data ['name', 'pre_name'] - * @return array ['code', 'msg', 'data'] - */ - public function deleteRelation($data) - { - try { - $knowledgeModel = new KnowledgeModel(); - $msg = $knowledgeModel->getKnowledgePairID($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ - 'id' => $msg['id'], - ]; - $info = $this->where($where)->delete(); - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 删除知识点关系(ID) - * @param int $id - * @return array ['code', 'msg', 'data'] - */ - public function deleteRelationByID($id) - { - try { - $where = ['id' => $id]; - $msg = $this->where($where)->find(); - if ($msg) { - $info = $this->where($where)->delete(); - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取前置知识点 - * @param string $name - * @param boolean $core_only - * @return array ['code', 'msg', 'data'] - */ - public function getPreKnowledge($name, $core_only = false) { - try { - $knowledgeModel = new KnowledgeModel(); - $msg = $knowledgeModel->getSpecificKnowledge($name); - if ($msg['code'] == CODE_SUCCESS) { - $where = [ - 'k.knowledge_id' => $msg['data']['id'] - ]; - if ($core_only) { - $where['k.is_core'] = 1; - } - $result = $this->alias('k') - ->join(['knowledge' => 'a'], 'a.id = k.pre_knowledge_id') - ->where($where) - ->field(['a.id', 'a.name', 'k.is_core']) - ->select(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '知识点不存在', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取后置知识点 - * @param string $name - * @param boolean $core_only - * @return array ['code', 'msg', 'data'] - */ - public function getAfterKnowledge($name, $core_only = false) { - try { - $knowledgeModel = new KnowledgeModel(); - $msg = $knowledgeModel->getSpecificKnowledge($name); - if ($msg['code'] == CODE_SUCCESS) { - $where = [ - 'k.pre_knowledge_id' => $msg['data']['id'] - ]; - if ($core_only) { - $where['k.is_core'] = 1; - } - $result = $this->alias('k') - ->join(['knowledge' => 'a'], 'a.id = k.knowledge_id') - ->where($where) - ->field(['a.id', 'a.name', 'k.is_core']) - ->select(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '知识点不存在', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 切换是否为必须前置 - * @param array $data['name', 'pre_name'] - * @return array ['code', 'msg', 'data'] - */ - public function switchCore($data) { - try { - $knowledgeModel = new KnowledgeModel(); - $msg = $knowledgeModel->getKnowledgePairID($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ 'id' => $msg['id']]; - if ($msg['is_core'] == 0) { - $updateData = ['is_core' => 1]; - } else { - $updateData = ['is_core' => 0]; - } - $info = $this->where($where)->update($updateData); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 设置为必须前置 - * @param array $data ['name', 'pre_name'] - * @return array ['code', 'msg', 'data'] - */ - public function setCore($data) { - try { - $knowledgeModel = new KnowledgeModel(); - $msg = $knowledgeModel->getKnowledgePairID($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ 'id' => $msg['id']]; - $updateData = ['is_core' => 1]; - $info = $this->where($where)->update($updateData); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 取消设置为必须前置 - * @param array $data ['name', 'pre_name'] - * @return array ['code', 'msg', 'data'] - */ - public function unsetCore($data) { - try { - $knowledgeModel = new KnowledgeModel(); - $msg = $knowledgeModel->getKnowledgePairID($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ 'id' => $msg['id']]; - $updateData = ['is_core' => 0]; - $info = $this->where($where)->update($updateData); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/KnowledgeTagModel.php b/back_end/application/oj/model/KnowledgeTagModel.php deleted file mode 100644 index 0d173ba89..000000000 --- a/back_end/application/oj/model/KnowledgeTagModel.php +++ /dev/null @@ -1,123 +0,0 @@ -checkExist($knowledge_id, $tag_id); - if ($result['code'] != CODE_SUCCESS) return $result; - $pair = [ - 'knowledge_id' => $knowledge_id, - 'tag_id' => $tag_id - ]; - $result = $this->where($pair)->find(); - if ($result) { - return ['code' => CODE_ERROR, 'msg' => '关系已存在', 'data' => []]; - } else { - $info = $this->insertGetId($pair); - return ['code' => CODE_SUCCESS, 'msg' => '插入成功', 'data' => $info]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 删除关系 - * @param int $knowledge_id - * @param int $tag_id - * @return array ['code', 'msg', 'data'] - */ - public function deleteKnowledgeTag($knowledge_id, $tag_id) { - try { - $result = $this->checkExist($knowledge_id, $tag_id); - if ($result['code'] != CODE_SUCCESS) return $result; - $pair = [ - 'knowledge_id' => $knowledge_id, - 'tag_id' => $tag_id - ]; - $result = $this->where($pair)->find(); - if ($result) { - $info = $this->where($pair)->delete(); - return ['code' => CODE_SUCCESS, 'msg' => '插入成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 删除关系 - * @param int $id - * @return array ['code', 'msg', 'data'] - */ - public function deleteKnowledgeTagByID($id) { - try { - $pair = ['id' => $id]; - $result = $this->where($pair)->find(); - if ($result) { - $info = $this->where($pair)->delete(); - return ['code' => CODE_SUCCESS, 'msg' => '插入成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - /** - * @usage 获取标签 - * @param int $knowledge_id - * @return array ['code', 'msg', 'data'] - */ - public function getKnowledgeTag($knowledge_id) { - try { - $knowledgeModel = new KnowledgeModel(); - $result = $knowledgeModel->getKnowledgeByID($knowledge_id); - if ($result['code'] != CODE_SUCCESS) return $result; - - $where = [ - 'k.knowledge_id' => $knowledge_id - ]; - $result = $this->alias('k') - ->join(['tag' => 'a'], 'a.id = k.tag_id') - ->where($where) - ->field(['a.id', 'a.name', 'a.description']) - ->select(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - private function checkExist($knowledge_id, $tag_id) { - try { - $tagModel = new TagModel(); - $knowledgeModel = new KnowledgeModel(); - $result = $tagModel->getTheTag($tag_id); - if ($result['code'] != CODE_SUCCESS) return $result; - $result = $knowledgeModel->getKnowledgeByID($knowledge_id); - if ($result['code'] != CODE_SUCCESS) return $result; - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => []]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/KnowledgeUserModel.php b/back_end/application/oj/model/KnowledgeUserModel.php deleted file mode 100644 index 2777a07cd..000000000 --- a/back_end/application/oj/model/KnowledgeUserModel.php +++ /dev/null @@ -1,283 +0,0 @@ -where(['user_id' => $user_id])->find(); - if (!$result) { - $insertData = [ - 'user_id' => $user_id, - 'knowledge_doing' => array(), - 'knowledge_done' => array() - ]; - $this->insertGetId($insertData); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => []]; - } - $returnData = json_decode($result['knowledge_doing']); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $returnData]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => $e->getMessage(), 'data' => []]; - } - } - - /** - * @usage 获取所有已完成的知识点 - * @param $user_id - * @return array ['code', 'msg', 'data'] - */ - public function getAllDoneKnowledge($user_id) { - try { - $result = $this->where(['user_id' => $user_id])->find(); - if (!$result) { - $insertData = [ - 'user_id' => $user_id, - 'knowledge_doing' => array(), - 'knowledge_done' => array() - ]; - $this->insertGetId($insertData); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => []]; - } - $returnData = json_decode($result['knowledge_done']); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $returnData]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => $e->getMessage(), 'data' => []]; - } - } - - /** - * @usage 判断知识点状态 - * @param int $user_id - * @param string $knowledge - * @return array ['code', 'msg', 'data'] - */ - public function getKnowledgeStatus($user_id, $knowledge) { - try { - $result = $this->where(['user_id' => $user_id])->find(); - if (!$result) { - $insertData = [ - 'user_id' => $user_id, - 'knowledge_doing' => array(), - 'knowledge_done' => array() - ]; - $this->insertGetId($insertData); - return ['code' => CODE_SUCCESS, 'msg' => '知识点未开始', 'data' => -1]; - } - $knowledge_doing = json_decode($result['knowledge_doing']); - $knowledge_done = json_decode($result['knowledge_done']); - if ($this->checkDoingKnowledge($knowledge_doing, $knowledge)) { - return ['code' => CODE_SUCCESS, 'msg' => '知识点进行中', 'data' => 0]; - } else if ($this->checkDoneKnowledge($knowledge_done, $knowledge)) { - return ['code' => CODE_SUCCESS, 'msg' => '知识点已完成', 'data' => 1]; - } else { - return ['code' => CODE_SUCCESS, 'msg' => '知识点未开始', 'data' => -1]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => $e->getMessage(), 'data' => []]; - } - } - - /** - * @usage 添加进行的知识点 - * @param int $user_id - * @param string $knowledge - * @return array ['code', 'msg', 'data'] - */ - public function addDoingKnowledge($user_id, $knowledge) { - try { - $knowledgeRelationModel = new KnowledgeRelationModel(); - $result = $this->processData($user_id, $knowledge); - if ($result['code'] != CODE_SUCCESS) { - return $result; - } else { - $knowledge_doing = $result['data']['knowledge_doing']; - $knowledge_done = $result['data']['knowledge_done']; - } - if ($this->checkDoneKnowledge($knowledge_done, $knowledge) == true) { - return ['code' => CODE_ERROR, 'msg' => '知识点已完成', 'data' => []]; - } - if ($this->checkDoingKnowledge($knowledge_doing, $knowledge) == true) { - return ['code' => CODE_ERROR, 'msg' => '知识点进行中', 'data' => []]; - } - $pre_knowledge = $knowledgeRelationModel->getPreKnowledge($knowledge, true)['data']; - foreach ($pre_knowledge as $item) { - if ($this->checkDoneKnowledge($knowledge_done, $item['name']) == false) { - return ['code' => CODE_ERROR, 'msg' => '存在前置知识点未完成', 'data' => $item]; - } - } - array_push($knowledge_doing, $knowledge); - $result = $this->where(['user_id' => $user_id])->update(['knowledge_doing' => (array)$knowledge_doing]); - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => $result]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => $e->getMessage(), 'data' => []]; - } - } - - - /** - * @usage 添加完成知识点 - * @param int $user_id - * @param string $knowledge - * @return array ['code', 'msg', 'data'] - */ - public function addDoneKnowledge($user_id, $knowledge) { - try { - $submitModel = new SubmitModel(); - $problemKnowledgeModel = new KnowledgeProblemModel(); - $result = $this->processData($user_id, $knowledge); - if ($result['code'] != CODE_SUCCESS) { - return $result; - } else { - $knowledge_doing = $result['data']['knowledge_doing']; - $knowledge_done = $result['data']['knowledge_done']; - } - if ($this->checkDoneKnowledge($knowledge_done, $knowledge) == true) { - return ['code' => CODE_ERROR, 'msg' => '知识点已完成', 'data' => []]; - } - if ($this->checkDoingKnowledge($knowledge_doing, $knowledge) == false) { - return ['code' => CODE_ERROR, 'msg' => '知识点未进行', 'data' => []]; - } - $problems = $problemKnowledgeModel->getProblemByKnowledge($knowledge, true)['data']; - foreach ($problems as $problem) { - $problem_id = $problem['problem_id']; - $where = [ - 'user_id' => $user_id, - 'problem_id' => $problem_id, - 'status' => 'AC' - ]; - $result = $submitModel->where($where)->find(); - if (!$result) { - return ['code' => CODE_ERROR, 'msg' => '有题目未完成', 'data' => $problem]; - } - } - $knowledge_doing = array_diff($knowledge_doing, [$knowledge]); - array_push($knowledge_done, ['name' => $knowledge, 'score' => 100]); - $insertData = [ - 'knowledge_doing' => $knowledge_doing, - 'knowledge_done' => $knowledge_done - ]; - $result = $this->where(['user_id' => $user_id])->update($insertData); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $result]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => $e->getMessage(), 'data' => []]; - } - } - - /** - * @usage 删除知识点 - * @param string $knowledge - * @return boolean - */ - public function deleteKnowledge($knowledge) { - try { - $data = $this->select(); - foreach ($data as $item) { - $id = $item['id']; - $knowledge_doing = json_decode($item['knowledge_doing']); - $knowledge_done = json_decode($item['knowledge_done']); - $new_knowledge_doing = array(); - $new_knowledge_done = array(); - foreach ($knowledge_doing as $doing) { - if ($doing == $knowledge) continue; - array_push($new_knowledge_doing, $doing); - } - foreach ($knowledge_done as $done) { - if ($done->name == $knowledge) continue; - array_push($new_knowledge_done, $done); - } - $insertData = [ - 'knowledge_doing' => $new_knowledge_doing, - 'knowledge_done' => $new_knowledge_done - ]; - $this->where(['id' => $id])->update($insertData); - return true; - } - } catch (DbException $e) { - return false; - } - } - - /** - * @usage 处理数据 - * @param int $user_id - * @param string $knowledge - * @return array ['code', 'msg', 'data'] - */ - public function processData($user_id, $knowledge) { - try { - $userModel = new UserModel(); - $knowledgeModel = new KnowledgeModel(); - $knowledgeRelationModel = new KnowledgeRelationModel(); - $result = $userModel->searchUserById($user_id); - if ($result['code'] != CODE_SUCCESS) { - return ['code' => CODE_ERROR, 'msg' => '用户不存在', 'data' => []]; - } - $result = $knowledgeModel->getSpecificKnowledge($knowledge); - if ($result['code'] != CODE_SUCCESS) { - return ['code' => CODE_ERROR, 'msg' => '知识点不存在', 'data' => []]; - } - $result = $this->where(['user_id' => $user_id])->find(); - if (!$result) { - $insertData = [ - 'user_id' => $user_id, - 'knowledge_doing' => array(), - 'knowledge_done' => array() - ]; - $this->insertGetId($insertData); - $knowledge_doing = $knowledge_done = array(); - } else { - $knowledge_doing = json_decode($result['knowledge_doing']); - $knowledge_done = json_decode($result['knowledge_done']); - } - $data = [ - 'knowledge_doing' => $knowledge_doing, - 'knowledge_done' => $knowledge_done - ]; - return ['code' => CODE_SUCCESS, 'msg' => '处理成功', 'data' => $data]; - }catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => $e->getMessage(), 'data' => []]; - } - } - - /** - * @usage 查找正在进行中是否包含某知识点 - * @param array $doing - * @param string $knowledge - * @return boolean - */ - public function checkDoingKnowledge($doing, $knowledge) { - foreach ($doing as $item) { - if ($item == $knowledge) { - return true; - } - } - return false; - } - - /** - * @usage 查找已完成中是否包含某知识点 - * @param array $done - * @param string $knowledge - * @return boolean - */ - public function checkDoneKnowledge($done, $knowledge) { - foreach ($done as $item) { - if ($item->name == $knowledge) { - return true; - } - } - return false; - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/OJCacheModel.php b/back_end/application/oj/model/OJCacheModel.php deleted file mode 100644 index d0b46f3c4..000000000 --- a/back_end/application/oj/model/OJCacheModel.php +++ /dev/null @@ -1,254 +0,0 @@ -cache_time = config('wutoj_config.rank_cache_time'); - } - - public function set_public_notification_cache($data) - { - try { - $ok = Cache::store('redis')->set("public_notification", $data, $this->cache_time * 6); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '更新全局通知失败', 'data' => $data]; - } - return ['code' => CODE_SUCCESS, 'msg' => '更新全局通知成功', 'data' => $data]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - public function get_public_notification_cache() - { - try { - $ok = Cache::store('redis')->get("public_notification"); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '获取全局通知失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '获取全局通知成功', 'data' => $ok]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - public function set_contest_notification_cache($contest_id, $data) - { - try { - $ok = Cache::store('redis')->set("contest_notification".$contest_id, $data, $this->cache_time * 6); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '更新比赛通知失败', 'data' => $data]; - } - return ['code' => CODE_SUCCESS, 'msg' => '更新比赛通知成功', 'data' => $data]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - public function get_contest_notification_cache($contest_id) - { - try { - $ok = Cache::store('redis')->get("contest_notification".$contest_id); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '获取全局通知失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '获取全局通知成功', 'data' => $ok]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - public function set_user_rank_cache($data) - { - try { - $ok = Cache::store('redis')->set(config('wutoj_config.user_rank_cache'), $data, $this->cache_time * 12); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '更新用户排行榜失败', 'data' => $data]; - } - return ['code' => CODE_SUCCESS, 'msg' => '更新用户排行榜成功', 'data' => $data]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - public function set_rank_cache($data, $contest_id) - { - try { - $ok = Cache::store('redis')->set('contest'.$contest_id, $data, $this->cache_time); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '更新排行榜失败', 'data' => $data]; - } - return ['code' => CODE_SUCCESS, 'msg' => '更新排行榜成功', 'data' => $data]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - public function set_password_cache($data, $user_id) - { - try { - $ok = Cache::store('redis')->set('find_password'.$user_id, $data, VALID_TIME); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '更新找回密码信息失败', 'data' => $data]; - } - return ['code' => CODE_SUCCESS, 'msg' => '更新找回密码信息成功', 'data' => $data]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - public function set_submit_cache($data) - { - try { - $ok = Cache::store('redis')->set('submit'.$data, $data, config('wutoj_config.interval_time')); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '更新提交缓存失败', 'data' => $data]; - } - return ['code' => CODE_SUCCESS, 'msg' => '更新提交缓存成功', 'data' => $data]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - public function set_update_cache($data) - { - try { - $ok = Cache::store('redis')->set('update'.$data, $data, VALID_TIME * 6 * 24); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '更新用户缓存失败', 'data' => $data]; - } - return ['code' => CODE_SUCCESS, 'msg' => '更新用户缓存成功', 'data' => $data]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - public function get_user_rank_cache() - { - try { - $ok = Cache::store('redis')->get(config('wutoj_config.user_rank_cache')); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '获取用户排行榜失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '获取用户排行榜成功', 'data' => $ok]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - public function get_rank_cache($contest_id) - { - try { - $ok = Cache::store('redis')->get('contest'.$contest_id); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '获取排行榜失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '获取排行榜成功', 'data' => $ok]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - public function get_submit_cache($data) - { - try { - $ok = Cache::store('redis')->get('submit'.$data); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '获取提交缓存失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '获取提交缓存成功', 'data' => $ok]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - public function get_password_cache($user_id) - { - try { - $ok = Cache::store('redis')->get('find_password'.$user_id); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '获取找回密码信息失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '获取找回密码信息成功', 'data' => $ok]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - public function get_update_cache($data) - { - try { - $ok = Cache::store('redis')->get('update'.$data); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '获取用户缓存失败', 'data' => $data]; - } - return ['code' => CODE_SUCCESS, 'msg' => '获取用户缓存成功', 'data' => $data]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - - /** - * @param array $data - * @param int $problem_id - * @param boolean core_only - * @return array ['code', 'msg', 'data'] - */ - public function setProblemKnowledgeCache($data, $problem_id, $core_only) { - try { - $ok = Cache::store('redis')->set("problem_knowledge".$problem_id.$core_only, $data, VALID_TIME); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '更新题目知识点信息失败', 'data' => $data]; - } - return ['code' => CODE_SUCCESS, 'msg' => '更新题目知识点信息成功', 'data' => $data]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - /** - * @param int $problem_id - * @param boolean $core_only - * @return array ['code', 'msg', 'data'] - */ - public function getProblemKnowledgeCache($problem_id, $core_only) { - try { - $ok = Cache::store('redis')->get("problem_knowledge".$problem_id.$core_only); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '获取题目知识点信息失败', 'data' => []]; - } - return ['code' => CODE_SUCCESS, 'msg' => '获取题目知识点信息成功', 'data' => $ok]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - /** - * @param int $problem_id - * @param boolean $core_only - * @return array ['code', 'msg', 'data'] - */ - public function unsetProblemKnowledgeCache($problem_id, $core_only) { - try { - $ok = Cache::store('redis')->rm("problem_knowledge".$problem_id.$core_only); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '删除题目知识点信息失败', 'data' => $ok]; - } - return ['code' => CODE_SUCCESS, 'msg' => '删除题目知识点信息成功', 'data' => $ok]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/PrivilegeModel.php b/back_end/application/oj/model/PrivilegeModel.php deleted file mode 100644 index 11c3c6fb1..000000000 --- a/back_end/application/oj/model/PrivilegeModel.php +++ /dev/null @@ -1,76 +0,0 @@ -insert(['user_id' => $user_id, 'privilege' => $privilege]); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => '']; - } else { - return ['code' => CODE_ERROR, 'msg' => '添加失败', 'data' => '']; - } - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function delePrivilege($user_id, $privilege) - { - try { - $res = $this->where(['user_id' => $user_id, 'privilege' => $privilege])->delete(); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => '']; - } else { - return ['code' => CODE_ERROR, 'msg' => '删除失败', 'data' => '']; - } - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function searchPrivilege($user_id, $privilege) - { - try { - $res = $this->where(['user_id' => $user_id, 'privilege' => $privilege])->find(); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '权限验证成功', 'data' => '权限验证成功']; - } else { - return ['code' => CODE_ERROR, 'msg' => '不存在该权限', 'data' => '不存在该权限']; - } - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function searchOnesAllPrivilege($user_id) - { - try { - $res = $this->where('user_id', $user_id)->select(); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $res]; - } else { - return ['code' => CODE_ERROR, 'msg' => '查找失败', 'data' => '']; - } - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/ProblemModel.php b/back_end/application/oj/model/ProblemModel.php deleted file mode 100644 index 51dbe7db8..000000000 --- a/back_end/application/oj/model/ProblemModel.php +++ /dev/null @@ -1,107 +0,0 @@ -alias('p') - ->field(['p.problem_id as problem_id', 'title', 'tag', 'p.time', 'p.memory/(1024*1024) as memory', 'p.type', - 'count(case when submit.status="AC" then submit.status end) as ac', - 'count(case when submit.status="WA" then submit.status end) as wa', - 'count(case when submit.status="TLE" then submit.status end) as tle', - 'count(case when submit.status="MLE" then submit.status end) as mle', - 'count(case when submit.status="RE" then submit.status end) as re', - 'count(case when submit.status="SE" then submit.status end) as se', - 'count(case when submit.status="CE" then submit.status end) as ce', - 'count(case when submit.status="AC" and submit.user_id="'.$user_id.'" then submit.status end) as accepted', - 'count(case when submit.status!="AC" and submit.user_id="'.$user_id.'" then submit.status end) as unaccepted']) - ->where('p.status', USING) - ->leftJoin('submit', 'p.problem_id = submit.problem_id') - ->group('p.problem_id') - ->limit($page * $page_limit, $page_limit)->select()->toArray(); - if (empty($info['data'])) { - return ['code' => CODE_ERROR, 'msg' => '暂无数据', 'data' => '']; - } - $info['count'] = $this->alias('p') - ->where('p.status', USING) - ->leftJoin('submit', 'p.problem_id = submit.problem_id') - ->group('p.problem_id') - ->count(); - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function searchProblemById($problem_id) - { - try { - $content = $this->field('memory', true)->field('memory/(1024*1024) as memory')->where('problem_id', $problem_id)->find(); - if ($content) { - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } - return ['code' => CODE_ERROR, 'msg' => '暂无数据', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function searchProblemByTitle($title) - { - try { - $content['data'] = $this->alias('p') - ->field(['p.problem_id as problem_id', 'title', 'tag', 'p.time', 'p.memory/(1024*1024) as memory', 'p.type', - 'count(case when submit.status="AC" then submit.status end) as ac', - 'count(case when submit.status="WA" then submit.status end) as wa', - 'count(case when submit.status="TLE" then submit.status end) as tle', - 'count(case when submit.status="MLE" then submit.status end) as mle', - 'count(case when submit.status="RE" then submit.status end) as re', - 'count(case when submit.status="SE" then submit.status end) as se', - 'count(case when submit.status="CE" then submit.status end) as ce']) - ->where('p.status', USING) - ->where('title', 'like', '%' . $title . '%') - ->leftJoin('submit', 'p.problem_id = submit.problem_id') - ->group('p.problem_id') - ->select() - ->toArray(); - if ($content['data']) { - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } - return ['code' => CODE_ERROR, 'msg' => '暂无数据', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function editProblem($problem_id, $data) - { - try { - $res = $this->where('problem_id', $problem_id)->update($data); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '编辑成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '编辑失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - -} \ No newline at end of file diff --git a/back_end/application/oj/model/ReplyModel.php b/back_end/application/oj/model/ReplyModel.php deleted file mode 100644 index e09dcd46e..000000000 --- a/back_end/application/oj/model/ReplyModel.php +++ /dev/null @@ -1,44 +0,0 @@ -strict(false)->insert($data); - if($info === false){ - return ['code' => CODE_ERROR, 'msg' => '添加失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function get_the_discuss($discuss_id, $page) - { - try{ - $page_limit = config('wutoj_config.page_limit'); - $info['data'] = $this - ->field(['reply.id as id','reply.user_id as user_id', 'nick', 'avatar', 'discuss_id', 'content', 'time']) - ->where('discuss_id', $discuss_id) - ->limit($page * $page_limit, $page_limit) - ->join('users','reply.user_id = users.user_id') - ->select() - ->toArray(); - $info['count'] = $this->where('discuss_id', $discuss_id)->count(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/RotationModel.php b/back_end/application/oj/model/RotationModel.php deleted file mode 100644 index 52db08f96..000000000 --- a/back_end/application/oj/model/RotationModel.php +++ /dev/null @@ -1,73 +0,0 @@ -strict(false)->insert($data); - if ($info != true) { - return ['code' => CODE_ERROR, 'msg' => '添加失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => '']; - } - } - - public function delete_rotation($id) - { - try { - if (!$this->where('id', $id)->find()) { - return ['code' => USERNAME_IS_EXIST, 'msg' => '该轮播图不存在', 'data' => $this->getError()]; - } - $info = $this->where('id', $id)->delete(); - if ($info != true) { - return ['code' => CODE_ERROR, 'msg' => '删除失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => '']; - } - } - - public function get_all_rotation() - { - try { - $info = $this->where('status', 1)->select(); - if ($info != true) { - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info->toArray()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => '']; - } - } - - public function get_the_rotation($id) - { - try { - $info = $this->where('id', $id)->find(); - if (empty($info)) { - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => '']; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/SampleModel.php b/back_end/application/oj/model/SampleModel.php deleted file mode 100644 index b5d21c0a6..000000000 --- a/back_end/application/oj/model/SampleModel.php +++ /dev/null @@ -1,105 +0,0 @@ -insert([ - 'problem_id' => $problem_id, - 'input' => $input, - 'output' => $output - ]); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => '']; - } else { - return ['code' => CODE_ERROR, 'msg' => '添加失败', 'data' => '']; - } - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function searchSampleByID($id) - { - try { - $content = $this->where('sample_id', $id)->find(); - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function searchSampleByProblemID($problem_id) - { - try { - $content = $this->where('problem_id', $problem_id)->select(); - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function deleSample($id) - { - try { - $res = $this->where('sample_id', $id)->delete(); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => '']; - } else { - return ['code' => CODE_ERROR, 'msg' => '删除失败', 'data' => '']; - } - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function editSample($id, $input, $output) - { - try { - $res = $this->where('sample_id', $id) - ->setField([ - 'input' => $input, - 'output' => $output - ]); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '编辑成功', 'data' => '']; - } else { - return ['code' => CODE_ERROR, 'msg' => '编辑失败', 'data' => $res]; - } - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function editSampleByProblemID($id, $input, $output) - { - try { - $res = $this->where('problem_id', $id) - ->update([ - 'input' => $input, - 'output' => $output - ]); - if ($res !== false) { - return ['code' => CODE_SUCCESS, 'msg' => '编辑成功', 'data' => '']; - } else { - return ['code' => CODE_ERROR, 'msg' => '编辑失败', 'data' => $input]; - } - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/SubmitModel.php b/back_end/application/oj/model/SubmitModel.php deleted file mode 100644 index 333cd0aa0..000000000 --- a/back_end/application/oj/model/SubmitModel.php +++ /dev/null @@ -1,105 +0,0 @@ -field(['submit.user_id as user_id', 'submit.nick as nick', 'avatar', 'users.realname as realname', 'language', 'users.school as school','problem_id', 'submit.status as status', 'time', 'memory', 'submit_time']) - ->where($where) - ->withAttr('language', function($value) { - $language = [0=>'c.gcc', 1=>'cpp.g++', 2=>'java.openjdk10', 3=>'python.cpython3.6']; - return $language[$value]; - }) - ->leftJoin('users', 'submit.user_id = users.user_id') - ->order('submit.id', $order)->select()->toArray(); - foreach ($info as &$item){ - $item['nick'] = $item['realname'].' '.$item['school']; - unset($item['realname']); - unset($item['school']); - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getTrace()]; - } - } - - // TODO 重构 - public function get_the_submit($where, $page) - { - try { - $page_limit = config('wutoj_config.page_limit'); - $language = config('wutoj_config.language'); - $sql = $this - ->field(['submit.id as runid','submit.user_id as user_id','users.nick as nick', 'avatar', 'problem_id', 'language', 'submit.status as status', 'time', 'memory', 'submit_time']) - ->where($where) - ->order('submit.id', 'desc') - ->limit($page * $page_limit, $page_limit) - ->join('users','submit.user_id = users.user_id') - ->buildSql(); - $info['submit_info'] = Db::query($sql); - foreach ($info['submit_info'] as &$item){ - $item['language'] = $language[$item['language']]; - } - $info['count'] = $this->where($where)->count(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function get_a_submit($where){ - try { - $language = config('wutoj_config.language'); - $info = $this->field(['submit.id as runid','submit.user_id as user_id','users.nick as nick', 'problem_id', 'language', 'submit.status as status', 'time', 'memory', 'submit_time', 'source_code', 'msg']) - ->where($where)->order('submit_time')->join('users','submit.user_id = users.user_id')->buildSql(); - $info = Db::query($info); - foreach ($info as &$item){ - $item['language'] = $language[$item['language']]; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getTrace()]; - } - } - public function add_submit($data) - { - $info = $this->strict(false)->insertGetId($data); - if ($info === 0) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '提交成功', 'data' => $info]; - } - - /** - * @param $where - * @param $page - * @return array - * 等憨批叫我写分页的时候用 - */ - public function get_page_submit($where, $page) - { - try { - $info = $this->field(['user_id', 'nick', 'problem_id', 'status', 'time', 'memory', 'submit_time']) - ->where($where)->order('submit_time')->page($page,10)->select()->toArray(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getTrace()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/SubmitlogModel.php b/back_end/application/oj/model/SubmitlogModel.php deleted file mode 100644 index fd0a134d8..000000000 --- a/back_end/application/oj/model/SubmitlogModel.php +++ /dev/null @@ -1,59 +0,0 @@ -strict(false)->insert($data); - if ($info != true) { - return ['code' => CODE_ERROR, 'msg' => '添加失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getTrace()]; - } - } - - public function get_the_log() - { - try { - $info = $this->whereTime('time', '-312 hours')->select(); - if ($info == false) { - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info->toArray()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getTrace()]; - } - } - - public function get_all_log() - { - try { - $ac = $this->whereTime('time', '>', '1900-01-01')->sum('ac'); - $data = $this->whereTime('time', '>', '1900-01-01')->sum('submit'); - $info = array( - 'ac' => $ac, - 'submit' => $data, - ); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getTrace()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/TagModel.php b/back_end/application/oj/model/TagModel.php deleted file mode 100644 index 2740b0355..000000000 --- a/back_end/application/oj/model/TagModel.php +++ /dev/null @@ -1,86 +0,0 @@ -where($where) - ->limit($limit, $offset) - ->withAttr('status', function($value) { - $status = [-1=>'删除', 0=>'禁用', 1=>'正常']; - return $status[$value]; - }) - ->select() - ->toArray(); - if(empty($info)){ - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function getTheTag($id) - { - try{ - $info = $this->where('id', $id)->find(); - if(empty($info)){ - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => $info]; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function addTag($data) - { - try{ - $info = $this->strict(false)->insert($data); - if($info === false){ - return ['code' => CODE_ERROR, 'msg' => '添加标签失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '添加标签成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function editTag($data) - { - try{ - $info = $this->where('id', $data['id'])->update($data); - if($info === false){ - return ['code' => CODE_ERROR, 'msg' => '编辑标签失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '编辑标签成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function deleTag($id) - { - try{ - $info = $this->where('id', $id)->delete(); - if($info === false){ - return ['code' => CODE_ERROR, 'msg' => '删除标签失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '删除标签成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/model/UserModel.php b/back_end/application/oj/model/UserModel.php deleted file mode 100644 index cc6c6927f..000000000 --- a/back_end/application/oj/model/UserModel.php +++ /dev/null @@ -1,127 +0,0 @@ -where('nick', $data['nick'])->find(); - if (!empty($info)) { - return ['code' => USERNAME_IS_EXIST, 'msg' => '该昵称已被注册', 'data' => '']; - } - $res = $this->strict(false)->insert($data); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => '']; - } else { - return ['code' => CODE_ERROR, 'msg' => '添加失败', 'data' => '']; - } - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function editUser($user_id = 0, $data, $nick = 0) - { - try { - if($user_id !== 0){ - $info = $this->where('user_id', $user_id)->update($data); - } else { - $info = $this->where('nick', $nick)->update($data); - } - if ($info !== 0) { - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } - return ['code' => CODE_ERROR, 'msg' => '更新失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function searchUserById($user_id) - { - try { - $content = $this - ->field(['user_id', 'nick', 'avatar', 'realname', 'school', 'major', 'class', 'contact', 'mail', 'desc']) - ->where('user_id', $user_id)->find(); - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function searchUserByNick($nick) - { - try { - $content = $this - ->field(['user_id', 'nick', 'avatar', 'realname', 'school', 'major', 'class', 'contact', 'mail', 'desc']) - ->where('nick', $nick)->find(); - if (empty($content)) { - return ['code' => CODE_ERROR, 'msg' => '用户名不存在', 'data' => $content]; - } - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function loginCheck($req) - { - // uncheck - try { - $res = $this->where([['nick', '=', $req['nick']], ['password', '=', $req['password']]]) - ->find(); - if ($res) { - $res['all_problems'] = Db::table('submit') - ->field(['status', 'count(*) as cnt']) - ->where('user_id', $res['user_id']) - ->group('status') - ->select(); - $cnt = Db::table('submit') - ->field(['count(distinct problem_id) as cnt']) - ->where('user_id', $res['user_id']) - ->where('status', 'AC') - ->select(); - if($res['all_problems'] == null){ - $res['all_problems'] = array(0 => array('status' => 'AC', 'cnt' => 0)); - } - $tmp = $res['all_problems']; - foreach ($tmp as &$item){ - if($item['status'] === 'AC'){ - $item['cnt'] = $cnt[0]['cnt']; - } - } - $res['all_problems'] = $tmp; - return ['code' => CODE_SUCCESS, 'msg' => '登陆成功', 'data' => $res]; - } - return ['code' => CODE_ERROR, 'msg' => '用户名或密码错误', 'data' => '']; - } catch (Exception $e) { - var_dump($e->getMessage()); - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function user_rank($offset) - { - try { - $info = $this->field(['user_id', 'nick', 'school', 'desc', 'ac_num', 'wa_num']) - ->where('state', 0)->order('ac_num')->limit($offset, config())->select()->toArray(); - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - -} \ No newline at end of file diff --git a/back_end/application/oj/model/UsergroupModel.php b/back_end/application/oj/model/UsergroupModel.php deleted file mode 100644 index d19b9bf07..000000000 --- a/back_end/application/oj/model/UsergroupModel.php +++ /dev/null @@ -1,116 +0,0 @@ -alias(['user_group' => 'ug']) - ->field(['ug.group_id as group_id', 'group.avatar as avatar', 'group_name', 'identity', 'desc']) - ->where('user_id', $user_id) - ->where('group.status', 0) - ->rightJoin('group', 'ug.group_id = group.group_id') - ->group('ug.group_id') - ->withAttr('identity', function($value) { - $identity = [0=>'正常', 1=>'管理员', 2=>'创建者']; - return $identity[$value]; - }) - ->limit($page * $page_limit, $page_limit) - ->select() - ->toArray(); - if (empty($info['data'])) { - return ['code' => CODE_ERROR, 'msg' => '暂无数据', 'data' => '']; - } - foreach ($info['data'] as &$item){ - $item['count'] = $this->where('group_id', $item['group_id'])->count(); - } - $info['count'] = $this->alias(['user_group' => 'ug'])->where('user_id', $user_id) - ->where('group.status', 0)->rightJoin('group', 'ug.group_id = group.group_id') ->count(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function find_user($group_id) - { - try { - $info = $this->alias(['user_group' => 'ug']) - ->field(['ug.user_id as user_id', 'ug.identity as identity', 'nick', 'school', 'major', 'class', 'realname']) - ->where('group_id', $group_id) - ->rightJoin('users', 'ug.user_id = users.user_id') - ->withAttr('identity', function($value) { - $identity = [0=>'正常', 1=>'管理员', 2=>'创建者']; - return $identity[$value]; - }) - ->select() - ->toArray(); - if (empty($info)) { - return ['code' => CODE_ERROR, 'msg' => '暂无数据', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => '']; - } - } - - /** - * @param $group_id - * @param $user_id - * @return array['int','string','object'] - */ - public function searchRelation($group_id, $user_id) - { - try { - $content = $this->where([['group_id', '=', $group_id, 'user_id', '=', $user_id]])->select()[0]; // return object - if ($content) { - return ['code' => CODE_SUCCESS, 'msg' => '成功', 'data' => $content]; - } - return ['code' => CODE_ERROR, 'msg' => '失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function addRelation($group_id, $user_id, $identity) - { - try { - $res = $this->insert(['group_id' => $group_id, 'user_id' => $user_id, 'identity' => $identity]); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '你已在团队中', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - public function deleRelation($group_id, $user_id) - { - try { - $res = $this->where([['group_id', '=', $group_id, 'user_id', '=', $user_id]])->delete(); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/oj/validate/ContestValidate.php b/back_end/application/oj/validate/ContestValidate.php deleted file mode 100644 index 856964e20..000000000 --- a/back_end/application/oj/validate/ContestValidate.php +++ /dev/null @@ -1,50 +0,0 @@ - 'require|number', - 'group_id' => 'require|number', - 'contest_name' => 'require', - 'begin_time' => 'require|date', - 'end_time' => 'require|date', - 'frozen' => 'require|float|<:1', - 'problems' => 'require|array', - ]; - - protected $message = [ - 'contest_id.require' => '缺少比赛ID', - 'group_id.require' => '缺少团队ID', - 'contest_name.require' => '缺少比赛名称', - 'begin_time.require' => '缺少开始时间', - 'end_time.require' => '缺少结束时间', - 'frozen.require' => '缺少封榜时间比', - 'problems.require' => '缺少比赛题目', - 'contest_id.number' => '比赛ID为数字', - 'begin_time.date' => '时间格式错误', - 'end_time.date' => '时间格式错误', - 'frozen.float' => '封榜时间比错误', - 'frozen.<:1' => '封榜时间比错误', - 'problems.array' => '题目传值错误', - ]; - - protected $scene = [ - 'searchContest' => ['contest_name'], - 'searchContest1' => ['contest_id'], - 'deleContest' => ['contest_id'], - 'newContest' => ['contest_name', 'begin_time', 'end_time', 'frozen', 'problems'], - 'addContest' => ['group_id', 'contest_name', 'begin_time', 'end_time', 'frozen', 'problems'], - 'editContest' => ['contest_id', 'contest_name', 'begin_time', 'end_time', 'frozen', 'problems'], - ]; -} \ No newline at end of file diff --git a/back_end/application/oj/validate/DiscussValidate.php b/back_end/application/oj/validate/DiscussValidate.php deleted file mode 100644 index f1db2abcc..000000000 --- a/back_end/application/oj/validate/DiscussValidate.php +++ /dev/null @@ -1,30 +0,0 @@ - 'require', - 'problem_id' => 'require', - 'title' => 'require|max:30', - 'content' => 'require|max:10000', - ]; - - protected $message = [ - 'contest_id.require' => '未选中比赛', - 'problem_id.require' => '未选中题目', - 'title.require' => '未填写标题', - 'title.max' => '标题长度超限', - 'content.require' => '未填写内容', - 'content.max' => '内容长度超限', - ]; - - protected $scene = [ - 'add_discuss' => ['problem_id', 'title', 'content'], - ]; -} \ No newline at end of file diff --git a/back_end/application/oj/validate/FeedbackValidate.php b/back_end/application/oj/validate/FeedbackValidate.php deleted file mode 100644 index 26ff8bc2b..000000000 --- a/back_end/application/oj/validate/FeedbackValidate.php +++ /dev/null @@ -1,46 +0,0 @@ - 'require', - 'title' => 'require', - 'content' => 'require', -// 'realname' => 'require', -// 'cardno' => - 'type' => 'require', - 'phone' => 'require', - 'problem_id' => 'require', - 'problem_type' => 'require', - ]; - - // 不符规则的错误提示 - protected $message = [ - //'token.require' => '未获取到token令牌', - 'id.require' => '未获取到反馈id', - 'title.require' => '未获取到标题', - 'content.require' => '未获取到问题内容', - 'type.require' => '未获取到手机类别', - 'phone.require' => '未获取到手机号', - 'problem_id.require' => '未获取到问题id', - 'problem_type.require' => '未获取到问题类别', - ]; - - // 场景验证 - protected $scene = [ - 'add_feedback' => ['content'], - 'delete_feedback' => ['id'], - 'look_feedback' => ['id'], - 'look_problem' => ['problem_id'], - 'look_type' => ['problem_type'], - ]; -} \ No newline at end of file diff --git a/back_end/application/oj/validate/GroupValidate.php b/back_end/application/oj/validate/GroupValidate.php deleted file mode 100644 index 40cd082eb..000000000 --- a/back_end/application/oj/validate/GroupValidate.php +++ /dev/null @@ -1,39 +0,0 @@ - 'require|number', - 'group_name' => 'require|max:64', - 'desc' => 'require', - 'group_creator' => 'require|number', - 'join_code' => 'require' - ]; - - protected $message = [ - 'group_id.require' => '未获取到团队id', - 'group_id.number' => '请输入数字', - 'group_name.require' => '请输入分组名称', - 'group_name.max' => '分组名称应小于64个字符', - 'group_creator.require' => '缺少创建者ID', - 'group_creator.number' => '创建者ID格式不正确', - 'desc.require' => '缺少团队描述', - 'join_code.require' => '缺少加群码' - ]; - - protected $scene = [ - 'get_the_group' => ['group'], - 'add_group' => ['group_name', 'desc', 'join_code'], - 'join_group' => ['group_id', 'join_code'], - ]; -} \ No newline at end of file diff --git a/back_end/application/oj/validate/KnowledgeValidate.php b/back_end/application/oj/validate/KnowledgeValidate.php deleted file mode 100644 index 897c480bc..000000000 --- a/back_end/application/oj/validate/KnowledgeValidate.php +++ /dev/null @@ -1,38 +0,0 @@ - 'require', - 'pre_knowledge' => 'require', - 'problem' => 'require', - 'user_id' => 'require', - 'knowledge_id' => 'require' - ]; - - protected $message = [ - 'knowledge.require' => '未输入知识点', - 'pre_knowledge.require' => '未输入前置知识点', - 'problem.require' => '未输入问题', - 'user_id' => '未输入用户id', - 'knowledge_id' => '未输入知识点id' - ]; - - protected $scene = [ - 'add_knowledge' => ['knowledge'], - 'delete_knowledge' => ['knowledge'], - 'add_knowledge_relation' => ['knowledge', 'pre_knowledge'], - 'delete_knowledge_relation' => ['knowledge', 'pre_knowledge'], - 'get_knowledge' => ['knowledge'] , - 'set_knowledge_relation' => ['knowledge', 'pre_knowledge'], - 'get_problem_by_knowledge' => ['knowledge'], - 'get_knowledge_by_problem' => ['problem'], - 'handle_knowledge_problem_relation' => ['knowledge', 'problem'], - 'user_all_knowledge' => ['user_id'], - 'user_specific_knowledge' => ['user_id', 'knowledge'], - 'knowledge_id' => ['knowledge_id'] - ]; -} diff --git a/back_end/application/oj/validate/ProblemValidate.php b/back_end/application/oj/validate/ProblemValidate.php deleted file mode 100644 index 00cbb9a61..000000000 --- a/back_end/application/oj/validate/ProblemValidate.php +++ /dev/null @@ -1,41 +0,0 @@ - 'require|number', - 'search' => 'require', - 'title' => 'require', - 'background' => 'require', - 'describe' => 'require', - ]; - - protected $message = [ - 'problem_id.require' => '请输入题目序号', - 'problem_id.number' => '请输入正确题号', - 'search.require' => '请输入搜索内容', - 'title.require' => '请输入标题', - 'background.require' => '请输入背景', - 'describe.require' => '请输入描述', - ]; - - protected $scene = [ - 'displayProblem' => ['problem_id'], - 'search' => ['search'], - 'newProblem' => ['title', 'background', 'describe'], - 'editProblem' => ['problem_id', 'title', 'background', 'describe'], - ]; -} \ No newline at end of file diff --git a/back_end/application/oj/validate/ReplyValidate.php b/back_end/application/oj/validate/ReplyValidate.php deleted file mode 100644 index 41417b95b..000000000 --- a/back_end/application/oj/validate/ReplyValidate.php +++ /dev/null @@ -1,25 +0,0 @@ - 'require', - 'content' => 'require|max:200', - ]; - - protected $message = [ - 'id.require' => '未选中回复', - 'content.require' => '未填写内容', - 'contest.max' => '内容长度超限', - ]; - - protected $scene = [ - 'add_reply' => ['id', 'content'], - ]; -} \ No newline at end of file diff --git a/back_end/application/oj/validate/SampleValidate.php b/back_end/application/oj/validate/SampleValidate.php deleted file mode 100644 index 875e69631..000000000 --- a/back_end/application/oj/validate/SampleValidate.php +++ /dev/null @@ -1,24 +0,0 @@ - 'require', - 'problem_id' => 'require|number', - 'source_code' => 'require|max:20000', - 'status_id' => 'require|number', - ]; - - protected $message = [ - 'language.require' => '请选择语言', - 'problem_id.require' => '请选择题目', - 'problem_id.number' => '请使用数字', - 'source_code.require' => '请填写代码', - 'source_code.max' => '超过代码长度限制', - 'status_id.require' => '缺少status_id参数', - 'status_id.number' => 'status_id参数格式不正确', - ]; - - protected $scene = [ - 'submit' => ['language', 'problem_id', 'source_code'], - 'getSubmitStatus' => ['status_id'], - ]; -} \ No newline at end of file diff --git a/back_end/application/oj/validate/UserValidate.php b/back_end/application/oj/validate/UserValidate.php deleted file mode 100644 index 3674dffd6..000000000 --- a/back_end/application/oj/validate/UserValidate.php +++ /dev/null @@ -1,70 +0,0 @@ - 'require', - 'nick' => 'require|max:25', - 'password' => 'require|length:6,16', - 'old_password' => 'require|length:6,16', - 'password_check' => 'require|length:6,16', - 'identify' => 'in:-1,0,1,2,3', - 'realname' => 'require', - 'school' => 'require', - 'major' => 'require', - 'class' => 'require', - 'contact' => 'require', - 'mail' => 'require|email', - 'check' => 'require', - 'status' => 'require|in:-1,0' - ]; - - protected $message = [ - 'user_id.require' => '缺少用户id', - 'nick.require' => '缺少用户昵称', - 'nick.max' => '昵称最长25个字符', - 'password.require' => '缺少密码', - 'password.length' => '密码长度不正确', - 'old_password.require' => '缺少旧密码', - 'old_password.length' => '旧密码长度不正确', - 'password_check.length' => '密码长度不正确', - 'password_check.require' => '请再次输入密码', - 'identify.in' => '用户身份异常', - 'realname.require' => '请输入真实姓名', - 'school.require' => '请输入学校', - 'major.require' => '请输入专业', - 'class.require' => '请输入班级', - 'contact.require' => '请留下你的联系方式', - 'mail.require' => '请输入邮箱', - 'mail.email' => '邮箱格式错误', - 'check.require' => '请填写验证码', - 'status.require' => '请填写用户身份', - 'status.in' => '用户状态异常' - ]; - - protected $scene = [ - 'addUser' => ['nick', 'password', 'realname', 'school', 'major', 'class', 'contact', 'mail', 'status'], - 'editUser' => ['realname', 'school', 'major', 'class', 'contact', 'mail', 'status'], - 'searchUser_id' => ['user_id'], - 'searchUser_nick' => ['nick'], - 'deleteUser' => ['user_id'], - 'foreAddUser' => [], - 'login' => ['nick', 'password'], - 'register' => ['nick', 'password', 'password_check', 'realname', 'school', 'major', 'class', 'contact', 'mail'], - 'forget' => ['nick', 'mail'], - 'forget_password' => ['nick', 'password', 'password_check', 'check'], - 'change_password' => ['nick', 'old_password', 'password', 'password_check'], - ]; -} \ No newline at end of file diff --git a/back_end/application/oj/view/test/login.html b/back_end/application/oj/view/test/login.html deleted file mode 100644 index da9daf2cb..000000000 --- a/back_end/application/oj/view/test/login.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - Login Test - - - - - - -
- - -
- - - - \ No newline at end of file diff --git a/back_end/application/panel/common.php b/back_end/application/panel/common.php deleted file mode 100644 index 947f30d95..000000000 --- a/back_end/application/panel/common.php +++ /dev/null @@ -1,37 +0,0 @@ - $val) { - if ($val->name === 'iDisplayStart') { - $data['offset'] = $val->value; - } - if ($val->name === 'iDisplayLength'){ - $data['limit']= $val->value; - } - if ($val->name === 'sSearch' && $val->value !== '') { - array_push($data['where'], [$column, 'like', '%' . $val->value . '%']); - } - } - return $data; -} - -function datatable_response($code, $where, $data, $model) -{ - $response = array( - 'recordsTotal' => 0, - 'recordsFiltered' => 0, - 'data' => '' - ); - if($code === CODE_SUCCESS){ - $count = $model->where($where)->count(); - $response['recordsTotal'] = $count; - $response['recordsFiltered'] = $count; - $response['data'] = $data; - } - return json_encode($response); -} \ No newline at end of file diff --git a/back_end/application/panel/config/app.php b/back_end/application/panel/config/app.php deleted file mode 100644 index 78ae4b402..000000000 --- a/back_end/application/panel/config/app.php +++ /dev/null @@ -1,142 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 应用设置 -// +---------------------------------------------------------------------- - -return [ - // 应用名称 - 'app_name' => '', - // 应用地址 - 'app_host' => '', - // 应用调试模式 - 'app_debug' => false, - // 应用Trace - 'app_trace' => false, - // 是否支持多模块 - 'app_multi_module' => true, - // 入口自动绑定模块 - 'auto_bind_module' => false, - // 注册的根命名空间 - 'root_namespace' => [], - // 默认输出类型 - 'default_return_type' => 'html', - // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', - // 默认JSONP格式返回的处理方法 - 'default_jsonp_handler' => 'jsonpReturn', - // 默认JSONP处理方法 - 'var_jsonp_handler' => 'callback', - // 默认时区 - 'default_timezone' => 'Asia/Shanghai', - // 是否开启多语言 - 'lang_switch_on' => false, - // 默认全局过滤方法 用逗号分隔多个 - 'default_filter' => '', - // 默认语言 - 'default_lang' => 'zh-cn', - // 应用类库后缀 - 'class_suffix' => false, - // 控制器类后缀 - 'controller_suffix' => false, - - // +---------------------------------------------------------------------- - // | 模块设置 - // +---------------------------------------------------------------------- - - // 默认模块名 - 'default_module' => 'index', - // 禁止访问模块 - 'deny_module_list' => ['common'], - // 默认控制器名 - 'default_controller' => 'Index', - // 默认操作名 - 'default_action' => 'index', - // 默认验证器 - 'default_validate' => '', - // 默认的空模块名 - 'empty_module' => '', - // 默认的空控制器名 - 'empty_controller' => 'Error', - // 操作方法前缀 - 'use_action_prefix' => false, - // 操作方法后缀 - 'action_suffix' => '', - // 自动搜索控制器 - 'controller_auto_search' => false, - - // +---------------------------------------------------------------------- - // | URL设置 - // +---------------------------------------------------------------------- - - // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', - // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], - // pathinfo分隔符 - 'pathinfo_depr' => '/', - // HTTPS代理标识 - 'https_agent_name' => '', - // IP代理获取标识 - 'http_agent_ip' => 'X-REAL-IP', - // URL伪静态后缀 - 'url_html_suffix' => 'html', - // URL普通方式参数 用于自动生成 - 'url_common_param' => false, - // URL参数方式 0 按名称成对解析 1 按顺序解析 - 'url_param_type' => 0, - // 是否开启路由延迟解析 - 'url_lazy_route' => false, - // 是否强制使用路由 - 'url_route_must' => false, - // 合并路由规则 - 'route_rule_merge' => false, - // 路由是否完全匹配 - 'route_complete_match' => false, - // 使用注解路由 - 'route_annotation' => false, - // 域名根,如thinkphp.cn - 'url_domain_root' => '', - // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, - // 默认的访问控制器层 - 'url_controller_layer' => 'controller', - // 表单请求类型伪装变量 - 'var_method' => '_method', - // 表单ajax伪装变量 - 'var_ajax' => '_ajax', - // 表单pjax伪装变量 - 'var_pjax' => '_pjax', - // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, - // 请求缓存有效期 - 'request_cache_expire' => null, - // 全局请求缓存排除规则 - 'request_cache_except' => [], - - // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - - // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', - - // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', - // 显示错误信息 - 'show_error_msg' => false, - // 异常处理handle类 留空使用 \think\exception\Handle - 'exception_handle' => '', - - 'begin' => '2018-09-10 00:00:00', - 'finish' => '2018-09-25 23:59:59', -]; diff --git a/back_end/application/panel/config/cache.php b/back_end/application/panel/config/cache.php deleted file mode 100644 index 5d8d9c792..000000000 --- a/back_end/application/panel/config/cache.php +++ /dev/null @@ -1,36 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 缓存设置 -// +---------------------------------------------------------------------- - -return [ - 'type' => 'complex', - 'default' => [ - 'type' => 'file', - // 全局缓存有效期(0为永久有效) - 'expire'=> 5, - // 缓存前缀 - 'prefix'=> 'think', - // 缓存目录 - 'path' => '../runtime/cache/', - ], - 'redis' => [ - 'type' => 'redis', - 'host' => 'localhost', - // 全局缓存有效期(0为永久有效) - 'expire'=> 5, - // 缓存前缀 - 'prefix'=> 'think', - ], - // 添加更多的缓存类型设置 -]; diff --git a/back_end/application/panel/config/console.php b/back_end/application/panel/config/console.php deleted file mode 100644 index b0f9165ac..000000000 --- a/back_end/application/panel/config/console.php +++ /dev/null @@ -1,19 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 控制台配置 -// +---------------------------------------------------------------------- -return [ - 'name' => 'Think Console', - 'version' => '0.1', - 'user' => null, -]; diff --git a/back_end/application/panel/config/cookie.php b/back_end/application/panel/config/cookie.php deleted file mode 100644 index 1de07082a..000000000 --- a/back_end/application/panel/config/cookie.php +++ /dev/null @@ -1,30 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | Cookie设置 -// +---------------------------------------------------------------------- -return [ - // cookie 名称前缀 - 'prefix' => '', - // cookie 保存时间 - 'expire' => 0, - // cookie 保存路径 - 'path' => '/', - // cookie 有效域名 - 'domain' => '', - // cookie 启用安全传输 - 'secure' => false, - // httponly设置 - 'httponly' => '', - // 是否使用 setcookie - 'setcookie' => true, -]; diff --git a/back_end/application/panel/config/database.php b/back_end/application/panel/config/database.php deleted file mode 100644 index 296830444..000000000 --- a/back_end/application/panel/config/database.php +++ /dev/null @@ -1,63 +0,0 @@ - -// +---------------------------------------------------------------------- - -return [ - // 数据库类型 - 'type' => 'mysql', - // 服务器地址 - 'hostname' => '127.0.0.1', - // 数据库名 - 'database' => 'online_judge', - // 用户名 - 'username' => 'root', - // 密码 - 'password' => '', - // 端口 - 'hostport' => '', - // 连接dsn - 'dsn' => '', - // 数据库连接参数 - 'params' => [], - // 数据库编码默认采用utf8 - 'charset' => 'utf8', - // 数据库表前缀 - 'prefix' => '', - // 数据库调试模式 - 'debug' => true, - // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, - // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, - // 读写分离后 主服务器数量 - 'master_num' => 1, - // 指定从服务器序号 - 'slave_no' => '', - // 自动读取主库数据 - 'read_master' => false, - // 是否严格检查字段是否存在 - 'fields_strict' => true, - // 数据集返回类型 - 'resultset_type' => 'array', - // 自动写入时间戳字段 - 'auto_timestamp' => false, - // 时间字段取出后的默认时间格式 - 'datetime_format' => 'Y-m-d H:i:s', - // 是否需要进行SQL性能分析 - 'sql_explain' => false, - // Builder类 - 'builder' => '', - // Query类 - 'query' => '\\think\\db\\Query', - // 是否需要断线重连 - 'break_reconnect' => false, - // 断线标识字符串 - 'break_match_str' => [], -]; diff --git a/back_end/application/panel/config/log.php b/back_end/application/panel/config/log.php deleted file mode 100644 index b3d87b4a9..000000000 --- a/back_end/application/panel/config/log.php +++ /dev/null @@ -1,30 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 日志设置 -// +---------------------------------------------------------------------- -return [ - // 日志记录方式,内置 file socket 支持扩展 - 'type' => 'File', - // 日志保存目录 - 'path' => '', - // 日志记录级别 - 'level' => [], - // 单文件日志写入 - 'single' => false, - // 独立日志级别 - 'apart_level' => [], - // 最大日志文件数量 - 'max_files' => 0, - // 是否关闭日志写入 - 'close' => false, -]; diff --git a/back_end/application/panel/config/session.php b/back_end/application/panel/config/session.php deleted file mode 100644 index 1d7b6c60f..000000000 --- a/back_end/application/panel/config/session.php +++ /dev/null @@ -1,26 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 会话设置 -// +---------------------------------------------------------------------- - -return [ - 'id' => '', - // SESSION_ID的提交变量,解决flash上传跨域 - 'var_session_id' => '', - // SESSION 前缀 - 'prefix' => 'think', - // 驱动方式 支持redis memcache memcached - 'type' => '', - // 是否自动开启 SESSION - 'auto_start' => true, -]; diff --git a/back_end/application/panel/config/template.php b/back_end/application/panel/config/template.php deleted file mode 100644 index 44c33aeba..000000000 --- a/back_end/application/panel/config/template.php +++ /dev/null @@ -1,44 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 模板设置 -// +---------------------------------------------------------------------- - -return [ - // 模板引擎类型 支持 php think 支持扩展 - 'type' => 'Think', - // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 - 'auto_rule' => 1, - // 模板路径 - 'view_path' => '', - // 模板后缀 - 'view_suffix' => 'html', - // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, - // 模板引擎普通标签开始标记 - 'tpl_begin' => '{', - // 模板引擎普通标签结束标记 - 'tpl_end' => '}', - // 标签库标签开始标记 - 'taglib_begin' => '{', - // 标签库标签结束标记 - 'taglib_end' => '}', - //模板参数替换 - 'tpl_replace_string' => [ - '__CSS__' => '/back_end/public/static/css', - '__FONT__' => '/back_end/public/static/fonts', - '__JS__' => '/back_end/public/static/js', - '__IMG__' => '/back_end/public/static/images', - '__DT__' => '/back_end/public/static/datatable', - '__PANEL__' => '/back_end/panel', - ] -]; diff --git a/back_end/application/panel/config/trace.php b/back_end/application/panel/config/trace.php deleted file mode 100644 index 425d30148..000000000 --- a/back_end/application/panel/config/trace.php +++ /dev/null @@ -1,18 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | Trace设置 开启 app_trace 后 有效 -// +---------------------------------------------------------------------- -return [ - // 内置Html Console 支持扩展 - 'type' => 'Html', -]; diff --git a/back_end/application/panel/controller/Base.php b/back_end/application/panel/controller/Base.php deleted file mode 100644 index 8765ca1e4..000000000 --- a/back_end/application/panel/controller/Base.php +++ /dev/null @@ -1,95 +0,0 @@ - 'index', - 'a' => 'index', - 'title' => '控制台', - 'icon' => 'dashboard', - 'child' => array() - ), - array( - 'c' => 'problem', - 'a' => 'index', - 'title' => '题目列表', - 'icon' => '', - 'child' => array() - ), - array( - 'c' => 'tag', - 'a' => 'index', - 'title' => '标签列表', - 'icon' => '', - 'child' => array() - ), - array( - 'c' => 'contest', - 'a' => 'index', - 'title' => '比赛列表', - 'icon' => '', - 'child' => array() - ), - array( - 'c' => 'user', - 'a' => 'index', - 'title' => '用户列表', - 'icon' => '', - 'child' => array() - ), - array( - 'c' => 'submit', - 'a' => 'index', - 'title' => '提交列表', - 'icon' => '', - 'child' => array() - ), - array( - 'c' => 'knowledge', - 'a' => 'index', - 'title' => '知识树列表', - 'icon' => '', - 'child' => array() - ), - array( - 'c' => 'role', - 'a' => 'index', - 'title' => '权限管理', - 'icon' => '', - 'child' => array() - ), - array( - 'c' => 'notification', - 'a' => 'index', - 'title' => '通知管理', - 'icon' => '', - 'child' => array() - ) - ); - - /** - * 登录检测 - */ - public function __construct() - { - parent::__construct(); -// halt(session('identity')); - if (!Session::has('user_id')) { - $this->redirect(config('wutoj_config.oj_url')); - } - if (Session::get('identity') !== ADMINISTRATOR){ - $this->redirect(config('wutoj_config.oj_url')); - } - $this->assign('realname', session('nick')); - $this->assign('menu', $this->menu); - } -} \ No newline at end of file diff --git a/back_end/application/panel/controller/Contest.php b/back_end/application/panel/controller/Contest.php deleted file mode 100644 index 7d801ba2d..000000000 --- a/back_end/application/panel/controller/Contest.php +++ /dev/null @@ -1,168 +0,0 @@ -scene('newContest')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $contest_validate->getError(), ''); - } - foreach ($req['problems'] as $item){ - $resp = $problem_model->changeProblemStatus($item, ['status' => CONTEST]); - if($resp['code'] !== CODE_SUCCESS){ - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - } - $resp = $contest_model->newContest(array( - 'contest_name' => $req['contest_name'], - 'begin_time' => $req['begin_time'], - 'end_time' => $req['end_time'], - 'frozen' => $req['frozen'], - 'prize' => isset($req['prize'])?$req['prize']:"['0.1', '0.2', '0.3']", - 'colors' => json_encode(isset($req['colors']) ? $req['colors'] : array()), - 'problems' => json_encode($req['problems']), - )); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 删除比赛 - */ - public function deleContest() - { - $contest_model = new ContestModel(); - $contest_validate = new ContestValidate(); - - // delete - $req = input('post.'); - $result = $contest_validate->scene('deleteContest')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $contest_validate->getError(), ''); - } - $resp = $contest_model->deleContest($req['contest_id']); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 更新比赛 - */ - public function editContest() - { - $contest_model = new ContestModel(); - $problem_model = new ProblemModel(); - $contest_validate = new ContestValidate(); - - // update - $req = input('post.'); - $result = $contest_validate->scene('editContest')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $contest_validate->getError(), ''); - } - $resp = $contest_model->searchContest($req['contest_id']); - if($resp['code'] !== CODE_SUCCESS){ - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - $old_problem = json_decode($resp['data']['problems'], false); - $status = $resp['data']['status']; - foreach ($old_problem as $item){ - $resp = $problem_model->changeProblemStatus($item, ['status' => USING]); - if($resp['code'] !== CODE_SUCCESS){ - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - } - foreach ($req['problems'] as $item){ - $resp = $problem_model->changeProblemStatus($item, ['status' => CONTEST]); - if($resp['code'] !== CODE_SUCCESS){ - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - } - - $resp = $contest_model->editContest($req['contest_id'], array( - 'contest_name' => $req['contest_name'], - 'begin_time' => $req['begin_time'], - 'end_time' => $req['end_time'], - 'frozen' => $req['frozen'], - 'problems' => json_encode($req['problems']), - 'status' => isset($req['status']) ? $req['status'] : $status, - )); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 查询所有比赛 - */ - public function getAllContest() - { - $contest_model = new ContestModel(); - $req = input('post.aoData'); - $where = aoDataFormat($req, 'contest_name'); - $resp = $contest_model->getAllContest($where['where'], $where['limit'], $where['offset']); - echo datatable_response($resp['code'], $where['where'], $resp['data'], $contest_model); - } - - /** - * 查询单个比赛信息 - */ - public function getTheContest() - { - $contest_model = new ContestModel(); - - $req = input('post.'); - if(!isset($req['contest_id'])){ - return apiReturn(CODE_ERROR, '没有填写比赛编号', ''); - } - - $resp = $contest_model->searchContest($req['contest_id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /* 页面 */ - /** - * 添加比赛页面 - */ - public function add() - { - return $this->fetch(); - } - - /** - * 比赛详情页面 - */ - public function info() - { - $req = input('get.'); - $id = isset($req['id']) ? $req['id'] : 0; - $this->assign('id', $id); - return $this->fetch(); - } - - /** - * 首页 - */ - public function index() - { - return $this->fetch('index'); - } -} \ No newline at end of file diff --git a/back_end/application/panel/controller/Group.php b/back_end/application/panel/controller/Group.php deleted file mode 100644 index ea89f2f5b..000000000 --- a/back_end/application/panel/controller/Group.php +++ /dev/null @@ -1,77 +0,0 @@ -assign('id', $id); - return $this->fetch(); - } - - /** - * 首页 - */ - public function index() - { - return $this->fetch('index'); - } -} \ No newline at end of file diff --git a/back_end/application/panel/controller/Index.php b/back_end/application/panel/controller/Index.php deleted file mode 100644 index 80cb2e7dc..000000000 --- a/back_end/application/panel/controller/Index.php +++ /dev/null @@ -1,15 +0,0 @@ -fetch(); - } -} \ No newline at end of file diff --git a/back_end/application/panel/controller/Knowledge.php b/back_end/application/panel/controller/Knowledge.php deleted file mode 100644 index 3d4995d09..000000000 --- a/back_end/application/panel/controller/Knowledge.php +++ /dev/null @@ -1,233 +0,0 @@ -getKnowledge(""); - echo datatable_response($resp['code'], $where['where'], $resp['data'], $knowledge_model); - } - - /* - * 获取知识点 - */ - public function searchKnowledge() { - $knowledge_model = new KnowledgeModel(); - $name = input('get.name'); - $msg = $knowledge_model->getKnowledge($name); - return apiReturn($msg['code'], $msg['msg'], $msg['data'], 200); - } - - /* - * 删除知识点 - */ - public function deleteKnowledge() { - $knowledge_model = new KnowledgeModel(); - $name = input('get.name'); - $knowledge_model->deleteKnowledge(['name' => $name]); - $this->redirect('/back_end/panel/knowledge/index'); - } - - /* - * 添加知识点 - */ - public function addKnowledge() { - $knowledge_model = new KnowledgeModel(); - $name = input('get.name'); - $point = input('get.point'); - $msg = $knowledge_model->addKnowledge(['name' => $name, 'point' => $point]); - return apiReturn($msg['code'], $msg['msg'], $msg['data'], 200); - } - - /* - * 获取前置知识点 - */ - public function getPreKnowledge() { - $knowledge_relation_model = new KnowledgeRelationModel(); - $req = input('post.aoData'); - $name = input('post.knowledge_name'); - $where = aoDataFormat($req, 'group_name'); - $resp = $knowledge_relation_model->getPreKnowledge($name); - echo datatable_response($resp['code'], $where['where'], $resp['data'], $knowledge_relation_model); - } - - /* - * 删除知识点关系对 - */ - public function deleteKnowledgeRelation() { - $knowledge_relation_model = new KnowledgeRelationModel(); - $name = input('get.name'); - $pre_name = input('get.pre'); - $knowledge_relation_model->deleteRelation(['name' => $name, 'pre_name' => $pre_name]); - $this->redirect('/back_end/panel/knowledge/relation', ['name' => $name]); - } - - /* - * 切换知识点前置是否必要 - */ - public function switchKnowledgeRelation() { - $knowledge_relation_model = new KnowledgeRelationModel(); - $name = input('get.name'); - $pre_name = input('get.pre'); - $knowledge_relation_model->switchCore(['name' => $name, 'pre_name' => $pre_name]); - $this->redirect('/back_end/panel/knowledge/relation', ['name' => $name]); - } - - /* - * 添加知识点关系 - */ - public function addKnowledgeRelation() { - $knowledge_relation_model = new KnowledgeRelationModel(); - $name = input('post.name'); - $knowledge = input('post.knowledge'); - if (isset($knowledge['is_core'])) { - $is_core = true; - } else { - $is_core = false; - } - foreach ($knowledge as $item) { - if ($item == "is_core") continue; - $data = [ - 'name' => $name, - 'pre_name' => $item, - 'is_core' => $is_core - ]; - $knowledge_relation_model->addRelation($data); - } - return apiReturn(CODE_SUCCESS, 'ok', [], 200); - } - - /* - * 添加问题知识点关系 - */ - public function addProblemKnowledgeRelation() { - $problem_knowledge_model = new KnowledgeProblemModel(); - $problem_id = input('post.problem_id'); - $knowledge = input('post.knowledge'); - if (isset($knowledge['is_core'])) { - $is_core = true; - } else { - $is_core = false; - } - foreach ($knowledge as $item) { - if ($item == "is_core") continue; - $data = [ - 'problem_id' => $problem_id, - 'knowledge' => $item, - 'is_core' => $is_core - ]; - $problem_knowledge_model->addRelation($data); - } - return apiReturn(CODE_SUCCESS, 'ok', [], 200); - } - - /* - * 切换问题知识点是否必要 - */ - public function switchProblemKnowledgeRelation() { - $problem_knowledge_model = new KnowledgeProblemModel(); - $knowledge = input('get.knowledge'); - $problem_id = input('get.problem_id'); - $data = [ - 'problem_id' => $problem_id, - 'knowledge' => $knowledge - ]; - $problem_knowledge_model->switchCore($data); - $this->redirect('/back_end/panel/knowledge/problem', ['problem_id' => $problem_id]); - } - - /* - * 删除问题知识点 - */ - public function deleteProblemKnowledgeRelation() { - $problem_knowledge_model = new KnowledgeProblemModel(); - $knowledge = input('get.knowledge'); - $problem_id = input('get.problem_id'); - $data = [ - 'problem_id' => $problem_id, - 'knowledge' => $knowledge - ]; - $problem_knowledge_model->deleteRelation($data); - $this->redirect('/back_end/panel/knowledge/problem', ['problem_id' => $problem_id]); - } - - /* - * 获取问题知识点 - */ - public function getProblemKnowledge() { - $problem_knowledge_model = new KnowledgeProblemModel(); - $req = input('post.aoData'); - $problem_id = input('post.problem_id'); - $where = aoDataFormat($req, 'problem_id'); - $resp = $problem_knowledge_model->getKnowledgeByProblem($problem_id); - echo datatable_response($resp['code'], $where['where'], $resp['data'], $problem_knowledge_model); - - } - - /* - * 添加知识点标签 - */ - public function addKnowledgeTag() { - $knowledge_tag_model = new KnowledgeTagModel(); - $tag_id = input('post.tag_id'); - $knowledge_id = input('post.knowledge_id'); - $msg = $knowledge_tag_model->addKnowledgeTag($knowledge_id, $tag_id); - return apiReturn($msg['code'], $msg['msg'], $msg['data'], 200); - } - - /* - * 删除知识点标签 - */ - public function deleteKnowledgeTag() { - $knowledge_tag_model = new KnowledgeTagModel(); - $knowledge_id = input('get.knowledge_id'); - $tag_id = input('get.tag_id'); - $knowledge_tag_model->deleteKnowledgeTag($knowledge_id, $tag_id); - $this->redirect('/back_end/panel/knowledge/tag', ['knowledge_id' => $knowledge_id]); - } - /* - * 获取知识点标签 - */ - public function getKnowledgeTag() { - $knowledge_tag_model = new KnowledgeTagModel(); - $knowledge_id = input('post.knowledge_id'); - $req = input('post.aoData'); - $where = aoDataFormat($req, 'id'); - $resp = $knowledge_tag_model->getKnowledgeTag($knowledge_id); - echo datatable_response($resp['code'], $where['where'], $resp['data'], $knowledge_tag_model); - } - public function tag() - { - return $this->fetch('tag', ['knowledge_id' => input('get.id')]); - } - - public function relation() - { - return $this->fetch('relation', ['name' => input('get.name')]); - } - - public function index() - { - return $this->fetch('index'); - } - - public function problem() - { - return $this->fetch('problem', ['problem_id' => input('get.problem_id')]); - } -} \ No newline at end of file diff --git a/back_end/application/panel/controller/Notification.php b/back_end/application/panel/controller/Notification.php deleted file mode 100644 index 9dadf731d..000000000 --- a/back_end/application/panel/controller/Notification.php +++ /dev/null @@ -1,76 +0,0 @@ -getAllNotification($where['where'], $where['limit'], $where['offset']); - echo datatable_response($resp['code'], $where['where'], $resp['data'], $notification_model); - } - - public function getNotificationByID() - { - $notification_model = new NotificationModel(); - $id = input('post.id'); - $resp = $notification_model->getNotificationByID($id); - return apiReturn($resp['code'], $resp['msg'], $resp['data'], 200); - } - - public function addNotification() - { - $notification_model = new NotificationModel(); - $req = input('post.'); - $data = [ - 'title' => $req['title'], - 'content' => $req['content'], - 'status' => $req['status'], - 'user_id' => session('user_id') - ]; - if ($req['contest_id'] !== '') $data['contest_id'] = $req['contest_id']; - $resp = $notification_model->addNotification($data); - return apiReturn($resp['code'], $resp['msg'], $resp['data'], 200); - } - - public function deleteNotification() { - $notification_model = new NotificationModel(); - $id = input('get.id'); - $notification_model->deleteNotification($id); - $this->redirect('/back_end/panel/notification/index'); - } - - public function changeStatus() { - $notification_model = new NotificationModel(); - $id = input('get.id'); - $notification_model->changeNotificationStatus($id); - $this->redirect('/back_end/panel/notification/index'); - } - - public function info() - { - $req = input('get.'); - $id = isset($req['id']) ? $req['id'] : 0; - $this->assign('id', $id); - return $this->fetch(); - } - - - public function add() - { - return $this->fetch(); - } - - public function index() - { - return $this->fetch(); - } -} \ No newline at end of file diff --git a/back_end/application/panel/controller/Problem.php b/back_end/application/panel/controller/Problem.php deleted file mode 100644 index 6262802f8..000000000 --- a/back_end/application/panel/controller/Problem.php +++ /dev/null @@ -1,305 +0,0 @@ -scene('newProblem')->check($req); - if ($result !== VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $problem_validate->getError(), ''); - } - - // add - $resp = $problem_model->addProblem(array( - 'title' => $req['title'], - 'background' => $req['background'], - 'describe' => $req['describe'], - 'input_format' => isset($req['input_format']) ? $req['input_format'] : '', - 'output_format' => isset($req['output_format']) ? $req['output_format'] : '', - 'hint' => isset($req['hint']) ? $req['hint'] : '', - 'sample_input' => isset($req['sample_input']) ? $req['sample_input'] : '', - 'sample_output' => isset($req['sample_output']) ? $req['sample_output'] : '', - 'public' => isset($req['public']) ? $req['public'] : 1, - 'source' => isset($req['source']) ? $req['source'] : '', - 'tag' => isset($req['tag']) ? $req['tag'] : '', - )); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 删除题目 - */ - public function deleProblem() - { - $problem_model = new ProblemModel(); - - $req = input('get.'); - if (!isset($req['id'])) { - return apiReturn(CODE_ERROR, '没有用户id', ''); - } - $resp = $problem_model->deleProblem($req['id']); - $this->redirect('/back_end/panel/problem/index'); - } - - /** - * 编辑题目 - */ - public function editProblem() - { - $problem_validate = new ProblemValidate(); - $problem_model = new ProblemModel(); - - $req = input('post.'); - $result = $problem_validate->scene('editProblem')->check($req); - if ($result !== VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $problem_validate->getError(), ''); - } - - // edit - $resp = $problem_model->editProblem($req['problem_id'], array( - 'title' => $req['title'], - 'background' => $req['background'], - 'describe' => $req['describe'], - 'input_format' => isset($req['input_format']) ? $req['input_format'] : '', - 'output_format' => isset($req['output_format']) ? $req['output_format'] : '', - 'hint' => isset($req['hint']) ? $req['hint'] : '', - 'sample_input' => isset($req['sample_input']) ? $req['sample_input'] : '', - 'sample_output' => isset($req['sample_output']) ? $req['sample_output'] : '', - 'public' => isset($req['public']) ? $req['public'] : 1, - 'source' => isset($req['source']) ? $req['source'] : '', - 'tag' => isset($req['tag']) ? $req['tag'] : '', - )); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 查询所有题目 - */ - public function getAllProblem() - { - $problem_model = new ProblemModel(); - $req = input('post.aoData'); - $where = aoDataFormat($req, 'nick'); - $resp = $problem_model->getAllProblem($where['where'], $where['limit'], $where['offset']); - echo datatable_response($resp['code'], $where['where'], $resp['data'], $problem_model); - } - - /** - * 查询单个题目信息 - */ - public function getTheProblem() - { - $problem_model = new ProblemModel(); - $problem_validate = new ProblemValidate(); - $req = input('post.'); - $result = $problem_validate->scene('displayProblem')->check($req); - if ($result !== VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $problem_validate->getError(), ''); - } - $resp = $problem_model->searchProblemById($req['problem_id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 更新数据信息 - */ - public function update_data_info() - { - $req = input('post.'); - $secs = isset($req['secs']) ? (int)$req['secs'] : 1; - $nanos = isset($req['nanos']) ? (int)$req['nanos'] * 100000000 : 0; - $data_info = [ - 'type' => isset($req['sqj'])?'Special Judge':'Normal', - 'time' => $secs.'.'.$nanos, - 'memory' => isset($req['memory']) ? $req['memory'] * 1024 * 1024 : 33554432, - ]; - $problemModel = new ProblemModel(); - $resp = $problemModel->editProblemDataInfo($req['problem_id'], $data_info); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 上传题目数据接口, 支持多组数据 - */ - public function upload_data_file() - { - $files = request()->file(''); - $req = input('post.'); - $data = []; - // 更新题目数据信息 - $secs = isset($req['secs']) ? (int)$req['secs'] : 1; - $nanos = isset($req['nanos']) ? (int)$req['nanos'] * 100000000 : 0; - $data_info = [ - 'type' => isset($req['sqj'])?'Special Judge':'Normal', - 'time' => $secs.'.'.$nanos, - 'memory' => isset($req['memory']) ? $req['memory'] * 1024 * 1024 : 33554432, - ]; - $problemModel = new ProblemModel(); - $resp = $problemModel->editProblemDataInfo($req['problem_id'], $data_info); - if ($resp['code'] !== CODE_SUCCESS) { - return apiReturn(CODE_ERROR, $resp['msg'], $resp['data']); - } - foreach($files['file'] as $file) { - //halt($file); - $info = $file->move($this->data_path.'tmp/', ''); - if ($info != VALIDATE_PASS) { - return apiReturn(CODE_ERROR, $file->getError(), ''); - } else { - $file_path = $this->data_path.'tmp/' . (str_replace('\\', '/', $info->getSaveName())); - $str = file_get_contents($file_path); - //$str = str_replace("\r\n", '\n', $str); - $filename = substr($file->getInfo()['name'], 0, strpos($file->getInfo()['name'], '.')); - if (!isset($data[$filename])) { - if ($info->getExtension() === 'in') { - $data[$filename] = array( - 'in' => $str, - 'out' => '' - ); - } else { - $data[$filename] = array( - 'in' => '', - 'out' => $str - ); - } - } else { - if ($info->getExtension() === 'in') { - $data[$filename]['in'] = $str; - } else { - $data[$filename]['out'] = $str; - } - } - } - } - // dir path is /path/to/data/$(id)$(environment) - $dir = iconv('UTF-8', 'GBK', $req['problem_id']) . config('wutoj_config.environment'); - $dir = $this->data_path . $dir; - if (!file_exists($dir)) { - if(!mkdir($dir, 0755, true) || !is_dir($dir)){ - return apiReturn(CODE_ERROR, '创建目录失败', ''); - } - } - $problem_path = $dir.'/problem'; - if (!file_exists($problem_path)) { - if(!mkdir($problem_path, 0755, true) || !is_dir($problem_path)){ - return apiReturn(CODE_ERROR, '创建目录失败', ''); - } - } - $toml = new TomlBuilder(); - $secs = isset($req['secs']) ? (int)$req['secs'] : 1; - $nanos = isset($req['nanos']) ? (int)$req['nanos'] * 100000000 : 0; - if(isset($req['spj'])){ - // extern_problem文件夹创建 - $spj_toml = new TomlBuilder(); - $spj_path = $problem_path.'/extern_program'; - if (!file_exists($spj_path)) { - if(!mkdir($spj_path, 0755, true) || !is_dir($spj_path)){ - return apiReturn(CODE_ERROR, '创建目录失败', ''); - } - } - // spj文件config - $spj_name = 'spj.'.substr($req['language'],0, strpos($req['language'], '.')); - file_put_contents($spj_path.'/config.toml', $spj_toml->addValue('source', $spj_name) - ->addValue('language', $req['language']) - ->addTable('timeout') - ->addValue('secs', 5) - ->addValue('nanos', 0) - ->getTomlString()); - // 输出spj代码 - file_put_contents($spj_path.'/'.$spj_name, $req['code']); - // 题目config - $toml->addValue('problem_type', 'SpecialJudge'); - $toml->addTable('limit') - ->addValue('memory', isset($req['memory']) ? $req['memory'] * 1024 * 1024 : 33554432) - ->addTable('limit.real_time') - ->addValue('secs', $secs) - ->addValue('nanos', $nanos) - ->addTable('limit.cpu_time') - ->addValue('secs', $secs) - ->addValue('nanos', $nanos); - $toml->addTable('source') - ->addValue('source', $spj_name) - ->addValue('language', $req['language']); - file_put_contents($problem_path.'/config.toml', $toml->getTomlString()); - } else { - //题目config - $toml->addValue('problem_type', 'Normal'); - $toml->addTable('limit') - ->addValue('memory', isset($req['memory']) ? $req['memory'] * 1024 * 1024 : 33554432) - ->addTable('limit.real_time') - ->addValue('secs', $secs) - ->addValue('nanos', $nanos) - ->addTable('limit.cpu_time') - ->addValue('secs', $secs) - ->addValue('nanos', $nanos); - file_put_contents($problem_path.'/config.toml', $toml->getTomlString()); - } - $i = 0; - foreach ($data as $item){ - $data_path = $problem_path.'/'.(string)$i; - if (!file_exists($data_path)) { - if(!mkdir($data_path, 0755, true) || !is_dir($data_path)){ - return apiReturn(CODE_ERROR, '创建目录失败', ''); - } - } - file_put_contents($data_path.'/answer', str_replace('\r\n', '\n', $item['out'])); - file_put_contents($data_path.'/input', str_replace('\r\n', '\n', $item['in'])); - $i++; - } - } - - /* 页面 */ - /** - * 添加题目页面 - */ - public function add() - { - return $this->fetch(); - } - - /** - * 添加数据 - */ - public function data() - { - $req = input('get.'); - $problem_id = isset($req['id']) ? $req['id'] : 0; - $this->assign('problem_id', $problem_id); - return $this->fetch(); - } - - /** - * 题目详情页面 - */ - public function info() - { - $req = input('get.'); - $id = isset($req['id']) ? $req['id'] : 0; - $this->assign('id', $id); - return $this->fetch(); - } - - /** - * 首页 - */ - public function index() - { - return $this->fetch(); - } - -} diff --git a/back_end/application/panel/controller/Role.php b/back_end/application/panel/controller/Role.php deleted file mode 100644 index 5b02377cd..000000000 --- a/back_end/application/panel/controller/Role.php +++ /dev/null @@ -1,126 +0,0 @@ -getAllGroup(); - echo datatable_response($resp['code'], $where['where'], $resp['data'], $role_group_model); - } - - /* - * 添加权限组 - */ - public function addRoleGroup() { - $group_name = input('get.group_name'); - $role_group_model = new RoleGroupModel(); - $msg = $role_group_model->addRoleGroup(['group_name' =>$group_name]); - return apiReturn($msg['code'], $msg['msg'], $msg['data'], 200); - } - - /* - * 删除权限组 - */ - public function deleteRoleGroup() { - $group_name = input('get.group_name'); - $role_group_model = new RoleGroupModel(); - $role_group_model->deleteRoleGroup(['group_name' =>$group_name]); - $this->redirect("/back_end/panel/role/index"); - } - /* - * 更新权限组 - */ - public function updateRoleGroup() { - $group_name = input('post.group_name'); - $authorities = input('post.authorities'); - $role_group_model = new RoleGroupModel(); - $where = [ - "group_name" => $group_name, - "authority" => (array)$authorities - ]; - $msg = $role_group_model->updateAuthority($where); - return apiReturn($msg['code'], $msg['msg'], $msg['code'], 200); - } - - /* - * 更改权限组状态 - */ - public function switchGroupStatus() { - $auth = input('get.group_name'); - $authority_model = new RoleGroupModel(); - $msg = $authority_model->switchRoleGroupStatus($auth); - $this->redirect("/back_end/panel/role/index"); - } - - /* - * 获取所有权限 - */ - public function getAllAuthority() { - $authority_model = new AuthorityModel(); - $req = input('post.aoData'); - $where = aoDataFormat($req, 'name'); - $resp = $authority_model->getAllAuthority(); - echo datatable_response($resp['code'], $where['where'], $resp['data'], $authority_model); - } - - public function addAuthority() { - $auth = input('get.auth'); - $authority_model = new AuthorityModel(); - $msg = $authority_model->addAuthority(['name' => $auth]); - return apiReturn($msg['code'], $msg['msg'], $msg['data'], 200); - } - - public function deleteAuthority() { - $auth = input('get.auth'); - $authority_model = new AuthorityModel(); - $msg = $authority_model->deleteAuthority($auth); - $this->redirect("/back_end/panel/role/auth"); - } - - public function switchAuthorityStatus() { - $auth = input('get.auth'); - $authority_model = new AuthorityModel(); - $msg = $authority_model->switchAuthority($auth); - $this->redirect("/back_end/panel/role/auth"); - } - - public function edit() { - $group_name = input('get.group_name'); - $role_group_model = new RoleGroupModel(); - $authority_model = new AuthorityModel(); - $data = $role_group_model->getRoleGroup($group_name)['data']; - $authorities = $authority_model->getAuthorities(['enabled' => 1])['data']; - foreach ($authorities as $authority) { - if (in_array($authority['name'], $data['authority']->auth)) { - $authority['checked'] = 'checked'; - } else { - $authority['checked'] = ''; - } - } - $returnData = [ - 'name' => $data['group_name'], - 'auth' => $authorities - ]; - return $this->fetch('', $returnData); - } - - public function auth() { - return $this->fetch(); - } - - public function index() { - return $this->fetch(); - } -} \ No newline at end of file diff --git a/back_end/application/panel/controller/Sign.php b/back_end/application/panel/controller/Sign.php deleted file mode 100644 index 2a1e06de6..000000000 --- a/back_end/application/panel/controller/Sign.php +++ /dev/null @@ -1,84 +0,0 @@ -fetch(); -// } - - public function addsign() - { - $begin = strtotime(config('begin')); - $finish = strtotime(config('finish')); - $now = time(); - if($now<$begin || $now>$finish){ - return apiReturn(-1, "现在不是报名时间", '', 200); - } - else{ - $info = $_GET; - $created = time(); - $data = array( - 'name' => $info['name'], - 'sex' => $info['sex'], - 'class' => $info['class'], - 'cardNo' => $info['cardNo'], - 'date' => $info['date'], - 'qq' => $info['qq'], - 'tel' => $info['tel'], - 'dorm' => $info['dorm'], - 'content' => $info['content'], - 'status' => 0, - 'create_time' => $created, - 'update_time' => $created - ); - - $item = new SignModel(); - $where = ['cardNo' => $data['cardNo']]; - $temp = $item->getsign($where); - if($temp['data']){ - if(strtotime($temp['data']['update_time']) + 60 > $created){ - return apiReturn(-1, "不要频繁提交", '', 200); - } - } - $rel = $item->addsign($data); - return apiReturn($rel['code'], $rel['msg'], $rel['data'], 200); - } - } - - public function downloadCSV() - { - $userId = input('post.userId'); - $passwd = md5(base64_encode(input('post.passwd'))); - $user = new \app\index\model\UserModel(); - $result = $user->checkAdmin($userId, $passwd); - if(!$result) { - return apiReturn(-1, 'You don\'t have authority', null, 200); - } - - $now = date("Y-m-d",time()); - $nowtoken = md5(base64_encode('panel' . 'Sign' . 'downloadCSV' . $now . 'fight in acm@wut')); - $token = input('post.token'); - - if($nowtoken != $token) - { - return apiReturn(-1, 'token is wrong', null, 200); - }else{ - $item = new SignModel(); - $data = $item->getsign()['data']; - $info = ""; - foreach ($data as $v) { - foreach ($v as $vv) { - $info .= "\""; - $info .= $vv; - $info .= "\","; - } - $info .= "\n"; - } - return json(array('status'=>0, 'message'=>'OK', 'data'=>$info)); - } - } -} \ No newline at end of file diff --git a/back_end/application/panel/controller/Submit.php b/back_end/application/panel/controller/Submit.php deleted file mode 100644 index 968f957b5..000000000 --- a/back_end/application/panel/controller/Submit.php +++ /dev/null @@ -1,133 +0,0 @@ -getAllSubmit($where['where'], $where['limit'], $where['offset']); - echo datatable_response($resp['code'], $where['where'], $resp['data'], $submit_model); - } - - public function getTheSubmit() - { - $submit_model = new SubmitModel(); - $req = input('post.'); - if(!isset($req['id'])){ - return apiReturn(CODE_ERROR, '请填写id', ''); - } - $resp = $submit_model->getTheSubmit( $req['id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function reJudge() - { - $req = input('post.'); - $submit_model = new SubmitModel(); - if(!isset($req['id'])){ - return apiReturn(CODE_ERROR, '请填写重新评测的id', ''); - } - if(!is_array($req['id'])){ - return apiReturn(CODE_ERROR, '请按规则提交', ''); - } - $problems = $req['id']; - $submit_url = config('wutoj_config.submit_url'); - $length = count($submit_url); - foreach ($problems as $item){ - $info = $submit_model->getTheSubmit($item); - if ($info['code'] !== CODE_SUCCESS) { - return apiReturn($info['code'], $info['msg'], $info['data']); - } - - $info = $info['data']; - - // post to the random judger - post($submit_url[mt_rand(0, $length - 1)], json_encode(array( - 'id' => (string)$info['id'], - 'pid' => (string)$info['problem_id'], - 'env' => (string)config('wutoj_config.environment'), - 'source' => [ - 'language' => $info['language'], - 'code' => $info['source_code'], - ] - ), true)); - } - return apiReturn(CODE_SUCCESS, '重新评测成功', ''); - } - - public function rejudge_group() - { - $req = input('post.'); - $submit_model = new SubmitModel(); - $where = array(); - if ($req['problem_id'] != '') { - $where['problem_id'] = $req['problem_id']; - } - if ($req['user_id'] != '') { - $where['user_id'] = $req['user_id']; - } - if ($req['language'] != 'all') { - $where['language'] = $req['language']; - } - if ($req['start'] != '') { - $where['id'] = ['>=', $req['start']]; - } - if ($req['end'] != '') { - $where['id'] = ['<=', $req['end']]; - } - $info = $submit_model->getSubmitGroup($where); - if ($info['code'] !== CODE_SUCCESS) { - return apiReturn($info['code'], $info['msg'], $info['data']); - } - $submits = $info['data']; - $submit_url = config('wutoj_config.submit_url'); - $length = count($submit_url); - foreach ($submits as $info){ - - - // post to the random judger - post($submit_url[mt_rand(0, $length - 1)], json_encode(array( - 'id' => (string)$info['id'], - 'pid' => (string)$info['problem_id'], - 'env' => (string)config('wutoj_config.environment'), - 'source' => [ - 'language' => $info['language'], - 'code' => $info['source_code'], - ] - ), true)); - } - return apiReturn(CODE_SUCCESS, '重新评测成功', ''); - } - - - /* 页面 */ - public function index() - { - return $this->fetch(); - } - - public function info() - { - $req = input('get.'); - $id = isset($req['id']) ? $req['id'] : 0; - $this->assign('id', $id); - return $this->fetch(); - } - - //重判 - public function pending() - { - return $this->fetch(); - } - -} diff --git a/back_end/application/panel/controller/Tag.php b/back_end/application/panel/controller/Tag.php deleted file mode 100644 index 7993c030b..000000000 --- a/back_end/application/panel/controller/Tag.php +++ /dev/null @@ -1,84 +0,0 @@ -getAllTag($where['where'], $where['limit'], $where['offset']); - echo datatable_response($resp['code'], $where['where'], $resp['data'], $tag_model); - } - - public function getAllTags() - { - $tag_model = new TagModel(); - $resp = $tag_model->getAllTag(['status' => 1], 100, 0); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - public function getTheTag() - { - $tag_model = new TagModel(); - $req = input('post.'); - if(!isset($req['id'])){ - return apiReturn(CODE_ERROR, '请填写id', ''); - } - $resp = $tag_model->getTheTag($req['id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function addTag() - { - $tag_model = new TagModel(); - $req = input('post.'); - if(!isset($req['name'])){ - return apiReturn(CODE_ERROR, '请填写标签名字', ''); - } - $resp = $tag_model->addTag($req); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function editTag() - { - $tag_model = new TagModel(); - $req = input('post.'); - if(!isset($req['id'])){ - return apiReturn(CODE_ERROR, '请填写标签序号', ''); - } - $resp = $tag_model->editTag($req); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - public function deleTag() - { - $tag_model = new TagModel(); - $req = input('post.'); - if(!isset($req['id'])){ - return apiReturn(CODE_ERROR, '请填写标签序号', ''); - } - $resp = $tag_model->deleTag($req['id']); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /* 页面 */ - public function index() - { - return $this->fetch(); - } - - public function info() - { - $req = input('get.'); - $id = isset($req['id']) ? $req['id'] : 0; - $this->assign('id', $id); - return $this->fetch(); - } -} \ No newline at end of file diff --git a/back_end/application/panel/controller/User.php b/back_end/application/panel/controller/User.php deleted file mode 100644 index a5b609d19..000000000 --- a/back_end/application/panel/controller/User.php +++ /dev/null @@ -1,179 +0,0 @@ -scene('addUser')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $user_validate->getError(), ''); - } - - $user = $user_model->searchUserByNick($req['nick']); - if($user['code'] === CODE_SUCCESS){ - return apiReturn(CODE_ERROR, '已有用户', ''); - } - - // add - $req['password'] = md5(base64_encode($req['password'])); - $req['role_group'] = json_encode(array()); - $resp = $user_model->addUser($req); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - /** - * 删除用户 - */ - public function deleteUser() - { - $user_validate = new UserValidate(); - $user_model = new UserModel(); - - $req = input('post.'); - $result = $user_validate->scene('deleteUser')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $user_validate->getError(), ''); - } - - $resp = $user_model->deleUser($req['id']); - - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 修改用户 - */ - public function editUser() - { - $user_validate = new UserValidate(); - $user_model = new UserModel(); - - $req = input('post.'); - $result = $user_validate->scene('editUser')->check($req); - if ($result !== true) { - return apiReturn(CODE_ERROR, $user_validate->getError(), ''); - } - - $user = $user_model->searchUserById($req['user_id']); - if($user['code'] !== CODE_SUCCESS){ - return apiReturn($user['code'], $user['msg'], ''); - } - - // edit - $resp = $user_model->editUser($req['user_id'], $req); - return apiReturn($resp['code'], $resp['msg'], $resp['data']); - } - - /** - * 查询所有用户 - */ - public function getAllUser() - { - $user_model = new UserModel(); - $req = input('post.aoData'); - $where = aoDataFormat($req, 'nick'); - $resp = $user_model->getAllUser($where['where'], $where['limit'], $where['offset']); - echo datatable_response($resp['code'], $where['where'], $resp['data'], $user_model); - } - - /** - * 查询单个用户信息 - */ - public function getTheUser() - { - $user_model = new UserModel(); - - $req = input('post.'); - if(!isset($req['user_id'])){ - return apiReturn(CODE_ERROR, '未填写用户id', ''); - } - $user = $user_model->searchUserById($req['user_id']); - - return apiReturn($user['code'], $user['msg'], $user['data']); - } - - public function downloadExcel() { - $user_model = new UserModel(); - $returnData = $user_model->getUserInfo()['data']; - try { - $fileName = '做题信息'. '('.date("Y-m-d",time()) .'导出)'. ".xls"; - $excelObj = new \PHPExcel(); - $letter = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'); - $header = array('昵称', '姓名', 'AC', 'WA', 'TLE', 'MLE', 'CE', 'RE', 'OLE', 'PE'); - for ($i = 0; $i < count($header); $i++) { - $excelObj->getActiveSheet()->setCellValue($letter[$i]."1", $header[$i]); - } - $row = 2; - foreach ($returnData as $value) { - $excelObj->setActiveSheetIndex(0) - ->setCellValue('A'.$row, $value['nick']) - ->setCellValue('B'.$row, $value['realname']) - ->setCellValue('C'.$row, $value['AC']) - ->setCellValue('D'.$row, $value['WA']) - ->setCellValue('E'.$row, $value['TLE']) - ->setCellValue('F'.$row, $value['MLE']) - ->setCellValue('G'.$row, $value['CE']) - ->setCellValue('H'.$row, $value['RE']) - ->setCellValue('I'.$row, $value['OLE']) - ->setCellValue('J'.$row, $value['PE']); - $excelObj->getActiveSheet()->getRowDimension($row)->setRowHeight(15); - $row++; - } - - $excelObj->getDefaultStyle()->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER); - $excelObj->getDefaultStyle()->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::VERTICAL_CENTER); - - header('Content-Type: application/vnd.ms-excel;charset=UTF-8'); - header("Content-Disposition: attachment;filename={$fileName}"); - header('Cache-Control: max-age=0'); - $writer = \PHPExcel_IOFactory::createWriter($excelObj, 'Excel5'); - $writer->save('php://output'); - } catch (\PHPExcel_Exception $e) { - } - - } - - /* 页面 */ - /** - * 添加用户页面 - */ - public function add() - { - return $this->fetch(); - } - - /** - * 用户详情页面 - */ - public function info() - { - $req = input('get.'); - $id = isset($req['id']) ? $req['id'] : 0; - $this->assign('id', $id); - return $this->fetch(); - } - - /** - * 首页 - */ - public function index() - { - return $this->fetch(); - } -} \ No newline at end of file diff --git a/back_end/application/panel/model/AuthorityModel.php b/back_end/application/panel/model/AuthorityModel.php deleted file mode 100644 index 017029d61..000000000 --- a/back_end/application/panel/model/AuthorityModel.php +++ /dev/null @@ -1,185 +0,0 @@ -select(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $msg]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取权限 - * @param array $where - * @return array ['code', 'msg', 'data'] - */ - public function getAuthorities($where) { - try { - $msg = $this->where($where)->select(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $msg]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - /** - * @usage 获取权限 - * @param string $name - * @return array ['code', 'msg', 'data'] - */ - public function getAuthority($name) { - try { - $where = ['name' => $name]; - $msg = $this->where($where)->find(); - if ($msg) { - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $msg]; - } else { - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_SUCCESS, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 添加权限 - * @param array $data['name'] - * @return array ['code', 'msg', 'data'] - */ - public function addAuthority($data) { - try { - if ($data == "") { - return ['code' => CODE_ERROR, 'msg' => '空权限', 'data' => []]; - } - $where = ['name' => $data['name']]; - $msg = $this->where($where)->find(); - if ($msg) { - return ['code' => CODE_ERROR, 'msg' => '已有此权限', 'data' => $msg]; - } else { - $info = $this->insertGetId($data); - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => $info]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 删除权限 - * @param string $name - * @return array ['code', 'msg', 'data'] - */ - public function deleteAuthority($name) { - try { - $groupModel = new RoleGroupModel(); - //获取json字段中存在name的数据 - $sql = "select * from role_group where authority->'$.auth' like \"%".$name."%\";"; - $result = Db::query($sql); - if ($result != null) { - foreach ($result as $group) { - $group_name = $group['group_name']; - $authorities = json_decode($group['authority'])->auth; - //构件新的authorities字段 - $new_authorities = new \ArrayObject(); - foreach ($authorities as $authority) { - if ($authority != $name) { - $new_authorities->append($authority); - } - } - //更新权限组 - $data = [ - 'group_name' => $group_name, - 'authority' => (array)$new_authorities - ]; - $groupModel->updateAuthority($data); - } - $where = ['name' => $name]; - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => []]; - } else { - $msg = $this->where(['name' => $name])->delete(); - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 启用/禁用权限 - * @param string $name - * @return array ['code', 'msg', 'data'] - */ - public function switchAuthority($name) { - try { - $where = ['name' => $name]; - $msg = $this->where($where)->find(); - if ($msg) { - if ($msg['enabled'] == 1) { - return $this->disableAuthority($name); - } else { - return $this->enableAuthority($name); - } - } else { - return ['code' => CODE_ERROR, 'msg' => '不存在此权限', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 启用权限 - * @param string $name - * @return array ['code', 'msg', 'data'] - */ - public function enableAuthority($name) { - try { - $where = ['name' => $name]; - $msg = $this->where($where)->find(); - if ($msg) { - $result = $this->where($where)->update(['enabled' => 1]); - return ['code' => CODE_SUCCESS, 'msg' => '启用成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '不存在此权限', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 关闭权限 - * @param string $name - * @return array ['code', 'msg', 'data'] - */ - public function disableAuthority($name) { - try { - $where = ['name' => $name]; - $msg = $this->where($where)->find(); - if ($msg) { - $result = $this->where($where)->update(['enabled' => 0]); - return ['code' => CODE_SUCCESS, 'msg' => '启用成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '不存在此权限', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - -} \ No newline at end of file diff --git a/back_end/application/panel/model/CacheModel.php b/back_end/application/panel/model/CacheModel.php deleted file mode 100644 index 54afd20a4..000000000 --- a/back_end/application/panel/model/CacheModel.php +++ /dev/null @@ -1,69 +0,0 @@ -cache_time = 5; - } - - /** - * @param array $data - * @param int $problem_id - * @param boolean core_only - * @return array ['code', 'msg', 'data'] - */ - public function setProblemKnowledgeCache($data, $problem_id, $core_only) { - try { - $ok = Cache::store('redis')->set("problem_knowledge".$problem_id.$core_only, $data, VALID_TIME); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '更新题目知识点信息失败', 'data' => $data]; - } - return ['code' => CODE_SUCCESS, 'msg' => '更新题目知识点信息成功', 'data' => $data]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - /** - * @param int $problem_id - * @param boolean $core_only - * @return array ['code', 'msg', 'data'] - */ - public function getProblemKnowledgeCache($problem_id, $core_only) { - try { - $ok = Cache::store('redis')->get("problem_knowledge".$problem_id.$core_only); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '获取题目知识点信息失败', 'data' => []]; - } - return ['code' => CODE_SUCCESS, 'msg' => '获取题目知识点信息成功', 'data' => $ok]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } - - /** - * @param int $problem_id - * @param boolean $core_only - * @return array ['code', 'msg', 'data'] - */ - public function unsetProblemKnowledgeCache($problem_id, $core_only) { - try { - $ok = Cache::store('redis')->rm("problem_knowledge".$problem_id.$core_only); - if (!$ok) { - return ['code' => CODE_ERROR, 'msg' => '删除题目知识点信息失败', 'data' => $ok]; - } - return ['code' => CODE_SUCCESS, 'msg' => '删除题目知识点信息成功', 'data' => $ok]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => 'redis异常', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/panel/model/ContestModel.php b/back_end/application/panel/model/ContestModel.php deleted file mode 100644 index c9fbd9230..000000000 --- a/back_end/application/panel/model/ContestModel.php +++ /dev/null @@ -1,91 +0,0 @@ -select()->toArray(); - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } else if ($contest_id !== 0) { - $content = $this->where('contest_id', $contest_id)->find(); - if (empty($content)) { - return ['code' => CODE_ERROR, 'msg' => '未找到数据', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } else { - $content = $this->where('contest_name', 'like', '%' . $contest_name . '%')->select()->toArray(); - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - public function getAllContest($where, $limit, $offset) - { - try{ - $field = ['contest_id', 'contest_name', 'begin_time', 'end_time', 'status']; - $info = $this->field($field) - ->where($where) - ->limit($offset, $limit) - ->withAttr('status', function($value) { - $status = [-1=>'删除', 0=>'禁用', 1=>'正常']; - return $status[$value]; - }) - ->select(); - if($info === false){ - return ['code' => CODE_ERROR,'msg' => '返回值异常','data' => $this->getError()]; - } - return ['code' => CODE_SUCCESS, 'msg' => '获取成功', 'data' => $info->toArray()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR,'msg' => '操作数据库异常','data' => $e->getMessage()]; - } - } - - public function newContest($data) - { - try { - $res = $this->insert($data); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '新建比赛成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '新建比赛失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function deleContest($contest_id) - { - try { - $res = $this->where('contest_id', $contest_id)->update(['state' => 0]); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '删除比赛成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '删除比赛失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function editContest($contest_id, $data) - { - try { - $res = $this->where('contest_id', $contest_id)->update($data); - return ['code' => CODE_SUCCESS, 'msg' => '编辑比赛成功', 'data' => '']; - - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/panel/model/KnowledgeModel.php b/back_end/application/panel/model/KnowledgeModel.php deleted file mode 100644 index 6ba104d66..000000000 --- a/back_end/application/panel/model/KnowledgeModel.php +++ /dev/null @@ -1,133 +0,0 @@ -where('name', 'like', '%'.$name.'%')->select(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取知识点 - * @param string $name - * @return array ['code', 'msg', 'data'] - */ - public function getSpecificKnowledge($name) { - try { - $result = $this->where(['name' => $name])->find(); - if ($result) { - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '无此知识点', 'data' => $name]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function getKnowledgeByID($id) { - try { - $result = $this->where(['id' => $id])->find(); - if ($result) { - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '无此知识点', 'data' => $id]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取一对知识点 - * @param array $data ['name', 'pre_name'] - * @return array ['code', 'msg', 'data'] - */ - public function getKnowledgePairID($data) { - try { - $msg = $this->getSpecificKnowledge($data['name']); - if ($msg['code'] == CODE_SUCCESS) { - $knowledge_id = $msg['data']['id']; - } else { - return ['code' => CODE_ERROR, 'msg' => '知识点不存在', 'data' => []]; - } - $msg = $this->getSpecificKnowledge($data['pre_name']); - if ($msg['code'] == CODE_SUCCESS) { - $pre_knowledge_id = $msg['data']['id']; - } else { - return ['code' => CODE_ERROR, 'msg' => '前置知识点不存在', 'data' => []]; - } - $returnData = [ - 'knowledge_id' => $knowledge_id, - 'pre_knowledge_id'=> $pre_knowledge_id - ]; - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $returnData]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - - /** - * @usage 添加知识点 - * @param array $data ['name', 'point'] - * @return array ['code', 'msg', 'data'] - */ - public function addKnowledge($data) { - try { - $where = ['name' => $data['name']]; - $msg = $this->where($where)->find(); - if ($msg) { - return ['code' => CODE_ERROR, 'msg' => '已存在此知识点', 'data' => $msg]; - } else { - $insertData = ['name' => $data['name'], 'point' => $data['point']]; - $info = $this->insertGetId($data); - return ['code' => CODE_SUCCESS, 'msg' => '插入成功', 'data' => $info]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 删除知识点 - * @param array $data ['name'] - * @return array ['code', 'msg', 'data'] - */ - public function deleteKnowledge($data) { - try { - $where = ['name' => $data['name']]; - $msg = $this->where($where)->find(); - if ($msg) { - $knowledgeUserModel = new KnowledgeUserModel(); - if ($knowledgeUserModel->deleteKnowledge($data['name']) == false) { - return ['code' => CODE_ERROR, 'msg' => '删除失败', 'data' => []]; - } - $info = $this->where($where)->delete(); - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '不存在此知识点', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/panel/model/KnowledgeProblemModel.php b/back_end/application/panel/model/KnowledgeProblemModel.php deleted file mode 100644 index 10646fc20..000000000 --- a/back_end/application/panel/model/KnowledgeProblemModel.php +++ /dev/null @@ -1,264 +0,0 @@ -getSpecificKnowledge($knowledge); - if ($msg['code'] == CODE_SUCCESS) { - $where = [ - 'a.knowledge_id' => $msg['data']['id'], - ]; - if ($core_only) { - $where['a.is_core'] = 1; - } - $result = $this->alias('a') - ->join(['problem' => 'p'], 'p.problem_id = a.problem_id') - ->where($where) - ->field(['p.problem_id', 'a.is_core']) - ->select(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '知识点不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取问题知识点 - * @param int $problem_id - * @param boolean $core_only - * @return array ['code', 'msg', 'data'] - */ - public function getKnowledgeByProblem($problem_id, $core_only = false) { - $cacheModel = new CacheModel(); - $cache = $cacheModel->getProblemKnowledgeCache($problem_id, $core_only); - if ($cache['code'] == CODE_SUCCESS) { - return $cache; - } - try { - $problemModel = new ProblemModel(); - $msg = $problemModel->searchProblemById($problem_id); - if ($msg['code'] == CODE_SUCCESS) { - $where = ['a.problem_id' => $problem_id]; - if ($core_only == true) { - $where['is_core'] = 1; - } - $result = $this->alias('a') - ->join(['knowledge' => 'k'], 'k.id = a.knowledge_id') - ->where($where) - ->field(['k.id', 'k.name', 'a.is_core']) - ->select(); - $cacheModel->setProblemKnowledgeCache($result, $problem_id, $core_only); - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '知识点不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 添加关系 - * @param array $data ['problem_id', 'knowledge', 'is_core'] - * @return array ['code', 'msg', 'data'] - */ - public function addRelation($data) { - try { - $msg = $this->getRelationPair($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - return ['code' => CODE_ERROR, 'msg' => '关系已存在', 'data' => []]; - } else { - $insertData = [ - 'problem_id' => $id_pair['problem_id'], - 'knowledge_id' => $id_pair['knowledge_id'], - 'is_core' => isset($data['is_core'])?$data['is_core']:0, - ]; - $info = $this->insertGetId($insertData); - $cacheModel = new CacheModel(); - $cacheModel->unsetProblemKnowledgeCache($insertData['problem_id'], $insertData['is_core']); - return ['code' => CODE_SUCCESS, 'msg' => '插入成功', 'data' => $info]; - } - - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取关系对id - * @param array $data ['problem_id', 'knowledge'] - * @return array ['code', 'msg', 'data'] - */ - public function getRelationPair($data) { - $knowledgeModel = new KnowledgeModel(); - $problemModel = new ProblemModel(); - $msg = $knowledgeModel->getSpecificKnowledge($data['knowledge']); - if ($msg['code'] == CODE_SUCCESS) { - $knowledge_id = $msg['data']['id']; - } else { - return $msg; - } - $msg = $problemModel->searchProblemById($data['problem_id']); - if ($msg['code'] == CODE_ERROR) { - return ['code' => CODE_ERROR, 'msg' => '题目编号不存在', 'data' => []]; - } - $returnData = [ - 'knowledge_id' => $knowledge_id, - 'problem_id' => $data['problem_id'] - ]; - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $returnData]; - } - - - /** - * @usage 删除关系 - * @param array $data ['problem_id', 'knowledge'] - * @return array ['code', 'msg', 'data'] - */ - public function deleteRelation($data) { - try { - $msg = $this->getRelationPair($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ - 'id' => $msg['id'], - ]; - $info = $this->where($where)->delete(); - $cacheModel = new CacheModel(); - $cacheModel->unsetProblemKnowledgeCache($data['problem_id'], true); - $cacheModel->unsetProblemKnowledgeCache($data['problem_id'], false); - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 切换必要题目 - * @param array $data ['problem_id', 'knowledge'] - * @return array ['code', 'msg', 'data'] - */ - public function switchCore($data) { - try { - $msg = $this->getRelationPair($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ 'id' => $msg['id']]; - if ($msg['is_core'] == 1) { - $updateData = ['is_core' => 0]; - } else { - $updateData = ['is_core' => 1]; - } - $info = $this->where($where)->update($updateData); - $cacheModel = new CacheModel(); - $cacheModel->unsetProblemKnowledgeCache($data['problem_id'], true); - $cacheModel->unsetProblemKnowledgeCache($data['problem_id'], false); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 设置必要题目 - * @param array $data ['problem_id', 'knowledge'] - * @return array ['code', 'msg', 'data'] - */ - public function setCore($data) { - try { - $msg = $this->getRelationPair($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ 'id' => $msg['id']]; - $updateData = ['is_core' => 1]; - $info = $this->where($where)->update($updateData); - $cacheModel = new CacheModel(); - $cacheModel->unsetProblemKnowledgeCache($data['problem_id'], true); - $cacheModel->unsetProblemKnowledgeCache($data['problem_id'], false); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 取消设置必要题目 - * @param array $data ['problem_id', 'knowledge'] - * @return array ['code', 'msg', 'data'] - */ - public function unsetCore($data) { - try { - $msg = $this->getRelationPair($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ 'id' => $msg['id']]; - $updateData = ['is_core' => 0]; - $info = $this->where($where)->update($updateData); - $cacheModel = new CacheModel(); - $cacheModel->unsetProblemKnowledgeCache($data['problem_id'], true); - $cacheModel->unsetProblemKnowledgeCache($data['problem_id'], false); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/panel/model/KnowledgeRelationModel.php b/back_end/application/panel/model/KnowledgeRelationModel.php deleted file mode 100644 index 4fb2be9a2..000000000 --- a/back_end/application/panel/model/KnowledgeRelationModel.php +++ /dev/null @@ -1,218 +0,0 @@ - CODE_ERROR, 'msg' => '前后知识点相同', 'data' => []]; - } - $knowledgeModel = new KnowledgeModel(); - $msg = $knowledgeModel->getKnowledgePairID($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - return ['code' => CODE_ERROR, 'msg' => '关系已存在', 'data' => []]; - } else { - $insertData = [ - 'knowledge_id' => $id_pair['knowledge_id'], - 'pre_knowledge_id' => $id_pair['pre_knowledge_id'], - 'is_core' => isset($data['is_core'])?$data['is_core']:0, - ]; - $info = $this->insertGetId($insertData); - return ['code' => CODE_SUCCESS, 'msg' => '插入成功', 'data' => $info]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 删除知识点关系 - * @param array $data ['name', 'pre_name', 'is_core'] - * @return array ['code', 'msg', 'data'] - */ - public function deleteRelation($data) - { - try { - $knowledgeModel = new KnowledgeModel(); - $msg = $knowledgeModel->getKnowledgePairID($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ - 'id' => $msg['id'], - ]; - $info = $this->where($where)->delete(); - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 删除知识点关系(ID) - * @param int $id - * @return array ['code', 'msg', 'data'] - */ - public function deleteRelationByID($id) - { - try { - $where = ['id' => $id]; - $msg = $this->where($where)->find(); - if ($msg) { - $info = $this->where($where)->delete(); - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取前置知识点 - * @param string $name - * @param boolean $core_only - * @return array ['code', 'msg', 'data'] - */ - public function getPreKnowledge($name, $core_only = false) { - try { - $knowledgeModel = new KnowledgeModel(); - $msg = $knowledgeModel->getSpecificKnowledge($name); - if ($msg['code'] == CODE_SUCCESS) { - $where = [ - 'k.knowledge_id' => $msg['data']['id'] - ]; - if ($core_only) { - $where['k.is_core'] = 1; - } - $result = $this->alias('k') - ->join(['knowledge' => 'a'], 'a.id = k.pre_knowledge_id') - ->where($where) - ->field(['a.id', 'a.name', 'k.is_core']) - ->select(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '知识点不存在', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 切换是否为必须前置 - * @param array $data['name', 'pre_name'] - * @return array ['code', 'msg', 'data'] - */ - public function switchCore($data) { - try { - $knowledgeModel = new KnowledgeModel(); - $msg = $knowledgeModel->getKnowledgePairID($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ 'id' => $msg['id']]; - if ($msg['is_core'] == 0) { - $updateData = ['is_core' => 1]; - } else { - $updateData = ['is_core' => 0]; - } - $info = $this->where($where)->update($updateData); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 设置为必须前置 - * @param array $data ['name', 'pre_name'] - * @return array ['code', 'msg', 'data'] - */ - public function setCore($data) { - try { - $knowledgeModel = new KnowledgeModel(); - $msg = $knowledgeModel->getKnowledgePairID($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ 'id' => $msg['id']]; - $updateData = ['is_core' => 1]; - $info = $this->where($where)->update($updateData); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 取消设置为必须前置 - * @param array $data ['name', 'pre_name'] - * @return array ['code', 'msg', 'data'] - */ - public function unsetCore($data) { - try { - $knowledgeModel = new KnowledgeModel(); - $msg = $knowledgeModel->getKnowledgePairID($data); - if ($msg['code'] == CODE_ERROR) { - return $msg; - } else { - $id_pair = $msg['data']; - } - $msg = $this->where($id_pair)->find(); - if ($msg) { - $where = [ 'id' => $msg['id']]; - $updateData = ['is_core' => 0]; - $info = $this->where($where)->update($updateData); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/panel/model/KnowledgeTagModel.php b/back_end/application/panel/model/KnowledgeTagModel.php deleted file mode 100644 index 229c9304e..000000000 --- a/back_end/application/panel/model/KnowledgeTagModel.php +++ /dev/null @@ -1,123 +0,0 @@ -checkExist($knowledge_id, $tag_id); - if ($result['code'] != CODE_SUCCESS) return $result; - $pair = [ - 'knowledge_id' => $knowledge_id, - 'tag_id' => $tag_id - ]; - $result = $this->where($pair)->find(); - if ($result) { - return ['code' => CODE_ERROR, 'msg' => '关系已存在', 'data' => []]; - } else { - $info = $this->insertGetId($pair); - return ['code' => CODE_SUCCESS, 'msg' => '插入成功', 'data' => $info]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 删除关系 - * @param int $knowledge_id - * @param int $tag_id - * @return array ['code', 'msg', 'data'] - */ - public function deleteKnowledgeTag($knowledge_id, $tag_id) { - try { - $result = $this->checkExist($knowledge_id, $tag_id); - if ($result['code'] != CODE_SUCCESS) return $result; - $pair = [ - 'knowledge_id' => $knowledge_id, - 'tag_id' => $tag_id - ]; - $result = $this->where($pair)->find(); - if ($result) { - $info = $this->where($pair)->delete(); - return ['code' => CODE_SUCCESS, 'msg' => '插入成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 删除关系 - * @param int $id - * @return array ['code', 'msg', 'data'] - */ - public function deleteKnowledgeTagByID($id) { - try { - $pair = ['id' => $id]; - $result = $this->where($pair)->find(); - if ($result) { - $info = $this->where($pair)->delete(); - return ['code' => CODE_SUCCESS, 'msg' => '插入成功', 'data' => $info]; - } else { - return ['code' => CODE_ERROR, 'msg' => '关系不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - /** - * @usage 获取标签 - * @param int $knowledge_id - * @return array ['code', 'msg', 'data'] - */ - public function getKnowledgeTag($knowledge_id) { - try { - $knowledgeModel = new KnowledgeModel(); - $result = $knowledgeModel->getKnowledgeByID($knowledge_id); - if ($result['code'] != CODE_SUCCESS) return $result; - - $where = [ - 'k.knowledge_id' => $knowledge_id - ]; - $result = $this->alias('k') - ->join(['tag' => 'a'], 'a.id = k.tag_id') - ->where($where) - ->field(['a.id', 'a.name', 'a.description']) - ->select(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - private function checkExist($knowledge_id, $tag_id) { - try { - $tagModel = new TagModel(); - $knowledgeModel = new KnowledgeModel(); - $result = $tagModel->getTheTag($tag_id); - if ($result['code'] != CODE_SUCCESS) return $result; - $result = $knowledgeModel->getKnowledgeByID($knowledge_id); - if ($result['code'] != CODE_SUCCESS) return $result; - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => []]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/panel/model/KnowledgeUserModel.php b/back_end/application/panel/model/KnowledgeUserModel.php deleted file mode 100644 index f680ed346..000000000 --- a/back_end/application/panel/model/KnowledgeUserModel.php +++ /dev/null @@ -1,256 +0,0 @@ -where(['user_id' => $user_id])->find(); - $returnData = json_decode($result['knowledge_doing']); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $returnData]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => $e->getMessage(), 'data' => []]; - } - } - - /** - * @usage 获取所有已完成的知识点 - * @param $user_id - * @return array ['code', 'msg', 'data'] - */ - public function getAllDoneKnowledge($user_id) { - try { - $result = $this->where(['user_id' => $user_id])->find(); - $returnData = json_decode($result['knowledge_done']); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $returnData]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => $e->getMessage(), 'data' => []]; - } - } - - /** - * @usage 判断知识点状态 - * @param int $user_id - * @param string $knowledge - * @return array ['code', 'msg', 'data'] - */ - public function getKnowledgeStatus($user_id, $knowledge) { - try { - $result = $this->where(['user_id' => $user_id])->find(); - $knowledge_doing = json_decode($result['knowledge_doing']); - $knowledge_done = json_decode($result['knowledge_done']); - if ($this->checkDoingKnowledge($knowledge_doing, $knowledge)) { - return ['code' => CODE_SUCCESS, 'msg' => '知识点进行中', 'data' => 0]; - } else if ($this->checkDoneKnowledge($knowledge_done, $knowledge)) { - return ['code' => CODE_SUCCESS, 'msg' => '知识点已完成', 'data' => 1]; - } else { - return ['code' => CODE_SUCCESS, 'msg' => '知识点未开始', 'data' => -1]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => $e->getMessage(), 'data' => []]; - } - } - - /** - * @usage 添加进行的知识点 - * @param int $user_id - * @param string $knowledge - * @return array ['code', 'msg', 'data'] - */ - public function addDoingKnowledge($user_id, $knowledge) { - try { - $knowledgeRelationModel = new KnowledgeRelationModel(); - $result = $this->processData($user_id, $knowledge); - if ($result['code'] != CODE_SUCCESS) { - return $result; - } else { - $knowledge_doing = $result['data']['knowledge_doing']; - $knowledge_done = $result['data']['knowledge_done']; - } - if ($this->checkDoneKnowledge($knowledge_done, $knowledge) == true) { - return ['code' => CODE_ERROR, 'msg' => '知识点已完成', 'data' => []]; - } - if ($this->checkDoingKnowledge($knowledge_doing, $knowledge) == true) { - return ['code' => CODE_ERROR, 'msg' => '知识点进行中', 'data' => []]; - } - $pre_knowledge = $knowledgeRelationModel->getPreKnowledge($knowledge, true)['data']; - foreach ($pre_knowledge as $item) { - if ($this->checkDoneKnowledge($knowledge_done, $item['name']) == false) { - return ['code' => CODE_ERROR, 'msg' => '存在前置知识点未完成', 'data' => $item]; - } - } - array_push($knowledge_doing, $knowledge); - $result = $this->where(['user_id' => $user_id])->update(['knowledge_doing' => (array)$knowledge_doing]); - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => $result]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => $e->getMessage(), 'data' => []]; - } - } - - - /** - * @usage 添加完成知识点 - * @param int $user_id - * @param string $knowledge - * @return array ['code', 'msg', 'data'] - */ - public function addDoneKnowledge($user_id, $knowledge) { - try { - $submitModel = new SubmitModel(); - $problemKnowledgeModel = new KnowledgeProblemModel(); - $result = $this->processData($user_id, $knowledge); - if ($result['code'] != CODE_SUCCESS) { - return $result; - } else { - $knowledge_doing = $result['data']['knowledge_doing']; - $knowledge_done = $result['data']['knowledge_done']; - } - if ($this->checkDoneKnowledge($knowledge_done, $knowledge) == true) { - return ['code' => CODE_ERROR, 'msg' => '知识点已完成', 'data' => []]; - } - if ($this->checkDoingKnowledge($knowledge_doing, $knowledge) == false) { - return ['code' => CODE_ERROR, 'msg' => '知识点未进行', 'data' => []]; - } - $problems = $problemKnowledgeModel->getProblemByKnowledge($knowledge, true)['data']; - foreach ($problems as $problem) { - $problem_id = $problem['problem_id']; - $where = [ - 'user_id' => $user_id, - 'problem_id' => $problem_id, - 'status' => 'AC' - ]; - $result = $submitModel->where($where)->find(); - if (!$result) { - return ['code' => CODE_ERROR, 'msg' => '有题目未完成', 'data' => $problem]; - } - } - $knowledge_doing = array_diff($knowledge_doing, [$knowledge]); - array_push($knowledge_done, ['name' => $knowledge, 'score' => 100]); - $insertData = [ - 'knowledge_doing' => $knowledge_doing, - 'knowledge_done' => $knowledge_done - ]; - $result = $this->where(['user_id' => $user_id])->update($insertData); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $result]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => $e->getMessage(), 'data' => []]; - } - } - - /** - * @usage 删除知识点 - * @param string $knowledge - * @return boolean - */ - public function deleteKnowledge($knowledge) { - try { - $data = $this->select(); - foreach ($data as $item) { - $id = $item['id']; - $knowledge_doing = json_decode($item['knowledge_doing']); - $knowledge_done = json_decode($item['knowledge_done']); - $new_knowledge_doing = array(); - $new_knowledge_done = array(); - foreach ($knowledge_doing as $doing) { - if ($doing == $knowledge) continue; - array_push($new_knowledge_doing, $doing); - } - foreach ($knowledge_done as $done) { - if ($done->name == $knowledge) continue; - array_push($new_knowledge_done, $done); - } - $insertData = [ - 'knowledge_doing' => $new_knowledge_doing, - 'knowledge_done' => $new_knowledge_done - ]; - $this->where(['id' => $id])->update($insertData); - return true; - } - } catch (DbException $e) { - return false; - } - } - - /** - * @usage 处理数据 - * @param int $user_id - * @param string $knowledge - * @return array ['code', 'msg', 'data'] - */ - public function processData($user_id, $knowledge) { - try { - $userModel = new UserModel(); - $knowledgeModel = new KnowledgeModel(); - $knowledgeRelationModel = new KnowledgeRelationModel(); - $result = $userModel->searchUserById($user_id); - if ($result['code'] != CODE_SUCCESS) { - return ['code' => CODE_ERROR, 'msg' => '用户不存在', 'data' => []]; - } - $result = $knowledgeModel->getSpecificKnowledge($knowledge); - if ($result['code'] != CODE_SUCCESS) { - return ['code' => CODE_ERROR, 'msg' => '知识点不存在', 'data' => []]; - } - $result = $this->where(['user_id' => $user_id])->find(); - if (!$result) { - $insertData = [ - 'user_id' => $user_id, - 'knowledge_doing' => array(), - 'knowledge_done' => array() - ]; - $this->insertGetId($insertData); - $knowledge_doing = $knowledge_done = array(); - } else { - $knowledge_doing = json_decode($result['knowledge_doing']); - $knowledge_done = json_decode($result['knowledge_done']); - } - $data = [ - 'knowledge_doing' => $knowledge_doing, - 'knowledge_done' => $knowledge_done - ]; - return ['code' => CODE_SUCCESS, 'msg' => '处理成功', 'data' => $data]; - }catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => $e->getMessage(), 'data' => []]; - } - } - - /** - * @usage 查找正在进行中是否包含某知识点 - * @param array $doing - * @param string $knowledge - * @return boolean - */ - public function checkDoingKnowledge($doing, $knowledge) { - foreach ($doing as $item) { - if ($item == $knowledge) { - return true; - } - } - return false; - } - - /** - * @usage 查找已完成中是否包含某知识点 - * @param array $done - * @param string $knowledge - * @return boolean - */ - public function checkDoneKnowledge($done, $knowledge) { - foreach ($done as $item) { - if ($item->name == $knowledge) { - return true; - } - } - return false; - } -} \ No newline at end of file diff --git a/back_end/application/panel/model/ProblemModel.php b/back_end/application/panel/model/ProblemModel.php deleted file mode 100644 index d108e2dce..000000000 --- a/back_end/application/panel/model/ProblemModel.php +++ /dev/null @@ -1,155 +0,0 @@ -where('problem_id', $problem_id)->find(); - $sample = $sampleModel->searchSampleByProblemID($problem_id); - if (count($sample['data'])) { - $content['sample_input'] = $sample['data'][0]['input']; - $content['sample_output'] =$sample['data'][0]['output']; - } - - if ($content) { - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } - return ['code' => CODE_ERROR, 'msg' => '查找失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function getAllProblem($where, $limit, $offset) - { - try{ - $field = ['p.problem_id as problem_id', 'title', 'public', 'count(case when submit.status="AC" then submit.status end) as ac', 'p.status as status']; - $info = $this->alias('p') - ->field($field) - ->where($where) - ->leftJoin('submit', 'p.problem_id = submit.problem_id') - ->group('p.problem_id') - ->limit($offset, $limit) - ->withAttr('status', function($value) { - $status = [-1=>'删除', 0=>'禁用', 1=>'正常', 2=>'比赛']; - return $status[$value]; - }) - ->order('problem_id', 'desc') - ->select(); - if(empty($info)){ - return ['code' => CODE_ERROR,'msg' => '返回值异常','data' => $this->getError()]; - } - return ['code' => CODE_SUCCESS, 'msg' => '获取成功', 'data' => $info->toArray()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR,'msg' => '操作数据库异常','data' => $e->getMessage()]; - } - } - - public function changeProblemStatus($problem_id, $data) { - try { - - $res = $this->where('problem_id', $problem_id)->update($data); - return ['code' => CODE_SUCCESS, 'msg' => '编辑成功', 'data' => $res]; - - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function editProblem($problem_id, $data) - { - try { - $sampleModel = new SampleModel(); - $insertData = [ - 'title' => $data['title'], - 'background' => $data['background'], - 'describe' => $data['describe'], - 'input_format' => $data['input_format'], - 'output_format' => $data['output_format'], - 'hint' => $data['hint'] , - 'source' => $data['source'], - 'public' => $data['public'], - 'tag' => $data['tag'] - ]; - $res1 = $this->where('problem_id', $problem_id)->update($insertData); - if ($data['sample_input'] != '' && $data['sample_output'] != '') { - $res2 = $sampleModel->editSampleByProblemID($problem_id, $data['sample_input'], $data['sample_output']); - } else { - $res2 = ['code' => CODE_SUCCESS]; - } - if ($res1 !== false && $res2['code'] == CODE_SUCCESS) { - return ['code' => CODE_SUCCESS, 'msg' => '编辑成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '编辑失败', 'data' => $res2]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - /** - * @param $data : $title, $background, $describe, $input_format, $output_format, $hint, $public(boolean), $source, $tag - * @return array - */ - public function addProblem($data) - { - try { - $sampleModel = new SampleModel(); - $insertData = [ - 'title' => $data['title'], - 'background' => $data['background'], - 'describe' => $data['describe'], - 'input_format' => $data['input_format'], - 'output_format' => $data['output_format'], - 'hint' => $data['hint'] , - 'source' => $data['source'], - 'public' => $data['public'], - 'tag' => $data['tag'] - ]; - $res1 = $this->insertGetId($insertData); - if ($data['sample_input'] != '' && $data['sample_output'] != '') { - $res2 = $sampleModel->addSample($res1, $data['sample_input'], $data['sample_output']); - } else { - $res2 = ['code' => CODE_SUCCESS]; - } - if ($res1 !== false && $res2['code'] == CODE_SUCCESS) { - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '添加失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function deleProblem($problem_id) - { - try { - $res = $this->where('problem_id', $problem_id)->delete(); - if ($res !== false) { - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '删除失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function editProblemDataInfo($problem_id, $data) - { - try { - $res = $this->where('problem_id', $problem_id)->update($data); - return ['code' => CODE_SUCCESS, 'msg' => '编辑成功', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - -} \ No newline at end of file diff --git a/back_end/application/panel/model/RoleGroupModel.php b/back_end/application/panel/model/RoleGroupModel.php deleted file mode 100644 index 52211d4c0..000000000 --- a/back_end/application/panel/model/RoleGroupModel.php +++ /dev/null @@ -1,236 +0,0 @@ -select(); - foreach ($msg as $item) { - $item['authority'] = $item['authority']->auth; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $msg]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取某权限组 - * @param string $group_name - * @return array ['code', 'msg', 'data'] - */ - public function getRoleGroup($group_name) { - try { - $where = ['group_name' => $group_name]; - $msg = $this->where($where)->find(); - if ($msg) { - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $msg]; - } else { - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 添加权限组 - * @param array $data ['group_name'] - * @return array ['code', 'msg', 'data'] - */ - public function addRoleGroup($data) { - try { - $where = ['group_name' => $data['group_name']]; - $msg = $this->where($where)->find(); - if ($msg) { - return ['code' => CODE_ERROR, 'msg' => '权限组已存在', 'data' => $msg]; - } else { - //默认权限组不存在权限 - $insertData = [ - 'group_name' => $data['group_name'], - 'authority' => ["auth" => []], - ]; - $info = $this->insertGetId($insertData); - return ['code' => CODE_SUCCESS, 'msg' => '插入成功', 'data' => $info]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 删除权限组 - * @param array $data ['group_name'] - * @return array ['code', 'msg', 'data'] - */ - public function deleteRoleGroup($data) { - try { - $role_group = $this->getRoleGroup($data['group_name']); - if ($role_group['code'] == CODE_ERROR) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常或用户组不存在', 'data' => []]; - } else if ($role_group['data']['user_num'] !== 0) { - //需要考虑删除权限组时用户注册的权限组情况 - return ['code' => CODE_ERROR, 'msg' => '有用户绑定于此权限', 'data' => $role_group]; - } else { - $result = $this->where(['group_name' => $data['group_name']])->delete(); - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => $result]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } catch (\Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 更新权限 - * @param array $data ['group_name', 'authority'] - * @return array ['code', 'msg', 'data'] - */ - public function updateAuthority($data) { - try { - $authModel = new AuthorityModel(); - //验证权限是否存在 - foreach ($data['authority'] as $auth) { - $info = $authModel->getAuthority($auth); - if ($info['code'] == -1) { - return ['code' => CODE_ERROR, 'msg' => '有权限不存在', 'data' => $auth]; - } - } - $where = ['group_name' => $data['group_name']]; - $msg = $this->where($where)->find(); - if ($msg) { - $insertData = [ - 'authority' => ['auth' => $data['authority']], - ]; - $result = $this->where($where)->update($insertData); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '权限组不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 启用/禁用权限组 - * @param string $group_name - * @return array ['code', 'msg', 'data'] - */ - public function switchRoleGroupStatus($group_name) { - try { - $where = ['group_name' => $group_name]; - $msg = $this->where($where)->find(); - if ($msg) { - if ($msg['enabled'] == 1) { - return $this->disableRoleGroup($group_name); - } else { - return $this->enableRoleGroup($group_name); - } - } else { - return ['code' => CODE_ERROR, 'msg' => '不存在此权限', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - - /** - * @usage 启用权限组 - * @param string $group_name - * @return array ['code', 'msg', 'data'] - */ - public function enableRoleGroup($group_name) { - try { - $where = ['group_name' => $group_name]; - $msg = $this->where($where)->find(); - if ($msg) { - $result = $this->where($where)->update(['enabled' => 1]); - return ['code' => CODE_SUCCESS, 'msg' => '启用成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '不存在此权限组', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 停用权限组 - * @param string $group_name - * @return array ['code', 'msg', 'data'] - */ - public function disableRoleGroup($group_name) { - try { - $where = ['group_name' => $group_name]; - $msg = $this->where($where)->find(); - if ($msg) { - $result = $this->where($where)->update(['enabled' => 0]); - return ['code' => CODE_SUCCESS, 'msg' => '停用成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '不存在此权限组', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 用户加一 - * @param string $group_name - * @return array ['code', 'msg', 'data'] - */ - public function incUserNumber($group_name) { - try { - $where = ['group_name' => $group_name]; - $msg = $this->where($where)->find(); - if ($msg) { - $result = $this->where($where)->setInc('user_num'); - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '不存在此权限组', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 用户数减一 - * @param string $group_name - * @return array ['code', 'msg', 'data'] - */ - public function decUserNumber($group_name) { - try { - $where = ['group_name' => $group_name]; - $msg = $this->where($where)->find(); - if ($msg) { - $result = $this->where($where)->setDec('user_num'); - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '不存在此权限组', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } -} diff --git a/back_end/application/panel/model/SubmitModel.php b/back_end/application/panel/model/SubmitModel.php deleted file mode 100644 index bfac1fc82..000000000 --- a/back_end/application/panel/model/SubmitModel.php +++ /dev/null @@ -1,71 +0,0 @@ -field($field) - ->where($where) - ->limit($offset, $limit) - ->withAttr('language', function($value) { - $language = [0=>'c.gcc', 1=>'cpp.g++', 2=>'java.openjdk10', 3=>'python.cpython3.6']; - return $language[$value]; - }) - ->select() - ->toArray(); - if(empty($info)){ - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function getSubmitGroup($where) { - try { - $res = $this->field(['id','user_id','nick', 'problem_id', 'language', 'status', 'time', 'memory', 'submit_time', 'source_code']) - ->where($where) - ->withAttr('language', function($value) { - $language = [0=>'c.gcc', 1=>'cpp.g++', 2=>'java.openjdk10', 3=>'python.cpython3.6']; - return $language[$value]; - })->select(); - if (count($res) != 0) { - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $res]; - } else { - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => $res]; - } - - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => "数据库错误", 'data' => $e->getMessage()]; - } - } - - public function getTheSubmit($id){ - try { - $info = $this->field(['id','user_id','nick', 'problem_id', 'language', 'status', 'time', 'memory', 'submit_time', 'source_code']) - ->where('id', $id) - ->withAttr('language', function($value) { - $language = [0=>'c.gcc', 1=>'cpp.g++', 2=>'java.openjdk10', 3=>'python.cpython3.6']; - return $language[$value]; - }) - ->find(); - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getTrace()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/panel/model/TagModel.php b/back_end/application/panel/model/TagModel.php deleted file mode 100644 index d2c9344e4..000000000 --- a/back_end/application/panel/model/TagModel.php +++ /dev/null @@ -1,86 +0,0 @@ -where($where) - ->limit($limit, $offset) - ->withAttr('status', function($value) { - $status = [-1=>'删除', 0=>'禁用', 1=>'正常']; - return $status[$value]; - }) - ->select() - ->toArray(); - if(empty($info)){ - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function getTheTag($id) - { - try{ - $info = $this->where('id', $id)->find(); - if(empty($info)){ - return ['code' => CODE_ERROR, 'msg' => '查询失败', 'data' => $info]; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function addTag($data) - { - try{ - $info = $this->strict(false)->insert($data); - if($info === false){ - return ['code' => CODE_ERROR, 'msg' => '添加标签失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '添加标签成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function editTag($data) - { - try{ - $info = $this->where('id', $data['id'])->update($data); - if($info === false){ - return ['code' => CODE_ERROR, 'msg' => '编辑标签失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '编辑标签成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } - - public function deleTag($id) - { - try{ - $info = $this->where('id', $id)->delete(); - if($info === false){ - return ['code' => CODE_ERROR, 'msg' => '删除标签失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '删除标签成功', 'data' => $info]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库错误', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/panel/model/UserModel.php b/back_end/application/panel/model/UserModel.php deleted file mode 100644 index 60fa4caa8..000000000 --- a/back_end/application/panel/model/UserModel.php +++ /dev/null @@ -1,285 +0,0 @@ -field($field) - ->where($where) - ->limit($offset, $limit) - ->withAttr('identity', function($value) { - $status = [-1=>'删除', 0=>'正常用户', 1=>'学生', 2=>'教师', 3=>'管理员']; - return $status[$value]; - }) - ->withAttr('status', function($value) { - $status = [-1=>'删除', 0=>'正常']; - return $status[$value]; - }) - ->select(); - if($info === false){ - return ['code' => CODE_ERROR,'msg' => '返回值异常','data' => $this->getError()]; - } - return ['code' => CODE_SUCCESS, 'msg' => '获取成功', 'data' => $info->toArray()]; - } catch (Exception $e) { - return ['code' => CODE_ERROR,'msg' => '操作数据库异常','data' => $e->getMessage()]; - } - } - - public function deleUser($user_id) - { - $this->where('user_id', $user_id)->delete(); - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => '']; - } - - public function addUser($data) - { - try { - $info = $this->where('nick', $data['nick'])->find(); - if (!empty($info)) { - return ['code' => USERNAME_IS_EXIST, 'msg' => '该昵称已被注册', 'data' => '']; - } - $res = $this->strict(false)->insert($data); - if ($res) { - return ['code' => CODE_SUCCESS, 'msg' => '添加成功', 'data' => '']; - } - return ['code' => CODE_ERROR, 'msg' => '添加失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function editUser($user_id = 0, $data, $nick = 0) - { - try { - if($user_id !== 0){ - $info = $this->where('user_id', $user_id)->update($data); - } else { - $info = $this->where('nick', $nick)->update($data); - } - if ($info !== 0) { - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $info]; - } - return ['code' => CODE_ERROR, 'msg' => '更新失败', 'data' => '']; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - public function searchUserById($user_id) - { - try { - $content = $this - ->field(['user_id', 'nick', 'realname', 'school', 'major', 'class', 'identity', 'contact', 'mail', 'desc', 'status']) - ->where('user_id', $user_id) - ->find(); - if(empty($content)){ - return ['code' => CODE_ERROR, 'msg' => '查找失败', 'data' => '']; - } - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - public function searchUserByNick($nick) - { - try { - $content = $this - ->field(['user_id', 'nick', 'realname', 'school', 'major', 'class', 'contact', 'mail', 'desc']) - ->where('nick', $nick)->find(); - if (empty($content)) { - return ['code' => CODE_ERROR, 'msg' => '用户名不存在', 'data' => $content]; - } - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $content]; - } catch (Exception $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - /** - * @usage 为用户更新权限组 - * @param array $data ['nick', 'role_group'] - * @return array ['code', 'msg', 'data'] - */ - public function updateRoleGroup($data) { - try { - $roleGroupModel = new RoleGroupModel(); - $where = ['nick' => $data['nick']]; - $msg = $this->where($where)->find(); - if ($msg) { - $groups = $this->getRoleGroups($data)['data']; - if ($groups != null) { - //删除现有权限组的注册 - $groups = $groups->group; - foreach ($groups as $group) { - $roleGroupModel->decUserNumber($group); - } - } - //判断权限组是否存在 - foreach ($data['role_group'] as $group) { - $info = $roleGroupModel->getRoleGroup($group); - if ($info['code'] == CODE_ERROR) { - return ['code' => CODE_ERROR, 'msg' => '有权限组不存在', 'data' => $group]; - } - } - //注册新的权限组 - foreach ($data['role_group'] as $group) { - $roleGroupModel->incUserNumber($group); - } - $insertData = [ - 'role_group' => ['group' => $data['role_group']], - ]; - $result = $this->where($where)->update($insertData); - return ['code' => CODE_SUCCESS, 'msg' => '更新成功', 'data' => $result]; - } else { - return ['code' => CODE_ERROR, 'msg' => '用户不存在', 'data' => $msg]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 查找某项权限 - * @param string $nick - * @param string $auth - * @return boolean|array ['code', 'msg', 'data'] - */ - public function existAuthority($nick, $auth) { - try { - $groupModel = new RoleGroupModel(); - $groups = $this->getRoleGroups(['nick'=>$nick])['data']->group; - foreach ($groups as $group) { - //寻找每个权限组内权限 - $authorities = $groupModel->getRoleGroup($group)['data']['authority']->auth; - foreach ($authorities as $authority) { - if ($authority == $auth) { - return true; - } - } - } - return false; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获得所有权限 - * @param array $data ['nick'] - * @return array ['code', 'msg', 'data'] - */ - public function getRoleGroups($data) { - try { - $where = ['nick' => $data['nick']]; - $msg = $this->where($where)->find(); - if ($msg) { - return ['code' => CODE_SUCCESS, 'msg' => '查找成功', 'data' => $msg['role_group']]; - } else { - return ['code' => CODE_ERROR, 'msg' => '用户不存在', 'data' => []]; - } - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 删除某权限组在用户中的注册 - * @param string $group_name - * @return array ['code', 'msg', 'data'] - */ - public function deleteUserRoleGroup($group_name) { - try { - //获取json字段中存在需要删除权限组的数据 - $sql = "select * from users where role_group->'$.group' like \"%".$group_name."%\";"; - $result = Db::query($sql); - if ($result != null) { - foreach ($result as $user) { - $nick = $user['nick']; - $role_group = $this->getRoleGroups(['nick' => $nick])['data']->group; - //构造新的权限字段 - $new_role_group = new \ArrayObject(); - foreach ($role_group as $group) { - if ($group != $group_name) { - $new_role_group->append($group); - } - } - if ($new_role_group->count() == 0) { - $new_role_group->append('guest'); - } - //更新权限组 - $data = [ - 'nick' => $nick, - 'role_group' => (array)$new_role_group, - ]; - $this->updateRoleGroup($data); - } - } - return ['code' => CODE_SUCCESS, 'msg' => '删除成功', 'data' => []]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } - - /** - * @usage 获取用户所有信息 - * @param void - * @return array - */ - public function getUserInfo() { - try { - $userModel = new UserModel(); - $submitModel = new SubmitModel(); - $users = $userModel->field(['user_id'])->select(); - $result = []; - foreach ($users as $user) { - $user_id = $user['user_id']; - $where = ['user_id' => $user_id]; - $user_basic_info = $userModel->where($where)->find(); - $user_submit_info = $submitModel->where($where)->select(); - $status = ['WA', 'TLE', 'MLE', 'CE', 'RE', 'OLE', 'PE']; - $returnData = [ - 'nick' => $user_basic_info['nick'], - 'realname' => $user_basic_info['realname'] - ]; - foreach ($status as $item) { - $returnData[$item] = 0; - } - $returnData['AC'] = 0; - $problem_map = []; - foreach ($user_submit_info as $submit) { - foreach ($status as $item) { - if ($submit['status'] == $item) { - $returnData[$item]++; - break; - } - // AC单独计算 - if ($submit['status'] == 'AC') { - if (!isset($problem_map[$submit['problem_id']])) { - $returnData['AC']++; - $problem_map[$submit['problem_id']] = true; - } - } - } - } - $result[$user_id] = $returnData; - } - return ['code' => CODE_SUCCESS, 'msg' => '查询成功', 'data' => $result]; - } catch (DbException $e) { - return ['code' => CODE_ERROR, 'msg' => '数据库异常', 'data' => $e->getMessage()]; - } - } -} \ No newline at end of file diff --git a/back_end/application/panel/view/contest/add.html b/back_end/application/panel/view/contest/add.html deleted file mode 100644 index 7a6d1e0e9..000000000 --- a/back_end/application/panel/view/contest/add.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - 控制台 - 比赛内容 - 添加比赛 - - - - - - - - - - - - - - - - -
- - - - -
-
-
-

添加比赛

-
-
-
-
-
-
基本设置
-
-
-
- -
-
- - -

请输入比赛的标题。

-
-
- - -

请输入开始时间。

-
-
- - -

请输入结束时间。

-
-
- - -

请输入封榜时间(0.2)。

-
-
- - -

请输入题目集(1001,1002)用英文逗号分割。

-
-
- - -

请输入题目对应的气球颜色(可为空;#FFFFFF, #FFFFF0)用英文逗号分割。

-
-
-
- -
-
-
-
-
-
-
-
-
- - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/contest/index.html b/back_end/application/panel/view/contest/index.html deleted file mode 100644 index 98662fb29..000000000 --- a/back_end/application/panel/view/contest/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - 控制台 - 比赛列表 - - - - - - - - - -
- - - -
-
-
-

比赛列表

-
-
-
-
-
-
比赛列表
-
- -
- -
-
- - - - - - - - - - - - - -
编号标题开始时间结束时间状态操作
-
-
-
-
-
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/contest/info.html b/back_end/application/panel/view/contest/info.html deleted file mode 100644 index cb854f829..000000000 --- a/back_end/application/panel/view/contest/info.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - 控制台 - 比赛内容 - 编辑比赛 - - - - - - - - - - - - - - - - -
- - - - -
-
-
-

编辑比赛

-
-
-
-
-
-
基本设置
-
-
-
- -
-
- -
-
- - -

请输入比赛的标题。

-
-
- - -

请输入开始时间。

-
-
- - -

请输入结束时间。

-
-
- - -

请输入封榜时间(0.2)。

-
-
- - -

请输入题目集(1001,1002)用英文逗号分割。

-
-
- - -

请输入题目对应的气球颜色(可为空;#FFFFFF, #FFFFF0)用英文逗号分割。

-
-
-
- -
-
-
-
-
-
-
-
-
- - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/index/index.html b/back_end/application/panel/view/index/index.html deleted file mode 100644 index a0e777667..000000000 --- a/back_end/application/panel/view/index/index.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - -控制台 - 服务端 - - - - - - -主页 - -
- - - -
-
-
-

WUT-OJ后台管理

-
-
- - -
-
- - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/knowledge/index.html b/back_end/application/panel/view/knowledge/index.html deleted file mode 100644 index f2f551ee7..000000000 --- a/back_end/application/panel/view/knowledge/index.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - - - 控制台 - 知识树管理 - - - - - - - - - -
- - - -
-
-
-

知识点管理

-
-
-
-
-
-
-
- - - - -
-
- -
知识点列表
-
- - - - - - - - - -
- - - - - - - - - - - - - -
编号知识点等级前置知识点标签操作
-
-
-
- -
-
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/knowledge/problem.html b/back_end/application/panel/view/knowledge/problem.html deleted file mode 100644 index 472970ef0..000000000 --- a/back_end/application/panel/view/knowledge/problem.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - - - - 控制台 - 知识树管理 - - - - - - - - - -
- - - -
-
-
-

问题知识点管理

-
-
-
-
-
- -
-
- - -
-
-
-
- - -
知识点列表
-
- - - - - - - - - -
- - - - - - - - - - - -
编号知识点是否为必做题目操作
-
-
-
- -
-
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/knowledge/relation.html b/back_end/application/panel/view/knowledge/relation.html deleted file mode 100644 index 2a360d16a..000000000 --- a/back_end/application/panel/view/knowledge/relation.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - - - - 控制台 - 知识树管理 - - - - - - - - - -
- - - -
-
-
-

前置知识点管理

-
-
-
-
-
- -
-
- - -
-
-
-
- - -
知识点列表
-
- - - - - - - - - -
- - - - - - - - - - - -
编号知识点是否为必要前置操作
-
-
-
- -
-
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/knowledge/tag.html b/back_end/application/panel/view/knowledge/tag.html deleted file mode 100644 index d472f4cdc..000000000 --- a/back_end/application/panel/view/knowledge/tag.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - - - 控制台 - 知识树管理 - - - - - - - - - -
- - - -
-
-
-

问题知识点管理

-
-
-
-
-
- -
-
- - -
-
- -
标签列表
-
- - - - - - - - - -
- - - - - - - - - - - -
编号标签名描述操作
-
-
-
- -
-
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/layout/sidebar.html b/back_end/application/panel/view/layout/sidebar.html deleted file mode 100644 index 8d8940295..000000000 --- a/back_end/application/panel/view/layout/sidebar.html +++ /dev/null @@ -1,34 +0,0 @@ - \ No newline at end of file diff --git a/back_end/application/panel/view/layout/toolbar.html b/back_end/application/panel/view/layout/toolbar.html deleted file mode 100644 index 46ff8f3ce..000000000 --- a/back_end/application/panel/view/layout/toolbar.html +++ /dev/null @@ -1,13 +0,0 @@ - - diff --git a/back_end/application/panel/view/notification/add.html b/back_end/application/panel/view/notification/add.html deleted file mode 100644 index 40da5548f..000000000 --- a/back_end/application/panel/view/notification/add.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - 控制台 - 公告列表 - 添加公告 - - - - - - - - - - - - - - - - - - - - - -
- - - - -
-
-
-

添加公告

-
-
-
-
-
-
公告设置
-
-
-
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
-
- -
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/notification/index.html b/back_end/application/panel/view/notification/index.html deleted file mode 100644 index edac1f92e..000000000 --- a/back_end/application/panel/view/notification/index.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - - 控制台 - 公告列表 - - - - - - - - - -
- - - -
-
-
-

公告列表

-
-
-
-
-
-
公告列表
-
- - - - - - - -
- -
-
- - - - - - - - - - - - - - -
编号标题内容比赛编号用户编号操作状态
-
-
-
-
-
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/notification/info.html b/back_end/application/panel/view/notification/info.html deleted file mode 100644 index 9be1ba95d..000000000 --- a/back_end/application/panel/view/notification/info.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - 控制台 - 通知管理 - 编辑通知 - - - - - - - - - - - - - - - - - - - - - -
- - - - -
-
-
-

编辑通知

-
-
-
-
-
-
编辑通知
-
-
-
- -
-
- -
-
- - -
-
- - -
-
- - -
-
-
- -
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/problem/add.html b/back_end/application/panel/view/problem/add.html deleted file mode 100644 index 52860e0db..000000000 --- a/back_end/application/panel/view/problem/add.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - - 控制台 - 题目内容 - 添加题目 - - - - - - - - - - - - - - - - - - - - - -
- - - - -
-
-
-

添加题目

-
-
-
-
-
-
基本设置
-
-
-
- -
-
- - -

请输入题目的标题。

-
-
- -
-

请输入文章的标题。

-
-
- -
-

请输入题目的描述。

-
-
- -
-

请输入题目的输入格式。

-
-
- -
-

请输入题目的输出格式。

-
-
- -
- -
-

请输入题目的样例输入。

-
-
- -
- -
-

请输入题目的样例输出。

-
-
- -
-

请输入题目的提示。

-
-
- - -

请输入题目的来源。

-
-
- -
- -
-
- -
-
-
- -
-
-
- -
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/problem/data.html b/back_end/application/panel/view/problem/data.html deleted file mode 100644 index f2cb65d34..000000000 --- a/back_end/application/panel/view/problem/data.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - - 控制台 - 题目内容 - 添加题目数据 - - - - - - - - - - - - - - - - - - -
- - - - -
-
-
-

添加题目数据

-
-
-
-
-
-
数据设置
-
-
-
- -
-
- -
-
- - - . - - s -
-
-
-
- - MB -
-
- -
-
- - -
-
-
- -
-
- -
-
- -
- -
-
- - - -
-
- -
-
-
-
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/problem/index.html b/back_end/application/panel/view/problem/index.html deleted file mode 100644 index c21d7bcb8..000000000 --- a/back_end/application/panel/view/problem/index.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - - 控制台 - 题目列表 - - - - - - - - - -
- - - -
-
-
-

题目列表

-
-
-
-
-
-
题目列表
-
- - - - - - - -
- -
-
- - - - - - - - - - - - - - -
编号标题题目所属通过数状态操作知识点
-
-
-
-
-
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/problem/info.html b/back_end/application/panel/view/problem/info.html deleted file mode 100644 index 2cd9500b1..000000000 --- a/back_end/application/panel/view/problem/info.html +++ /dev/null @@ -1,275 +0,0 @@ - - - - - 控制台 - 题目内容 - 编辑题目 - - - - - - - - - - - - - - - - - - - - - -
- - - - -
-
-
-

编辑题目

-
-
-
-
-
-
基本设置
-
-
-
- -
-
- -
-
- - -

请输入题目的标题。

-
-
- -
-

请输入文章的标题。

-
-
- -
-

请输入题目的描述。

-
-
- -
-

请输入题目的输入格式。

-
-
- -
-

请输入题目的输出格式。

-
-
- -
- -
-

请输入题目的样例输入。

-
-
- -
- -
-

请输入题目的样例输出。

-
-
- -
-

请输入题目的提示。

-
-
- - -

请输入题目的来源。

-
-
- -
- -
-
- -
-
-
-
- -
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/role/auth.html b/back_end/application/panel/view/role/auth.html deleted file mode 100644 index 9cd5109bd..000000000 --- a/back_end/application/panel/view/role/auth.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - - - - 控制台 - 权限管理 - - - - - - - - - -
- - - -
-
-
-

权限管理

-
-
-
-
-
- -
-
- - -
-
- - -
权限列表
-
- - - - - - - - - -
- - - - - - - - - - - -
编号权限状态操作
-
-
-
- -
-
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/role/edit.html b/back_end/application/panel/view/role/edit.html deleted file mode 100644 index 086038986..000000000 --- a/back_end/application/panel/view/role/edit.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - - 控制台 - 权限管理 - - - - - - - - - -
- - - -
-
-
-

权限管理

-
-
-
-
-
-
权限组管理
-
-
- -
- -
- - - -
- {foreach $auth as $key=>$value} - {if !empty($value.name)} - - {/if} - {/foreach} -
- - - -
- - -
-
- -
-
-
-
-
-
- - - - - - - - - - - diff --git a/back_end/application/panel/view/role/index.html b/back_end/application/panel/view/role/index.html deleted file mode 100644 index e8ba72907..000000000 --- a/back_end/application/panel/view/role/index.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - - 控制台 - 权限管理 - - - - - - - - - -
- - - -
-
-
-

权限管理

-
-
-
-
-
- -
-
- - -
-
- -
权限组列表
-
- - - - - - - - - -
- - - - - - - - - - - - - -
编号用户组名称权限状态拥有用户数操作
-
-
-
- -
-
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/submit/index.html b/back_end/application/panel/view/submit/index.html deleted file mode 100644 index 10f2b56b3..000000000 --- a/back_end/application/panel/view/submit/index.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - 控制台 - 提交列表 - - - - - - - - - -
- - - -
-
-
-

提交列表

-
-
-
-
-
-
提交列表
-
- - - -
- -
-
- - - - - - - - - - - - - - - - - -
提交编号用户id用户昵称题目编号语言状态用时内存提交时间状态
-
-
-
-
-
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/submit/info.html b/back_end/application/panel/view/submit/info.html deleted file mode 100644 index 6e548bdd7..000000000 --- a/back_end/application/panel/view/submit/info.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - 控制台 - 提交详情 - - - - - - - - - - - - - - - - -
- - - - -
-
-
-

提交详情

-
-
-
-
-
-
基本设置
-
-
-
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
- -
-
-
-
-
-
-
-
-
- - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/submit/pending.html b/back_end/application/panel/view/submit/pending.html deleted file mode 100644 index d0aabb516..000000000 --- a/back_end/application/panel/view/submit/pending.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - 控制台 - 提交 - 批量重测 - - - - - - - - - - - - - - - - - - -
- - - - -
-
-
-

批量重测

-
-
-
-
-
-
数据设置
-
-
-
- -
-
- -
-
- - -
-
-
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- -
- -
- - -
-
- -
-
-
-
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/tag/index.html b/back_end/application/panel/view/tag/index.html deleted file mode 100644 index 26ecbc418..000000000 --- a/back_end/application/panel/view/tag/index.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - - - 控制台 - 题目标签 - - - - - - - - - -
- - - -
-
-
-

题目标签

-
-
-
-
-
-
题目标签
-
-
- - -
-
- - -

示例:#FFFFFF可不填

-
-
- - -
-
- -
-
- - - - - - - - - - - - - -
编号标签名描述是否显示颜色操作
-
-
-
-
-
-
-
- - - - - - - - - - diff --git a/back_end/application/panel/view/tag/info.html b/back_end/application/panel/view/tag/info.html deleted file mode 100644 index 3062bd0b1..000000000 --- a/back_end/application/panel/view/tag/info.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - 控制台 - 比赛内容 - 编辑比赛 - - - - - - - - - - - - - - - - -
- - - - -
-
-
-

编辑比赛

-
-
-
-
-
-
基本设置
-
-
-
- -
-
- -
-
- - -

请输入标签的名称。

-
-
- - -

请输入标签的颜色(示例:#FFFFFF可不填)。

-
-
- - -

请输入标签的描述。

-
-
-
- -
-
-
-
-
-
-
-
-
- - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/user/add.html b/back_end/application/panel/view/user/add.html deleted file mode 100644 index bb6694afa..000000000 --- a/back_end/application/panel/view/user/add.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - 控制台 - 用户 - 添加用户 - - - - - - - - - - - - - - - - -
- - - - -
-
-
-

添加用户

-
-
-
-
-
-
基本设置
-
-
-
- -
-
- - -

请输入用户的昵称。

-
-
- - -

请输入用户的昵称。

-
-
- - -

请输入用户的真实姓名。

-
-
- - -

请输入用户的学校。

-
-
- - -

请输入用户的专业。

-
-
- - -

请输入用户的班级。

-
-
- - -

请输入用户的身份。

-
-
- - -

请输入用户的联系方式。

-
-
- - -

请输入用户的个人描述。

-
-
- - -

请输入用户的邮箱。

-
-
- - -

请输入用户的状态。

-
-
-
- -
-
-
-
-
-
-
-
-
- - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/user/index.html b/back_end/application/panel/view/user/index.html deleted file mode 100644 index 8aa2171c8..000000000 --- a/back_end/application/panel/view/user/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - 控制台 - 用户列表 - - - - - - - - - -
- - - -
-
-
-

用户列表

-
-
-
-
-
-
用户列表
-
- -
- -
-
- - - - - - - - - - - - - - - - -
编号昵称姓名学校专业班级身份状态操作
-
-
-
-
-
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/user/info.html b/back_end/application/panel/view/user/info.html deleted file mode 100644 index 3bfb7ed97..000000000 --- a/back_end/application/panel/view/user/info.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - - 控制台 - 用户 - 编辑用户 - - - - - - - - - - - - - - - - -
- - - - -
-
-
-

编辑用户

-
-
-
-
-
-
基本设置
-
-
-
- -
-
- -
-
- - -

请输入用户的昵称。

-
-
- - -

请输入用户的真实姓名。

-
-
- - -

请输入用户的学校。

-
-
- - -

请输入用户的专业。

-
-
- - -

请输入用户的班级。

-
-
- - -

请输入用户的身份。

-
-
- - -

请输入用户的联系方式。

-
-
- - -

请输入用户的个人描述。

-
-
- - -

请输入用户的邮箱。

-
-
- - -

请输入用户的状态。

-
-
-
- -
-
-
-
-
-
-
-
-
- - - - - - - \ No newline at end of file diff --git a/back_end/application/panel/view/user/mine.html b/back_end/application/panel/view/user/mine.html deleted file mode 100644 index ea716a966..000000000 --- a/back_end/application/panel/view/user/mine.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - 控制台 - 用户管理 - 个人信息 - - - - - - - - - - - - -
- - - - -
-
-
-

个人信息

-
-
-
-
-
-
个人信息
-
-
-
-
-
- -
-
-
- - {if isset($rel)}{$rel.realname}{/if} -
-
-
-
-
- - {if isset($rel)}{$rel.role}{/if} -
-
-
-
-
- - {if isset($rel)}{$rel.session}{/if} -
-
-
-
-
- - {if isset($rel)}{$rel.position}{/if} -
-
-
-
-
- - {if isset($rel)}{$rel.sex}{/if} -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
-
- - -
-
-
-
-
- - -
-
-
-
- -
-
-
-
-
-
-
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/back_end/application/tags.php b/back_end/application/tags.php deleted file mode 100644 index 4b18d1050..000000000 --- a/back_end/application/tags.php +++ /dev/null @@ -1,28 +0,0 @@ - -// +---------------------------------------------------------------------- - -// 应用行为扩展定义文件 -return [ - // 应用初始化 - 'app_init' => [], - // 应用开始 - 'app_begin' => [], - // 模块初始化 - 'module_init' => [], - // 操作开始执行 - 'action_begin' => [], - // 视图内容过滤 - 'view_filter' => [], - // 日志写入 - 'log_write' => [], - // 应用结束 - 'app_end' => [], -]; diff --git a/back_end/build.php b/back_end/build.php deleted file mode 100644 index 34ba3c840..000000000 --- a/back_end/build.php +++ /dev/null @@ -1,26 +0,0 @@ - -// +---------------------------------------------------------------------- - -return [ - // 生成应用公共文件 - '__file__' => ['common.php'], - - // 定义demo模块的自动生成 (按照实际定义的文件名生成) - 'demo' => [ - '__file__' => ['common.php'], - '__dir__' => ['behavior', 'controller', 'model', 'view'], - 'controller' => ['Index', 'Test', 'UserType'], - 'model' => ['User', 'UserType'], - 'view' => ['index/index'], - ], - - // 其他更多的模块定义 -]; diff --git a/back_end/composer.json b/back_end/composer.json deleted file mode 100644 index e52962625..000000000 --- a/back_end/composer.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "topthink/think", - "description": "the new thinkphp framework", - "type": "project", - "keywords": [ - "framework", - "thinkphp", - "ORM" - ], - "homepage": "http://thinkphp.cn/", - "license": "Apache-2.0", - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - } - ], - "require": { - "php": ">=5.6.0", - "topthink/framework": "5.1.39", - "phpmailer/phpmailer": "~6.1", - "topthink/think-captcha": "2.0.x-dev", - "topthink/think-installer": "2.0.x-dev", - "ext-json": "*", - "phpoffice/phpexcel": "^1.8", - "yosymfony/toml": "^1.0" - }, - "autoload": { - "psr-4": { - "app\\": "application" - } - }, - "extra": { - "think-path": "thinkphp" - }, - "config": { - "preferred-install": "dist" - } -} diff --git a/back_end/composer.lock b/back_end/composer.lock deleted file mode 100644 index 00449d104..000000000 --- a/back_end/composer.lock +++ /dev/null @@ -1,382 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "2ed4f11f0cb237624fac278accdd3b4c", - "packages": [ - { - "name": "phpmailer/phpmailer", - "version": "v6.1.7", - "source": { - "type": "git", - "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0", - "reference": "2c2370ba3df7034f9eb7b8f387c97b52b2ba5ad0", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "ext-filter": "*", - "php": ">=5.5.0" - }, - "require-dev": { - "doctrine/annotations": "^1.2", - "friendsofphp/php-cs-fixer": "^2.2", - "phpunit/phpunit": "^4.8 || ^5.7" - }, - "suggest": { - "ext-mbstring": "Needed to send email in multibyte encoding charset", - "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", - "league/oauth2-google": "Needed for Google XOAUTH2 authentication", - "psr/log": "For optional PSR-3 debug logging", - "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", - "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" - }, - "type": "library", - "autoload": { - "psr-4": { - "PHPMailer\\PHPMailer\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1-only" - ], - "authors": [ - { - "name": "Marcus Bointon", - "email": "phpmailer@synchromedia.co.uk" - }, - { - "name": "Jim Jagielski", - "email": "jimjag@gmail.com" - }, - { - "name": "Andy Prevost", - "email": "codeworxtech@users.sourceforge.net" - }, - { - "name": "Brent R. Matzelle" - } - ], - "description": "PHPMailer is a full-featured email creation and transfer class for PHP", - "time": "2020-07-14T18:50:27+00:00" - }, - { - "name": "phpoffice/phpexcel", - "version": "1.8.2", - "source": { - "type": "git", - "url": "https://github.com/PHPOffice/PHPExcel.git", - "reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870", - "reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "php": "^5.2|^7.0" - }, - "require-dev": { - "squizlabs/php_codesniffer": "2.*" - }, - "type": "library", - "autoload": { - "psr-0": { - "PHPExcel": "Classes/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1" - ], - "authors": [ - { - "name": "Maarten Balliauw", - "homepage": "http://blog.maartenballiauw.be" - }, - { - "name": "Erik Tilt" - }, - { - "name": "Franck Lefevre", - "homepage": "http://rootslabs.net" - }, - { - "name": "Mark Baker", - "homepage": "http://markbakeruk.net" - } - ], - "description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", - "homepage": "https://github.com/PHPOffice/PHPExcel", - "keywords": [ - "OpenXML", - "excel", - "php", - "spreadsheet", - "xls", - "xlsx" - ], - "abandoned": "phpoffice/phpspreadsheet", - "time": "2018-11-22T23:07:24+00:00" - }, - { - "name": "topthink/framework", - "version": "v5.1.39", - "source": { - "type": "git", - "url": "https://github.com/top-think/framework.git", - "reference": "5762858f3d58faafb3a39427f8788884b2927007" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/5762858f3d58faafb3a39427f8788884b2927007", - "reference": "5762858f3d58faafb3a39427f8788884b2927007", - "shasum": "" - }, - "require": { - "php": ">=5.6.0", - "topthink/think-installer": "2.*" - }, - "require-dev": { - "johnkary/phpunit-speedtrap": "^1.0", - "mikey179/vfsstream": "~1.6", - "phpdocumentor/reflection-docblock": "^2.0", - "phploc/phploc": "2.*", - "phpunit/phpunit": "^5.0|^6.0", - "sebastian/phpcpd": "2.*", - "squizlabs/php_codesniffer": "2.*" - }, - "type": "think-framework", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - }, - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "the new thinkphp framework", - "homepage": "http://thinkphp.cn/", - "keywords": [ - "framework", - "orm", - "thinkphp" - ], - "time": "2019-11-17T23:22:02+00:00" - }, - { - "name": "topthink/think-captcha", - "version": "2.0.x-dev", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-captcha.git", - "reference": "54c8a51552f99ff9ea89ea9c272383a8f738ceee" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-captcha/zipball/54c8a51552f99ff9ea89ea9c272383a8f738ceee", - "reference": "54c8a51552f99ff9ea89ea9c272383a8f738ceee", - "shasum": "" - }, - "require": { - "topthink/framework": "5.1.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "think\\captcha\\": "src/" - }, - "files": [ - "src/helper.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "captcha package for thinkphp5", - "time": "2017-12-31T16:37:49+00:00" - }, - { - "name": "topthink/think-installer", - "version": "2.0.x-dev", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-installer.git", - "reference": "f5400a12c60e513911aef41fe443fa6920952675" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-installer/zipball/f5400a12c60e513911aef41fe443fa6920952675", - "reference": "f5400a12c60e513911aef41fe443fa6920952675", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0" - }, - "require-dev": { - "composer/composer": "1.0.*@dev" - }, - "type": "composer-plugin", - "extra": { - "class": "think\\composer\\Plugin" - }, - "autoload": { - "psr-4": { - "think\\composer\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "time": "2018-05-11T06:45:42+00:00" - }, - { - "name": "yosymfony/parser-utils", - "version": "v2.0.0", - "source": { - "type": "git", - "url": "https://github.com/yosymfony/parser-utils.git", - "reference": "00bec9a12722b21f2baf7f9db35f127e90c162c9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/yosymfony/parser-utils/zipball/00bec9a12722b21f2baf7f9db35f127e90c162c9", - "reference": "00bec9a12722b21f2baf7f9db35f127e90c162c9", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-4": { - "Yosymfony\\ParserUtils\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Victor Puertas", - "email": "vpgugr@gmail.com", - "homepage": "http://yosymfony.com" - } - ], - "description": "Parser utilities", - "homepage": "http://github.com/yosymfony/toml", - "keywords": [ - "lexer", - "parser" - ], - "time": "2018-06-29T15:31:11+00:00" - }, - { - "name": "yosymfony/toml", - "version": "v1.0.4", - "source": { - "type": "git", - "url": "https://github.com/yosymfony/toml.git", - "reference": "bdab92ad920d0e36810a3a3e4a998d23f3498f8e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/yosymfony/toml/zipball/bdab92ad920d0e36810a3a3e4a998d23f3498f8e", - "reference": "bdab92ad920d0e36810a3a3e4a998d23f3498f8e", - "shasum": "" - }, - "require": { - "php": ">=7.1", - "yosymfony/parser-utils": "^2.0" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-4": { - "Yosymfony\\Toml\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Victor Puertas", - "email": "vpgugr@gmail.com", - "homepage": "http://yosymfony.com" - } - ], - "description": "A PHP parser for TOML compatible with specification 0.4.0", - "homepage": "http://github.com/yosymfony/toml", - "keywords": [ - "mojombo", - "parser", - "toml" - ], - "time": "2018-08-08T15:08:14+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": { - "topthink/think-captcha": 20, - "topthink/think-installer": 20 - }, - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.6.0", - "ext-json": "*" - }, - "platform-dev": [] -} diff --git a/back_end/config/app.php b/back_end/config/app.php deleted file mode 100644 index f8e1c7a9c..000000000 --- a/back_end/config/app.php +++ /dev/null @@ -1,140 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 应用设置 -// +---------------------------------------------------------------------- - -return [ - // 应用名称 - 'app_name' => '', - // 应用地址 - 'app_host' => '', - // 应用调试模式 - 'app_debug' => true, - // 应用Trace - 'app_trace' => false, - // 是否支持多模块 - 'app_multi_module' => true, - // 入口自动绑定模块 - 'auto_bind_module' => false, - // 注册的根命名空间 - 'root_namespace' => [], - // 默认输出类型 - 'default_return_type' => 'html', - // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', - // 默认JSONP格式返回的处理方法 - 'default_jsonp_handler' => 'jsonpReturn', - // 默认JSONP处理方法 - 'var_jsonp_handler' => 'callback', - // 默认时区 - 'default_timezone' => 'Asia/Shanghai', - // 是否开启多语言 - 'lang_switch_on' => false, - // 默认全局过滤方法 用逗号分隔多个 - 'default_filter' => '', - // 默认语言 - 'default_lang' => 'zh-cn', - // 应用类库后缀 - 'class_suffix' => false, - // 控制器类后缀 - 'controller_suffix' => false, - - // +---------------------------------------------------------------------- - // | 模块设置 - // +---------------------------------------------------------------------- - - // 默认模块名 - 'default_module' => 'index', - // 禁止访问模块 - 'deny_module_list' => ['common'], - // 默认控制器名 - 'default_controller' => 'Index', - // 默认操作名 - 'default_action' => 'index', - // 默认验证器 - 'default_validate' => '', - // 默认的空模块名 - 'empty_module' => '', - // 默认的空控制器名 - 'empty_controller' => 'Error', - // 操作方法前缀 - 'use_action_prefix' => false, - // 操作方法后缀 - 'action_suffix' => '', - // 自动搜索控制器 - 'controller_auto_search' => false, - - // +---------------------------------------------------------------------- - // | URL设置 - // +---------------------------------------------------------------------- - - // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', - // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], - // pathinfo分隔符 - 'pathinfo_depr' => '/', - // HTTPS代理标识 - 'https_agent_name' => '', - // IP代理获取标识 - 'http_agent_ip' => 'X-REAL-IP', - // URL伪静态后缀 - 'url_html_suffix' => 'html', - // URL普通方式参数 用于自动生成 - 'url_common_param' => false, - // URL参数方式 0 按名称成对解析 1 按顺序解析 - 'url_param_type' => 0, - // 是否开启路由延迟解析 - 'url_lazy_route' => false, - // 是否强制使用路由 - 'url_route_must' => false, - // 合并路由规则 - 'route_rule_merge' => false, - // 路由是否完全匹配 - 'route_complete_match' => false, - // 使用注解路由 - 'route_annotation' => false, - // 域名根,如thinkphp.cn - 'url_domain_root' => '', - // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, - // 默认的访问控制器层 - 'url_controller_layer' => 'controller', - // 表单请求类型伪装变量 - 'var_method' => '_method', - // 表单ajax伪装变量 - 'var_ajax' => '_ajax', - // 表单pjax伪装变量 - 'var_pjax' => '_pjax', - // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, - // 请求缓存有效期 - 'request_cache_expire' => null, - // 全局请求缓存排除规则 - 'request_cache_except' => [], - - // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - 'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl', - - // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', - - // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', - // 显示错误信息 - 'show_error_msg' => false, - // 异常处理handle类 留空使用 \think\exception\Handle - 'exception_handle' => '', - -]; diff --git a/back_end/config/cache.php b/back_end/config/cache.php deleted file mode 100644 index 4579e217d..000000000 --- a/back_end/config/cache.php +++ /dev/null @@ -1,37 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 缓存设置 -// +---------------------------------------------------------------------- - -return [ - // 缓存配置为复合类型 - 'type' => 'complex', - 'default' => [ - 'type' => 'file', - // 全局缓存有效期(0为永久有效) - 'expire'=> 5, - // 缓存前缀 - 'prefix'=> 'think', - // 缓存目录 - 'path' => '../runtime/cache/', - ], - 'redis' => [ - 'type' => 'redis', - 'host' => '172.17.0.1', - // 全局缓存有效期(0为永久有效) - 'expire'=> 5, - // 缓存前缀 - 'prefix'=> 'think', - ], - // 添加更多的缓存类型设置 -]; diff --git a/back_end/config/captcha.php b/back_end/config/captcha.php deleted file mode 100644 index 1e16a092e..000000000 --- a/back_end/config/captcha.php +++ /dev/null @@ -1,5 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 控制台配置 -// +---------------------------------------------------------------------- -return [ - 'name' => 'Think Console', - 'version' => '0.1', - 'user' => null, -]; diff --git a/back_end/config/cookie.php b/back_end/config/cookie.php deleted file mode 100644 index 1de07082a..000000000 --- a/back_end/config/cookie.php +++ /dev/null @@ -1,30 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | Cookie设置 -// +---------------------------------------------------------------------- -return [ - // cookie 名称前缀 - 'prefix' => '', - // cookie 保存时间 - 'expire' => 0, - // cookie 保存路径 - 'path' => '/', - // cookie 有效域名 - 'domain' => '', - // cookie 启用安全传输 - 'secure' => false, - // httponly设置 - 'httponly' => '', - // 是否使用 setcookie - 'setcookie' => true, -]; diff --git a/back_end/config/database.php b/back_end/config/database.php deleted file mode 100644 index d14b95242..000000000 --- a/back_end/config/database.php +++ /dev/null @@ -1,63 +0,0 @@ - -// +---------------------------------------------------------------------- - -return [ - // 数据库类型 - 'type' => 'mysql', - // 服务器地址 - 'hostname' => '127.0.0.1', - // 数据库名 - 'database' => '', - // 用户名 - 'username' => 'root', - // 密码 - 'password' => '', - // 端口 - 'hostport' => '', - // 连接dsn - 'dsn' => '', - // 数据库连接参数 - 'params' => [], - // 数据库编码默认采用utf8 - 'charset' => 'utf8', - // 数据库表前缀 - 'prefix' => '', - // 数据库调试模式 - 'debug' => true, - // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, - // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, - // 读写分离后 主服务器数量 - 'master_num' => 1, - // 指定从服务器序号 - 'slave_no' => '', - // 自动读取主库数据 - 'read_master' => false, - // 是否严格检查字段是否存在 - 'fields_strict' => true, - // 数据集返回类型 - 'resultset_type' => 'array', - // 自动写入时间戳字段 - 'auto_timestamp' => false, - // 时间字段取出后的默认时间格式 - 'datetime_format' => 'Y-m-d H:i:s', - // 是否需要进行SQL性能分析 - 'sql_explain' => false, - // Builder类 - 'builder' => '', - // Query类 - 'query' => '\\think\\db\\Query', - // 是否需要断线重连 - 'break_reconnect' => false, - // 断线标识字符串 - 'break_match_str' => [], -]; diff --git a/back_end/config/log.php b/back_end/config/log.php deleted file mode 100644 index b3d87b4a9..000000000 --- a/back_end/config/log.php +++ /dev/null @@ -1,30 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 日志设置 -// +---------------------------------------------------------------------- -return [ - // 日志记录方式,内置 file socket 支持扩展 - 'type' => 'File', - // 日志保存目录 - 'path' => '', - // 日志记录级别 - 'level' => [], - // 单文件日志写入 - 'single' => false, - // 独立日志级别 - 'apart_level' => [], - // 最大日志文件数量 - 'max_files' => 0, - // 是否关闭日志写入 - 'close' => false, -]; diff --git a/back_end/config/mail.php b/back_end/config/mail.php deleted file mode 100644 index 7c470b563..000000000 --- a/back_end/config/mail.php +++ /dev/null @@ -1,23 +0,0 @@ - 'utf-8', // 邮件编码 - 'smtp_debug' => 0, // Debug模式。0: 关闭,1: 客户端消息,2: 客户端和服务器消息,3: 2和连接状态,4: 更详细 - 'debug_output' => 'html', // Debug输出类型。`echo`(默认),`html`,或`error_log` - 'host' => 'smtp.163.com', // SMTP服务器地址 - 'port' => 465, // 端口号。默认25 - 'smtp_auth' => true, // 启用SMTP认证 - 'smtp_secure' => 'ssl', // 启用安全协议。''(默认),'ssl'或'tls',留空不启用 - 'username' => 'acmwut@163.com', // SMTP登录邮箱 - 'password' => 'acmwut123', // SMTP登录密码。qq邮箱使用客户端授权码,QQ邮箱用独立密码 - 'from' => 'acmwut@163.com', // 发件人邮箱 - 'from_name' => '武汉理工大学ACM协会', // 发件人名称 - 'reply_to' => '', // 回复邮箱的地址。留空取发件人邮箱 - 'reply_to_name' => '', // 回复邮箱人名称。留空取发件人名称 -]; - - diff --git a/back_end/config/session.php b/back_end/config/session.php deleted file mode 100644 index 1d7b6c60f..000000000 --- a/back_end/config/session.php +++ /dev/null @@ -1,26 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 会话设置 -// +---------------------------------------------------------------------- - -return [ - 'id' => '', - // SESSION_ID的提交变量,解决flash上传跨域 - 'var_session_id' => '', - // SESSION 前缀 - 'prefix' => 'think', - // 驱动方式 支持redis memcache memcached - 'type' => '', - // 是否自动开启 SESSION - 'auto_start' => true, -]; diff --git a/back_end/config/template.php b/back_end/config/template.php deleted file mode 100644 index 4b07e0dd9..000000000 --- a/back_end/config/template.php +++ /dev/null @@ -1,43 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 模板设置 -// +---------------------------------------------------------------------- - -return [ - // 模板引擎类型 支持 php think 支持扩展 - 'type' => 'Think', - // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 - 'auto_rule' => 1, - // 模板路径 - 'view_path' => '', - // 模板后缀 - 'view_suffix' => 'html', - // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, - // 模板引擎普通标签开始标记 - 'tpl_begin' => '{', - // 模板引擎普通标签结束标记 - 'tpl_end' => '}', - // 标签库标签开始标记 - 'taglib_begin' => '{', - // 标签库标签结束标记 - 'taglib_end' => '}', - - 'tpl_replace_string' => [ - '__CSS__' => '/OnlineJudge/back_end/public/static/css', - '__FONT__' => '/OnlineJudge/back_end/public/static/fonts', - '__JS__' => '/OnlineJudge/back_end/public/static/js', - '__IMG__' => '/OnlineJudge/back_end/public/static/images', - '__DT__' => '/OnlineJudge/back_end/public/static/datatable', - ] -]; diff --git a/back_end/config/trace.php b/back_end/config/trace.php deleted file mode 100644 index 425d30148..000000000 --- a/back_end/config/trace.php +++ /dev/null @@ -1,18 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | Trace设置 开启 app_trace 后 有效 -// +---------------------------------------------------------------------- -return [ - // 内置Html Console 支持扩展 - 'type' => 'Html', -]; diff --git a/back_end/config/wutoj_cache.php b/back_end/config/wutoj_cache.php deleted file mode 100644 index 6a77113b2..000000000 --- a/back_end/config/wutoj_cache.php +++ /dev/null @@ -1,7 +0,0 @@ - 5, // 排行榜储存时间 - 'host' => 'localhost', - 'port' => '6379', -]; \ No newline at end of file diff --git a/back_end/config/wutoj_config.php b/back_end/config/wutoj_config.php deleted file mode 100644 index dc6004a91..000000000 --- a/back_end/config/wutoj_config.php +++ /dev/null @@ -1,26 +0,0 @@ - 5, // 排行榜储存时间 - 'host' => 'localhost', - 'port' => '6379', - 'user_rank_cache' => 'user_rank_cache', - 'environment' => 'master', - /* 提交 */ - 'submit_url' => [ - 'http://10.143.216.128:8819/submit' - ], - /* 交题时间间隔 */ - 'interval_time' => 5, - /* 支持语言 */ - 'language' => [ - 'c.gcc', - 'cpp.g++', - 'java.openjdk10', - 'python.cpython3.6' - ], - /* 每面数量 */ - 'page_limit' => 20, - /* oj 链接 */ - 'oj_url' => 'http://acmwhut.com', -]; diff --git a/back_end/extend/.gitignore b/back_end/extend/.gitignore deleted file mode 100644 index b722e9e13..000000000 --- a/back_end/extend/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!.gitignore \ No newline at end of file diff --git a/back_end/extend/custom/Mailer.php b/back_end/extend/custom/Mailer.php deleted file mode 100644 index bce109a86..000000000 --- a/back_end/extend/custom/Mailer.php +++ /dev/null @@ -1,56 +0,0 @@ -CharSet = config('mail.charset'); // 邮件编码设置 - $this->isSMTP(); // 启用SMTP服务 - $this->SMTPDebug = config('mail.smtp_debug'); // Debug模式级别 - $this->Debugoutput = config('mail.debug_output'); // Debug输出类型 - $this->Host = config('mail.host'); // SMTP服务器地址 - $this->Port = config('mail.port'); // 端口号 - $this->SMTPAuth = config('mail.smtp_auth'); // SMTP登录认证 - $this->SMTPSecure = config('mail.smtp_secure'); // SMTP安全协议 - $this->Username = config('mail.username'); // SMTP登录邮箱 - $this->Password = config('mail.password'); // SMTP登录密码 - $this->setFrom(config('mail.from'), config('mail.from_name')); // 发件人邮箱和名称 - $this->addReplyTo(config('mail.reply_to'), config('mail.reply_to_name')); // 回复邮箱和名称 - } - /** - * 发送邮件 - * @param [type] $toMail 收件人地址 - * @param [type] $toName 收件人名称 - * @param [type] $subject 邮件主题 - * @param [type] $content 邮件内容,支持html - * @param [type] $attachment 附件列表。文件路径或路径数组 - * @return [type] 成功返回true,失败返回错误消息 - */ - - public function sendMail($toMail, $toName, $subject, $content, $attachment = null){ - $this->addAddress($toMail, $toName); - $this->Subject = $subject; - $this->msgHTML($content); - - if($attachment) { // 添加附件 - if(is_string($attachment)){ - is_file($attachment) && $this->AddAttachment($attachment); - }else if(is_array($attachment)){ - foreach ($attachment as $file) { - is_file($file) && $this->AddAttachment($file); - } - } - } - if(!$this->send()){ // 发送 - return $this->ErrorInfo; - }else{ - return true; - } - } -} - diff --git a/back_end/openjudge_db.sql b/back_end/openjudge_db.sql deleted file mode 100644 index 986e9f540..000000000 --- a/back_end/openjudge_db.sql +++ /dev/null @@ -1,211 +0,0 @@ --- phpMyAdmin SQL Dump --- version 4.7.3 --- https://www.phpmyadmin.net/ --- --- Host: localhost:8889 --- Generation Time: 2018-08-16 18:37:41 --- 服务器版本: 5.6.35 --- PHP Version: 7.1.8 - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+00:00"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; - --- --- Database: `openjudge_db` --- -CREATE DATABASE IF NOT EXISTS `openjudge_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; -USE `openjudge_db`; - --- -------------------------------------------------------- - --- --- 表的结构 `contest` --- - -CREATE TABLE `contest` ( - `contestId` int(11) NOT NULL, - `contestName` varchar(1024) NOT NULL, - `contestProblem` varchar(1024) NOT NULL, - `contestStartTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `contestEndTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- 表的结构 `notice` --- - -CREATE TABLE `notice` ( - `noticeId` int(11) NOT NULL, - `title` varchar(2000) NOT NULL, - `href` varchar(2000) DEFAULT '#', - `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `user` int(11) NOT NULL, - `status` int(2) NOT NULL DEFAULT '0' -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- 转存表中的数据 `notice` --- - -INSERT INTO `notice` (`noticeId`, `title`, `href`, `time`, `user`, `status`) VALUES -(1, 'test', '#', '2018-08-16 16:30:01', 1, 0), -(2, '欢迎加入武汉理工大学计算机学院ACM协会', '#', '2018-08-16 16:30:01', 1, 1), -(3, '武汉理工大学计算机学院ACM协会首届招新赛报名即将开始', '#', '2018-08-16 16:30:01', 1, 1); - --- -------------------------------------------------------- - --- --- 表的结构 `problem` --- - -CREATE TABLE `problem` ( - `problemId` int(11) NOT NULL, - `problemNo` int(6) NOT NULL, - `problemTitle` varchar(300) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- 表的结构 `sign` --- - -CREATE TABLE `sign` ( - `id` int(11) NOT NULL, - `name` varchar(20) NOT NULL, - `sex` varchar(10) NOT NULL, - `cardNo` varchar(10) NOT NULL, - `class` varchar(30) NOT NULL, - `qq` varchar(30) NOT NULL, - `tel` varchar(30) NOT NULL, - `dorm` varchar(30) NOT NULL, - `content` text NOT NULL, - `status` int(2) NOT NULL, - `create_time` datetime NOT NULL, - `update_time` datetime NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- 表的结构 `team` --- - -CREATE TABLE `team` ( - `teamId` int(11) NOT NULL, - `teamCNnick` varchar(1024) NOT NULL, - `teamENnick` varchar(1024) NOT NULL, - `teamPasswd` varchar(45) NOT NULL, - `teamMail` varchar(100) NOT NULL, - `teamPhone` varchar(12) NOT NULL, - `teamPlays` varchar(1024) NOT NULL, - `isOnsite` int(1) NOT NULL DEFAULT '1' -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- 表的结构 `user` --- - -CREATE TABLE `user` ( - `userId` int(11) NOT NULL, - `userType` int(1) NOT NULL DEFAULT '0', - `userStat` int(1) NOT NULL DEFAULT '1', - `userMail` varchar(100) DEFAULT NULL, - `userPasswd` varchar(24) NOT NULL, - `userNick` varchar(45) NOT NULL, - `userName` varchar(45) NOT NULL, - `userGender` int(1) NOT NULL, - `userPhone` varchar(12) DEFAULT NULL, - `userAlias` varchar(1024) DEFAULT NULL, - `joinTime` timestamp NULL DEFAULT NULL, - `exitTime` timestamp NULL DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Indexes for dumped tables --- - --- --- Indexes for table `contest` --- -ALTER TABLE `contest` - ADD PRIMARY KEY (`contestId`); - --- --- Indexes for table `notice` --- -ALTER TABLE `notice` - ADD PRIMARY KEY (`noticeId`); - --- --- Indexes for table `problem` --- -ALTER TABLE `problem` - ADD PRIMARY KEY (`problemId`), - ADD UNIQUE KEY `problemNo` (`problemNo`); - --- --- Indexes for table `sign` --- -ALTER TABLE `sign` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `team` --- -ALTER TABLE `team` - ADD PRIMARY KEY (`teamId`); - --- --- Indexes for table `user` --- -ALTER TABLE `user` - ADD PRIMARY KEY (`userId`); - --- --- 在导出的表使用AUTO_INCREMENT --- - --- --- 使用表AUTO_INCREMENT `contest` --- -ALTER TABLE `contest` - MODIFY `contestId` int(11) NOT NULL AUTO_INCREMENT; --- --- 使用表AUTO_INCREMENT `notice` --- -ALTER TABLE `notice` - MODIFY `noticeId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; --- --- 使用表AUTO_INCREMENT `problem` --- -ALTER TABLE `problem` - MODIFY `problemId` int(11) NOT NULL AUTO_INCREMENT; --- --- 使用表AUTO_INCREMENT `sign` --- -ALTER TABLE `sign` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; --- --- 使用表AUTO_INCREMENT `team` --- -ALTER TABLE `team` - MODIFY `teamId` int(11) NOT NULL AUTO_INCREMENT; --- --- 使用表AUTO_INCREMENT `user` --- -ALTER TABLE `user` - MODIFY `userId` int(11) NOT NULL AUTO_INCREMENT; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/back_end/page/acm.jpg b/back_end/page/acm.jpg deleted file mode 100644 index 22761a21c..000000000 Binary files a/back_end/page/acm.jpg and /dev/null differ diff --git a/back_end/page/assets/css/font-awesome.min.css b/back_end/page/assets/css/font-awesome.min.css deleted file mode 100644 index 9b27f8ea8..000000000 --- a/back_end/page/assets/css/font-awesome.min.css +++ /dev/null @@ -1,4 +0,0 @@ -/*! - * Font Awesome 4.6.3 by @davegandy - http://fontawesome.io - @fontawesome - * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) - */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.6.3');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.6.3') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.6.3') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.6.3') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.6.3') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.6.3#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-signing:before,.fa-sign-language:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto} diff --git a/back_end/page/assets/css/font/GochiHand-Regular.eot b/back_end/page/assets/css/font/GochiHand-Regular.eot deleted file mode 100755 index 0e69dd1c7..000000000 Binary files a/back_end/page/assets/css/font/GochiHand-Regular.eot and /dev/null differ diff --git a/back_end/page/assets/css/font/GochiHand-Regular.ttf b/back_end/page/assets/css/font/GochiHand-Regular.ttf deleted file mode 100755 index fc18f60fe..000000000 Binary files a/back_end/page/assets/css/font/GochiHand-Regular.ttf and /dev/null differ diff --git a/back_end/page/assets/css/ie8.css b/back_end/page/assets/css/ie8.css deleted file mode 100644 index 3da0a3f1a..000000000 --- a/back_end/page/assets/css/ie8.css +++ /dev/null @@ -1,95 +0,0 @@ -/* - Spectral by HTML5 UP - html5up.net | @ajlkn - Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) -*/ - -/* Icon */ - - .icon.major { - border: none; - } - - .icon.major:before { - font-size: 3em; - } - -/* Form */ - - label { - color: #2E3842; - } - - input[type="text"], - input[type="password"], - input[type="email"], - select, - textarea { - border: solid 1px #dfdfdf; - } - -/* Button */ - - input[type="submit"], - input[type="reset"], - input[type="button"], - button, - .button { - border: solid 2px #dfdfdf; - } - - input[type="submit"].special, - input[type="reset"].special, - input[type="button"].special, - button.special, - .button.special { - border: 0 !important; - } - -/* Page Wrapper + Menu */ - - #menu { - display: none; - } - - body.is-menu-visible #menu { - display: block; - } - -/* Header */ - - #header nav > ul > li > a.menuToggle:after { - display: none; - } - -/* Banner + Wrapper (style4) */ - - #banner, - .wrapper.style4 { - -ms-behavior: url("assets/js/ie/backgroundsize.min.htc"); - } - - #banner:before, - .wrapper.style4:before { - display: none; - } - -/* Banner */ - - #banner .more { - height: 4em; - } - - #banner .more:after { - display: none; - } - -/* Main */ - - #main > header { - -ms-behavior: url("assets/js/ie/backgroundsize.min.htc"); - } - - #main > header:before { - display: none; - } \ No newline at end of file diff --git a/back_end/page/assets/css/ie9.css b/back_end/page/assets/css/ie9.css deleted file mode 100644 index 939de7ca2..000000000 --- a/back_end/page/assets/css/ie9.css +++ /dev/null @@ -1,125 +0,0 @@ -/* - Spectral by HTML5 UP - html5up.net | @ajlkn - Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) -*/ - -/* Spotlight */ - - .spotlight { - display: block; - } - - .spotlight .image { - display: inline-block; - vertical-align: top; - } - - .spotlight .content { - padding: 4em 4em 2em 4em ; - display: inline-block; - } - - .spotlight:after { - clear: both; - content: ''; - display: block; - } - -/* Features */ - - .features { - display: block; - } - - .features li { - float: left; - } - - .features:after { - content: ''; - display: block; - clear: both; - } - -/* Banner + Wrapper (style4) */ - - #banner, - .wrapper.style4 { - background-image: url("../../images/banner.jpg"); - background-position: center center; - background-repeat: no-repeat; - background-size: cover; - position: relative; - } - - #banner:before, - .wrapper.style4:before { - background: #000000; - content: ''; - height: 100%; - left: 0; - opacity: 0.5; - position: absolute; - top: 0; - width: 100%; - } - - #banner .inner, - .wrapper.style4 .inner { - position: relative; - z-index: 1; - } - -/* Banner */ - - #banner { - padding: 14em 0 12em 0 ; - height: auto; - } - - #banner:after { - display: none; - } - -/* CTA */ - - #cta .inner header { - float: left; - } - - #cta .inner .actions { - float: left; - } - - #cta .inner:after { - clear: both; - content: ''; - display: block; - } - -/* Main */ - - #main > header { - background-image: url("../../images/banner.jpg"); - background-position: center center; - background-repeat: no-repeat; - background-size: cover; - position: relative; - } - - #main > header:before { - background: #000000; - content: ''; - height: 100%; - left: 0; - opacity: 0.5; - position: absolute; - top: 0; - width: 100%; - } - - #main > header > * { - position: relative; - z-index: 1; - } \ No newline at end of file diff --git a/back_end/page/assets/css/images/arrow-bottom.png b/back_end/page/assets/css/images/arrow-bottom.png deleted file mode 100755 index 73ef07719..000000000 Binary files a/back_end/page/assets/css/images/arrow-bottom.png and /dev/null differ diff --git a/back_end/page/assets/css/images/arrow-left.png b/back_end/page/assets/css/images/arrow-left.png deleted file mode 100755 index 4c103c4b1..000000000 Binary files a/back_end/page/assets/css/images/arrow-left.png and /dev/null differ diff --git a/back_end/page/assets/css/images/arrow-right.png b/back_end/page/assets/css/images/arrow-right.png deleted file mode 100755 index 65fcc5279..000000000 Binary files a/back_end/page/assets/css/images/arrow-right.png and /dev/null differ diff --git a/back_end/page/assets/css/images/arrow-top.png b/back_end/page/assets/css/images/arrow-top.png deleted file mode 100755 index 8d2c04834..000000000 Binary files a/back_end/page/assets/css/images/arrow-top.png and /dev/null differ diff --git a/back_end/page/assets/css/images/arrow.svg b/back_end/page/assets/css/images/arrow.svg deleted file mode 100644 index 49ee37c79..000000000 --- a/back_end/page/assets/css/images/arrow.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/back_end/page/assets/css/images/bars.svg b/back_end/page/assets/css/images/bars.svg deleted file mode 100644 index 50e4e414c..000000000 --- a/back_end/page/assets/css/images/bars.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/back_end/page/assets/css/images/close.png b/back_end/page/assets/css/images/close.png deleted file mode 100755 index 48c4157c9..000000000 Binary files a/back_end/page/assets/css/images/close.png and /dev/null differ diff --git a/back_end/page/assets/css/images/close.svg b/back_end/page/assets/css/images/close.svg deleted file mode 100644 index 3ad87862e..000000000 --- a/back_end/page/assets/css/images/close.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/back_end/page/assets/css/images/scratch-border.png b/back_end/page/assets/css/images/scratch-border.png deleted file mode 100755 index 28339b0c3..000000000 Binary files a/back_end/page/assets/css/images/scratch-border.png and /dev/null differ diff --git a/back_end/page/assets/css/jquery.pagewalkthrough.css b/back_end/page/assets/css/jquery.pagewalkthrough.css deleted file mode 100755 index c85a91392..000000000 --- a/back_end/page/assets/css/jquery.pagewalkthrough.css +++ /dev/null @@ -1,151 +0,0 @@ -#jpwClose, -#jpwNext, -#jpwPrevious, -#jpwFinish { - color: #00c7ff; - cursor: pointer; - font-family: 'GochiHand'; - font-size: 18px; - font-weight: lighter; -} -#jpwOverlay { - background: rgba(0, 0, 0, 0.6); - position: fixed; - z-index: 999999; - top: 0; - width: 100%; - height: 100%; - display: block; -} -#jpwOverlay.transparent { - background: none; -} -#jpWalkthrough.jpw-scrolling .overlay-hole > div { - box-shadow: inset 0 0 10px 1000px rgba(0, 0, 0, 0.6); -} -#jpWalkthrough .overlay-hole > div { - box-shadow: inset 0 0 10px 10px rgba(0, 0, 0, 0.6); -} -#jpWalkthrough #jpwTooltip { - overflow: visible; - padding: 10px; - background: none; -} -#jpWalkthrough #jpwTooltip #tooltipWrapper { - overflow: visible; -} -#jpWalkthrough #jpwTooltip #bottom-scratch { - background: url("images/scratch-border.png") no-repeat left top; - width: 358px; - height: 42px; - display: block; - top: 25px; - clear: both; -} -#jpWalkthrough #jpwTooltip .draggable-area { - display: block; - width: 44px; - height: 40px; - position: absolute; - top: -35px; - right: -30px; - background: url("images/drag.png") no-repeat; - z-index: 10000; -} -#jpWalkthrough #jpwTooltip .top { - background: url("images/arrow-bottom.png") no-repeat scroll 0 0 transparent; - bottom: -86px; - height: 86px; - left: 130px; - position: absolute; - width: 75px; - display: block; - z-index: 1000; -} -#jpWalkthrough #jpwTooltip .right { - background: url("images/arrow-left.png") no-repeat scroll 0 0 transparent; - height: 56px; - left: -105px; - position: absolute; - top: 35px; - width: 105px; - display: block; - z-index: 1000; -} -#jpWalkthrough #jpwTooltip .bottom { - background: url("images/arrow-top.png") no-repeat scroll 0 0 transparent; - height: 86px; - left: 130px; - position: absolute; - top: -86px; - width: 75px; - display: block; - z-index: 1000; -} -#jpWalkthrough #jpwTooltip .left { - background: url("images/arrow-right.png") no-repeat scroll 0 0 transparent; - height: 56px; - position: absolute; - right: -105px; - top: 35px; - width: 105px; - display: block; - z-index: 1000; -} -#jpWalkthrough #jpwTooltip #tooltipInner { - font-family: 'GochiHand'; - color: #ffffff; - text-align: center; - font-size: 22px; -} -#jpWalkthrough #jpwTooltip #tooltipInner a { - font-size: 22px; -} -#jpWalkthrough #jpwTooltip #tooltipInner .tooltipTitle { - font-size: 40px; -} -#jpWalkthrough .killOverlay { - background-image: none !important; - background-color: none !important; -} -#jpwClose { - position: fixed; - top: 65px; - right: 25px; - z-index: 1000000; - color: #ffffff; - text-align: center; - display: block; -} -#jpwClose:hover { - color: #7eff00; -} -#jpwClose:before { - content: ''; - display: inline-block; - *display: inline; - *zoom: 1; - width: 44px; - height: 40px; - background: url("images/close.png") no-repeat; - position: absolute; - top: -45px; - left: 36px; -} -#jpwNext, -#jpwFinish { - float: right; -} -#jpwPrevious { - float: left; -} -@font-face { - font-family: 'GochiHand'; - src: url('font/GochiHand-Regular.eot'); - font-weight: normal; - font-style: normal; - font-family: 'GochiHand'; - src: url('font/GochiHand-Regular.ttf') format('truetype'); - font-weight: normal; - font-style: normal; -} diff --git a/back_end/page/assets/css/main.css b/back_end/page/assets/css/main.css deleted file mode 100644 index 5fc74be94..000000000 --- a/back_end/page/assets/css/main.css +++ /dev/null @@ -1,3878 +0,0 @@ -@import url(font-awesome.min.css); -@import url("https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600,600italic,800,800italic"); - -/* - Spectral by HTML5 UP - html5up.net | @ajlkn - Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) -*/ - -/* Reset */ - - html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; - } - - article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { - display: block; - } - - body { - line-height: 1; - } - - ol, ul { - list-style: none; - } - - blockquote, q { - quotes: none; - } - - blockquote:before, blockquote:after, q:before, q:after { - content: ''; - content: none; - } - - table { - border-collapse: collapse; - border-spacing: 0; - } - - body { - -webkit-text-size-adjust: none; - } - -/* Box Model */ - - *, *:before, *:after { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - } - -/* Grid */ - - .row { - border-bottom: solid 1px transparent; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - } - - .row > * { - float: left; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - } - - .row:after, .row:before { - content: ''; - display: block; - clear: both; - height: 0; - } - - .row.uniform > * > :first-child { - margin-top: 0; - } - - .row.uniform > * > :last-child { - margin-bottom: 0; - } - - .row.\30 \25 > * { - padding: 0 0 0 0em; - } - - .row.\30 \25 { - margin: 0 0 -1px 0em; - } - - .row.uniform.\30 \25 > * { - padding: 0em 0 0 0em; - } - - .row.uniform.\30 \25 { - margin: 0em 0 -1px 0em; - } - - .row > * { - padding: 0 0 0 1.5em; - } - - .row { - margin: 0 0 -1px -1.5em; - } - - .row.uniform > * { - padding: 1.5em 0 0 1.5em; - } - - .row.uniform { - margin: -1.5em 0 -1px -1.5em; - } - - .row.\32 00\25 > * { - padding: 0 0 0 3em; - } - - .row.\32 00\25 { - margin: 0 0 -1px -3em; - } - - .row.uniform.\32 00\25 > * { - padding: 3em 0 0 3em; - } - - .row.uniform.\32 00\25 { - margin: -3em 0 -1px -3em; - } - - .row.\31 50\25 > * { - padding: 0 0 0 2.25em; - } - - .row.\31 50\25 { - margin: 0 0 -1px -2.25em; - } - - .row.uniform.\31 50\25 > * { - padding: 2.25em 0 0 2.25em; - } - - .row.uniform.\31 50\25 { - margin: -2.25em 0 -1px -2.25em; - } - - .row.\35 0\25 > * { - padding: 0 0 0 0.75em; - } - - .row.\35 0\25 { - margin: 0 0 -1px -0.75em; - } - - .row.uniform.\35 0\25 > * { - padding: 0.75em 0 0 0.75em; - } - - .row.uniform.\35 0\25 { - margin: -0.75em 0 -1px -0.75em; - } - - .row.\32 5\25 > * { - padding: 0 0 0 0.375em; - } - - .row.\32 5\25 { - margin: 0 0 -1px -0.375em; - } - - .row.uniform.\32 5\25 > * { - padding: 0.375em 0 0 0.375em; - } - - .row.uniform.\32 5\25 { - margin: -0.375em 0 -1px -0.375em; - } - - .\31 2u, .\31 2u\24 { - width: 100%; - clear: none; - margin-left: 0; - } - - .\31 1u, .\31 1u\24 { - width: 91.6666666667%; - clear: none; - margin-left: 0; - } - - .\31 0u, .\31 0u\24 { - width: 83.3333333333%; - clear: none; - margin-left: 0; - } - - .\39 u, .\39 u\24 { - width: 75%; - clear: none; - margin-left: 0; - } - - .\38 u, .\38 u\24 { - width: 66.6666666667%; - clear: none; - margin-left: 0; - } - - .\37 u, .\37 u\24 { - width: 58.3333333333%; - clear: none; - margin-left: 0; - } - - .\36 u, .\36 u\24 { - width: 50%; - clear: none; - margin-left: 0; - } - - .\35 u, .\35 u\24 { - width: 41.6666666667%; - clear: none; - margin-left: 0; - } - - .\34 u, .\34 u\24 { - width: 33.3333333333%; - clear: none; - margin-left: 0; - } - - .\33 u, .\33 u\24 { - width: 25%; - clear: none; - margin-left: 0; - } - - .\32 u, .\32 u\24 { - width: 16.6666666667%; - clear: none; - margin-left: 0; - } - - .\31 u, .\31 u\24 { - width: 8.3333333333%; - clear: none; - margin-left: 0; - } - - .\31 2u\24 + *, - .\31 1u\24 + *, - .\31 0u\24 + *, - .\39 u\24 + *, - .\38 u\24 + *, - .\37 u\24 + *, - .\36 u\24 + *, - .\35 u\24 + *, - .\34 u\24 + *, - .\33 u\24 + *, - .\32 u\24 + *, - .\31 u\24 + * { - clear: left; - } - - .\-11u { - margin-left: 91.66667%; - } - - .\-10u { - margin-left: 83.33333%; - } - - .\-9u { - margin-left: 75%; - } - - .\-8u { - margin-left: 66.66667%; - } - - .\-7u { - margin-left: 58.33333%; - } - - .\-6u { - margin-left: 50%; - } - - .\-5u { - margin-left: 41.66667%; - } - - .\-4u { - margin-left: 33.33333%; - } - - .\-3u { - margin-left: 25%; - } - - .\-2u { - margin-left: 16.66667%; - } - - .\-1u { - margin-left: 8.33333%; - } - - @media screen and (max-width: 1680px) { - - .row > * { - padding: 0 0 0 1.5em; - } - - .row { - margin: 0 0 -1px -1.5em; - } - - .row.uniform > * { - padding: 1.5em 0 0 1.5em; - } - - .row.uniform { - margin: -1.5em 0 -1px -1.5em; - } - - .row.\32 00\25 > * { - padding: 0 0 0 3em; - } - - .row.\32 00\25 { - margin: 0 0 -1px -3em; - } - - .row.uniform.\32 00\25 > * { - padding: 3em 0 0 3em; - } - - .row.uniform.\32 00\25 { - margin: -3em 0 -1px -3em; - } - - .row.\31 50\25 > * { - padding: 0 0 0 2.25em; - } - - .row.\31 50\25 { - margin: 0 0 -1px -2.25em; - } - - .row.uniform.\31 50\25 > * { - padding: 2.25em 0 0 2.25em; - } - - .row.uniform.\31 50\25 { - margin: -2.25em 0 -1px -2.25em; - } - - .row.\35 0\25 > * { - padding: 0 0 0 0.75em; - } - - .row.\35 0\25 { - margin: 0 0 -1px -0.75em; - } - - .row.uniform.\35 0\25 > * { - padding: 0.75em 0 0 0.75em; - } - - .row.uniform.\35 0\25 { - margin: -0.75em 0 -1px -0.75em; - } - - .row.\32 5\25 > * { - padding: 0 0 0 0.375em; - } - - .row.\32 5\25 { - margin: 0 0 -1px -0.375em; - } - - .row.uniform.\32 5\25 > * { - padding: 0.375em 0 0 0.375em; - } - - .row.uniform.\32 5\25 { - margin: -0.375em 0 -1px -0.375em; - } - - .\31 2u\28xlarge\29, .\31 2u\24\28xlarge\29 { - width: 100%; - clear: none; - margin-left: 0; - } - - .\31 1u\28xlarge\29, .\31 1u\24\28xlarge\29 { - width: 91.6666666667%; - clear: none; - margin-left: 0; - } - - .\31 0u\28xlarge\29, .\31 0u\24\28xlarge\29 { - width: 83.3333333333%; - clear: none; - margin-left: 0; - } - - .\39 u\28xlarge\29, .\39 u\24\28xlarge\29 { - width: 75%; - clear: none; - margin-left: 0; - } - - .\38 u\28xlarge\29, .\38 u\24\28xlarge\29 { - width: 66.6666666667%; - clear: none; - margin-left: 0; - } - - .\37 u\28xlarge\29, .\37 u\24\28xlarge\29 { - width: 58.3333333333%; - clear: none; - margin-left: 0; - } - - .\36 u\28xlarge\29, .\36 u\24\28xlarge\29 { - width: 50%; - clear: none; - margin-left: 0; - } - - .\35 u\28xlarge\29, .\35 u\24\28xlarge\29 { - width: 41.6666666667%; - clear: none; - margin-left: 0; - } - - .\34 u\28xlarge\29, .\34 u\24\28xlarge\29 { - width: 33.3333333333%; - clear: none; - margin-left: 0; - } - - .\33 u\28xlarge\29, .\33 u\24\28xlarge\29 { - width: 25%; - clear: none; - margin-left: 0; - } - - .\32 u\28xlarge\29, .\32 u\24\28xlarge\29 { - width: 16.6666666667%; - clear: none; - margin-left: 0; - } - - .\31 u\28xlarge\29, .\31 u\24\28xlarge\29 { - width: 8.3333333333%; - clear: none; - margin-left: 0; - } - - .\31 2u\24\28xlarge\29 + *, - .\31 1u\24\28xlarge\29 + *, - .\31 0u\24\28xlarge\29 + *, - .\39 u\24\28xlarge\29 + *, - .\38 u\24\28xlarge\29 + *, - .\37 u\24\28xlarge\29 + *, - .\36 u\24\28xlarge\29 + *, - .\35 u\24\28xlarge\29 + *, - .\34 u\24\28xlarge\29 + *, - .\33 u\24\28xlarge\29 + *, - .\32 u\24\28xlarge\29 + *, - .\31 u\24\28xlarge\29 + * { - clear: left; - } - - .\-11u\28xlarge\29 { - margin-left: 91.66667%; - } - - .\-10u\28xlarge\29 { - margin-left: 83.33333%; - } - - .\-9u\28xlarge\29 { - margin-left: 75%; - } - - .\-8u\28xlarge\29 { - margin-left: 66.66667%; - } - - .\-7u\28xlarge\29 { - margin-left: 58.33333%; - } - - .\-6u\28xlarge\29 { - margin-left: 50%; - } - - .\-5u\28xlarge\29 { - margin-left: 41.66667%; - } - - .\-4u\28xlarge\29 { - margin-left: 33.33333%; - } - - .\-3u\28xlarge\29 { - margin-left: 25%; - } - - .\-2u\28xlarge\29 { - margin-left: 16.66667%; - } - - .\-1u\28xlarge\29 { - margin-left: 8.33333%; - } - - } - - @media screen and (max-width: 1280px) { - - .row > * { - padding: 0 0 0 1.5em; - } - - .row { - margin: 0 0 -1px -1.5em; - } - - .row.uniform > * { - padding: 1.5em 0 0 1.5em; - } - - .row.uniform { - margin: -1.5em 0 -1px -1.5em; - } - - .row.\32 00\25 > * { - padding: 0 0 0 3em; - } - - .row.\32 00\25 { - margin: 0 0 -1px -3em; - } - - .row.uniform.\32 00\25 > * { - padding: 3em 0 0 3em; - } - - .row.uniform.\32 00\25 { - margin: -3em 0 -1px -3em; - } - - .row.\31 50\25 > * { - padding: 0 0 0 2.25em; - } - - .row.\31 50\25 { - margin: 0 0 -1px -2.25em; - } - - .row.uniform.\31 50\25 > * { - padding: 2.25em 0 0 2.25em; - } - - .row.uniform.\31 50\25 { - margin: -2.25em 0 -1px -2.25em; - } - - .row.\35 0\25 > * { - padding: 0 0 0 0.75em; - } - - .row.\35 0\25 { - margin: 0 0 -1px -0.75em; - } - - .row.uniform.\35 0\25 > * { - padding: 0.75em 0 0 0.75em; - } - - .row.uniform.\35 0\25 { - margin: -0.75em 0 -1px -0.75em; - } - - .row.\32 5\25 > * { - padding: 0 0 0 0.375em; - } - - .row.\32 5\25 { - margin: 0 0 -1px -0.375em; - } - - .row.uniform.\32 5\25 > * { - padding: 0.375em 0 0 0.375em; - } - - .row.uniform.\32 5\25 { - margin: -0.375em 0 -1px -0.375em; - } - - .\31 2u\28large\29, .\31 2u\24\28large\29 { - width: 100%; - clear: none; - margin-left: 0; - } - - .\31 1u\28large\29, .\31 1u\24\28large\29 { - width: 91.6666666667%; - clear: none; - margin-left: 0; - } - - .\31 0u\28large\29, .\31 0u\24\28large\29 { - width: 83.3333333333%; - clear: none; - margin-left: 0; - } - - .\39 u\28large\29, .\39 u\24\28large\29 { - width: 75%; - clear: none; - margin-left: 0; - } - - .\38 u\28large\29, .\38 u\24\28large\29 { - width: 66.6666666667%; - clear: none; - margin-left: 0; - } - - .\37 u\28large\29, .\37 u\24\28large\29 { - width: 58.3333333333%; - clear: none; - margin-left: 0; - } - - .\36 u\28large\29, .\36 u\24\28large\29 { - width: 50%; - clear: none; - margin-left: 0; - } - - .\35 u\28large\29, .\35 u\24\28large\29 { - width: 41.6666666667%; - clear: none; - margin-left: 0; - } - - .\34 u\28large\29, .\34 u\24\28large\29 { - width: 33.3333333333%; - clear: none; - margin-left: 0; - } - - .\33 u\28large\29, .\33 u\24\28large\29 { - width: 25%; - clear: none; - margin-left: 0; - } - - .\32 u\28large\29, .\32 u\24\28large\29 { - width: 16.6666666667%; - clear: none; - margin-left: 0; - } - - .\31 u\28large\29, .\31 u\24\28large\29 { - width: 8.3333333333%; - clear: none; - margin-left: 0; - } - - .\31 2u\24\28large\29 + *, - .\31 1u\24\28large\29 + *, - .\31 0u\24\28large\29 + *, - .\39 u\24\28large\29 + *, - .\38 u\24\28large\29 + *, - .\37 u\24\28large\29 + *, - .\36 u\24\28large\29 + *, - .\35 u\24\28large\29 + *, - .\34 u\24\28large\29 + *, - .\33 u\24\28large\29 + *, - .\32 u\24\28large\29 + *, - .\31 u\24\28large\29 + * { - clear: left; - } - - .\-11u\28large\29 { - margin-left: 91.66667%; - } - - .\-10u\28large\29 { - margin-left: 83.33333%; - } - - .\-9u\28large\29 { - margin-left: 75%; - } - - .\-8u\28large\29 { - margin-left: 66.66667%; - } - - .\-7u\28large\29 { - margin-left: 58.33333%; - } - - .\-6u\28large\29 { - margin-left: 50%; - } - - .\-5u\28large\29 { - margin-left: 41.66667%; - } - - .\-4u\28large\29 { - margin-left: 33.33333%; - } - - .\-3u\28large\29 { - margin-left: 25%; - } - - .\-2u\28large\29 { - margin-left: 16.66667%; - } - - .\-1u\28large\29 { - margin-left: 8.33333%; - } - - } - - @media screen and (max-width: 980px) { - - .row > * { - padding: 0 0 0 1.5em; - } - - .row { - margin: 0 0 -1px -1.5em; - } - - .row.uniform > * { - padding: 1.5em 0 0 1.5em; - } - - .row.uniform { - margin: -1.5em 0 -1px -1.5em; - } - - .row.\32 00\25 > * { - padding: 0 0 0 3em; - } - - .row.\32 00\25 { - margin: 0 0 -1px -3em; - } - - .row.uniform.\32 00\25 > * { - padding: 3em 0 0 3em; - } - - .row.uniform.\32 00\25 { - margin: -3em 0 -1px -3em; - } - - .row.\31 50\25 > * { - padding: 0 0 0 2.25em; - } - - .row.\31 50\25 { - margin: 0 0 -1px -2.25em; - } - - .row.uniform.\31 50\25 > * { - padding: 2.25em 0 0 2.25em; - } - - .row.uniform.\31 50\25 { - margin: -2.25em 0 -1px -2.25em; - } - - .row.\35 0\25 > * { - padding: 0 0 0 0.75em; - } - - .row.\35 0\25 { - margin: 0 0 -1px -0.75em; - } - - .row.uniform.\35 0\25 > * { - padding: 0.75em 0 0 0.75em; - } - - .row.uniform.\35 0\25 { - margin: -0.75em 0 -1px -0.75em; - } - - .row.\32 5\25 > * { - padding: 0 0 0 0.375em; - } - - .row.\32 5\25 { - margin: 0 0 -1px -0.375em; - } - - .row.uniform.\32 5\25 > * { - padding: 0.375em 0 0 0.375em; - } - - .row.uniform.\32 5\25 { - margin: -0.375em 0 -1px -0.375em; - } - - .\31 2u\28medium\29, .\31 2u\24\28medium\29 { - width: 100%; - clear: none; - margin-left: 0; - } - - .\31 1u\28medium\29, .\31 1u\24\28medium\29 { - width: 91.6666666667%; - clear: none; - margin-left: 0; - } - - .\31 0u\28medium\29, .\31 0u\24\28medium\29 { - width: 83.3333333333%; - clear: none; - margin-left: 0; - } - - .\39 u\28medium\29, .\39 u\24\28medium\29 { - width: 75%; - clear: none; - margin-left: 0; - } - - .\38 u\28medium\29, .\38 u\24\28medium\29 { - width: 66.6666666667%; - clear: none; - margin-left: 0; - } - - .\37 u\28medium\29, .\37 u\24\28medium\29 { - width: 58.3333333333%; - clear: none; - margin-left: 0; - } - - .\36 u\28medium\29, .\36 u\24\28medium\29 { - width: 50%; - clear: none; - margin-left: 0; - } - - .\35 u\28medium\29, .\35 u\24\28medium\29 { - width: 41.6666666667%; - clear: none; - margin-left: 0; - } - - .\34 u\28medium\29, .\34 u\24\28medium\29 { - width: 33.3333333333%; - clear: none; - margin-left: 0; - } - - .\33 u\28medium\29, .\33 u\24\28medium\29 { - width: 25%; - clear: none; - margin-left: 0; - } - - .\32 u\28medium\29, .\32 u\24\28medium\29 { - width: 16.6666666667%; - clear: none; - margin-left: 0; - } - - .\31 u\28medium\29, .\31 u\24\28medium\29 { - width: 8.3333333333%; - clear: none; - margin-left: 0; - } - - .\31 2u\24\28medium\29 + *, - .\31 1u\24\28medium\29 + *, - .\31 0u\24\28medium\29 + *, - .\39 u\24\28medium\29 + *, - .\38 u\24\28medium\29 + *, - .\37 u\24\28medium\29 + *, - .\36 u\24\28medium\29 + *, - .\35 u\24\28medium\29 + *, - .\34 u\24\28medium\29 + *, - .\33 u\24\28medium\29 + *, - .\32 u\24\28medium\29 + *, - .\31 u\24\28medium\29 + * { - clear: left; - } - - .\-11u\28medium\29 { - margin-left: 91.66667%; - } - - .\-10u\28medium\29 { - margin-left: 83.33333%; - } - - .\-9u\28medium\29 { - margin-left: 75%; - } - - .\-8u\28medium\29 { - margin-left: 66.66667%; - } - - .\-7u\28medium\29 { - margin-left: 58.33333%; - } - - .\-6u\28medium\29 { - margin-left: 50%; - } - - .\-5u\28medium\29 { - margin-left: 41.66667%; - } - - .\-4u\28medium\29 { - margin-left: 33.33333%; - } - - .\-3u\28medium\29 { - margin-left: 25%; - } - - .\-2u\28medium\29 { - margin-left: 16.66667%; - } - - .\-1u\28medium\29 { - margin-left: 8.33333%; - } - - } - - @media screen and (max-width: 736px) { - - .row > * { - padding: 0 0 0 1.5em; - } - - .row { - margin: 0 0 -1px -1.5em; - } - - .row.uniform > * { - padding: 1.5em 0 0 1.5em; - } - - .row.uniform { - margin: -1.5em 0 -1px -1.5em; - } - - .row.\32 00\25 > * { - padding: 0 0 0 3em; - } - - .row.\32 00\25 { - margin: 0 0 -1px -3em; - } - - .row.uniform.\32 00\25 > * { - padding: 3em 0 0 3em; - } - - .row.uniform.\32 00\25 { - margin: -3em 0 -1px -3em; - } - - .row.\31 50\25 > * { - padding: 0 0 0 2.25em; - } - - .row.\31 50\25 { - margin: 0 0 -1px -2.25em; - } - - .row.uniform.\31 50\25 > * { - padding: 2.25em 0 0 2.25em; - } - - .row.uniform.\31 50\25 { - margin: -2.25em 0 -1px -2.25em; - } - - .row.\35 0\25 > * { - padding: 0 0 0 0.75em; - } - - .row.\35 0\25 { - margin: 0 0 -1px -0.75em; - } - - .row.uniform.\35 0\25 > * { - padding: 0.75em 0 0 0.75em; - } - - .row.uniform.\35 0\25 { - margin: -0.75em 0 -1px -0.75em; - } - - .row.\32 5\25 > * { - padding: 0 0 0 0.375em; - } - - .row.\32 5\25 { - margin: 0 0 -1px -0.375em; - } - - .row.uniform.\32 5\25 > * { - padding: 0.375em 0 0 0.375em; - } - - .row.uniform.\32 5\25 { - margin: -0.375em 0 -1px -0.375em; - } - - .\31 2u\28small\29, .\31 2u\24\28small\29 { - width: 100%; - clear: none; - margin-left: 0; - } - - .\31 1u\28small\29, .\31 1u\24\28small\29 { - width: 91.6666666667%; - clear: none; - margin-left: 0; - } - - .\31 0u\28small\29, .\31 0u\24\28small\29 { - width: 83.3333333333%; - clear: none; - margin-left: 0; - } - - .\39 u\28small\29, .\39 u\24\28small\29 { - width: 75%; - clear: none; - margin-left: 0; - } - - .\38 u\28small\29, .\38 u\24\28small\29 { - width: 66.6666666667%; - clear: none; - margin-left: 0; - } - - .\37 u\28small\29, .\37 u\24\28small\29 { - width: 58.3333333333%; - clear: none; - margin-left: 0; - } - - .\36 u\28small\29, .\36 u\24\28small\29 { - width: 50%; - clear: none; - margin-left: 0; - } - - .\35 u\28small\29, .\35 u\24\28small\29 { - width: 41.6666666667%; - clear: none; - margin-left: 0; - } - - .\34 u\28small\29, .\34 u\24\28small\29 { - width: 33.3333333333%; - clear: none; - margin-left: 0; - } - - .\33 u\28small\29, .\33 u\24\28small\29 { - width: 25%; - clear: none; - margin-left: 0; - } - - .\32 u\28small\29, .\32 u\24\28small\29 { - width: 16.6666666667%; - clear: none; - margin-left: 0; - } - - .\31 u\28small\29, .\31 u\24\28small\29 { - width: 8.3333333333%; - clear: none; - margin-left: 0; - } - - .\31 2u\24\28small\29 + *, - .\31 1u\24\28small\29 + *, - .\31 0u\24\28small\29 + *, - .\39 u\24\28small\29 + *, - .\38 u\24\28small\29 + *, - .\37 u\24\28small\29 + *, - .\36 u\24\28small\29 + *, - .\35 u\24\28small\29 + *, - .\34 u\24\28small\29 + *, - .\33 u\24\28small\29 + *, - .\32 u\24\28small\29 + *, - .\31 u\24\28small\29 + * { - clear: left; - } - - .\-11u\28small\29 { - margin-left: 91.66667%; - } - - .\-10u\28small\29 { - margin-left: 83.33333%; - } - - .\-9u\28small\29 { - margin-left: 75%; - } - - .\-8u\28small\29 { - margin-left: 66.66667%; - } - - .\-7u\28small\29 { - margin-left: 58.33333%; - } - - .\-6u\28small\29 { - margin-left: 50%; - } - - .\-5u\28small\29 { - margin-left: 41.66667%; - } - - .\-4u\28small\29 { - margin-left: 33.33333%; - } - - .\-3u\28small\29 { - margin-left: 25%; - } - - .\-2u\28small\29 { - margin-left: 16.66667%; - } - - .\-1u\28small\29 { - margin-left: 8.33333%; - } - - } - - @media screen and (max-width: 480px) { - - .row > * { - padding: 0 0 0 1.5em; - } - - .row { - margin: 0 0 -1px -1.5em; - } - - .row.uniform > * { - padding: 1.5em 0 0 1.5em; - } - - .row.uniform { - margin: -1.5em 0 -1px -1.5em; - } - - .row.\32 00\25 > * { - padding: 0 0 0 3em; - } - - .row.\32 00\25 { - margin: 0 0 -1px -3em; - } - - .row.uniform.\32 00\25 > * { - padding: 3em 0 0 3em; - } - - .row.uniform.\32 00\25 { - margin: -3em 0 -1px -3em; - } - - .row.\31 50\25 > * { - padding: 0 0 0 2.25em; - } - - .row.\31 50\25 { - margin: 0 0 -1px -2.25em; - } - - .row.uniform.\31 50\25 > * { - padding: 2.25em 0 0 2.25em; - } - - .row.uniform.\31 50\25 { - margin: -2.25em 0 -1px -2.25em; - } - - .row.\35 0\25 > * { - padding: 0 0 0 0.75em; - } - - .row.\35 0\25 { - margin: 0 0 -1px -0.75em; - } - - .row.uniform.\35 0\25 > * { - padding: 0.75em 0 0 0.75em; - } - - .row.uniform.\35 0\25 { - margin: -0.75em 0 -1px -0.75em; - } - - .row.\32 5\25 > * { - padding: 0 0 0 0.375em; - } - - .row.\32 5\25 { - margin: 0 0 -1px -0.375em; - } - - .row.uniform.\32 5\25 > * { - padding: 0.375em 0 0 0.375em; - } - - .row.uniform.\32 5\25 { - margin: -0.375em 0 -1px -0.375em; - } - - .\31 2u\28xsmall\29, .\31 2u\24\28xsmall\29 { - width: 100%; - clear: none; - margin-left: 0; - } - - .\31 1u\28xsmall\29, .\31 1u\24\28xsmall\29 { - width: 91.6666666667%; - clear: none; - margin-left: 0; - } - - .\31 0u\28xsmall\29, .\31 0u\24\28xsmall\29 { - width: 83.3333333333%; - clear: none; - margin-left: 0; - } - - .\39 u\28xsmall\29, .\39 u\24\28xsmall\29 { - width: 75%; - clear: none; - margin-left: 0; - } - - .\38 u\28xsmall\29, .\38 u\24\28xsmall\29 { - width: 66.6666666667%; - clear: none; - margin-left: 0; - } - - .\37 u\28xsmall\29, .\37 u\24\28xsmall\29 { - width: 58.3333333333%; - clear: none; - margin-left: 0; - } - - .\36 u\28xsmall\29, .\36 u\24\28xsmall\29 { - width: 50%; - clear: none; - margin-left: 0; - } - - .\35 u\28xsmall\29, .\35 u\24\28xsmall\29 { - width: 41.6666666667%; - clear: none; - margin-left: 0; - } - - .\34 u\28xsmall\29, .\34 u\24\28xsmall\29 { - width: 33.3333333333%; - clear: none; - margin-left: 0; - } - - .\33 u\28xsmall\29, .\33 u\24\28xsmall\29 { - width: 25%; - clear: none; - margin-left: 0; - } - - .\32 u\28xsmall\29, .\32 u\24\28xsmall\29 { - width: 16.6666666667%; - clear: none; - margin-left: 0; - } - - .\31 u\28xsmall\29, .\31 u\24\28xsmall\29 { - width: 8.3333333333%; - clear: none; - margin-left: 0; - } - - .\31 2u\24\28xsmall\29 + *, - .\31 1u\24\28xsmall\29 + *, - .\31 0u\24\28xsmall\29 + *, - .\39 u\24\28xsmall\29 + *, - .\38 u\24\28xsmall\29 + *, - .\37 u\24\28xsmall\29 + *, - .\36 u\24\28xsmall\29 + *, - .\35 u\24\28xsmall\29 + *, - .\34 u\24\28xsmall\29 + *, - .\33 u\24\28xsmall\29 + *, - .\32 u\24\28xsmall\29 + *, - .\31 u\24\28xsmall\29 + * { - clear: left; - } - - .\-11u\28xsmall\29 { - margin-left: 91.66667%; - } - - .\-10u\28xsmall\29 { - margin-left: 83.33333%; - } - - .\-9u\28xsmall\29 { - margin-left: 75%; - } - - .\-8u\28xsmall\29 { - margin-left: 66.66667%; - } - - .\-7u\28xsmall\29 { - margin-left: 58.33333%; - } - - .\-6u\28xsmall\29 { - margin-left: 50%; - } - - .\-5u\28xsmall\29 { - margin-left: 41.66667%; - } - - .\-4u\28xsmall\29 { - margin-left: 33.33333%; - } - - .\-3u\28xsmall\29 { - margin-left: 25%; - } - - .\-2u\28xsmall\29 { - margin-left: 16.66667%; - } - - .\-1u\28xsmall\29 { - margin-left: 8.33333%; - } - - } - -/* Basic */ - - @-ms-viewport { - width: device-width; - } - - body { - /*background: #2e3842;*/ - background: #232323; - margin: 0px 0px 0px 0px; - } - - body.is-loading *, body.is-loading *:before, body.is-loading *:after { - -moz-animation: none !important; - -webkit-animation: none !important; - -ms-animation: none !important; - animation: none !important; - -moz-transition: none !important; - -webkit-transition: none !important; - -ms-transition: none !important; - transition: none !important; - } - - body, input, select, textarea { - color: #fff; - font-family: "Open Sans", Helvetica, sans-serif; - font-size: 15pt; - font-weight: 400; - letter-spacing: 0.075em; - line-height: 1.65em; - } - - @media screen and (max-width: 1680px) { - - body, input, select, textarea { - font-size: 13pt; - } - - } - - @media screen and (max-width: 1280px) { - - body, input, select, textarea { - font-size: 12pt; - } - - } - - @media screen and (max-width: 736px) { - - body, input, select, textarea { - font-size: 11pt; - letter-spacing: 0.0375em; - } - - } - - a { - -moz-transition: color 0.2s ease, border-bottom-color 0.2s ease; - -webkit-transition: color 0.2s ease, border-bottom-color 0.2s ease; - -ms-transition: color 0.2s ease, border-bottom-color 0.2s ease; - transition: color 0.2s ease, border-bottom-color 0.2s ease; - border-bottom: dotted 1px; - color: inherit; - text-decoration: none; - } - - a:hover { - border-bottom-color: transparent; - } - - strong, b { - color: #fff; - font-weight: 600; - } - - em, i { - font-style: italic; - } - - p { - margin: 0 0 2em 0; - } - - h1, h2, h3, h4, h5, h6 { - color: #fff; - font-weight: 800; - letter-spacing: 0.225em; - line-height: 1em; - margin: 0 0 1em 0; - text-transform: uppercase; - } - - h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { - color: inherit; - text-decoration: none; - } - - h2 { - font-size: 1.35em; - line-height: 1.75em; - } - - @media screen and (max-width: 736px) { - - h2 { - font-size: 1.1em; - line-height: 1.65em; - } - - } - - h3 { - font-size: 1.15em; - line-height: 1.75em; - } - - @media screen and (max-width: 736px) { - - h3 { - font-size: 1em; - line-height: 1.65em; - } - - } - - h4 { - font-size: 1em; - line-height: 1.5em; - } - - h5 { - font-size: 0.8em; - line-height: 1.5em; - } - - h6 { - font-size: 0.7em; - line-height: 1.5em; - } - - sub { - font-size: 0.8em; - position: relative; - top: 0.5em; - } - - sup { - font-size: 0.8em; - position: relative; - top: -0.5em; - } - - hr { - border: 0; - border-bottom: solid 2px #fff; - margin: 3em 0; - } - - hr.major { - margin: 4.5em 0; - } - - blockquote { - border-left: solid 4px #fff; - font-style: italic; - margin: 0 0 2em 0; - padding: 0.5em 0 0.5em 2em; - } - - code { - background: rgba(144, 144, 144, 0.25); - border-radius: 3px; - font-family: "Courier New", monospace; - font-size: 0.9em; - letter-spacing: 0; - margin: 0 0.25em; - padding: 0.25em 0.65em; - } - - pre { - -webkit-overflow-scrolling: touch; - font-family: "Courier New", monospace; - font-size: 0.9em; - margin: 0 0 2em 0; - } - - pre code { - display: block; - line-height: 1.75em; - padding: 1em 1.5em; - overflow-x: auto; - } - - .align-left { - text-align: left; - } - - .align-center { - text-align: center; - } - - .align-right { - text-align: right; - } - -/* Section/Article */ - - section.special, article.special { - text-align: center; - } - - header p { - color: rgba(255, 255, 255, 0.5); - position: relative; - top: -0.25em; - } - - header h3 + p { - font-size: 1.1em; - } - - header h4 + p, - header h5 + p, - header h6 + p { - font-size: 0.9em; - } - - header.major { - margin: 0 0 3.5em 0; - } - - header.major h2, header.major h3, header.major h4, header.major h5, header.major h6 { - border-bottom: solid 2px #fff; - display: inline-block; - padding-bottom: 1em; - position: relative; - } - - header.major h2:after, header.major h3:after, header.major h4:after, header.major h5:after, header.major h6:after { - content: ''; - display: block; - height: 1px; - } - - header.major p { - color: #fff; - top: 0; - } - - @media screen and (max-width: 736px) { - - header.major { - margin: 0 0 2em 0; - } - - } - - @media screen and (max-width: 980px) { - - header br { - display: none; - } - - } - -/* Form */ - - form { - margin: 0 0 2em 0; - } - - label { - color: #fff; - display: block; - font-size: 0.9em; - font-weight: 600; - margin: 0 0 1em 0; - } - - input[type="text"], - input[type="password"], - input[type="email"], - select, - textarea { - -moz-appearance: none; - -webkit-appearance: none; - -ms-appearance: none; - appearance: none; - background: rgba(144, 144, 144, 0.25); - border-radius: 3px; - border: none; - color: inherit; - display: block; - outline: 0; - padding: 0 1em; - text-decoration: none; - width: 100%; - } - - input[type="text"]:invalid, - input[type="password"]:invalid, - input[type="email"]:invalid, - select:invalid, - textarea:invalid { - box-shadow: none; - } - - input[type="text"]:focus, - input[type="password"]:focus, - input[type="email"]:focus, - select:focus, - textarea:focus { - box-shadow: 0 0 0 2px #21b2a6; - } - - .select-wrapper { - text-decoration: none; - display: block; - position: relative; - } - - .select-wrapper:before { - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; - font-family: FontAwesome; - font-style: normal; - font-weight: normal; - text-transform: none !important; - } - - .select-wrapper:before { - -moz-pointer-events: none; - -webkit-pointer-events: none; - -ms-pointer-events: none; - pointer-events: none; - color: #fff; - content: '\f078'; - display: block; - height: 2.75em; - line-height: 2.75em; - position: absolute; - right: 0; - text-align: center; - top: 0; - width: 2.75em; - } - - .select-wrapper select::-ms-expand { - display: none; - } - - input[type="text"], - input[type="password"], - input[type="email"], - select { - height: 2.75em; - } - - textarea { - padding: 0.75em 1em; - } - - input[type="checkbox"], - input[type="radio"] { - -moz-appearance: none; - -webkit-appearance: none; - -ms-appearance: none; - appearance: none; - display: block; - float: left; - margin-right: -2em; - opacity: 0; - width: 1em; - z-index: -1; - } - - input[type="checkbox"] + label, - input[type="radio"] + label { - text-decoration: none; - color: #fff; - cursor: pointer; - display: inline-block; - font-size: 1em; - font-weight: 400; - padding-left: 2.4em; - padding-right: 0.75em; - position: relative; - } - - input[type="checkbox"] + label:before, - input[type="radio"] + label:before { - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; - font-family: FontAwesome; - font-style: normal; - font-weight: normal; - text-transform: none !important; - } - - input[type="checkbox"] + label:before, - input[type="radio"] + label:before { - background: rgba(144, 144, 144, 0.25); - border-radius: 3px; - content: ''; - display: inline-block; - height: 1.65em; - left: 0; - line-height: 1.58125em; - position: absolute; - text-align: center; - top: 0; - width: 1.65em; - } - - input[type="checkbox"]:checked + label:before, - input[type="radio"]:checked + label:before { - background: #2e3842; - color: #fff; - content: '\f00c'; - } - - input[type="checkbox"]:focus + label:before, - input[type="radio"]:focus + label:before { - box-shadow: 0 0 0 2px #21b2a6; - } - - input[type="checkbox"] + label:before { - border-radius: 3px; - } - - input[type="radio"] + label:before { - border-radius: 100%; - } - - ::-webkit-input-placeholder { - color: rgba(255, 255, 255, 0.5) !important; - opacity: 1.0; - } - - :-moz-placeholder { - color: rgba(255, 255, 255, 0.5) !important; - opacity: 1.0; - } - - ::-moz-placeholder { - color: rgba(255, 255, 255, 0.5) !important; - opacity: 1.0; - } - - :-ms-input-placeholder { - color: rgba(255, 255, 255, 0.5) !important; - opacity: 1.0; - } - - .formerize-placeholder { - color: rgba(255, 255, 255, 0.5) !important; - opacity: 1.0; - } - -/* Box */ - - .box { - border-radius: 3px; - border: solid 2px #fff; - margin-bottom: 2em; - padding: 1.5em; - } - - .box > :last-child, - .box > :last-child > :last-child, - .box > :last-child > :last-child > :last-child { - margin-bottom: 0; - } - - .box.alt { - border: 0; - border-radius: 0; - padding: 0; - } - -/* Icon */ - - .icon { - text-decoration: none; - border-bottom: none; - position: relative; - } - - .icon:before { - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; - font-family: FontAwesome; - font-style: normal; - font-weight: normal; - text-transform: none !important; - } - - .icon > .label { - display: none; - } - - .icon.major { - -moz-transform: rotate(-45deg); - -webkit-transform: rotate(-45deg); - -ms-transform: rotate(-45deg); - transform: rotate(-45deg); - border-radius: 3px; - border: solid 2px #fff; - display: inline-block; - font-size: 1.35em; - height: calc(3em + 2px); - line-height: 3em; - text-align: center; - width: calc(3em + 2px); - } - - .icon.major:before { - -moz-transform: rotate(45deg); - -webkit-transform: rotate(45deg); - -ms-transform: rotate(45deg); - transform: rotate(45deg); - display: inline-block; - font-size: 1.5em; - } - - @media screen and (max-width: 736px) { - - .icon.major { - font-size: 1em; - } - - } - - .icon.style1 { - color: #00ffcc; - } - - .icon.style2 { - color: #00f0ff; - } - - .icon.style3 { - color: #76ddff; - } - -/* Image */ - - .image { - border-radius: 3px; - border: 0; - display: inline-block; - position: relative; - } - - .image img { - border-radius: 3px; - display: block; - } - - .image.left { - float: left; - margin: 0 2em 2em 0; - top: 0.25em; - } - - .image.right { - float: right; - margin: 0 0 2em 2em; - top: 0.25em; - } - - .image.left, .image.right { - max-width: 40%; - } - - .image.left img, .image.right img { - width: 100%; - } - - .image.fit { - display: block; - margin: 0 0 2em 0; - width: 100%; - } - - .image.fit img { - width: 100%; - } - -/* List */ - - ol { - list-style: decimal; - margin: 0 0 2em 0; - padding-left: 1.25em; - } - - ol li { - padding-left: 0.25em; - } - - ul { - list-style: disc; - margin: 0 0 2em 0; - padding-left: 1em; - } - - ul li { - padding-left: 0.5em; - } - - ul.alt { - list-style: none; - padding-left: 0; - } - - ul.alt li { - border-top: solid 1px #fff; - padding: 0.5em 0; - } - - ul.alt li:first-child { - border-top: 0; - padding-top: 0; - } - - ul.icons { - cursor: default; - list-style: none; - padding-left: 0; - } - - ul.icons li { - display: inline-block; - padding: 0 1em 0 0; - } - - ul.icons li:last-child { - padding-right: 0 !important; - } - - ul.icons.major { - padding: 1em 0; - } - - ul.icons.major li { - padding-right: 3.5em; - } - - @media screen and (max-width: 736px) { - - ul.icons.major li { - padding: 0 1em !important; - } - - } - - ul.actions { - cursor: default; - list-style: none; - padding-left: 0; - } - - ul.actions li { - display: inline-block; - padding: 0 1.5em 0 0; - vertical-align: middle; - } - - ul.actions li:last-child { - padding-right: 0; - } - - ul.actions.small li { - padding: 0 0.75em 0 0; - } - - ul.actions.vertical li { - display: block; - padding: 1.5em 0 0 0; - } - - ul.actions.vertical li:first-child { - padding-top: 0; - } - - ul.actions.vertical li > * { - margin-bottom: 0; - } - - ul.actions.vertical.small li { - padding: 0.75em 0 0 0; - } - - ul.actions.vertical.small li:first-child { - padding-top: 0; - } - - ul.actions.fit { - display: table; - margin-left: -1.5em; - padding: 0; - table-layout: fixed; - width: calc(100% + 1.5em); - } - - ul.actions.fit li { - display: table-cell; - padding: 0 0 0 1.5em; - } - - ul.actions.fit li > * { - margin-bottom: 0; - } - - ul.actions.fit.small { - margin-left: -0.75em; - width: calc(100% + 0.75em); - } - - ul.actions.fit.small li { - padding: 0 0 0 0.75em; - } - - @media screen and (max-width: 736px) { - - ul.actions li { - display: block; - padding: 1em 0 0 0; - text-align: center; - width: 100%; - } - - ul.actions li:first-child { - padding-top: 0; - } - - ul.actions li > * { - margin: 0 auto !important; - max-width: 30em; - width: 100%; - } - - ul.actions li > *.icon:before { - margin-left: -1em; - } - - ul.actions.small li { - padding: 0.5em 0 0 0; - } - - ul.actions.small li:first-child { - padding-top: 0; - } - - } - - dl { - margin: 0 0 2em 0; - } - -/* Table */ - - .table-wrapper { - -webkit-overflow-scrolling: touch; - overflow-x: auto; - } - - table { - margin: 0 0 2em 0; - width: 100%; - } - - table tbody tr { - border: solid 1px #fff; - border-left: 0; - border-right: 0; - } - - table tbody tr:nth-child(2n + 1) { - background-color: rgba(144, 144, 144, 0.25); - } - - table td { - padding: 0.75em 0.75em; - } - - table th { - color: #fff; - font-size: 0.9em; - font-weight: 600; - padding: 0 0.75em 0.75em 0.75em; - text-align: left; - } - - table thead { - border-bottom: solid 2px #fff; - } - - table tfoot { - border-top: solid 2px #fff; - } - - table.alt { - border-collapse: separate; - } - - table.alt tbody tr td { - border: solid 1px #fff; - border-left-width: 0; - border-top-width: 0; - } - - table.alt tbody tr td:first-child { - border-left-width: 1px; - } - - table.alt tbody tr:first-child td { - border-top-width: 1px; - } - - table.alt thead { - border-bottom: 0; - } - - table.alt tfoot { - border-top: 0; - } - -/* Button */ - - input[type="submit"], - input[type="reset"], - input[type="button"], - button, - .button { - -moz-appearance: none; - -webkit-appearance: none; - -ms-appearance: none; - appearance: none; - -moz-transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out; - -webkit-transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out; - -ms-transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out; - transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out; - background-color: transparent; - border-radius: 3px; - border: 0; - box-shadow: inset 0 0 0 2px #fff; - color: #fff; - cursor: pointer; - display: inline-block; - font-size: 0.8em; - font-weight: 600; - height: 3.125em; - letter-spacing: 0.225em; - line-height: 3.125em; - padding: 0 2.75em; - text-align: center; - text-decoration: none; - text-transform: uppercase; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } - - input[type="submit"]:hover, - input[type="reset"]:hover, - input[type="button"]:hover, - button:hover, - .button:hover { - background-color: rgba(144, 144, 144, 0.25); - } - - input[type="submit"]:active, - input[type="reset"]:active, - input[type="button"]:active, - button:active, - .button:active { - background-color: rgba(144, 144, 144, 0.5); - } - - input[type="submit"].icon:before, - input[type="reset"].icon:before, - input[type="button"].icon:before, - button.icon:before, - .button.icon:before { - margin-right: 0.5em; - } - - input[type="submit"].fit, - input[type="reset"].fit, - input[type="button"].fit, - button.fit, - .button.fit { - display: block; - margin: 0 0 1em 0; - width: 100%; - } - - input[type="submit"].small, - input[type="reset"].small, - input[type="button"].small, - button.small, - .button.small { - font-size: 0.8em; - } - - input[type="submit"].big, - input[type="reset"].big, - input[type="button"].big, - button.big, - .button.big { - font-size: 1.35em; - } - - input[type="submit"].special, - input[type="reset"].special, - input[type="button"].special, - button.special, - .button.special { - background-color: #ed4933; - box-shadow: none !important; - color: #ffffff !important; - } - - input[type="submit"].special:hover, - input[type="reset"].special:hover, - input[type="button"].special:hover, - button.special:hover, - .button.special:hover { - background-color: #ef5e4a !important; - } - - input[type="submit"].special:active, - input[type="reset"].special:active, - input[type="button"].special:active, - button.special:active, - .button.special:active { - background-color: #eb341c !important; - } - - input[type="submit"].disabled, input[type="submit"]:disabled, - input[type="reset"].disabled, - input[type="reset"]:disabled, - input[type="button"].disabled, - input[type="button"]:disabled, - button.disabled, - button:disabled, - .button.disabled, - .button:disabled { - -moz-pointer-events: none; - -webkit-pointer-events: none; - -ms-pointer-events: none; - pointer-events: none; - opacity: 0.25; - } - - @media screen and (max-width: 736px) { - - input[type="submit"], - input[type="reset"], - input[type="button"], - button, - .button { - height: 3.75em; - line-height: 3.75em; - } - - } - -/* Features */ - - .features { - display: -moz-flex; - display: -webkit-flex; - display: -ms-flex; - display: flex; - -moz-flex-wrap: wrap; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; - flex-wrap: wrap; - -moz-justify-content: center; - -webkit-justify-content: center; - -ms-justify-content: center; - justify-content: center; - list-style: none; - padding: 0; - width: 100%; - } - - .features li { - padding: 4em 4em 2em 6em ; - display: block; - position: relative; - text-align: left; - width: 50%; - } - - .features li:nth-child(1) { - background-color: rgba(0, 0, 0, 0.035); - } - - .features li:nth-child(2) { - background-color: rgba(0, 0, 0, 0.07); - } - - .features li:nth-child(3) { - background-color: rgba(0, 0, 0, 0.105); - } - - .features li:nth-child(4) { - background-color: rgba(0, 0, 0, 0.14); - } - - .features li:nth-child(5) { - background-color: rgba(0, 0, 0, 0.175); - } - - .features li:nth-child(6) { - background-color: rgba(0, 0, 0, 0.21); - } - - .features li:nth-child(7) { - background-color: rgba(0, 0, 0, 0.245); - } - - .features li:nth-child(8) { - background-color: rgba(0, 0, 0, 0.28); - } - - .features li:nth-child(9) { - background-color: rgba(0, 0, 0, 0.315); - } - - .features li:nth-child(10) { - background-color: rgba(0, 0, 0, 0.35); - } - - .features li:before { - display: block; - color: #00ffcc; - position: absolute; - left: 1.75em; - top: 2.75em; - font-size: 1.5em; - } - - .features li:nth-child(1) { - border-top-left-radius: 3px; - } - - .features li:nth-child(2) { - border-top-right-radius: 3px; - } - - .features li:nth-last-child(1) { - border-bottom-right-radius: 3px; - } - - .features li:nth-last-child(2) { - border-bottom-left-radius: 3px; - } - - @media screen and (max-width: 980px) { - - .features li { - padding: 3em 2em 1em 2em ; - text-align: center; - } - - .features li:before { - left: 0; - margin: 0 0 1em 0; - position: relative; - top: 0; - } - - } - - @media screen and (max-width: 736px) { - - .features li { - padding: 3em 0 1em 0 ; - background-color: transparent !important; - border-top: solid 2px #fff; - width: 100%; - } - - .features li:first-child { - border-top: 0; - } - - } - -/* Spotlight */ - - .spotlight { - -moz-align-items: center; - -webkit-align-items: center; - -ms-align-items: center; - align-items: center; - display: -moz-flex; - display: -webkit-flex; - display: -ms-flex; - display: flex; - } - - .spotlight .image { - -moz-order: 1; - -webkit-order: 1; - -ms-order: 1; - order: 1; - border-radius: 0; - width: 40%; - } - - .spotlight .image img { - border-radius: 0; - width: 100%; - } - - .spotlight .content { - padding: 2em 4em 0.1em 4em ; - -moz-order: 2; - -webkit-order: 2; - -ms-order: 2; - order: 2; - max-width: 48em; - width: 60%; - } - - .spotlight:nth-child(2n) { - -moz-flex-direction: row-reverse; - -webkit-flex-direction: row-reverse; - -ms-flex-direction: row-reverse; - flex-direction: row-reverse; - } - - .spotlight:nth-child(1) { - background-color: rgba(0, 0, 0, 0.075); - } - - .spotlight:nth-child(2) { - background-color: rgba(0, 0, 0, 0.15); - } - - .spotlight:nth-child(3) { - background-color: rgba(0, 0, 0, 0.225); - } - - .spotlight:nth-child(4) { - background-color: rgba(0, 0, 0, 0.3); - } - - .spotlight:nth-child(5) { - background-color: rgba(0, 0, 0, 0.375); - } - - .spotlight:nth-child(6) { - background-color: rgba(0, 0, 0, 0.45); - } - - .spotlight:nth-child(7) { - background-color: rgba(0, 0, 0, 0.525); - } - - .spotlight:nth-child(8) { - background-color: rgba(0, 0, 0, 0.6); - } - - .spotlight:nth-child(9) { - background-color: rgba(0, 0, 0, 0.675); - } - - .spotlight:nth-child(10) { - background-color: rgba(0, 0, 0, 0.75); - } - - @media screen and (max-width: 1280px) { - - .spotlight .image { - width: 45%; - } - - .spotlight .content { - width: 55%; - } - - } - - @media screen and (max-width: 980px) { - - .spotlight { - display: block; - } - - .spotlight br { - display: none; - } - - .spotlight .image { - width: 100%; - } - - .spotlight .content { - padding: 4em 3em 2em 3em ; - max-width: none; - text-align: center; - width: 100%; - } - - } - - @media screen and (max-width: 736px) { - - .spotlight .content { - padding: 3em 2em 1em 2em ; - } - - } - -/* Wrapper */ - - .wrapper { - padding: 6em 0 4em 0 ; - } - - .wrapper > .inner { - width: 60em; - margin: 0 auto; - } - - @media screen and (max-width: 1280px) { - - .wrapper > .inner { - width: 90%; - } - - } - - @media screen and (max-width: 980px) { - - .wrapper > .inner { - width: 100%; - } - - } - - .wrapper.alt { - padding: 0; - } - - .wrapper.style1 { - background-color: #21b2a6; - color: #c7ebe8; - } - - .wrapper.style1 strong, .wrapper.style1 b { - color: #ffffff; - } - - .wrapper.style1 h2, .wrapper.style1 h3, .wrapper.style1 h4, .wrapper.style1 h5, .wrapper.style1 h6 { - color: #ffffff; - } - - .wrapper.style1 hr { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style1 blockquote { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style1 code { - background: rgba(255, 255, 255, 0.075); - } - - .wrapper.style1 header p { - color: #a6e0db; - } - - .wrapper.style1 header.major h2, .wrapper.style1 header.major h3, .wrapper.style1 header.major h4, .wrapper.style1 header.major h5, .wrapper.style1 header.major h6 { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style1 header.major p { - color: #c7ebe8; - } - - .wrapper.style1 label { - color: #ffffff; - } - - .wrapper.style1 input[type="text"], - .wrapper.style1 input[type="password"], - .wrapper.style1 input[type="email"], - .wrapper.style1 select, - .wrapper.style1 textarea { - background: rgba(255, 255, 255, 0.075); - } - - .wrapper.style1 .select-wrapper:before { - color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style1 input[type="checkbox"] + label, - .wrapper.style1 input[type="radio"] + label { - color: #c7ebe8; - } - - .wrapper.style1 input[type="checkbox"] + label:before, - .wrapper.style1 input[type="radio"] + label:before { - background: rgba(255, 255, 255, 0.075); - } - - .wrapper.style1 input[type="checkbox"]:checked + label:before, - .wrapper.style1 input[type="radio"]:checked + label:before { - background: #ffffff; - color: #21b2a6; - } - - .wrapper.style1 ::-webkit-input-placeholder { - color: #a6e0db !important; - } - - .wrapper.style1 :-moz-placeholder { - color: #a6e0db !important; - } - - .wrapper.style1 ::-moz-placeholder { - color: #a6e0db !important; - } - - .wrapper.style1 :-ms-input-placeholder { - color: #a6e0db !important; - } - - .wrapper.style1 .formerize-placeholder { - color: #a6e0db !important; - } - - .wrapper.style1 .icon.major { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style1 ul.alt li { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style1 table tbody tr { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style1 table tbody tr:nth-child(2n + 1) { - background-color: rgba(255, 255, 255, 0.075); - } - - .wrapper.style1 table th { - color: #ffffff; - } - - .wrapper.style1 table thead { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style1 table tfoot { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style1 table.alt tbody tr td { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style1 input[type="submit"], - .wrapper.style1 input[type="reset"], - .wrapper.style1 input[type="button"], - .wrapper.style1 button, - .wrapper.style1 .button { - box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.125); - color: #ffffff; - } - - .wrapper.style1 input[type="submit"]:hover, - .wrapper.style1 input[type="reset"]:hover, - .wrapper.style1 input[type="button"]:hover, - .wrapper.style1 button:hover, - .wrapper.style1 .button:hover { - background-color: rgba(255, 255, 255, 0.075); - } - - .wrapper.style1 input[type="submit"]:active, - .wrapper.style1 input[type="reset"]:active, - .wrapper.style1 input[type="button"]:active, - .wrapper.style1 button:active, - .wrapper.style1 .button:active { - background-color: rgba(255, 255, 255, 0.2); - } - - @media screen and (max-width: 736px) { - - .wrapper.style1 .features li { - border-top-color: rgba(0, 0, 0, 0.125); - } - - } - - .wrapper.style2 { - background-color: #2e3842; - } - - .wrapper.style3 { - background-color: #505393; - color: #d3d4e4; - } - - .wrapper.style3 strong, .wrapper.style3 b { - color: #ffffff; - } - - .wrapper.style3 h2, .wrapper.style3 h3, .wrapper.style3 h4, .wrapper.style3 h5, .wrapper.style3 h6 { - color: #ffffff; - } - - .wrapper.style3 hr { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style3 blockquote { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style3 code { - background: rgba(255, 255, 255, 0.075); - } - - .wrapper.style3 header p { - color: #b9bad3; - } - - .wrapper.style3 header.major h2, .wrapper.style3 header.major h3, .wrapper.style3 header.major h4, .wrapper.style3 header.major h5, .wrapper.style3 header.major h6 { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style3 header.major p { - color: #d3d4e4; - } - - .wrapper.style3 label { - color: #ffffff; - } - - .wrapper.style3 input[type="text"], - .wrapper.style3 input[type="password"], - .wrapper.style3 input[type="email"], - .wrapper.style3 select, - .wrapper.style3 textarea { - background: rgba(255, 255, 255, 0.075); - } - - .wrapper.style3 .select-wrapper:before { - color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style3 input[type="checkbox"] + label, - .wrapper.style3 input[type="radio"] + label { - color: #d3d4e4; - } - - .wrapper.style3 input[type="checkbox"] + label:before, - .wrapper.style3 input[type="radio"] + label:before { - background: rgba(255, 255, 255, 0.075); - } - - .wrapper.style3 input[type="checkbox"]:checked + label:before, - .wrapper.style3 input[type="radio"]:checked + label:before { - background: #ffffff; - color: #505393; - } - - .wrapper.style3 ::-webkit-input-placeholder { - color: #b9bad3 !important; - } - - .wrapper.style3 :-moz-placeholder { - color: #b9bad3 !important; - } - - .wrapper.style3 ::-moz-placeholder { - color: #b9bad3 !important; - } - - .wrapper.style3 :-ms-input-placeholder { - color: #b9bad3 !important; - } - - .wrapper.style3 .formerize-placeholder { - color: #b9bad3 !important; - } - - .wrapper.style3 .icon.major { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style3 ul.alt li { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style3 table tbody tr { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style3 table tbody tr:nth-child(2n + 1) { - background-color: rgba(255, 255, 255, 0.075); - } - - .wrapper.style3 table th { - color: #ffffff; - } - - .wrapper.style3 table thead { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style3 table tfoot { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style3 table.alt tbody tr td { - border-color: rgba(0, 0, 0, 0.125); - } - - .wrapper.style3 input[type="submit"], - .wrapper.style3 input[type="reset"], - .wrapper.style3 input[type="button"], - .wrapper.style3 button, - .wrapper.style3 .button { - box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.125); - color: #ffffff; - } - - .wrapper.style3 input[type="submit"]:hover, - .wrapper.style3 input[type="reset"]:hover, - .wrapper.style3 input[type="button"]:hover, - .wrapper.style3 button:hover, - .wrapper.style3 .button:hover { - background-color: rgba(255, 255, 255, 0.075); - } - - .wrapper.style3 input[type="submit"]:active, - .wrapper.style3 input[type="reset"]:active, - .wrapper.style3 input[type="button"]:active, - .wrapper.style3 button:active, - .wrapper.style3 .button:active { - background-color: rgba(255, 255, 255, 0.2); - } - - @media screen and (max-width: 736px) { - - .wrapper.style3 .features li { - border-top-color: rgba(0, 0, 0, 0.125); - } - - } - - .wrapper.style4 { - background-color: transparent; - } - - .wrapper.style5 { - background-color: #ffffff; - color: #4E4852; - } - - .wrapper.style5 strong, .wrapper.style5 b { - color: #2E3842; - } - - .wrapper.style5 h2, .wrapper.style5 h3, .wrapper.style5 h4, .wrapper.style5 h5, .wrapper.style5 h6 { - color: #2E3842; - } - - .wrapper.style5 hr { - border-color: #dfdfdf; - } - - .wrapper.style5 blockquote { - border-color: #dfdfdf; - } - - .wrapper.style5 code { - background: rgba(0, 0, 0, 0.0375); - } - - .wrapper.style5 header p { - color: #8E8892; - } - - .wrapper.style5 header.major h2, .wrapper.style5 header.major h3, .wrapper.style5 header.major h4, .wrapper.style5 header.major h5, .wrapper.style5 header.major h6 { - border-color: #dfdfdf; - } - - .wrapper.style5 header.major p { - color: #4E4852; - } - - .wrapper.style5 label { - color: #2E3842; - } - - .wrapper.style5 input[type="text"], - .wrapper.style5 input[type="password"], - .wrapper.style5 input[type="email"], - .wrapper.style5 select, - .wrapper.style5 textarea { - background: rgba(0, 0, 0, 0.0375); - } - - .wrapper.style5 .select-wrapper:before { - color: #dfdfdf; - } - - .wrapper.style5 input[type="checkbox"] + label, - .wrapper.style5 input[type="radio"] + label { - color: #4E4852; - } - - .wrapper.style5 input[type="checkbox"] + label:before, - .wrapper.style5 input[type="radio"] + label:before { - background: rgba(0, 0, 0, 0.0375); - } - - .wrapper.style5 input[type="checkbox"]:checked + label:before, - .wrapper.style5 input[type="radio"]:checked + label:before { - background: #2E3842; - color: #ffffff; - } - - .wrapper.style5 ::-webkit-input-placeholder { - color: #8E8892 !important; - } - - .wrapper.style5 :-moz-placeholder { - color: #8E8892 !important; - } - - .wrapper.style5 ::-moz-placeholder { - color: #8E8892 !important; - } - - .wrapper.style5 :-ms-input-placeholder { - color: #8E8892 !important; - } - - .wrapper.style5 .formerize-placeholder { - color: #8E8892 !important; - } - - .wrapper.style5 .icon.major { - border-color: #dfdfdf; - } - - .wrapper.style5 ul.alt li { - border-color: #dfdfdf; - } - - .wrapper.style5 table tbody tr { - border-color: #dfdfdf; - } - - .wrapper.style5 table tbody tr:nth-child(2n + 1) { - background-color: rgba(0, 0, 0, 0.0375); - } - - .wrapper.style5 table th { - color: #2E3842; - } - - .wrapper.style5 table thead { - border-color: #dfdfdf; - } - - .wrapper.style5 table tfoot { - border-color: #dfdfdf; - } - - .wrapper.style5 table.alt tbody tr td { - border-color: #dfdfdf; - } - - .wrapper.style5 input[type="submit"], - .wrapper.style5 input[type="reset"], - .wrapper.style5 input[type="button"], - .wrapper.style5 button, - .wrapper.style5 .button { - box-shadow: inset 0 0 0 2px #dfdfdf; - color: #2E3842; - } - - .wrapper.style5 input[type="submit"]:hover, - .wrapper.style5 input[type="reset"]:hover, - .wrapper.style5 input[type="button"]:hover, - .wrapper.style5 button:hover, - .wrapper.style5 .button:hover { - background-color: rgba(0, 0, 0, 0.0375); - } - - .wrapper.style5 input[type="submit"]:active, - .wrapper.style5 input[type="reset"]:active, - .wrapper.style5 input[type="button"]:active, - .wrapper.style5 button:active, - .wrapper.style5 .button:active { - background-color: rgba(0, 0, 0, 0.1); - } - - @media screen and (max-width: 736px) { - - .wrapper.style5 .features li { - border-top-color: #dfdfdf; - } - - } - - @media screen and (max-width: 980px) { - - .wrapper { - padding: 4em 3em 2em 3em ; - } - - } - - @media screen and (max-width: 736px) { - - .wrapper { - padding: 3em 2em 1em 2em ; - } - - } - -/* Page Wrapper + Menu */ - - #page-wrapper { - -moz-transition: opacity 0.5s ease; - -webkit-transition: opacity 0.5s ease; - -ms-transition: opacity 0.5s ease; - transition: opacity 0.5s ease; - opacity: 1; - padding-top: 3em; - } - - #page-wrapper:before { - background: transparent; - content: ''; - display: block; - display: none; - height: 100%; - left: 0; - position: fixed; - top: 0; - width: 100%; - z-index: 10001; - } - - #menu { - -moz-transform: translateX(20em); - -webkit-transform: translateX(20em); - -ms-transform: translateX(20em); - transform: translateX(20em); - -moz-transition: -moz-transform 0.5s ease; - -webkit-transition: -webkit-transform 0.5s ease; - -ms-transition: -ms-transform 0.5s ease; - transition: transform 0.5s ease; - -webkit-overflow-scrolling: touch; - background: rgba(0,0,0,0); - color: #ffffff; - height: 100%; - max-width: 80%; - overflow-y: auto; - padding: 3em 2em; - position: fixed; - right: 0; - top: 0; - width: 13em; - z-index: 10002; - } - - #menu ul { - list-style: none; - padding: 0; - } - - #menu ul > li { - border-top: solid 1px rgba(0, 0, 0, 0.125); - margin: 0.5em 0 0 0; - padding: 0.5em 0 0 0; - } - - #menu ul > li:first-child { - border-top: 0 !important; - margin-top: 0 !important; - padding-top: 0 !important; - } - - #menu ul > li > a { - border: 0; - color: #EEEEEE; - display: block; - font-size: 0.8em; - letter-spacing: 0.225em; - outline: 0; - text-decoration: none; - text-transform: uppercase; - } - - /*TODO transition highlight*/ - #menu ul > li > a :hover{ - -webkit-tap-highlight-color: rgba(0,0,0,0.3); - } - - @media screen and (max-width: 736px) { - - #menu ul > li > a { - line-height: 3em; - } - - } - - #menu .close { - background-image: url("images/close.svg"); - background-position: 4.85em 1em; - background-repeat: no-repeat; - border: 0; - cursor: pointer; - display: block; - height: 3em; - position: absolute; - right: 0; - top: 0; - vertical-align: middle; - width: 7em; - } - - @media screen and (max-width: 736px) { - - #menu { - padding: 3em 1.5em; - } - - } - - body.is-menu-visible #page-wrapper { - opacity: 0.35; - } - - body.is-menu-visible #page-wrapper:before { - display: block; - } - - body.is-menu-visible #menu { - -moz-transform: translateX(0); - -webkit-transform: translateX(0); - -ms-transform: translateX(0); - transform: translateX(0); - } - - body.is-menu-visible #menuToggle { - opacity: 0; - transition: opacity 370ms; - } - - /*ACM-font*/ - @font-face { - font-family: 'ACM font'; - src: url('../fonts/acm.ttf'); - } - - .acmfont { - position: absolute; - z-index: 11; - font-family: "ACM font"; - font-size: 9em; - } - -/* Header */ - - #header { - -moz-transition: background-color 0.2s ease; - -webkit-transition: background-color 0.2s ease; - -ms-transition: background-color 0.2s ease; - transition: background-color 0.2s ease; - background: #232323; - height: 3em; - left: 0; - line-height: 3em; - position: fixed; - top: 0; - width: 100%; - z-index: 10000; - } - - #header h1 { - -moz-transition: opacity 0.2s ease; - -webkit-transition: opacity 0.2s ease; - -ms-transition: opacity 0.2s ease; - transition: opacity 0.2s ease; - height: inherit; - left: 1.25em; - line-height: inherit; - position: absolute; - top: 0; - } - - #header h1 a { - border: 0; - display: block; - height: inherit; - line-height: inherit; - } - - @media screen and (max-width: 736px) { - - #header h1 a { - font-size: 0.8em; - } - - } - - #header nav { - height: inherit; - line-height: inherit; - position: absolute; - right: 0; - top: 0; - } - - #header nav > ul { - list-style: none; - margin: 0; - padding: 0; - white-space: nowrap; - } - - #header nav > ul > li { - display: inline-block; - padding: 0; - } - - #header nav > ul > li > a { - border: 0; - color: #fff; - display: block; - font-size: 0.8em; - letter-spacing: 0.225em; - padding: 0 1.5em; - text-transform: uppercase; - } - - #header nav > ul > li > a.menuToggle { - outline: 0; - position: relative; - } - - #header nav > ul > li > a.menuToggle:after { - background-image: url("images/bars.svg"); - background-position: right center; - background-repeat: no-repeat; - content: ''; - display: inline-block; - height: 3.75em; - vertical-align: top; - width: 2em; - } - - @media screen and (max-width: 736px) { - - #header nav > ul > li > a.menuToggle { - padding: 0 1.5em; - } - - #header nav > ul > li > a.menuToggle span { - display: none; - } - - } - - @media screen and (max-width: 736px) { - - #header nav > ul > li > a { - padding: 0 0 0 1.5em; - } - - } - - #header nav > ul > li:first-child { - margin-left: 0; - } - - #header.alt { - background: transparent; - } - - #header.alt h1 { - -moz-pointer-events: none; - -webkit-pointer-events: none; - -ms-pointer-events: none; - pointer-events: none; - opacity: 0; - } - -/* Banner */ - - /*#banner {*/ - /*display: -moz-flex;*/ - /*display: -webkit-flex;*/ - /*display: -ms-flex;*/ - /*display: flex;*/ - /*-moz-flex-direction: column;*/ - /*-webkit-flex-direction: column;*/ - /*-ms-flex-direction: column;*/ - /*flex-direction: column;*/ - /*-moz-justify-content: center;*/ - /*-webkit-justify-content: center;*/ - /*-ms-justify-content: center;*/ - /*justify-content: center;*/ - /*cursor: default;*/ - /*height: 100vh;*/ - /*min-height: 35em;*/ - /*overflow: hidden;*/ - /*position: relative;*/ - /*text-align: center;*/ - /*}*/ - - /*#banner h2 {*/ - /*-moz-transform: scale(1);*/ - /*-webkit-transform: scale(1);*/ - /*-ms-transform: scale(1);*/ - /*transform: scale(1);*/ - /*-moz-transition: -moz-transform 0.5s ease, opacity 0.5s ease;*/ - /*-webkit-transition: -webkit-transform 0.5s ease, opacity 0.5s ease;*/ - /*-ms-transition: -ms-transform 0.5s ease, opacity 0.5s ease;*/ - /*transition: transform 0.5s ease, opacity 0.5s ease;*/ - /*display: inline-block;*/ - /*font-size: 1.75em;*/ - /*opacity: 1;*/ - /*padding: 0.35em 1em;*/ - /*position: relative;*/ - /*z-index: 1;*/ - /*}*/ - - /*#banner h2:before, #banner h2:after {*/ - /*-moz-transition: width 0.85s ease;*/ - /*-webkit-transition: width 0.85s ease;*/ - /*-ms-transition: width 0.85s ease;*/ - /*transition: width 0.85s ease;*/ - /*-moz-transition-delay: 0.25s;*/ - /*-webkit-transition-delay: 0.25s;*/ - /*-ms-transition-delay: 0.25s;*/ - /*transition-delay: 0.25s;*/ - /*background: #fff;*/ - /*content: '';*/ - /*display: block;*/ - /*height: 2px;*/ - /*position: absolute;*/ - /*width: 100%;*/ - /*}*/ - - /*#banner h2:before {*/ - /*top: 0;*/ - /*left: 0;*/ - /*}*/ - - /*#banner h2:after {*/ - /*bottom: 0;*/ - /*right: 0;*/ - /*}*/ - - /*#banner p {*/ - /*letter-spacing: 0.225em;*/ - /*text-transform: uppercase;*/ - /*}*/ - - /*#banner p a {*/ - /*color: inherit;*/ - /*}*/ - - /*#banner .more {*/ - /*-moz-transition: -moz-transform 0.75s ease, opacity 0.75s ease;*/ - /*-webkit-transition: -webkit-transform 0.75s ease, opacity 0.75s ease;*/ - /*-ms-transition: -ms-transform 0.75s ease, opacity 0.75s ease;*/ - /*transition: transform 0.75s ease, opacity 0.75s ease;*/ - /*-moz-transition-delay: 3.5s;*/ - /*-webkit-transition-delay: 3.5s;*/ - /*-ms-transition-delay: 3.5s;*/ - /*transition-delay: 3.5s;*/ - /*-moz-transform: translateY(0);*/ - /*-webkit-transform: translateY(0);*/ - /*-ms-transform: translateY(0);*/ - /*transform: translateY(0);*/ - /*border: none;*/ - /*bottom: 0;*/ - /*color: inherit;*/ - /*font-size: 0.8em;*/ - /*height: 8.5em;*/ - /*left: 50%;*/ - /*letter-spacing: 0.225em;*/ - /*margin-left: -8.5em;*/ - /*opacity: 1;*/ - /*outline: 0;*/ - /*padding-left: 0.225em;*/ - /*position: absolute;*/ - /*text-align: center;*/ - /*text-transform: uppercase;*/ - /*width: 16em;*/ - /*z-index: 1;*/ - /*}*/ - - /*#banner .more:after {*/ - /*background-image: url("images/arrow.svg");*/ - /*background-position: center;*/ - /*background-repeat: no-repeat;*/ - /*background-size: contain;*/ - /*bottom: 4em;*/ - /*content: '';*/ - /*display: block;*/ - /*height: 1.5em;*/ - /*left: 50%;*/ - /*margin: 0 0 0 -0.75em;*/ - /*position: absolute;*/ - /*width: 1.5em;*/ - /*}*/ - - /*#banner:after {*/ - /*-moz-pointer-events: none;*/ - /*-webkit-pointer-events: none;*/ - /*-ms-pointer-events: none;*/ - /*pointer-events: none;*/ - /*-moz-transition: opacity 3s ease-in-out;*/ - /*-webkit-transition: opacity 3s ease-in-out;*/ - /*-ms-transition: opacity 3s ease-in-out;*/ - /*transition: opacity 3s ease-in-out;*/ - /*-moz-transition-delay: 1.25s;*/ - /*-webkit-transition-delay: 1.25s;*/ - /*-ms-transition-delay: 1.25s;*/ - /*transition-delay: 1.25s;*/ - /*content: '';*/ - /*background: #2e3842;*/ - /*display: block;*/ - /*width: 100%;*/ - /*height: 100%;*/ - /*position: absolute;*/ - /*left: 0;*/ - /*top: 0;*/ - /*opacity: 0;*/ - /*}*/ - - /*@media screen and (max-width: 736px) {*/ - - /*#banner {*/ - /*padding: 7em 3em 5em 3em ;*/ - /*height: auto;*/ - /*min-height: 0;*/ - /*}*/ - - /*#banner h2 {*/ - /*font-size: 1.25em;*/ - /*}*/ - - /*#banner br {*/ - /*display: none;*/ - /*}*/ - - /*#banner .more {*/ - /*display: none;*/ - /*}*/ - - /*}*/ - - /*body.is-loading #banner h2 {*/ - /*-moz-transform: scale(0.95);*/ - /*-webkit-transform: scale(0.95);*/ - /*-ms-transform: scale(0.95);*/ - /*transform: scale(0.95);*/ - /*opacity: 0;*/ - /*}*/ - - /*body.is-loading #banner h2:before, body.is-loading #banner h2:after {*/ - /*width: 0;*/ - /*}*/ - - /*body.is-loading #banner .more {*/ - /*-moz-transform: translateY(8.5em);*/ - /*-webkit-transform: translateY(8.5em);*/ - /*-ms-transform: translateY(8.5em);*/ - /*transform: translateY(8.5em);*/ - /*opacity: 0;*/ - /*}*/ - - /*body.is-loading #banner:after {*/ - /*opacity: 1;*/ - /*}*/ - - #beforebanner{ - width: 0px; - display: block; - height: 100%; - background: #232323; - position: absolute; - } - - #banner{ - left: 0px; - width: 100%; - display: block; - height: 100%; - background: #880000; - color: #fff; - text-align: center; - position: relative; - } - #banner:before{ - content: ""; - position: absolute; - left: 0; - top: 0; - width: 400px; - height: 100%; - background: #232323; - z-index: 10; - } - #banner:after { - position: absolute; - content: ''; - top: 0; - left: 400px; - border-style: solid; - border-width: 335.5px; - border-color: #232323 transparent transparent #232323; - z-index: 10; - } - -/* CTA */ - - #cta .inner { - display: -moz-flex; - display: -webkit-flex; - display: -ms-flex; - display: flex; - max-width: 45em; - } - - #cta .inner header { - -moz-order: 1; - -webkit-order: 1; - -ms-order: 1; - order: 1; - padding-right: 3em; - width: 70%; - } - - #cta .inner header p { - color: inherit; - } - - #cta .inner .actions { - -moz-order: 2; - -webkit-order: 2; - -ms-order: 2; - order: 2; - width: 30%; - } - - @media screen and (max-width: 980px) { - - #cta .inner { - display: block; - text-align: center; - } - - #cta .inner header { - padding-right: 0; - width: 100%; - } - - #cta .inner .actions { - margin-left: auto; - margin-right: auto; - max-width: 20em; - width: 100%; - } - - } - - @media screen and (max-width: 736px) { - - #cta .inner .actions { - max-width: none; - } - - } - -/* Main */ - - #main > header { - padding: 12em 0 10em 0 ; - background-image: -moz-linear-gradient(top, rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("../../images/banner.jpg"); - background-image: -webkit-linear-gradient(top, rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("../../images/banner.jpg"); - background-image: -ms-linear-gradient(top, rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("../../images/banner.jpg"); - background-image: linear-gradient(top, rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("../../images/banner.jpg"); - background-attachment: fixed; - background-position: center center; - background-repeat: no-repeat; - background-size: cover; - text-align: center; - } - - #main > header h2 { - font-size: 1.75em; - margin: 0 0 0.5em 0; - } - - #main > header p { - color: inherit; - letter-spacing: 0.225em; - text-transform: uppercase; - top: 0; - } - - #main > header p a { - color: inherit; - } - - @media screen and (max-width: 1680px) { - - #main > header { - padding: 10em 0 8em 0 ; - } - - } - - @media screen and (max-width: 1280px) { - - #main > header { - padding: 8em 3em 6em 3em ; - } - - } - - @media screen and (max-width: 980px) { - - #main > header { - padding: 10em 3em 8em 3em ; - } - - } - - @media screen and (max-width: 736px) { - - #main > header { - padding: 5em 3em 3em 3em ; - } - - #main > header h2 { - font-size: 1.25em; - margin: 0 0 1em 0; - } - - } - - body.is-mobile #main > header { - background-attachment: scroll; - } - -/* Footer */ - - #footer { - padding: 6em 0 4em 0 ; - background-color: #1d242a; - text-align: center; - } - - #footer .icons { - font-size: 1.25em; - } - - #footer .icons a { - color: rgba(255, 255, 255, 0.5); - } - - #footer .icons a:hover { - color: #fff; - } - - #footer .copyright { - color: rgba(255, 255, 255, 0.5); - font-size: 0.8em; - letter-spacing: 0.225em; - list-style: none; - padding: 0; - text-transform: uppercase; - } - - #footer .copyright li { - border-left: solid 1px rgba(255, 255, 255, 0.5); - display: inline-block; - line-height: 1em; - margin-left: 1em; - padding-left: 1em; - } - - #footer .copyright li:first-child { - border-left: 0; - margin-left: 0; - padding-left: 0; - } - - #footer .copyright li a { - color: inherit; - } - - #footer .copyright li a:hover { - color: #fff; - } - - @media screen and (max-width: 480px) { - - #footer .copyright li { - border: 0; - display: block; - line-height: 1.65em; - margin: 0; - padding: 0.5em 0; - } - - } - - @media screen and (max-width: 980px) { - - #footer { - padding: 4em 3em 2em 3em ; - } - - } - - @media screen and (max-width: 736px) { - - #footer { - padding: 3em 2em 1em 2em ; - } - - } - -/* Landing */ - - body.landing #page-wrapper { - /*background-image: -moz-linear-gradient(top, rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("../../images/banner.jpg");*/ - /*background-image: -webkit-linear-gradient(top, rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("../../images/banner.jpg");*/ - /*background-image: -ms-linear-gradient(top, rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("../../images/banner.jpg");*/ - /*background-image: linear-gradient(top, rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("../../images/banner.jpg");*/ - /*background-attachment: fixed;*/ - /*background-position: center center;*/ - /*background-repeat: no-repeat;*/ - background-size: cover; - padding-top: 0; - } - - body.landing #footer { - background-color: rgba(29, 36, 42, 0.9); - } - - body.is-mobile.landing #page-wrapper { - background: none; - } - - /*body.is-mobile.landing #banner,*/ - /*body.is-mobile.landing .wrapper.style4 {*/ - /*background-image: -moz-linear-gradient(top, rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("../../images/banner.jpg");*/ - /*background-image: -webkit-linear-gradient(top, rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("../../images/banner.jpg");*/ - /*background-image: -ms-linear-gradient(top, rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("../../images/banner.jpg");*/ - /*background-image: linear-gradient(top, rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url("../../images/banner.jpg");*/ - /*background-position: center center;*/ - /*background-repeat: no-repeat;*/ - /*background-size: cover;*/ - /*}*/ - - body.is-mobile.landing #footer { - background-color: #1d242a; - } \ No newline at end of file diff --git a/back_end/page/assets/fonts/FontAwesome.otf b/back_end/page/assets/fonts/FontAwesome.otf deleted file mode 100644 index d4de13e83..000000000 Binary files a/back_end/page/assets/fonts/FontAwesome.otf and /dev/null differ diff --git a/back_end/page/assets/fonts/acm.ttf b/back_end/page/assets/fonts/acm.ttf deleted file mode 100644 index ae5a14107..000000000 Binary files a/back_end/page/assets/fonts/acm.ttf and /dev/null differ diff --git a/back_end/page/assets/fonts/fontawesome-webfont.eot b/back_end/page/assets/fonts/fontawesome-webfont.eot deleted file mode 100644 index c7b00d2ba..000000000 Binary files a/back_end/page/assets/fonts/fontawesome-webfont.eot and /dev/null differ diff --git a/back_end/page/assets/fonts/fontawesome-webfont.svg b/back_end/page/assets/fonts/fontawesome-webfont.svg deleted file mode 100644 index 8b66187fe..000000000 --- a/back_end/page/assets/fonts/fontawesome-webfont.svg +++ /dev/null @@ -1,685 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/back_end/page/assets/fonts/fontawesome-webfont.ttf b/back_end/page/assets/fonts/fontawesome-webfont.ttf deleted file mode 100644 index f221e50a2..000000000 Binary files a/back_end/page/assets/fonts/fontawesome-webfont.ttf and /dev/null differ diff --git a/back_end/page/assets/fonts/fontawesome-webfont.woff b/back_end/page/assets/fonts/fontawesome-webfont.woff deleted file mode 100644 index 6e7483cf6..000000000 Binary files a/back_end/page/assets/fonts/fontawesome-webfont.woff and /dev/null differ diff --git a/back_end/page/assets/fonts/fontawesome-webfont.woff2 b/back_end/page/assets/fonts/fontawesome-webfont.woff2 deleted file mode 100644 index 7eb74fd12..000000000 Binary files a/back_end/page/assets/fonts/fontawesome-webfont.woff2 and /dev/null differ diff --git a/back_end/page/assets/js/ie/backgroundsize.min.htc b/back_end/page/assets/js/ie/backgroundsize.min.htc deleted file mode 100644 index 3d9960de1..000000000 --- a/back_end/page/assets/js/ie/backgroundsize.min.htc +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/back_end/page/assets/js/ie/html5shiv.js b/back_end/page/assets/js/ie/html5shiv.js deleted file mode 100644 index dcf351c86..000000000 --- a/back_end/page/assets/js/ie/html5shiv.js +++ /dev/null @@ -1,8 +0,0 @@ -/* - HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed -*/ -(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); -a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; -c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| -"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment(); -for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d #mq-test-1 { width: 42px; }',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){v(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))},g=function(a){return a.replace(c.regex.minmaxwh,"").match(c.regex.other)};if(c.ajax=f,c.queue=d,c.unsupportedmq=g,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var h,i,j,k=a.document,l=k.documentElement,m=[],n=[],o=[],p={},q=30,r=k.getElementsByTagName("head")[0]||l,s=k.getElementsByTagName("base")[0],t=r.getElementsByTagName("link"),u=function(){var a,b=k.createElement("div"),c=k.body,d=l.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=k.createElement("body"),c.style.background="none"),l.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&l.insertBefore(c,l.firstChild),a=b.offsetWidth,f?l.removeChild(c):c.removeChild(b),l.style.fontSize=d,e&&(c.style.fontSize=e),a=j=parseFloat(a)},v=function(b){var c="clientWidth",d=l[c],e="CSS1Compat"===k.compatMode&&d||k.body[c]||d,f={},g=t[t.length-1],p=(new Date).getTime();if(b&&h&&q>p-h)return a.clearTimeout(i),i=a.setTimeout(v,q),void 0;h=p;for(var s in m)if(m.hasOwnProperty(s)){var w=m[s],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?j||u():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?j||u():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(n[w.rules]))}for(var C in o)o.hasOwnProperty(C)&&o[C]&&o[C].parentNode===r&&r.removeChild(o[C]);o.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=k.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,r.insertBefore(E,g.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(k.createTextNode(F)),o.push(E)}},w=function(a,b,d){var e=a.replace(c.regex.comments,"").replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var h=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},i=!f&&d;b.length&&(b+="/"),i&&(f=1);for(var j=0;f>j;j++){var k,l,o,p;i?(k=d,n.push(h(a))):(k=e[j].match(c.regex.findStyles)&&RegExp.$1,n.push(RegExp.$2&&h(RegExp.$2))),o=k.split(","),p=o.length;for(var q=0;p>q;q++)l=o[q],g(l)||m.push({media:l.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:n.length-1,hasquery:l.indexOf("(")>-1,minw:l.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:l.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}v()},x=function(){if(d.length){var b=d.shift();f(b.href,function(c){w(c,b.href,b.media),p[b.href]=!0,a.setTimeout(function(){x()},0)})}},y=function(){for(var b=0;ba?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; - -return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/\s*$/g,ra={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:k.htmlSerialize?[0,"",""]:[1,"X
","
"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?""!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("'; - tGdocs = ''; - tVideo = '\n'; - tAudio = '\n'; - tFlash = '\n'; - tPdf = '\n'; - tObject = '\n' + '\n' + - $h.OBJECT_PARAMS + ' ' + $h.DEFAULT_PREVIEW + '\n\n'; - tOther = '
\n' + $h.DEFAULT_PREVIEW + '\n
\n'; - tZoomCache = ''; - vDefaultDim = {width: '100%', height: '100%', 'min-height': '480px'}; - if (self._isPdfRendered()) { - tPdf = self.pdfRendererTemplate.replace('{renderer}', self._encodeURI(self.pdfRendererUrl)); - } - self.defaults = { - layoutTemplates: { - main1: tMain1, - main2: tMain2, - preview: tPreview, - close: tClose, - fileIcon: tFileIcon, - caption: tCaption, - modalMain: tModalMain, - modal: tModal, - progress: tProgress, - stats: tStats, - size: tSize, - footer: tFooter, - indicator: tIndicator, - actions: tActions, - actionDelete: tActionDelete, - actionUpload: tActionUpload, - actionDownload: tActionDownload, - actionZoom: tActionZoom, - actionDrag: tActionDrag, - btnDefault: tBtnDefault, - btnLink: tBtnLink, - btnBrowse: tBtnBrowse, - zoomCache: tZoomCache - }, - previewMarkupTags: { - tagBefore1: tTagBef1, - tagBefore2: tTagBef2, - tagAfter: tTagAft - }, - previewContentTemplates: { - generic: tGeneric, - html: tHtml, - image: tImage, - text: tText, - office: tOffice, - gdocs: tGdocs, - video: tVideo, - audio: tAudio, - flash: tFlash, - object: tObject, - pdf: tPdf, - other: tOther - }, - allowedPreviewTypes: ['image', 'html', 'text', 'video', 'audio', 'flash', 'pdf', 'object'], - previewTemplates: {}, - previewSettings: { - image: {width: 'auto', height: 'auto', 'max-width': '100%', 'max-height': '100%'}, - html: {width: '213px', height: '160px'}, - text: {width: '213px', height: '160px'}, - office: {width: '213px', height: '160px'}, - gdocs: {width: '213px', height: '160px'}, - video: {width: '213px', height: '160px'}, - audio: {width: '100%', height: '30px'}, - flash: {width: '213px', height: '160px'}, - object: {width: '213px', height: '160px'}, - pdf: {width: '100%', height: '160px', 'position': 'relative'}, - other: {width: '213px', height: '160px'} - }, - previewSettingsSmall: { - image: {width: 'auto', height: 'auto', 'max-width': '100%', 'max-height': '100%'}, - html: {width: '100%', height: '160px'}, - text: {width: '100%', height: '160px'}, - office: {width: '100%', height: '160px'}, - gdocs: {width: '100%', height: '160px'}, - video: {width: '100%', height: 'auto'}, - audio: {width: '100%', height: '30px'}, - flash: {width: '100%', height: 'auto'}, - object: {width: '100%', height: 'auto'}, - pdf: {width: '100%', height: '160px'}, - other: {width: '100%', height: '160px'} - }, - previewZoomSettings: { - image: {width: 'auto', height: 'auto', 'max-width': '100%', 'max-height': '100%'}, - html: vDefaultDim, - text: vDefaultDim, - office: {width: '100%', height: '100%', 'max-width': '100%', 'min-height': '480px'}, - gdocs: {width: '100%', height: '100%', 'max-width': '100%', 'min-height': '480px'}, - video: {width: 'auto', height: '100%', 'max-width': '100%'}, - audio: {width: '100%', height: '30px'}, - flash: {width: 'auto', height: '480px'}, - object: {width: 'auto', height: '100%', 'max-width': '100%', 'min-height': '480px'}, - pdf: vDefaultDim, - other: {width: 'auto', height: '100%', 'min-height': '480px'} - }, - mimeTypeAliases: { - 'video/quicktime': 'video/mp4' - }, - fileTypeSettings: { - image: function (vType, vName) { - return ($h.compare(vType, 'image.*') && !$h.compare(vType, /(tiff?|wmf)$/i) || - $h.compare(vName, /\.(gif|png|jpe?g)$/i)); - }, - html: function (vType, vName) { - return $h.compare(vType, 'text/html') || $h.compare(vName, /\.(htm|html)$/i); - }, - office: function (vType, vName) { - return $h.compare(vType, /(word|excel|powerpoint|office)$/i) || - $h.compare(vName, /\.(docx?|xlsx?|pptx?|pps|potx?)$/i); - }, - gdocs: function (vType, vName) { - return $h.compare(vType, /(word|excel|powerpoint|office|iwork-pages|tiff?)$/i) || - $h.compare(vName, - /\.(docx?|xlsx?|pptx?|pps|potx?|rtf|ods|odt|pages|ai|dxf|ttf|tiff?|wmf|e?ps)$/i); - }, - text: function (vType, vName) { - return $h.compare(vType, 'text.*') || $h.compare(vName, /\.(xml|javascript)$/i) || - $h.compare(vName, /\.(txt|md|csv|nfo|ini|json|php|js|css)$/i); - }, - video: function (vType, vName) { - return $h.compare(vType, 'video.*') && ($h.compare(vType, /(ogg|mp4|mp?g|mov|webm|3gp)$/i) || - $h.compare(vName, /\.(og?|mp4|webm|mp?g|mov|3gp)$/i)); - }, - audio: function (vType, vName) { - return $h.compare(vType, 'audio.*') && ($h.compare(vName, /(ogg|mp3|mp?g|wav)$/i) || - $h.compare(vName, /\.(og?|mp3|mp?g|wav)$/i)); - }, - flash: function (vType, vName) { - return $h.compare(vType, 'application/x-shockwave-flash', true) || $h.compare(vName, - /\.(swf)$/i); - }, - pdf: function (vType, vName) { - return $h.compare(vType, 'application/pdf', true) || $h.compare(vName, /\.(pdf)$/i); - }, - object: function () { - return true; - }, - other: function () { - return true; - } - }, - fileActionSettings: { - showRemove: true, - showUpload: true, - showDownload: true, - showZoom: true, - showDrag: true, - removeIcon: '', - removeClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - removeErrorClass: 'btn btn-sm btn-kv btn-danger', - removeTitle: 'Remove file', - uploadIcon: '', - uploadClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - uploadTitle: 'Upload file', - uploadRetryIcon: '', - uploadRetryTitle: 'Retry upload', - downloadIcon: '', - downloadClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - downloadTitle: 'Download file', - zoomIcon: '', - zoomClass: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - zoomTitle: 'View Details', - dragIcon: '', - dragClass: 'text-info', - dragTitle: 'Move / Rearrange', - dragSettings: {}, - indicatorNew: '', - indicatorSuccess: '', - indicatorError: '', - indicatorLoading: '', - indicatorPaused: '', - indicatorNewTitle: 'Not uploaded yet', - indicatorSuccessTitle: 'Uploaded', - indicatorErrorTitle: 'Upload Error', - indicatorLoadingTitle: 'Uploading ...', - indicatorPausedTitle: 'Upload Paused' - } - }; - $.each(self.defaults, function (key, setting) { - if (key === 'allowedPreviewTypes') { - if (self.allowedPreviewTypes === undefined) { - self.allowedPreviewTypes = setting; - } - return; - } - self[key] = $.extend(true, {}, setting, self[key]); - }); - self._initPreviewTemplates(); - }, - _initPreviewTemplates: function () { - var self = this, tags = self.previewMarkupTags, tagBef, tagAft = tags.tagAfter; - $.each(self.previewContentTemplates, function (key, value) { - if ($h.isEmpty(self.previewTemplates[key])) { - tagBef = tags.tagBefore2; - if (key === 'generic' || key === 'image' || key === 'html' || key === 'text') { - tagBef = tags.tagBefore1; - } - if (self._isPdfRendered() && key === 'pdf') { - tagBef = tagBef.replace('kv-file-content', 'kv-file-content kv-pdf-rendered'); - } - self.previewTemplates[key] = tagBef + value + tagAft; - } - }); - }, - _initPreviewCache: function () { - var self = this; - self.previewCache = { - data: {}, - init: function () { - var content = self.initialPreview; - if (content.length > 0 && !$h.isArray(content)) { - content = content.split(self.initialPreviewDelimiter); - } - self.previewCache.data = { - content: content, - config: self.initialPreviewConfig, - tags: self.initialPreviewThumbTags - }; - }, - count: function (skipNull) { - if (!self.previewCache.data || !self.previewCache.data.content) { - return 0; - } - if (skipNull) { - var chk = self.previewCache.data.content.filter(function (n) { - return n !== null; - }); - return chk.length; - } - return self.previewCache.data.content.length; - }, - get: function (i, isDisabled) { - var ind = $h.INIT_FLAG + i, data = self.previewCache.data, config = data.config[i], - content = data.content[i], out, $tmp, cat, ftr, - fname, ftype, frameClass, asData = $h.ifSet('previewAsData', config, self.initialPreviewAsData), - a = config ? {title: config.title || null, alt: config.alt || null} : {title: null, alt: null}, - parseTemplate = function (cat, dat, fname, ftype, ftr, ind, fclass, t) { - var fc = ' file-preview-initial ' + $h.SORT_CSS + (fclass ? ' ' + fclass : ''), - id = self.previewInitId + '-' + ind, - fileId = config && config.fileId || id; - /** @namespace config.zoomData */ - return self._generatePreviewTemplate(cat, dat, fname, ftype, id, fileId, false, null, fc, - ftr, ind, t, a, config && config.zoomData || dat); - }; - if (!content || !content.length) { - return ''; - } - isDisabled = isDisabled === undefined ? true : isDisabled; - cat = $h.ifSet('type', config, self.initialPreviewFileType || 'generic'); - fname = $h.ifSet('filename', config, $h.ifSet('caption', config)); - ftype = $h.ifSet('filetype', config, cat); - ftr = self.previewCache.footer(i, isDisabled, (config && config.size || null)); - frameClass = $h.ifSet('frameClass', config); - if (asData) { - out = parseTemplate(cat, content, fname, ftype, ftr, ind, frameClass); - } else { - out = parseTemplate('generic', content, fname, ftype, ftr, ind, frameClass, cat) - .setTokens({'content': data.content[i]}); - } - if (data.tags.length && data.tags[i]) { - out = $h.replaceTags(out, data.tags[i]); - } - /** @namespace config.frameAttr */ - if (!$h.isEmpty(config) && !$h.isEmpty(config.frameAttr)) { - $tmp = $(document.createElement('div')).html(out); - $tmp.find('.file-preview-initial').attr(config.frameAttr); - out = $tmp.html(); - $tmp.remove(); - } - return out; - }, - clean: function (data) { - data.content = $h.cleanArray(data.content); - data.config = $h.cleanArray(data.config); - data.tags = $h.cleanArray(data.tags); - self.previewCache.data = data; - }, - add: function (content, config, tags, append) { - var data = self.previewCache.data, index; - if (!content || !content.length) { - return 0; - } - index = content.length - 1; - if (!$h.isArray(content)) { - content = content.split(self.initialPreviewDelimiter); - } - if (append && data.content) { - index = data.content.push(content[0]) - 1; - data.config[index] = config; - data.tags[index] = tags; - } else { - data.content = content; - data.config = config; - data.tags = tags; - } - self.previewCache.clean(data); - return index; - }, - set: function (content, config, tags, append) { - var data = self.previewCache.data, i, chk; - if (!content || !content.length) { - return; - } - if (!$h.isArray(content)) { - content = content.split(self.initialPreviewDelimiter); - } - chk = content.filter(function (n) { - return n !== null; - }); - if (!chk.length) { - return; - } - if (data.content === undefined) { - data.content = []; - } - if (data.config === undefined) { - data.config = []; - } - if (data.tags === undefined) { - data.tags = []; - } - if (append) { - for (i = 0; i < content.length; i++) { - if (content[i]) { - data.content.push(content[i]); - } - } - for (i = 0; i < config.length; i++) { - if (config[i]) { - data.config.push(config[i]); - } - } - for (i = 0; i < tags.length; i++) { - if (tags[i]) { - data.tags.push(tags[i]); - } - } - } else { - data.content = content; - data.config = config; - data.tags = tags; - } - self.previewCache.clean(data); - }, - unset: function (index) { - var chk = self.previewCache.count(), rev = self.reversePreviewOrder; - if (!chk) { - return; - } - if (chk === 1) { - self.previewCache.data.content = []; - self.previewCache.data.config = []; - self.previewCache.data.tags = []; - self.initialPreview = []; - self.initialPreviewConfig = []; - self.initialPreviewThumbTags = []; - return; - } - self.previewCache.data.content = $h.spliceArray(self.previewCache.data.content, index, rev); - self.previewCache.data.config = $h.spliceArray(self.previewCache.data.config, index, rev); - self.previewCache.data.tags = $h.spliceArray(self.previewCache.data.tags, index, rev); - var data = $.extend(true, {}, self.previewCache.data); - self.previewCache.clean(data); - }, - out: function () { - var html = '', caption, len = self.previewCache.count(), i, content; - if (len === 0) { - return {content: '', caption: ''}; - } - for (i = 0; i < len; i++) { - content = self.previewCache.get(i); - html = self.reversePreviewOrder ? (content + html) : (html + content); - } - caption = self._getMsgSelected(len); - return {content: html, caption: caption}; - }, - footer: function (i, isDisabled, size) { - var data = self.previewCache.data || {}; - if ($h.isEmpty(data.content)) { - return ''; - } - if ($h.isEmpty(data.config) || $h.isEmpty(data.config[i])) { - data.config[i] = {}; - } - isDisabled = isDisabled === undefined ? true : isDisabled; - var config = data.config[i], caption = $h.ifSet('caption', config), a, - width = $h.ifSet('width', config, 'auto'), url = $h.ifSet('url', config, false), - key = $h.ifSet('key', config, null), fileId = $h.ifSet('fileId', config, null), - fs = self.fileActionSettings, initPreviewShowDel = self.initialPreviewShowDelete || false, - downloadInitialUrl = !self.initialPreviewDownloadUrl ? '' : - self.initialPreviewDownloadUrl + '?key=' + key + (fileId ? '&fileId=' + fileId : ''), - dUrl = config.downloadUrl || downloadInitialUrl, - dFil = config.filename || config.caption || '', - initPreviewShowDwl = !!(dUrl), - sDel = $h.ifSet('showRemove', config, initPreviewShowDel), - sDwl = $h.ifSet('showDownload', config, $h.ifSet('showDownload', fs, initPreviewShowDwl)), - sZm = $h.ifSet('showZoom', config, $h.ifSet('showZoom', fs, true)), - sDrg = $h.ifSet('showDrag', config, $h.ifSet('showDrag', fs, true)), - dis = (url === false) && isDisabled; - sDwl = sDwl && config.downloadUrl !== false && !!dUrl; - a = self._renderFileActions(config, false, sDwl, sDel, sZm, sDrg, dis, url, key, true, dUrl, dFil); - return self._getLayoutTemplate('footer').setTokens({ - 'progress': self._renderThumbProgress(), - 'actions': a, - 'caption': caption, - 'size': self._getSize(size), - 'width': width, - 'indicator': '' - }); - } - }; - self.previewCache.init(); - }, - _isPdfRendered: function () { - var self = this, useLib = self.usePdfRenderer, - flag = typeof useLib === 'function' ? useLib() : !!useLib; - return flag && self.pdfRendererUrl; - }, - _handler: function ($el, event, callback) { - var self = this, ns = self.namespace, ev = event.split(' ').join(ns + ' ') + ns; - if (!$el || !$el.length) { - return; - } - $el.off(ev).on(ev, callback); - }, - _encodeURI: function (vUrl) { - var self = this; - return self.encodeUrl ? encodeURI(vUrl) : vUrl; - }, - _log: function (msg, tokens) { - var self = this, id = self.$element.attr('id'); - if (!self.showConsoleLogs) { - return; - } - if (id) { - msg = '"' + id + '": ' + msg; - } - msg = 'bootstrap-fileinput: ' + msg; - if (typeof tokens === 'object') { - msg = msg.setTokens(tokens); - } - if (window.console && typeof window.console.log !== 'undefined') { - window.console.log(msg); - } else { - window.alert(msg); - } - }, - _validate: function () { - var self = this, status = self.$element.attr('type') === 'file'; - if (!status) { - self._log($h.logMessages.badInputType); - } - return status; - }, - _errorsExist: function () { - var self = this, $err, $errList = self.$errorContainer.find('li'); - if ($errList.length) { - return true; - } - $err = $(document.createElement('div')).html(self.$errorContainer.html()); - $err.find('.kv-error-close').remove(); - $err.find('ul').remove(); - return !!$.trim($err.text()).length; - }, - _errorHandler: function (evt, caption) { - var self = this, err = evt.target.error, showError = function (msg) { - self._showError(msg.replace('{name}', caption)); - }; - /** @namespace err.NOT_FOUND_ERR */ - /** @namespace err.SECURITY_ERR */ - /** @namespace err.NOT_READABLE_ERR */ - if (err.code === err.NOT_FOUND_ERR) { - showError(self.msgFileNotFound); - } else { - if (err.code === err.SECURITY_ERR) { - showError(self.msgFileSecured); - } else { - if (err.code === err.NOT_READABLE_ERR) { - showError(self.msgFileNotReadable); - } else { - if (err.code === err.ABORT_ERR) { - showError(self.msgFilePreviewAborted); - } else { - showError(self.msgFilePreviewError); - } - } - } - } - }, - _addError: function (msg) { - var self = this, $error = self.$errorContainer; - if (msg && $error.length) { - $error.html(self.errorCloseButton + msg); - self._handler($error.find('.kv-error-close'), 'click', function () { - setTimeout(function () { - if (self.showPreview && !self.getFrames().length) { - self.clear(); - } - $error.fadeOut('slow'); - }, self.processDelay); - }); - } - }, - _setValidationError: function (css) { - var self = this; - css = (css ? css + ' ' : '') + 'has-error'; - self.$container.removeClass(css).addClass('has-error'); - $h.addCss(self.$captionContainer, 'is-invalid'); - }, - _resetErrors: function (fade) { - var self = this, $error = self.$errorContainer; - self.isError = false; - self.$container.removeClass('has-error'); - self.$captionContainer.removeClass('is-invalid'); - $error.html(''); - if (fade) { - $error.fadeOut('slow'); - } else { - $error.hide(); - } - }, - _showFolderError: function (folders) { - var self = this, $error = self.$errorContainer, msg; - if (!folders) { - return; - } - if (!self.isAjaxUpload) { - self._clearFileInput(); - } - msg = self.msgFoldersNotAllowed.replace('{n}', folders); - self._addError(msg); - self._setValidationError(); - $error.fadeIn(self.fadeDelay); - self._raise('filefoldererror', [folders, msg]); - }, - _showFileError: function (msg, params, event) { - var self = this, $error = self.$errorContainer, ev = event || 'fileuploaderror', - fId = params && params.fileId || '', e = params && params.id ? - '
  • ' + msg + '
  • ' : '
  • ' + msg + '
  • '; - - if ($error.find('ul').length === 0) { - self._addError('
      ' + e + '
    '); - } else { - $error.find('ul').append(e); - } - $error.fadeIn(self.fadeDelay); - self._raise(ev, [params, msg]); - self._setValidationError('file-input-new'); - return true; - }, - _showError: function (msg, params, event) { - var self = this, $error = self.$errorContainer, ev = event || 'fileerror'; - params = params || {}; - params.reader = self.reader; - self._addError(msg); - $error.fadeIn(self.fadeDelay); - self._raise(ev, [params, msg]); - if (!self.isAjaxUpload) { - self._clearFileInput(); - } - self._setValidationError('file-input-new'); - self.$btnUpload.attr('disabled', true); - return true; - }, - _noFilesError: function (params) { - var self = this, label = self.minFileCount > 1 ? self.filePlural : self.fileSingle, - msg = self.msgFilesTooLess.replace('{n}', self.minFileCount).replace('{files}', label), - $error = self.$errorContainer; - msg = '
  • ' + msg + '
  • '; - if ($error.find('ul').length === 0) { - self._addError('
      ' + msg + '
    '); - } else { - $error.find('ul').append(msg); - } - self.isError = true; - self._updateFileDetails(0); - $error.fadeIn(self.fadeDelay); - self._raise('fileerror', [params, msg]); - self._clearFileInput(); - self._setValidationError(); - }, - _parseError: function (operation, jqXHR, errorThrown, fileName) { - /** @namespace jqXHR.responseJSON */ - var self = this, errMsg = $.trim(errorThrown + ''), textPre, - text = jqXHR.responseJSON !== undefined && jqXHR.responseJSON.error !== undefined ? - jqXHR.responseJSON.error : jqXHR.responseText; - if (self.cancelling && self.msgUploadAborted) { - errMsg = self.msgUploadAborted; - } - if (self.showAjaxErrorDetails && text) { - text = $.trim(text.replace(/\n\s*\n/g, '\n')); - textPre = text.length ? '
    ' + text + '
    ' : ''; - errMsg += errMsg ? textPre : text; - } - if (!errMsg) { - errMsg = self.msgAjaxError.replace('{operation}', operation); - } - self.cancelling = false; - return fileName ? '' + fileName + ': ' + errMsg : errMsg; - }, - _parseFileType: function (type, name) { - var self = this, isValid, vType, cat, i, types = self.allowedPreviewTypes || []; - if (type === 'application/text-plain') { - return 'text'; - } - for (i = 0; i < types.length; i++) { - cat = types[i]; - isValid = self.fileTypeSettings[cat]; - vType = isValid(type, name) ? cat : ''; - if (!$h.isEmpty(vType)) { - return vType; - } - } - return 'other'; - }, - _getPreviewIcon: function (fname) { - var self = this, ext, out = null; - if (fname && fname.indexOf('.') > -1) { - ext = fname.split('.').pop(); - if (self.previewFileIconSettings) { - out = self.previewFileIconSettings[ext] || self.previewFileIconSettings[ext.toLowerCase()] || null; - } - if (self.previewFileExtSettings) { - $.each(self.previewFileExtSettings, function (key, func) { - if (self.previewFileIconSettings[key] && func(ext)) { - out = self.previewFileIconSettings[key]; - //noinspection UnnecessaryReturnStatementJS - return; - } - }); - } - } - return out || self.previewFileIcon; - }, - _parseFilePreviewIcon: function (content, fname) { - var self = this, icn = self._getPreviewIcon(fname), out = content; - if (out.indexOf('{previewFileIcon}') > -1) { - out = out.setTokens({'previewFileIconClass': self.previewFileIconClass, 'previewFileIcon': icn}); - } - return out; - }, - _raise: function (event, params) { - var self = this, e = $.Event(event); - if (params !== undefined) { - self.$element.trigger(e, params); - } else { - self.$element.trigger(e); - } - if (e.isDefaultPrevented() || e.result === false) { - return false; - } - switch (event) { - // ignore these events - case 'filebatchuploadcomplete': - case 'filebatchuploadsuccess': - case 'fileuploaded': - case 'fileclear': - case 'filecleared': - case 'filereset': - case 'fileerror': - case 'filefoldererror': - case 'fileuploaderror': - case 'filebatchuploaderror': - case 'filedeleteerror': - case 'filecustomerror': - case 'filesuccessremove': - break; - // receive data response via `filecustomerror` event` - default: - if (!self.ajaxAborted) { - self.ajaxAborted = e.result; - } - break; - } - return true; - }, - _listenFullScreen: function (isFullScreen) { - var self = this, $modal = self.$modal, $btnFull, $btnBord; - if (!$modal || !$modal.length) { - return; - } - $btnFull = $modal && $modal.find('.btn-fullscreen'); - $btnBord = $modal && $modal.find('.btn-borderless'); - if (!$btnFull.length || !$btnBord.length) { - return; - } - $btnFull.removeClass('active').attr('aria-pressed', 'false'); - $btnBord.removeClass('active').attr('aria-pressed', 'false'); - if (isFullScreen) { - $btnFull.addClass('active').attr('aria-pressed', 'true'); - } else { - $btnBord.addClass('active').attr('aria-pressed', 'true'); - } - if ($modal.hasClass('file-zoom-fullscreen')) { - self._maximizeZoomDialog(); - } else { - if (isFullScreen) { - self._maximizeZoomDialog(); - } else { - $btnBord.removeClass('active').attr('aria-pressed', 'false'); - } - } - }, - _listen: function () { - var self = this, $el = self.$element, $form = self.$form, $cont = self.$container, fullScreenEvents; - self._handler($el, 'click', function (e) { - if ($el.hasClass('file-no-browse')) { - if ($el.data('zoneClicked')) { - $el.data('zoneClicked', false); - } else { - e.preventDefault(); - } - } - }); - self._handler($el, 'change', $.proxy(self._change, self)); - if (self.showBrowse) { - self._handler(self.$btnFile, 'click', $.proxy(self._browse, self)); - } - self._handler($cont.find('.fileinput-remove:not([disabled])'), 'click', $.proxy(self.clear, self)); - self._handler($cont.find('.fileinput-cancel'), 'click', $.proxy(self.cancel, self)); - self._handler($cont.find('.fileinput-pause'), 'click', $.proxy(self.pause, self)); - self._initDragDrop(); - self._handler($form, 'reset', $.proxy(self.clear, self)); - if (!self.isAjaxUpload) { - self._handler($form, 'submit', $.proxy(self._submitForm, self)); - } - self._handler(self.$container.find('.fileinput-upload'), 'click', $.proxy(self._uploadClick, self)); - self._handler($(window), 'resize', function () { - self._listenFullScreen(screen.width === window.innerWidth && screen.height === window.innerHeight); - }); - fullScreenEvents = 'webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange'; - self._handler($(document), fullScreenEvents, function () { - self._listenFullScreen($h.checkFullScreen()); - }); - self._autoFitContent(); - self._initClickable(); - self._refreshPreview(); - }, - _autoFitContent: function () { - var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, - self = this, config = width < 400 ? (self.previewSettingsSmall || self.defaults.previewSettingsSmall) : - (self.previewSettings || self.defaults.previewSettings), sel; - $.each(config, function (cat, settings) { - sel = '.file-preview-frame .file-preview-' + cat; - self.$preview.find(sel + '.kv-preview-data,' + sel + ' .kv-preview-data').css(settings); - }); - }, - _scanDroppedItems: function (item, files, path) { - path = path || ''; - var self = this, i, dirReader, readDir, errorHandler = function (e) { - self._log($h.logMessages.badDroppedFiles); - self._log(e); - }; - if (item.isFile) { - item.file(function (file) { - files.push(file); - }, errorHandler); - } else { - if (item.isDirectory) { - dirReader = item.createReader(); - readDir = function () { - dirReader.readEntries(function (entries) { - if (entries && entries.length > 0) { - for (i = 0; i < entries.length; i++) { - self._scanDroppedItems(entries[i], files, path + item.name + '/'); - } - // recursively call readDir() again, since browser can only handle first 100 entries. - readDir(); - } - return null; - }, errorHandler); - }; - readDir(); - } - } - - }, - _initDragDrop: function () { - var self = this, $zone = self.$dropZone; - if (self.dropZoneEnabled && self.showPreview) { - self._handler($zone, 'dragenter dragover', $.proxy(self._zoneDragEnter, self)); - self._handler($zone, 'dragleave', $.proxy(self._zoneDragLeave, self)); - self._handler($zone, 'drop', $.proxy(self._zoneDrop, self)); - self._handler($(document), 'dragenter dragover drop', self._zoneDragDropInit); - } - }, - _zoneDragDropInit: function (e) { - e.stopPropagation(); - e.preventDefault(); - }, - _zoneDragEnter: function (e) { - var self = this, dataTransfer = e.originalEvent.dataTransfer, - hasFiles = $.inArray('Files', dataTransfer.types) > -1; - self._zoneDragDropInit(e); - if (self.isDisabled || !hasFiles) { - e.originalEvent.dataTransfer.effectAllowed = 'none'; - e.originalEvent.dataTransfer.dropEffect = 'none'; - return; - } - if (self._raise('fileDragEnter', {'sourceEvent': e, 'files': dataTransfer.types.Files})) { - $h.addCss(self.$dropZone, 'file-highlighted'); - } - }, - _zoneDragLeave: function (e) { - var self = this; - self._zoneDragDropInit(e); - if (self.isDisabled) { - return; - } - if (self._raise('fileDragLeave', {'sourceEvent': e})) { - self.$dropZone.removeClass('file-highlighted'); - } - - }, - _zoneDrop: function (e) { - /** @namespace e.originalEvent.dataTransfer */ - var self = this, i, $el = self.$element, dataTransfer = e.originalEvent.dataTransfer, - files = dataTransfer.files, items = dataTransfer.items, folders = $h.getDragDropFolders(items), - processFiles = function () { - if (!self.isAjaxUpload) { - self.changeTriggered = true; - $el.get(0).files = files; - setTimeout(function () { - self.changeTriggered = false; - $el.trigger('change' + self.namespace); - }, self.processDelay); - } else { - self._change(e, files); - } - self.$dropZone.removeClass('file-highlighted'); - }; - e.preventDefault(); - if (self.isDisabled || $h.isEmpty(files)) { - return; - } - if (!self._raise('fileDragDrop', {'sourceEvent': e, 'files': files})) { - return; - } - if (folders > 0) { - if (!self.isAjaxUpload) { - self._showFolderError(folders); - return; - } - files = []; - for (i = 0; i < items.length; i++) { - var item = items[i].webkitGetAsEntry(); - if (item) { - self._scanDroppedItems(item, files); - } - } - setTimeout(function () { - processFiles(); - }, 500); - } else { - processFiles(); - } - }, - _uploadClick: function (e) { - var self = this, $btn = self.$container.find('.fileinput-upload'), $form, - isEnabled = !$btn.hasClass('disabled') && $h.isEmpty($btn.attr('disabled')); - if (e && e.isDefaultPrevented()) { - return; - } - if (!self.isAjaxUpload) { - if (isEnabled && $btn.attr('type') !== 'submit') { - $form = $btn.closest('form'); - // downgrade to normal form submit if possible - if ($form.length) { - $form.trigger('submit'); - } - e.preventDefault(); - } - return; - } - e.preventDefault(); - if (isEnabled) { - self.upload(); - } - }, - _submitForm: function () { - var self = this; - return self._isFileSelectionValid() && !self._abort({}); - }, - _clearPreview: function () { - var self = this, - $thumbs = self.showUploadedThumbs ? self.getFrames(':not(.file-preview-success)') : self.getFrames(); - $thumbs.each(function () { - var $thumb = $(this), id = $thumb.attr('id'), $zoom = self._getZoom(id); - $thumb.remove(); - $h.cleanZoomCache($zoom); - }); - if (!self.getFrames().length || !self.showPreview) { - self._resetUpload(); - } - self._validateDefaultPreview(); - }, - _initSortable: function () { - var self = this, $el = self.$preview, settings, selector = '.' + $h.SORT_CSS, - rev = self.reversePreviewOrder; - if (!window.KvSortable || $el.find(selector).length === 0) { - return; - } - //noinspection JSUnusedGlobalSymbols - settings = { - handle: '.drag-handle-init', - dataIdAttr: 'data-preview-id', - scroll: false, - draggable: selector, - onSort: function (e) { - var oldIndex = e.oldIndex, newIndex = e.newIndex, i = 0; - self.initialPreview = $h.moveArray(self.initialPreview, oldIndex, newIndex, rev); - self.initialPreviewConfig = $h.moveArray(self.initialPreviewConfig, oldIndex, newIndex, rev); - self.previewCache.init(); - self.getFrames('.file-preview-initial').each(function () { - $(this).attr('data-fileindex', $h.INIT_FLAG + i); - i++; - }); - self._raise('filesorted', { - previewId: $(e.item).attr('id'), - 'oldIndex': oldIndex, - 'newIndex': newIndex, - stack: self.initialPreviewConfig - }); - } - }; - if ($el.data('kvsortable')) { - $el.kvsortable('destroy'); - } - $.extend(true, settings, self.fileActionSettings.dragSettings); - $el.kvsortable(settings); - }, - _setPreviewContent: function (content) { - var self = this; - self.$preview.html(content); - self._autoFitContent(); - }, - _initPreviewImageOrientations: function () { - var self = this, i = 0; - if (!self.autoOrientImageInitial) { - return; - } - self.getFrames('.file-preview-initial').each(function () { - var $thumb = $(this), $img, $zoomImg, id, config = self.initialPreviewConfig[i]; - /** @namespace config.exif */ - if (config && config.exif && config.exif.Orientation) { - id = $thumb.attr('id'); - $img = $thumb.find('>.kv-file-content img'); - $zoomImg = self._getZoom(id, ' >.kv-file-content img'); - self.setImageOrientation($img, $zoomImg, config.exif.Orientation, $thumb); - } - i++; - }); - }, - _initPreview: function (isInit) { - var self = this, cap = self.initialCaption || '', out; - if (!self.previewCache.count(true)) { - self._clearPreview(); - if (isInit) { - self._setCaption(cap); - } else { - self._initCaption(); - } - return; - } - out = self.previewCache.out(); - cap = isInit && self.initialCaption ? self.initialCaption : out.caption; - self._setPreviewContent(out.content); - self._setInitThumbAttr(); - self._setCaption(cap); - self._initSortable(); - if (!$h.isEmpty(out.content)) { - self.$container.removeClass('file-input-new'); - } - self._initPreviewImageOrientations(); - }, - _getZoomButton: function (type) { - var self = this, label = self.previewZoomButtonIcons[type], css = self.previewZoomButtonClasses[type], - title = ' title="' + (self.previewZoomButtonTitles[type] || '') + '" ', - params = title + (type === 'close' ? ' data-dismiss="modal" aria-hidden="true"' : ''); - if (type === 'fullscreen' || type === 'borderless' || type === 'toggleheader') { - params += ' data-toggle="button" aria-pressed="false" autocomplete="off"'; - } - return ''; - }, - _getModalContent: function () { - var self = this; - return self._getLayoutTemplate('modal').setTokens({ - 'rtl': self.rtl ? ' kv-rtl' : '', - 'zoomFrameClass': self.frameClass, - 'heading': self.msgZoomModalHeading, - 'prev': self._getZoomButton('prev'), - 'next': self._getZoomButton('next'), - 'toggleheader': self._getZoomButton('toggleheader'), - 'fullscreen': self._getZoomButton('fullscreen'), - 'borderless': self._getZoomButton('borderless'), - 'close': self._getZoomButton('close') - }); - }, - _listenModalEvent: function (event) { - var self = this, $modal = self.$modal, getParams = function (e) { - return { - sourceEvent: e, - previewId: $modal.data('previewId'), - modal: $modal - }; - }; - $modal.on(event + '.bs.modal', function (e) { - var $btnFull = $modal.find('.btn-fullscreen'), $btnBord = $modal.find('.btn-borderless'); - self._raise('filezoom' + event, getParams(e)); - if (event === 'shown') { - $btnBord.removeClass('active').attr('aria-pressed', 'false'); - $btnFull.removeClass('active').attr('aria-pressed', 'false'); - if ($modal.hasClass('file-zoom-fullscreen')) { - self._maximizeZoomDialog(); - if ($h.checkFullScreen()) { - $btnFull.addClass('active').attr('aria-pressed', 'true'); - } else { - $btnBord.addClass('active').attr('aria-pressed', 'true'); - } - } - } - }); - }, - _initZoom: function () { - var self = this, $dialog, modalMain = self._getLayoutTemplate('modalMain'), modalId = '#' + $h.MODAL_ID; - if (!self.showPreview) { - return; - } - self.$modal = $(modalId); - if (!self.$modal || !self.$modal.length) { - $dialog = $(document.createElement('div')).html(modalMain).insertAfter(self.$container); - self.$modal = $(modalId).insertBefore($dialog); - $dialog.remove(); - } - $h.initModal(self.$modal); - self.$modal.html(self._getModalContent()); - $.each($h.MODAL_EVENTS, function (key, event) { - self._listenModalEvent(event); - }); - }, - _initZoomButtons: function () { - var self = this, previewId = self.$modal.data('previewId') || '', $first, $last, - thumbs = self.getFrames().toArray(), len = thumbs.length, $prev = self.$modal.find('.btn-prev'), - $next = self.$modal.find('.btn-next'); - if (thumbs.length < 2) { - $prev.hide(); - $next.hide(); - return; - } else { - $prev.show(); - $next.show(); - } - if (!len) { - return; - } - $first = $(thumbs[0]); - $last = $(thumbs[len - 1]); - $prev.removeAttr('disabled'); - $next.removeAttr('disabled'); - if ($first.length && $first.attr('id') === previewId) { - $prev.attr('disabled', true); - } - if ($last.length && $last.attr('id') === previewId) { - $next.attr('disabled', true); - } - }, - _maximizeZoomDialog: function () { - var self = this, $modal = self.$modal, $head = $modal.find('.modal-header:visible'), - $foot = $modal.find('.modal-footer:visible'), $body = $modal.find('.modal-body'), - h = $(window).height(), diff = 0; - $modal.addClass('file-zoom-fullscreen'); - if ($head && $head.length) { - h -= $head.outerHeight(true); - } - if ($foot && $foot.length) { - h -= $foot.outerHeight(true); - } - if ($body && $body.length) { - diff = $body.outerHeight(true) - $body.height(); - h -= diff; - } - $modal.find('.kv-zoom-body').height(h); - }, - _resizeZoomDialog: function (fullScreen) { - var self = this, $modal = self.$modal, $btnFull = $modal.find('.btn-fullscreen'), - $btnBord = $modal.find('.btn-borderless'); - if ($modal.hasClass('file-zoom-fullscreen')) { - $h.toggleFullScreen(false); - if (!fullScreen) { - if (!$btnFull.hasClass('active')) { - $modal.removeClass('file-zoom-fullscreen'); - self.$modal.find('.kv-zoom-body').css('height', self.zoomModalHeight); - } else { - $btnFull.removeClass('active').attr('aria-pressed', 'false'); - } - } else { - if (!$btnFull.hasClass('active')) { - $modal.removeClass('file-zoom-fullscreen'); - self._resizeZoomDialog(true); - if ($btnBord.hasClass('active')) { - $btnBord.removeClass('active').attr('aria-pressed', 'false'); - } - } - } - } else { - if (!fullScreen) { - self._maximizeZoomDialog(); - return; - } - $h.toggleFullScreen(true); - } - $modal.focus(); - }, - _setZoomContent: function ($frame, animate) { - var self = this, $content, tmplt, body, title, $body, $dataEl, config, previewId = $frame.attr('id'), - $zoomPreview = self._getZoom(previewId), $modal = self.$modal, $tmp, - $btnFull = $modal.find('.btn-fullscreen'), $btnBord = $modal.find('.btn-borderless'), cap, size, - $btnTogh = $modal.find('.btn-toggleheader'); - tmplt = $zoomPreview.attr('data-template') || 'generic'; - $content = $zoomPreview.find('.kv-file-content'); - body = $content.length ? $content.html() : ''; - cap = $frame.data('caption') || ''; - size = $frame.data('size') || ''; - title = cap + ' ' + size; - $modal.find('.kv-zoom-title').attr('title', $('
    ').html(title).text()).html(title); - $body = $modal.find('.kv-zoom-body'); - $modal.removeClass('kv-single-content'); - if (animate) { - $tmp = $body.addClass('file-thumb-loading').clone().insertAfter($body); - $body.html(body).hide(); - $tmp.fadeOut('fast', function () { - $body.fadeIn('fast', function () { - $body.removeClass('file-thumb-loading'); - }); - $tmp.remove(); - }); - } else { - $body.html(body); - } - config = self.previewZoomSettings[tmplt]; - if (config) { - $dataEl = $body.find('.kv-preview-data'); - $h.addCss($dataEl, 'file-zoom-detail'); - $.each(config, function (key, value) { - $dataEl.css(key, value); - if (($dataEl.attr('width') && key === 'width') || ($dataEl.attr('height') && key === 'height')) { - $dataEl.removeAttr(key); - } - }); - } - $modal.data('previewId', previewId); - self._handler($modal.find('.btn-prev'), 'click', function () { - self._zoomSlideShow('prev', previewId); - }); - self._handler($modal.find('.btn-next'), 'click', function () { - self._zoomSlideShow('next', previewId); - }); - self._handler($btnFull, 'click', function () { - self._resizeZoomDialog(true); - }); - self._handler($btnBord, 'click', function () { - self._resizeZoomDialog(false); - }); - self._handler($btnTogh, 'click', function () { - var $header = $modal.find('.modal-header'), $floatBar = $modal.find('.modal-body .floating-buttons'), - ht, $actions = $header.find('.kv-zoom-actions'), resize = function (height) { - var $body = self.$modal.find('.kv-zoom-body'), h = self.zoomModalHeight; - if ($modal.hasClass('file-zoom-fullscreen')) { - h = $body.outerHeight(true); - if (!height) { - h = h - $header.outerHeight(true); - } - } - $body.css('height', height ? h + height : h); - }; - if ($header.is(':visible')) { - ht = $header.outerHeight(true); - $header.slideUp('slow', function () { - $actions.find('.btn').appendTo($floatBar); - resize(ht); - }); - } else { - $floatBar.find('.btn').appendTo($actions); - $header.slideDown('slow', function () { - resize(); - }); - } - $modal.focus(); - }); - self._handler($modal, 'keydown', function (e) { - var key = e.which || e.keyCode, $prev = $(this).find('.btn-prev'), $next = $(this).find('.btn-next'), - vId = $(this).data('previewId'), vPrevKey = self.rtl ? 39 : 37, vNextKey = self.rtl ? 37 : 39; - if (key === vPrevKey && $prev.length && !$prev.attr('disabled')) { - self._zoomSlideShow('prev', vId); - } - if (key === vNextKey && $next.length && !$next.attr('disabled')) { - self._zoomSlideShow('next', vId); - } - }); - }, - _zoomPreview: function ($btn) { - var self = this, $frame, $modal = self.$modal; - if (!$btn.length) { - throw 'Cannot zoom to detailed preview!'; - } - $h.initModal($modal); - $modal.html(self._getModalContent()); - $frame = $btn.closest($h.FRAMES); - self._setZoomContent($frame); - $modal.modal('show'); - self._initZoomButtons(); - }, - _zoomSlideShow: function (dir, previewId) { - var self = this, $btn = self.$modal.find('.kv-zoom-actions .btn-' + dir), $targFrame, i, $thumb, - thumbsData = self.getFrames().toArray(), thumbs = [], len = thumbsData.length, out; - if ($btn.attr('disabled')) { - return; - } - for (i = 0; i < len; i++) { - $thumb = $(thumbsData[i]); - if ($thumb && $thumb.length && $thumb.find('.kv-file-zoom:visible').length) { - thumbs.push(thumbsData[i]); - } - } - len = thumbs.length; - for (i = 0; i < len; i++) { - if ($(thumbs[i]).attr('id') === previewId) { - out = dir === 'prev' ? i - 1 : i + 1; - break; - } - } - if (out < 0 || out >= len || !thumbs[out]) { - return; - } - $targFrame = $(thumbs[out]); - if ($targFrame.length) { - self._setZoomContent($targFrame, true); - } - self._initZoomButtons(); - self._raise('filezoom' + dir, {'previewId': previewId, modal: self.$modal}); - }, - _initZoomButton: function () { - var self = this; - self.$preview.find('.kv-file-zoom').each(function () { - var $el = $(this); - self._handler($el, 'click', function () { - self._zoomPreview($el); - }); - }); - }, - _inputFileCount: function () { - return this.$element.get(0).files.length; - }, - _refreshPreview: function () { - var self = this, files; - if ((!self._inputFileCount() && !self.isAjaxUpload) || !self.showPreview || !self.isPreviewable) { - return; - } - if (self.isAjaxUpload) { - if (self.fileManager.count() > 0) { - files = $.extend(true, {}, self.fileManager.stack); - self.fileManager.clear(); - self._clearFileInput(); - } else { - files = self.$element.get(0).files; - } - } else { - files = self.$element.get(0).files; - } - if (files && files.length) { - self.readFiles(files); - self._setFileDropZoneTitle(); - } - }, - _clearObjects: function ($el) { - $el.find('video audio').each(function () { - this.pause(); - $(this).remove(); - }); - $el.find('img object div').each(function () { - $(this).remove(); - }); - }, - _clearFileInput: function () { - var self = this, $el = self.$element, $srcFrm, $tmpFrm, $tmpEl; - if (!self._inputFileCount()) { - return; - } - $srcFrm = $el.closest('form'); - $tmpFrm = $(document.createElement('form')); - $tmpEl = $(document.createElement('div')); - $el.before($tmpEl); - if ($srcFrm.length) { - $srcFrm.after($tmpFrm); - } else { - $tmpEl.after($tmpFrm); - } - $tmpFrm.append($el).trigger('reset'); - $tmpEl.before($el).remove(); - $tmpFrm.remove(); - }, - _resetUpload: function () { - var self = this; - self.uploadCache = []; - self.$btnUpload.removeAttr('disabled'); - self._setProgress(0); - self._hideProgress(); - self._resetErrors(false); - self._initAjax(); - self.fileManager.clearImages(); - self._resetCanvas(); - if (self.overwriteInitial) { - self.initialPreview = []; - self.initialPreviewConfig = []; - self.initialPreviewThumbTags = []; - self.previewCache.data = { - content: [], - config: [], - tags: [] - }; - } - }, - _resetCanvas: function () { - var self = this; - if (self.canvas && self.imageCanvasContext) { - self.imageCanvasContext.clearRect(0, 0, self.canvas.width, self.canvas.height); - } - }, - _hasInitialPreview: function () { - var self = this; - return !self.overwriteInitial && self.previewCache.count(true); - }, - _resetPreview: function () { - var self = this, out, cap; - if (self.previewCache.count(true)) { - out = self.previewCache.out(); - self._setPreviewContent(out.content); - self._setInitThumbAttr(); - cap = self.initialCaption ? self.initialCaption : out.caption; - self._setCaption(cap); - } else { - self._clearPreview(); - self._initCaption(); - } - if (self.showPreview) { - self._initZoom(); - self._initSortable(); - } - }, - _clearDefaultPreview: function () { - var self = this; - self.$preview.find('.file-default-preview').remove(); - }, - _validateDefaultPreview: function () { - var self = this; - if (!self.showPreview || $h.isEmpty(self.defaultPreviewContent)) { - return; - } - self._setPreviewContent('
    ' + self.defaultPreviewContent + '
    '); - self.$container.removeClass('file-input-new'); - self._initClickable(); - }, - _resetPreviewThumbs: function (isAjax) { - var self = this, out; - if (isAjax) { - self._clearPreview(); - self.clearFileStack(); - return; - } - if (self._hasInitialPreview()) { - out = self.previewCache.out(); - self._setPreviewContent(out.content); - self._setInitThumbAttr(); - self._setCaption(out.caption); - self._initPreviewActions(); - } else { - self._clearPreview(); - } - }, - _getLayoutTemplate: function (t) { - var self = this, template = self.layoutTemplates[t]; - if ($h.isEmpty(self.customLayoutTags)) { - return template; - } - return $h.replaceTags(template, self.customLayoutTags); - }, - _getPreviewTemplate: function (t) { - var self = this, templates = self.previewTemplates, template = templates[t] || templates.other; - if ($h.isEmpty(self.customPreviewTags)) { - return template; - } - return $h.replaceTags(template, self.customPreviewTags); - }, - _getOutData: function (formdata, jqXHR, responseData, filesData) { - var self = this; - jqXHR = jqXHR || {}; - responseData = responseData || {}; - filesData = filesData || self.fileManager.list(); - return { - formdata: formdata, - files: filesData, - filenames: self.filenames, - filescount: self.getFilesCount(), - extra: self._getExtraData(), - response: responseData, - reader: self.reader, - jqXHR: jqXHR - }; - }, - _getMsgSelected: function (n) { - var self = this, strFiles = n === 1 ? self.fileSingle : self.filePlural; - return n > 0 ? self.msgSelected.replace('{n}', n).replace('{files}', strFiles) : self.msgNoFilesSelected; - }, - _getFrame: function (id, skipWarning) { - var self = this, $frame = $h.getFrameElement(self.$preview, id); - if (self.showPreview && !skipWarning && !$frame.length) { - self._log($h.logMessages.invalidThumb, {id: id}); - } - return $frame; - }, - _getZoom: function (id, selector) { - var self = this, $frame = $h.getZoomElement(self.$preview, id, selector); - if (self.showPreview && !$frame.length) { - self._log($h.logMessages.invalidThumb, {id: id}); - } - return $frame; - }, - _getThumbs: function (css) { - css = css || ''; - return this.getFrames(':not(.file-preview-initial)' + css); - }, - _getThumbId: function (fileId) { - var self = this; - return self.previewInitId + '-' + fileId; - }, - _getExtraData: function (fileId, index) { - var self = this, data = self.uploadExtraData; - if (typeof self.uploadExtraData === 'function') { - data = self.uploadExtraData(fileId, index); - } - return data; - }, - _initXhr: function (xhrobj, fileId, fileCount) { - var self = this, fm = self.fileManager, func = function (event) { - var pct = 0, total = event.total, loaded = event.loaded || event.position, - stats = fm.getUploadStats(fileId, loaded, total); - /** @namespace event.lengthComputable */ - if (event.lengthComputable && !self.enableResumableUpload) { - pct = $h.round(loaded / total * 100); - } - if (fileId) { - self._setFileUploadStats(fileId, pct, fileCount, stats); - } else { - self._setProgress(pct, null, null, self._getStats(stats)); - } - self._raise('fileajaxprogress', [stats]); - }; - if (xhrobj.upload) { - if (self.progressDelay) { - func = $h.debounce(func, self.progressDelay); - } - xhrobj.upload.addEventListener('progress', func, false); - } - return xhrobj; - }, - _initAjaxSettings: function () { - var self = this; - self._ajaxSettings = $.extend(true, {}, self.ajaxSettings); - self._ajaxDeleteSettings = $.extend(true, {}, self.ajaxDeleteSettings); - }, - _mergeAjaxCallback: function (funcName, srcFunc, type) { - var self = this, settings = self._ajaxSettings, flag = self.mergeAjaxCallbacks, targFunc; - if (type === 'delete') { - settings = self._ajaxDeleteSettings; - flag = self.mergeAjaxDeleteCallbacks; - } - targFunc = settings[funcName]; - if (flag && typeof targFunc === 'function') { - if (flag === 'before') { - settings[funcName] = function () { - targFunc.apply(this, arguments); - srcFunc.apply(this, arguments); - }; - } else { - settings[funcName] = function () { - srcFunc.apply(this, arguments); - targFunc.apply(this, arguments); - }; - } - } else { - settings[funcName] = srcFunc; - } - }, - _ajaxSubmit: function (fnBefore, fnSuccess, fnComplete, fnError, formdata, fileId, index, vUrl) { - var self = this, settings, defaults, data, processQueue; - if (!self._raise('filepreajax', [formdata, fileId, index])) { - return; - } - formdata.append('initialPreview', JSON.stringify(self.initialPreview)); - formdata.append('initialPreviewConfig', JSON.stringify(self.initialPreviewConfig)); - formdata.append('initialPreviewThumbTags', JSON.stringify(self.initialPreviewThumbTags)); - self._initAjaxSettings(); - self._mergeAjaxCallback('beforeSend', fnBefore); - self._mergeAjaxCallback('success', fnSuccess); - self._mergeAjaxCallback('complete', fnComplete); - self._mergeAjaxCallback('error', fnError); - vUrl = vUrl || self.uploadUrlThumb || self.uploadUrl; - if (typeof vUrl === 'function') { - vUrl = vUrl(); - } - data = self._getExtraData(fileId, index) || {}; - if (typeof data === 'object') { - $.each(data, function (key, value) { - formdata.append(key, value); - }); - } - defaults = { - xhr: function () { - var xhrobj = $.ajaxSettings.xhr(); - return self._initXhr(xhrobj, fileId, self.fileManager.count()); - }, - url: self._encodeURI(vUrl), - type: 'POST', - dataType: 'json', - data: formdata, - cache: false, - processData: false, - contentType: false - }; - settings = $.extend(true, {}, defaults, self._ajaxSettings); - self.ajaxQueue.push(settings); - processQueue = function () { - var config, xhr; - if (self.ajaxCurrentThreads < self.maxAjaxThreads) { - config = self.ajaxQueue.shift(); - if (typeof config !== 'undefined') { - self.ajaxCurrentThreads++; - xhr = $.ajax(config).done(function () { - clearInterval(self.ajaxQueueIntervalId); - self.ajaxCurrentThreads--; - }); - self.ajaxRequests.push(xhr); - } - } - }; - self.ajaxQueueIntervalId = setInterval(processQueue, self.queueDelay); - - }, - _mergeArray: function (prop, content) { - var self = this, arr1 = $h.cleanArray(self[prop]), arr2 = $h.cleanArray(content); - self[prop] = arr1.concat(arr2); - }, - _initUploadSuccess: function (out, $thumb, allFiles) { - var self = this, append, data, index, $div, $newCache, content, config, tags, id, i; - if (!self.showPreview || typeof out !== 'object' || $.isEmptyObject(out)) { - self._resetCaption(); - return; - } - if (out.initialPreview !== undefined && out.initialPreview.length > 0) { - self.hasInitData = true; - content = out.initialPreview || []; - config = out.initialPreviewConfig || []; - tags = out.initialPreviewThumbTags || []; - append = out.append === undefined || out.append; - if (content.length > 0 && !$h.isArray(content)) { - content = content.split(self.initialPreviewDelimiter); - } - if (content.length) { - self._mergeArray('initialPreview', content); - self._mergeArray('initialPreviewConfig', config); - self._mergeArray('initialPreviewThumbTags', tags); - } - if ($thumb !== undefined) { - if (!allFiles) { - index = self.previewCache.add(content[0], config[0], tags[0], append); - data = self.previewCache.get(index, false); - $div = $(document.createElement('div')).html(data).hide().insertAfter($thumb); - $newCache = $div.find('.kv-zoom-cache'); - if ($newCache && $newCache.length) { - $newCache.insertAfter($thumb); - } - $thumb.fadeOut('slow', function () { - var $newThumb = $div.find('.file-preview-frame'); - if ($newThumb && $newThumb.length) { - $newThumb.insertBefore($thumb).fadeIn('slow').css('display:inline-block'); - } - self._initPreviewActions(); - self._clearFileInput(); - $h.cleanZoomCache(self._getZoom($thumb.attr('id'))); - $thumb.remove(); - $div.remove(); - self._initSortable(); - }); - } else { - id = $thumb.attr('id'); - i = self._getUploadCacheIndex(id); - if (i !== null) { - self.uploadCache[i] = { - id: id, - content: content[0], - config: config[0] || [], - tags: tags[0] || [], - append: append - }; - } - } - } else { - self.previewCache.set(content, config, tags, append); - self._initPreview(); - self._initPreviewActions(); - } - } - self._resetCaption(); - }, - _getUploadCacheIndex: function (id) { - var self = this, i, len = self.uploadCache.length, config; - for (i = 0; i < len; i++) { - config = self.uploadCache[i]; - if (config.id === id) { - return i; - } - } - return null; - }, - _initSuccessThumbs: function () { - var self = this; - if (!self.showPreview) { - return; - } - self._getThumbs($h.FRAMES + '.file-preview-success').each(function () { - var $thumb = $(this), $remove = $thumb.find('.kv-file-remove'); - $remove.removeAttr('disabled'); - self._handler($remove, 'click', function () { - var id = $thumb.attr('id'), - out = self._raise('filesuccessremove', [id, $thumb.attr('data-fileindex')]); - $h.cleanMemory($thumb); - if (out === false) { - return; - } - $thumb.fadeOut('slow', function () { - $h.cleanZoomCache(self._getZoom(id)); - $thumb.remove(); - if (!self.getFrames().length) { - self.reset(); - } - }); - }); - }); - }, - _updateInitialPreview: function () { - var self = this, u = self.uploadCache; - if (self.showPreview) { - $.each(u, function (key, setting) { - self.previewCache.add(setting.content, setting.config, setting.tags, setting.append); - }); - if (self.hasInitData) { - self._initPreview(); - self._initPreviewActions(); - } - } - }, - _uploadSingle: function (i, id, isBatch) { - var self = this, fm = self.fileManager, count = fm.count(), formdata = new FormData(), outData, - previewId = self._getThumbId(id), $thumb, chkComplete, $btnUpload, $btnDelete, - hasPostData = count > 0 || !$.isEmptyObject(self.uploadExtraData), uploadFailed, $prog, fnBefore, - errMsg, fnSuccess, fnComplete, fnError, updateUploadLog, op = self.ajaxOperations.uploadThumb, - fileObj = fm.getFile(id), params = {id: previewId, index: i, fileId: id}, - fileName = self.fileManager.getFileName(id, true); - if (self.enableResumableUpload) { // not enabled for resumable uploads - return; - } - if (self.showPreview) { - $thumb = self.fileManager.getThumb(id); - $prog = $thumb.find('.file-thumb-progress'); - $btnUpload = $thumb.find('.kv-file-upload'); - $btnDelete = $thumb.find('.kv-file-remove'); - $prog.show(); - } - if (count === 0 || !hasPostData || (self.showPreview && $btnUpload && $btnUpload.hasClass('disabled')) || - self._abort(params)) { - return; - } - updateUploadLog = function () { - if (!uploadFailed) { - fm.removeFile(id); - } else { - fm.errors.push(id); - } - fm.setProcessed(id); - if (fm.isProcessed()) { - self.fileBatchCompleted = true; - } - }; - chkComplete = function () { - var $initThumbs; - if (!self.fileBatchCompleted) { - return; - } - setTimeout(function () { - var triggerReset = fm.count() === 0, errCount = fm.errors.length; - self._updateInitialPreview(); - self.unlock(triggerReset); - if (triggerReset) { - self._clearFileInput(); - } - $initThumbs = self.$preview.find('.file-preview-initial'); - if (self.uploadAsync && $initThumbs.length) { - $h.addCss($initThumbs, $h.SORT_CSS); - self._initSortable(); - } - self._raise('filebatchuploadcomplete', [fm.stack, self._getExtraData()]); - if (!self.retryErrorUploads || errCount === 0) { - fm.clear(); - } - self._setProgress(101); - self.ajaxAborted = false; - }, self.processDelay); - }; - fnBefore = function (jqXHR) { - outData = self._getOutData(formdata, jqXHR); - fm.initStats(id); - self.fileBatchCompleted = false; - if (!isBatch) { - self.ajaxAborted = false; - } - if (self.showPreview) { - if (!$thumb.hasClass('file-preview-success')) { - self._setThumbStatus($thumb, 'Loading'); - $h.addCss($thumb, 'file-uploading'); - } - $btnUpload.attr('disabled', true); - $btnDelete.attr('disabled', true); - } - if (!isBatch) { - self.lock(); - } - if (fm.errors.indexOf(id) !== -1) { - delete fm.errors[id]; - } - self._raise('filepreupload', [outData, previewId, i]); - $.extend(true, params, outData); - if (self._abort(params)) { - jqXHR.abort(); - if (!isBatch) { - self._setThumbStatus($thumb, 'New'); - $thumb.removeClass('file-uploading'); - $btnUpload.removeAttr('disabled'); - $btnDelete.removeAttr('disabled'); - self.unlock(); - } - self._setProgressCancelled(); - } - }; - fnSuccess = function (data, textStatus, jqXHR) { - var pid = self.showPreview && $thumb.attr('id') ? $thumb.attr('id') : previewId; - outData = self._getOutData(formdata, jqXHR, data); - $.extend(true, params, outData); - setTimeout(function () { - if ($h.isEmpty(data) || $h.isEmpty(data.error)) { - if (self.showPreview) { - self._setThumbStatus($thumb, 'Success'); - $btnUpload.hide(); - self._initUploadSuccess(data, $thumb, isBatch); - self._setProgress(101, $prog); - } - self._raise('fileuploaded', [outData, pid, i]); - if (!isBatch) { - self.fileManager.remove($thumb); - } else { - updateUploadLog(); - } - } else { - uploadFailed = true; - errMsg = self._parseError(op, jqXHR, self.msgUploadError, self.fileManager.getFileName(id)); - self._showFileError(errMsg, params); - self._setPreviewError($thumb, true); - if (!self.retryErrorUploads) { - $btnUpload.hide(); - } - if (isBatch) { - updateUploadLog(); - } - self._setProgress(101, self._getFrame(pid).find('.file-thumb-progress'), - self.msgUploadError); - } - }, self.processDelay); - }; - fnComplete = function () { - setTimeout(function () { - if (self.showPreview) { - $btnUpload.removeAttr('disabled'); - $btnDelete.removeAttr('disabled'); - $thumb.removeClass('file-uploading'); - } - if (!isBatch) { - self.unlock(false); - self._clearFileInput(); - } else { - chkComplete(); - } - self._initSuccessThumbs(); - }, self.processDelay); - }; - fnError = function (jqXHR, textStatus, errorThrown) { - errMsg = self._parseError(op, jqXHR, errorThrown, self.fileManager.getFileName(id)); - uploadFailed = true; - setTimeout(function () { - var $prog; - if (isBatch) { - updateUploadLog(); - } - self.fileManager.setProgress(id, 100); - self._setPreviewError($thumb, true); - if (!self.retryErrorUploads) { - $btnUpload.hide(); - } - $.extend(true, params, self._getOutData(formdata, jqXHR)); - self._setProgress(101, self.$progress, self.msgAjaxProgressError.replace('{operation}', op)); - $prog = self.showPreview && $thumb ? $thumb.find('.file-thumb-progress') : ''; - self._setProgress(101, $prog, self.msgUploadError); - self._showFileError(errMsg, params); - }, self.processDelay); - }; - formdata.append(self.uploadFileAttr, fileObj.file, fileName); - self._setUploadData(formdata, {fileId: id}); - self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, formdata, id, i); - }, - _uploadBatch: function () { - var self = this, fm = self.fileManager, total = fm.total(), params = {}, fnBefore, fnSuccess, fnError, - fnComplete, hasPostData = total > 0 || !$.isEmptyObject(self.uploadExtraData), errMsg, - setAllUploaded, formdata = new FormData(), op = self.ajaxOperations.uploadBatch; - if (total === 0 || !hasPostData || self._abort(params)) { - return; - } - setAllUploaded = function () { - self.fileManager.clear(); - self._clearFileInput(); - }; - fnBefore = function (jqXHR) { - self.lock(); - fm.initStats(); - var outData = self._getOutData(formdata, jqXHR); - self.ajaxAborted = false; - if (self.showPreview) { - self._getThumbs().each(function () { - var $thumb = $(this), $btnUpload = $thumb.find('.kv-file-upload'), - $btnDelete = $thumb.find('.kv-file-remove'); - if (!$thumb.hasClass('file-preview-success')) { - self._setThumbStatus($thumb, 'Loading'); - $h.addCss($thumb, 'file-uploading'); - } - $btnUpload.attr('disabled', true); - $btnDelete.attr('disabled', true); - }); - } - self._raise('filebatchpreupload', [outData]); - if (self._abort(outData)) { - jqXHR.abort(); - self._getThumbs().each(function () { - var $thumb = $(this), $btnUpload = $thumb.find('.kv-file-upload'), - $btnDelete = $thumb.find('.kv-file-remove'); - if ($thumb.hasClass('file-preview-loading')) { - self._setThumbStatus($thumb, 'New'); - $thumb.removeClass('file-uploading'); - } - $btnUpload.removeAttr('disabled'); - $btnDelete.removeAttr('disabled'); - }); - self._setProgressCancelled(); - } - }; - fnSuccess = function (data, textStatus, jqXHR) { - /** @namespace data.errorkeys */ - var outData = self._getOutData(formdata, jqXHR, data), key = 0, - $thumbs = self._getThumbs(':not(.file-preview-success)'), - keys = $h.isEmpty(data) || $h.isEmpty(data.errorkeys) ? [] : data.errorkeys; - - if ($h.isEmpty(data) || $h.isEmpty(data.error)) { - self._raise('filebatchuploadsuccess', [outData]); - setAllUploaded(); - if (self.showPreview) { - $thumbs.each(function () { - var $thumb = $(this); - self._setThumbStatus($thumb, 'Success'); - $thumb.removeClass('file-uploading'); - $thumb.find('.kv-file-upload').hide().removeAttr('disabled'); - }); - self._initUploadSuccess(data); - } else { - self.reset(); - } - self._setProgress(101); - } else { - if (self.showPreview) { - $thumbs.each(function () { - var $thumb = $(this); - $thumb.removeClass('file-uploading'); - $thumb.find('.kv-file-upload').removeAttr('disabled'); - $thumb.find('.kv-file-remove').removeAttr('disabled'); - if (keys.length === 0 || $.inArray(key, keys) !== -1) { - self._setPreviewError($thumb, true); - if (!self.retryErrorUploads) { - $thumb.find('.kv-file-upload').hide(); - self.fileManager.remove($thumb); - } - } else { - $thumb.find('.kv-file-upload').hide(); - self._setThumbStatus($thumb, 'Success'); - self.fileManager.remove($thumb); - } - if (!$thumb.hasClass('file-preview-error') || self.retryErrorUploads) { - key++; - } - }); - self._initUploadSuccess(data); - } - errMsg = self._parseError(op, jqXHR, self.msgUploadError); - self._showFileError(errMsg, outData, 'filebatchuploaderror'); - self._setProgress(101, self.$progress, self.msgUploadError); - } - }; - fnComplete = function () { - self.unlock(); - self._initSuccessThumbs(); - self._clearFileInput(); - self._raise('filebatchuploadcomplete', [self.fileManager.stack, self._getExtraData()]); - }; - fnError = function (jqXHR, textStatus, errorThrown) { - var outData = self._getOutData(formdata, jqXHR); - errMsg = self._parseError(op, jqXHR, errorThrown); - self._showFileError(errMsg, outData, 'filebatchuploaderror'); - self.uploadFileCount = total - 1; - if (!self.showPreview) { - return; - } - self._getThumbs().each(function () { - var $thumb = $(this); - $thumb.removeClass('file-uploading'); - if (self.fileManager.getFile($thumb.attr('data-fileid'))) { - self._setPreviewError($thumb); - } - }); - self._getThumbs().removeClass('file-uploading'); - self._getThumbs(' .kv-file-upload').removeAttr('disabled'); - self._getThumbs(' .kv-file-delete').removeAttr('disabled'); - self._setProgress(101, self.$progress, self.msgAjaxProgressError.replace('{operation}', op)); - }; - var ctr = 0; - $.each(self.fileManager.stack, function (key, data) { - if (!$h.isEmpty(data.file)) { - formdata.append(self.uploadFileAttr, data.file, (data.nameFmt || ('untitled_' + ctr))); - } - ctr++; - }); - self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, formdata); - }, - _uploadExtraOnly: function () { - var self = this, params = {}, fnBefore, fnSuccess, fnComplete, fnError, formdata = new FormData(), errMsg, - op = self.ajaxOperations.uploadExtra; - if (self._abort(params)) { - return; - } - fnBefore = function (jqXHR) { - self.lock(); - var outData = self._getOutData(formdata, jqXHR); - self._raise('filebatchpreupload', [outData]); - self._setProgress(50); - params.data = outData; - params.xhr = jqXHR; - if (self._abort(params)) { - jqXHR.abort(); - self._setProgressCancelled(); - } - }; - fnSuccess = function (data, textStatus, jqXHR) { - var outData = self._getOutData(formdata, jqXHR, data); - if ($h.isEmpty(data) || $h.isEmpty(data.error)) { - self._raise('filebatchuploadsuccess', [outData]); - self._clearFileInput(); - self._initUploadSuccess(data); - self._setProgress(101); - } else { - errMsg = self._parseError(op, jqXHR, self.msgUploadError); - self._showFileError(errMsg, outData, 'filebatchuploaderror'); - } - }; - fnComplete = function () { - self.unlock(); - self._clearFileInput(); - self._raise('filebatchuploadcomplete', [self.fileManager.stack, self._getExtraData()]); - }; - fnError = function (jqXHR, textStatus, errorThrown) { - var outData = self._getOutData(formdata, jqXHR); - errMsg = self._parseError(op, jqXHR, errorThrown); - params.data = outData; - self._showFileError(errMsg, outData, 'filebatchuploaderror'); - self._setProgress(101, self.$progress, self.msgAjaxProgressError.replace('{operation}', op)); - }; - self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, formdata); - }, - _deleteFileIndex: function ($frame) { - var self = this, ind = $frame.attr('data-fileindex'), rev = self.reversePreviewOrder; - if (ind.substring(0, 5) === $h.INIT_FLAG) { - ind = parseInt(ind.replace($h.INIT_FLAG, '')); - self.initialPreview = $h.spliceArray(self.initialPreview, ind, rev); - self.initialPreviewConfig = $h.spliceArray(self.initialPreviewConfig, ind, rev); - self.initialPreviewThumbTags = $h.spliceArray(self.initialPreviewThumbTags, ind, rev); - self.getFrames().each(function () { - var $nFrame = $(this), nInd = $nFrame.attr('data-fileindex'); - if (nInd.substring(0, 5) === $h.INIT_FLAG) { - nInd = parseInt(nInd.replace($h.INIT_FLAG, '')); - if (nInd > ind) { - nInd--; - $nFrame.attr('data-fileindex', $h.INIT_FLAG + nInd); - } - } - }); - } - }, - _resetCaption: function () { - var self = this; - setTimeout(function () { - var cap, n, chk = self.previewCache.count(true), len = self.fileManager.count(), file, - incomplete = ':not(.file-preview-success):not(.file-preview-error)', - hasThumb = self.showPreview && self.getFrames(incomplete).length; - if (len === 0 && chk === 0 && !hasThumb) { - self.reset(); - } else { - n = chk + len; - if (n > 1) { - cap = self._getMsgSelected(n); - } else { - file = self.fileManager.getFirstFile(); - cap = file ? file.nameFmt : '_'; - } - self._setCaption(cap); - } - }, self.processDelay); - }, - _initFileActions: function () { - var self = this; - if (!self.showPreview) { - return; - } - self._initZoomButton(); - self.getFrames(' .kv-file-remove').each(function () { - var $el = $(this), $frame = $el.closest($h.FRAMES), hasError, id = $frame.attr('id'), - ind = $frame.attr('data-fileindex'), status; - self._handler($el, 'click', function () { - status = self._raise('filepreremove', [id, ind]); - if (status === false || !self._validateMinCount()) { - return false; - } - hasError = $frame.hasClass('file-preview-error'); - $h.cleanMemory($frame); - $frame.fadeOut('slow', function () { - $h.cleanZoomCache(self._getZoom(id)); - self.fileManager.remove($frame); - self._clearObjects($frame); - $frame.remove(); - if (id && hasError) { - self.$errorContainer.find('li[data-thumb-id="' + id + '"]').fadeOut('fast', function () { - $(this).remove(); - if (!self._errorsExist()) { - self._resetErrors(); - } - }); - } - self._clearFileInput(); - self._resetCaption(); - self._raise('fileremoved', [id, ind]); - }); - }); - }); - self.getFrames(' .kv-file-upload').each(function () { - var $el = $(this); - self._handler($el, 'click', function () { - var $frame = $el.closest($h.FRAMES), fileId = $frame.attr('data-fileid'); - self._hideProgress(); - if ($frame.hasClass('file-preview-error') && !self.retryErrorUploads) { - return; - } - self._uploadSingle(self.fileManager.getIndex(fileId), fileId, false); - }); - }); - }, - _initPreviewActions: function () { - var self = this, $preview = self.$preview, deleteExtraData = self.deleteExtraData || {}, - btnRemove = $h.FRAMES + ' .kv-file-remove', settings = self.fileActionSettings, - origClass = settings.removeClass, errClass = settings.removeErrorClass, - resetProgress = function () { - var hasFiles = self.isAjaxUpload ? self.previewCache.count(true) : self._inputFileCount(); - if (!self.getFrames().length && !hasFiles) { - self._setCaption(''); - self.reset(); - self.initialCaption = ''; - } - }; - self._initZoomButton(); - $preview.find(btnRemove).each(function () { - var $el = $(this), vUrl = $el.data('url') || self.deleteUrl, vKey = $el.data('key'), errMsg, fnBefore, - fnSuccess, fnError, op = self.ajaxOperations.deleteThumb; - if ($h.isEmpty(vUrl) || vKey === undefined) { - return; - } - if (typeof vUrl === 'function') { - vUrl = vUrl(); - } - var $frame = $el.closest($h.FRAMES), cache = self.previewCache.data, settings, params, config, - fileName, extraData, index = $frame.attr('data-fileindex'); - index = parseInt(index.replace($h.INIT_FLAG, '')); - config = $h.isEmpty(cache.config) && $h.isEmpty(cache.config[index]) ? null : cache.config[index]; - extraData = $h.isEmpty(config) || $h.isEmpty(config.extra) ? deleteExtraData : config.extra; - fileName = config.filename || config.caption || ''; - if (typeof extraData === 'function') { - extraData = extraData(); - } - params = {id: $el.attr('id'), key: vKey, extra: extraData}; - fnBefore = function (jqXHR) { - self.ajaxAborted = false; - self._raise('filepredelete', [vKey, jqXHR, extraData]); - if (self._abort()) { - jqXHR.abort(); - } else { - $el.removeClass(errClass); - $h.addCss($frame, 'file-uploading'); - $h.addCss($el, 'disabled ' + origClass); - } - }; - fnSuccess = function (data, textStatus, jqXHR) { - var n, cap; - if (!$h.isEmpty(data) && !$h.isEmpty(data.error)) { - params.jqXHR = jqXHR; - params.response = data; - errMsg = self._parseError(op, jqXHR, self.msgDeleteError, fileName); - self._showFileError(errMsg, params, 'filedeleteerror'); - $frame.removeClass('file-uploading'); - $el.removeClass('disabled ' + origClass).addClass(errClass); - resetProgress(); - return; - } - $frame.removeClass('file-uploading').addClass('file-deleted'); - $frame.fadeOut('slow', function () { - index = parseInt(($frame.attr('data-fileindex')).replace($h.INIT_FLAG, '')); - self.previewCache.unset(index); - self._deleteFileIndex($frame); - n = self.previewCache.count(true); - cap = n > 0 ? self._getMsgSelected(n) : ''; - self._setCaption(cap); - self._raise('filedeleted', [vKey, jqXHR, extraData]); - $h.cleanZoomCache(self._getZoom($frame.attr('id'))); - self._clearObjects($frame); - $frame.remove(); - resetProgress(); - }); - }; - fnError = function (jqXHR, textStatus, errorThrown) { - var errMsg = self._parseError(op, jqXHR, errorThrown, fileName); - params.jqXHR = jqXHR; - params.response = {}; - self._showFileError(errMsg, params, 'filedeleteerror'); - $frame.removeClass('file-uploading'); - $el.removeClass('disabled ' + origClass).addClass(errClass); - resetProgress(); - }; - self._initAjaxSettings(); - self._mergeAjaxCallback('beforeSend', fnBefore, 'delete'); - self._mergeAjaxCallback('success', fnSuccess, 'delete'); - self._mergeAjaxCallback('error', fnError, 'delete'); - settings = $.extend(true, {}, { - url: self._encodeURI(vUrl), - type: 'POST', - dataType: 'json', - data: $.extend(true, {}, {key: vKey}, extraData) - }, self._ajaxDeleteSettings); - self._handler($el, 'click', function () { - if (!self._validateMinCount()) { - return false; - } - self.ajaxAborted = false; - self._raise('filebeforedelete', [vKey, extraData]); - //noinspection JSUnresolvedVariable,JSHint - if (self.ajaxAborted instanceof Promise) { - self.ajaxAborted.then(function (result) { - if (!result) { - $.ajax(settings); - } - }); - } else { - if (!self.ajaxAborted) { - $.ajax(settings); - } - } - }); - }); - }, - _hideFileIcon: function () { - var self = this; - if (self.overwriteInitial) { - self.$captionContainer.removeClass('icon-visible'); - } - }, - _showFileIcon: function () { - var self = this; - $h.addCss(self.$captionContainer, 'icon-visible'); - }, - _getSize: function (bytes, sizes) { - var self = this, size = parseFloat(bytes), i, func = self.fileSizeGetter, out; - if (!$.isNumeric(bytes) || !$.isNumeric(size)) { - return ''; - } - if (typeof func === 'function') { - out = func(size); - } else { - if (size === 0) { - out = '0.00 B'; - } else { - i = Math.floor(Math.log(size) / Math.log(1024)); - if (!sizes) { - sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; - } - out = (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + sizes[i]; - } - } - return self._getLayoutTemplate('size').replace('{sizeText}', out); - }, - _getFileType: function (ftype) { - var self = this; - return self.mimeTypeAliases[ftype] || ftype; - }, - _generatePreviewTemplate: function ( - cat, - data, - fname, - ftype, - previewId, - fileId, - isError, - size, - frameClass, - foot, - ind, - templ, - attrs, - zoomData - ) { - var self = this, caption = self.slug(fname), prevContent, zoomContent = '', styleAttribs = '', - screenW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, - config, title = caption, alt = caption, typeCss = 'type-default', getContent, - footer = foot || self._renderFileFooter(cat, caption, size, 'auto', isError), - forcePrevIcon = self.preferIconicPreview, forceZoomIcon = self.preferIconicZoomPreview, - newCat = forcePrevIcon ? 'other' : cat; - config = screenW < 400 ? (self.previewSettingsSmall[newCat] || self.defaults.previewSettingsSmall[newCat]) : - (self.previewSettings[newCat] || self.defaults.previewSettings[newCat]); - if (config) { - $.each(config, function (key, val) { - styleAttribs += key + ':' + val + ';'; - }); - } - getContent = function (c, d, zoom, frameCss) { - var id = zoom ? 'zoom-' + previewId : previewId, tmplt = self._getPreviewTemplate(c), - css = (frameClass || '') + ' ' + frameCss; - if (self.frameClass) { - css = self.frameClass + ' ' + css; - } - if (zoom) { - css = css.replace(' ' + $h.SORT_CSS, ''); - } - tmplt = self._parseFilePreviewIcon(tmplt, fname); - if (c === 'text') { - d = $h.htmlEncode(d); - } - if (cat === 'object' && !ftype) { - $.each(self.defaults.fileTypeSettings, function (key, func) { - if (key === 'object' || key === 'other') { - return; - } - if (func(fname, ftype)) { - typeCss = 'type-' + key; - } - }); - } - if (!$h.isEmpty(attrs)) { - if (attrs.title !== undefined && attrs.title !== null) { - title = attrs.title; - } - if (attrs.alt !== undefined && attrs.alt !== null) { - title = attrs.alt; - } - } - return tmplt.setTokens({ - 'previewId': id, - 'caption': caption, - 'title': title, - 'alt': alt, - 'frameClass': css, - 'type': self._getFileType(ftype), - 'fileindex': ind, - 'fileid': fileId || '', - 'typeCss': typeCss, - 'footer': footer, - 'data': d, - 'template': templ || cat, - 'style': styleAttribs ? 'style="' + styleAttribs + '"' : '' - }); - }; - ind = ind || previewId.slice(previewId.lastIndexOf('-') + 1); - if (self.fileActionSettings.showZoom) { - zoomContent = getContent((forceZoomIcon ? 'other' : cat), zoomData ? zoomData : data, true, - 'kv-zoom-thumb'); - } - zoomContent = '\n' + self._getLayoutTemplate('zoomCache').replace('{zoomContent}', zoomContent); - if (typeof self.sanitizeZoomCache === 'function') { - zoomContent = self.sanitizeZoomCache(zoomContent); - } - prevContent = getContent((forcePrevIcon ? 'other' : cat), data, false, 'kv-preview-thumb'); - return prevContent + zoomContent; - }, - _addToPreview: function ($preview, content) { - var self = this; - return self.reversePreviewOrder ? $preview.prepend(content) : $preview.append(content); - }, - _previewDefault: function (file, isDisabled) { - var self = this, $preview = self.$preview; - if (!self.showPreview) { - return; - } - var fname = $h.getFileName(file), ftype = file ? file.type : '', content, size = file.size || 0, - caption = self._getFileName(file, ''), isError = isDisabled === true && !self.isAjaxUpload, - data = $h.createObjectURL(file), fileId = self.fileManager.getId(file), - previewId = self._getThumbId(fileId); - self._clearDefaultPreview(); - content = self._generatePreviewTemplate('other', data, fname, ftype, previewId, fileId, isError, size); - self._addToPreview($preview, content); - self._setThumbAttr(previewId, caption, size); - if (isDisabled === true && self.isAjaxUpload) { - self._setThumbStatus(self._getFrame(previewId), 'Error'); - } - }, - _previewFile: function (i, file, theFile, data, fileInfo) { - if (!this.showPreview) { - return; - } - var self = this, fname = $h.getFileName(file), ftype = fileInfo.type, caption = fileInfo.name, - cat = self._parseFileType(ftype, fname), content, $preview = self.$preview, fsize = file.size || 0, - iData = (cat === 'text' || cat === 'html' || cat === 'image') ? theFile.target.result : data, - fileId = self.fileManager.getId(file), previewId = self._getThumbId(fileId); - /** @namespace window.DOMPurify */ - if (cat === 'html' && self.purifyHtml && window.DOMPurify) { - iData = window.DOMPurify.sanitize(iData); - } - content = self._generatePreviewTemplate(cat, iData, fname, ftype, previewId, fileId, false, fsize); - self._clearDefaultPreview(); - self._addToPreview($preview, content); - var $thumb = self._getFrame(previewId); - self._validateImageOrientation($thumb.find('img'), file, previewId, fileId, caption, ftype, fsize, iData); - self._setThumbAttr(previewId, caption, fsize); - self._initSortable(); - }, - _setThumbAttr: function (id, caption, size) { - var self = this, $frame = self._getFrame(id); - if ($frame.length) { - size = size && size > 0 ? self._getSize(size) : ''; - $frame.data({'caption': caption, 'size': size}); - } - }, - _setInitThumbAttr: function () { - var self = this, data = self.previewCache.data, len = self.previewCache.count(true), config, - caption, size, previewId; - if (len === 0) { - return; - } - for (var i = 0; i < len; i++) { - config = data.config[i]; - previewId = self.previewInitId + '-' + $h.INIT_FLAG + i; - caption = $h.ifSet('caption', config, $h.ifSet('filename', config)); - size = $h.ifSet('size', config); - self._setThumbAttr(previewId, caption, size); - } - }, - _slugDefault: function (text) { - // noinspection RegExpRedundantEscape - return $h.isEmpty(text, true) ? '' : String(text).replace(/[\[\]\/\{}:;#%=\(\)\*\+\?\\\^\$\|<>&"']/g, '_'); - }, - _updateFileDetails: function (numFiles, skipRaiseEvent) { - var self = this, $el = self.$element, label, n, log, nFiles, file, - name = ($h.isIE(9) && $h.findFileName($el.val())) || ($el[0].files[0] && $el[0].files[0].name); - if (!name && self.fileManager.count() > 0) { - file = self.fileManager.getFirstFile(); - label = file.nameFmt; - } else { - label = name ? self.slug(name) : '_'; - } - n = self.isAjaxUpload ? self.fileManager.count() : numFiles; - nFiles = self.previewCache.count(true) + n; - log = n === 1 ? label : self._getMsgSelected(nFiles); - if (self.isError) { - self.$previewContainer.removeClass('file-thumb-loading'); - self.$previewStatus.html(''); - self.$captionContainer.removeClass('icon-visible'); - } else { - self._showFileIcon(); - } - self._setCaption(log, self.isError); - self.$container.removeClass('file-input-new file-input-ajax-new'); - if (!skipRaiseEvent) { - self._raise('fileselect', [numFiles, label]); - } - if (self.previewCache.count(true)) { - self._initPreviewActions(); - } - }, - _setThumbStatus: function ($thumb, status) { - var self = this; - if (!self.showPreview) { - return; - } - var icon = 'indicator' + status, msg = icon + 'Title', - css = 'file-preview-' + status.toLowerCase(), - $indicator = $thumb.find('.file-upload-indicator'), - config = self.fileActionSettings; - $thumb.removeClass('file-preview-success file-preview-error file-preview-paused file-preview-loading'); - if (status === 'Success') { - $thumb.find('.file-drag-handle').remove(); - } - $indicator.html(config[icon]); - $indicator.attr('title', config[msg]); - $thumb.addClass(css); - if (status === 'Error' && !self.retryErrorUploads) { - $thumb.find('.kv-file-upload').attr('disabled', true); - } - }, - _setProgressCancelled: function () { - var self = this; - self._setProgress(101, self.$progress, self.msgCancelled); - }, - _setProgress: function (p, $el, error, stats) { - var self = this; - $el = $el || self.$progress; - if (!$el.length) { - return; - } - var pct = Math.min(p, 100), out, pctLimit = self.progressUploadThreshold, - t = p <= 100 ? self.progressTemplate : self.progressCompleteTemplate, - template = pct < 100 ? self.progressTemplate : - (error ? (self.paused ? self.progressPauseTemplate : self.progressErrorTemplate) : t); - if (p >= 100) { - stats = ''; - } - if (!$h.isEmpty(template)) { - if (pctLimit && pct > pctLimit && p <= 100) { - out = template.setTokens({'percent': pctLimit, 'status': self.msgUploadThreshold}); - } else { - out = template.setTokens({'percent': pct, 'status': (p > 100 ? self.msgUploadEnd : pct + '%')}); - } - stats = stats || ''; - out = out.setTokens({stats: stats}); - $el.html(out); - if (error) { - $el.find('[role="progressbar"]').html(error); - } - } - }, - _setFileDropZoneTitle: function () { - var self = this, $zone = self.$container.find('.file-drop-zone'), title = self.dropZoneTitle, strFiles; - if (self.isClickable) { - strFiles = $h.isEmpty(self.$element.attr('multiple')) ? self.fileSingle : self.filePlural; - title += self.dropZoneClickTitle.replace('{files}', strFiles); - } - $zone.find('.' + self.dropZoneTitleClass).remove(); - if (!self.showPreview || $zone.length === 0 || self.fileManager.count() > 0 || !self.dropZoneEnabled || - (!self.isAjaxUpload && self.$element.files)) { - return; - } - if ($zone.find($h.FRAMES).length === 0 && $h.isEmpty(self.defaultPreviewContent)) { - $zone.prepend('
    ' + title + '
    '); - } - self.$container.removeClass('file-input-new'); - $h.addCss(self.$container, 'file-input-ajax-new'); - }, - _getStats: function (stats) { - var self = this, pendingTime, t; - if (!self.showUploadStats || !stats || !stats.bitrate) { - return ''; - } - t = self._getLayoutTemplate('stats'); - pendingTime = (!stats.elapsed || !stats.bps) ? self.msgCalculatingTime : - self.msgPendingTime.setTokens({time: $h.getElapsed(Math.ceil(stats.pendingBytes / stats.bps))}); - - return t.setTokens({ - uploadSpeed: stats.bitrate, - pendingTime: pendingTime - }); - }, - _setResumableProgress: function (pct, stats, $thumb) { - var self = this, rm = self.resumableManager, obj = $thumb ? rm : self, - $prog = $thumb ? $thumb.find('.file-thumb-progress') : null; - if (obj.lastProgress === 0) { - obj.lastProgress = pct; - } - if (pct < obj.lastProgress) { - pct = obj.lastProgress; - } - self._setProgress(pct, $prog, null, self._getStats(stats)); - obj.lastProgress = pct; - }, - _toggleResumableProgress: function (template, message) { - var self = this, $progress = self.$progress; - if ($progress && $progress.length) { - $progress.html(template.setTokens({ - percent: 101, - status: message, - stats: '' - })); - } - }, - _setFileUploadStats: function (id, pct, total, stats) { - var self = this, $prog = self.$progress; - if (!self.showPreview && (!$prog || !$prog.length)) { - return; - } - var fm = self.fileManager, $thumb = fm.getThumb(id), pctTot, rm = self.resumableManager, - totUpSize = 0, totSize = fm.getTotalSize(), totStats = $.extend(true, {}, stats); - if (self.enableResumableUpload) { - var loaded = stats.loaded, currUplSize = rm.getUploadedSize(), currTotSize = rm.file.size, totLoaded; - loaded += currUplSize; - totLoaded = fm.uploadedSize + loaded; - pct = $h.round(100 * loaded / currTotSize); - stats.pendingBytes = currTotSize - currUplSize; - self._setResumableProgress(pct, stats, $thumb); - pctTot = Math.floor(100 * totLoaded / totSize); - totStats.pendingBytes = totSize - totLoaded; - self._setResumableProgress(pctTot, totStats); - } else { - fm.setProgress(id, pct); - $prog = $thumb && $thumb.length ? $thumb.find('.file-thumb-progress') : null; - self._setProgress(pct, $prog, null, self._getStats(stats)); - $.each(fm.stats, function (id, cfg) { - totUpSize += cfg.loaded; - }); - totStats.pendingBytes = totSize - totUpSize; - pctTot = $h.round(totUpSize / totSize * 100); - self._setProgress(pctTot, null, null, self._getStats(totStats)); - } - }, - _validateMinCount: function () { - var self = this, len = self.isAjaxUpload ? self.fileManager.count() : self._inputFileCount(); - if (self.validateInitialCount && self.minFileCount > 0 && self._getFileCount(len - 1) < self.minFileCount) { - self._noFilesError({}); - return false; - } - return true; - }, - _getFileCount: function (fileCount, includeInitial) { - var self = this, addCount = 0; - if (includeInitial === undefined) { - includeInitial = self.validateInitialCount && !self.overwriteInitial; - } - if (includeInitial) { - addCount = self.previewCache.count(true); - fileCount += addCount; - } - return fileCount; - }, - _getFileId: function (file) { - return $h.getFileId(file, this.generateFileId); - }, - _getFileName: function (file, defaultValue) { - var self = this, fileName = $h.getFileName(file); - return fileName ? self.slug(fileName) : defaultValue; - }, - _getFileNames: function (skipNull) { - var self = this; - return self.filenames.filter(function (n) { - return (skipNull ? n !== undefined : n !== undefined && n !== null); - }); - }, - _setPreviewError: function ($thumb, keepFile) { - var self = this, removeFrame = self.removeFromPreviewOnError && !self.retryErrorUploads; - if (!keepFile || removeFrame) { - self.fileManager.remove($thumb); - } - if (!self.showPreview) { - return; - } - if (removeFrame) { - $thumb.remove(); - return; - } else { - self._setThumbStatus($thumb, 'Error'); - } - self._refreshUploadButton($thumb); - }, - _refreshUploadButton: function ($thumb) { - var self = this, $btn = $thumb.find('.kv-file-upload'), cfg = self.fileActionSettings, - icon = cfg.uploadIcon, title = cfg.uploadTitle; - if (!$btn.length) { - return; - } - if (self.retryErrorUploads) { - icon = cfg.uploadRetryIcon; - title = cfg.uploadRetryTitle; - } - $btn.attr('title', title).html(icon); - }, - _checkDimensions: function (i, chk, $img, $thumb, fname, type, params) { - var self = this, msg, dim, tag = chk === 'Small' ? 'min' : 'max', limit = self[tag + 'Image' + type], - $imgEl, isValid; - if ($h.isEmpty(limit) || !$img.length) { - return; - } - $imgEl = $img[0]; - dim = (type === 'Width') ? $imgEl.naturalWidth || $imgEl.width : $imgEl.naturalHeight || $imgEl.height; - isValid = chk === 'Small' ? dim >= limit : dim <= limit; - if (isValid) { - return; - } - msg = self['msgImage' + type + chk].setTokens({'name': fname, 'size': limit}); - self._showFileError(msg, params); - self._setPreviewError($thumb); - }, - _getExifObj: function (data) { - var self = this, exifObj = null, error = $h.logMessages.exifWarning; - if (data.slice(0, 23) !== 'data:image/jpeg;base64,' && data.slice(0, 22) !== 'data:image/jpg;base64,') { - exifObj = null; - return; - } - try { - exifObj = window.piexif ? window.piexif.load(data) : null; - } catch (err) { - exifObj = null; - error = err && err.message || ''; - } - if (!exifObj) { - self._log($h.logMessages.badExifParser, {details: error}); - } - return exifObj; - }, - setImageOrientation: function ($img, $zoomImg, value, $thumb) { - var self = this, invalidImg = !$img || !$img.length, invalidZoomImg = !$zoomImg || !$zoomImg.length, $mark, - isHidden = false, $div, zoomOnly = invalidImg && $thumb && $thumb.attr('data-template') === 'image', ev; - if (invalidImg && invalidZoomImg) { - return; - } - ev = 'load.fileinputimageorient'; - if (zoomOnly) { - $img = $zoomImg; - $zoomImg = null; - $img.css(self.previewSettings.image); - $div = $(document.createElement('div')).appendTo($thumb.find('.kv-file-content')); - $mark = $(document.createElement('span')).insertBefore($img); - $img.css('visibility', 'hidden').removeClass('file-zoom-detail').appendTo($div); - } else { - isHidden = !$img.is(':visible'); - } - $img.off(ev).on(ev, function () { - if (isHidden) { - self.$preview.removeClass('hide-content'); - $thumb.find('.kv-file-content').css('visibility', 'hidden'); - } - var img = $img.get(0), zoomImg = $zoomImg && $zoomImg.length ? $zoomImg.get(0) : null, - h = img.offsetHeight, w = img.offsetWidth, r = $h.getRotation(value); - if (isHidden) { - $thumb.find('.kv-file-content').css('visibility', 'visible'); - self.$preview.addClass('hide-content'); - } - $img.data('orientation', value); - if (zoomImg) { - $zoomImg.data('orientation', value); - } - if (value < 5) { - $h.setTransform(img, r); - $h.setTransform(zoomImg, r); - return; - } - var offsetAngle = Math.atan(w / h), origFactor = Math.sqrt(Math.pow(h, 2) + Math.pow(w, 2)), - scale = !origFactor ? 1 : (h / Math.cos(Math.PI / 2 + offsetAngle)) / origFactor, - s = ' scale(' + Math.abs(scale) + ')'; - $h.setTransform(img, r + s); - $h.setTransform(zoomImg, r + s); - if (zoomOnly) { - $img.css('visibility', 'visible').insertAfter($mark).addClass('file-zoom-detail'); - $mark.remove(); - $div.remove(); - } - }); - }, - _validateImageOrientation: function ($img, file, previewId, fileId, caption, ftype, fsize, iData) { - var self = this, exifObj, value, autoOrientImage = self.autoOrientImage, - selector = $h.getZoomSelector(previewId, ' img'); - exifObj = autoOrientImage ? self._getExifObj(iData) : null; - value = exifObj ? exifObj['0th'][piexif.ImageIFD.Orientation] : null; // jshint ignore:line - if (!value) { - self._validateImage(previewId, fileId, caption, ftype, fsize, iData, exifObj); - return; - } - self.setImageOrientation($img, $(selector), value, self._getFrame(previewId)); - self._raise('fileimageoriented', {'$img': $img, 'file': file}); - self._validateImage(previewId, fileId, caption, ftype, fsize, iData, exifObj); - }, - _validateImage: function (previewId, fileId, fname, ftype, fsize, iData, exifObj) { - var self = this, $preview = self.$preview, params, w1, w2, $thumb = self._getFrame(previewId), - i = $thumb.attr('data-fileindex'), $img = $thumb.find('img'); - fname = fname || 'Untitled'; - $img.one('load', function () { - w1 = $thumb.width(); - w2 = $preview.width(); - if (w1 > w2) { - $img.css('width', '100%'); - } - params = {ind: i, id: previewId, fileId: fileId}; - self._checkDimensions(i, 'Small', $img, $thumb, fname, 'Width', params); - self._checkDimensions(i, 'Small', $img, $thumb, fname, 'Height', params); - if (!self.resizeImage) { - self._checkDimensions(i, 'Large', $img, $thumb, fname, 'Width', params); - self._checkDimensions(i, 'Large', $img, $thumb, fname, 'Height', params); - } - self._raise('fileimageloaded', [previewId]); - self.fileManager.addImage(fileId, { - ind: i, - img: $img, - thumb: $thumb, - pid: previewId, - typ: ftype, - siz: fsize, - validated: false, - imgData: iData, - exifObj: exifObj - }); - $thumb.data('exif', exifObj); - self._validateAllImages(); - }).one('error', function () { - self._raise('fileimageloaderror', [previewId]); - }).each(function () { - if (this.complete) { - $(this).trigger('load'); - } else { - if (this.error) { - $(this).trigger('error'); - } - } - }); - }, - _validateAllImages: function () { - var self = this, counter = {val: 0}, numImgs = self.fileManager.getImageCount(), fsize, - minSize = self.resizeIfSizeMoreThan; - if (numImgs !== self.fileManager.totalImages) { - return; - } - self._raise('fileimagesloaded'); - if (!self.resizeImage) { - return; - } - $.each(self.fileManager.loadedImages, function (id, config) { - if (!config.validated) { - fsize = config.siz; - if (fsize && fsize > minSize * 1000) { - self._getResizedImage(id, config, counter, numImgs); - } - config.validated = true; - } - }); - }, - _getResizedImage: function (id, config, counter, numImgs) { - var self = this, img = $(config.img)[0], width = img.naturalWidth, height = img.naturalHeight, blob, - ratio = 1, maxWidth = self.maxImageWidth || width, maxHeight = self.maxImageHeight || height, - isValidImage = !!(width && height), chkWidth, chkHeight, canvas = self.imageCanvas, dataURI, - context = self.imageCanvasContext, type = config.typ, pid = config.pid, ind = config.ind, - $thumb = config.thumb, throwError, msg, exifObj = config.exifObj, exifStr, file, params, evParams; - throwError = function (msg, params, ev) { - if (self.isAjaxUpload) { - self._showFileError(msg, params, ev); - } else { - self._showError(msg, params, ev); - } - self._setPreviewError($thumb); - }; - file = self.fileManager.getFile(id); - params = {id: pid, 'index': ind, fileId: id}; - evParams = [id, pid, ind]; - if (!file || !isValidImage || (width <= maxWidth && height <= maxHeight)) { - if (isValidImage && file) { - self._raise('fileimageresized', evParams); - } - counter.val++; - if (counter.val === numImgs) { - self._raise('fileimagesresized'); - } - if (!isValidImage) { - throwError(self.msgImageResizeError, params, 'fileimageresizeerror'); - return; - } - } - type = type || self.resizeDefaultImageType; - chkWidth = width > maxWidth; - chkHeight = height > maxHeight; - if (self.resizePreference === 'width') { - ratio = chkWidth ? maxWidth / width : (chkHeight ? maxHeight / height : 1); - } else { - ratio = chkHeight ? maxHeight / height : (chkWidth ? maxWidth / width : 1); - } - self._resetCanvas(); - width *= ratio; - height *= ratio; - canvas.width = width; - canvas.height = height; - try { - context.drawImage(img, 0, 0, width, height); - dataURI = canvas.toDataURL(type, self.resizeQuality); - if (exifObj) { - exifStr = window.piexif.dump(exifObj); - dataURI = window.piexif.insert(exifStr, dataURI); - } - blob = $h.dataURI2Blob(dataURI); - self.fileManager.setFile(id, blob); - self._raise('fileimageresized', evParams); - counter.val++; - if (counter.val === numImgs) { - self._raise('fileimagesresized', [undefined, undefined]); - } - if (!(blob instanceof Blob)) { - throwError(self.msgImageResizeError, params, 'fileimageresizeerror'); - } - } catch (err) { - counter.val++; - if (counter.val === numImgs) { - self._raise('fileimagesresized', [undefined, undefined]); - } - msg = self.msgImageResizeException.replace('{errors}', err.message); - throwError(msg, params, 'fileimageresizeexception'); - } - }, - _showProgress: function () { - var self = this; - if (self.$progress && self.$progress.length) { - self.$progress.show(); - } - }, - _hideProgress: function () { - var self = this; - if (self.$progress && self.$progress.length) { - self.$progress.hide(); - } - }, - _initBrowse: function ($container) { - var self = this, $el = self.$element; - if (self.showBrowse) { - self.$btnFile = $container.find('.btn-file').append($el); - } else { - $el.appendTo($container).attr('tabindex', -1); - $h.addCss($el, 'file-no-browse'); - } - }, - _initClickable: function () { - var self = this, $zone, $tmpZone; - if (!self.isClickable) { - return; - } - $zone = self.$dropZone; - if (!self.isAjaxUpload) { - $tmpZone = self.$preview.find('.file-default-preview'); - if ($tmpZone.length) { - $zone = $tmpZone; - } - } - - $h.addCss($zone, 'clickable'); - $zone.attr('tabindex', -1); - self._handler($zone, 'click', function (e) { - var $tar = $(e.target); - if (!$(self.elErrorContainer + ':visible').length && - (!$tar.parents('.file-preview-thumbnails').length || $tar.parents( - '.file-default-preview').length)) { - self.$element.data('zoneClicked', true).trigger('click'); - $zone.blur(); - } - }); - }, - _initCaption: function () { - var self = this, cap = self.initialCaption || ''; - if (self.overwriteInitial || $h.isEmpty(cap)) { - self.$caption.val(''); - return false; - } - self._setCaption(cap); - return true; - }, - _setCaption: function (content, isError) { - var self = this, title, out, icon, n, cap, file; - if (!self.$caption.length) { - return; - } - self.$captionContainer.removeClass('icon-visible'); - if (isError) { - title = $('
    ' + self.msgValidationError + '
    ').text(); - n = self.fileManager.count(); - if (n) { - file = self.fileManager.getFirstFile(); - cap = n === 1 && file ? file.nameFmt : self._getMsgSelected(n); - } else { - cap = self._getMsgSelected(self.msgNo); - } - out = $h.isEmpty(content) ? cap : content; - icon = '' + self.msgValidationErrorIcon + ''; - } else { - if ($h.isEmpty(content)) { - return; - } - title = $('
    ' + content + '
    ').text(); - out = title; - icon = self._getLayoutTemplate('fileIcon'); - } - self.$captionContainer.addClass('icon-visible'); - self.$caption.attr('title', title).val(out); - self.$captionIcon.html(icon); - }, - _createContainer: function () { - var self = this, attribs = {'class': 'file-input file-input-new' + (self.rtl ? ' kv-rtl' : '')}, - $container = $(document.createElement('div')).attr(attribs).html(self._renderMain()); - $container.insertBefore(self.$element); - self._initBrowse($container); - if (self.theme) { - $container.addClass('theme-' + self.theme); - } - return $container; - }, - _refreshContainer: function () { - var self = this, $container = self.$container, $el = self.$element; - $el.insertAfter($container); - $container.html(self._renderMain()); - self._initBrowse($container); - self._validateDisabled(); - }, - _validateDisabled: function () { - var self = this; - self.$caption.attr({readonly: self.isDisabled}); - }, - _renderMain: function () { - var self = this, - dropCss = self.dropZoneEnabled ? ' file-drop-zone' : 'file-drop-disabled', - close = !self.showClose ? '' : self._getLayoutTemplate('close'), - preview = !self.showPreview ? '' : self._getLayoutTemplate('preview') - .setTokens({'class': self.previewClass, 'dropClass': dropCss}), - css = self.isDisabled ? self.captionClass + ' file-caption-disabled' : self.captionClass, - caption = self.captionTemplate.setTokens({'class': css + ' kv-fileinput-caption'}); - return self.mainTemplate.setTokens({ - 'class': self.mainClass + (!self.showBrowse && self.showCaption ? ' no-browse' : ''), - 'preview': preview, - 'close': close, - 'caption': caption, - 'upload': self._renderButton('upload'), - 'remove': self._renderButton('remove'), - 'cancel': self._renderButton('cancel'), - 'pause': self._renderButton('pause'), - 'browse': self._renderButton('browse') - }); - - }, - _renderButton: function (type) { - var self = this, tmplt = self._getLayoutTemplate('btnDefault'), css = self[type + 'Class'], - title = self[type + 'Title'], icon = self[type + 'Icon'], label = self[type + 'Label'], - status = self.isDisabled ? ' disabled' : '', btnType = 'button'; - switch (type) { - case 'remove': - if (!self.showRemove) { - return ''; - } - break; - case 'cancel': - if (!self.showCancel) { - return ''; - } - css += ' kv-hidden'; - break; - case 'pause': - if (!self.showPause) { - return ''; - } - css += ' kv-hidden'; - break; - case 'upload': - if (!self.showUpload) { - return ''; - } - if (self.isAjaxUpload && !self.isDisabled) { - tmplt = self._getLayoutTemplate('btnLink').replace('{href}', self.uploadUrl); - } else { - btnType = 'submit'; - } - break; - case 'browse': - if (!self.showBrowse) { - return ''; - } - tmplt = self._getLayoutTemplate('btnBrowse'); - break; - default: - return ''; - } - - css += type === 'browse' ? ' btn-file' : ' fileinput-' + type + ' fileinput-' + type + '-button'; - if (!$h.isEmpty(label)) { - label = ' ' + label + ''; - } - return tmplt.setTokens({ - 'type': btnType, 'css': css, 'title': title, 'status': status, 'icon': icon, 'label': label - }); - }, - _renderThumbProgress: function () { - var self = this; - return '
    ' + - self.progressInfoTemplate.setTokens({percent: 101, status: self.msgUploadBegin, stats: ''}) + - '
    '; - }, - _renderFileFooter: function (cat, caption, size, width, isError) { - var self = this, config = self.fileActionSettings, rem = config.showRemove, drg = config.showDrag, - upl = config.showUpload, zoom = config.showZoom, out, params, - template = self._getLayoutTemplate('footer'), tInd = self._getLayoutTemplate('indicator'), - ind = isError ? config.indicatorError : config.indicatorNew, - title = isError ? config.indicatorErrorTitle : config.indicatorNewTitle, - indicator = tInd.setTokens({'indicator': ind, 'indicatorTitle': title}); - size = self._getSize(size); - params = {type: cat, caption: caption, size: size, width: width, progress: '', indicator: indicator}; - if (self.isAjaxUpload) { - params.progress = self._renderThumbProgress(); - params.actions = self._renderFileActions(params, upl, false, rem, zoom, drg, false, false, false); - } else { - params.actions = self._renderFileActions(params, false, false, false, zoom, drg, false, false, false); - } - out = template.setTokens(params); - out = $h.replaceTags(out, self.previewThumbTags); - return out; - }, - _renderFileActions: function ( - cfg, - showUpl, - showDwn, - showDel, - showZoom, - showDrag, - disabled, - url, - key, - isInit, - dUrl, - dFile - ) { - var self = this; - if (!cfg.type && isInit) { - cfg.type = 'image'; - } - if (self.enableResumableUpload) { - showUpl = false; - } else { - if (typeof showUpl === 'function') { - showUpl = showUpl(cfg); - } - } - if (typeof showDwn === 'function') { - showDwn = showDwn(cfg); - } - if (typeof showDel === 'function') { - showDel = showDel(cfg); - } - if (typeof showZoom === 'function') { - showZoom = showZoom(cfg); - } - if (typeof showDrag === 'function') { - showDrag = showDrag(cfg); - } - if (!showUpl && !showDwn && !showDel && !showZoom && !showDrag) { - return ''; - } - var vUrl = url === false ? '' : ' data-url="' + url + '"', btnZoom = '', btnDrag = '', css, - vKey = key === false ? '' : ' data-key="' + key + '"', btnDelete = '', btnUpload = '', btnDownload = '', - template = self._getLayoutTemplate('actions'), config = self.fileActionSettings, - otherButtons = self.otherActionButtons.setTokens({'dataKey': vKey, 'key': key}), - removeClass = disabled ? config.removeClass + ' disabled' : config.removeClass; - if (showDel) { - btnDelete = self._getLayoutTemplate('actionDelete').setTokens({ - 'removeClass': removeClass, - 'removeIcon': config.removeIcon, - 'removeTitle': config.removeTitle, - 'dataUrl': vUrl, - 'dataKey': vKey, - 'key': key - }); - } - if (showUpl) { - btnUpload = self._getLayoutTemplate('actionUpload').setTokens({ - 'uploadClass': config.uploadClass, - 'uploadIcon': config.uploadIcon, - 'uploadTitle': config.uploadTitle - }); - } - if (showDwn) { - btnDownload = self._getLayoutTemplate('actionDownload').setTokens({ - 'downloadClass': config.downloadClass, - 'downloadIcon': config.downloadIcon, - 'downloadTitle': config.downloadTitle, - 'downloadUrl': dUrl || self.initialPreviewDownloadUrl - }); - btnDownload = btnDownload.setTokens({'filename': dFile, 'key': key}); - } - if (showZoom) { - btnZoom = self._getLayoutTemplate('actionZoom').setTokens({ - 'zoomClass': config.zoomClass, - 'zoomIcon': config.zoomIcon, - 'zoomTitle': config.zoomTitle - }); - } - if (showDrag && isInit) { - css = 'drag-handle-init ' + config.dragClass; - btnDrag = self._getLayoutTemplate('actionDrag').setTokens({ - 'dragClass': css, - 'dragTitle': config.dragTitle, - 'dragIcon': config.dragIcon - }); - } - return template.setTokens({ - 'delete': btnDelete, - 'upload': btnUpload, - 'download': btnDownload, - 'zoom': btnZoom, - 'drag': btnDrag, - 'other': otherButtons - }); - }, - _browse: function (e) { - var self = this; - if (e && e.isDefaultPrevented() || !self._raise('filebrowse')) { - return; - } - if (self.isError && !self.isAjaxUpload) { - self.clear(); - } - if (self.focusCaptionOnBrowse) { - self.$captionContainer.focus(); - } - }, - _change: function (e) { - var self = this; - if (self.changeTriggered) { - return; - } - var $el = self.$element, isDragDrop = arguments.length > 1, isAjaxUpload = self.isAjaxUpload, - tfiles, files = isDragDrop ? arguments[1] : $el.get(0).files, ctr = self.fileManager.count(), - total, initCount, len, isSingleUpl = $h.isEmpty($el.attr('multiple')), - maxCount = !isAjaxUpload && isSingleUpl ? 1 : self.maxFileCount, maxTotCount = self.maxTotalFileCount, - inclAll = maxTotCount > 0 && maxTotCount > maxCount, flagSingle = (isSingleUpl && ctr > 0), - throwError = function (mesg, file, previewId, index) { - var p1 = $.extend(true, {}, self._getOutData(null, {}, {}, files), {id: previewId, index: index}), - p2 = {id: previewId, index: index, file: file, files: files}; - return isAjaxUpload ? self._showFileError(mesg, p1) : self._showError(mesg, p2); - }, - maxCountCheck = function (n, m, all) { - var msg = all ? self.msgTotalFilesTooMany : self.msgFilesTooMany; - msg = msg.replace('{m}', m).replace('{n}', n); - self.isError = throwError(msg, null, null, null); - self.$captionContainer.removeClass('icon-visible'); - self._setCaption('', true); - self.$container.removeClass('file-input-new file-input-ajax-new'); - }; - self.reader = null; - self._resetUpload(); - self._hideFileIcon(); - if (self.dropZoneEnabled) { - self.$container.find('.file-drop-zone .' + self.dropZoneTitleClass).remove(); - } - if (!isAjaxUpload) { - if (e.target && e.target.files === undefined) { - files = e.target.value ? [{name: e.target.value.replace(/^.+\\/, '')}] : []; - } else { - files = e.target.files || {}; - } - } - tfiles = files; - if ($h.isEmpty(tfiles) || tfiles.length === 0) { - if (!isAjaxUpload) { - self.clear(); - } - self._raise('fileselectnone'); - return; - } - self._resetErrors(); - len = tfiles.length; - initCount = isAjaxUpload ? (self.fileManager.count() + len) : len; - total = self._getFileCount(initCount, inclAll ? false : undefined); - if (maxCount > 0 && total > maxCount) { - if (!self.autoReplace || len > maxCount) { - maxCountCheck((self.autoReplace && len > maxCount ? len : total), maxCount); - return; - } - if (total > maxCount) { - self._resetPreviewThumbs(isAjaxUpload); - } - } else { - if (inclAll) { - total = self._getFileCount(initCount, true); - if (maxTotCount > 0 && total > maxTotCount) { - if (!self.autoReplace || len > maxCount) { - maxCountCheck((self.autoReplace && len > maxTotCount ? len : total), maxTotCount, true); - return; - } - if (total > maxCount) { - self._resetPreviewThumbs(isAjaxUpload); - } - } - } - if (!isAjaxUpload || flagSingle) { - self._resetPreviewThumbs(false); - if (flagSingle) { - self.clearFileStack(); - } - } else { - if (isAjaxUpload && ctr === 0 && (!self.previewCache.count(true) || self.overwriteInitial)) { - self._resetPreviewThumbs(true); - } - } - } - self.readFiles(tfiles); - }, - _abort: function (params) { - var self = this, data; - if (self.ajaxAborted && typeof self.ajaxAborted === 'object' && self.ajaxAborted.message !== undefined) { - data = $.extend(true, {}, self._getOutData(null), params); - data.abortData = self.ajaxAborted.data || {}; - data.abortMessage = self.ajaxAborted.message; - self._setProgress(101, self.$progress, self.msgCancelled); - self._showFileError(self.ajaxAborted.message, data, 'filecustomerror'); - self.cancel(); - return true; - } - return !!self.ajaxAborted; - }, - _resetFileStack: function () { - var self = this, i = 0; - self._getThumbs().each(function () { - var $thumb = $(this), ind = $thumb.attr('data-fileindex'), pid = $thumb.attr('id'); - if (ind === '-1' || ind === -1) { - return; - } - if (!self.fileManager.getFile($thumb.attr('data-fileid'))) { - $thumb.attr({'data-fileindex': i}); - i++; - } else { - $thumb.attr({'data-fileindex': '-1'}); - } - self._getZoom(pid).attr({ - 'data-fileindex': $thumb.attr('data-fileindex') - }); - }); - }, - _isFileSelectionValid: function (cnt) { - var self = this; - cnt = cnt || 0; - if (self.required && !self.getFilesCount()) { - self.$errorContainer.html(''); - self._showFileError(self.msgFileRequired); - return false; - } - if (self.minFileCount > 0 && self._getFileCount(cnt) < self.minFileCount) { - self._noFilesError({}); - return false; - } - return true; - }, - _canPreview: function (file) { - var self = this; - if (!file || !self.showPreview || !self.$preview || !self.$preview.length) { - return false; - } - var name = file.name || '', type = file.type || '', size = (file.size || 0) / 1000, - cat = self._parseFileType(type, name), allowedTypes, allowedMimes, allowedExts, skipPreview, - types = self.allowedPreviewTypes, mimes = self.allowedPreviewMimeTypes, - exts = self.allowedPreviewExtensions || [], dTypes = self.disabledPreviewTypes, - dMimes = self.disabledPreviewMimeTypes, dExts = self.disabledPreviewExtensions || [], - maxSize = self.maxFilePreviewSize && parseFloat(self.maxFilePreviewSize) || 0, - expAllExt = new RegExp('\\.(' + exts.join('|') + ')$', 'i'), - expDisExt = new RegExp('\\.(' + dExts.join('|') + ')$', 'i'); - allowedTypes = !types || types.indexOf(cat) !== -1; - allowedMimes = !mimes || mimes.indexOf(type) !== -1; - allowedExts = !exts.length || $h.compare(name, expAllExt); - skipPreview = (dTypes && dTypes.indexOf(cat) !== -1) || (dMimes && dMimes.indexOf(type) !== -1) || - (dExts.length && $h.compare(name, expDisExt)) || (maxSize && !isNaN(maxSize) && size > maxSize); - return !skipPreview && (allowedTypes || allowedMimes || allowedExts); - }, - addToStack: function (file, id) { - this.fileManager.add(file, id); - }, - clearFileStack: function () { - var self = this; - self.fileManager.clear(); - self._initResumableUpload(); - if (self.enableResumableUpload) { - if (self.showPause === null) { - self.showPause = true; - } - if (self.showCancel === null) { - self.showCancel = false; - } - } else { - self.showPause = false; - if (self.showCancel === null) { - self.showCancel = true; - } - } - return self.$element; - }, - getFileStack: function () { - return this.fileManager.stack; - }, - getFileList: function () { - return this.fileManager.list(); - }, - getFilesCount: function (includeInitial) { - var self = this, len = self.isAjaxUpload ? self.fileManager.count() : self._inputFileCount(); - if (includeInitial) { - len += self.previewCache.count(true); - } - return self._getFileCount(len); - }, - readFiles: function (files) { - this.reader = new FileReader(); - var self = this, $el = self.$element, reader = self.reader, $container = self.$previewContainer, - $status = self.$previewStatus, msgLoading = self.msgLoading, msgProgress = self.msgProgress, - previewInitId = self.previewInitId, numFiles = files.length, settings = self.fileTypeSettings, - readFile, fileTypes = self.allowedFileTypes, typLen = fileTypes ? fileTypes.length : 0, - fileExt = self.allowedFileExtensions, strExt = $h.isEmpty(fileExt) ? '' : fileExt.join(', '), - throwError = function (msg, file, previewId, index, fileId, removeThumb) { - var p1 = $.extend(true, {}, self._getOutData(null, {}, {}, files), - {id: previewId, index: index, fileId: fileId}), $thumb, - p2 = {id: previewId, index: index, fileId: fileId, file: file, files: files}; - removeThumb = removeThumb || self.removeFromPreviewOnError; - if (!removeThumb) { - self._previewDefault(file, true); - } - $thumb = self._getFrame(previewId, true); - if (self.isAjaxUpload) { - setTimeout(function () { - readFile(index + 1); - }, self.processDelay); - } else { - self.unlock(); - numFiles = 0; - } - if (removeThumb && $thumb.length) { - $thumb.remove(); - } else { - self._initFileActions(); - $thumb.find('.kv-file-upload').remove(); - } - self.isError = self.isAjaxUpload ? self._showFileError(msg, p1) : self._showError(msg, p2); - self._updateFileDetails(numFiles); - }; - self.fileManager.clearImages(); - $.each(files, function (key, file) { - var func = self.fileTypeSettings.image; - if (func && func(file.type)) { - self.fileManager.totalImages++; - } - }); - readFile = function (i) { - var $error = self.$errorContainer, errors, fm = self.fileManager; - if ($h.isEmpty($el.attr('multiple'))) { - numFiles = 1; - } - if (i >= numFiles) { - self.unlock(); - if (self.duplicateErrors.length) { - errors = '
  • ' + self.duplicateErrors.join('
  • ') + '
  • '; - if ($error.find('ul').length === 0) { - $error.html(self.errorCloseButton + '
      ' + errors + '
    '); - } else { - $error.find('ul').append(errors); - } - $error.fadeIn(self.fadeDelay); - self._handler($error.find('.kv-error-close'), 'click', function () { - $error.fadeOut(self.fadeDelay); - }); - self.duplicateErrors = []; - } - if (self.isAjaxUpload) { - self._raise('filebatchselected', [fm.stack]); - if (fm.count() === 0 && !self.isError) { - self.reset(); - } - } else { - self._raise('filebatchselected', [files]); - } - $container.removeClass('file-thumb-loading'); - $status.html(''); - return; - } - self.lock(true); - var file = files[i], previewId = previewInitId + '-' + self._getFileId(file), fSizeKB, j, msg, - fnText = settings.text, fnImage = settings.image, fnHtml = settings.html, typ, chk, typ1, typ2, - caption = self._getFileName(file, ''), fileSize = (file && file.size || 0) / 1000, - fileExtExpr = '', previewData = $h.createObjectURL(file), fileCount = 0, - strTypes = '', fileId, canLoad, - func, knownTypes = 0, isText, isHtml, isImage, txtFlag, processFileLoaded = function () { - var msg = msgProgress.setTokens({ - 'index': i + 1, - 'files': numFiles, - 'percent': 50, - 'name': caption - }); - setTimeout(function () { - $status.html(msg); - self._updateFileDetails(numFiles); - readFile(i + 1); - }, self.processDelay); - if (self._raise('fileloaded', [file, previewId, i, reader]) && self.isAjaxUpload) { - fm.add(file); - } - }; - if (!file) { - return; - } - fileId = fm.getId(file); - if (typLen > 0) { - for (j = 0; j < typLen; j++) { - typ1 = fileTypes[j]; - typ2 = self.msgFileTypes[typ1] || typ1; - strTypes += j === 0 ? typ2 : ', ' + typ2; - } - } - if (caption === false) { - readFile(i + 1); - return; - } - if (caption.length === 0) { - msg = self.msgInvalidFileName.replace('{name}', $h.htmlEncode($h.getFileName(file), '[unknown]')); - throwError(msg, file, previewId, i, fileId); - return; - } - if (!$h.isEmpty(fileExt)) { - fileExtExpr = new RegExp('\\.(' + fileExt.join('|') + ')$', 'i'); - } - fSizeKB = fileSize.toFixed(2); - if (self.isAjaxUpload && fm.exists(fileId) || self._getFrame(previewId, true).length) { - var p2 = {id: previewId, index: i, fileId: fileId, file: file, files: files}; - msg = self.msgDuplicateFile.setTokens({name: caption, size: fSizeKB}); - if (self.isAjaxUpload) { - setTimeout(function () { - self.duplicateErrors.push(msg); - self._raise('fileduplicateerror', [file, fileId, caption, fSizeKB, previewId, i]); - readFile(i + 1); - self._updateFileDetails(numFiles); - }, self.processDelay); - } else { - self._showError(msg, p2); - self.unlock(); - numFiles = 0; - self._clearFileInput(); - self.reset(); - self._updateFileDetails(numFiles); - } - return; - } - if (self.maxFileSize > 0 && fileSize > self.maxFileSize) { - msg = self.msgSizeTooLarge.setTokens({ - 'name': caption, - 'size': fSizeKB, - 'maxSize': self.maxFileSize - }); - throwError(msg, file, previewId, i, fileId); - return; - } - if (self.minFileSize !== null && fileSize <= $h.getNum(self.minFileSize)) { - msg = self.msgSizeTooSmall.setTokens({ - 'name': caption, - 'size': fSizeKB, - 'minSize': self.minFileSize - }); - throwError(msg, file, previewId, i, fileId); - return; - } - if (!$h.isEmpty(fileTypes) && $h.isArray(fileTypes)) { - for (j = 0; j < fileTypes.length; j += 1) { - typ = fileTypes[j]; - func = settings[typ]; - fileCount += !func || (typeof func !== 'function') ? 0 : (func(file.type, - $h.getFileName(file)) ? 1 : 0); - } - if (fileCount === 0) { - msg = self.msgInvalidFileType.setTokens({name: caption, types: strTypes}); - throwError(msg, file, previewId, i, fileId); - return; - } - } - if (fileCount === 0 && !$h.isEmpty(fileExt) && $h.isArray(fileExt) && !$h.isEmpty(fileExtExpr)) { - chk = $h.compare(caption, fileExtExpr); - fileCount += $h.isEmpty(chk) ? 0 : chk.length; - if (fileCount === 0) { - msg = self.msgInvalidFileExtension.setTokens({name: caption, extensions: strExt}); - throwError(msg, file, previewId, i, fileId); - return; - } - } - if (!self._canPreview(file)) { - canLoad = self.isAjaxUpload && self._raise('filebeforeload', [file, i, reader]); - if (self.isAjaxUpload && canLoad) { - fm.add(file); - } - if (self.showPreview && canLoad) { - $container.addClass('file-thumb-loading'); - self._previewDefault(file); - self._initFileActions(); - } - setTimeout(function () { - if (canLoad) { - self._updateFileDetails(numFiles); - } - readFile(i + 1); - self._raise('fileloaded', [file, previewId, i]); - }, 10); - return; - } - isText = fnText(file.type, caption); - isHtml = fnHtml(file.type, caption); - isImage = fnImage(file.type, caption); - $status.html(msgLoading.replace('{index}', i + 1).replace('{files}', numFiles)); - $container.addClass('file-thumb-loading'); - reader.onerror = function (evt) { - self._errorHandler(evt, caption); - }; - reader.onload = function (theFile) { - var hex, fileInfo, uint, byte, bytes = [], contents, mime, readTextImage = function (textFlag) { - var newReader = new FileReader(); - newReader.onerror = function (theFileNew) { - self._errorHandler(theFileNew, caption); - }; - newReader.onload = function (theFileNew) { - if (self.isAjaxUpload && !self._raise('filebeforeload', [file, i, reader])) { - return; - } - self._previewFile(i, file, theFileNew, previewData, fileInfo); - self._initFileActions(); - processFileLoaded(); - }; - if (textFlag) { - newReader.readAsText(file, self.textEncoding); - } else { - newReader.readAsDataURL(file); - } - }; - fileInfo = {'name': caption, 'type': file.type}; - $.each(settings, function (k, f) { - if (k !== 'object' && k !== 'other' && typeof f === 'function' && f(file.type, caption)) { - knownTypes++; - } - }); - if (knownTypes === 0) { // auto detect mime types from content if no known file types detected - uint = new Uint8Array(theFile.target.result); - for (j = 0; j < uint.length; j++) { - byte = uint[j].toString(16); - bytes.push(byte); - } - hex = bytes.join('').toLowerCase().substring(0, 8); - mime = $h.getMimeType(hex, '', ''); - if ($h.isEmpty(mime)) { // look for ascii text content - contents = $h.arrayBuffer2String(reader.result); - mime = $h.isSvg(contents) ? 'image/svg+xml' : $h.getMimeType(hex, contents, file.type); - } - fileInfo = {'name': caption, 'type': mime}; - isText = fnText(mime, ''); - isHtml = fnHtml(mime, ''); - isImage = fnImage(mime, ''); - txtFlag = isText || isHtml; - if (txtFlag || isImage) { - readTextImage(txtFlag); - return; - } - } - if (self.isAjaxUpload && !self._raise('filebeforeload', [file, i, reader])) { - return; - } - self._previewFile(i, file, theFile, previewData, fileInfo); - self._initFileActions(); - processFileLoaded(); - }; - reader.onprogress = function (data) { - if (data.lengthComputable) { - var fact = (data.loaded / data.total) * 100, progress = Math.ceil(fact); - msg = msgProgress.setTokens({ - 'index': i + 1, - 'files': numFiles, - 'percent': progress, - 'name': caption - }); - setTimeout(function () { - $status.html(msg); - }, self.processDelay); - } - }; - if (isText || isHtml) { - reader.readAsText(file, self.textEncoding); - } else { - if (isImage) { - reader.readAsDataURL(file); - } else { - reader.readAsArrayBuffer(file); - } - } - }; - - readFile(0); - self._updateFileDetails(numFiles, true); - }, - lock: function (selectMode) { - var self = this, $container = self.$container; - self._resetErrors(); - self.disable(); - if (!selectMode && self.showCancel) { - $container.find('.fileinput-cancel').show(); - } - if (!selectMode && self.showPause) { - $container.find('.fileinput-pause').show(); - } - self._raise('filelock', [self.fileManager.stack, self._getExtraData()]); - return self.$element; - }, - unlock: function (reset) { - var self = this, $container = self.$container; - if (reset === undefined) { - reset = true; - } - self.enable(); - $container.removeClass('is-locked'); - if (self.showCancel) { - $container.find('.fileinput-cancel').hide(); - } - if (self.showPause) { - $container.find('.fileinput-pause').hide(); - } - if (reset) { - self._resetFileStack(); - } - self._raise('fileunlock', [self.fileManager.stack, self._getExtraData()]); - return self.$element; - }, - resume: function () { - var self = this, flag = false, rm = self.resumableManager; - if (!self.enableResumableUpload) { - return self.$element; - } - if (self.paused) { - self._toggleResumableProgress(self.progressPauseTemplate, self.msgUploadResume); - } else { - flag = true; - } - self.paused = false; - if (flag) { - self._toggleResumableProgress(self.progressInfoTemplate, self.msgUploadBegin); - } - setTimeout(function () { - rm.upload(); - }, self.processDelay); - return self.$element; - }, - pause: function () { - var self = this, rm = self.resumableManager, xhr = self.ajaxRequests, len = xhr.length, i, - pct = rm.getProgress(), actions = self.fileActionSettings; - if (!self.enableResumableUpload) { - return self.$element; - } - if (rm.chunkIntervalId) { - clearInterval(rm.chunkIntervalId); - } - if (self.ajaxQueueIntervalId) { - clearInterval(self.ajaxQueueIntervalId); - } - self._raise('fileuploadpaused', [self.fileManager, rm]); - if (len > 0) { - for (i = 0; i < len; i += 1) { - self.paused = true; - xhr[i].abort(); - } - } - if (self.showPreview) { - self._getThumbs().each(function () { - var $thumb = $(this), fileId = $thumb.attr('data-fileid'), t = self._getLayoutTemplate('stats'), - stats, $indicator = $thumb.find('.file-upload-indicator'); - $thumb.removeClass('file-uploading'); - if ($indicator.attr('title') === actions.indicatorLoadingTitle) { - self._setThumbStatus($thumb, 'Paused'); - stats = t.setTokens({pendingTime: self.msgPaused, uploadSpeed: ''}); - self.paused = true; - self._setProgress(pct, $thumb.find('.file-thumb-progress'), pct + '%', stats); - } - if (!self.fileManager.getFile(fileId)) { - $thumb.find('.kv-file-remove').removeClass('disabled').removeAttr('disabled'); - } - }); - } - self._setProgress(101, self.$progress, self.msgPaused); - return self.$element; - }, - cancel: function () { - var self = this, xhr = self.ajaxRequests, rm = self.resumableManager, len = xhr.length, i; - if (self.enableResumableUpload && rm.chunkIntervalId) { - clearInterval(rm.chunkIntervalId); - rm.reset(); - self._raise('fileuploadcancelled', [self.fileManager, rm]); - } else { - self._raise('fileuploadcancelled', [self.fileManager]); - } - if (self.ajaxQueueIntervalId) { - clearInterval(self.ajaxQueueIntervalId); - } - self._initAjax(); - if (len > 0) { - for (i = 0; i < len; i += 1) { - self.cancelling = true; - xhr[i].abort(); - } - } - self._getThumbs().each(function () { - var $thumb = $(this), fileId = $thumb.attr('data-fileid'), $prog = $thumb.find('.file-thumb-progress'); - $thumb.removeClass('file-uploading'); - self._setProgress(0, $prog); - $prog.hide(); - if (!self.fileManager.getFile(fileId)) { - $thumb.find('.kv-file-upload').removeClass('disabled').removeAttr('disabled'); - $thumb.find('.kv-file-remove').removeClass('disabled').removeAttr('disabled'); - } - self.unlock(); - }); - setTimeout(function () { - self._setProgressCancelled(); - }, self.processDelay); - return self.$element; - }, - clear: function () { - var self = this, cap; - if (!self._raise('fileclear')) { - return; - } - self.$btnUpload.removeAttr('disabled'); - self._getThumbs().find('video,audio,img').each(function () { - $h.cleanMemory($(this)); - }); - self._clearFileInput(); - self._resetUpload(); - self.clearFileStack(); - self._resetErrors(true); - if (self._hasInitialPreview()) { - self._showFileIcon(); - self._resetPreview(); - self._initPreviewActions(); - self.$container.removeClass('file-input-new'); - } else { - self._getThumbs().each(function () { - self._clearObjects($(this)); - }); - if (self.isAjaxUpload) { - self.previewCache.data = {}; - } - self.$preview.html(''); - cap = (!self.overwriteInitial && self.initialCaption.length > 0) ? self.initialCaption : ''; - self.$caption.attr('title', '').val(cap); - $h.addCss(self.$container, 'file-input-new'); - self._validateDefaultPreview(); - } - if (self.$container.find($h.FRAMES).length === 0) { - if (!self._initCaption()) { - self.$captionContainer.removeClass('icon-visible'); - } - } - self._hideFileIcon(); - if (self.focusCaptionOnClear) { - self.$captionContainer.focus(); - } - self._setFileDropZoneTitle(); - self._raise('filecleared'); - return self.$element; - }, - reset: function () { - var self = this; - if (!self._raise('filereset')) { - return; - } - self.lastProgress = 0; - self._resetPreview(); - self.$container.find('.fileinput-filename').text(''); - $h.addCss(self.$container, 'file-input-new'); - if (self.getFrames().length) { - self.$container.removeClass('file-input-new'); - } - self.clearFileStack(); - self._setFileDropZoneTitle(); - return self.$element; - }, - disable: function () { - var self = this, $container = self.$container; - self.isDisabled = true; - self._raise('filedisabled'); - self.$element.attr('disabled', 'disabled'); - $container.addClass('is-locked'); - $h.addCss($container.find('.btn-file'), 'disabled'); - $container.find('.kv-fileinput-caption').addClass('file-caption-disabled'); - $container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button') - .attr('disabled', true); - self._initDragDrop(); - return self.$element; - }, - enable: function () { - var self = this, $container = self.$container; - self.isDisabled = false; - self._raise('fileenabled'); - self.$element.removeAttr('disabled'); - $container.removeClass('is-locked'); - $container.find('.kv-fileinput-caption').removeClass('file-caption-disabled'); - $container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button') - .removeAttr('disabled'); - $container.find('.btn-file').removeClass('disabled'); - self._initDragDrop(); - return self.$element; - }, - upload: function () { - var self = this, fm = self.fileManager, totLen = fm.count(), i, outData, - hasExtraData = !$.isEmptyObject(self._getExtraData()); - if (!self.isAjaxUpload || self.isDisabled || !self._isFileSelectionValid(totLen)) { - return; - } - self.lastProgress = 0; - self._resetUpload(); - if (totLen === 0 && !hasExtraData) { - self._showFileError(self.msgUploadEmpty); - return; - } - self.cancelling = false; - self._showProgress(); - self.lock(); - if (totLen === 0 && hasExtraData) { - self._setProgress(2); - self._uploadExtraOnly(); - return; - } - if (self.enableResumableUpload) { - return self.resume(); - } - if (self.uploadAsync || self.enableResumableUpload) { - outData = self._getOutData(null); - self._raise('filebatchpreupload', [outData]); - self.fileBatchCompleted = false; - self.uploadCache = []; - $.each(self.getFileStack(), function (id) { - var previewId = self._getThumbId(id); - self.uploadCache.push({id: previewId, content: null, config: null, tags: null, append: true}); - }); - self.$preview.find('.file-preview-initial').removeClass($h.SORT_CSS); - self._initSortable(); - } - self._setProgress(2); - self.hasInitData = false; - if (self.uploadAsync) { - i = 0; - $.each(fm.stack, function (id) { - self._uploadSingle(i, id, true); - i++; - }); - return; - } - self._uploadBatch(); - return self.$element; - }, - destroy: function () { - var self = this, $form = self.$form, $cont = self.$container, $el = self.$element, ns = self.namespace; - $(document).off(ns); - $(window).off(ns); - if ($form && $form.length) { - $form.off(ns); - } - if (self.isAjaxUpload) { - self._clearFileInput(); - } - self._cleanup(); - self._initPreviewCache(); - $el.insertBefore($cont).off(ns).removeData(); - $cont.off().remove(); - return $el; - }, - refresh: function (options) { - var self = this, $el = self.$element; - if (typeof options !== 'object' || $h.isEmpty(options)) { - options = self.options; - } else { - options = $.extend(true, {}, self.options, options); - } - self._init(options, true); - self._listen(); - return $el; - }, - zoom: function (frameId) { - var self = this, $frame = self._getFrame(frameId), $modal = self.$modal; - if (!$frame) { - return; - } - $h.initModal($modal); - $modal.html(self._getModalContent()); - self._setZoomContent($frame); - $modal.modal('show'); - self._initZoomButtons(); - }, - getExif: function (frameId) { - var self = this, $frame = self._getFrame(frameId); - return $frame && $frame.data('exif') || null; - }, - getFrames: function (cssFilter) { - var self = this, $frames; - cssFilter = cssFilter || ''; - $frames = self.$preview.find($h.FRAMES + cssFilter); - if (self.reversePreviewOrder) { - $frames = $($frames.get().reverse()); - } - return $frames; - }, - getPreview: function () { - var self = this; - return { - content: self.initialPreview, - config: self.initialPreviewConfig, - tags: self.initialPreviewThumbTags - }; - } - }; - - $.fn.fileinput = function (option) { - if (!$h.hasFileAPISupport() && !$h.isIE(9)) { - return; - } - var args = Array.apply(null, arguments), retvals = []; - args.shift(); - this.each(function () { - var self = $(this), data = self.data('fileinput'), options = typeof option === 'object' && option, - theme = options.theme || self.data('theme'), l = {}, t = {}, - lang = options.language || self.data('language') || $.fn.fileinput.defaults.language || 'en', opt; - if (!data) { - if (theme) { - t = $.fn.fileinputThemes[theme] || {}; - } - if (lang !== 'en' && !$h.isEmpty($.fn.fileinputLocales[lang])) { - l = $.fn.fileinputLocales[lang] || {}; - } - opt = $.extend(true, {}, $.fn.fileinput.defaults, t, $.fn.fileinputLocales.en, l, options, self.data()); - data = new FileInput(this, opt); - self.data('fileinput', data); - } - - if (typeof option === 'string') { - retvals.push(data[option].apply(data, args)); - } - }); - switch (retvals.length) { - case 0: - return this; - case 1: - return retvals[0]; - default: - return retvals; - } - }; - - //noinspection HtmlUnknownAttribute - $.fn.fileinput.defaults = { - language: 'en', - showCaption: true, - showBrowse: true, - showPreview: true, - showRemove: true, - showUpload: true, - showUploadStats: true, - showCancel: null, - showPause: null, - showClose: true, - showUploadedThumbs: true, - showConsoleLogs: true, - browseOnZoneClick: false, - autoReplace: false, - autoOrientImage: function () { // applicable for JPEG images only and non ios safari - var ua = window.navigator.userAgent, webkit = !!ua.match(/WebKit/i), - iOS = !!ua.match(/iP(od|ad|hone)/i), iOSSafari = iOS && webkit && !ua.match(/CriOS/i); - return !iOSSafari; - }, - autoOrientImageInitial: true, - required: false, - rtl: false, - hideThumbnailContent: false, - encodeUrl: true, - focusCaptionOnBrowse: true, - focusCaptionOnClear: true, - generateFileId: null, - previewClass: '', - captionClass: '', - frameClass: 'krajee-default', - mainClass: 'file-caption-main', - mainTemplate: null, - purifyHtml: true, - fileSizeGetter: null, - initialCaption: '', - initialPreview: [], - initialPreviewDelimiter: '*$$*', - initialPreviewAsData: false, - initialPreviewFileType: 'image', - initialPreviewConfig: [], - initialPreviewThumbTags: [], - previewThumbTags: {}, - initialPreviewShowDelete: true, - initialPreviewDownloadUrl: '', - removeFromPreviewOnError: false, - deleteUrl: '', - deleteExtraData: {}, - overwriteInitial: true, - sanitizeZoomCache: function (content) { - var $container = $(document.createElement('div')).append(content); - $container.find('input,select,.file-thumbnail-footer').remove(); - return $container.html(); - }, - previewZoomButtonIcons: { - prev: '', - next: '', - toggleheader: '', - fullscreen: '', - borderless: '', - close: '' - }, - previewZoomButtonClasses: { - prev: 'btn btn-navigate', - next: 'btn btn-navigate', - toggleheader: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - fullscreen: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - borderless: 'btn btn-sm btn-kv btn-default btn-outline-secondary', - close: 'btn btn-sm btn-kv btn-default btn-outline-secondary' - }, - previewTemplates: {}, - previewContentTemplates: {}, - preferIconicPreview: false, - preferIconicZoomPreview: false, - allowedFileTypes: null, - allowedFileExtensions: null, - allowedPreviewTypes: undefined, - allowedPreviewMimeTypes: null, - allowedPreviewExtensions: null, - disabledPreviewTypes: undefined, - disabledPreviewExtensions: ['msi', 'exe', 'com', 'zip', 'rar', 'app', 'vb', 'scr'], - disabledPreviewMimeTypes: null, - defaultPreviewContent: null, - customLayoutTags: {}, - customPreviewTags: {}, - previewFileIcon: '', - previewFileIconClass: 'file-other-icon', - previewFileIconSettings: {}, - previewFileExtSettings: {}, - buttonLabelClass: 'hidden-xs', - browseIcon: ' ', - browseClass: 'btn btn-primary', - removeIcon: '', - removeClass: 'btn btn-default btn-secondary', - cancelIcon: '', - cancelClass: 'btn btn-default btn-secondary', - pauseIcon: '', - pauseClass: 'btn btn-default btn-secondary', - uploadIcon: '', - uploadClass: 'btn btn-default btn-secondary', - uploadUrl: null, - uploadUrlThumb: null, - uploadAsync: true, - uploadParamNames: { - chunkCount: 'chunkCount', - chunkIndex: 'chunkIndex', - chunkSize: 'chunkSize', - chunkSizeStart: 'chunkSizeStart', - chunksUploaded: 'chunksUploaded', - fileBlob: 'fileBlob', - fileId: 'fileId', - fileName: 'fileName', - fileRelativePath: 'fileRelativePath', - fileSize: 'fileSize', - retryCount: 'retryCount' - }, - maxAjaxThreads: 5, - fadeDelay: 800, - processDelay: 100, - queueDelay: 10, // must be lesser than process delay - progressDelay: 0, // must be lesser than process delay - enableResumableUpload: false, - resumableUploadOptions: { - fallback: null, - testUrl: null, // used for checking status of chunks/ files previously / partially uploaded - chunkSize: 2 * 1024, // in KB - maxThreads: 4, - maxRetries: 3, - showErrorLog: true - }, - uploadExtraData: {}, - zoomModalHeight: 480, - minImageWidth: null, - minImageHeight: null, - maxImageWidth: null, - maxImageHeight: null, - resizeImage: false, - resizePreference: 'width', - resizeQuality: 0.92, - resizeDefaultImageType: 'image/jpeg', - resizeIfSizeMoreThan: 0, // in KB - minFileSize: 0, - maxFileSize: 0, - maxFilePreviewSize: 25600, // 25 MB - minFileCount: 0, - maxFileCount: 0, - maxTotalFileCount: 0, - validateInitialCount: false, - msgValidationErrorClass: 'text-danger', - msgValidationErrorIcon: ' ', - msgErrorClass: 'file-error-message', - progressThumbClass: 'progress-bar progress-bar-striped active', - progressClass: 'progress-bar bg-success progress-bar-success progress-bar-striped active', - progressInfoClass: 'progress-bar bg-info progress-bar-info progress-bar-striped active', - progressCompleteClass: 'progress-bar bg-success progress-bar-success', - progressPauseClass: 'progress-bar bg-primary progress-bar-primary progress-bar-striped active', - progressErrorClass: 'progress-bar bg-danger progress-bar-danger', - progressUploadThreshold: 99, - previewFileType: 'image', - elCaptionContainer: null, - elCaptionText: null, - elPreviewContainer: null, - elPreviewImage: null, - elPreviewStatus: null, - elErrorContainer: null, - errorCloseButton: $h.closeButton('kv-error-close'), - slugCallback: null, - dropZoneEnabled: true, - dropZoneTitleClass: 'file-drop-zone-title', - fileActionSettings: {}, - otherActionButtons: '', - textEncoding: 'UTF-8', - ajaxSettings: {}, - ajaxDeleteSettings: {}, - showAjaxErrorDetails: true, - mergeAjaxCallbacks: false, - mergeAjaxDeleteCallbacks: false, - retryErrorUploads: true, - reversePreviewOrder: false, - usePdfRenderer: function () { - //noinspection JSUnresolvedVariable - var isIE11 = !!window.MSInputMethodContext && !!document.documentMode; - return !!navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/i) || isIE11; - }, - pdfRendererUrl: '', - pdfRendererTemplate: '' - }; - - // noinspection HtmlUnknownAttribute - $.fn.fileinputLocales.en = { - fileSingle: 'file', - filePlural: 'files', - browseLabel: 'Browse …', - removeLabel: 'Remove', - removeTitle: 'Clear all unprocessed files', - cancelLabel: 'Cancel', - cancelTitle: 'Abort ongoing upload', - pauseLabel: 'Pause', - pauseTitle: 'Pause ongoing upload', - uploadLabel: 'Upload', - uploadTitle: 'Upload selected files', - msgNo: 'No', - msgNoFilesSelected: 'No files selected', - msgCancelled: 'Cancelled', - msgPaused: 'Paused', - msgPlaceholder: 'Select {files}...', - msgZoomModalHeading: 'Detailed Preview', - msgFileRequired: 'You must select a file to upload.', - msgSizeTooSmall: 'File "{name}" ({size} KB) is too small and must be larger than {minSize} KB.', - msgSizeTooLarge: 'File "{name}" ({size} KB) exceeds maximum allowed upload size of {maxSize} KB.', - msgFilesTooLess: 'You must select at least {n} {files} to upload.', - msgFilesTooMany: 'Number of files selected for upload ({n}) exceeds maximum allowed limit of {m}.', - msgTotalFilesTooMany: 'You can upload a maximum of {m} files ({n} files detected).', - msgFileNotFound: 'File "{name}" not found!', - msgFileSecured: 'Security restrictions prevent reading the file "{name}".', - msgFileNotReadable: 'File "{name}" is not readable.', - msgFilePreviewAborted: 'File preview aborted for "{name}".', - msgFilePreviewError: 'An error occurred while reading the file "{name}".', - msgInvalidFileName: 'Invalid or unsupported characters in file name "{name}".', - msgInvalidFileType: 'Invalid type for file "{name}". Only "{types}" files are supported.', - msgInvalidFileExtension: 'Invalid extension for file "{name}". Only "{extensions}" files are supported.', - msgFileTypes: { - 'image': 'image', - 'html': 'HTML', - 'text': 'text', - 'video': 'video', - 'audio': 'audio', - 'flash': 'flash', - 'pdf': 'PDF', - 'object': 'object' - }, - msgUploadAborted: 'The file upload was aborted', - msgUploadThreshold: 'Processing...', - msgUploadBegin: 'Initializing...', - msgUploadEnd: 'Done', - msgUploadResume: 'Resuming upload...', - msgUploadEmpty: 'No valid data available for upload.', - msgUploadError: 'Upload Error', - msgDeleteError: 'Delete Error', - msgProgressError: 'Error', - msgValidationError: 'Validation Error', - msgLoading: 'Loading file {index} of {files} …', - msgProgress: 'Loading file {index} of {files} - {name} - {percent}% completed.', - msgSelected: '{n} {files} selected', - msgFoldersNotAllowed: 'Drag & drop files only! {n} folder(s) dropped were skipped.', - msgImageWidthSmall: 'Width of image file "{name}" must be at least {size} px.', - msgImageHeightSmall: 'Height of image file "{name}" must be at least {size} px.', - msgImageWidthLarge: 'Width of image file "{name}" cannot exceed {size} px.', - msgImageHeightLarge: 'Height of image file "{name}" cannot exceed {size} px.', - msgImageResizeError: 'Could not get the image dimensions to resize.', - msgImageResizeException: 'Error while resizing the image.
    {errors}
    ', - msgAjaxError: 'Something went wrong with the {operation} operation. Please try again later!', - msgAjaxProgressError: '{operation} failed', - msgDuplicateFile: 'File "{name}" of same size "{size} KB" has already been selected earlier. Skipping duplicate selection.', - msgResumableUploadRetriesExceeded: 'Upload aborted beyond {max} retries for file {file}! Error Details:
    {error}
    ', - msgPendingTime: '{time} remaining', - msgCalculatingTime: 'calculating time remaining', - ajaxOperations: { - deleteThumb: 'file delete', - uploadThumb: 'file upload', - uploadBatch: 'batch file upload', - uploadExtra: 'form data upload' - }, - dropZoneTitle: 'Drag & drop files here …', - dropZoneClickTitle: '
    (or click to select {files})', - previewZoomButtonTitles: { - prev: 'View previous file', - next: 'View next file', - toggleheader: 'Toggle header', - fullscreen: 'Toggle full screen', - borderless: 'Toggle borderless mode', - close: 'Close detailed preview' - } - }; - - $.fn.fileinput.Constructor = FileInput; - - /** - * Convert automatically file inputs with class 'file' into a bootstrap fileinput control. - */ - $(document).ready(function () { - var $input = $('input.file[type=file]'); - if ($input.length) { - $input.fileinput(); - } - }); -})); diff --git a/back_end/public/static/js/fileinput.min.js b/back_end/public/static/js/fileinput.min.js deleted file mode 100644 index 2b8ef49fc..000000000 --- a/back_end/public/static/js/fileinput.min.js +++ /dev/null @@ -1,11 +0,0 @@ -/*! - * bootstrap-fileinput v4.5.0 - * http://plugins.krajee.com/file-input - * - * Author: Kartik Visweswaran - * Copyright: 2014 - 2018, Kartik Visweswaran, Krajee.com - * - * Licensed under the BSD 3-Clause - * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md - */ -!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):e(window.jQuery)}(function(e){"use strict";var t,i;e.fn.fileinputLocales={},e.fn.fileinputThemes={},String.prototype.setTokens=function(e){var t,i,a=this.toString();for(t in e)e.hasOwnProperty(t)&&(i=new RegExp("{"+t+"}","g"),a=a.replace(i,e[t]));return a},t={FRAMES:".kv-preview-thumb",SORT_CSS:"file-sortable",OBJECT_PARAMS:'\n\n\n\n\n\n',DEFAULT_PREVIEW:'
    \n{previewFileIcon}\n
    ',MODAL_ID:"kvFileinputModal",MODAL_EVENTS:["show","shown","hide","hidden","loaded"],objUrl:window.URL||window.webkitURL,compare:function(e,t,i){return void 0!==e&&(i?e===t:e.match(t))},isIE:function(e){if("Microsoft Internet Explorer"!==navigator.appName)return!1;if(10===e)return new RegExp("msie\\s"+e,"i").test(navigator.userAgent);var t,i=document.createElement("div");return i.innerHTML="\x3c!--[if IE "+e+"]> 0&&e[0].webkitGetAsEntry())for(t=0;t=0?atob(e.split(",")[1]):decodeURIComponent(e.split(",")[1]),a=new ArrayBuffer(i.length),r=new Uint8Array(a),n=0;n>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:s+=String.fromCharCode(i);break;case 12:case 13:a=n[o++],s+=String.fromCharCode((31&i)<<6|63&a);break;case 14:a=n[o++],r=n[o++],s+=String.fromCharCode((15&i)<<12|(63&a)<<6|(63&r)<<0)}return s},isHtml:function(e){var t=document.createElement("div");t.innerHTML=e;for(var i=t.childNodes,a=i.length;a--;)if(1===i[a].nodeType)return!0;return!1},isSvg:function(e){return e.match(/^\s*<\?xml/i)&&(e.match(//g,">").replace(/"/g,""").replace(/'/g,"'")},replaceTags:function(t,i){var a=t;return i?(e.each(i,function(e,t){"function"==typeof t&&(t=t()),a=a.split(e).join(t)}),a):a},cleanMemory:function(e){var i=e.is("img")?e.attr("src"):e.find("source").attr("src");t.objUrl.revokeObjectURL(i)},findFileName:function(e){var t=e.lastIndexOf("/");return-1===t&&(t=e.lastIndexOf("\\")),e.split(e.substring(t,t+1)).pop()},checkFullScreen:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},toggleFullScreen:function(e){var i=document,a=i.documentElement;a&&e&&!t.checkFullScreen()?a.requestFullscreen?a.requestFullscreen():a.msRequestFullscreen?a.msRequestFullscreen():a.mozRequestFullScreen?a.mozRequestFullScreen():a.webkitRequestFullscreen&&a.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):i.exitFullscreen?i.exitFullscreen():i.msExitFullscreen?i.msExitFullscreen():i.mozCancelFullScreen?i.mozCancelFullScreen():i.webkitExitFullscreen&&i.webkitExitFullscreen()},moveArray:function(t,i,a,r){var n=e.extend(!0,[],t);if(r&&n.reverse(),a>=n.length)for(var s=a-n.length;1+s--;)n.push(void 0);return n.splice(a,0,n.splice(i,1)[0]),r&&n.reverse(),n},cleanZoomCache:function(e){var t=e.closest(".kv-zoom-cache-theme");t.length||(t=e.closest(".kv-zoom-cache")),t.remove()},closeButton:function(e){return''},getRotation:function(e){switch(e){case 2:return"rotateY(180deg)";case 3:return"rotate(180deg)";case 4:return"rotate(180deg) rotateY(180deg)";case 5:return"rotate(270deg) rotateY(180deg)";case 6:return"rotate(90deg)";case 7:return"rotate(90deg) rotateY(180deg)";case 8:return"rotate(270deg)";default:return""}},setTransform:function(e,t){e&&(e.style.transform=t,e.style.webkitTransform=t,e.style["-moz-transform"]=t,e.style["-ms-transform"]=t,e.style["-o-transform"]=t)},setImageOrientation:function(e,i,a){if(e&&e.length){var r="load.fileinputimageorient";e.off(r).on(r,function(){var r=e.get(0),n=i&&i.length?i.get(0):null,s=r.offsetHeight,o=r.offsetWidth,l=t.getRotation(a);if(e.data("orientation",a),n&&i.data("orientation",a),a<5)return t.setTransform(r,l),void t.setTransform(n,l);var d=Math.atan(o/s),c=Math.sqrt(Math.pow(s,2)+Math.pow(o,2)),h=c?s/Math.cos(Math.PI/2+d)/c:1,p=" scale("+Math.abs(h)+")";t.setTransform(r,l+p),t.setTransform(n,l+p)})}}},(i=function(i,a){this.$element=e(i),this.$parent=this.$element.parent(),this._validate()&&(this.isPreviewable=t.hasFileAPISupport(),this.isIE9=t.isIE(9),this.isIE10=t.isIE(10),(this.isPreviewable||this.isIE9)&&(this._init(a),this._listen()),this.$element.removeClass("file-loading"))}).prototype={constructor:i,_cleanup:function(){this.reader=null,this.formdata={},this.uploadCount=0,this.uploadStatus={},this.uploadLog=[],this.uploadAsyncCount=0,this.loadedImages=[],this.totalImagesCount=0,this.ajaxRequests=[],this.clearStack(),this.fileBatchCompleted=!0,this.isPreviewable||(this.showPreview=!1),this.isError=!1,this.ajaxAborted=!1,this.cancelling=!1},_init:function(i,a){var r,n,s,o,l=this,d=l.$element;l.options=i,e.each(i,function(e,i){switch(e){case"minFileCount":case"maxFileCount":case"minFileSize":case"maxFileSize":case"maxFilePreviewSize":case"resizeImageQuality":case"resizeIfSizeMoreThan":case"progressUploadThreshold":case"initialPreviewCount":case"zoomModalHeight":case"minImageHeight":case"maxImageHeight":case"minImageWidth":case"maxImageWidth":l[e]=t.getNum(i);break;default:l[e]=i}}),l.rtl&&(o=l.previewZoomButtonIcons.prev,l.previewZoomButtonIcons.prev=l.previewZoomButtonIcons.next,l.previewZoomButtonIcons.next=o),a||l._cleanup(),l.$form=d.closest("form"),l._initTemplateDefaults(),l.uploadFileAttr=t.isEmpty(d.attr("name"))?"file_data":d.attr("name"),s=l._getLayoutTemplate("progress"),l.progressTemplate=s.replace("{class}",l.progressClass),l.progressCompleteTemplate=s.replace("{class}",l.progressCompleteClass),l.progressErrorTemplate=s.replace("{class}",l.progressErrorClass),l.isDisabled=d.attr("disabled")||d.attr("readonly"),l.isDisabled&&d.attr("disabled",!0),l.isAjaxUpload=t.hasFileUploadSupport()&&!t.isEmpty(l.uploadUrl),l.dropZoneEnabled=t.hasDragDropSupport()&&l.dropZoneEnabled,l.isAjaxUpload||(l.dropZoneEnabled=l.dropZoneEnabled&&t.canAssignFilesToInput()),l.isClickable=l.browseOnZoneClick&&l.showPreview&&(l.dropZoneEnabled||!t.isEmpty(l.defaultPreviewContent)),l.slug="function"==typeof i.slugCallback?i.slugCallback:l._slugDefault,l.mainTemplate=l.showCaption?l._getLayoutTemplate("main1"):l._getLayoutTemplate("main2"),l.captionTemplate=l._getLayoutTemplate("caption"),l.previewGenericTemplate=l._getPreviewTemplate("generic"),!l.imageCanvas&&l.resizeImage&&(l.maxImageWidth||l.maxImageHeight)&&(l.imageCanvas=document.createElement("canvas"),l.imageCanvasContext=l.imageCanvas.getContext("2d")),t.isEmpty(d.attr("id"))&&d.attr("id",t.uniqId()),l.namespace=".fileinput_"+d.attr("id").replace(/-/g,"_"),void 0===l.$container?l.$container=l._createContainer():l._refreshContainer(),n=l.$container,l.$dropZone=n.find(".file-drop-zone"),l.$progress=n.find(".kv-upload-progress"),l.$btnUpload=n.find(".fileinput-upload"),l.$captionContainer=t.getElement(i,"elCaptionContainer",n.find(".file-caption")),l.$caption=t.getElement(i,"elCaptionText",n.find(".file-caption-name")),t.isEmpty(l.msgPlaceholder)||(r=d.attr("multiple")?l.filePlural:l.fileSingle,l.$caption.attr("placeholder",l.msgPlaceholder.replace("{files}",r))),l.$captionIcon=l.$captionContainer.find(".file-caption-icon"),l.$previewContainer=t.getElement(i,"elPreviewContainer",n.find(".file-preview")),l.$preview=t.getElement(i,"elPreviewImage",n.find(".file-preview-thumbnails")),l.$previewStatus=t.getElement(i,"elPreviewStatus",n.find(".file-preview-status")),l.$errorContainer=t.getElement(i,"elErrorContainer",l.$previewContainer.find(".kv-fileinput-error")),l._validateDisabled(),t.isEmpty(l.msgErrorClass)||t.addCss(l.$errorContainer,l.msgErrorClass),a?l._errorsExist()||l.$errorContainer.hide():(l.$errorContainer.hide(),l.previewInitId="preview-"+t.uniqId(),l._initPreviewCache(),l._initPreview(!0),l._initPreviewActions(),l.$parent.hasClass("file-loading")&&(l.$container.insertBefore(l.$parent),l.$parent.remove())),l._setFileDropZoneTitle(),d.attr("disabled")&&l.disable(),l._initZoom(),l.hideThumbnailContent&&t.addCss(l.$preview,"hide-content")},_initTemplateDefaults:function(){var i,a,r,n,s,o,l,d,c,h=this;i=t.closeButton("fileinput-remove"),a='',r='
    \n",s='\x3c!--suppress ALL --\x3e\n",l='\n',o='\n\n'+t.OBJECT_PARAMS+" "+t.DEFAULT_PREVIEW+"\n\n",d='
    \n'+t.DEFAULT_PREVIEW+"\n
    \n",c={width:"100%",height:"100%","min-height":"480px"},h._isPdfRendered()&&(l=h.pdfRendererTemplate.replace("{renderer}",h.pdfRendererUrl)),h.defaults={layoutTemplates:{main1:'{preview}\n
    \n
    \n {caption}\n
    \n {remove}\n {cancel}\n {upload}\n {browse}\n
    \n
    ',main2:'{preview}\n
    \n
    \n{remove}\n{cancel}\n{upload}\n{browse}\n',preview:'
    \n {close}
    \n
    \n
    \n
    \n
    \n
    \n
    ',close:i,fileIcon:'',caption:'
    \n \n \n
    ',modalMain:a,modal:'\n',progress:'
    \n
    \n {status}\n
    \n
    ',size:" ({sizeText})",footer:'',indicator:'
    {indicator}
    ',actions:'
    \n \n
    \n{drag}\n
    ',actionDelete:'\n',actionUpload:'',actionDownload:'{downloadIcon}',actionZoom:'',actionDrag:'{dragIcon}',btnDefault:'',btnLink:'{icon} {label}',btnBrowse:'
    {icon} {label}
    ',zoomCache:''},previewMarkupTags:{tagBefore1:'
    \n',tagBefore2:'
    \n',tagAfter:"
    {footer}\n
    \n"},previewContentTemplates:{generic:"{content}\n",html:'
    {data}
    \n',image:'{caption}\n',text:'\n',office:'',gdocs:'',video:n,audio:s,flash:'\n',object:o,pdf:l,other:d},allowedPreviewTypes:["image","html","text","video","audio","flash","pdf","object"],previewTemplates:{},previewSettings:{image:{width:"auto",height:"auto","max-width":"100%","max-height":"100%"},html:{width:"213px",height:"160px"},text:{width:"213px",height:"160px"},office:{width:"213px",height:"160px"},gdocs:{width:"213px",height:"160px"},video:{width:"213px",height:"160px"},audio:{width:"100%",height:"30px"},flash:{width:"213px",height:"160px"},object:{width:"213px",height:"160px"},pdf:{width:"100%",height:"160px"},other:{width:"213px",height:"160px"}},previewSettingsSmall:{image:{width:"auto",height:"auto","max-width":"100%","max-height":"100%"},html:{width:"100%",height:"160px"},text:{width:"100%",height:"160px"},office:{width:"100%",height:"160px"},gdocs:{width:"100%",height:"160px"},video:{width:"100%",height:"auto"},audio:{width:"100%",height:"30px"},flash:{width:"100%",height:"auto"},object:{width:"100%",height:"auto"},pdf:{width:"100%",height:"160px"},other:{width:"100%",height:"160px"}},previewZoomSettings:{image:{width:"auto",height:"auto","max-width":"100%","max-height":"100%"},html:c,text:c,office:{width:"100%",height:"100%","max-width":"100%","min-height":"480px"},gdocs:{width:"100%",height:"100%","max-width":"100%","min-height":"480px"},video:{width:"auto",height:"100%","max-width":"100%"},audio:{width:"100%",height:"30px"},flash:{width:"auto",height:"480px"},object:{width:"auto",height:"100%","max-width":"100%","min-height":"480px"},pdf:c,other:{width:"auto",height:"100%","min-height":"480px"}},fileTypeSettings:{image:function(e,i){return t.compare(e,"image.*")&&!t.compare(e,/(tiff?|wmf)$/i)||t.compare(i,/\.(gif|png|jpe?g)$/i)},html:function(e,i){return t.compare(e,"text/html")||t.compare(i,/\.(htm|html)$/i)},office:function(e,i){return t.compare(e,/(word|excel|powerpoint|office)$/i)||t.compare(i,/\.(docx?|xlsx?|pptx?|pps|potx?)$/i)},gdocs:function(e,i){return t.compare(e,/(word|excel|powerpoint|office|iwork-pages|tiff?)$/i)||t.compare(i,/\.(docx?|xlsx?|pptx?|pps|potx?|rtf|ods|odt|pages|ai|dxf|ttf|tiff?|wmf|e?ps)$/i)},text:function(e,i){return t.compare(e,"text.*")||t.compare(i,/\.(xml|javascript)$/i)||t.compare(i,/\.(txt|md|csv|nfo|ini|json|php|js|css)$/i)},video:function(e,i){return t.compare(e,"video.*")&&(t.compare(e,/(ogg|mp4|mp?g|mov|webm|3gp)$/i)||t.compare(i,/\.(og?|mp4|webm|mp?g|mov|3gp)$/i))},audio:function(e,i){return t.compare(e,"audio.*")&&(t.compare(i,/(ogg|mp3|mp?g|wav)$/i)||t.compare(i,/\.(og?|mp3|mp?g|wav)$/i))},flash:function(e,i){return t.compare(e,"application/x-shockwave-flash",!0)||t.compare(i,/\.(swf)$/i)},pdf:function(e,i){return t.compare(e,"application/pdf",!0)||t.compare(i,/\.(pdf)$/i)},object:function(){return!0},other:function(){return!0}},fileActionSettings:{showRemove:!0,showUpload:!0,showDownload:!0,showZoom:!0,showDrag:!0,removeIcon:'',removeClass:"btn btn-sm btn-kv btn-default btn-outline-secondary",removeErrorClass:"btn btn-sm btn-kv btn-danger",removeTitle:"Remove file",uploadIcon:'',uploadClass:"btn btn-sm btn-kv btn-default btn-outline-secondary",uploadTitle:"Upload file",uploadRetryIcon:'',uploadRetryTitle:"Retry upload",downloadIcon:'',downloadClass:"btn btn-sm btn-kv btn-default btn-outline-secondary",downloadTitle:"Download file",zoomIcon:'',zoomClass:"btn btn-sm btn-kv btn-default btn-outline-secondary",zoomTitle:"View Details",dragIcon:'',dragClass:"text-info",dragTitle:"Move / Rearrange",dragSettings:{},indicatorNew:'',indicatorSuccess:'',indicatorError:'',indicatorLoading:'',indicatorNewTitle:"Not uploaded yet",indicatorSuccessTitle:"Uploaded",indicatorErrorTitle:"Upload Error",indicatorLoadingTitle:"Uploading ..."}},e.each(h.defaults,function(t,i){"allowedPreviewTypes"!==t?h[t]=e.extend(!0,{},i,h[t]):void 0===h.allowedPreviewTypes&&(h.allowedPreviewTypes=i)}),h._initPreviewTemplates()},_initPreviewTemplates:function(){var i,a=this,r=a.previewMarkupTags,n=r.tagAfter;e.each(a.previewContentTemplates,function(e,s){t.isEmpty(a.previewTemplates[e])&&(i=r.tagBefore2,"generic"!==e&&"image"!==e&&"html"!==e&&"text"!==e||(i=r.tagBefore1),a._isPdfRendered()&&"pdf"===e&&(i=i.replace("kv-file-content","kv-file-content kv-pdf-rendered")),a.previewTemplates[e]=i+s+n)})},_initPreviewCache:function(){var i=this;i.previewCache={data:{},init:function(){var e=i.initialPreview;e.length>0&&!t.isArray(e)&&(e=e.split(i.initialPreviewDelimiter)),i.previewCache.data={content:e,config:i.initialPreviewConfig,tags:i.initialPreviewThumbTags}},count:function(){return i.previewCache.data&&i.previewCache.data.content?i.previewCache.data.content.length:0},get:function(a,r){var n,s,o,l,d,c,h,p="init_"+a,u=i.previewCache.data,f=u.config[a],m=u.content[a],g=i.previewInitId+"-"+p,v=t.ifSet("previewAsData",f,i.initialPreviewAsData),w=function(e,a,r,n,s,o,l,d,c){return d=" file-preview-initial "+t.SORT_CSS+(d?" "+d:""),i._generatePreviewTemplate(e,a,r,n,s,!1,null,d,o,l,c)};return m?(r=void 0===r||r,o=t.ifSet("type",f,i.initialPreviewFileType||"generic"),d=t.ifSet("filename",f,t.ifSet("caption",f)),c=t.ifSet("filetype",f,o),l=i.previewCache.footer(a,r,f&&f.size||null),h=t.ifSet("frameClass",f),n=v?w(o,m,d,c,g,l,p,h):w("generic",m,d,c,g,l,p,h,o).setTokens({content:u.content[a]}),u.tags.length&&u.tags[a]&&(n=t.replaceTags(n,u.tags[a])),t.isEmpty(f)||t.isEmpty(f.frameAttr)||((s=e(document.createElement("div")).html(n)).find(".file-preview-initial").attr(f.frameAttr),n=s.html(),s.remove()),n):""},add:function(e,a,r,n){var s,o=i.previewCache.data;return t.isArray(e)||(e=e.split(i.initialPreviewDelimiter)),n?(s=o.content.push(e)-1,o.config[s]=a,o.tags[s]=r):(s=e.length-1,o.content=e,o.config=a,o.tags=r),i.previewCache.data=o,s},set:function(e,a,r,n){var s,o=i.previewCache.data;if(e&&e.length&&(t.isArray(e)||(e=e.split(i.initialPreviewDelimiter)),e.filter(function(e){return null!==e}).length)){if(void 0===o.content&&(o.content=[]),void 0===o.config&&(o.config=[]),void 0===o.tags&&(o.tags=[]),n){for(s=0;s'+e+"":"
  • "+e+"
  • ";return 0===a.find("ul").length?this._addError("
      "+n+"
    "):a.find("ul").append(n),a.fadeIn(800),this._raise(r,[t,e]),this._setValidationError("file-input-new"),!0},_showError:function(e,t,i){var a=this.$errorContainer,r=i||"fileerror";return(t=t||{}).reader=this.reader,this._addError(e),a.fadeIn(800),this._raise(r,[t,e]),this.isAjaxUpload||this._clearFileInput(),this._setValidationError("file-input-new"),this.$btnUpload.attr("disabled",!0),!0},_noFilesError:function(e){var t=this.minFileCount>1?this.filePlural:this.fileSingle,i=this.msgFilesTooLess.replace("{n}",this.minFileCount).replace("{files}",t),a=this.$errorContainer;this._addError(i),this.isError=!0,this._updateFileDetails(0),a.fadeIn(800),this._raise("fileerror",[e,i]),this._clearFileInput(),this._setValidationError()},_parseError:function(t,i,a,r){var n,s=e.trim(a+""),o=void 0!==i.responseJSON&&void 0!==i.responseJSON.error?i.responseJSON.error:i.responseText;return this.cancelling&&this.msgUploadAborted&&(s=this.msgUploadAborted),this.showAjaxErrorDetails&&o&&(n=(o=e.trim(o.replace(/\n\s*\n/g,"\n"))).length?"
    "+o+"
    ":"",s+=s?n:o),s||(s=this.msgAjaxError.replace("{operation}",t)),this.cancelling=!1,r?""+r+": "+s:s},_parseFileType:function(e,i){var a,r,n,s=this.allowedPreviewTypes||[];if("application/text-plain"===e)return"text";for(n=0;n-1&&(i=t.split(".").pop(),a.previewFileIconSettings&&(r=a.previewFileIconSettings[i]||a.previewFileIconSettings[i.toLowerCase()]||null),a.previewFileExtSettings&&e.each(a.previewFileExtSettings,function(e,t){a.previewFileIconSettings[e]&&t(i)&&(r=a.previewFileIconSettings[e])})),r},_parseFilePreviewIcon:function(e,t){var i=this._getPreviewIcon(t)||this.previewFileIcon,a=e;return a.indexOf("{previewFileIcon}")>-1&&(a=a.setTokens({previewFileIconClass:this.previewFileIconClass,previewFileIcon:i})),a},_raise:function(t,i){var a=e.Event(t);if(void 0!==i?this.$element.trigger(a,i):this.$element.trigger(a),a.isDefaultPrevented()||!1===a.result)return!1;switch(t){case"filebatchuploadcomplete":case"filebatchuploadsuccess":case"fileuploaded":case"fileclear":case"filecleared":case"filereset":case"fileerror":case"filefoldererror":case"fileuploaderror":case"filebatchuploaderror":case"filedeleteerror":case"filecustomerror":case"filesuccessremove":break;default:this.ajaxAborted||(this.ajaxAborted=a.result)}return!0},_listenFullScreen:function(e){var t,i,a=this.$modal;a&&a.length&&(t=a&&a.find(".btn-fullscreen"),i=a&&a.find(".btn-borderless"),t.length&&i.length&&(t.removeClass("active").attr("aria-pressed","false"),i.removeClass("active").attr("aria-pressed","false"),e?t.addClass("active").attr("aria-pressed","true"):i.addClass("active").attr("aria-pressed","true"),a.hasClass("file-zoom-fullscreen")?this._maximizeZoomDialog():e?this._maximizeZoomDialog():i.removeClass("active").attr("aria-pressed","false")))},_listen:function(){var i=this,a=i.$element,r=i.$form,n=i.$container;i._handler(a,"click",function(e){a.hasClass("file-no-browse")&&(a.data("zoneClicked")?a.data("zoneClicked",!1):e.preventDefault())}),i._handler(a,"change",e.proxy(i._change,i)),i.showBrowse&&i._handler(i.$btnFile,"click",e.proxy(i._browse,i)),i._handler(n.find(".fileinput-remove:not([disabled])"),"click",e.proxy(i.clear,i)),i._handler(n.find(".fileinput-cancel"),"click",e.proxy(i.cancel,i)),i._initDragDrop(),i._handler(r,"reset",e.proxy(i.clear,i)),i.isAjaxUpload||i._handler(r,"submit",e.proxy(i._submitForm,i)),i._handler(i.$container.find(".fileinput-upload"),"click",e.proxy(i._uploadClick,i)),i._handler(e(window),"resize",function(){i._listenFullScreen(screen.width===window.innerWidth&&screen.height===window.innerHeight)}),i._handler(e(document),"webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange",function(){i._listenFullScreen(t.checkFullScreen())}),i._autoFitContent(),i._initClickable(),i._refreshPreview()},_autoFitContent:function(){var t,i=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a=this,r=i<400?a.previewSettingsSmall||a.defaults.previewSettingsSmall:a.previewSettings||a.defaults.previewSettings;e.each(r,function(e,i){t=".file-preview-frame .file-preview-"+e,a.$preview.find(t+".kv-preview-data,"+t+" .kv-preview-data").css(i)})},_scanDroppedItems:function(e,t,i){i=i||"";var a,r,n,s=this,o=function(e){s._log("Error scanning dropped files!"),s._log(e)};e.isFile?e.file(function(e){t.push(e)},o):e.isDirectory&&(r=e.createReader(),(n=function(){r.readEntries(function(r){if(r&&r.length>0){for(a=0;a-1;if(this._zoneDragDropInit(i),this.isDisabled||!a)return i.originalEvent.dataTransfer.effectAllowed="none",void(i.originalEvent.dataTransfer.dropEffect="none");t.addCss(this.$dropZone,"file-highlighted")},_zoneDragLeave:function(e){this._zoneDragDropInit(e),this.isDisabled||this.$dropZone.removeClass("file-highlighted")},_zoneDrop:function(e){var i,a=this,r=a.$element,n=e.originalEvent.dataTransfer,s=n.files,o=n.items,l=t.getDragDropFolders(o),d=function(){a.isAjaxUpload?a._change(e,s):(a.changeTriggered=!0,r.get(0).files=s,setTimeout(function(){a.changeTriggered=!1,r.trigger("change"+a.namespace)},10)),a.$dropZone.removeClass("file-highlighted")};if(e.preventDefault(),!a.isDisabled&&!t.isEmpty(s))if(l>0){if(!a.isAjaxUpload)return void a._showFolderError(l);for(s=[],i=0;i
    a",l.leadingWhitespace=3===b.firstChild.nodeType,l.tbody=!b.getElementsByTagName("tbody").length,l.htmlSerialize=!!b.getElementsByTagName("link").length,l.html5Clone="<:nav>"!==z.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),l.appendChecked=c.checked,b.innerHTML="",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){l.noCloneEvent=!1}),b.cloneNode(!0).click()),null==l.deleteExpando){l.deleteExpando=!0;try{delete b.test}catch(d){l.deleteExpando=!1}}a=b=c=null}(),function(){var b,c,d=z.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),l[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var Y=/^(?:input|select|textarea)$/i,Z=/^key/,$=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,ab=/^([^.]*)(?:\.(.+)|)$/;function bb(){return!0}function cb(){return!1}function db(){try{return z.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof n===L||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(F)||[""],h=b.length;while(h--)f=ab.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(F)||[""],j=b.length;while(j--)if(h=ab.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,m,o=[d||z],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||z,3!==d.nodeType&&8!==d.nodeType&&!_.test(p+n.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[n.expando]?b:new n.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),k=n.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!n.isWindow(d)){for(i=k.delegateType||p,_.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||z)&&o.push(l.defaultView||l.parentWindow||a)}m=0;while((h=o[m++])&&!b.isPropagationStopped())b.type=m>1?i:k.bindType||p,f=(n._data(h,"events")||{})[b.type]&&n._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&n.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&n.acceptData(d)&&g&&d[p]&&!n.isWindow(d)){l=d[g],l&&(d[g]=null),n.event.triggered=p;try{d[p]()}catch(r){}n.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((n.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?n(c,this).index(i)>=0:n.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),ib=/^\s+/,jb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,kb=/<([\w:]+)/,lb=/\s*$/g,sb={option:[1,""],legend:[1,"
    ","
    "],area:[1,"",""],param:[1,"",""],thead:[1,"","
    "],tr:[2,"","
    "],col:[2,"","
    "],td:[3,"","
    "],_default:l.htmlSerialize?[0,"",""]:[1,"X
    ","
    "]},tb=eb(z),ub=tb.appendChild(z.createElement("div"));sb.optgroup=sb.option,sb.tbody=sb.tfoot=sb.colgroup=sb.caption=sb.thead,sb.th=sb.td;function vb(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==L?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==L?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,vb(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function wb(a){X.test(a.type)&&(a.defaultChecked=a.checked)}function xb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function yb(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function zb(a){var b=qb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ab(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}function Bb(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Cb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(yb(b).text=a.text,zb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&X.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}n.extend({clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!hb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ub.innerHTML=a.outerHTML,ub.removeChild(f=ub.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=vb(f),h=vb(a),g=0;null!=(e=h[g]);++g)d[g]&&Cb(e,d[g]);if(b)if(c)for(h=h||vb(a),d=d||vb(f),g=0;null!=(e=h[g]);g++)Bb(e,d[g]);else Bb(a,f);return d=vb(f,"script"),d.length>0&&Ab(d,!i&&vb(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k,m=a.length,o=eb(b),p=[],q=0;m>q;q++)if(f=a[q],f||0===f)if("object"===n.type(f))n.merge(p,f.nodeType?[f]:f);else if(mb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(kb.exec(f)||["",""])[1].toLowerCase(),k=sb[i]||sb._default,h.innerHTML=k[1]+f.replace(jb,"<$1>")+k[2],e=k[0];while(e--)h=h.lastChild;if(!l.leadingWhitespace&&ib.test(f)&&p.push(b.createTextNode(ib.exec(f)[0])),!l.tbody){f="table"!==i||lb.test(f)?""!==k[1]||lb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)n.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}n.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),l.appendChecked||n.grep(vb(p,"input"),wb),q=0;while(f=p[q++])if((!d||-1===n.inArray(f,d))&&(g=n.contains(f.ownerDocument,f),h=vb(o.appendChild(f),"script"),g&&Ab(h),c)){e=0;while(f=h[e++])pb.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.deleteExpando,m=n.event.special;null!=(d=a[h]);h++)if((b||n.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k?delete d[i]:typeof d.removeAttribute!==L?d.removeAttribute(i):d[i]=null,c.push(f))}}}),n.fn.extend({text:function(a){return W(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||z).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(vb(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&Ab(vb(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(vb(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return W(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(gb,""):void 0;if(!("string"!=typeof a||nb.test(a)||!l.htmlSerialize&&hb.test(a)||!l.leadingWhitespace&&ib.test(a)||sb[(kb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(jb,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(vb(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(vb(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,o=k-1,p=a[0],q=n.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&ob.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(i=n.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=n.map(vb(i,"script"),yb),f=g.length;k>j;j++)d=i,j!==o&&(d=n.clone(d,!0,!0),f&&n.merge(g,vb(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,n.map(g,zb),j=0;f>j;j++)d=g[j],pb.test(d.type||"")&&!n._data(d,"globalEval")&&n.contains(h,d)&&(d.src?n._evalUrl&&n._evalUrl(d.src):n.globalEval((d.text||d.textContent||d.innerHTML||"").replace(rb,"")));i=c=null}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],g=n(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Db,Eb={};function Fb(b,c){var d=n(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:n.css(d[0],"display");return d.detach(),e}function Gb(a){var b=z,c=Eb[a];return c||(c=Fb(a,b),"none"!==c&&c||(Db=(Db||n(" + \ No newline at end of file diff --git a/front_end/src/page/contest-rank.vue b/src/page/contest-rank.vue similarity index 86% rename from front_end/src/page/contest-rank.vue rename to src/page/contest-rank.vue index 7a61848e4..5de2dd03f 100644 --- a/front_end/src/page/contest-rank.vue +++ b/src/page/contest-rank.vue @@ -31,47 +31,61 @@ - + --> + - - - + + + @@ -133,7 +144,8 @@ \ No newline at end of file diff --git a/front_end/src/router/router.js b/src/router/router.js similarity index 96% rename from front_end/src/router/router.js rename to src/router/router.js index e6aa9f002..05fd822a9 100644 --- a/front_end/src/router/router.js +++ b/src/router/router.js @@ -26,6 +26,7 @@ import topicInfo from "../page/topicInfo"; import discussionInfo from "../page/discussionInfo"; import addDiscussion from "../page/addDiscussion"; import submission from "../page/submission"; +import bot from "../page/bot"; Vue.use(VueRouter); @@ -45,7 +46,7 @@ const routes = [ }, { // 题目列表 - path: "/plist", + path: "/problemlist", component: problemlist, meta: { isLogin: false, @@ -159,6 +160,13 @@ const routes = [ isLogin: false, }, }, + { + path: "/knowledge", + component: bot, + meta: { + isLogin: false, + } + }, { // 小组管理 path: "/groupManager", @@ -260,4 +268,4 @@ router.beforeEach((to, from, next) => { next(); }); -export default router; +export default router; \ No newline at end of file diff --git a/front_end/src/store/index.js b/src/store/index.js similarity index 56% rename from front_end/src/store/index.js rename to src/store/index.js index 070ad3e4d..5be7d9755 100644 --- a/front_end/src/store/index.js +++ b/src/store/index.js @@ -2,12 +2,17 @@ import Vue from "vue"; import Vuex from "vuex"; import login from "./modules/login"; import ui from "./modules/ui"; - +import problem from "./modules/problem" +import contest from "./modules/contest" +import carousel from "./modules/carousel" Vue.use(Vuex); export default new Vuex.Store({ modules: { login, ui, + problem, + contest, + carousel }, }); diff --git a/src/store/modules/carousel.js b/src/store/modules/carousel.js new file mode 100644 index 000000000..53125f415 --- /dev/null +++ b/src/store/modules/carousel.js @@ -0,0 +1,30 @@ +import util, { deepClone } from "../../utils" +const state = { + carousel: null +} + +const getters = { + carousel: (state) => { + return state.carousel; + } +} + +const mutations = { + carousel(state, data){ + state.carousel = deepClone(data); + } +} + +const actions = { + carousel({ commit }, data){ + commit("carousel", data); + } +} + +export default { + namespace: true, + state, + getters, + mutations, + actions +} \ No newline at end of file diff --git a/src/store/modules/contest.js b/src/store/modules/contest.js new file mode 100644 index 000000000..5772cde0e --- /dev/null +++ b/src/store/modules/contest.js @@ -0,0 +1,68 @@ +import util, { deepClone } from "../../utils" +const state = { + contestInfo: null, + contestDiscussList: null, + contestLogList: null, + contestList: null, + contestListNoLogin: null +} +const getters = { + contestInfo:(state) => { + return state.contestInfo; + }, + contestDiscussList:(state) => { + return state.contestDiscussList; + }, + contestLogList:(state) => { + return state.contestLogList; + }, + contestLogListNoLogin:(state) => { + return state.contestListNoLogin; + }, + contestList:(state) => { + return state.contestList; + } +} +const mutations = { + contestInfo(state, data) { + state.contestInfo = deepClone(data); + }, + contestDiscussList(state, data) { + state.contestDiscussList = deepClone(data); + }, + contestLogList(state, data) { + state.contestLogList = deepClone(data); + }, + contestList(state, data) { + state.contestList = deepClone(data); + }, + contestLogListNoLogin:(state, data) => { + state.contestListNoLogin = deepClone(data); + } +} +const actions = { + contestInfo({ commit }, data) { + commit("contestInfo", data); + }, + contestDiscussList({ commit }, data) { + commit("contestDiscussList", data); + }, + contestLogList({ commit }, data) { + commit("contestLogList", data); + }, + contestList({ commit }, data) { + commit("contestList", data); + }, + contestLogListNoLogin({ commit }, data) { + commit('contestLogListNoLogin', data); + } +} + +export default { + namespaced: true, + state, + getters, + actions, + mutations, + }; + \ No newline at end of file diff --git a/front_end/src/store/modules/login.js b/src/store/modules/login.js similarity index 86% rename from front_end/src/store/modules/login.js rename to src/store/modules/login.js index a407f82db..8aae9c330 100644 --- a/front_end/src/store/modules/login.js +++ b/src/store/modules/login.js @@ -29,9 +29,9 @@ const mutations = { userData(state, data) { state.userId = data.userId; state.nick = data.nick; - state.desc = data.desc == null ? "null" : data.desc; + state.desc = data.desc == data.desc; state.avator = - data.avator == undefined ? "../../assets/media/avator.png" : data.avator; + data.avator == "null" ? "../../assets/media/avator.png" : data.avator; state.acCnt = data.acCnt; state.waCnt = data.waCnt; }, diff --git a/src/store/modules/problem.js b/src/store/modules/problem.js new file mode 100644 index 000000000..2b146c091 --- /dev/null +++ b/src/store/modules/problem.js @@ -0,0 +1,31 @@ +import util, { deepClone } from "../../utils" +const state = { + storedData: null + }; + + const getters = { + storedData: (state) => { + return state.storedData; + } +}; + + const mutations = { + storedData(state, data) { + state.storedData = deepClone(data); + } + }; + + const actions = { + storedData({ commit }, data){ + commit("storedData", data); + } + }; + + export default { + namespaced: true, + state, + getters, + actions, + mutations, + }; + \ No newline at end of file diff --git a/front_end/src/store/modules/ui.js b/src/store/modules/ui.js similarity index 100% rename from front_end/src/store/modules/ui.js rename to src/store/modules/ui.js diff --git a/front_end/src/utils.js b/src/utils.js similarity index 81% rename from front_end/src/utils.js rename to src/utils.js index 41de7720b..87c63f4c0 100644 --- a/front_end/src/utils.js +++ b/src/utils.js @@ -152,6 +152,38 @@ export const deepEqual = function (x, y) { } } +export const deepClone = (obj) => { + let newObj + if(typeof obj === 'object' && obj !== null){ + if(obj instanceof Array){ + newObj = obj.map(item=>deepClone(item)) + }else{ + newObj = Object.assign({},obj) + } + for (const key in obj){ + if(obj.hasOwnProperty(key)){ + newObj[key] = deepClone(obj[key]) + } + } + }else if(typeof obj === 'function'){ + let fnBody = [] + fnBody = obj.toString().match(/\((.+)\)\{(.+)\}$/) + const args = fnBody.slice(1,fnBody.length-1) + newObj = new Function(args,fnBody[fnBody.length-1]) + for (const key in obj){ + if(obj.hasOwnProperty(key)){ + newObj[key] = deepClone(obj[key]) + } + } + }else if(typeof obj === 'symbol'){ + newObj = Symbol(obj.toString().match(/\((.+)\)/)[1]) + }else{ + return obj + } + return newObj +} + + export const dataURLtoFile = function (dataurl, filename) { let arr = dataurl.split(','); let mime = arr[0].match(/:(.*?);/)[1]; diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 000000000..8c33f32a8 --- /dev/null +++ b/vite.config.js @@ -0,0 +1,66 @@ +/* eslint-disable */ +import legacyPlugin from '@vitejs/plugin-legacy'; +import * as path from 'path'; +import { + createVuePlugin +} from 'vite-plugin-vue2'; +// @see https://cn.vitejs.dev/config/ +export default ({ + command, + mode +}) => { + let rollupOptions = {}; + + + let optimizeDeps = {}; + + + let alias = { + '@': path.resolve(__dirname, '.\src'), + 'vue$': 'vue/dist/vue.runtime.esm.js', + } + + let proxy = {} + + let define = { + 'process.env.NODE_ENV': '"development"', + } + + let esbuild = {} + + return { + base: './', // index.html文件所在位置 + root: './', // js导入的资源路径,src + resolve: { + alias, + }, + define: define, + server: { + // 代理 + proxy, + }, + build: { + target: 'es2015', + minify: 'terser', // 是否进行压缩,boolean | 'terser' | 'esbuild',默认使用terser + manifest: false, // 是否产出maifest.json + sourcemap: false, // 是否产出soucemap.json + outDir: 'build', // 产出目录 + rollupOptions, + }, + esbuild, + optimizeDeps, + plugins: [ + legacyPlugin({ + targets: ['Android > 39', 'Chrome >= 60', 'Safari >= 10.1', 'iOS >= 10.3', 'Firefox >= 54', 'Edge >= 15'], + }), createVuePlugin(), + ], + css: { + preprocessorOptions: { + less: { + // 支持内联 JavaScript + javascriptEnabled: true, + } + } + }, + } +} \ No newline at end of file diff --git a/front_end/vue.config.js b/vue.config.js similarity index 81% rename from front_end/vue.config.js rename to vue.config.js index fc506bfe9..a49dbb191 100644 --- a/front_end/vue.config.js +++ b/vue.config.js @@ -51,18 +51,23 @@ module.exports = { config.devServer.proxy = process.env.NODE_ENV === "test" ? { - "/api/oj": { - target: "https://acmwhut.com/", + "/api": { + /*if 原来 "https://acmwhut.com/" */ + /*if 张志伟的服务器 "http://120.77.181.57:5000/" */ + target: "http://dev.acmwhut.com/api/", changeOrigin: true, secure: false, + pathRewrite: { + '^/api': '' + } }, } : { - "/api/oj": { - target: "http://localhost:3000/", + "/api": { + target: "http://dev.acmwhut.com/api/", changeOrigin: true, pathRewrite: { - "^/api/oj": "", + "^/api": "", }, }, };
    - {{ rank_info[index - 1].rank }} + {{ rank_info[index].rank }} - {{ rank_info[index - 1].nick }} + {{ rank_info[index].nick }} {{ rank_info[index - 1].acNum }}{{ rank_info[index - 1].penalty | penaltyFilter }}{{ rank_info[index].acNum }}{{ rank_info[index].penalty | penaltyFilter }} + +
    +
    - +