* Merge code.

This commit is contained in:
Yagami
2021-02-25 13:28:21 +08:00
parent 5e9d124884
commit 774eceaf1d
23 changed files with 11 additions and 2515 deletions
-38
View File
@@ -1,38 +0,0 @@
<?php
/**
* The browse of programplan 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 programplan
* @version $Id: browse.html.php 4903 2013-06-26 05:32:59Z wyd621@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<style>#dropMenu{z-index:99999;}</style>
<?php js::set('browseType', $type);?>
<div id='mainContent' class='main-table'>
<?php if(empty($plans)):?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->programplan->noData;?></span>
<?php if(common::hasPriv('programplan', 'create')):?>
<?php echo html::a($this->createLink('programplan', 'create', "projectID=$projectID&productID=$productID"), "<i class='icon icon-plus'></i> " . $lang->programplan->create, '', "class='btn btn-info'");?>
<?php endif;?>
</p>
</div>
<?php else:?>
<?php if($type == 'gantt') include './gantt.html.php';?>
<?php if($type == 'lists') include './list.html.php';?>
<?php endif;?>
</div>
<script>
$('#subNavbar').find('ul li').each(function()
{
var that = $(this);
if(that.attr('data-id') != browseType) that.removeClass('active');
});
</script>
<?php include '../../common/view/footer.html.php';?>
-183
View File
@@ -1,183 +0,0 @@
<?php
/**
* The create of programplan 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 programplan
* @version $Id: create.html.php 4903 2013-06-26 05:32:59Z wyd621@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('browseType', $type);?>
<style>.icon-help{margin-left: 3px;}</style>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<span class='btn btn-link btn-active-text'>
<?php
$title = $lang->programplan->create;
if($planID) $title = $programPlan->name . $lang->project->statge . '(' . $programPlan->begin . $lang->project->to . $programPlan->end . ')';
echo "<span class='text'>{$title}</span>";
?>
</span>
</div>
</div>
<?php $hideAttribute = $planID == 0 ? '' : ' hidden'?>
<?php $class = $planID == 0 ? '' : "disabled='disabled'"?>
<?php $name = $planID == 0 ? $lang->programplan->name : $lang->programplan->subStageName;?>
<div id='mainContent' class='main-content'>
<form class='main-form form-ajax' method='post' id='planForm' enctype='multipart/form-data'>
<table class='table table-form'>
<thead>
<tr class='text-center'>
<th class='required'><?php echo $name;?></th>
<th class='w-110px'>
<?php echo $lang->programplan->percent;?>
<?php if($planID):?>
<i class='icon-help' data-toggle='popover' data-trigger='focus hover' data-placement='right' data-tip-class='text-muted popover-sm' data-container="body" data-content="<?php echo $lang->programplan->workloadTips;?>"></i>
<?php endif;?>
</th>
<th class='w-110px <?php echo $hideAttribute?>'><?php echo $lang->programplan->attribute;?></th>
<th class='w-110px'><?php echo $lang->project->acl;?></th>
<th class='w-110px'><?php echo $lang->programplan->milestone;?></th>
<th class='w-110px required'><?php echo $lang->programplan->begin;?></th>
<th class='w-110px required'><?php echo $lang->programplan->end;?></th>
<th class='w-110px'><?php echo $lang->programplan->realBegan;?></th>
<th class='w-110px'><?php echo $lang->programplan->realEnd;?></th>
<?php if(isset($this->config->qcVersion)):?>
<th class='w-110px'><?php echo $lang->programplan->output;?></th>
<?php endif;?>
<th class="w-70px text-center"> <?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php $i = 0;?>
<?php if(empty($plans) and $planID == 0):?>
<?php foreach($stages as $stage):?>
<tr>
<td><input type='text' name='names[]' id='names<?php echo $i;?>' value='<?php echo $stage->name;?>' class='form-control' /></td>
<td>
<div class='input-group'>
<input type='text' name='percents[]' id='percent<?php echo $i;?>' value='<?php echo $stage->percent;?>' class='form-control'/>
<span class='input-group-addon'>%</span>
</div>
</td>
<td class='<?php echo $hideAttribute?>'><?php echo html::select("attributes[$i]", $lang->stage->typeList, $stage->type, "class='form-control'");?></td>
<td><?php echo html::select("acl[]", $lang->project->aclList, 'open', "class='form-control' $class");?></td>
<td><?php echo html::radio("milestone[$i]", $lang->programplan->milestoneList, 0);?></td>
<td><input type='text' name='begin[]' id='begin<?php echo $i;?>' value='' class='form-control form-date' /></td>
<td><input type='text' name='end[]' id='end<?php echo $i;?>' value='' class='form-control form-date' /></td>
<td><input type='text' name='realBegan[]' id='realBegan<?php echo $i;?>' value='' class='form-control form-date' /></td>
<td><input type='text' name='realEnd[]' id='realEnd<?php echo $i;?>' value='' class='form-control form-date' /></td>
<?php if(isset($this->config->qcVersion)):?>
<td><?php echo html::select("output[$i][]", $documentList, '', "class='form-control chosen' multiple");?></td>
<?php endif;?>
<td class='c-actions text-left'>
<a href='javascript:;' onclick='addItem(this)' class='btn btn-link'><i class='icon-plus'></i></a>
<a href='javascript:;' onclick='deleteItem(this)' class='btn btn-link'><i class='icon icon-close'></i></a>
</td>
</tr>
<?php $i ++;?>
<?php endforeach;?>
<?php endif;?>
<?php if(!empty($plans)):?>
<?php foreach($plans as $plan):?>
<?php $disabled = $plan->setMilestone ? '' : "disabled='disabled'"?>
<?php echo html::hidden('planIDList[]', $plan->id);?>
<tr>
<td><input type='text' name='names[]' id='names<?php echo $i;?>' value='<?php echo $plan->name;?>' class='form-control' /></td>
<td>
<div class='input-group'>
<input type='text' name='percents[]' id='percent<?php echo $i;?>' value='<?php echo $plan->percent;?>' class='form-control' />
<span class='input-group-addon'>%</span>
</div>
</td>
<td class='<?php echo $hideAttribute?>'><?php echo html::select("attributes[$i]", $lang->stage->typeList, $plan->attribute, "class='form-control'");?></td>
<td><?php echo html::select("acl[]", $lang->project->aclList, $plan->acl, "class='form-control' $class");?></td>
<td><?php echo html::radio("milestone[$i]", $lang->programplan->milestoneList, $plan->milestone, $disabled);?></td>
<td><input type='text' name='begin[] ' id='begin<?php echo $i;?>' value='<?php echo $plan->begin;?>' class='form-control form-date' /></td>
<td><input type='text' name='end[]' id='end<?php echo $i;?>' value='<?php echo $plan->end;?>' class='form-control form-date' /></td>
<td><input type='text' name='realBegan[] ' id='realBegan<?php echo $i;?>' value='<?php echo $plan->realBegan;?>' class='form-control form-date' /></td>
<td><input type='text' name='realEnd[]' id='realEnd<?php echo $i;?>' value='<?php echo $plan->realEnd;?>' class='form-control form-date' /></td>
<?php if(isset($this->config->qcVersion)):?>
<?php $option = empty($plan->output) ? 0 : explode(',', $plan->output);?>
<td><?php echo html::select("output[$i][]", $documentList, $option, "class='form-control chosen' multiple");?></td>
<?php endif;?>
<td class='c-actions text-left'>
<a href='javascript:;' onclick='addItem(this)' class='btn btn-link'><i class='icon-plus'></i></a>
</td>
</tr>
<?php $i ++;?>
<?php endforeach;?>
<?php endif;?>
<?php for($j = 0; $j < 5; $j ++):?>
<tr class='addedItem'>
<td><input type='text' name='names[]' id='names<?php echo $i;?>' value='' class='form-control' /></td>
<td>
<div class='input-group'>
<input type='text' name='percents[]' id='percent<?php echo $i;?>' value='' class='form-control' />
<span class='input-group-addon'>%</span>
</div>
</td>
<td class='<?php echo $hideAttribute?>'><?php echo html::select("attributes[$i]", $lang->stage->typeList, '', "class='form-control'");?></td>
<td><?php echo html::select("acl[]", $lang->project->aclList, 'open', "class='form-control' $class");?></td>
<td><?php echo html::radio("milestone[$i]", $lang->programplan->milestoneList, 0);?></td>
<td><input type='text' name='begin[] ' id='begin<?php echo $i;?>' value='' class='form-control form-date' /></td>
<td><input type='text' name='end[]' id='end<?php echo $i;?>' value='' class='form-control form-date' /></td>
<td><input type='text' name='realBegan[] ' id='realBegan<?php echo $i;?>' value='' class='form-control form-date' /></td>
<td><input type='text' name='realEnd[]' id='realEnd<?php echo $i;?>' value='' class='form-control form-date' /></td>
<?php if(isset($this->config->qcVersion)):?>
<td><?php echo html::select("output[$i][]", $documentList, '', "class='form-control chosen' multiple");?></td>
<?php endif;?>
<td class='c-actions text-left'>
<a href='javascript:;' onclick='addItem(this)' class='btn btn-link'><i class='icon-plus'></i></a>
<a href='javascript:;' onclick='deleteItem(this)' class='btn btn-link'><i class='icon icon-close'></i></a>
</td>
</tr>
<?php $i ++;?>
<?php endfor;?>
</tbody>
<tfoot>
<tr>
<?php $colspan = $planID == 0 ? 9 : 8;?>
<td colspan='<?php echo $colspan?>' class='text-center form-actions'><?php echo html::submitButton() . ' ' . html::backButton(); ?></td>
</tr>
</tfoot>
</table>
<?php js::set('i', $i);?>
</form>
</div>
<div>
<?php $i = '%i%';?>
<table class='hidden'>
<tr id='addItem' class='hidden'>
<td><input type='text' name='names[]' id='names<?php echo $i;?>' class='form-control' /></td>
<td>
<div class='input-group'>
<input type='text' name='percents[]' id='percent<?php echo $i;?>' class='form-control' />
<span class='input-group-addon'>%</span>
</div>
</td>
<td class='<?php echo $hideAttribute?>'><?php echo html::select("attributes[$i]", $lang->stage->typeList, '', "class='form-control'");?></td>
<td><?php echo html::select("acl[]", $lang->project->aclList, 'open', "class='form-control' $class");?></td>
<td><?php echo html::radio("milestone[$i]", $lang->programplan->milestoneList, 0);?></td>
<td><input type='text' name='begin[] ' id='begin<?php echo $i;?>' class='form-control form-date' /></td>
<td><input type='text' name='end[]' id='end<?php echo $i;?>' class='form-control form-date' /></td>
<td><input type='text' name='realBegan[] ' id='realBegan<?php echo $i;?>' class='form-control form-date' /></td>
<td><input type='text' name='realEnd[]' id='realEnd<?php echo $i;?>' class='form-control form-date' /></td>
<?php if(isset($this->config->qcVersion)):?>
<td><?php echo html::select("output[$i][]", $documentList, '', "class='form-control chosen ' multiple");?></td>
<?php endif;?>
<td class='c-actions text-center'>
<a href='javascript:;' onclick='addItem(this)' class='btn btn-link'><i class='icon-plus'></i></a>
<a href='javascript:;' onclick='deleteItem(this)' class='btn btn-link'><i class='icon icon-close'></i></a>
</td>
</tr>
</table>
</div>
<script>$('[data-toggle="popover"]').popover();</script>
<?php include '../../common/view/footer.html.php';?>
-107
View File
@@ -1,107 +0,0 @@
<?php
/**
* The edit of programplan 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 programplan
* @version $Id: edit.html.php 4903 2013-06-26 05:32:59Z wyd621@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<div id="mainContent" class="main-content fade">
<div class="center-block">
<div class="main-header">
<h2><?php echo $lang->programplan->edit;?></h2>
</div>
<form class="load-indicator main-form form-ajax" method='post' enctype='multipart/form-data' id='dataform'>
<table class="table table-form">
<tbody>
<tr>
<th class="w-100px"><?php echo $lang->programplan->parent;?></th>
<td colspan='2'><?php echo html::select('parent', $parentStage, $plan->parent, "class='form-control chosen '");?></td>
</tr>
<tr>
<th class='w-100px'><?php echo $lang->programplan->name;?> </th>
<td colspan='2'><?php echo html::input('name', $plan->name, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->programplan->percent;?> </th>
<td colspan='2'>
<div class='input-group'>
<?php echo html::input('percent', $plan->percent, "class='form-control'");?>
<div class='input-group-addon'>%</span>
</div>
</td>
</tr>
<tr class="<?php if($plan->grade == 2) echo "hidden";?>" id="attributeType">
<th><?php echo $lang->programplan->attribute;?> </th>
<td colspan='2'><?php echo html::select('attribute', $lang->stage->typeList, $plan->attribute, "class='form-control'");?></td>
</tr>
<?php if($plan->setMilestone):?>
<tr>
<th><?php echo $lang->programplan->milestone;?> </th>
<td colspan='2'><?php echo html::radio('milestone', $lang->programplan->milestoneList, $plan->milestone);?></td>
</tr>
<?php else:?>
<?php echo html::hidden('milestone', $plan->milestone);?>
<?php endif;?>
<tr>
<th><?php echo $lang->project->acl;?> </th>
<?php $class = $plan->grade == 2 ? "disabled='disabled'" : '';?>
<td colspan='2'><?php echo html::select('acl', $lang->project->aclList, $plan->acl, "class='form-control' $class");?></td>
</tr>
<tr>
<th><?php echo $lang->programplan->planDateRange;?> </th>
<td colspan='2'>
<div class="input-group title-group">
<?php echo html::input('begin', $plan->begin, "class='form-control form-date'");?>
<span class="input-group-addon fix-border br-0"><?php echo $lang->project->to;?></span>
<?php echo html::input('end', $plan->end, "class='form-control form-date'");?>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->programplan->realDateRange;?> </th>
<td colspan='2'>
<div class="input-group title-group">
<?php echo html::input('realBegan', $plan->realBegan, "class='form-control form-date'");?>
<span class="input-group-addon fix-border br-0"><?php echo $lang->project->to;?></span>
<?php echo html::input('realEnd', $plan->realEnd, "class='form-control form-date'");?>
</div>
</td>
</tr>
<?php if(isset($this->config->qcVersion)):?>
<tr>
<th><?php echo $lang->programplan->output;?> </th>
<td colspan='4'><?php echo html::select('output[]', $documentList, $plan->output, "class='form-control chosen ' multiple");?></td>
</tr>
<?php endif;?>
<tr>
<td colspan='4' class='form-actions text-center'><?php echo html::submitButton() . html::backButton()?></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<script>
$("#parent").change(function()
{
var parent = $(this).children("option:selected").val();
if(parent == 0)
{
$("#attributeType").removeClass('hidden');
$("#acl").attr('disabled', false);
}
else
{
$("#attributeType").addClass('hidden');
$("#acl").attr('disabled', true);
}
});
</script>
<?php include '../../common/view/footer.html.php';?>
-422
View File
@@ -1,422 +0,0 @@
<?php
/**
* The gantt of programplan 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 programplan
* @version $Id: gantt.html.php 4903 2013-06-26 05:32:59Z wyd621@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/ext/view/gantt.html.php';?>
<style>
#ganttView {height: 600px;}
#mainContent:before {background: #fff;}
.gantt-fullscreen #header,
.gantt-fullscreen #mainMenu,
.gantt-fullscreen #footer {display: none!important;}
.gantt-fullscreen #mainContent {position: fixed; top: 0; right: 0; bottom: 0; left: 0}
.gantt_task_content{display: none;}
.checkbox-primary {margin-top: 0px; margin-left: 10px;}
form {display: block; margin-top: 0em; margin-block-end: 1em;}
</style>
<?php js::set('customUrl', $this->createLink('programplan', 'ajaxCustom'));?>
<?php js::set('dateDetails', $dateDetails);?>
<div id='mainContent' class='main-content load-indicator' data-loading='<?php echo $lang->programplan->exporting;?>'>
<form class="main-form form-ajax">
<div class="example">
<?php echo html::commonButton($lang->programplan->full, 'id="fullScreenBtn"', 'btn btn-primary btn-sm')?>
<?php echo html::checkbox('stageCustom', $lang->programplan->stageCustom, $selectCustom);?>
</div>
</form>
<div id='ganttContainer'>
<div class='gantt' id='ganttView'></div>
</div>
</div>
<script>
var scriptLoadedMap = {};
var loadingPrefixText = '<?php echo $lang->programplan->exporting;?>';
function getRemoteScript(url, successCallback, errorCallback)
{
if(scriptLoadedMap[url]) return successCallback && successCallback();
$.getScript(url, function()
{
scriptLoadedMap[url] = true;
if(successCallback) successCallback();
}).fail(function()
{
if(errorCallback) errorCallback('Cannot load "' + url + '".');
});
}
function updateProgress(progress)
{
var progressText = loadingPrefixText;
if(progress < 1) progressText += Math.floor(progress * 100) + '%';
$('#mainContent').attr('data-loading', progressText);
}
function drawGanttToCanvas(exportType, successCallback, errorCallback)
{
updateProgress(0);
exportType = exportType || 'image';
var $ganttView = $('#ganttView');
var oldHeight = $ganttView.css('height');
var $ganttContainer = $('#ganttContainer');
var $ganttDataArea = $ganttView.find('.gantt_data_area');
var $ganttDridData = $ganttView.find('.gantt_grid_data');
var ganttHeight = $ganttView.find('.gantt_task_bg').outerHeight() + $ganttView.find('.gantt_grid_scale').outerHeight() + 1;
var ganttWidth = $ganttDataArea.outerWidth() + $ganttDridData.outerWidth();
$ganttContainer.css(
{
height: ganttHeight + $('#ganttHeader').outerHeight() + 80,
width: ganttWidth + 93
});
$ganttView.css('height', ganttHeight);
gantt.render();
updateProgress(0.1);
getRemoteScript('<?php echo $jsRoot . 'html2canvas/min.js';?>', function()
{
updateProgress(0.2);
var afterFinish = function(canvas)
{
$ganttContainer.css(
{
width: '',
height: ''
});
$ganttView.css('height', oldHeight);
if(canvas) canvas.remove();
};
var delayTime = Math.max(1000, Math.floor(10 * (ganttHeight * ganttWidth) / 100000));
var progressTimer;
if(delayTime > 1500)
{
var startProgress = 0.2;
var deltaProgress = 0.5 / Math.floor(delayTime/1000);
progressTimer = setInterval(function()
{
startProgress += deltaProgress;
updateProgress(Math.min(0.7, startProgress));
}, 1000);
}
setTimeout(function()
{
if(progressTimer) clearInterval(progressTimer);
updateProgress(0.7);
html2canvas($ganttContainer[0], {logging: false}).then(function(canvas)
{
var isExportPDF = exportType === 'pdf';
updateProgress(isExportPDF ? 0.8 : 0.9);
canvas.onerror = function()
{
afterFinish(canvas);
if(errorCallback) errorCallback('Cannot convert image to blob.');
};
if(isExportPDF)
{
var width = canvas.width;
var height = canvas.height;
getRemoteScript('<?php echo $jsRoot . 'pdfjs/min.js';?>', function()
{
updateProgress(0.8);
var pdf = new jsPDF(
{
format: [width, height],
unit: 'px',
orientation: width > height ? 'l' : 'p'
});
pdf.addImage(canvas, 0, 0, pdf.internal.pageSize.getWidth(), pdf.internal.pageSize.getHeight());
pdf.save('gantt-export-<?php echo $projectID;?>.pdf');
if(successCallback) successCallback(pdf);
afterFinish();
}, function(error)
{
afterFinish(canvas);
if(errorCallback) errorCallback(error);
});
}
else
{
canvas.toBlob(function(blob)
{
updateProgress(0.95);
var imageUrl = URL.createObjectURL(blob);
$('#ganttDownload').attr({href: imageUrl})[0].click();
if(successCallback) successCallback(imageUrl);
afterFinish(canvas);
});
}
}).catch(function(error)
{
afterFinish();
if(errorCallback) errorCallback('Cannot draw graphic to canvas.');
});
}, delayTime);
}, errorCallback);
}
function exportGantt(exportType)
{
var $mainContent = $('#mainContent');
$mainContent.addClass('loading').css('height', Math.max(200, Math.floor($(window).height() - $('#footer').outerHeight() - $('#header').outerHeight() - $('#mainMenu').outerHeight() - 38)));
$('#ganttExportDate').text(new Date().format('yyyy-MM-dd hh:mm:ss'));
var afterFinish = function(url)
{
setTimeout(function()
{
$mainContent.css('height', '').removeClass('loading');
}, 300);
updateProgress(1);
};
drawGanttToCanvas(exportType, afterFinish, function(errorText)
{
afterFinish();
$.zui.messager.danger('<?php echo $lang->programplan->exportFail;?>' + (errorText || ''));
});
}
function getByIdForGantt(list, id)
{
for (var i = 0; i < list.length; i++)
{
if (list[i].key == id) return list[i].label || "";
}
return "";
}
function zoomTasks(node)
{
switch(node.value)
{
case "day":
gantt.config.min_column_width = 70;
gantt.config.scales = [{unit: 'day', step: 1, format: '%m-%d'}];
gantt.config.scale_height = 35;
break;
case "week":
gantt.config.min_column_width = 70;
gantt.config.scales = [{unit: 'week', step: 1, format: "<?php echo $lang->project->gantt->zooming['week'];?> #%W"}, {unit:"day", step:1, date:"%D"}]
gantt.config.scale_height = 60;
break;
case "month":
gantt.config.min_column_width = 70;
gantt.config.scale_height = 60;
gantt.config.scales = [{unit: 'month', step: 1, format: '%M'}, {unit:"week", step:1, date:"<?php echo $lang->project->gantt->zooming['week'];?> #%W"}];
break;
}
gantt.render();
}
function updateCriticalPath()
{
gantt.config.highlight_critical_path = !gantt.config.highlight_critical_path;
if(gantt.config.highlight_critical_path)
{
$('#criticalPath').html(<?php echo json_encode($lang->programplan->hideCriticalPath);?>);
gantt.config.highlight_critical_path = true;
}
else
{
$('#criticalPath').html(<?php echo json_encode($lang->programplan->showCriticalPath);?>);
gantt.config.highlight_critical_path = false;
}
gantt.render();
}
$("#fullScreenBtn").on("click", function()
{
$("#mainContent").css("z-index", "9999");
$("#ganttView").css("z-index", "9999");
});
$(function()
{
// Set gantt view height
var resizeGanttView = function()
{
if(gantt.getState().fullscreen) return false;
$('#ganttView').css('height', Math.max(200, Math.floor($(window).height() - $('#footer').outerHeight() - $('#header').outerHeight() - $('#mainMenu').outerHeight() - 80)));
};
var ganttData = $.parseJSON(<?php echo json_encode($plans);?>);
if(!ganttData.data) ganttData.data = [];
gantt.config.readonly = true;
gantt.config.row_height = 25;
gantt.config.min_column_width = 40;
gantt.config.details_on_create = false;
gantt.config.scales = [{unit: 'day', step: 1, format: '%m-%d'}];
gantt.config.duration_unit = "day";
gantt.config.columns = [
{name: 'text', width: '*', tree: true, resize: true, width:200},
{name: 'start_date', align: 'center', resize: true, width: 80},
{name: 'deadline', align: 'center', resize: true, width: 80},
{name: 'duration', align: 'center', resize: true, width: 60},
{name: 'percent', align: 'center', resize: true, width:70, template: function(plan)
{
if(plan.percent) return Math.round(plan.percent) + '%';
}
},
{name: 'taskProgress', align: 'center', resize: true, width: 60},
{name: 'realBegan', align: 'center', resize: true, width: 80},
{name: 'realEnd', align: 'center', width: 80}
];
gantt.locale.labels.column_text = "<?php echo $lang->programplan->name;?>";
gantt.locale.labels.column_percent = "<?php echo $lang->programplan->percentAB;?>";
gantt.locale.labels.column_taskProgress = "<?php echo $lang->programplan->taskProgress;?>";
gantt.locale.labels.column_start_date = "<?php echo $lang->programplan->begin;?>";
gantt.locale.labels.column_deadline = "<?php echo $lang->programplan->end;?>";
gantt.locale.labels.column_realBegan = "<?php echo $lang->programplan->realBegan;?>";
gantt.locale.labels.column_realEnd = "<?php echo $lang->programplan->realEnd;?>";
gantt.locale.labels.column_duration = "<?php echo $lang->programplan->duration;?>";
if(dateDetails)
{
gantt.config.layout = {
rows: [
{
cols: [
{
view: 'grid',
scrollX: 'scrollHor',
scrollY: 'scrollVer'
}
]
},
{
view: 'scrollbar',
id: 'scrollHor',
height: 20
}
]
}
}
var date2Str = gantt.date.date_to_str(gantt.config.task_date);
var today = new Date();
var todayTips = "<?php echo $lang->programplan->today;?>";
gantt.addMarker({
start_date: today,
css: "today",
text: todayTips,
title: todayTips + ": " + date2Str(today)
});
gantt.templates.scale_cell_class = function(date)
{
if(date.getDay() == 0 || date.getDay() == 6) return 'weekend';
};
gantt.templates.timeline_cell_class = function(item, date)
{
if(date.getDay() == 0 || date.getDay() == 6) return 'weekend';
};
gantt.attachEvent('onTemplatesReady', function()
{
$('#fullScreenBtn').click(function()
{
gantt.expand();
});
});
var isGanttExpand = false;
var delayTimer = null;
var handleFullscreen = function()
{
if(isGanttExpand)
{
$('body').addClass('gantt-fullscreen');
$('#ganttView').css('height', $(window).height() - 40);
isGanttExpand = false;
}
else
{
$('body').removeClass('gantt-fullscreen');
resizeGanttView();
}
delayTimer = null;
};
var delayHandleFullscreen = function()
{
if(delayTimer) clearTimeout(delayTimer);
delayTimer = setTimeout(handleFullscreen, 50);
};
gantt.attachEvent('onBeforeExpand', function()
{
$('body').addClass('gantt-fullscreen');
isGanttExpand = true;
return true;
});
if(document.addEventListener)
{
document.addEventListener('webkitfullscreenchange', delayHandleFullscreen, false);
document.addEventListener('mozfullscreenchange', delayHandleFullscreen, false);
document.addEventListener('fullscreenchange', delayHandleFullscreen, false);
document.addEventListener('MSFullscreenChange', delayHandleFullscreen, false);
}
resizeGanttView();
$(window).resize(resizeGanttView);
gantt.templates.grid_folder = function(item) {
return "";
};
gantt.templates.grid_file = function(item) {
return "";
};
gantt.init('ganttView');
gantt.parse(ganttData);
gantt.showDate(new Date());
// Show task in modal on click task
var taskModalTrigger = new $.zui.ModalTrigger({type: 'iframe', width: '80%'});
gantt.attachEvent('onTaskClick', function(id, e)
{
if($(e.srcElement).hasClass('gantt_close') || $(e.srcElement).hasClass('gantt_open')) return false;
if(typeof id === 'string') id = parseInt(id);
if(!isNaN(id) && id > 0)
{
//taskModalTrigger.show({url: createLink('task', 'view', 'taskID=' + id, 'html', true)});
}
});
// Make folder can open or close by click
$('#ganttView').on('click', '.gantt_close,.gantt_open', function()
{
var $task = $(this).closest('.gantt_row_task');
var task = gantt.getTask($task.attr('task_id'));
if(task) gantt[task.$open ? 'close' : 'open'](task.id);
});
$(".checkbox-primary").on('click', function()
{
var stageCustom = [];
$("input[name='stageCustom[]']:checked").each(function()
{
var custom = $(this).val();
stageCustom.push(custom);
});
if(stageCustom.length == 0) stageCustom = 0;
$.ajax({
url: customUrl,
dataType: "json",
data: {stageCustom: stageCustom},
type: "post",
success: function(result)
{
window.location.reload();
}
});
});
});
</script>
-89
View File
@@ -1,89 +0,0 @@
<?php
/**
* The list of programplan 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 programplan
* @version $Id: list.html.php 4903 2013-06-26 05:32:59Z wyd621@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php
include '../../common/view/datatable.fix.html.php';
js::set('confirmDelete', $lang->programplan->confirmDelete);
?>
<style>
#tableCustomBtn{display: none;}
.table-children {border-left: 2px solid #cbd0db; border-right: 2px solid #cbd0db;}
.table tbody > tr.table-children.table-child-top {border-top: 2px solid #cbd0db;}
.table tbody > tr.table-children.table-child-bottom {border-bottom: 2px solid #cbd0db;}
.table td.has-child > a:not(.plan-toggle) {max-width: 90%; max-width: calc(100% - 30px); display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.table td.has-child > .plan-toggle {color: #838a9d; position: relative; top: 1px;}
.table td.has-child > .plan-toggle:hover {color: #006af1; cursor: pointer;}
.table td.has-child > .plan-toggle > .icon {font-size: 16px; display: inline-block; transition: transform .2s; -ms-transform:rotate(-90deg); -moz-transform:rotate(-90deg); -o-transform:rotate(-90deg); -webkit-transform:rotate(-90deg); transform: rotate(-90deg);}
.table td.has-child > .plan-toggle > .icon:before {text-align: left;}
.table td.has-child > .plan-toggle.collapsed > .icon {-ms-transform:rotate(90deg); -moz-transform:rotate(90deg); -o-transform:rotate(90deg); -webkit-transform:rotate(90deg); transform: rotate(90deg);}
.main-table tbody > tr.table-children > td:first-child::before {width: 3px;}
@-moz-document url-prefix() {.main-table tbody > tr.table-children > td:first-child::before {width: 4px;}}
</style>
<form class='main-table table-programplan' id='programplanForm' method='post'>
<div class="table-header fixed-right">
<nav class="btn-toolbar pull-right"></nav>
</div>
<?php
$vars = "projectID=$projectID&productID=$productID&type=lists&orderBy=%s";
$setting = $this->datatable->getSetting('programplan');
$widths = $this->datatable->setFixedFieldWidth($setting);
$widths['leftWidth'] = 300;
$columns = 0;
?>
<table class='table has-sort-head' id='programplanList' data-fixed-left-width='<?php echo $widths['leftWidth']?>' data-fixed-right-width='<?php echo $widths['rightWidth']?>' data-checkbox-name='programplanList[]'>
<thead>
<tr>
<th class='w-50px'><?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th> <?php common::printOrderLink('name', $orderBy, $vars, $lang->programplan->name);?></th>
<th class='w-90px'><?php common::printOrderLink('percent', $orderBy, $vars, $lang->programplan->percent);?></th>
<th class='w-80px'><?php common::printOrderLink('attribute', $orderBy, $vars, $lang->programplan->attribute);?></th>
<th class='w-90px'><?php common::printOrderLink('begin', $orderBy, $vars, $lang->programplan->begin);?></th>
<th class='w-90px'><?php common::printOrderLink('end', $orderBy, $vars, $lang->programplan->end);?></th>
<th class='w-90px'><?php common::printOrderLink('realBegan', $orderBy, $vars, $lang->programplan->realBegan);?></th>
<th class='w-90px'><?php common::printOrderLink('realEnd', $orderBy, $vars, $lang->programplan->realEnd);?></th>
<th class='w-150px text-center'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php foreach($plans as $plan):?>
<tr data-id='<?php echo $plan->id?>'>
<?php foreach($setting as $key => $value) $this->programplan->printCell($value, $plan, $users, $projectID);?>
</tr>
<?php if(!empty($plan->children)):?>
<?php $i = 0;?>
<?php foreach($plan->children as $key => $child):?>
<?php $class = $i == 0 ? ' table-child-top' : '';?>
<?php $class .= ($i + 1 == count($plan->children)) ? ' table-child-bottom' : '';?>
<tr class='table-children<?php echo $class;?> parent-<?php echo $plan->id;?>' data-id='<?php echo $child->id?>'>
<?php foreach($setting as $key => $value) $this->programplan->printCell($value, $child, $users, $projectID);?>
</tr>
<?php $i ++;?>
<?php endforeach;?>
<?php endif;?>
<?php endforeach;?>
</tbody>
</table>
</form>
<script>
$(function(){$('#programplanForm').table();})
$(document).on('click', '.plan-toggle', function(e)
{
var $toggle = $(this);
var id = $(this).data('id');
var isCollapsed = $toggle.toggleClass('collapsed').hasClass('collapsed');
$toggle.closest('[data-ride="table"]').find('tr.parent-' + id).toggle(!isCollapsed);
e.stopPropagation();
e.preventDefault();
});
</script>