delete calendar function for userinterface

This commit is contained in:
Georg Ehrke 2011-09-24 19:52:55 +02:00
parent 793e29e124
commit 4aeb2990c0
4 changed files with 42 additions and 2 deletions

View File

@ -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'));
}
?>

View 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){

View File

@ -1 +0,0 @@
There are actually no known bugs

View 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>";