CologneBlue.php 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <?php
  2. /**
  3. * See docs/skin.txt
  4. *
  5. * @todo document
  6. * @file
  7. * @ingroup Skins
  8. */
  9. if( !defined( 'MEDIAWIKI' ) )
  10. die( -1 );
  11. /**
  12. * @todo document
  13. * @ingroup Skins
  14. */
  15. class SkinCologneBlue extends Skin {
  16. function getStylesheet() {
  17. return 'common/cologneblue.css';
  18. }
  19. function getSkinName() {
  20. return "cologneblue";
  21. }
  22. function doBeforeContent() {
  23. $s = "";
  24. $qb = $this->qbSetting();
  25. $mainPageObj = Title::newMainPage();
  26. $s .= "\n<div id='content'>\n<div id='topbar'>" .
  27. "<table width='100%' border='0' cellspacing='0' cellpadding='8'><tr>";
  28. $s .= "<td class='top' align='left' valign='middle' nowrap='nowrap'>";
  29. $s .= "<a href=\"" . $mainPageObj->escapeLocalURL() . "\">";
  30. $s .= "<span id='sitetitle'>" . wfMsg( "sitetitle" ) . "</span></a>";
  31. $s .= "</td><td class='top' align='right' valign='bottom' width='100%'>";
  32. $s .= $this->sysLinks();
  33. $s .= "</td></tr><tr><td valign='top'>";
  34. $s .= "<font size='-1'><span id='sitesub'>";
  35. $s .= htmlspecialchars( wfMsg( "sitesubtitle" ) ) . "</span></font>";
  36. $s .= "</td><td align='right'>" ;
  37. $s .= "<font size='-1'><span id='langlinks'>" ;
  38. $s .= str_replace ( "<br />" , "" , $this->otherLanguages() );
  39. $cat = $this->getCategoryLinks();
  40. if( $cat ) $s .= "<br />$cat\n";
  41. $s .= "<br />" . $this->pageTitleLinks();
  42. $s .= "</span></font>";
  43. $s .= "</td></tr></table>\n";
  44. $s .= "\n</div>\n<div id='article'>";
  45. $notice = wfGetSiteNotice();
  46. if( $notice ) {
  47. $s .= "\n<div id='siteNotice'>$notice</div>\n";
  48. }
  49. $s .= $this->pageTitle();
  50. $s .= $this->pageSubtitle() . "\n";
  51. return $s;
  52. }
  53. function doAfterContent()
  54. {
  55. global $wgOut, $wgLang;
  56. $s = "\n</div><br clear='all' />\n";
  57. $s .= "\n<div id='footer'>";
  58. $s .= "<table width='98%' border='0' cellspacing='0'><tr>";
  59. $qb = $this->qbSetting();
  60. if ( 1 == $qb || 3 == $qb ) { # Left
  61. $s .= $this->getQuickbarCompensator();
  62. }
  63. $s .= "<td class='bottom' align='center' valign='top'>";
  64. $s .= $this->bottomLinks();
  65. $s .= $wgLang->pipeList( array(
  66. "\n<br />" . $this->makeKnownLinkObj( Title::newMainPage() ),
  67. $this->aboutLink(),
  68. $this->searchForm( wfMsg( "qbfind" ) )
  69. ) );
  70. $s .= "\n<br />" . $this->pageStats();
  71. $s .= "</td>";
  72. if ( 2 == $qb ) { # Right
  73. $s .= $this->getQuickbarCompensator();
  74. }
  75. $s .= "</tr></table>\n</div>\n</div>\n";
  76. if ( 0 != $qb ) { $s .= $this->quickBar(); }
  77. return $s;
  78. }
  79. function reallyGenerateUserStylesheet() {
  80. $s = parent::reallyGenerateUserStylesheet();
  81. $qb = $this->qbSetting();
  82. if ( 2 == $qb ) { # Right
  83. $s .= "#quickbar { position: absolute; right: 4px; }\n" .
  84. "#article { margin-left: 4px; margin-right: 148px; }\n";
  85. } else if ( 1 == $qb ) {
  86. $s .= "#quickbar { position: absolute; left: 4px; }\n" .
  87. "#article { margin-left: 148px; margin-right: 4px; }\n";
  88. } else if ( 3 == $qb ) { # Floating left
  89. $s .= "#quickbar { position:absolute; left:4px } \n" .
  90. "#topbar { margin-left: 148px }\n" .
  91. "#article { margin-left:148px; margin-right: 4px; } \n" .
  92. "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
  93. } else if ( 4 == $qb ) { # Floating right
  94. $s .= "#quickbar { position: fixed; right: 4px; } \n" .
  95. "#topbar { margin-right: 148px }\n" .
  96. "#article { margin-right: 148px; margin-left: 4px; } \n" .
  97. "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
  98. }
  99. return $s;
  100. }
  101. function sysLinks() {
  102. global $wgUser, $wgLang, $wgContLang, $wgTitle;
  103. $li = $wgContLang->specialPage("Userlogin");
  104. $lo = $wgContLang->specialPage("Userlogout");
  105. $rt = $wgTitle->getPrefixedURL();
  106. if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
  107. $q = "";
  108. } else {
  109. $q = "returnto={$rt}";
  110. }
  111. $s = array(
  112. $this->mainPageLink(),
  113. $this->makeKnownLink( wfMsgForContent( "aboutpage" ), wfMsg( "about" ) ),
  114. $this->makeKnownLink( wfMsgForContent( "helppage" ), wfMsg( "help" ) ),
  115. $this->makeKnownLink( wfMsgForContent( "faqpage" ), wfMsg("faq") ),
  116. $this->specialLink( "specialpages" )
  117. );
  118. /* show links to different language variants */
  119. if( $this->variantLinks() ) {
  120. $s[] = $this->variantLinks();
  121. }
  122. if( $this->extensionTabLinks() ) {
  123. $s[] = $this->extensionTabLinks();
  124. }
  125. if ( $wgUser->isLoggedIn() ) {
  126. $s[] = $this->makeKnownLink( $lo, wfMsg( "logout" ), $q );
  127. } else {
  128. $s[] = $this->makeKnownLink( $li, wfMsg( "login" ), $q );
  129. }
  130. return $wgLang->pipeList( $s );
  131. }
  132. /**
  133. * Compute the sidebar
  134. * @access private
  135. */
  136. function quickBar()
  137. {
  138. global $wgOut, $wgTitle, $wgUser, $wgLang, $wgContLang, $wgEnableUploads;
  139. $tns=$wgTitle->getNamespace();
  140. $s = "\n<div id='quickbar'>";
  141. $sep = "<br />";
  142. $s .= $this->menuHead( "qbfind" );
  143. $s .= $this->searchForm();
  144. $s .= $this->menuHead( "qbbrowse" );
  145. # Use the first heading from the Monobook sidebar as the "browse" section
  146. $bar = $this->buildSidebar();
  147. unset( $bar['SEARCH'] );
  148. unset( $bar['LANGUAGES'] );
  149. unset( $bar['TOOLBOX'] );
  150. $browseLinks = reset( $bar );
  151. foreach ( $browseLinks as $link ) {
  152. if ( $link['text'] != '-' ) {
  153. $s .= "<a href=\"{$link['href']}\">" .
  154. htmlspecialchars( $link['text'] ) . '</a>' . $sep;
  155. }
  156. }
  157. if ( $wgOut->isArticle() ) {
  158. $s .= $this->menuHead( "qbedit" );
  159. $s .= "<strong>" . $this->editThisPage() . "</strong>";
  160. $s .= $sep . $this->makeKnownLink( wfMsgForContent( "edithelppage" ), wfMsg( "edithelp" ) );
  161. if( $wgUser->isLoggedIn() ) {
  162. $s .= $sep . $this->moveThisPage();
  163. }
  164. if ( $wgUser->isAllowed('delete') ) {
  165. $dtp = $this->deleteThisPage();
  166. if ( "" != $dtp ) {
  167. $s .= $sep . $dtp;
  168. }
  169. }
  170. if ( $wgUser->isAllowed('protect') ) {
  171. $ptp = $this->protectThisPage();
  172. if ( "" != $ptp ) {
  173. $s .= $sep . $ptp;
  174. }
  175. }
  176. $s .= $sep;
  177. $s .= $this->menuHead( "qbpageoptions" );
  178. $s .= $this->talkLink()
  179. . $sep . $this->commentLink()
  180. . $sep . $this->printableLink();
  181. if ( $wgUser->isLoggedIn() ) {
  182. $s .= $sep . $this->watchThisPage();
  183. }
  184. $s .= $sep;
  185. $s .= $this->menuHead("qbpageinfo")
  186. . $this->historyLink()
  187. . $sep . $this->whatLinksHere()
  188. . $sep . $this->watchPageLinksLink();
  189. if( $tns == NS_USER || $tns == NS_USER_TALK ) {
  190. $id=User::idFromName($wgTitle->getText());
  191. if ($id != 0) {
  192. $s .= $sep . $this->userContribsLink();
  193. if( $this->showEmailUser( $id ) ) {
  194. $s .= $sep . $this->emailUserLink();
  195. }
  196. }
  197. }
  198. $s .= $sep;
  199. }
  200. $s .= $this->menuHead( "qbmyoptions" );
  201. if ( $wgUser->isLoggedIn() ) {
  202. $name = $wgUser->getName();
  203. $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
  204. wfMsg( 'mytalk' ) );
  205. if ( $wgUser->getNewtalk() ) {
  206. $tl .= " *";
  207. }
  208. $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
  209. wfMsg( "mypage" ) )
  210. . $sep . $tl
  211. . $sep . $this->specialLink( "watchlist" )
  212. . $sep . $this->makeKnownLinkObj( SpecialPage::getSafeTitleFor( "Contributions", $wgUser->getName() ),
  213. wfMsg( "mycontris" ) )
  214. . $sep . $this->specialLink( "preferences" )
  215. . $sep . $this->specialLink( "userlogout" );
  216. } else {
  217. $s .= $this->specialLink( "userlogin" );
  218. }
  219. $s .= $this->menuHead( "qbspecialpages" )
  220. . $this->specialLink( "newpages" )
  221. . $sep . $this->specialLink( "listfiles" )
  222. . $sep . $this->specialLink( "statistics" );
  223. if ( $wgUser->isLoggedIn() && $wgEnableUploads ) {
  224. $s .= $sep . $this->specialLink( "upload" );
  225. }
  226. global $wgSiteSupportPage;
  227. if( $wgSiteSupportPage) {
  228. $s .= $sep."<a href=\"".htmlspecialchars($wgSiteSupportPage)."\" class =\"internal\">"
  229. .wfMsg( "sitesupport" )."</a>";
  230. }
  231. $s .= $sep . $this->makeKnownLinkObj(
  232. SpecialPage::getTitleFor( 'Specialpages' ),
  233. wfMsg( 'moredotdotdot' ) );
  234. $s .= $sep . "\n</div>\n";
  235. return $s;
  236. }
  237. function menuHead( $key )
  238. {
  239. $s = "\n<h6>" . wfMsg( $key ) . "</h6>";
  240. return $s;
  241. }
  242. function searchForm( $label = "" )
  243. {
  244. global $wgRequest, $wgUseTwoButtonsSearchForm;
  245. $search = $wgRequest->getText( 'search' );
  246. $action = $this->escapeSearchLink();
  247. $s = "<form id=\"searchform{$this->searchboxes}\" method=\"get\" class=\"inline\" action=\"$action\">";
  248. if ( "" != $label ) { $s .= "{$label}: "; }
  249. $s .= "<input type='text' id=\"searchInput{$this->searchboxes}\" class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
  250. . htmlspecialchars(substr($search,0,256)) . "\" /><br />"
  251. . "<input type='submit' id=\"searchGoButton{$this->searchboxes}\" class=\"searchButton\" name=\"go\" value=\"" . htmlspecialchars( wfMsg( "searcharticle" ) ) . "\" />";
  252. if ($wgUseTwoButtonsSearchForm)
  253. $s .= "<input type='submit' id=\"mw-searchButton{$this->searchboxes}\" class=\"searchButton\" name=\"fulltext\" value=\"" . htmlspecialchars( wfMsg( "search" ) ) . "\" />\n";
  254. else
  255. $s .= '<div><a href="$action" rel="search">' . wfMsg ('powersearch-legend') . "</a></div>\n";
  256. $s .= '</form>';
  257. // Ensure unique id's for search boxes made after the first
  258. $this->searchboxes = $this->searchboxes == '' ? 2 : $this->searchboxes + 1;
  259. return $s;
  260. }
  261. }