* Finish task #8497.
This commit is contained in:
@@ -228,6 +228,51 @@ class projectrelease extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a release.
|
||||
*
|
||||
* @param int $releaseID
|
||||
* @param string $confirm yes|no
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function delete($releaseID, $confirm = 'no')
|
||||
{
|
||||
if($confirm == 'no')
|
||||
{
|
||||
die(js::confirm($this->lang->release->confirmDelete, $this->createLink('projectrelease', 'delete', "releaseID=$releaseID&confirm=yes")));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->release->delete(TABLE_RELEASE, $releaseID);
|
||||
|
||||
$release = $this->dao->select('*')->from(TABLE_RELEASE)->where('id')->eq((int)$releaseID)->fetch();
|
||||
$build = $this->dao->select('*')->from(TABLE_BUILD)->where('id')->eq((int)$release->build)->fetch();
|
||||
if(empty($build->project)) $this->loadModel('build')->delete(TABLE_BUILD, $build->id);
|
||||
|
||||
$this->executeHooks($releaseID);
|
||||
|
||||
/* if ajax request, send result. */
|
||||
if($this->server->ajax)
|
||||
{
|
||||
if(dao::isError())
|
||||
{
|
||||
$response['result'] = 'fail';
|
||||
$response['message'] = dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$response['result'] = 'success';
|
||||
$response['message'] = '';
|
||||
$release = $this->release->getById($releaseID);
|
||||
$this->dao->update(TABLE_BUILD)->set('deleted')->eq(1)->where('id')->eq($release->build)->andWhere('name')->eq($release->name)->exec();
|
||||
}
|
||||
$this->send($response);
|
||||
}
|
||||
die(js::locate($this->session->releaseList, 'parent'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the stories of release to HTML.
|
||||
*
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<div class="table-empty-tip">
|
||||
<p>
|
||||
<span class="text-muted"><?php echo $lang->release->noRelease;?></span>
|
||||
<?php if(common::canModify('product', $product) and common::hasPriv('release', 'create')):?>
|
||||
<?php if(common::canModify('product', $product) and common::hasPriv('projectrelease', 'create')):?>
|
||||
<?php echo html::a($this->createLink('projectrelease', 'create', "productID=$product->id&branch=$branch"), "<i class='icon icon-plus'></i> " . $lang->release->create, '', "class='btn btn-info'");?>
|
||||
<?php endif;?>
|
||||
</p>
|
||||
@@ -58,7 +58,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($releases as $release):?>
|
||||
<?php $canBeChanged = common::canBeChanged('release', $release);?>
|
||||
<?php $canBeChanged = common::canBeChanged('projectrelease', $release);?>
|
||||
<tr>
|
||||
<td><?php echo html::a(inlink('view', "releaseID=$release->id"), sprintf('%03d', $release->id));?></td>
|
||||
<td>
|
||||
@@ -81,17 +81,17 @@
|
||||
<?php
|
||||
if($canBeChanged)
|
||||
{
|
||||
if(common::hasPriv('release', 'linkStory')) echo html::a(inlink('view', "releaseID=$release->id&type=story&link=true"), '<i class="icon-link"></i> ', '', "class='btn' title='{$lang->release->linkStory}'");
|
||||
if(common::hasPriv('release', 'linkBug')) echo html::a(inlink('view', "releaseID=$release->id&type=bug&link=true"), '<i class="icon-bug"></i> ', '', "class='btn' title='{$lang->release->linkBug}'");
|
||||
if(common::hasPriv('release', 'changeStatus', $release))
|
||||
if(common::hasPriv('projectrelease', 'linkStory')) echo html::a(inlink('view', "releaseID=$release->id&type=story&link=true"), '<i class="icon-link"></i> ', '', "class='btn' title='{$lang->release->linkStory}'");
|
||||
if(common::hasPriv('projectrelease', 'linkBug')) echo html::a(inlink('view', "releaseID=$release->id&type=bug&link=true"), '<i class="icon-bug"></i> ', '', "class='btn' title='{$lang->release->linkBug}'");
|
||||
if(common::hasPriv('projectrelease', 'changeStatus', $release))
|
||||
{
|
||||
$changedStatus = $release->status == 'normal' ? 'terminate' : 'normal';
|
||||
echo html::a($this->createLink('release', 'changeStatus', "releaseID=$release->id&status=$changedStatus"), '<i class="icon-' . ($release->status == 'normal' ? 'pause' : 'play') . '"></i> ', 'hiddenwin', "class='btn' title='{$lang->release->changeStatusList[$changedStatus]}'");
|
||||
echo html::a($this->createLink('projectrelease', 'changeStatus', "releaseID=$release->id&status=$changedStatus"), '<i class="icon-' . ($release->status == 'normal' ? 'pause' : 'play') . '"></i> ', 'hiddenwin', "class='btn' title='{$lang->release->changeStatusList[$changedStatus]}'");
|
||||
}
|
||||
common::printIcon('projectrelease', 'edit', "release=$release->id", $release, 'list');
|
||||
if(common::hasPriv('release', 'delete', $release))
|
||||
if(common::hasPriv('projectrelease', 'delete', $release))
|
||||
{
|
||||
$deleteURL = $this->createLink('release', 'delete', "releaseID=$release->id&confirm=yes");
|
||||
$deleteURL = $this->createLink('projectrelease', 'delete', "releaseID=$release->id&confirm=yes");
|
||||
echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"releaseList\", confirmDelete)", '<i class="icon-trash"></i>', '', "class='btn' title='{$lang->release->delete}'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,19 +31,19 @@
|
||||
</div>
|
||||
<div class='btn-toolbar pull-right'>
|
||||
<?php
|
||||
$canBeChanged = common::canBeChanged('release', $release);
|
||||
$canBeChanged = common::canBeChanged('projectrelease', $release);
|
||||
|
||||
if(!$release->deleted and $canBeChanged)
|
||||
{
|
||||
echo $this->buildOperateMenu($release, 'view');
|
||||
|
||||
if(common::hasPriv('release', 'changeStatus', $release))
|
||||
if(common::hasPriv('projectrelease', 'changeStatus', $release))
|
||||
{
|
||||
$changedStatus = $release->status == 'normal' ? 'terminate' : 'normal';
|
||||
echo html::a(inlink('changeStatus', "releaseID=$release->id&status=$changedStatus"), '<i class="icon-' . ($release->status == 'normal' ? 'pause' : 'play') . '"></i> ' . $lang->release->changeStatusList[$changedStatus], 'hiddenwin', "class='btn btn-link' title='{$lang->release->changeStatusList[$changedStatus]}'");
|
||||
}
|
||||
if(common::hasPriv('release', 'edit')) echo html::a(inlink('edit', "releaseID=$release->id"), "<i class='icon-common-edit icon-edit'></i> " . $this->lang->edit, '', "class='btn btn-link' title='{$this->lang->edit}'");
|
||||
if(common::hasPriv('release', 'delete')) echo html::a(inlink('delete', "releaseID=$release->id"), "<i class='icon-common-delete icon-trash'></i> " . $this->lang->delete, '', "class='btn btn-link' title='{$this->lang->delete}' target='hiddenwin'");
|
||||
if(common::hasPriv('projectrelease', 'edit')) echo html::a(inlink('edit', "releaseID=$release->id"), "<i class='icon-common-edit icon-edit'></i> " . $this->lang->edit, '', "class='btn btn-link' title='{$this->lang->edit}'");
|
||||
if(common::hasPriv('projectrelease', 'delete')) echo html::a(inlink('delete', "releaseID=$release->id"), "<i class='icon-common-delete icon-trash'></i> " . $this->lang->delete, '', "class='btn btn-link' title='{$this->lang->delete}' target='hiddenwin'");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@@ -59,19 +59,19 @@
|
||||
<li <?php if($type == 'leftBug') echo "class='active'"?>><a href='#leftBugs' data-toggle='tab'><?php echo html::icon($lang->icons['bug'], 'text-red') . ' ' . $lang->release->generatedBugs;?></a></li>
|
||||
<li <?php if($type == 'releaseInfo') echo "class='active'"?>><a href='#releaseInfo' data-toggle='tab'><?php echo html::icon($lang->icons['plan'], 'text-info') . ' ' . $lang->release->view;?></a></li>
|
||||
<?php if($countStories or $countBugs or $countLeftBugs):?>
|
||||
<li class='pull-right'><div><?php common::printIcon('release', 'export', '', '', 'button', '', '', "export btn-sm");?></div></li>
|
||||
<li class='pull-right'><div><?php common::printIcon('projectrelease', 'export', '', '', 'button', '', '', "export btn-sm");?></div></li>
|
||||
<?php endif;?>
|
||||
</ul>
|
||||
<div class='tab-content'>
|
||||
<div class='tab-pane <?php if($type == 'story') echo 'active'?>' id='stories'>
|
||||
<?php if(common::hasPriv('release', 'linkStory') and $canBeChanged):?>
|
||||
<?php if(common::hasPriv('projectrelease', 'linkStory') and $canBeChanged):?>
|
||||
<div class='actions'><?php echo html::a("javascript:showLink({$release->id}, \"story\")", '<i class="icon-link"></i> ' . $lang->release->linkStory, '', "class='btn btn-primary'");?></div>
|
||||
<div class='linkBox cell hidden'></div>
|
||||
<?php endif;?>
|
||||
<form class='main-table table-story' method='post' id='linkedStoriesForm' data-ride="table">
|
||||
<table class='table has-sort-head' id='storyList'>
|
||||
<?php
|
||||
$canBatchUnlink = common::hasPriv('release', 'batchUnlinkStory');
|
||||
$canBatchUnlink = common::hasPriv('projectrelease', 'batchUnlinkStory');
|
||||
$canBatchClose = common::hasPriv('story', 'batchClose');
|
||||
?>
|
||||
<?php $vars = "releaseID={$release->id}&type=story&link=$link¶m=$param&orderBy=%s";?>
|
||||
@@ -122,9 +122,9 @@
|
||||
<td><?php echo $lang->story->stageList[$story->stage];?></td>
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
if(common::hasPriv('release', 'unlinkStory') and $canBeChanged)
|
||||
if(common::hasPriv('projectrelease', 'unlinkStory') and $canBeChanged)
|
||||
{
|
||||
$unlinkURL = $this->createLink('release', 'unlinkStory', "releaseID=$release->id&story=$story->id");
|
||||
$unlinkURL = $this->createLink('projectrelease', 'unlinkStory', "releaseID=$release->id&story=$story->id");
|
||||
echo html::a("javascript:ajaxDelete(\"$unlinkURL\", \"storyList\", confirmUnlinkStory)", '<i class="icon-unlink"></i>', '', "class='btn' title='{$lang->release->unlinkStory}'");
|
||||
}
|
||||
?>
|
||||
@@ -138,7 +138,7 @@
|
||||
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
|
||||
<div class="table-actions btn-toolbar">
|
||||
<?php
|
||||
if(common::hasPriv('release', 'batchUnlinkStory'))
|
||||
if(common::hasPriv('projectrelease', 'batchUnlinkStory'))
|
||||
{
|
||||
$unlinkURL = inlink('batchUnlinkStory', "release=$release->id");
|
||||
echo html::a('###', $lang->release->batchUnlink, '', "onclick='setFormAction(\"$unlinkURL\", \"hiddenwin\", this)' class='btn'");
|
||||
@@ -162,13 +162,13 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class='tab-pane <?php if($type == 'bug') echo 'active'?>' id='bugs'>
|
||||
<?php if(common::hasPriv('release', 'linkBug') and $canBeChanged):?>
|
||||
<?php if(common::hasPriv('projectrelease', 'linkBug') and $canBeChanged):?>
|
||||
<div class='actions'><?php echo html::a("javascript:showLink({$release->id}, \"bug\")", '<i class="icon-bug"></i> ' . $lang->release->linkBug, '', "class='btn btn-primary'");?></div>
|
||||
<div class='linkBox cell hidden'></div>
|
||||
<?php endif;?>
|
||||
<form class='main-table table-bug' method='post' target='hiddenwin' action="<?php echo inLink('batchUnlinkBug', "releaseID=$release->id");?>" id='linkedBugsForm' data-ride="table">
|
||||
<table class='table has-sort-head' id='bugList'>
|
||||
<?php $canBatchUnlink = common::hasPriv('release', 'batchUnlinkBug');?>
|
||||
<?php $canBatchUnlink = common::hasPriv('projectrelease', 'batchUnlinkBug');?>
|
||||
<?php $vars = "releaseID={$release->id}&type=bug&link=$link¶m=$param&orderBy=%s";?>
|
||||
<thead>
|
||||
<tr class='text-center'>
|
||||
@@ -212,9 +212,9 @@
|
||||
<td><?php echo substr($bug->resolvedDate, 5, 11)?></td>
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
if(common::hasPriv('release', 'unlinkBug') and $canBeChanged)
|
||||
if(common::hasPriv('projectrelease', 'unlinkBug') and $canBeChanged)
|
||||
{
|
||||
$unlinkURL = $this->createLink('release', 'unlinkBug', "releaseID=$release->id&bug=$bug->id");
|
||||
$unlinkURL = $this->createLink('projectrelease', 'unlinkBug', "releaseID=$release->id&bug=$bug->id");
|
||||
echo html::a("javascript:ajaxDelete(\"$unlinkURL\", \"bugList\", confirmUnlinkBug)", '<i class="icon-unlink"></i>', '', "class='btn' title='{$lang->release->unlinkBug}'");
|
||||
}
|
||||
?>
|
||||
@@ -240,13 +240,13 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class='tab-pane <?php if($type == 'leftBug') echo 'active'?>' id='leftBugs'>
|
||||
<?php if(common::hasPriv('release', 'linkBug') and $canBeChanged):?>
|
||||
<?php if(common::hasPriv('projectrelease', 'linkBug') and $canBeChanged):?>
|
||||
<div class='actions'><?php echo html::a("javascript:showLink({$release->id}, \"leftBug\")", '<i class="icon-bug"></i> ' . $lang->release->linkBug, '', "class='btn btn-primary'");?></div>
|
||||
<div class='linkBox cell hidden'></div>
|
||||
<?php endif;?>
|
||||
<form class='main-table table-bug' method='post' target='hiddenwin' action="<?php echo inlink('batchUnlinkBug', "releaseID=$release->id&type=leftBug");?>" id='linkedBugsForm' data-ride="table">
|
||||
<table class='table has-sort-head' id='leftBugList'>
|
||||
<?php $canBatchUnlink = common::hasPriv('release', 'batchUnlinkBug');?>
|
||||
<?php $canBatchUnlink = common::hasPriv('projectrelease', 'batchUnlinkBug');?>
|
||||
<?php $vars = "releaseID={$release->id}&type=leftBug&link=$link¶m=$param&orderBy=%s";?>
|
||||
<thead>
|
||||
<tr class='text-center'>
|
||||
@@ -303,9 +303,9 @@
|
||||
<td><?php echo $bug->openedDate?></td>
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
if(common::hasPriv('release', 'unlinkBug') and $canBeChanged)
|
||||
if(common::hasPriv('projectrelease', 'unlinkBug') and $canBeChanged)
|
||||
{
|
||||
$unlinkURL = $this->createLink('release', 'unlinkBug', "releaseID=$release->id&bug=$bug->id&type=leftBug");
|
||||
$unlinkURL = $this->createLink('projectrelease', 'unlinkBug', "releaseID=$release->id&bug=$bug->id&type=leftBug");
|
||||
echo html::a("javascript:ajaxDelete(\"$unlinkURL\", \"leftBugList\", confirmUnlinkBug)", '<i class="icon-unlink"></i>', '', "class='btn' title='{$lang->release->unlinkBug}'");
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user