* finish task #5275.

This commit is contained in:
wangyidong
2019-02-22 10:36:16 +08:00
parent 6de8f45c44
commit adfd61aa66
8 changed files with 111 additions and 23 deletions
+7 -1
View File
@@ -532,7 +532,7 @@ class doc extends control
* @access public
* @return void
*/
public function sort()
public function sort($type = '')
{
if($_POST)
{
@@ -543,6 +543,12 @@ class doc extends control
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success'));
}
if($type)
{
$this->view->libs = $this->doc->getLibs($type);
$this->display();
}
}
/**
-4
View File
@@ -1,4 +0,0 @@
#libs .libs-group-heading{border:1px solid #ddd;overflow:hidden}
#libs .libs-group{border:1px solid #ddd; border-top:0px;overflow:hidden; margin-bottom:20px;}
#libs .libs-group.libs-custom{border-top:1px solid #ddd;overflow:hidden; margin-bottom:20px;}
#libs .lib-custom{width:130px; margin-bottom:10px;}
-13
View File
@@ -1,14 +1 @@
.lib-heading{border-right:1px solid #ddd;}
.lib-more a.more{font-weight:bold; display:block;}
#libs .libs-group-heading{border:1px solid #ddd;}
#libs .libs-group{border:1px solid #ddd; border-top:0px; margin-bottom:20px;}
#libs .libs-group.lib-more{border:0px; text-align:center; height:120px; line-height:110px;}
#libs .libs-group.lib-more:hover{background-color: #EBF2F9}
#libs .libs-custom-heading{text-align:center; height:120px; line-height:110px; position: relative; margin-bottom:20px;}
#libs .libs-custom-heading:hover{background-color: #EBF2F9}
#libs .libs-custom-heading a{display:block;height:100%;}
#libs .libs-custom-heading .lable-custom{position: absolute;left:8px;}
#libs hr {margin-top:0px;}
#libs .panel-body {overflow: auto; max-height: 224px;}
#pageActions ul.dropdown-menu{left: 67px}
-1
View File
@@ -80,7 +80,6 @@ $(document).ready(function()
}
}, 'json');
}
});
'use strict';
+2 -1
View File
@@ -141,7 +141,8 @@ $lang->doc->fastMenuIconList['collectedbyme'] = 'icon-folder-star';
$lang->doc->customObjectLibs['files'] = '显示附件库';
$lang->doc->customObjectLibs['customFiles'] = '显示自定义文档库';
$lang->doc->customShowLibs = '文档库显示设置';
$lang->doc->orderLib = '文档库排序';
$lang->doc->customShowLibs = '显示设置';
$lang->doc->customShowLibsList['zero'] = '显示空文档的库';
$lang->doc->customShowLibsList['unclosed'] = '只显示未关闭的项目';
+91 -1
View File
@@ -161,7 +161,20 @@ if(empty($type)) $type = 'product';
<?php endforeach;?>
</div>
</div>
<div class='side-footer'><?php echo html::a('###', "<i class='icon-cog'></i> {$lang->doc->customShowLibs}", '', "class='setting text-secondary small' data-target='#settingModal' data-toggle='modal'");?></div>
<div class='side-footer clearfix'>
<div class='pull-left'>
<?php echo html::a('###', "<i class='icon-cog'></i> {$lang->doc->customShowLibs}", '', "class='setting text-secondary small' data-target='#settingModal' data-toggle='modal'");?>
</div>
<div class='pull-right'>
<?php
if(common::hasPriv('doc', 'sort'))
{
echo html::a('###', "{$lang->doc->orderLib}", '', "id='orderLib' class='text-secondary small " . (($type != 'product' and $type !='project') ? '' : 'hidden') . "'");
echo html::a('javascript:cancelOrder()', "<i class='icon-back icon-sm'></i> {$lang->goback}", '', "id='cancelOrder' class='text-secondary small hidden'");
}
?>
</div>
</div>
</div>
<div class='modal fade' id='settingModal' aria-hidden="true">
<div class='modal-dialog mw-400px'>
@@ -185,4 +198,81 @@ if(empty($type)) $type = 'product';
</div>
</div>
</div>
<?php js::set('goback', $lang->goback);?>
<script>
$(function()
{
if($.cookie('docSideType'))
{
var type = $.cookie('docSideType');
var $tabs = $('#mainRow .side-col .tabs');
if($tabs.find('.tab-content .tab-pane#' + type).length >0)
{
$tabs.find('.nav-tabs li').removeClass('active');
$tabs.find('.nav-tabs li a[href="#' + type + '"]').parent().addClass('active');
$tabs.find('.tab-content .tab-pane').removeClass('active');
$tabs.find('.tab-content .tab-pane#' + type).addClass('active');
}
$.cookie('docSideType', '');
$('#mainRow .side-col .side-footer #orderLib').toggleClass('hidden', (type == 'product' || type == 'project'));
}
$('#mainRow .side-col .tabs .nav-tabs li a').click(function()
{
var href = $(this).attr('href');
$(this).closest('.side-col').find('.side-footer #orderLib').toggleClass('hidden', (href.indexOf('product') > 0 || href.indexOf('project') > 0));
});
$('#orderLib').click(function()
{
var $tabPane = $('#mainRow .side-col .tabs .tab-content .tab-pane.active');
var type = $tabPane.attr('id');
$.get(createLink('doc', 'sort', "type=" + type), function(data)
{
$tabPane.find('ul.tree').addClass('hidden');
$tabPane.find('.libs-group.sort').remove();
$tabPane.closest('.side-col').find('.side-footer .pull-right #orderLib').addClass('hidden');
$tabPane.closest('.side-col').find('.side-footer .pull-right #cancelOrder').removeClass('hidden');
$tabPane.append(data);
$tabPane.find('.libs-group.sort').sortable(
{
trigger: '.lib',
selector: '.lib',
finish: function()
{
var orders = {};
var orderNext = 1;
$('.libs-group.sort .lib').not('.files').not('.addbtn').each(function()
{
orders[$(this).data('id')] = orderNext ++;
});
$.post(createLink('doc', 'sort'), orders, function(data)
{
if(data.result == 'success')
{
$.cookie('docSideType', type);
return location.reload();
}
else
{
bootbox.alert(data.message);
}
}, 'json');
}
});
});
});
function cancelOrder()
{
var $tabPane = $('#mainRow .side-col .tabs .tab-content .tab-pane.active');
$tabPane.find('.libs-group.sort').remove();
$tabPane.find('ul.tree').removeClass('hidden');
$tabPane.closest('.side-col').find('.side-footer .pull-right #orderLib').removeClass('hidden');
$tabPane.closest('.side-col').find('.side-footer .pull-right #cancelOrder').addClass('hidden');
}
});
</script>
</div>
+9
View File
@@ -0,0 +1,9 @@
<div class='libs-group sort'>
<style>
.libs-group.sort {padding-left:15px;}
.libs-group.sort .lib {padding:2px 0 2px 6px;cursor: pointer;}
</style>
<?php foreach($libs as $libID => $libName):?>
<div class='lib' data-id='<?php echo $libID;?>'><i class='icon-move'></i> <?php echo $libName;?></div>
<?php endforeach;?>
</div>
+2 -2
View File
@@ -626,7 +626,7 @@ class taskModel extends model
if($task->consumed < $oldTask->consumed) die(js::error($this->lang->task->error->consumedSmall));
/* Fix bug#1388, Check children task projectID and moduleID. */
if($task->project != $oldTask->project)
if(isset($task->project) and $task->project != $oldTask->project)
{
$this->dao->update(TABLE_TASK)->set('project')->eq($task->project)->set('module')->eq($task->module)->where('parent')->eq($taskID)->exec();
}
@@ -705,7 +705,7 @@ class taskModel extends model
{
if($task->status == 'done') $this->loadModel('score')->create('task', 'finish', $taskID);
if($task->status == 'closed') $this->loadModel('score')->create('task', 'close', $taskID);
if($task->parent)
if(!empty($task->parent))
{
$this->dao->update(TABLE_TASK)->set('parent')->eq(-1)->where('id')->eq($task->parent)->exec();
$this->updateParentStatus($taskID);