Skip to content
Permalink
Browse files

Created "PageIconsMenu" and migrated all "page icons" items

  • Loading branch information...
LotarProject committed Aug 21, 2019
1 parent 7d68949 commit 42365dbba4699014d910e37fcf0cdac90ee9da4d
@@ -7,10 +7,11 @@
* Added Events dispatch table
* Re-Added after 4 years the `<bdi>` tag for better compatibility with RLT languages

### Chnged
### Changed
* Used DokuWiki hooks for customize login and profile page (regiter, edit and delete)
* Upgraded `simple_html_dom` to v1.9
* Removed margin in mobile tamplate with `fluidContainer` enabled
* Added `PageIconsMenu` menu DokuWiki menu system and migrated all "page icons" items

### Fixed
* Fixed "PHP Notice" for `MAX_FILE_SIZE`
@@ -1759,7 +1759,7 @@ public function normalizeContent($content)
foreach ($html->find('.curid') as $elm) {
foreach ($elm->find('a') as $link) {
$link->class .= ' curid';
$link->attr['data-curid'] = 'true'; # FIX attribute
$link->attr[' data-curid'] = 'true'; # FIX attribute
}
}
@@ -2768,9 +2768,9 @@ private function initToolsMenu()
global $ACT;
$tools_menus = array(
'user' => array('icon' => 'mdi mdi-account', 'object' => new \dokuwiki\Menu\UserMenu),
'site' => array('icon' => 'mdi mdi-toolbox', 'object' => new \dokuwiki\Menu\SiteMenu),
'page' => array('icon' => 'mdi mdi-file-document-outline', 'object' => new \dokuwiki\template\bootstrap3\Menu\PageMenu),
'user' => array('icon' => 'mdi mdi-account', 'object' => new \dokuwiki\Menu\UserMenu),
'site' => array('icon' => 'mdi mdi-toolbox', 'object' => new \dokuwiki\Menu\SiteMenu),
'page' => array('icon' => 'mdi mdi-file-document-outline', 'object' => new \dokuwiki\template\bootstrap3\Menu\PageMenu),
);
if (defined('DOKU_MEDIADETAIL')) {
@@ -2788,11 +2788,20 @@ private function initToolsMenu()
$active .= ' active';
}
if ($item->getType() == 'shareon') {
$active .= ' dropdown';
}
$html = '<li class="' . $active . '">';
$html .= "<a $attr>";
$html .= \inlineSVG($item->getSvg());
$html .= '<span>' . hsc($item->getLabel()) . '</span>';
$html .= "</a>";
if ($item->getType() == 'shareon') {
$html .= $item->getDropDownMenu();
}
$html .= '</li>';
$tools_menus[$tool]['menu'][$item->getType()]['object'] = $item;
@@ -316,7 +316,7 @@ div#picker2 {
}

ul li:not(.active) a:hover {
background: transparent;
background: transparent;
}

.tools {
@@ -580,18 +580,26 @@ div#picker2 {
color: inherit;
}

.share-google-plus i { color: #DC4E41; }
.share-twitter i { color: #55ACEE; }
.share-linkedin i { color: #0077B5; }
.share-facebook i { color: #3B5998; }
.share-whatsapp i { color: #43D854; }
.share-pinterest i { color: #BD081C; }
.share-telegram i { color: #0088CC; }
.share-yammer i { color: #5AA8BF; }
.share-reddit i { color: #FF4500; }
span {
display: none;
}

}
svg {
width: 1.2em !important;
height: 1.2em !important;
}

.share-google-plus svg { color: #DC4E41; }
.share-twitter svg { color: #55ACEE; }
.share-linkedin svg { color: #0077B5; }
.share-facebook svg { color: #3B5998; }
.share-whatsapp svg { color: #43D854; }
.share-pinterest svg { color: #BD081C; }
.share-telegram svg { color: #0088CC; }
.share-yammer svg { color: #5AA8BF; }
.share-reddit svg { color: #FF4500; }

}

/* Override Bootstrap3 style */

@@ -775,8 +783,8 @@ svg.icon {
fill: currentColor;
display: inline-block;
vertical-align: middle;
width: 1.4em;
height: 1.4em;
width: 1.3em;
height: 1.3em;
}

#dw__pagetools .menuitem svg {
@@ -0,0 +1,22 @@
<?php
namespace dokuwiki\Menu;
/**
* Class DetailMenu
*
* This menu offers options on an image detail view. It usually displayed similar to
* the PageMenu.
*/
class DetailMenu extends AbstractMenu {
protected $view = 'detail';
protected $types = array(
'ImgOriginalSize',
'MediaManager',
'ImgBackto',
'Top',
);
}
@@ -0,0 +1,46 @@
<?php
namespace dokuwiki\Menu\Item;
/**
* Class Feed
*/
class Feed extends AbstractItem {
/** @inheritdoc */
public function __construct() {
parent::__construct();
global $lang;
if (! in_array('feed', explode(',', tpl_getConf('pageIcons')))) {
throw new \RuntimeException("feed is not available");
}
unset($this->params['do']);
$this->label = $lang['btn_recent'];
$this->svg = template('assets/mdi/svg/rss.svg');
$this->id = '';
$this->nofollow = true;
}
public function getLinkAttributes($classprefix = 'menuitem ') {
global $ID;
$attr = array(
'href' => DOKU_URL . 'feed.php?ns=' . getNS($ID),
'title' => $this->getTitle(),
'rel' => 'nofollow',
'target' => '_blank',
);
if ($classprefix !== false) $attr['class'] = $classprefix . $this->getType();
return $attr;
}
}
@@ -0,0 +1,52 @@
<?php
namespace dokuwiki\Menu\Item;
/**
* Class Help
*/
class Help extends AbstractItem {
/** @inheritdoc */
public function __construct() {
parent::__construct();
if (! in_array('help', explode(',', tpl_getConf('pageIcons')))) {
throw new \RuntimeException("help is not available");
}
unset($this->params['do']);
$help_page = page_findnearest('help', tpl_getConf('useACL'));
if (! $help_page) {
throw new \RuntimeException("help page not found");
}
$this->label = hsc(p_get_first_heading($help_page));
$this->svg = template('assets/mdi/svg/help.svg');
$this->id = '#';
$this->help = wl($help_page, array('do' => 'export_xhtmlbody'));
}
public function getLinkAttributes($classprefix = 'menuitem ') {
$attr = array(
'href' => $this->getLink(),
'title' => $this->getTitle(),
'rel' => 'nofollow',
'data-toggle' => 'modal',
'data-target' => '.modal.help',
'data-page' => $this->help,
'onclick' => "jQuery('.modal.help .modal-title').html(jQuery(this).attr('title')); jQuery('.modal.help .modal-body').load(jQuery(this).data('page'));"
);
if ($classprefix !== false) $attr['class'] = $classprefix . $this->getType();
return $attr;
}
}
@@ -0,0 +1,48 @@
<?php
namespace dokuwiki\Menu\Item;
/**
* Class ImgOriginalSize
*/
class ImgOriginalSize extends AbstractItem {
/** @inheritdoc */
public function __construct() {
parent::__construct();
global $IMG;
global $REV;
global $INPUT;
global $lang;
if (! $IMG) {
throw new \RuntimeException("image is not available");
}
unset($this->params['do']);
$this->label = $lang['js']['mediadirect'];
$this->svg = template('assets/mdi/svg/image-size-select-large.svg');
$this->id = '#';
$this->img_link = ml($IMG, array('cache'=> $INPUT->str('cache'),'rev' => $REV), true, '&');
}
public function getLinkAttributes($classprefix = 'menuitem ') {
$attr = array(
'href' => $this->img_link,
'title' => $this->getTitle(),
'rel' => 'nofollow',
'target' => '_blank',
);
if ($classprefix !== false) $attr['class'] = $classprefix . $this->getType();
return $attr;
}
}
@@ -0,0 +1,41 @@
<?php
namespace dokuwiki\Menu\Item;
/**
* Class Permalink
*/
class Permalink extends AbstractItem {
/** @inheritdoc */
public function __construct() {
parent::__construct();
if (! in_array('permalink', explode(',', tpl_getConf('pageIcons')))) {
throw new \RuntimeException("permalink is not available");
}
unset($this->params['do']);
$this->label = tpl_getLang('permalink');
$this->svg = template('assets/mdi/svg/link.svg');
$this->id = '#';
}
public function getLinkAttributes($classprefix = 'menuitem ') {
$attr = array(
'href' => DOKU_URL . DOKU_SCRIPT . '?id=' . $ID . '&rev=' . $INFO['lastmod'],
'title' => $this->getTitle(),
'rel' => 'nofollow',
'target' => '_blank',
);
if ($classprefix !== false) $attr['class'] = $classprefix . $this->getType();
return $attr;
}
}
@@ -0,0 +1,41 @@
<?php
namespace dokuwiki\Menu\Item;
/**
* Class PrintPage
*/
class PrintPage extends AbstractItem {
/** @inheritdoc */
public function __construct() {
parent::__construct();
if (! in_array('print', explode(',', tpl_getConf('pageIcons')))) {
throw new \RuntimeException("print is not available");
}
unset($this->params['do']);
$this->label = tpl_getLang('print');
$this->svg = template('assets/mdi/svg/printer.svg');
$this->id = '#';
}
public function getLinkAttributes($classprefix = 'menuitem ') {
$attr = array(
'href' => $this->getLink(),
'title' => $this->getTitle(),
'rel' => 'nofollow',
'onclick' => 'javascript:window.print()',
);
if ($classprefix !== false) $attr['class'] = $classprefix . $this->getType();
return $attr;
}
}

0 comments on commit 42365db

Please sign in to comment.
You can’t perform that action at this time.