[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

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

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @author Mambo Foundation Inc see README.php
   5  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   6  * See COPYRIGHT.php for copyright notices and details.
   7  * @license GNU/GPL Version 2, see LICENSE.php
   8  *
   9  * Redistributions of files must retain the above copyright notice.
  10  *
  11  * Mambo is free software; you can redistribute it and/or
  12  * modify it under the terms of the GNU General Public License
  13  * as published by the Free Software Foundation; version 2 of the License.
  14  */
  15  
  16  /** ensure this file is being included by a parent file */
  17  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  18  
  19  $_MAMBOTS->registerFunction( 'onInitEditor', 'botNoEditorInit' );
  20  $_MAMBOTS->registerFunction( 'onGetEditorContents', 'botNoEditorGetContents' );
  21  $_MAMBOTS->registerFunction( 'onEditorArea', 'botNoEditorEditorArea' );
  22  
  23  /**
  24  * No WYSIWYG Editor - javascript initialisation
  25  */
  26  function botNoEditorInit() {
  27      return <<<EOD
  28  <script type="text/javascript">
  29  	function insertAtCursor(myField, myValue) {
  30          if (document.selection) {
  31              // IE support
  32              myField.focus();
  33              sel = document.selection.createRange();
  34              sel.text = myValue;
  35          } else if (myField.selectionStart || myField.selectionStart == '0') {
  36              // MOZILLA/NETSCAPE support
  37              var startPos = myField.selectionStart;
  38              var endPos = myField.selectionEnd;
  39              myField.value = myField.value.substring(0, startPos)
  40                  + myValue
  41                  + myField.value.substring(endPos, myField.value.length);
  42          } else {
  43              myField.value += myValue;
  44          }
  45      }
  46  </script>
  47  EOD;
  48  }
  49  /**
  50  * No WYSIWYG Editor - copy editor contents to form field
  51  * @param string The name of the editor area
  52  * @param string The name of the form field
  53  */
  54  function botNoEditorGetContents( $editorArea, $hiddenField ) {
  55      return <<<EOD
  56  EOD;
  57  }
  58  /**
  59  * No WYSIWYG Editor - display the editor
  60  * @param string The name of the editor area
  61  * @param string The content of the field
  62  * @param string The name of the form field
  63  * @param string The width of the editor area
  64  * @param string The height of the editor area
  65  * @param int The number of columns for the editor area
  66  * @param int The number of rows for the editor area
  67  */
  68  function botNoEditorEditorArea( $name, $content, $hiddenField, $width, $height, $col, $row ) {
  69      global $mosConfig_live_site, $_MAMBOTS;
  70  
  71      $results = $_MAMBOTS->trigger( 'onCustomEditorButton' );
  72      $buttons = array();
  73      foreach ($results as $result) {
  74          $buttons[] = '<img src="'.$mosConfig_live_site.'/mambots/editors-xtd/'.$result[0].'" onclick="insertAtCursor( document.adminForm.'.$hiddenField.', \''.$result[1].'\' )" />';
  75      }
  76      $buttons = implode( "", $buttons );
  77  
  78      return <<<EOD
  79  <textarea name="$hiddenField" id="$hiddenField" cols="$col" rows="$row" style="width:$width;height:$height;">$content</textarea>
  80  <br />$buttons
  81  EOD;
  82  }
  83  ?>