bot_nulleditor.php

Go to the documentation of this file.
00001 <?php
00002 
00003 class bot_nulleditor {
00004 
00005     public function perform () {
00006         $args = func_get_args();
00007         $event = array_shift($args);
00008         $botparams = array_shift($args);
00009         $published = array_shift($args);
00010         switch ($event) {
00011             case 'onIniEditor':
00012                 return $this->init ();
00013 
00014             case 'onGetEditorContents':
00015                 return call_user_func_array(array($this,'getContents'), $args);
00016 
00017             case 'onEditorArea':
00018                 return call_user_func_array(array($this,'editorArea'), $args);
00019 
00020         }
00021     }
00022 
00027 private function init() {
00028     return <<<EOD
00029 <script type="text/javascript">
00030     function insertAtCursor(myField, myValue) {
00031         if (document.selection) {
00032             // IE support
00033             myField.focus();
00034             sel = document.selection.createRange();
00035             sel.text = myValue;
00036         } else if (myField.selectionStart || myField.selectionStart == '0') {
00037             // MOZILLA/NETSCAPE support
00038             var startPos = myField.selectionStart;
00039             var endPos = myField.selectionEnd;
00040             myField.value = myField.value.substring(0, startPos)
00041                 + myValue
00042                 + myField.value.substring(endPos, myField.value.length);
00043         } else {
00044             myField.value += myValue;
00045         }
00046     }
00047 </script>
00048 EOD;
00049 }
00055 private function getContents( $editorArea, $hiddenField ) {
00056     return <<<EOD
00057 EOD;
00058 }
00069 private function editorArea( $name, $content, $hiddenField, $width, $height, $col, $row ) {
00070 /*
00071 echo '<br />Name='.$name;
00072 echo '<br />Content='.$content;
00073 echo '<br />hiddenField='.$hiddenField;
00074 echo '<br />width='.$width;
00075 echo '<br />height='.$height;
00076 echo '<br />col='.$col;
00077 echo '<br />row='.$row;
00078 */
00079     $mhandler = aliroMambotHandler::getInstance();
00080     $results = $mhandler->trigger('onCustomEditorButton');
00081     $buttons = array();
00082     foreach ($results as $result) {
00083         $buttons[] = '<img src="'.aliroCore::getInstance()->getCfg('live_site').'/mambots/editors-xtd/'.$result[0].'" onclick="insertAtCursor( document.adminForm.'.$hiddenField.', \''.$result[1].'\' )" />';
00084     }
00085     $buttons = implode( "", $buttons );
00086     return <<<EOD
00087 <textarea name="$hiddenField" id="$hiddenField" cols="$col" rows="$row" style="width:{$width}px;height:{$height}px;">$content</textarea>
00088 <br />$buttons
00089 EOD;
00090 }
00091 
00092 }

Generated on Wed May 14 13:01:56 2008 for ALIRO by  doxygen 1.5.5