I've been trying to see if there is a way to get Calendar to work with OG such that you can have a different calendar for each group. In principle it seems that it should (and does partially) work.
Here's my process:
1. Created a CCK type called Calendar Event, included a start date/time (with optional end date/time).
2. Created a Group in OG, called Group 1.
3. Created Calendar view (called og_calendar) which uses a filter for "Og: Post in User Subbed Groups" "is equal to" "currently logged in User"
4. Create a Calendar Event and make it published to Group 1 only.
5. Show a Calendar Block on the Group homepage.
Now, if I understand this correctly, I should get:
- a mini calendar which has the date of my event highlighted (this seems to work OK)
- when I click on the day of the highlighted event, I should go to the Group page that refers to this node (this doesn't work, it goes to a blank node page
- if I click on the month link, I should get a large calendar view with group only events for the group page. This sort of works, in that it goes to a month view and my event is visible, but it does not go to a Group page (if I have a different template for the Group, it does not use this template it defaults to the overall site template, so I assume it dropping out of OG)
So, my question/request would be - is there a way to get Calendar to work with OG?
Thanks
ps. here's the Calendar view
$view = new stdClass();
$view->name = 'og_calendar';
$view->description = 'Calendar view of any date field';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'Calendar';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'calendar';
$view->url = 'og_calendar';
$view->use_pager = TRUE;
$view->nodes_per_page = '99';
$view->block = TRUE;
$view->block_title = 'Calendar';
$view->block_header = '';
$view->block_header_format = '1';
$view->block_footer = '';
$view->block_footer_format = '1';
$view->block_empty = '';
$view->block_empty_format = '1';
$view->block_type = 'calendar';
$view->nodes_per_block = '99';
$view->block_more = TRUE;
$view->block_use_page_header = FALSE;
$view->block_use_page_footer = FALSE;
$view->block_use_page_empty = FALSE;
$view->sort = array (
);
$view->argument = array (
array (
'type' => 'calendar_year',
'argdefault' => '2',
'title' => 'Year',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
array (
'type' => 'calendar_month',
'argdefault' => '2',
'title' => 'Month',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
array (
'type' => 'calendar_day',
'argdefault' => '2',
'title' => 'Day',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'title',
'label' => 'Title:',
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
array (
'tablename' => 'node_data_field_date_time',
'field' => 'field_date_time_value',
'label' => '',
'handler' => 'content_views_field_handler_ungroup',
'options' => 'default',
),
array (
'tablename' => 'node',
'field' => 'body',
'label' => '',
'handler' => 'views_handler_field_body',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'calevent',
),
),
array (
'tablename' => 'og_uid_node',
'field' => 'currentuid',
'operator' => '=',
'options' => '',
'value' => '***CURRENT_USER***',
),
);
$view->exposed_filter = array (
);
$view->requires = array(node, node_data_field_date_time, og_uid_node);
$views[$view->name] = $view;
Comments
Comment #1
karens commentedMoshe and Eaton and I have been discussing ways to get this working right to create OG calendars and there may be a few things that need to be tweaked to get it working. I see we don't already have an actual feature request for this, so this will be it :-)
Comment #2
karens commentedOops, not Eaton but Ted Serbinski
Comment #3
mzabala commentedI am interested in this as well. What I would love is not just have calendars per organic group, but for a user to view a combined calendar with the events from all the groups they are currently subscribed to.
Comment #4
Veggieryan commentedany progress on this front? even with the new "post is in current group" filter this does not work.
Comment #5
Veggieryan commentedAny news on this?
Obviously this is an intricate problem... should we just accept that our groups only get list views of events for now? ;)
Are there relevant patches to test and vote on?
thanks!
ryan.
Comment #6
jonhattanIt does work if the OG group is hardcoded in the view, using the filter "Og: Post in specified group". It raises a:
warning: Invalid argument supplied for foreach() in /var/www/drupal-5.2/includes/form.inc on line 948.
and does not show up the list of available groups. Just enter yourself the nid of the desired group node and it works.
I figure out that the other group filters does not work because when calendar is invoqued outside the group page, the group context info is not available.
The context is available when using the view as a og_ghp_ but is not available if you directly call the view (ej: http://example.com/my_og_calendar). It's neither available if you click to go to another month, etc.
Found this related topic:
http://drupal.org/node/66145
Comment #7
jonhattanIn fact I made it work with the patch in the topic I mentiones. Enabling a little module that tracks the OG context between pages. It's at:
http://drupal.org/node/66145
The other problem is still not solved (the group theme).
It will be possible to make the big calendar work as the minicalendar, ie: by passing an url argument:
?mini=my_og_calendar/2007/10/all&??Comment #8
jason.fisher commentedAlmost what I'm looking for, but don't believe this quite solves my issue -- trying to get the calendar to show up as a tab for a group using views.
i.e., group is node/61908, trying to get calendar URL to be node/61908/calendar/YYYY/MM/DD -- mainly so I can keep node/61908 as the group home.
It seems your fix works around this problem. I'm thinking I need to fix something in calendar itself?
Comment #9
karens commentedI'm not sure this is completely working yet, but I think one thing needed was to be able to use the gid as the first argument and the calendar wasn't properly handling a non-calendar argument in the first position. I just committed a fix to allow that so you should be able to create a calendar url like og/gid/year/month where you substitute in the gid, year, and month in to see the calendar for that group.
I'm not promising that completely works yet, but try it and please report back.
Comment #10
karens commentedNot quite working yet. I can get some things working right, but not everything just yet. Still working on this.
Comment #11
karens commentedI've made some progress on this. Non-calendar args now seem to be working correctly and the latest commit includes a default view for a group calendar that will appear as a tab on the group node page (at node/$arg/calendar). Getting a block view of this working is going to be much more difficult, so I'm going to make a separate issue for that.
Comment #12
kc1981 commentedThanks for the great work!
This works very well except for that it puts the Calendar tab on any page accessed via http:/example.com/node/xx and not just the group pages. It also addess the Setup and iCal tabs on http://example.com/node
Comment #13
karens commentedHmm, you're right. It turns out we need to have OG create a views token that can tell us if this is a valid group. I created a patch for this at http://drupal.org/node/182936. Add that to og.module, then change the url in your view from 'node/$arg/calendar' to 'node/$group/calendar'.
Comment #14
kc1981 commentedThanks!
This solves the problem of the Calendar tab showing up, but now when I click on any of the links on a group's Calendar page, the urls read http://example.com/node/$group/calendar/yyyy/mm/dd instead of inserting the group number.
I worked out a fix that involves adding the following function to calendar_api.inc :
The functions needs to be called in three places to fix the Year Month Day navigation at the top, the prev/next links, and the date links on the monthly calendar.
Around line 299 in calendar.theme I added
$url = _calendar_og_view_url($view->real_url);and changed the references of $view->real_url to $url for each $calendar_links[]
In calendar_api.inc in calendar_get_calendar(), it should be called on $params['url'] towards the beginning of the function (I put it at line 53).
In calendar.module around line 381, I changed
to
The links seem to be working now. Hope this helps!
Kevin
Comment #15
karens commentedI don't think all of that is necessary, I just needed to $group as another arg replacement. I just committed a fix for that. See if that solves the problem (I'm not where I can test it right now).
Comment #16
kc1981 commentedIs the fix different from the latest versions?
I'm using the latest Calendar 5.x-1-dev and og 5.x-4.0-rc11 (both downloaded this afternoon).
I have Og: Group nid(s) listed as my first argument in the view.
Without the code posted earlier, though, the links on the calendar page for the group point to things like
http://example.com/node/$group/calendar/41/2007/10/12
Did I miss something?
Thanks again. You guys are doing great work on og and calendar!
Comment #17
karens commentedWhen I test this with the latest code I committed and the latest OG, all the internal calendar links, navigation links, etc are fine. It may be you got a Calendar version that didn't have my last commit in it. The only place I can see any problem is in the breadcrumb where I do see '$group' showing up, so I need to investigate that.
Comment #18
karens commentedThe breadcrumb problem is a Views bug. I submitted a patch at http://drupal.org/node/183191 that gets everything working right.
Leaving this active until Views gets fixed.
Comment #19
kc1981 commentedThe links work fine now with the last night's download and the views patch.
Thanks!
Comment #20
gracearoha commentedWow, Looks like this is moving along quickly. Thanks so much for all the hard work. I have been looking for this function to add to my groups. Just one question: is it necessary to create a new CCK type called Calendar Event or will this new set up work by using the "create event" function already within the og details block?
Comment #21
csc4 commentedShould this be working now with the current versions of Views, Calendar and OG or do we need to wait for the Views update before trying?
Comment #22
karens commentedIf you use the latest version of Calendar and the latest development version of OG (not sure the OG fix is in an official release yet) it should work except for the breadcrumbs. The Views fix is to fix the breadcrumbs.
Comment #23
jblackhall commentedEDIT: Moved to this topic: http://drupal.org/node/187608#comment-624690
Comment #24
kc1981 commentedI think Views needs a similar patch to comment #18 for the views_get_url() function beginning around line 710 in order for the iCal feed to have the proper URL on an OG calendar view. I just posted a comment on http://drupal.org/node/183191, but thought it would be good to reference it here.
Comment #25
gracearoha commentedSo what is the difference between using this set up and og_calendar?
Comment #26
natalief commentedI am also interested in having a user to view a combined calendar with the events from all the groups they are currently subscribed to.
how is this accomplished?
Comment #27
kc1981 commentedIf you don't set the the OG: post in specified group filter on a Calendar view, then it should show items from all the groups a user is subscribed to, plus any site-wide items.
Comment #28
harriska2 commentedSubscribing (over a year later).
OG_Calendar requires the events module. In this senario, we don't want to use the events calendar but instead use CCK to create the event date (more customized, simpler format, etc).
Comment #29
Remon commentedSubscribing
Comment #30
kimadactyl commentedI'm getting this problem again. You can manually enter a URL, but the intial link to group calendar doesnt show up anything and the links are in the form:
http://example.com/node/$group/calendar/888/2008/05/all
I'm using 5.x-2.0-rc though, should I make a new ticket?
Comment #31
kimadactyl commentedhttp://drupal.org/node/239594#comment-820846
Works for me now with this patch and the view set to node/$node-group/calendar.
Comment #32
judyschmitz commentedHere's what I'm trying to do, as an admin to the site, and a user:
Have a global calendar that shows all events
Have an ability to segment that calendar according to separate tracks, or groups (see joomla calendar, it does this)
Have groups be able to post to their associated calendar track.
Is this possible in drupal event/calender/og?
Thanks
Judy
Comment #33
kimadactyl commentedI'm not sure what you mean by a "track", but yes I think you can do this Judy, although there are outstanding bugs :)
Kim
Comment #34
bcn commentedsetting Title back...
Comment #35
karens commentedI'm not making changes to the 5.1 version. I'm officially recommending you move to the 5.2 version now. If you have problems in that version you can check for existing issues or add new ones. Feature requests are now getting posted to the D6 version to be back-ported to 5.2.
There are several duplicates of this issue. Handling for this has been changed a lot in 5.2 and there are more current issues to track how that's working.
Comment #36
bryancasler commentedsubscribe