CC-3289: Widgets should have a version string so users can make sure widgets are up to date
-I've updated the messages used to notify the user to be more explicit. -I've moved the constant used to track widget api versioning to /application/configs/constants.php
This commit is contained in:
parent
51f97361bb
commit
b603726a39
3 changed files with 13 additions and 9 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
define('AIRTIME_COPYRIGHT_DATE', '2010-2011');
|
define('AIRTIME_COPYRIGHT_DATE', '2010-2011');
|
||||||
define('AIRTIME_REST_VERSION', '1.1');
|
define('AIRTIME_REST_VERSION', '1.1');
|
||||||
|
define('AIRTIME_API_VERSION', '1.0');
|
||||||
|
|
||||||
// Metadata Keys for files
|
// Metadata Keys for files
|
||||||
define('MDATA_KEY_FILEPATH', 'filepath');
|
define('MDATA_KEY_FILEPATH', 'filepath');
|
||||||
|
|
|
@ -216,7 +216,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
"nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, $limit, $utcTimeEnd),
|
"nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, $limit, $utcTimeEnd),
|
||||||
"timezone"=> date("T"),
|
"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.
|
"AIRTIME_API_VERSION"=>AIRTIME_API_VERSION); //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.
|
//Convert from UTC to localtime for user.
|
||||||
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||||
|
@ -255,7 +255,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
$result[$dow[$i]] = $shows;
|
$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.
|
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
|
||||||
header("Content-type: text/javascript");
|
header("Content-type: text/javascript");
|
||||||
echo $_GET['callback'].'('.json_encode($result).')';
|
echo $_GET['callback'].'('.json_encode($result).')';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
var AIRTIME_API_VERSION = "1.0";
|
||||||
|
|
||||||
(function($){
|
(function($){
|
||||||
$.fn.airtimeShowSchedule = function(options) {
|
$.fn.airtimeShowSchedule = function(options) {
|
||||||
|
|
||||||
|
@ -6,7 +8,7 @@
|
||||||
sourceDomain: "http://localhost/", //where to get show status from
|
sourceDomain: "http://localhost/", //where to get show status from
|
||||||
text: {onAirToday:"On air today"}
|
text: {onAirToday:"On air today"}
|
||||||
};
|
};
|
||||||
var options = $.extend(true, defaults, options);
|
options = $.extend(true, defaults, options);
|
||||||
options.sourceDomain = addEndingBackslash(options.sourceDomain);
|
options.sourceDomain = addEndingBackslash(options.sourceDomain);
|
||||||
|
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
|
@ -158,7 +160,7 @@
|
||||||
dowText: {monday:"Monday", tuesday:"Tuesday", wednesday:"Wednesday", thursday:"Thursday", friday:"Friday", saturday:"Saturday", sunday:"Sunday"},
|
dowText: {monday:"Monday", tuesday:"Tuesday", wednesday:"Wednesday", thursday:"Thursday", friday:"Friday", saturday:"Saturday", sunday:"Sunday"},
|
||||||
miscText: {time:"Time", programName:"Program Name", details:"Details", readMore:"Read More"}
|
miscText: {time:"Time", programName:"Program Name", details:"Details", readMore:"Read More"}
|
||||||
};
|
};
|
||||||
var options = $.extend(true, defaults, options);
|
options = $.extend(true, defaults, options);
|
||||||
options.sourceDomain = addEndingBackslash(options.sourceDomain);
|
options.sourceDomain = addEndingBackslash(options.sourceDomain);
|
||||||
|
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
|
@ -404,11 +406,12 @@ function convertDateToPosixTime(s){
|
||||||
* -If the value is less then 1 warn the user that they should upgrade the javascript to a newer version.
|
* -If the value is less then 1 warn the user that they should upgrade the javascript to a newer version.
|
||||||
*/
|
*/
|
||||||
function checkWidgetVersion(data){
|
function checkWidgetVersion(data){
|
||||||
var widgetVersion = data['widgetVersion'];
|
|
||||||
|
|
||||||
if (undefined === widgetVersion || widgetVersion > 1)
|
var airtimeServerWidgetVersion = data['AIRTIME_API_VERSION'];
|
||||||
throw 'The widgets you are using are out of date, please get the latest jquery.showinfo.js file.';
|
|
||||||
else if (widgetVersion < 1)
|
if (undefined === airtimeServerWidgetVersion || airtimeServerWidgetVersion > AIRTIME_API_VERSION )
|
||||||
throw 'The version of airtime that you are using should be upgraded to work with this widget.';
|
throw "The version of widgets you are using is out of date with the Airtime installation, please update your widgets javascript file. (Airtime widget API version is "+airtimeServerWidgetVersion+", this widget's API version is "+AIRTIME_API_VERSION+")";
|
||||||
|
else if (airtimeServerWidgetVersion < AIRTIME_API_VERSION )
|
||||||
|
throw "The Airtime server has a different version than this widget supports. Please get the correct widget version for your Airtime installation. (Airtime widget API version is "+airtimeServerWidgetVersion+", this widget's API version is "+AIRTIME_API_VERSION+")";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue