Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
giterlizzi committed Feb 6, 2024
2 parents 535949e + 3ff03dd commit 382fd84
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 18 deletions.
13 changes: 13 additions & 0 deletions RELEASE.md
@@ -1,5 +1,18 @@
# Bootstrap3 DokuWiki Template ChangeLog

## [develop]

This release increase the compatibility with the latest DokuWiki and PHP releases.

### Changes
* #589: Missing Wikipedia logo in interwiki links to Russian language
* #584, #604: Improved compatibility with new Translation Plugin
* #582: Theme changing doesn't work in Firefox/Gecko
* #573: Typeahead blocks global search if match is found
* #596, #597: Warnings after upgrade to 2023-04-04a "Jack Jackrum"
* #605: detail.php plural of "information"


## [v2022-07-27]

This release increase the compatibility with Hogfather and the upcoming Igor release and fix some regression.
Expand Down
6 changes: 4 additions & 2 deletions Template.php
Expand Up @@ -57,6 +57,7 @@ public function __construct()
'tocLayout' => $this->getConf('tocLayout'),
'useAnchorJS' => (int) $this->getConf('useAnchorJS'),
'useAlternativeToolbarIcons' => (int) $this->getConf('useAlternativeToolbarIcons'),
'disableSearchSuggest' => (int) $this->getConf('disableSearchSuggest'),
],
];

Expand Down Expand Up @@ -492,6 +493,7 @@ public function getTheme()
$bootstrap_theme = $this->getConf('bootstrapTheme');
$bootswatch_theme = $this->getBootswatchTheme();
$theme = (($bootstrap_theme == 'bootswatch') ? $bootswatch_theme : $bootstrap_theme);

return $theme;
}

Expand Down Expand Up @@ -1474,7 +1476,7 @@ public function normalizeContent($content)
# Page Heading (h1-h2)
# TODO this class will be removed in Bootstrap >= 4.0 version
foreach ($html->find('h1,h2,h3') as $elm) {
$elm->class .= ' page-header pb-3 mb-4 mt-5'; # TODO replace page-header with border-bottom in BS4
$elm->class .= ' page-header pb-3 mb-4 mt-0'; # TODO replace page-header with border-bottom in BS4
}

# Media Images
Expand Down Expand Up @@ -2228,7 +2230,7 @@ public function getTOC($return = false)
$toc_undefined = array_pop($toc);
}

trigger_event('TPL_TOC_RENDER', $toc, null, false);
\dokuwiki\Extension\Event::createAndTrigger('TPL_TOC_RENDER', $toc, null, false);

if ($ACT == 'admin' && $INPUT->str('page') == 'config') {
$bootstrap3_sections = [
Expand Down
1 change: 1 addition & 0 deletions conf/default.php
Expand Up @@ -85,3 +85,4 @@
$conf['useAvatar'] = 'off';
$conf['useGoogleAnalytics'] = 0;
$conf['notifyExtensionsUpdate'] = 0;
$conf['disableSearchSuggest'] = 0;
1 change: 1 addition & 0 deletions conf/metadata.php
Expand Up @@ -41,6 +41,7 @@
$meta['navbarLabels'] = array('multicheckbox', '_choices' => array('login', 'register', 'admin', 'tools', 'user', 'site', 'page', 'themes', 'expand', 'profile'));
$meta['showAddNewPage'] = array('multichoice', '_choices' => array('never', 'logged', 'always'));
$meta['notifyExtensionsUpdate'] = array('onoff');
$meta['disableSearchSuggest'] = array('onoff');

// Semantic
$meta['schemaOrgType'] = array('multichoice', '_choices' => array('Article', 'NewsArticle', 'TechArticle', 'BlogPosting', 'Recipe'));
Expand Down
4 changes: 2 additions & 2 deletions css/template.less
Expand Up @@ -37,7 +37,7 @@ a.iw_user {
background-image: url('iconify.php?icon=mdi-account.svg');
}

a.iw_wp, a.iw_wpde, a.iw_wpes, a.iw_wpfr, a.iw_wpjp, a.iw_wpmeta, a.iw_wppl {
a.iw_wp, a.iw_wpde, a.iw_wpes, a.iw_wpfr, a.iw_wpjp, a.iw_wpru, a.iw_wpmeta, a.iw_wppl {
background-image: url('iconify.php?icon=mdi-wikipedia.svg');
}

Expand Down Expand Up @@ -869,7 +869,7 @@ body {
a.iw_man {
background-image: url('iconify.php?icon=mdi-book.svg&color=%23ffffff');
}
a.iw_wp, a.iw_wpde, a.iw_wpes, a.iw_wpfr, a.iw_wpjp, a.iw_wpmeta, a.iw_wppl {
a.iw_wp, a.iw_wpde, a.iw_wpes, a.iw_wpfr, a.iw_wpjp, a.iw_wpru, a.iw_wpmeta, a.iw_wppl {
background-image: url('iconify.php?icon=mdi-wikipedia.svg&color=%23ffffff');
}
}
Expand Down
2 changes: 1 addition & 1 deletion detail.php
Expand Up @@ -381,7 +381,7 @@
<div class="image-information">

<h3 class="pb-4">
<?php echo iconify('mdi:information', array('class' => 'text-primary')) ?> Informations
<?php echo iconify('mdi:information', array('class' => 'text-primary')) ?> Information
</h3>

<div class="table-responsive">
Expand Down
8 changes: 5 additions & 3 deletions iconify.php
Expand Up @@ -78,13 +78,15 @@

$iconify_dir = dirname(__FILE__) . '/assets/iconify/json';
$cache_key = md5(serialize($params) . $conf['template'] . filemtime(__FILE__));
$cache = new cache($cache_key, '.js');
$cache->_event = 'ICONIFY_CACHE';
$cache_files = $params;
$cache_files[] = __FILE__;
$cache_ok = $cache->useCache(array('files' => $cache_files));
$content_type = 'application/javascript; charset=utf-8';

$cache = new dokuwiki\Cache\Cache($cache_key, '.js');
$cache->setEvent('ICONIFY_CACHE');
$cache_ok = $cache->useCache(array('files' => $cache_files));


if ($params['icon']) {
$content_type = 'image/svg+xml; charset=utf-8';
list($params['prefix'], $params['icons']) = explode('-', str_replace('.svg', '', $params['icon']), 2);
Expand Down
1 change: 1 addition & 0 deletions lang/en/settings.php
Expand Up @@ -118,3 +118,4 @@
$lang['useAvatar_o_activedirectory'] = 'Active Directory';
$lang['useGoogleAnalytics'] = 'Enable Google Analytics';
$lang['useLegacyNavbar'] = 'Use legacy and deprecated <code>navbar.html</code> hook (consider in the future to use the <code>:navbar</code> hook)';
$lang['disableSearchSuggest'] = 'Disable the search suggest';
7 changes: 6 additions & 1 deletion script.js
Expand Up @@ -60,11 +60,16 @@ var dw_template = {
dw_template.pageRestoreConfirm();
dw_template.alerts();
dw_template.detail();
dw_template.typeahead();

dw_template.menuitem();
dw_template.cookieLaw();
dw_template.plugins();

// Enable Typeahead
if (! JSINFO.bootstrap3.config.disableSearchSuggest) {
dw_template.typeahead();
}

// Preload icons
Iconify.preloadImages(['mdi:folder-open', 'mdi:folder', 'mdi:file-document-outline', 'mdi:chevron-up', 'mdi:chevron-down']);

Expand Down
2 changes: 1 addition & 1 deletion template.info.txt
Expand Up @@ -5,4 +5,4 @@ date 2022-07-27
name Bootstrap3 Template
desc Bootstrap-based template for Dokuwiki
url https://www.dokuwiki.org/template:bootstrap3
build stable/20220727
build dev/20240206
4 changes: 2 additions & 2 deletions tpl/theme-switcher.php
Expand Up @@ -25,14 +25,14 @@
<?php echo iconify('mdi:palette'); ?> <?php echo tpl_getLang('themes') ?>
</li>
<li<?php echo ($bootswatch_theme == 'default') ? ' class="active"' : '' ?>>
<a onclick="DokuCookie.setValue('bootswatchTheme', '<?php echo hsc('default'); ?>');" href="<?php echo wl($ID, array('bootswatch-theme' => hsc('default'))); ?>">Default</a>
<a onclick="DokuCookie.setValue('bootswatchTheme', '<?php echo hsc('default'); ?>'); document.location.reload(true)" href="#">Default</a>
</li>
<li class="dropdown-header">
<?php echo iconify('mdi:palette'); ?> Bootswatch Themes
</li>
<?php foreach ($TPL->getAvailableBootswatchThemes() as $theme): ?>
<li<?php echo ($bootswatch_theme == $theme) ? ' class="active"' : '' ?>>
<a onclick="DokuCookie.setValue('bootswatchTheme', '<?php echo hsc($theme); ?>');" href="<?php echo wl($ID, array('bootswatch-theme' => hsc($theme))); ?>"><?php echo ucfirst($theme) ?></a>
<a onclick="DokuCookie.setValue('bootswatchTheme', '<?php echo hsc($theme); ?>'); document.location.reload(true)" href="#"><?php echo ucfirst($theme) ?></a>
</li>
<?php endforeach; ?>
</ul>
Expand Down
62 changes: 56 additions & 6 deletions tpl/translation.php
Expand Up @@ -12,7 +12,7 @@
global $conf;

$show_translation = false;
$translation_items = '';
$translation_items = [];
$translation_label = '';

$translation = $TPL->getPlugin('translation');
Expand All @@ -28,7 +28,40 @@
$translation_label = $translation->getLang('translations');

foreach ($translation->translations as $t) {
$translation_items .= str_replace(array('<div class="li">', '</div>'), '', $translation->getTransItem($t, $idpart));

// Old version of Translation plugin
if (method_exists($translation, 'getTransItem')) {
$translation_items[] = str_replace(array('<div class="li">', '</div>'), '', $translation->getTransItem($t, $idpart));
} else {

list($target, $language) = $translation->buildTransID($t, $idpart);

$target = cleanID($target);
$exists = page_exists($target, '', false);
$link = wl($target);

$text = '';
$title = hsc($translation->getLocalName($language));

if (isset($translation->opts['flag'])) {
$text .= '<i>' . inlineSVG(DOKU_PLUGIN . 'translation/flags/' . $language . '.svg', 1024 * 12) . '</i>';
}

if (isset($translation->opts['name'])) {

$text .= hsc($translation->getLocalName($language));

if (isset($translation->opts['langcode'])) {
$text .= ' (' . hsc($language) . ')';
}

} elseif (isset($translation->opts['langcode'])) {
$text .= hsc($language);
}

$translation_items[] = '<li class="menuitem"><a href="' . $link . '" class="' . ($exists ? 'wikilink1' : 'wikilink2') . '" title="' . $title . '">' . $text . '</a></li>';

}
}

}
Expand All @@ -38,16 +71,33 @@
<!-- translation -->
<ul class="nav navbar-nav" id="dw__translation">
<li class="dropdown">
<a href="<?php wl($ID) ?>" class="dropdown-toggle" data-target="#" data-toggle="dropdown" title="<?php echo $translation_label ?>" role="button" aria-haspopup="true" aria-expanded="false">
<a href="<?php wl($ID)?>" class="dropdown-toggle" data-target="#" data-toggle="dropdown" title="<?php echo $translation_label ?>" role="button" aria-haspopup="true" aria-expanded="false">
<?php echo iconify('mdi:flag'); ?> <span class="hidden-lg hidden-md hidden-sm"><?php echo $translation_label ?></span><span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">

<?php if ($translation->getConf('about') || $translation->getConf('title')): ?>
<li class="dropdown-header hidden-xs hidden-sm">
<?php echo iconify('mdi:flag'); ?> <?php echo $translation_label ?>
<?php

echo iconify('mdi:flag');
echo $translation->getLang('translations');

if ($translation->getConf('about')) {
echo ' ' . $translation->showAbout();
}
?>
<?php endif;?>
</li>
<?php echo $translation_items ?>

<?php
foreach ($translation_items as $item) {
echo $item;
}
?>

</ul>
</li>
</ul>
<!-- /translation -->
<?php endif; ?>
<?php endif;?>

0 comments on commit 382fd84

Please sign in to comment.