CC-3704: No default checked day when creating repeat show

-fixed
This commit is contained in:
Martin Konecny 2012-04-25 16:21:03 -04:00
parent 140c8d55ae
commit d04e053814
2 changed files with 32 additions and 0 deletions

View File

@ -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;

View File

@ -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')) {