Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
fb8735588d
14 changed files with 217 additions and 24 deletions
|
@ -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()
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"]);
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
}
|
||||
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue