X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=skins%2FVector.php;h=3479ba58f7941a2f2ec503f82e0a74fcb031ecc7;hb=25b3c477503a47d5b20023c5a07b336474a12749;hp=99f6d53c69e2d28268fa3f12d31b467046cc5b7d;hpb=be378af50b612e85f42b1f38dc4c0cb45823c21b;p=lhc%2Fweb%2Fwiklou.git diff --git a/skins/Vector.php b/skins/Vector.php index 99f6d53c69..3479ba58f7 100644 --- a/skins/Vector.php +++ b/skins/Vector.php @@ -8,8 +8,9 @@ * @ingroup Skins */ -if( !defined( 'MEDIAWIKI' ) ) +if( !defined( 'MEDIAWIKI' ) ) { die( -1 ); +} /** * SkinTemplate class for Vector skin @@ -19,40 +20,50 @@ class SkinVector extends SkinTemplate { /* Functions */ var $skinname = 'vector', $stylename = 'vector', - $template = 'VectorTemplate'; + $template = 'VectorTemplate', $useHeadElement = true; /** * Initializes output page and sets up skin-specific parameters - * @param object $out Output page object to initialize + * @param $out OutputPage object to initialize */ public function initPage( OutputPage $out ) { - global $wgStylePath, $wgJsMimeType, $wgStyleVersion; + global $wgLocalStylePath; parent::initPage( $out ); - // Append skin-specific styles - $out->addStyle( 'vector/main-rtl.css', 'screen', '', 'rtl' ); - $out->addStyle( 'vector/main-ltr.css', 'screen', '', 'ltr' ); // Append CSS which includes IE only behavior fixes for hover support - // this is better than including this in a CSS fille since it doesn't // wait for the CSS file to load before fetching the HTC file. $out->addScript( '' - ); - // Append common IE fixes, which perhaps should be included in all - // skins, but for now it seems each skin needs to include them - // explicitly - $out->addScript( - '' + htmlspecialchars( $wgLocalStylePath ) . + "/{$this->stylename}/csshover.htc\")}" ); } + + /** + * Load skin and user CSS files in the correct order + * fixes bug 22916 + * @param $out OutputPage object + */ + function setupSkinUserCss( OutputPage $out ){ + global $wgVectorExtraStyles; + + parent::setupSkinUserCss( $out ); + + // Append skin-specific styles + $out->addStyle( "{$this->stylename}/main-rtl.css", 'screen', '', 'rtl' ); + $out->addStyle( "{$this->stylename}/main-ltr.css", 'screen', '', 'ltr' ); + + // Add extra stylesheets + // THIS IS ONLY USEFUL FOR EXPERIMENTING WITH DIFFERNT STYLE OPTIONS! THIS WILL BE REMOVED IN THE NEAR FUTURE. + if ( is_array( $wgVectorExtraStyles ) ) { + foreach ( $wgVectorExtraStyles as $style ) { + $out->addStyle( "vector/$style", 'screen' ); + } + } + } + /** * Builds a structured array of links used for tabs and menus * @return array @@ -60,7 +71,7 @@ class SkinVector extends SkinTemplate { */ function buildNavigationUrls() { global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle; - global $wgDisableLangConversion; + global $wgDisableLangConversion, $wgVectorUseIconWatch; wfProfileIn( __METHOD__ ); @@ -77,7 +88,6 @@ class SkinVector extends SkinTemplate { // Checks if page is some kind of content if( $this->iscontent ) { - // Gets page objects for the related namespaces $subjectPage = $this->mTitle->getSubjectPage(); $talkPage = $this->mTitle->getTalkPage(); @@ -93,7 +103,6 @@ class SkinVector extends SkinTemplate { } else { $talkId = "{$subjectId}_talk"; } - $currentId = $isTalk ? $talkId : $subjectId; // Adds namespace links $links['namespaces'][$subjectId] = $this->tabAction( @@ -140,7 +149,7 @@ class SkinVector extends SkinTemplate { ? wfMsg( 'vector-view-edit' ) : wfMsg( 'vector-view-create' ), 'href' => - $this->mTitle->getLocalUrl( $this->editUrlOptions() ) + $this->mTitle->getLocalURL( $this->editUrlOptions() ) ); // Checks if this is a current rev of talk page and we should show a new // section link @@ -150,22 +159,22 @@ class SkinVector extends SkinTemplate { // Adds new section link //$links['actions']['addsection'] $links['views']['addsection'] = array( - 'class' => $section == 'new' ? 'selected' : false, + 'class' => 'collapsible ' . ( $section == 'new' ? 'selected' : false ), 'text' => wfMsg( 'vector-action-addsection' ), - 'href' => $this->mTitle->getLocalUrl( + 'href' => $this->mTitle->getLocalURL( 'action=edit§ion=new' ) ); } } - // Checks if the page is known (some kind of viewable content) - } elseif ( $this->mTitle->isKnown() ) { + // Checks if the page has some kind of viewable content + } elseif ( $this->mTitle->hasSourceText() ) { // Adds view source view link $links['views']['viewsource'] = array( 'class' => ( $action == 'edit' ) ? 'selected' : false, 'text' => wfMsg( 'vector-view-viewsource' ), 'href' => - $this->mTitle->getLocalUrl( $this->editUrlOptions() ) + $this->mTitle->getLocalURL( $this->editUrlOptions() ) ); } wfProfileOut( __METHOD__ . '-edit' ); @@ -176,17 +185,17 @@ class SkinVector extends SkinTemplate { if ( $this->mTitle->exists() ) { // Adds history view link $links['views']['history'] = array( - 'class' => ($action == 'history') ? 'selected' : false, + 'class' => 'collapsible ' . ( ( $action == 'history' ) ? 'selected' : false ), 'text' => wfMsg( 'vector-view-history' ), - 'href' => $this->mTitle->getLocalUrl( 'action=history' ), + 'href' => $this->mTitle->getLocalURL( 'action=history' ), 'rel' => 'archives', ); if( $wgUser->isAllowed( 'delete' ) ) { $links['actions']['delete'] = array( - 'class' => ($action == 'delete') ? 'selected' : false, + 'class' => ( $action == 'delete' ) ? 'selected' : false, 'text' => wfMsg( 'vector-action-delete' ), - 'href' => $this->mTitle->getLocalUrl( 'action=delete' ) + 'href' => $this->mTitle->getLocalURL( 'action=delete' ) ); } if ( $this->mTitle->quickUserCan( 'move' ) ) { @@ -197,7 +206,7 @@ class SkinVector extends SkinTemplate { 'class' => $this->mTitle->isSpecial( 'Movepage' ) ? 'selected' : false, 'text' => wfMsg( 'vector-action-move' ), - 'href' => $moveTitle->getLocalUrl() + 'href' => $moveTitle->getLocalURL() ); } @@ -205,22 +214,22 @@ class SkinVector extends SkinTemplate { $this->mTitle->getNamespace() !== NS_MEDIAWIKI && $wgUser->isAllowed( 'protect' ) ) { - if ( !$this->mTitle->isProtected() ){ + if ( !$this->mTitle->isProtected() ) { $links['actions']['protect'] = array( - 'class' => ($action == 'protect') ? + 'class' => ( $action == 'protect' ) ? 'selected' : false, 'text' => wfMsg( 'vector-action-protect' ), 'href' => - $this->mTitle->getLocalUrl( 'action=protect' ) + $this->mTitle->getLocalURL( 'action=protect' ) ); } else { $links['actions']['unprotect'] = array( - 'class' => ($action == 'unprotect') ? + 'class' => ( $action == 'unprotect' ) ? 'selected' : false, 'text' => wfMsg( 'vector-action-unprotect' ), 'href' => - $this->mTitle->getLocalUrl( 'action=unprotect' ) + $this->mTitle->getLocalURL( 'action=unprotect' ) ); } } @@ -239,7 +248,7 @@ class SkinVector extends SkinTemplate { array( 'parsemag' ), $wgLang->formatNum( $n ) ), - 'href' => $undelTitle->getLocalUrl( + 'href' => $undelTitle->getLocalURL( 'target=' . urlencode( $this->thispage ) ) ); @@ -252,26 +261,25 @@ class SkinVector extends SkinTemplate { ) { if ( !$this->mTitle->getRestrictions( 'create' ) ) { $links['actions']['protect'] = array( - 'class' => ($action == 'protect') ? + 'class' => ( $action == 'protect' ) ? 'selected' : false, 'text' => wfMsg( 'vector-action-protect' ), 'href' => - $this->mTitle->getLocalUrl( 'action=protect' ) + $this->mTitle->getLocalURL( 'action=protect' ) ); } else { $links['actions']['unprotect'] = array( - 'class' => ($action == 'unprotect') ? + 'class' => ( $action == 'unprotect' ) ? 'selected' : false, 'text' => wfMsg( 'vector-action-unprotect' ), 'href' => - $this->mTitle->getLocalUrl( 'action=unprotect' ) + $this->mTitle->getLocalURL( 'action=unprotect' ) ); } } } wfProfileOut( __METHOD__ . '-live' ); - /** * The following actions use messages which, if made particular to * the Vector skin, would break the Ajax code which makes this @@ -282,29 +290,21 @@ class SkinVector extends SkinTemplate { * the global versions. */ // Checks if the user is logged in - if( $this->loggedin ) { - // Checks if the user is watching this page - if( !$this->mTitle->userIsWatching() ) { - // Adds watch action link - $links['actions']['watch'] = array( - 'class' => - ( $action == 'watch' or $action == 'unwatch' ) ? - 'selected' : false, - 'text' => wfMsg( 'watch' ), - 'href' => $this->mTitle->getLocalUrl( 'action=watch' ) - ); + if ( $this->loggedin ) { + if ( $wgVectorUseIconWatch ) { + $class = 'icon'; + $place = 'views'; } else { - // Adds unwatch action link - $links['actions']['unwatch'] = array( - 'class' => - ($action == 'unwatch' or $action == 'watch') ? - 'selected' : false, - 'text' => wfMsg( 'unwatch' ), - 'href' => $this->mTitle->getLocalUrl( 'action=unwatch' ) - ); + $class = ''; + $place = 'actions'; } + $mode = $this->mTitle->userIsWatching() ? 'unwatch' : 'watch'; + $links[$place][$mode] = array( + 'class' => $class . ( ( $action == 'watch' || $action == 'unwatch' ) ? ' selected' : false ), + 'text' => wfMsg( $mode ), // uses 'watch' or 'unwatch' message + 'href' => $this->mTitle->getLocalURL( 'action=' . $mode ) + ); } - // This is instead of SkinTemplateTabs - which uses a flat array wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) ); @@ -366,15 +366,11 @@ class VectorTemplate extends QuickTemplate { * Outputs the entire contents of the XHTML page */ public function execute() { - global $wgRequest, $wgOut, $wgContLang, $wgDevelopmentWarnings; + global $wgRequest, $wgContLang; $this->skin = $this->data['skin']; $action = $wgRequest->getText( 'action' ); - // Suppress warnings to prevent notices about missing indexes in - // $this->data (is this really the best way to handle this?) - $wgDevelopmentWarnings && wfSuppressWarnings(); - // Build additional attributes for navigation urls $nav = $this->skin->buildNavigationUrls(); foreach ( $nav as $section => $links ) { @@ -442,7 +438,15 @@ class VectorTemplate extends QuickTemplate { 'about', 'disclaimer', ), + 'icons' => array( + 'poweredbyico', + 'copyrightico', + ), ); + $footerlinksClasses = array( + 'icons' => array( 'noprint' ) + ); + // Reduce footer links down to only those which are being used $validFooterLinks = array(); foreach( $footerlinks as $category => $links ) { @@ -463,15 +467,14 @@ class VectorTemplate extends QuickTemplate { array_reverse( $this->data['personal_urls'] ); } // Output HTML Page - echo $wgOut->headElement( $this->skin ); + $this->html( 'headelement' ); ?> - data['body_ondblclick'] ): ?> ondblclick="text( 'body_ondblclick' ) ?>" data['body_onload'] ): ?> onload="text( 'body_onload' ) ?>" class="mediawiki text( 'dir' ) ?> text( 'pageclass' ) ?> text( 'skinnameclass' ) ?>" dir="text( 'dir' ) ?>"> -
-
+
+
-
+
html('specialpageattributes') ?>> - + data['sitenotice'] ): ?>
html( 'sitenotice' ) ?>
@@ -483,10 +486,10 @@ class VectorTemplate extends QuickTemplate {
-

msg( 'tagline' ) ?>

+
msg( 'tagline' ) ?>
-
html( 'subtitle' ) ?>
+
html('userlangattributes') ?>>html( 'subtitle' ) ?>
data['undelete'] ): ?> @@ -501,7 +504,7 @@ class VectorTemplate extends QuickTemplate { data['showjumplinks'] ): ?> @@ -525,7 +528,7 @@ class VectorTemplate extends QuickTemplate {
-