/[drupal]/contributions/modules/comment_alter_taxonomy/comment_alter_taxonomy_legacy_pages.inc
ViewVC logotype

Contents of /contributions/modules/comment_alter_taxonomy/comment_alter_taxonomy_legacy_pages.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Tue Mar 24 00:39:32 2009 UTC (8 months ago) by dww
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-php
#389096 by dww: Instead of providing separate issue views by tag,
reuse the new taxonomy exposed filters on issue advanced search:
- Changed links for project_issue tags to point to the new URLs.
- Added code to redirect from legacy paths to the new URLs (there's an
  admin setting to enable this behavior).
- Removed the default issue tag listing views.
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * Code used to redirect from the legacy project issue listings for issue tags.
7 */
8
9 function comment_alter_taxonomy_legacy_project_issue_redirect($term_id, $project = NULL) {
10
11 // First, find the appropriate taxonomy term given the argument.
12 $issue_vocabularies = taxonomy_get_vocabularies('project_issue');
13 if (is_numeric($term_id)) {
14 $terms[] = taxonomy_get_term($term_id);
15 }
16 else {
17 $terms = taxonomy_get_term_by_name($term_id);
18 }
19 if (empty($terms)) {
20 return drupal_not_found();
21 }
22 $is_issue_term = FALSE;
23 foreach ($terms as $term) {
24 foreach ($issue_vocabularies as $vid => $vocabulary) {
25 if ($term->vid == $vid) {
26 $is_issue_term = TRUE;
27 break;
28 }
29 }
30 }
31 if (!$is_issue_term) {
32 return drupal_not_found();
33 }
34 $filter_id = project_issue_views_filter_identifier($vocabulary->name);
35 $query = array($filter_id => $term->name);
36
37 // If the project argument was set, validate that, too.
38 if (!empty($project)) {
39 if (is_numeric($project)) {
40 $project_uri = project_get_uri_from_nid($project);
41 }
42 else {
43 $project_nid = project_get_nid_from_uri($project);
44 if (!empty($project_nid)) {
45 $project_uri = $project;
46 }
47 }
48 if (empty($project_uri)) {
49 return drupal_not_found();
50 }
51 }
52
53 // Finally, create the appropriate advanced search URL and redirect
54 $url = 'project/issues/search';
55 if (!empty($project_uri)) {
56 $url .= '/' . $project_uri;
57 }
58
59 drupal_goto($url, $query);
60 }
61

  ViewVC Help
Powered by ViewVC 1.1.2