allow setting article score manually
This commit is contained in:
parent
1b4d1a6b44
commit
beb6ce2761
|
@ -395,7 +395,7 @@ class Feeds extends Handler_Protected {
|
||||||
$score_pic = "<img class='hlScorePic' src=\"images/$score_pic\"
|
$score_pic = "<img class='hlScorePic' src=\"images/$score_pic\"
|
||||||
onclick=\"adjustArticleScore($id, $score)\" title=\"$score $score_title\">"; */
|
onclick=\"adjustArticleScore($id, $score)\" title=\"$score $score_title\">"; */
|
||||||
|
|
||||||
$score_pic = "<img class='hlScorePic' src=\"$score_pic\"
|
$score_pic = "<img class='hlScorePic' score='$score' onclick='changeScore($id, this)' src=\"$score_pic\"
|
||||||
title=\"$score\">";
|
title=\"$score\">";
|
||||||
|
|
||||||
if ($score > 500) {
|
if ($score > 500) {
|
||||||
|
|
|
@ -763,5 +763,16 @@ class RPC extends Handler_Protected {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setScore() {
|
||||||
|
$id = db_escape_string($_REQUEST['id']);
|
||||||
|
$score = (int)db_escape_string($_REQUEST['score']);
|
||||||
|
|
||||||
|
db_query($this->link, "UPDATE ttrss_user_entries SET
|
||||||
|
score = '$score' WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||||
|
|
||||||
|
print json_encode(array("id" => $id,
|
||||||
|
"score_pic" => theme_image($link, get_score_pic($score))));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -2137,3 +2137,30 @@ function cancelSearch() {
|
||||||
exception_error("cancelSearch", e);
|
exception_error("cancelSearch", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeScore(id, pic) {
|
||||||
|
try {
|
||||||
|
var score = pic.getAttribute("score");
|
||||||
|
|
||||||
|
var new_score = prompt(__("Please enter new score for this article:"), score);
|
||||||
|
|
||||||
|
if (new_score != undefined) {
|
||||||
|
|
||||||
|
var query = "op=rpc&method=setScore&id=" + param_escape(id) +
|
||||||
|
"&score=" + param_escape(new_score);
|
||||||
|
|
||||||
|
new Ajax.Request("backend.php", {
|
||||||
|
parameters: query,
|
||||||
|
onComplete: function(transport) {
|
||||||
|
var reply = JSON.parse(transport.responseText);
|
||||||
|
|
||||||
|
if (reply) {
|
||||||
|
pic.src = pic.src.replace(/score_.*?\.png/, reply["score_pic"]);
|
||||||
|
pic.setAttribute("score", new_score);
|
||||||
|
}
|
||||||
|
} });
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("changeScore", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue