Skip to content

Commit

Permalink
Added Overlay plugin support (thanks to @lattekun on #219)
Browse files Browse the repository at this point in the history
  • Loading branch information
giterlizzi committed Jun 24, 2016
1 parent abb7775 commit d5c1abd
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 4 deletions.
1 change: 1 addition & 0 deletions css/plugins.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@import "plugins/discussion.less";
@import "plugins/inlinetoc.less";
@import "plugins/linkback.less";
@import "plugins/overlay.less";
@import "plugins/publish.less";
@import "plugins/tag.less";
@import "plugins/tagging.less";
Expand Down
26 changes: 26 additions & 0 deletions css/plugins/overlay.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* DokuWiki Bootstrap3 Template: DokuWiki Plugins
*
* Home http://dokuwiki.org/template:bootstrap3
* Author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
* License GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/

/* Overlay */
#overlay {

padding: 0;
font-size: small;
z-index: 9999;

a {
text-decoration: none;
span { display: none; }
}

.list-inline {
margin: 0;
padding: 0;
}

}
1 change: 1 addition & 0 deletions js/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jQuery(document).on('bootstrap3:plugins', function(e) {
/* DOKUWIKI:include js/plugins/gallery.js */
/* DOKUWIKI:include js/plugins/include.js */
/* DOKUWIKI:include js/plugins/inlinetoc.js */
/* DOKUWIKI:include js/plugins/overlay.js */
/* DOKUWIKI:include js/plugins/publish.js */
/* DOKUWIKI:include js/plugins/tag.js */
/* DOKUWIKI:include js/plugins/tagging.js */
Expand Down
29 changes: 29 additions & 0 deletions js/plugins/overlay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* DokuWiki Bootstrap3 Template: Plugins Hacks!
*
* Home http://dokuwiki.org/template:bootstrap3
* Author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
* License GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/

// Overlay Plugin
var $overlay = jQuery('#overlay');

if ($overlay.length) {

$overlay.addClass('panel panel-default small');

$overlay.css('border', jQuery('.panel').css('border'));
$overlay.css('background', jQuery('.panel').css('background'));

var $title = $overlay.find('.close'),
$btn = $title.find('a');

$btn.wrapAll('<ul class="text-right list-inline dw-action-icon" />');
$btn.wrap('<li/>');
$btn.addClass('text-muted');

$title.nextAll().wrapAll('<div class="panel-body" />');
$title.removeClass('close').addClass('panel-heading');

}
19 changes: 15 additions & 4 deletions tpl_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function tpl_classes() {
function plugin_getRequestAdminPlugin(){
static $admin_plugin = false;
global $ACT,$INPUT,$INFO;

if ($admin_plugin === false) {
if (($ACT == 'admin') && ($page = $INPUT->str('page', '', true)) != '') {
$pluginlist = plugin_list('admin');
Expand All @@ -157,7 +157,7 @@ function plugin_getRequestAdminPlugin(){
}
}
}

return $admin_plugin;
}

Expand Down Expand Up @@ -195,18 +195,29 @@ function bootstrap3_toolsevent($toolsname, $items, $view='main', $return = false
foreach($evt->data['items'] as $k => $html) {

switch ($k) {

case 'export_odt':
$icon = 'file-text';
break;

case 'export_pdf':
$icon = 'file-pdf-o';
break;

case 'plugin_move':
$icon = 'i-cursor text-muted';
$html = preg_replace('/<a href=""><span>(.*?)<\/span>/', '<a href="javascript:void(0)" title="$1"><span>$1</span></a>', $html);
break;

case 'overlay':
$icon = 'clone text-muted';
$html = str_replace('href="', 'href="javascript:void(0)" onclick="', $html);
$html = preg_replace('/<a (.*?)>(.*?)<\/a>/', '<a $1><span>$2</span></a>', $html);
break;

default:
$icon = 'puzzle-piece'; // Unknown

}

$replace = array('<i class="fa fa-fw fa-'. $icon .'"></i> ', '');
Expand Down Expand Up @@ -271,7 +282,7 @@ function bootstrap3_sidebar_include($type) {
case 'right':

if (! bootstrap3_conf('showRightSidebar')) return false;

if (bootstrap3_conf('sidebarPosition') == 'right') {
bootstrap3_sidebar_wrapper($left_sidebar, 'dokuwiki__aside',
'sidebarheader.html', 'sidebarfooter.html');
Expand Down Expand Up @@ -1678,7 +1689,7 @@ function bootstrap3_content($content) {
$content = str_replace('<div class="error">', '<div class="alert alert-danger"><i class="fa fa-fw fa-times-circle"></i>', $content);
$content = str_replace('<div class="success">', '<div class="alert alert-success"><i class="fa fa-fw fa-check-circle"></i>', $content);
$content = str_replace(array('<div class="notify">', '<div class="msg notify">'), '<div class="alert alert-warning"><i class="fa fa-fw fa-warning"></i>', $content);

// Tables
$table_classes = 'table';

Expand Down

0 comments on commit d5c1abd

Please sign in to comment.