[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/plugins/system/legacy/ -> toolbar.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: toolbar.php 21062 2011-04-03 22:03:07Z dextercowley $
   4  * @package        Joomla.Legacy
   5  * @subpackage    1.5
   6  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7  * @license        GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // Check to ensure this file is within the rest of the framework
  16  defined('JPATH_BASE') or die();
  17  
  18  /**
  19   * Legacy class
  20   *
  21   * @deprecated    As of version 1.5
  22   * @package        Joomla.Legacy
  23   * @subpackage    1.5
  24   */
  25  class mosToolBar {
  26  
  27      /**
  28      * Writes the start of the button bar table
  29      */
  30  	function startTable()
  31      {
  32          global $mainframe;
  33  
  34          // Initialize some variables
  35          $document = & JFactory::getDocument();
  36  
  37          // load toolbar css
  38          $document->addStyleSheet( 'templates/system/css/toolbar.css' );
  39          ?>
  40          <table cellpadding="0" cellspacing="3" border="0" id="toolbar">
  41          <tr valign="middle" align="center">
  42          <?php
  43      }
  44  
  45      /**
  46      * Writes a custom option and task button for the button bar
  47      * @param string The task to perform (picked up by the switch($task) blocks
  48      * @param string The image to display
  49      * @param string The image to display when moused over
  50      * @param string The alt text for the icon image
  51      * @param boolean True if required to check that a standard list item is checked
  52      */
  53  	function custom( $task='', $icon=NULL, $iconOver='', $alt='', $listSelect=true ) {
  54  
  55          $icon     = ( $iconOver ? $iconOver : $icon );
  56          $image     = JHTML::_('image.site',  $icon, '/images/', NULL, NULL, $alt );
  57  
  58          if ($listSelect) {
  59              $message = JText::sprintf( 'Please make a selection from the list to', JText::_( $alt ) );
  60              $message = addslashes($message);
  61              $onclick = "javascript:if (document.adminForm.boxchecked.value == 0){ alert('".  $message . "');}else{submitbutton('$task')}";
  62          } else {
  63              $onclick = "javascript:submitbutton('$task')";
  64          }
  65  
  66          ?>
  67          <td>
  68              <a class="toolbar" onclick="<?php echo $onclick ;?>">
  69                  <?php echo $image; ?></a>
  70          </td>
  71          <?php
  72      }
  73  
  74      /**
  75      * Writes the common 'new' icon for the button bar
  76      * @param string An override for the task
  77      * @param string An override for the alt text
  78      */
  79  	function addNew( $task='new', $alt='New' ) {
  80          $alt= JText::_( $alt );
  81  
  82          mosToolBar::custom( $task, 'new_f2.png', '', $alt, false );
  83      }
  84  
  85      /**
  86      * Writes a common 'publish' button
  87      * @param string An override for the task
  88      * @param string An override for the alt text
  89      */
  90  	function publish( $task='publish', $alt='Published' ) {
  91           $alt= JText::_( $alt );
  92  
  93          mosToolBar::custom( $task, 'publish_f2.png', '', $alt, false );
  94      }
  95  
  96      /**
  97      * Writes a common 'publish' button for a list of records
  98      * @param string An override for the task
  99      * @param string An override for the alt text
 100      */
 101  	function publishList( $task='publish', $alt='Published' ) {
 102          $alt= JText::_( $alt );
 103  
 104          mosToolBar::custom( $task, 'publish_f2.png', '', $alt, true );
 105      }
 106  
 107      /**
 108      * Writes a common 'unpublish' button
 109      * @param string An override for the task
 110      * @param string An override for the alt text
 111      */
 112  	function unpublish( $task='unpublish', $alt='Unpublished' ) {
 113          $alt= JText::_( $alt );
 114  
 115          mosToolBar::custom( $task, 'unpublish_f2.png', '', $alt, false );
 116      }
 117  
 118      /**
 119      * Writes a common 'unpublish' button for a list of records
 120      * @param string An override for the task
 121      * @param string An override for the alt text
 122      */
 123  	function unpublishList( $task='unpublish', $alt='Unpublished' ) {
 124          $alt= JText::_( $alt );
 125  
 126          mosToolBar::custom( $task, 'unpublish_f2.png', '', $alt, true );
 127      }
 128  
 129      /**
 130      * Writes a common 'archive' button for a list of records
 131      * @param string An override for the task
 132      * @param string An override for the alt text
 133      */
 134  	function archiveList( $task='archive', $alt='Archived' ) {
 135          $alt= JText::_( $alt );
 136  
 137          mosToolBar::custom( $task, 'archive_f2.png', '', $alt, true );
 138      }
 139  
 140      /**
 141      * Writes an unarchive button for a list of records
 142      * @param string An override for the task
 143      * @param string An override for the alt text
 144      */
 145  	function unarchiveList( $task='unarchive', $alt='Unarchive' ) {
 146          $alt= JText::_( $alt );
 147  
 148          mosToolBar::custom( $task, 'unarchive_f2.png', '', $alt, true );
 149      }
 150  
 151      /**
 152      * Writes a common 'edit' button for a list of records
 153      * @param string An override for the task
 154      * @param string An override for the alt text
 155      */
 156  	function editList( $task='edit', $alt='Edit' ) {
 157          $alt= JText::_( $alt );
 158  
 159          mosToolBar::custom( $task, 'edit_f2.png', '', $alt, true );
 160      }
 161  
 162      /**
 163      * Writes a common 'edit' button for a template html
 164      * @param string An override for the task
 165      * @param string An override for the alt text
 166      */
 167  	function editHtml( $task='edit_source', $alt='Edit HTML' ) {
 168          $alt= JText::_( $alt );
 169  
 170          mosToolBar::custom( $task, 'edit_f2.png', '', $alt, true );
 171      }
 172  
 173      /**
 174      * Writes a common 'edit' button for a template css
 175      * @param string An override for the task
 176      * @param string An override for the alt text
 177      */
 178  	function editCss( $task='edit_css', $alt='Edit CSS' ) {
 179          $alt= JText::_( $alt );
 180  
 181          mosToolBar::custom( $task, 'css_f2.png', '', $alt, true );
 182      }
 183  
 184      /**
 185      * Writes a common 'delete' button for a list of records
 186      * @param string  Postscript for the 'are you sure' message
 187      * @param string An override for the task
 188      * @param string An override for the alt text
 189      */
 190  	function deleteList( $msg='', $task='remove', $alt='Delete' ) {
 191          $alt= JText::_( $alt );
 192  
 193          mosToolBar::custom( $task, 'delete_f2.png', '', $alt, true );
 194      }
 195  
 196      /**
 197      * Writes a save button for a given option
 198      * @param string An override for the task
 199      * @param string An override for the alt text
 200      */
 201  	function save( $task='save', $alt='Save' ) {
 202          $alt= JText::_( $alt );
 203  
 204          mosToolBar::custom( $task, 'save_f2.png', '', $alt, false );
 205      }
 206  
 207      /**
 208      * Writes a save button for a given option
 209      * @param string An override for the task
 210      * @param string An override for the alt text
 211      */
 212  	function apply( $task='apply', $alt='Apply' ) {
 213          $alt= JText::_( $alt );
 214  
 215          mosToolBar::custom( $task, 'apply_f2.png', '', $alt, false );
 216      }
 217  
 218      /**
 219      * Writes a cancel button and invokes a cancel operation (eg a checkin)
 220      * @param string An override for the task
 221      * @param string An override for the alt text
 222      */
 223  	function cancel( $task='cancel', $alt='Cancel' ) {
 224          $alt= JText::_( $alt );
 225  
 226          mosToolBar::custom( $task, 'cancel_f2.png', '', $alt, false );
 227      }
 228  
 229      /**
 230      * Writes a preview button for a given option (opens a popup window)
 231      * @param string The name of the popup file (excluding the file extension)
 232      */
 233  	function preview( $popup='' ) {
 234          $db =& JFactory::getDBO();
 235  
 236          $sql = 'SELECT template'
 237          . ' FROM #__templates_menu'
 238          . ' WHERE client_id = 0'
 239          . ' AND menuid = 0';
 240          $db->setQuery( $sql );
 241          $cur_template = $db->loadResult();
 242  
 243          $alt    = JText::_( 'Preview' );
 244          $image     = JHTML::_('image.site',  'preview_f2.png', 'images/', NULL, NULL, $alt );
 245          ?>
 246          <td>
 247              <a class="toolbar" onclick="window.open('popups/<?php echo $popup;?>.php?t=<?php echo $cur_template; ?>', 'win1', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');" >
 248                  <?php echo $image; ?></a>
 249          </td>
 250          <?php
 251      }
 252  
 253      /**
 254      * Writes a cancel button that will go back to the previous page without doing
 255      * any other operation
 256      */
 257  	function back() {
 258          $alt= JText::_( 'back' );
 259          $image = JHTML::_('image.site',  'back_f2.png', '/images/', NULL, NULL, $alt );
 260          ?>
 261          <td>
 262              <a class="toolbar" href="javascript:window.history.back();" >
 263                  <?php echo $image;?></a>
 264          </td>
 265          <?php
 266      }
 267  
 268      /**
 269      * Write a divider between menu buttons
 270      */
 271  	function divider() {
 272          $image = JHTML::_('image.site',  'menu_divider.png', '/images/' );
 273          ?>
 274          <td>
 275              <?php echo $image; ?>
 276          </td>
 277          <?php
 278      }
 279  
 280      /**
 281      * Writes a media_manager button
 282      * @param string The sub-drectory to upload the media to
 283      */
 284  	function media_manager( $directory = '' ) {
 285          $alt= JText::_( 'Upload Image' );
 286          $image = JHTML::_('image.site',  'upload_f2.png', '/images/', NULL, NULL, $alt );
 287          ?>
 288          <td>
 289              <a class="toolbar" onclick="popupWindow('popups/uploadimage.php?directory=<?php echo $directory; ?>','win1',250,100,'no');">
 290                  <?php echo $image; ?></a>
 291          </td>
 292          <?php
 293      }
 294  
 295      /**
 296      * Writes a spacer cell
 297      * @param string The width for the cell
 298      */
 299  	function spacer( $width='' ) {
 300          if ($width != '') {
 301              ?>
 302              <td width="<?php echo $width;?>">&nbsp;</td>
 303              <?php
 304          } else {
 305              ?>
 306              <td>&nbsp;</td>
 307              <?php
 308          }
 309      }
 310  
 311      /**
 312      * Writes the end of the menu bar table
 313      */
 314  	function endTable() {
 315          ?>
 316          </tr>
 317          </table>
 318          <?php
 319      }
 320  }
 321  ?>


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1