Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -221,6 +221,7 @@ |
222 | 222 | 'printableversion', |
223 | 223 | 'permalink', |
224 | 224 | 'print', |
| 225 | + 'view', |
225 | 226 | 'edit', |
226 | 227 | 'create', |
227 | 228 | 'editthispage', |
— | — | @@ -228,6 +229,7 @@ |
229 | 230 | 'delete', |
230 | 231 | 'deletethispage', |
231 | 232 | 'undelete_short', |
| 233 | + 'viewdeleted_short', |
232 | 234 | 'protect', |
233 | 235 | 'protect_change', |
234 | 236 | 'protectthispage', |
Index: trunk/phase3/skins/Vector.php |
— | — | @@ -50,296 +50,6 @@ |
51 | 51 | parent::setupSkinUserCss( $out ); |
52 | 52 | $out->addModuleStyles( 'skins.vector' ); |
53 | 53 | } |
54 | | - |
55 | | - /** |
56 | | - * Builds a structured array of links used for tabs and menus |
57 | | - * @return array |
58 | | - * @private |
59 | | - */ |
60 | | - function buildNavigationUrls() { |
61 | | - global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle; |
62 | | - global $wgDisableLangConversion, $wgVectorUseIconWatch; |
63 | | - |
64 | | - wfProfileIn( __METHOD__ ); |
65 | | - |
66 | | - $links = array( |
67 | | - 'namespaces' => array(), |
68 | | - 'views' => array(), |
69 | | - 'actions' => array(), |
70 | | - 'variants' => array() |
71 | | - ); |
72 | | - |
73 | | - // Detects parameters |
74 | | - $action = $wgRequest->getVal( 'action', 'view' ); |
75 | | - $section = $wgRequest->getVal( 'section' ); |
76 | | - |
77 | | - $userCanRead = $this->mTitle->userCanRead(); |
78 | | - |
79 | | - // Checks if page is some kind of content |
80 | | - if( $this->iscontent ) { |
81 | | - // Gets page objects for the related namespaces |
82 | | - $subjectPage = $this->mTitle->getSubjectPage(); |
83 | | - $talkPage = $this->mTitle->getTalkPage(); |
84 | | - |
85 | | - // Determines if this is a talk page |
86 | | - $isTalk = $this->mTitle->isTalkPage(); |
87 | | - |
88 | | - // Generates XML IDs from namespace names |
89 | | - $subjectId = $this->mTitle->getNamespaceKey( '' ); |
90 | | - |
91 | | - if ( $subjectId == 'main' ) { |
92 | | - $talkId = 'talk'; |
93 | | - } else { |
94 | | - $talkId = "{$subjectId}_talk"; |
95 | | - } |
96 | | - |
97 | | - // Adds namespace links |
98 | | - $links['namespaces'][$subjectId] = $this->tabAction( |
99 | | - $subjectPage, 'nstab-' . $subjectId, !$isTalk, '', $userCanRead |
100 | | - ); |
101 | | - $links['namespaces'][$subjectId]['context'] = 'subject'; |
102 | | - $links['namespaces'][$talkId] = $this->tabAction( |
103 | | - $talkPage, 'talk', $isTalk, '', $userCanRead |
104 | | - ); |
105 | | - $links['namespaces'][$talkId]['context'] = 'talk'; |
106 | | - |
107 | | - // Adds view view link |
108 | | - if ( $this->mTitle->exists() && $userCanRead ) { |
109 | | - $links['views']['view'] = $this->tabAction( |
110 | | - $isTalk ? $talkPage : $subjectPage, |
111 | | - 'vector-view-view', ( $action == 'view' ), '', true |
112 | | - ); |
113 | | - } |
114 | | - |
115 | | - wfProfileIn( __METHOD__ . '-edit' ); |
116 | | - |
117 | | - // Checks if user can... |
118 | | - if ( |
119 | | - // read and edit the current page |
120 | | - $userCanRead && $this->mTitle->quickUserCan( 'edit' ) && |
121 | | - ( |
122 | | - // if it exists |
123 | | - $this->mTitle->exists() || |
124 | | - // or they can create one here |
125 | | - $this->mTitle->quickUserCan( 'create' ) |
126 | | - ) |
127 | | - ) { |
128 | | - // Builds CSS class for talk page links |
129 | | - $isTalkClass = $isTalk ? ' istalk' : ''; |
130 | | - |
131 | | - // Determines if we're in edit mode |
132 | | - $selected = ( |
133 | | - ( $action == 'edit' || $action == 'submit' ) && |
134 | | - ( $section != 'new' ) |
135 | | - ); |
136 | | - $links['views']['edit'] = array( |
137 | | - 'class' => ( $selected ? 'selected' : '' ) . $isTalkClass, |
138 | | - 'text' => $this->mTitle->exists() |
139 | | - ? wfMsg( 'vector-view-edit' ) |
140 | | - : wfMsg( 'vector-view-create' ), |
141 | | - 'href' => |
142 | | - $this->mTitle->getLocalURL( $this->editUrlOptions() ) |
143 | | - ); |
144 | | - // Checks if this is a current rev of talk page and we should show a new |
145 | | - // section link |
146 | | - if ( ( $isTalk && $wgArticle && $wgArticle->isCurrent() ) || ( $wgOut->showNewSectionLink() ) ) { |
147 | | - // Checks if we should ever show a new section link |
148 | | - if ( !$wgOut->forceHideNewSectionLink() ) { |
149 | | - // Adds new section link |
150 | | - //$links['actions']['addsection'] |
151 | | - $links['views']['addsection'] = array( |
152 | | - 'class' => 'collapsible ' . ( $section == 'new' ? 'selected' : false ), |
153 | | - 'text' => wfMsg( 'vector-action-addsection' ), |
154 | | - 'href' => $this->mTitle->getLocalURL( |
155 | | - 'action=edit§ion=new' |
156 | | - ) |
157 | | - ); |
158 | | - } |
159 | | - } |
160 | | - // Checks if the page has some kind of viewable content |
161 | | - } elseif ( $this->mTitle->hasSourceText() && $userCanRead ) { |
162 | | - // Adds view source view link |
163 | | - $links['views']['viewsource'] = array( |
164 | | - 'class' => ( $action == 'edit' ) ? 'selected' : false, |
165 | | - 'text' => wfMsg( 'vector-view-viewsource' ), |
166 | | - 'href' => |
167 | | - $this->mTitle->getLocalURL( $this->editUrlOptions() ) |
168 | | - ); |
169 | | - } |
170 | | - wfProfileOut( __METHOD__ . '-edit' ); |
171 | | - |
172 | | - wfProfileIn( __METHOD__ . '-live' ); |
173 | | - |
174 | | - // Checks if the page exists |
175 | | - if ( $this->mTitle->exists() && $userCanRead ) { |
176 | | - // Adds history view link |
177 | | - $links['views']['history'] = array( |
178 | | - 'class' => 'collapsible ' . ( ( $action == 'history' ) ? 'selected' : false ), |
179 | | - 'text' => wfMsg( 'vector-view-history' ), |
180 | | - 'href' => $this->mTitle->getLocalURL( 'action=history' ), |
181 | | - 'rel' => 'archives', |
182 | | - ); |
183 | | - |
184 | | - if( $wgUser->isAllowed( 'delete' ) ) { |
185 | | - $links['actions']['delete'] = array( |
186 | | - 'class' => ( $action == 'delete' ) ? 'selected' : false, |
187 | | - 'text' => wfMsg( 'vector-action-delete' ), |
188 | | - 'href' => $this->mTitle->getLocalURL( 'action=delete' ) |
189 | | - ); |
190 | | - } |
191 | | - if ( $this->mTitle->quickUserCan( 'move' ) ) { |
192 | | - $moveTitle = SpecialPage::getTitleFor( |
193 | | - 'Movepage', $this->thispage |
194 | | - ); |
195 | | - $links['actions']['move'] = array( |
196 | | - 'class' => $this->mTitle->isSpecial( 'Movepage' ) ? |
197 | | - 'selected' : false, |
198 | | - 'text' => wfMsg( 'vector-action-move' ), |
199 | | - 'href' => $moveTitle->getLocalURL() |
200 | | - ); |
201 | | - } |
202 | | - |
203 | | - if ( |
204 | | - $this->mTitle->getNamespace() !== NS_MEDIAWIKI && |
205 | | - $wgUser->isAllowed( 'protect' ) |
206 | | - ) { |
207 | | - if ( !$this->mTitle->isProtected() ) { |
208 | | - $links['actions']['protect'] = array( |
209 | | - 'class' => ( $action == 'protect' ) ? |
210 | | - 'selected' : false, |
211 | | - 'text' => wfMsg( 'vector-action-protect' ), |
212 | | - 'href' => |
213 | | - $this->mTitle->getLocalURL( 'action=protect' ) |
214 | | - ); |
215 | | - |
216 | | - } else { |
217 | | - $links['actions']['unprotect'] = array( |
218 | | - 'class' => ( $action == 'unprotect' ) ? |
219 | | - 'selected' : false, |
220 | | - 'text' => wfMsg( 'vector-action-unprotect' ), |
221 | | - 'href' => |
222 | | - $this->mTitle->getLocalURL( 'action=unprotect' ) |
223 | | - ); |
224 | | - } |
225 | | - } |
226 | | - } else { |
227 | | - // article doesn't exist or is deleted |
228 | | - if ( |
229 | | - $wgUser->isAllowed( 'deletedhistory' ) && |
230 | | - $wgUser->isAllowed( 'undelete' ) |
231 | | - ) { |
232 | | - $n = $this->mTitle->isDeleted(); |
233 | | - if( $n ) { |
234 | | - $undelTitle = SpecialPage::getTitleFor( 'Undelete' ); |
235 | | - $links['actions']['undelete'] = array( |
236 | | - 'class' => false, |
237 | | - 'text' => wfMsgExt( |
238 | | - 'vector-action-undelete', |
239 | | - array( 'parsemag' ), |
240 | | - $wgLang->formatNum( $n ) |
241 | | - ), |
242 | | - 'href' => $undelTitle->getLocalURL( |
243 | | - 'target=' . urlencode( $this->thispage ) |
244 | | - ) |
245 | | - ); |
246 | | - } |
247 | | - } |
248 | | - |
249 | | - if ( |
250 | | - $this->mTitle->getNamespace() !== NS_MEDIAWIKI && |
251 | | - $wgUser->isAllowed( 'protect' ) |
252 | | - ) { |
253 | | - if ( !$this->mTitle->getRestrictions( 'create' ) ) { |
254 | | - $links['actions']['protect'] = array( |
255 | | - 'class' => ( $action == 'protect' ) ? |
256 | | - 'selected' : false, |
257 | | - 'text' => wfMsg( 'vector-action-protect' ), |
258 | | - 'href' => |
259 | | - $this->mTitle->getLocalURL( 'action=protect' ) |
260 | | - ); |
261 | | - |
262 | | - } else { |
263 | | - $links['actions']['unprotect'] = array( |
264 | | - 'class' => ( $action == 'unprotect' ) ? |
265 | | - 'selected' : false, |
266 | | - 'text' => wfMsg( 'vector-action-unprotect' ), |
267 | | - 'href' => |
268 | | - $this->mTitle->getLocalURL( 'action=unprotect' ) |
269 | | - ); |
270 | | - } |
271 | | - } |
272 | | - } |
273 | | - wfProfileOut( __METHOD__ . '-live' ); |
274 | | - /** |
275 | | - * The following actions use messages which, if made particular to |
276 | | - * the Vector skin, would break the Ajax code which makes this |
277 | | - * action happen entirely inline. Skin::makeGlobalVariablesScript |
278 | | - * defines a set of messages in a javascript object - and these |
279 | | - * messages are assumed to be global for all skins. Without making |
280 | | - * a change to that procedure these messages will have to remain as |
281 | | - * the global versions. |
282 | | - */ |
283 | | - // Checks if the user is logged in |
284 | | - if ( $this->loggedin ) { |
285 | | - if ( $wgVectorUseIconWatch ) { |
286 | | - $class = 'icon'; |
287 | | - $place = 'views'; |
288 | | - } else { |
289 | | - $class = ''; |
290 | | - $place = 'actions'; |
291 | | - } |
292 | | - $mode = $this->mTitle->userIsWatching() ? 'unwatch' : 'watch'; |
293 | | - $links[$place][$mode] = array( |
294 | | - 'class' => $class . ( ( $action == 'watch' || $action == 'unwatch' ) ? ' selected' : false ), |
295 | | - 'text' => wfMsg( $mode ), // uses 'watch' or 'unwatch' message |
296 | | - 'href' => $this->mTitle->getLocalURL( 'action=' . $mode ) |
297 | | - ); |
298 | | - } |
299 | | - // This is instead of SkinTemplateTabs - which uses a flat array |
300 | | - wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) ); |
301 | | - |
302 | | - // If it's not content, it's got to be a special page |
303 | | - } else { |
304 | | - $links['namespaces']['special'] = array( |
305 | | - 'class' => 'selected', |
306 | | - 'text' => wfMsg( 'nstab-special' ), |
307 | | - 'href' => $wgRequest->getRequestURL() |
308 | | - ); |
309 | | - // Equiv to SkinTemplateBuildContentActionUrlsAfterSpecialPage |
310 | | - wfRunHooks( 'SkinTemplateNavigation::SpecialPage', array( &$this, &$links ) ); |
311 | | - } |
312 | | - |
313 | | - // Gets list of language variants |
314 | | - $variants = $wgContLang->getVariants(); |
315 | | - // Checks that language conversion is enabled and variants exist |
316 | | - if( !$wgDisableLangConversion && count( $variants ) > 1 ) { |
317 | | - // Gets preferred variant |
318 | | - $preferred = $wgContLang->getPreferredVariant(); |
319 | | - // Loops over each variant |
320 | | - foreach( $variants as $code ) { |
321 | | - // Gets variant name from language code |
322 | | - $varname = $wgContLang->getVariantname( $code ); |
323 | | - // Checks if the variant is marked as disabled |
324 | | - if( $varname == 'disable' ) { |
325 | | - // Skips this variant |
326 | | - continue; |
327 | | - } |
328 | | - // Appends variant link |
329 | | - $links['variants'][] = array( |
330 | | - 'class' => ( $code == $preferred ) ? 'selected' : false, |
331 | | - 'text' => $varname, |
332 | | - 'href' => $this->mTitle->getLocalURL( '', $code ) |
333 | | - ); |
334 | | - } |
335 | | - } |
336 | | - |
337 | | - // Equiv to SkinTemplateContentActions |
338 | | - wfRunHooks( 'SkinTemplateNavigation::Universal', array( &$this, &$links ) ); |
339 | | - |
340 | | - wfProfileOut( __METHOD__ ); |
341 | | - |
342 | | - return $links; |
343 | | - } |
344 | 54 | } |
345 | 55 | |
346 | 56 | /** |
— | — | @@ -361,39 +71,38 @@ |
362 | 72 | * Outputs the entire contents of the XHTML page |
363 | 73 | */ |
364 | 74 | public function execute() { |
365 | | - global $wgRequest, $wgLang; |
| 75 | + global $wgRequest, $wgLang, $wgVectorUseIconWatch; |
366 | 76 | |
367 | 77 | $this->skin = $this->data['skin']; |
368 | 78 | $action = $wgRequest->getText( 'action' ); |
369 | 79 | |
370 | 80 | // Build additional attributes for navigation urls |
371 | | - $nav = $this->skin->buildNavigationUrls(); |
| 81 | + //$nav = $this->skin->buildNavigationUrls(); |
| 82 | + $nav = $this->data['content_navigation']; |
| 83 | + |
| 84 | + if ( $wgVectorUseIconWatch ) { |
| 85 | + $mode = $this->skin->mTitle->userIsWatching() ? 'unwatch' : 'watch'; |
| 86 | + $nav['views'][$mode] = $nav['actions'][$mode]; |
| 87 | + $nav['views'][$mode]['class'] = rtrim('icon ' . $nav['views'][$mode]['class'], ' '); |
| 88 | + $nav['views'][$mode]['primary'] = true; |
| 89 | + unset($nav['actions'][$mode]); |
| 90 | + } |
| 91 | + |
372 | 92 | foreach ( $nav as $section => $links ) { |
373 | 93 | foreach ( $links as $key => $link ) { |
374 | | - $xmlID = $key; |
375 | | - if ( isset( $link['context'] ) && $link['context'] == 'subject' ) { |
376 | | - $xmlID = 'ca-nstab-' . $xmlID; |
377 | | - } else if ( isset( $link['context'] ) && $link['context'] == 'talk' ) { |
378 | | - $xmlID = 'ca-talk'; |
379 | | - } else { |
380 | | - $xmlID = 'ca-' . $xmlID; |
| 94 | + if ( $section == "views" && !(isset($link["primary"]) && $link["primary"]) ) { |
| 95 | + $link['class'] = rtrim('collapsible ' . $link['class'], ' '); |
381 | 96 | } |
| 97 | + |
| 98 | + $xmlID = isset($link["id"]) ? $link["id"] : 'ca-' . $xmlID; |
382 | 99 | $nav[$section][$key]['attributes'] = |
383 | 100 | ' id="' . Sanitizer::escapeId( $xmlID ) . '"'; |
384 | | - if ( $nav[$section][$key]['class'] ) { |
| 101 | + if ( $link['class'] ) { |
385 | 102 | $nav[$section][$key]['attributes'] .= |
386 | 103 | ' class="' . htmlspecialchars( $link['class'] ) . '"'; |
387 | 104 | unset( $nav[$section][$key]['class'] ); |
388 | 105 | } |
389 | | - // We don't want to give the watch tab an accesskey if the page |
390 | | - // is being edited, because that conflicts with the accesskey on |
391 | | - // the watch checkbox. We also don't want to give the edit tab |
392 | | - // an accesskey, because that's fairly superfluous and conflicts |
393 | | - // with an accesskey (Ctrl-E) often used for editing in Safari. |
394 | | - if ( |
395 | | - in_array( $action, array( 'edit', 'submit' ) ) && |
396 | | - in_array( $key, array( 'edit', 'watch', 'unwatch' ) ) |
397 | | - ) { |
| 106 | + if ( isset($link['tooltiponly']) && $link['tooltiponly'] ) { |
398 | 107 | $nav[$section][$key]['key'] = |
399 | 108 | $this->skin->tooltip( $xmlID ); |
400 | 109 | } else { |
Index: trunk/phase3/skins/MonoBook.php |
— | — | @@ -107,14 +107,7 @@ |
108 | 108 | echo ' class="'.htmlspecialchars($tab['class']).'"'; |
109 | 109 | } |
110 | 110 | echo '><a href="'.htmlspecialchars($tab['href']).'"'; |
111 | | - # We don't want to give the watch tab an accesskey if the |
112 | | - # page is being edited, because that conflicts with the |
113 | | - # accesskey on the watch checkbox. We also don't want to |
114 | | - # give the edit tab an accesskey, because that's fairly su- |
115 | | - # perfluous and conflicts with an accesskey (Ctrl-E) often |
116 | | - # used for editing in Safari. |
117 | | - if( in_array( $action, array( 'edit', 'submit' ) ) |
118 | | - && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) { |
| 111 | + if( $tab["tooltiponly"] ) { |
119 | 112 | echo $skin->tooltip( "ca-$key" ); |
120 | 113 | } else { |
121 | 114 | echo $skin->tooltipAndAccesskey( "ca-$key" ); |
Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -1488,24 +1488,14 @@ |
1489 | 1489 | If true is returned, $subpages will be ignored and the rest of |
1490 | 1490 | subPageSubtitle() will run. |
1491 | 1491 | |
1492 | | -'SkinTemplateBuildContentActionUrlsAfterSpecialPage': after the single tab |
1493 | | -when showing a special page |
1494 | | -$sktemplate: SkinTemplate object |
1495 | | -$content_actions: array of tabs |
1496 | | - |
1497 | 1492 | 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink': after creating the |
1498 | 1493 | "permanent link" tab |
1499 | 1494 | $sktemplate: SkinTemplate object |
1500 | 1495 | $nav_urls: array of tabs |
1501 | 1496 | |
1502 | | -'SkinTemplateContentActions': Alter the "content action" links in SkinTemplates |
1503 | | -&$content_actions: Content actions |
1504 | | -[See http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/examples/Content_action.php |
1505 | | -for an example] |
1506 | | - |
1507 | 1497 | Alter the structured navigation links in SkinTemplates, there are three of these hooks called in different spots. |
1508 | | -'SkinTemplateNavigation': Called on content pages before variants have been added |
1509 | | -'SkinTemplateNavigation::SpecialPage': Called on special pages before variands have been added |
| 1498 | +'SkinTemplateNavigation': Called on content pages after the tabs have been added but before before variants have been added |
| 1499 | +'SkinTemplateNavigation::SpecialPage': Called on special pages after the special tab is added but before variants have been added |
1510 | 1500 | 'SkinTemplateNavigation::Universal': Called on both content and special pages after variants have been added |
1511 | 1501 | &$sktemplate: SkinTemplate object |
1512 | 1502 | &$links: Structured navigation links |
— | — | @@ -1536,10 +1526,6 @@ |
1537 | 1527 | &$text: Link text. |
1538 | 1528 | &$result: Complete assoc. array if you want to return true. |
1539 | 1529 | |
1540 | | -'SkinTemplateTabs': called when finished to build the actions tabs |
1541 | | -$sktemplate: SkinTemplate object |
1542 | | -$content_actions: array of tabs |
1543 | | - |
1544 | 1530 | 'SkinTemplateToolboxEnd': Called by SkinTemplate skins after toolbox links have |
1545 | 1531 | been rendered (useful for adding more) |
1546 | 1532 | $tools: array of tools |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -596,6 +596,26 @@ |
597 | 597 | } |
598 | 598 | |
599 | 599 | /** |
| 600 | + * This function accepts multiple message keys and returns a message instance |
| 601 | + * for the first message which is non-empty. If all messages are empty then an |
| 602 | + * instance of the first message key is returned. |
| 603 | + * Varargs: message keys |
| 604 | + * @return \type{Message} |
| 605 | + * @since 1.18 |
| 606 | + */ |
| 607 | +function wfMessageFallback( /*...*/ ) { |
| 608 | + $keys = func_get_args(); |
| 609 | + $first = $keys[0]; |
| 610 | + foreach ( $keys as $key ) { |
| 611 | + if ( wfEmptyMsg( $key ) ) { |
| 612 | + continue; |
| 613 | + } |
| 614 | + return wfMessage( $key ); |
| 615 | + } |
| 616 | + return wfMessage( $first ); |
| 617 | +} |
| 618 | + |
| 619 | +/** |
600 | 620 | * Get a message from anywhere, for the current user language. |
601 | 621 | * |
602 | 622 | * Use wfMsgForContent() instead if the message should NOT |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -495,7 +495,9 @@ |
496 | 496 | wfProfileIn( __METHOD__ . '-stuff5' ); |
497 | 497 | # Personal toolbar |
498 | 498 | $tpl->set( 'personal_urls', $this->buildPersonalUrls() ); |
499 | | - $content_actions = $this->buildContentActionUrls(); |
| 499 | + $content_navigation = $this->buildContentNavigationUrls(); |
| 500 | + $content_actions = $this->buildContentActionUrls( $content_navigation ); |
| 501 | + $tpl->setRef( 'content_navigation', $content_navigation ); |
500 | 502 | $tpl->setRef( 'content_actions', $content_actions ); |
501 | 503 | |
502 | 504 | $tpl->set( 'sidebar', $this->buildSidebar() ); |
— | — | @@ -720,7 +722,8 @@ |
721 | 723 | return array( |
722 | 724 | 'class' => implode( ' ', $classes ), |
723 | 725 | 'text' => $text, |
724 | | - 'href' => $title->getLocalUrl( $query ) ); |
| 726 | + 'href' => $title->getLocalUrl( $query ), |
| 727 | + 'primary' => true ); |
725 | 728 | } |
726 | 729 | |
727 | 730 | function makeTalkUrlDetails( $name, $urlaction = '' ) { |
— | — | @@ -747,204 +750,363 @@ |
748 | 751 | } |
749 | 752 | |
750 | 753 | /** |
751 | | - * an array of edit links by default used for the tabs |
| 754 | + * a structured array of links usually used for the tabs in a skin |
| 755 | + * |
| 756 | + * There are 4 standard sections |
| 757 | + * namespaces: Used for namespace tabs like special, page, and talk namespaces |
| 758 | + * views: Used for primary page views like read, edit, history |
| 759 | + * actions: Used for most extra page actions like deletion, protection, etc... |
| 760 | + * variants: Used to list the language variants for the page |
| 761 | + * |
| 762 | + * Each section's value is a key/value array of links for that section. |
| 763 | + * The links themseves have these common keys: |
| 764 | + * - class: The css classes to apply to the tab |
| 765 | + * - text: The text to display on the tab |
| 766 | + * - href: The href for the tab to point to |
| 767 | + * - rel: An optional rel= for the tab's link |
| 768 | + * - redundant: If true the tab will be dropped in skins using content_actions |
| 769 | + * this is useful for tabs like "Read" which only have meaning in skins that |
| 770 | + * take special meaning from the grouped structure of content_navigation |
| 771 | + * |
| 772 | + * Views also have an extra key which can be used: |
| 773 | + * - primary: If this is not true skins like vector may try to hide the tab |
| 774 | + * when the user has limited space in their browser window |
| 775 | + * |
| 776 | + * content_navigation using code also expects these ids to be present on the |
| 777 | + * links, however these are usually automatically generated by SkinTemplate |
| 778 | + * itself and are not necessary when using a hook. The only things these may |
| 779 | + * matter to are people modifying content_navigation after it's initial creation: |
| 780 | + * - id: A "preferred" id, most skins are best off outputting this preferred id for best compatibility |
| 781 | + * - tooltiponly: This is set to true for some tabs in cases where the system |
| 782 | + * believes that the accesskey should not be added to the tab. |
| 783 | + * |
752 | 784 | * @return array |
753 | 785 | * @private |
754 | 786 | */ |
755 | | - function buildContentActionUrls() { |
| 787 | + function buildContentNavigationUrls() { |
756 | 788 | global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle; |
| 789 | + global $wgDisableLangConversion; |
757 | 790 | |
758 | 791 | wfProfileIn( __METHOD__ ); |
| 792 | + |
| 793 | + $content_navigation = array( |
| 794 | + 'namespaces' => array(), |
| 795 | + 'views' => array(), |
| 796 | + 'actions' => array(), |
| 797 | + 'variants' => array() |
| 798 | + ); |
759 | 799 | |
| 800 | + // parameters |
760 | 801 | $action = $wgRequest->getVal( 'action', 'view' ); |
761 | 802 | $section = $wgRequest->getVal( 'section' ); |
762 | | - $content_actions = array(); |
| 803 | + |
763 | 804 | $userCanRead = $this->mTitle->userCanRead(); |
| 805 | + $skname = $this->skinname; |
764 | 806 | |
765 | | - $prevent_active_tabs = false; |
766 | | - wfRunHooks( 'SkinTemplatePreventOtherActiveTabs', array( &$this, &$prevent_active_tabs ) ); |
| 807 | + $preventActiveTabs = false; |
| 808 | + wfRunHooks( 'SkinTemplatePreventOtherActiveTabs', array( &$this, &$preventActiveTabs ) ); |
767 | 809 | |
| 810 | + // Checks if page is some kind of content |
768 | 811 | if( $this->iscontent ) { |
769 | | - $subjpage = $this->mTitle->getSubjectPage(); |
770 | | - $talkpage = $this->mTitle->getTalkPage(); |
| 812 | + // Gets page objects for the related namespaces |
| 813 | + $subjectPage = $this->mTitle->getSubjectPage(); |
| 814 | + $talkPage = $this->mTitle->getTalkPage(); |
771 | 815 | |
772 | | - $nskey = $this->mTitle->getNamespaceKey(); |
773 | | - $content_actions[$nskey] = $this->tabAction( |
774 | | - $subjpage, |
775 | | - $nskey, |
776 | | - !$this->mTitle->isTalkPage() && !$prevent_active_tabs, |
777 | | - '', $userCanRead |
778 | | - ); |
| 816 | + // Determines if this is a talk page |
| 817 | + $isTalk = $this->mTitle->isTalkPage(); |
779 | 818 | |
780 | | - $content_actions['talk'] = $this->tabAction( |
781 | | - $talkpage, |
782 | | - 'talk', |
783 | | - $this->mTitle->isTalkPage() && !$prevent_active_tabs, |
784 | | - '', |
785 | | - $userCanRead |
| 819 | + // Generates XML IDs from namespace names |
| 820 | + $subjectId = $this->mTitle->getNamespaceKey( '' ); |
| 821 | + |
| 822 | + if ( $subjectId == 'main' ) { |
| 823 | + $talkId = 'talk'; |
| 824 | + } else { |
| 825 | + $talkId = "{$subjectId}_talk"; |
| 826 | + } |
| 827 | + |
| 828 | + // Adds namespace links |
| 829 | + $content_navigation['namespaces'][$subjectId] = $this->tabAction( |
| 830 | + $subjectPage, 'nstab-' . $subjectId, !$isTalk && !$preventActiveTabs, '', $userCanRead |
786 | 831 | ); |
| 832 | + $content_navigation['namespaces'][$subjectId]['context'] = 'subject'; |
| 833 | + $content_navigation['namespaces'][$talkId] = $this->tabAction( |
| 834 | + $talkPage, 'talk', $isTalk && !$preventActiveTabs, '', $userCanRead |
| 835 | + ); |
| 836 | + $content_navigation['namespaces'][$talkId]['context'] = 'talk'; |
787 | 837 | |
| 838 | + // Adds view view link |
| 839 | + if ( $this->mTitle->exists() && $userCanRead ) { |
| 840 | + $content_navigation['views']['view'] = $this->tabAction( |
| 841 | + $isTalk ? $talkPage : $subjectPage, |
| 842 | + !wfEmptyMsg( "$skname-view-view" ) ? "$skname-view-view" : 'view', |
| 843 | + ( $action == 'view' ), '', true |
| 844 | + ); |
| 845 | + $content_navigation['views']['view']['redundant'] = true; // signal to hide this from simple content_actions |
| 846 | + } |
| 847 | + |
788 | 848 | wfProfileIn( __METHOD__ . '-edit' ); |
789 | | - if ( $userCanRead && $this->mTitle->quickUserCan( 'edit' ) && ( $this->mTitle->exists() || $this->mTitle->quickUserCan( 'create' ) ) ) { |
790 | | - $istalk = $this->mTitle->isTalkPage(); |
791 | | - $istalkclass = $istalk?' istalk':''; |
792 | | - $content_actions['edit'] = array( |
793 | | - 'class' => ( ( ( $action == 'edit' or $action == 'submit' ) and $section != 'new' ) ? 'selected' : '' ) . $istalkclass, |
794 | | - 'text' => ( $this->mTitle->exists() || ( $this->mTitle->getNamespace() == NS_MEDIAWIKI && !wfEmptyMsg( $this->mTitle->getText() ) ) ) |
795 | | - ? wfMsg( 'edit' ) |
796 | | - : wfMsg( 'create' ), |
797 | | - 'href' => $this->mTitle->getLocalUrl( $this->editUrlOptions() ) |
| 849 | + |
| 850 | + // Checks if user can... |
| 851 | + if ( |
| 852 | + // read and edit the current page |
| 853 | + $userCanRead && $this->mTitle->quickUserCan( 'edit' ) && |
| 854 | + ( |
| 855 | + // if it exists |
| 856 | + $this->mTitle->exists() || |
| 857 | + // or they can create one here |
| 858 | + $this->mTitle->quickUserCan( 'create' ) |
| 859 | + ) |
| 860 | + ) { |
| 861 | + // Builds CSS class for talk page links |
| 862 | + $isTalkClass = $isTalk ? ' istalk' : ''; |
| 863 | + |
| 864 | + // Determines if we're in edit mode |
| 865 | + $selected = ( |
| 866 | + ( $action == 'edit' || $action == 'submit' ) && |
| 867 | + ( $section != 'new' ) |
798 | 868 | ); |
799 | | - |
800 | | - // adds new section link if page is a current revision of a talk page or |
801 | | - if ( ( $wgArticle && $wgArticle->isCurrent() && $istalk ) || $wgOut->showNewSectionLink() ) { |
| 869 | + $msgKey = $this->mTitle->exists() || ( $this->mTitle->getNamespace() == NS_MEDIAWIKI && !wfEmptyMsg( $this->mTitle->getText() ) ) ? |
| 870 | + "edit" : "create"; |
| 871 | + $content_navigation['views']['edit'] = array( |
| 872 | + 'class' => ( $selected ? 'selected' : '' ) . $isTalkClass, |
| 873 | + 'text' => wfMessageFallback( "$skname-view-$msgKey", $msgKey )->plain(), |
| 874 | + 'href' => $this->mTitle->getLocalURL( $this->editUrlOptions() ), |
| 875 | + 'primary' => true, // don't collapse this in vector |
| 876 | + ); |
| 877 | + // Checks if this is a current rev of talk page and we should show a new |
| 878 | + // section link |
| 879 | + if ( ( $isTalk && $wgArticle && $wgArticle->isCurrent() ) || ( $wgOut->showNewSectionLink() ) ) { |
| 880 | + // Checks if we should ever show a new section link |
802 | 881 | if ( !$wgOut->forceHideNewSectionLink() ) { |
803 | | - $content_actions['addsection'] = array( |
| 882 | + // Adds new section link |
| 883 | + //$content_navigation['actions']['addsection'] |
| 884 | + $content_navigation['views']['addsection'] = array( |
804 | 885 | 'class' => $section == 'new' ? 'selected' : false, |
805 | | - 'text' => wfMsg( 'addsection' ), |
806 | | - 'href' => $this->mTitle->getLocalUrl( 'action=edit§ion=new' ) |
| 886 | + 'text' => wfMessageFallback( "$skname-action-addsection", 'addsection' )->plain(), |
| 887 | + 'href' => $this->mTitle->getLocalURL( 'action=edit§ion=new' ) |
807 | 888 | ); |
808 | 889 | } |
809 | 890 | } |
| 891 | + // Checks if the page has some kind of viewable content |
810 | 892 | } elseif ( $this->mTitle->hasSourceText() && $userCanRead ) { |
811 | | - $content_actions['viewsource'] = array( |
812 | | - 'class' => ($action == 'edit') ? 'selected' : false, |
813 | | - 'text' => wfMsg( 'viewsource' ), |
814 | | - 'href' => $this->mTitle->getLocalUrl( $this->editUrlOptions() ) |
| 893 | + // Adds view source view link |
| 894 | + $content_navigation['views']['viewsource'] = array( |
| 895 | + 'class' => ( $action == 'edit' ) ? 'selected' : false, |
| 896 | + 'text' => wfMessageFallback( "$skname-action-viewsource", 'viewsource' )->plain(), |
| 897 | + 'href' => $this->mTitle->getLocalURL( $this->editUrlOptions() ), |
| 898 | + 'primary' => true, // don't collapse this in vector |
815 | 899 | ); |
816 | 900 | } |
817 | 901 | wfProfileOut( __METHOD__ . '-edit' ); |
818 | 902 | |
819 | 903 | wfProfileIn( __METHOD__ . '-live' ); |
| 904 | + |
| 905 | + // Checks if the page exists |
820 | 906 | if ( $this->mTitle->exists() && $userCanRead ) { |
821 | | - |
822 | | - $content_actions['history'] = array( |
823 | | - 'class' => ($action == 'history') ? 'selected' : false, |
824 | | - 'text' => wfMsg( 'history_short' ), |
825 | | - 'href' => $this->mTitle->getLocalUrl( 'action=history' ), |
| 907 | + // Adds history view link |
| 908 | + $content_navigation['views']['history'] = array( |
| 909 | + 'class' => ( $action == 'history' ) ? 'selected' : false, |
| 910 | + 'text' => wfMessageFallback( "$skname-view-history", 'history_short' )->plain(), |
| 911 | + 'href' => $this->mTitle->getLocalURL( 'action=history' ), |
826 | 912 | 'rel' => 'archives', |
827 | 913 | ); |
828 | 914 | |
829 | 915 | if( $wgUser->isAllowed( 'delete' ) ) { |
830 | | - $content_actions['delete'] = array( |
831 | | - 'class' => ($action == 'delete') ? 'selected' : false, |
832 | | - 'text' => wfMsg( 'delete' ), |
833 | | - 'href' => $this->mTitle->getLocalUrl( 'action=delete' ) |
| 916 | + $content_navigation['actions']['delete'] = array( |
| 917 | + 'class' => ( $action == 'delete' ) ? 'selected' : false, |
| 918 | + 'text' => wfMessageFallback( "$skname-action-delete", 'delete' )->plain(), |
| 919 | + 'href' => $this->mTitle->getLocalURL( 'action=delete' ) |
834 | 920 | ); |
835 | 921 | } |
836 | 922 | if ( $this->mTitle->quickUserCan( 'move' ) ) { |
837 | 923 | $moveTitle = SpecialPage::getTitleFor( 'Movepage', $this->thispage ); |
838 | | - $content_actions['move'] = array( |
| 924 | + $content_navigation['actions']['move'] = array( |
839 | 925 | 'class' => $this->mTitle->isSpecial( 'Movepage' ) ? 'selected' : false, |
840 | | - 'text' => wfMsg( 'move' ), |
841 | | - 'href' => $moveTitle->getLocalUrl() |
| 926 | + 'text' => wfMessageFallback( "$skname-action-move", 'move' )->plain(), |
| 927 | + 'href' => $moveTitle->getLocalURL() |
842 | 928 | ); |
843 | 929 | } |
844 | 930 | |
845 | 931 | if ( $this->mTitle->getNamespace() !== NS_MEDIAWIKI && $wgUser->isAllowed( 'protect' ) ) { |
846 | | - if( !$this->mTitle->isProtected() ){ |
847 | | - $content_actions['protect'] = array( |
848 | | - 'class' => ($action == 'protect') ? 'selected' : false, |
849 | | - 'text' => wfMsg( 'protect' ), |
850 | | - 'href' => $this->mTitle->getLocalUrl( 'action=protect' ) |
851 | | - ); |
852 | | - |
853 | | - } else { |
854 | | - $content_actions['unprotect'] = array( |
855 | | - 'class' => ($action == 'unprotect') ? 'selected' : false, |
856 | | - 'text' => wfMsg( 'unprotect' ), |
857 | | - 'href' => $this->mTitle->getLocalUrl( 'action=unprotect' ) |
858 | | - ); |
859 | | - } |
| 932 | + $mode = !$this->mTitle->isProtected() ? 'protect' : 'unprotect'; |
| 933 | + $content_navigation['actions'][$mode] = array( |
| 934 | + 'class' => ( $action == $mode ) ? 'selected' : false, |
| 935 | + 'text' => wfMessageFallback( "$skname-action-$mode", $mode )->plain(), |
| 936 | + 'href' => $this->mTitle->getLocalURL( "action=$mode" ) |
| 937 | + ); |
860 | 938 | } |
861 | 939 | } else { |
862 | | - //article doesn't exist or is deleted |
863 | | - if( $wgUser->isAllowed( 'deletedhistory' ) && $wgUser->isAllowed( 'deletedtext' ) ) { |
| 940 | + // article doesn't exist or is deleted |
| 941 | + if ( $wgUser->isAllowed( 'deletedhistory' ) ) { |
864 | 942 | $n = $this->mTitle->isDeleted(); |
865 | 943 | if( $n ) { |
866 | 944 | $undelTitle = SpecialPage::getTitleFor( 'Undelete' ); |
867 | | - $content_actions['undelete'] = array( |
| 945 | + // If the user can't undelete but can view deleted history show them a "View .. deleted" tab instead |
| 946 | + $msgKey = $wgUser->isAllowed( 'undelete' ) ? 'undelete' : 'viewdeleted'; |
| 947 | + $content_navigation['actions']['undelete'] = array( |
868 | 948 | 'class' => false, |
869 | | - 'text' => wfMsgExt( 'undelete_short', array( 'parsemag' ), $wgLang->formatNum( $n ) ), |
870 | | - 'href' => $undelTitle->getLocalUrl( 'target=' . urlencode( $this->thispage ) ) |
871 | | - #'href' => self::makeSpecialUrl( "Undelete/$this->thispage" ) |
| 949 | + 'text' => wfMessageFallback( "$skname-action-$msgKey", "{$msgKey}_short" ) |
| 950 | + ->params( $wgLang->formatNum( $n ) )->text(), |
| 951 | + 'href' => $undelTitle->getLocalURL( array( 'target' => $this->thispage ) ) |
872 | 952 | ); |
873 | 953 | } |
874 | 954 | } |
875 | 955 | |
876 | 956 | if ( $this->mTitle->getNamespace() !== NS_MEDIAWIKI && $wgUser->isAllowed( 'protect' ) ) { |
877 | | - if( !$this->mTitle->getRestrictions( 'create' ) ) { |
878 | | - $content_actions['protect'] = array( |
879 | | - 'class' => ($action == 'protect') ? 'selected' : false, |
880 | | - 'text' => wfMsg( 'protect' ), |
881 | | - 'href' => $this->mTitle->getLocalUrl( 'action=protect' ) |
882 | | - ); |
883 | | - |
884 | | - } else { |
885 | | - $content_actions['unprotect'] = array( |
886 | | - 'class' => ($action == 'unprotect') ? 'selected' : false, |
887 | | - 'text' => wfMsg( 'unprotect' ), |
888 | | - 'href' => $this->mTitle->getLocalUrl( 'action=unprotect' ) |
889 | | - ); |
890 | | - } |
| 957 | + $mode = !$this->mTitle->getRestrictions( 'create' ) ? 'protect' : 'unprotect'; |
| 958 | + $content_navigation['actions'][$mode] = array( |
| 959 | + 'class' => ( $action == $mode ) ? 'selected' : false, |
| 960 | + 'text' => wfMessageFallback( "$skname-action-$mode", $mode )->plain(), |
| 961 | + 'href' => $this->mTitle->getLocalURL( "action=$mode" ) |
| 962 | + ); |
891 | 963 | } |
892 | 964 | } |
893 | | - |
894 | 965 | wfProfileOut( __METHOD__ . '-live' ); |
895 | 966 | |
896 | | - if( $this->loggedin ) { |
897 | | - if( !$this->mTitle->userIsWatching()) { |
898 | | - $content_actions['watch'] = array( |
899 | | - 'class' => ($action == 'watch' or $action == 'unwatch') ? 'selected' : false, |
900 | | - 'text' => wfMsg( 'watch' ), |
901 | | - 'href' => $this->mTitle->getLocalUrl( 'action=watch' ) |
902 | | - ); |
903 | | - } else { |
904 | | - $content_actions['unwatch'] = array( |
905 | | - 'class' => ($action == 'unwatch' or $action == 'watch') ? 'selected' : false, |
906 | | - 'text' => wfMsg( 'unwatch' ), |
907 | | - 'href' => $this->mTitle->getLocalUrl( 'action=unwatch' ) |
908 | | - ); |
909 | | - } |
| 967 | + // Checks if the user is logged in |
| 968 | + if ( $this->loggedin ) { |
| 969 | + /** |
| 970 | + * The following actions use messages which, if made particular to |
| 971 | + * the any specific skins, would break the Ajax code which makes this |
| 972 | + * action happen entirely inline. Skin::makeGlobalVariablesScript |
| 973 | + * defines a set of messages in a javascript object - and these |
| 974 | + * messages are assumed to be global for all skins. Without making |
| 975 | + * a change to that procedure these messages will have to remain as |
| 976 | + * the global versions. |
| 977 | + */ |
| 978 | + $mode = $this->mTitle->userIsWatching() ? 'unwatch' : 'watch'; |
| 979 | + $content_navigation['actions'][$mode] = array( |
| 980 | + 'class' => ( $action == 'watch' || $action == 'unwatch' ) ? 'selected' : false, |
| 981 | + 'text' => wfMsg( $mode ), // uses 'watch' or 'unwatch' message |
| 982 | + 'href' => $this->mTitle->getLocalURL( 'action=' . $mode ) |
| 983 | + ); |
910 | 984 | } |
911 | | - |
912 | | - |
913 | | - wfRunHooks( 'SkinTemplateTabs', array( $this, &$content_actions ) ); |
| 985 | + |
| 986 | + wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$content_navigation ) ); |
914 | 987 | } else { |
915 | | - /* show special page tab */ |
916 | | - |
917 | | - $content_actions[$this->mTitle->getNamespaceKey()] = array( |
| 988 | + // If it's not content, it's got to be a special page |
| 989 | + $content_navigation['namespaces']['special'] = array( |
918 | 990 | 'class' => 'selected', |
919 | | - 'text' => wfMsg('nstab-special'), |
| 991 | + 'text' => wfMsg( 'nstab-special' ), |
920 | 992 | 'href' => $wgRequest->getRequestURL(), // @bug 2457, 2510 |
| 993 | + 'context' => 'subject' |
921 | 994 | ); |
922 | | - |
923 | | - wfRunHooks( 'SkinTemplateBuildContentActionUrlsAfterSpecialPage', array( &$this, &$content_actions ) ); |
| 995 | + |
| 996 | + wfRunHooks( 'SkinTemplateNavigation::SpecialPage', array( &$this, &$content_navigation ) ); |
924 | 997 | } |
925 | 998 | |
926 | | - /* show links to different language variants */ |
927 | | - global $wgDisableLangConversion; |
| 999 | + // Gets list of language variants |
928 | 1000 | $variants = $wgContLang->getVariants(); |
929 | | - if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) { |
| 1001 | + // Checks that language conversion is enabled and variants exist |
| 1002 | + if( !$wgDisableLangConversion && count( $variants ) > 1 ) { |
| 1003 | + // Gets preferred variant |
930 | 1004 | $preferred = $wgContLang->getPreferredVariant(); |
931 | | - $vcount=0; |
| 1005 | + // Loops over each variant |
932 | 1006 | foreach( $variants as $code ) { |
| 1007 | + // Gets variant name from language code |
933 | 1008 | $varname = $wgContLang->getVariantname( $code ); |
934 | | - if( $varname == 'disable' ) |
| 1009 | + // Checks if the variant is marked as disabled |
| 1010 | + if( $varname == 'disable' ) { |
| 1011 | + // Skips this variant |
935 | 1012 | continue; |
936 | | - $selected = ( $code == $preferred )? 'selected' : false; |
937 | | - $content_actions['varlang-' . $vcount] = array( |
938 | | - 'class' => $selected, |
| 1013 | + } |
| 1014 | + // Appends variant link |
| 1015 | + $content_navigation['variants'][] = array( |
| 1016 | + 'class' => ( $code == $preferred ) ? 'selected' : false, |
939 | 1017 | 'text' => $varname, |
940 | 1018 | 'href' => $this->mTitle->getLocalURL( '', $code ) |
941 | 1019 | ); |
942 | | - $vcount ++; |
943 | 1020 | } |
944 | 1021 | } |
945 | 1022 | |
946 | | - wfRunHooks( 'SkinTemplateContentActions', array( &$content_actions ) ); |
| 1023 | + // Equiv to SkinTemplateContentActions |
| 1024 | + wfRunHooks( 'SkinTemplateNavigation::Universal', array( &$this, &$content_navigation ) ); |
947 | 1025 | |
| 1026 | + // Setup xml ids and tooltip info |
| 1027 | + foreach ( $content_navigation as $section => &$links ) { |
| 1028 | + foreach ( $links as $key => &$link ) { |
| 1029 | + $xmlID = $key; |
| 1030 | + if ( isset( $link['context'] ) && $link['context'] == 'subject' ) { |
| 1031 | + $xmlID = 'ca-nstab-' . $xmlID; |
| 1032 | + } elseif ( isset( $link['context'] ) && $link['context'] == 'talk' ) { |
| 1033 | + $xmlID = 'ca-talk'; |
| 1034 | + } elseif ( $section == "variants" ) { |
| 1035 | + $xmlID = 'ca-varlang-' . $xmlID; |
| 1036 | + } else { |
| 1037 | + $xmlID = 'ca-' . $xmlID; |
| 1038 | + } |
| 1039 | + $link['id'] = $xmlID; |
| 1040 | + } |
| 1041 | + } |
| 1042 | + |
| 1043 | + # We don't want to give the watch tab an accesskey if the |
| 1044 | + # page is being edited, because that conflicts with the |
| 1045 | + # accesskey on the watch checkbox. We also don't want to |
| 1046 | + # give the edit tab an accesskey, because that's fairly su- |
| 1047 | + # perfluous and conflicts with an accesskey (Ctrl-E) often |
| 1048 | + # used for editing in Safari. |
| 1049 | + if( in_array( $action, array( 'edit', 'submit' ) ) ) { |
| 1050 | + if ( isset($content_navigation['views']['edit']) ) { |
| 1051 | + $content_navigation['views']['edit']['tooltiponly'] = true; |
| 1052 | + } |
| 1053 | + if ( isset($content_navigation['actions']['watch']) ) { |
| 1054 | + $content_navigation['actions']['watch']['tooltiponly'] = true; |
| 1055 | + } |
| 1056 | + if ( isset($content_navigation['actions']['unwatch']) ) { |
| 1057 | + $content_navigation['actions']['unwatch']['tooltiponly'] = true; |
| 1058 | + } |
| 1059 | + } |
| 1060 | + |
948 | 1061 | wfProfileOut( __METHOD__ ); |
| 1062 | + |
| 1063 | + return $content_navigation; |
| 1064 | + } |
| 1065 | + |
| 1066 | + /** |
| 1067 | + * an array of edit links by default used for the tabs |
| 1068 | + * @return array |
| 1069 | + * @private |
| 1070 | + */ |
| 1071 | + function buildContentActionUrls( $content_navigation ) { |
| 1072 | + |
| 1073 | + wfProfileIn( __METHOD__ ); |
| 1074 | + |
| 1075 | + // content_actions has been replaced with content_navigation for backwards |
| 1076 | + // compatibility and also for skins that just want simple tabs content_actions |
| 1077 | + // is now built by flattening the content_navigation arrays into one |
| 1078 | + |
| 1079 | + $content_actions = array(); |
| 1080 | + |
| 1081 | + foreach ( $content_navigation as $section => $links ) { |
| 1082 | + |
| 1083 | + foreach ( $links as $key => $value ) { |
| 1084 | + |
| 1085 | + if ( isset($value["redundant"]) && $value["redundant"] ) { |
| 1086 | + // Redundant tabs are dropped from content_actions |
| 1087 | + continue; |
| 1088 | + } |
| 1089 | + |
| 1090 | + // content_actions used to have ids built using the "ca-$key" pattern |
| 1091 | + // so the xmlID based id is much closer to the actual $key that we want |
| 1092 | + // for that reason we'll just strip out the ca- if present and use |
| 1093 | + // the latter potion of the "id" as the $key |
| 1094 | + if ( isset($value["id"]) && substr($value["id"], 0, 3) == "ca-" ) { |
| 1095 | + $key = substr($value["id"], 3); |
| 1096 | + } |
| 1097 | + |
| 1098 | + if ( isset($content_actions[$key]) ) { |
| 1099 | + wfDebug( __METHOD__ . ": Found a duplicate key for $key while flattening content_navigation into content_actions." ); |
| 1100 | + continue; |
| 1101 | + } |
| 1102 | + |
| 1103 | + $content_actions[$key] = $value; |
| 1104 | + |
| 1105 | + } |
| 1106 | + |
| 1107 | + } |
| 1108 | + |
| 1109 | + wfProfileOut( __METHOD__ ); |
| 1110 | + |
949 | 1111 | return $content_actions; |
950 | 1112 | } |
951 | 1113 | |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -817,6 +817,7 @@ |
818 | 818 | 'printableversion' => 'Printable version', |
819 | 819 | 'permalink' => 'Permanent link', |
820 | 820 | 'print' => 'Print', |
| 821 | +'view' => 'View', |
821 | 822 | 'edit' => 'Edit', |
822 | 823 | 'create' => 'Create', |
823 | 824 | 'editthispage' => 'Edit this page', |
— | — | @@ -824,6 +825,7 @@ |
825 | 826 | 'delete' => 'Delete', |
826 | 827 | 'deletethispage' => 'Delete this page', |
827 | 828 | 'undelete_short' => 'Undelete {{PLURAL:$1|one edit|$1 edits}}', |
| 829 | +'viewdeleted_short' => 'View {{PLURAL:$1|one deleted edit|$1 deleted edits}}', |
828 | 830 | 'protect' => 'Protect', |
829 | 831 | 'protect_change' => 'change', |
830 | 832 | 'protectthispage' => 'Protect this page', |