I would like to use just a year and month views. As suggested in the docs, I've unattached day and week. Its more less ok, but theres few things I would like to change. Day links in month views are still clickable and they lead to an empty page now. Is there a easy way without touching the code to make them unclickable? The other thing is the year view. Is there a way to make day links open month view instead of the day view (which is empty page now)? Eventualy disabling the day links in year view would be nice too.

CommentFileSizeAuthor
#3 theme.inc_.patch626 bytesmarcushenningsen
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

KarenS’s picture

Status: Active » Fixed

All of those things can be done in the theme layer. There are themes available for all the calendar parts. Find the theme that you want to change and override it in the normal Drupal way to behave however you want.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

marcushenningsen’s picture

Title: Removing Week / Day Views » Removing day views should remove day links in date boxes
Version: 6.x-2.0-rc6 » 6.x-2.2
Category: support » feature
Status: Closed (fixed) » Needs review
FileSize
626 bytes

Reopening this issue, since I might have a solution.

In theme.inc (placed in the theme folder of the calendar module) on line 514 is where the link in the date box is generated:

$vars['link'] = l($vars['day'], $vars['url']);

I simply added a check for day views: if the day exists ouput the link, if it doesn't just show the day without the link:

if ($view->date_info->display_types[day]) {
    $vars['link'] = l($vars['day'], $vars['url']);
  } else {
    $vars['link'] = $vars['day'];
  }

For weeks this already works. E.g. on a month view with week numbers shown, week numbers will only link to the week view if the view view exists. I'm not sure where this piece of code can be found, and therefore I don't really know if my solution is in line with the module code. However, my solution seems to work flawlessly. Would like a confirmation on this, though.

Marcus

doublejosh’s picture

Wait, you can't remove the links to days in the theme layer.

The theme layer outputs $cell['data']; which already has the nodes and day link rendered into HTML.
So it's too late at the theme layer.

I'm trying to avoid messing with theme.inc How can I alter this output in the theme layer?

marcushenningsen’s picture

I don't think you can. As I see it, there's no way around messing with theme.inc. Could you please check if my solution works for you, then we can call on a maintainer to review and perhaps commit the patch?

Marcus

BKWill’s picture

I've applied your patch and it works just fine. This should be an essential option that is incorporated in the main release. It doesn't make sense to link to a page that doesn't contain data. Thank you for putting in the time to fix this.

Cheers,

Will

marcushenningsen’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for testing. Changing the status.

Danny_Joris’s picture

I agree with this issue. I don't want days in my calendar either. I managed to 'unlink' the separate days, but in the menu bar 'days' is still available. I know I could just hide it with css, but I don't like that. I shouldnt be messing with an .inc file.

Has this been committed yet?

-- Edit:

I fixed my issue by adding the following snippet to the calendar-main.tpl.php template.

<?php unset($calendar_links[2]) ?>
<?php unset($calendar_links[3]) ?>

Just unset the right keys in the links array.

-- Edit2: Hmm weird. It does appear to be enough to 'de-attach' the day and week views to remove week and day links. I must have overlooked that. Anyway, code snippet is not needed then. Sorry to bother :)

Fidelix’s picture

Status: Reviewed & tested by the community » Fixed

Solving this is actually simple.

Create a file named calendar-datebox.tpl.php in your theme directory.
Fill it with this:

<div class="<?php print $granularity ?> <?php print $class; ?>">
<?php
 
if ($selected == 1) {
print '<a href="'.$url.'">';
print $day;
print '</a>';
} else {
print $day;
};
?>
</div>

There you have it. No hacks.

marcushenningsen’s picture

Status: Fixed » Reviewed & tested by the community

Thanks for your idea, Fidelex. I tried your solution, but it seems to work as expected only if the days have no events. Can you confirm this?

Marcus

Fidelix’s picture

This is on purpose Marcus.

If the day has events, its common sense to link it to the days page so the user can view the events.

If you want to FULLY remove the links, even if the day have events, here is the code:

<div class="<?php print $granularity ?> <?php print $class; ?>">
<?php

print $day;

?>
</div>

Very simple, right?
Good luck!

bryancasler’s picture

#9 worked but it broke the functionality of this module http://drupal.org/project/calendar_tooltips

It also created some weird css display problems. Once you hovered over a date in the calendar it would continue displaying that date its hovered style permanently.

KarenS’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks.

Fidelix’s picture

What exactly did you commit KarenS?

The patch on the theme layer or the template i created?

KarenS’s picture

There is only one patch in this issue. That is what I committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ailgm’s picture

Status: Closed (fixed) » Needs work

Using 6.x-2.4, I'm encountering this problem. I've removed year, week and day displays. The day numbers are still linked for days with events in them.

I found similar lines at the end of template_preprocess_calendar_month_multiple_node and template_preprocess_calendar_week_multiple_node routines and added the same check. That made no difference to the one display I'm still using (month).

Is anyone else experiencing this? Have you solved it?

rcastera’s picture

#11 worked beautifully! Exactly what a client requested. Thanks!

Pat Redmond’s picture

Category: feature » bug

I think this is actually a bug. When I installed the module, I don't get any link from the month view to the day view. When I use the code in #9 I get the link. I'm not really sure why that's the case, but I think that it is worth including that code in the module.

M3lissa’s picture

Issue summary: View changes

#9 works perfect! Thanks a lot, I was really getting crazy about it! Thanks.

bgm’s picture

Status: Needs work » Fixed

I can't confirm/test for Drupal 6, but this works fine on Drupal 7: disabling the 'day' view display will disable the links on the calendar day. I think that this issue was accidentally re-opened.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.