diff --git a/VERSION b/VERSION
index 893d61407f..a0bf4fe0a2 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-15.0.rc2
+15.0.rc3
diff --git a/config/config.php b/config/config.php
index 149c92900b..a59d0e88eb 100644
--- a/config/config.php
+++ b/config/config.php
@@ -16,7 +16,7 @@ if(!class_exists('config')){class config{}}
if(!function_exists('getWebRoot')){function getWebRoot(){}}
/* 基本设置。Basic settings. */
-$config->version = '15.0.rc2'; // ZenTaoPHP的版本。 The version of ZenTaoPHP. Don't change it.
+$config->version = '15.0.rc3'; // ZenTaoPHP的版本。 The version of ZenTaoPHP. Don't change it.
$config->charset = 'UTF-8'; // ZenTaoPHP的编码。 The encoding of ZenTaoPHP.
$config->cookieLife = time() + 2592000; // Cookie的生存时间。The cookie life time.
$config->timezone = 'Asia/Shanghai'; // 时区设置。 The time zone setting, for more see http://www.php.net/manual/en/timezones.php.
diff --git a/db/zentao.sql b/db/zentao.sql
index 7ebfa9fa64..95bfaeefac 100644
--- a/db/zentao.sql
+++ b/db/zentao.sql
@@ -4181,7 +4181,7 @@ REPLACE INTO `zt_lang` (`lang`, `module`, `section`, `key`, `value`, `system`) V
('en', 'custom', 'URSRList', '1', '{\"SRName\":\"Story\",\"URName\":\"Epic\"}', '0'),
('en', 'custom', 'URSRList', '2', '{\"SRName\":\"Story\",\"URName\":\"Requirement\"}', '0');
-INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'custom', '', 'hourPoint', '1');
+INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'custom', '', 'hourPoint', '0');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', '', 'CRProduct', '1');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', '', 'CRExecution', '1');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'custom', '', 'URSR', '2');
diff --git a/framework/base/router.class.php b/framework/base/router.class.php
index 2dec604d3a..3a0490f547 100644
--- a/framework/base/router.class.php
+++ b/framework/base/router.class.php
@@ -886,22 +886,6 @@ class baseRouter
}
}
- /**
- * 保存openApp到cookie,下次请求使用,常用在locate, reload方法。
- * Save openApp to cookie, use it next visit, when locate, reload page.
- *
- * @access public
- * @return void
- */
- public function saveOpenApp()
- {
- $module = $this->rawModule;
- if(isset($this->lang->navGroup->$module) and $this->lang->navGroup->$module != $this->openApp)
- {
- setCookie('openApp', $this->openApp);
- }
- }
-
/**
* 根据用户浏览器的语言设置和服务器配置,选择显示的语言。
* 优先级:$lang参数 > session > cookie > 浏览器 > 配置文件。
diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php
new file mode 100644
index 0000000000..cbe2a0cbad
--- /dev/null
+++ b/lib/scm/gitlab.class.php
@@ -0,0 +1,655 @@
+client = $client;
+ $this->root = rtrim($root, '/') . '/';
+ $this->token = $password;
+ $this->branch = isset($_COOKIE['repoBranch']) ? $_COOKIE['repoBranch'] : '';
+ }
+
+ /**
+ * List files.
+ *
+ * @param string $path
+ * @param string $revision
+ * @access public
+ * @return array
+ */
+ public function ls($path, $revision = 'HEAD')
+ {
+ if(!scm::checkRevision($revision)) return array();
+ $api = "tree";
+
+ $param = new stdclass();
+ $param->path = urlencode(ltrim($path, '/'));
+ $param->ref = $revision;
+ $param->recursive = 0;
+
+ $list = $this->fetch($api, $param);
+ if(empty($list)) return array();
+
+ $infos = array();
+ foreach($list as $file)
+ {
+ $info = new stdClass();
+ if($file->type == 'blob')
+ {
+ $path = $file->path;
+ $file = $this->files($file->path);
+
+ $info->name = $file->file_name;
+ $info->kind = 'file';
+ $info->account = $file->committer;
+ $info->date = $file->date;
+ $info->size = $file->size;
+ $info->comment = $file->comment;
+ $info->revision = $file->revision;
+ }
+ else
+ {
+ $commits = $this->getCommitsByPath($file->path);
+ if(empty($commits)) continue;
+ $commit = $commits[0];
+
+ $info->name = $file->path;
+ $info->kind = 'dir';
+ $info->revision = $commit->id;
+ $info->account = $commit->committer_name;
+ $info->date = date('Y-m-d H:i:s', strtotime($commit->committed_date));
+ $info->size = 0;
+ $info->comment = $commit->message;
+ }
+
+ $infos[] = $info;
+ unset($info);
+ }
+
+ /* Sort by kind */
+ foreach($infos as $key => $info) $kinds[$key] = $info->kind;
+ if($infos) array_multisort($kinds, SORT_ASC, $infos);
+ return $infos;
+ }
+
+ /**
+ * Get files info.
+ *
+ * @param string $path
+ * @param string $ref
+ * @access public
+ * @return array
+ */
+ public function files($path, $ref = 'master')
+ {
+ $path = urlencode($path);
+ $api = "files/$path";
+ $param = new stdclass();
+ $param->ref = $ref;
+ $file = $this->fetch($api, $param);
+
+ $commits = $this->getCommitsByPath($path);
+ $file->revision = $file->commit_id;
+ $file->size = $this->formatBytes($file->size);
+
+ if(!empty($commits))
+ {
+ $commit = $commits[0];
+ $file->committer = $commit->committer_name;
+ $file->comment = $commit->message;
+ $file->date = date('Y-m-d H:i:s', strtotime($commit->committed_date));
+ }
+
+ return $file;
+ }
+
+ /**
+ * Get tags
+ *
+ * @param string $path
+ * @param string $revision
+ * @access public
+ * @return array
+ */
+ public function tags($path, $revision = 'HEAD')
+ {
+ $api = "tags";
+ $list = $this->fetch($api);
+
+ $tags = array();
+ foreach($list as $tag) $tags[] = $tag->name;
+
+ return $tags;
+ }
+
+ /**
+ * Get branch
+ *
+ * @access public
+ * @return array
+ */
+ public function branch()
+ {
+ $api = "branches";
+ $list = $this->fetch($api);
+
+ $branches = array();
+ foreach($list as $branch) $branches[$branch->name] = $branch->name;
+ asort($branches);
+
+ return $branches;
+ }
+
+ /**
+ * Get last log.
+ *
+ * @param string $path
+ * @param int $count
+ * @access public
+ * @return array
+ */
+ public function getLastLog($path, $count = 10)
+ {
+ return $this->log($path);
+ }
+
+ /**
+ * Get logs.
+ *
+ * @param string $path
+ * @param string $fromRevision
+ * @param string $toRevision
+ * @param int $count
+ * @access public
+ * @return array
+ */
+ public function log($path, $fromRevision = 0, $toRevision = 'HEAD', $count = 0)
+ {
+ if(!scm::checkRevision($fromRevision)) return array();
+ if(!scm::checkRevision($toRevision)) return array();
+
+ $path = ltrim($path, DIRECTORY_SEPARATOR);
+ $count = $count == 0 ? '' : "-n $count";
+
+ $list = $this->getCommitsByPath($path, $fromRevision, $toRevision);
+ foreach($list as $commit) $commit->diffs = $this->getFilesByCommit($commit->id);
+
+ return $this->parseLog($list);
+ }
+
+ /**
+ * Blame file
+ *
+ * @param string $path
+ * @param string $revision
+ * @access public
+ * @return array
+ */
+ public function blame($path, $revision)
+ {
+ if(!scm::checkRevision($revision)) return array();
+
+ $path = ltrim($path, DIRECTORY_SEPARATOR);
+ $path = urlencode($path);
+ $api = "files/$path/blame";
+ $param = new stdclass;
+ $param->ref = $this->branch;
+ $results = $this->fetch($api, $param);
+
+ $blames = array();
+ $revLine = 0;
+ $revision = '';
+
+ $lineNumber = 1;
+ foreach($results as $blame)
+ {
+ $line = array();
+ $line['revision'] = $blame->commit->id;
+ $line['committer'] = $blame->commit->committer_name;
+ $line['time'] = $blame->commit->committer_name;
+ $line['line'] = $lineNumber;
+ $line['lines'] = count($blame->lines);
+ $line['content'] = array_shift($blame->lines);
+
+ $blames[] = $line;
+
+ $lineNumber ++;
+
+ foreach($blame->lines as $line)
+ {
+ $blames[] = array('line' => $lineNumber, 'content' => $line);
+ $lineNumber ++;
+ }
+ }
+
+ return $blames;
+ }
+
+ /**
+ * Diff file.
+ *
+ * @param string $path
+ * @param string $fromRevision
+ * @param string $toRevision
+ * @access public
+ * @return array
+ */
+ public function diff($path, $fromRevision, $toRevision)
+ {
+ if(!scm::checkRevision($fromRevision)) return array();
+ if(!scm::checkRevision($toRevision)) return array();
+
+ $api = "compare";
+ $params = array('from' => $fromRevision, 'to' => $toRevision, 'straight' => 1);
+ $results = $this->fetch($api, $params);
+ foreach($results->diffs as $key => $diff)
+ {
+ if($path != '' and strpos($diff->new_path, $path) === false) unset($results->diffs[$key]);
+ }
+ return $results->diffs;
+ }
+
+ /**
+ * Cat file.
+ *
+ * @param string $entry
+ * @param string $revision
+ * @access public
+ * @return string
+ */
+ public function cat($entry, $revision = 'HEAD')
+ {
+ if(!scm::checkRevision($revision)) return false;
+ $file = $this->files($entry, $revision);
+ return base64_decode($file->content);
+ }
+
+ /**
+ * Get info.
+ *
+ * @param string $entry
+ * @param string $revision
+ * @access public
+ * @return object
+ */
+ public function info($entry, $revision = 'HEAD')
+ {
+ if(!scm::checkRevision($revision)) return false;
+
+ $info = new stdclass();
+ $info->kind = 'dir';
+ $info->path = $entry;
+ $info->root = '';
+
+ if($entry)
+ {
+ $parent = dirname($entry);
+ if($parent == '.') $parent = '/';
+ if($parent == '') $parent = '/';
+ $list = $this->tree($parent, 0);
+
+ foreach($list as $node) if($node->path == $entry) $file = $node;
+
+ $commits = $this->getCommitsByPath($entry);
+
+ if(!empty($commits)) $file->revision = zget($commits[0], 'id', '');
+ $info->kind = $file->type == 'tree' ? 'dir' : 'file';
+ }
+
+ return $info;
+ }
+
+ /**
+ * Exec git cmd.
+ *
+ * @param string $cmd
+ * @access public
+ * @todo Exec commads by gitlab api.
+ * @return array
+ */
+ public function exec($cmd)
+ {
+ chdir($this->root);
+ return execCmd(escapeCmd("$this->client $cmd"), 'array');
+ }
+
+ /**
+ * Parse diff.
+ *
+ * @param array $lines
+ * @access public
+ * @return array
+ */
+ public function parseDiff($results)
+ {
+ if(empty($results)) return array();
+ foreach($results as $file)
+ {
+ $diffFile = new stdclass();
+ $diffFile->fileName = $file->new_path;
+
+ $diff = new stdclass;
+ $diff->fileName = $file->new_path;
+
+ preg_match('/^@@ -(\\d+)(,(\\d+))?\\s+\\+(\\d+)(,(\\d+))?\\s+@@/A', $file->diff, $matches);
+ if(empty($matches)) continue;
+
+ $diff->oldStartLine = $matches[1];
+ $diff->newStartLine = $matches[4];
+
+ $oldCurrentLine = $diff->oldStartLine;
+ $newCurrentLine = $diff->newStartLine;
+ if($file->new_file)
+ {
+ $oldCurrentLine = $diff->newStartLine;
+ $newCurrentLine = $diff->oldStartLine;
+ }
+
+ $lines = explode("\n", $file->diff);
+ $newLines = array();
+ foreach($lines as $line)
+ {
+ if(strpos($line, '@@') === 0) continue;
+ if(strpos($line, '\ No newline at end of file') === 0) continue;
+ $sign = empty($line) ? '' : $line[0];
+ if($sign == '-' and $file->new_file) $sign = '+';
+ $type = $sign != '-' ? $sign == '+' ? 'new' : 'all' : 'old';
+
+ if($sign == '+' or $sign == '-')
+ {
+ $line = substr_replace($line, ' ', 1, 0);
+ if($file->new_file) $line = preg_replace('/^\-/', '+', $line);
+ }
+
+ $newLine = new stdclass();
+ $newLine->type = $type;
+ $newLine->oldlc = $type != 'new' ? $oldCurrentLine : '';
+ $newLine->newlc = $type != 'old' ? $newCurrentLine : '';
+ $newLine->line = htmlspecialchars($line);
+
+ if($type != 'new') $oldCurrentLine++;
+ if($type != 'old') $newCurrentLine++;
+
+ $newLines[] = $newLine;
+ }
+ $diffFile->contents[] = $diff;
+ $diff->lines = $newLines;
+ $diffs[] = $diffFile;
+ }
+ return $diffs;
+ }
+
+ /**
+ * Get commit count.
+ *
+ * @param int $commits
+ * @param string $lastVersion
+ * @access public
+ * @return int
+ */
+ public function getCommitCount($commits = 0, $lastVersion = '')
+ {
+ if(!scm::checkRevision($lastVersion)) return false;
+
+ chdir($this->root);
+ $revision = $this->branch ? $this->branch : 'HEAD';
+ return execCmd(escapeCmd("$this->client rev-list --count $revision -- ./"), 'string');
+ }
+
+ /**
+ * Get first revision.
+ *
+ * @access public
+ * @return string
+ */
+ public function getFirstRevision()
+ {
+ chdir($this->root);
+ $list = execCmd(escapeCmd("$this->client rev-list --reverse HEAD -- ./"), 'array');
+ return $list[0];
+ }
+
+ /**
+ * Get latest revision
+ *
+ * @access public
+ * @return string
+ */
+ public function getLatestRevision()
+ {
+ chdir($this->root);
+ $revision = $this->branch ? $this->branch : 'HEAD';
+ $list = execCmd(escapeCmd("$this->client rev-list -1 $revision -- ./"), 'array');
+ return $list[0];
+ }
+
+ /**
+ * Get commits.
+ *
+ * @param string $version
+ * @param int $count
+ * @param string $branch
+ * @access public
+ * @return array
+ */
+ public function getCommits($version = '', $count = 0, $branch = '')
+ {
+ if(!scm::checkRevision($version)) return array();
+ $api = "commits";
+
+ $count = 500;
+ $params = array();
+ $params['ref_name'] = $branch;
+ $params['per_page'] = $count;
+ $params['all'] = 1;
+
+ if($version)
+ {
+ $lastCommit = $this->getSingleCommit($version);
+ $params['until'] = $lastCommit->committed_date;
+ }
+
+ $list = $this->fetch($api, $params);
+
+ $commits = array();
+ foreach($list as $commit)
+ {
+ $log = new stdclass;
+ $log->committer = $commit->committer_name;
+ $log->revision = $commit->id;
+ $log->comment = $commit->message;
+ $log->time = date('Y-m-d H:i:s', strtotime($commit->created_at));
+
+ $commits[$commit->id] = $log;
+ $files[$commit->id] = $this->getFilesByCommit($log->revision);
+ }
+
+ return array('commits' => $commits, 'files' => $files);
+ }
+
+ /**
+ * getCommit
+ *
+ * @param int $sha
+ * @access public
+ * @return void
+ */
+ public function getSingleCommit($sha)
+ {
+ if(!scm::checkRevision($sha)) return null;
+ $api = "commits/$sha";
+ return $this->fetch($api);
+ }
+
+ /**
+ * Get commits by path.
+ *
+ * @param string $path
+ * @access public
+ * @return array
+ */
+ public function getCommitsByPath($path, $fromRevision = '', $toRevision = '')
+ {
+ $path = ltrim($path, DIRECTORY_SEPARATOR);
+ $api = "commits";
+
+ $param = new stdclass();
+ $param->path = urldecode($path);
+ $param->ref_name = $this->branch;
+
+ if($fromRevision) $fromRevision = $this->getSingleCommit($fromRevision);
+ if($toRevision) $toRevision = $this->getSingleCommit($toRevision);
+
+ if(!$fromRevision) $since = '';
+ if(!$toRevision) $until = '';
+ if($fromRevision and $toRevision)
+ {
+ $since = min($fromRevision->committed_date, $toRevision->committed_date);
+ $until = max($fromRevision->committed_date, $toRevision->committed_date);
+ }
+
+ $param->since = $since;
+ $param->until = $until;
+
+ return $this->fetch($api, $param);
+ }
+
+ /**
+ * Get files by commit.
+ *
+ * @param string $commit
+ * @access public
+ * @return void
+ */
+ public function getFilesByCommit($revision)
+ {
+ if(!scm::checkRevision($revision)) return array();
+ $api = "commits/{$revision}/diff";
+ $params = new stdclass;
+ $params->page = 1;
+ $params->per_page = 200;
+
+ $allResults = array();
+ while($results = $this->fetch($api, $params))
+ {
+ $params->page ++;
+ $allResults = $allResults + $results;
+ }
+
+ $files = array();
+ foreach($allResults as $row)
+ {
+ $file = new stdclass();
+ $file->revision = $revision;
+ $file->path = '/' . $row->new_path;
+ $file->type = 'file';
+
+ $file->action = 'M';
+ if($row->new_file) $file->action = 'A';
+ if($row->renamed_file) $file->action = 'R';
+ if($row->deleted_file) $file->action = 'D';
+ $files[] = $file;
+ }
+
+ return $files;
+ }
+
+ /**
+ * Repository/tree api.
+ *
+ * @param string $path
+ * @param bool $recursive
+ * @access public
+ * @return void
+ */
+ public function tree($path, $recursive = 1)
+ {
+ $api = "tree";
+
+ $params = array();
+ $params['path'] = ltrim($path, '/');
+ $params['ref'] = $this->branch;
+ $params['recursive'] = (int) $recursive;
+ return $this->fetch($api, $params);
+ }
+
+ /**
+ * Fetch data from gitlab api.
+ *
+ * @param string $api
+ * @access public
+ * @return void
+ */
+ public function fetch($api, $params = array())
+ {
+ $params = (array) $params;
+ $params['private_token'] = $this->token;
+
+ $api = ltrim($api, '/');
+ $api = $this->root . $api . '?' . http_build_query($params);
+
+ $response = file_get_contents($api);
+ return json_decode($response);
+ }
+
+ /**
+ * Format bytes shown.
+ *
+ * @param int $size
+ * @static
+ * @access public
+ * @return string
+ */
+ public static function formatBytes($size)
+ {
+ if($size < 1024) return $size . 'Bytes';
+ if(round($size / (1024 * 1024), 2) > 1) return round($size / (1024 * 1024), 2) . 'G';
+ if(round($size / 1024, 2) > 1) return round($size / 1024, 2) . 'M';
+ return round($size, 2) . 'KB';
+ }
+
+ /**
+ * Parse log.
+ *
+ * @param array $logs
+ * @access public
+ * @return array
+ */
+ public function parseLog($logs)
+ {
+ $parsedLogs = array();
+ $i = 0;
+ foreach($logs as $commit)
+ {
+ $parsedLog = new stdclass();
+ $parsedLog->revision = $commit->id;
+ $parsedLog->committer = $commit->committer_name;
+ $parsedLog->time = date('Y-m-d H:i:s', strtotime($commit->committed_date));
+ $parsedLog->comment = $commit->message;
+ $parsedLog->change = array();
+ foreach($commit->diffs as $diff)
+ {
+ $parsedLog->change[$diff->path] = array();
+ $parsedLog->change[$diff->path]['action'] = $diff->action;
+ $parsedLog->change[$diff->path]['kind'] = $diff->type;
+ }
+ $parsedLogs[] = $parsedLog;
+ }
+
+ return $parsedLogs;
+ }
+}
diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php
index 109c822529..f077c8ff35 100755
--- a/module/action/lang/zh-cn.php
+++ b/module/action/lang/zh-cn.php
@@ -431,7 +431,6 @@ $lang->action->dynamicAction->entry['created'] = '添加应用';
$lang->action->dynamicAction->entry['edited'] = '编辑应用';
/* 用来生成相应对象的链接。*/
-global $config;
$lang->action->label->product = $lang->productCommon . '|product|view|productID=%s';
$lang->action->label->productplan = "计划|productplan|view|productID=%s";
$lang->action->label->release = '发布|release|view|productID=%s';
diff --git a/module/action/model.php b/module/action/model.php
index cef27805e4..e002345d95 100755
--- a/module/action/model.php
+++ b/module/action/model.php
@@ -177,11 +177,12 @@ class actionModel extends model
}
/* Only process these object types. */
- if(strpos(',story,productplan,release,task,build,bug,case,testtask,doc,', ",{$objectType},") !== false)
+ if(strpos(',story,productplan,release,task,build,bug,case,testtask,doc,issue,risk,', ",{$objectType},") !== false)
{
if(!isset($this->config->objectTables[$objectType])) return $emptyRecord;
/* Set fields to fetch. */
+ $fields = '*';
if(strpos('story, productplan, case', $objectType) !== false) $fields = 'product';
if(strpos('build, bug, testtask, doc', $objectType) !== false) $fields = 'product, project, execution';
if($objectType == 'release') $fields = 'product, build';
diff --git a/module/admin/view/checkweak.html.php b/module/admin/view/checkweak.html.php
index 1f3b5ff786..bfe6962ddc 100644
--- a/module/admin/view/checkweak.html.php
+++ b/module/admin/view/checkweak.html.php
@@ -11,11 +11,6 @@
*/
?>
-
-
block->bug;?>
+
bug->common;?>
block->totalBug . ":";?>
allBugs;?>
-
block->doneBugs . ":";?>
+
bug->statusList['resolved'] . ":";?>
doneBugs;?>
-
block->leftBugs . ":";?>
+
bug->unResolved . ":";?>
leftBugs;?>
diff --git a/module/bug/control.php b/module/bug/control.php
index 2042419b62..f973801bea 100644
--- a/module/bug/control.php
+++ b/module/bug/control.php
@@ -509,7 +509,7 @@ class bug extends control
if(empty($moduleOptionMenu)) die(js::locate(helper::createLink('tree', 'browse', "productID=$productID&view=story")));
/* Get products and projects. */
- $products = $this->products;
+ $products = $this->config->CRProduct ? $this->products : $this->product->getPairs('noclosed');
$projects = array(0 => '');
if($projectID)
{
@@ -817,6 +817,11 @@ class bug extends control
if($bug->type != $type) unset($this->lang->bug->typeList[$type]);
}
+ if($this->app->openApp == 'qa')
+ {
+ $this->view->products = $this->config->CRProduct ? $this->products : $this->product->getPairs('noclosed');
+ }
+
/* Set header and position. */
$this->view->title = $this->lang->bug->edit . "BUG #$bug->id $bug->title - " . $this->products[$productID];
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php
index 6950477e3e..0cd8db28cf 100644
--- a/module/bug/view/batchedit.html.php
+++ b/module/bug/view/batchedit.html.php
@@ -49,7 +49,7 @@
| idAB;?> |
'>bug->type;?> |
- '>bug->severityAB;?> |
+ '>bug->severity;?> |
'>bug->pri;?> |
bug->title;?> |
diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php
index e9e1a34d46..ee07990a30 100644
--- a/module/bug/view/view.html.php
+++ b/module/bug/view/view.html.php
@@ -13,7 +13,7 @@
-session->bugList != false ? $app->session->bugList : inlink('browse', "productID=$bug->product");?>
+session->bugList ? $app->session->bugList : inlink('browse', "productID=$bug->product");?>
diff --git a/module/build/js/edit.js b/module/build/js/edit.js
index 3e58d95168..75f685f686 100644
--- a/module/build/js/edit.js
+++ b/module/build/js/edit.js
@@ -1,9 +1,8 @@
-var executionID = $('#execution').val();
function loadExecutions()
{
var productID = $('#product').val();
var branchID = $('#branch').length > 0 ? $('#branch').val() : 0;
- $('#executionsBox').load(createLink('product', 'ajaxGetExecutions', 'productID=' + productID + '&executionID=' + executionID + '&branch=' + branchID), function()
+ $('#executionsBox').load(createLink('product', 'ajaxGetExecutions', 'productID=' + productID + '&executionID=0&branch=' + branchID), function()
{
$('#executionsBox #execution').chosen().removeAttr('onchange');
});
diff --git a/module/build/model.php b/module/build/model.php
index 294f92c285..32f83db38a 100644
--- a/module/build/model.php
+++ b/module/build/model.php
@@ -394,7 +394,6 @@ class buildModel extends model
$oldBuild = $this->dao->select('*')->from(TABLE_BUILD)->where('id')->eq($buildID)->fetch();
$build = fixer::input('post')->stripTags($this->config->build->editor->edit['id'], $this->config->allowedTags)
->setDefault('product', $oldBuild->product)
- ->setDefault('branch', $oldBuild->branch)
->cleanInt('product,branch,execution')
->remove('allchecker,resolvedBy,files,labels,uid')
->get();
diff --git a/module/common/lang/en.php b/module/common/lang/en.php
index a236f17cb2..1aac0409b4 100644
--- a/module/common/lang/en.php
+++ b/module/common/lang/en.php
@@ -154,6 +154,7 @@ $lang->extension->common = 'Extension';
$lang->company->common = 'Company';
$lang->dept->common = 'Dept';
$lang->program->list = 'Program List';
+$lang->execution->list = "{$lang->executionCommon} List";
$lang->personnel->common = 'Member';
$lang->personnel->invest = 'Investment';
diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php
index 4b2a111d0f..701638fc27 100644
--- a/module/common/lang/menu.php
+++ b/module/common/lang/menu.php
@@ -226,7 +226,7 @@ $lang->scrum->menu->settings['subMenu']->group = array('link' => "{$lang->
/* Execution menu. */
$lang->execution->homeMenu = new stdclass();
if($config->systemMode == 'new') $lang->execution->homeMenu->index = "$lang->dashboard|execution|index|";
-$lang->execution->homeMenu->list = array('link' => "{$lang->executionCommon}列表|execution|all|", 'alias' => 'create,batchedit');
+$lang->execution->homeMenu->list = array('link' => "{$lang->execution->list}|execution|all|", 'alias' => 'create,batchedit');
$lang->execution->menu = new stdclass();
$lang->execution->menu->task = array('link' => "{$lang->task->common}|execution|task|executionID=%s", 'subModule' => 'task,tree', 'alias' => 'importtask,importbug');
@@ -330,9 +330,9 @@ $lang->devops->menuOrder[25] = 'rules';
/* Doc menu.*/
$lang->doc->menu = new stdclass();
$lang->doc->menu->dashboard = array('link' => "{$lang->dashboard}|doc|index");
-$lang->doc->menu->recent = array('link' => "{$lang->doc->recent}|doc|browse|libID=0&browseTyp=byediteddate", 'alias' => 'recent');
-$lang->doc->menu->my = array('link' => "{$lang->doc->my}|doc|browse|libID=0&browseTyp=openedbyme", 'alias' => 'my');
-$lang->doc->menu->collect = array('link' => "{$lang->doc->favorite}|doc|browse|libID=0&browseTyp=collectedbyme", 'alias' => 'collect');
+$lang->doc->menu->recent = array('link' => "{$lang->doc->recent}|doc|browse|browseTyp=byediteddate", 'alias' => 'recent');
+$lang->doc->menu->my = array('link' => "{$lang->doc->my}|doc|browse|browseTyp=openedbyme", 'alias' => 'my');
+$lang->doc->menu->collect = array('link' => "{$lang->doc->favorite}|doc|browse|browseTyp=collectedbyme", 'alias' => 'collect');
$lang->doc->menu->product = array('link' => "{$lang->doc->product}|doc|objectLibs|type=product", 'alias' => 'product');
if($config->systemMode == 'new') $lang->doc->menu->project = array('link' => "{$lang->doc->project}|doc|objectLibs|type=project", 'alias' => 'project');
if($config->systemMode == 'classic') $lang->doc->menu->execution = array('link' => "{$lang->doc->execution}|doc|objectLibs|type=execution", 'alias' => 'execution');
diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php
index 4840a236c3..ad5b452a85 100644
--- a/module/common/lang/zh-cn.php
+++ b/module/common/lang/zh-cn.php
@@ -154,6 +154,7 @@ $lang->extension->common = '插件';
$lang->company->common = '公司';
$lang->dept->common = '部门';
$lang->program->list = '项目集列表';
+$lang->execution->list = "{$lang->executionCommon}列表";
$lang->personnel->common = '人员';
$lang->personnel->invest = '投入人员';
diff --git a/module/common/view/datatable.fix.html.php b/module/common/view/datatable.fix.html.php
index 95a77574d5..6ed9254b0d 100644
--- a/module/common/view/datatable.fix.html.php
+++ b/module/common/view/datatable.fix.html.php
@@ -84,7 +84,7 @@ $(function()
moduleName == 'execution' && $app->methodName == 'task'):?>
| datatable->showAllModule;?> |
- datatable->showAllModuleList, isset($config->project->task->allModule) ? $config->project->task->allModule : 0);?> |
+ datatable->showAllModuleList, isset($config->execution->task->allModule) ? $config->execution->task->allModule : 0);?> |
diff --git a/module/custom/view/timezone.html.php b/module/custom/view/timezone.html.php
index 2df2364f74..3f802adc1e 100644
--- a/module/custom/view/timezone.html.php
+++ b/module/custom/view/timezone.html.php
@@ -32,11 +32,4 @@
-
-
diff --git a/module/doc/control.php b/module/doc/control.php
index cd0337040a..e90b33ef34 100644
--- a/module/doc/control.php
+++ b/module/doc/control.php
@@ -26,10 +26,6 @@ class doc extends control
$this->loadModel('product');
$this->loadModel('project');
$this->loadModel('execution');
- $this->from = $this->cookie->from ? $this->cookie->from : 'doc';
- $this->productID = $this->cookie->product ? $this->cookie->product : '0';
- $this->projectID = isset($_GET['project']) ? $_GET['project'] : 0;
- if($this->from == 'doc') $this->session->set('project', '');
}
/**
@@ -40,9 +36,6 @@ class doc extends control
*/
public function index()
{
- $this->from = 'doc';
- setcookie('from', 'doc', $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
-
$this->session->set('docList', $this->app->getURI(true), 'doc');
$this->app->loadClass('pager', $static = true);
$pager = new pager(0, 5, 1);
@@ -53,9 +46,9 @@ class doc extends control
$this->view->title = $this->lang->doc->common . $this->lang->colon . $this->lang->doc->index;
$this->view->position[] = $this->lang->doc->index;
- $this->view->latestEditedDocs = $this->doc->getDocsByBrowseType(0, 'byediteddate', 0, 0, 'editedDate_desc, id_desc', $pager);
- $this->view->myDocs = $this->doc->getDocsByBrowseType(0, 'openedbyme', 0, 0, 'addedDate_desc', $pager);
- $this->view->collectedDocs = $this->doc->getDocsByBrowseType(0, 'collectedbyme', 0, 0, 'addedDate_desc', $pager);
+ $this->view->latestEditedDocs = $this->doc->getDocsByBrowseType('byediteddate', 0, 0, 'editedDate_desc, id_desc', $pager);
+ $this->view->myDocs = $this->doc->getDocsByBrowseType('openedbyme', 0, 0, 'addedDate_desc', $pager);
+ $this->view->collectedDocs = $this->doc->getDocsByBrowseType('collectedbyme', 0, 0, 'addedDate_desc', $pager);
$this->view->statisticInfo = $this->doc->getStatisticInfo();
$this->view->users = $this->user->getPairs('noletter');
@@ -69,20 +62,15 @@ class doc extends control
* @param string $browseType
* @param int $param
* @param string $orderBy
- * @param string $from doc|project|product
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
- public function browse($libID = 0, $browseType = 'all', $param = 0, $orderBy = 'id_desc', $from = 'doc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
+ public function browse($browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->session->set('docList', $this->app->getURI(true), 'doc');
-
- $this->from = $from;
- setcookie('from', $from, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
-
$this->loadModel('search');
/* Set browseType.*/
@@ -90,38 +78,8 @@ class doc extends control
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
- $type = '';
- $productID = 0;
- $executionID = 0;
- if($libID)
- {
- $lib = $this->doc->getLibByID($libID);
- $type = $lib->type;
- $productID = $lib->product;
- $executionID = $lib->execution;
-
- if($type != 'product' and $type != 'execution') $from = 'doc';
- }
-
- $this->libs = $this->doc->getLibs($type, '', $libID);
-
- /* According the from, set menus. */
- if($from == 'product')
- {
- $this->product->setMenu($productID);
- }
- elseif($from == 'project')
- {
- $this->project->setMenu($lib->project);
- }
- else
- {
- $menuType = (!$type && (in_array($browseType, array_keys($this->lang->doc->fastMenuList)) || $browseType == 'bysearch')) ? $browseType : $type;
- }
-
/* Set header and position. */
- $this->view->title = $this->lang->doc->common . ($libID ? $this->lang->colon . $this->libs[$libID] : '');
- $this->view->position[] = $libID ? $this->libs[$libID] : '';
+ $this->view->title = $this->lang->doc->common;
/* Load pager. */
$this->app->loadClass('pager', $static = true);
@@ -130,33 +88,8 @@ class doc extends control
/* Append id for secend sort. */
$sort = $this->loadModel('common')->appendOrder($orderBy);
- /* Build the search form. */
- $actionURL = $this->createLink('doc', 'browse', "lib=$libID&browseType=bySearch&queryID=myQueryID&orderBy=$orderBy");
- $this->doc->buildSearchForm($libID, $this->libs, $queryID, $actionURL, $type);
-
- $title = '';
- $module = $moduleID ? $this->tree->getByID($moduleID) : '';
- if($module) $title = $module->name;
- if($libID) $title = html::a(helper::createLink('doc', 'browse', "libID=$libID"), $this->libs[$libID], '');
- if(in_array($browseType, array_keys($this->lang->doc->fastMenuList))) $title = $this->lang->doc->fastMenuList[$browseType];
- if($browseType == 'bysearch') $title = $this->lang->doc->search;
- if($param != 0) $title = $this->doc->buildCrumbTitle($libID, $param, $title);
- if($browseType == 'fastsearch')
- {
- if($this->post->searchDoc) $this->session->set('searchDoc', $this->post->searchDoc);
- $title = '"' . $this->session->searchDoc . '" ' . $this->lang->doc->searchResult;
- }
- else
- {
- $this->session->set('searchDoc', '');
- }
-
- $libs = array();
if($browseType == 'collectedbyme')
{
- $libs = $this->doc->getAllLibsByType('collector');
- $this->view->itemCounts = $this->doc->statLibCounts(array_keys($libs));
-
$this->app->rawMethod = 'collect';
}
elseif($browseType == 'openedbyme')
@@ -168,33 +101,13 @@ class doc extends control
$this->app->rawMethod = 'recent';
}
- $attachLibs = array();
- if(!empty($lib) and (!empty($lib->product) or !empty($lib->execution)) and $browseType != 'bymodule')
- {
- $count = $this->dao->select('count(*) as count')->from(TABLE_DOCLIB)->where('execution')->eq($lib->execution)->andWhere('product')->eq($lib->product)->fetch('count');
- if($count == 1 and $type and isset($lib->$type))
- {
- $objectLibs = $this->doc->getLibsByObject($type, $lib->$type);
- if(isset($objectLibs['execution'])) $attachLibs['execution'] = $objectLibs['execution'];
- if(isset($objectLibs['files'])) $attachLibs['files'] = $objectLibs['files'];
- }
- }
-
- $this->view->breadTitle = $title;
- $this->view->libID = $libID;
$this->view->moduleID = $moduleID;
- $this->view->modules = $this->doc->getDocMenu($libID, $moduleID, '`order`', $browseType);
- $this->view->docs = $this->doc->getDocsByBrowseType($libID, $browseType, $queryID, $moduleID, $sort, $pager);
- $this->view->attachLibs = $attachLibs;
+ $this->view->docs = $this->doc->getDocsByBrowseType($browseType, $queryID, $moduleID, $sort, $pager);
$this->view->users = $this->user->getPairs('noletter');
$this->view->orderBy = $orderBy;
$this->view->browseType = $browseType;
$this->view->param = $param;
- $this->view->type = $type;
- $this->view->from = $from;
$this->view->pager = $pager;
- $this->view->libs = $libs;
- $this->view->currentLib = $libID ? $lib : '';
$this->display();
}
@@ -390,20 +303,6 @@ class doc extends control
$lib = $this->doc->getLibByID($libID);
$type = $lib->type;
- /* According the from, set menus. */
- if($this->from == 'product')
- {
- $this->product->setMenu($lib->product);
-
- $this->lang->TRActions = common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib'), " " . $this->lang->doc->createlib, '', "class='btn btn-secondary iframe' data-width='70%'") : '';
- }
- elseif($this->from == 'project')
- {
- $this->project->setMenu($lib->project);
-
- $this->lang->TRActions = common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib'), " " . $this->lang->doc->createlib, '', "class='btn btn-secondary iframe' data-width='70%'") : '';
- }
-
$this->view->title = $lib->name . $this->lang->colon . $this->lang->doc->create;
$this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$libID"), $lib->name);
$this->view->position[] = $this->lang->doc->create;
@@ -411,7 +310,7 @@ class doc extends control
$unclosed = strpos($this->config->doc->custom->showLibs, 'unclosed') !== false ? 'unclosedProject' : '';
$this->view->libID = $libID;
- $this->view->libs = $this->doc->getLibs($type = 'all', $extra = "withObject,$unclosed", $libID);
+ $this->view->libs = $this->doc->getLibs($objectType, $extra = "withObject,$unclosed", $libID, $objectID);
$this->view->libName = $this->dao->findByID($libID)->from(TABLE_DOCLIB)->fetch('name');
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($libID, 'doc', $startModuleID = 0);
$this->view->moduleID = $moduleID ? (int)$moduleID : (int)$this->cookie->lastDocModule;
@@ -522,7 +421,7 @@ class doc extends control
$this->view->doc = $doc;
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($libID, 'doc', $startModuleID = 0);
$this->view->type = $type;
- $this->view->libs = $this->doc->getLibs('all', $extra = 'withObject|noBook', $libID);
+ $this->view->libs = $this->doc->getLibs('all', $extra = 'withObject|noBook', $libID, $objectID);
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->users = $this->user->getPairs('noletter|noclosed|nodeleted', $doc->users);
$this->display();
@@ -576,16 +475,6 @@ class doc extends control
$lib = $this->doc->getLibByID($doc->lib);
$type = $lib->type;
- /* According the from, set menus. */
- if($this->from == 'product')
- {
- $this->product->setMenu($lib->product);
- }
- elseif($this->from == 'project')
- {
- $this->project->setMenu($lib->project);
- }
-
$this->view->title = "DOC #$doc->id $doc->title - " . $lib->name;
$this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$doc->lib"), $lib->name);
$this->view->position[] = $this->lang->doc->view;
@@ -873,84 +762,6 @@ class doc extends control
$this->display();
}
- /**
- * Show files for product or execution.
- *
- * @param string $type
- * @param int $objectID
- * @param string $from product|project|doc
- * @param string $viewType
- * @param string $orderBy
- * @param int $recTotal
- * @param int $recPerPage
- * @param int $pageID
- * @access public
- * @return void
- */
- public function showFiles($type, $objectID, $from = 'doc', $viewType = '', $orderBy = 't1.id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
- {
- $uri = $this->app->getURI(true);
- $this->app->session->set('taskList', $uri, 'execution');
- $this->app->session->set('storyList', $uri, 'product');
- $this->app->session->set('docList', $uri, 'doc');
-
- if(empty($viewType)) $viewType = !empty($_COOKIE['docFilesViewType']) ? $this->cookie->docFilesViewType : 'card';
- setcookie('docFilesViewType', $viewType, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
-
- $table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT;
- $object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch();
-
- /* According the from, set menus. */
- if($this->from == 'product')
- {
- $this->product->setMenu($lib->product);
- }
- elseif($this->from == 'project')
- {
- $this->project->setMenu($objectID);
- }
- else
- {
- $crumb = html::a(inlink('allLibs', "type=$type"), $type == 'product' ? $this->lang->productCommon : $this->lang->executionCommon) . $this->lang->doc->separator;
- if($this->productID and $type == 'execution') $crumb = $this->doc->getProductCrumb($this->productID, $objectID);
- $crumb .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID"), $object->name);
- $crumb .= $this->lang->doc->separator . ' ' . $this->lang->doclib->files;
-
- $productID = 0;
- $executionID = 0;
- if($type == 'product')
- {
- $productID = $objectID;
- if(!$this->product->checkPriv($objectID)) $this->accessDenied();
- }
-
- if($type == 'execution')
- {
- $executionID = $objectID;
- if(!$this->execution->checkPriv($objectID)) $this->accessDenied();
- }
- }
-
- /* Load pager. */
- $this->app->loadClass('pager', $static = true);
- $pager = new pager($recTotal, $recPerPage, $pageID);
-
- $this->view->title = $object->name;
- $this->view->position[] = $object->name;
-
- $this->view->type = $type;
- $this->view->object = $object;
- $this->view->files = $this->doc->getLibFiles($type, $objectID, $orderBy, $pager);
- $this->view->users = $this->user->getPairs('noletter');
- $this->view->pager = $pager;
- $this->view->viewType = $viewType;
- $this->view->orderBy = $orderBy;
- $this->view->objectID = $objectID;
- $this->view->canBeChanged = common::canModify($type, $object); // Determines whether an object is editable.
-
- $this->display();
- }
-
/**
* Show accessDenied response.
*
diff --git a/module/doc/css/objectlibs.css b/module/doc/css/objectlibs.css
index b875b16044..743a6d66a0 100644
--- a/module/doc/css/objectlibs.css
+++ b/module/doc/css/objectlibs.css
@@ -16,7 +16,7 @@
.main-col .doc-title .actions a {margin-right: 8px;}
.main-col .doc-title .actions i {font-size: 15px; color: #8c8c8c;}
#sidebar {width: 275px;}
-#sidebar>.cell {width: 265px;}
+#sidebar>.cell {width: 100%;}
#sidebar>.sidebar-toggle {left: 3px; right: auto;}
.hide-sidebar #sidebar>.cell {left: -270px;}
.hide-sidebar #sidebar>.sidebar-toggle>.icon:before {content: "\e314";}
diff --git a/module/doc/js/browse.js b/module/doc/js/browse.js
deleted file mode 100644
index f5427fdb6b..0000000000
--- a/module/doc/js/browse.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Browse by module. */
-function browseByModule()
-{
- $('.divider').removeClass('hidden');
- $('#bymoduleTab').addClass('active');
- $('#allTab').removeClass('active');
-}
-
-function browseBySearch()
-{
- $('.divider').addClass('hidden');
- $('#bymoduleTab').removeClass('active');
- $('#allTab').addClass('active');
-}
-
-$(function()
-{
- if(browseType == 'bysearch') return;
- if(browseType == 'byediteddate' || browseType == 'openedbyme' || browseType == 'collectedbyme')
- {
- $('#pageActions ul.dropdown-menu').css('left', '0px');
- }
- $('#' + browseType + 'Tab').addClass('active');
-});
diff --git a/module/doc/model.php b/module/doc/model.php
index 3d001202a5..73904912a2 100644
--- a/module/doc/model.php
+++ b/module/doc/model.php
@@ -31,43 +31,16 @@ class docModel extends model
* @param string $type
* @param string $extra
* @param string $appendLibs
+ * @param int $projectID
* @access public
* @return array
*/
- public function getLibs($type = '', $extra = '', $appendLibs = '')
+ public function getLibs($type = '', $extra = '', $appendLibs = '', $objectID = 0)
{
- $projectID = $this->session->project;
- if($type == 'product' or $type == 'project')
+ if($type == 'all')
{
- $idList = array();
- if($type == 'product') $idList = $this->loadModel('product')->getProductIDByProject($projectID, false);
- if($type == 'execution')
- {
- $status = strpos($this->config->doc->custom->showLibs, 'unclosed') !== false ? 'undone' : 'all';
- $idList = $this->loadModel('execution')->getIdList($projectID, $status);
- }
-
- $table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT;
- $stmt = $this->dao->select('*')->from(TABLE_DOCLIB)
- ->where($type)->in($idList)
- ->andWhere('deleted')->eq('0')
- ->query();
- }
- elseif($type == 'all')
- {
- /* If extra have unclosedProject then ignore unclosed project libs. */
- $status = (strpos($extra, 'unclosedProject') !== false) ? 'undone' : 'all';
- $executionIdList = $this->loadModel('execution')->getIdList($projectID, $status);
- $productIdList = $this->loadModel('product')->getProductIDByProject($projectID, false);
-
$stmt = $this->dao->select('*')->from(TABLE_DOCLIB)
->where('deleted')->eq(0)
- ->andWhere()
- ->markLeft(1)
- ->where('`type`')->eq('custom')
- ->orWhere('execution')->in($executionIdList)
- ->orWhere('product')->in($productIdList)
- ->markRight(1)
->orderBy('id_desc')
->query();
}
@@ -79,11 +52,9 @@ class docModel extends model
->orderBy('`order`, id desc')->query();
}
- if(strpos($extra, 'withObject') !== false)
- {
- $products = $this->loadModel('product')->getProductPairsByProject($projectID);
- $executions = $this->loadModel('execution')->getPairs($projectID, 'all', 'noclosed');
- }
+ $products = $this->loadModel('product')->getPairs();
+ $projects = $this->loadModel('project')->getPairsByProgram();
+ $executions = $this->loadModel('execution')->getPairs();
$libPairs = array();
while($lib = $stmt->fetch())
@@ -93,6 +64,7 @@ class docModel extends model
if(strpos($extra, 'withObject') !== false)
{
if($lib->product != 0) $lib->name = zget($products, $lib->product, '') . '/' . $lib->name;
+ if($lib->project != 0) $lib->name = zget($projects, $lib->project, '') . '/' . $lib->name;
if($lib->execution != 0) $lib->name = zget($executions, $lib->execution, '') . '/' . $lib->name;
}
@@ -211,7 +183,6 @@ class docModel extends model
/**
* Get docs by browse type.
*
- * @param string $libID
* @param string $browseType
* @param int $queryID
* @param int $moduleID
@@ -220,10 +191,10 @@ class docModel extends model
* @access public
* @return array
*/
- public function getDocsByBrowseType($libID, $browseType, $queryID, $moduleID, $sort, $pager)
+ public function getDocsByBrowseType($browseType, $queryID, $moduleID, $sort, $pager)
{
$allLibs = array_keys($this->getLibs('all'));
- $docIdList = $this->getPrivDocs($libID, $moduleID);
+ $docIdList = $this->getPrivDocs(0, $moduleID);
$files = $this->dao->select('*')->from(TABLE_FILE)
->where('objectType')->eq('doc')
@@ -232,13 +203,12 @@ class docModel extends model
if($browseType == "all")
{
- $docs = $this->getDocs($libID, 0, $sort, $pager);
+ $docs = $this->getDocs(0, 0, $sort, $pager);
}
elseif($browseType == "openedbyme")
{
$docs = $this->dao->select('*')->from(TABLE_DOC)
->where('deleted')->eq(0)
- ->beginIF($libID)->andWhere('lib')->in($libID)->fi()
->andWhere('lib')->in($allLibs)
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
->andWhere('addedBy')->eq($this->app->user->account)
@@ -256,7 +226,6 @@ class docModel extends model
$docs = $this->dao->select('*')->from(TABLE_DOC)
->where('deleted')->eq(0)
->andWhere('id')->in(array_keys($docIDList))
- ->beginIF($libID)->andWhere('lib')->in($libID)->fi()
->andWhere('lib')->in($allLibs)
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
->orderBy($sort)
@@ -278,7 +247,6 @@ class docModel extends model
{
$docs = $this->dao->select('*')->from(TABLE_DOC)
->where('deleted')->eq(0)
- ->beginIF($libID)->andWhere('lib')->in($libID)->fi()
->andWhere('lib')->in($allLibs)
->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
->andWhere('collector')->like("%,{$this->app->user->account},%")
@@ -286,83 +254,6 @@ class docModel extends model
->page($pager)
->fetchAll('id');
}
- elseif($browseType == "bymodule")
- {
- $modules = 0;
- if($moduleID)
- {
- $modules = array($moduleID => $moduleID);
- if(strpos($this->config->doc->custom->showLibs, 'children') !== false) $modules = $this->loadModel('tree')->getAllChildId($moduleID);
- }
- $docs = $this->getDocs($libID, $modules, $sort, $pager);
- }
- elseif($browseType == "bygrid")
- {
- $docs = $this->getDocs($libID, 0, $sort, $pager);
- }
- elseif($browseType == "bysearch")
- {
- if($queryID)
- {
- $query = $this->loadModel('search')->getQuery($queryID);
- if($query)
- {
- $this->session->set('docQuery', $query->sql);
- $this->session->set('docForm', $query->form);
- }
- else
- {
- $this->session->set('docQuery', ' 1 = 1');
- }
- }
- else
- {
- if($this->session->docQuery == false) $this->session->set('docQuery', ' 1 = 1');
- }
-
- $libCond = strpos($this->session->docQuery, "`lib` = ") !== false;
- $allLibCond = strpos($this->session->docQuery, "`lib` = 'all'") !== false;
-
- $docQuery = str_replace("`product` = 'all'", '1', $this->session->docQuery); // Search all product.
- $docQuery = str_replace("`execution` = 'all'", '1', $docQuery); // Search all execution.
- $docQuery = str_replace("`lib` = 'all'", '1', $docQuery); // Search all lib.
-
- $docs = $this->dao->select('*')->from(TABLE_DOC)->where($docQuery)
- ->beginIF(!$libCond and $libID != 0)->andWhere("lib")->eq($libID)->fi()
- ->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
- ->andWhere('deleted')->eq(0)
- ->fetchAll('id');
- foreach($docs as $docID => $doc)
- {
- if(!$this->checkPrivDoc($doc)) unset($docs[$docID]);
- }
- $docs = $this->dao->select('*')->from(TABLE_DOC)
- ->where('id')->in(array_keys($docs))
- ->andWhere('lib')->in($allLibs)
- ->orderBy($sort)
- ->page($pager)
- ->fetchAll('id');
- }
- elseif($browseType == 'fastsearch')
- {
- if($this->session->searchDoc == false) return array();
- $docIdList = $this->getPrivDocs($libID, $moduleID);
- $docs = $this->dao->select('t1.*')->from(TABLE_DOC)->alias('t1')
- ->leftJoin(TABLE_DOCCONTENT)->alias('t2')->on('t2.doc = t1.id')
- ->where('t1.deleted')->eq(0)
- ->beginIF(!empty($docIdList))->andWhere('t1.id')->in($docIdList)->fi()
- ->andWhere('t1.title', true)->like("%{$this->session->searchDoc}%")
- ->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi()
- ->orWhere('t2.content')->like("%{$this->session->searchDoc}%")->markRight(1)
- ->andWhere('t1.lib')->in($allLibs)
- ->orderBy($sort)
- ->page($pager)
- ->fetchAll('id');
- foreach($docs as $doc) $doc->title = str_replace($this->session->searchDoc, "{$this->session->searchDoc}", $doc->title);
- }
-
- $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'doc', false);
- if(!$docs) return array();
$docContents = $this->dao->select('*')->from(TABLE_DOCCONTENT)->where('doc')->in(array_keys($docs))->orderBy('version,doc')->fetchAll('doc');
foreach($docs as $index => $doc)
@@ -743,7 +634,7 @@ class docModel extends model
->orderBy($orderBy)
->fetchAll('id');
- $docCounts= $this->dao->select("module, count(id) as docCount")->from(TABLE_DOC)
+ $docCounts = $this->dao->select("module, count(id) as docCount")->from(TABLE_DOC)
->where('module')->in(array_keys($modules))
->andWhere('deleted')->eq(0)
->groupBy('module')
@@ -1761,7 +1652,7 @@ class docModel extends model
$actions .= "';
diff --git a/module/doc/view/browse.html.php b/module/doc/view/browse.html.php
index 96457575b2..cd56fe5bc5 100644
--- a/module/doc/view/browse.html.php
+++ b/module/doc/view/browse.html.php
@@ -15,27 +15,14 @@
doc->confirmDelete)?>
-
-from != 'doc') js::set('type', 'doc');?>
-
-app->user->feedback) && !$this->cookie->feedbackView && $this->from == 'doc') ? true : false;?>
-
+
-
-
-
-
doc->noSearchedDoc;?>
-
-
+
-
doc->noDoc;?>
-
- createLink('doc', 'create', "libID={$libID}&moduleID=$moduleID&type=&from={$lang->navGroup->doc}"), " " . $lang->doc->create, '', "class='btn btn-info'");?>
-
-
+
doc->noEditedDoc;?>
doc->noOpenedDoc;?>
@@ -58,60 +45,6 @@
-
-
- collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
- collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
-
- | id}&browseType=all¶m=0&orderBy=$orderBy&from=$from"), " " . $lib->name);?> |
- |
- |
- |
- |
-
-
- id&objectType=doclib");?>" title="" class='btn btn-link ajaxCollect'>
-
- id", "", '', "title='{$lang->edit}' class='btn btn-link iframe'")?>
- id&viewType=doc¤tModuleID=0&branch=0&from=$from", "", '', "title='{$lang->tree->manage}' class='btn btn-link'")?>
- |
-
-
-
-
- $attachLib):?>
-
-
- | product}"), " " . $attachLib->name);?> |
-
- $type}&from=$from"), " " . $attachLib->name);?> |
-
- |
- |
- |
- |
- |
-
-
-
-
-
- collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
- collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
-
- | id&orderBy=$orderBy&from=$from"), " " . $module->name);?> |
- |
- |
- |
- |
-
-
- id&objectType=module");?>" title="" class='btn btn-link ajaxCollect'>
-
- |
-
-
-
collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
@@ -126,8 +59,8 @@
id&objectType=doc");?>" title="" class='btn btn-link ajaxCollect'>
- id&comment=false&from={$lang->navGroup->doc}", "", '', "title='{$lang->edit}' class='btn btn-link iframe'", true, true)?>
- id&confirm=no&from={$lang->navGroup->doc}", "", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
+ id&comment=false&from=$app->openApp", "", '', "title='{$lang->edit}' class='btn btn-link iframe'", true, true)?>
+ id&confirm=no&from=$app->openApp", "", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
diff --git a/module/doc/view/content.html.php b/module/doc/view/content.html.php
index 4838d2e7ec..a4ac5c600a 100644
--- a/module/doc/view/content.html.php
+++ b/module/doc/view/content.html.php
@@ -38,8 +38,10 @@ $sessionString .= session_name() . '=' . session_id();
echo html::a("javascript:ajaxDeleteDoc(\"$deleteURL\", \"docList\", confirmDelete)", '', '', "title='{$lang->doc->delete}' class='btn btn-link'");
}
?>
+
collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
id&objectType=doc");?>" title="doc->collect;?>" class='ajaxCollect btn btn-link'>
+
diff --git a/module/doc/view/index.html.php b/module/doc/view/index.html.php
index 47555a9600..6931047237 100644
--- a/module/doc/view/index.html.php
+++ b/module/doc/view/index.html.php
@@ -21,7 +21,7 @@
doc->orderByEdit;?>
@@ -127,7 +127,7 @@
doc->myDoc;?>
@@ -159,7 +159,7 @@
doc->myCollection;?>
diff --git a/module/doc/view/showfiles.html.php b/module/doc/view/showfiles.html.php
deleted file mode 100644
index 6b2f91053e..0000000000
--- a/module/doc/view/showfiles.html.php
+++ /dev/null
@@ -1,209 +0,0 @@
-
- * @package doc
- * @version $Id$
- * @link http://www.zentao.net
- */
-?>
-doc->appendNavCSS();?>
-
-
- from == 'doc'):?>
-
-
-
-
-
-
-
doclib->files;?>
-
-
-
-
-
-
-
-
- | doc->id;?> |
- doc->fileTitle;?> |
- doc->filePath;?> |
- doc->extension;?> |
- doc->size;?> |
- doc->addedBy;?> |
- doc->addedDate;?> |
- actions;?> |
-
-
-
-
- pathname)) continue;?>
-
- | id);?> |
-
- objectType, array('task', 'build')))
- {
- $objectLink = $this->createLink($file->objectType, 'view', "objectID=$file->objectID", '', '', $file->project);
- }
- if($type == 'product' && in_array($file->objectType, array('bug', 'release', 'testcase', 'testreport')))
- {
- $objectLink = $this->createLink($file->objectType, 'view', "objectID=$file->objectID", '', '', $file->project);
- }
- else
- {
- $objectLink = $this->createLink($file->objectType, 'view', "objectID=$file->objectID");
- }
- ?>
- title . ' [' . strtoupper($file->objectType) . ' #' . $file->objectID . ']';?>
- |
- pathname;?> |
- extension;?> |
- size / 1024 , 1) . 'K';?> |
- addedBy) ? zget($users, $file->addedBy) : '';?> |
- addedDate) ? substr($file->addedDate, 0, 10) : '';?> |
-
- id", '', "data-toggle='modal'", "class='btn' title={$lang->doc->download}", true, false, $file);
- if($canBeChanged) common::printLink('file', 'delete', "fileID=$file->id", '', 'hiddenwin', "class='btn' title={$lang->delete}", true, false, $file);
- ?>
- |
-
-
-
-
-
-
-
-
-
-
- pathname)) continue;?>
-
-
- extension) !== false and file_exists($file->realPath))
- {
- $imageSize = getimagesize($file->realPath);
- $imageWidth = $imageSize ? $imageSize[0] : 0;
- }
-
- $sessionString = $config->requestType == 'PATH_INFO' ? '?' : '&';
- $sessionString .= session_name() . '=' . session_id();
- $fileID = $file->id;
- $url = helper::createLink('file', 'download', 'fileID=' . $fileID) . $sessionString ;
- ?>
-
-
- createLink('file', 'download', "fileID=$file->id&mouse=left");
- if(in_array($file->extension, $config->file->imageExtensions))
- {
- echo "";
- }
- else
- {
- $iconClass = 'icon-file';
- if(strpos('zip,tar,gz,bz2,rar', $file->extension) !== false) $iconClass = 'icon-file-archive';
- else if(strpos('csv,xls,xlsx', $file->extension) !== false) $iconClass = 'icon-file-excel';
- else if(strpos('doc,docx', $file->extension) !== false) $iconClass = 'icon-file-word';
- else if(strpos('ppt,pptx', $file->extension) !== false) $iconClass = 'icon-file-powerpoint';
- else if(strpos('pdf', $file->extension) !== false) $iconClass = 'icon-file-pdf';
- else if(strpos('mp3,ogg,wav', $file->extension) !== false) $iconClass = 'icon-file-audio';
- else if(strpos('avi,mp4,mov', $file->extension) !== false) $iconClass = 'icon-file-video';
- else if(strpos('txt,md', $file->extension) !== false) $iconClass = 'icon-file-text';
- else if(strpos('html,htm', $file->extension) !== false) $iconClass = 'icon-globe';
- echo "";
- }
- ?>
-
- objectType, array('task', 'build')))
- {
- $objectLink = $this->createLink($file->objectType, 'view', "objectID=$file->objectID", '', '', $file->project);
- }
- else
- {
- $objectLink = $this->createLink($file->objectType, 'view', "objectID=$file->objectID");
- }
- ?>
-
-
-
-
-
-
-
-
-
-
-
pager->noRecord;?>
-
-
-
-
-
-
-
-
-
-
-
diff --git a/module/doc/view/view.html.php b/module/doc/view/view.html.php
index c3079d99d4..5e90c655d4 100644
--- a/module/doc/view/view.html.php
+++ b/module/doc/view/view.html.php
@@ -15,7 +15,7 @@
-session->docList ? $this->session->docList : inlink('browse', 'libID=0&browseTyp=byediteddate');?>
+session->docList ? $this->session->docList : inlink('browse', 'libID=0&browseType=byediteddate');?>
requestType == 'PATH_INFO' ? '?' : '&';
$sessionString .= session_name() . '=' . session_id();
diff --git a/module/execution/control.php b/module/execution/control.php
index 65674748d6..3a08565bd6 100644
--- a/module/execution/control.php
+++ b/module/execution/control.php
@@ -1216,7 +1216,8 @@ class execution extends control
$this->app->loadLang('programplan');
if($executionID)
{
- if(!empty($planID))
+ $execution = $this->execution->getById($executionID);
+ if(!empty($planID) and $execution->lifetime != 'ops')
{
if($confirm == 'yes')
{
@@ -1224,7 +1225,7 @@ class execution extends control
}
else
{
- die(js::confirm($this->lang->execution->importPlanStory, inlink('create', "projectID=$projectID&executionID=$executionID©ExecutionID=&planID=$planID&confirm=yes"), inlink('create', "projectID=$projectID&executionID=$executionID"), 'parent', 'parent'));
+ die(js::confirm($this->lang->execution->importPlanStory, inlink('create', "projectID=$projectID&executionID=$executionID©ExecutionID=&planID=$planID&confirm=yes"), inlink('create', "projectID=$projectID&executionID=$executionID")));
}
}
$this->view->title = $this->lang->execution->tips;
diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php
index b3c8667bf8..d916e1db2c 100644
--- a/module/execution/lang/en.php
+++ b/module/execution/lang/en.php
@@ -194,7 +194,6 @@ $lang->execution->copy = "Copy {$lang->executionCommon}";
$lang->execution->delete = "Delete {$lang->executionCommon}";
$lang->execution->deleteAB = "Delete Execution";
$lang->execution->browse = "{$lang->executionCommon} List";
-$lang->execution->list = "{$lang->executionCommon} List";
$lang->execution->edit = "Edit {$lang->executionCommon}";
$lang->execution->editAction = "Edit Execution";
$lang->execution->batchEdit = "Edit";
diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php
index cb14d2da43..c8f672cb9c 100644
--- a/module/execution/lang/zh-cn.php
+++ b/module/execution/lang/zh-cn.php
@@ -194,7 +194,6 @@ $lang->execution->copy = "复制{$lang->executionCommon}";
$lang->execution->delete = "删除{$lang->executionCommon}";
$lang->execution->deleteAB = "删除{$lang->execution->common}";
$lang->execution->browse = "浏览{$lang->execution->common}";
-$lang->execution->list = "{$lang->executionCommon}列表";
$lang->execution->edit = "编辑{$lang->executionCommon}";
$lang->execution->editAction = "编辑{$lang->execution->common}";
$lang->execution->batchEdit = "编辑";
diff --git a/module/execution/model.php b/module/execution/model.php
index 2a6c1b79de..e4ec11c128 100644
--- a/module/execution/model.php
+++ b/module/execution/model.php
@@ -69,16 +69,12 @@ class executionModel extends model
/* Unset story, bug, build and testtask if type is ops. */
$execution = $this->getByID($executionID);
- /*
if($execution and $execution->lifetime == 'ops')
{
unset($this->lang->execution->menu->story);
unset($this->lang->execution->menu->qa);
- unset($this->lang->execution->subMenu->qa->bug);
- unset($this->lang->execution->subMenu->qa->build);
- unset($this->lang->execution->subMenu->qa->testtask);
+ unset($this->lang->execution->menu->build);
}
- */
/* Hide story and qa menu when execution is story or design type. */
/*
@@ -1482,7 +1478,8 @@ class executionModel extends model
->leftJoin(TABLE_PRODUCT)->alias('t2')
->on('t1.product = t2.id')
->where('t1.project')->eq((int)$executionID)
- ->andWhere('t2.deleted')->eq(0);
+ ->andWhere('t2.deleted')->eq(0)
+ ->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->products)->fi();
if(!$withBranch) return $query->fetchPairs('id', 'name');
return $query->fetchAll('id');
}
@@ -2058,12 +2055,13 @@ class executionModel extends model
$planStories = array();
$planProducts = array();
$count = 0;
+ $this->loadModel('story');
if(!empty($plans))
{
foreach($plans as $planID => $productID)
{
if(empty($planID)) continue;
- $planStory = $this->loadModel('story')->getPlanStories($planID);
+ $planStory = $this->story->getPlanStories($planID);
if(!empty($planStory))
{
foreach($planStory as $id => $story)
@@ -2080,9 +2078,11 @@ class executionModel extends model
}
}
}
+
+ $projectID = $this->session->project;
$this->linkStory($executionID, $planStories, $planProducts);
- $this->linkStory($this->session->project, $planStories, $planProducts);
- if($count != 0) echo js::alert(sprintf($this->lang->execution->haveDraft, $count)) . js::locate(helper::createLink('execution', 'create', "productID=&executionID=$executionID"));
+ $this->linkStory($projectID, $planStories, $planProducts);
+ if($count != 0) echo js::alert(sprintf($this->lang->execution->haveDraft, $count)) . js::locate(helper::createLink('execution', 'create', "projectID=$projectID&executionID=$executionID"));
}
/**
diff --git a/module/execution/view/create.html.php b/module/execution/view/create.html.php
index 3488b3a143..8ce5187e40 100644
--- a/module/execution/view/create.html.php
+++ b/module/execution/view/create.html.php
@@ -12,7 +12,7 @@
?>
systemMode == 'new' ? $this->createLink('project', 'execution', "status=all&projectID=$projectID") : $this->createLink('execution', 'task', 'executionID=' . $executionID);?>
-
+