Index: trunk/phase3/includes/Parser.php |
— | — | @@ -1631,7 +1631,7 @@ |
1632 | 1632 | $found = false; |
1633 | 1633 | $nowiki = false; |
1634 | 1634 | $noparse = false; |
1635 | | - $brokenlink = false; |
| 1635 | + $itcamefromthedatabase = false; |
1636 | 1636 | |
1637 | 1637 | $title = NULL; |
1638 | 1638 | |
— | — | @@ -1782,6 +1782,7 @@ |
1783 | 1783 | if ( $articleContent !== false ) { |
1784 | 1784 | $found = true; |
1785 | 1785 | $text = $articleContent; |
| 1786 | + $itcamefromthedatabase = true; |
1786 | 1787 | } |
1787 | 1788 | } |
1788 | 1789 | |
— | — | @@ -1789,7 +1790,6 @@ |
1790 | 1791 | if ( $this->mOutputType == OT_HTML && !$found ) { |
1791 | 1792 | $text = '[['.$title->getPrefixedText().']]'; |
1792 | 1793 | $found = true; |
1793 | | - $brokenlink = true; |
1794 | 1794 | } |
1795 | 1795 | |
1796 | 1796 | # Template cache array insertion |
— | — | @@ -1842,13 +1842,12 @@ |
1843 | 1843 | |
1844 | 1844 | # Empties the template path |
1845 | 1845 | $this->mTemplatePath = array(); |
1846 | | - |
1847 | 1846 | if ( !$found ) { |
1848 | 1847 | return $matches[0]; |
1849 | 1848 | } else { |
1850 | 1849 | # replace ==section headers== |
1851 | 1850 | # XXX this needs to go away once we have a better parser. |
1852 | | - if ( $this->mOutputType != OT_WIKI && !$brokenlink ) { |
| 1851 | + if ( $this->mOutputType != OT_WIKI && $itcamefromthedatabase ) { |
1853 | 1852 | if( !is_null( $title ) ) |
1854 | 1853 | $encodedname = base64_encode($title->getPrefixedDBkey()); |
1855 | 1854 | else |
— | — | @@ -2263,7 +2262,10 @@ |
2264 | 2263 | |
2265 | 2264 | # Add the edit section span |
2266 | 2265 | if( $rightClickHack ) { |
2267 | | - $headline = $sk->editSectionScript($sectionCount+1,$headline); |
| 2266 | + if( $istemplate ) |
| 2267 | + $headline = $sk->editSectionScriptForOther($templatetitle, $templatesection, $headline); |
| 2268 | + else |
| 2269 | + $headline = $sk->editSectionScript($sectionCount+1,$headline); |
2268 | 2270 | } |
2269 | 2271 | |
2270 | 2272 | # give headline the correct <h#> tag |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -2716,6 +2716,12 @@ |
2717 | 2717 | * These two do not check for permissions: check $wgTitle->userCanEdit |
2718 | 2718 | * before calling them |
2719 | 2719 | */ |
| 2720 | + function editSectionScriptForOther( $title, $section, $head ) { |
| 2721 | + $ttl = Title::newFromText( $title ); |
| 2722 | + $url = $ttl->escapeLocalURL( 'action=edit§ion='.$section ); |
| 2723 | + return '<span oncontextmenu=\'document.location="'.$url.'";return false;\'>'.$head.'</span>'; |
| 2724 | + } |
| 2725 | + |
2720 | 2726 | function editSectionScript( $section, $head ) { |
2721 | 2727 | global $wgTitle, $wgRequest; |
2722 | 2728 | if( $wgRequest->getInt( 'oldid' ) && ( $wgRequest->getVal( 'diff' ) != '0' ) ) { |