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); +} 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 190f372d3..e7cd05b96 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')) {