I was demoing our product for a couple of pretty smart guys last week. One of them pointed out that it would be greatly improved by having better web design. I believe the phrase was something along the lines of “technologists aren’t necessarily the best designers”. So, when I went home, I took another look at things with fresh perspective. And I didn’t like what I saw. The problem is that I’ve been incrementally improving the appearance of Webmin for seven years or so, via icon replacement and mild CSS theming. Another round of that resulted in the current version of the theme, which has some reasonably functional improvements: a left-hand menu with JavaScript expansion, great icons by David Vignoni, and a lot of CSS styling to make it all seem less clunky and old-fashioned. Jamie was so enthusiastic about some of the changes that Webmin now has a version of it as the default theme (this doesn’t happen very often, as Jamie is relatively slow to adopt new client-side technologies in Webmin because they can prevent folks from using it).
Here’s a picture of the current version:

Pretty stark and white, huh? Not really much to get excited about. But so much better than the old standard Webmin themes that it always seemed pretty good. It’s all about perspective…I just had to look around at other web-based interfaces to see that I had been shooting for the wrong target, “better than it is now”. Instead, the only sane thing to do is shoot for “as good as the best on the web”.
To do that we’ll need AJAX, obviously. New stylesheets. And a lot of grunt work to transform Webmin’s table-based layouts into a pretty, clean, and style-able form.
AJAX
In the past, when we needed some dynamic elements on the page, I wrote it myself. Since I didn’t speak JavaScript very well, this meant almost no JavaScript was used. We had collapsing menus and elements, and Jamie wrote a few form validation elements. But mostly, we were living in an AJAX-free zone. No more.
I’ve looked at JavaScript libraries in the past, and marveled at how far the little language has come, but as of this past weekend, I’ve drunk the Kool-aid. I’ve added the Yahoo! UI library and the yui-ext libraries by Jack Slocum to our pages. Every element on every page is getting a makeover. No page, no UI component, no input field, no database display, no address box, nothing in our UI will be left unturned. First step was to convert the front page to make use of Jack’s layout functions in yui-ext.
Here’s the code for the layout:
Layout = function(){ return { init : function(){ var layout = new YAHOO.ext.BorderLayout(document.body, { north: { split:false, initialSize: 35 }, west: { split:true, initialSize: 200, titlebar: true, collapsible: true, minSize: 100, maxSize: 400, tabPosition: top }, center: { autoScroll: true }, south: { split:false, initialSize: 24 } }); layout.beginUpdate(); layout.add('north', new YAHOO.ext.ContentPanel('header', {fitToFrame:true})); layout.add('west', new YAHOO.ext.ContentPanel('wmnav', {title: 'Webmin', fitToFrame:true, closable:false, autoScroll:true})); layout.add('west', new YAHOO.ext.ContentPanel('vmnav', {title: 'Virtualmin', fitToFrame:true, closable:false, autoScroll:true})); layout.add('south', new YAHOO.ext.ContentPanel('statusBar', {fitToFrame:true})); center = layout.getRegion('center'); center.add(new YAHOO.ext.ContentPanel('right', {fitToFrame:true})); layout.endUpdate(); } } }();
And here’s what it looks like:

Pretty slick, huh? Of course, there’s also a big bundle of style sheet changes in the right hand content pane, and you’re also seeing a conversion of the menu in the left hand pane to a yui-ext tree (which needs new images), but the layout alone is a miraculous change in the feel of the app.
Over the next week or two I’ll be covering each of the steps I make in transforming our rather large application from a traditional CGI web app to a wholly AJAX-ified, interactive, rich user interface…stay tuned.
BTW-If you’re learning JavaScript, I found the videos by Douglas Crockford at the YUI Theater absolutely priceless. In about four or five hours, I learned enough about JavaScript to begin writing my own extensions to yui-ext. I’m a JavaScript slinger extraordinaire now, all thanks to Doug’s videos.

Mike | 29-Oct-07 at 4:10 pm | Permalink
Joe, did you go any further with YUI or some other ajax framework?
I need to write a module using ajax, and I’ll try to keep it consistent with any existing conventions in the Webmin community — but I’m not seeing much in the way of ajax in the Webmin community!
Mike
joe | 29-Oct-07 at 5:38 pm | Permalink
Hey Mike,
I ended up completely using extjs (http://extjs.com), and its new base components–I’ve dropped out all of the yui reliance in my own code, as well. I’m writing some more blog posts about it as we speak.
Hopefully, name space usage is getting common enough across frameworks that one could safely use extjs with other AJAX frameworks. But, I think it’s safe to say that we will be doing an extjs module in the future, so that modules and themes can call it from the same place (some of these frameworks are quite large at this point, so loading them from the same place allows browser caching to speed things up a lot). Another developer in the Virtualmin forums discussed his use of Prototype and Scriptaculous (I believe). He built a module to house it, and then all of his modules called it from the module path…since Webmin has a hidden flag in the module.info file, you can distribute modules that are just libraries used by other modules or themes, but will never show up in the UI.
I’ll try to get that conversion made soon, and go ahead and start distributing the extjs module. It would be nice to start seeing a little AJAX-y development happening in third party Webmin modules and themes…and if we can standardize on one framework, that’d be even better. ExtJS has the best looking widgets, in my opinion, so it’s the one we’ll be pushing. But we’re not going to force anything on other developers (we’re even planning on making Webmin development easier for Ruby and Python developers…PHP might even be possible in the future, though it’s a little clunky in CGI mode and running PHP embedded in Perl is a pretty onerous requirement for end users).
Mike | 30-Oct-07 at 3:09 pm | Permalink
Cool! Good call on ExtJS, they’ve done a nice job. It’s probably overkill for my needs (just populating select boxes) so I’ll go ahead and roll some simple XHR stuff, but if you have an extjs module in the works it would be cool to leverage that for nicer/unified UI.
Thanks for the pointer to the Virtualmin forums… I’ll get connected over there too.
joe | 31-Oct-07 at 4:03 pm | Permalink
I’ve just posted to the Webmin blog about wrapping up a JavaScript library for use in Webmin across multiple modules and themes. http://inthebox.webmin.com/sharing-javascript-code-in-webmin
I’ll be adding a few more helper functions and wrap it up for general use in the next few days.
Mike | 06-Nov-07 at 4:19 pm | Permalink
Just saw this — thanks for the followup. I’ll keep my eye on your various media outlets for news….