[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/mambots/editors/ -> none.php (source)

   1  <?php
   2  /**
   3  * @version $Id: none.php 3551 2006-05-18 08:24:53Z stingrey $
   4  * @package Joomla
   5  * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
   6  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
   7  * Joomla! is free software. This version may have been modified pursuant
   8  * to the GNU General Public License, and as distributed it includes or
   9  * is derivative of works licensed under the GNU General Public License or
  10  * other free or open source software licenses.
  11  * See COPYRIGHT.php for copyright notices and details.
  12  */
  13  
  14  // no direct access
  15  defined( '_VALID_MOS' ) or die( 'Restricted access' );
  16  
  17  $_MAMBOTS->registerFunction( 'onInitEditor', 'botNoEditorInit' );
  18  $_MAMBOTS->registerFunction( 'onGetEditorContents', 'botNoEditorGetContents' );
  19  $_MAMBOTS->registerFunction( 'onEditorArea', 'botNoEditorEditorArea' );
  20  
  21  /**
  22  * No WYSIWYG Editor - javascript initialisation
  23  */
  24  function botNoEditorInit() {
  25      return <<<EOD
  26  <script type="text/javascript">
  27  	function insertAtCursor(myField, myValue) {
  28          if (document.selection) {
  29              // IE support
  30              myField.focus();
  31              sel = document.selection.createRange();
  32              sel.text = myValue;
  33          } else if (myField.selectionStart || myField.selectionStart == '0') {
  34              // MOZILLA/NETSCAPE support
  35              var startPos = myField.selectionStart;
  36              var endPos = myField.selectionEnd;
  37              myField.value = myField.value.substring(0, startPos)
  38                  + myValue
  39                  + myField.value.substring(endPos, myField.value.length);
  40          } else {
  41              myField.value += myValue;
  42          }
  43      }
  44  </script>
  45  EOD;
  46  }
  47  /**
  48  * No WYSIWYG Editor - copy editor contents to form field
  49  * @param string The name of the editor area
  50  * @param string The name of the form field
  51  */
  52  function botNoEditorGetContents( $editorArea, $hiddenField ) {
  53      return <<<EOD
  54  EOD;
  55  }
  56  /**
  57  * No WYSIWYG Editor - display the editor
  58  * @param string The name of the editor area
  59  * @param string The content of the field
  60  * @param string The name of the form field
  61  * @param string The width of the editor area
  62  * @param string The height of the editor area
  63  * @param int The number of columns for the editor area
  64  * @param int The number of rows for the editor area
  65  */
  66  function botNoEditorEditorArea( $name, $content, $hiddenField, $width, $height, $col, $row ) {
  67      global $mosConfig_live_site, $_MAMBOTS;
  68  
  69      $results = $_MAMBOTS->trigger( 'onCustomEditorButton' );
  70      $buttons = array();
  71      foreach ($results as $result) {
  72          if ( $result[0] ) {
  73              $buttons[] = '<img src="'.$mosConfig_live_site.'/mambots/editors-xtd/'.$result[0].'" onclick="insertAtCursor( document.adminForm.'.$hiddenField.', \''.$result[1].'\' )" alt="'.$result[1].'" />';
  74          }
  75      }
  76      $buttons = implode( "", $buttons );
  77      
  78      $width  = $width . 'px';
  79      $height = $height . 'px';
  80      
  81      return <<<EOD
  82  <textarea name="$hiddenField" id="$hiddenField" cols="$col" rows="$row" style="width: $width; height: $height;">$content</textarea>
  83  <br />$buttons
  84  EOD;
  85  }
  86  ?>


Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics