Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / elements / htmlarea.html
1 <%doc>
2
3 Example:
4
5   include('/elements/htmlarea.html',
6             'field'      => 'fieldname',
7             'curr_value' => $curr_value,
8             'height'     => 800,
9             'config'     => { extraPlugins => 'blockprotect' },
10          );
11
12 </%doc>
13
14 % #init
15 <SCRIPT TYPE="text/javascript" src="<% $p %>elements/ckeditor/ckeditor.js">
16 </SCRIPT>
17
18 % #editor
19 <textarea name="<% $opt{'field'} %>"><% $opt{'curr_value'} |h %></textarea>
20
21 <SCRIPT TYPE="text/javascript">
22
23   CKEDITOR.replace('<% $opt{'field'} %>',
24                    <% encode_json($config) %>
25   );
26
27 </SCRIPT>
28
29 <%init>
30
31 my %opt = @_;
32 my $config = {
33   'height'              => ($opt{height} || 420),
34   'startupFocus'        => JSON::true,
35   'skin'                => 'kama',
36   'toolbarCanCollapse'  => JSON::true,
37   'removePlugins'       => 'elementspath',
38   'basePath'            => $p.'elements/ckeditor/',
39   'enterMode'           => 2,
40   %{ $opt{config} || {} },
41 };
42 $config->{width} = $opt{width} if defined($opt{width});
43
44 </%init>