1fff09e145d66d0a5288885e5485718ebd667393
[Plinn.git] / skins / generic / wysiwyg_support.pt
1 <html i18n:domain="plinn">
2
3 <div metal:define-macro="wysiwygEditorBox"
4 tal:omit-tag="">
5
6
7 <textarea cols="80" rows="25"
8 tal:content="inputvalue"
9 tal:define="defaultStyle string:width: 99%;; height: 450px;; margin-top: 2px;; border: 1px solid #8cacbb;;;
10 style style|defaultStyle;"
11 tal:attributes="name inputname;
12 id inputname;
13 rows rows|default;
14 cols cols|default;
15 style style"></textarea>
16 <div>
17 <script type="text/javascript" tal:attributes="src string:$portal_url/ckeditor/ckeditor.js"></script>
18 <script type="text/javascript" tal:content="structure python:'''
19 CKEDITOR.replace('%(inputname)s');
20 CKEDITOR.instances['%(inputname)s'].contentPath = '%(contentPath)s';
21 (function(){
22 var ckForm = document.getElementById('%(inputname)s').form;
23 if ((AJAX_CONFIG & 2) == 2) {
24 var formManager = new FormManager(ckForm, document.getElementById('mainCell'));
25 formManager.onBeforeSubmit = function(manager) {
26 var editor = CKEDITOR.instances['%(inputname)s'];
27 editor.updateElement();
28 };
29 }
30 })();
31 ''' % {'inputname' : inputname, 'contentPath' : here.absolute_url(relative=1)}">
32 </script>
33 </div>
34 </div>
35
36 <div metal:define-macro="textFormatSelector"
37 tal:define="wysiwyg python: here.portal_membership.getAuthenticatedMember().getProperty('wysiwyg_editor')!='None';
38 text_format python: getattr(here,'text_format','html')"
39 tal:omit-tag="" i18n:domain="plinn">
40 <input type="hidden" name="text_format" value="html" tal:condition="wysiwyg" />
41
42 <div tal:condition="not: wysiwyg">
43 <label i18n:translate="">Format</label><br/>
44 <label>
45 <input type="radio" name="text_format" value="structured-text"
46 tal:attributes="checked python:test(text_format=='structured-text', 1, None);" />
47 <span i18n:translate="" tal:omit-tag="">Structured text</span>
48 </label><br />
49
50 <label>
51 <input type="radio" name="text_format" value="html"
52 tal:attributes="checked python:test(text_format=='html', 1, None)" />
53 <span i18n:translate="" tal:omit-tag="">HTML</span>
54 </label><br />
55
56 <label>
57 <input type="radio" name="text_format" value="plain"
58 tal:attributes="checked python:test(text_format=='plain', 1, None);" />
59 <span i18n:translate="" tal:omit-tag="">Plain text</span>
60 </label>
61 </div>
62 </div>
63
64 </html>