You are not logged in Log in Join
You are here: Home » Members » hewei » Zope RPMs for RedHat » Plone 2.0 » Customized wysiwyg_support.pt » View Document

Log in
Name

Password

 

Customized wysiwyg_support.pt


 <html i18n:domain="plone">
 
 <div metal:define-macro="wysiwygEditorBox">
 
 <tal:block tal:define="preferredEditor python:here.portal_membership.getAuthenticatedMember().getProperty('wysiwyg_editor');
                        useCMFVE python:preferredEditor=='Visual Editor' and exists('here/visualeditor_edit')
                                 and request.environ.get('HTTP_USER_AGENT').count('MSIE')>0;
                        useEpoz python:preferredEditor=='Epoz' and exists('here/epoz_toolbox');
                        text_format python:request.get('text_format', getattr(here,'text_format','structured-text'));
                        is_html python:'html' in text_format">
 
   <tal:block tal:condition="useEpoz">
 
     <tal:block tal:define="ztu modules/ZTUtils;
                            pss modules/Products/PythonScripts/standard;
                            getProperty python: here.stylesheet_properties.getProperty;
                            current_skin python: ztu.make_query(skin=request.get(here.portal_skins.getRequestVarname(), ''));"
 
                tal:replace="structure python: here.Epoz(
                                       inputname,
                                       data = inputvalue,
                                       toolbox = here.absolute_url() + '/epoz_toolbox',
                                       lang = here.portal_properties.site_properties.default_language,
                                       style = 'width: 99%%; height: 450px; margin-top: 2px; border: %s;' % (getProperty('preBorder','1px solid #8cacbb'),),
                                       button = 'background-color: %s; border: 1px solid %s; cursor: pointer; margin-right: 1px; margin-bottom: 1px;' % (
                                                getProperty('contentTabBackground','#CDE2A7'),
                                                getProperty('contentTabFontColor','#578308'),),
                                       path = here.portal_url() + '/',
                                       css = here.portal_url()+'/plone.css?'+pss.url_quote(current_skin),
                                       charset = here.portal_properties.site_properties.default_charset,
                                       pageurl = here.absolute_url())">
     </tal:block>
 
     <script language="javascript" tal:content="structure string://<!--
       var EpozModeSwitch = document.getElementById('EpozViewMode'),
           EpozToolbar = document.getElementById('EpozToolbar'),
           EpozTextarea = document.getElementById('${inputname}');
 
       function switchEditor(wysiwyg) {
           if (EpozModeSwitch.checked == wysiwyg) {
               SwitchViewMode(!wysiwyg);
               EpozModeSwitch.checked = !wysiwyg;
               EpozModeSwitch.style.display = wysiwyg ? 'inline' : 'none';
           }
       }
       if ('${is_html}' == 'False') { // ${text_format}
           if (!EpozModeSwitch.checked) {
               EpozToolbar.style.display = 'none';
               EpozModeSwitch.checked = true;
               EpozModeSwitch.style.display = 'none';
               EpozTextarea.value = form_data;
               EpozTextarea.style.display = 'inline';
           }
       }
       //-->
 "></script>
 
   </tal:block>
 
   <tal:block tal:define="editorURL python:'visualeditor_edit?BASEURL='+path('here/portal_url')+'&inputname='+inputname"
              tal:condition="not:useEpoz">
     <iframe name="visedit"
             tal:condition="useCMFVE"
             tal:define="width width | string:507px;
                         height height | string:400px;
                         initialdisp python:test(is_html, 'inline', 'none')"
             tal:attributes="src python:test(is_html, editorURL, '');
                             style string:width: ${width};; height: ${height};; border: solid gray 1px;; display: ${initialdisp}"></iframe>
 
     <textarea cols="80"
               rows="25"
               tabindex=""
               name="description"
               tal:content="inputvalue"
               tal:attributes="name inputname;
                             id inputname;
                             onfocus onfocus|nothing;
                             onblur onblur|nothing;
                             tabindex tabindex|nothing;
                             style python:test(useCMFVE and is_html, 'display:none', 'display:inline');
                             rows rows|default;
                             cols cols|default;"></textarea>
 
   <script language="javascript" 
           tal:content="structure string://<!--
     var reloadURL = '${is_html}' == 'False' ? '${editorURL}' : '', // ${text_format}
         CMFVETextarea = document.getElementById('${inputname}');
         CMFVEFrame = document.getElementById('visedit');
 
     function switchEditor(wysiwyg) {
         if ('${useCMFVE}' == 'True') {
             if (wysiwyg) {
                 document.frames['visedit'].initialDocComplete = false; 
                 CMFVEFrame.style.display = 'inline';
                 CMFVETextarea.style.display = 'none';
                 if (reloadURL != '') {
                     document.frames['visedit'].location.href = reloadURL;
                     reloadURL = '';
                 }
             } else {
                 CMFVEFrame.style.display = 'none';
                 CMFVETextarea.style.display = 'inline';
             }
         }
     }
     //-->
 "></script>
 
 
   </tal:block>
 
 </tal:block>
 
 </div>
 
 
 <div metal:define-macro="textFormatSelector"
      class="field"
      tal:define="tabindex tabindex/next;
                  text_format python:request.get('text_format', getattr(here,'text_format','structured-text'))">
 
     <label for="text_format" i18n:translate="label_format">Format</label>
 
     <div class="formHelp" i18n:translate="help_format_wysiwyg">
     If you are unsure of which format to use, just select Plain
     Text and type the document as you usually do.
     </div>
 
     <input class="noborder"
            type="radio"
            name="text_format"
            value="structured-text"
            tabindex=""
            id="cb_structuredtext"
            onclick="switchEditor(false)"
            tal:attributes="checked python:test(text_format=='structured-text', 1, None);
                            tabindex tabindex;"
            />
     <label for="cb_structuredtext" i18n:translate="structured_text">Structured Text</label> <br />
 
     <input class="noborder"
            type="radio"
            name="text_format"
            value="html"
            tabindex=""
            id="cb_html"
            onclick="switchEditor(true)"
            tal:attributes="checked python:test(text_format=='html', 1, None);
                            tabindex tabindex;"
            />
     <label for="cb_html" i18n:translate="html">HTML</label> <br />
 
     <input class="noborder"
            type="radio"
            name="text_format"
            value="plain"
            tabindex=""
            id="cb_plain"
            onclick="switchEditor(false)"
            tal:attributes="checked python:test(text_format=='plain', 1, None);
                            tabindex tabindex;"
            />
     <label for="cb_plain" i18n:translate="plain_text">Plain Text</label>
 
 </div>
 
 </html>