Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
f1e1b747ad
|
@ -18,7 +18,11 @@ class NowplayingController extends Zend_Controller_Action
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js','text/javascript');
|
$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/nowplayingdatagrid.js','text/javascript');
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowview.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowview.js','text/javascript');
|
||||||
|
|
||||||
$refer_sses = new Zend_Session_Namespace('referrer');
|
$refer_sses = new Zend_Session_Namespace('referrer');
|
||||||
|
@ -104,7 +108,11 @@ class NowplayingController extends Zend_Controller_Action
|
||||||
$baseUrl = $request->getBaseUrl();
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js','text/javascript');
|
$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/nowplayingdatagrid.js','text/javascript');
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/dayview.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/dayview.js','text/javascript');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,6 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
|
|
||||||
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
|
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
|
||||||
}
|
}
|
||||||
var_dump($form->getValue('icecast_vorbis_metadata'));
|
|
||||||
if(!$error){
|
if(!$error){
|
||||||
Application_Model_StreamSetting::setStreamSetting($values);
|
Application_Model_StreamSetting::setStreamSetting($values);
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
|
@ -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/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/timepicker/jquery.ui.timepicker-0.0.6.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/colorpicker/js/colorpicker.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/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/airtime/schedule/schedule.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js','text/javascript');
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,9 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
||||||
// which is something we don't want
|
// which is something we don't want
|
||||||
'allowEmpty' => false,
|
'allowEmpty' => false,
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
new PasswordNotEmpty(array('UploadToSoundcloudOption'=>'1'))
|
new ConditionalNotEmpty(array('UploadToSoundcloudOption'=>'1'))
|
||||||
)
|
),
|
||||||
|
'renderPassword' => true
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add the description element
|
// Add the description element
|
||||||
|
|
|
@ -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 = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
|
||||||
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Meatadata')
|
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')
|
||||||
->setRequired(false)
|
->setRequired(false)
|
||||||
->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0)
|
->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0)
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
|
|
|
@ -1538,23 +1538,44 @@ class Application_Model_Show {
|
||||||
return $event;
|
return $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setShowFirstShow($s_date){
|
/* Takes in a UTC DateTime object.
|
||||||
|
* Converts this to local time, since cc_show days
|
||||||
|
* requires local time. */
|
||||||
|
public function setShowFirstShow($p_dt){
|
||||||
|
|
||||||
|
//clone object since we are modifying it and it was passed by reference.
|
||||||
|
$dt = clone $p_dt;
|
||||||
|
|
||||||
|
$dt->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
|
||||||
$showDay = CcShowDaysQuery::create()
|
$showDay = CcShowDaysQuery::create()
|
||||||
->filterByDbShowId($this->_showId)
|
->filterByDbShowId($this->_showId)
|
||||||
->findOne();
|
->findOne();
|
||||||
|
|
||||||
$showDay->setDbFirstShow($s_date)
|
$showDay->setDbFirstShow($dt)
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
Logging::log("setting show's first show.");
|
Logging::log("setting show's first show.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setShowLastShow($e_date){
|
/* Takes in a UTC DateTime object
|
||||||
|
* Converts this to local time, since cc_show days
|
||||||
|
* requires local time. */
|
||||||
|
public function setShowLastShow($p_dt){
|
||||||
|
|
||||||
|
//clone object since we are modifying it and it was passed by reference.
|
||||||
|
$dt = clone $p_dt;
|
||||||
|
|
||||||
|
$dt->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
|
||||||
|
//add one day since the Last Show date in CcShowDays is non-inclusive.
|
||||||
|
$dt->add(new DateInterval("P1D"));
|
||||||
|
|
||||||
$showDay = CcShowDaysQuery::create()
|
$showDay = CcShowDaysQuery::create()
|
||||||
->filterByDbShowId($this->_showId)
|
->filterByDbShowId($this->_showId)
|
||||||
->findOne();
|
->findOne();
|
||||||
|
|
||||||
$showDay->setDbLastShow($e_date)
|
$showDay->setDbLastShow($dt)
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1573,7 +1594,8 @@ class Application_Model_Show {
|
||||||
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
|
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
|
||||||
." WHERE si.show_id = s.id"
|
." WHERE si.show_id = s.id"
|
||||||
." AND si.starts <= TIMESTAMP '$timeNow'"
|
." AND si.starts <= TIMESTAMP '$timeNow'"
|
||||||
." AND si.ends > TIMESTAMP '$timeNow'";
|
." AND si.ends > TIMESTAMP '$timeNow'"
|
||||||
|
." AND modified_instance != TRUE";
|
||||||
|
|
||||||
// Convert back to local timezone
|
// Convert back to local timezone
|
||||||
$rows = $CC_DBC->GetAll($sql);
|
$rows = $CC_DBC->GetAll($sql);
|
||||||
|
@ -1611,6 +1633,7 @@ class Application_Model_Show {
|
||||||
." WHERE si.show_id = s.id"
|
." WHERE si.show_id = s.id"
|
||||||
." AND si.starts >= TIMESTAMP '$timeStart'"
|
." AND si.starts >= TIMESTAMP '$timeStart'"
|
||||||
." AND si.starts < TIMESTAMP $timeEnd"
|
." AND si.starts < TIMESTAMP $timeEnd"
|
||||||
|
." AND modified_instance != TRUE"
|
||||||
." ORDER BY si.starts";
|
." ORDER BY si.starts";
|
||||||
|
|
||||||
// defaults to retrieve all shows within the interval if $limit not set
|
// defaults to retrieve all shows within the interval if $limit not set
|
||||||
|
@ -1633,6 +1656,9 @@ class Application_Model_Show {
|
||||||
public static function ConvertToLocalTimeZone(&$rows, $columnsToConvert) {
|
public static function ConvertToLocalTimeZone(&$rows, $columnsToConvert) {
|
||||||
$timezone = date_default_timezone_get();
|
$timezone = date_default_timezone_get();
|
||||||
|
|
||||||
|
if (!is_array($rows)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
foreach($rows as &$row) {
|
foreach($rows as &$row) {
|
||||||
foreach($columnsToConvert as $column) {
|
foreach($columnsToConvert as $column) {
|
||||||
$row[$column] = Application_Model_DateHelper::ConvertToLocalDateTimeString($row[$column]);
|
$row[$column] = Application_Model_DateHelper::ConvertToLocalDateTimeString($row[$column]);
|
||||||
|
|
|
@ -29,6 +29,10 @@ class Application_Model_ShowInstance {
|
||||||
return new Application_Model_Show($this->getShowId());
|
return new Application_Model_Show($this->getShowId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function is weird. It should return a boolean, but instead returns
|
||||||
|
* an integer if it is a rebroadcast, or returns null if it isn't. You can convert
|
||||||
|
* it to boolean by using is_null(isRebroadcast), where true means isn't and false
|
||||||
|
* means that it is. */
|
||||||
public function isRebroadcast()
|
public function isRebroadcast()
|
||||||
{
|
{
|
||||||
return $this->_showInstance->getDbOriginalShow();
|
return $this->_showInstance->getDbOriginalShow();
|
||||||
|
@ -231,9 +235,9 @@ class Application_Model_ShowInstance {
|
||||||
$this->correctScheduleStartTimes();
|
$this->correctScheduleStartTimes();
|
||||||
|
|
||||||
$show = new Application_Model_Show($this->getShowId());
|
$show = new Application_Model_Show($this->getShowId());
|
||||||
if(!$show->isRepeating()){
|
if(!$show->isRepeating() && is_null($this->isRebroadcast())){
|
||||||
$show->setShowFirstShow($new_starts);
|
$show->setShowFirstShow($newStartsDateTime);
|
||||||
$show->setShowLastShow($new_ends);
|
$show->setShowLastShow($newEndsDateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
Application_Model_RabbitMq::PushSchedule();
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
|
|
@ -21,7 +21,23 @@ class Application_Model_StreamSetting {
|
||||||
|
|
||||||
return $ids;
|
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
|
/* Returns all information related to a specific stream. An example
|
||||||
* of a stream id is 's1' or 's2'. */
|
* of a stream id is 's1' or 's2'. */
|
||||||
public static function getStreamData($p_streamId){
|
public static function getStreamData($p_streamId){
|
||||||
|
@ -66,7 +82,6 @@ class Application_Model_StreamSetting {
|
||||||
$CC_DBC->query($sql);
|
$CC_DBC->query($sql);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
var_dump($key);
|
|
||||||
$temp = explode('_', $key);
|
$temp = explode('_', $key);
|
||||||
$prefix = $temp[0];
|
$prefix = $temp[0];
|
||||||
foreach($d as $k=>$v){
|
foreach($d as $k=>$v){
|
||||||
|
|
|
@ -6,3 +6,16 @@ $(document).ready(function() {
|
||||||
savePanelSpace: true
|
savePanelSpace: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function adjustDateToServerDate(date, serverTimezoneOffset){
|
||||||
|
//date object stores time in the browser's localtime. We need to artificially shift
|
||||||
|
//it to
|
||||||
|
var timezoneOffset = date.getTimezoneOffset()*60*1000;
|
||||||
|
|
||||||
|
date.setTime(date.getTime() + timezoneOffset + serverTimezoneOffset*1000);
|
||||||
|
|
||||||
|
/* date object has been shifted to artificial UTC time. Now let's
|
||||||
|
* shift it to the server's timezone */
|
||||||
|
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ $(document).ready(function() {
|
||||||
$("#datepicker").datepicker({
|
$("#datepicker").datepicker({
|
||||||
onSelect: function(dateText, inst)
|
onSelect: function(dateText, inst)
|
||||||
{ getData();}});
|
{ getData();}});
|
||||||
$("#datepicker").datepicker("setDate", new Date());
|
$("#datepicker").datepicker("setDate", adjustDateToServerDate(new Date(), timezoneOffset));
|
||||||
} else {
|
} else {
|
||||||
$('#day_view').click(function(){redirect('/Nowplaying/day-view')});
|
$('#day_view').click(function(){redirect('/Nowplaying/day-view')});
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,10 @@ function startDpSelect(dateText, inst) {
|
||||||
|
|
||||||
function endDpSelect(dateText, inst) {
|
function endDpSelect(dateText, inst) {
|
||||||
var time, date;
|
var time, date;
|
||||||
|
|
||||||
time = dateText.split("-");
|
time = dateText.split("-");
|
||||||
date = new Date(time[0], time[1] - 1, time[2]);
|
date = new Date(time[0], time[1] - 1, time[2]);
|
||||||
|
|
||||||
//$("#add_show_start_date").datepicker( "option", "maxDate", date);
|
|
||||||
if (inst.input)
|
if (inst.input)
|
||||||
inst.input.trigger('change');
|
inst.input.trigger('change');
|
||||||
}
|
}
|
||||||
|
@ -32,7 +31,7 @@ function createDateInput(el, onSelect) {
|
||||||
var date;
|
var date;
|
||||||
|
|
||||||
el.datepicker({
|
el.datepicker({
|
||||||
minDate: new Date(),
|
minDate: adjustDateToServerDate(new Date(), timezoneOffset),
|
||||||
onSelect: onSelect,
|
onSelect: onSelect,
|
||||||
dateFormat: 'yy-mm-dd'
|
dateFormat: 'yy-mm-dd'
|
||||||
});
|
});
|
||||||
|
@ -188,7 +187,7 @@ function setAddShowEvents() {
|
||||||
});
|
});
|
||||||
|
|
||||||
form.find('input[name^="add_show_rebroadcast_date_absolute"]').datepicker({
|
form.find('input[name^="add_show_rebroadcast_date_absolute"]').datepicker({
|
||||||
minDate: new Date(),
|
minDate: adjustDateToServerDate(new Date(), timezoneOffset),
|
||||||
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({
|
||||||
|
|
|
@ -75,19 +75,6 @@ function makeTimeStamp(date){
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
function adjustDateToServerDate(date, serverTimezoneOffset){
|
|
||||||
//date object stores time in the browser's localtime. We need to artificially shift
|
|
||||||
//it to
|
|
||||||
var timezoneOffset = date.getTimezoneOffset()*60*1000;
|
|
||||||
|
|
||||||
date.setTime(date.getTime() + timezoneOffset + serverTimezoneOffset*1000);
|
|
||||||
|
|
||||||
/* date object has been shifted to artificial UTC time. Now let's
|
|
||||||
* shift it to the server's timezone */
|
|
||||||
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
|
|
||||||
function pad(number, length) {
|
function pad(number, length) {
|
||||||
var str = '' + number;
|
var str = '' + number;
|
||||||
while (str.length < length) {
|
while (str.length < length) {
|
||||||
|
@ -101,7 +88,7 @@ function dayClick(date, allDay, jsEvent, view) {
|
||||||
var now, today, selected, chosenDate, chosenTime;
|
var now, today, selected, chosenDate, chosenTime;
|
||||||
|
|
||||||
now = adjustDateToServerDate(new Date(), serverTimezoneOffset);
|
now = adjustDateToServerDate(new Date(), serverTimezoneOffset);
|
||||||
|
|
||||||
if(view.name === "month") {
|
if(view.name === "month") {
|
||||||
today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||||
selected = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
selected = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
||||||
|
|
|
@ -50,7 +50,7 @@ martin@Thinkpad-T410:~/workspace/airtime/airtime_mvc/public/js/fullcalendar$ dif
|
||||||
+})(jQuery);
|
+})(jQuery);
|
||||||
|
|
||||||
|
|
||||||
adjustDateToServerDate() function is defined in "js/airtime/schedule/full-calendar-functions.js"
|
adjustDateToServerDate() function is defined in "js/airtime/common/common.js"
|
||||||
|
|
||||||
Please make this change before updating!!!
|
Please make this change before updating!!!
|
||||||
|
|
||||||
|
|
|
@ -38,14 +38,14 @@ echo -e "\n*** Creating Virtualenv for Airtime ***"
|
||||||
EXTRAOPTION=$(virtualenv --help | grep extra-search-dir)
|
EXTRAOPTION=$(virtualenv --help | grep extra-search-dir)
|
||||||
|
|
||||||
if [ "$?" -eq "0" ]; then
|
if [ "$?" -eq "0" ]; then
|
||||||
virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv || exit 1
|
virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv 2>/dev/null || exit 1
|
||||||
else
|
else
|
||||||
# copy distribute-0.6.10.tar.gz to /usr/share/python-virtualenv/
|
# copy distribute-0.6.10.tar.gz to /usr/share/python-virtualenv/
|
||||||
# this is due to the bug in virtualenv 1.4.9
|
# this is due to the bug in virtualenv 1.4.9
|
||||||
if [ -d "$VIRTUAL_ENV_SHARE" ]; then
|
if [ -d "$VIRTUAL_ENV_SHARE" ]; then
|
||||||
cp ${SCRIPTPATH}/3rd_party/distribute-0.6.10.tar.gz /usr/share/python-virtualenv/
|
cp ${SCRIPTPATH}/3rd_party/distribute-0.6.10.tar.gz /usr/share/python-virtualenv/
|
||||||
fi
|
fi
|
||||||
virtualenv --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv || exit 1
|
virtualenv --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv 2>/dev/null || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n*** Installing Python Libraries ***"
|
echo -e "\n*** Installing Python Libraries ***"
|
||||||
|
|
Loading…
Reference in New Issue