clicking on document table row will load document page, update browser history

This commit is contained in:
Uwe Steinmann 2019-10-16 09:50:54 +02:00
parent ad3678e60c
commit 297d5d1391
2 changed files with 24 additions and 3 deletions

View File

@ -2258,6 +2258,7 @@ $(document).ready( function() {
$workflowmode = $this->params['workflowmode'];
$previewwidth = $this->params['previewWidthList'];
$enableClipboard = $this->params['enableclipboard'];
$onepage = $this->params['onepage'];
$content = '';
@ -2316,8 +2317,11 @@ $(document).ready( function() {
$content .= "<img draggable=\"false\" class=\"mimeicon\" width=\"".$previewwidth."\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
$content .= "</td>";
$content .= "<td>";
$content .= "<a draggable=\"false\" href=\"../out/out.ViewDocument.php?documentid=".$docID."&showtree=".$showtree."\">" . htmlspecialchars($document->getName()) . "</a>";
$content .= "<td>";
if($onepage)
$content .= "<b>".htmlspecialchars($document->getName()) . "</b>";
else
$content .= "<a draggable=\"false\" href=\"../out/out.ViewDocument.php?documentid=".$docID."&showtree=".$showtree."\">" . htmlspecialchars($document->getName()) . "</a>";
if(isset($extracontent['below_title']))
$content .= $extracontent['below_title'];
$content .= "<br /><span style=\"font-size: 85%; font-style: italic; color: #666; \">".getMLText('owner').": <b>".htmlspecialchars($owner->getFullName())."</b>, ".getMLText('creation_date').": <b>".date('Y-m-d', $document->getDate())."</b>, ".getMLText('version')." <b>".$version."</b> - <b>".date('Y-m-d', $latestContent->getDate())."</b>".($document->expires() ? ", ".getMLText('expires').": <b>".getReadableDate($document->getExpires())."</b>" : "")."</span>";
@ -2425,6 +2429,7 @@ $(document).ready( function() {
$enableRecursiveCount = $this->params['enableRecursiveCount'];
$maxRecursiveCount = $this->params['maxRecursiveCount'];
$enableClipboard = $this->params['enableclipboard'];
$onepage = $this->params['onepage'];
$owner = $subFolder->getOwner();
$comment = $subFolder->getComment();
@ -2433,7 +2438,10 @@ $(document).ready( function() {
$content = '';
$content .= $this->folderListRowStart($subFolder);
$content .= "<td><a draggable=\"false\" href=\"../out/out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\"><img draggable=\"false\" src=\"".$this->getMimeIcon(".folder")."\" width=\"24\" height=\"24\" border=0></a></td>\n";
$content .= "<td><a draggable=\"false\" href=\"../out/out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\">" . htmlspecialchars($subFolder->getName()) . "</a>";
if($onepage)
$content .= "<td>" . "<b>".htmlspecialchars($subFolder->getName())."</b>";
else
$content .= "<td><a draggable=\"false\" href=\"../out/out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\">" . htmlspecialchars($subFolder->getName()) . "</a>";
$content .= "<br /><span style=\"font-size: 85%; font-style: italic; color: #666;\">".getMLText('owner').": <b>".htmlspecialchars($owner->getFullName())."</b>, ".getMLText('creation_date').": <b>".date('Y-m-d', $subFolder->getDate())."</b></span>";
if($comment) {
$content .= "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>";

View File

@ -101,6 +101,7 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style {
$maxItemsPerPage = $this->params['maxItemsPerPage'];
$showtree = $this->params['showtree'];
$onepage = $this->params['onepage'];
$sitename = trim(strip_tags($this->params['sitename']));
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'));
@ -111,7 +112,10 @@ function folderSelected(id, name) {
window.location = '../out/out.ViewFolder.php?folderid=' + id;
<?php } else { ?>
seeddms_folder = id;
title_prefix = "<?= (strlen($sitename)>0 ? $sitename : "SeedDMS") ?>";
$('div.ajax').trigger('update', {folderid: id, orderby: '<?= $orderby ?>'});
document.title = title_prefix+": "+name;
window.history.pushState({"html":"","pageTitle":title_prefix+": "+name},"", '../out/out.ViewFolder.php?folderid=' + id);
<?php } ?>
}
<?php if($maxItemsPerPage) { ?>
@ -154,6 +158,11 @@ $('#loadmore').click(function(e) {
<?php
if($onepage) {
?>
window.onpopstate = function(event) {
console.log("location: " + document.location + ", state: " + JSON.stringify(event.state));
console.log(JSON.stringify(event.state));
window.location = document.location;
};
$('body').on('click', '[id^=\"table-row-folder\"]', function(ev) {
attr_id = $(ev.currentTarget).attr('id').split('-')[3];
folderSelected(attr_id, '');
@ -161,6 +170,10 @@ $('body').on('click', '[id^=\"table-row-folder\"]', function(ev) {
scrollTop: 200
}, 200);
});
$('body').on('click', '[id^=\"table-row-document\"]', function(ev) {
attr_id = $(ev.currentTarget).attr('id').split('-')[3];
window.location = '../out/out.ViewDocument.php?documentid=' + attr_id;
});
$('body').on('click', '.order-btn', function(ev) {
ev.preventDefault();
var element = $(this);