Re-enable v1.0 URI compatibility wrt update feeds.

The additional filter token introduced 404's for bookmarked feeds;
now the old URLs are re-added and their actions forward the requests
to the new handlers.
Another small change removes a double assignment and puts the
"All Updates" link in the template on top to separate it clearly
from the other filters.

This commit closes issue 605.
This commit is contained in:
Thomas Keller 2011-03-15 22:54:35 +01:00
parent 867c3d3382
commit 8631529268
3 changed files with 44 additions and 3 deletions

View File

@ -121,6 +121,17 @@ class IDF_Views_Project
return $classes; return $classes;
} }
/**
* This action serves as URI compatibility layer for v1.0.
*
* @deprecated
*/
public function timelineCompat($request, $match)
{
$match[2] = 'all';
return $this->timeline($request, $match);
}
/** /**
* Timeline of the project. * Timeline of the project.
*/ */
@ -178,6 +189,17 @@ class IDF_Views_Project
} }
/**
* This action serves as URI compatibility layer for v1.0.
*
* @deprecated
*/
public function timelineFeedCompat($request, $match)
{
$match[2] = 'all';
return $this->timelineFeed($request, $match);
}
/** /**
* Timeline feed. * Timeline feed.
* *
@ -192,7 +214,6 @@ class IDF_Views_Project
$prj = $request->project; $prj = $request->project;
$model_filter = @$match[2]; $model_filter = @$match[2];
$model_filter = @$match[2];
$all_model_filters = self::getAvailableModelFilters(); $all_model_filters = self::getAvailableModelFilters();
if (!array_key_exists($model_filter, $all_model_filters)) { if (!array_key_exists($model_filter, $all_model_filters)) {
$model_filter = 'all'; $model_filter = 'all';

View File

@ -91,6 +91,23 @@ $ctl[] = array('regex' => '#^/p/([\-\w]+)/feed/timeline/(\w+)/token/(.*)/$#',
'method' => 'timelineFeed', 'method' => 'timelineFeed',
'name' => 'idf_project_timeline_feed_auth'); 'name' => 'idf_project_timeline_feed_auth');
$ctl[] = array('regex' => '#^/p/([\-\w]+)/timeline/$#',
'base' => $base,
'model' => 'IDF_Views_Project',
'method' => 'timelineCompat');
$ctl[] = array('regex' => '#^/p/([\-\w]+)/feed/timeline/$#',
'base' => $base,
'model' => 'IDF_Views_Project',
'method' => 'timelineFeedCompat',
'name' => 'idf_project_timeline_feed');
$ctl[] = array('regex' => '#^/p/([\-\w]+)/feed/timeline/token/(.*)/$#',
'base' => $base,
'model' => 'IDF_Views_Project',
'method' => 'timelineFeedCompat',
'name' => 'idf_project_timeline_feed_auth');
$ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/$#', $ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/$#',
'base' => $base, 'base' => $base,
'model' => 'IDF_Views_Issue', 'model' => 'IDF_Views_Issue',
@ -145,12 +162,12 @@ $ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/watchlist/(\w+)$#',
'base' => $base, 'base' => $base,
'model' => 'IDF_Views_Issue', 'model' => 'IDF_Views_Issue',
'method' => 'watchList'); 'method' => 'watchList');
$ctl[] = array('regex' => '#^/watchlist/(\w+)$#', $ctl[] = array('regex' => '#^/watchlist/(\w+)$#',
'base' => $base, 'base' => $base,
'model' => 'IDF_Views_Issue', 'model' => 'IDF_Views_Issue',
'method' => 'forgeWatchList'); 'method' => 'forgeWatchList');
// ---------- SCM ---------------------------------------- // ---------- SCM ----------------------------------------
$ctl[] = array('regex' => '#^/p/([\-\w]+)/source/help/$#', $ctl[] = array('regex' => '#^/p/([\-\w]+)/source/help/$#',

View File

@ -13,9 +13,12 @@
{/block} {/block}
{block context} {block context}
<p><span class="label{if 'all' == $model_filter} active{/if}"><a href="{url 'IDF_Views_Project::timeline', array($project.shortname, 'all')}">{trans 'All Updates'}</a></span></p>
<p><strong>{trans 'Filter by type'}</strong><br /> <p><strong>{trans 'Filter by type'}</strong><br />
{foreach $all_model_filters as $filter_key => $filter_name} {foreach $all_model_filters as $filter_key => $filter_name}
{if $filter_key != 'all'}
<span class="label{if $filter_key == $model_filter} active{/if}"><a href="{url 'IDF_Views_Project::timeline', array($project.shortname, $filter_key)}">{$filter_name}</a></span><br /> <span class="label{if $filter_key == $model_filter} active{/if}"><a href="{url 'IDF_Views_Project::timeline', array($project.shortname, $filter_key)}">{$filter_name}</a></span><br />
{/if}
{/foreach} {/foreach}
</p> </p>
{/block} {/block}