From 7747338e2c35a59b9d2f5e05b4445982833a6e83 Mon Sep 17 00:00:00 2001 From: filesite Date: Tue, 7 May 2024 12:38:44 +0000 Subject: [PATCH] add tag manage page --- themes/tajian/controller/MyController.php | 57 +++++------------------ themes/tajian/views/layout/main.php | 2 +- themes/tajian/views/my/index.php | 2 +- themes/tajian/views/my/setnickname.php | 2 +- themes/tajian/views/my/tags.php | 46 ++++++++++++++++++ themes/tajian/views/site/myindex.php | 6 ++- www/css/tajian.css | 4 +- 7 files changed, 67 insertions(+), 52 deletions(-) create mode 100644 themes/tajian/views/my/tags.php diff --git a/themes/tajian/controller/MyController.php b/themes/tajian/controller/MyController.php index 5382bc7..daf54a4 100644 --- a/themes/tajian/controller/MyController.php +++ b/themes/tajian/controller/MyController.php @@ -8,7 +8,7 @@ require_once __DIR__ . '/SiteController.php'; Class MyController extends SiteController { - public function actionIndex() { + public function actionIndex($viewName = 'index', $defaultTitle = '个人中心') { //判断是否已经登录,自动跳转到自己的添加视频网址 $loginedUser = Common::getUserFromSession(); if (empty($loginedUser['username'])) { @@ -51,8 +51,7 @@ Class MyController extends SiteController { //昵称支持 $nickname = $this->getNickname($readmeFile); - $pageTitle = $defaultTitle = '个人中心 | ' . FSC::$app['config']['site_name']; - $viewName = 'index'; + $pageTitle = "{$defaultTitle} | " . FSC::$app['config']['site_name']; $params = compact( 'dirTree', 'scanResults', 'htmlReadme', 'tags', 'nickname' @@ -62,50 +61,16 @@ Class MyController extends SiteController { //修改昵称 public function actionSetnickname() { - //判断是否已经登录 - $loginedUser = Common::getUserFromSession(); - if (empty($loginedUser['username'])) { - return $this->redirect('/site/login'); - }else if (!empty(FSC::$app['config']['multipleUserUriParse']) && FSC::$app['user_id'] != $loginedUser['username']) { - $shareUrl = "/{$loginedUser['username']}/my/setnickname/"; - return $this->redirect($shareUrl); - } - - $htmlReadme = ''; //Readme.md 内容,底部网站详细介绍 - $menus_sorted = array(); //Readme_sort.txt 说明文件内容,一级目录菜单从上到下的排序 - - $scanner = new DirScanner(); - $scanner->setWebRoot(FSC::$app['config']['content_directory']); - $dirTree = $scanner->scan(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory'], 4); - - $readmeFile = $scanner->getDefaultReadme(); - if (!empty($readmeFile)) { - if (!empty($readmeFile['sort'])) { - $menus_sorted = explode("\n", $readmeFile['sort']); - } - - $Parsedown = new Parsedown(); - $content = file_get_contents($readmeFile['realpath']); - $htmlReadme = $Parsedown->text($content); - $htmlReadme = $scanner->fixMDUrls($readmeFile['realpath'], $htmlReadme); - } - - //获取tags分类 - $tags = $this->getTags($dirTree); - //排序 - if (!empty($menus_sorted) && !empty($tags)) { - $tags = $this->sortTags($menus_sorted, $tags); - } - - $nickname = $this->getNickname($readmeFile); - - $pageTitle = "修改昵称 | " . FSC::$app['config']['site_name']; - + $defaultTitle = "修改昵称"; $viewName = 'setnickname'; - $params = compact( - 'htmlReadme', 'tags', 'pageTitle', 'nickname' - ); - return $this->render($viewName, $params, $pageTitle); + return $this->actionIndex($viewName, $defaultTitle); + } + + //分类管理 + public function actionTags() { + $defaultTitle = "管理分类"; + $viewName = 'tags'; + return $this->actionIndex($viewName, $defaultTitle); } } \ No newline at end of file diff --git a/themes/tajian/views/layout/main.php b/themes/tajian/views/layout/main.php index f27f654..62d4357 100644 --- a/themes/tajian/views/layout/main.php +++ b/themes/tajian/views/layout/main.php @@ -127,7 +127,7 @@ eof; - +