From: Jens Frank Date: Sun, 26 Sep 2004 09:45:35 +0000 (+0000) Subject: BUG#419 Added global variable that defines the elements of the navigation sidebar. X-Git-Tag: 1.5.0alpha1~1776 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=734caee09898f7e046b1ee3a0bb8fd96ecebded6;p=lhc%2Fweb%2Fwiklou.git BUG#419 Added global variable that defines the elements of the navigation sidebar. Made MonoBook use the global sidebar definition --- diff --git a/LocalSettings.sample b/LocalSettings.sample index 04fb97b781..bda3655c25 100644 --- a/LocalSettings.sample +++ b/LocalSettings.sample @@ -120,6 +120,15 @@ $wgDBminWordLen = 3; # # $wgUseDatabaseMessages = false; +## The links in the navigation sidebar can be configured. +## To add a link to the sidebar, add a line like the following +# +# $wgNavigationLinks[] = array( 'text' => 'helpdesk', 'href' => 'helpdesk-url' ); +# +## and create two MediaWiki:-pages with the corresponding names, e.g. +## MediaWiki:helpdesk="User help desk" +## MediaWiki:helpdesk-url="YourProject:Help_desk" + ## Set $wgUseImageResize to true if you want to enable dynamic ## server side image resizing ("Thumbnails") # diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 9204050d11..d7049c613a 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -707,6 +707,23 @@ $wgImageLimits = array ( array(1280,1024), array(10000,10000) ); + +# Navigation links for the user sidebar. +# 'text' is the name of the MediaWiki message that contains the label of this link +# 'href' is the name of the MediaWiki message that contains the link target of this link. +# Link targets starting with http are considered remote links. Ones not starting with +# http are considered as names of local wiki pages. +$wgNavigationLinks = array ( + array( 'text'=>'mainpage', 'href'=>'mainpage' ), + array( 'text'=>'portal', 'href'=>'portal-url' ), + array( 'text'=>'currentevents', 'href'=>'currentevents-url' ), + array( 'text'=>'recentchanges', 'href'=>'recentchanges-url' ), + array( 'text'=>'randompage', 'href'=>'randompage-url' ), + array( 'text'=>'help', 'href'=>'helppage' ), + array( 'text'=>'sitesupport', 'href'=>'sitesupport-url' ), +); + + } else { die(); } diff --git a/includes/Skin.php b/includes/Skin.php index 91b49f860b..872238d423 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1765,6 +1765,17 @@ class Skin { $this->checkTitle($title, $name); return $title->getLocalURL( $urlaction ); } + + # If url string starts with http, consider as external URL, else + # internal + /*static*/ function makeInternalOrExternalUrl( $name ) { + if ( strncmp( $name, 'http', 4 ) == 0 ) { + return $name; + } else { + return $this->makeUrl( $name ); + } + } + # this can be passed the NS number as defined in Language.php /*static*/ function makeNSUrl( $name, $urlaction='', $namespace=0 ) { $title = Title::makeTitleSafe( $namespace, $name ); diff --git a/includes/SkinPHPTal.php b/includes/SkinPHPTal.php index dc18f993ca..7280da336d 100644 --- a/includes/SkinPHPTal.php +++ b/includes/SkinPHPTal.php @@ -302,6 +302,7 @@ class SkinPHPTal extends Skin { $out->mBodytext .= $printfooter ; $tpl->setRef( 'bodytext', $out->mBodytext ); + # Language links $language_urls = array(); foreach( $wgOut->getLanguageLinks() as $l ) { $nt = Title::newFromText( $l ); @@ -314,6 +315,8 @@ class SkinPHPTal extends Skin { } else { $tpl->set('language_urls', false); } + + # Personal toolbar $tpl->set('personal_urls', $this->buildPersonalUrls()); $content_actions = $this->buildContentActionUrls(); $tpl->setRef('content_actions', $content_actions); @@ -324,6 +327,7 @@ class SkinPHPTal extends Skin { } else { $tpl->set('body_ondblclick', false); } + $tpl->set( 'navigation_urls', $this->buildNavigationUrls() ); $tpl->set( 'nav_urls', $this->buildNavUrls() ); // execute template @@ -558,6 +562,22 @@ class SkinPHPTal extends Skin { return $content_actions; } + /** + * build array of global navigation links + */ + function buildNavigationUrls () { + global $wgNavigationLinks; + $result = array(); + foreach ( $wgNavigationLinks as $link ) { + $result[] = array( + 'text' => wfMsg( $link['text'] ), + 'href' => $this->makeInternalOrExternalUrl( wfMsg( $link['href'] ) ), + 'id' => 'n-'.$link['text'] + ); + } + return $result; + } + /** * build array of common navigation links */ diff --git a/languages/Language.php b/languages/Language.php index d7a2fc4054..d7b4d91d81 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -315,7 +315,8 @@ and the [http://meta.wikipedia.org/wiki/MediaWiki_User%27s_Guide User's Guide] f "wikititlesuffix" => "{{SITENAME}}", "bugreports" => "Bug reports", "bugreportspage" => "{{ns:4}}:Bug_reports", -'sitesupport' => 'Donations', # Set a URL in $wgSiteSupportPage in LocalSettings.php +'sitesupport' => 'Donations', +'sitesupport-url' => '{{ns:4}}:Site support', 'faq' => 'FAQ', "faqpage" => "{{ns:4}}:FAQ", "edithelp" => "Editing help", @@ -335,6 +336,7 @@ and the [http://meta.wikipedia.org/wiki/MediaWiki_User%27s_Guide User's Guide] f 'anontalk' => 'Talk for this IP', 'navigation' => 'Navigation', 'currentevents' => 'Current events', +'currentevents-url' => 'Current events', 'disclaimers' => 'Disclaimers', "disclaimerpage" => "{{ns:4}}:General_disclaimer", "errorpagetitle" => "Error", @@ -817,6 +819,7 @@ from server time (UTC).', # 'changes' => 'changes', 'recentchanges' => 'Recent changes', +'recentchanges-url' => 'Special:Recentchanges', 'recentchangestext' => 'Track the most recent changes to the wiki on this page.', 'rcloaderr' => 'Loading recent changes', 'rcnote' => "Below are the last $1 changes in last $2 days.", @@ -992,6 +995,7 @@ That comes to '''$5''' average edits per page, and '''$6''' views per edit.", 'nlinks' => '$1 links', 'allpages' => 'All pages', 'randompage' => 'Random page', +'randompage-url'=> 'Special:Randompage', 'shortpages' => 'Short pages', 'longpages' => 'Long pages', 'deadendpages' => 'Dead-end pages', @@ -1550,6 +1554,8 @@ ta[\'ca-nstab-category\'] = new Array(\'c\',\'View the category page\'); 'showbigimage' => 'Download high resolution version ($1x$2, $3 KB)', 'newimages' => 'New images gallery', +'mormo' => 'mormo.org', +'mormo-url' => 'http://mormo.org', ); diff --git a/skins/MonoBook.pt b/skins/MonoBook.pt index a076a8590b..aa5e344f73 100644 --- a/skins/MonoBook.pt +++ b/skins/MonoBook.pt @@ -63,20 +63,9 @@
Navigation