diff options
author | Georg Ehrke <georg.stefan.germany@googlemail.com> | 2011-08-31 20:20:46 +0200 |
---|---|---|
committer | Georg Ehrke <georg.stefan.germany@googlemail.com> | 2011-08-31 20:20:46 +0200 |
commit | 5678d78d54cdabf4b6971803acd0bd3eb3573cc9 (patch) | |
tree | afa20e855c2d8e41ec3d650ff746ee4335ec845f /apps | |
parent | 9a60313c3b7a1abd3aa75d3c914682bfbd03fb07 (diff) | |
download | nextcloud-server-5678d78d54cdabf4b6971803acd0bd3eb3573cc9.tar.gz nextcloud-server-5678d78d54cdabf4b6971803acd0bd3eb3573cc9.zip |
new changes (e.g. show events) by Bart Visscher
Diffstat (limited to 'apps')
27 files changed, 239 insertions, 63 deletions
diff --git a/apps/calendar/ajax/activation.php b/apps/calendar/ajax/activation.php index adf44468c28..51c5777f643 100644..100755 --- a/apps/calendar/ajax/activation.php +++ b/apps/calendar/ajax/activation.php @@ -2,7 +2,7 @@ /************************************************* * ownCloud - Calendar Plugin * * * - * (c) Copyright 2011 Bart Visscher * + * (c) Copyright 2011 Georg Ehrke * * author: Georg Ehrke * * email: ownclouddev at georgswebsite dot de * * homepage: ownclouddev.georgswebsite.de * @@ -24,4 +24,4 @@ if(!OC_USER::isLoggedIn()) { $calendarid = $_POST['calendarid']; OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']); $cal = OC_Calendar_Calendar::findCalendar($calendarid); -echo $cal['active'];
\ No newline at end of file +echo $cal['active']; diff --git a/apps/calendar/ajax/editcalendar.php b/apps/calendar/ajax/editcalendar.php new file mode 100755 index 00000000000..e32bf458652 --- /dev/null +++ b/apps/calendar/ajax/editcalendar.php @@ -0,0 +1,29 @@ +<?php +/************************************************* + * ownCloud - Calendar Plugin * + * * + * (c) Copyright 2011 Georg Ehrke * + * author: Georg Ehrke * + * email: ownclouddev at georgswebsite dot de * + * homepage: ownclouddev.georgswebsite.de * + * manual: ownclouddev.georgswebsite.de/manual * + * License: GNU AFFERO GENERAL PUBLIC LICENSE * + * * + * If you are not able to view the License, * + * <http://www.gnu.org/licenses/> * + * <http://ownclouddev.georgswebsite.de/license/> * + * please write to the Free Software Foundation. * + * Address: * + * 59 Temple Place, Suite 330, Boston, * + * MA 02111-1307 USA * + *************************************************/ +require_once('../../../lib/base.php'); +$l10n = new OC_L10N('calendar'); +if(!OC_USER::isLoggedIn()) { + die("<script type=\"text/javascript\">document.location = oc_webroot;</script>"); +} +$calendar = OC_Calendar_Calendar::findCalendar($_GET['calendarid']); +$tmpl = new OC_Template("calendar", "part.editcalendar"); +$tmpl->assign('calendar',$calendar); +$tmpl->printPage(); +?> diff --git a/apps/calendar/ajax/getcal.php b/apps/calendar/ajax/getcal.php index 702c0e057ba..b20f22957c3 100755 --- a/apps/calendar/ajax/getcal.php +++ b/apps/calendar/ajax/getcal.php @@ -23,4 +23,4 @@ if(!OC_USER::isLoggedIn()) { } $output = new OC_TEMPLATE("calendar", "part.getcal"); $output -> printpage(); -?>
\ No newline at end of file +?> diff --git a/apps/calendar/ajax/settimezone.php b/apps/calendar/ajax/settimezone.php new file mode 100755 index 00000000000..62e171c66b9 --- /dev/null +++ b/apps/calendar/ajax/settimezone.php @@ -0,0 +1,26 @@ +<?php + +// Init owncloud +require_once('../../../lib/base.php'); + +$l=new OC_L10N('calendar'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Authentication error") ))); + exit(); +} + +// Get data +if( isset( $_POST['timezone'] ) ){ + $timezone=$_POST['timezone']; + OC_Preferences::setValue( OC_User::getUser(), 'calendar', 'timezone', $timezone ); + echo json_encode( array( "status" => "success", "data" => array( "message" => $l->t("Timezone changed") ))); +}else{ + echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Invalid request") ))); +} + +?> diff --git a/apps/calendar/ajax/updatecalendar.php b/apps/calendar/ajax/updatecalendar.php new file mode 100755 index 00000000000..2836dda218a --- /dev/null +++ b/apps/calendar/ajax/updatecalendar.php @@ -0,0 +1,39 @@ +<?php +/************************************************* + * ownCloud - Calendar Plugin * + * * + * (c) Copyright 2011 Georg Ehrke * + * author: Georg Ehrke * + * email: ownclouddev at georgswebsite dot de * + * homepage: ownclouddev.georgswebsite.de * + * manual: ownclouddev.georgswebsite.de/manual * + * License: GNU AFFERO GENERAL PUBLIC LICENSE * + * * + * If you are not able to view the License, * + * <http://www.gnu.org/licenses/> * + * <http://ownclouddev.georgswebsite.de/license/> * + * please write to the Free Software Foundation. * + * Address: * + * 59 Temple Place, Suite 330, Boston, * + * MA 02111-1307 USA * + *************************************************/ +require_once('../../../lib/base.php'); + +$l10n = new OC_L10N('calendar'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Authentication error") ))); + exit(); +} + +$calendarid = $_POST['id']; +OC_Calendar_Calendar::editCalendar($calendarid, $_POST['name'], $_POST['description'], null, null, null, $_POST['color']); +OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']); +$calendar = OC_Calendar_Calendar::findCalendar($calendarid); +$tmpl = new OC_Template('calendar', 'part.calendar.row'); +$tmpl->assign('calendar', $calendar); +echo json_encode( array( "status" => "success", "data" => $tmpl->fetchPage() )); diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index 0e3d9c9379e..5ec2177e20c 100644..100755 --- a/apps/calendar/appinfo/app.php +++ b/apps/calendar/appinfo/app.php @@ -16,3 +16,5 @@ OC_App::addNavigationEntry( array( 'href' => OC_Helper::linkTo( 'calendar', 'index.php' ), 'icon' => OC_Helper::imagePath( 'calendar', 'icon.png' ), 'name' => $l->t('Calendar'))); + +OC_App::registerPersonal('calendar', 'settings'); diff --git a/apps/calendar/appinfo/database.xml b/apps/calendar/appinfo/database.xml index 0d7ec188dfb..159ca0127e4 100644..100755 --- a/apps/calendar/appinfo/database.xml +++ b/apps/calendar/appinfo/database.xml @@ -135,7 +135,7 @@ <notnull>false</notnull> <length>100</length> </field> - + <field> <name>active</name> <type>integer</type> @@ -143,7 +143,7 @@ <notnull>true</notnull> <length>4</length> </field> - + <field> <name>ctag</name> <type>integer</type> diff --git a/apps/calendar/appinfo/info.xml b/apps/calendar/appinfo/info.xml index 23a07588cb4..23a07588cb4 100644..100755 --- a/apps/calendar/appinfo/info.xml +++ b/apps/calendar/appinfo/info.xml diff --git a/apps/calendar/caldav.php b/apps/calendar/caldav.php index 49fc9633365..49fc9633365 100644..100755 --- a/apps/calendar/caldav.php +++ b/apps/calendar/caldav.php diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index eb64418bd03..d9bad110a6b 100755 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -1,7 +1,7 @@ /************************************************* * ownCloud - Calendar Plugin * * * - * (c) Copyright 2011 Georg Ehrke, Bart Visscher * + * (c) Copyright 2011 Georg Ehrke * * author: Georg Ehrke * * email: ownclouddev at georgswebsite dot de * * homepage: ownclouddev.georgswebsite.de * @@ -462,17 +462,17 @@ function oc_cal_switch2today() { function oc_cal_update_eventsvar(loadyear) { $.getJSON(oc_webroot + "/apps/calendar/ajax/getcal.php?year=" + loadyear, function(newevents, status) { - if(status == "nosession") { + if(status == "nosession") { alert("You are not logged in. That can happen if you don't use owncloud for a long time."); - document.location.href = oc_webroot; + document.location(oc_webroot); } if(status == "parsingfail" || typeof (newevents) == "undefined") { $(function() { $( "#parsingfail_dialog" ).dialog(); }); } else { - oc_cal_events[loadyear]= newevents[loadyear]; - oc_cal_update_view(''); + oc_cal_events[loadyear] = newevents[loadyear]; + oc_cal_update_view('', ''); } }); } @@ -678,8 +678,8 @@ function oc_cal_load_events(loadview) { var weekdays = new Array("monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"); var dates = oc_cal_generate_dates("oneweek"); for(var i = 0; i <= 6; i++) { - var loadevents_month = dates[i][0]; - var loadevents_days = dates[i][1]; + var loadevents_month = dates[i][1]; + var loadevents_days = dates[i][0]; if( typeof (oc_cal_events[oc_cal_year][loadevents_month]) != "undefined") { if( typeof (oc_cal_events[oc_cal_year][loadevents_month][loadevents_days]) != "undefined") { if( typeof (oc_cal_events[oc_cal_year][loadevents_month][loadevents_days]["allday"]) != "undefined") { @@ -718,8 +718,8 @@ function oc_cal_load_events(loadview) { var weekdaynum = 0; var weeknum = 1; for(var i = 0; i <= 27; i++) { - var loadevents_month = dates[i][0]; - var loadevents_days = dates[i][1]; + var loadevents_month = dates[i][1]; + var loadevents_days = dates[i][0]; if( typeof (oc_cal_events[oc_cal_year][loadevents_month]) != "undefined") { if( typeof (oc_cal_events[oc_cal_year][loadevents_month][loadevents_days]) != "undefined") { var pnum = 0; @@ -767,8 +767,8 @@ function oc_cal_load_events(loadview) { var weekdaynum = 0; var weeknum = 1; for(var i = 0; i <= 41; i++) { - var loadevents_month = dates[i][0]; - var loadevents_days = dates[i][1]; + var loadevents_month = dates[i][1]; + var loadevents_days = dates[i][0]; if( typeof (oc_cal_events[oc_cal_year][loadevents_month]) != "undefined") { if( typeof (oc_cal_events[oc_cal_year][loadevents_month][loadevents_days]) != "undefined") { var pnum = 0; @@ -896,10 +896,27 @@ function oc_cal_choosecalendar(){ alert(t("calendar", "You can't open more than one dialog per site!")); } } - -function oc_cal_calender_activation(checkbox, calendarid){ +function oc_cal_calender_activation(checkbox, calendarid) +{ $.post(oc_webroot + "/apps/calendar/ajax/activation.php", { calendarid: calendarid, active: checkbox.checked?1:0 }, - function(data) { - checkbox.checked = data == 1; - }); -}
\ No newline at end of file + function(data) { + checkbox.checked = data == 1; + }); +} +function oc_cal_editcalendar(object, calendarid){ + $(object).closest('tr').load(oc_webroot + "/apps/calendar/ajax/editcalendar.php?calendarid="+calendarid); +} +function oc_cal_editcalendar_submit(button, calendarid){ + var displayname = $("#displayname_"+calendarid).val(); + var active = $("#active_"+calendarid+":checked").length; + var description = $("#description_"+calendarid).val(); + var calendarcolor = $("#calendarcolor_"+calendarid).val(); + + $.post("ajax/updatecalendar.php", { id: calendarid, name: displayname, active: active, description: description, color: calendarcolor }, + function(data){ + if(data.error == "true"){ + }else{ + $(button).closest('tr').html(data.data) + } + }, 'json'); +} diff --git a/apps/calendar/js/calendar_init.js b/apps/calendar/js/calendar_init.js index 4e71daabf3b..3140284094b 100755 --- a/apps/calendar/js/calendar_init.js +++ b/apps/calendar/js/calendar_init.js @@ -54,4 +54,4 @@ var oc_cal_datemonthyear = String(oc_cal_dayofmonth) + String(oc_cal_month) + S var oc_cal_calendars = new Array(); //event vars var oc_cal_events = new Array(); -oc_cal_events[oc_cal_year] = new Array(0,1,2,3,4,5,6,7,8,9,10,11); +oc_cal_events[oc_cal_year] = new Array(); diff --git a/apps/calendar/js/settings.js b/apps/calendar/js/settings.js new file mode 100755 index 00000000000..b2da81b0d0f --- /dev/null +++ b/apps/calendar/js/settings.js @@ -0,0 +1,15 @@ +$(document).ready(function(){ + $("#timezone").change( function(){ + // Serialize the data + var post = $( "#timezone" ).serialize(); + // Ajax foo + $.post( oc_webroot + '/apps/calendar/ajax/settimezone.php', post, function(data){ + if( data.status == "success" ){ + } + else{ + $('#timezoneerror').html( data.data.message ); + } + }); + return false; + }); +}); diff --git a/apps/calendar/l10n/de.php b/apps/calendar/l10n/de.php index 325a323d57a..325a323d57a 100644..100755 --- a/apps/calendar/l10n/de.php +++ b/apps/calendar/l10n/de.php diff --git a/apps/calendar/l10n/es.php b/apps/calendar/l10n/es.php index f20230fe17f..f20230fe17f 100644..100755 --- a/apps/calendar/l10n/es.php +++ b/apps/calendar/l10n/es.php diff --git a/apps/calendar/l10n/xgettextfiles b/apps/calendar/l10n/xgettextfiles index c94fb9d8b2e..c94fb9d8b2e 100644..100755 --- a/apps/calendar/l10n/xgettextfiles +++ b/apps/calendar/l10n/xgettextfiles diff --git a/apps/calendar/lib/calendar.php b/apps/calendar/lib/calendar.php index e28e384ba88..c1223b5b3ab 100644..100755 --- a/apps/calendar/lib/calendar.php +++ b/apps/calendar/lib/calendar.php @@ -56,15 +56,15 @@ * This class manages our calendars */ class OC_Calendar_Calendar{ - public static function allCalendars($uid){ + public static function allCalendars($uid, $active=null){ $values = array($uid); - $active_where = ''; - if (!is_null($active)){ - $active_where = ' AND active = ?'; - $values[] = $active; - } - $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_calendars WHERE userid = ?' . $active_where ); - $result = $stmt->execute($values); + $active_where = ''; + if (!is_null($active)){ + $active_where = ' AND active = ?'; + $values[] = $active; + } + $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_calendars WHERE userid = ?' . $active_where ); + $result = $stmt->execute($values); $calendars = array(); while( $row = $result->fetchRow()){ @@ -112,14 +112,14 @@ class OC_Calendar_Calendar{ public static function editCalendar($id,$name=null,$description=null,$components=null,$timezone=null,$order=null,$color=null){ // Need these ones for checking uri - $calendar = self::find($id); + $calendar = self::findCalendar($id); // Keep old stuff if(is_null($name)) $name = $calendar['name']; if(is_null($description)) $description = $calendar['description']; if(is_null($components)) $components = $calendar['components']; if(is_null($timezone)) $timezone = $calendar['timezone']; - if(is_null($order)) $order = $calendar['order']; + if(is_null($order)) $order = $calendar['calendarorder']; if(is_null($color)) $color = $calendar['color']; $stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET displayname=?,description=?,calendarorder=?,calendarcolor=?,timezone=?,components=?,ctag=ctag+1 WHERE id=?' ); @@ -131,6 +131,7 @@ class OC_Calendar_Calendar{ public static function setCalendarActive($id,$active){ $stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET active = ? WHERE id = ?' ); $stmt->execute(array($active, $id)); + return true; } diff --git a/apps/calendar/lib/connector_sabre.php b/apps/calendar/lib/connector_sabre.php index aff1941688f..aff1941688f 100644..100755 --- a/apps/calendar/lib/connector_sabre.php +++ b/apps/calendar/lib/connector_sabre.php diff --git a/apps/calendar/lib/hooks.php b/apps/calendar/lib/hooks.php index 5c446102b22..5c446102b22 100644..100755 --- a/apps/calendar/lib/hooks.php +++ b/apps/calendar/lib/hooks.php diff --git a/apps/calendar/settings.php b/apps/calendar/settings.php new file mode 100755 index 00000000000..bdf997eef70 --- /dev/null +++ b/apps/calendar/settings.php @@ -0,0 +1,10 @@ +<?php + +$tmpl = new OC_Template( 'calendar', 'settings'); +$timezone=OC_Preferences::getValue(OC_User::getUser(),'calendar','timezone',''); +$tmpl->assign('timezone',$timezone); +$tmpl->assign('timezones',DateTimeZone::listIdentifiers()); + +OC_Util::addScript('calendar','settings'); + +return $tmpl->fetchPage(); diff --git a/apps/calendar/templates/part.choosecalendar.php b/apps/calendar/templates/part.choosecalendar.php index 3bd7e5ef591..30866270ac5 100644..100755 --- a/apps/calendar/templates/part.choosecalendar.php +++ b/apps/calendar/templates/part.choosecalendar.php @@ -4,16 +4,13 @@ $option_calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); for($i = 0; $i < count($option_calendars); $i++){ echo "<tr>"; - echo "<td width=\"20px\"><input id=\"active_" . $option_calendars[$i]["id"] . "\" type=\"checkbox\" onClick=\"oc_cal_calender_activation(this, " . $option_calendars[$i]["id"] . ")\"></td>"; - echo "<td><label for=\"active_" . $option_calendars[$i]["id"] . "\">" . $option_calendars[$i]["displayname"] . "</label></td>"; - echo "<td width=\"20px\"><a style=\"display: block; opacity: 0.214133;\" href=\"#\" title=\"" . $l->t("Download") . "\" class=\"action\"><img src=\"/owncloud/core/img/actions/download.svg\"></a></td><td width=\"20px\"><a style=\"display: block; opacity: 0.214133;\" href=\"#\" title=\"" . $l->t("Rename") . "\" class=\"action\"><img src=\"/owncloud/core/img/actions/rename.svg\"></a></td>"; + $tmpl = new OC_Template('calendar', 'part.choosecalendar.rowfields'); + $tmpl->assign('calendar', $option_calendars[$i]); + $tmpl->printpage(); echo "</tr>"; } ?> </table> -<br /><br /><br /> -<input style="float: left;" type="button" onclick="oc_cal_choosecalendar_submit();" value="<?php echo $l->t("Submit"); ?>"> -</div> <script type="text/javascript"> $( "#choosecalendar_dialog" ).dialog({ width : 500, diff --git a/apps/calendar/templates/part.choosecalendar.rowfields.php b/apps/calendar/templates/part.choosecalendar.rowfields.php new file mode 100755 index 00000000000..ebe1ca0b137 --- /dev/null +++ b/apps/calendar/templates/part.choosecalendar.rowfields.php @@ -0,0 +1,4 @@ +<?php + echo "<td width=\"20px\"><input id=\"active_" . $_['calendar']["id"] . "\" type=\"checkbox\" onClick=\"oc_cal_calender_activation(this, " . $_['calendar']["id"] . ")\"" . ($_['calendar']["active"] ? ' checked="checked"' : '') . "></td>"; + echo "<td><label for=\"active_" . $_['calendar']["id"] . "\">" . $_['calendar']["displayname"] . "</label></td>"; + echo "<td width=\"20px\"><a style=\"display: block; opacity: 0.214133;\" href=\"#\" title=\"" . $l->t("Download") . "\" class=\"action\"><img src=\"/owncloud/core/img/actions/download.svg\"></a></td><td width=\"20px\"><a style=\"display: block; opacity: 0.214133;\" href=\"#\" title=\"" . $l->t("Edit") . "\" class=\"action\" onclick=\"oc_cal_editcalendar(this, " . $_['calendar']["id"] . ");\"><img src=\"/owncloud/core/img/actions/rename.svg\"></a></td>"; diff --git a/apps/calendar/templates/part.editcalendar.php b/apps/calendar/templates/part.editcalendar.php new file mode 100755 index 00000000000..d6f4e9f16ff --- /dev/null +++ b/apps/calendar/templates/part.editcalendar.php @@ -0,0 +1,32 @@ +<td id="editcalendar_dialog" title="<?php echo $l->t("Edit calendar"); ?>" colspan="4"> +<table width="100%" style="border: 0;"> +<tr> + <th><?php echo $l->t('Displayname') ?></th> + <td> + <input id="displayname_<?php echo $_['calendar']['id'] ?>" type="text" value="<?php echo $_['calendar']['displayname'] ?>"> + </td> +</tr> +<tr> + <td></td> + <td> + <input id="active_<?php echo $_['calendar']['id'] ?>" type="checkbox"<?php echo ($_['calendar']['active'] ? ' checked="checked"' : '' ) ?>> + <label for="active_<?php echo $_['calendar']['id'] ?>"> + <?php echo $l->t('Active') ?> + </label> + </td> +</tr> +<tr> + <th><?php echo $l->t('Description') ?></th> + <td> + <textarea id="description_<?php echo $_['calendar']['id'] ?>"><?php echo $_['calendar']['description'] ?></textarea> + </td> +</tr> +<tr> + <th><?php echo $l->t('Calendar color') ?></th> + <td> + <input id="calendarcolor_<?php echo $_['calendar']['id'] ?>" type="text" value="<?php echo $_['calendar']['calendarcolor'] ?>"> + </td> +</tr> +</table> +<input style="float: left;" type="button" onclick="oc_cal_editcalendar_submit(this, <?php echo $_['calendar']['id'] ?>);" value="<?php echo $l->t("Submit"); ?>"> +</td> diff --git a/apps/calendar/templates/part.editevent.php b/apps/calendar/templates/part.editevent.php index 8a85652442c..8a85652442c 100644..100755 --- a/apps/calendar/templates/part.editevent.php +++ b/apps/calendar/templates/part.editevent.php diff --git a/apps/calendar/templates/part.eventinfo.php b/apps/calendar/templates/part.eventinfo.php index edccaaa2227..edccaaa2227 100644..100755 --- a/apps/calendar/templates/part.eventinfo.php +++ b/apps/calendar/templates/part.eventinfo.php diff --git a/apps/calendar/templates/part.getcal.php b/apps/calendar/templates/part.getcal.php index 2ee121620f0..0d85c9be4c4 100644..100755 --- a/apps/calendar/templates/part.getcal.php +++ b/apps/calendar/templates/part.getcal.php @@ -1,22 +1,4 @@ <?php -/************************************************* - * ownCloud - Calendar Plugin * - * * - * (c) Copyright 2011 Bart Visscher * - * author: Georg Ehrke * - * email: ownclouddev at georgswebsite dot de * - * homepage: ownclouddev.georgswebsite.de * - * manual: ownclouddev.georgswebsite.de/manual * - * License: GNU AFFERO GENERAL PUBLIC LICENSE * - * * - * If you are not able to view the License, * - * <http://www.gnu.org/licenses/> * - * <http://ownclouddev.georgswebsite.de/license/> * - * please write to the Free Software Foundation. * - * Address: * - * 59 Temple Place, Suite 330, Boston, * - * MA 02111-1307 USA * - *************************************************/ $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1); $events = OC_Calendar_Calendar::allCalendarObjects($calendars[0]['id']); $select_year = $_GET["year"]; @@ -30,10 +12,10 @@ foreach($events as $event) $start_dt->setTimezone(new DateTimeZone($user_timezone)); $end_dt = new DateTime($event['enddate'], new DateTimeZone('UTC')); $end_dt->setTimezone(new DateTimeZone($user_timezone)); - $year = $start_dt->format('Y'); + $year = $start_dt->format('Y'); $month = $start_dt->format('n') - 1; // return is 0 based - $day = $start_dt->format('j'); - $hour = $start_dt->format('G'); + $day = $start_dt->format('j'); + $hour = $start_dt->format('G'); // hack if (strstr($event['calendardata'], 'DTSTART;VALUE=DATE:')) { @@ -47,11 +29,14 @@ foreach($events as $event) $return_event['startdate'] = $start_dt->format('Y-m-d H:i'); $return_event['enddate'] = $end_dt->format('Y-m-d H:i'); $return_event['description'] = $event['summary']; - if (isset($return_events[$year][$month][$day][$hour])){ + if (isset($return_events[$year][$month][$day][$hour])) + { $return_events[$year][$month][$day][$hour][] = $return_event; - }else{ + } + else + { $return_events[$year][$month][$day][$hour] = array(1 => $return_event); } } echo json_encode($return_events); -?>
\ No newline at end of file +?> diff --git a/apps/calendar/templates/part.newevent.php b/apps/calendar/templates/part.newevent.php index 837e032c734..837e032c734 100644..100755 --- a/apps/calendar/templates/part.newevent.php +++ b/apps/calendar/templates/part.newevent.php diff --git a/apps/calendar/templates/settings.php b/apps/calendar/templates/settings.php new file mode 100755 index 00000000000..0b0a4f1c265 --- /dev/null +++ b/apps/calendar/templates/settings.php @@ -0,0 +1,19 @@ +<form id="calendar"> + <fieldset class="personalblock"> + <label for="timezone"><strong><?php echo $l->t('Timezone');?></strong></label> + <select id="timezone" name="timezone"> + <?php foreach($_['timezones'] as $timezone): + if ( preg_match( '/^(America|Antartica|Arctic|Asia|Atlantic|Europe|Indian|Pacific)\//', $timezone ) ): + $ex=explode('/', $timezone, 2);//obtain continent,city + if ($continent!=$ex[0]): + if ($continent!="") echo '</optgroup>'; + echo '<optgroup label="'.$ex[0].'">'; + endif; + $city=$ex[1]; + $continent=$ex[0]; + echo '<option value="'.$timezone.'"'.($_['timezone'] == $timezone?' selected="selected"':'').'>'.$city.'</option>'; + endif; + endforeach;?> + </select><span id="timezoneerror"></span> + </fieldset> +</form> |