Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
1b3186af50
11 changed files with 149 additions and 19 deletions
|
@ -55,6 +55,8 @@
|
|||
<actionMethod actionName="addShowDialog"/>
|
||||
<actionMethod actionName="moveShow"/>
|
||||
<actionMethod actionName="resizeShow"/>
|
||||
<actionMethod actionName="deleteShow"/>
|
||||
<actionMethod actionName="makeContextMenu"/>
|
||||
</controllerFile>
|
||||
<controllerFile controllerName="Api">
|
||||
<actionMethod actionName="index"/>
|
||||
|
@ -177,9 +179,16 @@
|
|||
</viewControllerScriptsDirectory>
|
||||
<viewControllerScriptsDirectory forControllerName="Schedule">
|
||||
<viewScriptFile forActionName="resizeShow"/>
|
||||
</viewControllerScriptsDirectory>
|
||||
<viewControllerScriptsDirectory forControllerName="Api">
|
||||
<viewScriptFile forActionName="index"/>
|
||||
</viewControllerScriptsDirectory>
|
||||
<viewControllerScriptsDirectory forControllerName="Schedule">
|
||||
<viewScriptFile forActionName="deleteShow"/>
|
||||
</viewControllerScriptsDirectory>
|
||||
<viewControllerScriptsDirectory forControllerName="Schedule">
|
||||
<viewScriptFile forActionName="makeContextMenu"/>
|
||||
</viewControllerScriptsDirectory>
|
||||
</viewScriptsDirectory>
|
||||
<viewHelpersDirectory/>
|
||||
<viewFiltersDirectory enabled="false"/>
|
||||
|
|
|
@ -15,17 +15,33 @@ 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/qtip/jquery.qtip-1.0.0.min.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');
|
||||
|
||||
|
||||
$eventDefaultMenu = array();
|
||||
//$eventDefaultMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Delete');
|
||||
|
||||
$this->view->eventDefaultMenu = $eventDefaultMenu;
|
||||
|
||||
$eventHostMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Delete');
|
||||
$eventHostMenu[] = array('action' => '/Schedule/delete-show', 'text' => 'Schedule');
|
||||
|
||||
$this->view->eventHostMenu = $eventHostMenu;
|
||||
}
|
||||
|
||||
public function eventFeedAction()
|
||||
|
@ -40,7 +56,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$show = new Show($userInfo->id, $userInfo->type);
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
|
||||
$this->view->events = $show->getFullCalendarEvents($start, $end, $weekday);
|
||||
}
|
||||
|
||||
|
@ -54,7 +71,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$show = new Show($userInfo->id, $userInfo->type);
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
$overlap = $show->addShow($form->getValues());
|
||||
|
||||
if(isset($overlap)) {
|
||||
|
@ -76,7 +93,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$show = new Show($userInfo->id, $userInfo->type);
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
|
||||
$overlap = $show->moveShow($showId, $deltaDay, $deltaMin);
|
||||
|
||||
|
@ -92,7 +109,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$show = new Show($userInfo->id, $userInfo->type);
|
||||
$show = new Show(new User($userInfo->id, $userInfo->type));
|
||||
|
||||
$overlap = $show->resizeShow($showId, $deltaDay, $deltaMin);
|
||||
|
||||
|
@ -100,6 +117,21 @@ 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(new User($userInfo->id, $userInfo->type));
|
||||
$show->deleteShow($showId);
|
||||
}
|
||||
|
||||
public function makeContextMenuAction()
|
||||
{
|
||||
// action body
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -113,3 +145,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -91,9 +91,8 @@ class Application_Form_AddShow extends Zend_Form
|
|||
'required' => false,
|
||||
));
|
||||
|
||||
$user = new User();
|
||||
$options = array();
|
||||
$hosts = $user->getHosts();
|
||||
$hosts = User::getHosts();
|
||||
|
||||
foreach ($hosts as $host) {
|
||||
$options[$host['id']] = $host['login'];
|
||||
|
|
|
@ -2,13 +2,11 @@
|
|||
|
||||
class Show {
|
||||
|
||||
private $_userRole;
|
||||
private $_userId;
|
||||
private $_user;
|
||||
|
||||
public function __construct($userId, $userType='G')
|
||||
public function __construct($user=NULL)
|
||||
{
|
||||
$this->_userRole = $userType;
|
||||
$this->_userId = $userId;
|
||||
$this->_user = $user;
|
||||
}
|
||||
|
||||
//end dates are non inclusive.
|
||||
|
@ -180,6 +178,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;
|
||||
|
||||
|
@ -201,7 +203,7 @@ class Show {
|
|||
}
|
||||
if(!is_null($start) && is_null($end)) {
|
||||
$sql_range = "(first_show <= '{$start}' AND last_show IS NULL)
|
||||
OR (last_show > '{$start}')";
|
||||
OR (first_show <= '{$start}' AND last_show > '{$start}')";
|
||||
|
||||
$sql = $sql_gen ." WHERE ". $sql_range;
|
||||
}
|
||||
|
@ -319,10 +321,14 @@ class Show {
|
|||
$event[$key] = $value;
|
||||
}
|
||||
|
||||
if($this->_userRole === "A") {
|
||||
if($this->_user->isAdmin()) {
|
||||
$event["editable"] = true;
|
||||
}
|
||||
|
||||
if($this->_user->isHost($show["show_id"])) {
|
||||
$event["isHost"] = true;
|
||||
}
|
||||
|
||||
return $event;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,32 @@
|
|||
|
||||
class User {
|
||||
|
||||
public function getUsers($type=NULL) {
|
||||
private $_userRole;
|
||||
private $_userId;
|
||||
|
||||
public function __construct($userId, $userType='G')
|
||||
{
|
||||
$this->_userRole = $userType;
|
||||
$this->_userId = $userId;
|
||||
}
|
||||
|
||||
public function getType(){
|
||||
return $this->userRole;
|
||||
}
|
||||
|
||||
public function getId(){
|
||||
return $this->_userId;
|
||||
}
|
||||
|
||||
public function isHost($showId) {
|
||||
return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($this->_userId)->count() > 0;
|
||||
}
|
||||
|
||||
public function isAdmin() {
|
||||
return $this->_userRole === 'A';
|
||||
}
|
||||
|
||||
public static function getUsers($type=NULL) {
|
||||
global $CC_DBC;
|
||||
|
||||
$sql;
|
||||
|
@ -29,8 +54,8 @@ class User {
|
|||
return $CC_DBC->GetAll($sql);
|
||||
}
|
||||
|
||||
public function getHosts() {
|
||||
return $this->getUsers(array('H', 'A'));
|
||||
public static function getHosts() {
|
||||
return User::getUsers(array('H', 'A'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
1
application/views/scripts/schedule/delete-show.phtml
Normal file
1
application/views/scripts/schedule/delete-show.phtml
Normal file
|
@ -0,0 +1 @@
|
|||
<br /><br /><center>View script for controller <b>Schedule</b> and script/action name <b>deleteShow</b></center>
|
|
@ -1,2 +1,9 @@
|
|||
<div><span id='schedule_add_show'>Add Show</span></div>
|
||||
<div id='schedule_calendar'></div>
|
||||
|
||||
<ul id="schedule_event_default_menu" class="contextMenu">
|
||||
<?php echo $this->partialLoop('library/contextMenuPartial.phtml', $this->eventDefaultMenu) ?>
|
||||
</ul>
|
||||
<ul id="schedule_event_host_menu" class="contextMenu">
|
||||
<?php echo $this->partialLoop('library/contextMenuPartial.phtml', $this->eventHostMenu) ?>
|
||||
</ul>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<br /><br /><center>View script for controller <b>Schedule</b> and script/action name <b>makeContextMenu</b></center>
|
|
@ -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,26 @@ function dayClick(date, allDay, jsEvent, view) {
|
|||
}
|
||||
|
||||
function eventRender(event, element, view) {
|
||||
var x;
|
||||
//element.qtip({
|
||||
// content: event.description
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
function eventAfterRender( event, element, view ) {
|
||||
|
||||
if(event.isHost === true) {
|
||||
$(element).contextMenu(
|
||||
{menu: 'schedule_event_host_menu'}, eventMenu
|
||||
);
|
||||
}
|
||||
else{
|
||||
$(element).contextMenu(
|
||||
{menu: 'schedule_event_default_menu'}, eventMenu
|
||||
);
|
||||
}
|
||||
|
||||
$(element).data({'event': event});
|
||||
}
|
||||
|
||||
function eventClick(event, jsEvent, view) {
|
||||
|
@ -221,6 +251,7 @@ $(document).ready(function() {
|
|||
//callbacks
|
||||
dayClick: dayClick,
|
||||
eventRender: eventRender,
|
||||
eventAfterRender: eventAfterRender,
|
||||
eventClick: eventClick,
|
||||
eventMouseover: eventMouseover,
|
||||
eventMouseout: eventMouseout,
|
||||
|
|
|
@ -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
|
||||
|
|
15
public/js/qtip/jquery.qtip-1.0.0.min.js
vendored
Normal file
15
public/js/qtip/jquery.qtip-1.0.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue