Hi,
when I add a calendar page to my panel then the rendered page misses some views html which is visible at all other views on my pane. The missing html contains the view wrapper:
<div class="view view-calendar view-id-calendar view-display-id-calendar_1 view-dom-id-1 views-processed">
I'm also missing the date navigation which I have to add manually to my calendar-week.tpl.php with a call of print theme('date_navigation', $view);

My goal is to have a calendar on the frontpage-panel with ajaxified prev/next buttons which works pretty fine on the original calendar page. To make this work on panels the view wrapper is needed to let the javascript do its job.
I also observed that the calendar at my panel is not listed in javascripts Drupal.settings.views.ajaxViews but ajax is enabled. So I think the calendar view is rendered by panels in a very special/uncommon way, isn't it?

Since I've got the view wrapper on all other views I think this must be a calendar specific issue.

I hope someone can either help me or confirm this behavior.

Modules used:
calendar 2.4
date dev
panels 3.9 + ctools 1.8
views 2.12

Comments

haggins’s picture

It seems as template_preprocess_views_view() is not invoked when the calendar view is rendered within a panel.

haggins’s picture

What a journey! Finally I got it working this way:

  1. Patch date and calendar module to get basic ajaxifation as described here
  2. Modify calendar-week.tpl.php
    <div class="calendar-calendar"><div class="week-view">
    <table>
    .
    .
    .
    </table>
    </div></div>
    

    to

    <div class="view view-calendar view-id-calendar view-display-id-calendar_period_4 view-dom-id-1 views-processed">
    <div class="attachment attachment-after">
    <div class="calendar-calendar"><div class="week-view">
      <?php print theme('date_navigation', $view); ?>
    <table>
    .
    .
    .
    </table>
    </div></div></div></div>
    

    Make sure to add your correct class above!

  3. Add two contents to your pane where the calendar will appear:
    1. Add custom content and use php-filter to add the following:
      $view = views_get_view('calendar');
      $view->set_display('calendar_period_4');
      $week = date_format_date(date_now(), 'custom', 'Y-\WW');
      $view->set_arguments(array($week));
      $view->use_ajax = TRUE;
      theme('views_view', $view); // we add this content to use this command! It's responsible that our view
                                  // gets added to javascript object Drupal.settings.views.ajaxViews
      

    2. This content is the calender-view itself. Make sure to pass arguments and to overwrite view path with your panels path. This is necessary to make it work with javascript disabled.
  4. At least you may have to do some css adjustments to hide double navigation bar at the orginal calendar page.

Modules used:
date dev
calendar 2.4
panels 3.9
ctools 1.8
views 2.12

That's it, great! I hope there will be an easier way to achieve this in the future.

Anyway I'm still interested in why calendar isn't rendered through theme_views_view() in a panel by default as it is on it's own page...

neslee canil pinto’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

The D6 branch is no longer supported so we're closing this issue. If you think this issue still exists in D7 you can open a new one.