From 1dabbacca233617e3265b8063080be1feaa3a151 Mon Sep 17 00:00:00 2001 From: james Date: Fri, 3 Jun 2011 14:53:01 -0400 Subject: [PATCH 1/4] CC-2289:Differentiate between time and duration - End date and time is added - duration field is readonly now and is autocalculated - now playing duration field format is changed( 0h 0m 0s ) - removed millisecond from start and end time in now playing --- .../controllers/ScheduleController.php | 22 +++++- airtime_mvc/application/forms/AddShowWhen.php | 67 +++++++++++++------ airtime_mvc/application/models/Nowplaying.php | 13 +++- airtime_mvc/application/models/Shows.php | 48 ++++++++++++- airtime_mvc/public/css/add-show.css | 11 ++- .../public/js/airtime/schedule/add-show.js | 57 ++++++++++++++-- .../schedule/full-calendar-functions.js | 21 ++++++ 7 files changed, 207 insertions(+), 32 deletions(-) diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 2ac07f1c9..2ea53f016 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -423,7 +423,9 @@ class ScheduleController extends Zend_Controller_Action $formWhen->populate(array('add_show_start_date' => $show->getStartDate(), 'add_show_start_time' => DateHelper::removeSecondsFromTime($show->getStartTime()), - 'add_show_duration' => $show->getDuration(), + 'add_show_end_date_no_repeat' => $show->getEndDate(), + 'add_show_end_time' => DateHelper::removeSecondsFromTime($show->getEndTime()), + 'add_show_duration' => $show->getDuration(true), 'add_show_repeats' => $show->isRepeating() ? 1 : 0)); if ($show->isStartDateTimeInPast()){ @@ -541,7 +543,23 @@ class ScheduleController extends Zend_Controller_Action if($when) { $when = $formWhen->checkReliantFields($data, $startDateModified); } - + // format add_show_duration value to hh:mm so it can be compatible with + // existing code + $hPos = strpos($data["add_show_duration"], 'h'); + $mPos = strpos($data["add_show_duration"], 'm'); + + $hValue = 0; + $mValue = 0; + + if($hPos !== false){ + $hValue = trim(substr($data["add_show_duration"], 0, $hPos)); + } + if($mPos !== false){ + $mValue = trim(substr($data["add_show_duration"], $hPos+1, -1 )); + } + + $data["add_show_duration"] = $hValue.":".$mValue; + if($data["add_show_repeats"]) { $repeats = $formRepeats->isValid($data); if($repeats) { diff --git a/airtime_mvc/application/forms/AddShowWhen.php b/airtime_mvc/application/forms/AddShowWhen.php index 847f26005..4a31554ac 100644 --- a/airtime_mvc/application/forms/AddShowWhen.php +++ b/airtime_mvc/application/forms/AddShowWhen.php @@ -11,7 +11,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm // Add start date element $this->addElement('text', 'add_show_start_date', array( - 'label' => 'Date Start:', + 'label' => 'Date/Time Start:', 'class' => 'input_text', 'required' => true, 'value' => date("Y-m-d"), @@ -21,13 +21,13 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm array('date', false, array('YYYY-MM-DD')) ) )); - + // Add start time element - $this->addElement('text', 'add_show_start_time', array( - 'label' => 'Start Time:', + $startTime = $this->addElement('text', 'add_show_start_time', array( + 'decorators' => array('ViewHelper', array('HtmlTag', array('tag'=>'dd'))), 'class' => 'input_text', 'required' => true, - 'value' => '0:00', + 'value' => '00:00', 'filters' => array('StringTrim'), 'validators' => array( 'NotEmpty', @@ -36,19 +36,40 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm ) )); - // Add duration element - $this->addElement('text', 'add_show_duration', array( - 'label' => 'Duration:', + // Add end date element + $this->addElement('text', 'add_show_end_date_no_repeat', array( + 'label' => 'Date/Time End:', 'class' => 'input_text', - 'value' => '1:00', 'required' => true, + 'value' => date("Y-m-d"), + 'filters' => array('StringTrim'), + 'validators' => array( + 'NotEmpty', + array('date', false, array('YYYY-MM-DD')) + ) + )); + + // Add end time element + $this->addElement('text', 'add_show_end_time', array( + 'decorators' => array('ViewHelper', array('HtmlTag', array('tag'=>'dd'))), + 'class' => 'input_text', + 'required' => true, + 'value' => '01:00', 'filters' => array('StringTrim'), 'validators' => array( 'NotEmpty', - array('regex', false, - array('/^\d+:[0-5][0-9]$/', - 'messages' => 'enter a duration: HH:mm')) - ) + array('date', false, array('HH:mm')), + array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered')) + ) + + )); + + // Add duration element + $this->addElement('text', 'add_show_duration', array( + 'label' => 'Duration:', + 'class' => 'input_text', + 'value' => '01h00m', + 'readonly' => true )); // Add repeats element @@ -69,15 +90,19 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $now_epoch = strtotime($now_timestamp); $start_epoch = strtotime($start_timestamp); - if ((($formData['add_show_id'] != -1) && $startDateModified) || ($formData['add_show_id'] == -1)){ - if($start_epoch < $now_epoch) { - $this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past')); - $valid = false; - } - } - if(strtotime("00:00") == strtotime($formData["add_show_duration"])) { - $this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00:00')); + if ((($formData['add_show_id'] != -1) && $startDateModified) || ($formData['add_show_id'] == -1)){ + if($start_epoch < $now_epoch) { + $this->getElement('add_show_start_date')->setErrors(array('Cannot create show in the past')); + $valid = false; + } + } + + if( $formData["add_show_duration"] == "0m" ) { + $this->getElement('add_show_duration')->setErrors(array('Cannot have duration 0m')); + $valid = false; + }elseif(strpos($formData["add_show_duration"], 'h') !== false && intval(substr($formData["add_show_duration"], 0, strpos($formData["add_show_duration"], 'h'))) > 23) { + $this->getElement('add_show_duration')->setErrors(array('Cannot have duration > 24h')); $valid = false; } diff --git a/airtime_mvc/application/models/Nowplaying.php b/airtime_mvc/application/models/Nowplaying.php index 5b646497d..04a620c74 100644 --- a/airtime_mvc/application/models/Nowplaying.php +++ b/airtime_mvc/application/models/Nowplaying.php @@ -21,8 +21,17 @@ class Application_Model_Nowplaying $type = "a"; $type .= ($dbRow['item_ends'] > $timeNow && $dbRow['item_starts'] <= $timeNow) ? "c" : ""; - $dataTablesRows[] = array($type, $dbRow['show_starts'], $dbRow['item_starts'], $dbRow['item_ends'], - $dbRow['clip_length'], $dbRow['track_title'], $dbRow['artist_name'], $dbRow['album_title'], + // remove millisecond from the time format + $itemStart = explode('.', $dbRow['item_starts']); + $itemEnd = explode('.', $dbRow['item_ends']); + + //format duration + $duration = explode('.', $dbRow['clip_length']); + $duration = explode(':', $duration[0]); + $duration = $duration[0].'h'.$duration[1].'m'.$duration[2].'s'; + + $dataTablesRows[] = array($type, $dbRow['show_starts'], $itemStart[0], $itemEnd[0], + $duration, $dbRow['track_title'], $dbRow['artist_name'], $dbRow['album_title'], $dbRow['playlist_name'], $dbRow['show_name'], $status); } diff --git a/airtime_mvc/application/models/Shows.php b/airtime_mvc/application/models/Shows.php index fa439406b..017bc6178 100644 --- a/airtime_mvc/application/models/Shows.php +++ b/airtime_mvc/application/models/Shows.php @@ -433,6 +433,45 @@ class Show { return $startTime; } } + + /** + * Get the end date of the current show. + * Note that this is not the end date of repeated show + * + * @return string + * The end date in the format YYYY-MM-DD + */ + public function getEndDate(){ + $startDate = $this->getStartDate(); + $startTime = $this->getStartTime(); + $duration = $this->getDuration(); + + $startDateTime = new DateTime($startDate.' '.$startTime); + $duration = explode(":", $duration); + + $endDate = $startDateTime->add(new DateInterval('PT'.$duration[0].'H'.$duration[1].'M')); + + return $endDate->format('Y-m-d'); + } + + /** + * Get the end time of the current show. + * + * @return string + * The start time in the format HH:MM:SS + */ + public function getEndTime(){ + $startDate = $this->getStartDate(); + $startTime = $this->getStartTime(); + $duration = $this->getDuration(); + + $startDateTime = new DateTime($startDate.' '.$startTime); + $duration = explode(":", $duration); + + $endDate = $startDateTime->add(new DateInterval('PT'.$duration[0].'H'.$duration[1].'M')); + + return $endDate->format('H:i:s'); + } /** * Indicate whether the starting point of the show is in the @@ -535,9 +574,14 @@ class Show { } } - public function getDuration(){ + public function getDuration($format=false){ $showDay = CcShowDaysQuery::create()->filterByDbShowId($this->getId())->findOne(); - return $showDay->getDbDuration(); + if(!$format){ + return $showDay->getDbDuration(); + }else{ + $info = explode(':',$showDay->getDbDuration()); + return ($info[0] != 0 ? intval($info[0]).'h'.' ' : '').($info[1] != 0 ? intval($info[1]).'m' : ''); + } } public function getShowDays(){ diff --git a/airtime_mvc/public/css/add-show.css b/airtime_mvc/public/css/add-show.css index f78f515eb..1d0cf9f5c 100644 --- a/airtime_mvc/public/css/add-show.css +++ b/airtime_mvc/public/css/add-show.css @@ -51,7 +51,7 @@ margin: 0; padding: 4px 0; text-align: left; - min-width:90px; + min-width:100px; clear:left; } #schedule-add-show dt.big { @@ -111,3 +111,12 @@ label.wrapp-label input[type="checkbox"] { min-width: 150px; overflow: auto; } + +#add_show_start_time { + float: left; +} + +#add_show_duration { + background: #AAAAAA; + cursor: default; +} diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index 8b3d43ffb..2406377c9 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -13,6 +13,8 @@ function startDpSelect(dateText, inst) { $("#add_show_end_date").datepicker("option", "minDate", date); $('input[name^="add_show_rebroadcast_absolute_date"]').datepicker("option", "minDate", date); + if (inst.input) + inst.input.trigger('change'); } function endDpSelect(dateText, inst) { @@ -22,6 +24,8 @@ function endDpSelect(dateText, inst) { date = new Date(time[0], time[1] - 1, time[2]); $("#add_show_start_date").datepicker( "option", "maxDate", date); + if (inst.input) + inst.input.trigger('change'); } function createDateInput(el, onSelect) { @@ -158,14 +162,15 @@ function setAddShowEvents() { form.find("#add_show_no_end").click(endDateVisibility); createDateInput(form.find("#add_show_start_date"), startDpSelect); + createDateInput(form.find("#add_show_end_date_no_repeat"), endDpSelect); createDateInput(form.find("#add_show_end_date"), endDpSelect); form.find("#add_show_start_time").timepicker({ - amPmText: ['', ''] - }); - form.find("#add_show_duration").timepicker({ amPmText: ['', ''], - defaultTime: '01:00' + defaultTime: '00:00' + }); + form.find("#add_show_end_time").timepicker({ + amPmText: ['', ''] }); form.find('input[name^="add_show_rebroadcast_date_absolute"]').datepicker({ @@ -312,6 +317,50 @@ function setAddShowEvents() { } }); }); + + // auto puplate end date and time + $('#add_show_start_time, #add_show_start_date, #add_show_end_date_no_repeat, #add_show_end_time').change(function(){ + var startDate = $('#add_show_start_date').val().split('-'); + var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]+' '+$('#add_show_start_time').val()); + + var endDate = $('#add_show_end_date_no_repeat').val().split('-'); + var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val()); + + // if changed start time is greater than end, set end time to start time + 1 hour + if(startDateTime.getTime() > endDateTime.getTime()){ + endDateTime = new Date(startDateTime.getTime() + (1*60*60*1000)); + } + + var endDate = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2); + var endTime = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2); + + $('#add_show_end_date_no_repeat').val(endDate); + $('#add_show_end_time').val(endTime); + + // calculate duration + calculateDuration(endDateTime, startDateTime) + }) + + function calculateDuration(endDateTime, startDateTime){ + var duration; + var durationSeconds = (endDateTime.getTime() - startDateTime.getTime())/1000; + if(durationSeconds != 0){ + var durationHour = parseInt(durationSeconds/3600); + var durationMin = parseInt((durationSeconds%3600)/60); + duration = (durationHour == 0 ? '' : durationHour+'h'+' ')+(durationMin == 0 ? '' : durationMin+'m'); + }else{ + duration = '0m'; + } + $('#add_show_duration').val(duration); + } + function pad(number, length) { + var str = '' + number; + while (str.length < length) { + str = '0' + str; + } + + return str; + } } function showErrorSections() { diff --git a/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js b/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js index 57511f491..cdcad012c 100644 --- a/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js +++ b/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js @@ -109,11 +109,32 @@ function dayClick(date, allDay, jsEvent, view) { else { chosenTime = hours+":"+min; } + + if(hours < 10){ + chosenTime = "0"+chosenTime; + } + + var endHour = hours + 1; + var chosenEndTime; + + if(min < 10){ + chosenEndTime = endHour+":0"+min; + } + else { + chosenEndTime = endHour+":"+min; + } + + if(endHour < 10){ + chosenEndTime = "0"+chosenEndTime; + } $("#add_show_start_date").val(chosenDate); + $("#add_show_end_date_no_repeat").val(chosenDate); $("#add_show_end_date").datepicker("option", "minDate", chosenDate); $("#add_show_end_date").val(chosenDate); $("#add_show_start_time").val(chosenTime); + $("#add_show_end_time").val(chosenEndTime); + $("#add_show_duration").val('1h'); $("#schedule-show-when").show(); openAddShowForm(); From 6a15f51aac9b489f043a786bb260b5af1458a3c5 Mon Sep 17 00:00:00 2001 From: james Date: Mon, 6 Jun 2011 12:49:52 -0400 Subject: [PATCH 2/4] CC-2289:differentiate-between-time-and-duration - some change in date populating rules - change on start date/time triggers change in end date/time - change on end date/time will triggers background turning into red color to notify user that end date/time is earlier than start date/time. - need to do more work once I get img file from Vladmir --- airtime_mvc/application/forms/AddShowWhen.php | 3 + airtime_mvc/application/models/Nowplaying.php | 25 ++++- airtime_mvc/public/css/add-show.css | 6 ++ .../public/js/airtime/schedule/add-show.js | 97 ++++++++++++++++++- 4 files changed, 127 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/forms/AddShowWhen.php b/airtime_mvc/application/forms/AddShowWhen.php index 4a31554ac..38ddb7f1c 100644 --- a/airtime_mvc/application/forms/AddShowWhen.php +++ b/airtime_mvc/application/forms/AddShowWhen.php @@ -104,6 +104,9 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm }elseif(strpos($formData["add_show_duration"], 'h') !== false && intval(substr($formData["add_show_duration"], 0, strpos($formData["add_show_duration"], 'h'))) > 23) { $this->getElement('add_show_duration')->setErrors(array('Cannot have duration > 24h')); $valid = false; + }elseif( strstr($formData["add_show_duration"], '-') ){ + $this->getElement('add_show_duration')->setErrors(array('Cannot have duration < 0m')); + $valid = false; } return $valid; diff --git a/airtime_mvc/application/models/Nowplaying.php b/airtime_mvc/application/models/Nowplaying.php index 04a620c74..47769ce39 100644 --- a/airtime_mvc/application/models/Nowplaying.php +++ b/airtime_mvc/application/models/Nowplaying.php @@ -28,7 +28,30 @@ class Application_Model_Nowplaying //format duration $duration = explode('.', $dbRow['clip_length']); $duration = explode(':', $duration[0]); - $duration = $duration[0].'h'.$duration[1].'m'.$duration[2].'s'; + + if($duration[2] == 0){ + $duration[2] = ''; + }else{ + $duration[2] = intval($duration[2],10).'s'; + } + + if($duration[1] == 0){ + if($duration[2] == ''){ + $duration[1] = ''; + }else{ + $duration[1] = intval($duration[1],10).'m'; + } + }else{ + $duration[1] = intval($duration[1],10).'m'; + } + + if($duration[0] == 0){ + $duration[0] = ''; + }else{ + $duration[0] = intval($duration[0],10).'h'; + } + + $duration = $duration[0].$duration[1].$duration[2]; $dataTablesRows[] = array($type, $dbRow['show_starts'], $itemStart[0], $itemEnd[0], $duration, $dbRow['track_title'], $dbRow['artist_name'], $dbRow['album_title'], diff --git a/airtime_mvc/public/css/add-show.css b/airtime_mvc/public/css/add-show.css index 1d0cf9f5c..365a54a6c 100644 --- a/airtime_mvc/public/css/add-show.css +++ b/airtime_mvc/public/css/add-show.css @@ -114,9 +114,15 @@ label.wrapp-label input[type="checkbox"] { #add_show_start_time { float: left; + width: 100px; +} + +#add_show_end_time, #add_show_end_date_no_repeat, #add_show_start_date { + width: 100px; } #add_show_duration { background: #AAAAAA; cursor: default; + width: 100px; } diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index 2406377c9..f350ded21 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -23,7 +23,7 @@ function endDpSelect(dateText, inst) { time = dateText.split("-"); date = new Date(time[0], time[1] - 1, time[2]); - $("#add_show_start_date").datepicker( "option", "maxDate", date); + //$("#add_show_start_date").datepicker( "option", "maxDate", date); if (inst.input) inst.input.trigger('change'); } @@ -318,14 +318,70 @@ function setAddShowEvents() { }); }); - // auto puplate end date and time - $('#add_show_start_time, #add_show_start_date, #add_show_end_date_no_repeat, #add_show_end_time').change(function(){ + // when start date/time changes, set end date/time to start date/time+1 hr + $('#add_show_start_date, #add_show_start_time').change(function(){ var startDate = $('#add_show_start_date').val().split('-'); var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]+' '+$('#add_show_start_time').val()); var endDate = $('#add_show_end_date_no_repeat').val().split('-'); var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val()); + if(startDateTime.getTime() > endDateTime.getTime()){ + endDateTime = new Date(startDateTime.getTime() + (1*60*60*1000)); + } + + var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2); + var endTimeFormat = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2); + + $('#add_show_end_date_no_repeat').val(endDateFormat); + $('#add_show_end_time').val(endTimeFormat); + + // calculate duration + calculateDuration(endDateTime, startDateTime); + }); + + // when end date/time changes, check if the changed date is in past of start date/time + $('#add_show_end_date_no_repeat, #add_show_end_time').change(function(){ + var startDate = $('#add_show_start_date').val().split('-'); + var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]+' '+$('#add_show_start_time').val()); + + var endDate = $('#add_show_end_date_no_repeat').val().split('-'); + var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val()); + + if(startDateTime.getTime() > endDateTime.getTime()){ + $('#add_show_end_date_no_repeat').css('background', '#F49C9C'); + $('#add_show_end_time').css('background', '#F49C9C'); + }else{ + $('#add_show_end_date_no_repeat').css('background', ''); + $('#add_show_end_time').css('background', ''); + } + + // calculate duration + calculateDuration(endDateTime, startDateTime); + }); + // auto puplate end date and time + /*$('#add_show_start_date, #add_show_end_time_no_repeat').change(function(){ + var startDate = $('#add_show_start_date').val().split('-'); + var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]); + + var endDate = $('#add_show_end_date_no_repeat').val().split('-'); + var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]); + + if(startDateTime.getTime() > endDateTime.getTime()){ + if($(this) == $('#add_show_start_date')){ + var endDateTemp = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2); + $('#add_show_end_date_no_repeat').val(endDateTemp); + }else{ + var startDateTemp = startDateTime.getFullYear() + '-' + pad(startDateTime.getMonth()+1,2) + '-' + pad(startDateTime.getDate(),2); + $('#add_show_end_date_no_repeat').val(startDateTemp); + } + } + + var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]+' '+$('#add_show_start_time').val()); + + var endDate = $('#add_show_end_date_no_repeat').val().split('-'); + var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val()); + // if changed start time is greater than end, set end time to start time + 1 hour if(startDateTime.getTime() > endDateTime.getTime()){ endDateTime = new Date(startDateTime.getTime() + (1*60*60*1000)); @@ -339,7 +395,42 @@ function setAddShowEvents() { // calculate duration calculateDuration(endDateTime, startDateTime) + }) + $('#add_show_start_time, #add_show_end_time').change(function(){ + var startDate = $('#add_show_start_date').val().split('-'); + var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]+' '+$('#add_show_start_time').val()); + + var endDate = $('#add_show_end_date_no_repeat').val().split('-'); + var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val()); + + if($(this) == $('#add_show_start_time')){ + // if changed start time is greater than end, set end time to start time + 1 hour + if(startDateTime.getTime() > endDateTime.getTime()){ + endDateTime = new Date(startDateTime.getTime() + (1*60*60*1000)); + } + + var endDate = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2); + var endTime = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2); + + $('#add_show_end_date_no_repeat').val(endDate); + $('#add_show_end_time').val(endTime); + }else{ + // if changed start time is greater than end, set end time to start time + 1 hour + if(startDateTime.getTime() > endDateTime.getTime()){ + endDateTime = new Date(startDateTime.getTime() + (1*60*60*1000)); + } + + var endDate = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2); + var endTime = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2); + + $('#add_show_end_date_no_repeat').val(endDate); + $('#add_show_end_time').val(endTime); + } + + // calculate duration + calculateDuration(endDateTime, startDateTime) + })*/ function calculateDuration(endDateTime, startDateTime){ var duration; From 7cc1f5c2e7e0fe6884f0ff42665719afda5b22ce Mon Sep 17 00:00:00 2001 From: james Date: Mon, 13 Jun 2011 12:24:17 -0400 Subject: [PATCH 3/4] CC-2289:Differentiate between time and duration - css has been modified (from Vlad) - new image were added (from Vlad) --- .../css/images/input_with_calendar_bg.png | Bin 1082 -> 1074 bytes .../public/css/images/input_with_time_bg.png | Bin 1135 -> 1259 bytes .../public/css/images/search_auto_bg.png | Bin 1293 -> 1193 bytes airtime_mvc/public/css/styles.css | 127 ++++++++++++++++-- .../public/js/airtime/schedule/add-show.js | 81 +---------- 5 files changed, 124 insertions(+), 84 deletions(-) diff --git a/airtime_mvc/public/css/images/input_with_calendar_bg.png b/airtime_mvc/public/css/images/input_with_calendar_bg.png index 12e2d3f8061b4cf26077c52ccd0ad521576d86ca..219a68fb0ab693de80d8a6552bf4eec339cd1665 100644 GIT binary patch delta 411 zcmdnRv57;mGr-TCmrII^fq{Y7)59eQNQ(loFb5lutoL*4-l(X|6k}##YGLZ)VrXe( zXlZEZYT#sUWawn*Xk_H%Y--|WYOJJCkz3&FYvq!kT$-DjSK{ens{|C$OUX>Jg6cKG zrFZfICIbbCB4;<8ias#OKoz+d;8di;>{NeVcJ^1G(^q)9IEGZ*O8WEvzdiF-Mqy^& z103d41Uu)lEln3ZnRY<*WRC}zV^@!)q~!TY2j;b&|2_SHnSs%^iHD9o|7%iom~Xmw zN&z{ZSGk5CLQknUUjEs!=oqj>P%iadHXL%iP7oNQ2lEXdq zt4kGJ-wSuuZg5nX-juOwXUX9<-a|*+gf8l-s_C#_S*mkHO*n|*#077M=&vU(bQ`Z` bVv%4-6D>Zj>3eel(9sN@u6{1-oD!M<6`6&u delta 419 zcmdnQv5P~oGr-TCmrII^fq{Y7)59f*fq^Lk$d=<^29n3sCT!cNsLT{&U}RxwU}|P+ zY~o~MXy|HS>FjFkVq|LOXl`n0WNK-yq)?Gt;OlGUlAm0fo0?bR>0+w{6wyn`OtFIM zHN&NM@&YCU1*jrpoQgg$$-oqu;8di;>{K7uG$#b;bj1Ll5ZAkR?_Roe>DaMj+qP|+ zI(6#Jn>Sy-e*O3F-!*I2{Qmv>(4j-w;v4LMikm%M978H@y}9AY#bn6iaB)@V)t&zv zMMaiv_IH^1eU@;GznH9fhQYcE2{8)}GBgNx-e5nqsq49sm{VXx|A|zcmQCGTHwknd z+O@vL*EKTYz4g@iLyHX7NE+MwN9>6BQxRc#`RF3WHFGxm<$x4iY##|`oJUuQ{;$Kkq)y{{rb#apl28pJzX3_DsCnH`TyUZc`Ji3v**6Xs^dM=$5aJ7{@@nvO9^_9nI9#1dwYL>d3pKgyE}`YpM8IS z|NDjv0eKa^N$snYIhu@(jf4OF`8kebrHhKY=!%X{?AmNzo(UcTI2_*qw9A7Ah3>H6J=MP9yowU6bZs;cVs$jHdhhKG|| zPj7GwSfi<}y;;$_fyd?hx4XN`>sPK=(ZRsG`uNkc^}BbMzyH^-JLkgD1+U&c;@*6^ zTTJ)S&)?tQS5L^E5ZiW!?PT*6M_~iM!{_Af>;9DG<>>`yX1*-U>4LcT$(#ml>&BpM z+8VNri{wSJKYjYNhF{+95AP?b6RrWxWy~MdV{Ue?suWf@z;MX-q>{teqou%0+w{6wyn`OtFIM zHN>TN@&YCU1&AUuSDcDIFv-9ax#3i#!|YUV7Vn@3bh>4LPl)T?yLT^Ly0mTEwqwVR zef#$9%a<<~E?j79Yg@5m#oW1b4Wm77*cWT&CSz-hYWaF4=`+++w$kPzL*-j)&&1I(>}NGFNh*;pcK#3=353anjdqdVtALmPJijTxb z2!7V$+qC6rc!akwd*rvE?3mlzu11v=PPn~MPqtgmI_$>A7az6O#I>sIejjmFwmU`d q{g+v7|F{@|E@NP5Sl`dU%<$rx(DC;XI~RgPJYD@<)-gLJGywpKPqo7U diff --git a/airtime_mvc/public/css/images/search_auto_bg.png b/airtime_mvc/public/css/images/search_auto_bg.png index 6026bb51a876536ccb027726f630f47c234e9a77..95933679325f9017d3c71034ca9ff7373b6889f2 100644 GIT binary patch delta 551 zcmeC>TFI%{8Q|y6%O%Cdz`(%k>ERLtq=kT3oP!NWvN6j)nW(72n6lAJopJIk#+1of zjGFZYzP?ueMVaZDd5JkL`N^fZsd*)yF1AV)xdnPDnJHF|hNh-QZYIvg2Ifw#28M=C z&ZdTz2F9)~7EWfa=7vs63P6=WGqCBkbTzOrHZ?P{G%_?ZG;}qvbT)T%a&)t>bT%|_ zHZnB^>Yc33B&h&ZXNXJPXlNU1SD_EMj7@J#~xw#ob9ph?f?r3RfY~!oQuGiFXq5;}UgRcy`HNz)RT z!?IQ~nP1pJldQ;APKe3^F@3Lu1vNsF<&)g+6^O5MCWF=3{ z<%^}GH*MERN@z`zs%WXo|d0m=GV-!D&8)L>ND=%vm$`3|Gf zxZhS~@wIIT|^dnHw6q8aTO{I=h$|n>#rgJDD4rxlFcWl7T65 z!l~#9lR*sBBnw=MloX0ff>P70Qu32ab5rw5JY8&+Dsl_-QZiGlpn5HF>787_>{LG? z^@BVE17owNi(^Q|tv7cKPu~g%afbyT2{>_V?P@>-EoA9ezqDh7`*?W%1 z7fR<=G6u}3=eM8s^0(c${gw0h+nv2$Zsk5Uwd2um-Czcd0_8QYt7MMv`Tvyb*v`yZ ze{af{FeswP%rF_?}m@D=a--ADF@zJYD@<);T3K0RTB-_!0mB diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index c204c11b0..f5a166b18 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -331,8 +331,7 @@ fieldset.plain { .padded-strong { padding:10px; } -.input_text { - background:#dddddd url("images/input_bg.png") repeat-x scroll 0 0 ; +.input_text, input[type="text"], input[type="password"] { font-family:Arial, Helvetica, sans-serif; border: 1px solid #5b5b5b; font-size: 12px; @@ -341,14 +340,22 @@ fieldset.plain { padding: 0; text-indent: 3px; width:auto; + background-color: #dddddd; + border: 1px solid #5b5b5b; + box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2) inset; +} + +input[type="text"]:focus, input[type="password"]:focus, textarea:focus, .input_text_area:focus { + border: 1px solid #0088f1; } .auto-search { background:#dddddd url(images/search_auto_bg.png) no-repeat 0 0; text-indent:25px; } -.input_text_area { - background:#dddddd url("images/input_bg.png") repeat-x scroll 0 0 ; +.input_text_area, textarea { + background-color: #dddddd; border: 1px solid #5b5b5b; + box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2) inset; font-size: 13px; text-indent: 3px; } @@ -1200,10 +1207,14 @@ button, input { margin-right:6px } .button-bar-top .input_text.hasDatepicker, .input_text.hasDatepicker { - background:url(images/input_with_calendar_bg.png) no-repeat right 0; + background-image:url(images/input_with_calendar_bg.png); + background-repeat:no-repeat; + background-position:right 0; } .input_text.hasTimepicker { - background:url(images/input_with_time_bg.png) no-repeat right 0; + background-image:url(images/input_with_time_bg.png); + background-repeat:no-repeat; + background-position:right 0; } ul.errors { display:block; @@ -1445,11 +1456,12 @@ div.success{ } .formrow-repeat li { list-style-type:none; - margin:0 0 7px 0; + margin:0 0 8px 0; padding:0; - /*height:26px;*/ + height:25px; display:block; } +/* .formrow-repeat li .ui-button-icon-only { width:1.8em; } @@ -1467,6 +1479,37 @@ div.success{ display: block; line-height: 110%; } +*/ + +#add_show_rebroadcast_relative .ui-button-icon-only, +#add_show_rebroadcast_absolute .ui-button-icon-only { + width: 1.8em; +} +#add_show_rebroadcast_relative .ui-button-icon-only .ui-button-text, +#add_show_rebroadcast_absolute .ui-button-icon-only .ui-button-text, +#add_show_rebroadcast_relative .ui-button-icons-only .ui-button-text, +#add_show_rebroadcast_absolute .ui-button-icons-only .ui-button-text, +#add_show_rebroadcast_relative .ui-button-text-icon-primary .ui-button-text, +#add_show_rebroadcast_absolute .ui-button-text-icon-primary .ui-button-text { + font-size:12px; +} + +#add_show_rebroadcast_relative .ui-button-icon-only .ui-icon, +#add_show_rebroadcast_absolute .ui-button-icon-only .ui-icon { + margin-top: -8px; + position: absolute; + top: 50%; +} +#add_show_rebroadcast_relative .ui-button-text-icon-primary .ui-icon, +#add_show_rebroadcast_absolute .ui-button-text-icon-primary .ui-icon { + left: 0.4em; +} +#add_show_rebroadcast_relative .ui-button .ui-button-text, +#add_show_rebroadcast_absolute .ui-button .ui-button-text { + display: block; + line-height: 14px; +} + .formrow-repeat li .inline-text { color: #666666; padding: 0 6px 0 0; @@ -1613,3 +1656,71 @@ dd.radio-inline-list, .preferences dd.radio-inline-list { button.ui-button.md-cancel { padding: .4em 1em; } + +/*--//////////////////////// Changes/add-ons Jun 8th, 2011 ////////////////////////--*/ + +.dialogPopup.ui-dialog-content { + padding: 0.9em 1em; +} +.dialogPopup dl { + margin:0; + padding:0; +} +.dialogPopup dt { + margin:0; + padding: 0 0 5px; +} +.dialogPopup dt label { + font-weight: bold; +} +.dialogPopup dd { + margin:0 0 4px 0; + padding: 0 0 5px; +} +.dialogPopup dd input[type="text"]{ + width:100%; +} + +.info-text p { + font-size:12px; + color:#5b5b5b; + line-height:150%; + margin-top:0; +} + +.dialogPopup label input[type="checkbox"] { + float:left; + margin-right:6px; +} + +.dialogPopup fieldset { + padding: 10px; +} +.dialogPopup fieldset dd input[type="text"] { + width:99%; +} +fieldset.display_field { + background-color:#d5d5d5; + box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2) inset; +} +label span { + font-weight:normal; +} + +.dialogPopup .display_field dt, .dialogPopup .display_field dd { + color: #353535; + float: left; + font-size: 13px; + margin: 0; + min-width: 90px; + padding: 6px 0; + text-align: left; + width:60%; + +} + +.dialogPopup .display_field dt { + clear: left; + font-weight:bold; + width:40%; +} \ No newline at end of file diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index f350ded21..3839bdbe0 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -349,88 +349,16 @@ function setAddShowEvents() { var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val()); if(startDateTime.getTime() > endDateTime.getTime()){ - $('#add_show_end_date_no_repeat').css('background', '#F49C9C'); - $('#add_show_end_time').css('background', '#F49C9C'); + $('#add_show_end_date_no_repeat').css('background-color', '#F49C9C'); + $('#add_show_end_time').css('background-color', '#F49C9C'); }else{ - $('#add_show_end_date_no_repeat').css('background', ''); - $('#add_show_end_time').css('background', ''); + $('#add_show_end_date_no_repeat').css('background-color', ''); + $('#add_show_end_time').css('background-color', ''); } // calculate duration calculateDuration(endDateTime, startDateTime); }); - // auto puplate end date and time - /*$('#add_show_start_date, #add_show_end_time_no_repeat').change(function(){ - var startDate = $('#add_show_start_date').val().split('-'); - var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]); - - var endDate = $('#add_show_end_date_no_repeat').val().split('-'); - var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]); - - if(startDateTime.getTime() > endDateTime.getTime()){ - if($(this) == $('#add_show_start_date')){ - var endDateTemp = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2); - $('#add_show_end_date_no_repeat').val(endDateTemp); - }else{ - var startDateTemp = startDateTime.getFullYear() + '-' + pad(startDateTime.getMonth()+1,2) + '-' + pad(startDateTime.getDate(),2); - $('#add_show_end_date_no_repeat').val(startDateTemp); - } - } - - var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]+' '+$('#add_show_start_time').val()); - - var endDate = $('#add_show_end_date_no_repeat').val().split('-'); - var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val()); - - // if changed start time is greater than end, set end time to start time + 1 hour - if(startDateTime.getTime() > endDateTime.getTime()){ - endDateTime = new Date(startDateTime.getTime() + (1*60*60*1000)); - } - - var endDate = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2); - var endTime = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2); - - $('#add_show_end_date_no_repeat').val(endDate); - $('#add_show_end_time').val(endTime); - - // calculate duration - calculateDuration(endDateTime, startDateTime) - - }) - $('#add_show_start_time, #add_show_end_time').change(function(){ - var startDate = $('#add_show_start_date').val().split('-'); - var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]+' '+$('#add_show_start_time').val()); - - var endDate = $('#add_show_end_date_no_repeat').val().split('-'); - var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val()); - - if($(this) == $('#add_show_start_time')){ - // if changed start time is greater than end, set end time to start time + 1 hour - if(startDateTime.getTime() > endDateTime.getTime()){ - endDateTime = new Date(startDateTime.getTime() + (1*60*60*1000)); - } - - var endDate = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2); - var endTime = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2); - - $('#add_show_end_date_no_repeat').val(endDate); - $('#add_show_end_time').val(endTime); - }else{ - // if changed start time is greater than end, set end time to start time + 1 hour - if(startDateTime.getTime() > endDateTime.getTime()){ - endDateTime = new Date(startDateTime.getTime() + (1*60*60*1000)); - } - - var endDate = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2); - var endTime = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2); - - $('#add_show_end_date_no_repeat').val(endDate); - $('#add_show_end_time').val(endTime); - } - - // calculate duration - calculateDuration(endDateTime, startDateTime) - })*/ function calculateDuration(endDateTime, startDateTime){ var duration; @@ -444,6 +372,7 @@ function setAddShowEvents() { } $('#add_show_duration').val(duration); } + function pad(number, length) { var str = '' + number; while (str.length < length) { From 061dec14aada14099c4e70144cfef957a5295ef9 Mon Sep 17 00:00:00 2001 From: james Date: Mon, 13 Jun 2011 14:20:57 -0400 Subject: [PATCH 4/4] CC-2289:Differentiate between time and duration - modified createNewFormSections function so it populate form with defalt value --- airtime_mvc/application/models/Schedule.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 231d35e86..5676da420 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -765,6 +765,13 @@ class Schedule { $p_view->addNewShow = true; $formWhat->populate(array('add_show_id' => '-1')); + $formWhen->populate(array('add_show_start_date' => date("Y-m-d"), + 'add_show_start_time' => '00:00', + 'add_show_end_date_no_repeate' => date("Y-m-d"), + 'add_show_end_time' => '01:00', + 'add_show_duration' => '1h')); + + $formRepeats->populate(array('add_show_end_date' => date("Y-m-d"))); } }