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/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; + } } ?> diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index d8ce40c68..8da2ae4f2 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1191,12 +1191,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; + } } 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")); }); 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(); 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[@]} 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) 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 += "