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

View file

@ -36,8 +36,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -8,7 +8,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
{
$description1 = "This follows the same security pattern for the shows: if no users are explicitly set for the show, then anyone with a valid airtime login can connect to the stream, otherwise if there are users assigned to the show, then only those users can connect.";
$cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth");
$cb_airtime_auth->setLabel("Connect using Airtime username & password")
$cb_airtime_auth->setLabel("Use Airtime Authentication")
->setDescription($description1)
->setRequired(false)
->setDecorators(array('ViewHelper'));
@ -16,7 +16,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
$description2 = "Specifiy custom athentification which will work for only the show.";
$cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth");
$cb_custom_auth ->setLabel("Custom")
$cb_custom_auth ->setLabel("Use Custom Authentication")
->setDescription($description2)
->setRequired(false)
->setDecorators(array('ViewHelper'));

View file

@ -24,8 +24,7 @@ class Application_Form_AddShowRR extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -41,8 +41,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -62,8 +62,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -40,8 +40,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -66,8 +66,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -119,8 +119,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}
@ -129,8 +128,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$element = $this->getElement('add_show_repeats');
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -33,8 +33,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -87,7 +87,8 @@ class Application_Form_EditAudioMD extends Zend_Form
$this->addElement('text', 'bpm', array(
'label' => 'BPM:',
'class' => 'input_text',
'filters' => array('StringTrim')
'filters' => array('StringTrim'),
'validators' => array(array('StringLength', false, array(0, 8)))
));
// Add copyright field

View file

@ -11,7 +11,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$defaultFade = Application_Model_Preference::GetDefaultFade();
if($defaultFade == ""){
$defaultFade = '00.000000';
$defaultFade = '0.500000';
}
//Station name

View file

@ -21,6 +21,30 @@ class Application_Model_Show {
$show->setDbName($name);
Application_Model_RabbitMq::PushSchedule();
}
public function setAirtimeAuthFlag($flag){
$show = CcShowQuery::create()->findPK($this->_showId);
$show->setDbLiveStreamUsingAirtimeAuth($flag);
$show->save();
}
public function setCustomAuthFlag($flag){
$show = CcShowQuery::create()->findPK($this->_showId);
$show->setDbLiveStreamUsingCustomAuth($flag);
$show->save();
}
public function setCustomUsername($username){
$show = CcShowQuery::create()->findPK($this->_showId);
$show->setDbLiveStreamUser($username);
$show->save();
}
public function setCustomPassword($password){
$show = CcShowQuery::create()->findPK($this->_showId);
$show->setDbLiveStreamPass($password);
$show->save();
}
public function getDescription()
{

View file

@ -1,7 +1,7 @@
<div id="schedule-add-show" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded">
<div class="button-bar">
<a href="#" id="add-show-close" class="icon-link"><span class="ui-icon ui-icon-circle-close"></span>Close</a>
<button aria-disabled="false" role="button" class="add-show-submit right-floated ui-button ui-widget ui-state-default ui-button-text-icon-primary">
<button data-action="<?php echo isset($this->action) ? $this->action : "add-show" ?>" aria-disabled="false" role="button" class="add-show-submit right-floated ui-button ui-widget ui-state-default ui-button-text-icon-primary">
<span class="ui-icon ui-icon-plusthick"></span>
<span class="ui-button-text"><?php echo ($this->addNewShow ? "Add this show" : "Update show"); ?></span>
</button>
@ -37,7 +37,7 @@
<?php echo $this->style; ?>
</div>
<div class="button-bar bottom">
<button aria-disabled="false" role="button" class="add-show-submit right-floated ui-button ui-widget ui-state-default ui-button-text-icon-primary">
<button data-action="<?php echo isset($this->action) ? $this->action : "add-show" ?>" aria-disabled="false" role="button" class="add-show-submit right-floated ui-button ui-widget ui-state-default ui-button-text-icon-primary">
<span class="ui-icon ui-icon-plusthick"></span>
<span class="ui-button-text"><?php echo ($this->addNewShow ? "Add this show" : "Update show"); ?></span>
</button>

View file

@ -1,5 +1,7 @@
<form id="add-show-form" method="post" action="" style="display:none;">
<?php echo $this->render('schedule/add-show-form.phtml') ?>
<?php if($this->preloadShowForm){
echo $this->render('schedule/add-show-form.phtml');
}?>
</form>
<div id='schedule_calendar' class="ui-widget-content block-shadow padded omega-block"></div>