[ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 /** 3 * The Editor_htmlarea:: class provides an WYSIWYG editor for use 4 * in the Horde Framework. 5 * 6 * $Horde: framework/Editor/Editor/htmlarea.php,v 1.24.4.4 2006/01/01 21:28:14 jan Exp $ 7 * 8 * Copyright 2003-2006 Nuno Loureiro <nuno@co.sapo.pt> 9 * Copyright 2004-2006 Jan Schneider <jan@horde.org> 10 * 11 * See the enclosed file COPYING for license information (LGPL). If you 12 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 13 * 14 * @author Nuno Loureiro <nuno@co.sapo.pt> 15 * @author Jan Schneider <jan@horde.org> 16 * @since Horde 3.0 17 * @package Horde_Editor 18 */ 19 class Horde_Editor_htmlarea extends Horde_Editor { 20 21 /** 22 * Constructor. Include the necessary javascript files. 23 */ 24 function Horde_Editor_htmlarea($params = array()) 25 { 26 global $registry, $notification, $prefs; 27 28 Horde::addScriptFile('htmlarea.js', 'horde'); 29 Horde::addScriptFile('/services/editor/htmlarea/htmlarea.js', 'horde', true); 30 $script = Horde::url(Util::addParameter($registry->get('webroot', 'horde') . '/services/javascript.php', 'app', 'horde'), true); 31 $js = 'HTMLArea.loadScript("' . Util::addParameter($script, 'file', 'htmlarea_lang.js', false) . '"); '; 32 33 $plugins = ''; 34 if ($prefs->getValue('tableoperations')) { 35 $js .= 'HTMLArea.loadPlugin("TableOperations"); ' . 36 'HTMLArea.loadScript("' . Util::addParameter($script, 'file', 'htmlarea_table_lang.js', false) . '"); '; 37 $plugins .= 'editor.registerPlugin(TableOperations); '; 38 } 39 if ($prefs->getValue('contextmenu')) { 40 $js .= 'HTMLArea.loadPlugin("ContextMenu"); ' . 41 'HTMLArea.loadScript("' . Util::addParameter($script, 'file', 'htmlarea_context_lang.js', false) . '"); '; 42 $plugins .= 'editor.registerPlugin(ContextMenu); '; 43 } 44 if ($prefs->getValue('listtype')) { 45 $js .= 'HTMLArea.loadPlugin("ListType"); ' . 46 'HTMLArea.loadScript("' . Util::addParameter($script, 'file', 'htmlarea_listtype_lang.js', false) . '"); '; 47 $plugins .= 'editor.registerPlugin(ListType); '; 48 } 49 if ($prefs->getValue('anselimage') && $registry->hasMethod('images/listGalleries')) { 50 $js .= 'HTMLArea.loadPlugin("AnselImage"); ' . 51 'HTMLArea.loadScript("' . Util::addParameter($script, 'file', 'htmlarea_anselimage_lang.js', false) . '"); '; 52 $plugins .= 'editor.registerPlugin(AnselImage); '; 53 } 54 55 $js .= 'HTMLArea.onload = function() { ' . 56 'var config = new HTMLArea.Config() ;' . 57 'config.debug = false; ' . 58 'config.hideSomeButtons(" showhelp "); '; 59 if (isset($params['config'])) { 60 foreach ($params['config'] as $config => $value) { 61 $js .= 'config.' . $config . ' = "' . addslashes($value) . '";'; 62 } 63 } 64 65 if (isset($params['id'])) { 66 $js .= 'var textareas = [document.getElementById("' . $params['id'] . '")]; '; 67 } else { 68 $js .= 'var textareas = document.getElementsByTagName("textarea"); '; 69 } 70 $js .= 'for (var i = textareas.length - 1; i >= 0; i--) { ' . 71 'var editor = new HTMLArea(textareas[i], config); ' . 72 $plugins . 73 'editor.generate()}}; ' . 74 'HTMLArea.init();'; 75 76 $notification->push($js, 'javascript'); 77 } 78 79 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |