From d04e0538142b7efcc8764b728205dc6d7a8f6325 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 25 Apr 2012 16:21:03 -0400 Subject: [PATCH 1/2] CC-3704: No default checked day when creating repeat show -fixed --- .../js/airtime/dashboard/helperfunctions.js | 17 +++++++++++++++++ .../public/js/airtime/schedule/add-show.js | 15 +++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js b/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js index 12b419d96..58b3ff5bb 100644 --- a/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js +++ b/airtime_mvc/public/js/airtime/dashboard/helperfunctions.js @@ -11,6 +11,23 @@ function popup(mylink){ return false; } +/* Take a string representing a date in the format 2012-04-25 and return + * a javascript date object representing this date. */ +function getDateFromString(time){ + var date = time.split("-"); + + if (date.length != 3){ + return null; + } + + var year = parseInt(date[0], 10); + var month = parseInt(date[1], 10) -1; + var day = parseInt(date[2], 10); + + return new Date(year, month, day); + +} + function convertSecondsToDaysHoursMinutesSeconds(seconds){ if (seconds < 0) seconds = 0; diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index e33b6fbea..14e1c9fdc 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -110,7 +110,22 @@ function setAddShowEvents() { form.find("#add_show_repeats").click(function(){ $(this).blur(); form.find("#schedule-show-when > fieldset:last").toggle(); + + var checkBoxSelected = false; + var days = form.find("#add_show_day_check-element input").each( function() { + var currentCheckBox = $(this).attr("checked"); + if (currentCheckBox && currentCheckBox == "checked"){ + checkBoxSelected = true; + } + }); + + if (!checkBoxSelected){ + var d = getDateFromString(form.find("#add_show_start_date").attr("value")); + if ( d != null) + form.find("#add_show_day_check-"+d.getDay()).attr('checked', true); + } + //must switch rebroadcast displays if(form.find("#add_show_rebroadcast").attr('checked')) { From e12bd35ee237d6a666f136a6f04de6908bf07fd8 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 25 Apr 2012 16:39:58 -0400 Subject: [PATCH 2/2] CC-3671: add show on week/day view doesn't get start time/end time filled in -use str formatter for padding --- airtime_mvc/application/Bootstrap.php | 3 ++- .../application/controllers/SystemstatusController.php | 1 - airtime_mvc/public/js/airtime/common/common.js | 9 ++------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index af676f201..1e5fc3b2d 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -65,7 +65,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $view->headScript()->appendFile($baseUrl.'/js/libs/jquery-ui-1.8.18.custom.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/libs/jquery.stickyPanel.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/qtip/jquery.qtip.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version']); + $view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $view->headScript()->appendFile($baseUrl.'/js/sprintf/sprintf-0.7-beta1.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $view->headScript()->appendScript("var baseUrl='$baseUrl/'"); //scripts for now playing bar diff --git a/airtime_mvc/application/controllers/SystemstatusController.php b/airtime_mvc/application/controllers/SystemstatusController.php index b660cd4e1..8865b1663 100644 --- a/airtime_mvc/application/controllers/SystemstatusController.php +++ b/airtime_mvc/application/controllers/SystemstatusController.php @@ -10,7 +10,6 @@ class SystemstatusController extends Zend_Controller_Action $baseUrl = $request->getBaseUrl(); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/status/status.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/sprintf/sprintf-0.7-beta1.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); } public function indexAction() diff --git a/airtime_mvc/public/js/airtime/common/common.js b/airtime_mvc/public/js/airtime/common/common.js index e6b62f89a..fb059da0d 100644 --- a/airtime_mvc/public/js/airtime/common/common.js +++ b/airtime_mvc/public/js/airtime/common/common.js @@ -85,10 +85,5 @@ function openPreviewWindow(url) { } function pad(number, length) { - var str = '' + number; - while (str.length < length) { - str = '0' + str; - } - - return str; -} \ No newline at end of file + return sprintf("%'0"+length+"d", number); +}