Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
xia0ta0
2014-03-06 17:33:31 +08:00
21 changed files with 128 additions and 36 deletions

View File

@@ -1 +1,2 @@
ALTER TABLE `zt_project` DROP `goal`;
ALTER TABLE `zt_build` ADD `packageType` varchar(10) COLLATE 'utf8_general_ci' NOT NULL DEFAULT 'path' AFTER `scmPath`;

View File

@@ -16,7 +16,7 @@
<table class='table-1'>
<caption><?php echo $bug->title;?></caption>
<tr>
<td class='rowhead'><?php echo $lang->comment;?></td>
<td class='rowhead v-middle'><?php echo $lang->comment;?></td>
<td><?php echo html::textarea('comment', '', "rows='6' class='w-p98'");?></td>
</tr>
<tr>

View File

@@ -85,10 +85,14 @@ class build extends control
{
$changes = $this->build->update($buildID);
if(dao::isError()) die(js::error(dao::getError()));
if($changes)
$files = $this->loadModel('file')->saveUpload('build', $buildID);
if($changes or $files)
{
$actionID = $this->loadModel('action')->create('build', $buildID, 'edited');
$this->action->logHistory($actionID, $changes);
$fileAction = '';
if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n" ;
$actionID = $this->loadModel('action')->create('build', $buildID, 'Edited', $fileAction);
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
}
die(js::locate(inlink('view', "buildID=$buildID"), 'parent'));
}

View File

@@ -1,4 +1,22 @@
$(document).ready(function()
{
$("a.preview").colorbox({width:1000, height:550, iframe:true, transition:'none', scrolling:true});
if(typeof(packageType) != 'undefined')
{
var hiddenDom = packageType == 'filePath' ? 'fileform' : 'filePath';
$('#' + hiddenDom).parents('tr').addClass('hidden');
}
$("input[name='packageType']").bind('click', function()
{
if($(this).val() == 'path')
{
$('#filePath').parents('tr').removeClass('hidden');
$('#fileform').parents('tr').addClass('hidden');
}
else
{
$('#filePath').parents('tr').addClass('hidden');
$('#fileform').parents('tr').removeClass('hidden');
}
})
})

View File

@@ -30,12 +30,17 @@ $lang->build->builder = 'Builder';
$lang->build->scmPath = 'Source code path';
$lang->build->filePath = 'Package file path';
$lang->build->desc = 'Desc';
$lang->build->files = 'Upload package';
$lang->build->last = 'Last build';
$lang->build->linkStoriesAndBugs = 'stories and bugs';
$lang->build->linkStories = 'Stories';
$lang->build->linkBugs = 'Bugs';
$lang->build->stories = 'Linked stories';
$lang->build->bugs = 'Linked bugs';
$lang->build->packageType = 'Package type';
$lang->build->finishStories = 'The total demand for a complete %s';
$lang->build->resolvedBugs = 'The total solution of bug%s';
$lang->build->packageTypeList['path'] = 'Shared file';
$lang->build->packageTypeList['file'] = 'Upload file';

View File

@@ -30,12 +30,17 @@ $lang->build->builder = '构建者';
$lang->build->scmPath = '源代码地址';
$lang->build->filePath = '存储地址';
$lang->build->desc = '描述';
$lang->build->files = '上传发行包';
$lang->build->last = '上个版本';
$lang->build->linkStoriesAndBugs = '关联需求和Bug';
$lang->build->linkStories = '相关需求';
$lang->build->linkBugs = '相关Bug';
$lang->build->stories = '已关联需求';
$lang->build->bugs = '已关联Bug';
$lang->build->packageType = '发行包方式';
$lang->build->finishStories = '本次共完成需求%s个';
$lang->build->resolvedBugs = '本次共解决Bug%s个';
$lang->build->packageTypeList['path'] = '文件共享';
$lang->build->packageTypeList['file'] = '上传附件';

View File

@@ -30,7 +30,9 @@ class buildModel extends model
->where('t1.id')->eq((int)$buildID)
->fetch();
if(!$build) return false;
if($setImgSize) $build->desc = $this->loadModel('file')->setImgSize($build->desc);
$build->files = $this->loadModel('file')->getByObject('build', $buildID);
if($setImgSize) $build->desc = $this->file->setImgSize($build->desc);
return $build;
}
@@ -154,11 +156,17 @@ class buildModel extends model
->setDefault('product', 0)
->join('stories', ',')
->join('bugs', ',')
->add('project', (int)$projectID)->remove('resolvedBy,allchecker')->get();
->add('project', (int)$projectID)
->remove('resolvedBy,allchecker,files,labels')
->get();
if($build->packageType == 'path') unset($_FILES);
$this->dao->insert(TABLE_BUILD)->data($build)->autoCheck()->batchCheck($this->config->build->create->requiredFields, 'notempty')->check('name', 'unique', "product = {$build->product}")->exec();
if(!dao::isError())
{
$buildID = $this->dao->lastInsertID();
$this->loadModel('file')->saveUpload('build', $buildID);
$this->updateLinkedBug($build);
return $buildID;
}
@@ -180,8 +188,11 @@ class buildModel extends model
->setDefault('bugs', '')
->join('stories', ',')
->join('bugs', ',')
->remove('allchecker,resolvedBy')
->remove('allchecker,resolvedBy,files,labels')
->get();
if($build->packageType == 'path') unset($_FILES);
$this->dao->update(TABLE_BUILD)->data($build)
->autoCheck()
->batchCheck($this->config->build->edit->requiredFields, 'notempty')

View File

@@ -13,7 +13,7 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<form method='post' target='hiddenwin' id='dataform'>
<form method='post' target='hiddenwin' id='dataform' enctype='multipart/form-data'>
<table class='table-1 fixed'>
<caption><?php echo $lang->build->create;?></caption>
<tr>
@@ -39,10 +39,18 @@
<th class='rowhead'><?php echo $lang->build->scmPath;?></th>
<td><?php echo html::input('scmPath', '', "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->packageType;?></th>
<td><?php echo html::radio('packageType', $lang->build->packageTypeList, 'path');?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->filePath;?></th>
<td><?php echo html::input('filePath', '', "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->files;?></th>
<td><?php echo $this->fetch('file', 'buildForm', array('fileCount' => 1));?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->linkStoriesAndBugs;?></th>
<td>
@@ -110,4 +118,5 @@
<tr><td colspan='2' class='a-center'><?php echo html::submitButton() . html::backButton();?></td></tr>
</table>
</form>
<?php js::set('packageType', 'filePath')?>
<?php include '../../common/view/footer.html.php';?>

View File

@@ -13,7 +13,7 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<form method='post' target='hiddenwin' id='dataform'>
<form method='post' target='hiddenwin' id='dataform' enctype='multipart/form-data'>
<table class='table-1'>
<caption><?php echo $lang->build->edit;?></caption>
<tr>
@@ -36,10 +36,18 @@
<th class='rowhead'><?php echo $lang->build->scmPath;?></th>
<td><?php echo html::input('scmPath', $build->scmPath, "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->packageType;?></th>
<td><?php echo html::radio('packageType', $lang->build->packageTypeList, $build->packageType);?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->filePath;?></th>
<td><?php echo html::input('filePath', $build->filePath, "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->files;?></th>
<td><?php echo $this->fetch('file', 'buildForm', array('fileCount' => 1));?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->linkStoriesAndBugs;?></th>
<td>
@@ -121,9 +129,10 @@
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->desc;?></th>
<td><?php echo html::textarea('desc', $build->desc, "rows='15' class='area-1'");?></td>
<td><?php echo html::textarea('desc', $build->desc, "rows='10' class='area-1'");?></td>
</tr>
<tr><td colspan='2' class='a-center'><?php echo html::submitButton() . html::backButton() .html::hidden('project', $build->project);?></td></tr>
</table>
</form>
<?php js::set('packageType', $build->packageType == 'file' ? 'fileform' : 'filePath')?>
<?php include '../../common/view/footer.html.php';?>

View File

@@ -19,6 +19,7 @@
<legend><?php echo $lang->build->desc;?></legend>
<div class='content'><?php echo $build->desc;?></div>
</fieldset>
<?php echo $this->fetch('file', 'printFiles', array('files' => $build->files, 'fieldset' => 'true'));?>
<?php include '../../common/view/action.html.php';?>
<div class='a-center f-16px strong mb-10px'>
<?php

View File

@@ -370,6 +370,10 @@ class installModel extends model
{
$table = str_replace('--', '', $table);
}
/* Skip sql that is note. */
if(strpos($table, '--') === 0) continue;
$table = str_replace('`zt_', $this->config->db->name . '.`zt_', $table);
$table = str_replace('zt_', $this->config->db->prefix, $table);
if(!$this->dbh->query($table)) return false;

View File

@@ -88,10 +88,13 @@ class release extends control
{
$changes = $this->release->update($releaseID);
if(dao::isError()) die(js::error(dao::getError()));
if($changes)
$files = $this->loadModel('file')->saveUpload('release', $releaseID);
if($changes or $files)
{
$actionID = $this->loadModel('action')->create('release', $releaseID, 'edited');
$this->action->logHistory($actionID, $changes);
$fileAction = '';
if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n" ;
$actionID = $this->loadModel('action')->create('release', $releaseID, 'Edited', $fileAction);
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
}
die(js::locate(inlink('view', "releaseID=$releaseID"), 'parent'));
}

View File

@@ -30,7 +30,10 @@ class releaseModel extends model
->where('t1.id')->eq((int)$releaseID)
->orderBy('t1.id DESC')
->fetch();
if($setImgSize) $release->desc = $this->loadModel('file')->setImgSize($release->desc);
if(!$release) return false;
$release->files = $this->loadModel('file')->getByObject('release', $releaseID);
if($setImgSize) $release->desc = $this->file->setImgSize($release->desc);
return $release;
}
@@ -91,31 +94,38 @@ class releaseModel extends model
*/
public function create($productID)
{
if($this->post->build == false)
if($this->post->build == false)
{
$build = fixer::input('post')
->stripTags('name')
->add('product', (int)$productID)
->add('builder', $this->app->user->account)
->remove('build')
->remove('build,files,labels')
->get();
$this->dao->insert(TABLE_BUILD)->data($build)->autoCheck()->check('name','unique')->exec();
$buildID = $this->dao->lastInsertID();
}
$release = fixer::input('post')
->stripTags('name')
->add('product', (int)$productID)
->join('stories', ',')
->join('bugs', ',')
->setIF($this->post->build == false, 'build', $buildID)
->remove('allchecker')
->get();
$release = fixer::input('post')
->stripTags('name')
->add('product', (int)$productID)
->join('stories', ',')
->join('bugs', ',')
->setIF($this->post->build == false, 'build', $buildID)
->remove('allchecker,files,labels')
->get();
$this->dao->insert(TABLE_RELEASE)->data($release)->autoCheck()->batchCheck($this->config->release->create->requiredFields, 'notempty')->check('name','unique')->exec();
$releaseID = $this->dao->lastInsertID();
if($release->stories) $this->dao->update(TABLE_STORY)->set('stage')->eq('released')->where('id')->in($release->stories)->exec();
if(!dao::isError()) return $releaseID;
if(!dao::isError())
{
$releaseID = $this->dao->lastInsertID();
$this->loadModel('file')->saveUpload('release', $releaseID);
if($release->stories) $this->dao->update(TABLE_STORY)->set('stage')->eq('released')->where('id')->in($release->stories)->exec();
if(!dao::isError()) return $releaseID;
}
return false;
}
/**
@@ -134,6 +144,7 @@ class releaseModel extends model
->setDefault('bugs', '')
->join('stories', ',')
->join('bugs', ',')
->remove('files,labels')
->get();
$this->dao->update(TABLE_RELEASE)->data($release)
->autoCheck()

View File

@@ -13,7 +13,7 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<form method='post' target='hiddenwin' id='dataform'>
<form method='post' target='hiddenwin' id='dataform' enctype='multipart/form-data'>
<table class='table-1'>
<caption><?php echo $lang->release->create;?></caption>
<tr>
@@ -42,6 +42,10 @@
<th class='rowhead'><?php echo $lang->release->desc;?></th>
<td><?php echo html::textarea('desc', '', "rows='10' class='area-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->files;?></th>
<td class='a-left'><?php echo $this->fetch('file', 'buildform', array('fileCount' => 1));?></td>
</tr>
<tr><td colspan='2' class='a-center'><?php echo html::submitButton() . html::backButton();?></td></tr>
</table>
</form>

View File

@@ -13,7 +13,7 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<form method='post' target='hiddenwin' id='dataform'>
<form method='post' target='hiddenwin' id='dataform' enctype='multipart/form-data'>
<table class='table-1'>
<caption><?php echo $lang->release->edit;?></caption>
<tr>
@@ -106,7 +106,11 @@
</tr>
<tr>
<th class='rowhead'><?php echo $lang->release->desc;?></th>
<td><?php echo html::textarea('desc', $release->desc, "rows='20' class='area-1'");?></td>
<td><?php echo html::textarea('desc', $release->desc, "rows=10 class='area-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->files;?></th>
<td class='a-left'><?php echo $this->fetch('file', 'buildform', array('fileCount' => 1));?></td>
</tr>
<tr>
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::backButton() . html::hidden('product', $release->product);?></td>

View File

@@ -19,6 +19,7 @@
<legend><?php echo $lang->release->desc;?></legend>
<div class='content'><?php echo $release->desc;?></div>
</fieldset>
<?php echo $this->fetch('file', 'printFiles', array('files' => $release->files, 'fieldset' => 'true'));?>
<?php include '../../common/view/action.html.php';?>
<div class='a-center f-16px pb-10px'>
<?php

View File

@@ -13,7 +13,7 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/colorize.html.php';?>
<form method='post' target='hiddenwin' action="<?php echo inLink('batchClose', "from=storyBatchClose")?>">
<table class='table-1 fixed colored'>
<table class='table-1 fixed'>
<caption><?php echo $lang->story->common . $lang->colon . $lang->story->batchClose;?></caption>
<tr>
<th class='w-30px'> <?php echo $lang->idAB;?></th>

View File

@@ -228,7 +228,7 @@ class task extends control
$fileAction = '';
if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n" ;
$actionID = $this->action->create('task', $taskID, $action, $fileAction . $this->post->comment);
$this->action->logHistory($actionID, $changes);
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
$this->sendmail($taskID, $actionID);
}

View File

@@ -71,7 +71,7 @@ $lang->testcase->confirmStoryChange = '确认需求变动';
$lang->testcase->new = '新增';
$lang->testcase->num = '导入用例个数:';
$lang->testcase->num = '用例记录数:';
$lang->testcase->deleteStep = '删除';
$lang->testcase->insertBefore = '之前添加';

View File

@@ -69,7 +69,7 @@
<td>
<fieldset>
<legend><?php echo $lang->testcase->precondition;?></legend>
<?php echo $case->precondition;?>
<?php echo nl2br($case->precondition);?>
</fieldset>
<table class='table-1 colored'>
<tr class='colhead'>

View File

@@ -158,6 +158,7 @@ class upgradeModel extends model
case '5_0':
case '5_1':
case '5_2':
case '5_2_1': $confirmContent .= file_get_contents($this->getUpgradeFile('5.2.1'));
}
return str_replace('zt_', $this->config->db->prefix, $confirmContent);
}
@@ -612,13 +613,14 @@ class upgradeModel extends model
{
$line = trim($line);
$sqls[$key] = $line;
if(strpos($line, '--') !== false or empty($line)) unset($sqls[$key]);
/* Skip sql that is note. */
if(preg_match('/^--|^#|^\/\*/', $line) or empty($line)) unset($sqls[$key]);
}
$sqls = explode(';', join("\n", $sqls));
foreach($sqls as $sql)
{
$sql = trim($sql);
if(empty($sql)) continue;
if($mysqlVersion <= 4.1)