]>
git.wh0rd.org - tt-rss.git/blob - plugins/note/note.php
6 function __construct($host) {
7 $this->link
= $host->get_link();
10 $host->add_hook($host::HOOK_ARTICLE_BUTTON
, $this);
14 return file_get_contents(dirname(__FILE__
) . "/note.js");
18 function hook_article_button($line) {
19 return "<img src=\"".theme_image($this->link
, "plugins/note/note.png")."\"
20 style=\"cursor : pointer\" style=\"cursor : pointer\"
21 onclick=\"editArticleNote(".$line["id"].")\"
22 class='tagsPic' title='".__('Edit article note')."'>";
26 $param = db_escape_string($_REQUEST['param']);
28 $result = db_query($this->link
, "SELECT note FROM ttrss_user_entries WHERE
29 ref_id = '$param' AND owner_uid = " . $_SESSION['uid']);
31 $note = db_fetch_result($result, 0, "note");
33 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$param\">";
34 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
35 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setNote\">";
36 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"note\">";
38 print "<table width='100%'><tr><td>";
39 print "<textarea dojoType=\"dijit.form.SimpleTextarea\"
40 style='font-size : 12px; width : 100%; height: 100px;'
41 placeHolder='body#ttrssMain { font-size : 14px; };'
42 name='note'>$note</textarea>";
43 print "</td></tr></table>";
45 print "<div class='dlgButtons'>";
46 print "<button dojoType=\"dijit.form.Button\"
47 onclick=\"dijit.byId('editNoteDlg').execute()\">".__('Save')."</button> ";
48 print "<button dojoType=\"dijit.form.Button\"
49 onclick=\"dijit.byId('editNoteDlg').hide()\">".__('Cancel')."</button>";
55 $id = db_escape_string($_REQUEST["id"]);
56 $note = trim(strip_tags(db_escape_string($_REQUEST["note"])));
58 db_query($this->link
, "UPDATE ttrss_user_entries SET note = '$note'
59 WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
61 $formatted_note = format_article_note($id, $note);
63 print json_encode(array("note" => $formatted_note,
64 "raw_length" => mb_strlen($note)));