#
# $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")
#
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();
}
$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 );
$out->mBodytext .= $printfooter ;
$tpl->setRef( 'bodytext', $out->mBodytext );
+ # Language links
$language_urls = array();
foreach( $wgOut->getLanguageLinks() as $l ) {
$nt = Title::newFromText( $l );
} else {
$tpl->set('language_urls', false);
}
+
+ # Personal toolbar
$tpl->set('personal_urls', $this->buildPersonalUrls());
$content_actions = $this->buildContentActionUrls();
$tpl->setRef('content_actions', $content_actions);
} else {
$tpl->set('body_ondblclick', false);
}
+ $tpl->set( 'navigation_urls', $this->buildNavigationUrls() );
$tpl->set( 'nav_urls', $this->buildNavUrls() );
// execute template
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
*/
"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",
'anontalk' => 'Talk for this IP',
'navigation' => 'Navigation',
'currentevents' => 'Current events',
+'currentevents-url' => 'Current events',
'disclaimers' => 'Disclaimers',
"disclaimerpage" => "{{ns:4}}:General_disclaimer",
"errorpagetitle" => "Error",
#
'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 <strong>$1</strong> changes in last <strong>$2</strong> days.",
'nlinks' => '$1 links',
'allpages' => 'All pages',
'randompage' => 'Random page',
+'randompage-url'=> 'Special:Randompage',
'shortpages' => 'Short pages',
'longpages' => 'Long pages',
'deadendpages' => 'Dead-end pages',
'showbigimage' => 'Download high resolution version ($1x$2, $3 KB)',
'newimages' => 'New images gallery',
+'mormo' => 'mormo.org',
+'mormo-url' => 'http://mormo.org',
);
<h5 i18n:translate="string:navigation">Navigation</h5>
<div class="pBody">
<ul>
- <li id="n-mainpage"><a href="${nav_urls/mainpage/href}"
- i18n:translate="string:mainpage">Main Page</a></li>
- <li id="n-portal" tal:condition="nav_urls/portal/href"><a href="${nav_urls/portal/href}"
- i18n:translate="string:portal">Community Portal</a></li>
- <li id="n-currentevents" tal:condition="nav_urls/currentevents/href"><a href="${nav_urls/currentevents/href}"
- i18n:translate="string:currentevents">Current Events</a></li>
- <li id="n-recentchanges"><a href="${nav_urls/recentchanges/href}"
- i18n:translate="string:recentchanges">Recent Changes</a></li>
- <li id="n-randompage"><a href="${nav_urls/randompage/href}"
- i18n:translate="string:randompage">Random Page</a></li>
- <li id="n-help"><a href="${nav_urls/help/href}"
- i18n:translate="string:help">Help</a></li>
- <li id="n-sitesupport" tal:condition="nav_urls/sitesupport/href"><a href="${nav_urls/sitesupport/href}"
- i18n:translate="string:sitesupport">Donations</a></li>
+ <li tal:repeat="navlink navigation_urls" tal:attributes="id navlink/id">
+ <a tal:attributes="href navlink/href" tal:content="structure navlink/text">NavLink</a>
+ </li>
</ul>
</div>
</div>