diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index f3bf8f561..458d45837 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -53,6 +53,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $view->headLink()->appendStylesheet($baseUrl.'/css/redmond/jquery-ui-1.8.8.custom.css'); $view->headLink()->appendStylesheet($baseUrl.'/css/pro_dropdown_3.css'); + $view->headLink()->appendStylesheet($baseUrl.'/css/qtip/jquery.qtip.min.css'); $view->headLink()->appendStylesheet($baseUrl.'/css/styles.css'); } @@ -71,6 +72,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap //scripts for now playing bar $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js','text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/playlist.js','text/javascript'); + $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/versiontooltip.js','text/javascript'); $view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js','text/javascript'); } diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index 6aa4a5b43..2dad3da53 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -36,7 +36,6 @@ class LibraryController extends Zend_Controller_Action $this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css'); $this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css'); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/qtip/jquery.qtip.min.css'); $this->_helper->layout->setLayout('library'); diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 194fc0df0..ceb330552 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -56,7 +56,6 @@ class ScheduleController extends Zend_Controller_Action $this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css'); $this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css'); $this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css'); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/qtip/jquery.qtip.min.css'); Application_Model_Schedule::createNewFormSections($this->view); diff --git a/airtime_mvc/application/layouts/scripts/layout.phtml b/airtime_mvc/application/layouts/scripts/layout.phtml index 232fecd37..53ff557d1 100644 --- a/airtime_mvc/application/layouts/scripts/layout.phtml +++ b/airtime_mvc/application/layouts/scripts/layout.phtml @@ -10,6 +10,7 @@
+ versionNotify() ?> partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining())) ?> + versionNotify() ?> partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining())) ?> " . $latest . ""; + if(($diff == 0 && $current == $latest) || $diff < 0) { + // current version is up to date + $bg .= "icon_uptodate.png"; + $msg = "You are running the latest version"; + } else if($diff <= 2) { + // 2 or less major versions back + $bg .= "icon_update.png"; + $msg = "New version available: " . $link; + } else if($diff == 3) { + // 3 major versions back + $bg .= "icon_update2.png"; + $msg = "This version will soon be obsolete.
Please upgrade to " . $link; + } else { + // more than 3 major versions back + $bg .= "icon_outdated.png"; + $msg = "This version is no longer supported.
Please upgrade to " . $link; + } + + $result = "" + . "" + . "
"; + return $result; + } +} diff --git a/airtime_mvc/public/css/images/icon_outdated.png b/airtime_mvc/public/css/images/icon_outdated.png new file mode 100644 index 000000000..57202058f Binary files /dev/null and b/airtime_mvc/public/css/images/icon_outdated.png differ diff --git a/airtime_mvc/public/css/images/icon_update.png b/airtime_mvc/public/css/images/icon_update.png new file mode 100644 index 000000000..7bd78081e Binary files /dev/null and b/airtime_mvc/public/css/images/icon_update.png differ diff --git a/airtime_mvc/public/css/images/icon_update2.png b/airtime_mvc/public/css/images/icon_update2.png new file mode 100644 index 000000000..38fa5330f Binary files /dev/null and b/airtime_mvc/public/css/images/icon_update2.png differ diff --git a/airtime_mvc/public/css/images/icon_uptodate.png b/airtime_mvc/public/css/images/icon_uptodate.png new file mode 100644 index 000000000..8ed6bb01d Binary files /dev/null and b/airtime_mvc/public/css/images/icon_uptodate.png differ diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index c695fdb7d..927cea5f4 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -57,6 +57,31 @@ select { display:block; } +/* Version Notification Starts*/ +#version_icon { + position:absolute; + right:85px; + top:104px; + height:35px; + width:35px; + z-index:1000; + display:block; + cursor:pointer; + + background-repeat:no-repeat; + background-position:center; +} + +#ui-tooltip-version a { + color:#ff5d1a; + text-decoration:none; +} + +#ui-tooltip-version { + font-size: 14px; +} +/* Version Notification Ends*/ + /* Clearfix */ .clearfix:after, li:after { content: "."; display: block; height: 0; clear: both; visibility: hidden;} .clearfix, li { display: inline-block; } diff --git a/airtime_mvc/public/js/airtime/dashboard/versiontooltip.js b/airtime_mvc/public/js/airtime/dashboard/versiontooltip.js new file mode 100644 index 000000000..02660c019 --- /dev/null +++ b/airtime_mvc/public/js/airtime/dashboard/versiontooltip.js @@ -0,0 +1,53 @@ +/** + * Get the tooltip message to be displayed, + * which is stored inside a pair of hidden div tags + */ +function getContent() { + return $("#version_message").html(); +} + +/** + * Get the current version, + * which is stored inside a pair of hidden div tags + */ +function getCurrentVersion() { + return $("#version_current").html(); +} + +/** + * Sets up the tooltip for version notification + */ +function setupVersionQtip(){ + var qtipElem = $('#version_icon'); + if (qtipElem.length > 0){ + qtipElem.qtip({ + id: 'version', + content: { + text: getContent(), + title: { + text: getCurrentVersion(), + button: true + } + }, + show: 'click', /* Show on click */ + hide: false, /* Don't hide on mouseout */ + position: { + my: "top right", + at: "bottom left" + }, + style: { + border: { + width: 0, + radius: 4 + }, + classes: "ui-tooltip-dark ui-tooltip-rounded" + } + }); + } +} + +$(document).ready(function() { + if($('#version_message').length > 0) { + setupVersionQtip(); + } +}); \ No newline at end of file diff --git a/utils/phone_home_stat.php b/utils/phone_home_stat.php index 2ac9fc855..929325f97 100644 --- a/utils/phone_home_stat.php +++ b/utils/phone_home_stat.php @@ -74,6 +74,18 @@ if(Application_Model_Preference::GetSupportFeedback() == '1'){ $result = curl_exec($ch); } +// Get latest version from stat server and store to db +if(Application_Model_Preference::GetPlanLevel() == 'disabled'){ + $url = 'http://stat-dev.sourcefabric.org/airtime_latest_version'; + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_URL, $url); + $result = curl_exec($ch); + + Application_Model_Preference::SetLatestVersion($result); +} + /** * Ensures that the user is running this PHP script with root * permissions. If not running with root permissions, causes the