Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
7276d3d895
|
@ -464,6 +464,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$showInstanceId = $this->_getParam('id');
|
$showInstanceId = $this->_getParam('id');
|
||||||
|
|
||||||
$show_instance = CcShowInstancesQuery::create()->findPK($showInstanceId);
|
$show_instance = CcShowInstancesQuery::create()->findPK($showInstanceId);
|
||||||
|
$show = new Application_Model_Show($show_instance->getDbShowId());
|
||||||
|
|
||||||
$starts_string = $show_instance->getDbStarts();
|
$starts_string = $show_instance->getDbStarts();
|
||||||
$ends_string = $show_instance->getDbEnds();
|
$ends_string = $show_instance->getDbEnds();
|
||||||
|
@ -474,15 +475,20 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$starts_datetime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
$starts_datetime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
$ends_datetime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
$ends_datetime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
|
||||||
$instance_duration = $starts_datetime->diff($ends_datetime);
|
$instance_duration = $starts_datetime->diff($ends_datetime);
|
||||||
|
|
||||||
|
$formWhat->populate(array('add_show_id' => $show->getId(),
|
||||||
|
'add_show_instance_id' => $showInstanceId,
|
||||||
|
'add_show_name' => $show->getName(),
|
||||||
|
'add_show_url' => $show->getUrl(),
|
||||||
|
'add_show_genre' => $show->getGenre(),
|
||||||
|
'add_show_description' => $show->getDescription()));
|
||||||
|
|
||||||
$formValues = array('add_show_start_date' => $starts_datetime->format("Y-m-d"),
|
$formWhen->populate(array('add_show_start_date' => $starts_datetime->format("Y-m-d"),
|
||||||
'add_show_start_time' => $starts_datetime->format("H:i"),
|
'add_show_start_time' => $starts_datetime->format("H:i"),
|
||||||
'add_show_end_date_no_repeat' => $ends_datetime->format("Y-m-d"),
|
'add_show_end_date_no_repeat' => $ends_datetime->format("Y-m-d"),
|
||||||
'add_show_end_time' => $ends_datetime->format("H:i"),
|
'add_show_end_time' => $ends_datetime->format("H:i"),
|
||||||
'add_show_duration' => $instance_duration->format("%h"));
|
'add_show_duration' => $instance_duration->format("%h")));
|
||||||
|
|
||||||
$formWhen->populate($formValues);
|
|
||||||
|
|
||||||
$formWhat->disable();
|
$formWhat->disable();
|
||||||
$formWho->disable();
|
$formWho->disable();
|
||||||
|
@ -719,19 +725,15 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
foreach($js as $j){
|
foreach($js as $j){
|
||||||
$data[$j["name"]] = $j["value"];
|
$data[$j["name"]] = $j["value"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$start_dt = new DateTime($data['add_show_start_date']." ".$data['add_show_start_time'], new DateTimeZone(date_default_timezone_get()));
|
$success = Application_Model_Schedule::updateShowInstance($data, $this);
|
||||||
$start_dt->setTimezone(new DateTimeZone('UTC'));
|
if ($success){
|
||||||
|
$this->view->addNewShow = true;
|
||||||
$end_dt = new DateTime($data['add_show_end_date_no_repeat']." ".$data['add_show_end_time'], new DateTimeZone(date_default_timezone_get()));
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||||
$end_dt->setTimezone(new DateTimeZone('UTC'));
|
} else {
|
||||||
|
$this->view->addNewShow = false;
|
||||||
//add_show_instance_id not being populated by populateShowInstanceFormAction.
|
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
||||||
$ccShowInstance = CcShowInstancesQuery::create()->findPK($data["add_show_instance_id"]);
|
}
|
||||||
$ccShowInstance->setDbStarts($start_dt);
|
|
||||||
$ccShowInstance->setDbEnds($end_dt);
|
|
||||||
$ccShowInstance->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editShowAction(){
|
public function editShowAction(){
|
||||||
|
|
|
@ -629,6 +629,89 @@ class Application_Model_Schedule {
|
||||||
$p_view->addNewShow = true;
|
$p_view->addNewShow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function is responsible for handling the case where an individual
|
||||||
|
* show instance in a repeating show was edited (via the context menu in the Calendar).
|
||||||
|
* There is still lots of clean-up to do. For example we shouldn't be passing $controller into
|
||||||
|
* this method to manipulate the view (this should be done inside the controller function). With
|
||||||
|
* 2.1 deadline looming, this is OK for now. -Martin */
|
||||||
|
public static function updateShowInstance($data, $controller){
|
||||||
|
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||||
|
|
||||||
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
|
$formWhen = new Application_Form_AddShowWhen();
|
||||||
|
$formRepeats = new Application_Form_AddShowRepeats();
|
||||||
|
$formWho = new Application_Form_AddShowWho();
|
||||||
|
$formStyle = new Application_Form_AddShowStyle();
|
||||||
|
$formLive = new Application_Form_AddShowLiveStream();
|
||||||
|
|
||||||
|
$formWhat->removeDecorator('DtDdWrapper');
|
||||||
|
$formWhen->removeDecorator('DtDdWrapper');
|
||||||
|
$formRepeats->removeDecorator('DtDdWrapper');
|
||||||
|
$formWho->removeDecorator('DtDdWrapper');
|
||||||
|
$formStyle->removeDecorator('DtDdWrapper');
|
||||||
|
$formLive->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
|
if(!$isSaas){
|
||||||
|
$formRecord = new Application_Form_AddShowRR();
|
||||||
|
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||||
|
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||||
|
|
||||||
|
$formRecord->removeDecorator('DtDdWrapper');
|
||||||
|
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
|
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
|
}
|
||||||
|
$when = $formWhen->isValid($data);
|
||||||
|
|
||||||
|
if($when && $formWhen->checkReliantFields($data, true)) {
|
||||||
|
$start_dt = new DateTime($data['add_show_start_date']." ".$data['add_show_start_time'], new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$start_dt->setTimezone(new DateTimeZone('UTC'));
|
||||||
|
|
||||||
|
$end_dt = new DateTime($data['add_show_end_date_no_repeat']." ".$data['add_show_end_time'], new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$end_dt->setTimezone(new DateTimeZone('UTC'));
|
||||||
|
|
||||||
|
$ccShowInstance = CcShowInstancesQuery::create()->findPK($data["add_show_instance_id"]);
|
||||||
|
$ccShowInstance->setDbStarts($start_dt);
|
||||||
|
$ccShowInstance->setDbEnds($end_dt);
|
||||||
|
$ccShowInstance->save();
|
||||||
|
|
||||||
|
Application_Model_Schedule::createNewFormSections($controller->view);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
$formWhat->disable();
|
||||||
|
$formWhen->disableRepeatCheckbox();
|
||||||
|
$formRepeats->disable();
|
||||||
|
$formWho->disable();
|
||||||
|
$formStyle->disable();
|
||||||
|
//$formLive->disable();
|
||||||
|
|
||||||
|
$controller->view->what = $formWhat;
|
||||||
|
$controller->view->when = $formWhen;
|
||||||
|
$controller->view->repeats = $formRepeats;
|
||||||
|
$controller->view->who = $formWho;
|
||||||
|
$controller->view->style = $formStyle;
|
||||||
|
$controller->view->live = $formLive;
|
||||||
|
if(!$isSaas){
|
||||||
|
$controller->view->rr = $formRecord;
|
||||||
|
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||||
|
$controller->view->rebroadcast = $formRebroadcast;
|
||||||
|
|
||||||
|
//$formRecord->disable();
|
||||||
|
//$formAbsoluteRebroadcast->disable();
|
||||||
|
//$formRebroadcast->disable();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This function is responsible for handling the case where the entire show (not a single show instance)
|
||||||
|
* was edited (via the context menu in the Calendar).
|
||||||
|
* There is still lots of clean-up to do. For example we shouldn't be passing $controller into
|
||||||
|
* this method to manipulate the view (this should be done inside the controller function). With
|
||||||
|
* 2.1 deadline looming, this is OK for now.
|
||||||
|
* Another clean-up is to move all the form manipulation to the proper form class.....
|
||||||
|
* -Martin
|
||||||
|
*/
|
||||||
public static function addUpdateShow($data, $controller, $validateStartDate){
|
public static function addUpdateShow($data, $controller, $validateStartDate){
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
|
|
@ -809,7 +809,10 @@ Logging::log("getting media! - 2");
|
||||||
if (!isset($result)){//The file has no duplicate, so proceed to copy.
|
if (!isset($result)){//The file has no duplicate, so proceed to copy.
|
||||||
$storDir = Application_Model_MusicDir::getStorDir();
|
$storDir = Application_Model_MusicDir::getStorDir();
|
||||||
$stor = $storDir->getDirectory();
|
$stor = $storDir->getDirectory();
|
||||||
|
// check if "organize" dir exists and if not create one
|
||||||
|
if(!file_exists($stor."/organize")){
|
||||||
|
mkdir($stor."/organize", 0777);
|
||||||
|
}
|
||||||
//check to see if there is enough space in $stor to continue.
|
//check to see if there is enough space in $stor to continue.
|
||||||
$enough_space = Application_Model_StoredFile::checkForEnoughDiskSpaceToCopy($stor, $audio_file);
|
$enough_space = Application_Model_StoredFile::checkForEnoughDiskSpaceToCopy($stor, $audio_file);
|
||||||
if ($enough_space){
|
if ($enough_space){
|
||||||
|
|
|
@ -483,7 +483,6 @@ function showErrorSections() {
|
||||||
$("#schedule-record-rebroadcast").show();
|
$("#schedule-record-rebroadcast").show();
|
||||||
$("#add_show_rebroadcast_relative").show();
|
$("#add_show_rebroadcast_relative").show();
|
||||||
}
|
}
|
||||||
$('input:text').setMask()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
Loading…
Reference in New Issue