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.
This commit is contained in:
parent
214c6e85cc
commit
5d31e4c2a0
|
@ -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 {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
tableString = "";
|
||||
tableString += "<h3>" + options.text.onAirToday + "</h3>";
|
||||
tableString += "<table width='100%' border='0' cellspacing='0' cellpadding='0' class='widget widget no-playing-list small'>"+
|
||||
tableString += "<table width='100%' border='0' cellspacing='0' cellpadding='0' class='widget widget now-playing-list small'>"+
|
||||
"<tbody>";
|
||||
|
||||
for (var i=0; i<shows.length; i++){
|
||||
|
@ -44,6 +44,7 @@
|
|||
}
|
||||
|
||||
function processData(data){
|
||||
checkWidgetVersion(data);
|
||||
sd = new ScheduleData(data);
|
||||
updateWidget();
|
||||
}
|
||||
|
@ -117,7 +118,7 @@
|
|||
|
||||
obj.empty();
|
||||
obj.append("<h4>"+showStatus+" >></h4>");
|
||||
obj.append("<ul class='widget no-playing-bar'>" +
|
||||
obj.append("<ul class='widget now-playing-bar'>" +
|
||||
"<li class='current'>"+options.text.current+": "+currentShowName+
|
||||
"<span id='time-elapsed' class='time-elapsed'>"+timeElapsed+"</span>" +
|
||||
"<span id='time-remaining' class='time-remaining'>"+timeRemaining+"</span>"+
|
||||
|
@ -127,6 +128,7 @@
|
|||
}
|
||||
|
||||
function processData(data){
|
||||
checkWidgetVersion(data);
|
||||
sd = new ScheduleData(data);
|
||||
}
|
||||
|
||||
|
@ -189,7 +191,7 @@
|
|||
function updateWidget(data){
|
||||
for (var i=0; i<dow.length; i++){
|
||||
var html =
|
||||
'<table class="widget widget no-playing-list">'+
|
||||
'<table class="widget widget now-playing-list">'+
|
||||
'<colgroup>'+
|
||||
'<col width="150" />'+
|
||||
'<col width="350" />'+
|
||||
|
@ -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';
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<li><a href="#sunday">Sunday</a></li>
|
||||
</ul>
|
||||
<div id="monday">
|
||||
<table class="widget widget no-playing-list">
|
||||
<table class="widget widget now-playing-list">
|
||||
<colgroup>
|
||||
<col width="150">
|
||||
<col width="350">
|
||||
|
@ -316,7 +316,7 @@
|
|||
</table>
|
||||
</div>
|
||||
<div id="tuesday">
|
||||
<table class="widget widget no-playing-list">
|
||||
<table class="widget widget now-playing-list">
|
||||
<colgroup>
|
||||
<col width="150">
|
||||
<col width="350">
|
||||
|
@ -542,7 +542,7 @@
|
|||
</table>
|
||||
</div>
|
||||
<div id="wednesday">
|
||||
<table class="widget widget no-playing-list">
|
||||
<table class="widget widget now-playing-list">
|
||||
<colgroup>
|
||||
<col width="150">
|
||||
<col width="350">
|
||||
|
@ -810,7 +810,7 @@
|
|||
</table>
|
||||
</div>
|
||||
<div id="thursday">
|
||||
<table class="widget widget no-playing-list">
|
||||
<table class="widget widget now-playing-list">
|
||||
<colgroup>
|
||||
<col width="150">
|
||||
<col width="350">
|
||||
|
@ -1099,7 +1099,7 @@
|
|||
</table>
|
||||
</div>
|
||||
<div id="friday">
|
||||
<table class="widget widget no-playing-list">
|
||||
<table class="widget widget now-playing-list">
|
||||
<colgroup>
|
||||
<col width="150">
|
||||
<col width="350">
|
||||
|
@ -1374,7 +1374,7 @@
|
|||
</table>
|
||||
</div>
|
||||
<div id="saturday">
|
||||
<table class="widget widget no-playing-list">
|
||||
<table class="widget widget now-playing-list">
|
||||
<colgroup>
|
||||
<col width="150">
|
||||
<col width="350">
|
||||
|
@ -1572,7 +1572,7 @@
|
|||
</table>
|
||||
</div>
|
||||
<div id="sunday">
|
||||
<table class="widget widget no-playing-list">
|
||||
<table class="widget widget now-playing-list">
|
||||
<colgroup>
|
||||
<col width="150">
|
||||
<col width="350">
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<body>
|
||||
<div id="headerLiveHolder">
|
||||
<h4>On air now >></h4>
|
||||
<ul class="widget no-playing-bar">
|
||||
<ul class="widget now-playing-bar">
|
||||
<li class="current">Current: Réseau jeunesse<span class="time-elapsed" id="time-elapsed">02:22</span><span class="time-remaining" id="time-remaining">27:37</span></li>
|
||||
<li class="next">Next: Mano River Press (EN)<span>07:00 - 07:30</span></li>
|
||||
</ul>
|
||||
|
@ -18,7 +18,7 @@
|
|||
<br />
|
||||
<div id="onAirToday">
|
||||
<h3>On air today</h3>
|
||||
<table cellspacing="0" cellpadding="0" border="0" width="100%" class="widget widget no-playing-list small">
|
||||
<table cellspacing="0" cellpadding="0" border="0" width="100%" class="widget widget now-playing-list small">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="time">04:30 - 05:00</td>
|
||||
|
|
Loading…
Reference in New Issue