Page 1 of 1

PostPosted: Tue Jul 10, 2007 12:35 pm
by maddin
hi steve
I'd like to ask you some questions about implementing a google map, used as an input device for Dataface.
The user should get the possibility to draw their tracks directly on the map like in this example: http://maps.forum.nu/gm_plot.html
The google maps code is a mixture of javascript functions and html and for the display of polylines a different doctype has to be used
eg:
I would like to use the dataface permissions framework for this specific form. I was looking at the quickform extensions you wrote , for example how you implemented the wysiwyg editor , but that is far beyond my coding skills, and since this a input device which is not used that often there is no need to implement it as elegant as you implemented the tiny_mce. To make a long Story short...for an outline of a geo form like this, where would you place the code? Does it make sense to seperate the html from the javascript? ...If you don't tell me that this is a stupid idea some more questions might follow...;)
cheers martin

PostPosted: Tue Jul 10, 2007 5:02 pm
by shannah
Hi Martin,

All I can say is this is a really cool idea. You can either do this as a custom action or create a widget. The next release of Dataface has been completely refactored to allow the creation of custom widgets more modularly than before -- but custom widgets would still require some PHP coding.

The easier way, right now, would probably be to create a custom action for this. Then you could almost copy and paste the proper HTML and javascript into a template. And you could limit access to the action with dataface permissions. You'd probably create a permission called 'draw tracks' in the permissions.ini file, then make this a required permission for your 'draw_tracks' action.

e.g. permissions.ini :

draw tracks="Draw tracks with google maps"

e.g. actions.ini

[draw_tracks]
...
permission=draw tracks

If you wanted to implement it as a widget, then a good place to start would be by copying one of my custom widgets in the HTML/QuickForm directory. (e.g. calendar.php or htmlarea.php -- or any of the other widgets for that matter). The important thing is the toHtml() method which outputs the HTML to render the component...

But this can get pretty complicated.

I apologize for the vagueness and brevity of answers in this post... hopefully it makes some sense.

-Steve