r5357 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r5356‎ | r5357 | r5358 >
Date:16:39, 21 September 2004
Author:kateturner
Status:old
Tags:
Comment:
fix right-click section editing for templates
Modified paths:
  • /branches/REL1_3/phase3/includes/Parser.php (modified) (history)
  • /branches/REL1_3/phase3/includes/Skin.php (modified) (history)

Diff [purge]

Index: branches/REL1_3/phase3/includes/Parser.php
@@ -2194,7 +2194,10 @@
21952195
21962196 # Add the edit section span
21972197 if( $rightClickHack ) {
2198 - $headline = $sk->editSectionScript($sectionCount+1,$headline);
 2198+ if( $istemplate )
 2199+ $headline = $sk->editSectionScriptForOther($templatetitle, $templatesection, $headline);
 2200+ else
 2201+ $headline = $sk->editSectionScript($sectionCount+1,$headline);
21992202 }
22002203
22012204 # give headline the correct <h#> tag
Index: branches/REL1_3/phase3/includes/Skin.php
@@ -2588,6 +2588,12 @@
25892589 }
25902590
25912591 # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
 2592+ function editSectionScriptForOther( $title, $section, $head ) {
 2593+ $ttl = Title::newFromText( $title );
 2594+ $url = $ttl->escapeLocalURL( 'action=edit&section='.$section );
 2595+ return '<span oncontextmenu=\'document.location="'.$url.'";return false;\'>'.$head.'</span>';
 2596+ }
 2597+
25922598 function editSectionScript( $section, $head ) {
25932599 global $wgTitle, $wgRequest;
25942600 if( $wgRequest->getInt( 'oldid' ) && ( $wgRequest->getVal( 'diff' ) != '0' ) ) {

Status & tagging log