]>
git.wh0rd.org - tt-rss.git/blob - classes/note_button.php
2 class Note_Button
extends Plugin_Button
{
3 function render($article_id) {
4 return "<img src=\"".theme_image($this->link
, "images/art-pub-note.png")."\"
5 style=\"cursor : pointer\" style=\"cursor : pointer\"
6 onclick=\"editArticleNote($article_id)\"
7 class='tagsPic' title='".__('Edit article note')."'>";
11 $param = db_escape_string($_REQUEST['param']);
13 $result = db_query($this->link
, "SELECT note FROM ttrss_user_entries WHERE
14 ref_id = '$param' AND owner_uid = " . $_SESSION['uid']);
16 $note = db_fetch_result($result, 0, "note");
18 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$param\">";
19 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
20 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"buttonPlugin\">";
21 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"note\">";
22 print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin_method\" value=\"setNote\">";
24 print "<table width='100%'><tr><td>";
25 print "<textarea dojoType=\"dijit.form.SimpleTextarea\"
26 style='font-size : 12px; width : 100%; height: 100px;'
27 placeHolder='body#ttrssMain { font-size : 14px; };'
28 name='note'>$note</textarea>";
29 print "</td></tr></table>";
31 print "<div class='dlgButtons'>";
32 print "<button dojoType=\"dijit.form.Button\"
33 onclick=\"dijit.byId('editNoteDlg').execute()\">".__('Save')."</button> ";
34 print "<button dojoType=\"dijit.form.Button\"
35 onclick=\"dijit.byId('editNoteDlg').hide()\">".__('Cancel')."</button>";
41 $id = db_escape_string($_REQUEST["id"]);
42 $note = trim(strip_tags(db_escape_string($_REQUEST["note"])));
44 db_query($this->link
, "UPDATE ttrss_user_entries SET note = '$note'
45 WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
47 $formatted_note = format_article_note($id, $note);
49 print json_encode(array("note" => $formatted_note,
50 "raw_length" => mb_strlen($note)));