Summary | Use Horde_Routes in jonah/delivery/index.php |
Queue | Jonah |
Type | Enhancement |
State | Assigned |
Priority | 1. Low |
Owners | bklang (at) horde (dot) org |
Requester | chuck (at) horde (dot) org |
Created | 08/13/2008 (6118 days ago) |
Due | |
Updated | 07/17/2010 (5415 days ago) |
Assigned | |
Resolved | |
Milestone | |
Patch | No |
To be more flexible and compatible with web servers like Lighttpd
(which doesn't ignore existing files/directories when rewriting URLs)
a default prefix of 'feeds/' will be added to the routes. Also, the
routes should be defined in a configuration file so that they can be
modified easily.
Gdata standard, but I'll need guidance on how to use Routes to parse
the /-/ format.
it by hand, since it would come after a feed route and before a query
string.
http://cvs.horde.org/diff.php/jonah/lib/Driver.php?r1=1.1&r2=1.2&ty=u
http://cvs.horde.org/diff.php/jonah/lib/Driver/sql.php?r1=1.1&r2=1.2&ty=u
http://cvs.horde.org/co.php/jonah/.htaccess?r=1.1
http://cvs.horde.org/co.php/jonah/dispatcher.php?r=1.1
http://cvs.horde.org/co.php/jonah/feed.php?r=1.1
http://cvs.horde.org/co.php/jonah/lib/Driver.php?r=1.1
http://cvs.horde.org/co.php/jonah/lib/Driver/sql.php?r=1.1
http://cvs.horde.org/diff.php/jonah/lib/News.php?r1=1.155&r2=1.156&ty=u
http://cvs.horde.org/diff.php/jonah/lib/base.php?r1=1.52&r2=1.53&ty=u
http://cvs.horde.org/diff.php/jonah/scripts/sql/jonah.sql?r1=1.13&r2=1.14&ty=u
http://cvs.horde.org/co.php/jonah/scripts/upgrades/2008-08-22_add_channel_slugs.sql?r=1.1
Gdata does categories - with /-/tag1/tag2 or /-/tag1|tag2.
Gdata standard, but I'll need guidance on how to use Routes to parse
the /-/ format.
Gdata does categories - with /-/tag1/tag2 or /-/tag1|tag2.
outcome:
* Routes will be created for the feed slug, the tag, the author and
the month (including the year). This will result in URLs like:
/:feed/author/:author_id
/:feed/tag/:tag_id
/:feed/date/:year-month
/:feed
* The output format will be determined by the URL suffix (XML vs. HTML)
* All other filterable attributes will be implemented as query
strings. The format of these attributes will be modeled after GData
(ref: http://code.google.com/apis/gdata/reference.html#Queries)
Examples:
/myfeed/date/2008-08.html?tags=tag1|tag2
This returns all articles dated 2008-08-01 through 2008-08-31 tagged
with EITHER tag1 or tag2 from the "myfeed" feed in HTML format
/hordefeed/author/bklang.rss2?q=some%20search%20text
This returns all articles by bklang from the "hordefeed" feed
containing the text "some search text" in RSS2 form.
/otherfeed/tag/elephants.atom?start-index=23
This returns all articles tagged "elephant" starting at the 23rd
article of the "otherfeed" feed in Atom format.
/airplanes.html
This returns all the articles from the "airplanes" feed in HTML form.
together to match what I implemented in delivery/index.php. While
simple cases seem to map directly I can't seem to figure out how to
get exactly what I want from Horde_Routes.
For example, it's pretty straightforward to set up routes for
channel/:channel_id, for story/:story_id or for tags/:tag_id. What I
can't figure out, short of using query args, is providing the ability
to filter based on arbitrary criteria. Some examples:
/channel/:channel_id/tag/:tag_id
/tag/:tag_id/date/:date
/channel/:channel_id/date/:date
While I don't think it's important to allow mixing the order of
attributes I do think it's important to allow for any combination of
valid attributes. Short of accounting for every possible permutation
with a route map (which is obviously unmaintainable) I don't see how
to accomplish this with Routes. Am I missing something? All of the
examples I see are either for direct "controller/action/id" tuples or
strictly nested attributes such as
"region/:region_id/location/:location_id/action" where it would never
make sense to specify a location without a region or vice versa. The
Jonah attributes have no relation to the other attributes, except in
certain cases like it would not result in a sensible combination
("/story/:story_id/tag/:tag_id" for example).
Priority ⇒ 1. Low
Type ⇒ Enhancement
Summary ⇒ Use Horde_Routes in jonah/delivery/index.php
Queue ⇒ Jonah
Assigned to Ben Klang
Milestone ⇒
Patch ⇒ No
State ⇒ Assigned
$m = new Horde_Routes_Mapper();
$m->connect(':controller/:action/:id');
$m->connect('/admin/:section/:page', array(
'controller' => 'admin',
'section' => '',
'page' => '',
));
$m->connect('/minutes/:date', array(
'controller' => 'minutes',
'date' => '',
'requirements' => array('date' => '\d{4}\-?\d{2}\-?\d{2}'),
));
$m->connect('/page/:page', array(
'controller' => 'pages',
'requirements' => array('page' => '\w+'),
));
$result = $m->routematch($_SERVER['REQUEST_URI']);
if (!is_null($result)) {
list($vars, $route) = $result;
switch ($vars['controller']) {
}
Ben: I'm assigning this to you so you can write out the URL rules that
should be matched here (to make sure I get the intent right instead of
just looking at that switch statement). If you want to pass this off
afterward that's fine.