From: <par...@us...> - 2009-02-10 19:59:57
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23263/functions Modified Files: Tag: phpicalendar-editor date_functions.php event.js Log Message: Initial UI changes for editing Index: date_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/date_functions.php,v retrieving revision 1.52 retrieving revision 1.52.2.1 diff -C2 -d -r1.52 -r1.52.2.1 *** date_functions.php 5 Feb 2009 15:38:24 -0000 1.52 --- date_functions.php 10 Feb 2009 19:59:45 -0000 1.52.2.1 *************** *** 37,41 **** } ! // function to compare to dates in Ymd and return the number of weeks // that differ between them. requires dateOfWeek() function weekCompare($now, $then) { --- 37,41 ---- } ! // function to compare to dates in Ymd and return the number of weeks // that differ between them. requires dateOfWeek() function weekCompare($now, $then) { *************** *** 49,53 **** } ! // function to compare to dates in Ymd and return the number of days // that differ between them. function dayCompare($now, $then) { --- 49,53 ---- } ! // function to compare to dates in Ymd and return the number of days // that differ between them. function dayCompare($now, $then) { *************** *** 58,66 **** $diff_hours = $diff_minutes/60; $diff_days = round($diff_hours/24); ! return $diff_days; } ! // function to compare to dates in Ymd and return the number of months // that differ between them. function monthCompare($now, $then) { --- 58,66 ---- $diff_hours = $diff_minutes/60; $diff_days = round($diff_hours/24); ! return $diff_days; } ! // function to compare to dates in Ymd and return the number of months // that differ between them. function monthCompare($now, $then) { *************** *** 98,102 **** $month = date("n", $timestamp)-1; $day = date("j", $timestamp); ! $dayofweek = date("w", $timestamp); $weeknumber = date("W", $timestamp); $replacements = array( --- 98,102 ---- $month = date("n", $timestamp)-1; $day = date("j", $timestamp); ! $dayofweek = date("w", $timestamp); $weeknumber = date("W", $timestamp); $replacements = array( *************** *** 110,116 **** '%d' => sprintf("%02d", $day) ); ! $date = str_replace(array_keys($replacements), array_values($replacements), $format); ! return $date; ! } // calcOffset takes an offset (ie, -0500) and returns it in the number of seconds --- 110,116 ---- '%d' => sprintf("%02d", $day) ); ! $date = str_replace(array_keys($replacements), array_values($replacements), $format); ! return $date; ! } // calcOffset takes an offset (ie, -0500) and returns it in the number of seconds *************** *** 156,160 **** return $offset; } ! /* Returns a string to make event text with a link to popup boxes $arr is a master array item $lines is the number of lines to restrict the event_text to, using word_wrap --- 156,160 ---- return $offset; } ! /* Returns a string to make event text with a link to popup boxes $arr is a master array item $lines is the number of lines to restrict the event_text to, using word_wrap *************** *** 162,170 **** $link_class is a css class $pre_text and $post_text are to add tags around the link text (e.g. <b> or<i>) ! $title is the tooltip for the link */ function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $link_class = '', $pre_text = '', $post_text = '') { ! global $cpath, $timeFormat, $dateFormat_week; $return = ''; $event_text = stripslashes(urldecode($arr["event_text"])); --- 162,170 ---- $link_class is a css class $pre_text and $post_text are to add tags around the link text (e.g. <b> or<i>) ! $title is the tooltip for the link */ function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $link_class = '', $pre_text = '', $post_text = '') { ! global $cpath, $timeFormat, $dateFormat_week, $phpiCal_config, $username, $password, $invalid_login, $lang; $return = ''; $event_text = stripslashes(urldecode($arr["event_text"])); *************** *** 217,220 **** --- 217,233 ---- } $return .= $pre_text.$event_text.$post_text.'</a>'."\n"; + + // Require a valid user login to edit calendar events + if (($phpiCal_config->allow_edit == 'yes') && ($invalid_login === false) && ($username != '') && ($password != '')) { + static $popup_edit_index = 0; + $return = '<script language="JavaScript" type="text/javascript"><!-- + var editData = new EditData("' . $arr['calname'] . '", "' . $uid . '"); + document.edit_data[' . $popup_edit_index . '] = editData; + // --></script>' . + '<a href="#" title="' . $lang['l_edit_event'] . '" onclick="openEditWindow(' . $popup_edit_index . '); return false;">' . + '<img alt="' . $lang['l_edit'] . '" src="' . BASE . 'templates/' . $phpiCal_config->template . '/images/pencil.gif" border="0" />' . + '</a> ' . $return; + $popup_edit_index++; + } } *************** *** 228,233 **** $property = The property being examined, e.g. DTSTART, DTEND. $field = The full field being examined, e.g. DTSTART;TZID=US/Pacific ! ! See:http://phpicalendar.org/documentation/index.php/Property_Value_Data_Types#4.3.5___Date-Time */ function extractDateTime($data, $property, $field) { --- 241,246 ---- $property = The property being examined, e.g. DTSTART, DTEND. $field = The full field being examined, e.g. DTSTART;TZID=US/Pacific ! ! See:http://phpicalendar.org/documentation/index.php/Property_Value_Data_Types#4.3.5___Date-Time */ function extractDateTime($data, $property, $field) { *************** *** 244,255 **** $tz_dt = 'GMT'; } ! // Extract date-only values. if ((preg_match('/^'.$property.';VALUE=DATE:/i', $field)) || (ereg ('^([0-9]{4})([0-9]{2})([0-9]{2})$', $data))) { // Pull out the date value. Minimum year is 1970. ereg ('([0-9]{4})([0-9]{2})([0-9]{2})', $data, $dt_check); ! if ($dt_check[1] < 1970) { $dt_check[1] = '1970'; ! } # convert to date-time $data = $dt_check[1].$dt_check[2].$dt_check[3]."T000000"; --- 257,268 ---- $tz_dt = 'GMT'; } ! // Extract date-only values. if ((preg_match('/^'.$property.';VALUE=DATE:/i', $field)) || (ereg ('^([0-9]{4})([0-9]{2})([0-9]{2})$', $data))) { // Pull out the date value. Minimum year is 1970. ereg ('([0-9]{4})([0-9]{2})([0-9]{2})', $data, $dt_check); ! if ($dt_check[1] < 1970) { $dt_check[1] = '1970'; ! } # convert to date-time $data = $dt_check[1].$dt_check[2].$dt_check[3]."T000000"; *************** *** 261,265 **** preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})T{0,1}([0-9]{0,2})([0-9]{0,2})/', $data, $regs); if (!isset ($regs[1])) return; ! if ($regs[1] < 1970) { $regs[1] = '1970'; } --- 274,278 ---- preg_match ('/([0-9]{4})([0-9]{2})([0-9]{2})T{0,1}([0-9]{0,2})([0-9]{0,2})/', $data, $regs); if (!isset ($regs[1])) return; ! if ($regs[1] < 1970) { $regs[1] = '1970'; } *************** *** 283,287 **** $date = date('Ymd', $unixtime); if ($allday == '') $time = date('Hi', $unixtime); ! // Return the results. return array($unixtime, $date, $time, $allday, $tz_dt); --- 296,300 ---- $date = date('Ymd', $unixtime); if ($allday == '') $time = date('Hi', $unixtime); ! // Return the results. return array($unixtime, $date, $time, $allday, $tz_dt); *************** *** 301,303 **** } return $data; ! }?> \ No newline at end of file --- 314,316 ---- } return $data; ! }?> Index: event.js =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/event.js,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -C2 -d -r1.17 -r1.17.2.1 *** event.js 19 May 2007 16:18:13 -0000 1.17 --- event.js 10 Feb 2009 19:59:45 -0000 1.17.2.1 *************** *** 10,14 **** form.elements.cpath.value = data.cpath; form.elements.event_data.value = data.event_data; ! // open a new window var w = window.open('', 'Popup', 'scrollbars=yes,width=460,height=275'); --- 10,14 ---- form.elements.cpath.value = data.cpath; form.elements.event_data.value = data.event_data; ! // open a new window var w = window.open('', 'Popup', 'scrollbars=yes,width=460,height=275'); *************** *** 24,33 **** this.event_data = event_data; } - //--> - </script> - <script language="JavaScript" type="text/javascript"> - <!-- ! function openTodoInfo(num) { // populate the hidden form var data = document.todo_popup_data[num]; --- 24,53 ---- this.event_data = event_data; } ! document.popup_data = new Array(); ! ! ! function openEditWindow(num) { ! // populate the hidden form ! var data = document.edit_data[num]; ! var form = document.forms.editPopupForm; ! form.elements.edit_cal.value = data.edit_cal; ! form.elements.edit_uid.value = data.edit_uid; ! ! // open a new window ! var w = window.open('', 'Popup', 'scrollbars=yes,width=460,height=275'); ! form.target = 'Popup'; ! form.submit(); ! } ! ! function EditData(edit_cal, edit_uid) { ! this.edit_cal = edit_cal; ! this.edit_uid = edit_uid; ! } ! ! document.edit_data = new Array(); ! ! ! function openTodoInfo(num) { // populate the hidden form var data = document.todo_popup_data[num]; *************** *** 41,44 **** --- 61,65 ---- form.submit(); } + function TodoData(todo_data,todo_text) { this.todo_data = todo_data; *************** *** 46,50 **** } - document.popup_data = new Array(); document.todo_popup_data = new Array(); //--> --- 67,70 ---- |