Download & Extend

Options to make week, day, or year the default view

Project:Calendar
Version:5.x-2.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

Hello,

Currently, when I create a calendar view, monthly view will be default view, how can I change it to default weekly view ??

Comments

#1

Status:active» fixed

Check 'week' in the setting for Granularity in Argument "Date: Date".

#2

Status:fixed» postponed (maintainer needs more info)

Hello dydecker,

I went to my views' argument. I saw "Date: From" and "Date: To". no "Date: Date". and there is no week settings for Granularity after added either "Date: From" or "Date: To" argument. Did I miss something ??

#3

Oh, sorry - I just reread your request was for 5.x-2.0 not 6.2. My mistake. Perhaps someone else could help.

#4

Title:How to make weekly view as default??» Options to make week, day, or year the default view
Version:5.x-2.0-rc2» 5.x-2.x-dev
Category:support request» feature request
Status:postponed (maintainer needs more info)» active

Defaulting to the month view is hard-coded into the 5.2 version. I fixed that in the 6.2 version but haven't done it in 5.2. This is a feature request, it should be doable. I thought there was already an issue for this, but don't see it now, so I guess this will be it.

#5

Hello Karen,

I have read source code of calendar module. find calendar.inc near line 60 says.
// If no arguments are provided, default to current month view.
if (empty($view->args) || !calendar_is_calendar_arg($view)) {
$query->calendar_type = 'month';

Try to set $query->calendar_type = 'week';
But, not work.

Are there other codes I should change ??
Basically, we need to set all calendar default view to weekly.

#6

Hi,

while waiting for the implementation of this feature request this little workaround might be useful.

When you're calendar view is set up and working, add this code to the Argument handling code section of the View:

// Set arguments to current week if no args are set
if (!$args[0]) {
  $y = date('Y');
  $w = date('W');
  $args[0] = $y;
  $args[1] = 'W' . $w;
}
// debugging info, remove these two lines when you're happy with the results
$msg = 'args: ' . $args[0] . ', ' . $args[1];
drupal_set_message($msg);

return $args;

This code simply checks if the Views arguments are empty. In this case it puts the current year to first argument and current week with W-prefix to second argument.

Edit: this makese the week view to be default. This example can be easily modified to make day view the default, just put current year, month and day to the $args array.

Hope this helps,
Markus

#7

Status:active» fixed

work like a charm.
thanks Markus.

#8

Status:fixed» active

Setting back to active to retain this as a current feature request for the module

#9

Status:active» closed (won't fix)

I've decided I'm not going to add any new features to the D5 version. I need to finish D5 up and get an official release out on D6 and start looking at D7, so there just isn't time to make and maintain more changes to D5.

#10

Is there a way of choosing different default views for page vs block (D6)?

#11

Category:feature request» support request
Status:closed (won't fix)» needs review

Hello there,
Although I know this feature will not be ported to the 5.x branch, I will need some help regarding the #6 piece of code kindly provided by masipila.

The code first seemed to work very well when I implemented it last week.
However, one week later, I just realised that the events have not been updated: still the ones from last week.

I cleaned the cache, removed the code, inserted the code again etc... still have last week events listed.

Can anybody help?

Many thanks,

DB

#12

Any update? Can it be marked won't fix again?

#13

Status:needs review» closed (won't fix)

see #9

nobody click here