CC-2326 Can't edit a show more than once (End Date problems)

show editing assumed inclusive end dates while show creating assumed non inclusive.
This commit is contained in:
Naomi 2011-05-26 15:41:47 -04:00
parent 765897600d
commit 8d59c18bef
4 changed files with 100 additions and 95 deletions

View File

@ -227,7 +227,7 @@ class ScheduleController extends Zend_Controller_Action
'callback' => 'window["buildContentDialog"]'), 'title' => 'Show Content'); 'callback' => 'window["buildContentDialog"]'), 'title' => 'Show Content');
} }
if (strtotime($show->getShowEnd()) <= strtotime($today_timestamp) if (strtotime($show->getShowEnd()) <= strtotime($today_timestamp)
&& is_null($show->getSoundCloudFileId()) && is_null($show->getSoundCloudFileId())
&& Application_Model_Preference::GetDoSoundCloudUpload()) { && Application_Model_Preference::GetDoSoundCloudUpload()) {
$menu[] = array('action' => array('type' => 'fn', $menu[] = array('action' => array('type' => 'fn',
@ -405,9 +405,9 @@ class ScheduleController extends Zend_Controller_Action
if(!$user->isAdmin()) { if(!$user->isAdmin()) {
return; return;
} }
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');
$formWhat = new Application_Form_AddShowWhat(); $formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho(); $formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen(); $formWhen = new Application_Form_AddShowWhen();
@ -438,7 +438,7 @@ class ScheduleController extends Zend_Controller_Action
$showInstance = new ShowInstance($showInstanceId); $showInstance = new ShowInstance($showInstanceId);
$show = new Show($showInstance->getShowId()); $show = new Show($showInstance->getShowId());
$formWhat->populate(array('add_show_id' => $show->getId(), $formWhat->populate(array('add_show_id' => $show->getId(),
'add_show_name' => $show->getName(), 'add_show_name' => $show->getName(),
'add_show_url' => $show->getUrl(), 'add_show_url' => $show->getUrl(),
@ -455,10 +455,14 @@ class ScheduleController extends Zend_Controller_Action
foreach($showDays as $showDay){ foreach($showDays as $showDay){
array_push($days, $showDay->getDbDay()); array_push($days, $showDay->getDbDay());
} }
$displayedEndDate = new DateTime($show->getRepeatingEndDate());
$displayedEndDate->sub(new DateInterval("P1D"));//end dates are stored non-inclusively.
$displayedEndDate = $displayedEndDate->format("Y-m-d");
$formRepeats->populate(array('add_show_repeat_type' => $show->getRepeatType(), $formRepeats->populate(array('add_show_repeat_type' => $show->getRepeatType(),
'add_show_day_check' => $days, 'add_show_day_check' => $days,
'add_show_end_date' => $show->getRepeatingEndDate(), 'add_show_end_date' => $displayedEndDate,
'add_show_no_end' => ($show->getRepeatingEndDate() == ''))); 'add_show_no_end' => ($show->getRepeatingEndDate() == '')));
$formRecord->populate(array('add_show_record' => $show->isRecorded(), $formRecord->populate(array('add_show_record' => $show->isRecorded(),
@ -475,7 +479,7 @@ class ScheduleController extends Zend_Controller_Action
$rebroadcastFormValues["add_show_rebroadcast_time_$i"] = Show::removeSecondsFromTime($rebroadcast['start_time']); $rebroadcastFormValues["add_show_rebroadcast_time_$i"] = Show::removeSecondsFromTime($rebroadcast['start_time']);
$i++; $i++;
} }
$formRebroadcast->populate($rebroadcastFormValues); $formRebroadcast->populate($rebroadcastFormValues);
$rebroadcastsAbsolute = $show->getRebroadcastsAbsolute(); $rebroadcastsAbsolute = $show->getRebroadcastsAbsolute();
$rebroadcastAbsoluteFormValues = array(); $rebroadcastAbsoluteFormValues = array();
@ -497,7 +501,7 @@ class ScheduleController extends Zend_Controller_Action
$formStyle->populate(array('add_show_background_color' => $show->getBackgroundColor(), $formStyle->populate(array('add_show_background_color' => $show->getBackgroundColor(),
'add_show_color' => $show->getColor())); 'add_show_color' => $show->getColor()));
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml'); $this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
$this->view->entries = 5; $this->view->entries = 5;
} }
@ -543,7 +547,7 @@ class ScheduleController extends Zend_Controller_Action
foreach($js as $j){ foreach($js as $j){
$data[$j["name"]] = $j["value"]; $data[$j["name"]] = $j["value"];
} }
$data['add_show_hosts'] = $this->_getParam('hosts'); $data['add_show_hosts'] = $this->_getParam('hosts');
$data['add_show_day_check'] = $this->_getParam('days'); $data['add_show_day_check'] = $this->_getParam('days');
@ -586,7 +590,7 @@ class ScheduleController extends Zend_Controller_Action
} }
if($data["add_show_repeats"]) { if($data["add_show_repeats"]) {
$repeats = $formRepeats->isValid($data); $repeats = $formRepeats->isValid($data);
if($repeats) { if($repeats) {
$repeats = $formRepeats->checkReliantFields($data); $repeats = $formRepeats->checkReliantFields($data);
@ -596,7 +600,7 @@ class ScheduleController extends Zend_Controller_Action
//make it valid, results don't matter anyways. //make it valid, results don't matter anyways.
$rebroadAb = 1; $rebroadAb = 1;
if ($data["add_show_rebroadcast"]) { if ($data["add_show_rebroadcast"]) {
$rebroad = $formRebroadcast->isValid($data); $rebroad = $formRebroadcast->isValid($data);
if($rebroad) { if($rebroad) {
$rebroad = $formRebroadcast->checkReliantFields($data); $rebroad = $formRebroadcast->checkReliantFields($data);
@ -612,7 +616,7 @@ class ScheduleController extends Zend_Controller_Action
$repeats = 1; $repeats = 1;
$rebroad = 1; $rebroad = 1;
if ($data["add_show_rebroadcast"]) { if ($data["add_show_rebroadcast"]) {
$rebroadAb = $formAbsoluteRebroadcast->isValid($data); $rebroadAb = $formAbsoluteRebroadcast->isValid($data);
if($rebroadAb) { if($rebroadAb) {
$rebroadAb = $formAbsoluteRebroadcast->checkReliantFields($data); $rebroadAb = $formAbsoluteRebroadcast->checkReliantFields($data);
@ -634,10 +638,10 @@ class ScheduleController extends Zend_Controller_Action
if ($data['add_show_id'] != -1){ if ($data['add_show_id'] != -1){
$show = new Show($data['add_show_id']); $show = new Show($data['add_show_id']);
$data['add_show_record'] = $show->isRecorded(); $data['add_show_record'] = $show->isRecorded();
$record = $formRecord->isValid($data); $record = $formRecord->isValid($data);
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true)); $formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
} else { } else {
$record = $formRecord->isValid($data); $record = $formRecord->isValid($data);
} }
if ($what && $when && $repeats && $who && $style && $record && $rebroadAb && $rebroad) { if ($what && $when && $repeats && $who && $style && $record && $rebroadAb && $rebroad) {
@ -650,7 +654,7 @@ class ScheduleController extends Zend_Controller_Action
//send back a new form for the user. //send back a new form for the user.
$formWhat->reset(); $formWhat->reset();
$formWhat->populate(array('add_show_id' => '-1')); $formWhat->populate(array('add_show_id' => '-1'));
$formWho->reset(); $formWho->reset();
$formWhen->reset(); $formWhen->reset();
$formWhen->populate(array('add_show_start_date' => date("Y-m-d"), $formWhen->populate(array('add_show_start_date' => date("Y-m-d"),
@ -704,10 +708,10 @@ class ScheduleController extends Zend_Controller_Action
$show->deleteShow(); $show->deleteShow();
} }
} }
public function contentContextMenuAction(){ public function contentContextMenuAction(){
global $CC_CONFIG; global $CC_CONFIG;
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$params = '/format/json/id/#id#/'; $params = '/format/json/id/#id#/';

View File

@ -320,7 +320,7 @@ class Show {
* @param string $p_date * @param string $p_date
* The date which to delete after * The date which to delete after
*/ */
public function removeAllInstancesAfterDate($p_date){ public function removeAllInstancesFromDate($p_date){
global $CC_DBC; global $CC_DBC;
$date = new DateHelper; $date = new DateHelper;
@ -328,7 +328,7 @@ class Show {
$showId = $this->getId(); $showId = $this->getId();
$sql = "DELETE FROM cc_show_instances " $sql = "DELETE FROM cc_show_instances "
." WHERE date(starts) > DATE '$p_date'" ." WHERE date(starts) >= DATE '$p_date'"
." AND starts > TIMESTAMP '$timestamp'" ." AND starts > TIMESTAMP '$timestamp'"
." AND show_id = $showId"; ." AND show_id = $showId";
@ -590,7 +590,7 @@ class Show {
//show "Never Ends" option was toggled. //show "Never Ends" option was toggled.
if ($p_data['add_show_no_end']){ if ($p_data['add_show_no_end']){
} else { } else {
$p_show->removeAllInstancesAfterDate($p_endDate); $p_show->removeAllInstancesFromDate($p_endDate);
} }
} }
if ($p_show->getRepeatingEndDate() != $p_data['add_show_end_date']){ if ($p_show->getRepeatingEndDate() != $p_data['add_show_end_date']){
@ -599,7 +599,7 @@ class Show {
$newDate = strtotime($p_data['add_show_end_date']); $newDate = strtotime($p_data['add_show_end_date']);
$oldDate = strtotime($p_show->getRepeatingEndDate()); $oldDate = strtotime($p_show->getRepeatingEndDate());
if ($newDate < $oldDate){ if ($newDate < $oldDate){
$p_show->removeAllInstancesAfterDate($p_endDate); $p_show->removeAllInstancesFromDate($p_endDate);
} }
} }
} }
@ -608,7 +608,7 @@ class Show {
/** /**
* Create a show. * Create a show.
* *
* Note: end dates are non inclusive. * Note: end dates are inclusive.
* *
* @param array $data * @param array $data
* @return int * @return int
@ -624,17 +624,18 @@ class Show {
if ($data['add_show_no_end']) { if ($data['add_show_no_end']) {
$endDate = NULL; $endDate = NULL;
//$data['add_show_repeats'] = 1;
} }
else if ($data['add_show_repeats']) { else if ($data['add_show_repeats']) {
$sql = "SELECT date '{$data['add_show_end_date']}' + INTERVAL '1 day' "; //$sql = "SELECT date '{$data['add_show_end_date']}' + INTERVAL '1 day' ";
$r = $con->query($sql); //$r = $con->query($sql);
$endDate = $r->fetchColumn(0); //$endDate = $r->fetchColumn(0);
$endDate = $data['add_show_end_date'];
} }
else { else {
$sql = "SELECT date '{$data['add_show_start_date']}' + INTERVAL '1 day' "; //$sql = "SELECT date '{$data['add_show_start_date']}' + INTERVAL '1 day' ";
$r = $con->query($sql); //$r = $con->query($sql);
$endDate = $r->fetchColumn(0); //$endDate = $r->fetchColumn(0);
$endDate = $data['add_show_start_date'];
} }
//only want the day of the week from the start date. //only want the day of the week from the start date.
@ -703,7 +704,7 @@ class Show {
$start = $data['add_show_start_date']; $start = $data['add_show_start_date'];
} }
if (strtotime($start) < strtotime($endDate) || is_null($endDate)) { if (strtotime($start) <= strtotime($endDate) || is_null($endDate)) {
$showDay = new CcShowDays(); $showDay = new CcShowDays();
$showDay->setDbFirstShow($start); $showDay->setDbFirstShow($start);
$showDay->setDbLastShow($endDate); $showDay->setDbLastShow($endDate);
@ -921,7 +922,7 @@ class Show {
$rebroadcasts = $CC_DBC->GetAll($sql); $rebroadcasts = $CC_DBC->GetAll($sql);
$show = new Show($show_id); $show = new Show($show_id);
while(strtotime($next_date) < strtotime($end_timestamp) && (strtotime($last_show) > strtotime($next_date) || is_null($last_show))) { while(strtotime($next_date) <= strtotime($end_timestamp) && (strtotime($last_show) > strtotime($next_date) || is_null($last_show))) {
$start = $next_date; $start = $next_date;
@ -1179,7 +1180,7 @@ class ShowInstance {
{ {
$this->_instanceId = $instanceId; $this->_instanceId = $instanceId;
$this->_showInstance = CcShowInstancesQuery::create()->findPK($instanceId); $this->_showInstance = CcShowInstancesQuery::create()->findPK($instanceId);
if (is_null($this->_showInstance)){ if (is_null($this->_showInstance)){
throw new Exception(); throw new Exception();
} }
@ -1630,32 +1631,32 @@ class ShowInstance {
return $items; return $items;
} }
public static function GetShowsInstancesIdsInRange($p_timeNow, $p_start, $p_end) public static function GetShowsInstancesIdsInRange($p_timeNow, $p_start, $p_end)
{ {
global $CC_DBC; global $CC_DBC;
$sql = "SELECT id FROM cc_show_instances AS si " $sql = "SELECT id FROM cc_show_instances AS si "
."WHERE (" ."WHERE ("
."(si.starts < TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds' " ."(si.starts < TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds' "
."AND si.ends > TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds') " ."AND si.ends > TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds') "
."OR (si.starts > TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds' " ."OR (si.starts > TIMESTAMP '$p_timeNow' - INTERVAL '$p_start seconds' "
."AND si.ends < TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds') " ."AND si.ends < TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds') "
."OR (si.starts < TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds' " ."OR (si.starts < TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds' "
."AND si.ends > TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds') " ."AND si.ends > TIMESTAMP '$p_timeNow' + INTERVAL '$p_end seconds') "
.") " .") "
." ORDER BY si.starts"; ." ORDER BY si.starts";
$rows = $CC_DBC->GetAll($sql); $rows = $CC_DBC->GetAll($sql);
return $rows; return $rows;
} }
public function getScheduleItemsInRange($timeNow, $start, $end) public function getScheduleItemsInRange($timeNow, $start, $end)
{ {
global $CC_DBC, $CC_CONFIG; global $CC_DBC, $CC_CONFIG;
$instanceId = $this->_instanceId; $instanceId = $this->_instanceId;
$sql = "SELECT" $sql = "SELECT"
." si.starts as show_starts," ." si.starts as show_starts,"
." si.ends as show_ends," ." si.ends as show_ends,"
@ -1687,30 +1688,30 @@ class ShowInstance {
return $CC_DBC->GetAll($sql); return $CC_DBC->GetAll($sql);
} }
public function getLastAudioItemEnd(){ public function getLastAudioItemEnd(){
global $CC_DBC; global $CC_DBC;
$sql = "SELECT ends FROM cc_schedule " $sql = "SELECT ends FROM cc_schedule "
."WHERE instance_id = {$this->_instanceId} " ."WHERE instance_id = {$this->_instanceId} "
."ORDER BY ends DESC " ."ORDER BY ends DESC "
."LIMIT 1"; ."LIMIT 1";
return $CC_DBC->GetOne($sql); return $CC_DBC->GetOne($sql);
} }
public function getShowEndGapTime(){ public function getShowEndGapTime(){
$showEnd = $this->getShowEnd(); $showEnd = $this->getShowEnd();
$lastItemEnd = $this->getLastAudioItemEnd(); $lastItemEnd = $this->getLastAudioItemEnd();
if (is_null($lastItemEnd)){ if (is_null($lastItemEnd)){
$lastItemEnd = $this->getShowStart(); $lastItemEnd = $this->getShowStart();
} }
$diff = strtotime($showEnd) - strtotime($lastItemEnd); $diff = strtotime($showEnd) - strtotime($lastItemEnd);
return ($diff < 0) ? 0 : $diff; return ($diff < 0) ? 0 : $diff;
} }
public static function GetLastShowInstance($p_timeNow){ public static function GetLastShowInstance($p_timeNow){

View File

@ -26,11 +26,11 @@ function endDpSelect(dateText, inst) {
function createDateInput(el, onSelect) { function createDateInput(el, onSelect) {
var date; var date;
el.datepicker({ el.datepicker({
minDate: new Date(), minDate: new Date(),
onSelect: onSelect, onSelect: onSelect,
dateFormat: 'yy-mm-dd' dateFormat: 'yy-mm-dd'
}); });
} }
@ -46,13 +46,23 @@ function findHosts(request, callback) {
url = "/User/get-hosts"; url = "/User/get-hosts";
search = request.term; search = request.term;
$.post(url, $.post(url,
{format: "json", term: search}, {format: "json", term: search},
function(json) { function(json) {
callback(json.hosts); callback(json.hosts);
}); });
}
function beginEditShow(data){
$("#add-show-form")
.empty()
.append(data.newForm);
removeAddShowButton();
setAddShowEvents();
openAddShowForm();
} }
function setAddShowEvents() { function setAddShowEvents() {
@ -155,24 +165,24 @@ function setAddShowEvents() {
}); });
form.find("#add_show_duration").timepicker({ form.find("#add_show_duration").timepicker({
amPmText: ['', ''], amPmText: ['', ''],
defaultTime: '01:00' defaultTime: '01:00'
}); });
form.find('input[name^="add_show_rebroadcast_date_absolute"]').datepicker({ form.find('input[name^="add_show_rebroadcast_date_absolute"]').datepicker({
minDate: new Date(), minDate: new Date(),
dateFormat: 'yy-mm-dd' dateFormat: 'yy-mm-dd'
}); });
form.find('input[name^="add_show_rebroadcast_time"]').timepicker({ form.find('input[name^="add_show_rebroadcast_time"]').timepicker({
amPmText: ['', ''], amPmText: ['', ''],
defaultTime: '' defaultTime: ''
}); });
form.find(".add_absolute_rebroadcast_day").click(function(){ form.find(".add_absolute_rebroadcast_day").click(function(){
var li = $(this).parent().find("ul.formrow-repeat > li:visible:last").next(); var li = $(this).parent().find("ul.formrow-repeat > li:visible:last").next();
li.show(); li.show();
li = li.next(); li = li.next();
if(li.length === 0) { if(li.length === 0) {
$(this).hide(); $(this).hide();
} }
}); });
@ -207,11 +217,11 @@ function setAddShowEvents() {
list.next().show(); list.next().show();
}); });
form.find("#add_show_hosts_autocomplete").autocomplete({ form.find("#add_show_hosts_autocomplete").autocomplete({
source: findHosts, source: findHosts,
select: autoSelect, select: autoSelect,
delay: 200 delay: 200
}); });
form.find("#schedule-show-style input").ColorPicker({ form.find("#schedule-show-style input").ColorPicker({
@ -246,7 +256,7 @@ function setAddShowEvents() {
.append(json.form); .append(json.form);
setAddShowEvents(); setAddShowEvents();
}); });
makeAddShowButton(); makeAddShowButton();
}); });
@ -255,7 +265,7 @@ function setAddShowEvents() {
var addShowButton = $(this); var addShowButton = $(this);
if (!addShowButton.hasClass("disabled")){ if (!addShowButton.hasClass("disabled")){
addShowButton.addClass("disabled"); addShowButton.addClass("disabled");
} }
else { else {
return; return;
} }
@ -290,7 +300,7 @@ function setAddShowEvents() {
$("#add_show_end_date").val(end_date); $("#add_show_end_date").val(end_date);
$("#add_show_start_date").val(start_date); $("#add_show_start_date").val(start_date);
showErrorSections(); showErrorSections();
} }
else { else {
$("#add-show-form") $("#add-show-form")

View File

@ -46,16 +46,6 @@ function removeAddShowButton(){
span.remove(); span.remove();
} }
function beginEditShow(data){
$("#add-show-form")
.empty()
.append(data.newForm);
removeAddShowButton();
setAddShowEvents();
openAddShowForm();
}
function makeTimeStamp(date){ function makeTimeStamp(date){
var sy, sm, sd, h, m, s, timestamp; var sy, sm, sd, h, m, s, timestamp;
sy = date.getFullYear(); sy = date.getFullYear();
@ -70,7 +60,7 @@ function makeTimeStamp(date){
} }
function dayClick(date, allDay, jsEvent, view) { function dayClick(date, allDay, jsEvent, view) {
var now, today, selected, chosenDate, chosenTime; var now, today, selected, chosenDate, chosenTime;
now = new Date(); now = new Date();
@ -125,7 +115,7 @@ function dayClick(date, allDay, jsEvent, view) {
$("#add_show_end_date").val(chosenDate); $("#add_show_end_date").val(chosenDate);
$("#add_show_start_time").val(chosenTime); $("#add_show_start_time").val(chosenTime);
$("#schedule-show-when").show(); $("#schedule-show-when").show();
openAddShowForm(); openAddShowForm();
} }
} }
@ -155,7 +145,7 @@ function viewDisplay( view ) {
//re-initialize calendar with new slotmin options //re-initialize calendar with new slotmin options
$(calendarEl) $(calendarEl)
.fullCalendar('destroy') .fullCalendar('destroy')
.fullCalendar(opt) .fullCalendar(opt)
.fullCalendar( 'gotoDate', date ); .fullCalendar( 'gotoDate', date );
}); });
@ -176,7 +166,7 @@ function viewDisplay( view ) {
} }
} }
function eventRender(event, element, view) { function eventRender(event, element, view) {
//only put progress bar on shows that aren't being recorded. //only put progress bar on shows that aren't being recorded.
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 0) { if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 0) {
@ -198,29 +188,29 @@ function eventRender(event, element, view) {
//record icon (only if not on soundcloud, will always be true for future events) //record icon (only if not on soundcloud, will always be true for future events)
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id === -1) { if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id === -1) {
$(element).find(".fc-event-time").before('<span class="small-icon recording"></span>'); $(element).find(".fc-event-time").before('<span class="small-icon recording"></span>');
} }
if(view.name === 'month' && event.record === 1 && event.soundcloud_id === -1) { if(view.name === 'month' && event.record === 1 && event.soundcloud_id === -1) {
$(element).find(".fc-event-title").after('<span class="small-icon recording"></span>'); $(element).find(".fc-event-title").after('<span class="small-icon recording"></span>');
} }
//rebroadcast icon //rebroadcast icon
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.rebroadcast === 1) { if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.rebroadcast === 1) {
$(element).find(".fc-event-time").before('<span class="small-icon rebroadcast"></span>'); $(element).find(".fc-event-time").before('<span class="small-icon rebroadcast"></span>');
} }
if(view.name === 'month' && event.rebroadcast === 1) { if(view.name === 'month' && event.rebroadcast === 1) {
$(element).find(".fc-event-title").after('<span class="small-icon rebroadcast"></span>'); $(element).find(".fc-event-title").after('<span class="small-icon rebroadcast"></span>');
} }
//soundcloud icon //soundcloud icon
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.soundcloud_id !== -1 && event.record === 1) { if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.soundcloud_id !== -1 && event.record === 1) {
$(element).find(".fc-event-time").before('<span class="small-icon soundcloud"></span>'); $(element).find(".fc-event-time").before('<span class="small-icon soundcloud"></span>');
} }
if(view.name === 'month' && event.soundcloud_id !== -1 && event.record === 1) { if(view.name === 'month' && event.soundcloud_id !== -1 && event.record === 1) {
$(element).find(".fc-event-title").after('<span class="small-icon soundcloud"></span>'); $(element).find(".fc-event-title").after('<span class="small-icon soundcloud"></span>');
} }
} }
@ -228,9 +218,9 @@ function eventRender(event, element, view) {
function eventAfterRender( event, element, view ) { function eventAfterRender( event, element, view ) {
$(element) $(element)
.jjmenu("click", .jjmenu("click",
[{get:"/Schedule/make-context-menu/format/json/id/#id#"}], [{get:"/Schedule/make-context-menu/format/json/id/#id#"}],
{id: event.id}, {id: event.id},
{xposition: "mouse", yposition: "mouse"}); {xposition: "mouse", yposition: "mouse"});
} }
@ -239,7 +229,7 @@ function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui
url = '/Schedule/move-show/format/json'; url = '/Schedule/move-show/format/json';
$.post(url, $.post(url,
{day: dayDelta, min: minuteDelta, showInstanceId: event.id}, {day: dayDelta, min: minuteDelta, showInstanceId: event.id},
function(json){ function(json){
if(json.error) { if(json.error) {
@ -249,19 +239,19 @@ function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui
}); });
} }
function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view ) { function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view ) {
var url; var url;
url = '/Schedule/resize-show/format/json'; url = '/Schedule/resize-show/format/json';
$.post(url, $.post(url,
{day: dayDelta, min: minuteDelta, showInstanceId: event.id}, {day: dayDelta, min: minuteDelta, showInstanceId: event.id},
function(json){ function(json){
if(json.error) { if(json.error) {
alert(json.error); alert(json.error);
revertFunc(); revertFunc();
} }
scheduleRefetchEvents(); scheduleRefetchEvents();
}); });
} }
@ -273,7 +263,7 @@ function getFullCalendarEvents(start, end, callback) {
end_date = makeTimeStamp(end); end_date = makeTimeStamp(end);
url = '/Schedule/event-feed'; url = '/Schedule/event-feed';
var d = new Date(); var d = new Date();
$.post(url, {format: "json", start: start_date, end: end_date, cachep: d.getTime()}, function(json){ $.post(url, {format: "json", start: start_date, end: end_date, cachep: d.getTime()}, function(json){