Merge branch 'master' of https://github.com/easysoft/zentaopms
This commit is contained in:
@@ -106,6 +106,11 @@ class bugModel extends model
|
||||
*/
|
||||
public function create($from = '')
|
||||
{
|
||||
/* Delete template HTML tags, line breaks and spaces and tags in the steps. */
|
||||
$stepTemplate = strip_tags($this->lang->bug->tplStep . $this->lang->bug->tplResult . $this->lang->bug->tplExpect);
|
||||
$steps = strip_tags(preg_replace("/\s/", "", $this->post->steps));
|
||||
$steps = str_replace(" ", "", $steps);
|
||||
|
||||
$now = helper::now();
|
||||
$bug = fixer::input('post')
|
||||
->setDefault('PRJ', $this->session->PRJ)
|
||||
@@ -118,6 +123,7 @@ class bugModel extends model
|
||||
->setIF($this->post->assignedTo != '', 'assignedDate', $now)
|
||||
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
|
||||
->setIF(strpos($this->config->bug->create->requiredFields, 'project') !== false, 'project', $this->post->project)
|
||||
->setIF($steps == $stepTemplate, 'steps', '')
|
||||
->stripTags($this->config->bug->editor->create['id'], $this->config->allowedTags)
|
||||
->cleanInt('product,project,module,severity')
|
||||
->join('openedBuild', ',')
|
||||
|
||||
@@ -52,7 +52,7 @@ js::set('oldResolvedBuild' , $bug->resolvedBuild);
|
||||
</div>
|
||||
<div class='detail'>
|
||||
<div class='detail-title'><?php echo $lang->bug->legendSteps;?></div>
|
||||
<div class='detail-content article-content'>
|
||||
<div class='detail-content'>
|
||||
<?php echo html::textarea('steps', htmlspecialchars($bug->steps), "rows='12' class='form-control kindeditor' hidefocus='true'");?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -47,7 +47,7 @@ $lang->misc->zentao->cowin['feedback'] = "Feedback";
|
||||
$lang->misc->zentao->cowin['translate'] = "Translate";
|
||||
$lang->misc->zentao->cowin['recommend'] = "More";
|
||||
|
||||
$lang->misc->zentao->service['zentaotrain']= 'Zentao Training';
|
||||
|
||||
$lang->misc->zentao->service['idc'] = 'Zentao Cloud';
|
||||
$lang->misc->zentao->service['custom'] = 'Zentao Custom';
|
||||
$lang->misc->zentao->service['servicemore']= 'Mehr';
|
||||
|
||||
@@ -47,7 +47,7 @@ $lang->misc->zentao->cowin['feedback'] = "Feedback";
|
||||
$lang->misc->zentao->cowin['translate'] = "Translate";
|
||||
$lang->misc->zentao->cowin['recommend'] = "More";
|
||||
|
||||
$lang->misc->zentao->service['zentaotrain']= 'ZenTao Training';
|
||||
|
||||
$lang->misc->zentao->service['idc'] = 'ZenTao Cloud';
|
||||
$lang->misc->zentao->service['custom'] = 'ZenTao Custom';
|
||||
$lang->misc->zentao->service['servicemore']= 'More';
|
||||
|
||||
@@ -47,7 +47,7 @@ $lang->misc->zentao->cowin['feedback'] = "Feedback";
|
||||
$lang->misc->zentao->cowin['translate'] = "Traduire";
|
||||
$lang->misc->zentao->cowin['recommend'] = "Plus...";
|
||||
|
||||
$lang->misc->zentao->service['zentaotrain']= 'Zentao Train';
|
||||
|
||||
$lang->misc->zentao->service['idc'] = 'Zentao Cloud';
|
||||
$lang->misc->zentao->service['custom'] = 'Zentao Custom';
|
||||
$lang->misc->zentao->service['servicemore']= 'Plus...';
|
||||
|
||||
@@ -47,7 +47,7 @@ $lang->misc->zentao->cowin['feedback'] = "Feedback";
|
||||
$lang->misc->zentao->cowin['translate'] = "Translate";
|
||||
$lang->misc->zentao->cowin['recommend'] = "More";
|
||||
|
||||
$lang->misc->zentao->service['zentaotrain'] = 'Zentao Training';
|
||||
|
||||
$lang->misc->zentao->service['idc'] = 'Zentao Cloud';
|
||||
$lang->misc->zentao->service['custom'] = 'Zentao Custom';
|
||||
$lang->misc->zentao->service['servicemore'] = 'Thêm';
|
||||
|
||||
@@ -729,6 +729,7 @@ class program extends control
|
||||
public function PRJBrowse($programID = 0, $browseType = 'doing', $param = 0, $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1)
|
||||
{
|
||||
$this->lang->navGroup->program = 'project';
|
||||
$this->app->session->set('PRJBrowse', $this->app->getURI(true));
|
||||
|
||||
/* Load pager and get tasks. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
@@ -806,7 +807,7 @@ class program extends control
|
||||
{
|
||||
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('PGMBrowse')));
|
||||
}
|
||||
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('PRJBrowse', array('programID' => $programID, 'browseType' => 'doing'))));
|
||||
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('PRJBrowse', array('programID' => $programID, 'browseType' => 'all'))));
|
||||
}
|
||||
|
||||
$name = '';
|
||||
@@ -859,22 +860,22 @@ class program extends control
|
||||
public function PRJEdit($projectID = 0)
|
||||
{
|
||||
$this->lang->navGroup->program = 'project';
|
||||
$project = $this->program->getPRJByID($projectID);
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$changes = $this->program->update($projectID);
|
||||
$changes = $this->program->PRJUpdate($projectID);
|
||||
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => $this->processErrors(dao::getError())));
|
||||
if($changes)
|
||||
{
|
||||
$actionID = $this->loadModel('action')->create('program', $projectID, 'edited');
|
||||
$actionID = $this->loadModel('action')->create('project', $projectID, 'edited');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
|
||||
$url = $this->session->PRJList ? $this->session->PRJList : inlink('browse');
|
||||
$url = $this->session->PRJBrowse ? $this->session->PRJBrowse : inLink('PRJBrowse');
|
||||
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $url));
|
||||
}
|
||||
|
||||
$project = $this->program->getPRJByID($projectID);
|
||||
$parents = $this->program->getParentPairs();
|
||||
unset($parents[$projectID]);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ $(function()
|
||||
if($(this).prop('checked'))
|
||||
{
|
||||
$('#end').val('').attr('disabled', 'disabled');
|
||||
$('#days').val('');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
$(function()
|
||||
{
|
||||
$('#longTime').change(function()
|
||||
{
|
||||
if($(this).prop('checked'))
|
||||
{
|
||||
$('#end').val('').attr('disabled', 'disabled');
|
||||
$('#days').val('');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#end').removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -81,6 +81,10 @@ $lang->program->templateList['waterfall'] = "瀑布";
|
||||
$lang->program->PRJCategoryList['single'] = "单产品项目";
|
||||
$lang->program->PRJCategoryList['multiple'] = "多产品项目";
|
||||
|
||||
$lang->program->PRJLifeTimeList['short'] = "短期";
|
||||
$lang->program->PRJLifeTimeList['long'] = "长期";
|
||||
$lang->program->PRJLifeTimeList['ops'] = "运维";
|
||||
|
||||
$lang->program->featureBar['all'] = '所有';
|
||||
$lang->program->featureBar['doing'] = '进行中';
|
||||
$lang->program->featureBar['wait'] = '未开始';
|
||||
|
||||
+85
-31
@@ -766,10 +766,9 @@ class programModel extends model
|
||||
*/
|
||||
public function printPRJCommonAction()
|
||||
{
|
||||
$output = "<div class='btn-group' id='pgmCommonAction'><button data-toggle='dropdown' type='button' class='btn btn-limit' id='currentItem' title='{$this->lang->program->common}'>{$this->lang->program->common} <i class='icon icon-sort-down'></i></button>";
|
||||
$output = "<div class='btn-group' id='pgmCommonAction'><button data-toggle='dropdown' type='button' class='btn btn-limit' id='currentItem' title='{$this->lang->program->PRJAll}'>{$this->lang->program->PRJAll} <i class='icon icon-sort-down'></i></button>";
|
||||
$output .= '<ul class="dropdown-menu">';
|
||||
$output .= '<li>' . html::a(helper::createLink('program', 'index'), "<i class='icon icon-home'></i> " . $this->lang->program->PRJHome) . '</li>';
|
||||
$output .= '<li>' . html::a(helper::createLink('program', 'prjbrowse'), "<i class='icon icon-cards-view'></i> " . $this->lang->program->PRJBrowse) . '</li>';
|
||||
$output .= '<li>' . html::a(helper::createLink('program', 'prjbrowse'), "<i class='icon icon-cards-view'></i> " . $this->lang->program->PRJAll) . '</li>';
|
||||
$output .= '<li>' . html::a(helper::createLink('program', 'prjcreate'), "<i class='icon icon-plus'></i> " . $this->lang->program->PRJCreate) . '</li>';
|
||||
$output .= '</ul>';
|
||||
$output .= "</div>";
|
||||
@@ -795,7 +794,6 @@ class programModel extends model
|
||||
$currentProjectName = $this->lang->program->common;
|
||||
if($projectID)
|
||||
{
|
||||
setCookie("lastproject", $projectID, $this->config->cookieLife, $this->config->webRoot, '', false, true);
|
||||
$currentProject = $this->project->getById($projectID);
|
||||
$currentProjectName = $currentProject->name;
|
||||
}
|
||||
@@ -1044,7 +1042,11 @@ class programModel extends model
|
||||
*/
|
||||
public function getPRJByID($projectID)
|
||||
{
|
||||
return $this->dao->findById($projectID)->from(TABLE_PROJECT)->fetch();
|
||||
if(!$projectID) return false;
|
||||
|
||||
$project = $this->dao->findById($projectID)->from(TABLE_PROJECT)->fetch();
|
||||
if($project->end == '0000-00-00') $project->end = '';
|
||||
return $project;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1182,7 +1184,8 @@ class programModel extends model
|
||||
$project = fixer::input('post')
|
||||
->setDefault('status', 'wait')
|
||||
->add('type', 'project')
|
||||
->add('lifetime', 'short')
|
||||
->setIF($this->post->longTime == 1, 'end', '')
|
||||
->setIF($this->post->longTime == 1, 'days', 0)
|
||||
->setIF($this->post->acl != 'custom', 'whitelist', '')
|
||||
->setDefault('openedBy', $this->app->user->account)
|
||||
->setDefault('end', '')
|
||||
@@ -1191,11 +1194,12 @@ class programModel extends model
|
||||
->join('whitelist', ',')
|
||||
->cleanInt('budget')
|
||||
->stripTags($this->config->program->editor->prjcreate['id'], $this->config->allowedTags)
|
||||
->remove('longTime')
|
||||
->get();
|
||||
|
||||
if($project->parent)
|
||||
{
|
||||
$parentProgram = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($project->parent)->fetch();
|
||||
$parentProgram = $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($project->parent)->fetch();
|
||||
if($parentProgram)
|
||||
{
|
||||
/* Child project begin cannot less than parent. */
|
||||
@@ -1208,10 +1212,13 @@ class programModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
$requiredFields = $this->config->program->PRJCreate->requiredFields;
|
||||
if($this->post->longTime) $requiredFields = trim(str_replace(',end,', ',', ",{$requiredFields},"), ',');
|
||||
|
||||
$project = $this->loadModel('file')->processImgURL($project, $this->config->program->editor->prjcreate['id'], $this->post->uid);
|
||||
$this->dao->insert(TABLE_PROJECT)->data($project)
|
||||
->autoCheck()
|
||||
->batchcheck($this->config->program->PRJCreate->requiredFields, 'notempty')
|
||||
->batchcheck($requiredFields, 'notempty')
|
||||
->check('name', 'unique', "deleted='0'")
|
||||
->check('code', 'unique', "deleted='0'")
|
||||
->exec();
|
||||
@@ -1244,33 +1251,80 @@ class programModel extends model
|
||||
{
|
||||
$PRJAdminID = $this->dao->select('id')->from(TABLE_GROUP)->where('role')->eq('PRJadmin')->fetch('id');
|
||||
$groupPriv = new stdclass();
|
||||
$groupPriv->account = $this->app->user->account;
|
||||
$groupPriv->group = $PRJAdminID;
|
||||
$groupPriv->PRJ = $projectID;
|
||||
$groupPriv->account = $this->app->user->account;
|
||||
$groupPriv->group = $PRJAdminID;
|
||||
$groupPriv->PRJ = $projectID;
|
||||
$this->dao->insert(TABLE_USERGROUP)->data($groupPriv)->exec();
|
||||
}
|
||||
|
||||
if($project->model == 'waterfall')
|
||||
{
|
||||
$product = new stdclass();
|
||||
$product->name = $project->name;
|
||||
$product->PRJ = $projectID;
|
||||
$product->status = 'normal';
|
||||
$product->createdBy = $this->app->user->account;
|
||||
$product->createdDate = helper::now();
|
||||
|
||||
$this->dao->insert(TABLE_PRODUCT)->data($product)->exec();
|
||||
|
||||
$productID = $this->dao->lastInsertId();
|
||||
$this->dao->update(TABLE_PRODUCT)->set('`order`')->eq($productID * 5)->where('id')->eq($productID)->exec();
|
||||
|
||||
$data = new stdclass();
|
||||
$data->project = $projectID;
|
||||
$data->product = $productID;
|
||||
$this->dao->insert(TABLE_PROJECTPRODUCT)->data($data)->exec();
|
||||
}
|
||||
|
||||
return $projectID;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update project.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function PRJUpdate($projectID = 0)
|
||||
{
|
||||
$oldProject = $this->dao->findById($projectID)->from(TABLE_PROJECT)->fetch();
|
||||
|
||||
$project = fixer::input('post')
|
||||
->setDefault('team', substr($this->post->name, 0, 30))
|
||||
->setIF($this->post->longTime == 1, 'end', '')
|
||||
->setIF($this->post->longTime == 1, 'days', 0)
|
||||
->setIF($this->post->begin == '0000-00-00', 'begin', '')
|
||||
->setIF($this->post->end == '0000-00-00', 'end', '')
|
||||
->join('whitelist', ',')
|
||||
->stripTags($this->config->program->editor->prjedit['id'], $this->config->allowedTags)
|
||||
->remove('longTime')
|
||||
->get();
|
||||
|
||||
if($project->parent)
|
||||
{
|
||||
$parentProgram = $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($project->parent)->fetch();
|
||||
|
||||
if($parentProgram)
|
||||
{
|
||||
/* Child project begin cannot less than parent. */
|
||||
if($project->begin < $parentProgram->begin) dao::$errors['begin'] = sprintf($this->lang->program->PRJBeginGreateChild, $parentProgram->begin);
|
||||
|
||||
/* When parent set end then child project end cannot greater than parent. */
|
||||
if($parentProgram->end != '0000-00-00' and $project->end > $parentProgram->end) dao::$errors['end'] = sprintf($this->lang->program->PRJEndLetterChild, $parentProgram->end);
|
||||
|
||||
if(dao::isError()) return false;
|
||||
}
|
||||
}
|
||||
|
||||
$project = $this->loadModel('file')->processImgURL($project, $this->config->program->editor->prjedit['id'], $this->post->uid);
|
||||
$requiredFields = $this->config->program->PRJEdit->requiredFields;
|
||||
if($this->post->longTime) $requiredFields = trim(str_replace(',end,', ',', ",{$requiredFields},"), ',');
|
||||
|
||||
$this->dao->update(TABLE_PROJECT)->data($project)
|
||||
->autoCheck($skipFields = 'begin,end')
|
||||
->batchcheck($requiredFields, 'notempty')
|
||||
->checkIF($project->begin != '', 'begin', 'date')
|
||||
->checkIF($project->end != '', 'end', 'date')
|
||||
->checkIF($project->end != '', 'end', 'gt', $project->begin)
|
||||
->check('name', 'unique', "id!=$projectID and deleted='0'")
|
||||
->check('code', 'unique', "id!=$projectID and deleted='0'")
|
||||
->where('id')->eq($projectID)
|
||||
->exec();
|
||||
|
||||
if(!dao::isError())
|
||||
{
|
||||
$this->file->updateObjectID($this->post->uid, $projectID, 'project');
|
||||
if($project->acl != 'open' and ($project->acl != $oldProject->acl or $project->whitelist != $oldProject->whitelist))
|
||||
{
|
||||
$this->loadModel('user')->updateUserView($projectID, 'project');
|
||||
}
|
||||
|
||||
if($oldProject->parent != $project->parent) $this->processNode($projectID, $project->parent, $oldProject->path, $oldProject->grade);
|
||||
|
||||
return common::createChanges($oldProject, $project);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<?php js::set('template', $template);?>
|
||||
<?php js::set('programID', $programID);?>
|
||||
<?php js::set('from', $from);?>
|
||||
<?php js::set('weekend', $config->project->weekend);?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
@@ -43,6 +44,12 @@
|
||||
<th><?php echo $lang->program->PRJCode;?></th>
|
||||
<td><?php echo html::input('code', $code, "class='form-control' required");?></td><td></td><td></td>
|
||||
</tr>
|
||||
<?php if($template == 'scrum'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->program->PRJCategory;?></th>
|
||||
<td><?php echo html::select('lifetime', $lang->program->PRJLifeTimeList, '', "class='form-control'");?></td><td></td><td></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php if($template == 'waterfall'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->program->PRJCategory;?></th>
|
||||
@@ -96,13 +103,6 @@
|
||||
<th><?php echo $lang->project->teamname;?></th>
|
||||
<td><?php echo html::input('team', $team, "class='form-control'");?></td><td></td><td></td>
|
||||
</tr>
|
||||
<tr class='hide'>
|
||||
<th><?php echo $lang->project->status;?></th>
|
||||
<td><?php echo html::hidden('status', 'wait');?></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php $this->printExtendFields('', 'table');?>
|
||||
<tr>
|
||||
<th><?php echo $lang->program->PRJDesc;?></th>
|
||||
@@ -113,7 +113,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->program->auth;?></th>
|
||||
<td colspan='3'><?php echo html::radio('privway', $lang->program->PRJAuthList, $privway, '', 'block');?></td>
|
||||
<td colspan='3'><?php echo html::radio('auth', $lang->program->PRJAuthList, $privway, '', 'block');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->project->acl;?></th>
|
||||
|
||||
@@ -38,6 +38,12 @@
|
||||
<th><?php echo $lang->program->PRJCode;?></th>
|
||||
<td><?php echo html::input('code', $project->code, "class='form-control' required");?></td><td></td><td></td>
|
||||
</tr>
|
||||
<?php if($project->model == 'scrum'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->program->PRJCategory;?></th>
|
||||
<td><?php echo html::select('lifetime', $lang->program->PRJLifeTimeList, $project->lifetime, "class='form-control'");?></td><td></td><td></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php if($project->model == 'waterfall'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->program->PRJCategory;?></th>
|
||||
@@ -65,15 +71,16 @@
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('begin', $project->begin, "class='form-control form-date' onchange='computeWorkDays();' placeholder='" . $lang->program->begin . "' required");?>
|
||||
<span class='input-group-addon'><?php echo $lang->program->to;?></span>
|
||||
<?php echo html::input('end', $project->end, "class='form-control form-date' onchange='computeWorkDays();' placeholder='" . $lang->program->end . "' required");?>
|
||||
<?php if(empty($parentProgram) or $parentProgram->end == '0000-00-00'):?>
|
||||
<span class='input-group-addon hidden' id='longTimeBox'>
|
||||
<?php
|
||||
$disabledEnd = empty($project->end) ? 'disabled' : '';
|
||||
echo html::input('end', $project->end, "class='form-control form-date' onchange='computeWorkDays();' $disabledEnd placeholder='" . $lang->program->end . "' required");
|
||||
?>
|
||||
<span class='input-group-addon' id='longTimeBox'>
|
||||
<div class="checkbox-primary">
|
||||
<input type="checkbox" name="longTime" value="1" id="longTime">
|
||||
<label for="longTime"><?php echo $lang->program->longTime;?></label>
|
||||
<input type="checkbox" name="longTime" value="1" <?php echo empty($project->end) ? 'checked' : '';?> id="longTime">
|
||||
<label for="longTime"><?php echo $lang->program->PRJLongTime;?></label>
|
||||
</div>
|
||||
</span>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</td>
|
||||
<td class='muted'></td>
|
||||
@@ -86,7 +93,9 @@
|
||||
<?php echo html::input('days', '', "class='form-control'");?>
|
||||
<span class='input-group-addon'><?php echo $lang->project->day;?></span>
|
||||
</div>
|
||||
</td><td></td><td></td>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user