]>
git.wh0rd.org - tt-rss.git/blob - plugins/note/init.php
65cdf30e4854ec74121b19c3dc1112ded853debf
2 class Note
extends Plugin
{
7 "Adds support for setting article notes",
11 function init($host) {
14 $host->add_hook($host::HOOK_ARTICLE_BUTTON
, $this);
18 return file_get_contents(dirname(__FILE__
) . "/note.js");
22 function hook_article_button($line) {
23 return "<img src=\"plugins/note/note.png\"
24 style=\"cursor : pointer\" style=\"cursor : pointer\"
25 onclick=\"editArticleNote(".$line["id"].")\"
26 class='tagsPic' title='".__('Edit article note')."'>";
30 $param = db_escape_string($_REQUEST['param']);
32 $result = db_query("SELECT note FROM ttrss_user_entries WHERE
33 ref_id = '$param' AND owner_uid = " . $_SESSION['uid']);
35 $note = db_fetch_result($result, 0, "note");
37 print_hidden("id", "$param");
38 print_hidden("op", "pluginhandler");
39 print_hidden("method", "setNote");
40 print_hidden("plugin", "note");
42 print "<table width='100%'><tr><td>";
43 print "<textarea dojoType=\"dijit.form.SimpleTextarea\"
44 style='font-size : 12px; width : 98%; height: 100px;'
45 placeHolder='body#ttrssMain { font-size : 14px; };'
46 name='note'>$note</textarea>";
47 print "</td></tr></table>";
49 print "<div class='dlgButtons'>";
50 print "<button dojoType=\"dijit.form.Button\"
51 onclick=\"dijit.byId('editNoteDlg').execute()\">".__('Save')."</button> ";
52 print "<button dojoType=\"dijit.form.Button\"
53 onclick=\"dijit.byId('editNoteDlg').hide()\">".__('Cancel')."</button>";
59 $id = db_escape_string($_REQUEST["id"]);
60 $note = trim(strip_tags(db_escape_string($_REQUEST["note"])));
62 db_query("UPDATE ttrss_user_entries SET note = '$note'
63 WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
65 $formatted_note = Article
::format_article_note($id, $note);
67 print json_encode(array("note" => $formatted_note,
68 "raw_length" => mb_strlen($note)));
71 function api_version() {