Skip to content
Snippets Groups Projects
Commit 3b93167c authored by ThisNameIsNotAllowed's avatar ThisNameIsNotAllowed Committed by Andreas Gohr
Browse files

Provide icons for plugins in admin menu

Squashed commit of the following:

commit 86183b66c5b53b47e5ddb1e0d1c155c06c331d35
Merge: ebfb1ab1 4a8f4288e
Author: Andreas Gohr <andi@splitbrain.org>
Date:   Sat Jan 21 11:20:32 2017 +0100

    Merge branch 'master' of git://github.com/ThisNameIsNotAllowed/dokuwiki into pull-request-1767

    * 'master' of git://github.com/ThisNameIsNotAllowed/dokuwiki:
      Update admin.php
      Update admin.php
      Update _admin.css
      Update admin.php
      Update html.php
      Update _admin.css
      Update html.php
      Update html.php
      Update html.php
      Update.html
      Update html.php
      Update admin.php

commit 4a8f4288e61d48156bf9c4a7c49756912e4dac25
Author: ThisNameIsNotAllowed <ThisNameIsNotAllowed@users.noreply.github.com>
Date:   Fri Jan 20 09:25:52 2017 +0100

    Update admin.php

    Changed the code to check for icons being SVG files.
    This should fix php5.3 errors for using method returns straight on.

commit e43b6cae1e12c1d24efae301e6b25f79a660f353
Author: ThisNameIsNotAllowed <ThisNameIsNotAllowed@users.noreply.github.com>
Date:   Fri Jan 20 08:22:41 2017 +0100

    Update admin.php

    Removed elements that could lead to behaviors that shouldn't occure.

commit 9af82fb6f43a5ce10ba9b54f1d5f5cac644c7611
Merge: b99c67797 0b8d1871c
Author: ThisNameIsNotAllowed <ThisNameIsNotAllowed@users.noreply.github.com>
Date:   Thu Jan 19 16:22:02 2017 +0100

    Merge pull request #1 from ThisNameIsNotAllowed/add-c

    Added css, forced the author to use ".svg"-files for plugin icons.

commit 0b8d1871c8bd0a02aca3ff56128465e8739c96ea
Author: ThisNameIsNotAllowed <ThisNameIsNotAllowed@users.noreply.github.com>
Date:   Thu Jan 19 16:17:34 2017 +0100

    Update _admin.css

    fixed some aligning for plugin names.

commit 9158649de99867574471a2b894f8611bb99b9a7f
Author: ThisNameIsNotAllowed <ThisNameIsNotAllowed@users.noreply.github.com>
Date:   Thu Jan 19 15:49:20 2017 +0100

    Update admin.php

    Added method to return menu icons only in case their mime type matches svg files.

    Added warning to getMenuIcon comments telling the user to provide svg only.

commit 6df4e0f41880d40f0e7b1882d26fc647d6d2188e
Author: ThisNameIsNotAllowed <ThisNameIsNotAllowed@users.noreply.github.com>
Date:   Thu Jan 19 15:46:17 2017 +0100

    Update html.php

    Added code to accept svg files only.
    Also changed names of css classes to suit dokuwiki style.

commit 3435abc52ac1dbd4e0cea291a8b30bef722638a6
Author: ThisNameIsNotAllowed <ThisNameIsNotAllowed@users.noreply.github.com>
Date:   Thu Jan 19 15:41:06 2017 +0100

    Update _admin.css

    Added css for displaying plugin icons.

commit b99c67797eafdb73351f62d2db4c206426b9f828
Author: ThisNameIsNotAllowed <ThisNameIsNotAllowed@users.noreply.github.com>
Date:   Thu Nov 24 14:16:23 2016 +0100

    Update html.php

    Changed the list of admin plugins.

    The icons and plugin names appearance can now be influenced by css.

commit 479c6517ff6fc6010c24b2a285249f3600bc3248
Author: ThisNameIsNotAllowed <ThisNameIsNotAllowed@users.noreply.github.com>
Date:   Thu Nov 24 13:45:08 2016 +0100

    Update html.php

    Cleaned, due to too much duplicated code.

commit e621fd9788c064cc22385cfa4999a9be588bedc2
Author: ThisNameIsNotAllowed <ThisNameIsNotAllowed@users.noreply.github.com>
Date:   Wed Nov 23 16:26:14 2016 +0100

    Update html.php

    Changed class name for images shown before plugin names.

commit 9099dac8483fc1aa5a875755ba3dea6e7eb3f280
Author: ThisNameIsNotAllowed <ThisNameIsNotAllowed@users.noreply.github.com>
Date:   Wed Nov 23 16:24:01 2016 +0100

    Update.html

    Added icon to plugin array

commit faea3ceb7986ecd6d6bad3d8055a388f3810c4b1
Author: ThisNameIsNotAllowed <ThisNameIsNotAllowed@users.noreply.github.com>
Date:   Wed Nov 23 15:56:40 2016 +0100

    Update html.php

    Added support to display plugin icons in admin menu.

commit 539e60be075ab060d7d57beadc74d94606262a2e
Author: ThisNameIsNotAllowed <ThisNameIsNotAllowed@users.noreply.github.com>
Date:   Wed Nov 23 15:51:39 2016 +0100

    Update admin.php

    Add support for icons in admin menu.
parent ebfb1ab1
No related branches found
No related tags found
No related merge requests found
......@@ -2073,7 +2073,8 @@ function html_admin(){
$menu[$p] = array('plugin' => $p,
'prompt' => $obj->getMenuText($conf['lang']),
'sort' => $obj->getMenuSort()
'icon' => $obj->getMenuIconSvgOnly(),
'sort' => $obj->getMenuSort(),
);
}
......@@ -2171,10 +2172,20 @@ function html_admin(){
// output the menu
ptln('<div class="clearer"></div>');
print p_locale_xhtml('adminplugins');
ptln('<ul>');
ptln('<ul class="admin_plugins icon">');
foreach ($menu as $item) {
if (!$item['prompt']) continue;
ptln(' <li><div class="li"><a href="'.wl($ID, 'do=admin&amp;page='.$item['plugin']).'">'.$item['prompt'].'</a></div></li>');
ptln('<li><div class="li admin_plugin_container">');
ptln('<div class="admin_plugin_icon">');
//add icon to the item, in case of being specified
if(strlen($item['icon']) > 0){
ptln('<img src="'.$item['icon'].'" alt="admin_icon_'.hsc($item['prompt']).'"></img>');
}
ptln('</div>');
ptln('<div class="admin_plugin_name"><a href="'.wl($ID, 'do=admin&amp;page='.$item['plugin']).'">');
ptln($item['prompt']);
ptln('</a></div>');
ptln('</div></li>');
}
ptln('</ul>');
}
......
......@@ -30,6 +30,36 @@ class DokuWiki_Admin_Plugin extends DokuWiki_Plugin {
return $menutext;
}
/**
* Return the path to the icon being displayed in the main admin menu.
* Default means, there won't be any icon.
* (Override this function for setting another image)
*
* CAUTION:
* Only svg-files are allowed
*
*/
public function getMenuIcon(){
return '';
}
/**
* Return the path to the icon being displayed in the main admin menu.
* In case of file mime-type not being SVG, an empty string will be returned.
* @return string menu icon url or empty
*/
public function getMenuIconSvgOnly(){
$returnValue = '';
if(strlen($this->getMenuIcon()) != '' && is_file(DOKU_INC.substr($this->getMenuIcon(), strlen(DOKU_BASE)))){
$calculated = mimetype(DOKU_INC.substr($this->getMenuIcon(), strlen(DOKU_BASE)), false);
if(is_array($calculated) && $calculated[0] == 'svg') {
$returnValue = $this->getMenuIcon();
}
}
return $returnValue;
}
/**
* Determine position in list in admin window
* Lower values are sorted up
......
......@@ -49,6 +49,55 @@
background-image: url(../../images/admin/popularity.png);
}
/* DokuWiki additional plugins below */
.dokuwiki ul.admin_plugins {
float: left;
width: 40%;
}
.dokuwiki ul.admin_plugins.no_icon{
float: left;
width: 40%;
}
.dokuwiki ul.admin_plugins.icon{
list-style-type: none;
}
.dokuwiki ul.admin_plugins li {
pading-left: 35px;
margin: 0 0 0.4em 0;
color: inherit;
background: transparent none no-repeat scroll 0 0;
}
.dokuwiki ul.admin_plugins li .admin_plugin_container {
display: block;
height: 20px;
vertical-align: middle;
}
.dokuwiki ul.admin_plugins li .admin_plugin_container div.admin_plugin_icon {
width: 20px;
height: 20px;
display: inline-block;
vertical-align: middle;
}
.dokuwiki ul.admin_plugins li .admin_plugin_container div.admin_plugin_icon img {
height: 20px;
width: 20px;
}
.dokuwiki ul.admin_plugins li .admin_plugin_container div.admin_plugin_name {
padding-left: 0.5em;
vertical-align: middle;
display: inline-block;
text-align: center;
margin: 0 auto;
}
/* DokuWiki version below */
.dokuwiki #admin__version {
clear: left;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment