| Index: trunk/phase3/skins/Standard.php |
| — | — | @@ -127,6 +127,158 @@ |
| 128 | 128 | return $s; |
| 129 | 129 | } |
| 130 | 130 | |
| | 131 | + function quickBar() { |
| | 132 | + global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgContLang; |
| | 133 | + global $wgDisableUploads, $wgRemoteUploads, $wgNavigationLinks; |
| | 134 | + |
| | 135 | + $fname = 'Skin::quickBar'; |
| | 136 | + wfProfileIn( $fname ); |
| | 137 | + |
| | 138 | + $action = $wgRequest->getText( 'action' ); |
| | 139 | + $wpPreview = $wgRequest->getBool( 'wpPreview' ); |
| | 140 | + $tns=$wgTitle->getNamespace(); |
| | 141 | + |
| | 142 | + $s = "\n<div id='quickbar'>"; |
| | 143 | + $s .= "\n" . $this->logoText() . "\n<hr class='sep' />"; |
| | 144 | + |
| | 145 | + $sep = "\n<br />"; |
| | 146 | + |
| | 147 | + foreach ( $wgNavigationLinks as $link ) { |
| | 148 | + $msg = wfMsgForContent( $link['href'] ); |
| | 149 | + if ( $msg != '-' ) { |
| | 150 | + $s .= '<a href="' . $this->makeInternalOrExternalUrl( $msg ) . '">' . |
| | 151 | + wfMsg( $link['text'] ) . '</a>' . $sep; |
| | 152 | + } |
| | 153 | + } |
| | 154 | + |
| | 155 | + |
| | 156 | + if ($wgUser->getID()) { |
| | 157 | + $s.= $this->specialLink( 'watchlist' ) ; |
| | 158 | + $s .= $sep . $this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ), |
| | 159 | + wfMsg( 'mycontris' ), 'target=' . wfUrlencode($wgUser->getName() ) ); |
| | 160 | + |
| | 161 | + } |
| | 162 | + // only show watchlist link if logged in |
| | 163 | + $s .= "\n<hr class='sep' />"; |
| | 164 | + $articleExists = $wgTitle->getArticleId(); |
| | 165 | + if ( $wgOut->isArticle() || $action =='edit' || $action =='history' || $wpPreview) { |
| | 166 | + if($wgOut->isArticle()) { |
| | 167 | + $s .= '<strong>' . $this->editThisPage() . '</strong>'; |
| | 168 | + } else { # backlink to the article in edit or history mode |
| | 169 | + if($articleExists){ # no backlink if no article |
| | 170 | + switch($tns) { |
| | 171 | + case 0: |
| | 172 | + $text = wfMsg('articlepage'); |
| | 173 | + break; |
| | 174 | + case 1: |
| | 175 | + $text = wfMsg('viewtalkpage'); |
| | 176 | + break; |
| | 177 | + case 2: |
| | 178 | + $text = wfMsg('userpage'); |
| | 179 | + break; |
| | 180 | + case 3: |
| | 181 | + $text = wfMsg('viewtalkpage'); |
| | 182 | + break; |
| | 183 | + case 4: |
| | 184 | + $text = wfMsg('wikipediapage'); |
| | 185 | + break; |
| | 186 | + case 5: |
| | 187 | + $text = wfMsg('viewtalkpage'); |
| | 188 | + break; |
| | 189 | + case 6: |
| | 190 | + $text = wfMsg('imagepage'); |
| | 191 | + break; |
| | 192 | + case 7: |
| | 193 | + $text = wfMsg('viewtalkpage'); |
| | 194 | + break; |
| | 195 | + default: |
| | 196 | + $text= wfMsg('articlepage'); |
| | 197 | + } |
| | 198 | + |
| | 199 | + $link = $wgTitle->getText(); |
| | 200 | + if ($nstext = $wgContLang->getNsText($tns) ) { # add namespace if necessary |
| | 201 | + $link = $nstext . ':' . $link ; |
| | 202 | + } |
| | 203 | + |
| | 204 | + $s .= $this->makeLink( $link, $text ); |
| | 205 | + } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) { |
| | 206 | + # we just throw in a "New page" text to tell the user that he's in edit mode, |
| | 207 | + # and to avoid messing with the separator that is prepended to the next item |
| | 208 | + $s .= '<strong>' . wfMsg('newpage') . '</strong>'; |
| | 209 | + } |
| | 210 | + |
| | 211 | + } |
| | 212 | + |
| | 213 | + |
| | 214 | + if( $tns%2 && $action!='edit' && !$wpPreview) { |
| | 215 | + $s.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit§ion=new'); |
| | 216 | + } |
| | 217 | + |
| | 218 | + /* |
| | 219 | + watching could cause problems in edit mode: |
| | 220 | + if user edits article, then loads "watch this article" in background and then saves |
| | 221 | + article with "Watch this article" checkbox disabled, the article is transparently |
| | 222 | + unwatched. Therefore we do not show the "Watch this page" link in edit mode |
| | 223 | + */ |
| | 224 | + if ( 0 != $wgUser->getID() && $articleExists) { |
| | 225 | + if($action!='edit' && $action != 'submit' ) |
| | 226 | + { |
| | 227 | + $s .= $sep . $this->watchThisPage(); |
| | 228 | + } |
| | 229 | + if ( $wgTitle->userCanEdit() ) |
| | 230 | + $s .= $sep . $this->moveThisPage(); |
| | 231 | + } |
| | 232 | + if ( $wgUser->isSysop() and $articleExists ) { |
| | 233 | + $s .= $sep . $this->deleteThisPage() . |
| | 234 | + $sep . $this->protectThisPage(); |
| | 235 | + } |
| | 236 | + $s .= $sep . $this->talkLink(); |
| | 237 | + if ($articleExists && $action !='history') { |
| | 238 | + $s .= $sep . $this->historyLink(); |
| | 239 | + } |
| | 240 | + $s.=$sep . $this->whatLinksHere(); |
| | 241 | + |
| | 242 | + if($wgOut->isArticleRelated()) { |
| | 243 | + $s .= $sep . $this->watchPageLinksLink(); |
| | 244 | + } |
| | 245 | + |
| | 246 | + if ( Namespace::getUser() == $wgTitle->getNamespace() |
| | 247 | + || $wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) |
| | 248 | + ) { |
| | 249 | + |
| | 250 | + $id=User::idFromName($wgTitle->getText()); |
| | 251 | + $ip=User::isIP($wgTitle->getText()); |
| | 252 | + |
| | 253 | + if($id||$ip) { |
| | 254 | + $s .= $sep . $this->userContribsLink(); |
| | 255 | + } |
| | 256 | + if ( 0 != $wgUser->getID() ) { |
| | 257 | + if($id) { # can only email real users |
| | 258 | + $s .= $sep . $this->emailUserLink(); |
| | 259 | + } |
| | 260 | + } |
| | 261 | + } |
| | 262 | + $s .= "\n<br /><hr class='sep' />"; |
| | 263 | + } |
| | 264 | + |
| | 265 | + if ( 0 != $wgUser->getID() && ( !$wgDisableUploads || $wgRemoteUploads ) ) { |
| | 266 | + $s .= $this->specialLink( 'upload' ) . $sep; |
| | 267 | + } |
| | 268 | + $s .= $this->specialLink( 'specialpages' ) |
| | 269 | + . $sep . $this->bugReportsLink(); |
| | 270 | + |
| | 271 | + global $wgSiteSupportPage; |
| | 272 | + if( $wgSiteSupportPage ) { |
| | 273 | + $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) . |
| | 274 | + '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>'; |
| | 275 | + } |
| | 276 | + |
| | 277 | + $s .= "\n<br /></div>\n"; |
| | 278 | + wfProfileOut( $fname ); |
| | 279 | + return $s; |
| | 280 | + } |
| | 281 | + |
| | 282 | + |
| 131 | 283 | } |
| 132 | 284 | |
| 133 | 285 | ?> |
| Index: trunk/phase3/includes/Skin.php |
| — | — | @@ -918,152 +918,6 @@ |
| 919 | 919 | return $s; |
| 920 | 920 | } |
| 921 | 921 | |
| 922 | | - function quickBar() { |
| 923 | | - global $wgOut, $wgTitle, $wgUser, $wgRequest, $wgContLang; |
| 924 | | - global $wgDisableUploads, $wgRemoteUploads; |
| 925 | | - |
| 926 | | - $fname = 'Skin::quickBar'; |
| 927 | | - wfProfileIn( $fname ); |
| 928 | | - |
| 929 | | - $action = $wgRequest->getText( 'action' ); |
| 930 | | - $wpPreview = $wgRequest->getBool( 'wpPreview' ); |
| 931 | | - $tns=$wgTitle->getNamespace(); |
| 932 | | - |
| 933 | | - $s = "\n<div id='quickbar'>"; |
| 934 | | - $s .= "\n" . $this->logoText() . "\n<hr class='sep' />"; |
| 935 | | - |
| 936 | | - $sep = "\n<br />"; |
| 937 | | - $s .= $this->mainPageLink() |
| 938 | | - . $sep . $this->specialLink( 'recentchanges' ) |
| 939 | | - . $sep . $this->specialLink( 'randompage' ); |
| 940 | | - if ($wgUser->getID()) { |
| 941 | | - $s.= $sep . $this->specialLink( 'watchlist' ) ; |
| 942 | | - $s .= $sep .$this->makeKnownLink( $wgContLang->specialPage( 'Contributions' ), |
| 943 | | - wfMsg( 'mycontris' ), 'target=' . wfUrlencode($wgUser->getName() ) ); |
| 944 | | - |
| 945 | | - } |
| 946 | | - // only show watchlist link if logged in |
| 947 | | - if ( wfMsgForContent ( 'currentevents' ) != '-' ) |
| 948 | | - $s .= $sep . $this->makeKnownLink( wfMsgForContent( 'currentevents' ), '' ) ; |
| 949 | | - $s .= "\n<br /><hr class='sep' />"; |
| 950 | | - $articleExists = $wgTitle->getArticleId(); |
| 951 | | - if ( $wgOut->isArticle() || $action =='edit' || $action =='history' || $wpPreview) { |
| 952 | | - if($wgOut->isArticle()) { |
| 953 | | - $s .= '<strong>' . $this->editThisPage() . '</strong>'; |
| 954 | | - } else { # backlink to the article in edit or history mode |
| 955 | | - if($articleExists){ # no backlink if no article |
| 956 | | - switch($tns) { |
| 957 | | - case 0: |
| 958 | | - $text = wfMsg('articlepage'); |
| 959 | | - break; |
| 960 | | - case 1: |
| 961 | | - $text = wfMsg('viewtalkpage'); |
| 962 | | - break; |
| 963 | | - case 2: |
| 964 | | - $text = wfMsg('userpage'); |
| 965 | | - break; |
| 966 | | - case 3: |
| 967 | | - $text = wfMsg('viewtalkpage'); |
| 968 | | - break; |
| 969 | | - case 4: |
| 970 | | - $text = wfMsg('wikipediapage'); |
| 971 | | - break; |
| 972 | | - case 5: |
| 973 | | - $text = wfMsg('viewtalkpage'); |
| 974 | | - break; |
| 975 | | - case 6: |
| 976 | | - $text = wfMsg('imagepage'); |
| 977 | | - break; |
| 978 | | - case 7: |
| 979 | | - $text = wfMsg('viewtalkpage'); |
| 980 | | - break; |
| 981 | | - default: |
| 982 | | - $text= wfMsg('articlepage'); |
| 983 | | - } |
| 984 | | - |
| 985 | | - $link = $wgTitle->getText(); |
| 986 | | - if ($nstext = $wgContLang->getNsText($tns) ) { # add namespace if necessary |
| 987 | | - $link = $nstext . ':' . $link ; |
| 988 | | - } |
| 989 | | - |
| 990 | | - $s .= $this->makeLink( $link, $text ); |
| 991 | | - } elseif( $wgTitle->getNamespace() != Namespace::getSpecial() ) { |
| 992 | | - # we just throw in a "New page" text to tell the user that he's in edit mode, |
| 993 | | - # and to avoid messing with the separator that is prepended to the next item |
| 994 | | - $s .= '<strong>' . wfMsg('newpage') . '</strong>'; |
| 995 | | - } |
| 996 | | - |
| 997 | | - } |
| 998 | | - |
| 999 | | - |
| 1000 | | - if( $tns%2 && $action!='edit' && !$wpPreview) { |
| 1001 | | - $s.= '<br />'.$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg('postcomment'),'action=edit§ion=new'); |
| 1002 | | - } |
| 1003 | | - |
| 1004 | | - /* |
| 1005 | | - watching could cause problems in edit mode: |
| 1006 | | - if user edits article, then loads "watch this article" in background and then saves |
| 1007 | | - article with "Watch this article" checkbox disabled, the article is transparently |
| 1008 | | - unwatched. Therefore we do not show the "Watch this page" link in edit mode |
| 1009 | | - */ |
| 1010 | | - if ( 0 != $wgUser->getID() && $articleExists) { |
| 1011 | | - if($action!='edit' && $action != 'submit' ) |
| 1012 | | - { |
| 1013 | | - $s .= $sep . $this->watchThisPage(); |
| 1014 | | - } |
| 1015 | | - if ( $wgTitle->userCanEdit() ) |
| 1016 | | - $s .= $sep . $this->moveThisPage(); |
| 1017 | | - } |
| 1018 | | - if ( $wgUser->isSysop() and $articleExists ) { |
| 1019 | | - $s .= $sep . $this->deleteThisPage() . |
| 1020 | | - $sep . $this->protectThisPage(); |
| 1021 | | - } |
| 1022 | | - $s .= $sep . $this->talkLink(); |
| 1023 | | - if ($articleExists && $action !='history') { |
| 1024 | | - $s .= $sep . $this->historyLink(); |
| 1025 | | - } |
| 1026 | | - $s.=$sep . $this->whatLinksHere(); |
| 1027 | | - |
| 1028 | | - if($wgOut->isArticleRelated()) { |
| 1029 | | - $s .= $sep . $this->watchPageLinksLink(); |
| 1030 | | - } |
| 1031 | | - |
| 1032 | | - if ( Namespace::getUser() == $wgTitle->getNamespace() |
| 1033 | | - || $wgTitle->getNamespace() == Namespace::getTalk(Namespace::getUser()) |
| 1034 | | - ) { |
| 1035 | | - |
| 1036 | | - $id=User::idFromName($wgTitle->getText()); |
| 1037 | | - $ip=User::isIP($wgTitle->getText()); |
| 1038 | | - |
| 1039 | | - if($id||$ip) { |
| 1040 | | - $s .= $sep . $this->userContribsLink(); |
| 1041 | | - } |
| 1042 | | - if ( 0 != $wgUser->getID() ) { |
| 1043 | | - if($id) { # can only email real users |
| 1044 | | - $s .= $sep . $this->emailUserLink(); |
| 1045 | | - } |
| 1046 | | - } |
| 1047 | | - } |
| 1048 | | - $s .= "\n<br /><hr class='sep' />"; |
| 1049 | | - } |
| 1050 | | - |
| 1051 | | - if ( 0 != $wgUser->getID() && ( !$wgDisableUploads || $wgRemoteUploads ) ) { |
| 1052 | | - $s .= $this->specialLink( 'upload' ) . $sep; |
| 1053 | | - } |
| 1054 | | - $s .= $this->specialLink( 'specialpages' ) |
| 1055 | | - . $sep . $this->bugReportsLink(); |
| 1056 | | - |
| 1057 | | - global $wgSiteSupportPage; |
| 1058 | | - if( $wgSiteSupportPage ) { |
| 1059 | | - $s .= "\n<br /><a href=\"" . htmlspecialchars( $wgSiteSupportPage ) . |
| 1060 | | - '" class="internal">' . wfMsg( 'sitesupport' ) . '</a>'; |
| 1061 | | - } |
| 1062 | | - |
| 1063 | | - $s .= "\n<br /></div>\n"; |
| 1064 | | - wfProfileOut( $fname ); |
| 1065 | | - return $s; |
| 1066 | | - } |
| 1067 | | - |
| 1068 | 922 | function specialPagesList() { |
| 1069 | 923 | global $wgUser, $wgOut, $wgContLang, $wgServer, $wgRedirectScript; |
| 1070 | 924 | require_once('SpecialPage.php'); |