From bdc256a96fa3cce7f05968d73e656b7e4e8ab535 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Thu, 8 Sep 2011 13:44:00 +0200 Subject: delete events by key --- application/controllers/EventController.php | 4 ++ application/views/scripts/event/index.phtml | 83 ++++++++++++++--------------- 2 files changed, 43 insertions(+), 44 deletions(-) diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php index 4edabab..017c7c8 100644 --- a/application/controllers/EventController.php +++ b/application/controllers/EventController.php @@ -342,6 +342,10 @@ class EventController extends Zend_Controller_Action return; } } + + public function refreshCal() { + $this->_redirect('/event/'); + } public function editAction() { diff --git a/application/views/scripts/event/index.phtml b/application/views/scripts/event/index.phtml index 5a210b3..6618c52 100644 --- a/application/views/scripts/event/index.phtml +++ b/application/views/scripts/event/index.phtml @@ -86,11 +86,10 @@ var lastview; events: "/event/eventlist/poolID/" + getPoolID(), - - + dayClick: function( date, allDay, jsEvent, view ) { - //self.location="/event/add/"; + }, eventMouseover: function( event, jsEvent, view ) { @@ -100,14 +99,26 @@ var lastview; }, eventClick: function( event, jsEvent, view ) { - - alert('Event: ' + event.title + - '\nStart: ' + event.start + - '\nEnd: ' + event.end + - '\nNote: ' + event.note + - '\nCategory: ' + event.category + - '\nParticipants: ' + event.participants); - //$(this).css('color', 'red'); + + $(document).keydown(function (e) { + if (e.keyCode == 8 || e.keyCode == 46) { + if (confirm("Are you sure to delete " + event.title + " ?")) { + self.location="/event/delete/eventID/" + event.id; + $('#calendar').fullCalendar( 'removeEvents', event.id ); + $('#calendar').fullCalendar( 'rerenderEvents' ); + }else{ self.location = "/event/"; } + } + }); + /* + if(event.color == 'red') { + event.color = 'rgb(112,0,0)'; + }else if(event.color == 'green') { + event.color = 'rgb(0,90,0)'; + }else if(event.color == 'yellow') { + event.color = ''; + }else if(event.color == 'blue') { + event.color = 'rgb(0,0,112)'; + }*/ }, select: function( startDate, endDate, allDay, jsEvent, view ) { @@ -115,9 +126,7 @@ var lastview; if (!confirm("Are you sure to add an Event from " + startDate + " to " + endDate + " ?")) { $('#calendar').fullCalendar( 'unselect' ); }else { - //self.location="/event/add/"; self.location="/event/add/evstart/" + startDate + "/evend/" + endDate; - //$.post("/event/add/evstart" + startDate + "/evend" + endDate); } }, @@ -141,16 +150,6 @@ var lastview; }, eventDrop: function( event, dayDelta, minuteDelta, allDay, revertFunc ) { - /* - * ------------------------- - * allDay is not implemented - * ------------------------- - if (allDay) { - alert("Event is now all-day"); - }else{ - alert("Event has a time-of-day"); - } - */ if (!confirm(event.title + " was moved to " + event.start + "\n\n" + "Are you sure about this change?")) { revertFunc(); @@ -160,11 +159,13 @@ var lastview; }, - eventElementHandlers: function (event, eventElement) { - var view = this; + /*eventElementHandlers: function (event, eventElement) { + var view = this; + alert('eventhandler'); eventElement .click(function (ev) { + alert('eventhandler'); if (!eventElement.hasClass('ui-draggable-dragging') && !eventElement.hasClass('ui-resizable-resizing')) { @@ -185,31 +186,25 @@ var lastview; view.trigger('eventMouseout', this, event, ev); } ); - }, + },*/ eventRender: function(event, element, view) { - - element.bind('dblclick', function() { - alert('double click!'); - }); + element.qtip({ + content: + 'Title: ' + event.title + '
' + + 'Type: ' + event.category + '
' + + 'Note: ' + event.note + '
' + + 'Participants: ' + event.participants, + show: 'mouseover', + hide: 'mouseout' + }); + if (view.name == 'agendaWeek') { - element.qtip({ - content: - 'Title: ' + event.title + '
' + - 'Type: ' + event.category + '
' + - 'Note: ' + event.note + '
' + - 'Participants: ' + event.participants - }); + } if (view.name == 'agendaDay') { - element.qtip({ - content: - 'Title: ' + event.title + '
' + - 'Type: ' + event.category + '
' + - 'Note: ' + event.note + '
' + - 'Participants: ' + event.participants - }); + element.find('.fc-event-title').append("
Type: " + event.category + "
Note: " + event.note + "
Participants: " + event.participants); } }, -- cgit v1.2.3-55-g7522