<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>patspam &#187; WebGUI</title>
	<atom:link href="http://blog.patspam.com/category/comp/webgui/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.patspam.com</link>
	<description>patspam patspam patspam</description>
	<lastBuildDate>Thu, 16 Sep 2010 00:42:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PlebGUI: WebGUI Meets Plack</title>
		<link>http://blog.patspam.com/2009/plebgui-webgui-meets-plack</link>
		<comments>http://blog.patspam.com/2009/plebgui-webgui-meets-plack#comments</comments>
		<pubDate>Mon, 12 Oct 2009 13:20:02 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[WebGUI]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1212</guid>
		<description><![CDATA[WebGUI is an Apache mod_perl application. Not just any mod_perl application; reputedly the most deployed mod_perl application on the planet. You&#8217;d be forgiven for thinking that we love Apache. And we do. Mostly. But you see mod_perl is an overly zealous lover. Every intimate phase of the Apache request cycle is offered up to your [...]]]></description>
			<content:encoded><![CDATA[<p>WebGUI is an Apache mod_perl application. Not just any mod_perl application; <a href="http://www.ohloh.net/p/WebGUI">reputedly</a> the most deployed mod_perl application on the planet. You&#8217;d be forgiven for thinking that we love Apache. And we do. Mostly.</p>
<p>But you see mod_perl is an overly zealous lover. Every intimate phase of the Apache request cycle is offered up to your eager Perl embrace. Sure, you have to learn a few new tricks to get decent performance (such as two-tier mod_proxy/mod_perl) but hey it&#8217;s 2001 and mod_perl is SO much better than CGI. Without hesitation you commit to a life of <strong>PerlResponseHandler</strong>s and <strong>Apache2::Const::OK</strong>s.</p>
<p>Years pass. Life is good.</p>
<p>Your user base had become very adept at deploying Apache. In fact you make life easier for them by <a href="http://sourceforge.net/projects/pbwebgui/files/WebGUI%20Runtime%20Environment/">distributing</a> the complete Perl/Apache/MySQL stack as a simple installer, pre-configured for optimum performance.</p>
<p>Every now and then someone appears on the mailing list asking questions about WebGUI 5, a throw-back to the days when it used to be possible to deploy WebGUI on cheap shared hosting cPanel servers in CGI mode. You want to help, but WebGUI has become so powerful that CGI mode isn&#8217;t feasible anymore. That&#8217;s the price that was paid for evolving into an Enterprise-grade system. Developers <a href="http://www.webgui.org/webgui/campaigns/people/patrick-donelan">lament</a> the fact that small-time users can&#8217;t take advantage of all the awesome things WebGUI can do, not to mention all the word-of-mouth promotion WebGUI is missing out on, but them&#8217;s the brakes. WebGUI continues to grow. &#8220;Carrier-grade&#8221; is the new black. And across town, the non-enterprise crowd is left to content themselves with <a href="http://wordpress.org/">WordPress</a>, <a href="http://www.joomla.org/">Joomla</a> and <a href="http://drupal.org/">Drupal</a>.</p>
<p>And then a guy called <a href="http://profile.typepad.com/miyagawa">Tatsuhiko Miyagawa</a> comes along.</p>
<p>He says, gee, look at these wonderful server abstractions that Python (<a href="http://www.python.org/dev/peps/pep-0333/">WSGI</a>) and Ruby (<a href="http://rack.rubyforge.org/">Rack</a>) have. The Perl world might have moved on from CGI to things like Catalyst::Engine::* and HTTP::Engine, but there&#8217;s still duplicated effort everywhere. We can do better.</p>
<p>So he sits down and writes <a href="http://github.com/miyagawa/psgi-specs">PSGI</a>, an absurdly simple, manifestly beautiful specification for an interface between Perl web apps and web servers (drawing heavily on WSGI and Rack for inspiration).</p>
<h3>PSGI</h3>
<p>The idea goes like this: Web applications, when all is said and done, are really just on about sending three pieces of information to web browsers: a HTTP status code, a list of HTTP headers, and some content (a file or some text, normally HTML).</p>
<p>This is the specification:</p>
<pre class="brush: perl; title: ; notranslate">
[                                           # an array ref, containing..
    200,                                    # a HTTP status code
    [ 'Content-Type' =&gt; 'text/html', .. ],  # an array of HTTP headers
    [ '&lt;html&gt;...&lt;/html&gt;' ],                 # the text content (or a $filehandle)
]
</pre>
<p>And that&#8217;s really all there is to it.</p>
<p>Some people write web apps according to the interface. Other people write server backends according to the interface. Web app developers use whatever whiz-bang technology they like, and as long as they return an array that complies with the spec their web app can run on any server. And server backend developers can do lots of clever things to get that information back to web browsers really fast, and have the results of their work benefit all PSGI/Plack consumers. No more duplicated effort. No more server-specific love lock-in.</p>
<p>And folks took notice. Not just any folks either. Really, really smart people like Yuval Kogman, Stevan Little, Shawn Moore, Matt Trout, Jesse Vincent, Chia-liang Kao, Dave Rolsky, Simon Cozens, ..  (They&#8217;re some of the well-known names that jumped out at me from the <a href="http://github.com/miyagawa/psgi-specs/blob/master/PSGI.pod">PSGI.pod</a> spec doc. The others are probably even smarter, stealth hackers. I know, it&#8217;s scary).</p>
<h3>Plack</h3>
<p>Before you could say <a href="http://plackperl.org/">Plack</a> there was a reference implementation, server backend support for <a href="http://search.cpan.org/search?query=CGI&amp;mode=all">CGI</a>, <a href="http://www.fastcgi.com">FastCGI</a>, <a href="http://perl.apache.org/">mod_perl</a> (welcome back!), <a href="http://search.cpan.org/dist/AnyEvent/lib/AnyEvent.pm">AnyEvent</a>, <a href="http://search.cpan.org/dist/Coro/Coro.pm">Coro</a>, <a href="http://www.danga.com/perlbal/">Perlbal</a>, <a href="http://nginx.net/">Nginx</a>, .. framework support for <a href="http://www.catalystframework.org/">Catalyst</a>, <a href="http://cgi-app.org/">CGI-Application</a>, <a href="http://www.masonhq.com/">Mason</a>, <a href="http://search.cpan.org/~awwaiid/Continuity/">Continuity</a>, <a href="http://maypole.perl.org/">Maypole</a>, <a href="http://mojolicious.org/">Mojo</a> .. and a whole suite of Middleware and Utilities.</p>
<p>Meaning that all of a sudden any web app written in one of those frameworks can now be deployed on any of those servers. Or on the pure-perl standalone server that runs from the command line. Or on one of the more experimental/exotic servers I haven&#8217;t listed. If you&#8217;re not excited yet, just wait until <a href="http://code.google.com/appengine/">Google AppEngine</a> appears in that list.</p>
<h3>WebGUI</h3>
<p>But where is WebGUI! The problem is that WebGUI is both a framework and a web app. A really big web app. With a mod_perl addiction. Frameworks are built with multiple servers in mind, so they generally already have an in-built server abstraction layer. Which makes adding PSGI support relatively simple. WebGUI, on the other hand, deliberately eschews an abstraction layer so that it can fully embrace mod_perl and eke out every last ounce of power and performance it can from Apache.</p>
<p>So, faced with extreme framework envy, I did what any reasonable person would do.</p>
<p>I built a PSGI/Plack layer for WebGUI.</p>
<h3>PlebGUI</h3>
<p>I&#8217;ve codenamed the project &#8220;<a href="http://github.com/pdonelan/webgui/tree/plebgui">PlebGUI</a>&#8220;, which I think aptly describes the way it makes it possible for the little people to run WebGUI on low-cost shared hosting.</p>
<p>And it actually works. Take for instance <a href="http://plebgui.patspam.com">plebgui.patspam.com</a>, a demo PlebGUI site site running in FastCGI mode on <a href="http://www.hostmonster.com/">HostMonster</a> (the prototypical low-cost shared webhost).</p>
<h3>app.psgi</h3>
<p>The second wonderously simple idea in the PSGI spec is that a web app is just a plain old perl subroutine. Here&#8217;s one I prepared earlier:</p>
<pre class="brush: perl; title: ; notranslate">

sub { [ 200, [ 'Content-Type' =&gt; 'text/html' ], [ 'Hello World' ] ] }
</pre>
<p>I know, it&#8217;s almost insulting. I&#8217;m a web developer man! I do sophisticated things! But try putting that single-line sub into a test file called <strong>app.psgi</strong>. And then after you&#8217;ve installed Plack (it&#8217;s not on CPAN yet so you have to install it from miyagawa++&#8217;s <a href="http://github.com/miyagawa/Plack">git repo</a>) try running this:</p>
<pre class="brush: bash; title: ; notranslate">

$ plackup
Accepting connections at http://0:8080/
</pre>
<p>Go on, visit that url in your web browser. Hello to you too!</p>
<h3>Middleware</h3>
<p>Ok that was a cute trick, let&#8217;s try something more exciting:</p>
<pre class="brush: perl; title: ; notranslate">

use Plack::Builder;
builder {
    add &quot;Plack::Middleware::Static&quot;, path =&gt; qr/./, root =&gt; '/var/www';
    sub { [ 404, [ &quot;Content-Type&quot; =&gt; &quot;text/plain&quot; ], [ &quot;Not Found&quot; ] ] };
};
</pre>
<p>Congratulations, you just added your first Middleware. Assuming you have some static files located at <em>/var/www</em>, you&#8217;ll get the static files returned to your browser with the correct mimetype (thanks to <em>Plack::Middleware::Static</em>). Middleware just wraps your web app (a plain old Perl sub) with another plain old Perl sub. Middleware can do logging, <a href="http://bulknews.typepad.com/blog/2009/10/develstacktraceashtml.html">pretty</a> HTML stack traces, pre/post processing, or anything else you like. Simple, but immensely powerful.</p>
<h3>Plackup</h3>
<p>Plackup is a simple utility script that launches your web app with a specified server backend. By default it runs the pure-perl standalone development server. It expects your webapp to live in a file, similar to the ones we just created. Want to run your web app on another server backend? Try one of these:</p>
<pre class="brush: bash; title: ; notranslate">

plackup                                         # dev server with StackTrace and AccessLog enabled
plackup -s CGI                                  # remember how slow web apps used to be?
plackup -s AnyEvent                             # nonblocking
plackup -s Coro --port 9090                     # coroutines
plackup -s Standalone::Prefork --max-workers 20 # blazingly fast preforking ftw!
</pre>
<h3>dev.localhost.localdomain.psgi</h3>
<p>Here&#8217;s what the current per-site .psgi file looks like for PlebGUI:</p>
<pre class="brush: perl; title: ; notranslate">

use Plack::Builder;
use lib '/data/WebGUI/lib';
use WebGUI;

builder {

 # Populate $env from site.conf
 add 'Plack::Middleware::WebGUI',
   root =&gt; '/data/WebGUI',
   config =&gt; 'dev.localhost.localdomain.conf';

 # Handle /extras via Plack::Middleware::Static
 add 'Plack::Middleware::Static',
   path =&gt; qr{^/extras/},
   root =&gt; '/data/WebGUI/www';

 # Handle /uploads via Plack::Middleware::WGAccess (including .wgaccess)
 add 'Plack::Middleware::WGAccess',
   path     =&gt; qr{^/uploads/},
   root =&gt; '/data/domains/dev.localhost.localdomain/public';

 sub { WebGUI::handle_psgi(shift) };
}
</pre>
<p>What you can see there are 3 Middleware layers <strong>add</strong>ed in, one to set up the WebGUI site-specific environment, one to handle <em>/extras</em> static content, and one to handle <em>/uploads </em>static content (taking into account <em>.wgaccess</em> file permissions).</p>
<p>All of those <strong>plackup</strong> command variations above can be used to launch WebGUI outside of mod_perl. Prefer running inside of Apache? How about one of these:</p>
<pre class="brush: xml; title: ; notranslate">

&lt;VirtualHost *:80&gt;
 PerlOptions +Parent
 PerlSwitches -I/data/WebGUI/lib

 # CGI
 #AddHandler cgi-script cgi
 #ScriptAlias / /data/WebGUI/etc/dev.localhost.localdomain.cgi/
 #&lt;Directory /data/WebGUI/etc&gt;
 #   Options +ExecCGI
 #&lt;/Directory&gt;

 # mod_perl
 #SetHandler perl-script
 #PerlHandler Plack::Server::Apache2
 #PerlSetVar psgi_app /data/WebGUI/etc/dev.localhost.localdomain.psgi

 # FastCGI
 FastCgiServer /data/WebGUI/etc/dev.localhost.localdomain.fcgi
 ScriptAlias / /data/WebGUI/etc/dev.localhost.localdomain.fcgi/

 # mod_psgi
 #&lt;Location /&gt;
 #    SetHandler psgi
 #    PSGIApp /data/WebGUI/etc/dev.localhost.localdomain.psgi
 #&lt;/Location&gt;

&lt;/VirtualHost&gt;
</pre>
<p>Using those directives you can run WebGUI in CGI, mod_perl, FastCGI mode, or even the in-development <a href="http://github.com/spiritloose/mod_psgi/">mod_psgi Apache module</a>.</p>
<h3>Benchmarks</h3>
<p>Ok so how fast are these different backends? Let&#8217;s use ApacheBench to do some simple, unscientific tests of how many requests per second we can squeeze out of WebGUI.</p>
<p>First we&#8217;ll start with WebGUI in its original, un-plebified form, running on the WRE (more is better):</p>
<p>$ ab -n 1000 -c 10 -k http://dev.localhost.localdomain:8081/ | grep &#8216;Requests per&#8217;<br />
Requests per second:    <strong>122.77</strong> [#/sec] (mean)</p>
<p>The result is of course completely dependent on your Apache configuration &#8211; in this case I have (StartServers, MinSpareServers, MaxSpareServers, MaxClients) = (5,5,10,20).</p>
<p>Ok, now have a look at these numbers:</p>
<p>$ ./ab.pl &#8211;app /data/WebGUI/etc/dev.localhost.localdomain.psgi<br />
<em>Testing implementations: AnyEvent, Standalone, Standalone::Prefork, ServerSimple, Coro<br />
app: /data/WebGUI/etc/dev.localhost.localdomain.psgi<br />
ab:  ab -n 1000 -c 10 -k<br />
URL: http://127.0.0.1/<br />
</em><br />
<strong>&#8211; server: AnyEvent</strong><br />
Accepting requests at http://0.0.0.0:10001/<br />
Requests per second:    <strong>68.06</strong> [#/sec] (mean)</p>
<p><strong>&#8211; server: Standalone</strong><br />
Accepting connections at http://0:10001/<br />
Requests per second:    <strong>64.92</strong> [#/sec] (mean)</p>
<p><strong>&#8211; server: Standalone::Prefork</strong><br />
Accepting connections at http://0:10001/<br />
Requests per second:    <strong>214.54</strong> [#/sec] (mean)</p>
<p><strong>&#8211; server: ServerSimple</strong><br />
Plack::Server::ServerSimple: You can connect to your server at http://localhost:10001/<br />
Requests per second:    <strong>66.43</strong> [#/sec] (mean)</p>
<p><strong>&#8211; server: Coro</strong><br />
2009/10/11-23:17:32 Plack::Server::Coro::Server (type Net::Server::Coro) starting! pid(1581)<br />
Requests per second:    <strong>67.55</strong> [#/sec] (mean)</p>
<p>Did you see that? Standalone::Prefork is almost twice as fast as WebGUI in the WRE! The pre-forking server&#8217;s <em>max-workers</em> setting defaults to 10, so the comparison might actually be fair too.</p>
<h3>Holy Shit</h3>
<p>I think that&#8217;s worth repeating. PlebGUI, which is currently less than one week old and running on a compatibility layer optimised for &#8220;let&#8217;s just get this thing working and worry about performance later&#8221; is already capable of out-performing the WRE in terms of raw speed by 200%. (If you believe the benchmarks).</p>
<p>But Plack/PSGI is not just about speed. It&#8217;s about <strong>flexibility</strong>. Think Koen de Jonge, WebGUI hosting extraordinaire at Procolix, deploying a high availability &#8220;follow the sun&#8221; WebGUI cluster on Nginx servers. Think Colin Kuskie, WebGUI test suite overlord, probing the dark corners of the WebGUI API using standard HTTP::Request and HTTP::Response pairs through mocked HTTP and live HTTP servers. Think web developers working on WebGUI client code, with a web server fully integrated into Padre. Think WebGUI entirely deployable from the CPAN.</p>
<p>Think of every new project added to the PSGI/Plack ecosystem as a potential new PlebGUI feature.</p>
<h3>Where to Now</h3>
<p>The approach I took in turning WebGUI into PlebGUI was to create a fake Apache2::Request object, since that&#8217;s the closest thing WebGUI has to a server abstraction layer. Plack contains two helper classes <em>Plack::Request</em> and <em>Plack::Response</em> that make this really easy. Currently though, that leaves us in the curious situation where WebGUI does all of its work thinking it&#8217;s talking to mod_perl, only to have its real output re-routed through the PSGI-compatibility layer, to be subsequently processed by a specific server backend. If you don&#8217;t get the joke yet, just think about what happens when the PSGI server backend happens to be mod_perl.</p>
<p>The benchmarks would clearly improve if we ripped out mod_perl altogether. Lots of code would simplify too. Certain parts of WebGUI could disappear altogether, such as URL Handlers which could be entirely replaced with Middleware.</p>
<p>The only feature that PlebGUI currently lacks is content streaming. I deliberately left that out since it will be a lot easier to achieve once mod_perl disappears. In Plack land the way to drip-feed browsers with &#8220;chunked&#8221; content is to return an <a href="http://search.cpan.org/~gbarr/IO-1.25/lib/IO/Handle.pm">IO::Handle</a>-like object that responds to getline() and close(). The Plack folks are planning a fancy new module called IO::Writer that will Do The Right Thing under both blocking and non-blocking servers. Expect awesome things.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/plebgui-webgui-meets-plack/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Padre::Plugin::WebGUI Tab Icons</title>
		<link>http://blog.patspam.com/2009/padrepluginwebgui-tab-icons</link>
		<comments>http://blog.patspam.com/2009/padrepluginwebgui-tab-icons#comments</comments>
		<pubDate>Thu, 01 Oct 2009 09:49:25 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[WebGUI]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1208</guid>
		<description><![CDATA[Version 0.03 of Padre::Plugin::WebGUI (my WebGUI plugin for the Padre Perl IDE) is on its way to the CPAN, with one small but rather nice feature: tab icons. Just as the plugin uses WebGUI&#8217;s native icons to display the Asset Tree for your site, you now get the same attractive icon in the tab that [...]]]></description>
			<content:encoded><![CDATA[<p>Version 0.03 of <a href="http://search.cpan.org/dist/Padre-Plugin-WebGUI/">Padre::Plugin::WebGUI</a> (my WebGUI plugin for the Padre Perl IDE) is on its way to the CPAN, with one small but rather nice feature: tab icons. Just as the plugin uses WebGUI&#8217;s native icons to display the Asset Tree for your site, you now get the same attractive icon in the tab that opens up when you double-click to edit something. Apart from the aesthetics, it&#8217;s handy to know at a glance what sort of asset you&#8217;re editing (WebGUI uses the same trick for the edit icons on your site when you turn admin mode on). I was hoping to be able to add hover-text too (in case you don&#8217;t recognise the Asset type from its icon) but thus far I haven&#8217;t figured out if wxPerl and/or Padre supports it.</p>
<p>The following screenshot shows a nice example of several tabs open at once with different WebGUI Asset types displaying their own icons.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/10/Tab_Icons.png"><img class="alignnone size-medium wp-image-1209" title="Tab_Icons" src="http://blog.patspam.com/wp-content/uploads/2009/10/Tab_Icons-300x121.png" alt="Tab_Icons" width="300" height="121" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/padrepluginwebgui-tab-icons/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Padre::Plugin::WebGUI now with remote editing</title>
		<link>http://blog.patspam.com/2009/padrepluginwebgui-now-with-remote-editing</link>
		<comments>http://blog.patspam.com/2009/padrepluginwebgui-now-with-remote-editing#comments</comments>
		<pubDate>Sat, 26 Sep 2009 14:26:20 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[WebGUI]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1191</guid>
		<description><![CDATA[Up until now the WebGUI Padre plugin I&#8217;ve been working on has been more or less a proof-of-concept / toy / test-bed for experimental ideas. Whilst that has been fun (and made for good conference slides), the reality is that I haven&#8217;t actually been using the plugin for my daily WebGUI development, so how could [...]]]></description>
			<content:encoded><![CDATA[<p>Up until now the <a href="http://webgui.org">WebGUI</a> <a href="http://padre.perlide.org">Padre</a> plugin I&#8217;ve been <a href="../2009/padrepluginwebgui">working on</a> has been more or less a proof-of-concept / toy / test-bed for experimental ideas. Whilst that has been fun (and made for good conference slides), the reality is that I haven&#8217;t actually been using the plugin for my daily WebGUI development, so how could I expect other WebGUI developers to do so?</p>
<p>I&#8217;m hoping to change that. As of today I&#8217;ve stripped out all the experimental features and concentrated on the single feature that seems to have the widest possible appeal, namely, <strong>remote editing</strong>.</p>
<p>Version 0.02 of <a href="http://search.cpan.org/search?query=Padre%3A%3APlugin%3A%3AWebGUI&amp;mode=all">Padre::Plugin::WebGUI</a>, which is on its way to the CPAN, allows you to connect over HTTP to your webgui site, view you asset tree and edit your assets from inside the Padre text editor. That hopefully makes it as useful for designers and content managers as it is for developers.</p>
<p>Previously the plugin got most of its power from the WGDev library. However this meant that you had to install WebGUI and WGDev as a prerequisite. Given that the WRE ships with non-threaded perl, this meant either installing these prereqs into your system perl or building another perl specifically to run them.  Not an overly arduous task, but enough of a hurdle to dissuade most WebGUI developers from playing with the plugin. That obstacle has now been removed. You do not need to have WebGUI or WGDev installed to run the plugin.</p>
<p>Using WGDev also meant that you could only connect locally to your site. That restriction is now gone.</p>
<p><strong>Installation</strong></p>
<p>Firstly, <a href="http://padre.perlide.org/download.html">install Padre</a>.<strong><br />
</strong></p>
<p>To allow your WebGUI site to talk to the plugin, add <a href="http://github.com/pdonelan/webgui/blob/padre/lib/WebGUI/Content/Padre.pm">this content handler</a> (WebGUI::Content::Padre) to your site and restart modperl  (the easiest way to do this is to drop the module into your <em>/data/WebGUI/lib/WebGUI/Content</em> dir and add the new content handler to your site config file. There is also an <a href="http://github.com/pdonelan/webgui/blob/padre/sbin/installPadre.pl">install script</a> that will do the site config editing for you).</p>
<p>Next install the plugin from the CPAN</p>
<pre class="brush: bash; title: ; notranslate">

cpan Padre::Plugin::WebGUI
</pre>
<p><strong>Usage</strong></p>
<p>Inside Padre, go to the Plugin Manager and enable the WebGUI plugin. You should then see a WebGUI item appear in your Plugins menu.</p>
<p>From the WebGUI menu, tick &#8220;Show Asset Tree&#8221; and double-click on &#8220;Connect&#8221; in the new panel that appears.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/connect.png"><img class="alignnone size-medium wp-image-1193" title="connect" src="http://blog.patspam.com/wp-content/uploads/2009/09/connect-300x186.png" alt="connect" width="300" height="186" /></a></p>
<p>You will be prompted for the URL of the site you want to connect to. Currently you need to enter you the site in the form: <em>http://username:password@site.com</em> (later we will add a site manager to make this nicer). Remember that this can be any webgui site that you have access to, not just a local site.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/connect2.png"><img class="alignnone size-medium wp-image-1194" title="connect2" src="http://blog.patspam.com/wp-content/uploads/2009/09/connect2-300x67.png" alt="connect2" width="300" height="67" /></a></p>
<p>You will then see the Asset Tree dynamically populated with information from your site.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/asset_tree.png"><img class="alignnone size-medium wp-image-1192" title="asset_tree" src="http://blog.patspam.com/wp-content/uploads/2009/09/asset_tree-300x186.png" alt="asset_tree" width="300" height="186" /></a></p>
<p>Try double-clicking on an article.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/getting_started.png"><img class="alignnone size-medium wp-image-1196" title="getting_started" src="http://blog.patspam.com/wp-content/uploads/2009/09/getting_started-300x186.png" alt="getting_started" width="300" height="186" /></a></p>
<p>A new file tab should open with the name set to the name of your article (with [wg] prepended). The article content will be loaded into to tab, with Padre&#8217;s HTML syntax highlighting in effect. If you have Padre::Plugin::HTML installed, you can use the Tidy/Lint/Validate the HTML to your heart&#8217;s content. And every time you hit Save, your changes will be pushed up to the site as a new Version Tag.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/look_ma.png"><img class="alignnone size-medium wp-image-1198" title="look_ma" src="http://blog.patspam.com/wp-content/uploads/2009/09/look_ma-300x191.png" alt="look_ma" width="300" height="191" /></a></p>
<p>Try double-clicking on another sort of asset, for instance a Template. Once again, the template html will be loaded into a new tab with nice syntax highlighting.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/template.png"><img class="alignnone size-medium wp-image-1199" title="template" src="http://blog.patspam.com/wp-content/uploads/2009/09/template-300x186.png" alt="template" width="300" height="186" /></a></p>
<p>And for fun, try opening up a CSS Snippet. The plugin will detect that your snippet is set to the &#8216;text/css&#8217; mime type and use CSS code highlighting instead of HTML.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/css.png"><img class="alignnone size-medium wp-image-1195" title="css" src="http://blog.patspam.com/wp-content/uploads/2009/09/css-300x186.png" alt="css" width="300" height="186" /></a></p>
<p>And similarly for JavaScript Snippets.</p>
<p><a href="../wp-content/uploads/2009/09/javascript.png"><img title="javascript" src="../wp-content/uploads/2009/09/javascript-300x164.png" alt="javascript" width="300" height="164" /></a></p>
<p><strong>Design and Extensions</strong></p>
<p>As far as Padre is concerned the file you are editing is just a regular file on your file system. For example when you edit the text, an asterisk (*) appears next to the name of the file indicating that you haven&#8217;t save it yet.  The integration between the webgui content handler and the plugin is minimal, meaning that you could conceivably use this plugin to do remote editing on non-webgui sites too.</p>
<p>Padre has a nice architectural design, which makes it really easy for us to associate different WebGUI::Asset types with Padre::Document types. Currently most assets delegate to the default <em>Padre::Document::WebGUI::Asset</em> module which does HTML syntax highlighting and expects only generic content from the content handler running on your site. <em>Padre::Document::WebGUI::Snippet</em> has a slightly higher IQ level in that it asks the server to tell it what mimetype the asset is set to, so that it can use the appropriate syntax highlighter.</p>
<p>We could do some really interesting things by building asset-specific Padre::Document modules. For instance you could build a document type that uses fancy wxWidgets controls to do things that aren&#8217;t possible on the web (desktop integration etc..) And it&#8217;s just as easy to build these for your own custom asset types as it is for core ones. Given that Padre is cross-platform, you&#8217;re basically looking at a way of extending WebGUI interactions out into desktop-land.</p>
<p>If you&#8217;re a WebGUI designer/developer/content manager and you want to start playing with Padre::Plugin::WebGUI as a novel way of editing content, come find me on #webgui or #padre.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/padrepluginwebgui-now-with-remote-editing/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Finding missing WebGUI Templates</title>
		<link>http://blog.patspam.com/2009/finding-missing-webgui-templates</link>
		<comments>http://blog.patspam.com/2009/finding-missing-webgui-templates#comments</comments>
		<pubDate>Thu, 30 Jul 2009 09:06:59 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Comp]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[WebGUI]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1181</guid>
		<description><![CDATA[Following on from my previous WGDev post, here&#8217;s another example of wgd ls that lets you find missing Templates on a WebGUI site. One problem that content managers run into is that after deleting a template in WebGUI, any assets that still refer to the template will die a horrible death when users try to [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from my <a href="http://blog.patspam.com/2009/ode-to-wgd-and-the-command-line">previous WGDev post</a>, here&#8217;s another example of <strong>wgd ls</strong> that lets you find missing Templates on a WebGUI site.</p>
<p>One problem that content managers run into is that after deleting a template in WebGUI, any assets that still refer to the template will die a horrible death when users try to view them. What would be nice is an automated way of finding all such assets that refer to missing template, so that you can update them to refer to a different template.</p>
<p>For starters, WGDev can give you a list of all available templates on your site via:</p>
<pre class="brush: bash; title: ; notranslate">

wgd ls root -r --format %assetId% --includeOnlyClass WebGUI::Asset::Template | sort | uniq &gt; available
</pre>
<p>You can also ask for a list of all in-use templateIds, via:</p>
<pre class="brush: bash; title: ; notranslate">

wgd ls root -r --format %templateId% --filter '%templateId% ~~ /.+/' | sort | uniq &gt; in_use
</pre>
<p>All you need to do then is ask the <a href="http://www.gnu.org/software/coreutils/manual/html_node/comm-invocation.html">comm</a> command to tell you which templateIds are <em>in_use</em> but not <em>available</em>:</p>
<pre class="brush: bash; title: ; notranslate">

comm -23 in_use available
</pre>
<p>Putting it all together on one line (without the temporary files), that becomes:</p>
<pre class="brush: bash; title: ; notranslate">

comm -23 &lt;(wgd ls root -rf %templateId% --filter '%templateId% ~~ /.+/' | sort | uniq) &lt;(wgd ls root -rf %assetId% --includeOnlyClass WebGUI::Asset::Template | sort | uniq)
</pre>
<p>The output of this command is a nice list of missing templateIds.</p>
<p>Of course, what you probably then want to do is ask WGDev to give you a list of asset urls that are trying to use these missing Templates, for example, if one item in your list is <em>eHMsLCMqoXYpYrsZ7CWUtg</em>, you would do:</p>
<pre class="brush: bash; title: ; notranslate">

wgd ls root -rf %url% --filter '%templateId% ~~ eHMsLCMqoXYpYrsZ7CWUtg'
</pre>
<p>Which would print something like</p>
<pre class="brush: bash; title: ; notranslate">

/my/broken/asset/url
</pre>
<p>Combining this with the previous command to do it all on one line is left as an exercise for the reader <img src='http://blog.patspam.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Now, <strong>templateId</strong> isn&#8217;t the only Asset field that templates can be referenced under, for example, if you want to also find missing Style and Printable Style templates, you&#8217;d want to do something like:</p>
<pre class="brush: bash; title: ; notranslate">

for tmpl in templateId styleTemplateId printableStyleTemplateId
do
comm -23 &lt;(wgd ls root -rf %${tmpl}% --filter &quot;%${tmpl}% ~~ /.+/&quot; | sort | uniq) &lt;(wgd ls root -rf %assetId% --includeOnlyClass WebGUI::Asset::Template | sort | uniq)
done
</pre>
<p>It&#8217;s not optimised for speed, but it sure is handy. And you could apply the same approach to search for invalid group permissions, etc.. Of course if you found yourself doing this often you&#8217;re probably better off writing a dedicated WGDev plugin to wrap up the functionality.</p>
<p>There&#8217;s a <a href="http://github.com/pdonelan/webgui/tree/template_usage">WebGUI branch on GitHub</a> containing some extra <a href="http://www.webgui.org/rfe/request-for-enhancement/10659">Template Usage-related functions</a> &#8211; the plan is to add the ability to find all the different ways that templates are referenced (in Asset definitions, Account module definitions, &#8230;) so perhaps we will end up adding a &#8220;find missing Templates&#8221; button to the Edit Template page.</p>
<p>[ perl ironman ]</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/finding-missing-webgui-templates/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ode to wgd and the command line</title>
		<link>http://blog.patspam.com/2009/ode-to-wgd-and-the-command-line</link>
		<comments>http://blog.patspam.com/2009/ode-to-wgd-and-the-command-line#comments</comments>
		<pubDate>Tue, 14 Jul 2009 08:45:41 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[WebGUI]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1171</guid>
		<description><![CDATA[Doug just posted an ode to the Linux command line over at the Plain Black staff blog. I&#8217;ve been getting a lot of joy out of the command line today too thanks to Graham&#8217;s ridiculously useful WGDev. One wgd command that I only started using in earnest today is the ls command. In its most [...]]]></description>
			<content:encoded><![CDATA[<p>Doug just <a href="http://www.plainblack.com/pr/staff/blog/useful-shell-stuff">posted</a> an ode to the Linux command line over at the Plain Black staff blog.</p>
<p>I&#8217;ve been getting a lot of joy out of the command line today too thanks to Graham&#8217;s ridiculously useful <a href="http://github.com/haarg/wgdev/tree/master">WGDev</a>. One wgd command that I only started using in earnest today is the <strong>ls</strong> command. In its most basic form, it lets you print out a list of assets on your site:</p>
<pre class="brush: bash; title: ; notranslate">

$ wgd ls /home

getting_started
your_next_step
the_latest_news
tell_a_friend
documentation
site_map
</pre>
<p>I <a href="http://github.com/pdonelan/wgdev/tree/master">added</a> a bunch of extensions to <strong>ls</strong> today, the first one being a <strong>-r</strong> option that tells <strong>ls</strong> to recursively list assets. Given that this prints to STDOUT, you can pipe this into any other command line tool to manipulate the output. For example, to list all assets that have the word &#8220;you&#8221; in their menu title:</p>
<pre class="brush: bash; title: ; notranslate">

$ wgd ls /root -f &quot;%menuTitle%&quot; -r | grep -i you
Profile Account Layout
Inbox Account Layout
Friends Layout Template
Account Layout
Shop Account Layout
Contributions Layout
Default Account Layout
Layout
Your Next Step
</pre>
<p>(the<em> -f &#8220;%menuTitle%</em>&#8221; option above tells the command to output only the <em>menuTitle</em> property of each asset).</p>
<p>Under the hood <strong>ls</strong> is calling <em>asset-&gt;getLineage()</em>, so I exposed a few of the getLineage API options to <strong>ls</strong>.</p>
<p>For example, this is one way of getting a sorted list of Survey templates on your site:</p>
<pre class="brush: bash; title: ; notranslate">

$ wgd ls root -r --includeOnlyClass WebGUI::Asset::Template -f &quot;%url% %namespace%&quot; | perl -ane 'print &quot;$F[0] ($F[1])\n&quot; if $F[1] =~ m/survey/i' | sort
root/import/expireincompletesurveyresponses/expireincompletesurveyresponses (ExpireIncompleteSurveyResponses)
root/import/survey/default-answer-edit (Survey/Edit)
root/import/survey/default-feedback (Survey/Feedback)
root/import/survey/default-gradebook-report (Survey/Gradebook)
root/import/survey/default-overview-report (Survey/Overview)
root/import/survey/default-question-edit (Survey/Edit)
root/import/survey/default-questions (Survey/Take)
root/import/survey/default-section-edit (Survey/Edit)
root/import/survey/default-survey-edit (Survey/Edit)
root/import/survey/default-survey-summary (Survey/Summary)
root/import/survey/default-survey (Survey)
root/import/survey/default-survey-take (Survey/Take)
root/import/survey/default-test-results (Survey/TestResults)
</pre>
<p>While I was writing this post, Andy asked me to provide him with a list of all Carousel wobjects on a site we&#8217;re working on. That&#8217;s as easy as:</p>
<pre class="brush: bash; title: ; notranslate">

$ wgd ls -r root --includeOnlyClass WebGUI::Asset::Wobject::Carousel
</pre>
<p>The most useful option I added to <strong>ls</strong> is the <strong>&#8211;filter</strong> smartmatch filter option. This option filters the results using an asset property of your choosing. Format looks like &#8220;%url% ~~ smartmatch&#8221;, where &#8220;url&#8221; is the field to filter against, and &#8220;smartmatch&#8221; is either a Perl regular expression such as &#8220;/(?i:partial_match)/&#8221; or a string such as &#8220;my_exact_match&#8221;.</p>
<p>For example, the following command lists all templates that include absolute urls. We generate the output to an html file so that someone can easily open all the links and manually review/remove the absolute urls:</p>
<pre class="brush: bash; title: ; notranslate">

$ wgd ls -r /root --filter &quot;%template% ~~ /http:///&quot; --includeOnlyClass WebGUI::Asset::Template --format &quot;&lt;a href=http://dev.localhost.localdomain/%url%?func=edit&gt;%url%&lt;/a&gt;&lt;br&gt;&quot; &gt; links.html
</pre>
<p>links.html then contains:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;a href=http://dev.localhost.localdomain/style_01?func=edit&gt;style_01&lt;/a&gt;&lt;br&gt;
&lt;a href=http://dev.localhost.localdomain/style_02?func=edit&gt;style_02&lt;/a&gt;&lt;br&gt;
&lt;a href=http://dev.localhost.localdomain/style_03?func=edit&gt;style_03&lt;/a&gt;&lt;br&gt;

...
</pre>
<p>One type of command that I can see myself using a lot in the future is the following, which displays all assets that are viewable to a specific group (in this case the &#8220;Turn Admin On&#8221; group, which has an id of &#8220;12&#8243;):</p>
<pre class="brush: bash; title: ; notranslate">

$ wgd ls -r root --format &quot;%groupIdView% %url%&quot; --filter &quot;%groupIdView% ~~ 12&quot;
12 root/import/newsletter
12 root/import/projectmanager/resource
12 root/import/wiki
</pre>
<p>Alternatively, you can use a variation of the above to list all assets that are NOT viewable to a certain group (or groups). This is great for finding assets that have accidentally been set to say, Admins, when you want them viewable by Registered Users. For example, the following command lists assets that are not viewable to the default &#8220;Visitors&#8221;, &#8220;Everyone&#8221;, or &#8220;Registered Users&#8221; groups:</p>
<pre class="brush: bash; title: ; notranslate">

$ wgd ls -r root --format &quot;%groupIdView% %url%&quot; | perl -ane 'print &quot;$F[0] $F[1]\n&quot; if !grep {$F[0] eq $_} qw(1 2 7)'
12 root/import/newsletter
12 root/import/projectmanager/resource
12 root/import/wiki
</pre>
<p>All of these commands take in the order of 1 second to run, which is a lot less time consuming than manually reviewing your site asset-by-asset. And if you incorporate them into your test suite, you can re-verify their output against your site policy/expectations whenever you like.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/ode-to-wgd-and-the-command-line/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Padre::Plugin::WebGUI</title>
		<link>http://blog.patspam.com/2009/padrepluginwebgui</link>
		<comments>http://blog.patspam.com/2009/padrepluginwebgui#comments</comments>
		<pubDate>Fri, 03 Jul 2009 08:42:06 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[WebGUI]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1155</guid>
		<description><![CDATA[For a little while now I&#8217;ve been working on a WebGUI plugin for Padre (the Perl Application Development and Refactoring Environment). Progress has been pretty slow, partly due to lack of time but also because often the things I want to do are at the edge of what Padre currently supports (or just that there&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>For a little while now I&#8217;ve been working on a <a href="http://webgui.org">WebGUI</a> plugin for <a href="http://padre.perlide.org">Padre</a> (the Perl Application Development and Refactoring Environment). Progress has been pretty slow, partly due to lack of time but also because often the things I want to do are at the edge of what Padre currently supports (or just that there&#8217;s no existing examples of how to do something easily).</p>
<p>I&#8217;ve released the code onto <a href="http://search.cpan.org/search?query=Padre%3A%3APlugin%3A%3AWebGUI&amp;mode=all">CPAN</a>, and the current dev version is available via <a href="http://github.com/pdonelan/Padre-Plugin-WebGU">github</a>, but since it&#8217;s all a bit hacky and alpha at the moment I thought it worthwhile doing a little tour of what currently works (on my dev box at least).</p>
<h2>Installation</h2>
<p>Installation is the same as any other Padre plugin, either install via cpan</p>
<pre class="brush: bash; title: ; notranslate">

cpan install Padre::Plugin::WebGUI
</pre>
<p>or from git:</p>
<pre class="brush: bash; title: ; notranslate">

git clone git://github.com/pdonelan/Padre-Plugin-WebGUI.git

perl Makefile.PL

make &amp;&amp; make test &amp;&amp; make install
</pre>
<p>Since this is a WebGUI plugin, you need to first install <a href="http://webgui.org">WebGUI</a>, and also <a href="http://github.com/haarg/wgdev">WGDev</a>.</p>
<p>Once you&#8217;ve done that, you will see the WebGUI plugin listed in the Padre Plugin Manager:</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/07/Screenshot-Plugin-Manager.png"><img class="alignnone size-medium wp-image-1160" title="Padre Plugin Manager" src="http://blog.patspam.com/wp-content/uploads/2009/07/Screenshot-Plugin-Manager-300x225.png" alt="Padre Plugin Manager" width="300" height="225" /></a></p>
<p>Click the enable button, and you&#8217;ll see a WebGUI item appear in the Plugin menu.</p>
<h2>Controlling WRE Services</h2>
<p>The first thing you can do with the plugin is control your WRE services (mysql, modperl, modproxy and spectre).</p>
<p>Click on: <strong>WebGUI &gt; WRE Services &gt; Modperl &gt; Restart</strong> and you&#8217;ll see a restart status message appear in the Padre output panel.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/07/restart-modperl.png"><img class="alignnone size-medium wp-image-1162" title="restart-modperl" src="http://blog.patspam.com/wp-content/uploads/2009/07/restart-modperl-300x261.png" alt="restart-modperl" width="300" height="261" /></a></p>
<p>Currently this is just a simple wrapper around the wreservice.pl script that ships with WebGUI. A nice enhancement would be to turn the menu item into a services dashboard with lights telling you which services are currently running, and buttons to start/stop/restart.</p>
<h2>Online Resources</h2>
<p>Another item in the menu called <strong>Online Resources</strong> gives you access to a bunch of handy WebGUI links that open in your browser &#8211; including one that takes you straight to a web-based IRC client connected to #webgui.</p>
<h2>WebGUI Log</h2>
<p>If you click the &#8220;Logview&#8221; checkbox on the WebGUI menu, a <strong>WebGUI Log</strong> panel will open. This panel will start monitoring all of your WRE log files (webgui.log, modperl.log, modproxy.log, etc..) and display changes in real-time. WebGUI uses Log4perl as its logging engine, but it <a href="http://www.plainblack.com/webgui/dev/discuss/log4perl-webgui-custom-filter">uses the sitename as the Log4perl category</a>, which means that you can&#8217;t easily e.g. turn on DEBUG output and filter out everything except the module you&#8217;re working on (unless you use my <a href="http://github.com/pdonelan/log4perl-filter-callermatch">Log4perl::Filter::CallerMatch</a> module). Once we add in the ability to easily customise what files are being logged and apply filters to what gets displayed, this will make the above scenario a breeze.</p>
<p>The logview panel uses a long-running Padre task and <a href="http://search.cpan.org/~mgrabnar/File-Tail-0.99.3/Tail.pm#select">File::Tail::select</a> to continuous monitor a bunch of files in realtime. The main thread writes commands to a temp file to send commands to the monitoring thread (the most important command being &#8220;exit&#8221; which tells the thread to break out of its monitoring loop!). Later I plan on adding support for other commands such as &#8220;add/remove this file from the list of files you&#8217;re watching&#8221;, &#8220;add/remove filter&#8221;, etc.. Since this seems like a generic sort of feature I&#8217;m hoping to bundle  Padre::Plugin::WebGUI::Logview and Padre::Plugin::WebGUI::Task::Logview as a stand-alone module for other Padre plugin developers to use (and improve).</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/07/logview.png"><img class="alignnone size-medium wp-image-1164" title="logview" src="http://blog.patspam.com/wp-content/uploads/2009/07/logview-300x230.png" alt="logview" width="300" height="230" /></a></p>
<h2>Asset Tree</h2>
<p>And finally, the coolect feature the WebGUI plugin has is the Asset Tree.</p>
<p>If you turn on the Asset Tree from the plugin menu, a new panel appears with a &#8220;Connect&#8221; button on it. Currently this is hardwired to the default WebGUI dev site at dev.localhost.localdomain but later I plan on adding a Site Manager to allow you to define sites here.</p>
<p>Double-clicking on the Connect button connects to the site, and pulls down the asset tree:</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/07/asset-tree.png"><img class="alignnone size-medium wp-image-1165" title="asset-tree" src="http://blog.patspam.com/wp-content/uploads/2009/07/asset-tree-300x184.png" alt="asset-tree" width="300" height="184" /></a></p>
<p>This is the same Asset Tree you see when you log in to your WebGUI site and turn admin mode on. As you can see from the screenshot, right-clicking on a node brings up a context menu, from which you can do asset-specific actions. The plugin already gives you access to all of the WGDev commands from the main plugin menu (with a dialog box asking you what arguments you want to pass to the command), but it becomes a lot more useful once you hook these WGDev commands to the Asset Tree context menu. Then instead of having to remember what url or assetId your asset has, you can just click through the tree to find the node you want, right-click and off you go.</p>
<p>For example, WGDev has a <strong>package</strong> command that lets you package up node and all of its children into a tarball that can be imported into other sites, used in upgrade scripts, etc.. By integrating this command into the context menu, you can have Padre prompt you you for the folder that you want to save the WebGUI package in (via your native Save File dialog box).</p>
<p>Similarly, WGDev has an <strong>edit</strong> command that lets you edit an asset (for example a template file) via your favourite editor and then have the changes pushed back into the database after you save and close the file. By integrating this command into Padre, you could leave the file open, and push the changes up every time you hit save(allowing for more convenient continuous editing).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/padrepluginwebgui/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Survey vs SurveyMonkey</title>
		<link>http://blog.patspam.com/2009/survey-vs-surveymonkey</link>
		<comments>http://blog.patspam.com/2009/survey-vs-surveymonkey#comments</comments>
		<pubDate>Mon, 04 May 2009 09:35:09 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[WebGUI]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1143</guid>
		<description><![CDATA[For my first post in the Enlightened Perl &#8220;Iron Man&#8221; get-more-people-to blog-outside-of-the-Perl-echo-chamber initiative, I thought it&#8217;d be fun to do a follow-up to my recent WebGUI Survey Goodies post, comparing our humble Perl powered Survey tool to the industry giant: SurveyMonkey. SurveyMonkey According to their official website, SurveyMonkey is &#8220;the leading survey tool on the [...]]]></description>
			<content:encoded><![CDATA[<p>For my first post in the Enlightened Perl &#8220;<a href="http://www.enlightenedperl.org/ironman.html">Iron Man</a>&#8221; get-more-people-to blog-outside-of-the-Perl-echo-chamber initiative, I thought it&#8217;d be fun to do a follow-up to my recent <a href="http://blog.patspam.com/2009/webgui-survey-goodies">WebGUI Survey Goodies</a> post, comparing our humble Perl powered Survey tool to the industry giant: <a href="http://www.surveymonkey.com">SurveyMonkey</a>.</p>
<h2><a href="http://surveymonkey.com">SurveyMonkey</a></h2>
<p>According to their official website, SurveyMonkey is &#8220;the leading survey tool on the web (ranked by Alexa), with over 80% of the Fortune 100 currently using SurveyMonkey&#8221;. Impressive stuff! They must have an awesome tool. Let&#8217;s see how Survey stacks up. I&#8217;m comparing Survey to the free version of SurveyMonkey, so if someone has a paid account and wants to let us know what extra features we&#8217;re missing out on that&#8217;d be great.</p>
<p>Let&#8217;s start with the SurveyMonkey <a href="http://www.surveymonkey.com/Home_FeaturesDesign.aspx">features</a> page.</p>
<blockquote>
<h2><strong>Design</strong></h2>
<p>Select From Over 20 Types of Questions &#8211; We support everything from multiple choice to rating scales to open-ended text. You can customize the layout of every question type for the ultimate in design flexibility.</p></blockquote>
<p>20 question types sounds impressive. I don&#8217;t think we have that many. Looking closer though, their list actually only numbers 15 in total, and some of them are redundant items like  &#8220;Multiple Choice (only one answer)&#8221;, &#8220;Multiple Choice (Multiple Answers)&#8221;. Ok, first win to SurveyMonkey! &#8211; we don&#8217;t have a drop-down list question type. But that&#8217;s only because no-one has asked for one yet &#8211; Kaleb could probably commit one faster than it took me to write this blog post. Digging deeper, most of the other question types could be recreated by playing with Survey&#8217;s per-question/answer settings such as horizontal/vertical display, etc.. Preconfigured bundles of questions are an interesting concept..  Survey has the concept of a multi-choice question bundle, which is a question plus all of its answers &#8211; these can be copied, and also saved so that you can deploy them at will anywhere in your survey, but it might be interesting to apply that concept to the Section level (SurveyMonkey doesn&#8217;t let you create your own bundles by the way).</p>
<p>Missing from SurveyMonkey&#8217;s arsenal are &#8220;Date Range&#8221;, draggable sliders (and dual-sliders), and a calendar-style date picker. So let&#8217;s call it even for now.</p>
<blockquote><p>Use Our Survey Templates, Create custom themes</p></blockquote>
<p>Yup, we&#8217;re fully templated, using the same template system (HTML::Template) that powers the rest of WebGUI. There appears to be some skinning you can do in SurveyMonkey, but the &#8220;Survey Template Library&#8221; is only listed for the pro version on their <a href="http://www.surveymonkey.com/Home_Pricing.aspx">Pricing Page</a>. I think we&#8217;re edging ahead at this point.</p>
<blockquote><p>Add a Logo to Your Survey</p></blockquote>
<p>Um..?? Well let&#8217;s see.. You can run Survey on your own domain, within a WebGUI site, however you please. And yes, that includes putting your logo wherever you like. (Looks like the logo feature is disabled in the free version of SurveyMonkey. bummer.).</p>
<blockquote><p>Validate Your Survey Responses</p></blockquote>
<p>SurveyMonkey has some nice per-question validation options that go beyond what Survey is currently capable of. They definitely beat us on this front. However that will change when we make the planned switch to <a href="http://javascript.neyric.com/inputex/">inputEx</a> for rendering html form elements &#8211; inputEx has a huge array of sexy looking form elements that can be easily wired up with validation logic.</p>
<blockquote><p>Randomize or Sort Your Question Choices</p></blockquote>
<p>Can do.</p>
<blockquote><p>Save Your Survey as a PDF</p></blockquote>
<p>Nice! That&#8217;d be a great feature to have. No doubt a solution is only one <a href="http://search.cpan.org/search?query=pdf&amp;mode=all">CPAN</a> module away, but right now SurveyMonkey has it and we don&#8217;t.</p>
<blockquote>
<h3>Collection Features</h3>
</blockquote>
<p>I won&#8217;t list all the features here but they mostly pertain to controlling who can access your questionnaires. Survey runs inside of WebGUI, so you have the full power of WebGUI Authentication/Authorization at your disposal. You have fine-grained control over who can edit surveys, take surveys and view reports. Want to use LDAP users? Easy. WebGUI Auth is fully pluggable too, so there&#8217;s nothing stopping you from integrating your site with whatever other infrastructure you already have. Survey also lets you set time windows on how long users have to complete a survey, which can be useful if data validity is important to you. I&#8217;m confident we win hands down here, although of course you need to be competent enough to set it up.</p>
<blockquote>
<h3>Analysis Features</h3>
</blockquote>
<p>I think SurveyMonkey has more web-based features here, since our current focus is to do only basic online reporting and let users export their data to something more powerful like SPSS for proper statistical analysis. There&#8217;s definitely a lot we can improve on here, although we&#8217;re completely driven by the features that end-users want, so only time will tell what we decide to implement on this front.</p>
<h3>OK, my turn</h3>
<p>Off the top of my head, here are some features that Survey has but appear to be missing from the free version of SurveyMonkey:</p>
<ul>
<li>Jump/Branching expression. The front page mentions &#8220;control the flow with custom skip logic&#8221;. Presumably that&#8217;s similar to our Jump Expressions (see my <a href="http://blog.patspam.com/2009/webgui-survey-goodies">previous post</a>). I&#8217;d love to do a detailed comparison of the relative power of their expression engine vs ours, but sadly it&#8217;s only available in the paid version. Ours gives you a very large subset of the Perl language to play with, so we&#8217;re probably winning here.</li>
<li>I hardly consider this a &#8220;feature&#8221;, but it looks like the free version of SurveyMonkey only lets you create 10 questions per survey, and you can only have 100 responses. And the free version doesn&#8217;t let you export your data to a spreadsheet program. Ouch!</li>
<li>Scoring, and branching based on scores</li>
<li>No sign of quiz mode with tabular and graphical feedback for the user to let them know how they scored  (see my <a href="http://blog.patspam.com/2009/webgui-survey-goodies">previous post</a>)</li>
<li>Visualisation  (see my <a href="http://blog.patspam.com/2009/webgui-survey-goodies">previous post</a>)</li>
<li>Drag and drop section/question/answer re-ordering. I can&#8217;t imagine see myself being very productive if I was trying to work on the 500+ question survey I&#8217;m building inside of the menu-driven SurveyMonkey interface.</li>
<li>The ability to modify the survey engine to do whatever custom magic you like</li>
<li>Complete control over your data ffs!This is the biggie as far as I&#8217;m concerned. Surveys built with SurveyMonkey store their data on the SurveyMonkey servers. Australia&#8217;s privacy laws are very strict about sending private data overseas, and I assume the same is true for other countries. You could land yourself in a world of trouble if you created supposedly &#8220;private&#8221; surveys where people were asked to enter personally identifying information (particularly if the data was medical related) and that data was stored overseas. You can pay to add SSL to your SurveyMonkey account, but there is no mention of database encryption, which is also something to ponder. At the end of the day, if you&#8217;re doing anything remotely private you should be self-hosting the data.</li>
<li>Have access to the code, which, among other things, means that you can build a comprehensive test suite for your complex 500+ question survey. For any complex Survey involving non-trivial branching logic, it&#8217;s invaluable to be able to build an automated test suite that independently verifies your branching and scoring logic (and makes sure that any future changes don&#8217;t break things). In Survey you can write this in Perl at the code level, interacting with Survey and the database via the WebGUI API, or using any programming language to create an automated &#8220;virtual user&#8221; that interacts with the Survey via the web interface (simulating page clicks etc..).</li>
</ul>
<h2>So&#8230;</h2>
<p>Overall that was a bit disappointing. I mean, there&#8217;s are definitely areas we can improve on, and I&#8217;m sure that the SurveyMonkey documentation and support is great, but for something that purports to be the best of breed, &#8230; well let&#8217;s just that that as far as the free version goes you&#8217;re pretty limited in what you can do. No doubt the paid version is better, and of course most people out there just want something simple that they can jump right in and start using with minimal fuss. But it seems to me that pretty soon you start running into limitations, especially with the free version.</p>
<p>Ok, enough of that, let&#8217;s get back to what&#8217;s new in Survey. Here are a couple of new features that have been added in the past week:</p>
<p>Firstly, Kaleb committed some code a few days ago that allows you to flag Sections as &#8220;logical&#8221;. What this means is that the section is hidden from the user, but appears in the admin screen and can have branching expressions defined for it. This is really handy if you have sophisticated branching logic and you run into a situation where you need an intermediate jump target. For example, it&#8217;s a common scenario to have a bunch of &#8220;pre-section&#8221; rules that you want to evaluate before letting the user start the section. Rather than duplicating these rules on every other node that jumps to the section, you can have those nodes jump to a pre-section node that evaluates the rules in one place.</p>
<p>Another awesome feature that was recently committed to the Survey repo (and that won&#8217;t cost you a banana) is tagging. The Survey expression engine now allows you to <strong>tag</strong> data as you go, which allows you to do all sorts of interesting things. For instance, say you&#8217;re doing one of those magazine pop-quizzes where you (very scientifically) classify people into personality types. After asking a bunch of dog-related questions, you can now say something like this in your branch expression:</p>
<blockquote><p>tag(&#8220;personality type&#8221;, &#8220;dog lover&#8221;) if score(&#8220;dog questions section&#8221;) &gt; 5</p></blockquote>
<p>That creates a new data field called &#8220;personality type&#8221; that is stored against the user&#8217;s response (in this case the stored data is the string &#8220;dog lover&#8221;). Later, you can actually use that tag inside another branch expression to only show a bunch of questions to the dog lovers:</p>
<blockquote><p>jump { tag(&#8220;personality type&#8221;) eq &#8220;dog lover&#8221; } &#8220;more dog questions section&#8221;</p></blockquote>
<p>Or you could use that tag inside the text of another question as templated text:</p>
<blockquote><p>Clearly you&#8217;re a [[personality type]]!</p></blockquote>
<p>..which would appear to the user as:</p>
<blockquote><p>Clearly you&#8217;re a dog lover!</p></blockquote>
<p>And finally, the tagged data is stored as part of the user&#8217;s response data, meaning that you can pull it out of the database later (using another WebGUI asset like SQLReport or your own custom code) and do whatever you like with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/survey-vs-surveymonkey/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WebGUI Survey goodies</title>
		<link>http://blog.patspam.com/2009/webgui-survey-goodies</link>
		<comments>http://blog.patspam.com/2009/webgui-survey-goodies#comments</comments>
		<pubDate>Thu, 09 Apr 2009 08:12:20 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[WebGUI]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1126</guid>
		<description><![CDATA[Kaleb (aka perlmonkey2) and I have been rounding out WebGUI&#8216;s Survey wobject with a bunch of features over the past couple of weeks. Here&#8217;s a run-down of some of the highlights: Improved Visual Feedback The Survey Edit page now uses &#8220;Loading&#8230;&#8221; progress masks whenever it&#8217;s busy doing something. When you&#8217;re dealing with large data sets [...]]]></description>
			<content:encoded><![CDATA[<p>Kaleb (aka perlmonkey2) and I have been rounding out <a href="http://webgui.org">WebGUI</a>&#8216;s Survey wobject with a bunch of features over the past couple of weeks. Here&#8217;s a run-down of some of the highlights:</p>
<h3>Improved Visual Feedback</h3>
<p>The Survey Edit page now uses &#8220;Loading&#8230;&#8221; progress masks whenever it&#8217;s busy doing something. When you&#8217;re dealing with large data sets (and slow servers) it&#8217;s really handy to be able to see when the page is busy doing loading/saving/etc..</p>
<p><img class="alignnone size-full wp-image-1127" title="load-mask" src="http://blog.patspam.com/wp-content/uploads/2009/04/load-mask.png" alt="load-mask" width="326" height="127" /></p>
<h3>Multi-choice Bundles</h3>
<p>Survey ships with a bunch of useful multiple-choice question bundles to get you going. Some of these are very generic such as Gender (Male/Female), Yes/No, etc.. Others are more specific to single domain, such as Confidence (an 11 answer scale from &#8220;0 &#8211; Not at all confident&#8221; to &#8220;10 &#8211; Extremely confident&#8221;). Of course, every site is going to want a different set of re-usable bundles. You can now create your own bundles, and add/edit/delete the default ones.</p>
<p><img class="alignnone size-full wp-image-1128" title="multichoice-bundles" src="http://blog.patspam.com/wp-content/uploads/2009/04/multichoice-bundles.png" alt="multichoice-bundles" width="180" height="99" /></p>
<h3>Validation Warnings</h3>
<p>Now that Survey is a complex beast, allowing you to do all sorts of fancy things, it pays to have some automated checking of various things that could go wrong. The Edit Survey page constantly checks your Survey instance for warnings, and alerts you if anything smells bad.. everything from using Jump Expressions when enableSurveyExpressionEngine is disabled for your site, to duplicate Section/Question variable names, circular Jump targets, all the way up to full-blown Expression Engine compilation &amp; pseudo-execution checking.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/04/warnings.png"><img class="alignnone size-medium wp-image-1131" title="warnings" src="http://blog.patspam.com/wp-content/uploads/2009/04/warnings-300x215.png" alt="warnings" width="300" height="215" /></a></p>
<h3>Survey Summaries</h3>
<p>This is a long-awaited feature curtesy of Kaleb. You can now define which answers are correct, and assign arbitraty numeric scores to them. Then, when the user reaches the end of the Survey, they get shown their quiz results &#8211; both numerically (in a <a href="http://developer.yahoo.com/yui/datatable/">YUI DataTable</a>) and graphically (with<a href="http://developer.yahoo.com/yui/charts/"> YUI Charts</a>).</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/04/summaries.png"><img class="alignnone size-medium wp-image-1133" title="summaries" src="http://blog.patspam.com/wp-content/uploads/2009/04/summaries-300x253.png" alt="summaries" width="300" height="253" /></a></p>
<p>Coming soon to this department will be the ability to display quiz summaries at the end of individual sections rather than just all at the end.</p>
<h3>Visualisation</h3>
<p>Meanwhile, I&#8217;ve been building a tool to allow you to visualise the branching structure of a Survey using <a href="http://search.cpan.org/~lbrocard/GraphViz-2.04/lib/GraphViz.pm">GraphViz</a>. Here is an example of a real-world Survey instance that has ~500 questions. Turning this into a button that allows you to generate visualisations on the fly from the Edit Survey page on your own site is just a matter of sorting out the last remaining issues with GraphViz/ImageMagick support in the wre.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/04/visualisation.png"><img class="alignnone size-medium wp-image-1135" title="visualisation" src="http://blog.patspam.com/wp-content/uploads/2009/04/visualisation-300x188.png" alt="visualisation" width="300" height="188" /></a></p>
<h3>Branch Expressions</h3>
<p>This has been the main focus of my work, and probably deserves a post all to itself. Survey now has a dedicated expression engine, which allows you to control branching using a large sub-set of the Perl language. Expressions are evaluated using <a href="http://search.cpan.org/~rgarcia/Safe-2.16/Safe.pm">Safe</a> module, which limits what opcodes the expression can generate and limits access to only the variables that we chose to expose. Of course, even Safe.pm has caveats about what it can and can&#8217;t protect you from (for example infinite loops), so it&#8217;s important to note that the expression engine is disabled by default, and can only be enabled by site administrators in the WebGUI site config file.</p>
<p>When it comes down to it, branch expressions are just perl code, so you have a whole lot of power at your disposal. You can access recorded responses for the user by supplying the Section/Question variable name to the value() sub:</p>
<pre class="brush: perl; title: ; notranslate">

value(variable_name);
</pre>
<p>To actually trigger a branch, you call the jump() sub:</p>
<pre class="brush: perl; title: ; notranslate">

jump { value(q1) == 1 } section3
</pre>
<p>That says, if the user&#8217;s recorded response value to q1 has a numeric value of 1, jump to section 3.</p>
<p>Here&#8217;s a more advanced one:</p>
<pre class="brush: perl; title: ; notranslate">

jump { score(q1) &gt; 5 and value(q2) =~ m/textmatch/ } section3;
jump { avg(value(q1), value(q2), value(home/anotherSurvey, q3)) &gt; 10 } section4;
</pre>
<p>The above expression demonstrates some of the cooler branch expression features:</p>
<ul>
<li>Two alternative jump clauses</li>
<li>Branching based of Question score  (if you ask for score(Section) you get the total score for that section)</li>
<li>Text matching (you have the power of Perl at your disposal after all)</li>
<li>Calling a utility function, in this case avg(). The expression engine makes available a bunch of handy utility functions, such as all of the subs from List::Util (min, max, sum, etc..)</li>
<li>Resolving the recorded response value from another survey instance altogether (the first argument to value() and score() can be an assetId or an asset url.)</li>
</ul>
<p>Behind the scenes, the ExpressionEngine is quite nice too, telling you what it&#8217;s doing along the way, which makes debugging complex expressions quite painless.</p>
<p>Along with all these changes, the test suite continues to grow. Check it out in the <a href="http://getwebgui.com">next WebGUI beta</a> and let us know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/webgui-survey-goodies/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WebGUI Carousel Wobject</title>
		<link>http://blog.patspam.com/2009/webgui-carousel-wobject</link>
		<comments>http://blog.patspam.com/2009/webgui-carousel-wobject#comments</comments>
		<pubDate>Mon, 06 Apr 2009 06:41:32 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[WebGUI]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1111</guid>
		<description><![CDATA[There&#8217;s a new wobject coming in the latest WebGUI beta (version 7.7.3), called Carousel. On the surface, it&#8217;s a nice little integration between WebGUI and YUI, but below the surface it&#8217;s a great multi-purpose tool for rendering content dynamically in Javascript or Flash. It&#8217;s a common requirement to want to display rich text via Javascript [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-1114 aligncenter" title="Carousel Wobject" src="http://blog.patspam.com/wp-content/uploads/2009/04/mailgooglecom.jpeg" alt="Carousel Wobject" width="322" height="192" /></p>
<p>There&#8217;s a new wobject coming in the latest WebGUI beta (version 7.7.3), called Carousel. On the surface, it&#8217;s a nice little integration between WebGUI and YUI, but below the surface it&#8217;s a great multi-purpose tool for rendering content dynamically in Javascript or Flash.</p>
<p>It&#8217;s a common requirement to want to display rich text via Javascript or Flash. For example you might have a clickable diagram that shows different text depending on what part of the diagram a user clicks on.</p>
<p>Giving content managers access to the dynamic text can be rather cumbersome. In the worst case scenario the text is hard-coded in the Flash or Javascript source, out of reach of the content manager. Better solutions are where you have a bunch of editable Articles or Snippets that the Flash or Javascript reads from.</p>
<p>None of these solutions are very satisfactory though, because as far as the content manager is concerned the dynamic object is a single asset, and they really want a simple way to edit all of the text elements from the same place.</p>
<p>We designed the new Wobject specifically for this scenario. The Edit Screen of the wobject allows content managers to add as many rich text editor (RTE) boxes as they like (dynamically, a la FilePile). These RTEs are displayed one after the other on a single screen, allowing the content manager to edit all of the text in a single place. For each RTE, the content manager can also specify a unique ID.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/04/carousel-edit.png"><img class="alignnone size-medium wp-image-1112" title="carousel-edit" src="http://blog.patspam.com/wp-content/uploads/2009/04/carousel-edit-300x225.png" alt="carousel-edit" width="300" height="225" /></a></p>
<p>By default, the template for the Carousel wobject renders your RTE items into an attractive YUI Carousel widget:</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/04/carousel-view.png"><img class="alignnone size-medium wp-image-1113" title="carousel-view" src="http://blog.patspam.com/wp-content/uploads/2009/04/carousel-view-300x38.png" alt="carousel-view" width="300" height="38" /></a></p>
<p>The Wobject template does this by looping over all of the RTEs and generating markup expected by the YUI Carousel widget. This has the nice side-effect of allowing your widget to gracefully degrade in non-js browsers.</p>
<p>Taking a step back, we have a WebGUI wobject that lets us manipulate a collection of RTEs. The only part of the wobject specific to the YUI Carousel is the template. Let&#8217;s have a look at it:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div class=&quot;yui-skin-sam&quot;&gt;

...

&lt;tmpl_if item_loop&gt;
&lt;div id=&quot;&lt;tmpl_var assetId&gt;&quot;&gt;
&lt;ol&gt;
 &lt;tmpl_loop item_loop&gt;
	&lt;li class=&quot;item&quot; id=&quot;&lt;tmpl_var itemId&gt;&quot;&gt;
 &lt;tmpl_var text&gt;&lt;/li&gt;
&lt;/tmpl_loop&gt;&lt;/ol&gt;
&lt;/div&gt;
&lt;script&gt;
 YAHOO.util.Event.onDOMReady(function (ev) {
 var carousel = new YAHOO.widget.Carousel(&quot;&lt;tmpl_var assetId&gt;&quot;, {
 isCircular: true,
 numVisible: 1,
 animation: { speed: 0.5 }
 });
 carousel.render(); // get ready for rendering the widget
 carousel.show();   // display the widget
 });
 &lt;/script&gt;

&lt;/tmpl_if&gt;&lt;/div&gt;
&lt;/script&gt;
</pre>
<p>We can just as easily create our own template to do something else with the data. Returning to our original example, say you want to use the RTE text in a Flash diagram. All you have to do is change the template to output the contents of each RTE into a textarea dom element, styled to be hidden from view, with the id attribute set to the RTE unique id. Then, your Flash (or Javascript for that matter) can easily read in the rich text via DOM methods (e.g. <em>document.getElementById(RTE_unique_id).value</em>) and display it dynamically and/or do whatever it likes with it.</p>
<p>For example, we might use a template such as:</p>
<pre class="brush: xml; title: ; notranslate">

&lt;tmpl_loop item_loop&gt;
 &lt;textarea id=&quot;&lt;tmpl_var itemId&gt;&quot; style=&quot;visibility: hidden;&quot;&gt;&lt;tmpl_var text&gt;&lt;/textarea&gt;
 &lt;/tmpl_loop&gt;
</pre>
<p>The only coordination required is that the person deploying the wobject would need to know how many text blocks the flash/javascript expects, and what unique ids to use.  For some flash/javascript widgets you could ignore unique ids altogether by adding a special class attribute to the generated textareas and then using a class selector to dynamically select all matching textareas on the page.</p>
<p>This should make it easier to use dynamic flash/javascript widgets in WebGUI whilst still retaining the power and ease of use of a content management system.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/webgui-carousel-wobject/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

