From 546499a9f37372d239d16b538e372faf641f5aa5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 30 Apr 2008 09:10:59 +0100 Subject: [PATCH] finish initial work on scoring --- functions.php | 32 +++++++++++++++++++++++++++----- images/score_high.png | Bin 0 -> 325 bytes images/score_neutral.png | Bin 0 -> 305 bytes modules/backend-rpc.php | 13 +++++++++++++ tt-rss.css | 9 +++++++++ tt-rss.js | 19 +++++++++++++++++++ 6 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 images/score_high.png create mode 100644 images/score_neutral.png diff --git a/functions.php b/functions.php index bf0c55d3d..2c073b467 100644 --- a/functions.php +++ b/functions.php @@ -3313,7 +3313,8 @@ ttrss_entries,ttrss_user_entries,ttrss_feeds WHERE $group_limit_part - ttrss_feeds.hidden = false AND + ttrss_feeds.hidden = false AND + score >= -500 AND ttrss_user_entries.feed_id = ttrss_feeds.id AND ttrss_user_entries.ref_id = ttrss_entries.id AND ttrss_user_entries.owner_uid = '$owner_uid' AND @@ -3344,7 +3345,8 @@ FROM ttrss_entries,ttrss_user_entries,ttrss_tags WHERE - ref_id = ttrss_entries.id AND + ref_id = ttrss_entries.id AND + score >= -500 AND ttrss_user_entries.owner_uid = '$owner_uid' AND post_int_id = int_id AND tag_name = '$feed' AND $view_query_part @@ -4935,7 +4937,16 @@ $score = $line["score"]; - if ($score < 100) $score_pic = "score_low + if ($score > 100) { + $score_pic = "score_high.png"; + } else { + $score_pic = "score_neutral.png"; + } + + $score_title = __("(Click to change)"); + + $score_pic = ""; $entry_author = $line["author"]; @@ -4979,7 +4990,16 @@ # truncate_string($line["feed_title"],30)." "; # } else { - print ""; + + if ($score > 500) { + $hlc_suffix = "H"; + } else if ($score < -100) { + $hlc_suffix = "L"; + } else { + $hlc_suffix = ""; + } + + print ""; print "" . $line["title"]; @@ -5010,7 +5030,9 @@ # } print "$updated_fmt "; - + + print "$score_pic"; + print ""; } else { diff --git a/images/score_high.png b/images/score_high.png new file mode 100644 index 0000000000000000000000000000000000000000..fa19791c0d5481bd593f4e70b4e169fa8f4ebac0 GIT binary patch literal 325 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgfv7CCMOjoY&?ngfL-OI#yLobz*Y zQ}ap~oQqNuOHxx5$}>wc6x=<11Hv2m#DR(yc)B=-Se#BySRi1qh`Xh<^}*E*t8#er zm^m_!rEw^moqhfH`UztL0}+Rh+H7oXsXRP9!c69EHZJBZg57EHKp|fXo$uUtBsNLj z6i`cvTyb{xhaGjoA-pmM3pF(qlsLFPND8>NFb4kMQIK39y`hK0_VfoygGLT!wFf2) zQs?U`OnxgaXWhYgLX%tSJeP;r-lk2W7cMiDPBz*(vonc-!Q;Le_mL|H9|GOV;OXk; Jvd$@?2>?;rW>EkD literal 0 HcmV?d00001 diff --git a/images/score_neutral.png b/images/score_neutral.png new file mode 100644 index 0000000000000000000000000000000000000000..b4cd7e2318662c39ce550602009f122bfcad8b12 GIT binary patch literal 305 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgfv7CCNZ<`}N(EkGg364!_l=ltB< z)VvY~=c3falGGH1^30M91$R&1fbd2>aiF3ePZ!4!i_>c-UlesP;BnROKH|iaz%|>T zm2rl~e4T^-_8n%gLiQEi+BbX76H%_ko7h*q;&M^ptq?x0Q0k;}fJ5ehSW)NRwMvh~ zB7}}wC+sZ?y8TYZ@Zmc%7H$b6H-m}>JLU`34d)XXi`&w^F$A+Ed}5FaYu)Tt%g|#R qzF=p_E$4d?{C|?3J~|&FqweRZ#&dPs77n1h7(8A5T-G@yGywp7d}Ad5 literal 0 HcmV?d00001 diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index d7ebb5940..1bff702a7 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -401,6 +401,19 @@ return; } + if ($subop == "setScore") { + $id = db_escape_string($_REQUEST["id"]); + $score = sprintf("%d", $_REQUEST["score"]); + + $result = db_query($link, "UPDATE ttrss_user_entries SET score = '$score' + WHERE ref_id = '$id' AND owner_uid = ".$_SESSION["uid"]); + + print "Acknowledged."; + + return; + + } + print "Unknown method: $subop"; } ?> diff --git a/tt-rss.css b/tt-rss.css index 1cb36247f..65c93175b 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -1759,3 +1759,12 @@ table.headlinesList tr.feedTitle td { margin-top : 10px; */ padding-left : 5px; } + +td.hlContentH a, td.hlContentH span { + color : #00cc00; +} + +td.hlContentL a, td.hlContentL span { + color : #909090; + text-decoration : line-through; +} diff --git a/tt-rss.js b/tt-rss.js index e165ec1c7..d127e03d2 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -838,3 +838,22 @@ function viewLimitChanged() { cache_empty(); return viewCurrentFeed(0, '') } + +function adjustArticleScore(id, score) { + try { + + var pr = prompt(__("Assign score to article:"), score); + + if (pr != undefined) { + var query = "backend.php?op=rpc&subop=setScore&id=" + id + "&score=" + pr; + + new Ajax.Request(query, { + onComplete: function(transport) { + viewCurrentFeed(); + } }); + + } + } catch (e) { + exception_error(e, "adjustArticleScore"); + } +}