In the latest CVS version (1.192 at time of writing), line 1612 reads:

$form['event_term_select']['#attributes'] = array('onChange'=>'this.form.submit()');

It should read:

$form['event_type_select']['#attributes'] = array('onChange'=>'this.form.submit()');

otherwise selecting a new event type has no effect.

Sorry I cannot post a proper patch as is the Drupal way. Perhaps someone else could make one for this?

CommentFileSizeAuthor
#8 event-diff-2006-05-10-02-02-10.patch698 bytessanduhrs

Comments

Patrick Nelson’s picture

Assigned: Patrick Nelson » Unassigned
sanduhrs’s picture

Priority: Normal » Critical
Status: Needs review » Active

I can confirm this bug, but not your solution.
The mentioned line seems to be on line 1590 now, but it doesn't change behaviour if replaced as suggested.

The Dropdown "Select event type to filter by" which appears if taxonomy is enabled, doesn't show the defined types.
Also the link "limit view to events of this type" doesn't show the expected result, instead it still shows all events of all types.
And, if JavaScript is disabled theres no way to send the form ("Select event terms to filter by" and "Select event type to filter by").

Any hints on where the problem lies?
Drupal4.7RC2
Event4.7 and CVS

rubenk’s picture

Confirmed. I too have this problem. I can filter by term but not type. I am using different flexinodes for each calendar type and enabling/disabling people from seeing some of the flexinodes but I want people to be able to select different calendar views themselves as well.

rubenk’s picture

The fix provided by Patrick Nelson does indeed work. Implementing it allows for the page to refresh when an item in the list is clicked however there is a separate issue where it looks like all node types MAY not populate the list. For example, I have three calendars (event, water systems, and awra). The list only shows (top to bottom) white space, awra, white space. The list isn't being populated correctly. Any thoughts?

rubenk’s picture

Looks like the dropdown list gets populated fine but there are additional null or blank spaces at the top and bottom of the menu: "" at the top and a "" at the bottom of the menu. Not sure why this happens. When those are clicked on, it takes you back to the all events calendar. It should also be noted that the "events" type cannot be selected, although events may not be selectable because it is not a separate flexinode?!?

Can anybody reproduce this in CVS? Don't forget to use the patch mentioned at the top of this first.

rubenk’s picture

Title: Event type filter doesn't work due to type » Fixed Autosubmit by Type (someone create diff)
Category: bug » support

I would like to bump this and request someone makes a diff please (As per above).

It does help BUT
There is still a problem: when changing types, the available taxonomy terms are not changed (i.e. all of them are there when only ones suitable to that type should. See http://drupal.org/node/62704

rubenk’s picture

Could the problem with the taxonomy be located in the same location?

/**
* Returns a dropdown event-enabled content type input control.
*
* @ingroup event_support.
* @param $tid The current term id.
* @param $submit Adds 'onChange' form submit javascript command to control.
* @return A form with a dropdown event taxonomy term input control.
*/
function _event_get_type_control($curtype = NULL, $autosubmit = TRUE) {
if (module_exist('taxonomy')) {
/**
DOES THE FOLLOWING OCCUR for ALL TERMS?
*/
$results = event_get_types('all');

$items['all'] = t('(all)');
foreach ($results as $type) {
if (module_hook($type, 'node_name')) {
$items[$type] = module_invoke($type, 'node_name', $node);
}
elseif ($ctype = module_invoke('flexinode', 'load_content_type', substr($type, 10))) {
$items[$type] = $ctype->name;
}
}

$form['event_type_select'] = array(
'#type' => 'select',
'#default_value' => $curtype,
'#options' => $items,
'#description' => t('Select event type to filter by'));
if ($autosubmit) {
/**
Type changing FIXED on the line below
*/
$form['event_type_select']['#attributes'] = array('onChange'=>'this.form.submit()');
}

$form = drupal_get_form('event_type_filter', $form);

return theme('event_filter_control', $form);
}
}

/**
* @defgroup event_block Functions for event blocks.
*/

sanduhrs’s picture

StatusFileSize
new698 bytes

#6 : So here is your patch.
vg

rubenk’s picture

Status: Active » Needs review

Thank You so much. Can this be committed as the first step or does the taxonomy issue have to be corrected first?

rubenk’s picture

Title: Fixed Autosubmit by Type (someone create diff) » Problem Selecting Event by Type
Category: support » bug
killes@www.drop.org’s picture

Status: Needs review » Fixed

applied

urbanfalcon’s picture

Still broken for me. Could this be related to the new module naming structure? The module hook as stated above is looking for node_name, but according to the developer docs:
In 4.6, you had hook_node_name and hook_node_types. Now you must implement hook_node_info if you want to create a module which defines node type(s).

gerhard killesreiter’s picture

which version do you use? Please look at the cvs version inside the event.module file (at the top).

urbanfalcon’s picture

At line 238, I found if I replaced this:

    if (is_array($filter)) {
      $links[] = l(t('view all'), 'event/'. $year .'/'. $month .'/'. $day .'/'. $view .'/');
      $title =  t('Filter') .': ' .implode(', ', $filter);
      $types = $temp;
    }
     else {
       $types = null;
     }

with this:

    if (is_array($filter)) {
      $links[] = l(t('view all'), 'event/'. $year .'/'. $month .'/'. $day .'/'. $view .'/');
      $title =  t('Filter') .': ' .implode(', ', $filter);
      $types = $temp;
    }
    # else {
    #   $types = null;
    # }

I could use the querystring to filter by node type. This plus what was in my previous post were the fixes for my installation, even after I grabbed the patched CVS copy that was committed (which unfortunately still kept me from filtering by node type).

rubenk’s picture

Status: Fixed » Active

Interesting. The original post fixed my problem. However, would it be a good idea to change hook node name to hook node info? Anybody else have this problem? Also, how did commenting out types null help? - Lastly, I've made the necessary changes to a few lines of code to only show terms that are associated with the filtered node type(s) rather than showing all the possible terms (including those associated with other node types). However, I am working out of windows and haven't quite figured out how to make a diff.

rubenk’s picture

In response to sanduhrs: if javascripts are Enabled in the browser window, then after applying Nelson's patch (changing event_term_select to event_type_select) resulted in me: being able to filter by term and type successfully. With javascript Disabled, I can do neither. To be honest, I think this module needs javascript to self-post.

Urbanfalcon: In the end, did you (a) apply the event_term_select to event_type_select change, (b) change hook_node_type, and (c) comment out types = null to get the same result as me, that is, being able to filter by term and type successfully (with javascript enabled)?

urbanfalcon’s picture

All of the above, but only "c" seemed to really get the job done for me, enabled javascript or no.

nevets’s picture

I think this may solve the problem. In the function _event_get_type_control() it calls event_get_types() which I believe returns type names. But _event_get_type_control treats them as module names. I think the code should look like this

    $results = event_get_types('all');
    $items['all'] = t('(all)');
    foreach ($results as $type) {
      if ($ctype = module_invoke('flexinode', 'load_content_type', substr($type, 10))) {
        $items[$type] = $ctype->name;
      }
      else {
      	$items[$type] = $type;
      }
    }

This will produce an drop down with the event types filled in (not tested though with flexinode).
Also note, I also believe the outer if checking for the taxonomy module should be removed.

Then in event_page() [around line 276] replace

      elseif ($name = module_hook($type, 'node_name')) {
        $x = module_invoke($type, 'node_name', $node);
        $temp[$x] = $type;
        $filter[] = module_invoke($type, 'node_name', $node);
      }

with

      else if ( $type != 'all' ) {
      	$temp[$x] = $type;
      	$filter[] = $type;
      }

and the calendar will filter by type.

japerry’s picture

Status: Active » Closed (outdated)

Event for Drupal 8 is unrelated to older versions. If an issue similar to this one exists, please open a new issue with the 8.x branch.