]> source.dussan.org Git - nextcloud-server.git/commitdiff
delete calendar function for userinterface
authorGeorg Ehrke <georg.stefan.germany@googlemail.com>
Sat, 24 Sep 2011 17:52:55 +0000 (19:52 +0200)
committerGeorg Ehrke <georg.stefan.germany@googlemail.com>
Sat, 24 Sep 2011 17:52:55 +0000 (19:52 +0200)
apps/calendar/ajax/deletecalendar.php [new file with mode: 0644]
apps/calendar/js/calendar.js
apps/calendar/known bugs [deleted file]
apps/calendar/templates/part.choosecalendar.rowfields.php

diff --git a/apps/calendar/ajax/deletecalendar.php b/apps/calendar/ajax/deletecalendar.php
new file mode 100644 (file)
index 0000000..71129f2
--- /dev/null
@@ -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'));
+}
+?> 
index 61a1945c343ac63e6eea430bf0e50f5de834fd01..f8d1c8e650e1a37dbdf831c3b3bfa4579c836eb0 100644 (file)
@@ -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 (file)
index fb3cd2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-There are actually no known bugs
index 6993ad13c365d6e732bea69958e1a2aed4ec429c..db0c71252bbe90c6df8f0c3c75c707f08efdf21f 100644 (file)
@@ -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>";