Commit MetaInfo

Revisão5fce6bc45a138ad21beef3fdf65eb63ab3cfe53c (tree)
Hora2020-03-11 02:51:25
Autorumorigu <umorigu@gmai...>
Commiterumorigu

Mensagem de Log

BugTrack/430 RightBar - Secoud MenuBar (3 columns layout)

Mudança Sumário

Diff

--- /dev/null
+++ b/plugin/rightbar.inc.php
@@ -0,0 +1,61 @@
1+<?php
2+// PukiWiki - Yet another WikiWikiWeb clone.
3+// rightbar.inc.php
4+// Copyright 2020 PukiWiki Development Team
5+// License: GPL v2 or (at your option) any later version
6+//
7+// RightBar plugin
8+
9+// Use Submenu if true
10+define('RIGHTBAR_ENABLE_SUBMENU', FALSE);
11+
12+// Name of Submenu
13+define('RIGHTBAR_SUBMENUBAR', 'RightBar');
14+
15+function plugin_rightbar_convert()
16+{
17+ global $vars, $rightbar_name;
18+ static $menu = NULL;
19+
20+ $num = func_num_args();
21+ if ($num > 0) {
22+ // Try to change default 'RightBar' page name (only)
23+ if ($num > 1) {
24+ return '#rightbar(): Zero or One argument needed';
25+ }
26+ if ($menu !== NULL) {
27+ return '#rightbar(): Already set: ' . htmlsc($menu);
28+ }
29+ $args = func_get_args();
30+ if (! is_page($args[0])) {
31+ return '#rightbar(): No such page: ' . htmlsc($args[0]);
32+ } else {
33+ $menu = $args[0]; // Set
34+ return '';
35+ }
36+ }
37+ // Output rightbar page data
38+ $page = ($menu === NULL) ? $rightbar_name : $menu;
39+ if (RIGHTBAR_ENABLE_SUBMENU) {
40+ $path = explode('/', strip_bracket($vars['page']));
41+ while(! empty($path)) {
42+ $_page = join('/', $path) . '/' . RIGHTBAR_SUBMENUBAR;
43+ if (is_page($_page)) {
44+ $page = $_page;
45+ break;
46+ }
47+ array_pop($path);
48+ }
49+ }
50+ if (! is_page($page)) {
51+ return '';
52+ } else if ($vars['page'] === $page) {
53+ return '<!-- #rightbar(): You already view ' . htmlsc($page) . ' -->';
54+ } else if (!is_page_readable($page)) {
55+ return '#rightbar(): ' . htmlsc($page) . ' is not readable';
56+ } else {
57+ // Cut fixed anchors
58+ $menutext = preg_replace('/^(\*{1,3}.*)\[#[A-Za-z][\w-]+\](.*)$/m', '$1$2', get_source($page));
59+ return convert_html($menutext);
60+ }
61+}
--- a/pukiwiki.ini.php
+++ b/pukiwiki.ini.php
@@ -131,6 +131,7 @@ $whatsdeleted = 'RecentDeleted'; // Removeed page list
131131 $interwiki = 'InterWikiName'; // Set InterWiki definition here
132132 $aliaspage = 'AutoAliasName'; // Set AutoAlias definition here
133133 $menubar = 'MenuBar'; // Menu
134+$rightbar_name = 'RightBar'; // RightBar
134135
135136 /////////////////////////////////////////////////
136137 // Change default Document Type Definition
--- a/skin/pukiwiki.css
+++ b/skin/pukiwiki.css
@@ -391,6 +391,27 @@ div#menubar h4 {
391391 font-size:110%;
392392 }
393393
394+#rightbar {
395+ min-width:12em;
396+ max-width:12em;
397+ padding:0;
398+ margin:4px;
399+ font-size:90%;
400+ overflow:hidden;
401+ order:3;
402+ flex-grow:0;
403+}
404+#rightbar ul {
405+ margin:0 0 0 1em;
406+ padding:0 0 0 .5em;
407+}
408+#rightbar ul li {
409+ line-height:110%;
410+}
411+#rightbar h4 {
412+ font-size:110%;
413+}
414+
394415 div#body {
395416 padding:0;
396417 margin:0 0 0 .5em;
@@ -712,6 +733,12 @@ tr.bugtrack_state_undef td {
712733 font-size:100%;
713734 order:2;
714735 }
736+ div#rightbar {
737+ width:auto;
738+ max-width:none;
739+ font-size:100%;
740+ order:3;
741+ }
715742 div#body {
716743 order:1;
717744 }
--- a/skin/pukiwiki.skin.php
+++ b/skin/pukiwiki.skin.php
@@ -46,7 +46,14 @@ $rw = ! PKWK_READONLY;
4646
4747 // MenuBar
4848 $menu = arg_check('read') && exist_plugin_convert('menu') ? do_plugin_convert('menu') : FALSE;
49-
49+// RightBar
50+$rightbar = FALSE;
51+if (arg_check('read') && exist_plugin_convert('rightbar')) {
52+ $rightbar = do_plugin_convert('rightbar');
53+ if (!$rightbar) {
54+ $rightbar = FALSE;
55+ }
56+}
5057 // ------------------------------------------------------------
5158 // Output
5259
@@ -159,6 +166,9 @@ function _navigator($key, $value = '', $javascript = ''){
159166 <?php if ($menu !== FALSE) { ?>
160167 <div id="menubar"><?php echo $menu ?></div>
161168 <?php } ?>
169+<?php if ($rightbar !== FALSE) { ?>
170+ <div id="rightbar"><?php echo $rightbar ?></div>
171+<?php } ?>
162172 </div>
163173
164174 <?php if ($notes != '') { ?>
Show on old repository browser