diff --git a/bin/init.bat b/bin/init.bat index 8643144b1e..04f534a605 100644 --- a/bin/init.bat +++ b/bin/init.bat @@ -39,7 +39,11 @@ echo %ztcli% > %baseDir%ztcli.bat echo ztcli.bat ok :: create backup.bat -SET backup= %phpcli% %baseDir%php\backup.php +if %requestType% == 'PATH_INFO' ( + SET backup= %phpcli% %baseDir%ztcli "%pmsRoot%/backup-backup.html" +)else ( + SET backup= %phpcli% %baseDir%ztcli "%pmsRoot%/index.php?m=backup&f=backup" +) echo %backup% > %baseDir%backup.bat echo backup.bat ok diff --git a/bin/init.sh b/bin/init.sh index 7dbf98b722..61fc4c5b47 100755 --- a/bin/init.sh +++ b/bin/init.sh @@ -42,7 +42,11 @@ echo $ztcli > $basePath/ztcli.sh echo "ztcli.sh ok" # backup database -backup="$phpcli $basePath/php/backup.php" +if [ $requestType == 'PATH_INFO' ]; then + backup="$phpcli $basePath/ztcli '$pmsRoot/backup-backup.html'"; +else + backup="$phpcli $basePath/ztcli '$pmsRoot/index.php?m=backup&f=backup'"; +fi echo $backup > $basePath/backup.sh echo "backup.sh ok" diff --git a/bin/php/backup.php b/bin/php/backup.php deleted file mode 100755 index 97f7d12e81..0000000000 --- a/bin/php/backup.php +++ /dev/null @@ -1,58 +0,0 @@ -db->host}; port={$config->db->port}; dbname={$config->db->name}"; -$dbh = new PDO($dsn, $config->db->user, $config->db->password, array(PDO::ATTR_PERSISTENT => $config->db->persistant)); -$dbh->exec("SET NAMES {$config->db->encoding}"); -echo "Backuping database,"; -$zdb = new zdb(); -$return = $zdb->dump($dbRawFile); -if($return->result) -{ - $dbZipFile = $destDir . "/" . str_replace("sql", "zip", $dbRawFile); - $archive = new pclzip($dbZipFile); - - if($archive->create($dbRawFile)) - { - unlink($dbRawFile); - echo " successfully saved to $dbZipFile\n"; - } - else - { - die("Error : " . $archive->errorInfo(true)); - } -} -else -{ - echo "Failed to backup database!\n"; -} - -/* Backup the attachments. */ -chdir(dirname(dirname(dirname(__FILE__))) . "/www"); -if(!is_dir('data/upload')) die(" No files needed backup.\n"); - -echo "Backuping files,"; -$attachFile = $destDir . "/" . "file." . date('Ymd', time()) . ".zip"; -$archive = new pclzip($attachFile); -if($archive->create("data/upload", PCLZIP_OPT_REMOVE_PATH, "data")) die(" successfully saved to $attachFile\n"); -die("Error : ".$archive->errorInfo(true)); diff --git a/config/config.php b/config/config.php index 60180e1c8d..b01c02e9c7 100644 --- a/config/config.php +++ b/config/config.php @@ -38,7 +38,7 @@ $config->langs['zh-tw'] = '繁體'; $config->langs['en'] = 'English'; /* 设备类型视图文件前缀。The prefix for view file for different device. */ -$config->devicePrefix['mhtml'] = 'm.'; +$config->devicePrefix['mhtml'] = ''; /* 默认值设置。Default settings. */ $config->default = new stdclass(); diff --git a/config/filter.php b/config/filter.php index ee9d0880b3..66e2c6ce16 100644 --- a/config/filter.php +++ b/config/filter.php @@ -199,3 +199,8 @@ $filter->user->login->get['account'] = 'account'; $filter->user->login->get['lang'] = 'reg::lang'; $filter->user->login->get['password'] = 'reg::any'; $filter->user->edit->get['from'] = 'reg::word'; + +$filter->git->cat->get['repoUrl'] = 'reg::base64'; +$filter->git->diff->get['repoUrl'] = 'reg::base64'; +$filter->svn->cat->get['repoUrl'] = 'reg::base64'; +$filter->svn->diff->get['repoUrl'] = 'reg::base64'; \ No newline at end of file diff --git a/db/update9.6.3.sql b/db/update9.6.3.sql new file mode 100644 index 0000000000..39bc5e846b --- /dev/null +++ b/db/update9.6.3.sql @@ -0,0 +1 @@ +ALTER TABLE `zt_productplan` ADD `order` TEXT NOT NULL AFTER `end`; diff --git a/db/zentao.sql b/db/zentao.sql index affac107d4..bafc633bfb 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -438,6 +438,7 @@ CREATE TABLE IF NOT EXISTS `zt_productplan` ( `desc` text NOT NULL, `begin` date NOT NULL, `end` date NOT NULL, + `order` text NOT NULL, `deleted` enum('0','1') NOT NULL default '0', PRIMARY KEY (`id`), KEY `plan` (`product`,`end`) @@ -916,7 +917,7 @@ INSERT INTO `zt_group` (`id`, `name`, `role`, `desc`) VALUES (9, 'TOP', 'top', 'for top manager.'), (10, 'OTHERS', 'others', 'for others.'), (11, 'guest', 'guest', 'For guest'), -(12, 'limited', 'limited', 'For limited user'); +(12, 'LIMITED', 'limited', 'For limited user'); INSERT INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (1, 'action', 'editComment'), diff --git a/module/action/control.php b/module/action/control.php index 4bfd85b965..5916f33db9 100755 --- a/module/action/control.php +++ b/module/action/control.php @@ -104,6 +104,23 @@ class action extends control } } + /** + * Comment. + * + * @param string $objectType + * @param int $objectID + * @access public + * @return void + */ + public function comment($objectType, $objectID) + { + $actionID = $this->action->create($objectType, $objectID, 'Commented', $this->post->comment); + + $moduleName = $objectType == 'case' ? 'testcase' : $objectType; + $this->loadModel($moduleName)->sendmail($objectID, $actionID); + die(js::reload('parent')); + } + /** * Edit comment of a action. * diff --git a/module/action/lang/en.php b/module/action/lang/en.php index c82640c395..34e6c6c784 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -25,6 +25,7 @@ $lang->action->undelete = 'Restore'; $lang->action->hideOne = 'Hide'; $lang->action->hideAll = 'Hide All'; $lang->action->editComment = 'Edit'; +$lang->action->comment = 'Comment'; $lang->action->trashTips = 'Note: Delete in ZenTao is logic.'; $lang->action->textDiff = 'Text Format'; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index b03587b84c..7021b27d0d 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -25,6 +25,7 @@ $lang->action->undelete = '还原'; $lang->action->hideOne = '隐藏'; $lang->action->hideAll = '全部隐藏'; $lang->action->editComment = '修改备注'; +$lang->action->comment = '备注'; $lang->action->trashTips = '提示:为了保证系统的完整性,禅道系统的删除都是标记删除。'; $lang->action->textDiff = '文本格式'; diff --git a/module/bug/config.php b/module/bug/config.php index 102a38f872..190b518f2d 100644 --- a/module/bug/config.php +++ b/module/bug/config.php @@ -6,7 +6,7 @@ $config->bug->longlife = 7; $config->bug->create = new stdclass(); $config->bug->edit = new stdclass(); $config->bug->resolve = new stdclass(); -$config->bug->create->requiredFields = 'title,openedBuild'; +$config->bug->create->requiredFields = 'title,openedBuild,module'; $config->bug->edit->requiredFields = $config->bug->create->requiredFields; $config->bug->resolve->requiredFields = 'resolution'; diff --git a/module/bug/control.php b/module/bug/control.php index 943a4d29dc..ad93f9e2a3 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -15,7 +15,7 @@ class bug extends control /** * Construct function, load some modules auto. - * + * * @access public * @return void */ @@ -43,7 +43,7 @@ class bug extends control /** * The index page, locate to browse. - * + * * @access public * @return void */ @@ -54,15 +54,15 @@ class bug extends control /** * Browse bugs. - * - * @param int $productID + * + * @param int $productID * @param string $branch - * @param string $browseType - * @param int $param - * @param string $orderBy - * @param int $recTotal - * @param int $recPerPage - * @param int $pageID + * @param string $browseType + * @param int $param + * @param string $orderBy + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID * @access public * @return void */ @@ -171,11 +171,11 @@ class bug extends control /** * The report page. - * - * @param int $productID - * @param string $browseType + * + * @param int $productID + * @param string $browseType * @param int $branchID - * @param int $moduleID + * @param int $moduleID * @access public * @return void */ @@ -211,8 +211,8 @@ class bug extends control /** * Create a bug. - * - * @param int $productID + * + * @param int $productID * @param string $extras others params, forexample, projectID=10,moduleID=10 * @access public * @return void @@ -328,6 +328,9 @@ class bug extends control $projectMembers = $this->view->users; } + $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch); + if(empty($moduleOptionMenu)) die(js::locate(helper::createLink('tree', 'browse', "productID=$productID&view=story"))); + /* Set custom. */ foreach(explode(',', $this->config->bug->list->customCreateFields) as $field) $customFields[$field] = $this->lang->bug->$field; $this->view->customFields = $customFields; @@ -339,7 +342,7 @@ class bug extends control $this->view->productID = $productID; $this->view->productName = $this->products[$productID]; - $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch); + $this->view->moduleOptionMenu = $moduleOptionMenu; $this->view->stories = $stories; $this->view->projects = $this->product->getProjectPairs($productID, $branch ? "0,$branch" : 0, $params = 'nodeleted'); $this->view->builds = $builds; @@ -372,11 +375,11 @@ class bug extends control } /** - * Batch create. - * - * @param int $productID - * @param int $projectID - * @param int $moduleID + * Batch create. + * + * @param int $productID + * @param int $projectID + * @param int $moduleID * @access public * @return void */ @@ -453,8 +456,8 @@ class bug extends control /** * View a bug. - * - * @param int $bugID + * + * @param int $bugID * @access public * @return void */ @@ -481,7 +484,7 @@ class bug extends control /* Get product info. */ $productID = $bug->product; $productName = $this->products[$productID]; - + /* Header and positon. */ $this->view->title = "BUG #$bug->id $bug->title - " . $this->products[$productID]; $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $productName); @@ -503,8 +506,8 @@ class bug extends control /** * Edit a bug. - * - * @param int $bugID + * + * @param int $bugID * @access public * @return void */ @@ -625,11 +628,11 @@ class bug extends control $this->bug->sendmail($bugID, $actionID); $bug = $this->bug->getById($bugID); - if($bug->toTask != 0) + if($bug->toTask != 0) { foreach($changes as $change) { - if($change['field'] == 'status') + if($change['field'] == 'status') { $confirmURL = $this->createLink('task', 'view', "taskID=$bug->toTask"); $cancelURL = $this->server->HTTP_REFERER; @@ -727,7 +730,7 @@ class bug extends control } /** - * Update assign of bug. + * Update assign of bug. * * @param int $bugID * @access public @@ -763,6 +766,34 @@ class bug extends control $this->display(); } + /** + * Batch change branch. + * + * @param int $branchID + * @access public + * @return void + */ + public function batchChangeBranch($branchID) + { + if($this->post->bugIDList) + { + $bugIDList = $this->post->bugIDList; + $bugIDList = array_unique($bugIDList); + unset($_POST['bugIDList']); + $allChanges = $this->bug->batchChangeBranch($bugIDList, $branchID); + if(dao::isError()) die(js::error(dao::getError())); + foreach($allChanges as $bugID => $changes) + { + $this->loadModel('action'); + $actionID = $this->action->create('bug', $bugID, 'Edited'); + $this->action->logHistory($actionID, $changes); + $this->bug->sendmail($bugID, $actionID); + } + } + $this->loadModel('score')->create('ajax', 'batchOther'); + die(js::locate($this->session->bugList, 'parent')); + } + /** * Batch change the module of bug. * @@ -792,9 +823,9 @@ class bug extends control } /** - * Batch update assign of bug. - * - * @param int $projectID + * Batch update assign of bug. + * + * @param int $projectID * @access public * @return void */ @@ -823,8 +854,8 @@ class bug extends control /** * confirm a bug. - * - * @param int $bugID + * + * @param int $bugID * @access public * @return void */ @@ -856,8 +887,8 @@ class bug extends control } /** - * Batch confirm bugs. - * + * Batch confirm bugs. + * * @access public * @return void */ @@ -875,11 +906,11 @@ class bug extends control $this->loadModel('score')->create('ajax', 'batchOther'); die(js::locate($this->session->bugList, 'parent')); } - + /** * Resolve a bug. - * - * @param int $bugID + * + * @param int $bugID * @access public * @return void */ @@ -896,7 +927,7 @@ class bug extends control $this->bug->sendmail($bugID, $actionID); $bug = $this->bug->getById($bugID); - if($bug->toTask != 0) + if($bug->toTask != 0) { /* If task is not finished, update it's status. */ $task = $this->task->getById($bug->toTask); @@ -907,7 +938,7 @@ class bug extends control $cancelURL = $this->createLink('bug', 'view', "bugID=$bugID"); die(js::confirm(sprintf($this->lang->bug->remindTask, $bug->toTask), $confirmURL, $cancelURL, 'parent', 'parent.parent')); } - } + } if(isonlybody()) die(js::closeModal('parent.parent')); die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); } @@ -936,9 +967,9 @@ class bug extends control /** * Batch resolve bugs. - * - * @param string $resolution - * @param string $resolvedBuild + * + * @param string $resolution + * @param string $resolvedBuild * @access public * @return void */ @@ -995,8 +1026,8 @@ class bug extends control /** * Close a bug. - * - * @param int $bugID + * + * @param int $bugID * @access public * @return void */ @@ -1113,8 +1144,8 @@ class bug extends control } /** - * Batch close bugs. - * + * Batch close bugs. + * * @access public * @return void */ @@ -1225,7 +1256,7 @@ class bug extends control /** * Save current template. - * + * * @access public * @return string */ @@ -1238,7 +1269,7 @@ class bug extends control /** * Build the user templates selection code. - * + * * @access public * @return void */ @@ -1250,8 +1281,8 @@ class bug extends control /** * Delete a user template. - * - * @param int $templateID + * + * @param int $templateID * @access public * @return void */ @@ -1263,8 +1294,8 @@ class bug extends control /** * AJAX: get bugs of a user in html select. - * - * @param string $account + * + * @param string $account * @param string $id the id of the select control. * @access public * @return string @@ -1280,9 +1311,9 @@ class bug extends control /** * AJAX: Get bug owner of a module. - * - * @param int $moduleID - * @param int $productID + * + * @param int $moduleID + * @param int $productID * @access public * @return string */ @@ -1294,32 +1325,32 @@ class bug extends control /** * AJAX: get team members of the project as assignedTo list. - * - * @param int $projectID - * @param string $selectedUser + * + * @param int $projectID + * @param string $selectedUser * @access public * @return string */ public function ajaxLoadAssignedTo($projectID, $selectedUser = '') { $projectMembers = $this->loadModel('project')->getTeamMemberPairs($projectID); - + die(html::select('assignedTo', $projectMembers, $selectedUser, 'class="form-control"')); } /** * AJAX: get team members of the latest project of a product as assignedTo list. - * - * @param int $productID + * + * @param int $productID * x - * @param string $selectedUser + * @param string $selectedUser * @access public * @return string */ public function ajaxLoadProjectTeamMembers($productID, $selectedUser = '') { $latestProject = $this->product->getLatestProject($productID); - if(!empty($latestProject)) + if(!empty($latestProject)) { $projectMembers = $this->loadModel('project')->getTeamMemberPairs($latestProject->id, 'nodeleted'); } @@ -1346,9 +1377,9 @@ class bug extends control } /** - * AJAX: get actions of a bug. for web app. - * - * @param int $bugID + * AJAX: get actions of a bug. for web app. + * + * @param int $bugID * @access public * @return void */ @@ -1359,10 +1390,10 @@ class bug extends control } /** - * Get data to export - * - * @param string $productID - * @param string $orderBy + * Get data to export + * + * @param string $productID + * @param string $orderBy * @access public * @return void */ @@ -1550,8 +1581,8 @@ class bug extends control /** * Ajax get bug by ID. - * - * @param int $bugID + * + * @param int $bugID * @access public * @return void */ diff --git a/module/bug/js/common.js b/module/bug/js/common.js index e8dc98b4bf..6fcc8a9ae1 100644 --- a/module/bug/js/common.js +++ b/module/bug/js/common.js @@ -78,7 +78,7 @@ function loadBranch() $('#taskIdBox').innerHTML = ''; // Reset the task. $('#task').chosen(defaultChosenOptions); productID = $('#product').val(); - loadProductModules(productID); + loadProductModules(productID); loadProductProjects(productID); loadProductBuilds(productID); loadProductplans(productID); diff --git a/module/bug/lang/en.php b/module/bug/lang/en.php index 2524661b50..8f983f6bb3 100644 --- a/module/bug/lang/en.php +++ b/module/bug/lang/en.php @@ -217,18 +217,18 @@ $lang->bug->browserList['other'] = 'Other'; $lang->bug->typeList[''] = ''; $lang->bug->typeList['codeerror'] = 'Code Error'; $lang->bug->typeList['interface'] = 'Interface Optimization'; -$lang->bug->typeList['designchange'] = 'Design Change'; -$lang->bug->typeList['newfeature'] = 'New Feature'; -$lang->bug->typeList['designdefect'] = 'Design Defect'; $lang->bug->typeList['config'] = 'Configuration'; $lang->bug->typeList['install'] = 'Install/Deploy'; $lang->bug->typeList['security'] = 'Security'; $lang->bug->typeList['performance'] = 'Performance'; $lang->bug->typeList['standard'] = 'Standard'; $lang->bug->typeList['automation'] = 'Testing Script'; -$lang->bug->typeList['trackthings'] = 'Issue Tracking'; $lang->bug->typeList['others'] = 'Other'; + + + + $lang->bug->statusList[''] = ''; $lang->bug->statusList['active'] = 'Active'; $lang->bug->statusList['resolved'] = 'Resolved'; diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php index eb81221b4c..90b0fc7337 100644 --- a/module/bug/lang/zh-cn.php +++ b/module/bug/lang/zh-cn.php @@ -115,6 +115,7 @@ $lang->bug->byQuery = '搜索'; $lang->bug->needConfirm = '需求变动'; $lang->bug->allProduct = '所有' . $lang->productCommon; + $lang->bug->ditto = '同上'; $lang->bug->dittoNotice = '该bug与上一bug不属于同一产品!'; @@ -216,17 +217,17 @@ $lang->bug->browserList['other'] = '其他'; $lang->bug->typeList[''] = ''; $lang->bug->typeList['codeerror'] = '代码错误'; $lang->bug->typeList['interface'] = '界面优化'; -$lang->bug->typeList['designchange'] = '设计变更'; -$lang->bug->typeList['newfeature'] = '新增需求'; -$lang->bug->typeList['designdefect'] = '设计缺陷'; $lang->bug->typeList['config'] = '配置相关'; $lang->bug->typeList['install'] = '安装部署'; $lang->bug->typeList['security'] = '安全相关'; $lang->bug->typeList['performance'] = '性能问题'; $lang->bug->typeList['standard'] = '标准规范'; $lang->bug->typeList['automation'] = '测试脚本'; -$lang->bug->typeList['trackthings'] = '事务跟踪'; $lang->bug->typeList['others'] = '其他'; +$lang->bug->typeList['designchange'] = '设计变更'; +$lang->bug->typeList['newfeature'] = '新增需求'; +$lang->bug->typeList['designdefect'] = '设计缺陷'; +$lang->bug->typeList['trackthings'] = '事务跟踪'; $lang->bug->statusList[''] = ''; $lang->bug->statusList['active'] = '激活'; diff --git a/module/bug/model.php b/module/bug/model.php index 8b8b380b32..b6802cef13 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -113,7 +113,11 @@ class bugModel extends model for($i = 0; $i < $batchNum; $i++) { - if(!empty($data->title[$i]) and empty($data->openedBuilds[$i])) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->bug->openedBuild))); + if(!empty($data->title[$i])) + { + if(empty($data->modules[$i])) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->bug->module))); + if(empty($data->openedBuilds[$i])) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->bug->openedBuild))); + } } /* Get pairs(moduleID => moduleOwner) for bug. */ @@ -865,6 +869,35 @@ class bugModel extends model $this->linkBugToBuild($bugID, $bug->resolvedBuild); } + /** + * Batch change branch. + * + * @param array $bugIDList + * @param int $branchID + * @access public + * @return array + */ + public function batchChangeBranch($bugIDList, $branchID) + { + $now = helper::now(); + $allChanges = array(); + $oldBugs = $this->getByList($bugIDList); + foreach($bugIDList as $bugID) + { + $oldBug = $oldBugs[$bugID]; + if($branchID == $oldBug->branch) continue; + + $bug = new stdclass(); + $bug->lastEditedBy = $this->app->user->account; + $bug->lastEditedDate = $now; + $bug->branch = $branchID; + + $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec(); + if(!dao::isError()) $allChanges[$bugID] = common::createChanges($oldBug, $bug); + } + return $allChanges; + } + /** * Batch change the module of bug. * diff --git a/module/bug/view/batchcreate.html.php b/module/bug/view/batchcreate.html.php index 17fcbcae4e..4b6dda944d 100644 --- a/module/bug/view/batchcreate.html.php +++ b/module/bug/view/batchcreate.html.php @@ -39,7 +39,7 @@ foreach(explode(',', $showFields) as $field)