]> git.wh0rd.org Git - tt-rss.git/commitdiff
add new version indicator on main chrome
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 27 Jan 2007 11:32:59 +0000 (12:32 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 27 Jan 2007 11:32:59 +0000 (12:32 +0100)
functions.php
images/new_version.png [new file with mode: 0644]
modules/popup-dialog.php
tt-rss.css
tt-rss.js
tt-rss.php

index 5f3978ff90083c000ee45449a648148bac1daca6..6169f93a8cd4b827e3c4f3537e3460d842e0922d 100644 (file)
                        print "<param key=\"daemon_is_running\" value=\"".
                                sprintf("%d", file_is_locked("update_daemon.lock")) . "\"/>";
                }
+               if (CHECK_FOR_NEW_VERSION && $_SESSION["access_level"] >= 10) {
+                       
+                       if ($_SESSION["last_version_check"] + 600 < time()) {
+                               $new_version_details = check_for_update($link);
+
+                               print "<param key=\"new_version_available\" value=\"".
+                                       sprintf("%d", $new_version_details != ""). "\"/>";
+
+                               $_SESSION["last_version_check"] = time();
+                       }
+               }
+
                print "</runtime-info>";
        }
 
                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) {
                        $content = sanitize_rss($latest_item["description"]);
 
                        if (version_compare(VERSION, $latest_version) == -1) {
-                               return "<div class=\"notice\"><a href=\"javascript:showBlockElement('milestoneDetails')\">      
-                                       New version of Tiny-Tiny RSS ($latest_version) is available (click for details)</a>
-                                       <div id=\"milestoneDetails\">$content</div></div>";
+                               if ($brief_fmt) {
+                                       return "<div class=\"notice\"><a href=\"javascript:showBlockElement('milestoneDetails')\">      
+                                               New version of Tiny-Tiny RSS ($latest_version) is available (click for details)</a>
+                                               <div id=\"milestoneDetails\">$content</div></div>";
+                               } else {
+                                       return "New version of <a target='_new' 
+                                               href='http://tt-rss.spb.ru/'>Tiny-Tiny RSS</a> ($latest_version) is available:
+                                                <div>$content</div>";  
+                               }
+
                        }                       
                }
        }
diff --git a/images/new_version.png b/images/new_version.png
new file mode 100644 (file)
index 0000000..370073d
Binary files /dev/null and b/images/new_version.png differ
index 414e01006e211585d1ad574063491671b23c1e4b..d2b0ff9cfaa5fc0ad9444d253f6d9415ac4b261e 100644 (file)
@@ -5,7 +5,7 @@
 
                if ($id == "explainError") {
 
-                       print "<div id=\"infoBoxTitle\">Error message</div>";
+                       print "<div id=\"infoBoxTitle\">Notice</div>";
                        print "<div class=\"infoBoxContents\">";
 
                        if ($param == 1) {
                                        start the daemon process or contact instance owner.");
                        }
 
+                       if ($param == 2) {
+                               print check_for_update($link, false);
+
+                       }
+
                        print "</div>";
 
                        print "<div align='center'>";
index 5cf0ce7f594823f7f35eea7c7bef8cf225aa0fbe..5cb6e894794a6c3cf598aa39c2640eff293ac41b 100644 (file)
@@ -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;
+}
index 0e0886b8526fafc5d7f278be9ab20b7840e2d822..34dab4d3adf3bc9eff007c9ae1d77f915be74c9a 100644 (file)
--- 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("<span onclick=\"javascript:explainError(1)\">Warning: Update daemon is not runing.</span>", true, true);
                }
index 57a750c595e5e909eebf7ecf9377444f63f15a3a..dc1da0c3ace2b5f1588430454a6a6107680453eb 100644 (file)
@@ -102,12 +102,15 @@ window.onload = init;
 <div id="infoBoxShadow"><div id="infoBox">&nbsp;</div></div>
 
 <div id="header">
+       <div style="float : right">
        <?php if (!SINGLE_USER_MODE) { ?>
-               <div style="float : right">
                        <?php echo _('Hello,') ?> <b><?php echo $_SESSION["name"] ?></b>
                        (<a href="logout.php">Logout</a>)
-               </div>
        <?php } ?>
+       <img id="newVersionIcon" onclick="javascript:explainError(2)" 
+               src="images/new_version.png" title="New version is available!" 
+               alt="new_version_icon">
+       </div>
        <img src="<?php echo $theme_image_path ?>images/ttrss_logo.png" alt="Tiny Tiny RSS"/>   
 </div>