Skip to content

Commit

Permalink
data-namespace attribute for <div class="plugin__filelisting">
Browse files Browse the repository at this point in the history
This commit adds data-namespace attribute for top level div of the plugin. The attribute is later used by dropfiles plugin to determine the "root" namespace of the filelisting widget.
  • Loading branch information
Szymon Olewniczak committed Mar 18, 2020
1 parent ae1e0ed commit 9ae6cf1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function tpl_filelisting($print = true, $ns = NULL) {
if (is_null($ns)) $ns = getNS($INFO['id']);

if ($ns == false) {
$ns = ':';
$ns_string = '[' . $lang['mediaroot'] . ']';
} else {
$ns_string = $ns;
Expand All @@ -38,7 +39,7 @@ public function tpl_filelisting($print = true, $ns = NULL) {
$colgroup .= '<col style="width: 35%;">';
$colgroup .= '</colgroup>';

$ret = '<div class="plugin__filelisting">';
$ret = '<div class="plugin__filelisting" data-namespace="' . $ns . '">';

$ret .= '<div class="plugin__filelisting_capiton">';
$ret .= sprintf($this->getLang('files_in_namespace'), $ns_string);
Expand Down
2 changes: 1 addition & 1 deletion plugin.info.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
base filelisting
author Szymon Olewniczak
email dokuwiki@cosmocode.de
date 2019-07-09
date 2020-03-18
name filelisting plugin
desc List files in currently viewed namespaces
url http://www.dokuwiki.org/plugin:filelisting
8 changes: 6 additions & 2 deletions syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@ public function render($mode, Doku_Renderer $renderer, $data) {
$cur_ns = getNS($INFO['id']);

list($ns) = $data;
if($ns === '') $ns = $cur_ns;
$ns = resolve_id($cur_ns, $ns);
if(empty($ns)) {
$ns = $cur_ns;
} else {
$ns = resolve_id($cur_ns, $ns);
}


if ($mode == 'metadata') {
$dir = str_replace(':','/',$ns);
Expand Down

0 comments on commit 9ae6cf1

Please sign in to comment.