Discussions of Drupal, Web Development, and Libraries

Mark Jarrell's blog

Programmatically Adding Pre-Built Option Lists to Drupal Webforms

I'm a huge fan of the Webform module (and building Drupal forms in general), and I just today noticed a feature I hadn't previously taken advantage of. This is the ability to programmatically add what are called "pre-built" option lists that can be used in your webforms.

Webform pre-built options list in action

Presentation Slides - Building University Websites with the Drupal Content Management System

Here are the slides from my Keynote presentation at the Tennessee Higher Education Information Technology Symposium at Fall Creek Falls on Monday, April 19th 2010. Also, here's the abstract for the presentation:

Adding Zebra Striping CSS to Webform Fields and Formatting the Emails It Sends

Ever wanted to add alternating background colors (a.k.a. "zebra stripes") to your webform fields? I had a need to do this a couple of days ago and struggled to find a method for this. Little did I know that the webform module actually has a few template files included with it that you can use to override what's going on in the theme layer.

The particular thing I wanted to do was to add some CSS to the webform fields so that I could do some easy CSS zebra striping. I know this is super easy to do with the output of the Views module because of the "row-even" and "row-odd" CSS classes that are provided out of the box. I wanted to be able to do some similar CSS classes on my webform fields. Getting the job done requires taking the "webform-form.tpl.php" default template file in the Webform module directory and copying it to own your custom theme directory.

Here's the code I ended up using:

Setting Up a Luminis Channel That Displays Links to Scantron Class Climate Course Evaluations: A Recipe

If you are working at a university or other institution that makes use of the Luminis portal application delivered by Sungard Higher Education and you're wanting to set up a channel that pulls in survey links from Scantron's Class Climate system for students to fill out course evaluations, this recipe is intended for you.

Requirements to use this recipe:

  • Luminis IV
  • Separate server that can run PHP version 5
  • Scantron Class Climate v4.0 server w/ web services API

Adding an .htaccess Rule to Make Simpler Links to Drupal Files

In a site I was recently working on, I found myself hard-coding links to files stored within my Drupal site's "files" directory. If you've ever coded these links before, you know that they normally look something like:
/sites/[sitename]/files/[someotherdirectory]/image.jpg

This can be somewhat painful to add to the site, especially if you have any plans to ever change the domain name of your site. It would really be ideal if you could leave the domain name out of the equation and just write the link in the format:
/files/[someotherdirectory]/image.jpg

This is actually possible to do using the .htaccess file that appears in the root of your Drupal installation. Basically you just need to add a single line:
RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]

After you implement this rule, you should be able to start writing simpler links to your "files" directory.

Happy coding!

Image of the rewrite rule and the alternate links. See PDF on DIWD Site.

How to Set Up a Luminis Automated Notification for the Group Request Queue: A Recipe

If you are working at a university or other institution that makes use of the Luminis portal application delivered by Sungard Higher Education and you’re making use of the included Group Studio tools, you have probably noticed small a flaw with this section of the application. Luminis does not, by default, actively alert administrators when new groups have been requested by users of the system.

Basic PHP Code Troubleshooting Strategy

Well, I originally wrote this for a coworker, but thought that others might be interested in a simple strategy to use while investigating a problem during PHP coding, so here it is.

DrupalCamp Colorado Form Alterations Presentation Files

Yesterday, I gave a presentation at DrupalCamp Colorado entitled "Form Alterations - Getting What You Want in Drupal Without Hacking". I wanted to make sure that everyone has access to the files from the presentation, so here those are:

Session Page:
http://drupalcampcolorado.org/sessions/form-alterations-getting-what-you...

Slides:

File: 

Building a Firefox Search Add-on For Drupal.org

I was having trouble locating a good Firefox search add-on for searching drupal.org. A Google search or two reveals a couple of add-ons created by community members in the past couple of years that do searches of drupal.org via a Google search (using the "site:drupal.org" keyword). I know, however, that the searches on drupal.org recently received an overhaul (using Apache Solr) and now, searching on the actual drupal.org search is actually more efficient than a Google search in many cases. Especially if you know how to make quick use of the right sidebar of the search page which makes use of faceted search.

I knew it couldn't be that difficult to build a search plugin for Firefox, so I began searching the Mozilla site for instructions on that. If you're interested in doing this on your own, you can find out how to build what's called an "OpenSearch plugin" for Firefox at: Creating OpenSearch plugins for Firefox

If you'd like to download the add-on that I built and begin searching Drupal.org from Firefox, click on the screenshot below:

Drupal.org Search add-on in action

Using Applescript to Create Different Login Items for Different Days of the Week

So when the concept of "login items" appeared in Apple's System Preferences a few years back, I used to use those. Recently, especially since I started telecommuting a couple days per week, I discovered that I really needed different login items (applications) to start up depending on which day of the week it was. For instance, on my telecommute days, I need a VPN application to start up first.