Index: trunk/phase3/skins/Vector.php |
— | — | @@ -45,7 +45,298 @@ |
46 | 46 | // Add common styles |
47 | 47 | parent::setupSkinUserCss( $out ); |
48 | 48 | } |
| 49 | + |
| 50 | + /** |
| 51 | + * Builds a structured array of links used for tabs and menus |
| 52 | + * @return array |
| 53 | + * @private |
| 54 | + */ |
| 55 | + function buildNavigationUrls() { |
| 56 | + global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle; |
| 57 | + global $wgDisableLangConversion; |
49 | 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 | + } |
50 | 341 | } |
51 | 342 | |
52 | 343 | /** |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -976,298 +976,6 @@ |
977 | 977 | } |
978 | 978 | |
979 | 979 | /** |
980 | | - * Builds a structured array of links used for tabs and menus |
981 | | - * @return array |
982 | | - * @private |
983 | | - */ |
984 | | - function buildNavigationUrls() { |
985 | | - global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle; |
986 | | - global $wgDisableLangConversion; |
987 | | - |
988 | | - wfProfileIn( __METHOD__ ); |
989 | | - |
990 | | - $links = array( |
991 | | - 'namespaces' => array(), |
992 | | - 'views' => array(), |
993 | | - 'actions' => array(), |
994 | | - 'variants' => array() |
995 | | - ); |
996 | | - |
997 | | - // Detects parameters |
998 | | - $action = $wgRequest->getVal( 'action', 'view' ); |
999 | | - $section = $wgRequest->getVal( 'section' ); |
1000 | | - |
1001 | | - // Checks if page is some kind of content |
1002 | | - if( $this->iscontent ) { |
1003 | | - |
1004 | | - // Gets page objects for the related namespaces |
1005 | | - $subjectPage = $this->mTitle->getSubjectPage(); |
1006 | | - $talkPage = $this->mTitle->getTalkPage(); |
1007 | | - |
1008 | | - // Determines if this is a talk page |
1009 | | - $isTalk = $this->mTitle->isTalkPage(); |
1010 | | - |
1011 | | - // Generates XML IDs from namespace names |
1012 | | - $subjectId = $this->mTitle->getNamespaceKey( '' ); |
1013 | | - |
1014 | | - if ( $subjectId == 'main' ) { |
1015 | | - $talkId = 'talk'; |
1016 | | - } else { |
1017 | | - $talkId = "{$subjectId}_talk"; |
1018 | | - } |
1019 | | - $currentId = $isTalk ? $talkId : $subjectId; |
1020 | | - |
1021 | | - // Adds namespace links |
1022 | | - $links['namespaces'][$subjectId] = $this->tabAction( |
1023 | | - $subjectPage, 'vector-namespace-' . $subjectId, !$isTalk, '', true |
1024 | | - ); |
1025 | | - $links['namespaces'][$subjectId]['context'] = 'subject'; |
1026 | | - $links['namespaces'][$talkId] = $this->tabAction( |
1027 | | - $talkPage, 'vector-namespace-talk', $isTalk, '', true |
1028 | | - ); |
1029 | | - $links['namespaces'][$talkId]['context'] = 'talk'; |
1030 | | - |
1031 | | - // Adds view view link |
1032 | | - if ( $this->mTitle->exists() ) { |
1033 | | - $links['views']['view'] = $this->tabAction( |
1034 | | - $isTalk ? $talkPage : $subjectPage, |
1035 | | - 'vector-view-view', ( $action == 'view' ), '', true |
1036 | | - ); |
1037 | | - } |
1038 | | - |
1039 | | - wfProfileIn( __METHOD__ . '-edit' ); |
1040 | | - |
1041 | | - // Checks if user can... |
1042 | | - if ( |
1043 | | - // edit the current page |
1044 | | - $this->mTitle->quickUserCan( 'edit' ) && |
1045 | | - ( |
1046 | | - // if it exists |
1047 | | - $this->mTitle->exists() || |
1048 | | - // or they can create one here |
1049 | | - $this->mTitle->quickUserCan( 'create' ) |
1050 | | - ) |
1051 | | - ) { |
1052 | | - // Builds CSS class for talk page links |
1053 | | - $isTalkClass = $isTalk ? ' istalk' : ''; |
1054 | | - |
1055 | | - // Determines if we're in edit mode |
1056 | | - $selected = ( |
1057 | | - ( $action == 'edit' || $action == 'submit' ) && |
1058 | | - ( $section != 'new' ) |
1059 | | - ); |
1060 | | - $links['views']['edit'] = array( |
1061 | | - 'class' => ( $selected ? 'selected' : '' ) . $isTalkClass, |
1062 | | - 'text' => $this->mTitle->exists() |
1063 | | - ? wfMsg( 'vector-view-edit' ) |
1064 | | - : wfMsg( 'vector-view-create' ), |
1065 | | - 'href' => |
1066 | | - $this->mTitle->getLocalUrl( $this->editUrlOptions() ) |
1067 | | - ); |
1068 | | - // Checks if this is a current rev of talk page and we should show a new |
1069 | | - // section link |
1070 | | - if ( ( $isTalk && $wgArticle->isCurrent() ) || ( $wgOut->showNewSectionLink() ) ) { |
1071 | | - // Checks if we should ever show a new section link |
1072 | | - if ( !$wgOut->forceHideNewSectionLink() ) { |
1073 | | - // Adds new section link |
1074 | | - $links['actions']['addsection'] = array( |
1075 | | - 'class' => $section == 'new' ? 'selected' : false, |
1076 | | - 'text' => wfMsg( 'vector-action-addsection' ), |
1077 | | - 'href' => $this->mTitle->getLocalUrl( |
1078 | | - 'action=edit§ion=new' |
1079 | | - ) |
1080 | | - ); |
1081 | | - } |
1082 | | - } |
1083 | | - // Checks if the page is known (some kind of viewable content) |
1084 | | - } elseif ( $this->mTitle->isKnown() ) { |
1085 | | - // Adds view source view link |
1086 | | - $links['views']['viewsource'] = array( |
1087 | | - 'class' => ( $action == 'edit' ) ? 'selected' : false, |
1088 | | - 'text' => wfMsg( 'vector-view-viewsource' ), |
1089 | | - 'href' => |
1090 | | - $this->mTitle->getLocalUrl( $this->editUrlOptions() ) |
1091 | | - ); |
1092 | | - } |
1093 | | - wfProfileOut( __METHOD__ . '-edit' ); |
1094 | | - |
1095 | | - wfProfileIn( __METHOD__ . '-live' ); |
1096 | | - |
1097 | | - // Checks if the page exists |
1098 | | - if ( $this->mTitle->exists() ) { |
1099 | | - // Adds history view link |
1100 | | - $links['views']['history'] = array( |
1101 | | - 'class' => ($action == 'history') ? 'selected' : false, |
1102 | | - 'text' => wfMsg( 'vector-view-history' ), |
1103 | | - 'href' => $this->mTitle->getLocalUrl( 'action=history' ), |
1104 | | - 'rel' => 'archives', |
1105 | | - ); |
1106 | | - |
1107 | | - if( $wgUser->isAllowed( 'delete' ) ) { |
1108 | | - $links['actions']['delete'] = array( |
1109 | | - 'class' => ($action == 'delete') ? 'selected' : false, |
1110 | | - 'text' => wfMsg( 'vector-action-delete' ), |
1111 | | - 'href' => $this->mTitle->getLocalUrl( 'action=delete' ) |
1112 | | - ); |
1113 | | - } |
1114 | | - if ( $this->mTitle->quickUserCan( 'move' ) ) { |
1115 | | - $moveTitle = SpecialPage::getTitleFor( |
1116 | | - 'Movepage', $this->thispage |
1117 | | - ); |
1118 | | - $links['actions']['move'] = array( |
1119 | | - 'class' => $this->mTitle->isSpecial( 'Movepage' ) ? |
1120 | | - 'selected' : false, |
1121 | | - 'text' => wfMsg( 'vector-action-move' ), |
1122 | | - 'href' => $moveTitle->getLocalUrl() |
1123 | | - ); |
1124 | | - } |
1125 | | - |
1126 | | - if ( |
1127 | | - $this->mTitle->getNamespace() !== NS_MEDIAWIKI && |
1128 | | - $wgUser->isAllowed( 'protect' ) |
1129 | | - ) { |
1130 | | - if ( !$this->mTitle->isProtected() ){ |
1131 | | - $links['actions']['protect'] = array( |
1132 | | - 'class' => ($action == 'protect') ? |
1133 | | - 'selected' : false, |
1134 | | - 'text' => wfMsg( 'vector-action-protect' ), |
1135 | | - 'href' => |
1136 | | - $this->mTitle->getLocalUrl( 'action=protect' ) |
1137 | | - ); |
1138 | | - |
1139 | | - } else { |
1140 | | - $links['actions']['unprotect'] = array( |
1141 | | - 'class' => ($action == 'unprotect') ? |
1142 | | - 'selected' : false, |
1143 | | - 'text' => wfMsg( 'vector-action-unprotect' ), |
1144 | | - 'href' => |
1145 | | - $this->mTitle->getLocalUrl( 'action=unprotect' ) |
1146 | | - ); |
1147 | | - } |
1148 | | - } |
1149 | | - } else { |
1150 | | - // article doesn't exist or is deleted |
1151 | | - if ( |
1152 | | - $wgUser->isAllowed( 'deletedhistory' ) && |
1153 | | - $wgUser->isAllowed( 'undelete' ) |
1154 | | - ) { |
1155 | | - if( $n = $this->mTitle->isDeleted() ) { |
1156 | | - $undelTitle = SpecialPage::getTitleFor( 'Undelete' ); |
1157 | | - $links['actions']['undelete'] = array( |
1158 | | - 'class' => false, |
1159 | | - 'text' => wfMsgExt( |
1160 | | - 'vector-action-undelete', |
1161 | | - array( 'parsemag' ), |
1162 | | - $wgLang->formatNum( $n ) |
1163 | | - ), |
1164 | | - 'href' => $undelTitle->getLocalUrl( |
1165 | | - 'target=' . urlencode( $this->thispage ) |
1166 | | - ) |
1167 | | - ); |
1168 | | - } |
1169 | | - } |
1170 | | - |
1171 | | - if ( |
1172 | | - $this->mTitle->getNamespace() !== NS_MEDIAWIKI && |
1173 | | - $wgUser->isAllowed( 'protect' ) |
1174 | | - ) { |
1175 | | - if ( !$this->mTitle->getRestrictions( 'create' ) ) { |
1176 | | - $links['actions']['protect'] = array( |
1177 | | - 'class' => ($action == 'protect') ? |
1178 | | - 'selected' : false, |
1179 | | - 'text' => wfMsg( 'vector-action-protect' ), |
1180 | | - 'href' => |
1181 | | - $this->mTitle->getLocalUrl( 'action=protect' ) |
1182 | | - ); |
1183 | | - |
1184 | | - } else { |
1185 | | - $links['actions']['unprotect'] = array( |
1186 | | - 'class' => ($action == 'unprotect') ? |
1187 | | - 'selected' : false, |
1188 | | - 'text' => wfMsg( 'vector-action-unprotect' ), |
1189 | | - 'href' => |
1190 | | - $this->mTitle->getLocalUrl( 'action=unprotect' ) |
1191 | | - ); |
1192 | | - } |
1193 | | - } |
1194 | | - } |
1195 | | - wfProfileOut( __METHOD__ . '-live' ); |
1196 | | - |
1197 | | - /** |
1198 | | - * The following actions use messages which, if made particular to |
1199 | | - * the Vector skin, would break the Ajax code which makes this |
1200 | | - * action happen entirely inline. Skin::makeGlobalVariablesScript |
1201 | | - * defines a set of messages in a javascript object - and these |
1202 | | - * messages are assumed to be global for all skins. Without making |
1203 | | - * a change to that procedure these messages will have to remain as |
1204 | | - * the global versions. |
1205 | | - */ |
1206 | | - // Checks if the user is logged in |
1207 | | - if( $this->loggedin ) { |
1208 | | - // Checks if the user is watching this page |
1209 | | - if( !$this->mTitle->userIsWatching() ) { |
1210 | | - // Adds watch action link |
1211 | | - $links['actions']['watch'] = array( |
1212 | | - 'class' => |
1213 | | - ( $action == 'watch' or $action == 'unwatch' ) ? |
1214 | | - 'selected' : false, |
1215 | | - 'text' => wfMsg( 'watch' ), |
1216 | | - 'href' => $this->mTitle->getLocalUrl( 'action=watch' ) |
1217 | | - ); |
1218 | | - } else { |
1219 | | - // Adds unwatch action link |
1220 | | - $links['actions']['unwatch'] = array( |
1221 | | - 'class' => |
1222 | | - ($action == 'unwatch' or $action == 'watch') ? |
1223 | | - 'selected' : false, |
1224 | | - 'text' => wfMsg( 'unwatch' ), |
1225 | | - 'href' => $this->mTitle->getLocalUrl( 'action=unwatch' ) |
1226 | | - ); |
1227 | | - } |
1228 | | - } |
1229 | | - |
1230 | | - // This is instead of SkinTemplateTabs - which uses a flat array |
1231 | | - wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) ); |
1232 | | - |
1233 | | - // If it's not content, it's got to be a special page |
1234 | | - } else { |
1235 | | - $links['namespaces']['special'] = array( |
1236 | | - 'class' => 'selected', |
1237 | | - 'text' => wfMsg( 'vector-namespace-special' ), |
1238 | | - 'href' => $wgRequest->getRequestURL() |
1239 | | - ); |
1240 | | - } |
1241 | | - |
1242 | | - // Gets list of language variants |
1243 | | - $variants = $wgContLang->getVariants(); |
1244 | | - // Checks that language conversion is enabled and variants exist |
1245 | | - if( !$wgDisableLangConversion && count( $variants ) > 1 ) { |
1246 | | - // Gets preferred variant |
1247 | | - $preferred = $wgContLang->getPreferredVariant(); |
1248 | | - // Loops over each variant |
1249 | | - foreach( $variants as $code ) { |
1250 | | - // Gets variant name from language code |
1251 | | - $varname = $wgContLang->getVariantname( $code ); |
1252 | | - // Checks if the variant is marked as disabled |
1253 | | - if( $varname == 'disable' ) { |
1254 | | - // Skips this variant |
1255 | | - continue; |
1256 | | - } |
1257 | | - // Appends variant link |
1258 | | - $links['variants'][] = array( |
1259 | | - 'class' => ( $code == $preferred ) ? 'selected' : false, |
1260 | | - 'text' => $varname, |
1261 | | - 'href' => $this->mTitle->getLocalURL( '', $code ) |
1262 | | - ); |
1263 | | - } |
1264 | | - } |
1265 | | - |
1266 | | - wfProfileOut( __METHOD__ ); |
1267 | | - |
1268 | | - return $links; |
1269 | | - } |
1270 | | - |
1271 | | - /** |
1272 | 980 | * Generate strings used for xml 'id' names |
1273 | 981 | * @return string |
1274 | 982 | * @private |