From cc1e0f2cf0ae0759fc5b74b04dd6fe5f39d3654c Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 24 Nov 2016 16:55:39 +0800 Subject: [PATCH 1/5] * finish task #2730. --- module/bug/css/browse.css | 3 +++ module/bug/js/browse.js | 6 ++++++ module/product/css/browse.css | 2 ++ module/product/js/browse.js | 6 ++++++ module/product/view/browse.html.php | 1 + module/project/css/task.css | 3 +++ module/project/js/task.js | 6 ++++++ module/testcase/css/browse.css | 2 ++ module/testcase/js/browse.js | 6 ++++++ module/testtask/css/cases.css | 2 ++ module/testtask/js/cases.js | 6 ++++++ 11 files changed, 43 insertions(+) diff --git a/module/bug/css/browse.css b/module/bug/css/browse.css index f0bd370a0f..ad9760e3e5 100644 --- a/module/bug/css/browse.css +++ b/module/bug/css/browse.css @@ -13,3 +13,6 @@ .dropdown-list > li > a {display: block; padding: 3px 20px; clear: both; font-weight: normal; line-height: 1.53846154; color: #141414; white-space: nowrap;} .dropdown-list > li > a:hover, .dropdown-list > li > a:focus {color: #1a4f85;text-decoration: none;background-color: #ddd;} + +#treebox{position:fixed;margin-left:20px;} +.outer.hide-side #treebox{margin-left:0px;} diff --git a/module/bug/js/browse.js b/module/bug/js/browse.js index b939022371..73f248ac03 100644 --- a/module/bug/js/browse.js +++ b/module/bug/js/browse.js @@ -19,4 +19,10 @@ $(document).ready(function() }); setTimeout(function(){fixedTfootAction('#bugForm')}, 100); setTimeout(function(){fixedTheadOfList('#bugList')}, 100); + + var treeMaxHeight = document.documentElement.clientHeight - $('#header').height() - $('#featurebar').height() - $('#footer').height() - $('#treebox .side-body .panel-heading').height() - 120; + if($('#treebox').height() > $('#bugList').height()) treeMaxHeight -= 20; + $('#treebox .side-body .panel-body').children().each(function(){if(!$(this).hasClass('tree')) treeMaxHeight -= $(this).height()}); + $('#treebox .tree').css({'max-height':treeMaxHeight, 'overflow-y': 'auto', 'overflow-x':'hidden'}) + if(moduleID > 0)$('#treebox .tree').scrollTop($('#treebox .tree #module' + moduleID).offset().top - $('#treebox .tree li[data-id="1"]').offset().top); }); diff --git a/module/product/css/browse.css b/module/product/css/browse.css index af5d1f4620..b5287ac6d7 100644 --- a/module/product/css/browse.css +++ b/module/product/css/browse.css @@ -6,6 +6,8 @@ .dropdown-list > li > a {display: block; padding: 3px 20px; clear: both; font-weight: normal; line-height: 1.53846154; color: #141414; white-space: nowrap;} .dropdown-list > li > a:hover, .dropdown-list > li > a:focus {color: #1a4f85;text-decoration: none;background-color: #ddd;} +#treebox{position:fixed;margin-left:20px;} +.outer.hide-side #treebox{margin-left:0px;} .pl-5px{padding-left:5px;} a.removeModule{color:#ddd} diff --git a/module/product/js/browse.js b/module/product/js/browse.js index aed4662921..5aadb90943 100644 --- a/module/product/js/browse.js +++ b/module/product/js/browse.js @@ -23,4 +23,10 @@ $(function() $('.popoverStage').mouseout(function(){$(this).popover('hide')}); setTimeout(function(){fixedTfootAction('#productStoryForm')}, 100); setTimeout(function(){fixedTheadOfList('#storyList')}, 100); + + var treeMaxHeight = document.documentElement.clientHeight - $('#header').height() - $('#featurebar').height() - $('#footer').height() - $('#treebox .side-body .panel-heading').height() - 120; + if($('#treebox').height() > $('#storyList').height()) treeMaxHeight -= 20; + $('#treebox .side-body .panel-body').children().each(function(){if(!$(this).hasClass('tree')) treeMaxHeight -= $(this).height()}); + $('#treebox .tree').css({'max-height':treeMaxHeight, 'overflow-y': 'auto', 'overflow-x':'hidden'}) + if(moduleID > 0)$('#treebox .tree').scrollTop($('#treebox .tree #module' + moduleID).offset().top - $('#treebox .tree li[data-id="1"]').offset().top); }) diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index f8e1e2acbb..6dbce5385d 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -285,6 +285,7 @@ "; $mailConfig = $this->mail->autoDetect($this->post->fromAddress); $mailConfig->fromAddress = $this->post->fromAddress; + $mailConfig->domain = common::getSysURL(); $this->session->set('mailConfig', $mailConfig); die(js::locate(inlink('edit'), 'parent')); @@ -106,12 +107,15 @@ class mail extends control $this->locate(inlink('detect')); } + $mailConfig->domain = isset($this->config->mail->domain) ? $this->config->mail->domain : common::getSysURL(); + $this->view->title = $this->lang->mail->common . $this->lang->colon . $this->lang->mail->edit; $this->view->position[] = html::a(inlink('index'), $this->lang->mail->common); $this->view->position[] = $this->lang->mail->edit; $this->view->mailExist = $this->mail->mailExist(); $this->view->mailConfig = $mailConfig; + $this->view->openssl = extension_loaded('openssl'); $this->display(); } @@ -133,6 +137,7 @@ class mail extends control $mailConfig->async = $this->post->async; $mailConfig->fromAddress = trim($this->post->fromAddress); $mailConfig->fromName = trim($this->post->fromName); + $mailConfig->domain = trim($this->post->domain); $mailConfig->smtp->host = trim($this->post->host); $mailConfig->smtp->port = trim($this->post->port); $mailConfig->smtp->auth = $this->post->auth; @@ -195,6 +200,7 @@ class mail extends control $mailConfig->async = $this->post->async; $mailConfig->fromAddress = ''; $mailConfig->fromName = ''; + $mailConfig->domain = trim($this->post->domain); $mailConfig->sendcloud->accessKey = trim($this->post->accessKey); $mailConfig->sendcloud->secretKey = trim($this->post->secretKey); @@ -207,13 +213,14 @@ class mail extends control die(js::reload('parent')); } - $mailConfig = ''; + $mailConfig = new stdclass(); if($this->config->mail->turnon) { $mailConfig = $this->config->mail->sendcloud; $mailConfig->fromAddress = $this->config->mail->fromAddress; $mailConfig->fromName = $this->config->mail->fromName; $mailConfig->turnon = $this->config->mail->turnon; + $mailConfig->domain = isset($this->config->mail->domain) ? $this->config->mail->domain : common::getSysURL(); $mailConfig->async = isset($this->config->mail->async) ? $this->config->mail->async : 0; } diff --git a/module/mail/lang/en.php b/module/mail/lang/en.php index 3ca09b5210..40665b2d60 100755 --- a/module/mail/lang/en.php +++ b/module/mail/lang/en.php @@ -16,6 +16,7 @@ $lang->mail->turnon = 'Turn On'; $lang->mail->async = 'Asynchronous'; $lang->mail->fromAddress = 'Email Address'; $lang->mail->fromName = 'Sender'; +$lang->mail->domain = 'Domain'; $lang->mail->host = 'SMTP Server'; $lang->mail->port = 'SMTP Port'; $lang->mail->auth = 'Verification Required'; @@ -74,6 +75,7 @@ $lang->mail->sendmailTips = 'Note: Email author will not receive this email.'; $lang->mail->needConfigure = 'Email configuration is not found. Please cinfigure the Email first.'; $lang->mail->nofsocket = 'fsocket related function has been deactivated. Mails cannot send out. Please modify allow_url_fopen in php.ini to turn on Onopenssl, and restart Apache.'; $lang->mail->noOpenssl = 'Please turn on Onopenssl, and restart Apache.'; +$lang->mail->disableSecure = 'No openssl, disable ssl and tls.'; $lang->mail->sendCloudFail = 'Failed. Reason:'; $lang->mail->sendCloudHelp = <<1、Notice SendCloud是SendCloud的Team通知服务。具体可以到notice.sendcloud.net查看

diff --git a/module/mail/lang/zh-cn.php b/module/mail/lang/zh-cn.php index 00b08f6769..ea81b4c20d 100755 --- a/module/mail/lang/zh-cn.php +++ b/module/mail/lang/zh-cn.php @@ -16,6 +16,7 @@ $lang->mail->turnon = '是否打开'; $lang->mail->async = '异步发送'; $lang->mail->fromAddress = '发信邮箱'; $lang->mail->fromName = '发信人'; +$lang->mail->domain = '发信域名'; $lang->mail->host = 'smtp服务器'; $lang->mail->port = 'smtp端口号'; $lang->mail->auth = '是否需要验证'; @@ -74,6 +75,7 @@ $lang->mail->sendmailTips = '提示:系统不会为当前操作者发信。' $lang->mail->needConfigure = '无法找到邮件配置信息,请先配置邮件发送参数。'; $lang->mail->nofsocket = 'fsocket相关函数被禁用,不能发信!请在php.ini中修改allow_url_fopen为On,打开openssl扩展。 保存并重新启动apache。'; $lang->mail->noOpenssl = 'ssl和tls加密,请打开openssl扩展。 保存并重新启动apache。'; +$lang->mail->disableSecure = '没有openssl扩展,禁用ssl和tls加密'; $lang->mail->sendCloudFail = '操作失败,原因:'; $lang->mail->sendCloudHelp = <<1、Notice SendCloud是SendCloud的团队通知服务。具体可以到notice.sendcloud.net查看

diff --git a/module/mail/model.php b/module/mail/model.php index 4220bad0e3..be6f0292b0 100644 --- a/module/mail/model.php +++ b/module/mail/model.php @@ -290,7 +290,7 @@ class mailModel extends model $this->clear(); /* Replace full webPath image for mail. */ - if(strpos($body, 'src="data/upload')) $body = preg_replace('/server->http_host . $this->config->webRoot . 'data/upload', $body); + if(strpos($body, 'src="data/upload')) $body = preg_replace('/config->mail, 'domain', common::getSysURL()) . $this->config->webRoot . 'data/upload', $body); try { diff --git a/module/mail/view/edit.html.php b/module/mail/view/edit.html.php index 2fccaa63df..e38e91057e 100755 --- a/module/mail/view/edit.html.php +++ b/module/mail/view/edit.html.php @@ -25,6 +25,7 @@ include '../../common/view/header.html.php'; mail->turnon; ?> mail->turnonList, 1);?> + global->cron)):?> @@ -35,38 +36,51 @@ include '../../common/view/header.html.php'; mail->fromAddress; ?> fromAddress, "class='form-control'");?> - mail->addressWhiteList?> + mail->addressWhiteList?> mail->fromName; ?> - +
fromName, "class='form-control'");?> + + mail->domain; ?> + domain, "class='form-control'");?> + mail->host; ?> - host, "class='form-control'");?> + host, "class='form-control'");?> mail->port; ?> - port, "class='form-control'");?> + port, "class='form-control'");?> + mail->secure; ?> + + mail->secureList['ssl']); + unset($lang->mail->secureList['tls']); + $mailConfig->secure = ''; + } + echo html::radio('secure', $lang->mail->secureList, $mailConfig->secure); + if(!$openssl) echo "   " . $lang->mail->disableSecure . ''; + ?> + mail->auth; ?> - mail->authList, $mailConfig->auth, 'onchange=setAuth(this.value)'); ?> + mail->authList, $mailConfig->auth, 'onchange=setAuth(this.value)'); ?> mail->username; ?> - username, "class='form-control' autocomplete='off'") ?> + username, "class='form-control' autocomplete='off'") ?> mail->password; ?> - password, "class='form-control' autocomplete='off' placeholder='{$lang->mail->placeholder->password}'") ?> - - - mail->secure; ?> - mail->secureList, $mailConfig->secure); ?> + password, "class='form-control' autocomplete='off' placeholder='{$lang->mail->placeholder->password}'") ?> mail->debug; ?> diff --git a/module/mail/view/sendcloud.html.php b/module/mail/view/sendcloud.html.php index 605f94d5cb..0f952a4062 100755 --- a/module/mail/view/sendcloud.html.php +++ b/module/mail/view/sendcloud.html.php @@ -32,6 +32,10 @@ include '../../common/view/header.html.php'; + + mail->domain?> + mail, 'domain', common::getSysURL()), "class='form-control'")?> + mail->accessKey; ?>
diff --git a/module/project/control.php b/module/project/control.php index b43908e4c4..40ba301867 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -385,7 +385,8 @@ class project extends control $mails = $this->project->importBug($projectID); if(dao::isError()) die(js::error(dao::getError())); - foreach($mails as $mail) $this->sendmail($mail->taskID, $mail->actionID); + $this->loadModel('task'); + foreach($mails as $mail) $this->task->sendmail($mail->taskID, $mail->actionID); /* Locate the browser. */ die(js::locate($this->createLink('project', 'importBug', "projectID=$projectID"), 'parent')); @@ -1413,61 +1414,6 @@ class project extends control } } - /** - * Send email. - * - * @param int $taskID - * @param int $actionID - * @access public - * @return void - */ - public function sendmail($taskID, $actionID) - { - /* Reset $this->output. */ - $this->clear(); - - /* Set toList and ccList. */ - $task = $this->loadModel('task')->getById($taskID); - $projectName = $this->project->getById($task->project)->name; - $toList = $task->assignedTo; - $ccList = trim($task->mailto, ','); - - if($toList == '') - { - if($ccList == '') return; - if(strpos($ccList, ',') === false) - { - $toList = $ccList; - $ccList = ''; - } - else - { - $commaPos = strpos($ccList, ','); - $toList = substr($ccList, 0, $commaPos); - $ccList = substr($ccList, $commaPos + 1); - } - } - elseif(strtolower($toList) == 'closed') - { - $toList = $task->finishedBy; - } - - /* Get action info. */ - $action = $this->loadModel('action')->getById($actionID); - $history = $this->action->getHistory($actionID); - $action->history = isset($history[$actionID]) ? $history[$actionID] : array(); - - /* Create the email content. */ - $this->view->task = $task; - $this->view->action = $action; - - $mailContent = $this->parse($this->moduleName, 'sendmail'); - - /* Send emails. */ - $this->loadModel('mail')->send($toList, 'TASK#' . $task->id . ' ' . $task->name . ' - ' . $projectName, $mailContent, $ccList); - if($this->mail->isError()) trigger_error(join("\n", $this->mail->getError())); - } - /** * Manage products. * diff --git a/module/project/view/sendmail.html.php b/module/project/view/sendmail.html.php deleted file mode 100644 index 71150bd0ca..0000000000 --- a/module/project/view/sendmail.html.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @package task - * @version $Id$ - * @link http://www.zentao.net - */ -?> -id . ' ' . $task->name;?> - - - - - - - -
createLink('task', 'view', "taskID=$task->id"), $mailTitle, '', "style='color: #333;'");?>
- - - - -
- task->legendDesc;?> -
desc;?>
-
- - - diff --git a/module/report/control.php b/module/report/control.php index a2a042033c..819b34bf2f 100644 --- a/module/report/control.php +++ b/module/report/control.php @@ -206,7 +206,10 @@ class report extends control /* Get email content and title.*/ $this->view->mail = $mail; + $oldViewType = $this->viewType; + if($oldViewType == 'json') $this->viewType = 'html'; $mailContent = $this->parse('report', 'dailyreminder'); + $this->viewType == $oldViewType; /* Send email.*/ echo date('Y-m-d H:i:s') . " sending to $user, "; diff --git a/module/report/model.php b/module/report/model.php index b796015fc1..c5c7c84b65 100644 --- a/module/report/model.php +++ b/module/report/model.php @@ -295,6 +295,8 @@ class reportModel extends model */ public function getSysURL() { + if(isset($this->config->mail->domain)) return $this->config->mail->domain; + /* Ger URL when run in shell. */ if(PHP_SAPI == 'cli') { diff --git a/module/story/control.php b/module/story/control.php index 87db2fdf87..7d0eb11ba9 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -78,7 +78,7 @@ class story extends control { $actionID = $this->action->create('story', $storyID, 'Frombug', '', $bugID); } - $this->sendmail($storyID, $actionID); + $this->story->sendmail($storyID, $actionID); if($this->post->newStory) { $response['message'] = $this->lang->story->successSaved . $this->lang->story->newStory; @@ -212,7 +212,7 @@ class story extends control $mails = $this->story->batchCreate($productID, $branch); if(dao::isError()) die(js::error(dao::getError())); - foreach($mails as $mail) $this->sendmail($mail->storyID, $mail->actionID); + foreach($mails as $mail) $this->story->sendmail($mail->storyID, $mail->actionID); die(js::locate($this->createLink('product', 'browse', "productID=$productID&branch=$branch"), 'parent')); } @@ -341,7 +341,7 @@ class story extends control $action = !empty($changes) ? 'Edited' : 'Commented'; $actionID = $this->action->create('story', $storyID, $action, $this->post->comment); $this->action->logHistory($actionID, $changes); - $this->sendmail($storyID, $actionID); + $this->story->sendmail($storyID, $actionID); } die(js::locate($this->createLink('story', 'view', "storyID=$storyID"), 'parent')); } @@ -385,7 +385,7 @@ class story extends control $actionID = $this->action->create('story', $storyID, 'Edited'); $this->action->logHistory($actionID, $changes); - $this->sendmail($storyID, $actionID); + $this->story->sendmail($storyID, $actionID); } } die(js::locate($this->session->storyList, 'parent')); @@ -488,7 +488,7 @@ class story extends control if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n" ; $actionID = $this->action->create('story', $storyID, $action, $fileAction . $this->post->comment); $this->action->logHistory($actionID, $changes); - $this->sendmail($storyID, $actionID); + $this->story->sendmail($storyID, $actionID); } die(js::locate($this->createLink('story', 'view', "storyID=$storyID"), 'parent')); } @@ -523,7 +523,7 @@ class story extends control $this->story->activate($storyID); if(dao::isError()) die(js::error(dao::getError())); $actionID = $this->action->create('story', $storyID, 'Activated', $this->post->comment); - $this->sendmail($storyID, $actionID); + $this->story->sendmail($storyID, $actionID); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('story', 'view', "storyID=$storyID"), 'parent')); @@ -634,7 +634,7 @@ class story extends control if($this->post->closedReason != '' and strpos('done,postponed,subdivided', $this->post->closedReason) !== false) $result = 'pass'; $actionID = $this->action->create('story', $storyID, 'Reviewed', $this->post->comment, ucfirst($result)); $this->action->logHistory($actionID, array()); - $this->sendmail($storyID, $actionID); + $this->story->sendmail($storyID, $actionID); if($this->post->result == 'reject') { $this->action->create('story', $storyID, 'Closed', '', ucfirst($this->post->closedReason)); @@ -687,7 +687,7 @@ class story extends control $actions = $this->story->batchReview($storyIDList, $result, $reason); if(dao::isError()) die(js::error(dao::getError())); - foreach($actions as $storyID => $actionID) $this->sendmail($storyID, $actionID); + foreach($actions as $storyID => $actionID) $this->story->sendmail($storyID, $actionID); die(js::locate($this->session->storyList, 'parent')); } @@ -706,7 +706,7 @@ class story extends control if(dao::isError()) die(js::error(dao::getError())); $actionID = $this->action->create('story', $storyID, 'Closed', $this->post->comment, ucfirst($this->post->closedReason) . ($this->post->duplicateStory ? ':' . (int)$this->post->duplicateStory : '')); $this->action->logHistory($actionID, $changes); - $this->sendmail($storyID, $actionID); + $this->story->sendmail($storyID, $actionID); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate(inlink('view', "storyID=$storyID"), 'parent')); } @@ -753,7 +753,7 @@ class story extends control { $actionID = $this->action->create('story', $storyID, 'Closed', htmlspecialchars($this->post->comments[$storyID]), ucfirst($this->post->closedReasons[$storyID]) . ($this->post->duplicateStoryIDList[$storyID] ? ':' . (int)$this->post->duplicateStoryIDList[$storyID] : '')); $this->action->logHistory($actionID, $changes); - $this->sendmail($storyID, $actionID); + $this->story->sendmail($storyID, $actionID); } } die(js::locate($this->session->storyList, 'parent')); @@ -827,7 +827,7 @@ class story extends control { $actionID = $this->action->create('story', $storyID, 'Edited'); $this->action->logHistory($actionID, $changes); - $this->sendmail($storyID, $actionID); + $this->story->sendmail($storyID, $actionID); } die(js::reload('parent')); } @@ -848,7 +848,7 @@ class story extends control { $actionID = $this->action->create('story', $storyID, 'Edited'); $this->action->logHistory($actionID, $changes); - $this->sendmail($storyID, $actionID); + $this->story->sendmail($storyID, $actionID); } die(js::reload('parent')); } @@ -869,7 +869,7 @@ class story extends control { $actionID = $this->action->create('story', $storyID, 'Edited'); $this->action->logHistory($actionID, $changes); - $this->sendmail($storyID, $actionID); + $this->story->sendmail($storyID, $actionID); } die(js::reload('parent')); } @@ -890,7 +890,7 @@ class story extends control { $actionID = $this->action->create('story', $storyID, 'Edited'); $this->action->logHistory($actionID, $changes); - $this->sendmail($storyID, $actionID); + $this->story->sendmail($storyID, $actionID); } die(js::locate($this->session->storyList, 'parent')); } @@ -911,7 +911,7 @@ class story extends control { $actionID = $this->action->create('story', $storyID, 'Edited'); $this->action->logHistory($actionID, $changes); - $this->sendmail($storyID, $actionID); + $this->story->sendmail($storyID, $actionID); } } die(js::locate($this->session->storyList)); @@ -1225,76 +1225,6 @@ class story extends control echo $story->module; } - /** - * Send email. - * - * @param int $storyID - * @param int $actionID - * @access public - * @return void - */ - public function sendmail($storyID, $actionID) - { - /* Reset $this->output. */ - $this->clear(); - - $story = $this->story->getById($storyID); - $productName = $this->product->getById($story->product)->name; - - /* Get actions. */ - $actions = $this->action->getList('story', $storyID); - $action = zget($actions, $actionID, null); - $history = $this->action->getHistory($actionID); - $action->history = isset($history[$actionID]) ? $history[$actionID] : array(); - if(strtolower($action->action) == 'opened') $action->comment = $story->spec; - - /* Set toList and ccList. */ - $toList = $story->assignedTo; - $ccList = str_replace(' ', '', trim($story->mailto, ',')); - - /* If the action is changed or reviewed, mail to the project team. */ - if(strtolower($action->action) == 'changed' or strtolower($action->action) == 'reviewed') - { - $prjMembers = $this->story->getProjectMembers($storyID); - if($prjMembers) - { - $ccList .= ',' . join(',', $prjMembers); - $ccList = ltrim($ccList, ','); - } - } - - if($toList == '') - { - if($ccList == '') return; - if(strpos($ccList, ',') === false) - { - $toList = $ccList; - $ccList = ''; - } - else - { - $commaPos = strpos($ccList, ','); - $toList = substr($ccList, 0, $commaPos); - $ccList = substr($ccList, $commaPos + 1); - } - } - elseif($toList == 'closed') - { - $toList = $story->openedBy; - } - - /* Get the mail content. */ - if($action->action == 'opened') $action->comment = ''; - $this->view->story = $story; - $this->view->action = $action; - $this->view->users = $this->user->getPairs('noletter'); - - $mailContent = $this->parse($this->moduleName, 'sendmail'); - - /* Send it. */ - $this->loadModel('mail')->send($toList, 'STORY #' . $story->id . ' ' . $story->title . ' - ' . $productName, $mailContent, $ccList); - if($this->mail->isError()) trigger_error(join("\n", $this->mail->getError())); - } /** * The report page. * @@ -1349,6 +1279,7 @@ class story extends control /* format the fields of every story in order to export data. */ if($_POST) { + $this->loadModel('file'); $storyLang = $this->lang->story; $storyConfig = $this->config->story; @@ -1489,7 +1420,7 @@ class story extends control { foreach($relatedFiles[$story->id] as $file) { - $fileURL = 'http://' . $this->server->http_host . $this->config->webRoot . "data/upload/{$this->app->company->id}/" . $file->pathname; + $fileURL = common::getSysURL() . $this->file->webPath . $file->pathname; $story->files .= html::a($fileURL, $file->title, '_blank') . '
'; } } diff --git a/module/story/model.php b/module/story/model.php index f5ec41a913..9d734fb990 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2306,4 +2306,81 @@ class storyModel extends model return $forceReview; } + + /** + * Send mail + * + * @param int $storyID + * @param int $actionID + * @access public + * @return void + */ + public function sendmail($storyID, $actionID) + { + $this->loadModel('mail'); + $story = $this->getById($storyID); + $productName = $this->loadModel('product')->getById($story->product)->name; + $users = $this->loadModel('user')->getPairs('noletter'); + + /* Get actions. */ + $action = $this->loadModel('action')->getById($actionID); + $history = $this->action->getHistory($actionID); + $action->history = isset($history[$actionID]) ? $history[$actionID] : array(); + + /* Get mail content. */ + $modulePath = $this->app->getModulePath(); + $oldcwd = getcwd(); + $viewFile = $modulePath . 'view/sendmail.html.php'; + chdir($modulePath . 'view'); + if(file_exists($modulePath . 'ext/view/sendmail.html.php')) + { + $viewFile = $modulePath . 'ext/view/sendmail.html.php'; + chdir($modulePath . 'ext/view'); + } + ob_start(); + include $viewFile; + foreach(glob($modulePath . 'ext/view/sendmail.*.html.hook.php') as $hookFile) include $hookFile; + $mailContent = ob_get_contents(); + ob_end_clean(); + chdir($oldcwd); + + /* Set toList and ccList. */ + $toList = $story->assignedTo; + $ccList = str_replace(' ', '', trim($story->mailto, ',')); + + /* If the action is changed or reviewed, mail to the project team. */ + if(strtolower($action->action) == 'changed' or strtolower($action->action) == 'reviewed') + { + $prjMembers = $this->getProjectMembers($storyID); + if($prjMembers) + { + $ccList .= ',' . join(',', $prjMembers); + $ccList = ltrim($ccList, ','); + } + } + + if(empty($toList)) + { + if(empty($ccList)) return; + if(strpos($ccList, ',') === false) + { + $toList = $ccList; + $ccList = ''; + } + else + { + $commaPos = strpos($ccList, ','); + $toList = substr($ccList, 0, $commaPos); + $ccList = substr($ccList, $commaPos + 1); + } + } + elseif($toList == 'closed') + { + $toList = $story->openedBy; + } + + /* Send it. */ + $this->mail->send($toList, 'STORY #' . $story->id . ' ' . $story->title . ' - ' . $productName, $mailContent, $ccList); + if($this->mail->isError()) trigger_error(join("\n", $this->mail->getError())); + } } diff --git a/module/story/view/sendmail.html.php b/module/story/view/sendmail.html.php index c037e6cab7..27b9370106 100644 --- a/module/story/view/sendmail.html.php +++ b/module/story/view/sendmail.html.php @@ -11,12 +11,12 @@ */ ?> id . ' ' . $story->title;?> - +app->getModuleRoot() . 'common/view/mail.header.html.php';?> - +
createLink('story', 'view', "storyID=$story->id"), $mailTitle, '', "style='color: #333;'");?>config->mail, 'domain', common::getSysURL()) . helper::createLink('story', 'view', "storyID=$story->id"), $mailTitle, '', "style='color: #333; text-decoration: underline;'");?>
@@ -24,9 +24,9 @@
- story->legendSpec;?> + lang->story->legendSpec;?>
spec;?>
- +app->getModuleRoot() . 'common/view/mail.footer.html.php';?> diff --git a/module/task/control.php b/module/task/control.php index 61d7371ad2..7223d90344 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -96,7 +96,7 @@ class task extends control $taskID = $taskID['id']; $actionID = $this->action->create('task', $taskID, 'Opened', ''); - $this->sendmail($taskID, $actionID); + $this->task->sendmail($taskID, $actionID); } /* If link from no head then reload*/ @@ -179,7 +179,7 @@ class task extends control $mails = $this->task->batchCreate($projectID); if(dao::isError()) die(js::error(dao::getError())); - foreach($mails as $mail) $this->sendmail($mail->taskID, $mail->actionID); + foreach($mails as $mail) $this->task->sendmail($mail->taskID, $mail->actionID); /* Locate the browser. */ if($iframe) die(js::reload('parent.parent')); @@ -260,7 +260,7 @@ class task extends control $fileAction = !empty($files) ? $this->lang->addFiles . join(',', $files) . "\n" : ''; $actionID = $this->action->create('task', $taskID, $action, $fileAction . $this->post->comment); if(!empty($changes)) $this->action->logHistory($actionID, $changes); - $this->sendmail($taskID, $actionID); + $this->task->sendmail($taskID, $actionID); } if($task->fromBug != 0) @@ -313,7 +313,7 @@ class task extends control $actionID = $this->loadModel('action')->create('task', $taskID, 'Edited'); $this->action->logHistory($actionID, $changes); - $this->sendmail($taskID, $actionID); + $this->task->sendmail($taskID, $actionID); $task = $this->task->getById($taskID); if($task->fromBug != 0) @@ -412,7 +412,7 @@ class task extends control if(dao::isError()) die(js::error(dao::getError())); $actionID = $this->action->create('task', $taskID, 'Assigned', $this->post->comment, $this->post->assignedTo); $this->action->logHistory($actionID, $changes); - $this->sendmail($taskID, $actionID); + $this->task->sendmail($taskID, $actionID); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); @@ -445,7 +445,7 @@ class task extends control $this->loadModel('action'); $actionID = $this->action->create('task', $taskID, 'Edited'); $this->action->logHistory($actionID, $changes); - $this->sendmail($taskID, $actionID); + $this->task->sendmail($taskID, $actionID); } } die(js::reload('parent')); @@ -472,7 +472,7 @@ class task extends control if(dao::isError()) die(js::error(dao::getError())); $actionID = $this->action->create('task', $taskID, 'Assigned', $this->post->comment, $this->post->assignedTo); $this->action->logHistory($actionID, $changes); - $this->sendmail($taskID, $actionID); + $this->task->sendmail($taskID, $actionID); } die(js::locate($this->createLink('project', 'task', "projectID=$project"), 'parent')); } @@ -570,7 +570,7 @@ class task extends control $act = $this->post->left == 0 ? 'Finished' : 'Started'; $actionID = $this->action->create('task', $taskID, $act, $this->post->comment); $this->action->logHistory($actionID, $changes); - $this->sendmail($taskID, $actionID); + $this->task->sendmail($taskID, $actionID); } /* Remind whether to update status of the bug, if task which from that bug has been finished. */ @@ -722,7 +722,7 @@ class task extends control $fileAction = !empty($files) ? $this->lang->addFiles . join(',', $files) . "\n" : ''; $actionID = $this->action->create('task', $taskID, 'Finished', $fileAction . $this->post->comment); $this->action->logHistory($actionID, $changes); - $this->sendmail($taskID, $actionID); + $this->task->sendmail($taskID, $actionID); } if($this->task->needUpdateBugStatus($task)) @@ -804,7 +804,7 @@ class task extends control $act = $this->post->left == 0 ? 'Finished' : 'Restarted'; $actionID = $this->action->create('task', $taskID, $act, $this->post->comment); $this->action->logHistory($actionID, $changes); - $this->sendmail($taskID, $actionID); + $this->task->sendmail($taskID, $actionID); } if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); @@ -837,7 +837,7 @@ class task extends control { $actionID = $this->action->create('task', $taskID, 'Closed', $this->post->comment); $this->action->logHistory($actionID, $changes); - $this->sendmail($taskID, $actionID); + $this->task->sendmail($taskID, $actionID); } if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); @@ -883,7 +883,7 @@ class task extends control { $actionID = $this->action->create('task', $taskID, 'Closed', ''); $this->action->logHistory($actionID, $changes); - $this->sendmail($taskID, $actionID); + $this->task->sendmail($taskID, $actionID); } } if(isset($skipTasks)) echo js::alert(sprintf($this->lang->task->error->skipClose, join(',', $skipTasks))); @@ -912,7 +912,7 @@ class task extends control { $actionID = $this->action->create('task', $taskID, 'Canceled', $this->post->comment); $this->action->logHistory($actionID, $changes); - $this->sendmail($taskID, $actionID); + $this->task->sendmail($taskID, $actionID); } if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); @@ -946,7 +946,7 @@ class task extends control { $actionID = $this->action->create('task', $taskID, 'Activated', $this->post->comment); $this->action->logHistory($actionID, $changes); - $this->sendmail($taskID, $actionID); + $this->task->sendmail($taskID, $actionID); } if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); @@ -985,63 +985,6 @@ class task extends control } } - /** - * Send email. - * - * @param int $taskID - * @param int $actionID - * @access public - * @return void - */ - public function sendmail($taskID, $actionID) - { - /* Reset $this->output. */ - $this->clear(); - - /* Set toList and ccList. */ - $task = $this->task->getById($taskID); - $projectName = $this->project->getById($task->project)->name; - $users = $this->loadModel('user')->getPairs('noletter'); - $toList = $task->assignedTo; - $ccList = trim($task->mailto, ','); - - if($toList == '') - { - if($ccList == '') return; - if(strpos($ccList, ',') === false) - { - $toList = $ccList; - $ccList = ''; - } - else - { - $commaPos = strpos($ccList, ','); - $toList = substr($ccList, 0, $commaPos); - $ccList = substr($ccList, $commaPos + 1); - } - } - elseif(strtolower($toList) == 'closed') - { - $toList = $task->finishedBy; - } - - /* Get action info. */ - $action = $this->loadModel('action')->getById($actionID); - $history = $this->action->getHistory($actionID); - $action->history = isset($history[$actionID]) ? $history[$actionID] : array(); - - /* Create the email content. */ - $this->view->task = $task; - $this->view->action = $action; - $this->view->users = $users; - - $mailContent = $this->parse($this->moduleName, 'sendmail'); - - /* Send emails. */ - $this->loadModel('mail')->send($toList, 'TASK#' . $task->id . ' ' . $task->name . ' - ' . $projectName, $mailContent, $ccList); - if($this->mail->isError()) trigger_error(join("\n", $this->mail->getError())); - } - /** * AJAX: return tasks of a user in html select. * @@ -1139,6 +1082,7 @@ class task extends control { if($_POST) { + $this->loadModel('file'); $taskLang = $this->lang->task; $taskConfig = $this->config->task; @@ -1217,7 +1161,7 @@ class task extends control $task->files = ''; foreach($relatedFiles[$task->id] as $file) { - $fileURL = 'http://' . $this->server->http_host . $this->config->webRoot . "data/upload/{$this->app->company->id}/" . $file->pathname; + $fileURL = common::getSysURL() . $this->file->webPath . $file->pathname; $task->files .= html::a($fileURL, $file->title, '_blank') . '
'; } } diff --git a/module/task/model.php b/module/task/model.php index 07bf6613bc..12ca40708c 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -1696,4 +1696,70 @@ class taskModel extends model echo ''; } } + + /** + * Send mail. + * + * @param int $taskID + * @param int $actionID + * @access public + * @return void + */ + public function sendmail($taskID, $actionID) + { + $this->loadModel('mail'); + $task = $this->getById($taskID); + $projectName = $this->loadModel('project')->getById($task->project)->name; + $users = $this->loadModel('user')->getPairs('noletter'); + + /* Get action info. */ + $action = $this->loadModel('action')->getById($actionID); + $history = $this->action->getHistory($actionID); + $action->history = isset($history[$actionID]) ? $history[$actionID] : array(); + + /* Get mail content. */ + $modulePath = $this->app->getModulePath(); + $oldcwd = getcwd(); + $viewFile = $modulePath . 'view/sendmail.html.php'; + chdir($modulePath . 'view'); + if(file_exists($modulePath . 'ext/view/sendmail.html.php')) + { + $viewFile = $modulePath . 'ext/view/sendmail.html.php'; + chdir($modulePath . 'ext/view'); + } + ob_start(); + include $viewFile; + foreach(glob($modulePath . 'ext/view/sendmail.*.html.hook.php') as $hookFile) include $hookFile; + $mailContent = ob_get_contents(); + ob_end_clean(); + chdir($oldcwd); + + /* Set toList and ccList. */ + $toList = $task->assignedTo; + $ccList = trim($task->mailto, ','); + + if(empty($toList)) + { + if(empty($ccList)) return; + if(strpos($ccList, ',') === false) + { + $toList = $ccList; + $ccList = ''; + } + else + { + $commaPos = strpos($ccList, ','); + $toList = substr($ccList, 0, $commaPos); + $ccList = substr($ccList, $commaPos + 1); + } + } + elseif(strtolower($toList) == 'closed') + { + $toList = $task->finishedBy; + } + + /* Send emails. */ + $this->mail->send($toList, 'TASK#' . $task->id . ' ' . $task->name . ' - ' . $projectName, $mailContent, $ccList); + if($this->mail->isError()) trigger_error(join("\n", $this->mail->getError())); + } } diff --git a/module/task/view/sendmail.html.php b/module/task/view/sendmail.html.php index b19c009899..2a7b0dda6d 100644 --- a/module/task/view/sendmail.html.php +++ b/module/task/view/sendmail.html.php @@ -11,12 +11,12 @@ */ ?> id . ' ' . $task->name;?> - +app->getModuleRoot() . 'common/view/mail.header.html.php';?> - +
createLink('task', 'view', "taskID=$task->id"), $mailTitle, '', "style='color: #333;'");?>config->mail, 'domain', common::getSysURL()) . helper::createLink('task', 'view', "taskID=$task->id"), $mailTitle, '', "style='color: #333; text-decoration: underline;'");?>
@@ -24,9 +24,9 @@
- task->legendDesc;?> + lang->task->legendDesc;?>
desc;?>
- +app->getModuleRoot() . 'common/view/mail.footer.html.php';?> diff --git a/module/testtask/control.php b/module/testtask/control.php index 19fd54e9d3..a1ab1124eb 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -96,7 +96,7 @@ class testtask extends control $taskID = $this->testtask->create(); if(dao::isError()) die(js::error(dao::getError())); $actionID = $this->loadModel('action')->create('testtask', $taskID, 'opened'); - $this->sendmail($taskID, $actionID, 'opened'); + $this->testtask->sendmail($taskID, $actionID); die(js::locate($this->createLink('testtask', 'browse', "productID=$productID"), 'parent')); } @@ -365,7 +365,7 @@ class testtask extends control $this->action->logHistory($actionID, $changes); /* send mail.*/ - $this->sendmail($taskID, $actionID, 'edited'); + $this->testtask->sendmail($taskID, $actionID); } die(js::locate(inlink('view', "taskID=$taskID"), 'parent')); } @@ -452,7 +452,7 @@ class testtask extends control { $actionID = $this->action->create('testtask', $taskID, 'Closed', $this->post->comment); $this->action->logHistory($actionID, $changes); - $this->sendmail($taskID, $actionID, 'closed'); + $this->testtask->sendmail($taskID, $actionID); } if(isonlybody()) die(js::reload('parent.parent')); @@ -822,70 +822,4 @@ class testtask extends control ->exec(); die(js::locate($this->session->caseList)); } - - /** - * Send mail. - * - * @param int $testtaskID - * @param int $actionID - * @param string $action - * @access public - * @return void - */ - public function sendmail($testtaskID, $actionID, $actionType) - { - /* Reset $this->output. */ - $this->clear(); - - /* Set toList and ccList. */ - $testtask = $this->testtask->getByID($testtaskID); - $users = $this->loadModel('user')->getPairs('noletter'); - $toList = $testtask->owner; - $ccList = str_replace(' ', '', trim($testtask->mailto, ',')); - if($toList == '') - { - if($ccList == '') return; - if(strpos($ccList, ',') === false) - { - $toList = $ccList; - $ccList = ''; - } - else - { - $commaPos = strpos($ccList, ','); - $toList = substr($ccList, 0, $commaPos); - $ccList = substr($ccList, $commaPos + 1); - } - } - - /* Get action info. */ - $action = $this->loadModel('action')->getById($actionID); - $history = $this->action->getHistory($actionID); - $action->history = isset($history[$actionID]) ? $history[$actionID] : array(); - - /* Create the email content. */ - $this->view->testtask = $testtask; - $this->view->action = $action; - $this->view->users = $users; - - $mailContent = $this->parse($this->moduleName, 'sendmail'); - - /* Set email title. */ - if($actionType == 'opened') - { - $mailTitle = sprintf($this->lang->testtask->mail->create->title, $this->app->user->realname, $testtaskID, $this->post->name); - } - elseif($actionType == 'closed') - { - $mailTitle = sprintf($this->lang->testtask->mail->close->title, $this->app->user->realname, $testtaskID, $testtask->name); - } - else - { - $mailTitle = sprintf($this->lang->testtask->mail->edit->title, $this->app->user->realname, $testtaskID, $this->post->name); - } - - /* Send mail. */ - $this->loadModel('mail')->send($toList, $mailTitle, $mailContent, $ccList); - if($this->mail->isError()) trigger_error(join("\n", $this->mail->getError())); - } } diff --git a/module/testtask/model.php b/module/testtask/model.php index eb9bd353b7..8bc2009ea5 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -734,4 +734,78 @@ class testtaskModel extends model echo ''; } } + + /** + * Send mail. + * + * @param int $testtaskID + * @param int $actionID + * @access public + * @return void + */ + public function sendmail($testtaskID, $actionID) + { + $this->loadModel('mail'); + $testtask = $this->getByID($testtaskID); + $users = $this->loadModel('user')->getPairs('noletter'); + + /* Get action info. */ + $action = $this->loadModel('action')->getById($actionID); + $history = $this->action->getHistory($actionID); + $action->history = isset($history[$actionID]) ? $history[$actionID] : array(); + + /* Get mail content. */ + $modulePath = $this->app->getModulePath(); + $oldcwd = getcwd(); + $viewFile = $modulePath . 'view/sendmail.html.php'; + chdir($modulePath . 'view'); + if(file_exists($modulePath . 'ext/view/sendmail.html.php')) + { + $viewFile = $modulePath . 'ext/view/sendmail.html.php'; + chdir($modulePath . 'ext/view'); + } + ob_start(); + include $viewFile; + foreach(glob($modulePath . 'ext/view/sendmail.*.html.hook.php') as $hookFile) include $hookFile; + $mailContent = ob_get_contents(); + ob_end_clean(); + chdir($oldcwd); + + /* Set toList and ccList. */ + $toList = $testtask->owner; + $ccList = str_replace(' ', '', trim($testtask->mailto, ',')); + if(empty($toList)) + { + if(empty($ccList)) return; + if(strpos($ccList, ',') === false) + { + $toList = $ccList; + $ccList = ''; + } + else + { + $commaPos = strpos($ccList, ','); + $toList = substr($ccList, 0, $commaPos); + $ccList = substr($ccList, $commaPos + 1); + } + } + + /* Set email title. */ + if($action->action == 'opened') + { + $mailTitle = sprintf($this->lang->testtask->mail->create->title, $this->app->user->realname, $testtaskID, $this->post->name); + } + elseif($action->action == 'closed') + { + $mailTitle = sprintf($this->lang->testtask->mail->close->title, $this->app->user->realname, $testtaskID, $testtask->name); + } + else + { + $mailTitle = sprintf($this->lang->testtask->mail->edit->title, $this->app->user->realname, $testtaskID, $this->post->name); + } + + /* Send mail. */ + $this->mail->send($toList, $mailTitle, $mailContent, $ccList); + if($this->mail->isError()) trigger_error(join("\n", $this->mail->getError())); + } } diff --git a/module/testtask/view/sendmail.html.php b/module/testtask/view/sendmail.html.php index 2bb4658ad0..1e1320d78d 100644 --- a/module/testtask/view/sendmail.html.php +++ b/module/testtask/view/sendmail.html.php @@ -11,12 +11,12 @@ */ ?> id . ' ' . $testtask->name;?> - +app->getModuleRoot() . 'common/view/mail.header.html.php';?> - +
createLink('testtask', 'view', "testtaskID=$testtask->id"), $mailTitle, '', "style='color: #333;'");?>config->mail, 'domain', common::getSysURL()) . helper::createLink('testtask', 'view', "testtaskID=$testtask->id"), $mailTitle, '', "style='color: #333; text-decoration: underline;'");?>
@@ -24,9 +24,9 @@
- testtask->desc;?> + lang->testtask->desc;?>
desc;?>
- +app->getModuleRoot() . 'common/view/mail.footer.html.php';?> From 9d0e59a9fdbf88ad78dde060302eb3e071b7c768 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 25 Nov 2016 17:36:05 +0800 Subject: [PATCH 3/5] * revert install.php and upgrade.php --- www/install.php | 37 +++++++++++++++++++++++++++++++++++++ www/upgrade.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 www/install.php create mode 100644 www/upgrade.php diff --git a/www/install.php b/www/install.php new file mode 100644 index 0000000000..04596f2d31 --- /dev/null +++ b/www/install.php @@ -0,0 +1,37 @@ + + * @package ZenTaoPMS + * @version $Id: install.php 4677 2013-04-26 06:23:58Z chencongzhi520@gmail.com $ + * @link http://www.zentao.net + */ +error_reporting(0); +session_start(); +define('IN_INSTALL', true); + +/* Load the framework. */ +include '../framework/router.class.php'; +include '../framework/control.class.php'; +include '../framework/model.class.php'; +include '../framework/helper.class.php'; + +/* Instance the app. */ +$app = router::createApp('pms', dirname(dirname(__FILE__)), 'router'); + +/* Check installed or not. */ +if(!isset($_SESSION['installing']) and isset($config->installed) and $config->installed) die(header('location: index.php')); + +/* Reset the config params to make sure the install program will be lauched. */ +$config->set('requestType', 'GET'); +$config->set('default.module', 'install'); +$app->setDebug(); + +/* During the installation, if the database params is setted, auto connect the db. */ +if(isset($config->installed) and $config->installed) $app->connectDB(); + +$app->parseRequest(); +$app->loadModule(); diff --git a/www/upgrade.php b/www/upgrade.php new file mode 100644 index 0000000000..b9060a929a --- /dev/null +++ b/www/upgrade.php @@ -0,0 +1,46 @@ + + * @package ZenTaoPMS + * @version $Id: upgrade.php 4677 2013-04-26 06:23:58Z chencongzhi520@gmail.com $ + * @link http://www.zentao.net + */ +/* Judge my.php exists or not. */ +define('IN_UPGRADE', true); +$myConfig = dirname(dirname(__FILE__)) . '/config/my.php'; +if(!file_exists($myConfig)) +{ + echo "文件" . $myConfig . "不存在! 提示:不要重命名原来的禅道安装目录,下载最新的源码包,覆盖即可。" . "
"; + echo $myConfig . " doesn't exists! Please don't rename zentao before overriding the source code!"; + exit; +} + +error_reporting(0); + +/* Load the framework. */ +include '../framework/router.class.php'; +include '../framework/control.class.php'; +include '../framework/model.class.php'; +include '../framework/helper.class.php'; + +/* Instance the app. */ +$app = router::createApp('pms', dirname(dirname(__FILE__)), 'router'); +$common = $app->loadCommon(); + +/* Reset the config params to make sure the install program will be lauched. */ +$config->set('requestType', 'GET'); +$config->set('default.module', 'upgrade'); +$app->setDebug(); + +/* Check the installed version is the latest or not. */ +$config->installedVersion = $common->loadModel('setting')->getVersion(); +if(version_compare($config->version, $config->installedVersion) <= 0) die(header('location: index.php')); + +/* Run it. */ +$app->parseRequest(); +$common->checkUpgradeStatus(); +$app->loadModule(); From 92a398bb1d35fe55374db601a8b917e9793032b8 Mon Sep 17 00:00:00 2001 From: Catouse Date: Sat, 26 Nov 2016 17:25:24 +0800 Subject: [PATCH 4/5] * improve UI of project/manageproducts view. --- module/project/css/manageproducts.css | 13 ++++++++----- module/project/view/manageproducts.html.php | 18 ++++++------------ 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/module/project/css/manageproducts.css b/module/project/css/manageproducts.css index 720a203e2f..c30eeca8b1 100644 --- a/module/project/css/manageproducts.css +++ b/module/project/css/manageproducts.css @@ -1,6 +1,9 @@ .row {padding: 20px;} -#productsBox .row > .col-sm-4 {padding: 8px 15px; border:1px solid #ddd;margin-bottom:5px; width:32%; margin-right:8px;} -#productsBox .row > .col-sm-4 label {display:block; cursor: pointer;} -#productsBox .row > .col-sm-4:hover {background: #f1f1f1; cursor: pointer;} -#productsBox .row > .col-sm-4.checked, #productsBox .row > .col-sm-4.checked:hover {background: #E5FFE6; border: 1px solid #229F24;} -.col-sm-4+.col-sm-4 {margin-left: 0;} +#productsBox .row > .product {border:1px solid #ddd;margin-bottom:5px; width:32%; margin-right:8px; padding: 0; position: relative;} +#productsBox .row > .product label {display:block; cursor: pointer; margin: 0; padding: 8px 10px 8px 30px;} +#productsBox .row > .product:hover {background: #f1f1f1; cursor: pointer;} +#productsBox .row > .product.checked, #productsBox .row > .product.checked:hover {background: #E5FFE6; border: 1px solid #229F24;} +.product + .product {margin-left: 0;} +#productsBox .row > .product.has-branch label {margin-right: 40%;} +#productsBox .row > .product.has-branch > .form-control, +#productsBox .row > .product.has-branch > .chosen-container {position: absolute; width: 40%!important; right: 3px; top: 3px;} diff --git a/module/project/view/manageproducts.html.php b/module/project/view/manageproducts.html.php index 40af4449e5..060fa7cbba 100644 --- a/module/project/view/manageproducts.html.php +++ b/module/project/view/manageproducts.html.php @@ -24,17 +24,14 @@ $productName):?> -
- "?> -