[kronolith] Monthly Side by side view

j.huinink at wanadoo.nl j.huinink at wanadoo.nl
Wed Dec 11 20:44:38 PST 2002


This is the new "side by side" view where the calendar is wrapped for every 
week.

I am not enthousiastic about this implementation. It seems like a "stacked" 
week view instead of a month view. If I would like to see this, I'ld rather go 
to a side by side week view and step through the weeks using the "next" 
and "prev" button instead of scrolling through this month view.

I submit this for your comments and criticism, but if it were up to me, I would 
stick to the first implementation and fine tune it as already discussed on this 
list.

The diffs included are for kronolith\month.php and 
kronolith\templates\month\head_side_by_side.inc.

Regards,
Jeroen


__________________________________________________________


Snel en makkelijk e-mailen met Wanadoo Webmail!


http://www.wanadoo.nl/webmail-------------- next part --------------
Index: month.php
==================================================================RCS file: /repository/kronolith/month.php,v
retrieving revision 1.109
diff -r1.109 month.php
69,75d68
< // Days before the month starts.
< for ($i = 0; $i < $startday; $i++) {
<     if (!$sidebyside) {
<         echo '<td></td>';
<     }
< }
< 
83,84c76,77
<     foreach ($GLOBALS['display_calendars'] as $id) {
<         $currentCalendars[$id] = &$allCalendars[$id];
---
>     foreach ($GLOBALS['display_calendars'] as $cid) {
>         $currentCalendars[$cid] = &$allCalendars[$cid];
86d78
<     $sharedCalendars = $GLOBALS['display_calendars'];
88c80
<    $currentCalendars = array(true); 
---
>    $currentCalendars = array(0); 
90,93c82,86
< foreach ($currentCalendars as $id => $cal) {
<     if ($sidebyside) {
<         echo '<tr><th>' . $cal->getShareName() . '</th>';
<     } 
---
> 
> $row = array();
> foreach ($currentCalendars as $cid => $cal) {
>     $row[$cid] = array();
>     $displayweek = 0;
95a89,100
>         if ($day == 1) {
>             if($sidebyside) {
>                 $row[$cid][$displayweek] = '<th>' . $cal->getShareName() . '</th>';
>             } else {
>                 $row[$cid][$displayweek] = '';
>             }
>             // Days before the month starts.
>             for ($i = 0; $i < $startday; $i++) {
>                 $row[$cid][$displayweek] .= '<td width="14%">&nbsp;</td>';
>             }
>         }
> 
99a105,107
>             $row[$cid][$displayweek] .= '</tr>';
>             $displayweek++;
>             $row[$displayweek] = array();
101c109
<                 echo '<th>' . $cal->getShareName() . '</th>';
---
>                 $row[$cid][$displayweek] = '<tr><th>' . $cal->getShareName() . '</th>';
103c111
<                 echo '</tr><tr>';
---
>                 $row[$cid][$displayweek] = '<tr>';
114,115c122,123
<         echo '<td class="' . $style . '" height="100" width="14%" valign="top">';
<         echo '<table cellspacing="0" cellpadding="1" width="100%"><tr><td>';
---
>         $row[$cid][$displayweek] .= '<td class="' . $style . '" height="100" width="14%" valign="top">';
>         $row[$cid][$displayweek] .= '<table cellspacing="0" cellpadding="1" width="100%"><tr><td>';
119c127
<         echo '<b><a class="day" href="' . $url . "\">&nbsp;$day&nbsp;</a></b>";
---
>         $row[$cid][$displayweek] .= '<b><a class="day" href="' . $url . "\">&nbsp;$day&nbsp;</a></b>";
128c136
<             echo ' (' . Horde::link(Horde::applicationUrl($url), sprintf(_("Week %d"), $week)) . sprintf(_("Week&nbsp;%d"), $week) . '</a>)';
---
>             $row[$cid][$displayweek] .= ' (' . Horde::link(Horde::applicationUrl($url), sprintf(_("Week %d"), $week)) . sprintf(_("Week&nbsp;%d"), $week) . '</a>)';
130c138
<         echo '</td>';
---
>         $row[$cid][$displayweek] .= '</td>';
136c144
<             echo '<td width="14%">' . Horde::link($url, _("Create a New Event")) . Horde::img('new.gif', _("Create a New Event"), 'align="right"') . '</a></td>';
---
>             $row[$cid][$displayweek] .= '<td width="14%">' . Horde::link($url, _("Create a New Event")) . Horde::img('new.gif', _("Create a New Event"), 'align="right"') . '</a></td>';
139c147
<         echo '</tr></table>';
---
>         $row[$cid][$displayweek] .= '</tr></table>';
145c153
<                 if (!$prefs->getValue('show_shared_side_by_side') || $event->getCalendar() == $id) {
---
>                 if (!$prefs->getValue('show_shared_side_by_side') || $event->getCalendar() == $cid) {
159c167
<             echo $cell;
---
>             $row[$cid][$displayweek] .= $cell;
162c170
<         echo '</td>';
---
>         $row[$cid][$displayweek] .= '</td>';
164a173,185
>     //days at end of month
>     for ($i = ($dayofweek % 7); $i < 7; $i++) {
>         $row[$cid][$displayweek] .= '<td width="14%">&nbsp;</td>';
>     }
>     $row[$cid][$displayweek] .= '</tr><tr>';
> }
> for($j = 0; $j <= $displayweek; $j++) {
>     foreach ($currentCalendars as $cid => $cal) {
>         echo $row[$cid][$j];
>     }
>     if ($sidebyside && $j!=$displayweek) {
>         require KRONOLITH_TEMPLATES . '/month/head_side_by_side.inc';
>     } 
-------------- next part --------------
Index: head_side_by_side.inc
===================================================================
RCS file: /repository/kronolith/templates/month/head_side_by_side.inc,v
retrieving revision 1.1
diff -r1.1 head_side_by_side.inc
2c2
<     $prevurl = Horde::addParameter('month_shares.php', 'month=' . date('n', $prevstamp));
---
>     $prevurl = Horde::addParameter('month.php', 'month=' . date('n', $prevstamp));
6c6
<     $nexturl = Horde::addParameter('month_shares.php', 'month=' . date('n', $nextstamp));
---
>     $nexturl = Horde::addParameter('month.php', 'month=' . date('n', $nextstamp));
9,11d8
< 
<     $daysInMonth = Kronolith::daysInMonth($month, $year);
<     $startday = Kronolith::dayOfWeek($year, $month, 1);
25,30c22,24
< <?php
< $dayofweek = ($startday) % 7;
< for ($day = 1; $day <= $daysInMonth; $day++) {
<    switch($dayofweek % 7) {
<    case 0:
< ?>
---
> <?php if (!$prefs->getValue('week_start_monday')): ?>
> <th class="item"><?php echo _("Sunday") ?></th>
> <?php endif; ?>
32,33d25
< <?php break;
< case 1: ?>
35,36d26
< <?php break;
< case 2: ?>
38,39d27
< <?php break;
< case 3: ?>
41,42d28
< <?php break;
< case 4: ?>
44,45d29
< <?php break;
< case 5: ?>
47,48c31
< <?php break;
< case 6: ?>
---
> <?php if ($prefs->getValue('week_start_monday')): ?>
50,59c33
< <?php 
<     } 
<     if ($prefs->getValue('week_start_monday') == (($dayofweek + 2) % 7)) { ?>
<     <td></td>
< <?php
<     }
< 
<     $dayofweek++;
< }
< ?>
---
> <?php endif; ?>
60a35
> 
61a37
> 


More information about the kronolith mailing list