Thursday, September 29, 2005

Bug: Internet Explorer standards mode and element scrollbars

I've run into a problem with my ActiveMenu script. When IE6 is running in standards mode (vs quirks mode) the width calculation of a box gets a bit screwed up because IE6 doesn't take into account scrollbars while calculating the width of an object. This means that objects with a defined height and overflow: auto or overflow: scroll will end up wider than either a calculated or assigned width. The width discrepency is a problem because the presence of scrollbars modifies the working width of a box, which affects the layout of the box.

While I was able to find a few mentions of this problem, no real information seems to be available. Certainly no indication of a fix through either styles or scripting. See:
Unfortunately none of the big guys out there seem to have documented this problem. I may post a bug report on QuirksMode.

How this afffects Active Menu
If no width is specified for the story box then the area next to the floated headline list is calculated and used. Regardless of whether the width is specified or calculated, if scrollbars are added the story box is widened and no longer fits in the area next to the float. As a result the story box gets pushed below the float.

I worked around the problem by modifying the width of the story box when the document.compatMode property indicated that the page was being rendered in standards mode (via PPK) in IE6. One drawback of this approach is that the width is no longer flexible in IE6, though I could maybe add a function to correct it onresize of the parent div. I should maybe also consider disabling this check if the user has set the width of the story box in via CSS, under the assumption that they have taken the scrollbar problem into consideration.

I haven't tested in other versions of IE.

I'm not sure if this is also a problem with height calculations, though that would likely cause few problems with the document layout.

Friday, September 23, 2005

Mass e-mail list script updates

I modified the database/scripts so that actions performed by end users (subscribing, unsubscribing, updating e-mail address) are recorded in a separate table. The reason behind this update is so that I can keep the e-mail subscription database and the ichaos database synchronized.

The update is a simple INSERT that runs after each list update. The new table (MassEmailManage) has columns for old email address, new email address, action, and list id. I'll manually check it once a week or so to see if any ichaos updates need to be made.

Also, it'll be interesting to see how much activity these pages see.

Thursday, September 22, 2005

Home page redesign

I've pretty much completed the redesign of the home page. While the initial design phase was pretty easy the follow-up of creating a structurally clean, progressively enhanced page took a bit longer than I expected.

The page consists of four sections at present:
  • header
  • "What's New" headlines
  • quick links
  • brief introduction
The header and introduction were fairly straightforward. A float on the logo was the most advanced styling used. The other two sections took much longer since I wanted the page to work structurally for browsers that couldn't placed the headlines in the dt and the related story in the dd. If an image was also used, it would be placed in another dd above the story.

The next step was to style the list for browsers that aren't DOM-compliant (since I use the DOM extensively in the creation of active portions of the menu). What I wanted was fairly simple, the headline having a background color spanning the width of the content area with the entire area clickable. Below the headline and indented much like a normal definition list is the associated story. If an image is present it would be floated to the left of the story. I was able to achieve the design I wanted in modern browsers and most of the based CSS is used in the interactive version as well. In Nav4 the menu looks pretty much like a normal definition list, but I decided to hide the images because Nav4's styling capability made it difficult to get the desired effect.

The script runs once the page is loaded. Since this is a first version, the structure expected is pretty strict (I expect I'll be able to clean it up when I work on future versions). The script applies a class to the menu so that the styling used for the interactive elements is added. The script creates a styled unordered listed (ul) for the headlines. The headlines are pulled dynamically from the dts and so no extra work beyond filling out the definition list is required when implementing. I used a lot of DOM coding to generate the list such as createElement, appendChild, and insertBefore.

I have yet work on the printable view, but I'll probably hammer it out while I'm documenting the code.

Multi-Column List
The design for the quick links was fairly advanced when considering the capabilities of current web browsers ... a two-column list. While I could have easily used a table or two lists and floating or some other mechanism, the desire to maintain a semantically meaningful structure made these options undesireable.

With this in mind I tried to find a method of spreading a list across two columns that would not require breaking the list into parts. Plus I wanted to keep the amount of work required to edit the list at a minimum. After a bit of searching I found an article about multi-column lists on builder.au that gave me a good start (later ALA published their own article on this topic as well). I ran into a few problems during development ... mostly with IE (see below). The multi-column list feature I ended up with isn't nearly as robust as I had hoped to make it, but it performs the intended function pretty well.

The list script relies on a standard list (ul or ol). The user doesn't need to do any prep-work beyond applying a class to the list, attaching the JavaScript, and attaching the base stylesheet. Of course extra styling can be done by the user, and I had to do this for the home page so that I could make the multi-column list function flexible enough for library code.

Once the page loads the script looks for any list with the required class. Once a list is found a second class is added that provides the base styling needed for multiple columns (though I'm thinking of moving some of this functionality to the script ... we'll see once I start working on the documentation). The script determines the height of each list item and then uses that information to decide where to divide the list (right now the script can only handle a two-column list). The first element of the second column is given a top and left margin so that it sits next to the first column. The following list items are then given a left margin. Finally, the last element of the list is given a height value so that elements following the list don't overlap it.

There are a couple of issues and enhancements I'd definitely like to make. Currently I have the list item markers disabled due to various browser problems. The list doesn't handle width resizing at all (can I use percentage for the positioning?). I had to use a recursive function to watch the height of the list to handle height resizing (there may not be any other way around this, but maybe percentages or ems can help here as well).

Again, I have yet to work on the printable view, but I'll probably work on it while I'm documenting the code.

References
IE quirks
Unrelated to this work I came across an article that provided some information that helped during development. On the MSDN site there's an article about the hasLayout property. The property seems fairly innocuous, but reading up on it is important for understanding some of the styling weirdness that can be encountered in IE. Even better, there's a link to another article that gives a lot of good info, including how styling a list with layout can get ugly.


Now that I'm done with the home page I'll be spending a few days documenting the scripts for the code library.

Thursday, September 08, 2005

JS Library: Show/Hide Content

I've finally, finally, completed some code documentation. This is a little JS I wrote to hide content and then show it when a link is clicked. It's nothing special, but I've done my best to make it as easy to use as possible.

Show/Hide Content Files

Wednesday, August 31, 2005

404 Script

I updated the 404 script so that the entries in the 404Redirect.txt file can now include an entry to indicate a permanent redirect (301) rather than the temporary redirect used by ASP when you issue a Response.Redirect (302). The update will go public tonight, tomorrow I'll spend some time getting rid of some of the legacy directories on the site.

Home page redesign

I've completed the design work for the new home page. Most of the modifications requested after the first version were minor and so I was able to spend a little time fleshing out the structure that will be used. I'd like to structure the content as simply as possible, using JS and CSS to implement the advanced functionality. I've already got some ideas about what areas should be dynamically generated. The only part that's giving me a little trouble is the two-column link list ("Quick Links"), so I'll need to spend a bit more time on that.

We're meeting tomorrow to go over the design and make our final decisions. Hopefully I can have the new page up in a couple of weeks.

Monday, August 29, 2005

Testing Adobe Illustrator's SVG Output

FM asked me to take a look at creating SVG documents from Adobe Illustrator so that we could determine what needs to be done to make the documents structurally coherent. Here's a brief summary of the information I've gleaned from minor testing (using Illustrator 11.0.0).
  • The SVG width and height are defined by the elements contained in the Illustrator document, not the page layout, using a coordinate system similar to the SVG coordinate system.
  • Every element that is explicitly named is given an id attribute matching that name. Spaces are converted to underscores. Non-alphanumeric characters are converted to hex-encoded values of the form "_x5F_" (an underscore). Duplicate element names are modified by adding "_#_" where # is a number starting at zero.
  • Each layer and group is surrounded by a g tag.
  • The elements are created bottom-to-top if looking at the Layers palette.
  • Using the rectangle tool will produce a rect element in the SVG. Fill and stroke on a rectangle are defined on the rect element.
  • Using the rounded rectangle tool or stylizing a rectangle with rounded corners will produce a path element in the SVG. Fill and stroke on a path are defined on the path element.
  • Text is rendered as a text element transformed from 0,0 with multiple positioned tspan elements. The tspans appear to be created based on kerning and spacing rather than line wraps.
  • Text created using the Type Tool is rendered as an individual object.
  • Text created using the Area Type Tool is rendered as a group which contains the object defining the area and the text itself. If the area text is named in Illustrator the SVG group, object, and text are all given the same id.
  • Using the Line Segment tool creates a line element in the SVG. Applying a filter style to create an arrowhead creates a group with the original line and a path defining the arrowhead, this renders to SVG as expected. Applying an effect style to a create an arrowhead redraws the line as a path, but when rendered to SVG the line is created as a group containing another group, containing the original line and a path defining the arrowhead.
Note: In Illustrator filters and effects affect the object on which they're used differently. Generally filters are non-editable, effects are editable.