From dc6220e34f90b32200c059ea42fb1ad8277cd0dd Mon Sep 17 00:00:00 2001 From: wyd621 Date: Mon, 24 Mar 2014 00:59:51 +0000 Subject: [PATCH 1/9] * remove export title. --- module/bug/view/browse.html.php | 2 +- module/product/view/browse.html.php | 2 +- module/project/view/taskheader.html.php | 4 ++-- module/testcase/view/browse.html.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index 5f5b6d3e6a..8ad4b24606 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -40,7 +40,7 @@ js::set('customed', $customed); '; - echo html::a("#", " " . $lang->export, '', "id='exportAction' onclick=\"toggleSubMenu(this.id,'bottom',0)\" title='{$lang->export}'"); + echo html::a("#", " " . $lang->export, '', "id='exportAction' onclick=\"toggleSubMenu(this.id,'bottom',0)\""); echo ''; common::printIcon('bug', 'report', "productID=$productID&browseType=$browseType&moduleID=$moduleID"); diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index 25f032c957..22a6f87a6a 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -31,7 +31,7 @@
'; - echo html::a("#", " " . $lang->export, '', "id='exportAction' onclick='toggleSubMenu(this.id,\"bottom\",0)' title='{$lang->export}'"); + echo html::a("#", " " . $lang->export, '', "id='exportAction' onclick='toggleSubMenu(this.id,\"bottom\",0)'"); echo ''; common::printIcon('story', 'report', "productID=$productID&browseType=$browseType&moduleID=$moduleID"); diff --git a/module/project/view/taskheader.html.php b/module/project/view/taskheader.html.php index 1cdaba8da0..3cc39a273e 100644 --- a/module/project/view/taskheader.html.php +++ b/module/project/view/taskheader.html.php @@ -24,11 +24,11 @@ common::printIcon('task', 'report', "project=$projectID&browseType=$browseType"); echo ''; - echo html::a("#", " " . $lang->export, '', "id='exportAction' onclick=\"toggleSubMenu(this.id,'bottom',0)\" title='{$lang->export}'"); + echo html::a("#", " " . $lang->export, '', "id='exportAction' onclick=\"toggleSubMenu(this.id,'bottom',0)\""); echo ''; echo ''; - echo html::a("#", " " . $lang->import, '', "id='importAction' onclick=\"toggleSubMenu(this.id,'bottom',0)\" title='{$lang->import}'"); + echo html::a("#", " " . $lang->import, '', "id='importAction' onclick=\"toggleSubMenu(this.id,'bottom',0)\""); echo ''; common::printIcon('task', 'batchCreate', "projectID=$projectID"); diff --git a/module/testcase/view/browse.html.php b/module/testcase/view/browse.html.php index 37121d20f2..41b0e9a3f6 100644 --- a/module/testcase/view/browse.html.php +++ b/module/testcase/view/browse.html.php @@ -34,7 +34,7 @@ js::set('confirmDelete', $lang->testcase->confirmDelete); common::printIcon('testcase', 'import', "productID=$productID", '', 'button', '', '', 'export cboxElement'); echo ''; - echo html::a("#", "" . $lang->export, '', "id='exportAction' onclick=\"toggleSubMenu(this.id,'bottom',0)\" title='{$lang->export}'"); + echo html::a("#", "" . $lang->export, '', "id='exportAction' onclick=\"toggleSubMenu(this.id,'bottom',0)\""); echo ''; common::printIcon('testcase', 'batchCreate', "productID=$productID&moduleID=$moduleID"); From aa7a270e68a5a1bee9b3242dab6189f2b81457e4 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Mon, 24 Mar 2014 01:02:26 +0000 Subject: [PATCH 2/9] * remove packageType field for build. --- db/update5.2.1.sql | 1 - db/zentao.sql | 1 - module/build/js/common.js | 22 ---------------------- module/build/lang/en.php | 4 ---- module/build/lang/zh-cn.php | 6 +----- module/build/model.php | 4 ---- module/build/view/create.html.php | 5 ----- module/build/view/edit.html.php | 5 ----- module/release/model.php | 7 ++++--- 9 files changed, 5 insertions(+), 50 deletions(-) diff --git a/db/update5.2.1.sql b/db/update5.2.1.sql index 93f10e2b08..35954e5826 100644 --- a/db/update5.2.1.sql +++ b/db/update5.2.1.sql @@ -1,2 +1 @@ ALTER TABLE `zt_project` DROP `goal`; -ALTER TABLE `zt_build` ADD `packageType` varchar(10) COLLATE 'utf8_general_ci' NOT NULL DEFAULT 'path' AFTER `scmPath`; diff --git a/db/zentao.sql b/db/zentao.sql index 4d95a9d17c..c5568d9152 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -67,7 +67,6 @@ CREATE TABLE IF NOT EXISTS `zt_build` ( `project` mediumint(8) unsigned NOT NULL default '0', `name` char(150) NOT NULL, `scmPath` char(255) NOT NULL, - `packageType` varchar(10) COLLATE 'utf8_general_ci' NOT NULL DEFAULT 'path', `filePath` char(255) NOT NULL, `date` date NOT NULL, `stories` text NOT NULL, diff --git a/module/build/js/common.js b/module/build/js/common.js index c20857ad4d..e69de29bb2 100644 --- a/module/build/js/common.js +++ b/module/build/js/common.js @@ -1,22 +0,0 @@ -$(document).ready(function() -{ - $("a.preview").colorbox({width:1000, height:550, iframe:true, transition:'none', scrolling:true}); - if(typeof(packageType) != 'undefined') - { - var hiddenDom = packageType == 'filePath' ? 'fileform' : 'filePath'; - $('#' + hiddenDom).parents('tr').addClass('hidden'); - } - $("input[name='packageType']").bind('click', function() - { - if($(this).val() == 'path') - { - $('#filePath').parents('tr').removeClass('hidden'); - $('#fileform').parents('tr').addClass('hidden'); - } - else - { - $('#filePath').parents('tr').addClass('hidden'); - $('#fileform').parents('tr').removeClass('hidden'); - } - }) -}) diff --git a/module/build/lang/en.php b/module/build/lang/en.php index 73bd42b969..739540b721 100644 --- a/module/build/lang/en.php +++ b/module/build/lang/en.php @@ -37,10 +37,6 @@ $lang->build->linkStories = 'Stories'; $lang->build->linkBugs = 'Bugs'; $lang->build->stories = 'Linked stories'; $lang->build->bugs = 'Linked bugs'; -$lang->build->packageType = 'Package type'; $lang->build->finishStories = 'The total demand for a complete %s'; $lang->build->resolvedBugs = 'The total solution of bug%s'; - -$lang->build->packageTypeList['path'] = 'Shared file'; -$lang->build->packageTypeList['file'] = 'Upload file'; diff --git a/module/build/lang/zh-cn.php b/module/build/lang/zh-cn.php index b5da78d3cf..4265f7873d 100644 --- a/module/build/lang/zh-cn.php +++ b/module/build/lang/zh-cn.php @@ -28,7 +28,7 @@ $lang->build->name = '名称编号'; $lang->build->date = '打包日期'; $lang->build->builder = '构建者'; $lang->build->scmPath = '源代码地址'; -$lang->build->filePath = '存储地址'; +$lang->build->filePath = '下载地址'; $lang->build->desc = '描述'; $lang->build->files = '上传发行包'; $lang->build->last = '上个版本'; @@ -37,10 +37,6 @@ $lang->build->linkStories = '相关需求'; $lang->build->linkBugs = '相关Bug'; $lang->build->stories = '已关联需求'; $lang->build->bugs = '已关联Bug'; -$lang->build->packageType = '发行包方式'; $lang->build->finishStories = '本次共完成需求%s个'; $lang->build->resolvedBugs = '本次共解决Bug%s个'; - -$lang->build->packageTypeList['path'] = '文件共享'; -$lang->build->packageTypeList['file'] = '上传附件'; diff --git a/module/build/model.php b/module/build/model.php index 79fe0f6508..4c54f9eb16 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -160,8 +160,6 @@ class buildModel extends model ->remove('resolvedBy,allchecker,files,labels') ->get(); - if($build->packageType == 'path') unset($_FILES); - $this->dao->insert(TABLE_BUILD)->data($build)->autoCheck()->batchCheck($this->config->build->create->requiredFields, 'notempty')->check('name', 'unique', "product = {$build->product}")->exec(); if(!dao::isError()) { @@ -191,8 +189,6 @@ class buildModel extends model ->remove('allchecker,resolvedBy,files,labels') ->get(); - if($build->packageType == 'path') unset($_FILES); - $this->dao->update(TABLE_BUILD)->data($build) ->autoCheck() ->batchCheck($this->config->build->edit->requiredFields, 'notempty') diff --git a/module/build/view/create.html.php b/module/build/view/create.html.php index 3f9799fad7..e7ac2b0de6 100644 --- a/module/build/view/create.html.php +++ b/module/build/view/create.html.php @@ -39,10 +39,6 @@ build->scmPath;?> - - build->packageType;?> - build->packageTypeList, 'path');?> - build->filePath;?> @@ -118,5 +114,4 @@ - diff --git a/module/build/view/edit.html.php b/module/build/view/edit.html.php index df65e9ddac..f7bc359e24 100644 --- a/module/build/view/edit.html.php +++ b/module/build/view/edit.html.php @@ -36,10 +36,6 @@ build->scmPath;?> scmPath, "class='text-1'");?> - - build->packageType;?> - build->packageTypeList, $build->packageType);?> - build->filePath;?> filePath, "class='text-1'");?> @@ -134,5 +130,4 @@ project);?> -packageType == 'file' ? 'fileform' : 'filePath')?> diff --git a/module/release/model.php b/module/release/model.php index 57b47a4d5b..48a062cb7d 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -23,7 +23,7 @@ class releaseModel extends model */ public function getByID($releaseID, $setImgSize = false) { - $release = $this->dao->select('t1.*, t2.id as buildID, t2.packageType, t2.filePath, t2.scmPath, t2.name as buildName, t3.name as productName') + $release = $this->dao->select('t1.*, t2.id as buildID, t2.filePath, t2.scmPath, t2.name as buildName, t3.name as productName') ->from(TABLE_RELEASE)->alias('t1') ->leftJoin(TABLE_BUILD)->alias('t2')->on('t1.build = t2.id') ->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product = t3.id') @@ -32,8 +32,9 @@ class releaseModel extends model ->fetch(); if(!$release) return false; - $release->files = $this->loadModel('file')->getByObject('release', $releaseID); - if($release->packageType == 'file' and empty($release->files)) $release->files = $this->loadModel('file')->getByObject('build', $release->buildID); + $this->loadModel('file'); + $buildFiles = $this->file->getByObject('build', $release->buildID); + $release->files = $buildFiles ? $buildFiles : $this->file->getByObject('release', $releaseID); if($setImgSize) $release->desc = $this->file->setImgSize($release->desc); return $release; } From 01d820accb1f7a709b9ca779c3c9ff74349c6365 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Mon, 24 Mar 2014 01:15:44 +0000 Subject: [PATCH 3/9] * adjust position for the function of clear. --- module/bug/control.php | 5 ++++- module/project/control.php | 5 ++++- module/report/control.php | 4 +++- module/story/control.php | 5 ++++- module/task/control.php | 5 ++++- module/testtask/control.php | 4 +++- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index c9f115f807..4c434ef415 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1031,6 +1031,9 @@ class bug extends control */ public function sendmail($bugID, $actionID) { + /* Reset $this->output. */ + $this->clear(); + /* Set toList and ccList. */ $bug = $this->bug->getByID($bugID); $productName = $this->products[$bug->product]; @@ -1067,7 +1070,7 @@ class bug extends control $this->view->bug = $bug; $this->view->action = $action; $this->view->users = $this->user->getPairs('noletter'); - $this->clear(); + $mailContent = $this->parse($this->moduleName, 'sendmail'); /* Send it. */ diff --git a/module/project/control.php b/module/project/control.php index 7215ebeb24..a5f18c50e9 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1170,6 +1170,9 @@ class project extends control */ 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; @@ -1204,7 +1207,7 @@ class project extends control /* Create the email content. */ $this->view->task = $task; $this->view->action = $action; - $this->clear(); + $mailContent = $this->parse($this->moduleName, 'sendmail'); /* Send emails. */ diff --git a/module/report/control.php b/module/report/control.php index 0edc3b3eb2..21281d2cea 100644 --- a/module/report/control.php +++ b/module/report/control.php @@ -153,6 +153,9 @@ class report extends control foreach($reminder as $user => $mail) { + /* Reset $this->output. */ + $this->clear(); + /* Get email content and title.*/ $this->view->mail = $mail; $mailContent = $this->parse('report', 'dailyreminder'); @@ -161,7 +164,6 @@ class report extends control $mailTitle .= isset($mail->tasks) ? sprintf($this->lang->report->mailtitle->task, count($mail->tasks)) : ''; $mailTitle .= isset($mail->todos) ? sprintf($this->lang->report->mailtitle->todo, count($mail->todos)) : ''; $mailTitle = rtrim($mailTitle, ','); - $this->clear(); /* Send email.*/ echo date('Y-m-d H:i:s') . " sending to $user, "; diff --git a/module/story/control.php b/module/story/control.php index a849b3c64a..c33f3272ef 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -854,6 +854,9 @@ class story extends control */ public function sendmail($storyID, $actionID) { + /* Reset $this->output. */ + $this->clear(); + $story = $this->story->getById($storyID); $productName = $this->product->getById($story->product)->name; @@ -903,7 +906,7 @@ class story extends control $this->view->story = $story; $this->view->action = $action; $this->view->users = $this->user->getPairs('noletter'); - $this->clear(); + $mailContent = $this->parse($this->moduleName, 'sendmail'); /* Send it. */ diff --git a/module/task/control.php b/module/task/control.php index 91da8329b1..a45e65e8c6 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -769,6 +769,9 @@ class task extends control */ 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; @@ -805,7 +808,7 @@ class task extends control $this->view->task = $task; $this->view->action = $action; $this->view->users = $users; - $this->clear(); + $mailContent = $this->parse($this->moduleName, 'sendmail'); /* Send emails. */ diff --git a/module/testtask/control.php b/module/testtask/control.php index 3f550223f4..7e2e5e65c1 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -766,6 +766,9 @@ class testtask extends control */ public function sendmail($testtaskID, $actionID, $actionType) { + /* Reset $this->output. */ + $this->clear(); + $testtask = $this->testtask->getByID($testtaskID); $action = $this->action->getById($actionID); $users = $this->loadModel('user')->getPairs('noletter'); @@ -773,7 +776,6 @@ class testtask extends control $this->view->testtask = $testtask; $this->view->action = $action; $this->view->users = $users; - $this->clear(); $mailContent = $this->parse($this->moduleName, 'sendmail'); From 12374a02bc6c63fbc45f9debeb4db9ffebe76162 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Mon, 24 Mar 2014 01:25:44 +0000 Subject: [PATCH 4/9] * adjust for output timeout from exportConfigVars. --- lib/front/front.class.php | 1 + module/common/view/form.html.php | 2 +- module/common/view/header.lite.html.php | 2 +- www/js/jquery/form/zentao.js | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/front/front.class.php b/lib/front/front.class.php index 10ab0455df..28049a743a 100644 --- a/lib/front/front.class.php +++ b/lib/front/front.class.php @@ -784,6 +784,7 @@ EOT; $jsConfig->submitting = $lang->submitting; $jsConfig->save = $lang->save; $jsConfig->router = $app->server->PHP_SELF; + $jsConfig->timeout = $lang->timeout; $js = self::start(false); $js .= 'var config=' . json_encode($jsConfig); diff --git a/module/common/view/form.html.php b/module/common/view/form.html.php index d810694c14..900ff7f7c5 100755 --- a/module/common/view/form.html.php +++ b/module/common/view/form.html.php @@ -1,5 +1,5 @@ getExtViewFile(__FILE__)){include $extView; return helper::cd();}?> -lang->timeout)?> diff --git a/module/common/view/header.lite.html.php b/module/common/view/header.lite.html.php index b7acfab8e9..0f06fe2c81 100755 --- a/module/common/view/header.lite.html.php +++ b/module/common/view/header.lite.html.php @@ -11,7 +11,7 @@ $clientTheme = $this->app->getClientTheme(); - + zentaoPMS); diff --git a/www/js/jquery/form/zentao.js b/www/js/jquery/form/zentao.js index 4073a109f6..b1481ad3ba 100644 --- a/www/js/jquery/form/zentao.js +++ b/www/js/jquery/form/zentao.js @@ -85,7 +85,7 @@ $.extend( error:function(jqXHR, textStatus, errorThrown) { $.enableForm(formID); - if(textStatus == 'timeout' || textStatus == 'error') return alert(timeout); + if(textStatus == 'timeout' || textStatus == 'error') return alert(config.timeout); alert(jqXHR.responseText + textStatus + errorThrown); } }; From 37d7253961f903658d1e4ea0cb2fdc0c075b6060 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Mon, 24 Mar 2014 01:37:51 +0000 Subject: [PATCH 5/9] * adjust page for bug-customfields. --- module/bug/css/customfields.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/bug/css/customfields.css b/module/bug/css/customfields.css index d2edc24eaf..c85159f6a6 100644 --- a/module/bug/css/customfields.css +++ b/module/bug/css/customfields.css @@ -1,4 +1,4 @@ body{background:white; overflow:hidden;} -.btn-group .btn{display: block;width: 80px;text-align: center;margin-top: -1px;} +.btn-group .btn{display: block;width: 60px;text-align: center; padding: 4px; margin-bottom:2px;} .btn-group .btn:hover{z-index: 9999;} -.btn-group .btn i{line-height: 21px;} \ No newline at end of file +.btn-group .btn i{line-height: 21px;} From b66c834b4399ddbd198072c275a73c359385c08b Mon Sep 17 00:00:00 2001 From: wyd621 Date: Mon, 24 Mar 2014 01:59:50 +0000 Subject: [PATCH 6/9] * adjust for replace full webpath image to mail module. --- module/bug/control.php | 4 +++- module/bug/model.php | 1 + module/bug/view/sendmail.html.php | 10 +--------- module/mail/model.php | 3 +++ module/project/view/sendmail.html.php | 10 +--------- module/story/view/sendmail.html.php | 10 +--------- module/task/view/sendmail.html.php | 10 +--------- module/testtask/view/sendmail.html.php | 10 +--------- 8 files changed, 12 insertions(+), 46 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 4c434ef415..1a61f8425b 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -836,7 +836,9 @@ class bug extends control if($this->post->bugIDList) { $bugIDList = $this->post->bugIDList; - foreach($_POST as $postKey => $postValue) unset($_POST[$postKey]); + + /* Reset $_POST. Do not unset that because the function of close need that in model. */ + $_POST = array(); $bugs = $this->bug->getList($bugIDList); foreach($bugs as $bugID => $bug) diff --git a/module/bug/model.php b/module/bug/model.php index 100ff52e7f..994c7124f9 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -78,6 +78,7 @@ class bugModel extends model $data = fixer::input('post')->get(); $actions = array(); + /* Get pairs(moduleID => moduleOwner) for bug. */ $stmt = $this->dbh->query($this->loadModel('tree')->buildMenuQuery($productID, 'bug', $startModuleID = 0)); $moduleOwners = array(); while($module = $stmt->fetch()) $moduleOwners[$module->id] = $module->owner; diff --git a/module/bug/view/sendmail.html.php b/module/bug/view/sendmail.html.php index af791bb650..003295c46f 100644 --- a/module/bug/view/sendmail.html.php +++ b/module/bug/view/sendmail.html.php @@ -24,15 +24,7 @@ if($onlybody) $_GET['onlybody'] = 'no';
bug->legendSteps;?> -
- steps, 'src="data/upload')) - { - $bug->steps = preg_replace('/server->http_host . $this->config->webRoot, $bug->steps); - } - echo $bug->steps; - ?> -
+
steps;?>
diff --git a/module/mail/model.php b/module/mail/model.php index a757da09bf..77d6ce94ed 100644 --- a/module/mail/model.php +++ b/module/mail/model.php @@ -272,6 +272,9 @@ 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, $body); + try { $this->mta->setFrom($this->config->mail->fromAddress, $this->convertCharset($this->config->mail->fromName)); diff --git a/module/project/view/sendmail.html.php b/module/project/view/sendmail.html.php index 072da1f4c5..8085db722d 100644 --- a/module/project/view/sendmail.html.php +++ b/module/project/view/sendmail.html.php @@ -24,15 +24,7 @@ if($onlybody) $_GET['onlybody'] = 'no';
task->legendDesc;?> -
- desc, 'src="data/upload')) - { - $task->desc = preg_replace('/server->http_host . $this->config->webRoot, $task->desc); - } - echo $task->desc; - ?> -
+
desc;?>
diff --git a/module/story/view/sendmail.html.php b/module/story/view/sendmail.html.php index 8483264af6..60e1c9201f 100644 --- a/module/story/view/sendmail.html.php +++ b/module/story/view/sendmail.html.php @@ -24,15 +24,7 @@ if($onlybody) $_GET['onlybody'] = 'no';
story->legendSpec;?> -
- spec, 'src="data/upload')) - { - $story->spec = preg_replace('/server->http_host . $this->config->webRoot, $story->spec); - } - echo $story->spec; - ?> -
+
spec;?>
diff --git a/module/task/view/sendmail.html.php b/module/task/view/sendmail.html.php index 18778e2d4f..abdaa6d799 100644 --- a/module/task/view/sendmail.html.php +++ b/module/task/view/sendmail.html.php @@ -24,15 +24,7 @@ if($onlybody) $_GET['onlybody'] = 'no';
task->legendDesc;?> -
- desc, 'src="data/upload')) - { - $task->desc = preg_replace('/server->http_host . $this->config->webRoot, $task->desc); - } - echo $task->desc; - ?> -
+
desc;?>
diff --git a/module/testtask/view/sendmail.html.php b/module/testtask/view/sendmail.html.php index df51da4d74..ee938b2ac8 100644 --- a/module/testtask/view/sendmail.html.php +++ b/module/testtask/view/sendmail.html.php @@ -24,15 +24,7 @@ if($onlybody) $_GET['onlybody'] = 'no';
testtask->desc;?> -
- desc, 'src="data/upload')) - { - $testtask->desc = preg_replace('/server->http_host . $this->config->webRoot, $testtask->desc); - } - echo $testtask->desc; - ?> -
+
desc;?>
From 8086d79e709a3e6d723f85bf0991f3e0a87c1900 Mon Sep 17 00:00:00 2001 From: wyd621 Date: Mon, 24 Mar 2014 02:24:56 +0000 Subject: [PATCH 7/9] * change getList to getByList * add getByList in story module. --- module/bug/control.php | 2 +- module/bug/model.php | 6 +++--- module/story/model.php | 35 ++++++++++++++++++++++++++++------- module/task/control.php | 2 +- module/task/model.php | 2 +- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 1a61f8425b..04249cae9d 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -840,7 +840,7 @@ class bug extends control /* Reset $_POST. Do not unset that because the function of close need that in model. */ $_POST = array(); - $bugs = $this->bug->getList($bugIDList); + $bugs = $this->bug->getByList($bugIDList); foreach($bugs as $bugID => $bug) { if($bug->status != 'resolved') diff --git a/module/bug/model.php b/module/bug/model.php index 994c7124f9..83c1982801 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -202,7 +202,7 @@ class bugModel extends model * @access public * @return array */ - public function getList($bugIDList = 0) + public function getByList($bugIDList = 0) { return $this->dao->select('*')->from(TABLE_BUG) ->where('deleted')->eq(0) @@ -423,7 +423,7 @@ class bugModel extends model public function batchConfirm($bugIDList) { $now = helper::now(); - $bugs = $this->getList($bugIDList); + $bugs = $this->getByList($bugIDList); foreach($bugIDList as $bugID) { if($bugs[$bugID]->confirmed) continue; @@ -483,7 +483,7 @@ class bugModel extends model public function batchResolve($bugIDList, $resolution, $resolvedBuild) { $now = helper::now(); - $bugs = $this->getList($bugIDList); + $bugs = $this->getByList($bugIDList); foreach($bugIDList as $bugID) { $oldBug = $bugs[$bugID]; diff --git a/module/story/model.php b/module/story/model.php index 12c0284685..3dd2b9e719 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -57,6 +57,21 @@ class storyModel extends model return $story; } + /** + * Get stories by idList. + * + * @param int|array|string $storyIDList + * @access public + * @return array + */ + public function getByList($storyIDList = 0) + { + return $this->dao->select('*')->from(TABLE_STORY) + ->where('deleted')->eq(0) + ->beginIF($storyIDList)->andWhere('id')->in($storyIDList)->fi() + ->fetchAll('id'); + } + /** * Get affected things. * @@ -374,9 +389,10 @@ class storyModel extends model /* Init $stories. */ if(!empty($storyIDList)) { + $oldStories = $this->getByList($storyIDList); foreach($storyIDList as $storyID) { - $oldStory = $this->getById($storyID); + $oldStory = $oldStories[$storyID]; $story = new stdclass(); $story->lastEditedBy = $this->app->user->account; @@ -408,7 +424,7 @@ class storyModel extends model foreach($stories as $storyID => $story) { - $oldStory = $this->getById($storyID); + $oldStory = $oldStories[$storyID]; $this->dao->update(TABLE_STORY)->data($story) ->autoCheck() @@ -510,9 +526,11 @@ class storyModel extends model $date = helper::today(); $actions = array(); $this->loadModel('action'); + + $oldStories = $this->getByList($storyIDList); foreach($storyIDList as $storyID) { - $oldStory = $this->getById($storyID); + $oldStory = $oldStories[$storyID]; if($oldStory->status != 'draft' and $oldStory->status != 'changed') continue; $story = new stdClass(); @@ -591,9 +609,10 @@ class storyModel extends model /* Adjust whether the post data is complete, if not, remove the last element of $storyIDList. */ if($this->session->showSuhosinInfo) array_pop($storyIDList); + $oldStories = $this->getByList($storyIDList); foreach($storyIDList as $storyID) { - $oldStory = $this->getById($storyID); + $oldStory = $oldStories[$storyID]; if($oldStory->status == 'closed') continue; $story = new stdclass(); @@ -620,7 +639,7 @@ class storyModel extends model { if(!$story->closedReason) continue; - $oldStory = $this->getById($storyID); + $oldStory = $oldStories[$storyID]; $this->dao->update(TABLE_STORY)->data($story) ->autoCheck() @@ -653,9 +672,10 @@ class storyModel extends model { $now = helper::now(); $allChanges = array(); + $oldStories = $this->getByList($storyIDList); foreach($storyIDList as $storyID) { - $oldStory = $this->getById($storyID); + $oldStory = $oldStories[$storyID]; $story = new stdclass(); $story->lastEditedBy = $this->app->user->account; @@ -681,9 +701,10 @@ class storyModel extends model { $now = helper::now(); $allChanges = array(); + $oldStories = $this->getByList($storyIDList); foreach($storyIDList as $storyID) { - $oldStory = $this->getById($storyID); + $oldStory = $oldStories[$storyID]; if($oldStory->status == 'draft') continue; $story = new stdclass(); diff --git a/module/task/control.php b/module/task/control.php index a45e65e8c6..d9f70466f3 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -641,7 +641,7 @@ class task extends control unset($_POST['taskIDList']); $this->loadModel('action'); - $tasks = $this->task->getList($taskIDList); + $tasks = $this->task->getByList($taskIDList); foreach($tasks as $taskID => $task) { if($task->status == 'wait' or $task->status == 'doing') diff --git a/module/task/model.php b/module/task/model.php index 08041f40c2..87cdc6f1f9 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -684,7 +684,7 @@ class taskModel extends model * @access public * @return array */ - public function getList($taskIDList = 0) + public function getByList($taskIDList = 0) { return $this->dao->select('*')->from(TABLE_TASK) ->where('deleted')->eq(0) From d39c50c0821632189640b841b348639f319a39ed Mon Sep 17 00:00:00 2001 From: wyd621 Date: Mon, 24 Mar 2014 02:49:03 +0000 Subject: [PATCH 8/9] * adjust file-edit in colorbox. --- module/file/view/edit.html.php | 7 +++++-- module/file/view/printfiles.html.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/module/file/view/edit.html.php b/module/file/view/edit.html.php index 8485cbba1b..4def97432e 100644 --- a/module/file/view/edit.html.php +++ b/module/file/view/edit.html.php @@ -12,6 +12,9 @@ ?> + -
+ - diff --git a/module/file/view/printfiles.html.php b/module/file/view/printfiles.html.php index af33e122b4..ef10804611 100644 --- a/module/file/view/printfiles.html.php +++ b/module/file/view/printfiles.html.php @@ -5,7 +5,7 @@ $sessionString .= session_name() . '=' . session_id();
file->inputFileName;?>
+ title) . ".{$file->extension}";?>
-
+ $lang->project->weekend), $checked); - if($interval) - { - echo $lang->project->interval; - echo html::select('interval', $dayList, $interval); - } + if($interval) echo html::select('interval', $dayList, $interval); common::printLink('project', 'computeBurn', 'reload=yes', $lang->project->computeBurn, 'hiddenwin', "title='{$lang->project->computeBurn}{$lang->project->burn}' class='btn' id='computeBurn'"); echo $lang->project->howToUpdateBurn; diff --git a/module/release/model.php b/module/release/model.php index 48a062cb7d..7f81589426 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -33,8 +33,8 @@ class releaseModel extends model if(!$release) return false; $this->loadModel('file'); - $buildFiles = $this->file->getByObject('build', $release->buildID); - $release->files = $buildFiles ? $buildFiles : $this->file->getByObject('release', $releaseID); + $release->files = $this->file->getByObject('release', $releaseID); + if(empty($release->files))$release->files = $this->file->getByObject('build', $release->buildID); if($setImgSize) $release->desc = $this->file->setImgSize($release->desc); return $release; } @@ -96,6 +96,7 @@ class releaseModel extends model */ public function create($productID) { + $buildID = 0; if($this->post->build == false) { $build = fixer::input('post') diff --git a/module/report/model.php b/module/report/model.php index 93b25623f9..a1fa88516f 100644 --- a/module/report/model.php +++ b/module/report/model.php @@ -101,8 +101,7 @@ $(function () var baseline = $baselineJSON; var dateList = $dateListJSON; var ticks = $ticksJSON; - var firstMon = 0; - var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + var firstDay = 0; function showTooltip(x, y, contents) { $('
' + contents + '
').css @@ -132,20 +131,13 @@ $(function () { var month = tick.getMonth() + 1; var dateTail = ''; - if(firstMon != month) + if(firstDay != month) { - dateTail = '
/' + month; - firstMon = month; + dateTail = '/' + month; + firstDay = month; } - if(config.clientLang == 'en') - { - title = months[month-1] + ' ' + tick.getDate(); - } - else - { - title = month + '{$this->lang->date->month}' + tick.getDate(); - } + title = tick.getFullYear() + '/' + month + '/' + tick.getDate(); if(ticks.length <= 30) dateTail = '/' + month; return '' + tick.getDate() + dateTail + ''; diff --git a/module/story/model.php b/module/story/model.php index 3dd2b9e719..86ceb57721 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -66,9 +66,11 @@ class storyModel extends model */ public function getByList($storyIDList = 0) { - return $this->dao->select('*')->from(TABLE_STORY) - ->where('deleted')->eq(0) - ->beginIF($storyIDList)->andWhere('id')->in($storyIDList)->fi() + return $this->dao->select('t1.*, t2.spec, t2.verify')->from(TABLE_STORY)->alias('t1') + ->leftJoin(TABLE_STORYSPEC)->alias('t2')->on('t1.id=t2.story') + ->where('t1.deleted')->eq(0) + ->andWhere('t1.version=t2.version') + ->beginIF($storyIDList)->andWhere('t1.id')->in($storyIDList)->fi() ->fetchAll('id'); } @@ -551,7 +553,7 @@ class storyModel extends model $this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq($storyID)->exec(); $this->setStage($storyID); - if(strpos('done,postponed', $reason) !== false) $result = 'pass'; + if($reason and strpos('done,postponed', $reason) !== false) $result = 'pass'; $actions[$storyID] = $this->action->create('story', $storyID, 'Reviewed', '', ucfirst($result)); $this->action->logHistory($actions[$storyID], array()); }