]> git.wh0rd.org - tt-rss.git/blobdiff - offline.js
daemon2: fix removing of pids from ctimes array
[tt-rss.git] / offline.js
index f62bd46b9b76ee52178eb2e6c6f10aef5f0647a2..372d94392790cc4cb2ad103e3e3ec488f83e626d 100644 (file)
@@ -8,7 +8,7 @@ var articles_synced = 0;
 var sync_in_progress = false;
 var sync_timer = false;
 
-function view_offline(id, feed_id) {
+function view_offline(id) {
        try {
 
                enableHotkeys();
@@ -110,7 +110,6 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
                        catchup_local_feed(feed_id, is_cat);
                }
 
-               disableContainerChildren("headlinesToolbar", false);
                Form.enable("main_toolbar_form");
 
                var f = $("headlines-frame");
@@ -211,7 +210,7 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
                
                        var toolbar_form = document.forms["main_toolbar_form"];
                        
-                       var limit = toolbar_form.limit[toolbar_form.limit.selectedIndex].value;
+                       //var limit = toolbar_form.limit[toolbar_form.limit.selectedIndex].value;
                        var view_mode = toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value;
 
                        var limit_qpart = "";
@@ -337,12 +336,12 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
                                        
                                        tmp += "<td class='hlMarkedPic'>"+marked_pic+"</td>";
                
-                                       tmp += "<td onclick='view("+id+","+feed_id+")' "+
+                                       tmp += "<td onclick='view("+id+")' "+
                                                "class='hlContent' valign='middle'>";
                
                                        tmp += "<a target=\"_blank\" id=\"RTITLE-"+id+"\" href=\"" + 
                                                rs.fieldByName("link") + "\"" +
-                                               "onclick=\"return view("+id+","+feed_id+");\">"+
+                                               "onclick=\"return view("+id+");\">"+
                                                rs.fieldByName("title");
        
                                        tmp += "<span class=\"contentPreview\"> - "+content_preview+"</span>";
@@ -359,7 +358,7 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
 
                                        tmp += "</td>";
 
-                                       tmp += "<td class=\"hlUpdated\" onclick='view("+id+","+feed_id+")'>"+
+                                       tmp += "<td class=\"hlUpdated\" onclick='view("+id+")'>"+
                                                "<nobr>"+rs.fieldByName("updated").substring(0,16)+
                                                "</nobr></td>";
        
@@ -602,7 +601,6 @@ function init_offline() {
                store.enabled = true;
 
                Element.hide("dispSwitchPrompt");
-               Element.hide("feedBrowserPrompt");
 
                Element.hide("topLinksOnline");
                Element.show("topLinksOffline");
@@ -854,7 +852,7 @@ function update_offline_data(stage) {
 
                if (!db || offline_mode || getInitParam("offline_enabled") != "1") return;
 
-               var query = "backend.php?op=rpc&subop=download";
+               var query = "?op=rpc&subop=download";
                
                var rs = db.execute("SELECT MAX(id), MIN(id) FROM articles");
 
@@ -877,10 +875,10 @@ function update_offline_data(stage) {
                var to_sync = prepare_local_sync_data();
 
                if (to_sync != "") {
-                       to_sync = "?sync=" + param_escape(to_sync);
+                       to_sync = "&sync=" + param_escape(to_sync);
                }
 
-               debug(query + "/" + to_sync);
+               query = query + to_sync;
 
                var pic = $("offlineModePic");
 
@@ -896,8 +894,10 @@ function update_offline_data(stage) {
 
                sync_in_progress = true;
 
-               new Ajax.Request(query, {
-                       parameters: to_sync,
+               debug(query);
+
+               new Ajax.Request("backend.php", {
+                       parameters: query,
                        onComplete: function(transport) { 
                                offline_download_parse(stage, transport);                               
                        } });
@@ -1751,3 +1751,39 @@ function offlineConfirmModeChange() {
                exception_error("offlineConfirmModeChange", e);
        }
 }
+
+function printFeedEntry(id, title, row_class, unread, icon) {
+
+       var tmp = "";
+       var fctr_class = "";
+       var feed_icon = "";
+
+       if (unread > 0) {
+               row_class += "Unread";
+               fctr_class = "feedCtrHasUnread";
+       } else {
+               fctr_class = "feedCtrNoUnread";
+       }
+
+       if (icon) {
+               feed_icon = "<img id='FIMG-"+id+"' src='" + icon + "'>";
+       } else {
+               feed_icon = "<img id='FIMG-"+id+"' src='images/blank_icon.gif'>";
+       }
+
+       var link = "<a title=\"FIXME\" id=\"FEEDL-"+id+"\""+
+               "href=\"javascript:viewfeed('"+id+"', '', false, '', false, 0);\">"+
+               title + "</a>";
+
+       tmp += "<li id='FEEDR-"+id+"' class="+row_class+">" + feed_icon + 
+               "<span id=\"FEEDN-"+id+"\">" + link + "</span>";
+
+       tmp += " <span class='"+fctr_class+"' id=\"FEEDCTR-"+id+"\">" +
+           "(<span id=\"FEEDU-"+id+"\">"+unread+"</span>)</span>";
+                       
+       tmp += "</li>";
+
+       return tmp;
+}
+
+