Index: project_issue.views_default.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/views/project_issue.views_default.inc,v retrieving revision 1.36 diff -u -p -r1.36 project_issue.views_default.inc --- project_issue.views_default.inc 22 Feb 2009 00:31:32 -0000 1.36 +++ project_issue.views_default.inc 25 Feb 2009 06:47:02 -0000 @@ -201,7 +201,7 @@ function project_issue_views_default_vie 'sid' => array( 'operator' => 'in', 'value' => array( - 'open' => 'open', + 'Open' => 'Open', ), 'group' => '0', 'exposed' => TRUE, @@ -580,7 +580,7 @@ function project_issue_views_default_vie 'sid' => array( 'operator' => 'in', 'value' => array( - 'open' => 'open', + 'Open' => 'Open', ), 'group' => '0', 'exposed' => TRUE, @@ -1035,7 +1035,7 @@ function project_issue_views_default_vie 'sid' => array( 'operator' => 'in', 'value' => array( - 'open' => 'open', + 'Open' => 'Open', ), 'group' => '0', 'exposed' => TRUE, @@ -1439,7 +1439,7 @@ function project_issue_views_default_vie 'sid' => array( 'operator' => 'in', 'value' => array( - 'open' => 'open', + 'Open' => 'Open', ), 'group' => '0', 'exposed' => TRUE, Index: handlers/project_issue_handler_filter_issue_status.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/views/handlers/project_issue_handler_filter_issue_status.inc,v retrieving revision 1.3 diff -u -p -r1.3 project_issue_handler_filter_issue_status.inc --- handlers/project_issue_handler_filter_issue_status.inc 28 Jan 2009 21:59:12 -0000 1.3 +++ handlers/project_issue_handler_filter_issue_status.inc 25 Feb 2009 06:47:02 -0000 @@ -9,43 +9,20 @@ class project_issue_handler_filter_issue var $is_exposed = FALSE; var $default_states = array(); - function get_default_states() { - if (empty($default_states)) { - $default_states = project_issue_state(0, FALSE, FALSE, 0, TRUE); + function get_open_states() { + if (empty($open_states)) { + $open_states = array_keys(project_issue_state(0, FALSE, FALSE, 0, TRUE)); } - return $default_states; + return $open_states; } function get_value_options() { module_load_include('inc', 'project_issue', 'issue'); - $open_issues = array(); - if (empty($this->is_exposed) || empty($this->options['exposed']) || !empty($this->options['expose']['single'])) { - $open_issues = array('open' => t('- Open issues -')); - } - $this->value_options = $open_issues + project_issue_state(); - } - - function value_form(&$form, &$form_state) { - // Set a flag so that get_value_options() knows we're building a form for - // the actual exposed filter for a view, not just configuring it. - if (!empty($form_state['exposed'])) { - $this->is_exposed = TRUE; - } - // Let our parent do most of its magic. - parent::value_form($form, $form_state); - - // If this is the form for an exposed filter with multiple values, we need - // to see if we're trying to use 'open' issues, and if so, translate into - // the real default states to avoid FAPI validation errors. - if ($this->is_exposed && empty($this->options['expose']['single'])) { - $identifier = $this->options['expose']['identifier']; - if (!empty($form_state['input'][$identifier]['open'])) { - $default_value = array_keys($this->get_default_states()); - unset($form['value']['#default_value']); - $form['value']['#default_value'] = $default_value; - $form_state['input'][$identifier] = $default_value; - } - } + $special_status = array( + 'All' => t(''), + 'Open' => t(''), + ); + $this->value_options = $special_status + project_issue_state(); } function accept_exposed_input($input) { @@ -54,13 +31,34 @@ class project_issue_handler_filter_issue if (!empty($this->options['expose']['identifier'])) { $identifier = $this->options['expose']['identifier']; if (isset($input[$identifier])) { - if ($input[$identifier] == 'open') { - $this->value = array_keys($this->get_default_states()); + if (is_array($input[$identifier])) { + // Work-around a bug in Views that doesn't handle 'All' correctly + // if the view already has a default value. + if (!empty($input[$identifier]['All'])) { + return FALSE; + } + $this->value = array(); + foreach ($input[$identifier] as $value) { + if ($value == 'Open') { + $this->value += $this->get_open_states(); + } + else { + $this->value[] = $value; + } + } } - // Work-around a bug in Views that doesn't handle 'All' correctly if - // the view already has a default value. - elseif ($input[$identifier] == 'All') { - $rc = FALSE; + else { + // Input is not an array (we're configured as "force single"). + switch ($input[$identifier]) { + case 'All': + // Work-around a bug in Views that doesn't handle 'All' + // correctly if the view already has a default value. + return FALSE; + + case 'Open': + $this->value = $this->get_open_states(); + break; + } } } }