From d9fa39f1d444fbd5a909aabe19dfc50aa8601131 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 27 Jan 2007 12:32:59 +0100 Subject: [PATCH] add new version indicator on main chrome --- functions.php | 27 +++++++++++++++++++++++---- images/new_version.png | Bin 0 -> 262 bytes modules/popup-dialog.php | 7 ++++++- tt-rss.css | 12 ++++++++++-- tt-rss.js | 11 +++++++++++ tt-rss.php | 7 +++++-- 6 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 images/new_version.png diff --git a/functions.php b/functions.php index 5f3978ff..6169f93a 100644 --- a/functions.php +++ b/functions.php @@ -2133,6 +2133,18 @@ print ""; } + if (CHECK_FOR_NEW_VERSION && $_SESSION["access_level"] >= 10) { + + if ($_SESSION["last_version_check"] + 600 < time()) { + $new_version_details = check_for_update($link); + + print ""; + + $_SESSION["last_version_check"] = time(); + } + } + print ""; } @@ -2595,7 +2607,7 @@ return array($tmp, $headlines_count); } - function check_for_update($link) { + function check_for_update($link, $brief_fmt = true) { $releases_feed = "http://tt-rss.spb.ru/releases.rss"; if (!CHECK_FOR_NEW_VERSION || $_SESSION["access_level"] < 10) { @@ -2625,9 +2637,16 @@ $content = sanitize_rss($latest_item["description"]); if (version_compare(VERSION, $latest_version) == -1) { - return "
- New version of Tiny-Tiny RSS ($latest_version) is available (click for details) -
$content
"; + if ($brief_fmt) { + return "
+ New version of Tiny-Tiny RSS ($latest_version) is available (click for details) +
$content
"; + } else { + return "New version of Tiny-Tiny RSS ($latest_version) is available: +
$content
"; + } + } } } diff --git a/images/new_version.png b/images/new_version.png new file mode 100644 index 0000000000000000000000000000000000000000..370073de1bfebb2d44f3aee0c42e0ce36d175cc6 GIT binary patch literal 262 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl;=8&~`zjDUQ}64!{5 z;QX|b^2DN42FH~Aq*MjZ+{Eu-@GG zeSg8!qepK2beQQError message"; + print "
Notice
"; print "
"; if ($param == 1) { @@ -14,6 +14,11 @@ start the daemon process or contact instance owner."); } + if ($param == 2) { + print check_for_update($link, false); + + } + print "
"; print "
"; diff --git a/tt-rss.css b/tt-rss.css index 5cf0ce7f..5cb6e894 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -76,7 +76,7 @@ ul.feedCatList { ul.feedCatList li { margin : 0px; - padding : 0px 0px 0px 0px; + padding : 0px 0px 2px 0px; color : black; } @@ -85,6 +85,10 @@ ul.feedList li { font-size : small; } +ul.feedCatList img { + vertical-align : bottom; +} + li.feedUnread, li.errorUnread, li.labelUnread, @@ -1431,4 +1435,8 @@ ul.headlineDropdownMenu ul li:hover { background-color : #f0f0f0; } - +#newVersionIcon { + vertical-align : middle; + cursor : pointer; + display : none; +} diff --git a/tt-rss.js b/tt-rss.js index 0e0886b8..34dab4d3 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -539,6 +539,17 @@ function parse_runtime_info(elem) { debug("RI: " + k + " => " + v); + if (k == "new_version_available") { + var icon = document.getElementById("newVersionIcon"); + if (icon) { + if (v == "1") { + icon.style.display = "inline"; + } else { + icon.style.display = "none"; + } + } + } + if (k == "daemon_is_running" && v != 1) { notify("Warning: Update daemon is not runing.", true, true); } diff --git a/tt-rss.php b/tt-rss.php index 57a750c5..dc1da0c3 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -102,12 +102,15 @@ window.onload = init;
 
-- 2.39.5