Christian,
That's very interesting implementation, I do hope you will share a link.
Your basic understanding of fnclient-0.6.0 is correct. To commit a
note, fnclient.js does a POST that includes a simple simple XML block
describing the note. And the idea is that the browser-side client
(fnclient.js) can talk to whatever you want on the back-end. So
writing a back-end in Java/Struts is an excellent idea.
Fnclient.js receives two types of reply from the server.
------------------------------------------------------------------------
1 - Initial FNCanvas block for the image:
The "displayHTML## (stuff here) ##" block only comes from the server
when FNClient initially requests the annotations for a given image.
(I refer to this as the "FNCanvas" b/c it is the block of HTML divs
that contain the workspace of buttons, annotations, etc. for that
image. It is coming back from the server as a block of fully formed
XML to be inserted into the DOM. The reason it is wrapped in the
displayHTML is b/c I wanted to be able to send debug messages from
the server without breaking the actions. There's a regular
expression I use in function fnGetClientComplete that parses out the
canvas from the returning message from the server. For FNClient.js
to creativity in the browser, it is critical that the FNCanvas be
created around the image. The FNCanvas consists of a series of divs
with specific classes and IDs to which the styles are applied that
create the effects. You *could* put the FNCanvas there for each image
from whatever content management system generated the page. However,
the reason I moved away from that is it involves to much hacking for
integration for different systems. (See end of email for news about
next version.)
2 - "success=ok" messagesf rom server on creation, update, delete:
When sending a new note, or an update, or a delete, the server
responds with a simple "success=ok" or error messages. Again, that
"success=ok" is parsed out because I wanted to be able to send debug
messages. And I admit this is a bit lame. The server should send a
more detailed message back, like server-side generated ID of the new
note that has just been saved.
Your Line 258: imgObj.parentNode.removeChild(imgObj);
------------------------------------------------------------------------
-----------
The line " imgObj.parentNode.removeChild(imgObj); " is part of the
fnGetClientComplete function that is called upon receiving the
FNCanvas HTML from the server. The idea is that fnclient.js script
can find all the images on the page classed "fn-image" and turn them
into annotate-able images. So fnclient.js finds and image classed "fn-
image" and replaces that DOM image element (e.g., imgObj) with an
FNCanvas that contains that image. DOMs can be tricky things...so
I'd have to look at your page to see why this code is working
incorrectly with your page.
FYI: FNClient 0.6.5 - NEW!
-------------------------------------
Lastly, I am working FNClient 0.6.5 which has a more defined API in
fnclient.js. Instead of getting back an HTML block initially from the
server, fnclient.js will receive an enhanced XML block or a JSON
object. The FNClient model is much richer, too. I hope to have more
information soon.
Greg
On Oct 23, 2006, at 4:12 PM, Christian Forster wrote:
> Hi,
>
> I am a student at the University Münster, Germany. Together with four
> fellow students I am going to design and implement a web-based,
> community-driven learning-tool which should help students to get
> prepared for tests. One aspect of this is to let them share their
> notes
> and annotations concerning the lecturer's slides. Currently I am
> playing
> around with fotonotes. We are going to implement the server-side
> entirely new (Java/Struts), so I focus on the fnclient.js. I have got
> some questions:
>
> - in general: to commit a note to the server, xml is used. To
> receive a
> note, the client expects HTML-code wrapped in "displayHTML##" and
> "##".
> Have I overlooked something, or is that just the only way it works?
>
> - line 258: "imgObj.parentNode.removeChild(imgObj);"
> In my tests that line removes the picture I would like to be
> annotated.
> After Commenting out that line, everthings is fine. What is the
> meaning
> of that pice of code?
>
> Thank you in advance for dealing with my questions,
> best regards
>
> Christian
>
> --
> Christian Forster <christian-forster@...>