Index: trunk/extensions/SideBarMenu/SideBarMenu.i18n.php |
— | — | @@ -16,7 +16,8 @@ |
17 | 17 | 'sidebarmenu-parser-input-error' => 'Parser returned with error: $1', |
18 | 18 | 'sidebarmenu-parser-syntax-error' => 'Could not parse "$1", make sure the syntax is correct.', |
19 | 19 | 'sidebarmenu-js-init-error' => 'Failed loading JavaScript resources.', |
20 | | - 'sidebarmenu-parser-menuitem-expanded-null' => '"parser.menuitem.expanded" should be true or false, instead it is null.' |
| 20 | + 'sidebarmenu-parser-menuitem-expanded-null' => '"parser.menuitem.expanded" should be true or false, instead it is null.', |
| 21 | + 'sidebarmenu-edit' => 'Edit' |
21 | 22 | ); |
22 | 23 | |
23 | 24 | /** Message documentation (Message documentation) |
— | — | @@ -29,6 +30,7 @@ |
30 | 31 | 'sidebarmenu-parser-syntax-error' => '$1 is the line which failed to be parsed', |
31 | 32 | 'sidebarmenu-js-init-error' => 'General error message', |
32 | 33 | 'sidebarmenu-parser-menuitem-expanded-null' => '"parser.menuitem.expanded" is a configuration property.', |
| 34 | + 'sidebarmenu-edit' => 'The text/html of the edit link', |
33 | 35 | ); |
34 | 36 | |
35 | 37 | /** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
Index: trunk/extensions/SideBarMenu/SideBarMenu.php |
— | — | @@ -9,6 +9,7 @@ |
10 | 10 | const SBM_CONTROLS_SHOW = 'controls.show'; |
11 | 11 | const SBM_CONTROLS_HIDE = 'controls.hide'; |
12 | 12 | const SBM_JS_ANIMATE = 'js.animate'; |
| 13 | +const SBM_EDIT_LINK = 'edit'; |
13 | 14 | |
14 | 15 | |
15 | 16 | //default settings |
— | — | @@ -16,6 +17,7 @@ |
17 | 18 | $wgSideBarMenuConfig[SBM_CONTROLS_HIDE]= null; |
18 | 19 | $wgSideBarMenuConfig[SBM_JS_ANIMATE] = true; |
19 | 20 | $wgSideBarMenuConfig[SBM_EXPANDED] = true; |
| 21 | +$wgSideBarMenuConfig[SBM_EDIT_LINK] = true; |
20 | 22 | |
21 | 23 | $wgExtensionCredits['parserhook'][] = array( |
22 | 24 | 'path' => __FILE__, |
— | — | @@ -67,4 +69,4 @@ |
68 | 70 | 'group' => 'ext.sidebarmenu', |
69 | 71 | 'localBasePath' => dirname( __FILE__ ), |
70 | 72 | 'remoteExtPath' => 'SideBarMenu' |
71 | | -); |
\ No newline at end of file |
| 73 | +); |
Index: trunk/extensions/SideBarMenu/SideBarMenu.hooks.php |
— | — | @@ -18,16 +18,19 @@ |
19 | 19 | $output = '<div class="sidebar-menu-container">'; |
20 | 20 | try{ |
21 | 21 | $menuParser = new MenuParser($config[SBM_EXPANDED]); |
22 | | - $output .= $menuParser->getMenuTree($input)->toHTML(); |
| 22 | + $output .= $parser->recursiveTagParse($menuParser->getMenuTree($input)->toHTML(),$frame); |
23 | 23 | }catch(Exception $x){ |
24 | 24 | wfDebug("An error occured during parsing of: '$input' caught exception: $x"); |
25 | 25 | return wfMsg('sidebarmenu-parser.input-error',$x->getMessage()); |
26 | 26 | } |
| 27 | + if($config[SBM_EDIT_LINK]){ |
| 28 | + $output .= Linker::link($frame->getTitle(),wfMsg('sidebarmenu-edit'),array('title' => wfMsg('sidebarmenu-edit')),array('action' => 'edit')); |
| 29 | + } |
27 | 30 | $output .= '</div>'; |
28 | 31 | |
29 | 32 | $jsOutput = self::getJSConfig($config); |
30 | 33 | |
31 | | - return array( $jsOutput.$parser->recursiveTagParse($output,$frame), 'noparse' => true, 'isHTML' => true ); |
| 34 | + return array( $jsOutput.$output, 'noparse' => true, 'isHTML' => true ); |
32 | 35 | } |
33 | 36 | |
34 | 37 | public static function registerUnitTests( &$files ) { |
— | — | @@ -86,6 +89,7 @@ |
87 | 90 | $config[SBM_CONTROLS_SHOW] = array_key_exists(SBM_CONTROLS_SHOW, $args) ? $args[SBM_CONTROLS_SHOW] : (isset($wgSideBarMenuConfig[SBM_CONTROLS_SHOW]) ? $wgSideBarMenuConfig[SBM_CONTROLS_SHOW] : '['.wfMsg('showtoc').']'); |
88 | 91 | $config[SBM_CONTROLS_HIDE] = array_key_exists(SBM_CONTROLS_HIDE, $args) ? $args[SBM_CONTROLS_HIDE] : (isset($wgSideBarMenuConfig[SBM_CONTROLS_HIDE]) ? $wgSideBarMenuConfig[SBM_CONTROLS_HIDE] : '['.wfMsg('hidetoc').']'); |
89 | 92 | $config[SBM_JS_ANIMATE] = array_key_exists(SBM_JS_ANIMATE, $args) ? $args[SBM_JS_ANIMATE] : $wgSideBarMenuConfig[SBM_JS_ANIMATE]; |
| 93 | + $config[SBM_EDIT_LINK] = array_key_exists(SBM_EDIT_LINK, $args) ? $args[SBM_EDIT_LINK] : $wgSideBarMenuConfig[SBM_EDIT_LINK]; |
90 | 94 | return $config; |
91 | 95 | } |
92 | 96 | } |