diff --git a/module/block/view/dashboard.html.php b/module/block/view/dashboard.html.php index ccca29da24..0213f7c781 100644 --- a/module/block/view/dashboard.html.php +++ b/module/block/view/dashboard.html.php @@ -109,6 +109,14 @@ config.cannotPlaceInRight = 'block->cannotPlaceInRight; ?>'; var module = ''; var useGuest = ; +loadModel('misc')->getPluginRemind();?> + +var myModalTrigger = new $.zui.ModalTrigger({title:'misc->expiredTipsTitle;?>', custom: function(){return }, width:'600px'}); +var result = myModalTrigger.show(); +$('#pluginButton').click(function(){myModalTrigger.close()}); +$('#cancelButton').click(function(){myModalTrigger.close()}); + + $(function() { diff --git a/module/extension/model.php b/module/extension/model.php index 88e184e6e1..2d5843a653 100644 --- a/module/extension/model.php +++ b/module/extension/model.php @@ -910,4 +910,28 @@ class extensionModel extends model return $expiredDate; } + + /** + * Get plugins that are about to expire or have expired. + * + * @access public + * @return array() + */ + public function getExpirePlugins() + { + $extensions = $this->getLocalExtensions('installed'); + + $plugins = array(); + $today = helper::today(); + foreach($extensions as $extension) + { + $expiredDate = $this->getExpireDate($extension); + if(!empty($expiredDate)) + { + $dateDiff = helper::diffDate($expiredDate, $today); + if($dateDiff == 30 or $dateDiff == 14 or $dateDiff <= 0) $plugins[] = $extension->name; + } + } + return $plugins; + } } diff --git a/module/misc/lang/en.php b/module/misc/lang/en.php index 59ce3fa7bd..463a2227cf 100644 --- a/module/misc/lang/en.php +++ b/module/misc/lang/en.php @@ -12,6 +12,8 @@ $lang->misc = new stdclass(); $lang->misc->common = 'Misc'; $lang->misc->ping = 'Ping'; +$lang->misc->view = 'Click to view'; +$lang->misc->cancel = 'Cancel'; $lang->misc->zentao = new stdclass(); $lang->misc->zentao->version = 'Version %s'; @@ -70,6 +72,11 @@ $lang->misc->showAnnual = 'Add Annual Summary'; $lang->misc->annualDesc = 'After version 12.0, Annual Summary can be viewed on 『Report->Annual Summary』 page. See now.'; $lang->misc->remind = 'New feature reminders'; +$lang->misc->expiredTipsTitle = 'Dear system administrator, hello:'; +$lang->misc->expiredCountTips = 'There are %s plug-ins in the system that will expire soon. To avoid affecting your regular use, please get in touch with the administrator to renew or uninstall them in time.'; +$lang->misc->expiredPluginTips = 'The plug-ins that will expire are: %s.'; +$lang->misc->expiredTipsForAdmin = 'There are %s plug-ins in the current system that will expire soon. To avoid affecting the regular use of the function, please renew or uninstall them in the system background plug-in management as soon as possible.'; + $lang->misc->noticeRepair = "
If you are not Administrator, contact your ZenTao Administrator to repair tables.
If you are the Administrator, login your ZenTao host and create a file named %s.

Note:

diff --git a/module/misc/lang/zh-cn.php b/module/misc/lang/zh-cn.php index cb915a3de6..86ab3b2ef7 100644 --- a/module/misc/lang/zh-cn.php +++ b/module/misc/lang/zh-cn.php @@ -12,6 +12,8 @@ $lang->misc = new stdclass(); $lang->misc->common = '杂项'; $lang->misc->ping = '防超时'; +$lang->misc->view = '点击查看'; +$lang->misc->cancel = '取消'; $lang->misc->zentao = new stdclass(); $lang->misc->zentao->version = '版本%s'; @@ -70,6 +72,11 @@ $lang->misc->showAnnual = '新增年度总结功能'; $lang->misc->annualDesc = '12.0版本后,新增年度总结功能,可以到『统计->年度总结』页面查看。 是否现在查看'; $lang->misc->remind = '新功能提醒'; +$lang->misc->expiredTipsTitle = '尊敬的系统管理员,您好:'; +$lang->misc->expiredCountTips = '系统中有%s个插件即将到期,为避免影响您的正常使用,请联系管理员及时续费或卸载。'; +$lang->misc->expiredPluginTips = '即将到期的插件为:%s。'; +$lang->misc->expiredTipsForAdmin = '当前系统中有%s个插件即将到期,为避免影响功能的正常使用,请尽快到系统后台插件管理中进行续费或卸载处理。'; + $lang->misc->noticeRepair = "
普通用户请联系管理员进行修复
管理员请登录禅道所在的服务器,创建%s文件。

注意:

diff --git a/module/misc/model.php b/module/misc/model.php index 1bd918af09..75d5ecb683 100644 --- a/module/misc/model.php +++ b/module/misc/model.php @@ -61,6 +61,32 @@ class miscModel extends model return $remind; } + /** + * Get the notification information about plugin expiration. + * + * @access public + * @return void + */ + public function getPluginRemind() + { + $plugins = $this->loadModel('extension')->getExpirePlugins(); + $remind = ''; + + $today = helper::today(); + if(!isset($this->config->global->showPluginRemind)) $this->config->global->showPluginRemind = ''; + $showPluginRemind = empty($this->config->global->showPluginRemind) or $this->config->global->showPluginRemind != $today; + if(!empty($plugins) and $this->app->user->admin and $showPluginRemind) + { + $pluginButton = html::a(helper::createLink('extension', 'browse'), $this->lang->misc->view, '', "id='pluginButton' class='btn btn-primary btn-wide' data-app='admin'"); + $cancelButton = html::a('javascript: void(0);', $this->lang->misc->cancel, '', "id='cancelButton' class='btn btn-back btn-wide'"); + $remind = '

' . sprintf($this->lang->misc->expiredTipsForAdmin, count($plugins)) . '

'; + $remind .= '

' . $pluginButton . $cancelButton . '

'; + + $this->loadModel('setting')->setItem("{$this->app->user->account}.common.global.showPluginRemind", $today); + } + return $remind; + } + /** * Check one click package. * diff --git a/module/user/control.php b/module/user/control.php index 25a5cae3ef..2d947815aa 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -961,13 +961,15 @@ class user extends control else { $this->loadModel('misc'); - $this->view->noGDLib = sprintf($this->lang->misc->noGDLib, common::getSysURL() . $this->config->webRoot, '', false, true); - $this->view->title = $this->lang->user->login; - $this->view->referer = $this->referer; - $this->view->s = zget($this->config->global, 'sn', ''); - $this->view->keepLogin = $this->cookie->keepLogin ? $this->cookie->keepLogin : 'off'; - $this->view->rand = $this->user->updateSessionRandom(); - $this->view->unsafeSites = $this->misc->checkOneClickPackage(); + $this->loadModel('extension'); + $this->view->noGDLib = sprintf($this->lang->misc->noGDLib, common::getSysURL() . $this->config->webRoot, '', false, true); + $this->view->title = $this->lang->user->login; + $this->view->referer = $this->referer; + $this->view->s = zget($this->config->global, 'sn', ''); + $this->view->keepLogin = $this->cookie->keepLogin ? $this->cookie->keepLogin : 'off'; + $this->view->rand = $this->user->updateSessionRandom(); + $this->view->unsafeSites = $this->misc->checkOneClickPackage(); + $this->view->plugins = $this->extension->getExpirePlugins(); $this->display(); } } diff --git a/module/user/css/login.css b/module/user/css/login.css index 35c02b498a..f983807e03 100644 --- a/module/user/css/login.css +++ b/module/user/css/login.css @@ -20,3 +20,7 @@ html[lang='en'] #loginPanel .table-form > tbody > tr > th {width: 80px;} .showNotice {color: yellow;} .showNotice:hover {color: yellow;} + +.table-row-extension .alert {margin-bottom: 0px !important;} +.table-row-extension .content {color: #3c4353;} +.table-row-extension .expired-tips {cursor: pointer;} diff --git a/module/user/view/login.html.php b/module/user/view/login.html.php index acc432cfaa..41c07730a0 100644 --- a/module/user/view/login.html.php +++ b/module/user/view/login.html.php @@ -72,6 +72,15 @@ if(empty($config->notMd5Pwd))js::import($jsRoot . 'md5.js'); + 0):?> +
+
+ + misc->expiredPluginTips, $pluginName);?> +
 misc->expiredCountTips, $expiredPluginTips, count($plugins));?>
+
+
+ config->global->showDemoUsers)):?>