This commit is contained in:
滔哥
2017-10-31 07:31:32 +08:00
39 changed files with 463 additions and 227 deletions
+2
View File
@@ -111,6 +111,7 @@ $filter->product->browse->cookie['storyModule'] = 'int';
$filter->product->default->cookie['lastProduct'] = 'int';
$filter->product->default->cookie['preProductID'] = 'int';
$filter->product->index->cookie['preBranch'] = 'int';
$filter->product->export->cookie['checkedItem'] = 'reg::checked';
$filter->project->default->cookie['lastProject'] = 'int';
$filter->project->default->cookie['projectMode'] = 'code';
@@ -120,6 +121,7 @@ $filter->project->task->cookie['preProjectID'] = 'int';
$filter->project->task->cookie['productBrowseParam'] = 'int';
$filter->project->task->cookie['projectTaskOrder'] = 'reg::orderBy';
$filter->project->task->cookie['windowWidth'] = 'int';
$filter->project->export->cookie['checkedItem'] = 'reg::checked';
$filter->qa->default->cookie['lastProduct'] = 'int';
$filter->qa->default->cookie['preBranch'] = 'int';
+2
View File
@@ -64,6 +64,8 @@ CREATE TABLE IF NOT EXISTS `zt_log` (
KEY `obejctID` (`objectID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `zt_product` ADD `category` mediumint(8) NOT NULL AFTER `code`;
ALTER TABLE `zt_task` ADD `parent` INT(11) NULL DEFAULT '0' AFTER `deleted`;
ALTER TABLE `zt_team` ADD `task` INT(11) NULL DEFAULT '0' AFTER `project`;
ALTER TABLE `zt_team` ADD `estimate` DECIMAL(12,2) UNSIGNED NOT NULL DEFAULT '0';
+15 -14
View File
@@ -187,20 +187,21 @@ $lang->score->menu = $lang->my->menu;
$lang->product = new stdclass();
$lang->product->menu = new stdclass();
$lang->product->menu->list = array('link' => '%s', 'fixed' => true);
$lang->product->menu->story = array('link' => 'Story|product|browse|productID=%s', 'alias' => 'batchedit', 'subModule' => 'story');
$lang->product->menu->dynamic = 'Dynamic|product|dynamic|productID=%s';
$lang->product->menu->plan = array('link' => 'Plan|productplan|browse|productID=%s', 'subModule' => 'productplan');
$lang->product->menu->release = array('link' => 'Release|release|browse|productID=%s', 'subModule' => 'release');
$lang->product->menu->roadmap = 'Roadmap|product|roadmap|productID=%s';
$lang->product->menu->doc = array('link' => 'Document|doc|objectLibs|type=product&objectID=%s&from=product', 'subModule' => 'doc');
$lang->product->menu->branch = '@branch@|branch|manage|productID=%s';
$lang->product->menu->module = 'Module|tree|browse|productID=%s&view=story';
$lang->product->menu->view = array('link' => 'Overview|product|view|productID=%s', 'alias' => 'edit');
$lang->product->menu->project = "{$lang->projectCommon}|product|project|status=all&productID=%s";
$lang->product->menu->create = array('link' => "<i class='icon-plus'></i>&nbsp;Add{$lang->productCommon}|product|create", 'float' => 'right');
$lang->product->menu->all = array('link' => "<i class='icon-cubes'></i>&nbsp;All{$lang->productCommon}|product|all|productID=%s", 'float' => 'right');
$lang->product->menu->index = array('link' => "<i class='icon-home'></i>{$lang->productCommon}Homepage|product|index|locate=no", 'float' => 'right');
$lang->product->menu->list = array('link' => '%s', 'fixed' => true);
$lang->product->menu->story = array('link' => 'Story|product|browse|productID=%s', 'alias' => 'batchedit', 'subModule' => 'story');
$lang->product->menu->dynamic = 'Dynamic|product|dynamic|productID=%s';
$lang->product->menu->plan = array('link' => 'Plan|productplan|browse|productID=%s', 'subModule' => 'productplan');
$lang->product->menu->release = array('link' => 'Release|release|browse|productID=%s', 'subModule' => 'release');
$lang->product->menu->roadmap = 'Roadmap|product|roadmap|productID=%s';
$lang->product->menu->doc = array('link' => 'Document|doc|objectLibs|type=product&objectID=%s&from=product', 'subModule' => 'doc');
$lang->product->menu->branch = '@branch@|branch|manage|productID=%s';
$lang->product->menu->module = 'Module|tree|browse|productID=%s&view=story';
$lang->product->menu->category = 'Category|tree|browse|productID=%s&view=category';
$lang->product->menu->view = array('link' => 'Overview|product|view|productID=%s', 'alias' => 'edit');
$lang->product->menu->project = "{$lang->projectCommon}|product|project|status=all&productID=%s";
$lang->product->menu->create = array('link' => "<i class='icon-plus'></i>&nbsp;Add{$lang->productCommon}|product|create", 'float' => 'right');
$lang->product->menu->all = array('link' => "<i class='icon-cubes'></i>&nbsp;All{$lang->productCommon}|product|all|productID=%s", 'float' => 'right');
$lang->product->menu->index = array('link' => "<i class='icon-home'></i>{$lang->productCommon}Homepage|product|index|locate=no", 'float' => 'right');
$lang->story = new stdclass();
$lang->productplan = new stdclass();
+1
View File
@@ -40,6 +40,7 @@ $lang->product->menuOrder[40] = 'doc';
$lang->product->menuOrder[45] = 'project';
$lang->product->menuOrder[50] = 'branch';
$lang->product->menuOrder[55] = 'module';
$lang->product->menuOrder[57] = 'category';
$lang->product->menuOrder[60] = 'view';
$lang->product->menuOrder[65] = 'create';
$lang->product->menuOrder[70] = 'all';
+16 -14
View File
@@ -187,20 +187,21 @@ $lang->score->menu = $lang->my->menu;
$lang->product = new stdclass();
$lang->product->menu = new stdclass();
$lang->product->menu->list = array('link' => '%s', 'fixed' => true);
$lang->product->menu->story = array('link' => '需求|product|browse|productID=%s', 'alias' => 'batchedit', 'subModule' => 'story');
$lang->product->menu->dynamic = '动态|product|dynamic|productID=%s';
$lang->product->menu->plan = array('link' => '计划|productplan|browse|productID=%s', 'subModule' => 'productplan');
$lang->product->menu->release = array('link' => '发布|release|browse|productID=%s', 'subModule' => 'release');
$lang->product->menu->roadmap = '路线图|product|roadmap|productID=%s';
$lang->product->menu->doc = array('link' => '文档|doc|objectLibs|type=product&objectID=%s&from=product', 'subModule' => 'doc');
$lang->product->menu->branch = '@branch@|branch|manage|productID=%s';
$lang->product->menu->module = '模块|tree|browse|productID=%s&view=story';
$lang->product->menu->view = array('link' => '概况|product|view|productID=%s', 'alias' => 'edit');
$lang->product->menu->project = "{$lang->projectCommon}|product|project|status=all&productID=%s";
$lang->product->menu->create = array('link' => "<i class='icon-plus'></i>&nbsp;添加{$lang->productCommon}|product|create", 'float' => 'right');
$lang->product->menu->all = array('link' => "<i class='icon-cubes'></i>&nbsp;所有{$lang->productCommon}|product|all|productID=%s", 'float' => 'right');
$lang->product->menu->index = array('link' => "<i class='icon-home'></i>{$lang->productCommon}主页|product|index|locate=no", 'float' => 'right');
$lang->product->menu->list = array('link' => '%s', 'fixed' => true);
$lang->product->menu->story = array('link' => '需求|product|browse|productID=%s', 'alias' => 'batchedit', 'subModule' => 'story');
$lang->product->menu->dynamic = '动态|product|dynamic|productID=%s';
$lang->product->menu->plan = array('link' => '计划|productplan|browse|productID=%s', 'subModule' => 'productplan');
$lang->product->menu->release = array('link' => '发布|release|browse|productID=%s', 'subModule' => 'release');
$lang->product->menu->roadmap = '路线图|product|roadmap|productID=%s';
$lang->product->menu->doc = array('link' => '文档|doc|objectLibs|type=product&objectID=%s&from=product', 'subModule' => 'doc');
$lang->product->menu->branch = '@branch@|branch|manage|productID=%s';
$lang->product->menu->module = '模块|tree|browse|productID=%s&view=story';
$lang->product->menu->category = '目录|tree|browse|productID=%s&view=category';
$lang->product->menu->view = array('link' => '概况|product|view|productID=%s', 'alias' => 'edit');
$lang->product->menu->project = "{$lang->projectCommon}|product|project|status=all&productID=%s";
$lang->product->menu->create = array('link' => "<i class='icon-plus'></i>&nbsp;添加{$lang->productCommon}|product|create", 'float' => 'right');
$lang->product->menu->all = array('link' => "<i class='icon-cubes'></i>&nbsp;所有{$lang->productCommon}|product|all|productID=%s", 'float' => 'right');
$lang->product->menu->index = array('link' => "<i class='icon-home'></i>{$lang->productCommon}主页|product|index|locate=no", 'float' => 'right');
$lang->story = new stdclass();
$lang->productplan = new stdclass();
@@ -787,6 +788,7 @@ if(isset($config->global->flow) and $config->global->flow == 'onlyTest')
unset($lang->product->menu->roadmap);
unset($lang->product->menu->doc);
unset($lang->product->menu->module);
unset($lang->product->menu->category);
unset($lang->product->menu->index);
$lang->product->menu->build = array('link' => '版本|product|build', 'subModule' => 'build');
+5 -5
View File
@@ -27,9 +27,9 @@
</tr>
</thead>
<tbody>
<?php foreach($entries as $entry):?>
<?php foreach($entries as $id => $entry):?>
<tr>
<td class='text-center'><?php echo $entry->id;?></td>
<td class='text-center'><?php echo $id;?></td>
<td title='<?php echo $entry->name;?>'><?php echo $entry->name;?></td>
<td><?php echo $entry->code;?></td>
<td title='<?php echo $entry->key;?>'><?php echo $entry->key;?></td>
@@ -37,11 +37,11 @@
<td title='<?php echo $entry->desc;?>'><?php echo $entry->desc;?></td>
<td class='text-right'>
<?php
common::printIcon('entry', 'log', "entryID=$entry->id", '', 'list', 'file-text-o');
common::printIcon('entry', 'edit', "entryID=$entry->id", '', 'list');
common::printIcon('entry', 'log', "entryID=$id", '', 'list', 'file-text-o');
common::printIcon('entry', 'edit', "entryID=$id", '', 'list');
if(common::hasPriv('entry', 'delete'))
{
$deleteURL = $this->createLink('entry', 'delete', "entryID=$entry->id&confirm=yes");
$deleteURL = $this->createLink('entry', 'delete', "entryID=$id&confirm=yes");
echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"entryList\",confirmDelete)", '<i class="icon-remove"></i>', '', "title='{$lang->entry->delete}' class='btn-icon'");
}
?>
+1 -2
View File
@@ -15,8 +15,7 @@
<ul class='nav'>
<?php
echo "<li id='entry' class='active'>"; common::printLink('entry', 'browse', '', $lang->entry->common); echo '</li>';
echo "<li id='webhook'>"; common::printLink('webhook', 'browse', 'type=default', $lang->entry->webhook); echo '</li>';
echo "<li id='dingding'>"; common::printLink('webhook', 'browse', 'type=dingding', $lang->entry->dingding); echo '</li>';
echo "<li id='webhook'>"; common::printLink('webhook', 'browse', '', $lang->entry->webhook); echo '</li>';
?>
</ul>
<div class='actions'>
+3
View File
@@ -7,6 +7,9 @@ $config->product->customBatchEditFields = 'PO,QD,RD,status,type,desc';
$config->product->custom = new stdclass();
$config->product->custom->batchEditFields = 'PO,QD,RD,status';
$config->product->list = new stdclass();
$config->product->list->exportFields = 'id,name,activeStories,changedStories,draftStories,closedStories,plans,releases,bugs,unResolvedBugs,assignToNullBugs';
global $lang, $app;
$app->loadLang('story');
$config->product->search['module'] = 'story';
+51
View File
@@ -231,6 +231,7 @@ class product extends control
$this->view->poUsers = $this->loadModel('user')->getPairs('nodeleted|pofirst|noclosed');
$this->view->qdUsers = $this->loadModel('user')->getPairs('nodeleted|qdfirst|noclosed');
$this->view->rdUsers = $this->loadModel('user')->getPairs('nodeleted|devfirst|noclosed');
$this->view->categories = $this->loadModel('tree')->getOptionMenu($rootID = 0, $type = 'category');
unset($this->lang->product->typeList['']);
$this->display();
@@ -275,6 +276,7 @@ class product extends control
$this->view->poUsers = $this->loadModel('user')->getPairs('nodeleted|pofirst', $product->PO);
$this->view->qdUsers = $this->loadModel('user')->getPairs('nodeleted|qdfirst', $product->QD);
$this->view->rdUsers = $this->loadModel('user')->getPairs('nodeleted|devfirst', $product->RD);
$this->view->categories = $this->loadModel('tree')->getOptionMenu($rootID = 0, $type = 'category');
unset($this->lang->product->typeList['']);
$this->display();
@@ -660,6 +662,55 @@ class product extends control
$this->display();
}
/**
* Export product.
*
* @param string $status
* @param string $orderBy
* @access public
* @return void
*/
public function export($status, $orderBy)
{
if($_POST)
{
$productLang = $this->lang->product;
$productConfig = $this->config->product;
/* Create field lists. */
$fields = $this->post->exportFields ? $this->post->exportFields : explode(',', $productConfig->list->exportFields);
foreach($fields as $key => $fieldName)
{
$fieldName = trim($fieldName);
$fields[$fieldName] = zget($productLang, $fieldName);
unset($fields[$key]);
}
$productStats = $this->product->getStats($orderBy, null, $status);
foreach($productStats as $i => $product)
{
$product->activeStories = (int)$product->stories['active'];
$product->changedStories = (int)$product->stories['changed'];
$product->draftStories = (int)$product->stories['draft'];
$product->closedStories = (int)$product->stories['closed'];
$product->unResolvedBugs = (int)$product->unResolved;
$product->assignToNullBugs = (int)$product->assignToNull;
if($this->post->exportType == 'selected')
{
$checkedItem = $this->cookie->checkedItem;
if(strpos(",$checkedItem,", ",{$product->id},") === false) unset($productStats[$i]);
}
}
$this->post->set('fields', $fields);
$this->post->set('rows', $productStats);
$this->post->set('kind', 'product');
$this->fetch('file', 'export2' . $this->post->fileType, $_POST);
}
$this->display();
}
/**
* Doc for compatible.
*
+8
View File
@@ -26,6 +26,7 @@ $lang->product->other = 'Other:';
$lang->product->closed = 'Closed';
$lang->product->updateOrder = 'Ranking';
$lang->product->all = "All {$lang->productCommon}";
$lang->product->export = "Export";
$lang->product->basicInfo = 'Basic Info';
$lang->product->otherInfo = 'Other Info';
@@ -42,6 +43,13 @@ $lang->product->doc = 'Documents';
$lang->product->project = $lang->projectCommon . 'List';
$lang->product->build = 'Build List';
$lang->product->activeStories = 'Activated Story';
$lang->product->changedStories = 'Changed Story';
$lang->product->draftStories = 'Draft Story';
$lang->product->closedStories = 'Closed Story';
$lang->product->unResolvedBugs = 'Unresolved Bug';
$lang->product->assignToNullBugs = 'No Assigned Bug';
$lang->product->confirmDelete = " Do you want to delete {$lang->productCommon}?";
$lang->product->errorNoProduct = "{$lang->productCommon} is not created yet!";
+10
View File
@@ -26,6 +26,7 @@ $lang->product->other = '其他:';
$lang->product->closed = '已关闭';
$lang->product->updateOrder = "排序";
$lang->product->all = "所有{$lang->productCommon}";
$lang->product->export = "导出";
$lang->product->basicInfo = '基本信息';
$lang->product->otherInfo = '其他信息';
@@ -42,13 +43,22 @@ $lang->product->doc = '文档列表';
$lang->product->project = $lang->projectCommon . '列表';
$lang->product->build = '版本列表';
$lang->product->activeStories = '激活需求';
$lang->product->changedStories = '已变更需求';
$lang->product->draftStories = '草稿需求';
$lang->product->closedStories = '已关闭需求';
$lang->product->unResolvedBugs = '未解决Bug';
$lang->product->assignToNullBugs = '未指派Bug';
$lang->product->confirmDelete = " 您确定删除该{$lang->productCommon}吗?";
$lang->product->errorNoProduct = "还没有创建{$lang->productCommon}!";
$lang->product->accessDenied = "您无权访问该{$lang->productCommon}";
$lang->product->id = "编号";
$lang->product->name = "{$lang->productCommon}名称";
$lang->product->code = "{$lang->productCommon}代号";
$lang->product->category = "{$lang->productCommon}目录";
$lang->product->order = '排序';
$lang->product->type = "{$lang->productCommon}类型";
$lang->product->status = '状态';
+10 -6
View File
@@ -13,6 +13,10 @@
<?php include '../../common/view/sortable.html.php';?>
<div id='featurebar'>
<div class='actions'>
<?php
$link = $this->createLink('product', 'export', "status=$status&orderBy=$orderBy");
if(common::hasPriv('product', 'export'))echo html::a($link, "<i class='icon-download-alt icon'></i> " . $lang->export, '', "class='export btn'");
?>
<?php echo html::a($this->createLink('product', 'create'), "<i class='icon-plus'></i> " . $lang->product->create,'', "class='btn'") ?>
</div>
<ul class='nav'>
@@ -42,15 +46,15 @@
<tr>
<th class='w-id'><?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th><?php common::printOrderLink('name', $orderBy, $vars, $lang->product->name);?></th>
<th class='w-80px'><?php echo $lang->story->statusList['active'] . $lang->story->common;?></th>
<th class='w-80px'><?php echo $lang->story->statusList['changed'] . $lang->story->common;?></th>
<th class='w-80px'><?php echo $lang->story->statusList['draft'] . $lang->story->common;?></th>
<th class='w-80px'><?php echo $lang->story->statusList['closed'] . $lang->story->common;?></th>
<th class='w-80px'><?php echo $lang->product->activeStories;?></th>
<th class='w-80px'><?php echo $lang->product->changedStories;?></th>
<th class='w-80px'><?php echo $lang->product->draftStories;?></th>
<th class='w-80px'><?php echo $lang->product->closedStories;?></th>
<th class='w-80px'><?php echo $lang->product->plans;?></th>
<th class='w-80px'><?php echo $lang->product->releases;?></th>
<th class='w-80px'><?php echo $lang->product->bugs;?></th>
<th class='w-80px'><?php echo $lang->bug->unResolved;?></th>
<th class='w-80px'><?php echo $lang->bug->assignToNull;?></th>
<th class='w-80px'><?php echo $lang->product->unResolvedBugs;?></th>
<th class='w-80px'><?php echo $lang->product->assignToNullBugs;?></th>
<?php if($canOrder):?>
<th class='w-60px sort-default'><?php common::printOrderLink('order', $orderBy, $vars, $lang->product->updateOrder);?></th>
<?php endif;?>
+4
View File
@@ -30,6 +30,10 @@
<th><?php echo $lang->product->code;?></th>
<td><?php echo html::input('code', '', "class='form-control' autocomplete='off'");?></td><td></td>
</tr>
<tr>
<th><?php echo $lang->product->category;?></th>
<td><?php echo html::select('category', $categories, '', "class='form-control chosen'");?></td><td></td>
</tr>
<tr>
<th><?php echo $lang->product->PO;?></th>
<td><?php echo html::select('PO', $poUsers, $this->app->user->account, "class='form-control chosen'");?></td><td></td>
+4
View File
@@ -31,6 +31,10 @@
<th><?php echo $lang->product->code;?></th>
<td><?php echo html::input('code', $product->code, "class='form-control' autocomplete='off'");?></td><td></td>
</tr>
<tr>
<th><?php echo $lang->product->category;?></th>
<td><?php echo html::select('category', $categories, $product->category, "class='form-control chosen'");?></td><td></td>
</tr>
<tr>
<th><?php echo $lang->product->PO;?></th>
<td><?php echo html::select('PO', $poUsers, $product->PO, "class='form-control chosen'");?></td><td></td>
+13
View File
@@ -0,0 +1,13 @@
<?php
/**
* The export view file of product module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package product
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../file/view/export.html.php';?>
+32 -28
View File
@@ -5,6 +5,9 @@ $config->project->orderBy = 'isDone,status,order_desc';
$config->project->maxBurnDay = '31';
$config->project->weekend = '2';
$config->project->list = new stdclass();
$config->project->list->exportFields = 'id,name,code,PM,end,status,totalEstimate,totalConsumed,totalLeft,progess';
global $lang, $app;
$app->loadLang('task');
$config->project->create = new stdclass();
@@ -23,6 +26,7 @@ $config->project->editor->edit = array('id' => 'desc', 'tools' => 'simple
$config->project->editor->putoff = array('id' => 'comment', 'tools' => 'simpleTools');
$config->project->editor->activate = array('id' => 'comment', 'tools' => 'simpleTools');
$config->project->editor->close = array('id' => 'comment', 'tools' => 'simpleTools');
$config->project->editor->start = array('id' => 'comment', 'tools' => 'simpleTools');
$config->project->editor->suspend = array('id' => 'comment', 'tools' => 'simpleTools');
$config->project->search['module'] = 'task';
@@ -60,38 +64,38 @@ $config->project->search['fields']['closedDate'] = $lang->task->closedDate;
$config->project->search['fields']['canceledDate'] = $lang->task->canceledDate;
$config->project->search['fields']['lastEditedDate'] = $lang->task->lastEditedDate;
$config->project->search['params']['name'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
$config->project->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->task->statusList);
$config->project->search['params']['desc'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
$config->project->search['params']['assignedTo'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['pri'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->task->priList);
$config->project->search['params']['name'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
$config->project->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->task->statusList);
$config->project->search['params']['desc'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
$config->project->search['params']['assignedTo'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['pri'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->task->priList);
$config->project->search['params']['project'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->project->search['params']['module'] = array('operator' => 'belong', 'control' => 'select', 'values' => '');
$config->project->search['params']['estimate'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->project->search['params']['left'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->project->search['params']['consumed'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->project->search['params']['type'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->task->typeList);
$config->project->search['params']['fromBug'] = array('operator' => '=', 'control' => 'input', 'values' => $lang->task->typeList);
$config->project->search['params']['closedReason'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->task->reasonList);
$config->project->search['params']['project'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->project->search['params']['module'] = array('operator' => 'belong', 'control' => 'select', 'values' => '');
$config->project->search['params']['estimate'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->project->search['params']['left'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->project->search['params']['consumed'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->project->search['params']['type'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->task->typeList);
$config->project->search['params']['fromBug'] = array('operator' => '=', 'control' => 'input', 'values' => $lang->task->typeList);
$config->project->search['params']['closedReason'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->task->reasonList);
$config->project->search['params']['openedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['finishedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['closedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['cancelBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['lastEditedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['openedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['finishedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['closedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['cancelBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['lastEditedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['mailto'] = array('operator' => 'include', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['mailto'] = array('operator' => 'include', 'control' => 'select', 'values' => 'users');
$config->project->search['params']['openedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['deadline'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['estStarted'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['realStarted'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['assignedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['finishedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['closedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['canceledDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['lastEditedDate']= array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['openedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['deadline'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['estStarted'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['realStarted'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['assignedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['finishedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['closedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['canceledDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->project->search['params']['lastEditedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->printKanban = new stdClass();
$config->printKanban->col['story'] = 1;
+52
View File
@@ -2032,6 +2032,58 @@ class project extends control
$this->display();
}
/**
* Export project.
*
* @param string $status
* @param int $productID
* @param string $orderBy
* @access public
* @return void
*/
public function export($status, $productID, $orderBy)
{
if($_POST)
{
$projectLang = $this->lang->project;
$projectConfig = $this->config->project;
/* Create field lists. */
$fields = $this->post->exportFields ? $this->post->exportFields : explode(',', $projectConfig->list->exportFields);
foreach($fields as $key => $fieldName)
{
$fieldName = trim($fieldName);
$fields[$fieldName] = zget($projectLang, $fieldName);
unset($fields[$key]);
}
$projectStats = $this->project->getProjectStats($status == 'byproduct' ? 'all' : $status, $productID, 0, 30, $orderBy, null);
$users = $this->loadModel('user')->getPairs('noletter');
foreach($projectStats as $i => $project)
{
$project->PM = zget($users, $project->PM);
$project->status = isset($project->delay) ? $projectLang->delayed : $projectLang->statusList[$project->status];
$project->totalEstimate = $project->hours->totalEstimate;
$project->totalConsumed = $project->hours->totalConsumed;
$project->totalLeft = $project->hours->totalLeft;
$project->progress = $project->hours->progress . '%';
if($this->post->exportType == 'selected')
{
$checkedItem = $this->cookie->checkedItem;
if(strpos(",$checkedItem,", ",{$project->id},") === false) unset($projectStats[$i]);
}
}
$this->post->set('fields', $fields);
$this->post->set('rows', $projectStats);
$this->post->set('kind', 'project');
$this->fetch('file', 'export2' . $this->post->fileType, $_POST);
}
$this->display();
}
/**
* Doc for compatible.
*
+1
View File
@@ -58,6 +58,7 @@ $lang->project->activate = 'Activate';
$lang->project->putoff = 'Deplay';
$lang->project->suspend = 'Suspend';
$lang->project->close = 'Close';
$lang->project->export = 'Export';
$lang->project->typeList['sprint'] = 'Sprint';
$lang->project->typeList['waterfall'] = 'Waterfall';
+1
View File
@@ -58,6 +58,7 @@ $lang->project->activate = '激活';
$lang->project->putoff = '延期';
$lang->project->suspend = '挂起';
$lang->project->close = '关闭';
$lang->project->export = '导出';
$lang->project->typeList['sprint'] = "短期$lang->projectCommon";
$lang->project->typeList['waterfall'] = "长期$lang->projectCommon";
+3 -3
View File
@@ -11,7 +11,6 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::import($jsRoot . 'misc/date.js');?>
<div class='container'>
@@ -25,11 +24,12 @@
<form class='form-condensed' method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th class='w-60px'><?php echo $lang->comment;?></th>
<th class='text-left'><?php echo $lang->comment;?></th>
<td><?php echo html::textarea('comment', '', "rows='6' class='form-control'");?></td>
</tr>
<tr>
<th></th><td class='text-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
<th></th>
<td><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
</form>
+1
View File
@@ -14,6 +14,7 @@
<?php include '../../common/view/sortable.html.php';?>
<div id='featurebar'>
<div class='actions'>
<?php common::printLink('project', 'export', "status=$status&productID=$productID&orderBy=$orderBy", "<i class='icon-download-alt'></i> " . $lang->export, '', "class='btn export'")?>
<?php common::printLink('project', 'create', '', "<i class='icon-plus'></i> " . $lang->project->create, '', "class='btn'")?>
</div>
<ul class='nav'>
+2 -3
View File
@@ -24,12 +24,11 @@
<table class='table table-form'>
<tr>
<th class='text-left'><?php echo $lang->comment;?></th>
</tr>
<tr>
<td><?php echo html::textarea('comment', '', "rows='6' class='form-control'");?></td>
</tr>
<tr>
<td class='text-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
<th></th>
<td><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
</form>
+13
View File
@@ -0,0 +1,13 @@
<?php
/**
* The export view file of project module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package project
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../file/view/export.html.php';?>
+4 -3
View File
@@ -11,7 +11,7 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<div class='container mw-1400px'>
<div id='titlebar'>
<div class='heading'>
@@ -23,11 +23,12 @@
<form class='form-condensed' method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th class='w-60px'><?php echo $lang->comment;?></th>
<th class='text-left'><?php echo $lang->comment;?></th>
<td><?php echo html::textarea('comment', '', "rows='6' class='form-control'");?></td>
</tr>
<tr>
<th></th><td><?php echo html::submitButton($lang->project->start) . html::linkButton($lang->goback, $this->session->taskList); ?></td>
<th></th>
<td><?php echo html::submitButton($lang->project->start) . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
</form>
+2 -3
View File
@@ -24,12 +24,11 @@
<table class='table table-form'>
<tr>
<th class='text-left'><?php echo $lang->comment;?></th>
</tr>
<tr>
<td><?php echo html::textarea('comment', '', "rows='6' class='form-control'");?></td>
</tr>
<tr>
<td class='text-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
<th></th>
<td><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
</form>
+2
View File
@@ -210,6 +210,8 @@ class report extends control
/* Get email content and title.*/
$this->view->mail = $mail;
$this->view->mailTitle = $mailTitle;
$oldViewType = $this->viewType;
if($oldViewType == 'json') $this->viewType = 'html';
$mailContent = $this->parse('report', 'dailyreminder');
+19 -2
View File
@@ -25,7 +25,7 @@ class tree extends control
public function browse($rootID, $viewType, $currentModuleID = 0, $branch = 0)
{
/* According to the type, set the module root and modules. */
if(strpos('story|bug|case', $viewType) !== false)
if(strpos('story|bug|case|category', $viewType) !== false)
{
$product = $this->loadModel('product')->getById($rootID);
if($product->type != 'normal')
@@ -95,7 +95,6 @@ class tree extends control
if($this->config->global->flow == 'onlyTest') $this->lang->set('menugroup.tree', 'testcase');
if($this->config->global->flow != 'onlyTest') $this->lang->set('menugroup.tree', 'qa');
$title = $product->name . $this->lang->colon . $this->lang->tree->manageCase;
$position[] = html::a($this->createLink('testcase', 'browse', "product=$rootID"), $product->name);
$position[] = $this->lang->tree->manageCase;
@@ -123,6 +122,24 @@ class tree extends control
$position[] = html::a($this->createLink('doc', 'browse', "libID=$rootID"), $lib->name);
$position[] = $this->lang->tree->manageCustomDoc;
}
elseif($viewType == 'category')
{
$this->lang->set('menugroup.tree', 'product');
$this->product->setMenu($this->product->getPairs(), $rootID, $branch, 'category', '', 'category');
$this->lang->tree->menu = $this->lang->product->menu;
$this->lang->tree->menuOrder = $this->lang->product->menuOrder;
$products = $this->product->getPairs();
unset($products[$rootID]);
$currentProduct = key($products);
$this->view->allProduct = $products;
$this->view->currentProduct = $currentProduct;
$this->view->productModules = $this->tree->getOptionMenu($currentProduct, 'category');
$title = $this->lang->product->common . $this->lang->colon . $this->lang->tree->manageCategory;
$position[] = $this->lang->tree->manageCategory;
}
$parentModules = $this->tree->getParents($currentModuleID);
$this->view->title = $title;
+41 -37
View File
@@ -10,30 +10,32 @@
* @link http://www.zentao.net
*/
$lang->tree = new stdclass();
$lang->tree->common = '模块维护';
$lang->tree->edit = '编辑';
$lang->tree->delete = '删除模块';
$lang->tree->browse = '通用模块维护';
$lang->tree->browseTask = '任务模块维护';
$lang->tree->manage = '维护模块';
$lang->tree->fix = '修正数据';
$lang->tree->manageProduct = "维护{$lang->productCommon}视图模块";
$lang->tree->manageProject = "维护{$lang->projectCommon}视图模块";
$lang->tree->manageBug = '维护测试视图模块';
$lang->tree->manageCase = '维护用例视图模块';
$lang->tree->manageCaseLib = '维护测试库模块';
$lang->tree->manageCustomDoc = '维护文档库分类';
$lang->tree->updateOrder = '更新排序';
$lang->tree->manageChild = '维护子模块';
$lang->tree->manageStoryChild = '维护子模块';
$lang->tree->manageBugChild = '维护Bug子模块';
$lang->tree->manageCaseChild = '维护用例子模块';
$lang->tree->manageCaselibChild = '维护测试库子模块';
$lang->tree->manageTaskChild = "维护{$lang->projectCommon}子模块";
$lang->tree->syncFromProduct = '复制';
$lang->tree->dragAndSort = "拖放排序";
$lang->tree->sort = "排序";
$lang->tree->addChild = "增加子模块";
$lang->tree->common = '模块维护';
$lang->tree->edit = '编辑';
$lang->tree->delete = '删除模块';
$lang->tree->browse = '通用模块维护';
$lang->tree->browseTask = '任务模块维护';
$lang->tree->manage = '维护模块';
$lang->tree->fix = '修正数据';
$lang->tree->manageProduct = "维护{$lang->productCommon}视图模块";
$lang->tree->manageProject = "维护{$lang->projectCommon}视图模块";
$lang->tree->manageCategory = '维护目录';
$lang->tree->manageBug = '维护测试视图模块';
$lang->tree->manageCase = '维护用例视图模块';
$lang->tree->manageCaseLib = '维护测试库模块';
$lang->tree->manageCustomDoc = '维护文档库分类';
$lang->tree->updateOrder = '更新排序';
$lang->tree->manageChild = '维护子模块';
$lang->tree->manageStoryChild = '维护子模块';
$lang->tree->manageCategoryChild = '维护子目录';
$lang->tree->manageBugChild = '维护Bug子模块';
$lang->tree->manageCaseChild = '维护用例子模块';
$lang->tree->manageCaselibChild = '维护测试库子模块';
$lang->tree->manageTaskChild = "维护{$lang->projectCommon}子模块";
$lang->tree->syncFromProduct = '复制';
$lang->tree->dragAndSort = "拖放排序";
$lang->tree->sort = "排序";
$lang->tree->addChild = "增加子模块";
$lang->tree->confirmDelete = '该模块及其子模块都会被删除,您确定删除吗?';
$lang->tree->confirmRoot = "模块的所属{$lang->productCommon}修改,会关联修改该模块下的需求、Bug、用例的所属{$lang->productCommon},以及{$lang->projectCommon}和{$lang->productCommon}的关联关系。该操作比较危险,请谨慎操作。是否确认修改?";
@@ -41,16 +43,18 @@ $lang->tree->successSave = '成功保存';
$lang->tree->successFixed = '成功修正数据!';
$lang->tree->repeatName = '模块名“%s”已经存在!';
$lang->tree->name = '模块名称';
$lang->tree->root = '所属根';
$lang->tree->branch = '平台/分支';
$lang->tree->path = '路径';
$lang->tree->type = '类型';
$lang->tree->parent = '上级模块';
$lang->tree->child = '子模块';
$lang->tree->owner = '负责人';
$lang->tree->order = '排序';
$lang->tree->short = '简称';
$lang->tree->all = '所有模块';
$lang->tree->projectDoc = "{$lang->projectCommon}文档";
$lang->tree->product = "所属{$lang->productCommon}";
$lang->tree->name = '模块名称';
$lang->tree->category = '目录名称';
$lang->tree->root = '所属根';
$lang->tree->branch = '平台/分支';
$lang->tree->path = '路径';
$lang->tree->type = '类型';
$lang->tree->parent = '上级模块';
$lang->tree->child = '子模块';
$lang->tree->categoryChild = '子目录';
$lang->tree->owner = '负责人';
$lang->tree->order = '排序';
$lang->tree->short = '简称';
$lang->tree->all = '所有模块';
$lang->tree->projectDoc = "{$lang->projectCommon}文档";
$lang->tree->product = "所属{$lang->productCommon}";
+8
View File
@@ -81,6 +81,8 @@ class treeModel extends model
*/
public function getOptionMenu($rootID, $type = 'story', $startModule = 0, $branch = 0)
{
if($type == 'category') $rootID = 0;
$branches = array($branch => '');
if(strpos('story|bug|case', $type) !== false)
{
@@ -312,6 +314,8 @@ class treeModel extends model
*/
public function getTreeMenu($rootID, $type = 'root', $startModule = 0, $userFunc, $extra = '', $branch = 0)
{
if($type == 'category') $rootID = 0;
$branches = array($branch => '');
if($branch)
{
@@ -945,6 +949,8 @@ class treeModel extends model
*/
public function getSons($rootID, $moduleID, $type = 'root', $branch = 0)
{
if($type == 'category') $rootID = 0;
/* if createVersion <= 4.1 or type == 'story', only get modules of its type. */
if(!$this->isMergeModule($rootID, $type) or $type == 'story')
{
@@ -1495,6 +1501,8 @@ class treeModel extends model
*/
public function getProductStructure($rootID, $viewType, $branch = 0, $currentModuleID = 0)
{
if($viewType == 'category') $rootID = 0;
$branches = array($branch => '');
$product = $this->loadModel('product')->getById($rootID);
if(strpos('story|bug|case', $viewType) !== false and empty($branch))
+12 -5
View File
@@ -12,8 +12,9 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php $hasBranch = (strpos('story|bug|case', $viewType) !== false and $root->type != 'normal') ? true : false;?>
<?php $name = $viewType == 'category' ? $lang->tree->category : $lang->tree->name;?>
<div id='featurebar'>
<div class='heading'><?php echo $lang->tree->common;?></div>
<div class='heading'><?php echo $viewType == 'category' ? $lang->tree->manageCategory : $lang->tree->common;?></div>
</div>
<div class='row'>
<div class='col-sm-4'>
@@ -40,6 +41,7 @@
<div class='panel-body'>
<table class='table table-form'>
<tr>
<?php if($viewType != 'category'):?>
<td class='parentModule'>
<nobr>
<?php
@@ -53,6 +55,7 @@
?>
</nobr>
</td>
<?php endif;?>
<td id='moduleBox'>
<?php
if($viewType == 'story' and $allProduct)
@@ -80,7 +83,7 @@
for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++)
{
echo "<div class='row-table addedItem' style='margin-bottom:5px'>";
echo "<div class='col-table'>" . html::input("modules[]", '', "class='form-control' placeholder='{$lang->tree->name}' autocomplete='off'") . '</div>';
echo "<div class='col-table'>" . html::input("modules[]", '', "class='form-control' placeholder='{$name}' autocomplete='off'") . '</div>';
if($hasBranch) echo '<div class="col-table">' . html::select("branch[]", $branches, $branch, 'class="form-control"') . '</div>';
echo "<div class='col-table' style='width:120px'><div class='input-group'>" . html::input("shorts[]", '', "class='form-control' placeholder='{$lang->tree->short}' autocomplete='off'");
echo "<span class='input-group-btn'><a href='javascript:;' onclick='addItem(this)' class='btn btn-block'><i class='icon icon-plus'></i></a></span>";
@@ -91,7 +94,7 @@
echo "<div id='insertItemBox' class='hidden'>";
echo "<div class='row-table' style='margin-bottom:5px'>";
echo "<div class='col-table'>" . html::input("modules[]", '', "class='form-control' placeholder='{$lang->tree->name}' autocomplete='off'") . '</div>';
echo "<div class='col-table'>" . html::input("modules[]", '', "class='form-control' placeholder='{$name}' autocomplete='off'") . '</div>';
if($hasBranch) echo '<div class="col-table">' . html::select("branch[]", $branches, $branch, 'class="form-control" disabled') . '</div>';
echo "<div class='col-table' style='width:120px'><div class='input-group'>" . html::input("shorts[]", '', "class='form-control' placeholder='{$lang->tree->short}' autocomplete='off'") . html::hidden("order[]");
echo "<span class='input-group-btn' style='border-left:1px solid'><a href='javascript:;' onclick='deleteItem(this)' class='btn btn-block'><i class='icon icon-remove'></i></a></span>";
@@ -103,7 +106,9 @@
</td>
</tr>
<tr>
<?php if($viewType != 'category'):?>
<td></td>
<?php endif;?>
<td colspan='2'>
<?php
echo html::submitButton();
@@ -175,8 +180,8 @@ $(function()
subModules:
{
linkTemplate: '<?php echo helper::createLink('tree', 'browse', "rootID=$rootID&viewType=$viewType&moduleID={0}&branch={1}"); ?>',
title: '<?php echo $lang->tree->child ?>',
template: '<a href="javascript:;"><?php echo $lang->tree->child?></a>'
title: '<?php echo $viewType == 'category' ? $lang->tree->categoryChild : $lang->tree->child ?>',
template: '<a href="javascript:;"><?php echo $viewType == 'category' ? $lang->tree->categoryChild : $lang->tree->child?></a>'
}
},
action: function(event)
@@ -238,6 +243,8 @@ $(function()
});
$tree.find('[data-toggle="tooltip"]').tooltip();
$('#modulemenu > .nav > li > a[href*=tree][href*=browse]').not('[href*=<?php echo $viewType;?>]').parent().removeClass('active');
});
</script>
<?php
+7 -11
View File
@@ -14,7 +14,6 @@ class webhook extends control
/**
* Browse webhooks.
*
* @param string $type
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
@@ -22,14 +21,13 @@ class webhook extends control
* @access public
* @return void
*/
public function browse($type = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function browse($orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
$this->view->title = $this->lang->webhook->api . $this->lang->colon . $this->lang->webhook->list;
$this->view->webhooks = $this->webhook->getList($type, $orderBy, $pager);
$this->view->type = $type;
$this->view->webhooks = $this->webhook->getList($orderBy, $pager);
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->display();
@@ -38,17 +36,16 @@ class webhook extends control
/**
* Create a webhook.
*
* @param string $type
* @access public
* @return void
*/
public function create($type = '')
public function create()
{
if($_POST)
{
$this->webhook->create($type);
$this->webhook->create();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->webhook->saveSuccess, 'locate' => inlink('browse', "type=$type")));
$this->send(array('result' => 'success', 'message' => $this->lang->webhook->saveSuccess, 'locate' => inlink('browse')));
}
$this->app->loadLang('action');
@@ -57,7 +54,6 @@ class webhook extends control
$this->view->projects = $this->loadModel('project')->getPairs();
$this->view->objectTypes = $this->webhook->getObjectTypes();
$this->view->objectActions = $this->webhook->getObjectActions();
$this->view->type = $type;
$this->display();
}
@@ -75,7 +71,7 @@ class webhook extends control
{
$this->webhook->update($id);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->webhook->saveSuccess, 'locate' => inlink('browse', "type=$webhook->type")));
$this->send(array('result' => 'success', 'message' => $this->lang->webhook->saveSuccess, 'locate' => inlink('browse')));
}
$this->app->loadLang('action');
@@ -136,7 +132,7 @@ class webhook extends control
*/
public function asyncSend()
{
$webhooks = $this->webhook->getList($type = '', $orderBy = 'id_desc', $pager = null, $decode = false);
$webhooks = $this->webhook->getList($orderBy = 'id_desc', $pager = null, $decode = false);
if(empty($webhooks))
{
echo "NO WEBHOOK EXIST.\n";
+9
View File
@@ -1,5 +1,14 @@
$(function()
{
$('#type').change(function()
{
var type = $(this).val();
$('#contentTypeTR').toggle(type != 'dingding');
$('#sendTypeTR').toggle(type != 'dingding');
$('#paramsTR').toggle(type != 'bearychat' && type != 'dingding');
$('#urlNote').html(urlNote[type]);
});
$('.objectType').click(function()
{
if($(this).prop('checked'))
+11 -5
View File
@@ -3,7 +3,6 @@ $lang->webhook->common = 'webhook';
$lang->webhook->list = '钩子列表';
$lang->webhook->api = '接口';
$lang->webhook->entry = '应用';
$lang->webhook->dingding = '钉钉';
$lang->webhook->log = '日志';
$lang->webhook->assigned = '指派给';
@@ -31,6 +30,10 @@ $lang->webhook->date = '发送时间';
$lang->webhook->data = '数据';
$lang->webhook->result = '结果';
$lang->webhook->typeList['bearychat'] = '倍洽';
$lang->webhook->typeList['dingding'] = '钉钉';
$lang->webhook->typeList['default'] = '默认';
$lang->webhook->sendTypeList['sync'] = '同步';
$lang->webhook->sendTypeList['async'] = '异步';
@@ -50,7 +53,10 @@ $lang->webhook->confirmDelete = '您确认要删除该webhook吗?';
$lang->webhook->trimWords = '了';
$lang->webhook->note = new stdClass();
$lang->webhook->note->async = '异步需要打开计划任务';
$lang->webhook->note->dingding = '请在钉钉中添加一个自定义机器人,并将其webhook填写到此处。';
$lang->webhook->note->product = '此项为空时所有产品的动作都会触发钩子,否则只有关联产品的动作才会触发。';
$lang->webhook->note->project = '此项为空时所有项目的动作都会触发钩子,否则只有关联项目的动作才会触发。';
$lang->webhook->note->async = '异步需要打开计划任务';
$lang->webhook->note->product = '此项为空时所有产品的动作都会触发钩子,否则只有关联产品的动作才会触发。';
$lang->webhook->note->project = '此项为空时所有项目的动作都会触发钩子,否则只有关联项目的动作才会触发。';
$lang->webhook->note->typeList['bearychat'] = '请在倍洽中添加一个禅道机器人,并将其webhook填写到此处。';
$lang->webhook->note->typeList['dingding'] = '请在钉钉中添加一个自定义机器人,并将其webhook填写到此处。';
$lang->webhook->note->typeList['default'] = '从第三方系统获取webhook并填写到此处。';
+76 -64
View File
@@ -28,18 +28,16 @@ class webhookModel extends model
/**
* Get webhook list.
*
* @param string $type
* @param string $orderBy
* @param object $pager
* @param bool $decode
* @access public
* @return array
*/
public function getList($type = '', $orderBy = 'id_desc', $pager = null, $decode = true)
public function getList($orderBy = 'id_desc', $pager = null, $decode = true)
{
$webhooks = $this->dao->select('*')->from(TABLE_WEBHOOK)
->where('deleted')->eq('0')
->beginIF($type)->andWhere('type')->eq($type)->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
@@ -142,14 +140,12 @@ class webhookModel extends model
/**
* Create a webhook.
*
* @param string $type
* @access public
* @return bool
*/
public function create($type)
public function create()
{
$webhook = fixer::input('post')
->add('type', $type)
->add('createdBy', $this->app->user->account)
->add('createdDate', helper::now())
->join('products', ',')
@@ -241,6 +237,7 @@ class webhookModel extends model
*/
public function buildData($objectType, $objectID, $actionType, $actionID, $webhook)
{
/* Validate data. */
if(!isset($this->lang->action->label)) $this->loadModel('action');
if(!isset($this->lang->action->label->$actionType)) return false;
if(empty($this->config->objectTables[$objectType])) return false;
@@ -262,69 +259,43 @@ class webhookModel extends model
$object = $this->dao->select('*')->from($this->config->objectTables[$objectType])->where('id')->eq($objectID)->fetch();
$field = $this->config->action->objectNameFields[$objectType];
$text = $object->$field;
$host = common::getSysURL();
$viewLink = $this->getViewLink($objectType, $objectID);
$title = $this->app->user->realname . $this->lang->action->label->$actionType . $this->lang->action->objectTypes[$objectType];
$text = $title . ' ' . "[#{$objectID}::{$object->$field}](" . $host . $viewLink . ")";
$mobile = '';
$email = '';
if($actionType == 'assigned')
{
$assignedTo = $object->assignedTo;
foreach($users as $user)
{
if($user->account == $object->assignedTo)
{
$assignedTo = $user->realname;
$mobile = $user->mobile;
$email = $user->email;
break;
}
}
$text .= ' ' . $this->lang->webhook->assigned . ' ' . $assignedTo;
}
$action->text = $text;
$data = new stdclass();
if($webhook->type == 'dingding')
{
$title = $this->app->user->realname . $this->lang->action->label->$actionType . $this->lang->action->objectTypes[$objectType];
$mobile = '';
if($actionType == 'assigned')
{
$assignedTo = $object->assignedTo;
foreach($users as $user)
{
if($user->account == $object->assignedTo)
{
$assignedTo = $user->realname;
$mobile = $user->mobile;
break;
}
}
if($mobile) $title .= ' ' . "[#{$objectID}::{$title}](" . $host . $viewLink . ")";
$title .= ' ' . $this->lang->webhook->assigned . ' ' . $assignedTo;
}
if($mobile)
{
$at = new stdclass();
$at->atMobiles = array($mobile);
$at->isAtAll = false;
$data->msgtype = 'text';
$data->text = array('content' => $title);
$data->at = $at;
}
else
{
$link = new stdclass();
$link->text = "[#{$objectID}::{$text}]";
$link->title = $title;
$link->picUrl = '';
$link->messageUrl = $host . $viewLink;
$data->msgtype = 'link';
$data->link = $link;
}
return helper::jsonEncode($data);
$data = $this->getDingdingData($title, $text, $mobile);
}
foreach(explode(',', $webhook->params) as $param)
elseif($webhook->type == 'bearychat')
{
if($param == 'text')
{
$data->text = $this->app->user->realname . $this->lang->action->label->$actionType . $this->lang->action->objectTypes[$objectType] . ' ' . "[#{$objectID}::{$text}](" . $host . $viewLink . ")";
if($actionType == 'assigned') $data->text .= ' ' . $this->lang->webhook->assigned . ' ' . zget($users, $object->assignedTo);
}
else
{
$data->$param = $action->$param;
}
$data = $this->getBearychatData($text, $mobile, $email, $objectType, $objectID);
}
else
{
$data = new stdclass();
foreach(explode(',', $webhook->params) as $param) $data->$param = $action->$param;
}
$data = $this->getFiles($data, $objectType, $objectID);
return helper::jsonEncode($data);
}
@@ -353,16 +324,56 @@ class webhookModel extends model
}
/**
* Get files.
* Get hook data for dingding.
*
* @param object $data
* @param string $title
* @param string $text
* @param string $mobile
* @access public
* @return object
*/
public function getDingdingData($title, $text, $mobile)
{
if($mobile) $text .= " @{$mobile}";
$markdown = new stdclass();
$markdown->title = $title;
$markdown->text = $text;
$data = new stdclass();
$data->msgtype = 'markdown';
$data->markdown = $markdown;
if($mobile)
{
$at = new stdclass();
$at->atMobiles = array($mobile);
$at->isAtAll = false;
$data->at = $at;
}
return $data;
}
/**
* Get hook data for bearychat.
*
* @param string $text
* @param string $mobile
* @param string $email
* @param string $objectType
* @param int $objectID
* @access public
* @return object
*/
public function getFiles($data, $objectType, $objectID)
public function getBearychatData($text, $mobile, $email, $objectType, $objectID)
{
$data = new stdclass();
$data->text = $text;
$data->markdown = 'true';
$data->user = $mobile ? $mobile : ($email ? $email : $this->app->user->account);
if(!empty($_FILES['files']['name'][0]))
{
$this->loadModel('file');
@@ -378,6 +389,7 @@ class webhookModel extends model
}
}
}
return $data;
}
+5 -5
View File
@@ -12,23 +12,23 @@
?>
<?php include 'header.html.php';?>
<?php js::set('confirmDelete', $lang->webhook->confirmDelete);?>
<?php js::set('type', $type);?>
<form id='ajaxForm' method='post'>
<table id='webhookList' class='table table-condensed table-hover table-striped table-fixed'>
<thead>
<tr>
<?php $vars = "type=$type&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<?php $vars = "orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<th class='w-60px'><?php common::printOrderLink('id', $orderBy, $vars, $lang->webhook->id);?></th>
<th class='w-100px'><?php common::printOrderLink('type', $orderBy, $vars, $lang->webhook->type);?></th>
<th><?php common::printOrderLink('name', $orderBy, $vars, $lang->webhook->name);?></th>
<th><?php common::printOrderLink('url', $orderBy, $vars, $lang->webhook->url);?></th>
<th class='w-70px'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php $index = 1;?>
<?php foreach($webhooks as $id => $webhook):?>
<tr>
<td class='text-center'><?php echo $index++;?></td>
<td class='text-center'><?php echo $id;?></td>
<td><?php echo zget($lang->webhook->typeList, $webhook->type);?></td>
<td class='text' title='<?php echo $webhook->name;?>'><?php echo $webhook->name;?></td>
<td class='text' title='<?php echo $webhook->url;?>'><?php echo $webhook->url;?></td>
<td class='text-right'>
@@ -47,7 +47,7 @@
</tbody>
<tfoot>
<tr>
<td colspan='4'><?php $pager->show();?></td>
<td colspan='5'><?php $pager->show();?></td>
</tr>
</tfoot>
</table>
+12 -10
View File
@@ -12,6 +12,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/form.html.php';?>
<?php js::set('urlNote', $lang->webhook->note->typeList);?>
<div class='container mw-1400px'>
<div id="titlebar">
<div class="heading">
@@ -22,27 +23,30 @@
<form id='webhookForm' method='post' class='ajaxForm'>
<table class='table table-form'>
<tr>
<th class='w-80px'><?php echo $lang->webhook->name;?></th>
<td class='w-p50'><?php echo html::input('name', '', "class='form-control'");?></td>
<th class='w-80px'><?php echo $lang->webhook->type;?></th>
<td class='w-p50'><?php echo html::select('type', $lang->webhook->typeList, 'default', "class='form-control'");?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->webhook->name;?></th>
<td><?php echo html::input('name', '', "class='form-control'");?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->webhook->url;?></th>
<td><?php echo html::input('url', '', "class='form-control'");?></td>
<td><?php if($type == 'dingding') echo $lang->webhook->note->dingding;?></td>
<td id='urlNote'><?php echo $lang->webhook->note->typeList['default'];?></td>
</tr>
<?php if($type != 'dingding'):?>
<tr>
<tr id='contentTypeTR'>
<th><?php echo $lang->webhook->contentType;?></th>
<td><?php echo html::select('contentType', $config->webhook->contentTypes, '', "class='form-control'");?></td>
<td></td>
</tr>
<tr>
<tr id='sendTypeTR'>
<th><?php echo $lang->webhook->sendType;?></th>
<td><?php echo html::select('sendType', $lang->webhook->sendTypeList, '', "class='form-control'");?></td>
<td><?php echo $lang->webhook->note->async;?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->webhook->product;?></th>
<td><?php echo html::select('products[]', $products, '', "class='form-control chosen' multiple");?></td>
@@ -53,12 +57,10 @@
<td><?php echo html::select('projects[]', $projects, '', "class='form-control chosen' multiple");?></td>
<td><?php echo $lang->webhook->note->project;?></td>
</tr>
<?php if($type != 'dingding'):?>
<tr>
<tr id='paramsTR'>
<th><?php echo $lang->webhook->params;?></th>
<td class='labelWidth' colspan='2'><?php echo html::checkbox('params', $lang->webhook->paramsList, 'text');?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->webhook->action;?></th>
<td colspan='2'>
+2 -2
View File
@@ -29,7 +29,7 @@
<tr>
<th><?php echo $lang->webhook->url;?></th>
<td><?php echo html::input('url', $webhook->url, "class='form-control'");?></td>
<td><?php if($webhook->type == 'dingding') echo $lang->webhook->note->dingding;?></td>
<td><?php echo zget($lang->webhook->note->typeList, $webhook->type);?></td>
</tr>
<?php if($webhook->type != 'dingding'):?>
<tr>
@@ -53,7 +53,7 @@
<td><?php echo html::select('projects[]', $projects, $webhook->projects, "class='form-control chosen' multiple");?></td>
<td><?php echo $lang->webhook->note->project;?></td>
</tr>
<?php if($webhook->type != 'dingding'):?>
<?php if(strpos(',bearychat,dingding,', ",$webhook->type,") === false):?>
<tr>
<th><?php echo $lang->webhook->params;?></th>
<td class='labelWidth' colspan='2'><?php echo html::checkbox('params', $lang->webhook->paramsList, $webhook->params);?></td>
+2 -4
View File
@@ -15,16 +15,14 @@
<ul class='nav'>
<?php
echo "<li id='entry'>"; common::printLink('entry', 'browse', '', $lang->webhook->entry); echo '</li>';
echo "<li id='webhook'>"; common::printLink('webhook', 'browse', 'type=default', $lang->webhook->common); echo '</li>';
echo "<li id='dingding'>"; common::printLink('webhook', 'browse', 'type=dingding', $lang->webhook->dingding); echo '</li>';
echo "<li id='webhook' class='active'>"; common::printLink('webhook', 'browse', '', $lang->webhook->common); echo '</li>';
?>
</ul>
<div class='actions'>
<div class='btn-group'>
<div class='btn-group' id='createActionMenu'>
<?php common::printIcon('webhook', 'create', "type=$type", '', 'button', '', '', 'btn-primary');?>
<?php common::printIcon('webhook', 'create', '', '', 'button', '', '', 'btn-primary');?>
</div>
</div>
</div>
</div>
<script>$('.nav li a[href*=<?php echo $type;?>]').parent().addClass('active');</script>
+1 -1
View File
@@ -13,7 +13,7 @@
<?php include '../../common/view/header.html.php';?>
<div id="titlebar">
<div class="heading">
<strong><?php echo html::a(inlink('browse', "type={$webhook->type}"), $webhook->type == 'dingding' ? $lang->webhook->dingding : $lang->webhook->common);?></strong>
<strong><?php echo html::a(inlink('browse'), $lang->webhook->common);?></strong>
<small class="text-muted"> <?php echo $webhook->name;?> </small>
<small class="text-muted"> <?php echo $lang->webhook->log;?> <i class="icon-file-text-o"></i></small>
</div>