]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WysiwygEdit/htmlarea2.php
Activated Id substitution for Subversion
[SourceForge/phpwiki.git] / lib / WysiwygEdit / htmlarea2.php
1 <?php
2 rcs_id('$Id$');
3 /**
4  * requires installation into themes/default/htmlarea2/
5  * Output the javascript function to check for MS Internet Explorer >= 5.5 on Windows
6  * and call the real js script then, else just a nil func.
7  *   version 2: only for MSIE 5.5 and better
8  *   version 3: also Mozilla >= 1.3
9  *
10  * @package WysiwygEdit
11  * @author Reini Urban
12  */
13
14 require_once("lib/WysiwygEdit.php");
15
16 class WysiwygEdit_htmlarea2 extends WysiwygEdit {
17
18     function Head($name='edit[content]') {
19         //if (isBrowserIE() and browserVersion() >= 5.5) return $this->Head_IEonly();
20
21         return JavaScript("
22 _editor_url = \"".DATA_PATH."/themes/default/htmlarea2/\";
23 var win_ie_ver = parseFloat(navigator.appVersion.split(\"MSIE\")[1]);
24 if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
25 if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
26 if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
27 if (win_ie_ver >= 5.5) {
28   document.write('<scr' + 'ipt src=\"' +_editor_url+ 'editor.js\"');
29   document.write(' language=\"Javascript1.2\"></scr' + 'ipt>');
30 } else {
31   document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); 
32 }
33  ",
34                     array('version' => 'JavaScript1.2',
35                           'type' => 'text/javascript'));
36     }
37
38     // to be called after </textarea>
39     // version 2
40     function Textarea($textarea,$wikitext,$name='edit[content]') {
41         $out = HTML($textarea);
42         // some more custom links 
43         //$out->pushContent(HTML::a(array('href'=>"javascript:editor_insertHTML('".$name."',\"<font style='background-color: yellow'>\",'</font>',1)"),_("Highlight selected text")));
44         //$out->pushContent(HTML("\n"));
45         $out->pushContent(JavaScript("editor_generate('".$name."');",
46                                      array('version' => 'JavaScript1.2',
47                                            'defer' => 1)));
48         return $out;
49         //return "\n".'<script language="JavaScript1.2" defer> editor_generate(\'CONTENT\'); </script>'."\n";
50     }
51
52     // for testing only
53     function Head_IEonly() {
54         return HTML(JavaScript("_editor_url = \"".DATA_PATH."/themes/default/htmlarea2/\""),
55                     "\n",
56                     JavaScript("",
57                                array('version' => 'JavaScript1.2',
58                                      'type' => 'text/javascript',
59                                      'src' => DATA_PATH."/themes/default/htmlarea2/editor.js")));
60     }
61
62 }
63
64 /*
65  $Log: not supported by cvs2svn $
66  Revision 1.1  2005/10/30 14:22:15  rurban
67  refactor WysiwygEdit
68
69
70 */
71
72 // Local Variables:
73 // mode: php
74 // tab-width: 8
75 // c-basic-offset: 4
76 // c-hanging-comment-ender-p: nil
77 // indent-tabs-mode: nil
78 // End:
79 ?>