| 1 |
|
| 2 |
################################################################################### |
| 3 |
# |
| 4 |
# Embperl - Copyright (c) 1997-2008 Gerald Richter / ecos gmbh www.ecos.de |
| 5 |
# Embperl - Copyright (c) 2008-2014 Gerald Richter |
| 6 |
# |
| 7 |
# You may distribute under the terms of either the GNU General Public |
| 8 |
# License or the Artistic License, as specified in the Perl README file. |
| 9 |
# |
| 10 |
# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR |
| 11 |
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 12 |
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
# |
| 14 |
# $Id$ |
| 15 |
# |
| 16 |
################################################################################### |
| 17 |
|
| 18 |
package Embperl::Form::Control::tinymce ; |
| 19 |
|
| 20 |
use strict ; |
| 21 |
use base 'Embperl::Form::Control::textarea' ; |
| 22 |
|
| 23 |
use Embperl::Inline ; |
| 24 |
|
| 25 |
1 ; |
| 26 |
|
| 27 |
__EMBPERL__ |
| 28 |
|
| 29 |
[# --------------------------------------------------------------------------- |
| 30 |
# |
| 31 |
# show_control - output the control |
| 32 |
#] |
| 33 |
|
| 34 |
[$ sub show_control ($self, $req) |
| 35 |
|
| 36 |
my $options = $self -> {tinymce} || {} ; |
| 37 |
foreach my $k (keys %$options) |
| 38 |
{ |
| 39 |
my $v = $options -> {$k} ; |
| 40 |
$v =~ s/\'/\"/g ; |
| 41 |
$options -> {$k} = $v if ($v =~ s/%%(.+?)%%/$fdat{$1}/g) ; |
| 42 |
} |
| 43 |
$] |
| 44 |
|
| 45 |
[- $ctrlid = $self -> SUPER::show_control ($req) ; -] |
| 46 |
<script> |
| 47 |
$('#[+ $ctrlid +]').tinymce({ |
| 48 |
script_url : '/_appserv/js/tiny_mce/tiny_mce.js', |
| 49 |
theme : "advanced", |
| 50 |
//plugins : "table,insertdatetime,searchreplace,print,contextmenu,paste,fullscreen,noneditable", |
| 51 |
plugins : "insertdatetime,searchreplace,print,contextmenu,paste,fullscreen,noneditable,autoresize,inlinepopups", |
| 52 |
dialog_type : "modal", |
| 53 |
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", |
| 54 |
theme_advanced_buttons2 : '', //"print,cut,copy,pastetext,pasteword,selectall", |
| 55 |
theme_advanced_buttons3 : "", |
| 56 |
theme_advanced_toolbar_location : "top", |
| 57 |
theme_advanced_toolbar_align : "left", |
| 58 |
theme_advanced_path : false, |
| 59 |
//content_css : "example_full.css", |
| 60 |
plugin_insertdate_dateFormat : "%d.%m.%Y", |
| 61 |
plugin_insertdate_timeFormat : "%H:%M:%S", |
| 62 |
extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", |
| 63 |
theme_advanced_resizing : true, |
| 64 |
inline_styles : false, |
| 65 |
[$ foreach my $k (keys %$options) $] |
| 66 |
[+ $k +] : '[+ $options -> {$k} +]', |
| 67 |
[$endforeach$] |
| 68 |
onchange_callback : function () |
| 69 |
{ |
| 70 |
$('#[+ $ctrlid +]').trigger ('input_changed') ; |
| 71 |
} |
| 72 |
|
| 73 |
}); |
| 74 |
</script> |
| 75 |
[# |
| 76 |
<script language="javascript" type="text/javascript" src="/tiny_mce/tiny_mce.js"></script> |
| 77 |
[$ if $self -> {theme} ne 'big' $] |
| 78 |
<script language="javascript" type="text/javascript"> |
| 79 |
tinyMCE.init({ |
| 80 |
mode : "textareas", |
| 81 |
theme : "advanced", |
| 82 |
plugins : "table,insertdatetime,searchreplace,print,contextmenu,paste,fullscreen,noneditable", |
| 83 |
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,bullist,numlist,outdent,indent,undo,redo,link,unlink,image,code,hr,sub,sup,forecolor,backcolor,charmap,table", |
| 84 |
theme_advanced_buttons2 : "", |
| 85 |
theme_advanced_buttons3 : "", |
| 86 |
theme_advanced_toolbar_location : "top", |
| 87 |
theme_advanced_toolbar_align : "left", |
| 88 |
theme_advanced_path_location : "bottom", |
| 89 |
content_css : "example_full.css", |
| 90 |
plugin_insertdate_dateFormat : "%d.%m.%Y", |
| 91 |
plugin_insertdate_timeFormat : "%H:%M:%S", |
| 92 |
extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", |
| 93 |
xtheme_advanced_resize_horizontal : false, |
| 94 |
theme_advanced_resizing : true, |
| 95 |
editor_selector : "cBase cControl cMceEditor", |
| 96 |
width: "100%" |
| 97 |
}); |
| 98 |
</script> |
| 99 |
[$else$] |
| 100 |
<script language="javascript" type="text/javascript"> |
| 101 |
tinyMCE.init({ |
| 102 |
mode : "textareas", |
| 103 |
theme : "advanced", |
| 104 |
plugins : "table,insertdatetime,searchreplace,print,contextmenu,paste,fullscreen,noneditable", |
| 105 |
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", |
| 106 |
theme_advanced_buttons2 : "removeformat,formatselect,fontselect,fontsizeselect,fullscreen,insertdate,inserttime", |
| 107 |
theme_advanced_buttons3 : "", |
| 108 |
theme_advanced_toolbar_location : "top", |
| 109 |
theme_advanced_toolbar_align : "left", |
| 110 |
theme_advanced_path_location : "bottom", |
| 111 |
content_css : "example_full.css", |
| 112 |
plugin_insertdate_dateFormat : "%d.%m.%Y", |
| 113 |
plugin_insertdate_timeFormat : "%H:%M:%S", |
| 114 |
extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", |
| 115 |
xtheme_advanced_resize_horizontal : false, |
| 116 |
theme_advanced_resizing : true, |
| 117 |
editor_selector : "cBase cControl cMceEditor", |
| 118 |
width: "100%" |
| 119 |
}); |
| 120 |
</script> |
| 121 |
[$endif$] |
| 122 |
#] |
| 123 |
|
| 124 |
[$endsub$] |
| 125 |
|
| 126 |
__END__ |
| 127 |
|
| 128 |
=pod |
| 129 |
|
| 130 |
=head1 NAME |
| 131 |
|
| 132 |
Embperl::Form::Control::tinymce - A tinymce input control inside an Embperl Form |
| 133 |
|
| 134 |
|
| 135 |
=head1 SYNOPSIS |
| 136 |
|
| 137 |
{ |
| 138 |
type => 'tinymce', |
| 139 |
text => 'blabla', |
| 140 |
name => 'foo', |
| 141 |
rows => 10, |
| 142 |
cols => 80, |
| 143 |
} |
| 144 |
|
| 145 |
=head1 DESCRIPTION |
| 146 |
|
| 147 |
Used to create an input control inside an Embperl Form. |
| 148 |
See Embperl::Form on how to specify parameters. |
| 149 |
|
| 150 |
=head2 PARAMETER |
| 151 |
|
| 152 |
=head3 type |
| 153 |
|
| 154 |
Needs to be 'tinymce' |
| 155 |
|
| 156 |
=head3 text |
| 157 |
|
| 158 |
Will be used as label for the text input control |
| 159 |
|
| 160 |
=head3 cols |
| 161 |
|
| 162 |
Number of columns |
| 163 |
|
| 164 |
=head3 rows |
| 165 |
|
| 166 |
Number of rows |
| 167 |
|
| 168 |
=head1 Author |
| 169 |
|
| 170 |
G. Richter (richter at embperl dot org) |
| 171 |
|
| 172 |
=head1 See Also |
| 173 |
|
| 174 |
perl(1), Embperl, Embperl::Form |
| 175 |
|
| 176 |
|