CGCalendar: Handling the calendar and the list and event templates

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Yvan B
Forum Members
Forum Members
Posts: 60
Joined: Thu Apr 08, 2010 3:27 pm

Re: CGCalendar: Handling the calendar and the list and event templates

Post by Yvan B »

Peciura wrote: OK. I thought you we using parameter inline=1.

To show event list of the day with jQuery, it is enough  change 'cgcalendar_info ul li' to 'cgcalendar_content' and '#one_calendar_event' is also useless:
{literal}

$(document).ready(function(){
   $(".cgcalendar_content a").click(function updateCGCalendar(event){
event.preventDefault();
      var event_link = $(this).attr("href");   
/* alerter is good way to inspect some variables like url */
/*alert(nav_link+'&showtemplate=false'); */
      $('#calendar').load(event_link+'&showtemplate=false');
   });
});

{/literal}
I think we still don't understand each other !

Before today, I wasn't using JQuery. I was using the inline and use_session parameters and it worked fine except that the eventlist for particular days was displayed inline, instead of my calendar, and it was wrong. By the way, I think this should be changed, as it doesn't make sense to replace a calendar by an eventlist.

As I didn't know how to make it work my way. I tried JQuery, even if I was a bit reluctant, because I don't know it at all.

Now, using the JQuery code you provided at the very begining of this thread, it works fine except for the session thing: when I browse the calendar and then go to another page of my website, the calendar displays the current month again. It doesn't keep track of the month I'm checking when I browse my website. Same when I select an event or a day: the calendar goes back to the current month. And the use_session parameter doesn't work along your JQuery code.
Another parameter of CGCalendar that seems disabled is 'detailpage'. The event and detail templates are shown in the currentpage.

I guess it's not that important, but i wish I could keep track of the month I'm checking and display the event and detail templates in a specific page. That is what I'm asking. Do you have any idea how to do this ?
Yvan B
Forum Members
Forum Members
Posts: 60
Joined: Thu Apr 08, 2010 3:27 pm

Re: CGCalendar: Handling the calendar and the list and event templates

Post by Yvan B »

UP !!!

Hey, Peciura, I guess you're getting tired of answering me, but I really wish to know if (and how) you can manage to keep in memory the month you're browsing when you go to another page of the website.

But, I also have another question. I checked my website with Internet Explorer and I encounter trouble with your JQueries. I know it's stupid, but I'm stuck with IE6 here... So, I'm wondering if you know it works with IE7 or 8.

Thanks very much !
Peciura

Re: CGCalendar: Handling the calendar and the list and event templates

Post by Peciura »

Bearing in mind jQuery is not working  in IE and you want to save selected month - run CGCalendar  inline
(use parameters:  inline, use_session, detailpage) and
modify {$day.ur} in  calendar template as follows.
Not sure if it is the best way, but you know...
Yvan B
Forum Members
Forum Members
Posts: 60
Joined: Thu Apr 08, 2010 3:27 pm

Re: CGCalendar: Handling the calendar and the list and event templates

Post by Yvan B »

Ok, I'm just about to cry... It works ! It works just right ! And it got through the W3C Validator !

I'm very grateful to you, Peciura. If you've got time, i'd be glad to get even a short explanation of this solution, because I don't understand it.

Thanks again :)
Peciura

Re: CGCalendar: Handling the calendar and the list and event templates

Post by Peciura »

If you've got time, i'd be glad to get even a short explanation of this solution, because I don't understand it.
Every module instance has its own ID. That's how CMSms knows, what module should use passed parameters (url).
I simply changed it to default content id. After doing that parameters are passed to {content} and than to CGCalendar.
Yvan B
Forum Members
Forum Members
Posts: 60
Joined: Thu Apr 08, 2010 3:27 pm

Re: CGCalendar: Handling the calendar and the list and event templates

Post by Yvan B »

Got it ! I'll try to keep that in mind. Thanks again !
kb6104
New Member
New Member
Posts: 2
Joined: Mon Mar 28, 2011 1:22 pm

Re: CGCalendar: Handling the calendar and the list and event

Post by kb6104 »

I now this is a year later but I am implementing my very first cgcalendar. This thread has been very helpful, thank you! BUT I can't figure out:
1. where to put javascript (main template? calendar template? page the calendar is on?

2. I have a small grid calendar in a side bar on every page (no event descriptions, just numbers). I can click day to see an events list but next/prev month on small calendar is screwed up. When clicked "hides" the small calendar content
http://hibuffalodowntown.com/index.php?page=home

3. can you supply eventtemplate and listtemplate you used. I know its asking a lot...

Here is the template I'm using (from your previous posts):
{strip}
<div class='cgcalendar_wrapper'>
<table class="calendar" id="cal-calendar">
<caption class="calendar-month">
<span class="calendar-prev">
<a href="{"`$navigation.prev`&showtemplate=false"}"> {*importamt*}
«
</a>

</span>
{$month_names[$month]} {$year}
<span class="calendar-next">

<a href="{"`$navigation.next`&showtemplate=false"}"> {*importamt*}
»
</a>
</span>
</caption>
<tbody>
<tr>
{foreach from=$day_names item=day key=key}
<th abbr="{$day}">
{$day_short_names[$key]}
</th>
{/foreach}
</tr>
<tr>
{* initial empty days *}
{if $first_of_month_weekday_number > 0}
<td colspan="{$first_of_month_weekday_number}"> </td>
{/if}

{* iterate over the days of this month *}
{assign var=weekday value=$first_of_month_weekday_number}
{foreach from=$days item=day key=key}
{if $weekday == 7}
{assign var=weekday value=0}
</tr>
<tr>
{/if}
<td >
<div class='cgcalendar_day' id='cgcalendar_day_{$key}'>
{if isset($day.class)}
<div class="{$day.class}">
{/if}
{if isset($day.events.0)}
{assign var='cgcalendar_multiple_category' value=''}
{assign var='first_category' value=''}
{foreach from=$day.events item=event}
{foreach from=$event.categories item=category}
<div class="cgcalendar_category_{$category.category_id} cgcalendar_category
{if $first_category==''}
{assign var='first_category' value=`$category.category_id`}
{elseif $first_category!=$category.category_id}
{assign var='cgcalendar_multiple_category' value=`$category.category_id`}
{/if}
">
{/foreach}
{/foreach}

{if !empty($cgcalendar_multiple_category)}
<div class='cgcalendar_multiple_category'>
{/if}

<a href="{$day.url|replace:$actionid:'cntnt01'}">{$key}</a>

{if !empty($cgcalendar_multiple_category)}
</div>
{/if}

{foreach from=$day.events item=event}
{foreach from=$event.categories item=category}
</div>
{/foreach}
{/foreach}

<div class='cgcalendar_info'>
<ul style='float:left;'>
{foreach from=$day.events item=event}
<li>
<a href="{$event.url}">
{$event.event_title}
</a>
</li>
{/foreach}
</ul>
</div>
</div>
{else}
{$key}
{/if}

{if isset($day.class)}
</div>
{/if}
</div>
</td>
{math assign=weekday equation="x + 1" x=$weekday}
{/foreach}

{* remaining empty days *}
{if $weekday != 7}
<td colspan="{math equation="7-x" x=$weekday}"> </td>
{/if}
</tr>
</tbody>
</table>
</div>
{/strip}
josee225
Forum Members
Forum Members
Posts: 64
Joined: Sat Jun 06, 2009 12:42 am

Re: CGCalendar: Handling the calendar and the list and event

Post by josee225 »

I am very interested in all the information posted here, unfortunately, all the jQuery code seems to have disappeared... Or maybe it's a setting in my account ???

Is there anyway someone could post it again or help my out with this?

Thank you!
blackhawk
Power Poster
Power Poster
Posts: 280
Joined: Mon Oct 20, 2008 6:07 pm

Re: CGCalendar: Handling the calendar and the list and event

Post by blackhawk »

I don't mean to re-open a "completed?" topic?, but its a year later and everything has changed. I have cmsms 1.10.1 installed with cgCalendar 1.8.2, and I cannot get the detailpage tag to work when display="calendar".

Here's my tag on my "home" page...

Code: Select all

{cms_module detailpage="blog"  module="CGCalendar" first_day_of_week="0" use_session="true" display="calendar" calendartemplate="klp2012-list" inline="1"}
When I load this "initially" on my home page and click the arrows to go back a month, or forward a month, should it not initiate that with the detailpage alias to blog? Instead the page reloads to the same home page. Does anyone else have this problem? Is there a workable solution to this? What must we do to get $navigation.prev and $navigation.next to proceed to the correct page alias?

Thanks O0
Post Reply

Return to “Modules/Add-Ons”