$tog_marked_link = "selectionToggleMarked()";\r
$tog_published_link = "selectionTogglePublished()";\r
\r
+ $set_score_link = "setSelectionScore()";\r
+\r
if ($is_cat) $cat_q = "&is_cat=$is_cat";\r
\r
if ($search) {\r
$reply .= "<option value=\"0\" disabled=\"1\">".__('Selection:')."</option>";\r
\r
$reply .= "<option value=\"$catchup_sel_link\">".__('Mark as read')."</option>";\r
+ $reply .= "<option value=\"$set_score_link\">".__('Set score')."</option>";\r
\r
if ($feed_id != "0") {\r
$reply .= "<option value=\"$archive_sel_link\">".__('Archive')."</option>";\r
}
function setScore() {
- $id = db_escape_string($_REQUEST['id']);
+ $ids = 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"]);
+ score = '$score' WHERE ref_id IN ($ids) AND owner_uid = " . $_SESSION["uid"]);
print json_encode(array("id" => $id,
"score_pic" => theme_image($link, get_score_pic($score))));
}
}
+function setSelectionScore() {
+ try {
+ var ids = getSelectedArticleIds2();
+
+ if (ids.length > 0) {
+ console.log(ids);
+
+ var score = prompt(__("Please enter new score for selected articles:"), score);
+
+ if (score != undefined) {
+ var query = "op=rpc&method=setScore&id=" + param_escape(ids.toString()) +
+ "&score=" + param_escape(score);
+
+ new Ajax.Request("backend.php", {
+ parameters: query,
+ onComplete: function(transport) {
+ var reply = JSON.parse(transport.responseText);
+ if (reply) {
+ console.log(ids);
+
+ ids.each(function(id) {
+ var row = $("RROW-" + id);
+
+ if (row) {
+ var pic = row.getElementsByClassName("hlScorePic")[0];
+
+ if (pic) {
+ pic.src = pic.src.replace(/score_.*?\.png/,
+ reply["score_pic"]);
+ pic.setAttribute("score", score);
+ }
+ }
+ });
+ }
+ } });
+ }
+
+ } else {
+ alert(__("No articles are selected."));
+ }
+ } catch (e) {
+ exception_error("setSelectionScore", e);
+ }
+}
+
function changeScore(id, pic) {
try {
var score = pic.getAttribute("score");