From add6d167e3676417f52b5f038ee1d249c3c71543 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 22 Nov 2011 10:35:01 -0500 Subject: [PATCH 1/7] CC-3071: Show adding "When" improvements - fixed - the issue is that it wasn't incrementing the date. - rewrote the code(cleaner and more intuitive) --- .../schedule/full-calendar-functions.js | 66 ++++++------------- 1 file changed, 20 insertions(+), 46 deletions(-) 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 dae0c5648..898144376 100644 --- a/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js +++ b/airtime_mvc/public/js/airtime/schedule/full-calendar-functions.js @@ -88,6 +88,15 @@ function adjustDateToServerDate(date, serverTimezoneOffset){ return date; } +function pad(number, length) { + var str = '' + number; + while (str.length < length) { + str = '0' + str; + } + + return str; +} + function dayClick(date, allDay, jsEvent, view) { var now, today, selected, chosenDate, chosenTime; @@ -111,58 +120,23 @@ function dayClick(date, allDay, jsEvent, view) { $(span).prev().remove(); $(span).remove(); } - - chosenDate = selected.getFullYear(); - - var month = selected.getMonth() + 1; - if(month < 10) { - chosenDate = chosenDate+'-0'+month; - } - else { - chosenDate = chosenDate+'-'+month; - } - - var day = selected.getDate(); - if(day < 10) { - chosenDate = chosenDate+'-0'+day; - } - else { - chosenDate = chosenDate+'-'+day; - } - - var min = selected.getMinutes(); - var hours = selected.getHours(); - if(min < 10){ - chosenTime = hours+":0"+min; - } - else { - chosenTime = hours+":"+min; - } - if(hours < 10){ - chosenTime = "0"+chosenTime; - } + // 1 hr + var duration = 60 * 60* 1000; - var endHour = hours + 1; - var chosenEndTime; + var endDateTime = new Date(selected.getTime() + duration); - if(min < 10){ - chosenEndTime = endHour+":0"+min; - } - else { - chosenEndTime = endHour+":"+min; - } - - if(endHour < 10){ - chosenEndTime = "0"+chosenEndTime; - } + chosenDate = selected.getFullYear() + '-' + pad(selected.getMonth()+1,2) + '-' + pad(selected.getDate(),2); + chosenTime = pad(selected.getHours(),2) + ':' + pad(selected.getMinutes(),2); + 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_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_end_date_no_repeat").val(endDateFormat); + $("#add_show_end_date").datepicker("option", "minDate", endDateFormat); + $("#add_show_end_date").val(endDateFormat); $("#add_show_start_time").val(chosenTime); - $("#add_show_end_time").val(chosenEndTime); + $("#add_show_end_time").val(endTimeFormat); $("#add_show_duration").val('1h'); $("#schedule-show-when").show(); From e1cb11f53d22f13d6a77b9e04023e7a93120c893 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 22 Nov 2011 12:22:34 -0500 Subject: [PATCH 2/7] -minor customization to automated tests --- dev_tools/fabric/fab_release_test.py | 4 ++-- dev_tools/fabric/run.sh | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dev_tools/fabric/fab_release_test.py b/dev_tools/fabric/fab_release_test.py index 25592c9e9..391b9280b 100644 --- a/dev_tools/fabric/fab_release_test.py +++ b/dev_tools/fabric/fab_release_test.py @@ -58,7 +58,7 @@ def create_fresh_os(vm_name, update_virtualenv=False, debian=False): then they will most likey have a different host key, and ssh will fail, warning about a possible man in the middle attack. """ - local("rm ~/.ssh/known_hosts") + local("rm -f ~/.ssh/known_hosts") vm_vdi_file = '%s.vdi'%vm_name vm_xml_file = '%s.xml'%vm_name @@ -103,7 +103,7 @@ def create_fresh_os(vm_name, update_virtualenv=False, debian=False): local('VBoxManage snapshot %s restore fresh_install'%vm_name) - local('VBoxManage modifyvm "%s" --bridgeadapter1 eth0'%vm_name) + local('VBoxManage modifyvm "%s" --bridgeadapter1 wlan0'%vm_name) local('VBoxManage startvm %s'%vm_name) print "Please wait while attempting to acquire IP address" diff --git a/dev_tools/fabric/run.sh b/dev_tools/fabric/run.sh index cfcd66132..2bd3aec3c 100755 --- a/dev_tools/fabric/run.sh +++ b/dev_tools/fabric/run.sh @@ -4,8 +4,9 @@ exec 2>&1 target="airtime_git_branch" #airtime_versions=("" "airtime_182_tar" "airtime_194_tar") -airtime_versions=("") -ubuntu_versions=("ubuntu_lucid_32" "ubuntu_lucid_64" "ubuntu_maverick_32" "ubuntu_maverick_64" "ubuntu_natty_32" "ubuntu_natty_64" "ubuntu_oneiric_32" "ubuntu_oneiric_64" "debian_squeeze_32" "debian_squeeze_64") +airtime_versions=("" "airtime_182_tar" "airtime_195_tar") +#ubuntu_versions=("ubuntu_lucid_32" "ubuntu_lucid_64" "ubuntu_maverick_32" "ubuntu_maverick_64" "ubuntu_natty_32" "ubuntu_natty_64" "ubuntu_oneiric_32" "ubuntu_oneiric_64" "debian_squeeze_32" "debian_squeeze_64") +ubuntu_versions=("ubuntu_natty_32" "ubuntu_natty_64") num1=${#ubuntu_versions[@]} num2=${#airtime_versions[@]} From 798fd4827477a627c0ed239969da2526c8f51f8d Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 22 Nov 2011 12:27:36 -0500 Subject: [PATCH 3/7] CC-3081: Upgrade 1.9.5->2.0 fails (PHP fatal error on db) -fixed --- install_minimal/DoctrineMigrations/Version20111114222927.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_minimal/DoctrineMigrations/Version20111114222927.php b/install_minimal/DoctrineMigrations/Version20111114222927.php index 5672e951f..b0cf33379 100644 --- a/install_minimal/DoctrineMigrations/Version20111114222927.php +++ b/install_minimal/DoctrineMigrations/Version20111114222927.php @@ -10,7 +10,7 @@ class Version20111114222927 extends AbstractMigration public function up(Schema $schema) { $cc_show_instances = $schema->getTable('cc_show_instances'); - $cc_show_instances->addColumn('deleted_instance', 'boolean', array('notnull' => true, 'default'=> '0')); + $cc_show_instances->addColumn('modified_instance', 'boolean', array('notnull' => true, 'default'=> '0')); } public function down(Schema $schema) From 212205b0ff9ab93cff25431ea60c549f07c2bd74 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 22 Nov 2011 18:03:47 -0500 Subject: [PATCH 4/7] CC-3070: Scheduling show on the 31st of a month causes problem to months that don't have 31 days -fixed. --- airtime_mvc/application/models/Show.php | 37 +++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 2d07001ed..85373d13a 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1197,12 +1197,39 @@ class Application_Model_Show { self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone); - $dt = new DateTime($start, new DateTimeZone($timezone)); - $dt->add(new DateInterval($p_interval)); - $start = $dt->format("Y-m-d H:i:s"); - $dt->setTimezone(new DateTimeZone('UTC')); - $utcStartDateTime = $dt; + if ($p_interval == 'P1M'){ + /* When adding months, there is a problem if we are on January 31st and add one month with PHP. + * What ends up happening is that since February 31st doesn't exist, the date returned is + * March 3rd. For now let's ignore the day and assume we are always working with the + * first of each month, and use PHP to add 1 month to this (this will take care of rolling + * over the years 2011->2012, etc.). Then let's append the actual day, and use the php + * checkdate() function, to see if it is valid. If not, then we'll just skip this month. */ + + $startDt = new DateTime($start, new DateTimeZone($timezone)); + + /* pass in only the year and month (not the day) */ + $dt = new DateTime($startDt->format("Y-m"), new DateTimeZone($timezone)); + + /* Keep adding 1 month, until we find the next month that contains the day + * we are looking for (31st day for example) */ + do { + $dt->add(new DateInterval($p_interval)); + } while(!checkdate($dt->format("m"), $startDt->format("d"), $dt->format("Y"))); + $dt->setDate($dt->format("Y"), $dt->format("m"), $startDt->format("d")); + + $start = $dt->format("Y-m-d H:i:s"); + + $dt->setTimezone(new DateTimeZone('UTC')); + $utcStartDateTime = $dt; + } else { + $dt = new DateTime($start, new DateTimeZone($timezone)); + $dt->add(new DateInterval($p_interval)); + $start = $dt->format("Y-m-d H:i:s"); + + $dt->setTimezone(new DateTimeZone('UTC')); + $utcStartDateTime = $dt; + } } From 8231df6c44b1e703963e20ab478184420a321cb6 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 23 Nov 2011 10:30:39 -0500 Subject: [PATCH 5/7] CC-3080: Select stream: drop-down menu does not really select stream, makes no difference to output quality on Firefox 3.6 -should be fixed. --- .../application/views/scripts/dashboard/stream-player.phtml | 2 -- 1 file changed, 2 deletions(-) diff --git a/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml b/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml index 6729b4fde..5c5020459 100644 --- a/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml +++ b/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml @@ -28,8 +28,6 @@ $(document).ready(function(){ $("#combo-box").change(function(eventObject){ var elem = $("#combo-box option:selected"); - console.log(elem); - setjPlayer(elem.attr("data-url"), elem.attr("data-type"), elem.attr("server-type")); }); From 8766cade49b22f48a961554d935578d70581eaf5 Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Wed, 23 Nov 2011 10:39:05 -0500 Subject: [PATCH 6/7] CC-3092: Station Information: not able to upload logo - Adding a return statement fixed it...I don't what was I thinking... - Some indention seems messed up, fixed it --- .../forms/customfilters/ImageSize.php | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/airtime_mvc/application/forms/customfilters/ImageSize.php b/airtime_mvc/application/forms/customfilters/ImageSize.php index 9dcfffffe..69db3cb82 100644 --- a/airtime_mvc/application/forms/customfilters/ImageSize.php +++ b/airtime_mvc/application/forms/customfilters/ImageSize.php @@ -1,42 +1,42 @@ 1) { + // img too big! create a scaled down image + $newWidth = round($origWidth / $ratio); + $newHeight = round($origHeight / $ratio); + $resized = imagecreatetruecolor($newWidth, $newHeight); + imagecopyresampled($resized, $image, 0, 0, 0, 0, $newWidth, $newHeight, $origWidth, $origHeight); + + // determine type and store to disk + $explodeResult = explode(".", $value); + $type = strtolower($explodeResult[count($explodeResult) - 1]); + $writeFunc = 'image' . $type; + if ($type == 'jpeg' || $type == 'jpg') { + imagejpeg($resized, $value, 100); + } else { + $writeFunc($resized, $value); + } } - // create a scaled down image - $newWidth = round($origWidth / $ratio); - $newHeight = round($origHeight / $ratio); - $resized = imagecreatetruecolor($newWidth, $newHeight); - imagecopyresampled($resized, $image, 0, 0, 0, 0, $newWidth, $newHeight, $origWidth, $origHeight); - - // determine type and store to disk - $explodeResult = explode(".", $value); - $type = $explodeResult[count($explodeResult) - 1]; - $writeFunc = 'image' . $type; - if($type == 'jpeg' || $type == 'jpg') { - imagejpeg($resized, $value, 100); - } else { - $writeFunc($resized, $value); - } - } + return $value; + } } ?> From 161fa80d6487683ee3cb07ec845511d5a169cbb8 Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Wed, 23 Nov 2011 12:00:54 -0500 Subject: [PATCH 7/7] CC-3091: Widget "Today's Program" doesn't show any content It's not showing anything because I thought it's not suppose to display the currently playing show. Fixed by retrieving the currently playing show along with next shows, and display them. todayInfoAction is no longer needed since liveInfoAction does the same thing. --- .../application/controllers/ApiController.php | 26 ------------------- widgets/js/jquery.showinfo.js | 6 +++-- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 590edb35e..2d42aff47 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -202,32 +202,6 @@ class ApiController extends Zend_Controller_Action exit; } } - - public function todayInfoAction() - { - if (Application_Model_Preference::GetAllow3rdPartyApi()){ - // disable the view and the layout - $this->view->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - $date = new Application_Model_DateHelper; - $utcTimeNow = $date->getUtcTimestamp(); - $utctimeEnd = Application_Model_DateHelper::GetDayEndTimestampInUtc(); - - $result = array("env"=>APPLICATION_ENV, - "schedulerTime"=>gmdate("Y-m-d H:i:s"), - "nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, 5, $utcTimeEnd)); - - Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); - - header("Content-type: text/javascript"); - echo $_GET['callback'].'('.json_encode($result).')'; - } else { - header('HTTP/1.0 401 Unauthorized'); - print 'You are not allowed to access this resource. '; - exit; - } - } public function weekInfoAction() { diff --git a/widgets/js/jquery.showinfo.js b/widgets/js/jquery.showinfo.js index b57f8d7c4..1c75b7918 100644 --- a/widgets/js/jquery.showinfo.js +++ b/widgets/js/jquery.showinfo.js @@ -16,7 +16,9 @@ getServerData(); function updateWidget(){ - var shows = sd.getNextShows(); + var currentShow = sd.getCurrentShow(); + var nextShows = sd.getNextShows(); + var shows = currentShow.length == 0 ? nextShows : currentShow.concat(nextShows); tableString = ""; tableString += "

" + options.text.onAirToday + "

"; @@ -50,7 +52,7 @@ } function getServerData(){ - $.ajax({ url: options.sourceDomain + "api/today-info/", dataType:"jsonp", success:function(data){ + $.ajax({ url: options.sourceDomain + "api/live-info/", dataType:"jsonp", success:function(data){ processData(data); }, error:airtimeScheduleJsonpError}); setTimeout(getServerData, options.updatePeriod*1000);