diff options
author | Andrew Dolgov <[email protected]> | 2010-11-29 20:25:51 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2010-11-29 20:36:39 +0300 |
commit | 741b60909ffcf67475c5ea7f66c6e870584d2b59 (patch) | |
tree | 8cfa76e163d58b992f02edb94c844deedb5327dd /modules | |
parent | 359866ab266a6339a00bf2a1320762fc857fc39f (diff) |
tweak article notes
Diffstat (limited to 'modules')
-rw-r--r-- | modules/backend-rpc.php | 40 | ||||
-rw-r--r-- | modules/popup-dialog.php | 32 |
2 files changed, 49 insertions, 23 deletions
diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index b8877da20..239ff60f6 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -209,8 +209,9 @@ return; } - // XML method if ($subop == "publ") { + header("Content-Type: text/plain"); + $pub = $_REQUEST["pub"]; $id = db_escape_string($_REQUEST["id"]); $note = trim(strip_tags(db_escape_string($_REQUEST["note"]))); @@ -221,31 +222,11 @@ $pub = "false"; } - if ($note != 'undefined') { - $note_qpart = "note = '$note',"; - } - - // FIXME this needs collision testing - $result = db_query($link, "UPDATE ttrss_user_entries SET - $note_qpart published = $pub WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]); - - print "<rpc-reply>"; - - if ($note != 'undefined') { - $note_size = strlen($note); - print "<note id=\"$id\" size=\"$note_size\">"; - print "<![CDATA[" . format_article_note($id, $note) . "]]>"; - print "</note>"; - } - - print "<message>UPDATE_COUNTERS</message>"; - - print "</rpc-reply>"; - + print json_encode(array("message" => "UPDATE_COUNTERS")); return; } @@ -893,6 +874,21 @@ return; } + if ($subop == "setNote") { + header("Content-Type: text/plain"); + + $id = db_escape_string($_REQUEST["id"]); + $note = strip_tags(db_escape_string($_REQUEST["note"])); + + db_query($link, "UPDATE ttrss_user_entries SET note = '$note' + WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]); + + $formatted_note = format_article_note($id, $note); + + print json_encode(array("note" => $formatted_note)); + return; + } + print "<rpc-reply><error>Unknown method: $subop</error></rpc-reply>"; } ?> diff --git a/modules/popup-dialog.php b/modules/popup-dialog.php index 6da30521b..4513c7cfb 100644 --- a/modules/popup-dialog.php +++ b/modules/popup-dialog.php @@ -802,10 +802,12 @@ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"setpref\">"; print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"key\" value=\"USER_STYLESHEET\">"; - print "<p><textarea dojoType=\"dijit.form.SimpleTextarea\" + print "<table width='100%'><tr><td>"; + print "<textarea dojoType=\"dijit.form.SimpleTextarea\" style='font-size : 12px; width : 100%; height: 200px;' placeHolder='body#ttrssMain { font-size : 14px; };' name='value'>$value</textarea>"; + print "</td></tr></table>"; print "<div class='dlgButtons'>"; print "<button dojoType=\"dijit.form.Button\" @@ -816,6 +818,34 @@ } + if ($id == "editArticleNote") { + + $result = db_query($link, "SELECT note FROM ttrss_user_entries WHERE + ref_id = '$param' AND owner_uid = " . $_SESSION['uid']); + + $note = db_fetch_result($result, 0, "note"); + + print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$param\">"; + print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">"; + print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"setNote\">"; + + print "<table width='100%'><tr><td>"; + print "<textarea dojoType=\"dijit.form.SimpleTextarea\" + style='font-size : 12px; width : 100%; height: 100px;' + placeHolder='body#ttrssMain { font-size : 14px; };' + name='note'>$note</textarea>"; + print "</td></tr></table>"; + + print "<div class='dlgButtons'>"; + print "<button dojoType=\"dijit.form.Button\" + onclick=\"dijit.byId('editNoteDlg').execute()\">".__('Save')."</button> "; + print "<button dojoType=\"dijit.form.Button\" + onclick=\"dijit.byId('editNoteDlg').hide()\">".__('Cancel')."</button>"; + print "</div>"; + + } + + print "</dlg>"; } ?> |