From f44f079b91c1b92a78b3404c52524038aaae745d Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Thu, 28 Jan 2021 10:38:30 +0800 Subject: [PATCH] * Add default preference. --- framework/control.class.php | 14 +++++++------- module/my/control.php | 28 ++++++++++++---------------- module/my/view/preference.html.php | 18 +++++++++++++++++- 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/framework/control.class.php b/framework/control.class.php index 4523f7b30e..90977fff43 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -33,7 +33,7 @@ class control extends baseControl { parent::__construct($moduleName, $methodName, $appName); - //if(defined('IN_USE') or (defined('RUN_MODE') and RUN_MODE == 'api')) $this->setConcept(); + if(defined('IN_USE') or (defined('RUN_MODE') and RUN_MODE == 'api')) $this->setPreference(); if(!isset($this->config->bizVersion)) return false; @@ -77,21 +77,21 @@ class control extends baseControl } /** - * Go to concept setting page if concept not setted. + * Go to preference setting page if preference not setted. * * @access public * @return void */ - public function setConcept() + public function setPreference() { - if(empty($this->app->user->admin)) return true; + if(empty($this->app->user->account)) return true; if($this->app->getModuleName() == 'user' and strpos("login,logout", $this->app->getMethodName()) !== false) return true; if($this->app->getModuleName() == 'my' and $this->app->getMethodName() == 'changepassword') return true; + if($this->app->getModuleName() == 'my' and $this->app->getMethodName() == 'preference') return true; - if($this->app->getModuleName() == 'custom' and $this->app->getMethodName() == 'flow') return true; - if(!isset($this->config->conceptSetted)) + if(!isset($this->config->preferenceSetted)) { - $this->locate(helper::createLink('custom', 'flow')); + $this->locate(helper::createLink('my', 'preference')); } } diff --git a/module/my/control.php b/module/my/control.php index d9fc7520f8..fb62dfb1ac 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -834,24 +834,20 @@ class my extends control { foreach($_POST as $key => $value) $this->setting->setItem("{$this->app->user->account}.common.$key", $value); - die(js::closeModal('parent.parent')); + $this->setting->setItem("{$this->app->user->account}.common.preferenceSetted", 1); + if(isOnlybody()) die(js::closeModal('parent.parent')); + + die(js::locate($this->createLink('my', 'index'), 'parent')); } - /* Get default URSR. */ - $URSR = $this->setting->getItem("owner={$this->app->user->account}&module=common&key=URSR"); - - /* Get default menu link. */ - $programLink = $this->setting->getItem("owner={$this->app->user->account}&module=common&key=programLink"); - $productLink = $this->setting->getItem("owner={$this->app->user->account}&module=common&key=productLink"); - $projectLink = $this->setting->getItem("owner={$this->app->user->account}&module=common&key=projectLink"); - - $this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->preference; - $this->view->position[] = $this->lang->my->preference; - $this->view->URSRList = $this->loadModel('custom')->getURSRPairs(); - $this->view->URSR = $URSR ? $URSR : $this->setting->getItem('owner=system&module=custom&key=URSR'); - $this->view->programLink = $programLink ? $programLink : 'program-pgmbrowse'; - $this->view->productLink = $productLink ? $productLink : 'product-all'; - $this->view->projectLink = $projectLink ? $projectLink : 'program-prjbrowse'; + $this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->preference; + $this->view->position[] = $this->lang->my->preference; + $this->view->URSRList = $this->loadModel('custom')->getURSRPairs(); + $this->view->URSR = isset($this->config->URSR) ? $this->config->URSR : $this->setting->getItem('owner=system&module=custom&key=URSR'); + $this->view->programLink = isset($this->config->programLink) ? $this->config->programLink : 'program-pgmbrowse'; + $this->view->productLink = isset($this->config->productLink) ? $this->config->productLink : 'product-all'; + $this->view->projectLink = isset($this->config->projectLink) ? $this->config->projectLink : 'program-prjbrowse'; + $this->view->preferenceSetted = isset($this->config->preferenceSetted) ? true : false; $this->display(); } diff --git a/module/my/view/preference.html.php b/module/my/view/preference.html.php index a668860e06..945a0261f7 100755 --- a/module/my/view/preference.html.php +++ b/module/my/view/preference.html.php @@ -10,12 +10,24 @@ * @link http://www.zentao.net */ ?> + + + + +