Can't get Views2 to work with Events

wrb123 - November 16, 2008 - 22:43
Project:Timeline
Version:6.x-1.x-dev
Component:Configuration
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hello,
I have installed Timeline and Event modules and created a new Event. It shows up in Event Calendar (if i go to the Event i created and click Calendar) but I cant seem to make a View that works. Here are my Views2 settings:

under Basic Settings i have chosen Style: Timeline.
under Style Options i have chosen Grouping Field: None, Typeline Type: Vertical
under Initial Date Focus: First Event, Main Band Interval Unit: Day, Controls: Disabled

Filters - Node Type: Event
Fields - Node: Title (do not link to node)

I then make a Page View and have chosen timeline as my path.

This displays a blank page.
When I look at the README.TXT it's a little unclear on the Views settings. Views will not let you create a Page view without using at least one field, so I chose Node Title.

Here are what the fields are listed as in README.TXT:

1st: If present, used as the start time and end time for the timeline event.
Event nodes will use the start and end date of the event...

does this mean since im using an Event node i shouldnt have to add a field to my view? There is no option in Add Fields to a View that says anything about my Event type. In Event content type (added automatically by Event module - it has the option of selecting dates when you add a new Event) there are no actual Fields when you go to Event -> Manage Fields, so i dont know how Im supposed to add this to my view.

...CCK date fields will use the from and to date of the field.
If not present, the node's creation time is used instead.

- 2nd: If present, used as the title and clickable link for the timeline
event. If not present, the node's default title is used instead.

- 3rd: If present, used as the description for the timeline event. If not
present, the node's teaser is used (if available). NOTE: at present CCK
nodes don't have a teaser by default, so you'll want to define the
description field explicitly for them.

I'm just really confused about how to make the View. If anyone can help me with this I would really appreciate it.
-Bill

#1

rhieb - November 21, 2008 - 22:04

I have the same issues

#2

wrb123 - November 25, 2008 - 02:39

SOLUTION:

There may be other ways to do this (I do -not- use Event module), but I just did it this way and it works fine! Awesome module once it's working :)

If anyone else gets this working please let me know, or if you have minor issues or problems ask those too, either here or in private message.

1. install Timeline module according to INSTALL.TXT included with Timeline.
2. install Date module
3. install Views module
4. install CCK module
5. create a new content type called timelinetype
6. add a new field to content type timelinetype called timelinedate (choose To: Date = Optional, Granularity = Select all available.. hour through second, No Time Zone conversion)
7. use the instructions below to import a new view
8. change the filter type on the new view to Filter by Node Type, and then choose timelinetype (for some reason this view filters for type: Event by default)
9. click the Page part of the view and set the path where you want the timeline to appear (such as timelinepage, so your timeline appears at www.site.com/timelinepage)

You should be able to customize the view slightly after you have successfully gotten it to display, such as changing the band granularity to year/month/day/hour/second/whatever !

observe the following in the text of the view pasted below:
field_timelinedate_value /* timelinedate is the name of the date field you created for your custom content type. this one date field contains both the start and end dates since you have chosen "To Date: Optional" in the steps above. */
field_timelinedate_value2 /* this value is set without you having to add a second field to your custom type - it is the "To Date" mentioned */
'timelinetype' => 'timelinetype' /* is the line in the view import text below that refers to the name of the custom content type you created */

*** instructions to import a new view ***
Go to Import New View, call it "timelineblock" and paste the following into it (Thanks to spython who originally posted this in a different thread - i just modified it to clarify which fields should be used with it):

$view = new view;
$view->name = 'timelineblock';
$view->description = 'timeline view description';
$view->tag = 'timelineblock';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => '',
'link_to_node' => 0,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'field_timelinedate_value' => array(
'label' => '',
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => 0,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_timelinedate_value',
'table' => 'node_data_field_timelinedate',
'field' => 'field_timelinedate_value',
'relationship' => 'none',
),
'field_timelinedate_value2' => array(
'label' => 'Date',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => 0,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_timelinedate_value2',
'table' => 'node_data_field_timelinedate',
'field' => 'field_timelinedate_value2',
'relationship' => 'none',
),
'body' => array(
'label' => '',
'exclude' => 0,
'id' => 'body',
'table' => 'node_revisions',
'field' => 'body',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'timelinetype' => 'timelinetype',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('items_per_page', 500);
$handler->override_option('style_plugin', 'timeline');
$handler->override_option('style_options', array(
'grouping' => '',
'type' => '0',
'display' => array(
'width' => '100%',
'height' => '250px',
'focus' => 'first',
),
'bands' => array(
'band1_unit' => 'month',
'band2_unit' => 'year',
),
'misc' => array(
'controls' => '0',
),
));
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
'teaser' => 1,
'links' => 1,
'comments' => 0,
));
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'timelinepage');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));

#3

rhieb - November 25, 2008 - 13:49

This worked GREAT!! Thanks a bunch you just made my holiday week.

#4

jmiccolis - November 25, 2008 - 13:58

@wrb123 Thanks for pulling together such detail instructions. Would you consider posting a patch to README.txt that incorporates some of #2?

#5

wrb123 - November 25, 2008 - 20:29

I would be glad to simplify the instructions above and create a patch to README.txt for this module if someone could tell me how to do a patch. Thanks to the original README.txt author for providing as much detail as he did, I just think this helps strengthen the Custom Content Type fields/views part of it. Glad I could help!
-Bill

#6

jmiccolis - November 25, 2008 - 21:09

Great! Take a look here for patch file instructions -> http://drupal.org/patch/create

#7

wrb123 - November 27, 2008 - 00:19

Here is what I came up with. I re-wrote the instructions above and here it is. I'm sorry I don't have time right now to figure out what text to remove from the original README, nor to actually patch, because I am getting ready to leave tonight for holiday travel. I hope this is a little more clear for everyone - now it includes specific instructions on how to alter the View code before importing if using different content type and field names:

If using a custom content type (and NOT using Event module):

1. Install CCK module (this is what you will use to make a custom content type).
2. Install Views module (this is what you will use to make a view to display the timeline).
3. Install Date module (this is what you will use to add ONE date field to your custom content type).
4. Install Timeline module accoding to INSTALL.TXT included with the module.

5. Create a new custom content type called timelinetype.

6. Go to manage fields for your new content type (timelinetype) and add a new field. Call the new field timelinedate. When creating the field, in the settings choose "To: Date - Optional", "Granularity" select all items available: year, month, day, hour, etc., choose "No Time Zone Conversion" (note: you may be able to change some of these options, but this is what definitely works). You only add this ONE new field to your custom content type. By choosing "To: Date - Optional" the field will have a second date associated with it -- you do not need a second date field.

7. Create a new View using Views module: Go to Import New View, name "timelineblock" and paste the View code into it:

$view = new view;
$view->name = 'timelineblock';
$view->description = 'timeline view description';
$view->tag = 'timelineblock';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => '',
'link_to_node' => 0,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'field_timelinedate_value' => array(
'label' => '',
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => 0,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_timelinedate_value',
'table' => 'node_data_field_timelinedate',
'field' => 'field_timelinedate_value',
'relationship' => 'none',
),
'field_timelinedate_value2' => array(
'label' => 'Date',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => 0,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => 0,
),
'exclude' => 0,
'id' => 'field_timelinedate_value2',
'table' => 'node_data_field_timelinedate',
'field' => 'field_timelinedate_value2',
'relationship' => 'none',
),
'body' => array(
'label' => '',
'exclude' => 0,
'id' => 'body',
'table' => 'node_revisions',
'field' => 'body',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'timelinetype' => 'timelinetype',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('items_per_page', 500);
$handler->override_option('style_plugin', 'timeline');
$handler->override_option('style_options', array(
'grouping' => '',
'type' => '0',
'display' => array(
'width' => '100%',
'height' => '250px',
'focus' => 'first',
),
'bands' => array(
'band1_unit' => 'month',
'band2_unit' => 'year',
),
'misc' => array(
'controls' => '0',
),
));
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
'teaser' => 1,
'links' => 1,
'comments' => 0,
));
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'timelinepage');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));

/* this is the end of the View - do not copy this line or any of the following lines, and do not paste them into the view */

8. Click the Filter Type on the new View in the Filters section (it might say "Filter: Node Type - Event") and change it by choosing the checkbox next to timelinetype and unchecking any other boxes next to content types. Just make sure your View has Filter: Node Type - timelinetype (this is so the Timeline only tries to show nodes that are of the right type and doesn't try to show Pages or Books or Events or some other type of content from your site).

9. Click the Page part of the View toward the upper-left, and then set the Path (toward the bottom left) where you want the timeline to appear (such as timelinepage, so your timeline appears at yoursite.com/timelinepage). You may want to name it something else.

10. Create a new timelinetype and give it a title, body, start date, and end date (so you have something for the Timeline to display).

11. Go to /timelinepage (or whatever you set the View page path to) and look at your Timeline!

You should be able to customize the view slightly after you have successfully gotten it to display, such as changing the band granularity to year/month/day/hour/second, or making the timeline more pixels tall or wide (by clicking on the small flower in your View next to Basic Settings - Style: Timeline.

Advanced:

If you'd rather use other names for your content type and date field, you will need to change some values in the text of the View before importing it. Assume we are using the custom content type called event, and that custom content type has one date field called eventdate. Don't be confused - the custom content type can be called "event" if you want. This does NOT mean these instructions are for Event module - they are not. Event module creates a new custom content type called "event" when it is installed, but if you don't have Event module installed (which we don't) you can still create a custom content type named anything you want, including event.

field_timelinedate_value (change to field_event_value) - you will have to change this in 3 places.
field_timelinedate_value2 (change to field_event_value2) - you will have to change this in 3 places.
node_data_field_timelinedate (change to node_data_field_event) - you will have to change this in 2 places.
'timelinetype' => 'timelinetype', (change to 'event' => 'event',) - you will have to change this 1 line which has 2 mentions of the custom content type.

#8

everydayjones - February 24, 2009 - 02:53

I followed the above, but all I get is a white page displayed when I try to view all the work I've done. I've created the content, not sure what's up.

#9

bit7 - March 24, 2009 - 09:57

+1 subscribing.

#10

scotese - April 11, 2009 - 14:01

Don't forget to Save your View after following all of the directions in #7. But sadly, I too just get a blank page.

#11

KiamLaLuno - April 11, 2009 - 14:14
Title:Can't get Views2 View to work with Events» Can't get Views2 to work with Events

#12

Livingstone - April 17, 2009 - 10:34
Status:active» fixed

Hello everybody.
I just follow the instructions above changing the widget url in admin/settings/timeline/advanced : http://static.simile.mit.edu/timeline/api/timeline-api.js and everything seems to be ok!

:)

#13

KiamLaLuno - April 17, 2009 - 10:43
Status:fixed» active

It would be better to wait a reply from who opened the issue, before to declare it fixed.

#14

Livingstone - April 18, 2009 - 08:02

Ok, I'm very sorry

#15

bertboerland@ww... - April 20, 2009 - 09:36

confirmed, not working when using the JS file local, does work when the MIT reference is used

#16

KiamLaLuno - April 20, 2009 - 09:43

Is that caused by any difference between the files, or is one working simply because it is not a local file?

#17

bertboerland@ww... - April 20, 2009 - 11:48

I downloaded the JS I use from the MIT (and all other files as well of MIT) but there is an error

date_format() expects parameter 1 to be DateTime, null given in /Applications/MAMP/htdocs/sitename/sites/all/modules/timeline/timeline.module on line 443.

Now I think this is cck field date related, however, using the webservice works fine with the same view

#18

hobo - May 20, 2009 - 20:26

I'm seeing the same problem
date_format() expects parameter 1 to be DateTime, null given in /Applications/MAMP/htdocs/sitename/sites/all/modules/timeline/timeline.module on line 443.

anyone get this and solve it?

#19

hobo - May 21, 2009 - 15:03

Seems that funny things happen when timeline-api.js is not directly in the /api directory.. I had it installed /api/timeline-1-2/timeline-api.js.. things cleared up when i moved things back and removed the timeline-1-2 directory..

#20

xamanu - July 23, 2009 - 19:04
Status:active» closed

Events module is not supported anymore by the newest version of Timeline Module 6.x-2.x

 
 

Drupal is a registered trademark of Dries Buytaert.