Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Yuchen Wang 2011-11-25 21:34:05 -05:00
commit 41eeefe427
21 changed files with 153 additions and 87 deletions

View file

@ -18,7 +18,11 @@ class NowplayingController extends Zend_Controller_Action
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js','text/javascript');
//nowplayingdatagrid.js requires this variable, so that datePicker widget can be offset to server time instead of client time
$this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds");
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowview.js','text/javascript');
$refer_sses = new Zend_Session_Namespace('referrer');
@ -104,7 +108,11 @@ class NowplayingController extends Zend_Controller_Action
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js','text/javascript');
//nowplayingdatagrid.js requires this variable, so that datePicker widget can be offset to server time instead of client time
$this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds");
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/dayview.js','text/javascript');
}

View file

@ -199,7 +199,6 @@ class PreferenceController extends Zend_Controller_Action
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
}
var_dump($form->getValue('icecast_vorbis_metadata'));
if(!$error){
Application_Model_StreamSetting::setStreamSetting($values);
$data = array();

View file

@ -46,8 +46,12 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/fullcalendar/fullcalendar.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker-0.0.6.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/colorpicker/js/colorpicker.js','text/javascript');
//full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time
$this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds");
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/full-calendar-functions.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js','text/javascript');

View file

@ -28,7 +28,7 @@ class Application_Form_StreamSetting extends Zend_Form
}
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Meatadata')
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')
->setRequired(false)
->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0)
->setDecorators(array('ViewHelper'));

View file

@ -178,13 +178,27 @@ class Application_Model_Show {
* Sunday are removed.
*
* @param array p_uncheckedDays
* An array specifying which days should be removed.
* An array specifying which days should be removed. (in the local timezone)
*/
public function removeUncheckedDaysInstances($p_uncheckedDays)
{
global $CC_DBC;
$uncheckedDaysImploded = implode(",", $p_uncheckedDays);
//need to convert local doftw to UTC doftw (change made for 2.0 since shows are stored in UTC)
$daysRemovedUTC = array();
$showDays = CcShowDaysQuery::create()
->filterByDbShowId($this->getId())
->find();
foreach($showDays as $showDay) {
if (in_array($showDay->getDbDay(), $p_uncheckedDays)) {
$startDay = new DateTime("{$showDay->getDbFirstShow()} {$showDay->getDbStartTime()}", new DateTimeZone($showDay->getDbTimezone()));
$startDay->setTimezone(new DateTimeZone("UTC"));
$daysRemovedUTC[] = $startDay->format("w");
}
}
$uncheckedDaysImploded = implode(",", $daysRemovedUTC);
$showId = $this->getId();
$timestamp = gmdate("Y-m-d H:i:s");
@ -194,9 +208,6 @@ class Application_Model_Show {
." AND starts > TIMESTAMP '$timestamp'"
." AND show_id = $showId";
Logging::log("sql for removing unchecked days");
Logging::log($sql);
$CC_DBC->query($sql);
}
@ -797,6 +808,7 @@ class Application_Model_Show {
$daysRemoved = array_diff($showDaysArray, $p_data['add_show_day_check']);
if (count($daysRemoved) > 0){
$this->removeUncheckedDaysInstances($daysRemoved);
}
}

View file

@ -21,7 +21,23 @@ class Application_Model_StreamSetting {
return $ids;
}
/* Retruns only global data as array*/
public static function getGlobalData(){
global $CC_DBC;
$sql = "SELECT * "
."FROM cc_stream_setting "
."WHERE keyname IN ('output_sound_device', 'icecast_vorbis_metadata')";
$rows = $CC_DBC->getAll($sql);
$data = array();
foreach($rows as $row){
$data[$row["keyname"]] = $row["value"];
}
return $data;
}
/* Returns all information related to a specific stream. An example
* of a stream id is 's1' or 's2'. */
public static function getStreamData($p_streamId){
@ -66,7 +82,6 @@ class Application_Model_StreamSetting {
$CC_DBC->query($sql);
}
else{
var_dump($key);
$temp = explode('_', $key);
$prefix = $temp[0];
foreach($d as $k=>$v){