April 22, 2007

Filed under: Javascript, Alfresco — Marcus @ 9:44 pm

Alfresco has the ability to process server-side javascript via an external command processor (Alfresco Wiki). Any output of the script is then returned to the browser as HTML, meaning quite complex interfaces can be built without any Java code.

The following is a simple request processor that uses the idea of MVC (loosely…) with Action Controllers to process different actions and views depending on what method the user triggers. There’s some limitations as to what you can push through to the Freemarker templates, so some of the logic is needed in there, however overal it’s possible to do some quite sophisticated things.

Main entry point is JSRequest.prototype.doRequest

  • figures out what request action to execute based on an “action” parameter in the request (ie you need to specify one as a hidden field on your forms)
  • executes that action, getting a string back as the output of that action
  • wraps a global template (if it exists) around the whole lot for theming purposes.

The example includes just a simple search demonstration. The javascript is actually inside the .html files; you may need to change some of the config settings at the top of the files to make sure of the context path etc.

(Edited to add: you access it via a url like http://localhost:8080/alfresco/command/script/execute?scriptPath=/Company%20Home/web-scripts/index.html)
Javascript request processing example

April 11, 2007

Javascript WYSIWYG Form Editor

Filed under: Javascript — Marcus @ 12:07 am

I’ve found the need a few times for a form editor to allows users create structured forms that I can then control the results of (say, a user survey or similar). JotForm is one that struck me as being quite nice, so on a boring couple of hours got out my newly found JQuery hat and had a play around. Just like almost everyone else, I’ve been quite amazed at how simple stuff is with JQuery, with the following only a couple hours of tooling around.

Javascript Form Editor

Obviously it’s far from complete, but if anyone’s wanting a base to work from, let me know if you get anywhere with it.

April 7, 2007

Javascript day timetable using JQuery

Filed under: Javascript — Marcus @ 11:55 pm

This had been lying around for a while, but when I first tried JQuery I was able to clean it up a bit.

Example

JS source

.

Powered by WordPress