guid,
ttrss_entries.id,ttrss_entries.title,
updated,
+ note,
unread,feed_id,marked,published,link,last_read,
".SUBSTRING_FOR_DATE."(last_read,1,19) as last_read_noms,
$vfeed_query_part
$result = db_query($link, "SELECT
guid,
+ note,
ttrss_entries.id as id,title,
updated,
unread,feed_id,
function generate_syndicated_feed($link, $owner_uid, $feed, $is_cat,
$limit, $search, $search_mode, $match_on) {
+ $note_style = "background-color : #fff7d5; border-width : 1px; ".
+ "padding : 5px; border-style : dashed; border-color : #e7d796;".
+ "margin-top : 5px; color : #9a8c59;";
+
if (!$limit) $limit = 30;
$qfh_ret = queryFeedHeadlines($link, $feed,
print "<title>" .
htmlspecialchars($line["title"]) . "</title>";
- print "<description><![CDATA[" .
- $line["content_preview"] . "]]></description>";
+ print "<description><![CDATA[";
+ print $line["content_preview"];
+ if ($line["note"]) {
+ print "<div style='$note_style'>";
+ print $line["note"];
+ print "</div>";
+ }
+ print "]]></description>";
print "</item>";
}
".SUBSTRING_FOR_DATE."(updated,1,16) as updated,
(SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url,
num_comments,
- author
+ author,
+ note
FROM ttrss_entries,ttrss_user_entries
WHERE id = '$id' AND ref_id = id AND owner_uid = " . $_SESSION["uid"]);
if (!$entry_comments) $entry_comments = " "; # placeholder
print "<div style='float : right'>
- <img src='images/tag.png' class='tagsPic' alt='Tags' title='Tags'>";
+ <img src='images/tag.png' class='tagsPic' alt='Tags' title='Tags'> ";
if (!$zoom_mode) {
print "<span id=\"ATSTR-$id\">$tags_str</span>
style=\"cursor : pointer\" style=\"cursor : pointer\"
onclick=\"zoomToArticle($id)\"
alt='Zoom' title='".__('Show article summary in new window')."'>";
+
+ $note_escaped = htmlspecialchars($line['note'], ENT_QUOTES);
+
+ print "<img src=\"images/art-pub-note.png\" class='tagsPic'
+ style=\"cursor : pointer\" style=\"cursor : pointer\"
+ onclick=\"publishWithNote($id, '$note_escaped')\"
+ alt='PubNote' title='".__('Publish article with a note')."'>";
+
}
print "</div>";
print "<div clear='both'>$entry_comments</div>";
print $article_content;
+ print "<div id=\"POSTNOTE-$id\">";
+ if ($line['note']) {
+ print format_article_note($id, $line['note']);
+ }
+ print "</div>";
+
$result = db_query($link, "SELECT * FROM ttrss_enclosures WHERE
post_id = '$id' AND content_url != ''");
// print "<div class=\"cdmInnerContent\" id=\"CICD-$id\" $cdm_cstyle>";
print sanitize_rss($link, $line["content_preview"]);
+
+ print "<div id=\"POSTNOTE-$id\">";
+ if ($line['note']) {
+ print format_article_note($id, $line['note']);
+ }
+ print "</div>";
+
$article_content = $line["content_preview"];
$e_result = db_query($link, "SELECT * FROM ttrss_enclosures WHERE
" <input type=\"checkbox\" onclick=\"toggleSelectRowById(this,
'RROW-$id')\" class=\"feedCheckBox\" id=\"RCHK-$id\">";
- print "</span><span class='s1'>$marked_pic</span> ";
- print "<span class='s1'>$published_pic</span> ";
- print "<span class='s1'><img src=\"images/art-zoom.png\" class='tagsPic'
+ print "</span><span class='s1'>$marked_pic ";
+ print "$published_pic ";
+ print "<img src=\"images/art-zoom.png\" class='tagsPic'
onclick=\"zoomToArticle($id)\"
style=\"cursor : pointer\"
alt='Zoom'
- title='".__('Show article summary in new window')."'></span>";
+ title='".__('Show article summary in new window')."'> ";
+
+ $note_escaped = htmlspecialchars($line['note'], ENT_QUOTES);
+
+ print "<img src=\"images/art-pub-note.png\" class='tagsPic'
+ style=\"cursor : pointer\" style=\"cursor : pointer\"
+ onclick=\"publishWithNote($id, '$note_escaped')\"
+ alt='PubNote' title='".__('Publish article with a note')."'>";
+
+ print "</span>";
$tags_str = format_tags_string(get_article_tags($link, $id), $id);
print "</span>";
- print "<span class='s2'>Toggle: <a class=\"cdmToggleLink\"
+ print "<span class='s2'><a class=\"cdmToggleLink\"
href=\"javascript:toggleUnread($id)\">
- Unread</a></span>";
+ ".__('toggle unread')."</a></span>";
print "</div>";
print "</div>";
return $labels_str;
}
+
+ function format_article_note($id, $note) {
+
+ $note_escaped = htmlspecialchars($note, ENT_QUOTES);
+
+ $str = "<div class='articleNote'>";
+ $str .= "<div class='articleNoteOps'>";
+ $str .= "<a href=\"javascript:publishWithNote($id, '$note_escaped')\">".
+ __('edit note')."</a>";
+ $str .= "</div>";
+ $str .= $note;
+ $str .= "</div>";
+
+ return $str;
+ }
?>
}
if ($subop == "publ") {
- $pub = $_GET["pub"];
- $id = db_escape_string($_GET["id"]);
+ $pub = $_REQUEST["pub"];
+ $id = db_escape_string($_REQUEST["id"]);
+ $note = trim(strip_tags(db_escape_string($_REQUEST["note"])));
if ($pub == "1") {
$pub = "true";
$pub = "false";
}
+ if ($note != 'undefined') {
+ $note_qpart = "note = '$note',";
+ }
+
// FIXME this needs collision testing
- $result = db_query($link, "UPDATE ttrss_user_entries SET published = $pub
+ $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><counters>";
+
+ print "<rpc-reply>";
+
+ print "<counters>";
getGlobalCounters($link);
getLabelCounters($link);
if (get_pref($link, 'ENABLE_FEED_CATS')) {
getCategoryCounters($link);
}
- print "</counters></rpc-reply>";
+ print "</counters>";
+
+ if ($note != 'undefined') {
+ $note_size = strlen($note);
+ print "<note id=\"$id\" size=\"$note_size\">";
+ print "<![CDATA[" . format_article_note($id, $note) . "]]>";
+ print "</note>";
+ }
+
+ print "</rpc-reply>";
return;
}
require_once "functions.php";
define('EXPECTED_CONFIG_VERSION', 18);
- define('SCHEMA_VERSION', 54);
+ define('SCHEMA_VERSION', 55);
if (!file_exists("config.php")) {
print "<b>Fatal Error</b>: You forgot to copy
published bool not null default 0,
last_read datetime,
score int not null default 0,
+ note text,
unread bool not null default 1,
index (ref_id),
foreign key (ref_id) references ttrss_entries(id) ON DELETE CASCADE,
create table ttrss_version (schema_version int not null) TYPE=InnoDB;
-insert into ttrss_version values (54);
+insert into ttrss_version values (55);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
published boolean not null default false,
last_read timestamp,
score int not null default 0,
+ note text,
unread boolean not null default true);
-- create index ttrss_user_entries_feed_id_index on ttrss_user_entries(feed_id);
create table ttrss_version (schema_version int not null);
-insert into ttrss_version values (54);
+insert into ttrss_version values (55);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
--- /dev/null
+begin;
+
+alter table ttrss_user_entries add column note text;
+
+update ttrss_version set schema_version = 55;
+
+commit;
--- /dev/null
+begin;
+
+alter table ttrss_user_entries add column note text;
+
+update ttrss_version set schema_version = 55;
+
+commit;
div.postReply img.tagsPic {
width : 16px;
height : 16px;
+ margin-left : 4px;
vertical-align : middle;
}
+div.articleNote div.articleNoteOps {
+ float : right;
+ color : #9a8c59;
+}
+
+div.articleNote div.articleNoteOps a {
+ color : #9a8c59;
+}
+
+div.articleNote div.articleNoteOps a:hover {
+ color : black;
+}
+
+div.articleNote {
+ background-color : #fff7d5;
+ border-width : 1px;
+ padding : 5px;
+ border-style : dashed;
+ border-color : #e7d796;
+ font-size : 8px;
+ margin-top : 5px;
+ color : #9a8c59;
+}
+
div.postReply span.author {
font-size : 12px;
}
var last_requested_article = false;
+function toggle_published_callback(transport) {
+ try {
+ if (transport.responseXML) {
+
+ all_counters_callback2(transport);
+
+ var note = transport.responseXML.getElementsByTagName("note")[0];
+
+ if (note) {
+ var note_id = note.getAttribute("id");
+ var note_size = note.getAttribute("size");
+ var note_content = note.firstChild.nodeValue;
+
+ var container = $('POSTNOTE-' + note_id);
+
+ cache_invalidate(note_id);
+
+ if (container) {
+ if (note_size == "0") {
+ Element.hide(container);
+ } else {
+ container.innerHTML = note_content;
+ Element.show(container);
+ }
+ }
+ }
+ }
+
+ } catch (e) {
+ exception_error("toggle_published_callback", e, transport);
+ }
+}
+
function catchup_callback2(transport, callback) {
try {
debug("catchup_callback2 " + transport + ", " + callback);
}
}
-function togglePub(id, client_only, no_effects) {
+function togglePub(id, client_only, no_effects, note) {
try {
var query = "backend.php?op=rpc&id=" + id + "&subop=publ";
query = query + "&afid=" + getActiveFeedId();
+
+ if (note != undefined) {
+ query = query + "¬e=" + param_escape(note);
+ } else {
+ query = query + "¬e=undefined";
+ }
if (tagsAreDisplayed()) {
query = query + "&omode=tl";
var vfeedu = $("FEEDU--2");
var crow = $("RROW-" + id);
- if (mark_img.src.match("pub_unset")) {
+ if (mark_img.src.match("pub_unset") || note != undefined) {
mark_img.src = mark_img.src.replace("pub_unset", "pub_set");
mark_img.alt = __("Unpublish article");
query = query + "&pub=1";
-
} else {
//mark_img.src = "images/pub_unset.png";
if (!client_only) {
new Ajax.Request(query, {
onComplete: function(transport) {
- all_counters_callback2(transport);
+ toggle_published_callback(transport);
} });
}
exception_error("toggleHeadlineActions", e);
}
}
+
+function publishWithNote(id, def_note) {
+ try {
+ if (!def_note) def_note = '';
+
+ var note = prompt(__("Please enter a note for this article:"), def_note);
+
+ if (note != undefined) {
+ togglePub(id, false, false, note);
+ }
+
+ } catch (e) {
+ exception_error("publishWithNote", e);
+ }
+}