Friday, May 19, 2006

Scripting: File Queue

I created a sister script to my file queue script that allows anyone editing a file on the development site to queue that file for upload to the live site. This is should ease the development process a little as it allows the communications staff to create/edit a page and queue it for upload without any involvement from me or the rest of the technology staff.

In order to make the script as easy as possible to use I made some modifications.
  1. The script checks the referrer page to determine what file to upload. No user input necessary.
  2. I created a loop to ensure that the destination directory(ies) exist so no copy errors are encountered.
  3. I added a RegEx that filters the body for image tags, grabs the src attribute, and uploads those images as well.
I copied the folder creation updates back to my original script so that I don't have to worry about creating those prior to uploading a file.

I may make a further modification to the original script that uses a RegEx to grab all externally referenced files. These would then be presented back in a selection list to the user. This will make it easier to queue a page because I won't have to queue each individual element of the page separately.

AAAS: Taking Over

With KG (AAAS webmaster) leaving I've been asked to take over some duties for her temporarily, mostly just posting a news item here or there. The process isn't too tedious and shouldn't take up too much of my time once I've done it a few time.

One interesting aspect of the job will be to update the RSS feed. I've not played with RSS much beyond using them through My Yahoo!. There are a number of feed editors out there but I found two that are a) free and b) easy to use. Of course, the output they generate differs in one significant way, the content is entity-encoded in RSS-W but surrounded by a CDATA delimeter in RSS-B. Both appear to be valid methods of creating an RSS 2.0 document. I like RSS-B better but it does not use the same formatting used up until now. After talking to KG, though, I think I'll use it as she seemed to think using CDATA was more SGML-y, meaning it was likely more XML-y.

References:

Wednesday, May 10, 2006

Scripting: "Print this page"

The "Print this page" functionality I developed for the Web site recently broke with the introduction of a new template. The main reason was my reliance on a regular expression to parse the document for the sections that would need to be output on a printer-friendly version of the page. The new template was missing text I had been using delineate these sections.

Unfotutnately, to accommodate the new templates (and any future additions) would have required writing a different regular expression for each template because there was no other text delimeters unique enough to work for all templates. I like to keep my programming as generic as possible so I decided to use the HTML::Parser module to pull the various sections from the document. This particular object will work fine for all pages using the AAAS template since I can rely on tags common to that template rather than text specific to any sub-templates being used.

It took a bit of trial and error to get things to work but I think I'm finally starting to get the hang of how the module works. The basic procedure is to find a tag of interest such as a div tag with the attribute id="contentBox" (which contains the document content) and then add handlers to the parser to grab all text contained within that element. You can add and remove handlers at will as the parser runs, making it easy to catch blocks of text in one pass.

The only thing I'm not sure of at present is if it's possible to capture sub-blocks easily. Thinking about it briefly, though, leads me to think that by assigning the desired output to a variable and then parsing that variable for the sub-blocks would be a feasible method.

Tuesday, May 02, 2006

Scripting: Sending e-mail

I was searching around the Web trying to find some good information on e-mail line length in relation to IERI R3. I much knew that a line length of 78 was the max, but I wanted to find out if there were better guidelines as to the formatting of e-mail. Dan's Mail Format Site has a good article on line length. Something new I learned is that quoted-printable encoding isn't necessarily the best method for avoiding line-length display problems in e-mail clients. quoted-printable is more important from an e-mail transmission point of view by keeping line lengths within the appropriate limits. However, if the e-mail client doesn't reflow the message after removing any soft breaks created by the QP encoding then long lines will still be a problem. the format=flowed Content-Type parameter (which I had been using for the mass mail templates ... though without a full understanding) is more important from a display point of view.

I'll need to do a little more investigation and testing to determine how best to format messages, particularly with regards to client display. While I was looking at this in terms of IERI R3, the information I found will require some modification to the mass mail scripts as well.

Monday, May 01, 2006

Scripting: AAAS Site Template & IE7

I've been testing out IE7 ever since Microsoft released the public beta. There are a few things that need to be fixed with the JS/CSS code I've developed. I hope to address these issues in the next few weeks.

On top of these problems I noticed there were issues with the main AAAS template. The left-side expandable menu navigation was failing horribly and completely unusable. Luckily the fix came to me easy enough as I noticed one of the library functions, the publicly available lib_bwcheck (which hasn't been updated since who knows when), was not detecting IE7 correctly. A quick fix and everything was working like normal.

I've passed the information on to KG.