From 701ed82f400e419756994c3b32e7f9f82eb0b8a3 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 8 Feb 2012 00:04:19 -0500 Subject: [PATCH] CC-3224: "On-the-fly" stream rebroadcasting - interface implementation. subform within the show form. --- .../controllers/PreferenceController.php | 4 ++ .../controllers/ScheduleController.php | 7 +++ .../application/forms/AddShowLiveStream.php | 62 +++++++++++++++++++ .../forms/LiveStreamingPreferences.php | 13 ++-- airtime_mvc/application/models/Preference.php | 2 +- airtime_mvc/application/models/Schedule.php | 21 ++++--- .../scripts/form/add-show-live-stream.phtml | 59 ++++++++++++++++++ .../scripts/form/preferences_livestream.phtml | 6 +- .../scripts/schedule/add-show-form.phtml | 4 ++ .../js/airtime/preferences/preferences.js | 7 ++- 10 files changed, 164 insertions(+), 21 deletions(-) create mode 100644 airtime_mvc/application/forms/AddShowLiveStream.php create mode 100644 airtime_mvc/application/views/scripts/form/add-show-live-stream.phtml diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 6c59c4eca..f9b2009a7 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -47,6 +47,10 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetSoundCloudTags($values["preferences_soundcloud"]["SoundCloudTags"]); Application_Model_Preference::SetSoundCloudGenre($values["preferences_soundcloud"]["SoundCloudGenre"]); Application_Model_Preference::SetSoundCloudTrackType($values["preferences_soundcloud"]["SoundCloudTrackType"]); + + Application_Model_Preference::SetLiveSteamAutoEnable($values["preferences_livestream"]["auto_enable_live_stream"]); + Application_Model_Preference::SetLiveSteamMasterUsername($values["preferences_livestream"]["master_username"]); + Application_Model_Preference::SetLiveSteamMasterPassword($values["preferences_livestream"]["master_password"]); Application_Model_Preference::SetSoundCloudLicense($values["preferences_soundcloud"]["SoundCloudLicense"]); diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index a97471759..430ba5bca 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -411,6 +411,7 @@ class ScheduleController extends Zend_Controller_Action $formWhen = new Application_Form_AddShowWhen(); $formRepeats = new Application_Form_AddShowRepeats(); $formStyle = new Application_Form_AddShowStyle(); + $formLive = new Application_Form_AddShowLiveStream(); $formWhat->removeDecorator('DtDdWrapper'); $formWho->removeDecorator('DtDdWrapper'); @@ -423,6 +424,7 @@ class ScheduleController extends Zend_Controller_Action $this->view->repeats = $formRepeats; $this->view->who = $formWho; $this->view->style = $formStyle; + $this->view->live = $formLive; $this->view->addNewShow = false; $show = new Application_Model_Show($showInstance->getShowId()); @@ -564,12 +566,14 @@ class ScheduleController extends Zend_Controller_Action $formWhen = new Application_Form_AddShowWhen(); $formRepeats = new Application_Form_AddShowRepeats(); $formStyle = new Application_Form_AddShowStyle(); + $formLive = new Application_Form_AddShowLiveStream(); $formWhat->removeDecorator('DtDdWrapper'); $formWho->removeDecorator('DtDdWrapper'); $formWhen->removeDecorator('DtDdWrapper'); $formRepeats->removeDecorator('DtDdWrapper'); $formStyle->removeDecorator('DtDdWrapper'); + $formLive->removeDecorator('DtDdWrapper'); $what = $formWhat->isValid($data); $when = $formWhen->isValid($data); @@ -686,6 +690,7 @@ class ScheduleController extends Zend_Controller_Action $this->view->rr = $formRecord; $this->view->absoluteRebroadcast = $formAbsoluteRebroadcast; $this->view->rebroadcast = $formRebroadcast; + $this->view->live = $formLive; $this->view->addNewShow = true; //the form still needs to be "update" since @@ -719,6 +724,8 @@ class ScheduleController extends Zend_Controller_Action $this->view->repeats = $formRepeats; $this->view->who = $formWho; $this->view->style = $formStyle; + $this->view->live = $formLive; + if(!$isSaas){ $this->view->rr = $formRecord; $this->view->absoluteRebroadcast = $formAbsoluteRebroadcast; diff --git a/airtime_mvc/application/forms/AddShowLiveStream.php b/airtime_mvc/application/forms/AddShowLiveStream.php new file mode 100644 index 000000000..eeb56b9fe --- /dev/null +++ b/airtime_mvc/application/forms/AddShowLiveStream.php @@ -0,0 +1,62 @@ +setDecorators(array( + array('ViewScript', array('viewScript' => 'form/add-show-live-stream.phtml')) + )); + + $allow_live_stream = new Zend_Form_Element_Checkbox("allow_live_stream_override"); + $allow_live_stream->setLabel("Allow Live Stream Override") + ->setRequired(false) + ->setDecorators(array('ViewHelper')); + $this->addElement($allow_live_stream); + + $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."; + $security_setting1 = new Zend_Form_Element_Checkbox("security_setting1"); + $security_setting1->setLabel("Connect using Airtime username & password") + ->setDescription($description1) + ->setRequired(false) + ->setDecorators(array('ViewHelper')); + $this->addElement($security_setting1); + + $description2 = "Specifiy custom athentification which will work for only the show."; + $security_setting2 = new Zend_Form_Element_Checkbox("security_setting2"); + $security_setting2 ->setLabel("Custom") + ->setDescription($description2) + ->setRequired(false) + ->setDecorators(array('ViewHelper')); + $this->addElement($security_setting2); + + //custom username + $custom_username = new Zend_Form_Element_Text('custom_username'); + $custom_username->setAttrib('class', 'input_text') + ->setAttrib('autocomplete', 'off') + ->setAllowEmpty(true) + ->setLabel('Custom Username') + ->setFilters(array('StringTrim')) + ->setValidators(array( + new ConditionalNotEmpty(array("security_setting2"=>"1")))) + //fix//->setValue(Application_Model_Preference::GetLiveSteamMasterUsername()) + ->setDecorators(array('ViewHelper')); + $this->addElement($custom_username); + + //custom password + $custom_password = new Zend_Form_Element_Password('custom_password'); + $custom_password->setAttrib('class', 'input_text') + ->setAttrib('autocomplete', 'off') + ->setAttrib('renderPassword','true') + ->setAllowEmpty(true) + ->setLabel('Custom Password') + ->setFilters(array('StringTrim')) + ->setValidators(array( + new ConditionalNotEmpty(array("security_setting2"=>"1")))) + //fix//->setValue(Application_Model_Preference::GetLiveSteamMasterUsername()) + ->setDecorators(array('ViewHelper')); + $this->addElement($custom_password); + } +} \ No newline at end of file diff --git a/airtime_mvc/application/forms/LiveStreamingPreferences.php b/airtime_mvc/application/forms/LiveStreamingPreferences.php index f1538e723..9bfba6891 100644 --- a/airtime_mvc/application/forms/LiveStreamingPreferences.php +++ b/airtime_mvc/application/forms/LiveStreamingPreferences.php @@ -1,6 +1,4 @@ setAttrib('class', 'input_text') + ->setAttrib('autocomplete', 'off') + ->setAllowEmpty(true) ->setLabel('Master Username') ->setFilters(array('StringTrim')) ->setValue(Application_Model_Preference::GetLiveSteamMasterUsername()) @@ -29,14 +29,15 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm $this->addElement($master_username); //Master password - $master_password = new Zend_Form_Element_Text('master_password'); + $master_password = new Zend_Form_Element_Password('master_password'); $master_password->setAttrib('class', 'input_text') ->setAttrib('autocomplete', 'off') - ->setAttrib('renderPassword', true) + ->setAttrib('renderPassword','true') + ->setAllowEmpty(true) ->setLabel('Master Password') ->setFilters(array('StringTrim')) - ->setValidators(array(new ConditionalNotEmpty(array('auto_enable_live_stream'=>'1')))) - ->setValue(Application_Model_Preference::GetLiveSteamMasterUsername()) + ->setValue(Application_Model_Preference::GetLiveSteamMasterPassword()) + ->setDecorators(array('ViewHelper')); $this->addElement($master_password); } diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 11d96a6d1..72a191b06 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -727,7 +727,7 @@ class Application_Model_Preference } public static function GetLiveSteamMasterPassword(){ - return self::GetValue("live_stream_master_username"); + return self::GetValue("live_stream_master_password"); } /* User specific preferences end */ diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 2338fd0e8..b924ee4c0 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -742,22 +742,25 @@ class Application_Model_Schedule { $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; $formWhat = new Application_Form_AddShowWhat(); - $formWho = new Application_Form_AddShowWho(); - $formWhen = new Application_Form_AddShowWhen(); - $formRepeats = new Application_Form_AddShowRepeats(); - $formStyle = new Application_Form_AddShowStyle(); + $formWho = new Application_Form_AddShowWho(); + $formWhen = new Application_Form_AddShowWhen(); + $formRepeats = new Application_Form_AddShowRepeats(); + $formStyle = new Application_Form_AddShowStyle(); + $formLive = new Application_Form_AddShowLiveStream(); - $formWhat->removeDecorator('DtDdWrapper'); - $formWho->removeDecorator('DtDdWrapper'); - $formWhen->removeDecorator('DtDdWrapper'); - $formRepeats->removeDecorator('DtDdWrapper'); - $formStyle->removeDecorator('DtDdWrapper'); + $formWhat->removeDecorator('DtDdWrapper'); + $formWho->removeDecorator('DtDdWrapper'); + $formWhen->removeDecorator('DtDdWrapper'); + $formRepeats->removeDecorator('DtDdWrapper'); + $formStyle->removeDecorator('DtDdWrapper'); + $formLive->removeDecorator('DtDdWrapper'); $p_view->what = $formWhat; $p_view->when = $formWhen; $p_view->repeats = $formRepeats; $p_view->who = $formWho; $p_view->style = $formStyle; + $p_view->live = $formLive; $formWhat->populate(array('add_show_id' => '-1')); $formWhen->populate(array('add_show_start_date' => date("Y-m-d"), diff --git a/airtime_mvc/application/views/scripts/form/add-show-live-stream.phtml b/airtime_mvc/application/views/scripts/form/add-show-live-stream.phtml new file mode 100644 index 000000000..3759792b7 --- /dev/null +++ b/airtime_mvc/application/views/scripts/form/add-show-live-stream.phtml @@ -0,0 +1,59 @@ +
+
+
+ +
+
+ element->getElement('allow_live_stream_override') ?> +
+
+ +
+
+ element->getElement('security_setting1') ?> +
+
+ +
+
+ element->getElement('security_setting2') ?> +
+ + +
+ +
+
+ element->getElement('custom_username') ?> + element->getElement('custom_username')->hasErrors()) : ?> +
    + element->getElement('custom_username')->getMessages() as $error): ?> +
  • + +
+ +
+
+ +
+
+ element->getElement('custom_password') ?> + element->getElement('custom_password')->hasErrors()) : ?> +
    + element->getElement('custom_password')->getMessages() as $error): ?> +
  • + +
+ +
+
+
+ diff --git a/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml b/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml index 8636dfcf6..3b7c87870 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml @@ -14,8 +14,7 @@
-
@@ -29,8 +28,7 @@
-
diff --git a/airtime_mvc/application/views/scripts/schedule/add-show-form.phtml b/airtime_mvc/application/views/scripts/schedule/add-show-form.phtml index b42b408d2..e61593d78 100644 --- a/airtime_mvc/application/views/scripts/schedule/add-show-form.phtml +++ b/airtime_mvc/application/views/scripts/schedule/add-show-form.phtml @@ -16,6 +16,10 @@ when; ?> repeats; ?> +

Live Stream

+
+ live; ?> +
isSaas()){?>

Record & Rebroadcast

diff --git a/airtime_mvc/public/js/airtime/preferences/preferences.js b/airtime_mvc/public/js/airtime/preferences/preferences.js index eb6b7a935..6c760d939 100644 --- a/airtime_mvc/public/js/airtime/preferences/preferences.js +++ b/airtime_mvc/public/js/airtime/preferences/preferences.js @@ -2,7 +2,12 @@ function showErrorSections() { if($("#soundcloud-settings .errors").length > 0) { $("#soundcloud-settings").show(); - $(window).scrollTop($("soundcloud-settings .errors").position().top); + $(window).scrollTop($("#soundcloud-settings .errors").position().top); + } + + if($("#livestream-settings .errors").length > 0) { + $("#livestream-settings").show(); + $(window).scrollTop($("#livestream-settings .errors").position().top); } }