assorted labels bugfixes and UI work
This commit is contained in:
parent
b8a637f3d2
commit
933ba4ee9c
|
@ -2225,42 +2225,10 @@
|
||||||
|
|
||||||
$label_id = -$feed - 11;
|
$label_id = -$feed - 11;
|
||||||
|
|
||||||
$tmp_result = db_query($link, "SELECT sql_exp FROM ttrss_labels
|
db_query($link, "UPDATE ttrss_user_entries, ttrss_user_labels2
|
||||||
WHERE id = '$label_id'");
|
SET unread = false WHERE label_id = '$label_id'
|
||||||
|
AND owner_uid = '".$_SESSION["uid"]."' AND ref_id = article_id");
|
||||||
|
|
||||||
if ($tmp_result) {
|
|
||||||
$sql_exp = db_fetch_result($tmp_result, 0, "sql_exp");
|
|
||||||
|
|
||||||
db_query($link, "BEGIN");
|
|
||||||
|
|
||||||
$tmp2_result = db_query($link,
|
|
||||||
"SELECT
|
|
||||||
int_id
|
|
||||||
FROM
|
|
||||||
ttrss_user_entries,ttrss_entries,ttrss_feeds
|
|
||||||
WHERE
|
|
||||||
ref_id = ttrss_entries.id AND
|
|
||||||
ttrss_user_entries.feed_id = ttrss_feeds.id AND
|
|
||||||
$sql_exp AND
|
|
||||||
ttrss_user_entries.owner_uid = " . $_SESSION["uid"]);
|
|
||||||
|
|
||||||
while ($tmp_line = db_fetch_assoc($tmp2_result)) {
|
|
||||||
db_query($link, "UPDATE
|
|
||||||
ttrss_user_entries
|
|
||||||
SET
|
|
||||||
unread = false, last_read = NOW()
|
|
||||||
WHERE
|
|
||||||
int_id = " . $tmp_line["int_id"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
db_query($link, "COMMIT");
|
|
||||||
|
|
||||||
/* db_query($link, "UPDATE ttrss_user_entries,ttrss_entries
|
|
||||||
SET unread = false,last_read = NOW()
|
|
||||||
WHERE $sql_exp
|
|
||||||
AND ref_id = id
|
|
||||||
AND owner_uid = ".$_SESSION["uid"]); */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ccache_update($link, $feed, $_SESSION["uid"], $cat_view);
|
ccache_update($link, $feed, $_SESSION["uid"], $cat_view);
|
||||||
|
@ -2448,7 +2416,8 @@
|
||||||
SELECT SUM(unread) AS unread FROM
|
SELECT SUM(unread) AS unread FROM
|
||||||
ttrss_user_entries, ttrss_labels2, ttrss_user_labels2
|
ttrss_user_entries, ttrss_labels2, ttrss_user_labels2
|
||||||
WHERE label_id = id AND article_id = ref_id AND
|
WHERE label_id = id AND article_id = ref_id AND
|
||||||
ttrss_labels2.owner_uid = '$owner_uid' AND id = '$label_id'");
|
ttrss_labels2.owner_uid = '$owner_uid' AND id = '$label_id'
|
||||||
|
AND ttrss_user_entries.owner_uid = '$owner_uid'");
|
||||||
|
|
||||||
if (db_num_rows($result) != 0) {
|
if (db_num_rows($result) != 0) {
|
||||||
return db_fetch_result($result, 0, "unread");
|
return db_fetch_result($result, 0, "unread");
|
||||||
|
@ -2686,8 +2655,9 @@
|
||||||
$result = db_query($link,
|
$result = db_query($link,
|
||||||
"SELECT id, caption, SUM(unread) AS unread FROM ttrss_labels2
|
"SELECT id, caption, SUM(unread) AS unread FROM ttrss_labels2
|
||||||
LEFT JOIN ttrss_user_labels2 ON (label_id = id)
|
LEFT JOIN ttrss_user_labels2 ON (label_id = id)
|
||||||
LEFT JOIN ttrss_user_entries ON (ref_id = article_id)
|
LEFT JOIN ttrss_user_entries ON (ref_id = article_id AND
|
||||||
WHERE ttrss_labels2.owner_uid = '$owner_uid'
|
ttrss_user_entries.owner_uid = '$owner_uid')
|
||||||
|
WHERE ttrss_labels2.owner_uid = '$owner_uid'
|
||||||
GROUP BY id");
|
GROUP BY id");
|
||||||
|
|
||||||
while ($line = db_fetch_assoc($result)) {
|
while ($line = db_fetch_assoc($result)) {
|
||||||
|
@ -4056,8 +4026,13 @@
|
||||||
$label_id = $line["id"];
|
$label_id = $line["id"];
|
||||||
$label_caption = $line["caption"];
|
$label_caption = $line["caption"];
|
||||||
|
|
||||||
print "<li onclick=\"javascript:selectionAssignLabel($label_id)\">
|
if ($feed_id < -10 && $feed_id == -11-$label_id) {
|
||||||
$label_caption</li>";
|
print "<li onclick=\"javascript:selectionRemoveLabel($label_id)\">
|
||||||
|
$label_caption ".__('(remove)')."</li>";
|
||||||
|
} else {
|
||||||
|
print "<li onclick=\"javascript:selectionAssignLabel($label_id)\">
|
||||||
|
$label_caption</li>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</ul></li></ul>";
|
print "</ul></li></ul>";
|
||||||
|
@ -6071,6 +6046,19 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function label_remove_article($link, $id, $label, $owner_uid) {
|
||||||
|
|
||||||
|
$label_id = label_find_id($link, $label, $owner_uid);
|
||||||
|
|
||||||
|
if (!$label_id) return;
|
||||||
|
|
||||||
|
$result = db_query($link,
|
||||||
|
"DELETE FROM ttrss_user_labels2
|
||||||
|
WHERE
|
||||||
|
label_id = '$label_id' AND
|
||||||
|
article_id = '$id'");
|
||||||
|
}
|
||||||
|
|
||||||
function label_add_article($link, $id, $label, $owner_uid) {
|
function label_add_article($link, $id, $label, $owner_uid) {
|
||||||
|
|
||||||
$label_id = label_find_id($link, $label, $owner_uid);
|
$label_id = label_find_id($link, $label, $owner_uid);
|
||||||
|
|
|
@ -424,6 +424,25 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($subop == "removeFromLabel") {
|
||||||
|
|
||||||
|
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
||||||
|
$label_id = db_escape_string($_REQUEST["lid"]);
|
||||||
|
|
||||||
|
$label = label_find_caption($link, $label_id, $_SESSION["uid"]);
|
||||||
|
|
||||||
|
if ($label) {
|
||||||
|
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
label_remove_article($link, $id, $label, $_SESSION["uid"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<rpc-reply>OK</rpc-reply>";
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($subop == "assignToLabel") {
|
if ($subop == "assignToLabel") {
|
||||||
|
|
||||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
||||||
|
|
32
viewfeed.js
32
viewfeed.js
|
@ -850,6 +850,38 @@ function toggleUnread(id, cmode, effect) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectionRemoveLabel(id) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
var ids = getSelectedArticleIds2();
|
||||||
|
|
||||||
|
if (ids.length == 0) {
|
||||||
|
alert(__("No articles are selected."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ok = confirm(__("Remove selected articles from label?"));
|
||||||
|
|
||||||
|
if (ok) {
|
||||||
|
|
||||||
|
var query = "backend.php?op=rpc&subop=removeFromLabel&ids=" +
|
||||||
|
param_escape(ids.toString()) + "&lid=" + param_escape(id);
|
||||||
|
|
||||||
|
// notify_progress("Loading, please wait...");
|
||||||
|
|
||||||
|
new Ajax.Request(query, {
|
||||||
|
onComplete: function(transport) {
|
||||||
|
viewCurrentFeed();
|
||||||
|
} });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("selectionAssignLabel", e);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function selectionAssignLabel(id) {
|
function selectionAssignLabel(id) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue