diff --git a/module/ci/control.php b/module/ci/control.php index 209ceb21d8..c61dfb4798 100644 --- a/module/ci/control.php +++ b/module/ci/control.php @@ -278,6 +278,7 @@ class ci extends control $this->view->position[] = $this->lang->citask->create; $this->view->repoList = $this->ci->listRepoForSelection("true"); + $this->view->jenkinsList = $this->ci->listJenkinsForSelection("true"); $this->view->module = 'citask'; $this->display(); @@ -292,7 +293,7 @@ class ci extends control */ public function editCitask($id) { - $citask = $this->ci->getJenkinsByID($id); + $citask = $this->ci->getCitaskByID($id); if($_POST) { $this->ci->updateCitask($id); @@ -307,9 +308,11 @@ class ci extends control $this->view->position[] = html::a(inlink('browseCitask'), $this->lang->citask->common); $this->view->position[] = $this->lang->citask->edit; - $this->view->citask = $citask; + $this->view->citask = $citask; - $this->view->module = 'jenkins'; + $this->view->repoList = $this->ci->listRepoForSelection("true"); + $this->view->jenkinsList = $this->ci->listJenkinsForSelection("true"); + $this->view->module = 'citask'; $this->display(); } diff --git a/module/ci/css/editcitask.css b/module/ci/css/editcitask.css new file mode 100644 index 0000000000..acd32fac18 --- /dev/null +++ b/module/ci/css/editcitask.css @@ -0,0 +1,7 @@ +.row.text-with-input .col { + line-height: 32px; +} + +.only-pick-time thead th, .only-pick-time tfoot th { + color: transparent !important; +} diff --git a/module/ci/js/editcitask.js b/module/ci/js/editcitask.js new file mode 100644 index 0000000000..e0fcdf37cf --- /dev/null +++ b/module/ci/js/editcitask.js @@ -0,0 +1,46 @@ +$(function() +{ + triggerTypeChanged(triggerType); +}); + +function triggerTypeChanged(type) { + if(type == 'tag') { + $('.tag-fields').removeClass('hidden'); + $('.comment-fields').addClass('hidden'); + + scheduleTypeChanged(); + } else if(type == 'commit') { + $('.tag-fields').addClass('hidden'); + $('.comment-fields').removeClass('hidden'); + + $('.corn-fields').addClass('hidden'); + $('.custom-fields').addClass('hidden'); + + scheduleTypeChanged(); + } else if(type == 'schedule') { + $('.tag-fields').addClass('hidden'); + $('.comment-fields').addClass('hidden'); + + var val = $("input[name='scheduleType']:checked").val(); + scheduleTypeChanged(val? val: 'corn'); + } +} + +function scheduleTypeChanged(type) { + if(type == 'corn') { + $('.schedule-fields').removeClass('hidden'); + + $('.corn-fields').removeClass('hidden'); + $('.custom-fields').addClass('hidden'); + } else if(type == 'custom') { + $('.schedule-fields').removeClass('hidden'); + + $('.corn-fields').addClass('hidden'); + $('.custom-fields').removeClass('hidden'); + } else { + $('.schedule-fields').addClass('hidden'); + + $('.corn-fields').addClass('hidden'); + $('.custom-fields').addClass('hidden'); + } +} \ No newline at end of file diff --git a/module/ci/model.php b/module/ci/model.php index 723138af06..9114a1350c 100644 --- a/module/ci/model.php +++ b/module/ci/model.php @@ -687,4 +687,20 @@ class ciModel extends model return $repos; } + /** + * list jenkins for ci task edit + * + * @return mixed + */ + public function listJenkinsForSelection($whr) + { + $repos = $this->dao->select('id, name')->from(TABLE_JENKINS) + ->where('deleted')->eq('0') + ->beginIF(!empty(whr))->andWhere($whr)->fi() + ->orderBy(id) + ->fetchPairs(); + $repos[''] = ''; + return $repos; + } + } diff --git a/module/ci/view/browsecitask.html.php b/module/ci/view/browsecitask.html.php index ce53412ec7..6fb2ee7332 100644 --- a/module/ci/view/browsecitask.html.php +++ b/module/ci/view/browsecitask.html.php @@ -1,17 +1,17 @@ - * @package jenkins + * @package citask * @version $Id$ * @link http://www.zentao.net */ ?> -jenkins->confirmDelete); ?> +citask->confirmDelete); ?>