remember current folder id on page, update drop folder list regulary

This commit is contained in:
Uwe Steinmann 2019-09-05 12:53:45 +02:00
parent 177e3c571a
commit 4215eda966
5 changed files with 30 additions and 5 deletions

View File

@ -7,6 +7,8 @@
- Import from filesystem can read a file with metadata
- drop folder chooser can be put multiple times on a page
- add section in README.Install.md on how to secure the configuration
- fix php error when removing a version of a document
- major rework of ViewFolder page, most parts of the page are now loaded by ajax
--------------------------------------------------------------------------------
Changes in version 5.1.12

View File

@ -23,6 +23,7 @@
class SeedDMS_Controller_Preview extends SeedDMS_Controller_Common {
public function run() {
global $theme;
$dms = $this->params['dms'];
$type = $this->params['type'];
$settings = $this->params['settings'];

View File

@ -1147,3 +1147,9 @@ $(document).ready(function() { /* {{{ */
timeOutId = setTimeout(checkTasks, 30000);
}
var updateDropFolder = function() {
$('#menu-dropfolder > div.ajax').trigger('update', {folderid: seeddms_folder});
console.log(seeddms_folder);
timeOutId = setTimeout(updateDropFolder, 60000);
}

View File

@ -166,6 +166,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo '<script src="../styles/'.$this->theme.'/application.js"></script>'."\n";
if($this->params['enablemenutasks'] && isset($this->params['user']) && $this->params['user']) {
$this->addFooterJS('checkTasks();');
$this->addFooterJS('updateDropFolder();');
}
if($this->footerjs) {
$jscode = "$(document).ready(function () {\n";
@ -196,6 +197,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
header('Content-Type: application/javascript');
echo "var seeddms_absbaseprefix=\"".$this->params['absbaseprefix']."\";\n";
echo "var seeddms_webroot=\"".$this->params['settings']->_httpRoot."\";\n";
echo "var seeddms_folder=1;\n";
} /* }}} */
function footerjs() { /* {{{ */
@ -1597,7 +1599,7 @@ $(document).ready(function() {
$subfolders = $folder->getSubFolders(isset($orderby[0]) ? $orderby[0] : '', $orderdir);
$subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $user, $accessmode);
foreach($subfolders as $subfolder) {
$node = array('label'=>$subfolder->getName(), 'id'=>$subfolder->getID(), 'load_on_demand'=>($subfolder->hasSubFolders() || ($subfolder->hasDocuments() && $showdocs)) ? false : false, 'is_folder'=>true);
$node = array('label'=>$subfolder->getName(), 'id'=>$subfolder->getID(), 'load_on_demand'=>($subfolder->hasSubFolders() || ($subfolder->hasDocuments() && $showdocs)) ? true : false, 'is_folder'=>true);
if($expandtree>=$level || $pathfolder->getID() == $subfolder->getID()) {
$node['children'] = jqtree($path, $subfolder, $user, $accessmode, $showdocs, $expandtree, $orderby, $level+1);
if($showdocs) {
@ -1617,7 +1619,7 @@ $(document).ready(function() {
$subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $user, $accessmode);
$children = array();
foreach($subfolders as $subfolder) {
$node = array('label'=>$subfolder->getName(), 'id'=>$subfolder->getID(), 'load_on_demand'=>($subfolder->hasSubFolders() || ($subfolder->hasDocuments() && $showdocs)) ? false : false, 'is_folder'=>true);
$node = array('label'=>$subfolder->getName(), 'id'=>$subfolder->getID(), 'load_on_demand'=>($subfolder->hasSubFolders() || ($subfolder->hasDocuments() && $showdocs)) ? true : false, 'is_folder'=>true);
$children[] = $node;
}
return $children;
@ -1633,7 +1635,7 @@ $(document).ready(function() {
$folder = array_shift($path);
$node = array('label'=>$folder->getName(), 'id'=>$folder->getID(), 'load_on_demand'=>false, 'is_folder'=>true);
if(!$folder->hasSubFolders()) {
$node['load_on_demand'] = false;
$node['load_on_demand'] = true;
$node['children'] = array();
} else {
$node['children'] = jqtree($path, $folder, $this->params['user'], $accessmode, $showdocs, 0 /*$expandtree*/, $orderby, 0);
@ -1661,7 +1663,8 @@ $(document).ready(function() {
?>
var data = <?php echo json_encode($tree); ?>;
$(function() {
$('#jqtree<?php echo $formid ?>').tree({
const $tree = $('#jqtree<?php echo $formid ?>');
$tree.tree({
// saveState: true,
selectable: false,
data: data,

View File

@ -104,8 +104,10 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
header('Content-Type: application/javascript; charset=UTF-8');
parent::jsTranslations(array('cancel', 'splash_move_document', 'confirm_move_document', 'move_document', 'confirm_transfer_link_document', 'transfer_content', 'link_document', 'splash_move_folder', 'confirm_move_folder', 'move_folder'));
?>
seeddms_folder = <?= $folder->getID() ?>;
function folderSelected(id, name) {
// window.location = '../out/out.ViewFolder.php?folderid=' + id;
seeddms_folder = id;
$('div.ajax').trigger('update', {folderid: id, orderby: '<?= $orderby ?>'});
}
<?php if($maxItemsPerPage) { ?>
@ -143,7 +145,17 @@ $(window).scroll(function() {
$('#loadmore').click(function(e) {
loadMoreObjects($(this), $(this).data('all'));
});
<?php } ?>
/*
$('body').on('click', '[id^=\"table-row-folder\"]', function(ev) {
attr_id = $(ev.currentTarget).attr('id').split('-')[3];
folderSelected(attr_id, '');
$([document.documentElement, document.body]).animate({
scrollTop: 200
}, 200);
});
*/
<?php
if($showtree == 1)
$this->printNewTreeNavigationJs($folder->getID(), M_READ, 0, '', ($expandFolderTree == 1) ? -1 : 3, $orderby);
@ -274,6 +286,7 @@ $('#loadmore').click(function(e) {
if($documents === null)
$documents = $folder->getDocuments($orderby[0], $orderdir);
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
$parent = null; //$folder->getParent();
$txt = $this->callHook('folderListPreContent', $folder, $subFolders, $documents);
if(is_string($txt))
@ -286,7 +299,7 @@ $('#loadmore').click(function(e) {
else {
print "<table id=\"viewfolder-table\" class=\"table table-condensed table-hover\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".($parent ? '<button class="btn btn-mini btn-default" id="table-row-folder-'.$parent->getID().'"><i class="icon-arrow-up"></i></button>' : '')."</th>\n";
print "<th>".getMLText("name");
print " <a href=\"../out/out.ViewFolder.php?folderid=". $folderid .($orderby=="n"||$orderby=="na"?"&orderby=nd":"&orderby=n")."\" title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="icon-sort-by-alphabet selected"></i>':($orderby=="nd"?' <i class="icon-sort-by-alphabet-alt selected"></i>':' <i class="icon-sort-by-alphabet"></i>'))."</a>";
print " <a href=\"../out/out.ViewFolder.php?folderid=". $folderid .($orderby=="s"||$orderby=="sa"?"&orderby=sd":"&orderby=s")."\" title=\"".getMLText("sort_by_sequence")."\">".($orderby=="s"||$orderby=="sa"?' <i class="icon-sort-by-order selected"></i>':($orderby=="sd"?' <i class="icon-sort-by-order-alt selected"></i>':' <i class="icon-sort-by-order"></i>'))."</a>";