2 rcs_id('$Id: Wikiwyg.php,v 1.6 2006-08-25 22:42:51 rurban Exp $');
4 * Wikiwyg is compatible with most internet browsers which
5 * include: IE 5.5+ (Windows), Firefox 1.0+, Mozilla 1.3+
8 * Download: http://openjsan.org/doc/i/in/ingy/Wikiwyg/
9 * Suggested installation into themes/default/Wikiwyg/
11 * @package WysiwygEdit
12 * @author Reini Urban, based on a patch by Jean-Nicolas GEREONE, STMicroelectronics, 2006
15 require_once("lib/WysiwygEdit.php");
17 class WysiwygEdit_Wikiwyg extends WysiwygEdit {
19 function WysiwygEdit_Wikiwyg() {
21 $this->_transformer_tags = false;
22 $this->BasePath = DATA_PATH.'/themes/default/Wikiwyg';
23 $this->_htmltextid = "edit:content";
24 $this->_wikitextid = "editareawiki";
26 var base_url = '".DATA_PATH."';
27 var data_url = '$this->BasePath';
28 var script_url = '".deduce_script_name()."';
32 function Head($name='edit[content]') {
34 foreach (array("Wikiwyg.js","Wikiwyg/Toolbar.js","Wikiwyg/Preview.js","Wikiwyg/Wikitext.js",
35 "Wikiwyg/Wysiwyg.js","Wikiwyg/Phpwiki.js","Wikiwyg/HTML.js",
36 "Wikiwyg/Toolbar.js") as $js) {
37 $WikiTheme->addMoreHeaders
38 (Javascript('', array('src' => $this->BasePath . '/' . $js,
39 'language' => 'JavaScript')));
41 $doubleClickToEdit = ($GLOBALS['request']->getPref('doubleClickEdit') or ENABLE_DOUBLECLICKEDIT)
43 return JavaScript($this->_jsdefault . "
44 window.onload = function() {
45 var wikiwyg = new Wikiwyg.Phpwiki();
47 doubleClickToEdit: $doubleClickToEdit,
48 javascriptLocation: base_url+'/themes/default/Wikiwyg/',
50 imagesLocation: base_url+'/themes/default/Wikiwyg/images/',
52 'save','preview','|','save_button','|',
56 'bold', 'italic', '|',
61 'ordered', 'unordered','hr','|',
66 'label', 'p', 'h2', 'h3', 'h4', 'pre'
69 save: '"._("Apply changes")."',
70 cancel: '"._("Exit toolbar")."',
71 h2: '"._("Title 1")."',
72 h3: '"._("Title 2")."',
73 h4: '"._("Title 3")."',
74 verbatim: '"._("Verbatim")."',
75 toc: '"._("Table of content")."',
76 wikitext: '"._("Insert Wikitext section")."',
79 preview: '"._("Preview")."',
80 save_button:'"._("Save")."'
87 supportCamelCaseLinks: true
90 var div = document.getElementById(\"" . $this->_htmltextid . "\");
91 wikiwyg.createWikiwygArea(div, config);
92 wikiwyg_divs.push(wikiwyg);
97 function Textarea ($textarea, $wikitext, $name='edit[content]') {
98 $htmltextid = $this->_htmltextid;
99 $textarea->SetAttr('id', $htmltextid);
100 $iframe0 = new RawXml('<iframe id="iframe0" height="0" width="0" frameborder="0"></iframe>');
101 $out = HTML(HTML::div(array('class' => 'hint'),
102 _("Warning: This Wikiwyg editor has only Beta quality!")),
110 * Handler to convert the Wiki Markup to HTML before editing.
111 * This will be converted back by WysiwygEdit_ConvertAfter if required.
112 * *text* => '<b>text<b>'
114 function ConvertBefore($text) {
119 * No special PHP HTML->Wikitext conversion needed. This is done in js thanksfully.
120 * Avoided in editpage.php: PageEditor->getContent
122 function ConvertAfter($text) {
123 return TransformInline($text);
129 $Log: not supported by cvs2svn $
130 Revision 1.5 2006/06/28 14:28:14 jeannicolas
133 Add preview and save button on the toolbar.
134 Fix an IE issue in wikitext mode.
136 Revision 1.4 2006/06/19 17:33:06 jeannicolas
138 Add button to insert table of content plugin
139 Add button to insert wikitext section in wysiwyg mode
141 Fix internet explorer issue in wikitext mode. The toolbar in this mode didn't work.
143 Revision 1.3 2006/05/31 19:59:57 jeannicolas
146 Added wysiwyg_editor 1.1b
148 Revision 1.2 2006/05/14 17:52:20 rurban
149 fix syntax error. delete a left-over attempt to add CSS links also. We did put everything into phpwiki.css for browser compatibility.
151 Revision 1.1 2006/05/13 19:59:55 rurban
152 added wysiwyg_editor-1.3a feature by Jean-Nicolas GEREONE <jean-nicolas.gereone@st.com>
153 converted wysiwyg_editor-1.3a js to WysiwygEdit framework
154 changed default ENABLE_WYSIWYG = true and added WYSIWYG_BACKEND = Wikiwyg
163 // c-hanging-comment-ender-p: nil
164 // indent-tabs-mode: nil