Merge branch 'devel' into CC-3174

This commit is contained in:
Naomi Aro 2012-04-10 15:57:13 +02:00
commit b998a04c2e
40 changed files with 354 additions and 234 deletions

View file

@ -58,7 +58,8 @@ class ApiController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(true);
$api_key = $this->_getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -333,7 +334,8 @@ class ApiController extends Zend_Controller_Action
$api_key = $this->_getParam('api_key');
if(!in_array($api_key, $CC_CONFIG["apiKey"]))
if(!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource. ';
@ -355,7 +357,8 @@ class ApiController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(true);
$api_key = $this->_getParam('api_key');
if(!in_array($api_key, $CC_CONFIG["apiKey"]))
if(!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -378,7 +381,8 @@ class ApiController extends Zend_Controller_Action
global $CC_CONFIG;
$api_key = $this->_getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -411,7 +415,8 @@ class ApiController extends Zend_Controller_Action
global $CC_CONFIG;
$api_key = $this->_getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -435,7 +440,8 @@ class ApiController extends Zend_Controller_Action
global $CC_CONFIG;
$api_key = $this->_getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -542,7 +548,8 @@ class ApiController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(true);
$api_key = $this->_getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -564,7 +571,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -667,7 +675,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -683,7 +692,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -711,7 +721,8 @@ class ApiController extends Zend_Controller_Action
$api_key = $request->getParam('api_key');
$path = base64_decode($request->getParam('path'));
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -728,7 +739,8 @@ class ApiController extends Zend_Controller_Action
$api_key = $request->getParam('api_key');
$path = base64_decode($request->getParam('path'));
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -745,7 +757,8 @@ class ApiController extends Zend_Controller_Action
$api_key = $request->getParam('api_key');
$path = base64_decode($request->getParam('path'));
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -760,7 +773,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -777,14 +791,13 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
$getDiskInfo = $request->getParam('diskinfo') == "true";
/*
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
exit;
}
*/
$status = array(
"platform"=>Application_Model_Systemstatus::GetPlatformInfo(),
@ -846,7 +859,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -926,7 +940,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -945,7 +960,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -979,7 +995,8 @@ class ApiController extends Zend_Controller_Action
$password = $request->getParam('password');
$djtype = $request->getParam('djtype');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';

View file

@ -142,7 +142,6 @@ class PreferenceController extends Zend_Controller_Action
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
// get current settings
$temp = Application_Model_StreamSetting::getStreamSetting();
@ -236,7 +235,7 @@ class PreferenceController extends Zend_Controller_Action
$live_stream_subform->updateConnectionURLs();
}
$this->view->confirm_pypo_restart_text = "Updating settings will temporarily interrupt any currently playing shows. Click \'OK\' to continue.";
$this->view->confirm_pypo_restart_text = "If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings).";
$this->view->num_stream = $num_of_stream;
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
@ -261,16 +260,18 @@ class PreferenceController extends Zend_Controller_Action
else
{
$path = $path.'/';
$handle = opendir($path);
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
//only show directories that aren't private.
if (is_dir($path.$file) && substr($file, 0, 1) != ".") {
$element = array();
$element["name"] = $file;
$element["isFolder"] = true;
$element["isError"] = false;
$result[$file] = $element;
$handle = opendir($path);
if ($handle !== false){
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
//only show directories that aren't private.
if (is_dir($path.$file) && substr($file, 0, 1) != ".") {
$element = array();
$element["name"] = $file;
$element["isFolder"] = true;
$element["isError"] = false;
$result[$file] = $element;
}
}
}
}

View file

@ -28,6 +28,8 @@ class ScheduleController extends Zend_Controller_Action
->addActionContext('content-context-menu', 'json')
->addActionContext('set-time-scale', 'json')
->addActionContext('set-time-interval', 'json')
->addActionContext('edit-show-instance', 'json')
->addActionContext('dj-edit-show', 'json')
->initContext();
$this->sched_sess = new Zend_Session_Namespace("schedule");
@ -52,7 +54,6 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
@ -88,6 +89,9 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
if($user->isUserType(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)){
$this->view->preloadShowForm = true;
}
$this->view->headScript()->appendScript("var weekStart = ".Application_Model_Preference::GetWeekStartDay().";");
}
@ -429,6 +433,7 @@ class ScheduleController extends Zend_Controller_Action
$this->view->percentFilled = $show->getPercentScheduled();
$this->view->showContent = $show->getShowListContent();
$this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml');
$this->view->showTitle = $show->getName();
unset($this->view->showContent);
}
@ -444,6 +449,10 @@ class ScheduleController extends Zend_Controller_Action
// repeating shows. It's value is either "instance","rebroadcast", or "all"
$type = $this->_getParam('type');
if ($type == "instance"){
$this->view->action = "edit-show-instance";
}
try{
$showInstance = new Application_Model_ShowInstance($showInstanceId);
}catch(Exception $e){
@ -457,6 +466,10 @@ class ScheduleController extends Zend_Controller_Action
if(!($isAdminOrPM || $isDJ)) {
return;
}
if($isDJ){
$this->view->action = "dj-edit-show";
}
$formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho();
@ -604,10 +617,50 @@ class ScheduleController extends Zend_Controller_Action
}
public function getFormAction(){
Application_Model_Schedule::createNewFormSections($this->view);
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
if($user->isUserType(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)){
Application_Model_Schedule::createNewFormSections($this->view);
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
}
}
public function editShowInstanceAction(){
$js = $this->_getParam('data');
$data = array();
//need to convert from serialized jQuery array.
foreach($js as $j){
$data[$j["name"]] = $j["value"];
}
}
public function djEditShowAction(){
$js = $this->_getParam('data');
$data = array();
//need to convert from serialized jQuery array.
foreach($js as $j){
$data[$j["name"]] = $j["value"];
}
//update cc_show
$show = new Application_Model_Show($data["add_show_id"]);
$show->setAirtimeAuthFlag($data["cb_airtime_auth"]);
$show->setCustomAuthFlag($data["cb_custom_auth"]);
$show->setCustomUsername($data["custom_username"]);
$show->setCustomPassword($data["custom_password"]);
$this->view->edit = true;
}
//for 2.2
/*
public function editShowAction(){
}
*/
public function addShowAction()
{
$js = $this->_getParam('data');
@ -619,13 +672,6 @@ class ScheduleController extends Zend_Controller_Action
}
$show = new Application_Model_Show($data['add_show_id']);
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$isDJ = $user->isHost($show->getId());
$startDateModified = true;
if ($data['add_show_id'] != -1 && !array_key_exists('add_show_start_date', $data)){
//show is being updated and changing the start date was disabled, since the
@ -642,6 +688,11 @@ class ScheduleController extends Zend_Controller_Action
if($data['add_show_day_check'] == "") {
$data['add_show_day_check'] = null;
}
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$isDJ = $user->isHost($show->getId());
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$record = false;
@ -785,7 +836,7 @@ class ScheduleController extends Zend_Controller_Action
if (!$startDateModified){
$formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true));
}
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
}