From 71a24bb826f7761927acce02f0e87bf91946e4fd Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 10 Apr 2020 07:52:35 +0200 Subject: [PATCH] add 'data-target-id' to folder and document rows in list This will be used to specify the document associated to the row. --- views/bootstrap/class.Bootstrap.php | 6 ++++-- views/bootstrap/class.ViewFolder.php | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 6f58067dd..b5e0e7e7b 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -2281,7 +2281,9 @@ $('body').on('click', '[id^=\"table-row-document\"] td:nth-child(2)', function(e ?> /* catch click on a document row in the list folders and documents */ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) { - attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3]; + attr_id = $(ev.currentTarget).parent().data('target-id'); + if(typeof attr_id == 'undefined') + attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3]; window.location = '../out/out.ViewFolder.php?folderid=' + attr_id; }); getID(); - return "getName(), ENT_QUOTES)."\">"; + return "getName(), ENT_QUOTES)."\">"; } /* }}} */ function documentListRowEnd($document) { /* {{{ */ diff --git a/views/bootstrap/class.ViewFolder.php b/views/bootstrap/class.ViewFolder.php index 61492e27c..2585bd4cf 100644 --- a/views/bootstrap/class.ViewFolder.php +++ b/views/bootstrap/class.ViewFolder.php @@ -183,7 +183,14 @@ $('body').on('click', '#goto-parent', function(ev) { }); /* catch click on a folder row in the list folders and documents */ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) { - attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3]; + /* retrieve the id of the target folder either from data-target-id or + * from the id. Prefer data-target-id because the id is also used for identifying + * the table row when deleting the folder + * This was added for the internal_link extensŃ–on + */ + attr_id = $(ev.currentTarget).parent().data('target-id'); + if(typeof attr_id == 'undefined') + attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3]; folderSelected(attr_id, ''); $([document.documentElement, document.body]).animate({ scrollTop: 200