]> git.wh0rd.org - tt-rss.git/commitdiff
offline: only ask for offline mode when possible
authorAndrew Dolgov <fox@bah.org.ru>
Fri, 13 Feb 2009 06:50:48 +0000 (09:50 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Fri, 13 Feb 2009 06:50:48 +0000 (09:50 +0300)
offline.js

index ff09b7167aafe2d84c54fada8fc212ecc66a588a..d9b32cf28b1701c51826ac73b032c40def1bcb4a 100644 (file)
@@ -1130,9 +1130,7 @@ function init_gears() {
        }
 }
 
-function gotoOffline() {
-
-//     debug("[Local store] currentVersion = " + store.currentVersion);
+function offlineArticlesStored() {
 
        var rs = db.execute("SELECT COUNT(*) FROM articles");
        var count = 0;
@@ -1142,7 +1140,15 @@ function gotoOffline() {
 
        rs.close();
 
-       if (count == 0) {
+       return count;
+}
+
+function gotoOffline() {
+
+//     debug("[Local store] currentVersion = " + store.currentVersion);
+
+
+       if (offlineArticlesStored() == 0) {
                notify_error("You have to synchronize some articles before going into offline mode.");
                return;
        }
@@ -1692,7 +1698,7 @@ function offlineSyncShowHideElems(syncing) {
 function offlineConfirmModeChange() {
        try {
                
-               if (db) {
+               if (db && getInitParam("offline_enabled") == "1" && offlineArticlesStored() > 0) {
                        var ok = confirm(__("Tiny Tiny RSS has trouble accessing its server. Would you like to go offline?")); 
 
                        if (ok) {