JavaScript

SWFUpload with Ext JS Buttons

For the longest time I am have been using Ext JS to write the Administration Tools for the Indianapolis Motor Speedway and the Indy Racing League where I work. Some of the tools required uploading of large files to where I would use the SWFUpload library to achieve this functionally. With the introduction of Flash 10 to where you can not have JavaScript call the method to open the dialog box any more this presented a problem. The generally accepted workaround is to have the flash object be transparent and over the button but this doesn’t allow the button to have events or allow you to do hover overs and the such, Until Now.

read more

Building Admin Tools With JavaScript and PHP

So part of my job at the Indianapolis Motor Speedway is writing Admin Tools for our users to administer the sites with.  There are a mix of older admin tools which don’t use any JavaScript and newer admin tools where the front end is completely based on JavaScript.

I was recently asked to build an admin tool to allow one of our users to maintain the drop down portions of the site navigation since they can change with each passing event that happens at the track. This presented the following problems:

  • Navigation is stored in a XML file
  • The navigation XML file is versioned with Subversion
  • The admin had to be easy to use.

What I started with was trying to figure out the whole svn integration thing as I had to figure out a way to make sure that the working copy was always current and that when the user saved the navigation it did a commit on the file to that way it would always be the latest version in the repository.

Problem 1: SVN does not allow you to checkout a single file to be a working copy.  I found this to be a problem as I didn’t want the whole directory, I just wanted the navigation.xml file.  I did some searching on the SVN bug tracker and found a perl script that David Kilzer wrote that allowed me to check out a single file.  Problem 1 is solved.

Once I got the file checked out into the working directory on the server i preceded to write a shell script that updated the file via an svn up command that would be ran on my fetch script before I read in the XML file to pass it back to the JavaScript.

Now that I have the XML back in my front end i can display it. Here is what the admin tools looks like when you have selected which site you want to edit.

IMS Sites Navigation Admin

As you can see from the screen shot everything is layout in an easy to browse tree view.  You can move the child nodes around to order then or place them in any parent menu that you like.  There is a simple edit and add features.  The adding also incorporates a feature from our Site Pages admin that allows you to select from a page in there so you don’t have to copy and paste a link from the pages admin to this admin.

Once the user gets done with any changed they may have they can select the save button and that passes it back off to the PHP backend where it writes out the xml file and then does an svn ci on the file which places it back in the SVN repository and also promotes it to production via a set of PHP and bash scripts to interface with the SVN repository.

All in all using the ExtJS Library and PHP to build the admin tools for the IMS sites has dramiticly cut down on the time it takes to do everything since I have a very good understand of how everything in ExtJS works and when I don’t there is a great documentation resource out there.

read more

Following Apple on the road to rich web apps

Thanks to the guys over at tuaw.com for linking to this article.

———————————

Roughly Drafted has an interesting (and long) article that discusses Apple, Adobe, Google and Microsoft, and their different approaches to developing rich applications for the web. The article is very readable for a non-technical audience, and well-researched, too.

The article contrasts Apple’s mature development tools and platform frameworks with Google’s new open-source tools (like Google Gears). Further, it discusses closed frameworks like Adobe Flash and Microsoft Silverlight, and why Apple is ignoring those in favor of open-source, standards-based development for both apple.com and support for the iPhone.

Then it gets good. Daniel Eran Dilger writes about Charles Jolley’s SproutCore, a JavaScript framework that Apple has adopted for its own rich web apps, based on a Cocoa-like model-view-controller foundation with bindings, key value observing, and view controls. Think JavaScript on Rails. SproutCore bares its teeth at Adobe’s development tools, all ready to show off in Apple’s upcoming release of Mobile Me.

“That makes SproutCore a light Cocoa alternative for deploying web apps that look and feel like Mac OS X desktop apps,” Dilger writes.

read more

WiiExtJS: Building Ajax apps that run on the Wii Opera browser

Shea Frederick has posted on building Wii-friendly web pages using the ExtJS library.

Shea focuses on the various issues that come up when building something for the Wii resolution, screen size, input types, and more.

For example, check out the layout:

Ext.ns('Ext.ux.layout');
Ext.ux.layout.wii = Ext.extend(Ext.layout.FitLayout, {
    setItemSize : function(item, size){
        var viewSize = Ext.getBody().getViewSize();
        this.container.addClass('ux-layout-wii');
        item.addClass('ux-layout-wii-item');
        size.height = (viewSize.height-60);
        size.width = (viewSize.width-60);
        item.setSize(size);
    }
});
Ext.Container.LAYOUTS['wii'] = Ext.ux.layout.wii;

And then you can detect the Wii to set this layout:

Ext.isWii = navigator.userAgent.toLowerCase().indexOf("wii") > -1;
var layout = 'fit';
var title = 'Normal';
if (Ext.isWii) {
    layout = 'wii';
    title = 'Wii';
}
read more