|
|
@ -679,7 +679,7 @@ function offline_download_parse(stage, transport) {
|
|
|
|
[id, caption, fg_color, bg_color]);
|
|
|
|
[id, caption, fg_color, bg_color]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
window.setTimeout("update_offline_data("+(stage+1)+")", 10*1000);
|
|
|
|
window.setTimeout("update_offline_data("+(stage+1)+")", 5*1000);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
var articles = transport.responseXML.getElementsByTagName("article");
|
|
|
|
var articles = transport.responseXML.getElementsByTagName("article");
|
|
|
@ -723,13 +723,20 @@ function offline_download_parse(stage, transport) {
|
|
|
|
var has_sync_data = has_local_sync_data();
|
|
|
|
var has_sync_data = has_local_sync_data();
|
|
|
|
|
|
|
|
|
|
|
|
if (articles_found >= limit || has_sync_data) {
|
|
|
|
if (articles_found >= limit || has_sync_data) {
|
|
|
|
window.setTimeout("update_offline_data("+(stage+1)+")", 10*1000);
|
|
|
|
window.setTimeout("update_offline_data("+(stage+1)+")", 5*1000);
|
|
|
|
debug("<b>update_offline_data: done " + stage + " HSD: " +
|
|
|
|
debug("<b>update_offline_data: done " + stage + " HSD: " +
|
|
|
|
has_sync_data + "</b>");
|
|
|
|
has_sync_data + "</b>");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
window.setTimeout("update_offline_data(0)", 180*1000);
|
|
|
|
window.setTimeout("update_offline_data(0)", 180*1000);
|
|
|
|
debug("update_offline_data: finished");
|
|
|
|
debug("update_offline_data: finished");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var pic = $("restartOfflinePic");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pic) {
|
|
|
|
|
|
|
|
pic.src = "images/offline.png";
|
|
|
|
|
|
|
|
pic.title = __("Restart in offline mode");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
db.execute("DELETE FROM articles WHERE "+
|
|
|
|
db.execute("DELETE FROM articles WHERE "+
|
|
|
|
"updated < DATETIME('NOW', 'localtime', '-31 days')");
|
|
|
|
"updated < DATETIME('NOW', 'localtime', '-31 days')");
|
|
|
|
|
|
|
|
|
|
|
@ -737,6 +744,7 @@ function offline_download_parse(stage, transport) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
update_local_sync_data();
|
|
|
|
update_local_sync_data();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// notify('');
|
|
|
|
// notify('');
|
|
|
|
|
|
|
|
|
|
|
@ -778,6 +786,13 @@ function update_offline_data(stage) {
|
|
|
|
|
|
|
|
|
|
|
|
debug(query + "/" + to_sync);
|
|
|
|
debug(query + "/" + to_sync);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var pic = $("restartOfflinePic");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pic) {
|
|
|
|
|
|
|
|
pic.src = "images/offline-sync.gif";
|
|
|
|
|
|
|
|
pic.title = __("Synchronizing offline data...");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
new Ajax.Request(query, {
|
|
|
|
new Ajax.Request(query, {
|
|
|
|
parameters: to_sync,
|
|
|
|
parameters: to_sync,
|
|
|
|
onComplete: function(transport) {
|
|
|
|
onComplete: function(transport) {
|
|
|
|