mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-24 20:01:31 +00:00
tweak article notes
This commit is contained in:
@@ -4617,12 +4617,12 @@
|
|||||||
onclick=\"postOpenInNewTab(event, $id)\"
|
onclick=\"postOpenInNewTab(event, $id)\"
|
||||||
alt='Zoom' title='".__('Open article in new tab')."'>";
|
alt='Zoom' title='".__('Open article in new tab')."'>";
|
||||||
|
|
||||||
$note_escaped = htmlspecialchars($line['note'], ENT_QUOTES);
|
//$note_escaped = htmlspecialchars($line['note'], ENT_QUOTES);
|
||||||
|
|
||||||
print "<img src=\"".theme_image($link, 'images/art-pub-note.png')."\"
|
print "<img src=\"".theme_image($link, 'images/art-pub-note.png')."\"
|
||||||
class='tagsPic' style=\"cursor : pointer\"
|
class='tagsPic' style=\"cursor : pointer\"
|
||||||
onclick=\"publishWithNote($id, '$note_escaped')\"
|
onclick=\"editArticleNote($id)\"
|
||||||
alt='PubNote' title='".__('Publish article with a note')."'>";
|
alt='PubNote' title='".__('Edit article note')."'>";
|
||||||
|
|
||||||
if (DIGEST_ENABLE) {
|
if (DIGEST_ENABLE) {
|
||||||
print "<img src=\"".theme_image($link, 'images/art-email.png')."\"
|
print "<img src=\"".theme_image($link, 'images/art-email.png')."\"
|
||||||
@@ -4684,17 +4684,17 @@
|
|||||||
href=\"".htmlspecialchars($feed_site_url)."\">".
|
href=\"".htmlspecialchars($feed_site_url)."\">".
|
||||||
$feed_icon . "</a></div>";
|
$feed_icon . "</a></div>";
|
||||||
|
|
||||||
print "<div class=\"postContent\">";
|
|
||||||
|
|
||||||
$article_content = sanitize_rss($link, $line["content"], false, false,
|
|
||||||
$feed_site_url);
|
|
||||||
|
|
||||||
print "<div id=\"POSTNOTE-$id\">";
|
print "<div id=\"POSTNOTE-$id\">";
|
||||||
if ($line['note']) {
|
if ($line['note']) {
|
||||||
print format_article_note($id, $line['note']);
|
print format_article_note($id, $line['note']);
|
||||||
}
|
}
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|
||||||
|
print "<div class=\"postContent\">";
|
||||||
|
|
||||||
|
$article_content = sanitize_rss($link, $line["content"], false, false,
|
||||||
|
$feed_site_url);
|
||||||
|
|
||||||
print $article_content;
|
print $article_content;
|
||||||
|
|
||||||
print_article_enclosures($link, $id, $always_display_enclosures,
|
print_article_enclosures($link, $id, $always_display_enclosures,
|
||||||
@@ -5234,12 +5234,12 @@
|
|||||||
alt='Zoom'
|
alt='Zoom'
|
||||||
title='".__('Open article in new tab')."'>";
|
title='".__('Open article in new tab')."'>";
|
||||||
|
|
||||||
$note_escaped = htmlspecialchars($line['note'], ENT_QUOTES);
|
//$note_escaped = htmlspecialchars($line['note'], ENT_QUOTES);
|
||||||
|
|
||||||
print "<img src=\"images/art-pub-note.png\"
|
print "<img src=\"images/art-pub-note.png\"
|
||||||
style=\"cursor : pointer\" style=\"cursor : pointer\"
|
style=\"cursor : pointer\" style=\"cursor : pointer\"
|
||||||
onclick=\"publishWithNote($id, '$note_escaped')\"
|
onclick=\"editArticleNote($id)\"
|
||||||
alt='PubNote' title='".__('Publish article with a note')."'>";
|
alt='PubNote' title='".__('Edit article note')."'>";
|
||||||
|
|
||||||
if (DIGEST_ENABLE) {
|
if (DIGEST_ENABLE) {
|
||||||
print "<img src=\"".theme_image($link, 'images/art-email.png')."\"
|
print "<img src=\"".theme_image($link, 'images/art-email.png')."\"
|
||||||
@@ -6209,15 +6209,8 @@
|
|||||||
|
|
||||||
function format_article_note($id, $note) {
|
function format_article_note($id, $note) {
|
||||||
|
|
||||||
$note_escaped = htmlspecialchars($note, ENT_QUOTES);
|
$str = "<div class='articleNote' title=\"".__('edit note')."\"
|
||||||
|
onclick=\"editArticleNote($id)\">$note</div>";
|
||||||
$str = "<div class='articleNote'>";
|
|
||||||
$str .= $note;
|
|
||||||
$str .= "<div class='articleNoteOps'>";
|
|
||||||
$str .= "<a href=\"javascript:publishWithNote($id, '$note_escaped')\">".
|
|
||||||
__('edit note')."</a>";
|
|
||||||
$str .= "</div>";
|
|
||||||
$str .= "</div>";
|
|
||||||
|
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,8 +209,9 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XML method
|
|
||||||
if ($subop == "publ") {
|
if ($subop == "publ") {
|
||||||
|
header("Content-Type: text/plain");
|
||||||
|
|
||||||
$pub = $_REQUEST["pub"];
|
$pub = $_REQUEST["pub"];
|
||||||
$id = db_escape_string($_REQUEST["id"]);
|
$id = db_escape_string($_REQUEST["id"]);
|
||||||
$note = trim(strip_tags(db_escape_string($_REQUEST["note"])));
|
$note = trim(strip_tags(db_escape_string($_REQUEST["note"])));
|
||||||
@@ -221,31 +222,11 @@
|
|||||||
$pub = "false";
|
$pub = "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($note != 'undefined') {
|
|
||||||
$note_qpart = "note = '$note',";
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME this needs collision testing
|
|
||||||
|
|
||||||
$result = db_query($link, "UPDATE ttrss_user_entries SET
|
$result = db_query($link, "UPDATE ttrss_user_entries SET
|
||||||
$note_qpart
|
|
||||||
published = $pub
|
published = $pub
|
||||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||||
|
|
||||||
|
print json_encode(array("message" => "UPDATE_COUNTERS"));
|
||||||
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>";
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -893,6 +874,21 @@
|
|||||||
return;
|
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>";
|
print "<rpc-reply><error>Unknown method: $subop</error></rpc-reply>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -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=\"subop\" value=\"setpref\">";
|
||||||
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"key\" value=\"USER_STYLESHEET\">";
|
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;'
|
style='font-size : 12px; width : 100%; height: 200px;'
|
||||||
placeHolder='body#ttrssMain { font-size : 14px; };'
|
placeHolder='body#ttrssMain { font-size : 14px; };'
|
||||||
name='value'>$value</textarea>";
|
name='value'>$value</textarea>";
|
||||||
|
print "</td></tr></table>";
|
||||||
|
|
||||||
print "<div class='dlgButtons'>";
|
print "<div class='dlgButtons'>";
|
||||||
print "<button dojoType=\"dijit.form.Button\"
|
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>";
|
print "</dlg>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
20
tt-rss.css
20
tt-rss.css
@@ -74,31 +74,15 @@ div.postReply img.tagsPic {
|
|||||||
vertical-align : middle;
|
vertical-align : middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.articleNote div.articleNoteOps {
|
|
||||||
text-align : center;
|
|
||||||
color : #9a8c59;
|
|
||||||
font-style : italic;
|
|
||||||
margin-top : 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.articleNote div.articleNoteOps a {
|
|
||||||
color : #9a8c59;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.articleNote div.articleNoteOps a:hover {
|
|
||||||
color : black;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.articleNote {
|
div.articleNote {
|
||||||
background-color : #fff7d5;
|
background-color : #fff7d5;
|
||||||
border-width : 1px;
|
border-width : 1px;
|
||||||
padding : 5px;
|
padding : 5px;
|
||||||
border-style : dashed;
|
border-style : dashed;
|
||||||
border-color : #e7d796;
|
border-color : #e7d796;
|
||||||
font-size : 8px;
|
font-size : 11px;
|
||||||
margin-bottom : 5px;
|
|
||||||
margin-top : 5px;
|
|
||||||
margin-left : 5px;
|
margin-left : 5px;
|
||||||
|
margin-top : 5px;
|
||||||
float : right;
|
float : right;
|
||||||
color : #9a8c59;
|
color : #9a8c59;
|
||||||
max-width : 150px;
|
max-width : 150px;
|
||||||
|
|||||||
63
viewfeed.js
63
viewfeed.js
@@ -483,6 +483,14 @@ function togglePub(id, client_only, no_effects, note) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!client_only) {
|
if (!client_only) {
|
||||||
|
new Ajax.Request("backend.php", {
|
||||||
|
parameters: query,
|
||||||
|
onComplete: function(transport) {
|
||||||
|
handle_rpc_json(transport);
|
||||||
|
} });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if (!client_only) {
|
||||||
new Ajax.Request("backend.php", {
|
new Ajax.Request("backend.php", {
|
||||||
parameters: query,
|
parameters: query,
|
||||||
onComplete: function(transport) {
|
onComplete: function(transport) {
|
||||||
@@ -510,7 +518,7 @@ function togglePub(id, client_only, no_effects, note) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} });
|
} });
|
||||||
}
|
} */
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("togglePub", e);
|
exception_error("togglePub", e);
|
||||||
@@ -1799,7 +1807,7 @@ function toggleHeadlineActions() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function publishWithNote(id, def_note) {
|
/* function publishWithNote(id, def_note) {
|
||||||
try {
|
try {
|
||||||
if (!def_note) def_note = '';
|
if (!def_note) def_note = '';
|
||||||
|
|
||||||
@@ -1812,7 +1820,7 @@ function publishWithNote(id, def_note) {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("publishWithNote", e);
|
exception_error("publishWithNote", e);
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
function emailArticle(id) {
|
function emailArticle(id) {
|
||||||
try {
|
try {
|
||||||
@@ -2308,3 +2316,52 @@ function tweetArticle(id) {
|
|||||||
exception_error("tweetArticle", e);
|
exception_error("tweetArticle", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function editArticleNote(id) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
var query = "backend.php?op=dlg&id=editArticleNote¶m=" + param_escape(id);
|
||||||
|
|
||||||
|
if (dijit.byId("editNoteDlg"))
|
||||||
|
dijit.byId("editNoteDlg").destroyRecursive();
|
||||||
|
|
||||||
|
dialog = new dijit.Dialog({
|
||||||
|
id: "editNoteDlg",
|
||||||
|
title: __("Edit article note"),
|
||||||
|
style: "width: 600px",
|
||||||
|
execute: function() {
|
||||||
|
if (this.validate()) {
|
||||||
|
var query = dojo.objectToQuery(this.attr('value'));
|
||||||
|
|
||||||
|
notify_progress("Saving article note...", true);
|
||||||
|
|
||||||
|
new Ajax.Request("backend.php", {
|
||||||
|
parameters: query,
|
||||||
|
onComplete: function(transport) {
|
||||||
|
notify('');
|
||||||
|
dialog.hide();
|
||||||
|
|
||||||
|
var reply = JSON.parse(transport.responseText);
|
||||||
|
|
||||||
|
cache_invalidate(id);
|
||||||
|
|
||||||
|
var elem = $("POSTNOTE-" + id);
|
||||||
|
|
||||||
|
if (elem) {
|
||||||
|
Element.hide(elem);
|
||||||
|
elem.innerHTML = reply.note;
|
||||||
|
new Effect.Appear(elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
href: query,
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.show();
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("editArticleNote", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user