Gold Apple Software Web Development by Geoff Appleby

A Simple Issue Tracker With Drupal

As I started working on more projects simultaneously, I found it a necessity to find a better way to track tasks. My best previous system was a wall full of colour-coded sticky notes, but I had difficulty translating it from keeping track of one organization's tasks to keeping track of all my freelance work.  I felt this site was the best place for me to keep track of things, with the potential to allow better interactivity with clients later, and so wanted to integrate something with Drupal.

Drupal.org's own project module (with Project issue tracking) is available, but as the description states, "Projects are generally assumed to represent software that has source code, releases, and so on." While the projects I work on generally have source code, they are not nicely packaged releases, and I can't use the issue tracking without the projects.  There are other Drupal modules available to support issue tracking, but I found they were all pretty complex and customized.  I figured Views and CCK would provide most of the features I would need on top of core Drupal, and so set out to construct a simple issue tracker.

What are we doing?

Each task should have the following information:

  • Type (e.g., Feature, Bug)
  • Priority (e.g., Right now, When time allows)
  • Severity (e.g., Critical, Normal, Minor)
  • Status (e.g., Active, Complete, Postponed)

The complex part is that it shouldn't be required to edit the task itself to modify these fields, and instead a user should be able to update the status when making a comment.  And, of course, we need a nice list of these tasks to find which ones are most important.

Getting Started

The modules we need to download and enable are CCK (Content, Fieldgroup, Number, Option Widgets, Text), Views (Views, Views UI), and Driven / Comment Driven (Comment driven, Driven API, Driven CCK properties, Driven difference API, Driven Node Edition Policy, Driven node properties, Driven property manager)

Creating the Content Type

Create Task Content Type Navigate to 'admin/content/types/add' to create a content type 'Task'.  Driven works best when 'Create new Revision' under the workflow settings is enabled, Comments should be displayed  as 'Flat list - expanded', and the new comment submission form located 'below post or comments'.

I also prefer that tasks are not promoted to the front page (under the 'Workflow settings' fieldset), comments have the subject field disabled, and comment previews are optional.

Adding fields

Once you have created the task content type, go to the 'Manage Fields' page for it.

Add Type Field Type Field Settings The task type will be a text field which will have a limited set of allowed values, so select 'Text' as the type and 'Select List' as the form widget.  Set it as a required field, with a maximum length of 10 or so, and provide a set of key|label pairs.  I chose 'Feature', 'Bug', and 'Administrative' to cover most things, but you can adapt this to suit your needs.  Don't worry too much about it; it's easy to add more values later.

Add Priority Field Priority Field Settings Priority and Severity are both going to be numeric fields, but we'll provide text labels for each to make them more relatable.  The priority levels I chose are 'When Time Allows', 'Soon', 'Promptly', and 'Immediately', with corresponding values of 1,4,7, and 10.  The severity levels I chose are 'Trivial', 'Minor', 'Normal', 'Major', and 'Critical', with values of 1,3,5,7,10.  Again, you can adjust these values and labels to suit your preferences. 

Hopefuly the priority and severity labels provide a good indicator as to the difference between the two fields.  Severity rates how significant the task or issue is; for code generally the scale maps to a range from aesthetic issues to security vulnerabilities.  Missing or impaired functionality is typically 'normal', while data loss or corruption is 'major'.  Most often it is valuable to have a separate time priority for tasks; while most often high severity issues (security vulnerabilities) are also high priorities (drop everything to fix this), sometimes small or easy to fix issues are important to resolve right away as well even though they are still trivial issues.  In general the severity of a task never changes (at least without new information), but the priority will as other tasks are added or completed.

Status Field Settings Status is a text field like 'type'.  I've opted for a longer maximum length due to the key values I'm using: Active, Postponed, and Closed, but otherwise settings are the same.

Driving the Nodes

The Driven module properties are controlled through the Content Type admin page, located at 'admin/content/node-type/task/driven-props'.

Driven Settings You first need to enable the driven properties for the content type, and then select the checkboxes for the four CCK fields and the node title.  I chose to also disable empty comments and change the fieldset title.

Driven Node Edition Policy Next select the 'Edition hidden' tab, and select the same options.  This will prevent a user from being able to change these fields when editing a node, and instead they must be changed by adding a comment.

The node creation form will be unchanged, but when later editing the node the CCK field inputs will not be available.  When viewing the node the comment form will now have additional fields to allow you to update the title or CCK fields.  As a nice feature of Driven, when a comment is added to a task and modifies one of the 'driven' properties, Driven Module will add a box showing the changes.

Create Task FormEdit Task FormView Task View Task with Comment

Creating a view

Create View Create a new view at 'admin/build/views/add' by specifying the view name, and leaving the default view type of 'node'.

Creat View Page Display Since we'll be creating a single page variant, add it as a new display.

Under 'Basic settings', 'Style' will need to be changed to 'Table', the page should be enabled and the items per page increased.

The page settings should set the path to 'tasks/active', and have a menu item.  The menu item should be a 'default menu tab' titled 'Active', and create a 'Normal menu item' as the parent menu item.

The view will need some fields, so add the node title and the four CCK fields we created.  The default settings should be fine for all of them except title, which should be set to link to the node.

I chose to sort fields by priority, then severity in descending order so that the "get it done now" tasks are listed at the top.

Create View Page Display Settings Finally for filters, add 'Node : Content type' and 'Content : Status - Allowed Values'.  Limit the content type to 'task', and select the status to be limited to 'Is one of' all but the closed status.

Create a similar page, except the filter should be overriden to have the status field limited to closed tasks.  This time the menu item should be a 'menu tab'.  If you wish, you could create a third page display to separate postponed tasks from active tasks.

Active Tasks View

Onwards

This tracker works nicely for now, but is difficult to navigate when dealing with a large and varied set of tasks.  The next step, for another article, is associating each task with a project to better filter them.

Comments

great stuff! You obviously know your Drupal!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <br> <p>
  • Lines and paragraphs break automatically.
  • Each email address will be obfuscated in a human readable fashion or (if JavaScript is enabled) replaced with a spamproof clickable link.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.