From 12dbdf8f4ca3a63d1d1754b7d9be0aaf7964d308 Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 11 Feb 2011 15:59:16 -0500 Subject: [PATCH 1/2] CC-1915 playlist name no longer required in form, defaults to "Untitled Playlist" --- application/controllers/PlaylistController.php | 4 +++- application/forms/AddShowRepeats.php | 1 + application/forms/AddShowWhen.php | 1 + application/forms/PlaylistMetadata.php | 2 +- public/js/airtime/library/spl.js | 4 ---- public/js/airtime/schedule/add-show.js | 5 +---- public/js/airtime/schedule/full-calendar-functions.js | 2 +- 7 files changed, 8 insertions(+), 11 deletions(-) diff --git a/application/controllers/PlaylistController.php b/application/controllers/PlaylistController.php index 17d604c46..a047e47da 100644 --- a/application/controllers/PlaylistController.php +++ b/application/controllers/PlaylistController.php @@ -120,7 +120,9 @@ class PlaylistController extends Zend_Controller_Action $formdata = $form->getValues(); $pl = $this->getPlaylist(); - $pl->setName($formdata["title"]); + + if($formdata["title"]) + $pl->setName($formdata["title"]); if(isset($formdata["description"])) { $pl->setPLMetaData(UI_MDATA_KEY_DESCRIPTION, $formdata["description"]); diff --git a/application/forms/AddShowRepeats.php b/application/forms/AddShowRepeats.php index ec30c52fc..9e363257e 100644 --- a/application/forms/AddShowRepeats.php +++ b/application/forms/AddShowRepeats.php @@ -39,6 +39,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm $this->addElement('text', 'add_show_end_date', array( 'label' => 'Date End:', 'class' => 'input_text', + 'value' => date("Y-m-d"), 'required' => false, 'filters' => array('StringTrim'), 'validators' => array( diff --git a/application/forms/AddShowWhen.php b/application/forms/AddShowWhen.php index 5e876fabb..4467ee089 100644 --- a/application/forms/AddShowWhen.php +++ b/application/forms/AddShowWhen.php @@ -10,6 +10,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm 'label' => 'Date Start:', 'class' => 'input_text', 'required' => true, + 'value' => date("Y-m-d"), 'filters' => array('StringTrim'), 'validators' => array( 'NotEmpty', diff --git a/application/forms/PlaylistMetadata.php b/application/forms/PlaylistMetadata.php index 997620c45..4fc64ce39 100644 --- a/application/forms/PlaylistMetadata.php +++ b/application/forms/PlaylistMetadata.php @@ -8,7 +8,7 @@ class Application_Form_PlaylistMetadata extends Zend_Form // Add username element $this->addElement('text', 'title', array( 'label' => 'Title:', - 'required' => true, + 'required' => false, 'filters' => array('StringTrim'), 'validators' => array( 'NotEmpty', diff --git a/public/js/airtime/library/spl.js b/public/js/airtime/library/spl.js index 1885329a8..101ef9a2d 100644 --- a/public/js/airtime/library/spl.js +++ b/public/js/airtime/library/spl.js @@ -340,10 +340,6 @@ function createPlaylistMetaForm(json) { data = $("#side_playlist form").serialize(); $.post(url, data, function(json){ - if(json.form){ - - } - openDiffSPL(json); }) }); diff --git a/public/js/airtime/schedule/add-show.js b/public/js/airtime/schedule/add-show.js index 092b8f9ac..e6e3fd08d 100644 --- a/public/js/airtime/schedule/add-show.js +++ b/public/js/airtime/schedule/add-show.js @@ -25,15 +25,12 @@ function endDpSelect(dateText, inst) { function createDateInput(el, onSelect) { var date; - + el.datepicker({ minDate: new Date(), onSelect: onSelect, dateFormat: 'yy-mm-dd' }); - - date = $.datepicker.formatDate("yy-mm-dd", new Date()); - el.val(date); } function autoSelect(event, ui) { diff --git a/public/js/airtime/schedule/full-calendar-functions.js b/public/js/airtime/schedule/full-calendar-functions.js index 4c6ec4ded..6a6aadc5c 100644 --- a/public/js/airtime/schedule/full-calendar-functions.js +++ b/public/js/airtime/schedule/full-calendar-functions.js @@ -124,7 +124,7 @@ function viewDisplay( view ) { opt.defaultView = view.name; $(calendarEl).fullCalendar('destroy'); $(calendarEl).fullCalendar(opt); - $(calendarEl).fullCalendar( 'gotoDate', d ) + $(calendarEl).fullCalendar( 'gotoDate', d ); }); var x = $(view.element).find(".fc-agenda-head th:first"); From f8d3a38b2e37805f80418279165a0dd22997409f Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 11 Feb 2011 17:46:55 -0500 Subject: [PATCH 2/2] default fade setting for songs. --- .../controllers/PreferenceController.php | 10 +++------- application/forms/Preferences.php | 12 +++++++++++- application/models/Playlist.php | 18 ++++++++++++++---- application/models/Preference.php | 8 ++++++++ 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/application/controllers/PreferenceController.php b/application/controllers/PreferenceController.php index cbfa1d26b..b6a6f5bea 100644 --- a/application/controllers/PreferenceController.php +++ b/application/controllers/PreferenceController.php @@ -24,22 +24,18 @@ class PreferenceController extends Zend_Controller_Action } $form = new Application_Form_Preferences(); - if (!$form->isValid($request->getPost())) { + if ($form->isValid($request->getPost())) { - } else { $values = $form->getValues(); - Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view); + Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view); + Application_Model_Preference::SetDefaultFade($values["stationDefaultFade"]); $this->view->statusMsg = "Preferences Updated."; } - - $this->view->form = $form; return $this->render('index'); //render the phtml file } - - } diff --git a/application/forms/Preferences.php b/application/forms/Preferences.php index 3ae783572..f003b75d6 100644 --- a/application/forms/Preferences.php +++ b/application/forms/Preferences.php @@ -16,6 +16,16 @@ class Application_Form_Preferences extends Zend_Form 'validators' => array('NotEmpty'), 'value' => Application_Model_Preference::GetValue("station_name") )); + + // Add login element + $this->addElement('text', 'stationDefaultFade', array( + 'class' => 'input_text', + 'label' => 'Default Fade:', + 'required' => false, + 'filters' => array('StringTrim'), + 'validators' => array(array('regex', false, array('/^[0-2][0-3]:[0-5][0-9]:[0-5][0-9](\.\d{1,6})?$/', 'messages' => 'enter a time 00:00:00{.000000}'))), + 'value' => Application_Model_Preference::GetValue("default_fade") + )); $this->addElement('submit', 'submit', array( 'class' => 'ui-button ui-state-default', @@ -24,4 +34,4 @@ class Application_Form_Preferences extends Zend_Form )); } } - +///^[0-2][0-3]:[0-5][0-9]:[0-5][0-9]{.}[0-9]{0-6}/i diff --git a/application/models/Playlist.php b/application/models/Playlist.php index 6db198122..726d66b17 100644 --- a/application/models/Playlist.php +++ b/application/models/Playlist.php @@ -927,11 +927,21 @@ class Playlist { */ private function insertPlaylistElement($plId, $fileId, $pos, $clipLength, $cuein, $cueout, $fadeIn=NULL, $fadeOut=NULL) { - if(is_null($fadeIn)) - $fadeIn = '00:00:00.000'; - if(is_null($fadeOut)) - $fadeOut = '00:00:00.000'; + $defaultFade = Application_Model_Preference::GetDefaultFade(); + if(is_null($fadeIn)) { + if($defaultFade != "") + $fadeIn = $defaultFade; + else + $fadeIn = '00:00:00.000'; + } + if(is_null($fadeOut)) { + if($defaultFade != "") + $fadeOut = $defaultFade; + else + $fadeOut = '00:00:00.000'; + } + $row = new CcPlaylistcontents(); $row->setDbPlaylistId($plId); $row->setDbFileId($fileId); diff --git a/application/models/Preference.php b/application/models/Preference.php index 14c3eab26..8a75d9365 100644 --- a/application/models/Preference.php +++ b/application/models/Preference.php @@ -78,5 +78,13 @@ class Application_Model_Preference return Application_Model_Preference::GetValue("shows_populated_until"); } + public static function SetDefaultFade($fade) { + Application_Model_Preference::SetValue("default_fade", $fade); + } + + public static function GetDefaultFade() { + return Application_Model_Preference::GetValue("default_fade"); + } + }