Do not display empty toolbox
authorMichaël Parienti (edelweiss) <mparienti@easter-eggs.com>
Mon, 8 Jun 2009 13:01:39 +0000 (15:01 +0200)
committerMichaël Parienti (edelweiss) <mparienti@easter-eggs.com>
Mon, 8 Jun 2009 13:01:39 +0000 (15:01 +0200)
src/LE.php

index cc2ab21..e7da3b0 100644 (file)
@@ -215,8 +215,29 @@ class LETemplate extends QuickTemplate {
        }
 
 
+        function _displayToolbox() 
+        { 
+          if($this->data['notspecialpage']) { 
+            foreach( array( 'whatlinkshere', 'recentchangeslinked' ) as $special ) { 
+              if($this->configdata['showToolboxitems'][$special]) { return true ; } 
+            } 
+          }
+          if($this->configdata['showToolboxitems']['trackbacklink'] && isset($this->data['nav_urls']['trackbacklink'])) { return true; }
+          if($this->configdata['showToolboxitems']['feeds'] && $this->data['feeds']) { return true; }
+          foreach( array('contributions', 'emailuser', 'upload', 'specialpages') as $special ) { 
+            if($this->configdata['showToolboxitems'][$special]) { return true; }
+          }
+          if($this->configdata['showToolboxitems']['printableversion'] && !empty($this->data['nav_urls']['print']['href'])) { return true; }
+          
+          return false;
+        }
+
         function displayToolbox() 
-        { ?>
+        { 
+          if (!$this->_displayToolbox()) {
+            return;
+          }
+          ?>
         <div class="navbar">
          <h3><?php $this->msg('toolbox') ?></h3>
            <ul>