* Finish task #58063.
This commit is contained in:
@@ -674,6 +674,11 @@ EOT;
|
||||
$selected = $key == $libID ? 'selected' : '';
|
||||
$output .= html::a(inlink($methodName, "libID=$key"), $lib->name, '', "class='$selected' data-app='{$this->app->tab}'");
|
||||
}
|
||||
if(count($libs) >= 2 and common::hasPriv('doc', 'sortLibs'))
|
||||
{
|
||||
$output .= '<li class="divider"></li>';
|
||||
$output .= html::a($this->createLink('doc', 'sortLibs', "type=api&objectID=0", '', true), "<i class='icon-move'></i> {$this->lang->doc->sortLibs}", '', "data-title='{$this->lang->doc->sortLibs}' data-toggle='modal' data-type='iframe' data-width='400px' data-app='{$this->app->tab}'");
|
||||
}
|
||||
$output .= "</div></div></div></div></div>";
|
||||
|
||||
/* Get lib version */
|
||||
|
||||
@@ -1199,4 +1199,22 @@ class doc extends control
|
||||
unset($this->lang->doc->libTypeList['book']);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort libs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function sortLibs($type, $objectID)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$this->doc->updateLibOrder();
|
||||
return print(js::reload('parent.parent'));
|
||||
}
|
||||
$this->view->title = $this->lang->doc->sortLibs;
|
||||
$this->view->libs = $this->doc->getLibs($type, '', '', $objectID);
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,3 +103,4 @@ ol, ul {margin-bottom: 0}
|
||||
.fullscreen-close {top: 8px !important;}
|
||||
|
||||
#subHeader .list-group>a.selected {color: #e9f2fb !important; background-color: #0c64eb !important;}
|
||||
#pageNav #dropMenu .table-col .list-group .icon-move {display:block; float: left; font-size: 12px; padding: 3px 4px 3px 1px;}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#mainContent .doclib-name {font-size: 13px; font-weight: 550; padding: 10px 0px;}
|
||||
#mainContent #libs .lib > .icon-move {padding-left: 4px; font-size:13px; vertical-align: text-top;}
|
||||
#mainContent #libs .lib {padding-bottom: 5px;}
|
||||
#mainContent #libs {padding-bottom: 10px;}
|
||||
@@ -0,0 +1,31 @@
|
||||
$(function()
|
||||
{
|
||||
/* Make libs sortable. */
|
||||
$('#libs').sortable(
|
||||
{
|
||||
trigger: '.lib > .icon-move, .lib > .lib-name',
|
||||
dropToClass: 'sort-to',
|
||||
stopPropagation: true,
|
||||
nested: true,
|
||||
selector: 'div',
|
||||
dragCssClass: 'drop-here',
|
||||
targetSelector: function($ele, $root)
|
||||
{
|
||||
var $libs = $ele.closest('#libs');
|
||||
return $libs.children('div.lib');
|
||||
},
|
||||
always: function()
|
||||
{
|
||||
$('#libs,#libs .is-sorting').removeClass('is-sorting');
|
||||
},
|
||||
finish: function(e)
|
||||
{
|
||||
var orders = ',';
|
||||
$('#libs').find('div.lib').each(function()
|
||||
{
|
||||
orders += $(this).attr('data-id') + ',';
|
||||
});
|
||||
$('#libs #libIdList').attr('value', orders);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -151,6 +151,7 @@ $lang->doc->removeMenu = 'Remove from Menu';
|
||||
$lang->doc->search = 'Search';
|
||||
$lang->doc->allCollections = 'All Collections';
|
||||
$lang->doc->keywordsTips = 'Please use commas to separate keywords.';
|
||||
$lang->doc->sortLibs = 'Sort Libs';
|
||||
|
||||
global $config;
|
||||
/* Query condition list. */
|
||||
|
||||
@@ -151,6 +151,7 @@ $lang->doc->removeMenu = '从菜单栏移除';
|
||||
$lang->doc->search = '搜索';
|
||||
$lang->doc->allCollections = '查看全部收藏文档';
|
||||
$lang->doc->keywordsTips = '多个关键字请用逗号分隔。';
|
||||
$lang->doc->sortLibs = '文档库排序';
|
||||
|
||||
global $config;
|
||||
/* 查询条件列表 */
|
||||
|
||||
+36
-8
@@ -48,7 +48,7 @@ class docModel extends model
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('type')->eq('api')
|
||||
->beginIF(!empty($appendLib))->orWhere('id')->eq($appendLib)->fi()
|
||||
->orderBy('id_desc')
|
||||
->orderBy('`order`_asc, id_desc')
|
||||
->fetchAll('id');
|
||||
$libs = array_filter($libs, array($this, 'checkPrivLib'));
|
||||
return $libs;
|
||||
@@ -61,6 +61,7 @@ class docModel extends model
|
||||
* @param string $extra
|
||||
* @param string $appendLibs
|
||||
* @param int $projectID
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -72,7 +73,7 @@ class docModel extends model
|
||||
->where('type')->ne('api')
|
||||
->beginIF($type == 'all')->andWhere('deleted')->eq(0)->fi()
|
||||
->andWhere('vision')->eq($this->config->vision)
|
||||
->orderBy('id_desc')
|
||||
->orderBy('`order` asc, id_desc')
|
||||
->query();
|
||||
}
|
||||
else
|
||||
@@ -83,7 +84,7 @@ class docModel extends model
|
||||
->beginIF($type)->andWhere('type')->eq($type)->fi()
|
||||
->beginIF(!$type)->andWhere('type')->ne('api')->fi()
|
||||
->beginIF($objectID and strpos(',product,project,execution,', ",$type,") !== false)->andWhere($type)->eq($objectID)->fi()
|
||||
->orderBy('`order`, id desc')->query();
|
||||
->orderBy("`order` asc, id_desc")->query();
|
||||
}
|
||||
|
||||
$products = $this->loadModel('product')->getPairs();
|
||||
@@ -128,7 +129,7 @@ class docModel extends model
|
||||
|
||||
if(!empty($appendLibs))
|
||||
{
|
||||
$stmt = $this->dao->select('*')->from(TABLE_DOCLIB)->where('id')->in($appendLibs)->orderBy('`order`, id desc')->query();
|
||||
$stmt = $this->dao->select('*')->from(TABLE_DOCLIB)->where('id')->in($appendLibs)->orderBy("`order` asc, id_desc")->query();
|
||||
while($lib = $stmt->fetch())
|
||||
{
|
||||
if(!isset($libPairs[$lib->id]) and $this->checkPrivLib($lib, $extra)) $libPairs[$lib->id] = $lib->name;
|
||||
@@ -1401,8 +1402,8 @@ class docModel extends model
|
||||
->andWhere('vision')->eq($this->config->vision)
|
||||
->andWhere('type')->eq($type)
|
||||
->beginIF(!empty($appendLib))->orWhere('id')->eq($appendLib)->fi()
|
||||
->beginIF($type == 'custom')->orderBy('`order`, id')->fi()
|
||||
->beginIF($type == 'book')->orderBy('id_desc')->fi()
|
||||
->beginIF($type == 'custom')->orderBy('`order` asc, id_desc')->fi()
|
||||
->beginIF($type == 'book')->orderBy('`order` asc, id_desc')->fi()
|
||||
->fetchAll('id');
|
||||
}
|
||||
elseif($type != 'product' and $type != 'project' and $type != 'execution')
|
||||
@@ -1417,7 +1418,7 @@ class docModel extends model
|
||||
->andWhere($type)->eq($objectID)
|
||||
->beginIF(!empty($appendLib))->orWhere('id')->eq($appendLib)->fi()
|
||||
->beginIF($type == 'project')->andWhere('execution')->eq(0)->fi()
|
||||
->orderBy('`order`, id')
|
||||
->orderBy('`order` asc, id_desc')
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
@@ -2360,6 +2361,11 @@ EOT;
|
||||
$selected = empty($libID) ? 'selected' : '';
|
||||
$output .= html::a(inlink('showFiles', "type=$type&objectID=$objectID"), $this->lang->doclib->files, '', "class='$selected' data-app='{$this->app->tab}'");
|
||||
}
|
||||
if(count($libs) >= 2 and common::hasPriv('doc', 'sortLibs'))
|
||||
{
|
||||
$output .= '<li class="divider"></li>';
|
||||
$output .= html::a(inlink('sortLibs', "type=$type&objectID=$objectID", '', true), "<i class='icon-move'></i> {$this->lang->doc->sortLibs}", '', "data-title='{$this->lang->doc->sortLibs}' data-toggle='modal' data-type='iframe' data-width='400px' data-app='{$this->app->tab}'");
|
||||
}
|
||||
$output .= "</div></div></div></div></div>";
|
||||
}
|
||||
|
||||
@@ -2767,7 +2773,7 @@ EOT;
|
||||
$table = $this->config->objectTables[$type];
|
||||
$libs = $this->getLibsByObject($type, $objectID, '', $appendLib);
|
||||
|
||||
if($libID == 0) $libID = key($libs);
|
||||
if($libID == 0) $libID = reset($libs)->id;
|
||||
$this->lang->modulePageNav = $this->select($type, $objects, $objectID, $libs, $libID);
|
||||
|
||||
if($this->app->tab == 'doc') $this->app->rawMethod = $type;
|
||||
@@ -2812,4 +2818,26 @@ EOT;
|
||||
|
||||
return $autoloadPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Lib orders.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function updateLibOrder()
|
||||
{
|
||||
$libIdList = $this->post->libIdList;
|
||||
$libIdList = explode(',', $libIdList);
|
||||
|
||||
$order = 1;
|
||||
foreach($libIdList as $libID)
|
||||
{
|
||||
if(!$libID) continue;
|
||||
|
||||
$this->dao->update(TABLE_DOCLIB)->set('`order`')->eq($order * 10)->where('id')->eq($libID)->exec();
|
||||
|
||||
$order++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* The sortlibs view file of doc module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2022 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Mengyi Liu <liumengyi@easycorp.ltd>
|
||||
* @package doc
|
||||
* @version $Id: sorlibs.html.php 958 2022-06-21 14:20:42Z $
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id="main">
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $lang->doc->order;?></h2>
|
||||
</div>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='doclib-name'><?php echo $lang->doclib->name?></div>
|
||||
<?php $libIdList = ',';?>
|
||||
<form id='libs' class='load-indicator main-form' method='post' target='hiddenwin'>
|
||||
<?php foreach($libs as $libID => $libName):?>
|
||||
<?php $libIdList .= "$libID,";?>
|
||||
<div class='lib' data-id='<?php echo $libID;?>'>
|
||||
<span class='lib-name'><?php echo $libName;?></span><i class='icon-move'></i>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
<?php echo html::hidden('libIdList', trim($libIdList, ','));?>
|
||||
<div class='text-center'><?php echo html::submitButton($lang->save);?></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
Reference in New Issue
Block a user