From dc0855de186d1f4bb4a87030afe44283d8da7d52 Mon Sep 17 00:00:00 2001 From: drigato Date: Mon, 16 Mar 2015 11:29:24 -0400 Subject: [PATCH] SAAS-643: Embed Player -> Restrict the setting of an OPUS stream --- .../application/controllers/EmbeddableplayerController.php | 7 ++++++- airtime_mvc/application/forms/EmbeddablePlayer.php | 2 ++ .../application/views/scripts/embeddableplayer/index.phtml | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/controllers/EmbeddableplayerController.php b/airtime_mvc/application/controllers/EmbeddableplayerController.php index fa37e2861..d7a16104b 100644 --- a/airtime_mvc/application/controllers/EmbeddableplayerController.php +++ b/airtime_mvc/application/controllers/EmbeddableplayerController.php @@ -11,7 +11,12 @@ class EmbeddablePlayerController extends Zend_Controller_Action { $form = new Application_Form_EmbeddablePlayer(); - $this->view->form = $form; + if ($form->getElement('player_stream_url')->getAttrib('numberOfEnabledStreams') > 0) { + $this->view->form = $form; + } else { + $this->view->errorMsg = "You need to enable at least one MP3, AAC, or OGG stream to use this feature."; + } + } public function embedCodeAction() diff --git a/airtime_mvc/application/forms/EmbeddablePlayer.php b/airtime_mvc/application/forms/EmbeddablePlayer.php index 7a89660ff..520a5318b 100644 --- a/airtime_mvc/application/forms/EmbeddablePlayer.php +++ b/airtime_mvc/application/forms/EmbeddablePlayer.php @@ -16,6 +16,7 @@ class Application_Form_EmbeddablePlayer extends Zend_Form_SubForm $streamURL = new Zend_Form_Element_Radio('player_stream_url'); $urlOptions = Array(); foreach(Application_Model_StreamSetting::getEnabledStreamUrls() as $type => $url) { + if ($type == "opus") continue; $urlOptions[$url] = $type; } $streamURL->setMultiOptions( @@ -24,6 +25,7 @@ class Application_Form_EmbeddablePlayer extends Zend_Form_SubForm $streamURL->setValue(array_keys($urlOptions)[0]); $streamURL->setLabel(_('Select stream:')); $streamURL->setAttrib('codec', array_values($urlOptions)[0]); + $streamURL->setAttrib('numberOfEnabledStreams', sizeof($urlOptions)); $this->addElement($streamURL); $url = $streamURL->getValue(); diff --git a/airtime_mvc/application/views/scripts/embeddableplayer/index.phtml b/airtime_mvc/application/views/scripts/embeddableplayer/index.phtml index 0a9e66daa..f762892b4 100644 --- a/airtime_mvc/application/views/scripts/embeddableplayer/index.phtml +++ b/airtime_mvc/application/views/scripts/embeddableplayer/index.phtml @@ -6,6 +6,7 @@
+ errorMsg; ?> form; ?>