From 5d31e4c2a04bb3b0ed8dcf10063e020d4dd402a7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 8 Feb 2012 14:57:48 -0500 Subject: [PATCH] CC-3289: Widgets should have a version string so users can make sure widgets are up to date - I updated the ApiController.php file to add a widgetsVersion value used in the response to widgets - I updated the widgets jquery.showinfo.js file to check the version and report back to the user. --- .../application/controllers/ApiController.php | 5 ++-- widgets/js/jquery.showinfo.js | 25 ++++++++++++++++--- widgets/widget_schedule.html | 14 +++++------ widgets/widgets.html | 4 +-- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index d5394583a..0143b374a 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -215,7 +215,8 @@ class ApiController extends Zend_Controller_Action "currentShow"=>Application_Model_Show::GetCurrentShow($utcTimeNow), "nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, $limit, $utcTimeEnd), "timezone"=> date("T"), - "timezoneOffset"=> date("Z")); + "timezoneOffset"=> date("Z"), + "widgetVersion"=>"1.0"); //used by caller to determine if the airtime they are running or widgets in use is out of date. //Convert from UTC to localtime for user. Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); @@ -254,7 +255,7 @@ class ApiController extends Zend_Controller_Action $result[$dow[$i]] = $shows; } - + $result['widgetVersion'] = "1.0"; //used by caller to determine if the airtime they are running or widgets in use is out of date. header("Content-type: text/javascript"); echo $_GET['callback'].'('.json_encode($result).')'; } else { diff --git a/widgets/js/jquery.showinfo.js b/widgets/js/jquery.showinfo.js index d1bdd7f3f..049d65304 100644 --- a/widgets/js/jquery.showinfo.js +++ b/widgets/js/jquery.showinfo.js @@ -22,7 +22,7 @@ tableString = ""; tableString += "

" + options.text.onAirToday + "

"; - tableString += ""+ + tableString += "
"+ ""; for (var i=0; i"+showStatus+" >>"); - obj.append("
'+ ''+ ''+ ''+ @@ -234,6 +236,7 @@ } function processData(data){ + checkWidgetVersion(data); updateWidget(data); } @@ -393,3 +396,19 @@ function convertDateToPosixTime(s){ return Date.UTC(year, month-1, day, hour, minute, sec, msec); } + +/* Checks the incomming data's widget version tag. +* The current widget version is 1. +* -If the value returned is equal to 1 do nothing. +* -If the value doesn't exist or it is great then 1 throw error warning the user they should upgrade their airtime install. +* -If the value is less then 1 warn the user that they should upgrade the javascript to a newer version. +*/ +function checkWidgetVersion(data){ + var widgetVersion = data['widgetVersion']; + //console.log(widgetVersion); + if (undefined === widgetVersion || widgetVersion > 1) + throw 'The widgets you are using are out of date, please get the latest jquery.showinfo.js file.'; + else if (widgetVersion < 1) + throw 'The version of airtime that you are using should be upgraded to work with this widget'; + +} diff --git a/widgets/widget_schedule.html b/widgets/widget_schedule.html index a24f36ef6..f7e8ae2de 100644 --- a/widgets/widget_schedule.html +++ b/widgets/widget_schedule.html @@ -34,7 +34,7 @@
  • Sunday
  • -
    +
    @@ -316,7 +316,7 @@
    - +
    @@ -542,7 +542,7 @@
    - +
    @@ -810,7 +810,7 @@
    - +
    @@ -1099,7 +1099,7 @@
    - +
    @@ -1374,7 +1374,7 @@
    - +
    @@ -1572,7 +1572,7 @@
    - +
    diff --git a/widgets/widgets.html b/widgets/widgets.html index c5f571988..0c1ba7e2c 100644 --- a/widgets/widgets.html +++ b/widgets/widgets.html @@ -9,7 +9,7 @@

    On air now >>

    -
      +
      • Current: RĂ©seau jeunesse02:2227:37
      @@ -18,7 +18,7 @@

      On air today

      -
    +
    04:30 - 05:00