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

This commit is contained in:
James 2011-10-22 11:34:43 -04:00
commit fb8735588d
14 changed files with 217 additions and 24 deletions

View file

@ -25,6 +25,7 @@ class ApiController extends Zend_Controller_Action
->addActionContext('register-component', 'json')
->addActionContext('update-liquidsoap-error', 'json')
->addActionContext('update-liquidsoap-connection', 'json')
->addActionContext('library-init', 'json')
->initContext();
}
@ -77,9 +78,11 @@ class ApiController extends Zend_Controller_Action
}
$this->view->calendarInit = array(
"timestamp"=>time(),
"timezoneOffset"=> date("Z"),
"timeScale"=>Application_Model_Preference::GetCalendarTimeScale()
"timestamp" => time(),
"timezoneOffset" => date("Z"),
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
"weekStartDay" => Application_Model_Preference::GetWeekStartDay()
);
}
@ -731,5 +734,25 @@ class ApiController extends Zend_Controller_Action
// setting error_msg as "" when there is no error_msg
Application_Model_StreamSetting::setLiquidsoapError($stream_id, "");
}
/**
* Sets up and send init values used in the Library.
* This is being used by library.js
*/
public function libraryInitAction(){
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
if(is_null(Zend_Auth::getInstance()->getStorage()->read())) {
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
return;
}
$this->view->libraryInit = array(
"numEntries"=>Application_Model_Preference::GetLibraryNumEntries()
);
}
}

View file

@ -15,6 +15,7 @@ class LibraryController extends Zend_Controller_Action
->addActionContext('get-file-meta-data', 'html')
->addActionContext('upload-file-soundcloud', 'json')
->addActionContext('get-upload-to-soundcloud-status', 'json')
->addActionContext('set-num-entries', 'json')
->initContext();
$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
@ -278,4 +279,14 @@ class LibraryController extends Zend_Controller_Action
$this->view->error_msg = $file->getSoundCloudErrorMsg();
}
}
/**
* Stores the number of entries user chose to show in the Library
* to the pref db
*/
public function setNumEntriesAction() {
$request = $this->getRequest();
$numEntries = $request->getParam('numEntries');
Application_Model_Preference::SetLibraryNumEntries($numEntries);
}
}

View file

@ -36,6 +36,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetStreamLabelFormat($values["preferences_general"]["streamFormat"]);
Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]);
Application_Model_Preference::SetTimezone($values["preferences_general"]["timezone"]);
Application_Model_Preference::SetWeekStartDay($values["preferences_general"]["weekStartDay"]);
Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["preferences_soundcloud"]["UseSoundCloud"]);
Application_Model_Preference::SetUploadToSoundcloudOption($values["preferences_soundcloud"]["UploadToSoundcloudOption"]);

View file

@ -29,6 +29,7 @@ class ScheduleController extends Zend_Controller_Action
->addActionContext('upload-to-sound-cloud', 'json')
->addActionContext('content-context-menu', 'json')
->addActionContext('set-time-scale', 'json')
->addActionContext('set-time-interval', 'json')
->initContext();
$this->sched_sess = new Zend_Session_Namespace("schedule");
@ -737,6 +738,14 @@ class ScheduleController extends Zend_Controller_Action
public function setTimeScaleAction() {
Application_Model_Preference::SetCalendarTimeScale($this->_getParam('timeScale'));
}
/**
* Sets the user specific preference for which time interval to use in Calendar.
* This is only being used by schedule.js at the moment.
*/
public function setTimeIntervalAction() {
Application_Model_Preference::SetCalendarTimeInterval($this->_getParam('timeInterval'));
}
}

View file

@ -65,6 +65,14 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$timezone->setValue(Application_Model_Preference::GetTimezone());
$timezone->setDecorators(array('ViewHelper'));
$this->addElement($timezone);
/* Form Element for setting which day is the start of the week */
$week_start_day = new Zend_Form_Element_Select("weekStartDay");
$week_start_day->setLabel("Week Starts On");
$week_start_day->setMultiOptions($this->getWeekStartDays());
$week_start_day->setValue(Application_Model_Preference::GetWeekStartDay());
$week_start_day->setDecorators(array('ViewHelper'));
$this->addElement($week_start_day);
}
private function getTimezones(){
@ -90,7 +98,19 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
return $tzlist;
}
private function getWeekStartDays() {
$days = array(
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
);
return $days;
}
}

View file

@ -485,6 +485,21 @@ class Application_Model_Preference
public static function GetSoundCloudDownloadbleOption() {
return self::GetValue("soundcloud_downloadable");
}
public static function SetWeekStartDay($day) {
self::SetValue("week_start_day", $day);
}
public static function GetWeekStartDay() {
$val = self::GetValue("week_start_day");
if (strlen($val) == 0){
return "0";
} else {
return $val;
}
}
/* User specific preferences start */
/**
* Sets the time scale preference (day/week/month) in Calendar.
@ -501,5 +516,39 @@ class Application_Model_Preference
public static function GetCalendarTimeScale() {
return self::GetValue("calendar_time_scale", true /* user specific */);
}
/**
* Sets the number of entries to show preference in library under Playlist Builder.
*
* @param $numEntries new number of entries to show
*/
public static function SetLibraryNumEntries($numEntries) {
return self::SetValue("library_num_entries", $numEntries, true /* user specific */);
}
/**
* Retrieves the number of entries to show preference in library under Playlist Builder.
*/
public static function GetLibraryNumEntries() {
return self::GetValue("library_num_entries", true /* user specific */);
}
/**
* Sets the time interval preference in Calendar.
*
* @param $timeInterval new time interval
*/
public static function SetCalendarTimeInterval($timeInterval) {
return self::SetValue("calendar_time_interval", $timeInterval, true /* user specific */);
}
/**
* Retrieves the time interval preference for the current user.
*/
public static function GetCalendarTimeInterval() {
return self::GetValue("calendar_time_interval", true /* user specific */);
}
/* User specific preferences end */
}

View file

@ -443,7 +443,7 @@ class Application_Model_StoredFile {
$serverName = $_SERVER['SERVER_NAME'];
$serverPort = $_SERVER['SERVER_PORT'];
return constructGetFileUrl($serverName, $serverPort);
return $this->constructGetFileUrl($serverName, $serverPort);
}
/**
@ -456,7 +456,7 @@ class Application_Model_StoredFile {
$serverName = $CC_CONFIG['baseUrl'];
$serverPort = $CC_CONFIG['basePort'];
return constructGetFileUrl($serverName, $serverPort);
return $this->constructGetFileUrl($serverName, $serverPort);
}
private function constructGetFileUrl($p_serverName, $p_serverPort){

View file

@ -42,7 +42,7 @@ $(document).ready(function(){
?>
});
</script>
<div class="jp-logo"><img id="logo-img" onload='resizeToMaxHeight(this, 67);' src="<?php echo $this->logo ?>" /></div>
<div class="jp-logo"><img id="logo-img" onload='resizeToMaxHeight(this, 40);' src="<?php echo $this->logo ?>" /></div>
<div class="jp-stream">
<div class="jp-stream-text">Select stream:</div>

View file

@ -72,7 +72,7 @@
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dd>
<dt id="timezone-label" class="block-display">
<label class="required" for="timezone"><?php echo $this->element->getElement('timezone')->getLabel() ?>
<span class="info-text-small">(Required)</span> :
@ -88,5 +88,32 @@
</ul>
<?php endif; ?>
</dd>
<!-- Week Start Day option -->
<dt id="weekStartDay-label" class="block-display">
<label class="required" for="timezone"><?php echo $this->element->getElement('weekStartDay')->getLabel() ?>:
</label>
</dt>
<dd id="weekStartDay-element" class="block-display">
<?php $i=0;
$value = $this->element->getElement('weekStartDay')->getValue();
?>
<select id="weekStartDay" name="weekStartDay">
<?php foreach ($this->element->getElement('weekStartDay')->getMultiOptions() as $option) : ?>
<option value="<?php echo $i ?>" <?php if($i == $value){echo 'selected="selected"';}?> >
<?php echo $option ?>
</option>
<?php $i = $i + 1; ?>
<?php endforeach; ?>
</select>
<?php if($this->element->getElement('weekStartDay')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('weekStartDay')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl>
</fieldset>

View file

@ -75,7 +75,7 @@
}
label.wrapp-label input[type="checkbox"] {
float:left;
margin:-1px 4px 0 0;
margin:-1px 2px 0 0;
}
#schedule-add-show fieldset:last-child {
@ -91,7 +91,7 @@ label.wrapp-label input[type="checkbox"] {
#add_show_day_check-element.block-display label.wrapp-label {
font-size:12px;
float:left;
margin-right:5px;
margin-right:10px;
}
#add_show_name-element .input_text {
/*width:99%;*/

View file

@ -279,11 +279,20 @@ function addMetadataQtip(){
})
}
$(document).ready(function() {
/**
* Use user preference for number of entries to show;
* defaults to 10 if preference was never set
*/
function getNumEntriesPreference(data) {
var numEntries = data.libraryInit.numEntries;
if(numEntries == '') {
numEntries = '10';
}
return parseInt(numEntries);
}
$('.tabs').tabs();
$('#library_display').dataTable( {
function createDataTable(data) {
var dTable = $('#library_display').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/Library/contents/format/json",
@ -313,8 +322,28 @@ $(document).ready(function() {
"bAutoWidth": false,
"oLanguage": {
"sSearch": ""
}
}).fnSetFilteringDelay(350);
},
"iDisplayLength": getNumEntriesPreference(data)
});
dTable.fnSetFilteringDelay(350);
// Updates pref db when user changes the # of entries to show
$('select[name=library_display_length]').change(function() {
var url = '/Library/set-num-entries/format/json';
$.post(url, {numEntries: $(this).val()},
function(json){
if(json.error) {
alert(json.error);
}
});
});
}
$(document).ready(function() {
$('.tabs').tabs();
$.ajax({ url: "/Api/library-init/format/json", dataType:"json", success:createDataTable
, error:function(jqXHR, textStatus, errorThrown){}});
checkImportStatus()
setInterval( "checkImportStatus()", 5000 );

View file

@ -13,7 +13,7 @@ function setWatchedDirEvents() {
//knownPaths: [{text:'Desktop', image:'desktop.png', path:'/home'}],
knownPaths: [],
imageUrl: 'img/icons/',
systemImageUrl: 'img/browser/',
systemImageUrl: '/css/img/',
handlerUrl: '/Preference/server-browse/format/json',
title: 'Choose Storage Folder',
basePath: '',

View file

@ -308,6 +308,17 @@ function getTimeScalePreference(data) {
return timeScale;
}
/**
* Use user preference for time interval; defaults to 30m if preference was never set
*/
function getTimeIntervalPreference(data) {
var timeInterval = data.calendarInit.timeInterval;
if(timeInterval == '') {
timeInterval = '30';
}
return parseInt(timeInterval);
}
function createFullCalendar(data){
serverTimezoneOffset = data.calendarInit.timezoneOffset;
@ -321,6 +332,8 @@ function createFullCalendar(data){
right: 'agendaDay, agendaWeek, month'
},
defaultView: getTimeScalePreference(data),
slotMinutes: getTimeIntervalPreference(data),
firstDay: data.calendarInit.weekStartDay,
editable: false,
allDaySlot: false,
axisFormat: 'H:mm',
@ -347,7 +360,7 @@ function createFullCalendar(data){
//Update time scale preference when day/week/month button is clicked
$(".fc-button-content").click(function() {
url = '/Schedule/set-time-scale/format/json';
var url = '/Schedule/set-time-scale/format/json';
$.post(url, {timeScale: $(this).text()},
function(json){
if(json.error) {
@ -355,6 +368,17 @@ function createFullCalendar(data){
}
});
});
//Update time interval preference when dropdown is updated
$(".schedule_change_slots.input_select").change(function() {
var url = '/Schedule/set-time-interval/format/json';
$.post(url, {timeInterval: $(this).val()},
function(json){
if(json.error) {
alert(json.error);
}
});
});
}
$(window).load(function() {

View file

@ -126,7 +126,12 @@ def airtime_182_tar():
reboot(45)
sudo('airtime-check-system')
def airtime_182_deb():
def airtime_194_tar():
run('wget http://downloads.sourceforge.net/project/airtime/1.9.4/airtime-1.9.4.tar.gz')
run('tar xfz airtime-1.9.4.tar.gz')
sudo('cd ~/airtime-1.9.4/install_full/ubuntu && ./airtime-full-install')
def airtime_latest_deb():
append('/etc/apt/sources.list', "deb http://apt.sourcefabric.org/ lucid main", use_sudo=True)
append('/etc/apt/sources.list', "deb http://archive.ubuntu.com/ubuntu/ lucid multiverse", use_sudo=True)
sudo('apt-get update')
@ -135,11 +140,6 @@ def airtime_182_deb():
sudo('apt-get install -y icecast2')
sudo('apt-get purge -y pulseaudio')
sudo('apt-get install -y --force-yes airtime')
def airtime_194_tar():
run('wget http://downloads.sourceforge.net/project/airtime/1.9.4/airtime-1.9.4.tar.gz')
run('tar xfz airtime-1.9.4.tar.gz')
sudo('cd ~/airtime-1.9.4/install_full/ubuntu && ./airtime-full-install')
def airtime_devel():
sudo('apt-get update')