2 rcs_id('$Id: Wikiwyg.php,v 1.5 2006-06-28 14:28:14 jeannicolas 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($textarea,
108 * Handler to convert the Wiki Markup to HTML before editing.
109 * This will be converted back by WysiwygEdit_ConvertAfter if required.
110 * *text* => '<b>text<b>'
112 function ConvertBefore($text) {
117 * No special PHP HTML->Wikitext conversion needed. This is done in js thanksfully.
118 * Avoided in editpage.php: PageEditor->getContent
120 function ConvertAfter($text) {
121 return TransformInline($text);
127 $Log: not supported by cvs2svn $
128 Revision 1.4 2006/06/19 17:33:06 jeannicolas
130 Add button to insert table of content plugin
131 Add button to insert wikitext section in wysiwyg mode
133 Fix internet explorer issue in wikitext mode. The toolbar in this mode didn't work.
135 Revision 1.3 2006/05/31 19:59:57 jeannicolas
138 Added wysiwyg_editor 1.1b
140 Revision 1.2 2006/05/14 17:52:20 rurban
141 fix syntax error. delete a left-over attempt to add CSS links also. We did put everything into phpwiki.css for browser compatibility.
143 Revision 1.1 2006/05/13 19:59:55 rurban
144 added wysiwyg_editor-1.3a feature by Jean-Nicolas GEREONE <jean-nicolas.gereone@st.com>
145 converted wysiwyg_editor-1.3a js to WysiwygEdit framework
146 changed default ENABLE_WYSIWYG = true and added WYSIWYG_BACKEND = Wikiwyg
155 // c-hanging-comment-ender-p: nil
156 // indent-tabs-mode: nil