diff --git a/.zfproject.xml b/.zfproject.xml
index 12959c77e..9b0b3c0a3 100644
--- a/.zfproject.xml
+++ b/.zfproject.xml
@@ -55,6 +55,7 @@
+
@@ -177,9 +178,13 @@
+
+
+
+
diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php
index 7337f1c9c..5eb80ca0a 100644
--- a/application/controllers/ScheduleController.php
+++ b/application/controllers/ScheduleController.php
@@ -15,17 +15,26 @@ class ScheduleController extends Zend_Controller_Action
->addActionContext('add-show-dialog', 'json')
->addActionContext('add-show', 'json')
->addActionContext('move-show', 'json')
- ->addActionContext('resize-show', 'json')
+ ->addActionContext('resize-show', 'json')
+ ->addActionContext('delete-show', 'json')
->initContext();
}
public function indexAction()
{
$this->view->headScript()->appendFile('/js/fullcalendar/fullcalendar.min.js','text/javascript');
+ $this->view->headScript()->appendFile('/js/contextmenu/jquery.contextMenu.js','text/javascript');
+
$this->view->headScript()->appendFile('/js/campcaster/schedule/schedule.js','text/javascript');
+ $this->view->headLink()->appendStylesheet('/css/jquery.contextMenu.css');
$this->view->headLink()->appendStylesheet('/css/fullcalendar.css');
$this->view->headLink()->appendStylesheet('/css/schedule.css');
+
+
+ $eventMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Delete');
+
+ $this->view->eventMenu = $eventMenu;
}
public function eventFeedAction()
@@ -100,6 +109,17 @@ class ScheduleController extends Zend_Controller_Action
$this->view->overlap = $overlap;
}
+ public function deleteShowAction()
+ {
+ $showId = $this->_getParam('showId');
+
+ $userInfo = Zend_Auth::getInstance()->getStorage()->read();
+
+ $show = new Show($userInfo->id, $userInfo->type);
+
+ $show->deleteShow($showId);
+ }
+
}
@@ -113,3 +133,5 @@ class ScheduleController extends Zend_Controller_Action
+
+
diff --git a/application/models/Shows.php b/application/models/Shows.php
index c649e2bb4..f8e10a436 100644
--- a/application/models/Shows.php
+++ b/application/models/Shows.php
@@ -180,6 +180,10 @@ class Show {
}
+ public function deleteShow($showId, $dayId=NULL) {
+ CcShowQuery::create()->filterByDbId($showId)->delete();
+ }
+
public function getShows($start=NULL, $end=NULL, $days=NULL, $s_time=NULL, $e_time=NULL, $exclude_shows=NULL) {
global $CC_DBC;
diff --git a/application/models/Users.php b/application/models/Users.php
index f7c51c2f2..292999afd 100644
--- a/application/models/Users.php
+++ b/application/models/Users.php
@@ -2,6 +2,15 @@
class User {
+ private $_userRole;
+ private $_userId;
+
+ public function __construct($userId, $userType='G')
+ {
+ $this->_userRole = $userType;
+ $this->_userId = $userId;
+ }
+
public function getUsers($type=NULL) {
global $CC_DBC;
@@ -33,4 +42,8 @@ class User {
return $this->getUsers(array('H', 'A'));
}
+ public function isHost($showId) {
+ $res = CCShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($this->_userId);
+ }
+
}
diff --git a/application/views/scripts/schedule/index.phtml b/application/views/scripts/schedule/index.phtml
index 7cbbc9bd8..b37b56ce2 100644
--- a/application/views/scripts/schedule/index.phtml
+++ b/application/views/scripts/schedule/index.phtml
@@ -1,2 +1,6 @@
Add Show
+
+
diff --git a/public/js/campcaster/schedule/schedule.js b/public/js/campcaster/schedule/schedule.js
index 48c68cac4..f6c2b4223 100644
--- a/public/js/campcaster/schedule/schedule.js
+++ b/public/js/campcaster/schedule/schedule.js
@@ -115,6 +115,17 @@ function makeShowDialog(html) {
return dialog;
}
+function eventMenu(action, el, pos) {
+ var event;
+ event = $(el).data('event');
+
+ $.post(action,
+ {showId: event.id, format: "json"},
+ function(json){
+ $("#schedule_calendar").fullCalendar( 'refetchEvents' );
+ });
+}
+
/**
*
* Full Calendar callback methods.
@@ -126,7 +137,16 @@ function dayClick(date, allDay, jsEvent, view) {
}
function eventRender(event, element, view) {
- var x;
+
+}
+
+function eventAfterRender( event, element, view ) {
+
+ $(element).contextMenu(
+ {menu: 'schedule_event_menu'}, eventMenu
+ );
+
+ $(element).data({'event': event});
}
function eventClick(event, jsEvent, view) {
@@ -221,6 +241,7 @@ $(document).ready(function() {
//callbacks
dayClick: dayClick,
eventRender: eventRender,
+ eventAfterRender: eventAfterRender,
eventClick: eventClick,
eventMouseover: eventMouseover,
eventMouseout: eventMouseout,
diff --git a/public/js/contextmenu/jquery.contextMenu.js b/public/js/contextmenu/jquery.contextMenu.js
index b2cd4f8fd..a06f0bbdf 100644
--- a/public/js/contextmenu/jquery.contextMenu.js
+++ b/public/js/contextmenu/jquery.contextMenu.js
@@ -37,7 +37,7 @@ if(jQuery)( function() {
e.stopPropagation();
var srcElement = $(this);
$(this).unbind('mouseup');
- if( evt.button == 0 ) {
+ if( evt.button == 2 ) {
// Hide context menus that may be showing
$(".contextMenu").hide();
// Get this context menu