* finish task #2266.

This commit is contained in:
wangyidong
2015-05-15 13:26:15 +08:00
parent 8c06ec0f0c
commit ed1d7ba4b6
8 changed files with 169 additions and 3 deletions
+2 -2
View File
@@ -667,8 +667,8 @@ INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type
('*', '*', '*', '*', '*', '', '监控定时任务', 'zentao', 1, 'normal', '0000-00-00 00:00:00'),
('30', '23', '*', '*', '*', 'moduleName=project&methodName=computeburn', '更新燃尽图', 'zentao', 1, 'normal', '0000-00-00 00:00:00'),
('0', '1', '*', '*', '*', 'moduleName=report&methodName=remind', '每日任务提醒', 'zentao', 1, 'normal', '0000-00-00 00:00:00'),
('*/5', '*', '*', '*', '*', 'moduleName=svn&methodName=run', '同步SVN', 'zentao', 1, 'normal', '0000-00-00 00:00:00'),
('*/5', '*', '*', '*', '*', 'moduleName=git&methodName=run', '同步GIT', 'zentao', 1, 'normal', '0000-00-00 00:00:00'),
('*/5', '*', '*', '*', '*', 'moduleName=svn&methodName=run', '同步SVN', 'zentao', 1, 'stop', '0000-00-00 00:00:00'),
('*/5', '*', '*', '*', '*', 'moduleName=git&methodName=run', '同步GIT', 'zentao', 1, 'stop', '0000-00-00 00:00:00'),
('30', '0', '*', '*', '*', 'moduleName=backup&methodName=backup', '备份数据和附件', 'zentao', 1, 'normal', '0000-00-00 00:00:00'),
('*/5', '*', '*', '*', '*', 'moduleName=mail&methodName=asyncSend', '异步发信', 'zentao', 1, 'normal', '0000-00-00 00:00:00');
+1
View File
@@ -1,5 +1,6 @@
<?php if($extView = $this->getExtViewFile(__FILE__)){include $extView; return helper::cd();}?>
<?php
$this->loadModel('custom')->customByConfig();
$webRoot = $this->app->getWebRoot();
$jsRoot = $webRoot . "js/";
$themeRoot = $webRoot . "theme/";
+16 -1
View File
@@ -97,5 +97,20 @@ class custom extends control
$this->custom->deleteItems("module=$module&section=$field");
die(js::reload('parent'));
}
}
/**
* Flow zentao.
*
* @access public
* @return void
*/
public function flow()
{
if($_POST)
{
$this->loadModel('setting')->setItem('system.custom.productproject', $this->post->productproject);
die(js::reload('parent'));
}
$this->display();
}
}
+17
View File
@@ -5,6 +5,7 @@ $lang->custom->set = 'Set custom';
$lang->custom->restore = 'restore';
$lang->custom->key = 'Key';
$lang->custom->value = 'Value';
$lang->custom->flow = 'Flow';
$lang->custom->object['story'] = 'Story';
$lang->custom->object['task'] = 'Task';
@@ -69,3 +70,19 @@ $lang->custom->notice->userRole = 'The length of key must be less than 20!';
$lang->custom->storyReview = 'Reviewed procedure';
$lang->custom->reviewList[1] = 'Open';
$lang->custom->reviewList[0] = 'Close';
$lang->custom->flowList['productproject'] = 'The relation of product and project';
$lang->custom->productproject = new stdclass();
$lang->custom->productproject->relation['0_0'] = 'Product - Project';
$lang->custom->productproject->relation['0_1'] = 'Product - Iterative';
$lang->custom->productproject->relation['1_1'] = 'Project - Iterative';
$lang->custom->productproject->product[0] = 'Product';
$lang->custom->productproject->product[1] = 'Project';
$lang->custom->productproject->project[0] = 'Project';
$lang->custom->productproject->project[1] = 'Iterative';
$lang->custom->productproject->locked = 'PMS';
$lang->custom->productproject->notice = 'You can change the name of product and project, and the corresponding name display';
+17
View File
@@ -5,6 +5,7 @@ $lang->custom->set = '自定义配置';
$lang->custom->restore = '恢复默认';
$lang->custom->key = '键';
$lang->custom->value = '值';
$lang->custom->flow = '流程';
$lang->custom->object['story'] = '需求';
$lang->custom->object['task'] = '任务';
@@ -69,3 +70,19 @@ $lang->custom->notice->userRole = '键的长度必须小于20个字符!';
$lang->custom->storyReview = '评审流程';
$lang->custom->reviewList[1] = '开启';
$lang->custom->reviewList[0] = '关闭';
$lang->custom->flowList['productproject'] = '产项关系';
$lang->custom->productproject = new stdclass();
$lang->custom->productproject->relation['0_0'] = '产品 - 项目';
$lang->custom->productproject->relation['0_1'] = '产品 - 迭代';
$lang->custom->productproject->relation['1_1'] = '项目 - 迭代';
$lang->custom->productproject->product[0] = '产品';
$lang->custom->productproject->product[1] = '项目';
$lang->custom->productproject->project[0] = '项目';
$lang->custom->productproject->project[1] = '迭代';
$lang->custom->productproject->locked = '项目管理';
$lang->custom->productproject->notice = '可以修改产品视图和项目视图的名称,以及相应的名称显示';
+68
View File
@@ -122,4 +122,72 @@ class customModel extends model
->beginIF($params['section'])->andWhere('section')->in($params['section'])->fi()
->beginIF($params['key'])->andWhere('`key`')->in($params['key'])->fi();
}
/**
* Custom by config.
*
* @access public
* @return void
*/
public function customByConfig()
{
if(!isset($this->config->custom->productproject)) return true;
$productproject = $this->config->custom->productproject;
if(strpos($productproject, '_') === false) return true;
list($product, $project) = explode('_', $productproject);
if($product == 0 and $project == 0) return true;
$change['before'] = $this->lang->custom->productproject->project[0];
$change['after'] = $this->lang->custom->productproject->project[$project];
$changes[] = $change;
if($product != 0)
{
$change['before'] = $this->lang->custom->productproject->product[0];
$change['after'] = $this->lang->custom->productproject->product[$product];
$changes[] = $change;
}
$this->changeAllLang($this->lang, $changes);
}
/**
* Change all lang.
*
* @param object $lang
* @param array $changes
* @access public
* @return object
*/
public function changeAllLang($lang, $changes = array())
{
if(empty($changes)) return true;
static $changed = array();
$type = is_array($lang) ? 'array' : 'object';
foreach($lang as $key => $value)
{
if($lang == $this->lang->custom) continue;
if(is_object($value) or is_array($value))
{
if($type == 'array') $lang[$key] = $this->changeAllLang($value, $changes);
if($type == 'object') $lang->$key = $this->changeAllLang($value, $changes);
}
if(is_string($value))
{
if(isset($changed[$value])) continue;
if(strpos($value, $this->lang->custom->productproject->locked) !== false) continue;
foreach($changes as $change)
{
if(strpos($value, $change['before']) !== false)
{
$value = str_replace($change['before'], $change['after'], $value);
if($type == 'array') $lang[$key] = $value;
if($type == 'object')$lang->$key = $value;
$changed[$value] = true;
}
}
}
}
return $lang;
}
}
+45
View File
@@ -0,0 +1,45 @@
<?php
/**
* The set view file of custom module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv11.html)
* @author Congzhi Chen <congzhi@cnezsoft.com>
* @package custom
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/treeview.html.php';?>
<div id='featurebar'>
<ul class='nav'>
<?php
foreach($lang->custom->object as $object => $name)
{
echo "<li id='{$object}Tab'>";
common::printLink('custom', 'set', "module=$object", $name);
echo '</li>';
}
echo "<li class='active'>";
common::printLink('custom', 'flow', "", $lang->custom->flow);
echo '</li>';
?>
</ul>
</div>
<div class='main'>
<form method='post' class='form-condensed' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th class='w-100px'><?php echo $lang->custom->flowList['productproject'];?></th>
<td class='w-p40'><?php echo html::select('productproject', $lang->custom->productproject->relation, isset($config->custom->productproject) ? $config->custom->productproject : '', "class='form-control'");?></td>
<td><?php echo $lang->custom->productproject->notice?></td>
</tr>
<tr>
<td></td>
<td colspan='2'><?php echo html::submitButton();?></td>
</tr>
</table>
</form>
</div>
<?php include '../../common/view/footer.html.php';?>
+3
View File
@@ -41,6 +41,9 @@ EOT;
common::printLink('custom', 'set', "module=$object", $name);
echo '</li>';
}
echo '<li>';
common::printLink('custom', 'flow', "", $lang->custom->flow);
echo '</li>';
?>
</ul>
</div>