Merge branch 'feature/doctemplate' into release/21.7.2
This commit is contained in:
@@ -46,10 +46,12 @@ class programplan extends control
|
||||
* @param int $baselineID
|
||||
* @param string $browseType
|
||||
* @param int $queryID
|
||||
* @param string $from
|
||||
* @param int $blockID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browse(int $projectID = 0, int $productID = 0, string $type = 'gantt', string $orderBy = 'id_asc', int $baselineID = 0, string $browseType = '', int $queryID = 0)
|
||||
public function browse(int $projectID = 0, int $productID = 0, string $type = 'gantt', string $orderBy = 'id_asc', int $baselineID = 0, string $browseType = '', int $queryID = 0, string $from = 'project', int $blockID = 0)
|
||||
{
|
||||
if($type == 'lists')
|
||||
{
|
||||
@@ -57,6 +59,16 @@ class programplan extends control
|
||||
return;
|
||||
}
|
||||
|
||||
if($from == 'doc')
|
||||
{
|
||||
$this->loadModel('doc');
|
||||
$projects = $this->loadModel('project')->getPairsByModel(array('ipd', 'waterfall', 'waterfallplus'));
|
||||
if(empty($projects)) return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->tips->noProject));
|
||||
|
||||
if(!$projectID) $projectID = key($projects);
|
||||
$this->view->projects = $projects;
|
||||
}
|
||||
|
||||
$this->app->loadLang('stage');
|
||||
$this->session->set('projectPlanList', $this->app->getURI(true), 'project');
|
||||
$this->commonAction($projectID, $productID);
|
||||
@@ -71,6 +83,9 @@ class programplan extends control
|
||||
$browseType = strtolower($browseType);
|
||||
$plans = $this->programplanZen->buildStages($projectID, $productID, $baselineID, $type, $orderBy, $browseType, $queryID);
|
||||
|
||||
$this->view->from = $from;
|
||||
$this->view->blockID = $blockID;
|
||||
|
||||
/* Build gantt browse view. */
|
||||
$this->programplanZen->buildBrowseView($projectID, $productID, $plans, $type, $orderBy, $baselineID, $browseType, $queryID);
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
.mb-4-important {margin-bottom: 16px !important;}
|
||||
@@ -0,0 +1,24 @@
|
||||
window.insertToDoc = function(blockID, insertLink)
|
||||
{
|
||||
const docID = getDocApp()?.docID;
|
||||
const blockType = 'gantt';
|
||||
|
||||
const url = $.createLink('doc', 'buildZentaoList', `docID=${docID}&type=${blockType}&blockID=${blockID}`);
|
||||
const formData = new FormData();
|
||||
formData.append('ganttOptions', JSON.stringify(ganttOptions));
|
||||
formData.append('ganttFields', JSON.stringify(ganttFields));
|
||||
formData.append('showFields', JSON.stringify(showFields));
|
||||
formData.append('url', insertLink);
|
||||
|
||||
$.post(url, formData, function(resp)
|
||||
{
|
||||
resp = JSON.parse(resp);
|
||||
if(resp.result == 'success')
|
||||
{
|
||||
const oldBlockID = resp.oldBlockID;
|
||||
const newBlockID = resp.newBlockID;
|
||||
zui.Modal.hide();
|
||||
window.insertZentaoList && window.insertZentaoList(blockType, newBlockID, null, oldBlockID);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -15,7 +15,60 @@ namespace zin;
|
||||
data('fileName', 'gantt-export-' . $projectID);
|
||||
include './ganttfields.html.php';
|
||||
|
||||
if($app->rawModule == 'programplan')
|
||||
$isFromDoc = $from === 'doc';
|
||||
if($isFromDoc)
|
||||
{
|
||||
jsVar('ganttOptions', $plans);
|
||||
jsVar('ganttFields', $ganttFields);
|
||||
jsVar('showFields', $showFields);
|
||||
|
||||
$this->app->loadLang('doc');
|
||||
$projectChangeLink = createLink('programPlan', 'browse', "projectID={projectID}&productID={$productID}&type={$type}&orderBy=$orderBy&baselineID=&browseType={$browseType}&queryID={$queryID}&from=$from&blockID=$blockID");
|
||||
$insertLink = createLink('programPlan', 'browse', "projectID=$projectID&productID={$productID}&type={$type}&orderBy=$orderBy&baselineID=&browseType={$browseType}&queryID={$queryID}&from=$from&blockID={blockID}");
|
||||
|
||||
formPanel
|
||||
(
|
||||
setID('zentaolist'),
|
||||
setClass('mb-4-important'),
|
||||
set::title(sprintf($this->lang->doc->insertTitle, $this->lang->doc->zentaoList['gantt'])),
|
||||
set::actions(array()),
|
||||
set::showExtra(false),
|
||||
to::titleSuffix
|
||||
(
|
||||
span
|
||||
(
|
||||
setClass('text-muted text-sm text-gray-600 font-light'),
|
||||
span
|
||||
(
|
||||
setClass('text-warning mr-1'),
|
||||
icon('help'),
|
||||
),
|
||||
$lang->doc->previewTip
|
||||
)
|
||||
),
|
||||
formRow
|
||||
(
|
||||
formGroup
|
||||
(
|
||||
set::width('1/2'),
|
||||
set::name('project'),
|
||||
set::label($lang->doc->project),
|
||||
set::control(array('required' => false)),
|
||||
set::items($projects),
|
||||
set::value($projectID),
|
||||
set::required(),
|
||||
span
|
||||
(
|
||||
setClass('error-tip text-danger hidden'),
|
||||
$lang->doc->emptyError
|
||||
),
|
||||
on::change('[name="project"]')->do("loadModal('$projectChangeLink'.replace('{projectID}', $(this).val()))")
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if($app->rawModule == 'programplan' && !$isFromDoc)
|
||||
{
|
||||
$productDropdown = null;
|
||||
if($project->stageBy == 'product' && empty($project->isTpl))
|
||||
@@ -63,9 +116,17 @@ gantt
|
||||
(
|
||||
set('ganttLang', $ganttLang),
|
||||
set('ganttFields', $ganttFields),
|
||||
set('canEdit', common::hasPriv('programplan', 'ganttEdit')),
|
||||
set('canEditDeadline', common::hasPriv('review', 'edit')),
|
||||
set('canEdit', $isFromDoc ? false : hasPriv('programplan', 'ganttEdit')),
|
||||
set('canEditDeadline', $isFromDoc ? false : hasPriv('review', 'edit')),
|
||||
set('zooming', isset($zooming) ? $zooming : 'day'),
|
||||
set('showChart', !$dateDetails),
|
||||
set('options', $plans)
|
||||
);
|
||||
|
||||
$isFromDoc ? btn
|
||||
(
|
||||
setClass('mt-4'),
|
||||
set::type('primary'),
|
||||
on::click("insertToDoc($blockID, '$insertLink')"),
|
||||
$lang->doc->insertText
|
||||
) : null;
|
||||
|
||||
@@ -34,16 +34,23 @@ $ganttLang->wrongRelationSource = $lang->execution->error->wrongGanttRelationSou
|
||||
$ganttLang->wrongRelationTarget = $lang->execution->error->wrongGanttRelationTarget;
|
||||
$ganttLang->wrongKanbanTasks = $lang->execution->error->wrongKanbanTasks;
|
||||
|
||||
$typeHtml = '<span class="toggle-all-icon"><i class="icon-expand-alt"></i></span><a data-toggle="dropdown" href="#browseTypeList"><span class="text">' . $lang->programplan->ganttBrowseType[$ganttType] . '</span><span class="caret"></span></a>';
|
||||
$typeHtml .= '<menu class="dropdown-menu menu" id="browseTypeList">';
|
||||
foreach($lang->programplan->ganttBrowseType as $ganttBrowseType => $typeName)
|
||||
if($from == 'doc')
|
||||
{
|
||||
$link = $this->createLink('programplan', 'browse', "projectID=$projectID&productID=$productID&type=$ganttBrowseType");
|
||||
if($app->rawModule == 'review' and $app->rawMethod == 'assess') $this->createLink('review', 'assess', "reivewID=$reviewID&from=&type=$ganttBrowseType");
|
||||
$typeHtml = $lang->programplan->ganttBrowseType['gantt'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$typeHtml = '<span class="toggle-all-icon"><i class="icon-expand-alt"></i></span><a data-toggle="dropdown" href="#browseTypeList"><span class="text">' . $lang->programplan->ganttBrowseType[$ganttType] . '</span><span class="caret"></span></a>';
|
||||
$typeHtml .= '<menu class="dropdown-menu menu" id="browseTypeList">';
|
||||
foreach($lang->programplan->ganttBrowseType as $ganttBrowseType => $typeName)
|
||||
{
|
||||
$link = $this->createLink('programplan', 'browse', "projectID=$projectID&productID=$productID&type=$ganttBrowseType");
|
||||
if($app->rawModule == 'review' and $app->rawMethod == 'assess') $this->createLink('review', 'assess', "reivewID=$reviewID&from=&type=$ganttBrowseType");
|
||||
|
||||
$typeHtml .= '<li class="menu-item' . ($ganttType == $ganttBrowseType ? " active" : '') . '">' . html::a($link, $typeName, '', "class='item-content'") . '</li>';
|
||||
$typeHtml .= '<li class="menu-item' . ($ganttType == $ganttBrowseType ? " active" : '') . '">' . html::a($link, $typeName, '', "class='item-content'") . '</li>';
|
||||
}
|
||||
$typeHtml .= '</menu>';
|
||||
}
|
||||
$typeHtml .= '</menu>';
|
||||
|
||||
$ganttFields = array();
|
||||
$ganttFields['column_text'] = $typeHtml;
|
||||
|
||||
Reference in New Issue
Block a user