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

This commit is contained in:
leiyong
2020-04-29 00:44:59 -07:00
10 changed files with 299 additions and 9 deletions
+2 -1
View File
@@ -57,11 +57,12 @@ class dingapi
$depts = $this->getAllDepts();
if($this->isError()) return array('result' => 'fail', 'message' => $this->errors);
set_time_limit(0);
$users = array();
foreach($depts as $deptID => $deptName)
{
$response = $this->queryAPI($this->apiUrl . "user/simplelist?access_token={$this->token}&department_id={$deptID}");
if($this->isError()) return array('result' => 'fail', 'message' => $this->errors);
if($this->isError()) continue;
foreach($response->userlist as $user) $users[$user->name] = $user->userid;
}
+1
View File
@@ -4,6 +4,7 @@ $config->product->orderBy = 'isClosed,order_desc';
$config->product->customBatchEditFields = 'line,PO,QD,RD,status,type,desc';
$config->product->browse = new stdclass();
$config->product->custom = new stdclass();
$config->product->custom->batchEditFields = 'line,PO,QD,RD,status';
+34
View File
@@ -635,6 +635,40 @@ class product extends control
$this->display();
}
/**
* Ajax set unfoldID.
*
* @param int $productID
* @param string $action
* @access public
* @return void
*/
public function ajaxSetUnfoldID($productID, $action = 'add')
{
$this->loadModel('setting');
$setting = $this->setting->createDAO($this->setting->parseItemParam("owner={$this->app->user->account}&module=product&section=browse&key=unfoldID"), 'select')->fetch();
$newUnfoldID = $this->post->newUnfoldID;
if(empty($newUnfoldID)) die();
$newUnfoldID = json_decode($newUnfoldID);
$unfoldIdList = $setting ? json_decode($setting->value, true) : array();
foreach($newUnfoldID as $unfoldID)
{
unset($unfoldIdList[$productID][$unfoldID]);
if($action == 'add') $unfoldIdList[$productID][$unfoldID] = $unfoldID;
}
if(empty($setting))
{
$this->setting->setItem($this->app->user->account . ".product.browse.unfoldID", json_encode($unfoldIdList));
}
else
{
$this->dao->update(TABLE_CONFIG)->set('value')->eq(json_encode($unfoldIdList))->where('id')->eq($setting->id)->exec();
}
die('success');
}
/**
* Update order.
*
+99
View File
@@ -1,6 +1,14 @@
$(function()
{
if($('#storyList thead th.c-title').width() < 150) $('#storyList thead th.c-title').width(150);
$('#storyList td.has-child .story-toggle').each(function()
{
var $td = $(this).closest('td');
var labelWidth = 0;
if($td.find('.label').length > 0) labelWidth = $td.find('.label').width();
$td.find('a').eq(0).css('max-width', $td.width() - labelWidth - 60);
});
$(document).on('click', '.story-toggle', function(e)
{
var $toggle = $(this);
@@ -30,4 +38,95 @@ $(function()
$this.addClass('dropup');
}
});
if($('#productStoryForm td.has-child').length > 0)
{
$('#productStoryForm th.c-title').append("<button type='button' id='toggleFold' class='btn btn-mini collapsed'>" + unfoldAll + "</button>");
var allUnfold = true;
$('#productStoryForm td.has-child').each(function()
{
var storyID = $(this).closest('tr').attr('data-id');
if(typeof(unfoldID[storyID]) == 'undefined')
{
allUnfold = false;
$('#productStoryForm tr.parent-' + storyID).hide();
$(this).find('a.story-toggle').addClass('collapsed')
}
})
if(allUnfold)
{
$('#productStoryForm th.c-title #toggleFold').html(foldAll).removeClass('collapsed');
}
else
{
$('#productStoryForm th.c-title #toggleFold').html(unfoldAll).addClass('collapsed');
}
$(document).on('click', '#toggleFold', function()
{
var newUnfoldID = [];
var url = '';
if($(this).hasClass('collapsed'))
{
$('#productStoryForm td.has-child').each(function()
{
var storyID = $(this).closest('tr').attr('data-id');
$('#productStoryForm tr.parent-' + storyID).show();
$(this).find('a.story-toggle').removeClass('collapsed')
newUnfoldID.push(storyID);
})
$(this).html(foldAll).removeClass('collapsed');
url = createLink('product', 'ajaxSetUnfoldID', 'productID=' + productID);
}
else
{
$('#productStoryForm td.has-child').each(function()
{
var storyID = $(this).closest('tr').attr('data-id');
$('#productStoryForm tr.parent-' + storyID).hide();
$(this).find('a.story-toggle').addClass('collapsed');
newUnfoldID.push(storyID);
})
$(this).html(unfoldAll).addClass('collapsed');
url = createLink('product', 'ajaxSetUnfoldID', 'productID=' + productID + '&action=delete');
}
$.post(url, {'newUnfoldID': JSON.stringify(newUnfoldID)});
});
$('#productStoryForm td.has-child a.story-toggle').click(function()
{
var newUnfoldID = [];
var url = '';
if($(this).hasClass('collapsed'))
{
var storyID = $(this).closest('tr').attr('data-id');
$('#productStoryForm tr.parent-' + storyID).show();
newUnfoldID.push(storyID);
url = createLink('product', 'ajaxSetUnfoldID', 'productID=' + productID);
}
else
{
var storyID = $(this).closest('tr').attr('data-id');
$('#productStoryForm tr.parent-' + storyID).hide();
newUnfoldID.push(storyID);
url = createLink('product', 'ajaxSetUnfoldID', 'productID=' + productID + '&action=delete');
}
setTimeout(function()
{
if($('#productStoryForm td.has-child a.story-toggle.collapsed').length == 0)
{
$('#toggleFold').html(foldAll).removeClass('collapsed');
}
else
{
$('#toggleFold').html(unfoldAll).addClass('collapsed');
}
}, 100);
$.post(url, {'newUnfoldID': JSON.stringify(newUnfoldID)});
});
}
});
+9
View File
@@ -15,6 +15,15 @@
<?php js::set('browseType', $browseType);?>
<?php js::set('productID', $productID);?>
<?php js::set('branch', $branch);?>
<?php
/* Set unfold parent taskID. */
$this->app->loadLang('project');
$config->product->browse->unfoldID = isset($config->product->browse->unfoldID) ? json_decode($config->product->browse->unfoldID, true) : array();
$config->product->browse->unfoldID = zget($config->product->browse->unfoldID, $productID, array());
js::set('unfoldID', $config->product->browse->unfoldID);
js::set('unfoldAll', $lang->project->treeLevel['all']);
js::set('foldAll', $lang->project->treeLevel['root']);
?>
<div id="mainMenu" class="clearfix">
<div id="sidebarHeader">
<div class="title">
+1
View File
@@ -10,6 +10,7 @@ $config->project->list->exportFields = 'id,name,code,PM,end,status,totalEstimate
global $lang, $app;
$app->loadLang('task');
$config->project->task = new stdclass();
$config->project->create = new stdclass();
$config->project->edit = new stdclass();
$config->project->create->requiredFields = 'name,code,begin,end';
+34
View File
@@ -2461,6 +2461,40 @@ class project extends control
die(js::reload('parent.parent'));
}
/**
* Ajax set unfoldID.
*
* @param int $projectID
* @param string $action
* @access public
* @return void
*/
public function ajaxSetUnfoldID($projectID, $action = 'add')
{
$this->loadModel('setting');
$setting = $this->setting->createDAO($this->setting->parseItemParam("owner={$this->app->user->account}&module=project&section=task&key=unfoldID"), 'select')->fetch();
$newUnfoldID = $this->post->newUnfoldID;
if(empty($newUnfoldID)) die();
$newUnfoldID = json_decode($newUnfoldID);
$unfoldIdList = $setting ? json_decode($setting->value, true) : array();
foreach($newUnfoldID as $unfoldID)
{
unset($unfoldIdList[$projectID][$unfoldID]);
if($action == 'add') $unfoldIdList[$projectID][$unfoldID] = $unfoldID;
}
if(empty($setting))
{
$this->setting->setItem($this->app->user->account . ".project.task.unfoldID", json_encode($unfoldIdList));
}
else
{
$this->dao->update(TABLE_CONFIG)->set('value')->eq(json_encode($unfoldIdList))->where('id')->eq($setting->id)->exec();
}
die('success');
}
/**
* Import stories by plan.
*
+91
View File
@@ -8,6 +8,97 @@ $(function()
if($td.find('.label').length > 0) labelWidth = $td.find('.label').width();
$td.find('a').eq(0).css('max-width', $td.width() - labelWidth - 60);
});
if($('#projectTaskForm td.has-child').length > 0)
{
$('#projectTaskForm th.c-name').append("<button type='button' id='toggleFold' class='btn btn-mini collapsed'>" + unfoldAll + "</button>");
var allUnfold = true;
$('#projectTaskForm td.has-child').each(function()
{
var taskID = $(this).closest('tr').attr('data-id');
if(typeof(unfoldID[taskID]) == 'undefined')
{
allUnfold = false;
$('#projectTaskForm tr.parent-' + taskID).hide();
$(this).find('a.task-toggle').addClass('collapsed')
}
})
if(allUnfold)
{
$('#projectTaskForm th.c-name #toggleFold').html(foldAll).removeClass('collapsed');
}
else
{
$('#projectTaskForm th.c-name #toggleFold').html(unfoldAll).addClass('collapsed');
}
$(document).on('click', '#toggleFold', function()
{
var newUnfoldID = [];
var url = '';
if($(this).hasClass('collapsed'))
{
$('#projectTaskForm td.has-child').each(function()
{
var taskID = $(this).closest('tr').attr('data-id');
$('#projectTaskForm tr.parent-' + taskID).show();
$(this).find('a.task-toggle').removeClass('collapsed')
newUnfoldID.push(taskID);
})
$(this).html(foldAll).removeClass('collapsed');
url = createLink('project', 'ajaxSetUnfoldID', 'projectID=' + projectID);
}
else
{
$('#projectTaskForm td.has-child').each(function()
{
var taskID = $(this).closest('tr').attr('data-id');
$('#projectTaskForm tr.parent-' + taskID).hide();
$(this).find('a.task-toggle').addClass('collapsed');
newUnfoldID.push(taskID);
})
$(this).html(unfoldAll).addClass('collapsed');
url = createLink('project', 'ajaxSetUnfoldID', 'projectID=' + projectID + '&action=delete');
}
$.post(url, {'newUnfoldID': JSON.stringify(newUnfoldID)});
});
$('#projectTaskForm td.has-child a.task-toggle').click(function()
{
var newUnfoldID = [];
var url = '';
if($(this).hasClass('collapsed'))
{
var taskID = $(this).closest('tr').attr('data-id');
$('#projectTaskForm tr.parent-' + taskID).show();
newUnfoldID.push(taskID);
url = createLink('project', 'ajaxSetUnfoldID', 'projectID=' + projectID);
}
else
{
var taskID = $(this).closest('tr').attr('data-id');
$('#projectTaskForm tr.parent-' + taskID).hide();
newUnfoldID.push(taskID);
url = createLink('project', 'ajaxSetUnfoldID', 'projectID=' + projectID + '&action=delete');
}
setTimeout(function()
{
if($('#projectTaskForm td.has-child a.task-toggle.collapsed').length == 0)
{
$('#toggleFold').html(foldAll).removeClass('collapsed');
}
else
{
$('#toggleFold').html(unfoldAll).addClass('collapsed');
}
}, 100);
$.post(url, {'newUnfoldID': JSON.stringify(newUnfoldID)});
});
}
});
$('#module' + moduleID).closest('li').addClass('active');
+7
View File
@@ -19,6 +19,13 @@ js::set('moduleID', $moduleID);
js::set('productID', $productID);
js::set('projectID', $projectID);
js::set('browseType', $browseType);
/* Set unfold parent taskID. */
$config->project->task->unfoldID = isset($config->project->task->unfoldID) ? json_decode($config->project->task->unfoldID, true) : array();
$config->project->task->unfoldID = zget($config->project->task->unfoldID, $projectID, array());
js::set('unfoldID', $config->project->task->unfoldID);
js::set('unfoldAll', $lang->project->treeLevel['all']);
js::set('foldAll', $lang->project->treeLevel['root']);
?>
<div id="mainMenu" class="clearfix">
<div id="sidebarHeader">
+21 -8
View File
@@ -1089,11 +1089,13 @@ class taskModel extends model
if(!empty($oldTask->team))
{
$this->dao->update(TABLE_TEAM)->set('left')->eq(0)
->where('root')->eq($taskID)
->andWhere('type')->eq('task')
->andWhere('account')->eq($oldTask->assignedTo)
->exec();
$beginTag = false;
foreach($oldTask->team as $account => $team)
{
if($account == $task->assignedTo) break;
if($account == $oldTask->assignedTo) $beginTag = true;
if($beginTag) $this->dao->update(TABLE_TEAM)->set('left')->eq(0)->where('root')->eq($taskID)->andWhere('type')->eq('task')->andWhere('account')->eq($account)->exec();
}
$this->dao->update(TABLE_TEAM)->set('left')->eq($task->left)
->where('root')->eq($taskID)
@@ -1417,13 +1419,24 @@ class taskModel extends model
if(!empty($oldTask->team))
{
$this->dao->update(TABLE_TEAM)
->set('left')->eq(0)
->set('consumed')->eq($task->consumed)
$this->dao->update(TABLE_TEAM)->set('left')->eq(0)->set('consumed')->eq($task->consumed)
->where('root')->eq((int)$taskID)
->andWhere('type')->eq('task')
->andWhere('account')->eq($oldTask->assignedTo)->exec();
$beginTag = false;
foreach($oldTask->team as $account => $team)
{
if($account == $task->assignedTo) break;
if($account == $oldTask->assignedTo)
{
$beginTag = true;
continue;
}
if($beginTag) $this->dao->update(TABLE_TEAM)->set('left')->eq(0)->where('root')->eq($taskID)->andWhere('type')->eq('task')->andWhere('account')->eq($account)->exec();
}
$task = $this->computeHours4Multiple($oldTask, $task);
}