New Contributors to Share Extras

I was really pleased by the feedback I got when I first talked about Share Extras at Alfresco’s Sales Kick-off in Orlando earlier this year, when I showed a few of the initial add-ons.
Since then, the list has grown significantly, but I was especially pleased when Peter joined the project and contributed his Google Site News Dashlet and CKEditor Form Control add-ons for Share. For me it marked the point where the project became more than the list of ideas that had been in my head.
Now as of last week two contributors have become four, with the addition of two great add-ons from Florian Maul and Romain Guinot. I’m really excited about these both.
Florian’s JavaScript Console add-on is an essential tool for developers building extensions for Alfresco, and complements my port of Dave Caruana’s original Node Browser. Like the Execute Script action, it also provides a useful tool for administrators who want to run one-off scripts against the Alfresco repository.
JavaScript Console Tool
Romain’s Sample Audit Dashlet shows how different types of Audit information can be displayed in Share. This is a great addition since it shows how auditing can be used outside of the DOD Records Management module, to track specific events within the repository. Even custom audit applications are supported.

Not only do these new add-ons take the total number to almost 25, they also extend the number of languages supported in Share Extras, by providing examples in French and German, in addition to the English and Swedish examples added by myself and Peter.
Lastly, I’ve made a few significant improvements to the Site Poll Dashlet last week, which I couldn’t have done without the help of several others. So thanks to Toni de la Fuente for helping me to debug and fix a couple of previously unreproducible (at least for me) issues with the repository web scripts, to Jeff Potts for his suggestion to update the site activity feed when someone votes, and to Ed Mannion for reporting an obvious issue with using Date.now() on non-Mozilla browsers.
If you want to help contribute to Share Extras, you can do so in several ways. Of course new add-ons are always welcome but ideas, bug reports/fixes and translations are equally valid ways of helping out. More information is available on the Contribution Process page.

Maidenhead, Queen of Shops

As I walked up the High Street in Maidenhead today I was pleasantly impressed to see a small market there, with a greengrocers, deli and crafts stall. It seems to be a growing trend, with a number of Welsh towns reviving or extending their on-street markets.

Among the stalls was an information stand, giving out leaflets (scanned copy of the one I picked up) and information on the new Kings Triangle development, which is being promoted as the solution to the town centre’s current woes.

The improvements are long overdue. Despite being the main pedestrian corridor linking the train station to the town centre the space is currently occupied by a mix of fast food outlets, chain pubs, low-rise offices, the monstrous Broadway multi-storey car park and a load of derelict land.

But as James Farquharson points out in a considered response on his blog today, the plans in their current form are based on the crucial assumption that retail development will provide a panacea to town centre decline, and at a time when analysts predict a continued retail slump for many years to come.

What I noticed, looking at the glossy leaflet, was the new shopping streets on the plan. Besides Debenhams, I wonder who will occupy the new spaces. Perhaps existing businesses will move in from other parts of the town centre, but in that case the development is merely shifting the problem from one place to another.

With the existing commercial centre around the High Street already having a number of vacant premises, a lot of new businesses will be needed not only to fill those but the new premises too. That would mean drawing in a large number of new visitors to Maidenhead, and with Reading, Wycombe and London providing plentiful competition, one wonders to what extent this is possible in reality.

The remarkable thing about all these towns (possibly London aside) is the degree to which they compete with each other, each trying to out-do the others in the quest for growth and economic expansion, but contributing little in architectural merit or in any general character. The same is true of my local area in Ealing, with various developments (some approved, some not) constantly being touted as the magic pill that will stop people heading to Westfield (15 minutes away on the tube) to do their shopping. We’ll see.

As James points out, something else is needed. Ealing at least has a number of green and open spaces at it’s centre which act as a hub for entertainment events, draw people in and above all create a unique sense of community. Maidenhead, sadly, has few of these, and those that it does have are mainly out of the way, separated off from the rest of the town by the almost impassable A4 bypass. Like the Broadway car park, another great 1960s planning failure.

So, back to my starting point. Street markets are on the up, and provide a great way for the entrepreneurial outfits that the Government is trying to encourage to generate revenue, without the long-term commitments of leasing premises and paying business rates. What better way to encourage this at a local level than to create a new space in Maidenhead, a single open space where Maidenhead can define it’s own unique social, cultural and of course commercial heart.

The alternative is a web of near-identical shopping streets, occupied by the usual mix of mobile phone stores, discount stores, fast food outlets and charity shops. With perhaps the odd tree, bit of grass or market stall for decoration. If we’re going to continue on down this route on new developments like this – when more effective and sustainable alternatives exist – then Mary Portis will have her work cut out.

Thanks to Mike Hatfield for pointing out James’s blog post.

Refreshing Web Scripts from Ant

I’ve always been a big fan of using Ant to automate some of the more mundane tasks such as building packages, when developing Share add-ons like the 20 now available on Share Extras, and the Sample Dashlet project now hosted on there now provides a template for others to use in their own projects.
That project’s build script provides a target to hot-copy files into a running Tomcat instance for local testing, but whenever I’ve updated web script components (either on the repo side or in Share) I’ve had to remember to hit the Refresh Web Scripts button on the scripts index page. This calls the Web Scripts Maintenance page, which is actually a web script itself.
Since I was doing a small bit of work this week to provide a couple of new custom document actions, I figured it was worth looking again for a more automated solution to this.
Ant comes complete with it’s own Get Task which can make outgoing HTTP calls, but as the name implies it’s limited to GETs only and not the POSTs required to hit the Web Scripts Maintenance page. So I started looking for alternatives.
Ant’s Sandbox does provide a HTTP module which can apparently make other requests, but the lack of any updates since 2007 did not bode well, and the lack of any documentation was too much of a barrier anyway. Lastly I revisited the Ant-Contrib tasks which I’d experimented with a while back, but again there were no recent updates and the library still did not support the authentication necessary to call the Maintenance web script.
Finally via a thread on Stack Overflow, I came across this project by Alex Sherwin, which is actively being maintained and supports POST requests with authentication and request parameters. Exactly what I needed.
So I added the following definitions to my build script, which seem to work well on 3.4.
<!-- Tomcat properties to reload web scripts or the manager webapp -->
<property name="tomcat.url" value="http://localhost:8080" />
<property name="tomcat.repo.url" value="${tomcat.url}" />
<property name="tomcat.share.url" value="${tomcat.url}" />
<!-- Tomcat properties to reload web scripts -->
<property name="webapp.alfresco.path" value="/alfresco" />
<property name="webapp.share.path" value="/share" />
<property name="post.verbose" value="false" />
<property name="repo.admin.username" value="admin" />
<property name="repo.admin.password" value="admin" />
<property name="repo.scripts.index" value="${tomcat.repo.url}${webapp.alfresco.path}/service/index" />
<property name="share.scripts.index" value="${tomcat.share.url}${webapp.share.path}/page/index" />

<path id="ml-ant-http.classpath">
    <fileset dir="lib">
        <include name="ml-ant-http-1.1.1.jar" />
    </fileset>
</path>

<taskdef name="http" classname="org.missinglink.ant.task.http.HttpClientTask">
    <classpath>
        <path refid="ml-ant-http.classpath" />
    </classpath>
</taskdef>

<!--
Web script reloading from Ant. These tasks use the HTTP task from
http://code.google.com/p/missing-link/.
-->
<target name="reload-webscripts-repo" depends="" description="Reload repository webscripts">
    <http url="${repo.scripts.index}"
        method="POST"
        printrequest="false"
        printrequestheaders="false"
        printresponse="false"
        printresponseheaders="false"
        expected="200"
        failonunexpected="true">
        <credentials username="${repo.admin.username}" password="${repo.admin.password}" />
        <query>
            <parameter name="reset" value="on" />
        </query>
    </http>
</target>

<target name="reload-webscripts-share" depends="" description="Reload Share webscripts">
    <http url="${share.scripts.index}"
        method="POST"
        printrequest="false"
        printrequestheaders="false"
        printresponse="false"
        printresponseheaders="false"
        expected="200"
        failonunexpected="true">
        <credentials username="${repo.admin.username}" password="${repo.admin.password}" />
        <query>
            <parameter name="reset" value="on" />
        </query>
    </http>
</target>

I’ve tried to structure the properties to cater for most peoples’ development settings, for example if you have separate Tomcats running the repo and Share on different ports, then you can specify different values for -Dtomcat.repo.url and -Dtomcat.share.url when you call the script. You should see that the username and password used to authenticate to the web script can be easily overridden if you have changed the default values.
The scripts haven’t yet been tested against v3.3, but I suspect that the share.scripts.index property will need overriding in this version in order to use the ‘service’ servlet name instead of ‘page’ used in 3.4, e.g. -Dshare.scripts.index=http://localhost:8080/share/service/index .
There’s just a couple of negatives. I couldn’t figure out how to make the http task a little less verbose with it’s output, but I’m sure that will be addressed in time. Also it would be good if the Maintenance web script came with a plain text output template rather than just HTML, as although it would be useful to output the result from the script (which shows the number of web scripts currently/previously loaded, plus any problems), the HTML markup isn’t really readable enough to echo to the terminal.
Since the changes seem pretty stable, I’ve added these to the Sample Project in Subversion. You can try it out yourself by grabbing a copy of the build.xml file as well as the JAR file ml-ant-http-1.1.1.jar from the lib directory. I’ll put a new release of the project ZIP file out in the coming days.
Lastly, here’s a screenshot of the Execute Script action that I was able to test using the new build script.
Execute Script action