* code for task #6889.
This commit is contained in:
@@ -23,16 +23,21 @@ class ci extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* CI index page.
|
||||
*
|
||||
* Build today job.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function index()
|
||||
public function buildTodayJob()
|
||||
{
|
||||
$this->view->position[] = $this->lang->ci->common;
|
||||
$scheduleJobs = $this->loadModel('integration')->getListByTriggerType('schedule');
|
||||
|
||||
$this->display();
|
||||
$week = date('w');
|
||||
foreach($scheduleJobs as $job)
|
||||
{
|
||||
if(strpos($job->scheduleDay, $week) !== false) $this->integration->exec($job->id);
|
||||
}
|
||||
die('success');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The index view file of ci module of ZenTaoPMS.
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php'; ?>
|
||||
|
||||
<div id='mainContent' class='main-row'>
|
||||
<div class='main-col main-content'></div>
|
||||
</div>
|
||||
|
||||
<?php include '../../common/view/footer.html.php'; ?>
|
||||
@@ -138,10 +138,7 @@ class integration extends control
|
||||
*/
|
||||
public function delete($id, $confirm = 'no')
|
||||
{
|
||||
if($confirm != 'yes')
|
||||
{
|
||||
die(js::confirm($this->lang->integration->confirmDelete, inlink('delete', "jobID=$id&confirm=yes")));
|
||||
}
|
||||
if($confirm != 'yes') die(js::confirm($this->lang->integration->confirmDelete, inlink('delete', "jobID=$id&confirm=yes")));
|
||||
|
||||
$this->integration->delete(TABLE_INTEGRATION, $id);
|
||||
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
.row.text-with-input .col{line-height: 32px;}
|
||||
.only-pick-time thead th, .only-pick-time tfoot th {color: transparent !important;}
|
||||
.checkbox-primary.checkbox-inline{display:inline-block !important;}
|
||||
.checkbox-primary.checkbox-inline label{padding-left:5px !important;}
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
.row.text-with-input .col {line-height: 32px;}
|
||||
.only-pick-time thead th, .only-pick-time tfoot th {color: transparent !important;}
|
||||
.checkbox-primary.checkbox-inline{display:inline-block !important;}
|
||||
.checkbox-primary.checkbox-inline label{padding-left:5px !important;}
|
||||
|
||||
@@ -68,24 +68,19 @@ $('#triggerType').change(function()
|
||||
{
|
||||
$('.tag-fields').removeClass('hidden');
|
||||
$('.comment-fields').addClass('hidden');
|
||||
|
||||
scheduleTypeChanged();
|
||||
$('.custom-fields').addClass('hidden');
|
||||
}
|
||||
else if(type == 'commit')
|
||||
{
|
||||
$('.tag-fields').addClass('hidden');
|
||||
$('.comment-fields').removeClass('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 : 'custom');
|
||||
$('.custom-fields').removeClass('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -94,17 +89,3 @@ $(function()
|
||||
$('#repo').change();
|
||||
$('#triggerType').change();
|
||||
});
|
||||
|
||||
function scheduleTypeChanged(type)
|
||||
{
|
||||
if(type == 'custom')
|
||||
{
|
||||
$('.schedule-fields').removeClass('hidden');
|
||||
$('.custom-fields').removeClass('hidden');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.schedule-fields').addClass('hidden');
|
||||
$('.custom-fields').addClass('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,24 +70,19 @@ $('#triggerType').change(function()
|
||||
{
|
||||
$('.tag-fields').removeClass('hidden');
|
||||
$('.comment-fields').addClass('hidden');
|
||||
|
||||
scheduleTypeChanged();
|
||||
$('.custom-fields').addClass('hidden');
|
||||
}
|
||||
else if(type == 'commit')
|
||||
{
|
||||
$('.tag-fields').addClass('hidden');
|
||||
$('.comment-fields').removeClass('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: 'custom');
|
||||
$('.custom-fields').removeClass('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -101,27 +96,13 @@ function execJob(id)
|
||||
{
|
||||
$.ajax(
|
||||
{
|
||||
type:"POST",
|
||||
type: "POST",
|
||||
url: createLink('integration', 'exec', 'id=' + id),
|
||||
data: {},
|
||||
datatype: "json",
|
||||
success:function(data)
|
||||
success: function(data)
|
||||
{
|
||||
$('.exe-job-button').tooltip('show', sendExec);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function scheduleTypeChanged(type)
|
||||
{
|
||||
if(type == 'custom')
|
||||
{
|
||||
$('.schedule-fields').removeClass('hidden');
|
||||
$('.custom-fields').removeClass('hidden');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.schedule-fields').addClass('hidden');
|
||||
$('.custom-fields').addClass('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,33 +6,22 @@ $lang->integration->execNow = 'Execute now';
|
||||
$lang->integration->delete = 'Delete Integration';
|
||||
$lang->integration->confirmDelete = 'Do you want to delete this Build?';
|
||||
|
||||
$lang->integration->id = 'ID';
|
||||
$lang->integration->name = 'Name';
|
||||
$lang->integration->repo = 'Repo';
|
||||
$lang->integration->svnFolder = 'SVN Tag Watch Path';
|
||||
$lang->integration->jenkins = 'Jenkins Server';
|
||||
$lang->integration->buildType = 'Build Type';
|
||||
$lang->integration->jenkinsJob = 'Jenkins Task';
|
||||
$lang->integration->triggerType = 'Trigger';
|
||||
$lang->integration->scheduleType = 'Schedule';
|
||||
$lang->integration->cronExpression = 'Cron Expression';
|
||||
$lang->integration->custom = 'Custom';
|
||||
|
||||
$lang->integration->at = 'executed on';
|
||||
$lang->integration->time = 'Time';
|
||||
$lang->integration->exec = 'Execute';
|
||||
$lang->integration->scheduleInterval = 'Every';
|
||||
$lang->integration->day = 'days';
|
||||
$lang->integration->lastExec = 'Last Executed';
|
||||
$lang->integration->scheduleTime = 'Time';
|
||||
$lang->integration->id = 'ID';
|
||||
$lang->integration->name = 'Name';
|
||||
$lang->integration->repo = 'Repo';
|
||||
$lang->integration->svnFolder = 'SVN Tag Watch Path';
|
||||
$lang->integration->jenkins = 'Jenkins Server';
|
||||
$lang->integration->buildType = 'Build Type';
|
||||
$lang->integration->jenkinsJob = 'Jenkins Task';
|
||||
$lang->integration->triggerType = 'Trigger';
|
||||
$lang->integration->scheduleDay = 'Custom Days';
|
||||
$lang->integration->lastExec = 'Last Executed';
|
||||
|
||||
$lang->integration->example = 'e.g.';
|
||||
$lang->integration->tagEx = 'build_#15, to build Jenkins job that id is 15.';
|
||||
$lang->integration->commitEx = 'start build #15, to build Jenkins job that id is 15.';
|
||||
$lang->integration->cronSample = 'e.g. 0 0 2 * * 2-6/1 means 2:00 a.m. every weekday.';
|
||||
|
||||
$lang->integration->dayTypeList['workDay'] = 'Weekdays';
|
||||
$lang->integration->dayTypeList['everyDay'] = 'Every Day';
|
||||
$lang->integration->sendExec = 'Send execute request success.';
|
||||
|
||||
$lang->integration->buildTypeList['build'] = 'Only Build';
|
||||
$lang->integration->buildTypeList['buildAndDeploy'] = 'Build And Deploy';
|
||||
@@ -41,6 +30,3 @@ $lang->integration->buildTypeList['buildAndTest'] = 'Build And Test';
|
||||
$lang->integration->triggerTypeList['tag'] = 'Tag';
|
||||
$lang->integration->triggerTypeList['commit'] = 'Code Commit';
|
||||
$lang->integration->triggerTypeList['schedule'] = 'Schedule';
|
||||
|
||||
$lang->integration->scheduleTypeList['cron'] = 'Crontab';
|
||||
$lang->integration->scheduleTypeList['custom'] = 'Custom';
|
||||
|
||||
@@ -6,25 +6,16 @@ $lang->integration->execNow = '立即执行';
|
||||
$lang->integration->delete = '删除构建任务';
|
||||
$lang->integration->confirmDelete = '确认删除该构建任务吗?';
|
||||
|
||||
$lang->integration->id = 'ID';
|
||||
$lang->integration->name = '名称';
|
||||
$lang->integration->repo = '代码库';
|
||||
$lang->integration->svnFolder = 'SVN Tag监控路径';
|
||||
$lang->integration->jenkins = 'Jenkins服务';
|
||||
$lang->integration->buildType = '构建类型';
|
||||
$lang->integration->jenkinsJob = 'Jenkins任务名';
|
||||
$lang->integration->triggerType = '触发方式';
|
||||
$lang->integration->scheduleType = '时间计划';
|
||||
$lang->integration->cronExpression = 'Cron表达式';
|
||||
$lang->integration->custom = '自定义';
|
||||
|
||||
$lang->integration->at = '在';
|
||||
$lang->integration->time = '时间';
|
||||
$lang->integration->exec = '执行';
|
||||
$lang->integration->scheduleInterval = '每隔';
|
||||
$lang->integration->day = '天';
|
||||
$lang->integration->lastExec = '最后执行';
|
||||
$lang->integration->scheduleTime = '时间';
|
||||
$lang->integration->id = 'ID';
|
||||
$lang->integration->name = '名称';
|
||||
$lang->integration->repo = '代码库';
|
||||
$lang->integration->svnFolder = 'SVN Tag监控路径';
|
||||
$lang->integration->jenkins = 'Jenkins服务';
|
||||
$lang->integration->buildType = '构建类型';
|
||||
$lang->integration->jenkinsJob = 'Jenkins任务名';
|
||||
$lang->integration->triggerType = '触发方式';
|
||||
$lang->integration->scheduleDay = '自定义天数';
|
||||
$lang->integration->lastExec = '最后执行';
|
||||
|
||||
$lang->integration->example = '举例';
|
||||
$lang->integration->tagEx = 'build_#15,其中15为Jenkins任务编号';
|
||||
@@ -32,9 +23,6 @@ $lang->integration->commitEx = 'start build #15,其中15为Jenkins任务编
|
||||
$lang->integration->cronSample = '如 0 0 2 * * 2-6/1 表示每个工作日凌晨2点';
|
||||
$lang->integration->sendExec = '发送执行请求成功!';
|
||||
|
||||
$lang->integration->dayTypeList['workDay'] = '工作日';
|
||||
$lang->integration->dayTypeList['everyDay'] = '每天';
|
||||
|
||||
$lang->integration->buildTypeList['build'] = '仅构建';
|
||||
$lang->integration->buildTypeList['buildAndDeploy'] = '构建部署';
|
||||
$lang->integration->buildTypeList['buildAndTest'] = '构建测试';
|
||||
@@ -42,6 +30,3 @@ $lang->integration->buildTypeList['buildAndTest'] = '构建测试';
|
||||
$lang->integration->triggerTypeList['tag'] = '打标签';
|
||||
$lang->integration->triggerTypeList['commit'] = '代码提交注释';
|
||||
$lang->integration->triggerTypeList['schedule'] = '定时计划';
|
||||
|
||||
$lang->integration->scheduleTypeList['cron'] = 'Crontab';
|
||||
$lang->integration->scheduleTypeList['custom'] = '自定义';
|
||||
|
||||
@@ -42,6 +42,21 @@ class integrationModel extends model
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list by triggerType field
|
||||
*
|
||||
* @param string $triggerType
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getListByTriggerType($triggerType)
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_INTEGRATION)
|
||||
->where('deleted')->eq('0')
|
||||
->andWhere('triggerType')->eq($triggerType)
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create integration
|
||||
*
|
||||
@@ -55,40 +70,20 @@ class integrationModel extends model
|
||||
->add('createdDate', helper::now())
|
||||
->remove('repoType')
|
||||
->get();
|
||||
if($integration->triggerType == 'schedule')
|
||||
{
|
||||
if(!isset($integration->scheduleDay)) $integration->scheduleDay = array();
|
||||
$integration->scheduleDay = join(',', $integration->scheduleDay);
|
||||
}
|
||||
|
||||
$this->dao->insert(TABLE_INTEGRATION)->data($integration)
|
||||
->batchCheck($this->config->integration->create->requiredFields, 'notempty')
|
||||
|
||||
->batchCheckIF($integration->triggerType === 'schedule' && $integration->scheduleType == 'cron', "cronExpression", 'notempty')
|
||||
->batchCheckIF($integration->triggerType === 'schedule' && $integration->scheduleType == 'custom', "scheduleDay,scheduleTime,scheduleInterval", 'notempty')
|
||||
->batchCheckIF($integration->triggerType === 'schedule', "scheduleDay", 'notempty')
|
||||
->batchCheckIF($this->post->repoType == 'Subversion', "svnFolder", 'notempty')
|
||||
|
||||
->autoCheck()
|
||||
->exec();
|
||||
|
||||
$integrationId = $this->dao->lastInsertID();
|
||||
if($integration->triggerType =='schedule')
|
||||
{
|
||||
$arr = explode(":", $integration->scheduleTime);
|
||||
$hour = $arr[0];
|
||||
$min = $arr[1];
|
||||
|
||||
if($integration->scheduleDay == 'everyDay')
|
||||
{
|
||||
$days = '1-7';
|
||||
}
|
||||
elseif($integration->scheduleDay == 'workDay')
|
||||
{
|
||||
$days = '1-5';
|
||||
}
|
||||
|
||||
$cron = (object)array('m' => $min, 'h' => $hour, 'dom' => '*', 'mon' => '*',
|
||||
'dow' => $days . '/' . $integration->scheduleInterval, 'command' => 'moduleName=ci&methodName=exeJob&parm=' . $integrationId,
|
||||
'remark' => ($this->lang->ci->extJob . $integrationId), 'type' => 'zentao',
|
||||
'buildin' => '-1', 'status' => 'normal', 'lastTime' => '0000-00-00 00:00:00');
|
||||
$this->dao->insert(TABLE_CRON)->data($cron)->exec();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -106,45 +101,21 @@ class integrationModel extends model
|
||||
->add('editedDate', helper::now())
|
||||
->remove('repoType')
|
||||
->get();
|
||||
if($integration->triggerType == 'schedule')
|
||||
{
|
||||
if(!isset($integration->scheduleDay)) $integration->scheduleDay = array();
|
||||
$integration->scheduleDay = join(',', $integration->scheduleDay);
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_INTEGRATION)->data($integration)
|
||||
->batchCheck($this->config->integration->edit->requiredFields, 'notempty')
|
||||
|
||||
->batchCheckIF($integration->triggerType === 'schedule' && $integration->scheduleType == 'cron', "cronExpression", 'notempty')
|
||||
->batchCheckIF($integration->triggerType === 'schedule' && $integration->scheduleType == 'custom', "scheduleDay,scheduleTime,scheduleInterval", 'notempty')
|
||||
->batchCheckIF($integration->triggerType === 'schedule', "scheduleDay", 'notempty')
|
||||
->batchCheckIF($this->post->repoType == 'Subversion', "svnFolder", 'notempty')
|
||||
|
||||
->autoCheck()
|
||||
->where('id')->eq($id)
|
||||
->exec();
|
||||
|
||||
if ($integration->triggerType === 'schedule')
|
||||
{
|
||||
$command = 'moduleName=ci&methodName=exeJob&parm=' . $id;
|
||||
|
||||
$arr = explode(":", $integration->scheduleTime);
|
||||
$hour = $arr[0];
|
||||
$min = $arr[1];
|
||||
|
||||
if($integration->scheduleDay == 'everyDay')
|
||||
{
|
||||
$days = '1-7';
|
||||
}
|
||||
elseif($integration->scheduleDay == 'workDay')
|
||||
{
|
||||
$days = '2-6';
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_CRON)
|
||||
->set('m')->eq($min)
|
||||
->set('h')->eq($hour)
|
||||
->set('dom')->eq('*')
|
||||
->set('mon')->eq('*')
|
||||
->set('dow')->eq($days . '/' . $integration->scheduleInterval)
|
||||
->set('lastTime')->eq('0000-00-00 00:00:00')
|
||||
->where('command')->eq($command)->exec();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -163,7 +134,7 @@ class integrationModel extends model
|
||||
->where('t1.id')->eq($integrationID)
|
||||
->fetch();
|
||||
|
||||
if (!$integration) return false;
|
||||
if(!$integration) return false;
|
||||
|
||||
$jenkinsServer = $integration->serviceUrl;
|
||||
$jenkinsUser = $integration->account;
|
||||
|
||||
@@ -54,18 +54,8 @@
|
||||
<td colspan="3"><?php echo $lang->integration->commitEx; ?></td>
|
||||
</tr>
|
||||
<tr class="custom-fields">
|
||||
<th><?php echo $lang->integration->custom; ?></th>
|
||||
<td colspan="3">
|
||||
<div class="row text-with-input">
|
||||
<div class="col w-50px"><?php echo $lang->integration->scheduleInterval;?></div>
|
||||
<div class="col w-100px"><?php echo html::number('scheduleInterval', '1', "class='form-control'");?></div>
|
||||
<div class="col w-40px"><?php echo $lang->integration->day;?>, </div>
|
||||
<div class="col <?php echo $this->app->getClientLang() == 'en' ? 'w-100px' : '2-30px'; ?>"><?php echo $lang->integration->at;?></div>
|
||||
<div class="col w-150px"><?php echo html::select('scheduleDay', $lang->integration->dayTypeList, '',"class='form-control chosen'");?></div>
|
||||
<div class="col w-100px"><?php echo html::input('scheduleTime', '2:00', "class='form-control form-time time-only' min='1'");?></div>
|
||||
<div class="col w-120px"><?php echo $lang->integration->exec;?>。 </div>
|
||||
</div>
|
||||
</td>
|
||||
<th><?php echo $lang->integration->scheduleDay; ?></th>
|
||||
<td colspan="3"><?php echo html::checkbox('scheduleDay', $lang->datepicker->dayNames, '', '', 'inline');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
|
||||
@@ -57,18 +57,8 @@
|
||||
<td colspan="3"><?php echo $lang->integration->commitEx; ?></td>
|
||||
</tr>
|
||||
<tr class="custom-fields">
|
||||
<th><?php echo $lang->integration->custom; ?></th>
|
||||
<td colspan="3">
|
||||
<div class="row text-with-input">
|
||||
<div class="col w-50px"><?php echo $lang->integration->scheduleInterval;?></div>
|
||||
<div class="col w-100px"><?php echo html::number('scheduleInterval', $job->scheduleInterval, "class='form-control'");?></div>
|
||||
<div class="col w-40px"><?php echo $lang->integration->day; ?>, </div>
|
||||
<div class="col <?php echo $this->app->getClientLang() == 'en' ? 'w-100px' : '2-30px'; ?>"><?php echo $lang->integration->at;?></div>
|
||||
<div class="col w-150px"><?php echo html::select('scheduleDay', $lang->integration->dayTypeList, $job->scheduleDay,"class='form-control chosen'");?></div>
|
||||
<div class="col w-100px"><?php echo html::input('scheduleTime', $job->scheduleTime, "class='form-control form-time time-only' min='1'");?></div>
|
||||
<div class="col w-120px"><?php echo $lang->integration->exec; ?>.</div>
|
||||
</div>
|
||||
</td>
|
||||
<th><?php echo $lang->integration->scheduleDay;?></th>
|
||||
<td colspan="3"><?php echo html::checkbox('scheduleDay', $lang->datepicker->dayNames, $job->scheduleDay, '', 'inline');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
@@ -76,7 +66,6 @@
|
||||
<?php echo html::submitButton(); ?>
|
||||
<?php echo html::backButton(); ?>
|
||||
<?php echo html::hidden('repoType', zget($repoTypes, $job->repo, 'Git'));?>
|
||||
|
||||
<?php echo html::commonButton($lang->integration->execNow, "onclick=execJob($job->id) data-tip-class='tooltip-success'", "btn btn-info exe-job-button");?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$config->jenkins->create = new stdclass();
|
||||
$config->jenkins->edit = new stdclass();
|
||||
$config->jenkins->create->requiredFields = 'name,serviceUrl,credentials';
|
||||
$config->jenkins->edit = new stdclass();
|
||||
$config->jenkins->edit->requiredFields = 'name,serviceUrl,credentials';
|
||||
$config->jenkins->edit->requiredFields = 'name,serviceUrl,credentials';
|
||||
|
||||
@@ -20,16 +20,7 @@ class jenkins extends control
|
||||
public function __construct($moduleName = '', $methodName = '')
|
||||
{
|
||||
parent::__construct($moduleName, $methodName);
|
||||
|
||||
$repoID = $this->session->repoID;
|
||||
foreach($this->lang->repo->menu as $key => $menu)
|
||||
{
|
||||
common::setMenuVars($this->lang->ci->menu, $key, $repoID);
|
||||
}
|
||||
|
||||
if(common::hasPriv('jenkins', 'create') and strpos(',browsejob,', $this->methodName) > -1) {
|
||||
$this->lang->modulePageActions = html::a(helper::createLink('jenkins', 'create'), "<i class='icon icon-plus'></i> " . $this->lang->jenkins->create, '', "class='btn btn-primary'");
|
||||
}
|
||||
$this->loadModel('ci')->setMenu();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,17 +35,18 @@ class jenkins extends control
|
||||
*/
|
||||
public function browse($orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
if(common::hasPriv('jenkins', 'create')) $this->lang->modulePageActions = html::a(helper::createLink('jenkins', 'create'), "<i class='icon icon-plus'></i> " . $this->lang->jenkins->create, '', "class='btn btn-primary'");
|
||||
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$this->view->jenkinsList = $this->jenkins->listAll($orderBy, $pager);
|
||||
|
||||
$this->view->title = $this->lang->jenkins->common . $this->lang->colon . $this->lang->jenkins->browse;
|
||||
$this->view->position[] = $this->lang->jenkins->common;
|
||||
$this->view->position[] = $this->lang->jenkins->browse;
|
||||
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->jenkinsList = $this->jenkins->getList($orderBy, $pager);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->pager = $pager;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -118,11 +110,11 @@ class jenkins extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id)
|
||||
public function delete($id, $confim = 'no')
|
||||
{
|
||||
$this->jenkins->delete(TABLE_JENKINS, $id);
|
||||
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
if($confim != 'yes') die(js::confirm($this->lang->jenkins->confirmDelete, inlink('delete', "id=$id&confirm=yes")));
|
||||
|
||||
$this->send(array('result' => 'success'));
|
||||
$this->jenkins->delete(TABLE_JENKINS, $id);
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
$(function()
|
||||
{
|
||||
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
$(function()
|
||||
{
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
$(function()
|
||||
{
|
||||
});
|
||||
@@ -32,18 +32,16 @@ class jenkinsModel extends model
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param bool $decode
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function listAll($orderBy = 'id_desc', $pager = null, $decode = true)
|
||||
public function getList($orderBy = 'id_desc', $pager = null)
|
||||
{
|
||||
$jenkinsList = $this->dao->select('*')->from(TABLE_JENKINS)
|
||||
return $this->dao->select('*')->from(TABLE_JENKINS)
|
||||
->where('deleted')->eq('0')
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
return $jenkinsList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,46 +11,37 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php'; ?>
|
||||
<?php js::set('confirmDelete', $lang->jenkins->confirmDelete); ?>
|
||||
|
||||
<div id='mainContent' class='main-row'>
|
||||
<div class='main-col main-content'>
|
||||
<form class='main-table' id='ajaxForm' method='post'>
|
||||
<table id='jenkinsList' class='table has-sort-head table-fixed'>
|
||||
<thead>
|
||||
<tr>
|
||||
<?php $vars = "orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"; ?>
|
||||
<th class='w-60px'><?php common::printOrderLink('id', $orderBy, $vars, $lang->jenkins->id); ?></th>
|
||||
<th class='w-200px text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->jenkins->name); ?></th>
|
||||
<th class='text-left'><?php common::printOrderLink('serviceUrl', $orderBy, $vars, $lang->jenkins->serviceUrl); ?></th>
|
||||
<th class='w-100px c-actions-4'><?php echo $lang->actions; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($jenkinsList as $id => $jenkins): ?>
|
||||
<tr>
|
||||
<td class='text-center'><?php echo $id; ?></td>
|
||||
<td class='text' title='<?php echo $jenkins->name; ?>'><?php echo $jenkins->name; ?></td>
|
||||
<td class='text' title='<?php echo $jenkins->serviceUrl; ?>'><?php echo $jenkins->serviceUrl; ?></td>
|
||||
|
||||
<td class='c-actions text-center'>
|
||||
<?php
|
||||
common::printIcon('jenkins', 'edit', "jenkinsID=$id", '', 'list', 'edit');
|
||||
if (common::hasPriv('jenkins', 'delete'))
|
||||
{
|
||||
$deleteURL = $this->createLink('jenkins', 'delete', "jenkinsID=$id&confirm=yes");
|
||||
echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"jenkinsList\", confirmDelete)", '<i class="icon-trash"></i>', '', "title='{$lang->jenkins->delete}' class='btn'");
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if ($jenkinsList): ?>
|
||||
<div class='table-footer'><?php $pager->show('rignt', 'pagerjs'); ?></div>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
<form class='main-table' id='ajaxForm' method='post'>
|
||||
<table id='jenkinsList' class='table has-sort-head table-fixed'>
|
||||
<thead>
|
||||
<tr>
|
||||
<?php $vars = "orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"; ?>
|
||||
<th class='w-60px'><?php common::printOrderLink('id', $orderBy, $vars, $lang->jenkins->id); ?></th>
|
||||
<th class='w-200px text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->jenkins->name); ?></th>
|
||||
<th class='text-left'><?php common::printOrderLink('serviceUrl', $orderBy, $vars, $lang->jenkins->serviceUrl); ?></th>
|
||||
<th class='w-100px c-actions-4'><?php echo $lang->actions; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($jenkinsList as $id => $jenkins): ?>
|
||||
<tr>
|
||||
<td class='text-center'><?php echo $id; ?></td>
|
||||
<td class='text' title='<?php echo $jenkins->name; ?>'><?php echo $jenkins->name; ?></td>
|
||||
<td class='text' title='<?php echo $jenkins->serviceUrl; ?>'><?php echo $jenkins->serviceUrl; ?></td>
|
||||
<td class='c-actions text-left'>
|
||||
<?php
|
||||
common::printIcon('jenkins', 'edit', "jenkinsID=$id", '', 'list', 'edit');
|
||||
if(common::hasPriv('jenkins', 'delete')) echo html::a($this->createLink('jenkins', 'delete', "jenkinsID=$id"), '<i class="icon-trash"></i>', '', "title='{$lang->jenkins->delete}' class='btn'");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if($jenkinsList):?>
|
||||
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php'; ?>
|
||||
|
||||
@@ -11,53 +11,48 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php'; ?>
|
||||
|
||||
<div id='mainContent' class='main-row'>
|
||||
<div class='main-col main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $lang->jenkins->create; ?></h2>
|
||||
</div>
|
||||
<form id='jenkinsForm' method='post' class='form-ajax'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->name; ?></th>
|
||||
<td class='required'><?php echo html::input('name', '', "class='form-control'"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->serviceUrl; ?></th>
|
||||
<td class='required'><?php echo html::input('serviceUrl', '', "class='form-control'"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->account;?></th>
|
||||
<td><?php echo html::input('account', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->token;?></th>
|
||||
<td><?php echo html::input('token', '', "class='form-control'");?></td>
|
||||
<td><?php echo $lang->jenkins->tokenFirst;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->password;?></th>
|
||||
<td>
|
||||
<?php echo html::password('password', '', "class='form-control'");?>
|
||||
</td>
|
||||
<td><?php echo $lang->jenkins->tips;?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th></th>
|
||||
<td class='text-center form-actions'>
|
||||
<?php echo html::submitButton(); ?>
|
||||
<?php echo html::backButton(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class='main-col main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $lang->jenkins->create; ?></h2>
|
||||
</div>
|
||||
<form id='jenkinsForm' method='post' class='form-ajax'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->name; ?></th>
|
||||
<td class='required'><?php echo html::input('name', '', "class='form-control'"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->serviceUrl; ?></th>
|
||||
<td class='required'><?php echo html::input('serviceUrl', '', "class='form-control'"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->account;?></th>
|
||||
<td><?php echo html::input('account', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->token;?></th>
|
||||
<td><?php echo html::input('token', '', "class='form-control'");?></td>
|
||||
<td><?php echo $lang->jenkins->tokenFirst;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->password;?></th>
|
||||
<td><?php echo html::password('password', '', "class='form-control'");?></td>
|
||||
<td><?php echo $lang->jenkins->tips;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td class='text-center form-actions'>
|
||||
<?php echo html::submitButton(); ?>
|
||||
<?php echo html::backButton(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include '../../common/view/footer.html.php'; ?>
|
||||
|
||||
@@ -11,55 +11,52 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php'; ?>
|
||||
|
||||
<div id='mainContent' class='main-row'>
|
||||
<div class='main-col main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $lang->jenkins->edit; ?></h2>
|
||||
</div>
|
||||
<form id='jenkinsForm' method='post' class='form-ajax'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='thWidth'></th>
|
||||
<td colspan="2"><?php echo $lang->jenkins->tips; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->name; ?></th>
|
||||
<td class='required'><?php echo html::input('name', $jenkins->name, "class='form-control'"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->serviceUrl; ?></th>
|
||||
<td class='required'><?php echo html::input('serviceUrl', $jenkins->serviceUrl, "class='form-control'"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->account;?></th>
|
||||
<td><?php echo html::input('account', $jenkins->account, "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->token;?></th>
|
||||
<td><?php echo html::input('token', $jenkins->token, "class='form-control'");?></td>
|
||||
<td><?php echo $lang->jenkins->tokenFirst;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->password;?></th>
|
||||
<td><?php echo html::password('password', $jenkins->password, "class='form-control'");?></td>
|
||||
<td><?php echo $lang->jenkins->tips;?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th></th>
|
||||
<td class='text-center form-actions'>
|
||||
<?php echo html::submitButton(); ?>
|
||||
<?php echo html::backButton() ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class='main-col main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $lang->jenkins->edit; ?></h2>
|
||||
</div>
|
||||
<form id='jenkinsForm' method='post' class='form-ajax'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='thWidth'></th>
|
||||
<td colspan="2"><?php echo $lang->jenkins->tips; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->name; ?></th>
|
||||
<td class='required'><?php echo html::input('name', $jenkins->name, "class='form-control'"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->serviceUrl; ?></th>
|
||||
<td class='required'><?php echo html::input('serviceUrl', $jenkins->serviceUrl, "class='form-control'"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->account;?></th>
|
||||
<td><?php echo html::input('account', $jenkins->account, "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->token;?></th>
|
||||
<td><?php echo html::input('token', $jenkins->token, "class='form-control'");?></td>
|
||||
<td><?php echo $lang->jenkins->tokenFirst;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->jenkins->password;?></th>
|
||||
<td><?php echo html::password('password', $jenkins->password, "class='form-control'");?></td>
|
||||
<td><?php echo $lang->jenkins->tips;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td class='text-center form-actions'>
|
||||
<?php echo html::submitButton(); ?>
|
||||
<?php echo html::backButton() ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php'; ?>
|
||||
|
||||
Reference in New Issue
Block a user