You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@corinthia.apache.org by Franz de Copenhague <fr...@outlook.com> on 2015/03/12 18:52:12 UTC

[dfwebserver] API

I am thinking about what server features are required by the editor.

1. Upload a document

2. Get the HTML abstract of the document

3. Push the edited HTML representation in the document
4. Upload new images and other embbed objects in the edited HTML

5. Download the document

After discussing the features, we can see what technologies apply for. In advance, AJAX+REST is good for me.

franz


 		 	   		  

Re: [dfwebserver] API

Posted by Peter Kelly <pm...@apache.org>.
> On 13 Mar 2015, at 1:17 am, jan i <ja...@apache.org> wrote:
> 
> On 12 March 2015 at 18:52, Franz de Copenhague <
> franzdecopenhague@outlook.com> wrote:
> 
>> I am thinking about what server features are required by the editor.
>> 
>> 1. Upload a document
>> 
>> 2. Get the HTML abstract of the document
>> 
>> 3. Push the edited HTML representation in the document
>> 4. Upload new images and other embbed objects in the edited HTML
>> 
>> 5. Download the document
>> 
> 
> These are the very basic features, but I think you also need:
>    6. Get a list of all styles (so the user can add styles)
>    7. Generate new table of index, subject index etc.
> 
> Peter published a list of functions that the current JS needs:
> https://cwiki.apache.org/confluence/display/Corinthia/API+reference
> 
> I would expect we need to have all of them implemented (hopefully a bit
> more generic).

Actually these are all the functions the current JS code *provides*. What it does need are the following callbacks:

debug(str)

error(error,type)

addOutlineItem(itemId,type,title)

updateOutlineItem(itemId,title)

removeOutlineItem(itemId)

outlineUpdated()

setCursor(x,y,width,height)

setSelectionHandles(x1,y1,height1,x2,y2,height2)

setTableSelection(x,y,width,height)

setSelectionBounds(left,top,right,bottom)

clearSelectionHandlesAndCursor()

updateAutoCorrect()

All of these are called asynchronously, and actually the calls aren’t made by the library themselves, but are added to an array of “messages” - see Editor/src/Editor.js for details. The reason I implemented callbacks in this way was (at least at the time) the UIWebView class in iOS did not provide any way for JS code to invoke Objective C code, which is what needed to happen in all of the above cases. So after every call to one of the API methods listed on the wiki, you’re supposed to call Editor_getBackMessages(), and you get an array of arrays, each indicating the function name and parameters.

As you can see, the set of callbacks is very small; the majority of work is in implementing all the logic that invokes the already-provided APIs from the wiki. Also the outline methods above are optional, and only necessary if you wish to provide a real-time document map (see the first screenshot at http://static.uxproductivity.com/media/). The same goes for autocorrect.

For the web-based editor, I suggest we implement a wrapper class for the API which, for each function, calls the real implementation version and then invokes Editor_getBackMessages() to invoke registered callbacks. Otherwise the UI code is going to be really awkward and we’ll likely forget to do it in some places. I can help get this going and will try to find some time to do so soon.

—
Dr Peter M. Kelly
pmkelly@apache.org

PGP key: http://www.kellypmk.net/pgp-key <http://www.kellypmk.net/pgp-key>
(fingerprint 5435 6718 59F0 DD1F BFA0 5E46 2523 BAA1 44AE 2966)


Re: [dfwebserver] API

Posted by jan i <ja...@apache.org>.
On 12 March 2015 at 19:38, Franz de Copenhague <
franzdecopenhague@outlook.com> wrote:

>
>
> ----------------------------------------
> > Date: Thu, 12 Mar 2015 19:17:03 +0100
> > Subject: Re: [dfwebserver] API
> > From: jani@apache.org
> > To: dev@corinthia.incubator.apache.org
> >
> >
> > If you got to https://cwiki.apache.org/Corinthia and create a login,
> then I
> > will give you write karma to our wiki pages.
> >
> > rgds
> > jan I.
> >
>
> Done!
>
likewise, logout/login and you have edit/create permission.

have fun
jan i.


>
> My username is franzdecopenhague
>
> franz

RE: [dfwebserver] API

Posted by Franz de Copenhague <fr...@outlook.com>.

----------------------------------------
> Date: Thu, 12 Mar 2015 19:17:03 +0100
> Subject: Re: [dfwebserver] API
> From: jani@apache.org
> To: dev@corinthia.incubator.apache.org
>
>
> If you got to https://cwiki.apache.org/Corinthia and create a login, then I
> will give you write karma to our wiki pages.
>
> rgds
> jan I.
>

Done! 

My username is franzdecopenhague 

franz 		 	   		  

Re: [dfwebserver] API

Posted by jan i <ja...@apache.org>.
On 12 March 2015 at 18:52, Franz de Copenhague <
franzdecopenhague@outlook.com> wrote:

> I am thinking about what server features are required by the editor.
>
> 1. Upload a document
>
> 2. Get the HTML abstract of the document
>
> 3. Push the edited HTML representation in the document
> 4. Upload new images and other embbed objects in the edited HTML
>
> 5. Download the document
>

These are the very basic features, but I think you also need:
    6. Get a list of all styles (so the user can add styles)
    7. Generate new table of index, subject index etc.

Peter published a list of functions that the current JS needs:
https://cwiki.apache.org/confluence/display/Corinthia/API+reference

I would expect we need to have all of them implemented (hopefully a bit
more generic).

If you got to https://cwiki.apache.org/Corinthia and create a login, then I
will give you write karma to our wiki pages.

It would be nice to have a page, that describes the functions (and
interface) between server and client and the wiki is a better place to
discuss the details.

rgds
jan I.




>
> After discussing the features, we can see what technologies apply for. In
> advance, AJAX+REST is good for me.
>
> franz
>
>
>