diff options
-rw-r--r-- | apps/calendar/ajax/deletecalendar.php | 28 | ||||
-rw-r--r-- | apps/calendar/js/calendar.js | 13 | ||||
-rw-r--r-- | apps/calendar/known bugs | 1 | ||||
-rw-r--r-- | apps/calendar/templates/part.choosecalendar.rowfields.php | 2 |
4 files changed, 42 insertions, 2 deletions
diff --git a/apps/calendar/ajax/deletecalendar.php b/apps/calendar/ajax/deletecalendar.php new file mode 100644 index 00000000000..71129f2c040 --- /dev/null +++ b/apps/calendar/ajax/deletecalendar.php @@ -0,0 +1,28 @@ +<?php +/** + * Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +require_once('../../../lib/base.php'); + +$l10n = new OC_L10N('calendar'); + +if(!OC_USER::isLoggedIn()) { + die('<script type="text/javascript">document.location = oc_webroot;</script>'); +} + +$cal = $_POST["calendarid"]; +$calendar = OC_Calendar_Calendar::findCalendar($cal); +if($calendar["userid"] != OC_User::getUser()){ + echo json_encode(array('status'=>'error','error'=>'permission_denied')); + exit; +} +$del = OC_Calendar_Calendar::deleteCalendar($cal); +if($del == true){ + echo json_encode(array('status' => 'success')); +}else{ + echo json_encode(array('status'=>'error', 'error'=>'dberror')); +} +?> diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index 61a1945c343..f8d1c8e650e 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -416,6 +416,19 @@ Calendar={ $('#caldav_url').show(); $("#caldav_url_close").show(); }, + deleteCalendar:function(calid){ + var check = confirm("Do you really want to delete this calendar?"); + if(check == false){ + return false; + }else{ + $.post(oc_webroot + "/apps/calendar/ajax/deletecalendar.php", { calendarid: calid}, + function(data) { + Calendar.UI.loadEvents(); + $('#choosecalendar_dialog').dialog('destroy').remove(); + Calendar.UI.Calendar.overview(); + }); + } + }, Calendar:{ overview:function(){ if($('#choosecalendar_dialog').dialog('isOpen') == true){ diff --git a/apps/calendar/known bugs b/apps/calendar/known bugs deleted file mode 100644 index fb3cd2aa28a..00000000000 --- a/apps/calendar/known bugs +++ /dev/null @@ -1 +0,0 @@ -There are actually no known bugs diff --git a/apps/calendar/templates/part.choosecalendar.rowfields.php b/apps/calendar/templates/part.choosecalendar.rowfields.php index 6993ad13c36..db0c71252bb 100644 --- a/apps/calendar/templates/part.choosecalendar.rowfields.php +++ b/apps/calendar/templates/part.choosecalendar.rowfields.php @@ -1,4 +1,4 @@ <?php echo "<td width=\"20px\"><input id=\"active_" . $_['calendar']["id"] . "\" type=\"checkbox\" onClick=\"Calendar.UI.Calendar.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 href=\"#\" onclick=\"Calendar.UI.showCalDAVUrl('" . OC_User::getUser() . "', '" . $_['calendar']["uri"] . "');\" title=\"" . $l->t("CalDav Link") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/public.svg\"></a></td><td width=\"20px\"><a href=\"export.php?calid=" . $_['calendar']["id"] . "\" title=\"" . $l->t("Download") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/download.svg\"></a></td><td width=\"20px\"><a href=\"#\" title=\"" . $l->t("Edit") . "\" class=\"action\" onclick=\"Calendar.UI.Calendar.edit(this, " . $_['calendar']["id"] . ");\"><img class=\"svg action\" src=\"../../core/img/actions/rename.svg\"></a></td>"; + echo "<td width=\"20px\"><a href=\"#\" onclick=\"Calendar.UI.showCalDAVUrl('" . OC_User::getUser() . "', '" . $_['calendar']["uri"] . "');\" title=\"" . $l->t("CalDav Link") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/public.svg\"></a></td><td width=\"20px\"><a href=\"export.php?calid=" . $_['calendar']["id"] . "\" title=\"" . $l->t("Download") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/download.svg\"></a></td><td width=\"20px\"><a href=\"#\" title=\"" . $l->t("Edit") . "\" class=\"action\" onclick=\"Calendar.UI.Calendar.edit(this, " . $_['calendar']["id"] . ");\"><img class=\"svg action\" src=\"../../core/img/actions/rename.svg\"></a></td><td width=\"20px\"><a href=\"#\" onclick=\"Calendar.UI.deleteCalendar('" . $_['calendar']["id"] . "');\" title=\"" . $l->t("Delete") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/delete.svg\"></a></td>"; |