filter editor: add button to rescore all feeds
This commit is contained in:
parent
f2f1d9d70d
commit
95a948a574
|
@ -131,11 +131,24 @@ print T_js_decl("Unpublish article");
|
||||||
print T_js_decl("You can't clear this type of feed.");
|
print T_js_decl("You can't clear this type of feed.");
|
||||||
print T_js_decl("Erase all non-starred articles in %s?");
|
print T_js_decl("Erase all non-starred articles in %s?");
|
||||||
print T_js_decl("Mark all articles as read?");
|
print T_js_decl("Mark all articles as read?");
|
||||||
|
print T_js_decl("Rescore articles in selected feeds?");
|
||||||
|
print T_js_decl("Rescoring selected feeds...");
|
||||||
|
print T_js_decl("Rescore articles in all feeds? This operation may take a lot of time.");
|
||||||
|
print T_js_decl("Rescoring feeds...");
|
||||||
|
#print T_js_decl(
|
||||||
|
#print T_js_decl(
|
||||||
|
#print T_js_decl(
|
||||||
|
#print T_js_decl(
|
||||||
|
#print T_js_decl(
|
||||||
|
#print T_js_decl(
|
||||||
|
#print T_js_decl(
|
||||||
|
#print T_js_decl(
|
||||||
|
#print T_js_decl(
|
||||||
|
#print T_js_decl(
|
||||||
#print T_js_decl(
|
#print T_js_decl(
|
||||||
#print T_js_decl(
|
#print T_js_decl(
|
||||||
#print T_js_decl(
|
#print T_js_decl(
|
||||||
#print T_js_decl(
|
#print T_js_decl(
|
||||||
#print T_js_decl(
|
#print T_js_decl(
|
||||||
#print T_js_decl(
|
#print T_js_decl(
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -516,6 +516,53 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($subop == "rescoreAll") {
|
||||||
|
|
||||||
|
$result = db_query($link,
|
||||||
|
"SELECT id FROM ttrss_feeds WHERE owner_uid = " . $_SESSION['uid']);
|
||||||
|
|
||||||
|
while ($feed_line = db_fetch_assoc($result)) {
|
||||||
|
|
||||||
|
$id = $feed_line["id"];
|
||||||
|
|
||||||
|
$filters = load_filters($link, $id, $_SESSION["uid"], 6);
|
||||||
|
|
||||||
|
$tmp_result = db_query($link, "SELECT title, content, link, ref_id FROM
|
||||||
|
ttrss_user_entries, ttrss_entries
|
||||||
|
WHERE ref_id = id AND feed_id = '$id' AND
|
||||||
|
owner_uid = " .$_SESSION['uid']."
|
||||||
|
");
|
||||||
|
|
||||||
|
$scores = array();
|
||||||
|
|
||||||
|
while ($line = db_fetch_assoc($tmp_result)) {
|
||||||
|
|
||||||
|
$article_filters = get_article_filters($filters, $line['title'],
|
||||||
|
$line['content'], $line['link']);
|
||||||
|
|
||||||
|
$new_score = calculate_article_score($article_filters);
|
||||||
|
|
||||||
|
if (!$scores[$new_score]) $scores[$new_score] = array();
|
||||||
|
|
||||||
|
array_push($scores[$new_score], $line['ref_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (array_keys($scores) as $s) {
|
||||||
|
if ($s > 1000) {
|
||||||
|
db_query($link, "UPDATE ttrss_user_entries SET score = '$s',
|
||||||
|
marked = true WHERE
|
||||||
|
ref_id IN (" . join(',', $scores[$s]) . ")");
|
||||||
|
} else {
|
||||||
|
db_query($link, "UPDATE ttrss_user_entries SET score = '$s' WHERE
|
||||||
|
ref_id IN (" . join(',', $scores[$s]) . ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print __("All done.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if ($subop == "add") {
|
if ($subop == "add") {
|
||||||
|
|
||||||
if (!WEB_DEMO_MODE) {
|
if (!WEB_DEMO_MODE) {
|
||||||
|
|
|
@ -228,6 +228,13 @@
|
||||||
id=\"create_filter_btn\"
|
id=\"create_filter_btn\"
|
||||||
value=\"".__('Create filter')."\">";
|
value=\"".__('Create filter')."\">";
|
||||||
|
|
||||||
|
print " ";
|
||||||
|
|
||||||
|
print "<input type=\"submit\"
|
||||||
|
class=\"button\"
|
||||||
|
onclick=\"rescore_all_feeds()\"
|
||||||
|
value=\"".__('Rescore articles')."\">";
|
||||||
|
|
||||||
$result = db_query($link, "SELECT
|
$result = db_query($link, "SELECT
|
||||||
ttrss_filters.id AS id,reg_exp,
|
ttrss_filters.id AS id,reg_exp,
|
||||||
ttrss_filter_types.name AS filter_type_name,
|
ttrss_filter_types.name AS filter_type_name,
|
||||||
|
|
15
prefs.js
15
prefs.js
|
@ -1931,7 +1931,7 @@ function rescoreSelectedFeeds() {
|
||||||
var ok = confirm(__("Rescore articles in selected feeds?"));
|
var ok = confirm(__("Rescore articles in selected feeds?"));
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
notify_progress("Rescoring selected labels...");
|
notify_progress("Rescoring selected feeds...");
|
||||||
|
|
||||||
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=rescore&quiet=1&ids="+
|
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=rescore&quiet=1&ids="+
|
||||||
param_escape(sel_rows.toString()), true);
|
param_escape(sel_rows.toString()), true);
|
||||||
|
@ -1945,3 +1945,16 @@ function rescoreSelectedFeeds() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function rescore_all_feeds() {
|
||||||
|
var ok = confirm(__("Rescore all articles? This operation may take a lot of time."));
|
||||||
|
|
||||||
|
if (ok) {
|
||||||
|
notify_progress("Rescoring feeds...");
|
||||||
|
|
||||||
|
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=rescoreAll&quiet=1", true);
|
||||||
|
xmlhttp.onreadystatechange=notify_callback;
|
||||||
|
xmlhttp.send(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue