[daisy] Saving Hook for a Part Editor

Karel Vervaeke karel at outerthought.org
Fri May 9 09:04:48 CEST 2008


The applet looks nice, with what at first sight seems to be a nice
balance between simplicity (ease of use) and complexity (featurewise).

I'm looking forward to seeing it in action in Daisy!

Karel

On Thu, 2008-05-08 at 13:30 +0200, Michael Hänni wrote:
> Hello
> 
> thank you for the hint for the saving hook. It works perfect.
> As a framework I'm using JHotDraw (http://www.jhotdraw.org).
> JHotDraw supports different data formats. Apart from an own format it 
> supports also .svg.
> Here is a  sample .svg-Applet: 
> http://www.randelshofer.ch/oop/jhotdraw/guide/Documentation/sample_svg_applet.html 
> 
> Here is a sample Drawing-Applet: 
> http://www.randelshofer.ch/oop/jhotdraw/guide/Documentation/sample_draw_applet.html 
> 
> 
> The prototype part editor for the SvgData part of the SvgDocument is 
> nearly finished.
> 
> As for the JHotDraw format ("Drawing xml") there is a lot more 
> functionality, I decided to create also an editor for this format. A new 
> challenge now is to write a serializer similar to the class 
> org.apache.cocoon.serialization.SVGSerializer to convert these files to 
> a bitmap image.
> 
> I hope that I will be able to have a first version of these two editors 
> within a week or two.
> 
> Regards,
> Michael
> 
> Bruno Dumon schrieb:
> > Hi,
> >
> > On Wed, 2008-04-30 at 17:40 +0200, Michael Hänni wrote:
> >   
> >> Hello
> >>
> >> I have implemented a part editor for the Part Type "SvgData" of the 
> >> document type "SVG document". This editor is an applet running inside a 
> >> browser.
> >> For the ease of use it should be possible for the user to click on the 
> >> "Save" or "Cancle editing (clears lock)" buttons to save or discharge 
> >> the edited part of the document. This is how it is done with the 
> >> document type "Simple Document".
> >> To meet this requirement I currently take the data from the applet and 
> >> write it to a hidden field of the document. This hidden field then gets 
> >> stored on the server side.
> >>
> >> What could be a good presave hook for writing the changes of the applet 
> >> in the "SVG document"?
> >> Currently I'm doing this at the end of the function preSubmitChecks() of 
> >> the file DaisyHome\daisywiki\webapp\daisy\resources\xml\documenteditor.xml.
> >> This works fine, but is more a hack than a solution, as the code is 
> >> executed for every document type, not just for a document containing a 
> >> "SvgData" part.
> >>
> >> Has anyone an idea?
> >>     
> >
> > The HTML editor and the navigation tree editor are in the same position:
> > before the form is submitted, their internal data-structures need to be
> > serialized and set as a field value.
> >
> > For the navigation tree editor, the relevant code is in treeview.js,
> > function installTreeEditorOnSubmitHandler. This gets called via the
> > initNavTree() call in parteditor_navigation_template.xml.
> >
> > The approach is basically to execute some code like the following when
> > loading your form (just put it in a <script> tag in your template):
> >
> > var plainTextField = dojo.byId("plaintext:input");
> > var htmlAreaSubmitHandler = new Object();
> > htmlAreaSubmitHandler.forms_onsubmit = function() {
> >    plainTextField.value = editorApplet.getData();
> >    return true;
> > }
> > cocoon.forms.addOnSubmitHandler(plainTextField.form,
> > htmlAreaSubmitHandler);
> >
> > BTW, what applet are you using? Looking forward to see the results!
> >
> >   
> 
> _______________________________________________
> daisy community mailing list
> Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
> mail to: daisy at lists.cocoondev.org
> list information: http://lists.cocoondev.org/mailman/listinfo/daisy


More information about the daisy mailing list