BUG#419 Added global variable that defines the elements of the navigation sidebar.
authorJens Frank <jeluf@users.mediawiki.org>
Sun, 26 Sep 2004 09:45:35 +0000 (09:45 +0000)
committerJens Frank <jeluf@users.mediawiki.org>
Sun, 26 Sep 2004 09:45:35 +0000 (09:45 +0000)
Made MonoBook use the global sidebar definition

LocalSettings.sample
includes/DefaultSettings.php
includes/Skin.php
includes/SkinPHPTal.php
languages/Language.php
skins/MonoBook.pt

index 04fb97b..bda3655 100644 (file)
@@ -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")
 #
index 9204050..d7049c6 100644 (file)
@@ -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();
 }
index 91b49f8..872238d 100644 (file)
@@ -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 );
index dc18f99..7280da3 100644 (file)
@@ -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
         */
index d7a2fc4..d7b4d91 100644 (file)
@@ -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 <strong>$1</strong> changes in last <strong>$2</strong> 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',
 
 
 );
index a076a85..aa5e344 100644 (file)
          <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>