Index: modules/project_issue/issue.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/issue.inc,v retrieving revision 1.172.2.22.2.2 diff -u -p -r1.172.2.22.2.2 issue.inc --- modules/project_issue/issue.inc 12 Nov 2006 09:22:15 -0000 1.172.2.22.2.2 +++ modules/project_issue/issue.inc 17 Nov 2006 06:38:21 -0000 @@ -1,6 +1,6 @@ uid; + } - // clean up after ourselves - unset($_SESSION['project_issue_search']); + // this isn't a POST, just return project + if (empty($_POST)) { + if ($url_arg == 'user') { + // If this is the "my issues" page, don't query the DB for a + // project that matches "user", just return and display all + // matching issues regardless of project. + return; + } + else { + return project_project_retrieve($url_arg); } - return project_project_retrieve($url_arg); } // dispatch to hanlders based on value of $_POST['edit']['form_id'] @@ -112,8 +112,12 @@ function project_issue_build_form_url($u * Search filters */ function project_issue_quick_search($url_arg, $filters) { - // search is for all/multiple projects, so just send to project/issues - if ($_POST['edit']['projects'] == 0 || strpos($_POST['edit']['projects'], ',') !== FALSE) { + if ($url_arg == 'user') { + // My issues query, so stay on the same page + $destination = 'project/issues/user'; + } + elseif ($_POST['edit']['projects'] == 0 || strpos($_POST['edit']['projects'], ',') !== FALSE) { + // search is for all/multiple projects, so just send to project/issues $destination = 'project/issues'; } else { @@ -130,30 +134,42 @@ function project_issue_quick_search($url // put $_POST['edit'] where pager will see them foreach ($filters as $filter) { - if (isset($_POST['edit'][$filter])) { + if (!empty($_POST['edit'][$filter])) { $_REQUEST[$filter] = $_POST['edit'][$filter]; } } // unset $_REQUEST['edit'] so the pager links aren't full of cruft unset($_REQUEST['edit']); + unset($_REQUEST['op']); return isset($project) ? $project : NULL; } // redirecting, so put filters in session foreach ($filters as $filter) { - if (isset($_POST['edit'][$filter])) { - $_SESSION['project_issue_search'][$filter] = $_POST['edit'][$filter]; + if (!empty($_POST['edit'][$filter])) { + $issue_filters[$filter] = $_POST['edit'][$filter]; } } - $_REQUEST['destination'] = $destination; - drupal_goto(); + drupal_goto($destination, drupal_query_string_encode($issue_filters)); } /** * handles the advanced search form */ function project_issue_advanced_search($url_arg, $filters) { + // Figure out what issue filters are in place for the query we're showing + foreach ($filters as $filter) { + if (!empty($_POST['edit'][$filter])) { + if (is_array($_POST['edit'][$filter])) { + $issue_filters[$filter] = implode(',', $_POST['edit'][$filter]); + } + else { + $issue_filters[$filter] = $_POST['edit'][$filter]; + } + } + } + // do we have just one project to search for? if (isset($_POST['edit']['projects']) && count($_POST['edit']['projects']) == 1) { // try to find the project, and 404 if not found @@ -161,24 +177,19 @@ function project_issue_advanced_search($ drupal_not_found(); exit; } - - // redirecting, so put filters in session - foreach ($filters as $filter) { - if (isset($_POST['edit'][$filter])) { - if (is_array($_POST['edit'][$filter])) { - $_SESSION['project_issue_search'][$filter] = implode(',', $_POST['edit'][$filter]); - } - else { - $_SESSION['project_issue_search'][$filter] = $_POST['edit'][$filter]; - } - } - } - $_REQUEST['destination'] = 'project/issues/'. $project->uri; - drupal_goto(); + $destination = 'project/issues/'. $project->uri; + drupal_goto($destination, drupal_query_string_encode($issue_filters)); } + // Put the issue filters where the pager links can find them. + foreach ($issue_filters as $name => $val) { + $_REQUEST[$name] = $val; + } // unset $_REQUEST['edit'] so the pager links aren't full of cruft unset($_REQUEST['edit']); + // Get rid of the silly 'op', since it's not a filter. + unset($_REQUEST['op']); + return project_project_retrieve($url_arg); }