* Merge sql.

This commit is contained in:
Yagami
2020-12-16 16:52:37 +08:00
parent b8d97f2f2d
commit ae552beafa
16 changed files with 220 additions and 92 deletions
+1 -1
View File
@@ -196,7 +196,7 @@ $lang->subject = new stdclass();
$lang->subject->menu = new stdclass();
$lang->subject->menu->subject = array('link' => '科目|subject|browse|');
$lang->subject->menu->holiday = array('link' => '节假日|holiday|browse|');
$lang->subject->menu->concept = array('link' => '需求概念|custom|setstoryconcept|');
$lang->subject->menu->concept = array('link' => '需求概念|custom|browsestoryconcept|');
$lang->holiday = new stdclass();
$lang->holiday->menu = $lang->subject->menu;
+36 -3
View File
@@ -396,12 +396,12 @@ class custom extends control
}
/**
* Set story concept.
* Browse story concept.
*
* @access public
* @return void
*/
public function setStoryConcept()
public function browseStoryConcept()
{
/* Process menu.*/
$this->app->loadLang('custom');
@@ -411,13 +411,28 @@ class custom extends control
$key = array_search('custom', $this->lang->noMenuModule);
unset($this->lang->noMenuModule[$key]);
$this->view->title = $this->lang->custom->browseStoryConcept;
$this->view->position[] = $this->lang->custom->browseStoryConcept;
$this->view->URSRList = $this->custom->getURSRList();
$this->display();
}
/**
* Set story concept.
*
* @access public
* @return void
*/
public function setStoryConcept()
{
if($_POST)
{
$result = $this->custom->setURAndSR();
if(!$result) $this->send(array('result' => 'fail', 'message' => $this->lang->custom->notice->URSREmpty));
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('custom', 'setstoryconcept')));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
$this->view->title = $this->lang->custom->setStoryConcept;
@@ -426,6 +441,24 @@ class custom extends control
$this->display();
}
/**
* Delete story concept.
*
* @access public
* @return void
*/
public function deleteStoryConcept($key = 0)
{
$lang = $this->app->getClientLang();
$this->dao->delete()->from(TABLE_LANG)
->where('lang')->eq($lang)
->andWhere('section')->eq('URSRList')
->andWhere('`key`')->eq($key)
->exec();
die(js::reload('parent.parent'));
}
/**
* Configure scrum.
*
-15
View File
@@ -1,15 +0,0 @@
$(function()
{
$('[name^="URSRCustom"]').change(function()
{
if($(this).attr('checked'))
{
$('#customURSR').removeClass('hidden');
}
else
{
$('#customURSR').addClass('hidden');
}
})
})
+4 -3
View File
@@ -39,7 +39,11 @@ $lang->custom->epic = "史诗";
$lang->custom->scrumStory = "故事";
$lang->custom->waterfallCommon = "瀑布";
$lang->custom->setStoryConcept = "设置需求概念";
$lang->custom->browseStoryConcept = "需求概念列表";
$lang->custom->deleteStoryConcept = "删除需求概念";
$lang->custom->configureScrum = "敏捷模型自定义";
$lang->custom->URConcept = "用需概念";
$lang->custom->SRConcept = "软需概念";
$lang->custom->object['program'] = '项目';
$lang->custom->program->fields['unitList'] = '预算单位';
@@ -218,9 +222,6 @@ $lang->custom->conceptOptions->hourPoint['0'] = '故事点';
$lang->custom->conceptOptions->hourPoint['1'] = '功能点';
$lang->custom->conceptOptions->hourPoint['2'] = '代码行';
$lang->custom->waterfall = new stdclass();
$lang->custom->waterfall->URSRName = '默认需求概念组合';
$lang->custom->scrum = new stdclass();
$lang->custom->scrum->setConcept = '设置项目概念';
+59 -20
View File
@@ -468,6 +468,47 @@ class customModel extends model
return $fields;
}
/**
* Get UR and SR pairs.
*
* @access public
* @return void
*/
public function getURSRPairs()
{
$this->app->loadLang('custom');
$URSRPairs = array();
foreach($this->lang->custom->URSRList as $key => $content)
{
$content = json_decode($content);
$URSRPairs[$key] = $content->SRName . '/' . $content->URName;
}
return $URSRPairs;
}
/**
* Get UR and SR list.
*
* @access public
* @return void
*/
public function getURSRList()
{
$this->app->loadLang('custom');
$URSRList = array();
foreach($this->lang->custom->URSRList as $key => $content)
{
$content = json_decode($content);
$URSRList[$key]['SRName'] = $content->SRName;
$URSRList[$key]['URName'] = $content->URName;
}
return $URSRList;
}
/**
* Save required fields.
*
@@ -572,34 +613,32 @@ class customModel extends model
*/
public function setURAndSR()
{
$data = fixer::input('post')->get();
$lang = $this->app->getClientLang();
$data = fixer::input('post')->get();
$lang = $this->app->getClientLang();
$maxKey = $this->dao->select('max(`key`) as maxKey')->from(TABLE_LANG)
->where('section')->eq('URSRList')
->andWhere('module')->eq('custom')
->andWhere('lang')->eq($lang)
->fetch('maxKey');
$maxKey = $maxKey ? $maxKey : 1;
/* If has custom UR and SR name. */
$newKey = '';
if(isset($data->URSRCustom))
foreach($data->URName as $key => $URName)
{
if(!$data->URName || !$data->SRName) return false;
$SRName = zget($data->SRName, $key, '');
if(!$URName || !$SRName) continue;
$newKey = max(array_keys($this->lang->custom->URSRList)) + 1;
$URSRName = $data->URName . '/' . $data->SRName;
$URSRList = new stdclass();
$URSRList->SRName = $SRName;
$URSRList->URName = $URName;
/* Delete old lang data, and add new. */
$this->lang->custom->URSRList[$newKey] = $URSRName;
$this->lang->custom->URList[$newKey] = $data->URName;
$this->lang->custom->SRList[$newKey] = $data->SRName;
$this->deleteItems("lang=$lang&module=custom&section=URSRList");
$this->deleteItems("lang=$lang&module=custom&section=URList");
$this->deleteItems("lang=$lang&module=custom&section=SRList");
$value = json_encode($URSRList);
$maxKey += 1;
foreach($this->lang->custom->URSRList as $key => $value) $this->setItem("$lang.custom.URSRList.{$key}.1", $value);
foreach($this->lang->custom->URList as $key => $value) $this->setItem("$lang.custom.URList.{$key}.1", $value);
foreach($this->lang->custom->SRList as $key => $value) $this->setItem("$lang.custom.SRList.{$key}.1", $value);
$this->setItem("$lang.custom.URSRList.{$maxKey}.1", $value);
}
$URSRName = $newKey ? $newKey : $data->URSRCommon;
$this->loadModel('setting')->setItem("system.custom.URSRName", $URSRName);
return true;
}
@@ -0,0 +1,38 @@
<?php
/**
* The html template file of setstoryconcept method of user module of ZenTaoPMS.
*
* @copyright Copyright 2009-2020 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Guangming Sun<sunguangming@cnezsoft.com>
* @package ZenTaoPMS
* @version $Id: browsestoryconcept.html.php 4129 2020-09-01 01:58:14Z sgm $
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id='mainMenu' class='clearfix'>
<div class='pull-right'>
<?php if(common::hasPriv('custom', 'setstoryconcept')) echo html::a($this->createLink('custom', 'setstoryconcept', '', '', true), $lang->custom->setStoryConcept, '', "class='btn btn-primary iframe' data-toggle='modal'");?>
</div>
</div>
<div id='mainContent' class='main-row'>
<div class='main-col main-content main-table'>
<table class='table table-form mw-800px'>
<tr>
<th class='text-left'><?php echo $lang->custom->URConcept;?> </th>
<th class='text-left'><?php echo $lang->custom->SRConcept;?> </th>
<th class='w-60px text-left'><?php echo $lang->actions;?> </th>
</tr>
<?php foreach($URSRList as $key => $URSR):?>
<tr>
<td><?php echo $URSR['URName'];?></td>
<td><?php echo $URSR['SRName'];?></td>
<td class='c-actions'>
<?php if(common::hasPriv('custom', 'deleteStoryConcept')) echo html::a($this->createLink('custom', 'deleteStoryConcept', "id=$key"), "<i class='icon icon-trash'></i>", 'hiddenwin', 'class="btn"');?>
</td>
</tr>
<?php endforeach;?>
</table>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+46 -23
View File
@@ -9,30 +9,53 @@
* @version $Id: setstoryconcept.html.php 4129 2020-09-01 01:58:14Z sgm $
*/
?>
<?php
$itemRow = <<<EOT
<tr>
<td><input type='text' class="form-control" autocomplete="off" value="" name="URName[]"></td>
<td><input type='text' class="form-control" autocomplete="off" value="" name="SRName[]"></td>
<td class='c-actions'>
<a href="javascript:void(0)" class='btn btn-link' onclick="addItem(this)"><i class='icon-plus'></i></a>
<a href="javascript:void(0)" class='btn btn-link' onclick="delItem(this)"><i class='icon-close'></i></a>
</td>
</tr>
EOT;
?>
<?php js::set('itemRow', $itemRow);?>
<?php include '../../common/view/header.html.php';?>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<form class="load-indicator main-form form-ajax" method='post'>
<div class='modal-body'>
<table class='table table-form'>
<tr id='URSRName'>
<th class='w-120px'><?php echo $lang->custom->waterfall->URSRName;?></th>
<td><?php echo html::select('URSRCommon', $lang->custom->URSRList, zget($config->custom, 'URSRName', 1), "class='form-control chosen'");?></td>
<td><?php echo html::checkbox('URSRCustom', $lang->custom->common, "class='form-control'");?></td>
<td></td><td></td><td></td>
</tr>
<tr class='hidden' id='customURSR'>
<th></th>
<td><?php echo html::input('URName', '', "class='form-control' placeholder={$lang->custom->URTips}");?></td>
<td><?php echo html::input('SRName', '', "class='form-control' placeholder={$lang->custom->SRTips}");?></td>
</tr>
<tr>
<th></th>
<td class='text-left'><?php echo html::submitButton();?></td>
</tr>
</table>
</div>
</form>
</div>
<form class="load-indicator main-form form-ajax" method='post'>
<div class='modal-body'>
<table class='table table-form'>
<tr class='text-center'>
<td class='w-200px'><strong><?php echo $lang->custom->URConcept;?></strong></th>
<td class='w-200px'><strong><?php echo $lang->custom->SRConcept;?></strong></th>
<td></td><td></td>
</tr>
<tr>
<td><?php echo html::input('URName[]', '', "class='form-control'");?></td>
<td><?php echo html::input('SRName[]', '', "class='form-control'");?></td>
<td class='c-actions'>
<a href="javascript:void(0)" class='btn btn-link' onclick="addItem(this)"><i class='icon-plus'></i></a>
</td>
</tr>
<tr>
<th></th>
<td class='text-center' colspan='2'><?php echo html::submitButton();?></td>
</tr>
</table>
</div>
</form>
</div>
<script>
function addItem(clickedButton)
{
$(clickedButton).parent().parent().after(itemRow);
}
function delItem(clickedButton)
{
$(clickedButton).parent().parent().remove();
}
</script>
<?php include '../../common/view/footer.html.php';?>
+17 -13
View File
@@ -1144,18 +1144,20 @@ $lang->holiday->methodOrder[20] = 'delete';
/* Custom. */
$lang->resource->custom = new stdclass();
$lang->resource->custom->index = 'index';
$lang->resource->custom->set = 'set';
$lang->resource->custom->project = 'project';
$lang->resource->custom->product = 'product';
$lang->resource->custom->restore = 'restore';
$lang->resource->custom->flow = 'flow';
$lang->resource->custom->working = 'working';
$lang->resource->custom->setPublic = 'setPublic';
$lang->resource->custom->timezone = 'timezone';
$lang->resource->custom->estimate = 'estimate';
$lang->resource->custom->setStoryConcept = 'setStoryConcept';
$lang->resource->custom->configureScrum = 'configureScrum';
$lang->resource->custom->index = 'index';
$lang->resource->custom->set = 'set';
$lang->resource->custom->project = 'project';
$lang->resource->custom->product = 'product';
$lang->resource->custom->restore = 'restore';
$lang->resource->custom->flow = 'flow';
$lang->resource->custom->working = 'working';
$lang->resource->custom->setPublic = 'setPublic';
$lang->resource->custom->timezone = 'timezone';
$lang->resource->custom->estimate = 'estimate';
$lang->resource->custom->setStoryConcept = 'setStoryConcept';
$lang->resource->custom->browseStoryConcept = 'browseStoryConcept';
$lang->resource->custom->deleteStoryConcept = 'deleteStoryConcept';
$lang->resource->custom->configureScrum = 'configureScrum';
$lang->custom->methodOrder[5] = 'index';
$lang->custom->methodOrder[10] = 'set';
@@ -1168,7 +1170,9 @@ $lang->custom->methodOrder[40] = 'setPublic';
$lang->custom->methodOrder[45] = 'timezone';
$lang->custom->methodOrder[50] = 'estimate';
$lang->custom->methodOrder[55] = 'setStoryContcept';
$lang->custom->methodOrder[60] = 'configureScrum';
$lang->custom->methodOrder[60] = 'browseStoryContcept';
$lang->custom->methodOrder[65] = 'deleteStoryContcept';
$lang->custom->methodOrder[70] = 'configureScrum';
$lang->resource->datatable = new stdclass();
$lang->resource->datatable->setGlobal = 'setGlobal';
+2 -1
View File
@@ -251,7 +251,6 @@ class product extends control
*/
public function create()
{
$this->app->loadLang('custom');
$this->lang->product->switcherMenu = $this->product->getSwitcher();
if(!empty($_POST))
@@ -285,6 +284,7 @@ class product extends control
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
$this->view->programs = array('') + $this->loadModel('program')->getTopPGMPairs();
$this->view->lines = array('') + $this->loadModel('tree')->getLinePairs();
$this->view->URSRPairs = $this->loadModel('custom')->getURSRPairs();
unset($this->lang->product->typeList['']);
$this->display();
@@ -354,6 +354,7 @@ class product extends control
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
$this->view->programs = array('') + $this->loadModel('program')->getTopPGMPairs();
$this->view->lines = array('') + $this->loadModel('tree')->getLinePairs();
$this->view->URSRPairs = $this->loadModel('custom')->getURSRPairs();
unset($this->lang->product->typeList['']);
$this->display();
+1 -1
View File
@@ -57,7 +57,7 @@
</tr>
<tr>
<th><?php echo $lang->product->storyConcept;?></th>
<td><?php echo html::select('storyConcept', $lang->custom->URSRList, zget($config->custom, 'URSRName', 1), "class='form-control chosen'");?></td>
<td><?php echo html::select('storyConcept', $URSRPairs, '', "class='form-control chosen'");?></td>
<td></td>
</tr>
<tr class='hide'>
+1 -1
View File
@@ -57,7 +57,7 @@
</tr>
<tr>
<th><?php echo $lang->product->storyConcept;?></th>
<td><?php echo html::select('storyConcept', $lang->custom->URSRList, $product->storyConcept, "class='form-control chosen'");?></td>
<td><?php echo html::select('storyConcept', $URSRPairs, $product->storyConcept, "class='form-control chosen'");?></td>
<td></td>
</tr>
<tr>
+2 -1
View File
@@ -675,7 +675,6 @@ class program extends control
*/
public function PRJCreate($model = 'waterfall', $programID = 0, $from = 'PRJ', $copyProjectID = '')
{
$this->app->loadLang('custom');
if($from == 'PRJ')
{
$this->lang->navGroup->program = 'project';
@@ -761,6 +760,7 @@ class program extends control
$this->view->from = $from;
$this->view->programList = $this->program->getParentPairs();
$this->view->parentProgram = $this->program->getPGMByID($programID);
$this->view->URSRPairs = $this->loadModel('custom')->getURSRPairs();
$this->display();
}
@@ -825,6 +825,7 @@ class program extends control
$this->view->productPlans = $productPlans;
$this->view->linkedProducts = $linkedProducts;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts), '', $linkedBranches);
$this->view->URSRPairs = $this->loadModel('custom')->getURSRPairs();
$this->display();
}
+1 -1
View File
@@ -134,7 +134,7 @@
<tr>
<th><?php echo $lang->program->PRJStoryConcept;?></th>
<td>
<?php echo html::select('storyConcept', $lang->custom->URSRList, zget($config->custom, 'URSRName', 1), "class='form-control chosen'");?>
<?php echo html::select('storyConcept', $URSRPairs, '', "class='form-control chosen'");?>
</td>
</tr>
<tr>
+1 -1
View File
@@ -134,7 +134,7 @@
<tr>
<th><?php echo $lang->program->PRJStoryConcept;?></th>
<td>
<?php echo html::select('storyConcept', $lang->custom->URSRList, $project->storyConcept, "class='form-control chosen'");?>
<?php echo html::select('storyConcept', $URSRPairs, '', "class='form-control chosen'");?>
</td>
</tr>
<tr>