sylvieg | 1 Nov 2009 16:20
Picon

[Tikiwiki-cvs/svn] SF.net SVN: tikiwiki:[22779] trunk

Revision: 22779
          http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=22779&view=rev
Author:   sylvieg
Date:     2009-11-01 15:20:49 +0000 (Sun, 01 Nov 2009)

Log Message:
-----------
[FIX]PLUGIN CALENDAR: do not show twice same event in list mode (remarcks: better to user {foreach}
instead of {section} because {foreach} supports non consecutive elts)

Modified Paths:
--------------
    trunk/modules/mod-calendar_new.php
    trunk/templates/tiki-calendar_listmode.tpl

Modified: trunk/modules/mod-calendar_new.php
===================================================================
--- trunk/modules/mod-calendar_new.php	2009-11-01 15:08:48 UTC (rev 22778)
+++ trunk/modules/mod-calendar_new.php	2009-11-01 15:20:49 UTC (rev 22779)
 <at>  <at>  -69,9 +69,16  <at>  <at> 
 	include('tiki-calendar_setup.php');

 	$tc_infos = $calendarlib->getCalendar($module_params['calIds'], $viewstart, $viewend, $group_by);
+	if ($viewlist == 'list') {
+		foreach ($tc_infos['listevents'] as $i=>$e) {
+			$tc_infos['listevents'][$i]['head'] = '';
+			$tc_infos['listevents'][$i]['group_description'] ='';
+		}
+		$tc_infos['listevents'] = array_unique($tc_infos['listevents']);	
+}

 	foreach ( $tc_infos as $tc_key => $tc_val ) {
-        	$smarty->assign($tc_key, $tc_val);
+		$smarty->assign($tc_key, $tc_val);
 	}

 	$module_params['name'] = 'calendar';

Modified: trunk/templates/tiki-calendar_listmode.tpl
===================================================================
--- trunk/templates/tiki-calendar_listmode.tpl	2009-11-01 15:08:48 UTC (rev 22778)
+++ trunk/templates/tiki-calendar_listmode.tpl	2009-11-01 15:20:49 UTC (rev 22779)
 <at>  <at>  -7,31 +7,31  <at>  <at> 
 </tr>
 {if $listevents| <at> count eq 0}<tr><td colspan="4">{tr}No records found{/tr}</td></tr>{/if}
 {cycle values="odd,even" print=false}
-{section name=w loop=$listevents}
-{assign var=calendarId value=$listevents[w].calendarId}
-<tr class="{cycle}{if $listevents[w].start <= $smarty.now and $listevents[w].end >= $smarty.now}
selected{/if} vevent">
+{foreach from=$listevents item=event}
+{assign var=calendarId value=$event.calendarId}
+<tr class="{cycle}{if $event.start <= $smarty.now and $event.end >= $smarty.now} selected{/if} vevent">
 <td>
-<abbr class="dtstart" title="{$listevents[w].start|compactisodate}"><a
href="{$myurl}?todate={$listevents[w].start}" title="{tr}Change
Focus{/tr}">{$listevents[w].start|tiki_short_date}</a></abbr><br />
-{if $listevents[w].allday} {tr}All-Day{/tr} {else} {$listevents[w].start|tiki_short_time} {/if}
+<abbr class="dtstart" title="{$event.start|compactisodate}"><a
href="{$myurl}?todate={$event.start}" title="{tr}Change
Focus{/tr}">{$event.start|tiki_short_date}</a></abbr><br />
+{if $event.allday} {tr}All-Day{/tr} {else} {$event.start|tiki_short_time} {/if}
 </td>
 <td>
-{if $listevents[w].start|tiki_short_date ne $listevents[w].end|tiki_short_date}<abbr
class="dtend" title="{$listevents[w].end|compactisodate}"><a
href="{$myurl}?todate={$listevents[w].end}" title="{tr}Change
Focus{/tr}">{$listevents[w].end|tiki_short_date}</a></abbr> {/if}<br />
-{if $listevents[w].start ne $listevents[w].end and $listevents[w].allday ne 1}{$listevents[w].end|tiki_short_time}{/if}
+{if $event.start|tiki_short_date ne $event.end|tiki_short_date}<abbr class="dtend"
title="{$event.end|compactisodate}"><a href="{$myurl}?todate={$event.end}"
title="{tr}Change Focus{/tr}">{$event.end|tiki_short_date}</a></abbr> {/if}<br />
+{if $event.start ne $event.end and $event.allday ne 1}{$event.end|tiki_short_time}{/if}
 </td>
 <td style="{if $infocals.$calendarId.custombgcolor ne ''}background-color:#{$infocals.$calendarId.custombgcolor};{/if}">
-<a class="link" href="tiki-calendar_edit_item.php?viewcalitemId={$listevents[w].calitemId}" title="{tr}View{/tr}">
+<a class="link" href="tiki-calendar_edit_item.php?viewcalitemId={$event.calitemId}" title="{tr}View{/tr}">
 {if $infocals.$calendarId.customfgcolor ne ''}<span style="color:#{$infocals.$calendarId.customfgcolor};">{/if}
-<span class="summary">{$listevents[w].name|escape}</span></a><br />
-<span class="description" style="font-style:italic">{$listevents[w].parsed}</span>
-{if $listevents[w].web}
-<br /><a href="{$listevents[w].web}" target="_other" class="calweb"
title="{$listevents[w].web}"><img src="img/icons/external_link.gif" width="7" height="7"
alt="&gt;" /></a>
+<span class="summary">{$event.name|escape}</span></a><br />
+<span class="description" style="font-style:italic">{$event.parsed}</span>
+{if $event.web}
+<br /><a href="{$event.web}" target="_other" class="calweb" title="{$event.web}"><img
src="img/icons/external_link.gif" width="7" height="7" alt="&gt;" /></a>
 {if $infocals.$calendarId.customfgcolor ne ''}</span>{/if}
 {/if}
 </td>
 <td>
-{if $listevents[w].modifiable eq "y"}<a class="link"
href="tiki-calendar_edit_item.php?calitemId={$listevents[w].calitemId}"
title="{tr}Edit{/tr}">{icon _id='page_edit'}</a>
-<a class="link"
href="tiki-calendar_edit_item.php?calitemId={$listevents[w].calitemId}&amp;delete=1"
title="{tr}Remove{/tr}">{icon _id='cross' alt='{tr}Remove{/tr}'}</a>{/if}
+{if $event.modifiable eq "y"}<a class="link"
href="tiki-calendar_edit_item.php?calitemId={$event.calitemId}"
title="{tr}Edit{/tr}">{icon _id='page_edit'}</a>
+<a class="link"
href="tiki-calendar_edit_item.php?calitemId={$event.calitemId}&amp;delete=1"
title="{tr}Remove{/tr}">{icon _id='cross' alt='{tr}Remove{/tr}'}</a>{/if}
 </td></tr>
-{/section}
+{/foreach}
 </table>

This was sent by the SourceForge.net collaborative development platform, the world's largest Open
Source development site.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

Gmane