[rt-users] Short URLs for Tickets and Queues

Smylers smylers at gbdirect.co.uk
Wed Apr 10 04:37:45 EDT 2002


Yesterday Jesse Vincent wrote:

> That's quite cute. I've wanted something like that for a while ;)

Ta (and to Simon).

> One other way that this could be implemented is using a mason
> dhandler. Which I should really do for 2.2 ;)

Yes, it'd be better for it not to be 'Apache'-dependent.

Also the punctuation characters (so people don't have to remember
whether to use spaces, hyphens or underscores) could probably be dealt
with in a safer way, possibly along these lines:

  if (there_is_a_queue_called_exactly $queue_requested)
  {
    $queue_to_use = that_queue;
  }
  else
  {
    ($queue_requested, @all_queue_names)
      = map { tr/a-z0-9//cd; lc; } ($queue_requested, @all_queue_names);
    foreach my $queue (@all_queue_names)
    {
      if ($queue eq $queue_requested)
      {
        $queue_to_use = $queue;
        last;
      }
    }

    if (!$queue_to_use)
    {
      foreach my $queue (@all_queue_names)
      {
        if ($queue =~ /^$queue_requested/o)
        {
          $queue_to_use = $queue;
          last;
        }
      }
    }
  }

Oooh, that looks like it even copes with unique prefixes!

Smylers
-- 
GBdirect
http://www.gbdirect.co.uk/





More information about the rt-users mailing list