This commit is contained in:
@@ -83,7 +83,7 @@ class Output
|
|||||||
|
|
||||||
/** @var \Doku_Renderer_xhtml $renderer */
|
/** @var \Doku_Renderer_xhtml $renderer */
|
||||||
$renderer = $this->renderer;
|
$renderer = $this->renderer;
|
||||||
$renderer->doc .= '<div class="filetools-plugin filetools-gallery">';
|
$renderer->doc .= '<div class="luxtools-plugin luxtools-gallery">';
|
||||||
|
|
||||||
foreach ($this->files as $item) {
|
foreach ($this->files as $item) {
|
||||||
$url = $this->itemWebUrl($item, !empty($params['randlinks']));
|
$url = $this->itemWebUrl($item, !empty($params['randlinks']));
|
||||||
@@ -228,7 +228,7 @@ class Output
|
|||||||
}
|
}
|
||||||
|
|
||||||
$style = $this->containerStyle($params);
|
$style = $this->containerStyle($params);
|
||||||
$this->renderer->doc .= '<div class="filetools-plugin"' . $style . '>';
|
$this->renderer->doc .= '<div class="luxtools-plugin"' . $style . '>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -473,8 +473,8 @@ class Output
|
|||||||
|
|
||||||
$noIcon = !empty($item['noicon']);
|
$noIcon = !empty($item['noicon']);
|
||||||
$link['class'] = $noIcon
|
$link['class'] = $noIcon
|
||||||
? 'filetools-open'
|
? 'luxtools-open'
|
||||||
: 'filetools-open media mediafile mf_folder';
|
: 'luxtools-open media mediafile mf_folder';
|
||||||
|
|
||||||
$link['more'] .= ' data-path="' . hsc($path) . '"';
|
$link['more'] .= ' data-path="' . hsc($path) . '"';
|
||||||
if ($conf['relnofollow']) $link['more'] .= ' rel="nofollow"';
|
if ($conf['relnofollow']) $link['more'] .= ' rel="nofollow"';
|
||||||
|
|||||||
@@ -126,14 +126,14 @@ class plugin_luxtools_test extends DokuWikiTest
|
|||||||
$doc->html($xhtml);
|
$doc->html($xhtml);
|
||||||
|
|
||||||
$structure = [
|
$structure = [
|
||||||
'div.filetools-plugin' => 1,
|
'div.luxtools-plugin' => 1,
|
||||||
'div.filetools-plugin > ul' => 1,
|
'div.luxtools-plugin > ul' => 1,
|
||||||
'div.filetools-plugin > ul > li' => 3,
|
'div.luxtools-plugin > ul > li' => 3,
|
||||||
'div.filetools-plugin > ul > li:nth-child(1)' => 1,
|
'div.luxtools-plugin > ul > li:nth-child(1)' => 1,
|
||||||
'div.filetools-plugin > ul > li:nth-child(1) a' => 'example.txt',
|
'div.luxtools-plugin > ul > li:nth-child(1) a' => 'example.txt',
|
||||||
'div.filetools-plugin > ul > li:nth-child(2) ul' => 1,
|
'div.luxtools-plugin > ul > li:nth-child(2) ul' => 1,
|
||||||
'div.filetools-plugin > ul > li:nth-child(2) ul > li' => 1,
|
'div.luxtools-plugin > ul > li:nth-child(2) ul > li' => 1,
|
||||||
'div.filetools-plugin > ul > li:nth-child(2) ul > li a' => 'example2.txt',
|
'div.luxtools-plugin > ul > li:nth-child(2) ul > li a' => 'example2.txt',
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->structureCheck($doc, $structure);
|
$this->structureCheck($doc, $structure);
|
||||||
@@ -153,14 +153,14 @@ class plugin_luxtools_test extends DokuWikiTest
|
|||||||
$doc->html($xhtml);
|
$doc->html($xhtml);
|
||||||
|
|
||||||
$structure = [
|
$structure = [
|
||||||
'div.filetools-plugin' => 1,
|
'div.luxtools-plugin' => 1,
|
||||||
'div.filetools-plugin > ol' => 1,
|
'div.luxtools-plugin > ol' => 1,
|
||||||
'div.filetools-plugin > ol > li' => 3,
|
'div.luxtools-plugin > ol > li' => 3,
|
||||||
'div.filetools-plugin > ol > li:nth-child(1)' => 1,
|
'div.luxtools-plugin > ol > li:nth-child(1)' => 1,
|
||||||
'div.filetools-plugin > ol > li:nth-child(1) a' => 'example.txt',
|
'div.luxtools-plugin > ol > li:nth-child(1) a' => 'example.txt',
|
||||||
'div.filetools-plugin > ol > li:nth-child(2) ol' => 1,
|
'div.luxtools-plugin > ol > li:nth-child(2) ol' => 1,
|
||||||
'div.filetools-plugin > ol > li:nth-child(2) ol > li' => 1,
|
'div.luxtools-plugin > ol > li:nth-child(2) ol > li' => 1,
|
||||||
'div.filetools-plugin > ol > li:nth-child(2) ol > li a' => 'example2.txt',
|
'div.luxtools-plugin > ol > li:nth-child(2) ol > li a' => 'example2.txt',
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->structureCheck($doc, $structure);
|
$this->structureCheck($doc, $structure);
|
||||||
@@ -182,12 +182,12 @@ class plugin_luxtools_test extends DokuWikiTest
|
|||||||
$doc->html($xhtml);
|
$doc->html($xhtml);
|
||||||
|
|
||||||
$structure = [
|
$structure = [
|
||||||
'div.filetools-plugin' => 1,
|
'div.luxtools-plugin' => 1,
|
||||||
'div.filetools-plugin table' => 1,
|
'div.luxtools-plugin table' => 1,
|
||||||
'div.filetools-plugin table > tbody > tr' => 3,
|
'div.luxtools-plugin table > tbody > tr' => 3,
|
||||||
'div.filetools-plugin table > tbody > tr:nth-child(1) a' => 'example.txt',
|
'div.luxtools-plugin table > tbody > tr:nth-child(1) a' => 'example.txt',
|
||||||
'div.filetools-plugin table > tbody > tr:nth-child(2) a' => 'exampledir/example2.txt',
|
'div.luxtools-plugin table > tbody > tr:nth-child(2) a' => 'exampledir/example2.txt',
|
||||||
'div.filetools-plugin table > tbody > tr:nth-child(3) a' => 'exampleimage.png',
|
'div.luxtools-plugin table > tbody > tr:nth-child(3) a' => 'exampleimage.png',
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->structureCheck($doc, $structure);
|
$this->structureCheck($doc, $structure);
|
||||||
@@ -201,7 +201,7 @@ class plugin_luxtools_test extends DokuWikiTest
|
|||||||
$doc = new Document();
|
$doc = new Document();
|
||||||
$doc->html($xhtml);
|
$doc->html($xhtml);
|
||||||
|
|
||||||
$style = (string)$doc->find('div.filetools-plugin')->attr('style');
|
$style = (string)$doc->find('div.luxtools-plugin')->attr('style');
|
||||||
|
|
||||||
$this->assertStringContainsString('max-height: 500px', $style);
|
$this->assertStringContainsString('max-height: 500px', $style);
|
||||||
$this->assertStringContainsString('overflow-y: auto', $style);
|
$this->assertStringContainsString('overflow-y: auto', $style);
|
||||||
@@ -215,7 +215,7 @@ class plugin_luxtools_test extends DokuWikiTest
|
|||||||
$doc = new Document();
|
$doc = new Document();
|
||||||
$doc->html($xhtml);
|
$doc->html($xhtml);
|
||||||
|
|
||||||
$style = $doc->find('div.filetools-plugin')->attr('style');
|
$style = $doc->find('div.luxtools-plugin')->attr('style');
|
||||||
|
|
||||||
$this->assertTrue($style === null || $style === '');
|
$this->assertTrue($style === null || $style === '');
|
||||||
}
|
}
|
||||||
@@ -232,9 +232,9 @@ class plugin_luxtools_test extends DokuWikiTest
|
|||||||
$doc->html($xhtml);
|
$doc->html($xhtml);
|
||||||
|
|
||||||
$structure = [
|
$structure = [
|
||||||
'div.filetools-plugin.filetools-gallery' => 1,
|
'div.luxtools-plugin.luxtools-gallery' => 1,
|
||||||
'div.filetools-plugin.filetools-gallery a' => 1,
|
'div.luxtools-plugin.luxtools-gallery a' => 1,
|
||||||
'div.filetools-plugin.filetools-gallery img' => 1,
|
'div.luxtools-plugin.luxtools-gallery img' => 1,
|
||||||
];
|
];
|
||||||
$this->structureCheck($doc, $structure);
|
$this->structureCheck($doc, $structure);
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ class plugin_luxtools_test extends DokuWikiTest
|
|||||||
$doc->html($xhtml);
|
$doc->html($xhtml);
|
||||||
|
|
||||||
$structure = [
|
$structure = [
|
||||||
'button.filetools-open' => 1,
|
'button.luxtools-open' => 1,
|
||||||
];
|
];
|
||||||
$this->structureCheck($doc, $structure);
|
$this->structureCheck($doc, $structure);
|
||||||
|
|
||||||
@@ -277,10 +277,10 @@ class plugin_luxtools_test extends DokuWikiTest
|
|||||||
$doc->html($xhtml);
|
$doc->html($xhtml);
|
||||||
|
|
||||||
$structure = [
|
$structure = [
|
||||||
'div.filetools-plugin' => 1,
|
'div.luxtools-plugin' => 1,
|
||||||
'div.filetools-plugin table' => 1,
|
'div.luxtools-plugin table' => 1,
|
||||||
'div.filetools-plugin table > tbody > tr' => 3,
|
'div.luxtools-plugin table > tbody > tr' => 3,
|
||||||
'a.filetools-open' => 1,
|
'a.luxtools-open' => 1,
|
||||||
];
|
];
|
||||||
$this->structureCheck($doc, $structure);
|
$this->structureCheck($doc, $structure);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options for the filetools plugin
|
* Options for the luxtools plugin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$conf['paths'] = '';
|
$conf['paths'] = '';
|
||||||
@@ -16,6 +16,6 @@ $conf['thumb_placeholder'] = ':wiki:thumb-placeholder.png';
|
|||||||
// Thumbnails are still displayed as 150x150 on the page.
|
// Thumbnails are still displayed as 150x150 on the page.
|
||||||
$conf['gallery_thumb_scale'] = 1;
|
$conf['gallery_thumb_scale'] = 1;
|
||||||
|
|
||||||
// Local opener service used by {{open>...}}.
|
// Local client service used by {{open>...}}.
|
||||||
$conf['open_service_url'] = 'http://127.0.0.1:8765';
|
$conf['open_service_url'] = 'http://127.0.0.1:8765';
|
||||||
$conf['open_service_token'] = '';
|
$conf['open_service_token'] = '';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Metadata for configuration manager plugin
|
* Metadata for configuration manager plugin
|
||||||
* Additions for the filetools plugin
|
* Additions for the luxtools plugin
|
||||||
*
|
*
|
||||||
* @author Gina Haeussge <osd@foosel.net>
|
* @author Gina Haeussge <osd@foosel.net>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ $lang['thumb_placeholder'] = 'MediaManager-ID für den Platzhalter der Galerie-T
|
|||||||
|
|
||||||
$lang['gallery_thumb_scale'] = 'Skalierungsfaktor für Galerie-Thumbnails. 2 erzeugt schärfere Thumbnails auf HiDPI-Displays (Anzeige bleibt 150×150).';
|
$lang['gallery_thumb_scale'] = 'Skalierungsfaktor für Galerie-Thumbnails. 2 erzeugt schärfere Thumbnails auf HiDPI-Displays (Anzeige bleibt 150×150).';
|
||||||
|
|
||||||
$lang['open_service_url'] = 'URL des lokalen Öffner-Dienstes für {{open>...}} (z.B. http://127.0.0.1:8765).';
|
$lang['open_service_url'] = 'URL des lokalen Client-Dienstes für {{open>...}} (z.B. http://127.0.0.1:8765).';
|
||||||
$lang['open_service_token'] = 'Token für den lokalen Öffner-Dienst (X-Filetools-Token).';
|
$lang['open_service_token'] = 'Token für den lokalen Client-Dienst (X-Luxtools-Token).';
|
||||||
|
|||||||
@@ -8,5 +8,5 @@ $lang['thumb_placeholder'] = 'MediaManager ID for the gallery thumbnail placehol
|
|||||||
|
|
||||||
$lang['gallery_thumb_scale'] = 'Gallery thumbnail scale factor. Use 2 for sharper thumbnails on HiDPI screens (still displayed as 150×150).';
|
$lang['gallery_thumb_scale'] = 'Gallery thumbnail scale factor. Use 2 for sharper thumbnails on HiDPI screens (still displayed as 150×150).';
|
||||||
|
|
||||||
$lang['open_service_url'] = 'Local opener service URL for the {{open>...}} button (e.g. http://127.0.0.1:8765).';
|
$lang['open_service_url'] = 'Local client service URL for the {{open>...}} button (e.g. http://127.0.0.1:8765).';
|
||||||
$lang['open_service_token'] = 'Token sent to the local opener service (X-Filetools-Token).';
|
$lang['open_service_token'] = 'Token sent to the local client service (X-Luxtools-Token).';
|
||||||
|
|||||||
12
script.js
12
script.js
@@ -4,7 +4,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function initGalleryThumbs() {
|
function initGalleryThumbs() {
|
||||||
var imgs = document.querySelectorAll('div.filetools-gallery img[data-thumb-src]');
|
var imgs = document.querySelectorAll('div.luxtools-gallery img[data-thumb-src]');
|
||||||
if (!imgs || !imgs.length) return;
|
if (!imgs || !imgs.length) return;
|
||||||
|
|
||||||
function loadThumb(img) {
|
function loadThumb(img) {
|
||||||
@@ -75,13 +75,13 @@
|
|||||||
|
|
||||||
function openViaService(el, rawPath) {
|
function openViaService(el, rawPath) {
|
||||||
var baseUrl = getServiceUrl(el);
|
var baseUrl = getServiceUrl(el);
|
||||||
if (!baseUrl) return Promise.reject(new Error('No opener service configured'));
|
if (!baseUrl) return Promise.reject(new Error('No client service configured'));
|
||||||
|
|
||||||
var headers = {
|
var headers = {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
};
|
};
|
||||||
var token = getServiceToken(el);
|
var token = getServiceToken(el);
|
||||||
if (token) headers['X-Filetools-Token'] = token;
|
if (token) headers['X-Luxtools-Token'] = token;
|
||||||
|
|
||||||
return window.fetch(baseUrl + '/open', {
|
return window.fetch(baseUrl + '/open', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -131,12 +131,12 @@
|
|||||||
|
|
||||||
function onClick(event) {
|
function onClick(event) {
|
||||||
var el = event.target;
|
var el = event.target;
|
||||||
if (!el || !el.classList || !el.classList.contains('filetools-open')) return;
|
if (!el || !el.classList || !el.classList.contains('luxtools-open')) return;
|
||||||
|
|
||||||
var raw = el.getAttribute('data-path') || '';
|
var raw = el.getAttribute('data-path') || '';
|
||||||
if (!raw) return;
|
if (!raw) return;
|
||||||
|
|
||||||
// Prefer local opener service.
|
// Prefer local client service.
|
||||||
openViaService(el, raw)
|
openViaService(el, raw)
|
||||||
.catch(function (err) {
|
.catch(function (err) {
|
||||||
// If the browser blocks the request before it reaches localhost (mixed-content,
|
// If the browser blocks the request before it reaches localhost (mixed-content,
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
// Fallback to old behavior (often blocked in modern browsers).
|
// Fallback to old behavior (often blocked in modern browsers).
|
||||||
var url = normalizeToFileUrl(raw);
|
var url = normalizeToFileUrl(raw);
|
||||||
if (!url) return;
|
if (!url) return;
|
||||||
console.warn('Local opener service failed, falling back to file:// navigation:', err);
|
console.warn('Local client service failed, falling back to file:// navigation:', err);
|
||||||
try {
|
try {
|
||||||
window.open(url, '_blank', 'noopener');
|
window.open(url, '_blank', 'noopener');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
16
style.css
16
style.css
@@ -3,18 +3,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* DokuWiki often highlights rows on hover. Avoid highlighting header rows. */
|
/* DokuWiki often highlights rows on hover. Avoid highlighting header rows. */
|
||||||
div.filetools-plugin table thead tr:hover > * {
|
div.luxtools-plugin table thead tr:hover > * {
|
||||||
background-color: @ini_background_alt !important;
|
background-color: @ini_background_alt !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* "Open Location" row above the header should be visually smaller. */
|
/* "Open Location" row above the header should be visually smaller. */
|
||||||
div.filetools-plugin table thead tr.luxtools-openlocation-row td {
|
div.luxtools-plugin table thead tr.luxtools-openlocation-row td {
|
||||||
font-size: 80%;
|
font-size: 80%;
|
||||||
padding-top: 0.2em;
|
padding-top: 0.2em;
|
||||||
padding-bottom: 0.2em;
|
padding-bottom: 0.2em;
|
||||||
}
|
}
|
||||||
div.filetools-plugin table thead tr.luxtools-openlocation-row:hover td {
|
div.luxtools-plugin table thead tr.luxtools-openlocation-row:hover td {
|
||||||
background-color: @ini_background !important;
|
background-color: @ini_background !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,24 +25,24 @@ div.filetools-plugin table thead tr.luxtools-openlocation-row:hover td {
|
|||||||
* The relative URL is resolved against the plugin directory by DokuWiki's CSS
|
* The relative URL is resolved against the plugin directory by DokuWiki's CSS
|
||||||
* aggregator, resulting in lib/images/fileicons/svg/folder.svg.
|
* aggregator, resulting in lib/images/fileicons/svg/folder.svg.
|
||||||
*/
|
*/
|
||||||
div.filetools-plugin a.media.mediafile.mf_folder,
|
div.luxtools-plugin a.media.mediafile.mf_folder,
|
||||||
div.filetools-plugin a.mediafile.mf_folder {
|
div.luxtools-plugin a.mediafile.mf_folder {
|
||||||
background-image: url(../../images/fileicons/svg/folder.svg) !important;
|
background-image: url(../../images/fileicons/svg/folder.svg) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Muted empty-state message when a listing has no results. */
|
/* Muted empty-state message when a listing has no results. */
|
||||||
div.filetools-plugin .luxtools-empty {
|
div.luxtools-plugin .luxtools-empty {
|
||||||
opacity: 0.65;
|
opacity: 0.65;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
padding: 0.25em 0;
|
padding: 0.25em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Image gallery spacing. */
|
/* Image gallery spacing. */
|
||||||
div.filetools-gallery {
|
div.luxtools-gallery {
|
||||||
padding-bottom: 0.5em;
|
padding-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.filetools-gallery a.media {
|
div.luxtools-gallery a.media {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 0 0.35em 0.35em 0;
|
margin: 0 0.35em 0.35em 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class syntax_plugin_luxtools extends syntax_plugin_luxtools_files
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compatibility alias for older codebases that referenced the legacy class name.
|
* Compatibility alias for older codebases that referenced the legacy FileTools class name.
|
||||||
*
|
*
|
||||||
* Note: plugin id/base is now `luxtools`.
|
* Note: plugin id/base is now `luxtools`.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ abstract class syntax_plugin_luxtools_abstract extends SyntaxPlugin
|
|||||||
$text = (string)$this->getLang($langKey);
|
$text = (string)$this->getLang($langKey);
|
||||||
|
|
||||||
if ($renderer instanceof \Doku_Renderer_xhtml) {
|
if ($renderer instanceof \Doku_Renderer_xhtml) {
|
||||||
$renderer->doc .= '<div class="filetools-plugin"><div class="luxtools-empty">' . hsc($text) . '</div></div>';
|
$renderer->doc .= '<div class="luxtools-plugin"><div class="luxtools-empty">' . hsc($text) . '</div></div>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class syntax_plugin_luxtools_open extends SyntaxPlugin
|
|||||||
$serviceUrl = trim((string)$this->getConf('open_service_url'));
|
$serviceUrl = trim((string)$this->getConf('open_service_url'));
|
||||||
$serviceToken = trim((string)$this->getConf('open_service_token'));
|
$serviceToken = trim((string)$this->getConf('open_service_token'));
|
||||||
|
|
||||||
$attrs = ' type="button" class="filetools-open"'
|
$attrs = ' type="button" class="luxtools-open"'
|
||||||
. ' data-path="' . hsc($path) . '"';
|
. ' data-path="' . hsc($path) . '"';
|
||||||
if ($serviceUrl !== '') {
|
if ($serviceUrl !== '') {
|
||||||
$attrs .= ' data-service-url="' . hsc($serviceUrl) . '"';
|
$attrs .= ' data-service-url="' . hsc($serviceUrl) . '"';
|
||||||
|
|||||||
Reference in New Issue
Block a user