| 1 | |||
| 2 | ################################################################################### | ||
| 3 | # | ||
| 4 | # Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de | ||
| 5 | # Embperl - Copyright (c) 2008-2015 Gerald Richter | ||
| 6 | # Embperl - Copyright (c) 2015-2023 actevy.io | ||
| 7 | # | ||
| 8 | # You may distribute under the terms of either the GNU General Public | ||
| 9 | # License or the Artistic License, as specified in the Perl README file. | ||
| 10 | # | ||
| 11 | # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR | ||
| 12 | # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | ||
| 13 | # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
| 14 | # | ||
| 15 | # $Id$ | ||
| 16 | # | ||
| 17 | ################################################################################### | ||
| 18 | |||
| 19 | package Embperl::Form::Control::tinymce ; | ||
| 20 | |||
| 21 | use strict ; | ||
| 22 | use base 'Embperl::Form::Control::textarea' ; | ||
| 23 | |||
| 24 | use Embperl::Inline ; | ||
| 25 | |||
| 26 | 1 ; | ||
| 27 | |||
| 28 | __EMBPERL__ | ||
| 29 | |||
| 30 | [# --------------------------------------------------------------------------- | ||
| 31 | # | ||
| 32 | # show_control - output the control | ||
| 33 | #] | ||
| 34 | |||
| 35 | [$ sub show_control ($self, $req) | ||
| 36 | |||
| 37 | my $options = $self -> {tinymce} || {} ; | ||
| 38 | foreach my $k (keys %$options) | ||
| 39 | { | ||
| 40 | my $v = $options -> {$k} ; | ||
| 41 | $v =~ s/\'/\"/g ; | ||
| 42 | $options -> {$k} = $v if ($v =~ s/%%(.+?)%%/$fdat{$1}/g) ; | ||
| 43 | } | ||
| 44 | $] | ||
| 45 | |||
| 46 | [- $ctrlid = $self -> SUPER::show_control ($req) ; -] | ||
| 47 | <script> | ||
| 48 | $('#[+ $ctrlid +]').tinymce({ | ||
| 49 | script_url : '/_appserv/js/tiny_mce/tiny_mce.js', | ||
| 50 | theme : "advanced", | ||
| 51 | //plugins : "table,insertdatetime,searchreplace,print,contextmenu,paste,fullscreen,noneditable", | ||
| 52 | plugins : "insertdatetime,searchreplace,print,contextmenu,paste,fullscreen,noneditable,autoresize,inlinepopups", | ||
| 53 | dialog_type : "modal", | ||
| 54 | theme_advanced_buttons1 : "bold,italic,underline,strikethrough,styleselect,bullist,numlist,outdent,indent,undo,redo,link,unlink,image,sub,sup,charmap,insertdate,inserttime,search,replace,fullscreen", | ||
| 55 | theme_advanced_buttons2 : '', //"print,cut,copy,pastetext,pasteword,selectall", | ||
| 56 | theme_advanced_buttons3 : "", | ||
| 57 | theme_advanced_toolbar_location : "top", | ||
| 58 | theme_advanced_toolbar_align : "left", | ||
| 59 | theme_advanced_path : false, | ||
| 60 | //content_css : "example_full.css", | ||
| 61 | plugin_insertdate_dateFormat : "%d.%m.%Y", | ||
| 62 | plugin_insertdate_timeFormat : "%H:%M:%S", | ||
| 63 | extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", | ||
| 64 | theme_advanced_resizing : true, | ||
| 65 | inline_styles : false, | ||
| 66 | [$ foreach my $k (keys %$options) $] | ||
| 67 | [+ $k +] : '[+ $options -> {$k} +]', | ||
| 68 | [$endforeach$] | ||
| 69 | onchange_callback : function () | ||
| 70 | { | ||
| 71 | $('#[+ $ctrlid +]').trigger ('input_changed') ; | ||
| 72 | } | ||
| 73 | |||
| 74 | }); | ||
| 75 | </script> | ||
| 76 | [# | ||
| 77 | <script language="javascript" type="text/javascript" src="/tiny_mce/tiny_mce.js"></script> | ||
| 78 | [$ if $self -> {theme} ne 'big' $] | ||
| 79 | <script language="javascript" type="text/javascript"> | ||
| 80 | tinyMCE.init({ | ||
| 81 | mode : "textareas", | ||
| 82 | theme : "advanced", | ||
| 83 | plugins : "table,insertdatetime,searchreplace,print,contextmenu,paste,fullscreen,noneditable", | ||
| 84 | theme_advanced_buttons1 : "bold,italic,underline,strikethrough,bullist,numlist,outdent,indent,undo,redo,link,unlink,image,code,hr,sub,sup,forecolor,backcolor,charmap,table", | ||
| 85 | theme_advanced_buttons2 : "", | ||
| 86 | theme_advanced_buttons3 : "", | ||
| 87 | theme_advanced_toolbar_location : "top", | ||
| 88 | theme_advanced_toolbar_align : "left", | ||
| 89 | theme_advanced_path_location : "bottom", | ||
| 90 | content_css : "example_full.css", | ||
| 91 | plugin_insertdate_dateFormat : "%d.%m.%Y", | ||
| 92 | plugin_insertdate_timeFormat : "%H:%M:%S", | ||
| 93 | extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", | ||
| 94 | xtheme_advanced_resize_horizontal : false, | ||
| 95 | theme_advanced_resizing : true, | ||
| 96 | editor_selector : "cBase cControl cMceEditor", | ||
| 97 | width: "100%" | ||
| 98 | }); | ||
| 99 | </script> | ||
| 100 | [$else$] | ||
| 101 | <script language="javascript" type="text/javascript"> | ||
| 102 | tinyMCE.init({ | ||
| 103 | mode : "textareas", | ||
| 104 | theme : "advanced", | ||
| 105 | plugins : "table,insertdatetime,searchreplace,print,contextmenu,paste,fullscreen,noneditable", | ||
| 106 | theme_advanced_buttons1 : "bold,italic,underline,strikethrough,bullist,numlist,outdent,indent,undo,redo,link,unlink,image,code,hr,sub,sup,forecolor,backcolor,charmap,anchor,table,search,replace", | ||
| 107 | theme_advanced_buttons2 : "removeformat,formatselect,fontselect,fontsizeselect,fullscreen,insertdate,inserttime", | ||
| 108 | theme_advanced_buttons3 : "", | ||
| 109 | theme_advanced_toolbar_location : "top", | ||
| 110 | theme_advanced_toolbar_align : "left", | ||
| 111 | theme_advanced_path_location : "bottom", | ||
| 112 | content_css : "example_full.css", | ||
| 113 | plugin_insertdate_dateFormat : "%d.%m.%Y", | ||
| 114 | plugin_insertdate_timeFormat : "%H:%M:%S", | ||
| 115 | extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", | ||
| 116 | xtheme_advanced_resize_horizontal : false, | ||
| 117 | theme_advanced_resizing : true, | ||
| 118 | editor_selector : "cBase cControl cMceEditor", | ||
| 119 | width: "100%" | ||
| 120 | }); | ||
| 121 | </script> | ||
| 122 | [$endif$] | ||
| 123 | #] | ||
| 124 | |||
| 125 | [$endsub$] | ||
| 126 | |||
| 127 | __END__ |