Patch

Jan Schneider janmailing@gmx.de
Fri, 8 Jun 2001 14:18:15 +0200


---------------------- multipart/mixed attachment
Hi,

attached find a patch that implements the following:
- checkbox to set duration to the whole day
- allow duration to be set up to 23 hours, 60 minutes
- implement occurence: monthly on the same weekday 
(mcal_event_set_recur_monthly_wday)
- enable deleting of events in month view

Jan.

::::::::::::::::::::::::::::::::::::::::
AMMMa AG - discover your knowledge
:::::::::::::::::::::::::::
Detmolder Str. 25-33 :: D-33604 Bielefeld
fon +49.521.96878-0 :: fax  +49.521.96878-20
http://www.ammma.de
::::::::::::::::::::::::::::::::::::::::::::::
---------------------- multipart/mixed attachment
Index: month.php
===================================================================
RCS file: /cvs/horde/kronolith/month.php,v
retrieving revision 1.44
diff -u -r1.44 month.php
--- month.php	2001/05/23 16:49:23	1.44
+++ month.php	2001/06/08 12:04:40
@@ -102,7 +102,8 @@
         foreach ($date_array[$i] as $e) {
             echo '<a class="event" href="' . Horde::url('editevent.php?eventID=' . $e['id'] . "&month=$month&year=$year&day=$i") . '">';
             Horde::pimg('bullet.gif', 'align="bottom" alt="*"');
-            echo $e['title'] . '</a><br />';
+            echo $e['title'] . '</a>';
+            echo '<a href="' . Horde::applicationUrl('delevent.php?eventID=' . $e['id'] . "&month=$month&year=$year&day=$i") . '"><img src="graphics/delete.gif" alt="delete" border=0 hspace=2 vspace=0></a><br />' . "\n";
         }
     }
     echo '</td>' . "\n";
Index: lib/Driver/mcal.php
===================================================================
RCS file: /cvs/horde/kronolith/lib/Driver/mcal.php,v
retrieving revision 1.10
diff -u -r1.10 mcal.php
--- lib/Driver/mcal.php	2001/05/31 03:59:04	1.10
+++ lib/Driver/mcal.php	2001/06/08 12:12:00
@@ -183,6 +183,13 @@
                     $eventData['start_hour'] = 0;
                 }
             }
+            if (isset($eventData['whole_day'])
+                && ($eventData['whole_day'] == 1)) {
+                $eventData['start_hour'] = 0;
+                $eventData['start_min'] = 0;
+                $eventData['end_hour'] = 24;
+                $eventData['end_min'] = 0;
+            }
             mcal_event_set_start($this->driver->stream,
                                  $eventData['start_year'],
                                  $eventData['start_month'],
@@ -260,6 +267,19 @@
                                                       $eventData['recur_enddate_month'],
                                                       $eventData['recur_enddate_day'],
                                                       $eventData['recur_day_of_month_interval']);
+                }
+                break;
+
+            case KRONOLITH_RECUR_WEEK_OF_MONTH:
+                if (isset($eventData['recur_enddate_year'])
+                    && isset($eventData['recur_enddate_month'])
+                    && isset($eventData['recur_enddate_day'])) {
+                    if (empty($eventData['recur_week_of_month_interval'])) $eventData['recur_week_of_month_interval'] = 1;
+                    mcal_event_set_recur_monthly_wday($this->driver->stream,
+                                                      $eventData['recur_enddate_year'],
+                                                      $eventData['recur_enddate_month'],
+                                                      $eventData['recur_enddate_day'],
+                                                      $eventData['recur_week_of_month_interval']);
                 }
                 break;

Index: templates/edit/edit.inc
===================================================================
RCS file: /cvs/horde/kronolith/templates/edit/edit.inc,v
retrieving revision 1.20
diff -u -r1.20 edit.inc
--- templates/edit/edit.inc	2001/05/31 14:28:56	1.20
+++ templates/edit/edit.inc	2001/06/08 12:12:00
@@ -12,7 +12,8 @@
     if (field == 'recur_daily_interval') clearFields(1);
     else if (field == 'recur_weekly_interval') clearFields(2);
     else if (field == 'recur_day_of_month_interval') clearFields(3);
-    else if (field == 'recur_yearly_interval') clearFields(4);
+    else if (field == 'recur_week_of_month_interval') clearFields(4);
+    else if (field == 'recur_yearly_interval') clearFields(5);
 }

 function setRecur(index)
@@ -37,8 +38,17 @@
         }
     }
     if (index != 3) document.event.recur_day_of_month_interval.value = '';
-    if (index != 4) document.event.recur_yearly_interval.value = '';
+    if (index != 4) document.event.recur_week_of_month_interval.value = '';
+    if (index != 5) document.event.recur_yearly_interval.value = '';
 }
+
+function setWholeDay()
+{
+    document.event.start_hour.selectedIndex = 0;
+    document.event.start_min.selectedIndex = 0;
+    document.event.end_hour.selectedIndex = 23;
+    document.event.end_min.selectedIndex = 12;
+}
 // -->
 </script>

@@ -192,7 +202,6 @@
 <tr>
 <td align="right" class="light"><b>Duration&nbsp;&nbsp;</b></td>
 <td class="item<?=($_i++ % 2)?>" align="left" valign="top">
-<select name="end_hour">
 <?php
 if ($event->isInitialized()) {
     $end_hour_match = $event->getEndDate('G') - $event->getStartDate('G');
@@ -201,10 +210,21 @@
         $end_min_match += 60;
         $end_hour_match--;
     }
+    if ($end_hour_match == 0 && $end_min_match == 0
+        && ($event->getEndDate('d') - $event->getStartDate('d')) == 1) {
+        $end_hour_match = 23;
+        $end_min_match = 60;
+        $whole_day_match = true;
+    }
 } else {
     $end_hour_match = 1;
     $end_min_match = 0;
 }
+?>
+<input name="whole_day" type="checkbox" value="1" onclick="setWholeDay()"<?php if (isset($whole_day_match) && $whole_day_match) echo ' checked' ?>>
+<?= _("The whole day")?><br>
+<select name="end_hour">
+<?php
 for ($i=0; $i<24; $i++) {
     $sel = '';
     if ($i == $end_hour_match)
@@ -216,7 +236,7 @@
 <?= _("Hour(s)")?>&nbsp;
 <select name="end_min">
 <?php
-for ($i=0; $i<12; $i++) {
+for ($i=0; $i<13; $i++) {
     $sel = '';
     $min = sprintf("%02d", $i * 5);
     if ($min == $end_min_match)
@@ -224,7 +244,7 @@
     echo '<option value="' . $min . '"' . $sel . '>' . $min;
 }
 ?>
-</select>Minutes
+</select><?= _("Minutes") ?>
 </td>
 </tr>

@@ -247,9 +267,9 @@
 <td class="item<?=($_i++ % 2)?>" align="left" valign="top">
 <?php $_j = $_i ?>
 <table cellpadding="0" cellspacing="0" border="0" width="95%">
-<tr><td class="item<?=($_j++ % 2)?>"><input type="radio" name="recur" onclick="clearFields(0);" value="<?= KRONOLITH_RECUR_NONE ?>"<?php if ($event->hasRecurType(KRONOLITH_RECUR_NONE)) echo ' checked="checked"' ?>><?= _("None") ?></td></tr>
-<tr><td class="item<?=($_j++ % 2)?>"><input type="radio" name="recur" onclick="setInterval('recur_daily_interval');" value="<?= KRONOLITH_RECUR_DAILY ?>"<?php if ($event->hasRecurType(KRONOLITH_RECUR_DAILY)) echo ' checked="checked"' ?>><?= _("Daily: Recurs every") ?>&nbsp;<input type="text" name="recur_daily_interval" size="2" onkeypress="setRecur(1);" onchange="setRecur(1);" value="<?= $event->hasRecurType(KRONOLITH_RECUR_DAILY) ? $event->getRecurInterval() : '' ?>" />&nbsp;<?= _("day(s)") ?></td></tr>
-<tr><td class="item<?=($_j++ % 2)?>">
+<tr><td nowrap class="item<?=($_j++ % 2)?>"><input type="radio" name="recur" onclick="clearFields(0);" value="<?= KRONOLITH_RECUR_NONE ?>"<?php if ($event->hasRecurType(KRONOLITH_RECUR_NONE)) echo ' checked="checked"' ?>><?= _("None") ?></td></tr>
+<tr><td nowrap class="item<?=($_j++ % 2)?>"><input type="radio" name="recur" onclick="setInterval('recur_daily_interval');" value="<?= KRONOLITH_RECUR_DAILY ?>"<?php if ($event->hasRecurType(KRONOLITH_RECUR_DAILY)) echo ' checked="checked"' ?>><?= _("Daily: Recurs every") ?>&nbsp;<input type="text" name="recur_daily_interval" size="2" onkeypress="setRecur(1);" onchange="setRecur(1);" value="<?= $event->hasRecurType(KRONOLITH_RECUR_DAILY) ? $event->getRecurInterval() : '' ?>" />&nbsp;<?= _("day(s)") ?></td></tr>
+<tr><td nowrap class="item<?=($_j++ % 2)?>">
 <input type="radio" name="recur" onclick="setInterval('recur_weekly_interval');" value="<?= KRONOLITH_RECUR_WEEKLY ?>"<?php if ($event->hasRecurType(KRONOLITH_RECUR_WEEKLY)) echo ' checked="checked"' ?>><?= _("Weekly: Recurs every") ?>&nbsp;<input type="text" name="recur_weekly_interval" size="2" onkeypress="setRecur(2);" onchange="setRecur(2);" value="<?= $event->hasRecurType(KRONOLITH_RECUR_WEEKLY) ? $event->getRecurInterval() : '' ?>" />&nbsp;<?= _("week(s) on:") ?><br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 Mo<input type="checkbox" name="weekly[]" onclick="setRecur(2);" value="<?= KRONOLITH_MASK_MONDAY ?>"<?php if ($event->recurOnDay(KRONOLITH_MASK_MONDAY)) echo ' checked="checked"' ?> />&nbsp;
@@ -260,8 +280,9 @@
 Sa<input type="checkbox" name="weekly[]" onclick="setRecur(2);" value="<?= KRONOLITH_MASK_SATURDAY ?>"<?php if ($event->recurOnDay(KRONOLITH_MASK_SATURDAY)) echo ' checked="checked"' ?> />&nbsp;
 Su<input type="checkbox" name="weekly[]" onclick="setRecur(2);" value="<?= KRONOLITH_MASK_SUNDAY ?>"<?php if ($event->recurOnDay(KRONOLITH_MASK_SUNDAY)) echo ' checked="checked"' ?> />&nbsp;
 </td></tr>
-<tr><td class="item<?=($_j++ % 2)?>"><input type="radio" name="recur" onclick="setInterval('recur_day_of_month_interval');" value="<?= KRONOLITH_RECUR_DAY_OF_MONTH ?>"<?php if ($event->hasRecurType(KRONOLITH_RECUR_DAY_OF_MONTH)) echo ' checked="checked"' ?>><?= _("Monthly: Recurs every") ?>&nbsp;<input type="text" name="recur_day_of_month_interval" size="2" onkeypress="setRecur(3);" onchange="setRecur(3);" value="<?= $event->hasRecurType(KRONOLITH_RECUR_DAY_OF_MONTH) ? $event->getRecurInterval() : '' ?>" />&nbsp;<?= _("month(s)") ?></td></tr>
-<tr><td class="item<?=($_j++ % 2)?>"><input type="radio" name="recur" onclick="setInterval('recur_yearly_interval');" value="<?= KRONOLITH_RECUR_YEARLY ?>"<?php if ($event->hasRecurType(KRONOLITH_RECUR_YEARLY)) echo ' checked="checked"' ?>><?= _("Yearly: Recurs every") ?>&nbsp;<input type="text" name="recur_yearly_interval" size="2" onkeypress="setRecur(4);" onchange="setRecur(4);" value="<?= $event->hasRecurType(KRONOLITH_RECUR_YEARLY) ? $event->getRecurInterval() : '' ?>" />&nbsp;<?= _("year(s)") ?></td></tr>
+<tr><td nowrap class="item<?=($_j++ % 2)?>"><input type="radio" name="recur" onclick="setInterval('recur_day_of_month_interval');" value="<?= KRONOLITH_RECUR_DAY_OF_MONTH ?>"<?php if ($event->hasRecurType(KRONOLITH_RECUR_DAY_OF_MONTH)) echo ' checked="checked"' ?>><?= _("Monthly: Recurs every") ?>&nbsp;<input type="text" name="recur_day_of_month_interval" size="2" onkeypress="setRecur(3);" onchange="setRecur(3);" value="<?= $event->hasRecurType(KRONOLITH_RECUR_DAY_OF_MONTH) ? $event->getRecurInterval() : '' ?>" />&nbsp;<?= _("month(s)") ?> <?= _("on the same date") ?></td></tr>
+<tr><td nowrap class="item<?=($_j++ % 2)?>"><input type="radio" name="recur" onclick="setInterval('recur_week_of_month_interval');" value="<?= KRONOLITH_RECUR_WEEK_OF_MONTH ?>"<?php if ($event->hasRecurType(KRONOLITH_RECUR_WEEK_OF_MONTH)) echo ' checked="checked"' ?>><?= _("Monthly: Recurs every") ?>&nbsp;<input type="text" name="recur_week_of_month_interval" size="2" onkeypress="setRecur(4);" onchange="setRecur(4);" value="<?= $event->hasRecurType(KRONOLITH_RECUR_WEEK_OF_MONTH) ? $event->getRecurInterval() : '' ?>" />&nbsp;<?= _("month(s)") ?> <?= _("on the same weekday") ?></td></tr>
+<tr><td nowrap class="item<?=($_j++ % 2)?>"><input type="radio" name="recur" onclick="setInterval('recur_yearly_interval');" value="<?= KRONOLITH_RECUR_YEARLY ?>"<?php if ($event->hasRecurType(KRONOLITH_RECUR_YEARLY)) echo ' checked="checked"' ?>><?= _("Yearly: Recurs every") ?>&nbsp;<input type="text" name="recur_yearly_interval" size="2" onkeypress="setRecur(5);" onchange="setRecur(5);" value="<?= $event->hasRecurType(KRONOLITH_RECUR_YEARLY) ? $event->getRecurInterval() : '' ?>" />&nbsp;<?= _("year(s)") ?></td></tr>
 </table>
 <
---------------------- multipart/mixed attachment--