Index: trunk/phase3/skins/Vector.php |
— | — | @@ -46,297 +46,6 @@ |
47 | 47 | parent::setupSkinUserCss( $out ); |
48 | 48 | } |
49 | 49 | |
50 | | - /** |
51 | | - * A structured array of edit links by default used for the tabs |
52 | | - * @return array |
53 | | - * @private |
54 | | - */ |
55 | | - function buildNavigationUrls() { |
56 | | - global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle; |
57 | | - global $wgDisableLangConversion; |
58 | | - |
59 | | - wfProfileIn( __METHOD__ ); |
60 | | - |
61 | | - $links = array( |
62 | | - 'namespaces' => array(), |
63 | | - 'views' => array(), |
64 | | - 'actions' => array(), |
65 | | - 'variants' => array() |
66 | | - ); |
67 | | - |
68 | | - // Detects parameters |
69 | | - $action = $wgRequest->getVal( 'action', 'view' ); |
70 | | - $section = $wgRequest->getVal( 'section' ); |
71 | | - |
72 | | - // Checks if page is some kind of content |
73 | | - if( $this->iscontent ) { |
74 | | - |
75 | | - // Gets page objects for the related namespaces |
76 | | - $subjectPage = $this->mTitle->getSubjectPage(); |
77 | | - $talkPage = $this->mTitle->getTalkPage(); |
78 | | - |
79 | | - // Determines if this is a talk page |
80 | | - $isTalk = $this->mTitle->isTalkPage(); |
81 | | - |
82 | | - // Generates XML IDs from namespace names |
83 | | - $subjectId = $this->mTitle->getNamespaceKey( '' ); |
84 | | - |
85 | | - if ( $subjectId == 'main' ) { |
86 | | - $talkId = 'talk'; |
87 | | - } else { |
88 | | - $talkId = "{$subjectId}_talk"; |
89 | | - } |
90 | | - $currentId = $isTalk ? $talkId : $subjectId; |
91 | | - |
92 | | - // Adds namespace links |
93 | | - $links['namespaces'][$subjectId] = $this->tabAction( |
94 | | - $subjectPage, 'vector-namespace-' . $subjectId, !$isTalk, '', true |
95 | | - ); |
96 | | - $links['namespaces'][$subjectId]['context'] = 'subject'; |
97 | | - $links['namespaces'][$talkId] = $this->tabAction( |
98 | | - $talkPage, 'vector-namespace-talk', $isTalk, '', true |
99 | | - ); |
100 | | - $links['namespaces'][$talkId]['context'] = 'talk'; |
101 | | - |
102 | | - // Adds view view link |
103 | | - if ( $this->mTitle->exists() ) { |
104 | | - $links['views']['view'] = $this->tabAction( |
105 | | - $isTalk ? $talkPage : $subjectPage, |
106 | | - 'vector-view-view', ( $action == 'view' ), '', true |
107 | | - ); |
108 | | - } |
109 | | - |
110 | | - wfProfileIn( __METHOD__ . '-edit' ); |
111 | | - |
112 | | - // Checks if user can... |
113 | | - if ( |
114 | | - // edit the current page |
115 | | - $this->mTitle->quickUserCan( 'edit' ) && |
116 | | - ( |
117 | | - // if it exists |
118 | | - $this->mTitle->exists() || |
119 | | - // or they can create one here |
120 | | - $this->mTitle->quickUserCan( 'create' ) |
121 | | - ) |
122 | | - ) { |
123 | | - // Builds CSS class for talk page links |
124 | | - $isTalkClass = $isTalk ? ' istalk' : ''; |
125 | | - |
126 | | - // Determines if we're in edit mode |
127 | | - $selected = ( |
128 | | - ( $action == 'edit' || $action == 'submit' ) && |
129 | | - ( $section != 'new' ) |
130 | | - ); |
131 | | - $links['views']['edit'] = array( |
132 | | - 'class' => ( $selected ? 'selected' : '' ) . $isTalkClass, |
133 | | - 'text' => $this->mTitle->exists() |
134 | | - ? wfMsg( 'vector-view-edit' ) |
135 | | - : wfMsg( 'vector-view-create' ), |
136 | | - 'href' => |
137 | | - $this->mTitle->getLocalUrl( $this->editUrlOptions() ) |
138 | | - ); |
139 | | - // Checks if this is a current rev of talk page and we should show a new |
140 | | - // section link |
141 | | - if ( ( $isTalk && $wgArticle->isCurrent() ) || ( $wgOut->showNewSectionLink() ) ) { |
142 | | - // Checks if we should ever show a new section link |
143 | | - if ( !$wgOut->forceHideNewSectionLink() ) { |
144 | | - // Adds new section link |
145 | | - $links['actions']['addsection'] = array( |
146 | | - 'class' => $section == 'new' ? 'selected' : false, |
147 | | - 'text' => wfMsg( 'vector-action-addsection' ), |
148 | | - 'href' => $this->mTitle->getLocalUrl( |
149 | | - 'action=edit§ion=new' |
150 | | - ) |
151 | | - ); |
152 | | - } |
153 | | - } |
154 | | - // Checks if the page is known (some kind of viewable content) |
155 | | - } elseif ( $this->mTitle->isKnown() ) { |
156 | | - // Adds view source view link |
157 | | - $links['views']['viewsource'] = array( |
158 | | - 'class' => ( $action == 'edit' ) ? 'selected' : false, |
159 | | - 'text' => wfMsg( 'vector-view-viewsource' ), |
160 | | - 'href' => |
161 | | - $this->mTitle->getLocalUrl( $this->editUrlOptions() ) |
162 | | - ); |
163 | | - } |
164 | | - wfProfileOut( __METHOD__ . '-edit' ); |
165 | | - |
166 | | - wfProfileIn( __METHOD__ . '-live' ); |
167 | | - |
168 | | - // Checks if the page exists |
169 | | - if ( $this->mTitle->exists() ) { |
170 | | - // Adds history view link |
171 | | - $links['views']['history'] = array( |
172 | | - 'class' => ($action == 'history') ? 'selected' : false, |
173 | | - 'text' => wfMsg( 'vector-view-history' ), |
174 | | - 'href' => $this->mTitle->getLocalUrl( 'action=history' ), |
175 | | - 'rel' => 'archives', |
176 | | - ); |
177 | | - |
178 | | - if( $wgUser->isAllowed( 'delete' ) ) { |
179 | | - $links['actions']['delete'] = array( |
180 | | - 'class' => ($action == 'delete') ? 'selected' : false, |
181 | | - 'text' => wfMsg( 'vector-action-delete' ), |
182 | | - 'href' => $this->mTitle->getLocalUrl( 'action=delete' ) |
183 | | - ); |
184 | | - } |
185 | | - if ( $this->mTitle->quickUserCan( 'move' ) ) { |
186 | | - $moveTitle = SpecialPage::getTitleFor( |
187 | | - 'Movepage', $this->thispage |
188 | | - ); |
189 | | - $links['actions']['move'] = array( |
190 | | - 'class' => $this->mTitle->isSpecial( 'Movepage' ) ? |
191 | | - 'selected' : false, |
192 | | - 'text' => wfMsg( 'vector-action-move' ), |
193 | | - 'href' => $moveTitle->getLocalUrl() |
194 | | - ); |
195 | | - } |
196 | | - |
197 | | - if ( |
198 | | - $this->mTitle->getNamespace() !== NS_MEDIAWIKI && |
199 | | - $wgUser->isAllowed( 'protect' ) |
200 | | - ) { |
201 | | - if ( !$this->mTitle->isProtected() ){ |
202 | | - $links['actions']['protect'] = array( |
203 | | - 'class' => ($action == 'protect') ? |
204 | | - 'selected' : false, |
205 | | - 'text' => wfMsg( 'vector-action-protect' ), |
206 | | - 'href' => |
207 | | - $this->mTitle->getLocalUrl( 'action=protect' ) |
208 | | - ); |
209 | | - |
210 | | - } else { |
211 | | - $links['actions']['unprotect'] = array( |
212 | | - 'class' => ($action == 'unprotect') ? |
213 | | - 'selected' : false, |
214 | | - 'text' => wfMsg( 'vector-action-unprotect' ), |
215 | | - 'href' => |
216 | | - $this->mTitle->getLocalUrl( 'action=unprotect' ) |
217 | | - ); |
218 | | - } |
219 | | - } |
220 | | - } else { |
221 | | - // article doesn't exist or is deleted |
222 | | - if ( |
223 | | - $wgUser->isAllowed( 'deletedhistory' ) && |
224 | | - $wgUser->isAllowed( 'undelete' ) |
225 | | - ) { |
226 | | - if( $n = $this->mTitle->isDeleted() ) { |
227 | | - $undelTitle = SpecialPage::getTitleFor( 'Undelete' ); |
228 | | - $links['actions']['undelete'] = array( |
229 | | - 'class' => false, |
230 | | - 'text' => wfMsgExt( |
231 | | - 'vector-action-undelete', |
232 | | - array( 'parsemag' ), |
233 | | - $wgLang->formatNum( $n ) |
234 | | - ), |
235 | | - 'href' => $undelTitle->getLocalUrl( |
236 | | - 'target=' . urlencode( $this->thispage ) |
237 | | - ) |
238 | | - ); |
239 | | - } |
240 | | - } |
241 | | - |
242 | | - if ( |
243 | | - $this->mTitle->getNamespace() !== NS_MEDIAWIKI && |
244 | | - $wgUser->isAllowed( 'protect' ) |
245 | | - ) { |
246 | | - if ( !$this->mTitle->getRestrictions( 'create' ) ) { |
247 | | - $links['actions']['protect'] = array( |
248 | | - 'class' => ($action == 'protect') ? |
249 | | - 'selected' : false, |
250 | | - 'text' => wfMsg( 'vector-action-protect' ), |
251 | | - 'href' => |
252 | | - $this->mTitle->getLocalUrl( 'action=protect' ) |
253 | | - ); |
254 | | - |
255 | | - } else { |
256 | | - $links['actions']['unprotect'] = array( |
257 | | - 'class' => ($action == 'unprotect') ? |
258 | | - 'selected' : false, |
259 | | - 'text' => wfMsg( 'vector-action-unprotect' ), |
260 | | - 'href' => |
261 | | - $this->mTitle->getLocalUrl( 'action=unprotect' ) |
262 | | - ); |
263 | | - } |
264 | | - } |
265 | | - } |
266 | | - wfProfileOut( __METHOD__ . '-live' ); |
267 | | - |
268 | | - /** |
269 | | - * The following actions use messages which, if made particular to |
270 | | - * the Vector skin, would break the Ajax code which makes this |
271 | | - * action happen entirely inline. Skin::makeGlobalVariablesScript |
272 | | - * defines a set of messages in a javascript object - and these |
273 | | - * messages are assumed to be global for all skins. Without making |
274 | | - * a change to that procedure these messages will have to remain as |
275 | | - * the global versions. |
276 | | - */ |
277 | | - // Checks if the user is logged in |
278 | | - if( $this->loggedin ) { |
279 | | - // Checks if the user is watching this page |
280 | | - if( !$this->mTitle->userIsWatching() ) { |
281 | | - // Adds watch action link |
282 | | - $links['actions']['watch'] = array( |
283 | | - 'class' => |
284 | | - ( $action == 'watch' or $action == 'unwatch' ) ? |
285 | | - 'selected' : false, |
286 | | - 'text' => wfMsg( 'watch' ), |
287 | | - 'href' => $this->mTitle->getLocalUrl( 'action=watch' ) |
288 | | - ); |
289 | | - } else { |
290 | | - // Adds unwatch action link |
291 | | - $links['actions']['unwatch'] = array( |
292 | | - 'class' => |
293 | | - ($action == 'unwatch' or $action == 'watch') ? |
294 | | - 'selected' : false, |
295 | | - 'text' => wfMsg( 'unwatch' ), |
296 | | - 'href' => $this->mTitle->getLocalUrl( 'action=unwatch' ) |
297 | | - ); |
298 | | - } |
299 | | - } |
300 | | - |
301 | | - // This is instead of SkinTemplateTabs - which uses a flat array |
302 | | - wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) ); |
303 | | - |
304 | | - // If it's not content, it's got to be a special page |
305 | | - } else { |
306 | | - $links['namespaces']['special'] = array( |
307 | | - 'class' => 'selected', |
308 | | - 'text' => wfMsg( 'vector-namespace-special' ), |
309 | | - 'href' => $wgRequest->getRequestURL() |
310 | | - ); |
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 | | - wfProfileOut( __METHOD__ ); |
338 | | - |
339 | | - return $links; |
340 | | - } |
341 | 50 | } |
342 | 51 | |
343 | 52 | /** |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -975,6 +975,298 @@ |
976 | 976 | } |
977 | 977 | |
978 | 978 | /** |
| 979 | + * Builds a structured array of links used for tabs and menus |
| 980 | + * @return array |
| 981 | + * @private |
| 982 | + */ |
| 983 | + function buildNavigationUrls() { |
| 984 | + global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle; |
| 985 | + global $wgDisableLangConversion; |
| 986 | + |
| 987 | + wfProfileIn( __METHOD__ ); |
| 988 | + |
| 989 | + $links = array( |
| 990 | + 'namespaces' => array(), |
| 991 | + 'views' => array(), |
| 992 | + 'actions' => array(), |
| 993 | + 'variants' => array() |
| 994 | + ); |
| 995 | + |
| 996 | + // Detects parameters |
| 997 | + $action = $wgRequest->getVal( 'action', 'view' ); |
| 998 | + $section = $wgRequest->getVal( 'section' ); |
| 999 | + |
| 1000 | + // Checks if page is some kind of content |
| 1001 | + if( $this->iscontent ) { |
| 1002 | + |
| 1003 | + // Gets page objects for the related namespaces |
| 1004 | + $subjectPage = $this->mTitle->getSubjectPage(); |
| 1005 | + $talkPage = $this->mTitle->getTalkPage(); |
| 1006 | + |
| 1007 | + // Determines if this is a talk page |
| 1008 | + $isTalk = $this->mTitle->isTalkPage(); |
| 1009 | + |
| 1010 | + // Generates XML IDs from namespace names |
| 1011 | + $subjectId = $this->mTitle->getNamespaceKey( '' ); |
| 1012 | + |
| 1013 | + if ( $subjectId == 'main' ) { |
| 1014 | + $talkId = 'talk'; |
| 1015 | + } else { |
| 1016 | + $talkId = "{$subjectId}_talk"; |
| 1017 | + } |
| 1018 | + $currentId = $isTalk ? $talkId : $subjectId; |
| 1019 | + |
| 1020 | + // Adds namespace links |
| 1021 | + $links['namespaces'][$subjectId] = $this->tabAction( |
| 1022 | + $subjectPage, 'vector-namespace-' . $subjectId, !$isTalk, '', true |
| 1023 | + ); |
| 1024 | + $links['namespaces'][$subjectId]['context'] = 'subject'; |
| 1025 | + $links['namespaces'][$talkId] = $this->tabAction( |
| 1026 | + $talkPage, 'vector-namespace-talk', $isTalk, '', true |
| 1027 | + ); |
| 1028 | + $links['namespaces'][$talkId]['context'] = 'talk'; |
| 1029 | + |
| 1030 | + // Adds view view link |
| 1031 | + if ( $this->mTitle->exists() ) { |
| 1032 | + $links['views']['view'] = $this->tabAction( |
| 1033 | + $isTalk ? $talkPage : $subjectPage, |
| 1034 | + 'vector-view-view', ( $action == 'view' ), '', true |
| 1035 | + ); |
| 1036 | + } |
| 1037 | + |
| 1038 | + wfProfileIn( __METHOD__ . '-edit' ); |
| 1039 | + |
| 1040 | + // Checks if user can... |
| 1041 | + if ( |
| 1042 | + // edit the current page |
| 1043 | + $this->mTitle->quickUserCan( 'edit' ) && |
| 1044 | + ( |
| 1045 | + // if it exists |
| 1046 | + $this->mTitle->exists() || |
| 1047 | + // or they can create one here |
| 1048 | + $this->mTitle->quickUserCan( 'create' ) |
| 1049 | + ) |
| 1050 | + ) { |
| 1051 | + // Builds CSS class for talk page links |
| 1052 | + $isTalkClass = $isTalk ? ' istalk' : ''; |
| 1053 | + |
| 1054 | + // Determines if we're in edit mode |
| 1055 | + $selected = ( |
| 1056 | + ( $action == 'edit' || $action == 'submit' ) && |
| 1057 | + ( $section != 'new' ) |
| 1058 | + ); |
| 1059 | + $links['views']['edit'] = array( |
| 1060 | + 'class' => ( $selected ? 'selected' : '' ) . $isTalkClass, |
| 1061 | + 'text' => $this->mTitle->exists() |
| 1062 | + ? wfMsg( 'vector-view-edit' ) |
| 1063 | + : wfMsg( 'vector-view-create' ), |
| 1064 | + 'href' => |
| 1065 | + $this->mTitle->getLocalUrl( $this->editUrlOptions() ) |
| 1066 | + ); |
| 1067 | + // Checks if this is a current rev of talk page and we should show a new |
| 1068 | + // section link |
| 1069 | + if ( ( $isTalk && $wgArticle->isCurrent() ) || ( $wgOut->showNewSectionLink() ) ) { |
| 1070 | + // Checks if we should ever show a new section link |
| 1071 | + if ( !$wgOut->forceHideNewSectionLink() ) { |
| 1072 | + // Adds new section link |
| 1073 | + $links['actions']['addsection'] = array( |
| 1074 | + 'class' => $section == 'new' ? 'selected' : false, |
| 1075 | + 'text' => wfMsg( 'vector-action-addsection' ), |
| 1076 | + 'href' => $this->mTitle->getLocalUrl( |
| 1077 | + 'action=edit§ion=new' |
| 1078 | + ) |
| 1079 | + ); |
| 1080 | + } |
| 1081 | + } |
| 1082 | + // Checks if the page is known (some kind of viewable content) |
| 1083 | + } elseif ( $this->mTitle->isKnown() ) { |
| 1084 | + // Adds view source view link |
| 1085 | + $links['views']['viewsource'] = array( |
| 1086 | + 'class' => ( $action == 'edit' ) ? 'selected' : false, |
| 1087 | + 'text' => wfMsg( 'vector-view-viewsource' ), |
| 1088 | + 'href' => |
| 1089 | + $this->mTitle->getLocalUrl( $this->editUrlOptions() ) |
| 1090 | + ); |
| 1091 | + } |
| 1092 | + wfProfileOut( __METHOD__ . '-edit' ); |
| 1093 | + |
| 1094 | + wfProfileIn( __METHOD__ . '-live' ); |
| 1095 | + |
| 1096 | + // Checks if the page exists |
| 1097 | + if ( $this->mTitle->exists() ) { |
| 1098 | + // Adds history view link |
| 1099 | + $links['views']['history'] = array( |
| 1100 | + 'class' => ($action == 'history') ? 'selected' : false, |
| 1101 | + 'text' => wfMsg( 'vector-view-history' ), |
| 1102 | + 'href' => $this->mTitle->getLocalUrl( 'action=history' ), |
| 1103 | + 'rel' => 'archives', |
| 1104 | + ); |
| 1105 | + |
| 1106 | + if( $wgUser->isAllowed( 'delete' ) ) { |
| 1107 | + $links['actions']['delete'] = array( |
| 1108 | + 'class' => ($action == 'delete') ? 'selected' : false, |
| 1109 | + 'text' => wfMsg( 'vector-action-delete' ), |
| 1110 | + 'href' => $this->mTitle->getLocalUrl( 'action=delete' ) |
| 1111 | + ); |
| 1112 | + } |
| 1113 | + if ( $this->mTitle->quickUserCan( 'move' ) ) { |
| 1114 | + $moveTitle = SpecialPage::getTitleFor( |
| 1115 | + 'Movepage', $this->thispage |
| 1116 | + ); |
| 1117 | + $links['actions']['move'] = array( |
| 1118 | + 'class' => $this->mTitle->isSpecial( 'Movepage' ) ? |
| 1119 | + 'selected' : false, |
| 1120 | + 'text' => wfMsg( 'vector-action-move' ), |
| 1121 | + 'href' => $moveTitle->getLocalUrl() |
| 1122 | + ); |
| 1123 | + } |
| 1124 | + |
| 1125 | + if ( |
| 1126 | + $this->mTitle->getNamespace() !== NS_MEDIAWIKI && |
| 1127 | + $wgUser->isAllowed( 'protect' ) |
| 1128 | + ) { |
| 1129 | + if ( !$this->mTitle->isProtected() ){ |
| 1130 | + $links['actions']['protect'] = array( |
| 1131 | + 'class' => ($action == 'protect') ? |
| 1132 | + 'selected' : false, |
| 1133 | + 'text' => wfMsg( 'vector-action-protect' ), |
| 1134 | + 'href' => |
| 1135 | + $this->mTitle->getLocalUrl( 'action=protect' ) |
| 1136 | + ); |
| 1137 | + |
| 1138 | + } else { |
| 1139 | + $links['actions']['unprotect'] = array( |
| 1140 | + 'class' => ($action == 'unprotect') ? |
| 1141 | + 'selected' : false, |
| 1142 | + 'text' => wfMsg( 'vector-action-unprotect' ), |
| 1143 | + 'href' => |
| 1144 | + $this->mTitle->getLocalUrl( 'action=unprotect' ) |
| 1145 | + ); |
| 1146 | + } |
| 1147 | + } |
| 1148 | + } else { |
| 1149 | + // article doesn't exist or is deleted |
| 1150 | + if ( |
| 1151 | + $wgUser->isAllowed( 'deletedhistory' ) && |
| 1152 | + $wgUser->isAllowed( 'undelete' ) |
| 1153 | + ) { |
| 1154 | + if( $n = $this->mTitle->isDeleted() ) { |
| 1155 | + $undelTitle = SpecialPage::getTitleFor( 'Undelete' ); |
| 1156 | + $links['actions']['undelete'] = array( |
| 1157 | + 'class' => false, |
| 1158 | + 'text' => wfMsgExt( |
| 1159 | + 'vector-action-undelete', |
| 1160 | + array( 'parsemag' ), |
| 1161 | + $wgLang->formatNum( $n ) |
| 1162 | + ), |
| 1163 | + 'href' => $undelTitle->getLocalUrl( |
| 1164 | + 'target=' . urlencode( $this->thispage ) |
| 1165 | + ) |
| 1166 | + ); |
| 1167 | + } |
| 1168 | + } |
| 1169 | + |
| 1170 | + if ( |
| 1171 | + $this->mTitle->getNamespace() !== NS_MEDIAWIKI && |
| 1172 | + $wgUser->isAllowed( 'protect' ) |
| 1173 | + ) { |
| 1174 | + if ( !$this->mTitle->getRestrictions( 'create' ) ) { |
| 1175 | + $links['actions']['protect'] = array( |
| 1176 | + 'class' => ($action == 'protect') ? |
| 1177 | + 'selected' : false, |
| 1178 | + 'text' => wfMsg( 'vector-action-protect' ), |
| 1179 | + 'href' => |
| 1180 | + $this->mTitle->getLocalUrl( 'action=protect' ) |
| 1181 | + ); |
| 1182 | + |
| 1183 | + } else { |
| 1184 | + $links['actions']['unprotect'] = array( |
| 1185 | + 'class' => ($action == 'unprotect') ? |
| 1186 | + 'selected' : false, |
| 1187 | + 'text' => wfMsg( 'vector-action-unprotect' ), |
| 1188 | + 'href' => |
| 1189 | + $this->mTitle->getLocalUrl( 'action=unprotect' ) |
| 1190 | + ); |
| 1191 | + } |
| 1192 | + } |
| 1193 | + } |
| 1194 | + wfProfileOut( __METHOD__ . '-live' ); |
| 1195 | + |
| 1196 | + /** |
| 1197 | + * The following actions use messages which, if made particular to |
| 1198 | + * the Vector skin, would break the Ajax code which makes this |
| 1199 | + * action happen entirely inline. Skin::makeGlobalVariablesScript |
| 1200 | + * defines a set of messages in a javascript object - and these |
| 1201 | + * messages are assumed to be global for all skins. Without making |
| 1202 | + * a change to that procedure these messages will have to remain as |
| 1203 | + * the global versions. |
| 1204 | + */ |
| 1205 | + // Checks if the user is logged in |
| 1206 | + if( $this->loggedin ) { |
| 1207 | + // Checks if the user is watching this page |
| 1208 | + if( !$this->mTitle->userIsWatching() ) { |
| 1209 | + // Adds watch action link |
| 1210 | + $links['actions']['watch'] = array( |
| 1211 | + 'class' => |
| 1212 | + ( $action == 'watch' or $action == 'unwatch' ) ? |
| 1213 | + 'selected' : false, |
| 1214 | + 'text' => wfMsg( 'watch' ), |
| 1215 | + 'href' => $this->mTitle->getLocalUrl( 'action=watch' ) |
| 1216 | + ); |
| 1217 | + } else { |
| 1218 | + // Adds unwatch action link |
| 1219 | + $links['actions']['unwatch'] = array( |
| 1220 | + 'class' => |
| 1221 | + ($action == 'unwatch' or $action == 'watch') ? |
| 1222 | + 'selected' : false, |
| 1223 | + 'text' => wfMsg( 'unwatch' ), |
| 1224 | + 'href' => $this->mTitle->getLocalUrl( 'action=unwatch' ) |
| 1225 | + ); |
| 1226 | + } |
| 1227 | + } |
| 1228 | + |
| 1229 | + // This is instead of SkinTemplateTabs - which uses a flat array |
| 1230 | + wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) ); |
| 1231 | + |
| 1232 | + // If it's not content, it's got to be a special page |
| 1233 | + } else { |
| 1234 | + $links['namespaces']['special'] = array( |
| 1235 | + 'class' => 'selected', |
| 1236 | + 'text' => wfMsg( 'vector-namespace-special' ), |
| 1237 | + 'href' => $wgRequest->getRequestURL() |
| 1238 | + ); |
| 1239 | + } |
| 1240 | + |
| 1241 | + // Gets list of language variants |
| 1242 | + $variants = $wgContLang->getVariants(); |
| 1243 | + // Checks that language conversion is enabled and variants exist |
| 1244 | + if( !$wgDisableLangConversion && count( $variants ) > 1 ) { |
| 1245 | + // Gets preferred variant |
| 1246 | + $preferred = $wgContLang->getPreferredVariant(); |
| 1247 | + // Loops over each variant |
| 1248 | + foreach( $variants as $code ) { |
| 1249 | + // Gets variant name from language code |
| 1250 | + $varname = $wgContLang->getVariantname( $code ); |
| 1251 | + // Checks if the variant is marked as disabled |
| 1252 | + if( $varname == 'disable' ) { |
| 1253 | + // Skips this variant |
| 1254 | + continue; |
| 1255 | + } |
| 1256 | + // Appends variant link |
| 1257 | + $links['variants'][] = array( |
| 1258 | + 'class' => ( $code == $preferred ) ? 'selected' : false, |
| 1259 | + 'text' => $varname, |
| 1260 | + 'href' => $this->mTitle->getLocalURL( '', $code ) |
| 1261 | + ); |
| 1262 | + } |
| 1263 | + } |
| 1264 | + |
| 1265 | + wfProfileOut( __METHOD__ ); |
| 1266 | + |
| 1267 | + return $links; |
| 1268 | + } |
| 1269 | + |
| 1270 | + /** |
979 | 1271 | * Generate strings used for xml 'id' names |
980 | 1272 | * @return string |
981 | 1273 | * @private |