putting in context menu for shows, simple delete.

This commit is contained in:
naomiaro 2010-12-10 17:59:57 -05:00
parent 71735b683d
commit 4e2c791bd3
7 changed files with 72 additions and 3 deletions

View file

@ -55,6 +55,7 @@
<actionMethod actionName="addShowDialog"/> <actionMethod actionName="addShowDialog"/>
<actionMethod actionName="moveShow"/> <actionMethod actionName="moveShow"/>
<actionMethod actionName="resizeShow"/> <actionMethod actionName="resizeShow"/>
<actionMethod actionName="deleteShow"/>
</controllerFile> </controllerFile>
<controllerFile controllerName="Api"> <controllerFile controllerName="Api">
<actionMethod actionName="index"/> <actionMethod actionName="index"/>
@ -177,9 +178,13 @@
</viewControllerScriptsDirectory> </viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Schedule"> <viewControllerScriptsDirectory forControllerName="Schedule">
<viewScriptFile forActionName="resizeShow"/> <viewScriptFile forActionName="resizeShow"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Api"> <viewControllerScriptsDirectory forControllerName="Api">
<viewScriptFile forActionName="index"/> <viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory> </viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Schedule">
<viewScriptFile forActionName="deleteShow"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory> </viewScriptsDirectory>
<viewHelpersDirectory/> <viewHelpersDirectory/>
<viewFiltersDirectory enabled="false"/> <viewFiltersDirectory enabled="false"/>

View file

@ -15,17 +15,26 @@ class ScheduleController extends Zend_Controller_Action
->addActionContext('add-show-dialog', 'json') ->addActionContext('add-show-dialog', 'json')
->addActionContext('add-show', 'json') ->addActionContext('add-show', 'json')
->addActionContext('move-show', 'json') ->addActionContext('move-show', 'json')
->addActionContext('resize-show', 'json') ->addActionContext('resize-show', 'json')
->addActionContext('delete-show', 'json')
->initContext(); ->initContext();
} }
public function indexAction() public function indexAction()
{ {
$this->view->headScript()->appendFile('/js/fullcalendar/fullcalendar.min.js','text/javascript'); $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->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/fullcalendar.css');
$this->view->headLink()->appendStylesheet('/css/schedule.css'); $this->view->headLink()->appendStylesheet('/css/schedule.css');
$eventMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Delete');
$this->view->eventMenu = $eventMenu;
} }
public function eventFeedAction() public function eventFeedAction()
@ -100,6 +109,17 @@ class ScheduleController extends Zend_Controller_Action
$this->view->overlap = $overlap; $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

View file

@ -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) { public function getShows($start=NULL, $end=NULL, $days=NULL, $s_time=NULL, $e_time=NULL, $exclude_shows=NULL) {
global $CC_DBC; global $CC_DBC;

View file

@ -2,6 +2,15 @@
class User { class User {
private $_userRole;
private $_userId;
public function __construct($userId, $userType='G')
{
$this->_userRole = $userType;
$this->_userId = $userId;
}
public function getUsers($type=NULL) { public function getUsers($type=NULL) {
global $CC_DBC; global $CC_DBC;
@ -33,4 +42,8 @@ class User {
return $this->getUsers(array('H', 'A')); return $this->getUsers(array('H', 'A'));
} }
public function isHost($showId) {
$res = CCShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($this->_userId);
}
} }

View file

@ -1,2 +1,6 @@
<div><span id='schedule_add_show'>Add Show</span></div> <div><span id='schedule_add_show'>Add Show</span></div>
<div id='schedule_calendar'></div> <div id='schedule_calendar'></div>
<ul id="schedule_event_menu" class="contextMenu">
<?php echo $this->partialLoop('library/contextMenuPartial.phtml', $this->eventMenu) ?>
</ul>

View file

@ -115,6 +115,17 @@ function makeShowDialog(html) {
return dialog; 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. * Full Calendar callback methods.
@ -126,7 +137,16 @@ function dayClick(date, allDay, jsEvent, view) {
} }
function eventRender(event, element, 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) { function eventClick(event, jsEvent, view) {
@ -221,6 +241,7 @@ $(document).ready(function() {
//callbacks //callbacks
dayClick: dayClick, dayClick: dayClick,
eventRender: eventRender, eventRender: eventRender,
eventAfterRender: eventAfterRender,
eventClick: eventClick, eventClick: eventClick,
eventMouseover: eventMouseover, eventMouseover: eventMouseover,
eventMouseout: eventMouseout, eventMouseout: eventMouseout,

View file

@ -37,7 +37,7 @@ if(jQuery)( function() {
e.stopPropagation(); e.stopPropagation();
var srcElement = $(this); var srcElement = $(this);
$(this).unbind('mouseup'); $(this).unbind('mouseup');
if( evt.button == 0 ) { if( evt.button == 2 ) {
// Hide context menus that may be showing // Hide context menus that may be showing
$(".contextMenu").hide(); $(".contextMenu").hide();
// Get this context menu // Get this context menu