From: David F. <da...@d2...> - 2005-05-03 18:25:05
Attachments:
url_cleanup.patch
|
while poking into the event stuff, I found there's a decent amount of redundancy, specifically in the $url passing to openevent() - it's in the $arr variable, and it's also then seperated out into it's own argument (but the function ignores that, and uses the value from $arr if it's there) - I went through all the calls to openevent, and cleaned it up. Patch attached, decently tested - I didn't actually verify it's being correctly passed for every value, but it's a pretty simple patch. Against latest cvs, etc. etc. dave |
From: David F. <da...@d2...> - 2005-05-03 23:30:07
Attachments:
parser_cleanups.patch
|
So, this is worth applying, but only if you don't apply my forthcoming patch - I'll shortly (maybe later today) have a reworked openevent/event.php setup that uses date+time+uid to lookup the event, instead of passing the data to the page. This leads to a few questions: 1. is this acceptable? I'm kinda running wild here since no one's saying anything, but obviously I'd like to run wild in the right direction. 2. if the patch goes in, it's significantly less data to pass through - which means we could remove the "changing the hidden form" hackery? If so, let me know, I'll put together a patch. 3. I noticed a two issues with the generation of master_array - first, the recur data wasn't being replicated to each instance of the event, only the first event - so (without iterating through the whole array) there was no good way to get it. So, I fixed that. This raises the size of master_array by a decent amount, so it's questionable, but necessary for me to implement recur details in the event popup. Second, all-day recurring events after the first one weren't getting set with valid uids - they were being added to the allday time w/ the "next" array key, instead of using the uid. This is less questionable, and a one-line fix - both fixes are in the patch, but if you want to cherry pick and would prefer this fix alone, let me know. So everyone knows, my immediate goals are: * adding recur info to the event.php popup, so it's more useful, and so I learn enough to do: * add basic event adding/editing. This obviously assumes that the phpicalendar "owns" the calendar, and thus will ignore locking/sync'ing beyond making sure it doesn't overwrite itself. This will be entirely optional (I'm happy to make it some sort of config option people have to turn on in general or per-calendar). * And then probably add a basic level of user support, so users can have their own calendars vs. shared calendars, etc. Simplistic calendar server. As always, I'd much prefer to do this the "right" way, in that maintaining a patch set against CVS sucks long term - so if there are way you'd prefer this done, please let me know and spare me the time reworking things later. phpicalendar has a *@(#ing awesome interface, by far the best I've seen so far, and the last piece I need to solve a few problems for me is the editing. (cc'd jim so you get the patch) dave David Fallon wrote: > while poking into the event stuff, I found there's a decent amount of > redundancy, specifically in the $url passing to openevent() - it's in > the $arr variable, and it's also then seperated out into it's own > argument (but the function ignores that, and uses the value from $arr if > it's there) - I went through all the calls to openevent, and cleaned it > up. Patch attached, decently tested - I didn't actually verify it's > being correctly passed for every value, but it's a pretty simple patch. > Against latest cvs, etc. etc. > > dave > > > ------------------------------------------------------------------------ > > Index: functions/date_functions.php > =================================================================== > RCS file: /cvsroot/phpicalendar/phpicalendar/functions/date_functions.php,v > retrieving revision 1.26 > diff -u -r1.26 date_functions.php > --- functions/date_functions.php 26 Oct 2004 19:12:29 -0000 1.26 > +++ functions/date_functions.php 3 May 2005 18:19:12 -0000 > @@ -162,7 +162,7 @@ > return $offset; > } > > -function openevent($calendar_name, $start, $end, $arr, $lines, $wrap, $pre_text, $post_text, $link_class, $url) { > +function openevent($calendar_name, $start, $end, $arr, $lines, $wrap, $pre_text, $post_text, $link_class) { > $event_text = stripslashes(urldecode($arr["event_text"])); > if (empty($start)) { > $title = $event_text; > Index: functions/template.php > =================================================================== > RCS file: /cvsroot/phpicalendar/phpicalendar/functions/template.php,v > retrieving revision 1.65 > diff -u -r1.65 template.php > --- functions/template.php 16 Apr 2005 20:39:00 -0000 1.65 > +++ functions/template.php 3 May 2005 18:19:12 -0000 > @@ -254,9 +254,8 @@ > foreach ($master_array[$get_date]['-1'] as $allday) { > $event_calno = $allday['calnumber']; > $event_calna = $allday['calname']; > - $event_url = $allday['url']; > if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors); > - $event = openevent($event_calna, '', '', $allday, 1, 11, '', '', 'psf', $event_url); > + $event = openevent($event_calna, '', '', $allday, 1, 11, '', '', 'psf'); > $loop_tmp = str_replace('{ALLDAY}', $event, $loop_ad); > $loop_tmp = str_replace('{CALNO}', $event_calno, $loop_tmp); > $replace .= $loop_tmp; > @@ -410,7 +409,6 @@ > $event_start = date ($timeFormat_small, $event_start); > $event_calno = $this_time_arr[($event_length[$thisday][$i]['key'])]['calnumber']; > $event_calna = $this_time_arr[($event_length[$thisday][$i]['key'])]['calname']; > - $event_url = $this_time_arr[($event_length[$thisday][$i]['key'])]['url']; > $event_status = strtolower($this_time_arr[($event_length[$thisday][$i]['key'])]['status']); > if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors); > if ($event_status != '') { > @@ -425,7 +423,7 @@ > > // Start drawing the event > $event_temp = $loop_event; > - $event = openevent($event_calna, $event_start, $event_end, $this_time_arr[($event_length[$thisday][$i]["key"])], $week_events_lines, 25, '', '', 'ps', $event_url); > + $event = openevent($event_calna, $event_start, $event_end, $this_time_arr[($event_length[$thisday][$i]["key"])], $week_events_lines, 25, '', '', 'ps'); > $event_temp = str_replace('{EVENT}', $event, $event_temp); > $event_temp = str_replace('{EVENT_START}', $event_start, $event_temp); > $event_temp = str_replace('{CONFIRMED}', $confirmed, $event_temp); > @@ -476,9 +474,8 @@ > foreach ($master_array[$getdate]['-1'] as $allday) { > $event_calno = $allday['calnumber']; > $event_calna = $allday['calname']; > - $event_url = $allday['url']; > if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors); > - $event = openevent($event_calna, '', '', $allday, 0, '', '', '', '', $event_url); > + $event = openevent($event_calna, '', '', $allday, 0, '', '', '', ''); > $loop_tmp = str_replace('{ALLDAY}', $event, $loop_ad); > $loop_tmp = str_replace('{CALNO}', $event_calno, $loop_tmp); > $replace .= $loop_tmp; > @@ -636,8 +633,7 @@ > // Start drawing the event > $event_temp = $loop_event; > $event_calna = $this_time_arr[($event_length[$i]['key'])]['calname']; > - $event_url = $this_time_arr[($event_length[$i]['key'])]['url']; > - $event = openevent($event_calna, $event_start, $event_end, $this_time_arr[($event_length[$i]['key'])], '', 0, '', '', 'ps', $event_url); > + $event = openevent($event_calna, $event_start, $event_end, $this_time_arr[($event_length[$i]['key'])], '', 0, '', '', 'ps'); > $event_temp = str_replace('{EVENT}', $event, $event_temp); > $event_temp = str_replace('{EVENT_START}', $event_start, $event_temp); > $event_temp = str_replace('{EVENT_END}', $event_end, $event_temp); > @@ -693,16 +689,15 @@ > $event_text = strip_tags($event_text, '<b><i><u>'); > if ($event_text != "") { > $event_calna = $val["calname"]; > - $event_url = $val["url"]; > $event_start = date ($timeFormat, $val["start_unixtime"]); > $event_end = date ($timeFormat, $val["end_unixtime"]); > if (!isset($val["event_start"])) { > $event_start = $lang['l_all_day']; > $event_end = ''; > - $return_adtmp = openevent($event_calna, $event_start, $event_end, $val, $tomorrows_events_lines, 21, '', '', 'psf', $event_url); > + $return_adtmp = openevent($event_calna, $event_start, $event_end, $val, $tomorrows_events_lines, 21, '', '', 'psf'); > $replace_ad .= str_replace('{T_ALLDAY}', $return_adtmp, $loop_t_ad); > } else { > - $return_etmp = openevent($event_calna, $event_start, $event_end, $val, $tomorrows_events_lines, 21, '', '', 'ps3', $event_url); > + $return_etmp = openevent($event_calna, $event_start, $event_end, $val, $tomorrows_events_lines, 21, '', '', 'ps3'); > $replace_e .= str_replace('{T_EVENT}', $return_etmp, $loop_t_e); > } > } > @@ -869,11 +864,10 @@ > $event_calno = $val['calnumber']; > if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors); > $event_calna = $val['calname']; > - $event_url = $val['url']; > if (!isset($val['event_start'])) { > if ($type == 'large') { > $switch['ALLDAY'] .= '<div class="V10"><img src="templates/'.$template.'/images/monthdot_'.$event_calno.'.gif" alt="" width="9" height="9" border="0" />'; > - $switch['ALLDAY'] .= openevent($event_calna, '', '', $val, $month_event_lines, 15, '', '', 'psf', $event_url); > + $switch['ALLDAY'] .= openevent($event_calna, '', '', $val, $month_event_lines, 15, '', '', 'psf'); > $switch['ALLDAY'] .= '</div>'; > } else { > $switch['ALLDAY'] .= '<img src="templates/'.$template.'/images/allday_dot.gif" alt=" " width="11" height="10" border="0" />'; > @@ -886,7 +880,7 @@ > $event_end = date($timeFormat, @strtotime ($event_end)); > if ($type == 'large') { > $switch['EVENT'] .= '<div class="V9"><img src="templates/'.$template.'/images/monthdot_'.$event_calno.'.gif" alt="" width="9" height="9" border="0" />'; > - $switch['EVENT'] .= openevent($event_calna, $event_start, $event_end, $val, $month_event_lines, 10, "$start2 ", '', 'ps3', $event_url).'<br />'; > + $switch['EVENT'] .= openevent($event_calna, $event_start, $event_end, $val, $month_event_lines, 10, "$start2 ", '', 'ps3').'<br />'; > $switch['EVENT'] .= '</div>'; > } else { > $switch['EVENT'] = '<img src="templates/'.$template.'/images/event_dot.gif" alt=" " width="11" height="10" border="0" />'; > @@ -947,18 +941,17 @@ > $switch['START_DATE'] = localizeDate ($dateFormat_week_list, $u_start); > foreach ($event_times as $val) { > $switch['CALNAME'] = $val['calname']; > - $switch['URL'] = $val['url']; > if (!isset($val['event_start'])) { > $switch['START_TIME'] = $lang['l_all_day']; > $switch['DESCRIPTION'] = urldecode($val['description']); > - $switch['EVENT_TEXT'] = openevent($switch['CALNAME'], '', '', $val, $month_event_lines, 15, '', '', 'psf', $switch['URL']); > + $switch['EVENT_TEXT'] = openevent($switch['CALNAME'], '', '', $val, $month_event_lines, 15, '', '', 'psf'); > } else { > $event_start = $val['start_unixtime']; > $event_end = (isset($val['display_end'])) ? $val['display_end'] : $val["event_end"]; > $event_start = date($timeFormat, $val['start_unixtime']); > $event_end = date($timeFormat, @strtotime ($event_end)); > $switch['START_TIME'] = $event_start . ' - ' . $event_end; > - $switch['EVENT_TEXT'] = openevent($switch['CALNAME'], $event_start, $event_end, $val, 0, 15, '', '', 'psf', $switch['URL']); > + $switch['EVENT_TEXT'] = openevent($switch['CALNAME'], $event_start, $event_end, $val, 0, 15, '', '', 'psf'); > $switch['DESCRIPTION'] = urldecode($val['description']); > } > if ($switch['EVENT_TEXT'] != '') { |
From: Jamin W. C. <jco...@as...> - 2005-05-03 23:51:22
|
On Tue, May 03, 2005 at 04:29:54PM -0700, David Fallon wrote: > > and the last piece I need to solve a few problems for me is the > editing. Why not use an application such as Sunbird for the editing? Just curious. -- Jamin W. Collins "Never underestimate the power of very stupid people in large groups." -- John Kenneth Galbraith |
From: David F. <da...@d2...> - 2005-05-04 00:46:00
|
Because then I have to worry about sync'ing issues - the only way that works is if I say only a particular user gets to update a given calendar, and that sucks. If it's on the server, then as long as I have phpicalendar deal with the locking (which is relatively trivial if I assume all the editing will occur through it), I can let anyone edit any calendar (as appropriate per their permissions, etc.) Plus, the UI for phpicalendar rocks, and it's cross platform (I have to worry about windows, linux, and mac clients). dave Jamin W. Collins wrote: > On Tue, May 03, 2005 at 04:29:54PM -0700, David Fallon wrote: > >>and the last piece I need to solve a few problems for me is the >>editing. > > > Why not use an application such as Sunbird for the editing? Just > curious. > > |
From: Jamin W. C. <jco...@as...> - 2005-05-04 03:47:57
|
On Tue, May 03, 2005 at 05:45:51PM -0700, David Fallon wrote: > Because then I have to worry about sync'ing issues - the only way that > works is if I say only a particular user gets to update a given > calendar, and that sucks. Not so. I have several calendars that are stored on a WebDAV server (actually a Subversion autoversioning repository) and Sunbird will allow for multi-user authoring without a hitch. It grabs the current version of the calendar before each commit thereby keeping changes made by other users. > Plus, the UI for phpicalendar rocks, and it's cross platform (I have > to worry about windows, linux, and mac clients). Sunbird is cross-platform also. Just an idea. -- Jamin W. Collins Facts do not cease to exist because they are ignored. --Aldous Huxley, "Proper Studies", 1927 |
From: David F. <da...@d2...> - 2005-05-04 17:28:03
|
ah, really? How interesting, I didn't know sunbird would download the calendar before editing. How does it handle conflicts? I'll have to relook at it. Jamin W. Collins wrote: > On Tue, May 03, 2005 at 05:45:51PM -0700, David Fallon wrote: > >>Because then I have to worry about sync'ing issues - the only way that >>works is if I say only a particular user gets to update a given >>calendar, and that sucks. > > > Not so. I have several calendars that are stored on a WebDAV server > (actually a Subversion autoversioning repository) and Sunbird will allow > for multi-user authoring without a hitch. It grabs the current version > of the calendar before each commit thereby keeping changes made by other > users. > > >>Plus, the UI for phpicalendar rocks, and it's cross platform (I have >>to worry about windows, linux, and mac clients). > > > Sunbird is cross-platform also. > > Just an idea. > |
From: Ben F. <li...@hi...> - 2005-05-07 11:47:31
|
David Fallon wrote: > 3. I noticed a two issues with the generation of master_array - > first, the recur data wasn't being replicated to each instance of the > event, only the first event - so (without iterating through the whole > array) there was no good way to get it. So, I fixed that. This raises > the size of master_array by a decent amount, so it's questionable, but > necessary for me to implement recur details in the event popup. Ah, that could be really good! I've not been developing phpicalendar but I have been using the object the parser generates in conjunction with a modified version of Jim Hu's script which turns it into RSS. I then in turn use the customised RSS feed in conjunction with MagpieRSS to generate a page of events (http://www.catmosearts.co.uk/calendar/events.php). One problem I came across was that for recurring events, if the RSS feed started in the middle of a recurring event, the data regarding the recurrence was lost as it only appears in the original occurrence. The only way I got round it was a dirty hack which grabs the data from 6 months in the past to make sure the recurrence data is grabbed. This has an obvious flaw but works for my specific needs. The one thing that I changed in phpicalendar ical parser was to supress the formatting of the until date (localizeDate($dateFormat_week,$until) I think) because the until date was in a useless format (for my needs) and it was more useful for me as a unixtime. This of course meant a separate parser for phpicalendar and the rss generator. Thanks for your work! -- Ben "tola" Francis http://hippygeek.co.uk ---------------------------------------------------- COMPUTER SUPPORT for small businesses and home users http://tolatech.co.uk ---------------------------------------------------- |
From: <da...@d2...> - 2005-05-07 16:57:42
|
> David Fallon wrote: > >> 3. I noticed a two issues with the generation of master_array - >> first, the recur data wasn't being replicated to each instance of the >> event, only the first event - so (without iterating through the whole >> array) there was no good way to get it. So, I fixed that. This raises >> the size of master_array by a decent amount, so it's questionable, but >> necessary for me to implement recur details in the event popup. > > Ah, that could be really good! I've not been developing phpicalendar but > I have been using the object the parser generates in conjunction with a > modified version of Jim Hu's script which turns it into RSS. I then in > turn use the customised RSS feed in conjunction with MagpieRSS to > generate a page of events > (http://www.catmosearts.co.uk/calendar/events.php). > > One problem I came across was that for recurring events, if the RSS feed > started in the middle of a recurring event, the data regarding the > recurrence was lost as it only appears in the original occurrence. The > only way I got round it was a dirty hack which grabs the data from 6 > months in the past to make sure the recurrence data is grabbed. This > has an obvious flaw but works for my specific needs. > > The one thing that I changed in phpicalendar ical parser was to supress > the formatting of the until date (localizeDate($dateFormat_week,$until) > I think) because the until date was in a useless format (for my needs) > and it was more useful for me as a unixtime. This of course meant a > separate parser for phpicalendar and the rss generator. > > Thanks for your work! Well, it's not in CVS yet, but hopefully this will be more motivation for someone to sign off on it. :) If it doesn't make it into 2.0, let me know and I can give you a patch that does it (it's a fairly small change). dave |