This commit is contained in:
Catouse
2018-07-09 14:09:06 +08:00
18 changed files with 1268 additions and 1452 deletions
+1
View File
@@ -81,6 +81,7 @@ rpm:
en:
unzip ZenTaoPMS.${VERSION}.zip
cd zentaopms/; grep -rl 'zentao.net'|xargs sed -i 's/zentao.net/zentao.pm/g';
cd zentaopms/; grep -rl 'http://www.zentao.pm'|xargs sed -i 's/http:\/\/www.zentao.pm/https:\/\/www.zentao.pm/g';
zip -r -9 ZenTaoPMS.$(VERSION).int.zip zentaopms
rm -fr zentaopms
echo $(VERSION).int > VERSION
+1137 -1101
View File
File diff suppressed because it is too large Load Diff
-8
View File
@@ -1111,14 +1111,6 @@ class bug extends control
*/
public function linkBugs($bugID, $browseType = '', $param = 0)
{
/* Link bugs. */
if(!empty($_POST))
{
$this->bug->linkBugs($bugID);
if(isonlybody()) die(js::closeModal('parent.parent', '', "function(){parent.parent.loadLinkBugs('$bugID')}"));
die(js::locate($this->createLink('bug', 'edit', "bugID=$bugID"), 'parent'));
}
/* Get bug and queryID. */
$bug = $this->bug->getById($bugID);
$queryID = ($browseType == 'bySearch') ? (int)$param : 0;
-30
View File
@@ -54,33 +54,3 @@ function loadModuleRelated()
productID = $('#product').val();
setStories(moduleID, productID);
}
/**
* Unlink related bug.
*
* @param int $bugID
* @param int $bug2Unlink
* @access public
* @return void
*/
function unlinkBug(bugID, bug2Unlink)
{
link = createLink('bug', 'unlinkBug', 'bugID=' + bugID + '&bug2Unlink=' + bug2Unlink);
$.get(link, function(data)
{
if(data == 'success') $('#linkBugBox').load(createLink('bug', 'ajaxGetLinkBugs', 'bugID=' + bugID));
});
}
/**
* Load linkBugs.
*
* @param int $bugID
* @access public
* @return void
*/
function loadLinkBugs(bugID)
{
bugLink = createLink('bug', 'ajaxGetLinkBugs', 'bugID=' + bugID);
$('#linkBugBox').load(bugLink);
}
+1 -57
View File
@@ -618,6 +618,7 @@ class bugModel extends model
->add('lastEditedDate', $now)
->join('openedBuild', ',')
->join('mailto', ',')
->join('linkBug', ',')
->setIF($this->post->assignedTo != $oldBug->assignedTo, 'assignedDate', $now)
->setIF($this->post->resolvedBy != '' and $this->post->resolvedDate == '', 'resolvedDate', $now)
->setIF($this->post->resolution != '' and $this->post->resolvedDate == '', 'resolvedDate', $now)
@@ -1159,26 +1160,6 @@ class bugModel extends model
$this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec();
}
/**
* Link related bugs.
*
* @param int $bugID
* @access public
* @return void
*/
public function linkBugs($bugID)
{
if($this->post->bugs == false) return;
$bug = $this->getById($bugID);
$bugs2Link = $this->post->bugs;
$bugs = implode(',', $bugs2Link) . ',' . trim($bug->linkBug, ',');
$this->dao->update(TABLE_BUG)->set('linkBug')->eq(trim($bugs, ','))->where('id')->eq($bugID)->exec();
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action')->create('bug', $bugID, 'linkRelatedBug', '', implode(',', $bugs2Link));
}
/**
* Get bugs to link.
*
@@ -1207,43 +1188,6 @@ class bugModel extends model
}
}
/**
* Unlink related bug.
*
* @param int $bugID
* @param int $bug2Unlink
* @access public
* @return void
*/
public function unlinkBug($bugID, $bug2Unlink = 0)
{
$bug = $this->getById($bugID);
$bugs = explode(',', trim($bug->linkBug, ','));
foreach($bugs as $key => $bugId)
{
if($bugId == $bug2Unlink) unset($bugs[$key]);
}
$bugs = implode(',', $bugs);
$this->dao->update(TABLE_BUG)->set('linkBug')->eq($bugs)->where('id')->eq($bugID)->exec();
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action')->create('bug', $bugID, 'unlinkRelatedBug', '', $bug2Unlink);
}
/**
* Get linkBugs.
*
* @param int $bugID
* @access public
* @return array
*/
public function getLinkBugs($bugID)
{
$bug = $this->getById($bugID);
return $this->dao->select('id, title')->from(TABLE_BUG)->where('id')->in($bug->linkBug)->fetchPairs();
}
/**
* Build search form.
*
+14 -13
View File
@@ -272,19 +272,20 @@ js::set('oldResolvedBuild' , $bug->resolvedBuild);
<tr>
<th></th>
<td>
<ul class='list-unstyled' id='linkBugBox'>
<?php
if(isset($bug->linkBugTitles))
{
foreach($bug->linkBugTitles as $linkBugID => $linkBugTitle)
{
echo '<li>';
echo html::a(inlink('view', "bugID=$linkBugID"), "#$linkBugID " . $linkBugTitle, '_blank');
echo html::a("javascript:unlinkBug($bug->id, $linkBugID)", '<i class="icon-remove"></i>', '', "title='{$lang->unlink}' style='float:right'");
echo '</li>';
}
}
?>
<ul class='list-unstyled'>
<?php
if(isset($bug->linkBugTitles))
{
foreach($bug->linkBugTitles as $linkBugID => $linkBugTitle)
{
echo "<li><div class='checkbox-primary'>";
echo "<input type='checkbox' checked='checked' name='linkBug[]' value=$linkBugID />";
echo "<label>#{$linkBugID} {$linkBugTitle}</label>";
echo '</div></li>';
}
}
?>
<span id='linkBugsBox'></span>
</ul>
</td>
</tr>
+27 -4
View File
@@ -11,7 +11,7 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id='mainContent' class='space'>
<div id='mainContent' class='main-content'>
<div class='main-header'>
<h2>
<span class='label label-id'><?php echo $bug->id;?></span>
@@ -19,11 +19,11 @@
<small class='text-muted'> <?php echo $lang->arrow . $lang->bug->linkBugs;?></small>
</h2>
</div>
<div id='queryBox' class='show'></div>
<div id='queryBox' class='show divider'></div>
<?php if($bugs2Link):?>
<form class='main-table' method='post' data-ride='table' target='hiddenwin' id='linkBugsForm'>
<table class='table' id='bugList'>
<thead class='hl-gray'>
<thead>
<tr>
<th class="c-id">
<div class="checkbox-primary check-all" title="<?php echo $lang->selectAll?>">
@@ -64,10 +64,33 @@
</table>
<div class='table-footer'>
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<div class="table-actions btn-toolbar"><?php echo html::submitButton();?></div>
<div class="table-actions btn-toolbar"><?php if($bugCount) echo html::submitButton('', '', 'btn btn-default');?></div>
<?php echo html::hidden('bug', $bug->id);?>
</div>
</form>
<?php endif;?>
</div>
<script>
$(function()
{
<?php if($bugs2Link):?>
$('#linkBugsForm').table();
setTimeout(function(){$('#linkBugsForm .table-footer').removeClass('fixed-footer');}, 100);
<?php endif;?>
$('#submit').click(function(){
var output = '';
$('#linkBugsForm').find('tr.checked').each(function(){
var bugID = $(this).find('td.c-id').find('div.checkbox-primary input').attr('value');
var bugTitle = "#" + bugID + ' ' + $(this).find('td').eq(3).attr('title');
var checkbox = "<li><div class='checkbox-primary'><input type='checkbox' checked='checked' name='linkBug[]' " + "value=" + bugID + " /><label>" + bugTitle + "</label></div></li>";
output += checkbox;
});
$.closeModal();
parent.$('#linkBugsBox').html(output);
return false;
});
});
</script>
<?php include '../../common/view/footer.html.php';?>
+1
View File
@@ -1590,6 +1590,7 @@ EOD;
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_ENCODING, "");
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_HEADER, FALSE);
$headers[] = "API-RemoteIP: " . $_SERVER['REMOTE_ADDR'];
-26
View File
@@ -1156,32 +1156,6 @@ class story extends control
$this->display();
}
/**
* AJAX: if type is linkStories, get related stories else get child stories.
*
* @param int $storyID
* @param string $type
* @access public
* @return string
*/
public function ajaxGetLinkedStories($storyID, $type = '')
{
/* Get linked stories. */
$stories = $this->story->getLinkedStories($storyID, $type);
/* Build linked stories list. */
$output = '';
foreach($stories as $storyId => $storyTitle)
{
$output .= '<li>';
$output .= html::a(inlink('view', "storyID=$storyId"), "#$storyId " . $storyTitle, '_blank');
$output .= html::a("javascript:unlinkStory($storyID, \"$type\", $storyId)", '<i class="icon-remove"></i>', '', "title='{$this->lang->unlink}' style='float:right'");
$output .= '</li>';
}
die($output);
}
/**
* AJAX: get stories of a project in html select.
*
-14
View File
@@ -1270,20 +1270,6 @@ class storyModel extends model
}
}
/**
* Get linked stories.
*
* @param string $storyID
* @param string $type
* @access public
* @return array
*/
public function getLinkedStories($storyID, $type = 'linkStories')
{
$story = $this->getById($storyID);
return $this->dao->select('id, title')->from(TABLE_STORY)->where('id')->in($story->$type)->fetchPairs();
}
/**
* Get stories list of a product.
*
+36 -36
View File
@@ -49,8 +49,6 @@
<?php echo html::textarea('comment', '', "rows='5' class='form-control'");?>
</div>
</div>
<div id='linkStoriesBOX'><?php echo html::hidden('linkStories', $story->linkStories);?></div>
<div id='childStoriesBOX'><?php echo html::hidden('childStories', $story->childStories);?></div>
<div class='actions form-actions text-center'>
<?php
echo html::hidden('lastEditedDate', $story->lastEditedDate);
@@ -200,23 +198,24 @@
<tr>
<th></th>
<td>
<ul class='list-unstyled' id='linkStoriesBox'>
<?php
if($story->linkStories)
{
$linkStories = explode(',', $story->linkStories);
foreach($linkStories as $linkStoryID)
{
if(isset($story->extraStories[$linkStoryID]))
{
echo "<li><div class='checkbox-primary'>";
echo "<input type='checkbox' checked='checked' name='linkStories[]' value=$linkStoryID />";
echo "<label>#{$linkStoryID} {$story->extraStories[$linkStoryID]}</label>";
echo '</div></li>';
}
}
}
?>
<ul class='list-unstyled'>
<?php
if($story->linkStories)
{
$linkStories = explode(',', $story->linkStories);
foreach($linkStories as $linkStoryID)
{
if(isset($story->extraStories[$linkStoryID]))
{
echo "<li><div class='checkbox-primary'>";
echo "<input type='checkbox' checked='checked' name='linkStories[]' value=$linkStoryID />";
echo "<label>#{$linkStoryID} {$story->extraStories[$linkStoryID]}</label>";
echo '</div></li>';
}
}
}
?>
<span id='linkStoriesBox'></span>
</ul>
</td>
</tr>
@@ -230,23 +229,24 @@
<tr>
<th></th>
<td>
<ul class='list-unstyled' id='childStoriesBox'>
<?php
if($story->childStories)
{
$childStories = explode(',', $story->childStories);
foreach($childStories as $childStoryID)
{
if(isset($story->extraStories[$childStoryID]))
{
echo "<li><div class='checkbox-primary'>";
echo "<input type='checkbox' checked='checked' name='childStories[]' value=$childStoryID />";
echo "<label>#{$childStoryID} {$story->extraStories[$childStoryID]}</label>";
echo '</div></li>';
}
}
}
?>
<ul class='list-unstyled'>
<?php
if($story->childStories)
{
$childStories = explode(',', $story->childStories);
foreach($childStories as $childStoryID)
{
if(isset($story->extraStories[$childStoryID]))
{
echo "<li><div class='checkbox-primary'>";
echo "<input type='checkbox' checked='checked' name='childStories[]' value=$childStoryID />";
echo "<label>#{$childStoryID} {$story->extraStories[$childStoryID]}</label>";
echo '</div></li>';
}
}
}
?>
<span id='childStoriesBox'></span>
</ul>
</td>
</tr>
+1 -1
View File
@@ -93,7 +93,7 @@ $(function()
output += checkbox;
});
$.closeModal();
parent.$('#' + linkType + 'Box').append(output);
parent.$('#' + linkType + 'Box').html(output);
return false;
});
});
-49
View File
@@ -931,14 +931,6 @@ class testcase extends control
*/
public function linkCases($caseID, $browseType = '', $param = 0)
{
/* Link cases. */
if(!empty($_POST))
{
$this->testcase->linkCases($caseID);
if(isonlybody()) die(js::closeModal('parent.parent', '', "function(){parent.parent.loadLinkCases('$caseID')}"));
die(js::locate($this->createLink('testcase', 'edit', "caseID=$caseID"), 'parent'));
}
/* Get case and queryID. */
$case = $this->testcase->getById($caseID);
$queryID = ($browseType == 'bySearch') ? (int)$param : 0;
@@ -965,47 +957,6 @@ class testcase extends control
$this->display();
}
/**
* AJAX: get linkCases.
*
* @param int $caseID
* @access public
* @return string
*/
public function ajaxGetLinkCases($caseID)
{
/* Get linkCases. */
$cases = $this->testcase->getLinkCases($caseID);
/* Build linkCase list. */
$output = '';
foreach($cases as $caseId => $caseTitle)
{
$output .= '<li>';
$output .= html::a(inlink('view', "caseID=$caseId"), "#$caseId " . $caseTitle, '_blank');
$output .= html::a("javascript:unlinkCase($caseID, $caseId)", '<i class="icon-remove"></i>', '', "title='{$this->lang->unlink}' style='float:right'");
$output .= '</li>';
}
die($output);
}
/**
* Unlink related case.
*
* @param int $caseID
* @param int $case2Unlink
* @access public
* @return string
*/
public function unlinkCase($caseID, $case2Unlink = 0)
{
/* Unlink related case. */
$this->testcase->unlinkCase($caseID, $case2Unlink);
die('success');
}
/**
* Confirm testcase changed.
*
-1
View File
@@ -2,4 +2,3 @@
.col-side .chosen-container {width: 218px!important}
.table-form > tbody > tr > td .btn.addbutton {display:block; margin:1px 0px; width:40px; padding:1px 6px;}
.table-form > tbody > tr > td .btn.delbutton {display:block; margin:1px 0px; width:40px; padding:1px 6px;}
#linkCaseBox li {margin-left:-56px}
-31
View File
@@ -20,37 +20,6 @@ $(document).ready(function()
initSteps();
});
/**
* Unlink related case.
*
* @param int $caseID
* @param int $case2Unlink
* @access public
* @return void
*/
function unlinkCase(caseID, case2Unlink)
{
link = createLink('testcase', 'unlinkCase', 'caseID=' + caseID + '&case2Unlink=' + case2Unlink);
$.get(link, function(data)
{
if(data == 'success') $('#linkCaseBox').load(createLink('testcase', 'ajaxGetLinkCases', 'caseID=' + caseID));
});
}
/**
* Load linkCases.
*
* @param int $caseID
* @access public
* @return void
*/
function loadLinkCases(caseID)
{
caseLink = createLink('testcase', 'ajaxGetLinkCases', 'caseID=' + caseID);
$('#linkCaseBox').load(caseLink);
}
/**
* Load lib modules.
*
+1 -57
View File
@@ -651,6 +651,7 @@ class testcaseModel extends model
->setIF($this->post->story != false and $this->post->story != $oldCase->story, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
->setDefault('story,branch', 0)
->join('stage', ',')
->join('linkCase', ',')
->remove('comment,steps,expects,files,labels,stepType')
->get();
if(!$this->forceNotReview() and $stepChanged) $case->status = 'wait';
@@ -749,26 +750,6 @@ class testcaseModel extends model
return $actions;
}
/**
* Link related cases.
*
* @param int $caseID
* @access public
* @return void
*/
public function linkCases($caseID)
{
if($this->post->cases == false) return;
$case = $this->getById($caseID);
$cases2Link = $this->post->cases;
$cases = implode(',', $cases2Link) . ',' . trim($case->linkCase, ',');
$this->dao->update(TABLE_CASE)->set('linkCase')->eq(trim($cases, ','))->where('id')->eq($caseID)->exec();
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action')->create('case', $caseID, 'linkRelatedCase', '', implode(',', $cases2Link));
}
/**
* Get cases to link.
*
@@ -797,43 +778,6 @@ class testcaseModel extends model
}
}
/**
* Unlink related case.
*
* @param int $caseID
* @param int $case2Unlink
* @access public
* @return void
*/
public function unlinkCase($caseID, $case2Unlink = 0)
{
$case = $this->getById($caseID);
$cases = explode(',', trim($case->linkCase, ','));
foreach($cases as $key => $caseId)
{
if($caseId == $case2Unlink) unset($cases[$key]);
}
$cases = implode(',', $cases);
$this->dao->update(TABLE_CASE)->set('linkCase')->eq($cases)->where('id')->eq($caseID)->exec();
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action')->create('case', $caseID, 'unlinkRelatedCase', '', $case2Unlink);
}
/**
* Get linkCases.
*
* @param int $caseID
* @access public
* @return array
*/
public function getLinkCases($caseID)
{
$case = $this->getById($caseID);
return $this->dao->select('id, title')->from(TABLE_CASE)->where('id')->in($case->linkCase)->fetchPairs();
}
/**
* Batch update testcases.
*
+14 -13
View File
@@ -225,19 +225,20 @@
<tr>
<th></th>
<td>
<ul class='list-unstyled' id='linkCaseBox'>
<?php
if(isset($case->linkCaseTitles))
{
foreach($case->linkCaseTitles as $linkCaseID => $linkCaseTitle)
{
echo '<li>';
echo html::a(inlink('view', "caseID=$linkCaseID"), "#$linkCaseID " . $linkCaseTitle, '_blank');
echo html::a("javascript:unlinkCase($case->id, $linkCaseID)", '<i class="icon-trash"></i>', '', "title='{$lang->unlink}' style='float:right'");
echo '</li>';
}
}
?>
<ul class='list-unstyled'>
<?php
if(isset($case->linkCaseTitles))
{
foreach($case->linkCaseTitles as $linkCaseID => $linkCaseTitle)
{
echo "<li><div class='checkbox-primary'>";
echo "<input type='checkbox' checked='checked' name='linkCase[]' value=$linkCaseID />";
echo "<label>#{$linkCaseID} {$linkCaseTitle}</label>";
echo '</div></li>';
}
}
?>
<span id='linkCaseBox'></span>
</ul>
</td>
</tr>
+35 -11
View File
@@ -11,16 +11,15 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id="mainMenu" class="clearfix">
<div class='btn-toolbar pull-left'>
<div class="page-title">
<span class="label label-id"><?php echo $case->id;?></span>
<?php echo html::a($this->createLink('case', 'view', 'caseID=' . $case->id), $case->title, '_blank', "class='text' title='{$case->title}'");?> <span class='text-muted'><i class="icon-angle-right"></i> <span><?php echo $lang->testcase->linkCases;?></span></span>
</div>
<div id="mainContent" class="main-content">
<div class='main-header'>
<h2>
<span class='label label-id'><?php echo $case->id;?></span>
<?php echo html::a($this->createLink('case', 'view', "caseID={$case->id}"), $case->title, '_blank');?>
<small class='text-muted'> <?php echo $lang->arrow . $lang->testcase->linkCases;?></small>
</h2>
</div>
</div>
<div id='queryBox' class='cell show'></div>
<div id='mainContent'>
<div id='queryBox' class='show divider'></div>
<?php if($cases2Link):?>
<form class='main-table' method='post' target='hiddenwin' id='linkCasesForm' data-ride='table'>
<table class='table' id='caseList'>
@@ -33,6 +32,7 @@
<?php echo $lang->idAB;?>
</th>
<th class='w-pri'><?php echo $lang->priAB;?></th>
<th><?php echo $lang->testcase->product;?></th>
<th><?php echo $lang->testcase->title;?></th>
<th class='w-type'><?php echo $lang->testcase->type;?></th>
<th class='w-user'><?php echo $lang->openedByAB;?></th>
@@ -51,7 +51,8 @@
<?php printf('%03d', $case2Link->id);?>
</td>
<td><span class='<?php echo 'pri' . zget($lang->testcase->priList, $case2Link->pri, $case2Link->pri)?>'><?php echo zget($lang->testcase->priList, $case2Link->pri, $case2Link->pri)?></span></td>
<td class='text-left'><?php echo html::a($this->createLink('testcase', 'view', "caseID=$case2Link->id"), $case2Link->title, '_blank');?></td>
<td><?php echo html::a($this->createLink('product', 'browse', "productID={$case2Link->product}&branch={$case2Link->branch}"), $products[$case2Link->product], '_blank');?></td>
<td class='text-left' title='<?php echo $case2Link->title;?>'><?php echo html::a($this->createLink('testcase', 'view', "caseID=$case2Link->id"), $case2Link->title, '_blank');?></td>
<td><?php echo $lang->testcase->typeList[$case2Link->type];?></td>
<td><?php echo $users[$case2Link->openedBy];?></td>
<td class='case-<?php echo $case2Link->status?>'><?php echo $lang->testcase->statusList[$case2Link->status];?></td>
@@ -62,10 +63,33 @@
</table>
<div class='table-footer'>
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<div class='table-actions btn-toolbar show-always'><?php echo html::submitButton('', '', 'btn btn-secondary');?></div>
<div class="table-actions btn-toolbar"><?php if($caseCount) echo html::submitButton('', '', 'btn btn-default');?></div>
<?php echo html::hidden('case', $case->id);?>
</div>
</form>
<?php endif;?>
</div>
<script>
$(function()
{
<?php if($cases2Link):?>
$('#linkCasesForm').table();
setTimeout(function(){$('#linkCasesForm .table-footer').removeClass('fixed-footer');}, 100);
<?php endif;?>
$('#submit').click(function(){
var output = '';
$('#linkCasesForm').find('tr.checked').each(function(){
var caseID = $(this).find('td.c-id').find('div.checkbox-primary input').attr('value');
var caseTitle = "#" + caseID + ' ' + $(this).find('td').eq(3).attr('title');
var checkbox = "<li><div class='checkbox-primary'><input type='checkbox' checked='checked' name='linkCase[]' " + "value=" + caseID + " /><label>" + caseTitle + "</label></div></li>";
output += checkbox;
});
$.closeModal();
parent.$('#linkCaseBox').html(output);
return false;
});
});
</script>
<?php include '../../common/view/footer.html.php';?>