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'));
}
}