[fpc-pascal] The new book: "WEB and database programming with fpc and Lazarus for newbies and professionals"

Michael Van Canneyt michael at freepascal.org
Fri Jun 18 09:25:06 CEST 2010



On Thu, 17 Jun 2010, Burkhard Carstens wrote:

> Am Mittwoch, 16. Juni 2010 23:01 schrieb Michael Van Canneyt:
>> On Wed, 16 Jun 2010, Burkhard Carstens wrote:
>>> .. anybody knows where I can buy it? ;-)
>>> After spending hours on www.w3c.org and www.w3schools.com,
>>> extjs.com (now sencha.com) and jquery.com reading a lot about html,
>>> dhtml, javascript and checking out some docs and examples about
>>> extjs and jquery, I got the feeling that all these pieces could
>>> form a nice picture .. just I still couldn't see it.
>>> Then I found this artice and now all of the sudden, everything
>>> makes a lot more sense:
>>> http://www.ibm.com/developerworks/web/library/wa-ajaxintro1.html
>>>
>>> Guess, it might be good to start from ground up (now that I found
>>> ground):
>>> Make some nice html files with some JavaScript functions, which
>>> just "call" my cgi via XmlHTTPRequest to insert something into the
>>> DB or return some results or tiny html snippets.
>>
>> This is exactly how I am programming web with FPC.
>>
>> FPC is used for the server. You'll see all components I use in
>> fcl-web/src. The client is programmed completely in ExtJS. The FPC
>> components have been built so they can work with any Javascript
>> framework, but ExtJS has been worked out best - simply because I use
>> it. Currently there are 3 important areas I am working in:
>> - SOAP calls using WST. fpweb can be used to route and handle SOAP
>> transport for WST. The code has been donated to WST.
>> - serving data to a (currently extjs) datastore in Javascript.
>>    (see fcl-web/src/webdata)
>> - 'simple' JSON-RPC programming: JSON-RPC versions 1 and 2 are
>> supported. As an extra, I especially made sure that the Ext.Direct
>> variant is well supported.  (see fcl-web/jsonrpc) I'm still working
>> on a Ext.Direct wrapper around WST.
>
> I already inhaled the WST chapter in Lazarus boork. Still need to read
> up on SOAP and JSON.
>
> What about ExtJS being GPL licensed? Got a developer license?

Yes.

>
>
>> Joost uses jQuery and some Javascript components built around it. I'm
>> sure that with his help, the ExtJS components can be modified to
>> support jquerygrid and whatnot.
>
> Here you refere to the ExtJS components of fpweb, right? IOW. if those
> are (or will be) universal, they should get renamed? (see, you are in
> that stuff, so for you, all this is clear. for a newbie (at least for
> me), it's still all confusing .. so having clear and distinct names
> would help.. e.g. if it's about the fpWeb components for use with ExtJS
> JavaScript Framework, they should be called fpExtJS components ..)
>

Nono. 
I'll give an example. There is TJSONRPCDispatcher. It 'knows' JSON-RPC.
There is a descendent TExtDirectDispatcher, which simply overrides a
couple of functions (they return names of fields in the json request)
so the dispatcher understands the request sent by ExtDirect. Also, the
TExtDirectDispatcher can generate an API configuration object.

But if you don't use ExtDirect, you can simply use TJSONRPCDispatcher.

For web data, it is similar. The base class is TWebDataProvider. It is
independent of what happens on the browser end. It just knows how to 
analyze a web request and act on a dataset (all CRUD operations). 
The output of TWebDataProvider is handled by a different class: 
TWebDataFormatter: it is an abstract class that formats the result of 
TWebDataProvider. 
There is a descendent TExtJSJSONFormatter that formats the result so 
the TSONReader in ExtJS understands it.

What Joost could do (I didn't find time yet) is write a descendent of
TWebDataFormatter that outputs the result of TWebDataProvider in a format
that the jQueryGrid understands. If someone needs it NOW, then of course
I can help in the impmlementation.

What I'm trying to say is that I've tried to make the classes so that they
can be used generally, and that one can make descendents that interface to
different Javascript libraries out there.

Michael.



More information about the fpc-pascal mailing list