Merge branch 'sprint/168_sunhao/doc_tree_sortable' into sprint/168
This commit is contained in:
@@ -42,14 +42,9 @@
|
||||
.title {font-size: 20px !important;}
|
||||
.article-content.comment {width: 100% !important;}
|
||||
|
||||
#custom, .tree {overflow: visible}
|
||||
.tree li>.list-toggle {left: -4px; top: 0;}
|
||||
.tree-group {position: relative;}
|
||||
.tree-group > .module-name {white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; display: block;}
|
||||
.tree-group .treeActions {display: none; position: absolute; right: 0; top: 0; background-color: #fff; white-space: nowrap;}
|
||||
.tree-group:hover > .module-name {width: calc(100% - 84px);}
|
||||
.tree-group:hover .treeActions {display: block}
|
||||
.tree-group .treeActions > .dropdown {display: inline-block;}
|
||||
.tree-group .dropdown-menu {position: absolute; right: 0; left: auto; margin-top: -2px;}
|
||||
.tree-group .dropdown-menu > li > a {max-width: 100%; color: #3c4353!important; font-weight: normal!important;}
|
||||
.tree-group .dropdown-menu > li > a:hover {color: #fff !important;}
|
||||
.tree-group .tree-actions {display: none; position: absolute; right: 0; top: 0; background-color: #fff; white-space: nowrap;}
|
||||
.tree-group:hover > .module-name {width: calc(100% - 20px);}
|
||||
.tree-group:hover .tree-actions {display: block}
|
||||
|
||||
@@ -2275,7 +2275,7 @@ EOT;
|
||||
if($startModule) $startModulePath = $startModule->path . '%';
|
||||
}
|
||||
|
||||
$docs = $this->dao->select('*')->from(TABLE_DOC)
|
||||
$docs = $this->dao->select('*')->from(TABLE_DOC)
|
||||
->where('lib')->eq($rootID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchAll();
|
||||
@@ -2363,7 +2363,7 @@ EOT;
|
||||
else
|
||||
{
|
||||
if(!$docID and $currentMethod != 'tablecontents') $docID = $doc->id;
|
||||
$treeMenu[$module->id] .= '<li' . ($doc->id == $docID ? ' class="active"' : ' class="doc"') . '>';
|
||||
$treeMenu[$module->id] .= '<li' . ($doc->id == $docID ? ' class="active"' : ' class="doc"') . " data-id=$doc->id>";
|
||||
|
||||
if($currentMethod == 'tablecontents')
|
||||
{
|
||||
@@ -2373,7 +2373,7 @@ EOT;
|
||||
if($currentMethod == 'objectlibs')
|
||||
{
|
||||
$treeMenu[$module->id] .= "<div class='tree-group'><span class='module-name'>" . html::a(inlink('objectLibs', "type=$type&objectID=$objectID&libID=$libID&docID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> " . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title' title='{$doc->title}'") . '</span>';
|
||||
$treeMenu[$module->id] .= "<div class='treeActions'>";
|
||||
$treeMenu[$module->id] .= "<div class='tree-actions'>";
|
||||
$treeMenu[$module->id] .= html::a(helper::createLink('doc', 'edit', "docID=$docID&comment=false&objectType=$type&objectID=$objectID&libID=$libID"), "<i class='icon icon-edit'></i>", '', "title={$this->lang->doc->edit}");
|
||||
$treeMenu[$module->id] .= '</div></div>';
|
||||
}
|
||||
@@ -2399,8 +2399,8 @@ EOT;
|
||||
}
|
||||
else
|
||||
{
|
||||
$li = "<div class='tree-group'><span class='module-name'><a title='{$module->name}'>" . $module->name . '</a></span>';
|
||||
$li .= "<div class='treeActions'>";
|
||||
$li = "<div class='tree-group'><span class='module-name'><a class='sort-module' title='{$module->name}'>" . $module->name . '</a></span>';
|
||||
$li .= "<div class='tree-actions'>";
|
||||
$li .= html::a(helper::createLink('tree', 'edit', "module=$module->id&type=doc"), "<i class='icon icon-edit'></i>", '', "data-toggle='modal' title={$this->lang->doc->editType}");
|
||||
$li .= html::a(helper::createLink('tree', 'browse', "rootID=$libID&type=doc&module=$module->id", '', 1), "<i class='icon icon-split'></i>", '', "class='iframe' title={$this->lang->doc->editType}");
|
||||
$li .= '</div></div>';
|
||||
@@ -2433,7 +2433,7 @@ EOT;
|
||||
}
|
||||
}
|
||||
|
||||
$treeMenu[$module->parent] .= '<li class="' . implode(' ', $class) . '">' . $li . '</li>';
|
||||
$treeMenu[$module->parent] .= '<li class="' . implode(' ', $class) . '" data-id=' . $module->id . '>' . $li . '</li>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,64 +15,103 @@ if(empty($type)) $type = 'product';
|
||||
$sideWidth = common::checkNotCN() ? '270' : '238';
|
||||
?>
|
||||
<div class="side-col" style="width:<?php echo $sideWidth;?>px" data-min-width="<?php echo $sideWidth;?>">
|
||||
<div class="cell" id="<?php echo $type;?>">
|
||||
<div id='title'>
|
||||
<li class='menu-title'><?php echo $this->lang->doc->menuTitle;?></li>
|
||||
<?php
|
||||
$canEditLib = common::hasPriv('doc', 'editLib');
|
||||
$canManageBook = common::hasPriv('doc', 'manageBook');
|
||||
$canManageMenu = common::hasPriv('tree', 'browse');
|
||||
$canEditLib = common::hasPriv('doc', 'editLib');
|
||||
$canDeleteLib = common::hasPriv('doc', 'deleteLib');
|
||||
if($type != 'book' and ($canManageMenu or $canEditLib or $canDeleteLib))
|
||||
{
|
||||
echo "<div class='menu-actions'>";
|
||||
echo html::a('javascript:;', "<i class='icon icon-ellipsis-v'></i>", '', "data-toggle='dropdown' class='btn btn-link'");
|
||||
echo "<ul class='dropdown-menu pull-right'>";
|
||||
if($canManageMenu)
|
||||
{
|
||||
echo '<li>' . html::a($this->createLink('tree', 'browse', "rootID=$libID&view=doc", '', true), '<i class="icon-cog-outline"></i> ' . $this->lang->doc->manageType, '', "class='iframe'") . '</li>';
|
||||
echo "<li class='divider'></li>";
|
||||
}
|
||||
if($canEditLib) echo '<li>' . html::a($this->createLink('doc', 'editLib', "rootID=$libID"), '<i class="icon-edit"></i> ' . $lang->doc->editLib, '', "class='iframe'") . '</li>';
|
||||
if($canDeleteLib) echo '<li>' . html::a($this->createLink('doc', 'deleteLib', "rootID=$libID"), '<i class="icon-trash"></i> ' . $lang->doc->deleteLib, 'hiddenwin') . '</li>';
|
||||
echo '</ul></div>';
|
||||
}
|
||||
<div class="cell" id="<?php echo $type;?>">
|
||||
<div id='title'>
|
||||
<li class='menu-title'><?php echo $this->lang->doc->menuTitle;?></li>
|
||||
<?php
|
||||
$canEditLib = common::hasPriv('doc', 'editLib');
|
||||
$canManageBook = common::hasPriv('doc', 'manageBook');
|
||||
$canManageMenu = common::hasPriv('tree', 'browse');
|
||||
$canEditLib = common::hasPriv('doc', 'editLib');
|
||||
$canDeleteLib = common::hasPriv('doc', 'deleteLib');
|
||||
if($type != 'book' and ($canManageMenu or $canEditLib or $canDeleteLib))
|
||||
{
|
||||
echo "<div class='menu-actions'>";
|
||||
echo html::a('javascript:;', "<i class='icon icon-ellipsis-v'></i>", '', "data-toggle='dropdown' class='btn btn-link'");
|
||||
echo "<ul class='dropdown-menu pull-right'>";
|
||||
if($canManageMenu)
|
||||
{
|
||||
echo '<li>' . html::a($this->createLink('tree', 'browse', "rootID=$libID&view=doc", '', true), '<i class="icon-cog-outline"></i> ' . $this->lang->doc->manageType, '', "class='iframe'") . '</li>';
|
||||
echo "<li class='divider'></li>";
|
||||
}
|
||||
if($canEditLib) echo '<li>' . html::a($this->createLink('doc', 'editLib', "rootID=$libID"), '<i class="icon-edit"></i> ' . $lang->doc->editLib, '', "class='iframe'") . '</li>';
|
||||
if($canDeleteLib) echo '<li>' . html::a($this->createLink('doc', 'deleteLib', "rootID=$libID"), '<i class="icon-trash"></i> ' . $lang->doc->deleteLib, 'hiddenwin') . '</li>';
|
||||
echo '</ul></div>';
|
||||
}
|
||||
|
||||
if($type == 'book' and ($canEditLib or $canManageBook))
|
||||
{
|
||||
echo "<div class='menu-actions'>";
|
||||
echo html::a('javascript:;', "<i class='icon icon-ellipsis-v'></i>", '', "data-toggle='dropdown' class='btn btn-link'");
|
||||
echo "<ul class='dropdown-menu pull-right'>";
|
||||
if($canEditLib) echo '<li>' . html::a($this->createLink('doc', 'editLib', "rootID=$libID"), '<i class="icon-edit"></i> ' . $lang->doc->editBook, '', "class='iframe'") . '</li>';
|
||||
if($canManageBook) echo '<li>' . html::a($this->createLink('doc', 'manageBook', "bookID=$libID"), '<i class="icon-cog-outline"></i> ' . $lang->doc->manageBook) . '</li>';
|
||||
echo '</ul></div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php if(!$moduleTree):?>
|
||||
<hr class="space">
|
||||
<div class="text-center text-muted tips">
|
||||
<?php echo $type == 'book' ? $lang->doc->noChapter : $lang->doc->noModule;?>
|
||||
</div>
|
||||
<hr class="space">
|
||||
<?php endif;?>
|
||||
<?php if($type == 'book'):?>
|
||||
<?php include './bookside.html.php';?>
|
||||
<?php else:?>
|
||||
<?php echo $moduleTree;?>
|
||||
<?php endif;?>
|
||||
if($type == 'book' and ($canEditLib or $canManageBook))
|
||||
{
|
||||
echo "<div class='menu-actions'>";
|
||||
echo html::a('javascript:;', "<i class='icon icon-ellipsis-v'></i>", '', "data-toggle='dropdown' class='btn btn-link'");
|
||||
echo "<ul class='dropdown-menu pull-right'>";
|
||||
if($canEditLib) echo '<li>' . html::a($this->createLink('doc', 'editLib', "rootID=$libID"), '<i class="icon-edit"></i> ' . $lang->doc->editBook, '', "class='iframe'") . '</li>';
|
||||
if($canManageBook) echo '<li>' . html::a($this->createLink('doc', 'manageBook', "bookID=$libID"), '<i class="icon-cog-outline"></i> ' . $lang->doc->manageBook) . '</li>';
|
||||
echo '</ul></div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<script>
|
||||
$('#modules').sortable(
|
||||
{
|
||||
trigger: '.icon-move',
|
||||
selector: 'li',
|
||||
nested: true,
|
||||
canMoveHere: function($ele, $target)
|
||||
{
|
||||
if($ele && $target && $ele.parent().closest('li').attr('data-idx') !== $target.parent().closest('li').attr('data-idx')) return false;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php if(!$moduleTree):?>
|
||||
<hr class="space">
|
||||
<div class="text-center text-muted tips">
|
||||
<?php echo $type == 'book' ? $lang->doc->noChapter : $lang->doc->noModule;?>
|
||||
</div>
|
||||
<hr class="space">
|
||||
<?php endif;?>
|
||||
<?php if($type == 'book'):?>
|
||||
<?php include './bookside.html.php';?>
|
||||
<?php else:?>
|
||||
<?php echo $moduleTree;?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<style>
|
||||
.sortable-sorting .module-name > a {cursor: move;}
|
||||
.sortable-sorting li >.tree-group {opacity: .5;}
|
||||
.sortable-sorting .drop-here .tree-group {background-color: #fff3e0;}
|
||||
.sortable-sorting .drop-here .tree-group > * {opacity: .1;}
|
||||
.sortable-sorting .drag-shadow .tree-group {opacity: 1!important;}
|
||||
.sortable-sorting .drag-shadow .tree-actions {visibility: hidden;}
|
||||
.is-sorting > li > .tree-group {opacity: 1; border-radius: 4px;}
|
||||
.is-sorting > li ul {display: none!important;}
|
||||
</style>
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
/* Make modules tree sortable */
|
||||
$('#modules').sortable(
|
||||
{
|
||||
trigger: '.module-name>a.sort-module',
|
||||
dropToClass: 'sort-to',
|
||||
stopPropagation: true,
|
||||
nested: true,
|
||||
selector: 'li',
|
||||
dragCssClass: 'drop-here',
|
||||
targetSelector: function($ele, $root)
|
||||
{
|
||||
return $ele.closest('ul').addClass('is-sorting').children('li');
|
||||
},
|
||||
always: function()
|
||||
{
|
||||
$('#modules,#modules .is-sorting').removeClass('is-sorting');
|
||||
},
|
||||
finish: function(e)
|
||||
{
|
||||
if(!e.changed) return;
|
||||
|
||||
var orders = {};
|
||||
$('#modules').find('li.has-list').each(function()
|
||||
{
|
||||
var $li = $(this);
|
||||
|
||||
var item = $li.data();
|
||||
orders['orders[' + item.id + ']'] = $li.attr('data-order') || item.order;
|
||||
});
|
||||
|
||||
$.post('<?php echo $this->createLink('tree', 'updateOrder');?>', orders, function(data){}).error(function()
|
||||
{
|
||||
bootbox.alert(lang.timeout);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -20,5 +20,4 @@
|
||||
table th, td {border: 2px solid #fff !important;}
|
||||
|
||||
#kanban {padding-bottom: 10px}
|
||||
|
||||
.kanban-col[data-type='closedProject'] span.count {display: none}
|
||||
.kanban-col[data-type='closedProject'] .count {display: none}
|
||||
|
||||
+3
-3
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user