Index: trunk/extensions/Wikilog/WikilogItemPager.php |
— | — | @@ -60,6 +60,7 @@ |
61 | 61 | # Local variables. |
62 | 62 | protected $mQuery = null; ///< Wikilog item query data |
63 | 63 | protected $mIncluding = false; ///< If pager is being included |
| 64 | + protected $mShowEditLink = false; ///< If edit links are shown. |
64 | 65 | |
65 | 66 | /** |
66 | 67 | * Constructor. |
— | — | @@ -91,11 +92,17 @@ |
92 | 93 | if ( $this->mLimit > $wgWikilogExpensiveLimit ) |
93 | 94 | $this->mLimit = $wgWikilogExpensiveLimit; |
94 | 95 | |
95 | | - # We will need a clean parser if not including. |
96 | | - global $wgParser; |
97 | | - if ( !$this->mIncluding ) { |
| 96 | + # Check parser state, setup edit links. |
| 97 | + global $wgOut, $wgParser; |
| 98 | + if ( $this->mIncluding ) { |
| 99 | + $popt = $wgParser->getOptions(); |
| 100 | + } else { |
| 101 | + $popt = $wgOut->parserOptions(); |
| 102 | + |
| 103 | + # We will need a clean parser if not including. |
98 | 104 | $wgParser->clearState(); |
99 | 105 | } |
| 106 | + $this->mShowEditLink = $popt->getEditSection(); |
100 | 107 | } |
101 | 108 | |
102 | 109 | /** |
— | — | @@ -161,10 +168,10 @@ |
162 | 169 | $heading = $skin->link( $item->mTitle, $titleText, array(), array(), |
163 | 170 | array( 'known', 'noclasses' ) |
164 | 171 | ); |
| 172 | + if ( $this->mShowEditLink && $item->mTitle->quickUserCan( 'edit' ) ) { |
| 173 | + $heading = $this->doEditLink( $item->mTitle, $item->mName ) . $heading; |
| 174 | + } |
165 | 175 | $heading = Xml::tags( 'h2', null, $heading ); |
166 | | - if ( $item->mTitle->quickUserCan( 'edit' ) ) { |
167 | | - $heading = $this->editLink( $item->mTitle ) . $heading; |
168 | | - } |
169 | 176 | |
170 | 177 | # Sumary entry header. |
171 | 178 | $key = $this->mQuery->isSingleWikilog() |
— | — | @@ -226,14 +233,28 @@ |
227 | 234 | /** |
228 | 235 | * Returns a wikilog article edit link, much similar to a section edit |
229 | 236 | * link in normal articles. |
230 | | - * @param $title Wikilog article title object. |
231 | | - * @return HTML fragment. |
| 237 | + * @param $title Title The title of the target article. |
| 238 | + * @param $tooltip string The tooltip to be included in the link, wrapped |
| 239 | + * in the 'wikilog-edit-hint' message. |
| 240 | + * @return string HTML fragment. |
232 | 241 | */ |
233 | | - private function editLink( $title ) { |
| 242 | + private function doEditLink( $title, $tooltip = null ) { |
234 | 243 | $skin = $this->getSkin(); |
235 | | - $url = $skin->makeKnownLinkObj( $title, wfMsg( 'wikilog-edit-lc' ), 'action=edit' ); |
236 | | - $result = wfMsg( 'editsection-brackets', $url ); |
237 | | - return "<span class=\"editsection\">$result</span>"; |
| 244 | + $attribs = array(); |
| 245 | + if ( !is_null( $tooltip ) ) { |
| 246 | + $attribs['title'] = wfMsg( 'wikilog-edit-hint', $tooltip ); |
| 247 | + } |
| 248 | + $link = $skin->link( $title, wfMsg( 'wikilog-edit-lc' ), |
| 249 | + $attribs, |
| 250 | + array( 'action' => 'edit' ), |
| 251 | + array( 'noclasses', 'known' ) |
| 252 | + ); |
| 253 | + |
| 254 | + $result = wfMsgHtml ( 'editsection-brackets', $link ); |
| 255 | + $result = "<span class=\"editsection\">$result</span>"; |
| 256 | + |
| 257 | + wfRunHooks( 'DoEditSectionLink', array( $skin, $title, "", $tooltip, &$result ) ); |
| 258 | + return $result; |
238 | 259 | } |
239 | 260 | } |
240 | 261 | |
— | — | @@ -488,7 +509,7 @@ |
489 | 510 | |
490 | 511 | case '_wl_actions': |
491 | 512 | if ( $this->mCurrentItem->mTitle->quickUserCan( 'edit' ) ) { |
492 | | - return $this->editLink( $this->mCurrentItem->mTitle ); |
| 513 | + return $this->doEditLink( $this->mCurrentItem->mTitle, $this->mCurrentItem->mName ); |
493 | 514 | } else { |
494 | 515 | return ''; |
495 | 516 | } |
— | — | @@ -553,13 +574,26 @@ |
554 | 575 | } |
555 | 576 | |
556 | 577 | /** |
557 | | - * Returns a wikilog article edit link for the actions column of the table. |
558 | | - * @param $title Wikilog article title object. |
559 | | - * @return HTML fragment. |
| 578 | + * Returns a wikilog article edit link, much similar to a section edit |
| 579 | + * link in normal articles. |
| 580 | + * @param $title Title The title of the target article. |
| 581 | + * @param $tooltip string The tooltip to be included in the link, wrapped |
| 582 | + * in the 'wikilog-edit-hint' message. |
| 583 | + * @return string HTML fragment. |
560 | 584 | */ |
561 | | - private function editLink( $title ) { |
| 585 | + private function doEditLink( $title, $tooltip = null ) { |
562 | 586 | $skin = $this->getSkin(); |
563 | | - $url = $skin->makeKnownLinkObj( $title, wfMsg( 'wikilog-edit-lc' ), 'action=edit' ); |
564 | | - return wfMsg( 'wikilog-brackets', $url ); |
| 587 | + $attribs = array(); |
| 588 | + if ( !is_null( $tooltip ) ) { |
| 589 | + $attribs['title'] = wfMsg( 'wikilog-edit-hint', $tooltip ); |
| 590 | + } |
| 591 | + $link = $skin->link( $title, wfMsg( 'wikilog-edit-lc' ), |
| 592 | + $attribs, |
| 593 | + array( 'action' => 'edit' ), |
| 594 | + array( 'noclasses', 'known' ) |
| 595 | + ); |
| 596 | + |
| 597 | + $result = wfMsgHtml ( 'editsection-brackets', $link ); |
| 598 | + return $result; |
565 | 599 | } |
566 | 600 | } |
Index: trunk/extensions/Wikilog/Wikilog.i18n.php |
— | — | @@ -90,6 +90,7 @@ |
91 | 91 | 'wikilog-simple-signature' => '$1 ($2)', |
92 | 92 | |
93 | 93 | # Edit page |
| 94 | + 'wikilog-edit-hint' => 'Edit wikilog article: $1', |
94 | 95 | 'wikilog-edit-fieldset-legend' => 'Wikilog options:', |
95 | 96 | 'wikilog-edit-signpub' => 'Sign and publish this article', |
96 | 97 | 'wikilog-edit-signpub-tooltip' => 'Causes this article to be signed and published in its wikilog when saved. |