1 | <?php |
---|
2 | |
---|
3 | // détermination du chemin de base par rapport à la racine du serveur |
---|
4 | $p=explode(basename(_DIR_PLUGINS)."/",str_replace('\\',/*'*/'/',realpath(dirname(__FILE__)))); |
---|
5 | define('_DIR_RELATIF_PLUGIN_FCKEDITOR',str_replace('../','',(_DIR_PLUGINS.end($p)))); |
---|
6 | |
---|
7 | $dir_relatif_array = split('/', $_SERVER["PHP_SELF"]); |
---|
8 | $i = 0; |
---|
9 | while($dir_relatif_array[$i] != 'ecrire') |
---|
10 | { |
---|
11 | $dir_relatif .= $dir_relatif_array[$i]."/"; |
---|
12 | $i++; |
---|
13 | } |
---|
14 | define('_DIR_PLUGIN_ABS_FCKEDITOR',$dir_relatif._DIR_RELATIF_PLUGIN_FCKEDITOR); |
---|
15 | |
---|
16 | function fckeditor_header_prive($flux) { |
---|
17 | |
---|
18 | global $exec; |
---|
19 | |
---|
20 | $code = ''; |
---|
21 | $langue = ($GLOBALS['_COOKIE']['spip_lang_ecrire'] != '') ? $GLOBALS['_COOKIE']['spip_lang_ecrire'] : 'fr'; |
---|
22 | |
---|
23 | if($exec=='articles_edit' || $exec=='breves_edit' || $exec=='rubriques_edit') { |
---|
24 | $code=' |
---|
25 | $("textarea[@name=texte]").after("<div id=\"fckeditor_div\"><input id=\"_BtnSwitchTextarea\" type=\"button\" value=\"'._T("fckeditor:texte_editeur_standard").'\" onclick=\"Toggle()\" /><textarea id=\"fckeditor_data\" cols=\"40\" rows=\"20\">"+$("textarea[@name=texte]").val()+"</textarea></div>"); |
---|
26 | $(".spip_barre").before("<input type=\"button\" value=\"'._T("fckeditor:texte_editeur_avance").'\" id=\"fckeditor_switch\" onclick=\"Toggle()\" />"); |
---|
27 | $("textarea[@name=texte]").css("display", "none"); |
---|
28 | $("#fckeditor_switch").css("display", "none"); |
---|
29 | $(document.forms["formulaire"]).bind("submit", PrepareSave); |
---|
30 | $(".spip_barre").css("display", "none"); |
---|
31 | var oFCKeditor = new FCKeditor( "fckeditor_data" , "100%", "600", "Spip") ; |
---|
32 | oFCKeditor.BasePath = "'._DIR_PLUGIN_FCKEDITOR.'/fckeditor/" ; |
---|
33 | oFCKeditor.Config["CustomConfigurationsPath"] = "'._DIR_PLUGIN_ABS_FCKEDITOR.'/spip_fck/fckconfig.php?path='._DIR_PLUGIN_ABS_FCKEDITOR.'&" + ( new Date() * 1 ) ; |
---|
34 | oFCKeditor.Config[ "AutoDetectLanguage" ] = false ; |
---|
35 | oFCKeditor.Config[ "DefaultLanguage" ] = "'.$langue.'" ; |
---|
36 | '; |
---|
37 | } |
---|
38 | |
---|
39 | switch ($exec) { |
---|
40 | case 'articles_edit': |
---|
41 | $code.=' |
---|
42 | oFCKeditor.ToolbarSet = "BarreArticle"; |
---|
43 | '; |
---|
44 | break; |
---|
45 | case 'breves_edit': |
---|
46 | $code.=' |
---|
47 | oFCKeditor.ToolbarSet = "BarreBreve"; |
---|
48 | '; |
---|
49 | break; |
---|
50 | case 'rubriques_edit': |
---|
51 | $code.=' |
---|
52 | oFCKeditor.ToolbarSet = "BarreRubrique"; |
---|
53 | '; |
---|
54 | break; |
---|
55 | } |
---|
56 | |
---|
57 | $code .= ' |
---|
58 | oFCKeditor.ReplaceTextarea()'; |
---|
59 | |
---|
60 | if(!empty($code)) { |
---|
61 | $code=' |
---|
62 | <script type="text/javascript" src="'._DIR_PLUGIN_FCKEDITOR.'fckeditor/fckeditor.js"></script> |
---|
63 | <script type="text/javascript" src="'._DIR_PLUGIN_FCKEDITOR.'spip_fck/switch.js"></script> |
---|
64 | <script type="text/javascript"><!-- |
---|
65 | $(document).ready(function () { |
---|
66 | '.$code.' |
---|
67 | }); |
---|
68 | //--> |
---|
69 | |
---|
70 | </script>'; |
---|
71 | return $flux.$code; |
---|
72 | } |
---|
73 | |
---|
74 | return $flux; |
---|
75 | } |
---|
76 | |
---|
77 | ?> |
---|