[Zope-CMF] LocalFS and IEeditor...

Jon Edwards jon@pcgs.freeserve.co.uk
Wed, 12 Dec 2001 16:47:51 -0000


> -----Original Message-----
> From: Paul Everitt [mailto:paul@zope.com]

> Can you describe what you did to make it work with CMF Document (i.e.
> did you make an option in preferences, did you implement it in the skin,

OK, here goes... as far as I remember. Needs tidying in a few places :-)

To use it for editing CMF Documents -

1. Create a new Folder in your portal_skins folder called "ieeditor" and
copy all the ieeditor stuff in.

2. Add "ieeditor" to the list of layers/folders in portal_skins Properties
tab (probably just after "custom")

3. Customise your document_edit_form and add -

---------------------------------------------------------------------------

<dtml-call "REQUEST.set('ua',HTTP_USER_AGENT)">

<dtml-if "_.string.find(ua,'MSIE') >=0">

<form action="document_edit" method="post" enctype="multipart/form-data">

<input type="hidden" name="SafetyBelt" value="&dtml-SafetyBelt;">
<input type="hidden" name="id" value="<dtml-var id>">
<input type="hidden" name="title" value="<dtml-var title html_quote>">
<input type="radio" name="text_format" value="html" STYLE="display:none"
          checked id="cb_html" />
	  <dtml-comment><label for="cb_html">html</label></dtml-comment>
<input type="radio" name="text_format" value="structured-text"
STYLE="display:none"
          id="cb_structuredtext" />
          <dtml-comment><label
for="cb_structuredtext">structured-text</label></dtml-comment>

  <iframe name="visedit" style="width: 95%;border:solid gray 1px;"
    height="400" src="ieeditor/ieeditor.html?BASEURL=<dtml-var URL2
url_quote>"></iframe>
  <textarea name="data:text" rows="1" cols="10"
    style="visibility:hidden;"><dtml-var text html_quote></textarea>

<input type="submit" value=" Change ">
<dtml-else>

**The old form goes here for non-MS users**

</dtml-if>
-------------------------------------------------------------------------

4. Customise your document_edit pythonscript

- change "text" in the parameter list to "data"
- add a new line "text=data" at the top

5. Change the editor_browse_files.html and editor_browse_images.html so that
CMF content types are included in the dtml-tree branches_expr ('Portal
Folder' and 'Portal Image' for example)

6. Customise standard_html_header and add a / to the end of the base href -

<base href="&dtml-absolute_url;/" />


There's an example of the HTML-Tidy call on Babu's site -
http://vsbabu.org/services/ - I think it uses the same Javascript library as
Phil's earlier post, but there's a PHP xml-rpc server involved somewhere
too!

Some ideas Babu has suggested to speed things up (or at least to cache
things after the first load) -
---------------------------------------------------------------------------
>Ahhh, so you could put in the document_edit_form -
>
>src="'ieeditor.html'.absolute_url()"?BASEURL=.......
>               ^^^^
>               not sure about this syntax, cos of the .html ending?

You can also do src="XXXX/ieeditor.html?BASEURL=..." :-)
where XXXX is the site root.
---------------------------------------------------------------------------
>So, strip out everything in the <Script> tags from ieeditor.html and >put
>it in a .js file?
Exactly. Then in the js file, you can make absolute references to all the
icons used. That way, all that can be cached by client will get cached.
---------------------------------------------------------------------------

Maybe you'd also use Zope's caching to cache the whole thing? ...in fact,
should you put your whole portal_skins folder in Zope's cache?

Hope that all makes sense and I haven't missed anything!

If anyone makes any improvements, please let me know

Cheers, Jon