* Finish task #36475.

This commit is contained in:
holan20180123
2021-03-08 09:48:02 +08:00
parent 25e96b57bb
commit 017a21b95b
4 changed files with 32 additions and 11 deletions
+11 -1
View File
@@ -78,10 +78,16 @@ class release extends control
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID")));
}
$builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch, 'notrunk|withbranch', false);
$releaseBuilds = $this->release->getReleaseBuilds($productID, $branch);
foreach($releaseBuilds as $build) unset($builds[$build]);
unset($builds['trunk']);
$this->commonAction($productID, $branch);
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->release->create;
$this->view->position[] = $this->lang->release->create;
$this->view->productID = $productID;
$this->view->builds = $builds;
$this->view->lastRelease = $this->release->getLast($productID, $branch);
$this->display();
}
@@ -114,13 +120,17 @@ class release extends control
$this->loadModel('bug');
$this->loadModel('build');
/* Get release. */
/* Get release and build. */
$release = $this->release->getById((int)$releaseID);
$this->commonAction($release->product, $release->branch);
$build = $this->build->getById($release->build);
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->release->edit;
$this->view->position[] = $this->lang->release->edit;
$this->view->release = $release;
$this->view->build = $build;
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($release->product, $release->branch, 'notrunk|withbranch', false);
$this->display();
}
+3
View File
@@ -114,6 +114,9 @@ class releaseModel extends model
$branch = (int)$branch;
$buildID = 0;
/* Check build if build is required. */
if(strpos($this->config->release->create->requiredFields, 'build') !== false and $this->post->build == false) return dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->release->build);
/* Check date must be not more than today. */
if($this->post->date > date('Y-m-d')) return dao::$errors[] = $this->lang->release->errorDate;
+7 -3
View File
@@ -18,7 +18,7 @@
<h2><?php echo $lang->release->create;?></h2>
</div>
<form class='load-indicator main-form form-ajax' id='dataform' method='post' enctype='multipart/form-data'>
<table class='table table-form'>
<table class='table table-form'>
<tbody>
<tr>
<th><?php echo $lang->release->name;?></th>
@@ -31,6 +31,10 @@
<?php if($lastRelease) echo '(' . $lang->release->last . ': ' . $lastRelease->name . ')';?>
</td>
</tr>
<tr>
<th><?php echo $lang->release->build;?></th>
<td><?php echo html::select('build', $builds, '', "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->release->date;?></th>
<td><?php echo html::input('date', helper::today(), "class='form-control form-date' required");?></td><td></td>
@@ -48,7 +52,7 @@
<tr>
<th><?php echo $lang->files;?></th>
<td colspan='2'><?php echo $this->fetch('file', 'buildform');?></td>
</tr>
</tr>
<tr>
<td colspan='3' class='text-center form-actions'>
<?php echo html::submitButton();?>
@@ -57,7 +61,7 @@
</tr>
</tbody>
</table>
</form>
</form>
</div>
</div>
<script>
+11 -7
View File
@@ -22,7 +22,7 @@
</h2>
</div>
<form class='load-indicator main-form form-ajax' method='post' target='hiddenwin' id='dataform' enctype='multipart/form-data'>
<table class='table table-form'>
<table class='table table-form'>
<tbody>
<tr>
<th><?php echo $lang->release->name;?></th>
@@ -34,24 +34,28 @@
<label for='marker'><?php echo $lang->release->marker;?></label>
</div>
</td>
</tr>
</tr>
<tr>
<th><?php echo $lang->release->build;?></th>
<td><?php echo html::select('build', $builds, $release->build, "class='form-control chosen' required"); ?></td>
</tr>
<tr>
<th><?php echo $lang->release->date;?></th>
<td><?php echo html::input('date', $release->date, "class='form-control form-date' required");?></td><td></td>
</tr>
</tr>
<tr>
<th><?php echo $lang->release->status;?></th>
<td><?php echo html::select('status', $lang->release->statusList, $release->status, "class='form-control'");?></td><td></td>
</tr>
</tr>
<?php $this->printExtendFields($release, 'table');?>
<tr>
<th><?php echo $lang->release->desc;?></th>
<td colspan='2'><?php echo html::textarea('desc', htmlspecialchars($release->desc), "rows=10 class='form-control kindeditor' hidefocus='true'");?></td>
</tr>
</tr>
<tr>
<th><?php echo $lang->files;?></th>
<td colspan='2'><?php echo $this->fetch('file', 'buildform');?></td>
</tr>
</tr>
<tr>
<td colspan='3' class='text-center form-actions'>
<?php echo html::submitButton();?>
@@ -61,7 +65,7 @@
</tr>
</tbody>
</table>
</form>
</form>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>