Sujet fermé
Note de ce sujet :
  • Moyenne : 0 (0 vote(s))
  • 1
  • 2
  • 3
  • 4
  • 5

[Résolu] CG Calendar 1.14.3 : Bug lié à la navigation entre les mois
#5

Merci de se pencher si rapidement sur mon cas.

Bon j'ai corrigé mon doctype et certaines erreurs.

Par contre j'ai toujours le même soucis j'ai donc du mal comprendre la solution.

J'avais comme fonctions de gabarit :

Citation :{if !isset($smarty.get.nojs)}
<script type="text/javascript">{jsmin}
// the jsmin plugin is included with CGExtensions.
if( typeof jQuery != 'undefined' ) {
$(document).ready(function(){
$(document).on('click','a.calendar-nav',function(ev){
// allow paginating through months via ajax.
var url = $(this).attr('href').replace(/amp;/g,'')+'nojs=1&showtemplate=false';
$('#cal-calendar').load(url);
ev.preventDefault();
});

if( jQuery().dialog ) {
$(document).on('click','a.calendar-daylist',function(ev){
// demonstrate viewing a day list in a popup dialog
// and mixing smarty and javascript code.
// uses jquery ui dialog... but could just as easily use fancybox etc.
// you could add parameters here for changing the template from the default, etc, or even filter by category.
ev.preventDefault();
var day = new Date( $(this).data('day') * 1000 );
var m = day.getMonth()+1;
var d = day.getDate();
var y = day.getFullYear();
var url = '{module_action_link module=CGCalendar display=list day=DDDD month=MMMM year=YYYY jsfriendly=1}&showtemplate=false';
url = url.replace('MMMM',m).replace('DDDD',d).replace('YYYY',y);
$('#cal-dayview').load(url,function(data){
$('#cal-dayview').dialog({
title: '{$mod->Lang('dayview')}'
})
});
});
}
})
} // jquery test
{/jsmin}</script>
{/if}

{strip}
<div style="display: none;">{* a simple wrapper *}
<div id="cal-dayview"></div>
</div>
<table class="calendar" id="cal-calendar">
<caption class="calendar-month">
<span class="calendar-prev"><a class="calendar-nav" href="{$navigation.prev}">&laquo;</a></span>
{$date|date_format:'%b %Y'}
<span class="calendar-next"><a class="calendar-nav" href="{$navigation.next}">&raquo;</a></span>
</caption>
<tbody><tr>
{foreach from=$day_names item=day key=key}
<th class="cal-dayhdr" 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}">&nbsp;</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 {if isset($day.class)}class="{$day.class} cal-day"{/if}>
{if isset($day.events.0)}<a class="calendar-daylist" data-day="{$day.date}" href="{$day.ni_url}">{$key}</a>{* by default use the non inline (replace content tag) version of the URL *}
<ul>
{foreach from=$day.events item=event}
<li>
{* some simple smarty logic to use the foreground and background colors assigned to an event *}
{$style=''}{if $event.bgcolor}{$style="style=\"color: {$event.fgcolor}; background-color: {$event.bgcolor}\""}{/if}
<a class="calendar-event" href="{$event.url}" {$style}>{$event.event_title|summarize:20}</a></li>
{/foreach}
</ul>
{else}{$key}{/if}
</td>
{math assign=weekday equation="x + 1" x=$weekday}
{/foreach}

{* remaining empty days *}
{if $weekday != 7}
<td colspan="{math equation="7-x" x=$weekday}">&nbsp;</td>
{/if}


</tr>
</tbody></table>

{/strip}

que j'ai donc changé en

Citation :{if !isset($smarty.get.nojs)}
<script type="text/javascript">{jsmin}
// the jsmin plugin is included with CGExtensions.
if( typeof jQuery != 'undefined' ) {
$(document).ready(function(){
$(document).on('click','a.calendar-nav',function(ev){
// allow paginating through months via ajax.
var url = $(this).attr('href').replace(/amp;/g,'')+'nojs=1&showtemplate=false';
///
$.get( url, function( data ) {
$( '#cal-calendar' ).html( data );
});
///
ev.preventDefault();
});

if( jQuery().dialog ) {
$(document).on('click','a.calendar-daylist',function(ev){
// demonstrate viewing a day list in a popup dialog
// and mixing smarty and javascript code.
// uses jquery ui dialog... but could just as easily use fancybox etc.
// you could add parameters here for changing the template from the default, etc, or even filter by category.
ev.preventDefault();
var day = new Date( $(this).data('day') * 1000 );
var m = day.getMonth()+1;
var d = day.getDate();
var y = day.getFullYear();
var url = '{module_action_link module=CGCalendar display=list day=DDDD month=MMMM year=YYYY jsfriendly=1}&showtemplate=false';
url = url.replace('MMMM',m).replace('DDDD',d).replace('YYYY',y);
$('#cal-dayview').get(url,function(data){
$('#cal-dayview').dialog({
title: '{$mod->Lang('dayview')}'
})
});
});
}
})
} // jquery test
{/jsmin}</script>
{/if}

{strip}
<div style="display: none;">{* a simple wrapper *}
<div id="cal-dayview"></div>
</div>
<table class="calendar" id="cal-calendar">
<caption class="calendar-month">
<span class="calendar-prev"><a class="calendar-nav" href="{$navigation.prev}">&laquo;</a></span>
{$date|date_format:'%b %Y'}
<span class="calendar-next"><a class="calendar-nav" href="{$navigation.next}">&raquo;</a></span>
</caption>
<tbody><tr>
{foreach from=$day_names item=day key=key}
<th class="cal-dayhdr" 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}">&nbsp;</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 {if isset($day.class)}class="{$day.class} cal-day"{/if}>
{if isset($day.events.0)}<a class="calendar-daylist" data-day="{$day.date}" href="{$day.ni_url}">{$key}</a>{* by default use the non inline (replace content tag) version of the URL *}
<ul>
{foreach from=$day.events item=event}
<li>
{* some simple smarty logic to use the foreground and background colors assigned to an event *}
{$style=''}{if $event.bgcolor}{$style="style=\"color: {$event.fgcolor}; background-color: {$event.bgcolor}\""}{/if}
<a class="calendar-event" href="{$event.url}" {$style}>{$event.event_title|summarize:20}</a></li>
{/foreach}
</ul>
{else}{$key}{/if}
</td>
{math assign=weekday equation="x + 1" x=$weekday}
{/foreach}

{* remaining empty days *}
{if $weekday != 7}
<td colspan="{math equation="7-x" x=$weekday}">&nbsp;</td>
{/if}


</tr>
</tbody></table>

{/strip}



Mais j'ai tout de même le même problème.

J'ai du mal comprendre quelque chose. D'ailleurs j'ai du mal à comprendre pourquoi je suis le seul à avoir ce souci mais bon.

Je suis nul en Ajax, et je n'ai que des notion de JS / JQuery ce qui peut expliquer mon incompréhension. Sad
Sujet fermé


Messages dans ce sujet

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)