bring back update button, it makes async update request to the daemon
This commit is contained in:
parent
a18a4f387a
commit
428b704dbc
6 changed files with 87 additions and 7 deletions
|
@ -732,10 +732,12 @@ function parse_counters(reply, scheduled_call) {
|
||||||
|
|
||||||
if (updated && feedlink) {
|
if (updated && feedlink) {
|
||||||
if (error) {
|
if (error) {
|
||||||
feedlink.title = "Error: " + error + " (" + updated + ")";
|
feedlink.title = __("Error:") + " " + error + " (" + updated + ")";
|
||||||
} else {
|
} else {
|
||||||
feedlink.title = "Updated: " + updated;
|
feedlink.title = __("Updated:") + " " + updated;
|
||||||
}
|
}
|
||||||
|
} else if (!updated && feedlink) {
|
||||||
|
feedlink.title = __("Updated:") + " " + __("Never");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (feedupd) {
|
if (feedupd) {
|
||||||
|
|
|
@ -2872,6 +2872,9 @@
|
||||||
|
|
||||||
$has_img = feed_has_icon($id);
|
$has_img = feed_has_icon($id);
|
||||||
|
|
||||||
|
if (date('Y') - date('Y', strtotime($line['last_updated'])) > 2)
|
||||||
|
$last_updated = '';
|
||||||
|
|
||||||
$cv = array("id" => $id,
|
$cv = array("id" => $id,
|
||||||
"updated" => $last_updated,
|
"updated" => $last_updated,
|
||||||
"counter" => $count,
|
"counter" => $count,
|
||||||
|
|
|
@ -1173,6 +1173,45 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($subop == "scheduleFeedUpdate") {
|
||||||
|
$feed_id = db_escape_string($_REQUEST["id"]);
|
||||||
|
$is_cat = db_escape_string($_REQUEST['is_cat']);
|
||||||
|
|
||||||
|
$message = __("Your request could not be completed.");
|
||||||
|
|
||||||
|
if ($feed_id >= 0) {
|
||||||
|
if (!$is_cat) {
|
||||||
|
$message = __("Feed update has been scheduled.");
|
||||||
|
|
||||||
|
db_query($link, "UPDATE ttrss_feeds SET
|
||||||
|
last_update_started = '1970-01-01',
|
||||||
|
last_updated = '1970-01-01' WHERE id = '$feed_id' AND
|
||||||
|
owner_uid = ".$_SESSION["uid"]);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$message = __("Category update has been scheduled.");
|
||||||
|
|
||||||
|
if ($feed_id)
|
||||||
|
$cat_query = "cat_id = '$feed_id'";
|
||||||
|
else
|
||||||
|
$cat_query = "cat_id IS NULL";
|
||||||
|
|
||||||
|
db_query($link, "UPDATE ttrss_feeds SET
|
||||||
|
last_update_started = '1970-01-01',
|
||||||
|
last_updated = '1970-01-01' WHERE $cat_query AND
|
||||||
|
owner_uid = ".$_SESSION["uid"]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$message = __("Can't update this kind of feed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<rpc-reply>";
|
||||||
|
print "<message>$message</message>";
|
||||||
|
print "</rpc-reply>";
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
print "<rpc-reply><error>Unknown method: $subop</error></rpc-reply>";
|
print "<rpc-reply><error>Unknown method: $subop</error></rpc-reply>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
36
tt-rss.js
36
tt-rss.js
|
@ -1286,3 +1286,39 @@ function handle_rpc_reply(transport, scheduled_call) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scheduleFeedUpdate() {
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (!getActiveFeedId()) {
|
||||||
|
alert(__("Please select some feed first."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var query = "?op=rpc&subop=scheduleFeedUpdate&id=" +
|
||||||
|
param_escape(getActiveFeedId()) +
|
||||||
|
"&is_cat=" + param_escape(activeFeedIsCat());
|
||||||
|
|
||||||
|
console.log(query);
|
||||||
|
|
||||||
|
new Ajax.Request("backend.php", {
|
||||||
|
parameters: query,
|
||||||
|
onComplete: function(transport) {
|
||||||
|
|
||||||
|
if (transport.responseXML) {
|
||||||
|
var message = transport.responseXML.getElementsByTagName("message")[0];
|
||||||
|
|
||||||
|
if (message) {
|
||||||
|
notify_info(message.firstChild.nodeValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
notify_error("Error communicating with server.");
|
||||||
|
|
||||||
|
} });
|
||||||
|
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("scheduleFeedUpdate", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -226,13 +226,9 @@
|
||||||
<option value="score"><?php echo __('Score') ?></option>
|
<option value="score"><?php echo __('Score') ?></option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<?php if (defined('_ENABLE_FEED_DEBUGGING')) { ?>
|
<button name="update" onclick="return scheduleFeedUpdate()">
|
||||||
|
|
||||||
<button name="update" onclick="return viewCurrentFeed('ForceUpdate')">
|
|
||||||
<?php echo __('Update') ?></button>
|
<?php echo __('Update') ?></button>
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<button onclick="return catchupCurrentFeed()">
|
<button onclick="return catchupCurrentFeed()">
|
||||||
<?php echo __('Mark as read') ?></button>
|
<?php echo __('Mark as read') ?></button>
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,10 @@ function headlines_callback2(transport, feed_cur_page) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var update_btn = document.forms["main_toolbar_form"].update;
|
||||||
|
|
||||||
|
update_btn.disabled = !(feed_id >= 0 && !is_cat);
|
||||||
|
|
||||||
var ll = $('FLL-' + feed_id);
|
var ll = $('FLL-' + feed_id);
|
||||||
|
|
||||||
if (ll && ll.parentNode)
|
if (ll && ll.parentNode)
|
||||||
|
|
Loading…
Reference in a new issue