published feeds work
This commit is contained in:
parent
ffba8297ea
commit
e4f4b46f9d
|
@ -124,7 +124,6 @@
|
||||||
require_once "modules/pref-users.php";
|
require_once "modules/pref-users.php";
|
||||||
require_once "modules/pref-feed-browser.php";
|
require_once "modules/pref-feed-browser.php";
|
||||||
|
|
||||||
|
|
||||||
if (!sanity_check($link)) { return; }
|
if (!sanity_check($link)) { return; }
|
||||||
|
|
||||||
if ($op == "rpc") {
|
if ($op == "rpc") {
|
||||||
|
@ -269,6 +268,11 @@
|
||||||
module_popup_dialog($link);
|
module_popup_dialog($link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($op == "pref-pub-items") {
|
||||||
|
module_pref_pub_items($link);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// update feeds of all users, may be used anonymously
|
// update feeds of all users, may be used anonymously
|
||||||
if ($op == "globalUpdateFeeds") {
|
if ($op == "globalUpdateFeeds") {
|
||||||
|
|
||||||
|
|
|
@ -1607,7 +1607,13 @@
|
||||||
SET unread = false,last_read = NOW()
|
SET unread = false,last_read = NOW()
|
||||||
WHERE marked = true AND owner_uid = ".$_SESSION["uid"]);
|
WHERE marked = true AND owner_uid = ".$_SESSION["uid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($feed == -2) {
|
||||||
|
db_query($link, "UPDATE ttrss_user_entries
|
||||||
|
SET unread = false,last_read = NOW()
|
||||||
|
WHERE published = true AND owner_uid = ".$_SESSION["uid"]);
|
||||||
|
}
|
||||||
|
|
||||||
} else if ($feed < -10) { // label
|
} else if ($feed < -10) { // label
|
||||||
|
|
||||||
// TODO make this more efficient
|
// TODO make this more efficient
|
||||||
|
@ -1773,6 +1779,8 @@
|
||||||
return getCategoryUnread($link, $n_feed);
|
return getCategoryUnread($link, $n_feed);
|
||||||
} else if ($n_feed == -1) {
|
} else if ($n_feed == -1) {
|
||||||
$match_part = "marked = true";
|
$match_part = "marked = true";
|
||||||
|
} else if ($n_feed == -2) {
|
||||||
|
$match_part = "published = true";
|
||||||
} else if ($n_feed > 0) {
|
} else if ($n_feed > 0) {
|
||||||
|
|
||||||
$result = db_query($link, "SELECT id FROM ttrss_feeds
|
$result = db_query($link, "SELECT id FROM ttrss_feeds
|
||||||
|
@ -1942,7 +1950,7 @@
|
||||||
$result = db_query($link, "SELECT count(ttrss_entries.id) as count FROM ttrss_entries,ttrss_user_entries,ttrss_feeds
|
$result = db_query($link, "SELECT count(ttrss_entries.id) as count FROM ttrss_entries,ttrss_user_entries,ttrss_feeds
|
||||||
WHERE marked = true AND ttrss_user_entries.ref_id = ttrss_entries.id AND
|
WHERE marked = true AND ttrss_user_entries.ref_id = ttrss_entries.id AND
|
||||||
ttrss_user_entries.feed_id = ttrss_feeds.id AND
|
ttrss_user_entries.feed_id = ttrss_feeds.id AND
|
||||||
unread = true AND ttrss_user_entries.owner_uid = ".$_SESSION["uid"]);
|
hidden = false AND unread = true AND ttrss_user_entries.owner_uid = ".$_SESSION["uid"]);
|
||||||
|
|
||||||
$count = db_fetch_result($result, 0, "count");
|
$count = db_fetch_result($result, 0, "count");
|
||||||
|
|
||||||
|
@ -1953,6 +1961,21 @@
|
||||||
$ret_arr["-1"]["description"] = "Starred";
|
$ret_arr["-1"]["description"] = "Starred";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$result = db_query($link, "SELECT count(ttrss_entries.id) as count FROM ttrss_entries,ttrss_user_entries,ttrss_feeds
|
||||||
|
WHERE published = true AND ttrss_user_entries.ref_id = ttrss_entries.id AND
|
||||||
|
ttrss_user_entries.feed_id = ttrss_feeds.id AND
|
||||||
|
hidden = false AND unread = true AND ttrss_user_entries.owner_uid = ".$_SESSION["uid"]);
|
||||||
|
|
||||||
|
$count = db_fetch_result($result, 0, "count");
|
||||||
|
|
||||||
|
if (!$ret_mode) {
|
||||||
|
print "<counter type=\"label\" id=\"-2\" counter=\"$count\"/>";
|
||||||
|
} else {
|
||||||
|
$ret_arr["-2"]["counter"] = $count;
|
||||||
|
$ret_arr["-2"]["description"] = "Published";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$result = db_query($link, "SELECT owner_uid,id,sql_exp,description FROM
|
$result = db_query($link, "SELECT owner_uid,id,sql_exp,description FROM
|
||||||
ttrss_labels WHERE owner_uid = ".$_SESSION["uid"]." ORDER by description");
|
ttrss_labels WHERE owner_uid = ".$_SESSION["uid"]." ORDER by description");
|
||||||
|
|
||||||
|
@ -2518,6 +2541,9 @@
|
||||||
} else if ($feed == -1) { // starred virtual feed
|
} else if ($feed == -1) { // starred virtual feed
|
||||||
$query_strategy_part = "marked = true";
|
$query_strategy_part = "marked = true";
|
||||||
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
|
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
|
||||||
|
} else if ($feed == -2) { // published virtual feed
|
||||||
|
$query_strategy_part = "published = true";
|
||||||
|
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
|
||||||
} else if ($feed <= -10) { // labels
|
} else if ($feed <= -10) { // labels
|
||||||
$label_id = -$feed - 11;
|
$label_id = -$feed - 11;
|
||||||
|
|
||||||
|
@ -2585,6 +2611,8 @@
|
||||||
|
|
||||||
} else if ($feed == -1) {
|
} else if ($feed == -1) {
|
||||||
$feed_title = __("Starred articles");
|
$feed_title = __("Starred articles");
|
||||||
|
} else if ($feed == -2) {
|
||||||
|
$feed_title = __("Published articles");
|
||||||
} else if ($feed < -10) {
|
} else if ($feed < -10) {
|
||||||
$label_id = -$feed - 11;
|
$label_id = -$feed - 11;
|
||||||
$result = db_query($link, "SELECT description FROM ttrss_labels
|
$result = db_query($link, "SELECT description FROM ttrss_labels
|
||||||
|
@ -2618,7 +2646,7 @@
|
||||||
guid,
|
guid,
|
||||||
ttrss_entries.id,ttrss_entries.title,
|
ttrss_entries.id,ttrss_entries.title,
|
||||||
updated,
|
updated,
|
||||||
unread,feed_id,marked,link,last_read,
|
unread,feed_id,marked,published,link,last_read,
|
||||||
SUBSTRING(last_read,1,19) as last_read_noms,
|
SUBSTRING(last_read,1,19) as last_read_noms,
|
||||||
$vfeed_query_part
|
$vfeed_query_part
|
||||||
$content_query_part
|
$content_query_part
|
||||||
|
@ -2936,6 +2964,31 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function publishArticlesById($link, $ids, $cmode) {
|
||||||
|
|
||||||
|
$tmp_ids = array();
|
||||||
|
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
array_push($tmp_ids, "ref_id = '$id'");
|
||||||
|
}
|
||||||
|
|
||||||
|
$ids_qpart = join(" OR ", $tmp_ids);
|
||||||
|
|
||||||
|
if ($cmode == 0) {
|
||||||
|
db_query($link, "UPDATE ttrss_user_entries SET
|
||||||
|
published = false,last_read = NOW()
|
||||||
|
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
|
||||||
|
} else if ($cmode == 1) {
|
||||||
|
db_query($link, "UPDATE ttrss_user_entries SET
|
||||||
|
published = true
|
||||||
|
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
|
||||||
|
} else {
|
||||||
|
db_query($link, "UPDATE ttrss_user_entries SET
|
||||||
|
published = NOT published,last_read = NOW()
|
||||||
|
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function catchupArticlesById($link, $ids, $cmode) {
|
function catchupArticlesById($link, $ids, $cmode) {
|
||||||
|
|
||||||
$tmp_ids = array();
|
$tmp_ids = array();
|
||||||
|
@ -3022,6 +3075,7 @@
|
||||||
|
|
||||||
$tog_unread_link = "javascript:selectionToggleUnread()";
|
$tog_unread_link = "javascript:selectionToggleUnread()";
|
||||||
$tog_marked_link = "javascript:selectionToggleMarked()";
|
$tog_marked_link = "javascript:selectionToggleMarked()";
|
||||||
|
$tog_published_link = "javascript:selectionTogglePublished()";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -3031,6 +3085,7 @@
|
||||||
|
|
||||||
$tog_unread_link = "javascript:selectionToggleUnread(true)";
|
$tog_unread_link = "javascript:selectionToggleUnread(true)";
|
||||||
$tog_marked_link = "javascript:selectionToggleMarked(true)";
|
$tog_marked_link = "javascript:selectionToggleMarked(true)";
|
||||||
|
$tog_published_link = "javascript:selectionTogglePublished(true)";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3046,7 +3101,9 @@
|
||||||
<li class=\"vsep\"> </li>
|
<li class=\"vsep\"> </li>
|
||||||
<li class=\"top\">Toggle<ul>
|
<li class=\"top\">Toggle<ul>
|
||||||
<li onclick=\"$tog_unread_link\">".__('Unread')."</li>
|
<li onclick=\"$tog_unread_link\">".__('Unread')."</li>
|
||||||
<li onclick=\"$tog_marked_link\">".__('Starred')."</li></ul></li>
|
<li onclick=\"$tog_marked_link\">".__('Starred')."</li>
|
||||||
|
<li onclick=\"$tog_published_link\">".__('Published')."</li>
|
||||||
|
</ul></li>
|
||||||
<li class=\"vsep\"> </li>
|
<li class=\"vsep\"> </li>
|
||||||
<li class=\"top\"><a href=\"$catchup_page_link\">".__('Mark as read')."</a><ul>
|
<li class=\"top\"><a href=\"$catchup_page_link\">".__('Mark as read')."</a><ul>
|
||||||
<li onclick=\"$catchup_page_link\">".__('This page')."</li>
|
<li onclick=\"$catchup_page_link\">".__('This page')."</li>
|
||||||
|
@ -3157,6 +3214,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$num_starred = getFeedUnread($link, -1);
|
$num_starred = getFeedUnread($link, -1);
|
||||||
|
$num_published = getFeedUnread($link, -2);
|
||||||
|
|
||||||
$class = "virt";
|
$class = "virt";
|
||||||
|
|
||||||
|
@ -3165,6 +3223,13 @@
|
||||||
printFeedEntry(-1, $class, __("Starred articles"), $num_starred,
|
printFeedEntry(-1, $class, __("Starred articles"), $num_starred,
|
||||||
"images/mark_set.png", $link);
|
"images/mark_set.png", $link);
|
||||||
|
|
||||||
|
$class = "virt";
|
||||||
|
|
||||||
|
if ($num_published > 0) $class .= "Unread";
|
||||||
|
|
||||||
|
printFeedEntry(-2, $class, __("Published articles"), $num_published,
|
||||||
|
"images/pub_set.png", $link);
|
||||||
|
|
||||||
if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
if (get_pref($link, 'ENABLE_FEED_CATS')) {
|
||||||
print "</ul>";
|
print "</ul>";
|
||||||
}
|
}
|
||||||
|
@ -3848,6 +3913,16 @@
|
||||||
alt=\"Set mark\" onclick='javascript:tMark($id)'>";
|
alt=\"Set mark\" onclick='javascript:tMark($id)'>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($line["published"] == "t" || $line["published"] == "1") {
|
||||||
|
$published_pic = "<img id=\"FPPIC-$id\" src=\"images/pub_set.png\"
|
||||||
|
class=\"markedPic\"
|
||||||
|
alt=\"Unpublish\" onclick='javascript:tPub($id)'>";
|
||||||
|
} else {
|
||||||
|
$published_pic = "<img id=\"FPPIC-$id\" src=\"images/pub_unset.png\"
|
||||||
|
class=\"markedPic\"
|
||||||
|
alt=\"Publish\" onclick='javascript:tPub($id)'>";
|
||||||
|
}
|
||||||
|
|
||||||
# $content_link = "<a target=\"_new\" href=\"".$line["link"]."\">" .
|
# $content_link = "<a target=\"_new\" href=\"".$line["link"]."\">" .
|
||||||
# $line["title"] . "</a>";
|
# $line["title"] . "</a>";
|
||||||
|
|
||||||
|
@ -3887,6 +3962,7 @@
|
||||||
</td>";
|
</td>";
|
||||||
|
|
||||||
print "<td class='hlMarkedPic'>$marked_pic</td>";
|
print "<td class='hlMarkedPic'>$marked_pic</td>";
|
||||||
|
print "<td class='hlMarkedPic'>$published_pic</td>";
|
||||||
|
|
||||||
if ($line["feed_title"]) {
|
if ($line["feed_title"]) {
|
||||||
print "<td class='hlContent'>$content_link</td>";
|
print "<td class='hlContent'>$content_link</td>";
|
||||||
|
@ -3952,6 +4028,7 @@
|
||||||
'RROW-$id')\" class=\"feedCheckBox\" id=\"RCHK-$id\">";
|
'RROW-$id')\" class=\"feedCheckBox\" id=\"RCHK-$id\">";
|
||||||
|
|
||||||
print "</span><span class='s1'>$marked_pic</span> ";
|
print "</span><span class='s1'>$marked_pic</span> ";
|
||||||
|
print "<span class='s1'>$published_pic</span> ";
|
||||||
|
|
||||||
$tags = get_article_tags($link, $id);
|
$tags = get_article_tags($link, $id);
|
||||||
|
|
||||||
|
@ -4094,4 +4171,9 @@
|
||||||
|
|
||||||
return $tag;
|
return $tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generate_publish_key() {
|
||||||
|
return sha1(uniqid(rand(), true));
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 552 B After Width: | Height: | Size: 551 B |
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 447 B |
|
@ -69,6 +69,22 @@
|
||||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($subop == "publ") {
|
||||||
|
$pub = $_GET["pub"];
|
||||||
|
$id = db_escape_string($_GET["id"]);
|
||||||
|
|
||||||
|
if ($pub == "1") {
|
||||||
|
$mark = "true";
|
||||||
|
} else {
|
||||||
|
$pub = "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME this needs collision testing
|
||||||
|
|
||||||
|
$result = db_query($link, "UPDATE ttrss_user_entries SET published = $pub
|
||||||
|
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||||
|
}
|
||||||
|
|
||||||
if ($subop == "updateFeed") {
|
if ($subop == "updateFeed") {
|
||||||
$feed_id = db_escape_string($_GET["feed"]);
|
$feed_id = db_escape_string($_GET["feed"]);
|
||||||
|
|
||||||
|
@ -179,6 +195,21 @@
|
||||||
print "</rpc-reply>";
|
print "</rpc-reply>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($subop == "publishSelected") {
|
||||||
|
|
||||||
|
$ids = split(",", db_escape_string($_GET["ids"]));
|
||||||
|
$cmode = sprintf("%d", $_GET["cmode"]);
|
||||||
|
|
||||||
|
publishArticlesById($link, $ids, $cmode);
|
||||||
|
|
||||||
|
print "<rpc-reply>";
|
||||||
|
print "<counters>";
|
||||||
|
getAllCounters($link);
|
||||||
|
print "</counters>";
|
||||||
|
print_runtime_info($link);
|
||||||
|
print "</rpc-reply>";
|
||||||
|
}
|
||||||
|
|
||||||
if ($subop == "sanityCheck") {
|
if ($subop == "sanityCheck") {
|
||||||
print "<rpc-reply>";
|
print "<rpc-reply>";
|
||||||
if (sanity_check($link)) {
|
if (sanity_check($link)) {
|
||||||
|
|
|
@ -1043,5 +1043,24 @@
|
||||||
class=\"button\" onclick=\"gotoExportOpml()\"
|
class=\"button\" onclick=\"gotoExportOpml()\"
|
||||||
value=\"".__('Export OPML')."\">";
|
value=\"".__('Export OPML')."\">";
|
||||||
|
|
||||||
|
|
||||||
|
print "<h3>Published articles</h3>";
|
||||||
|
|
||||||
|
if (!get_pref($link, "_PREFS_PUBLISH_KEY")) {
|
||||||
|
set_pref($link, "_PREFS_PUBLISH_KEY", generate_publish_key());
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<p>".__('Published articles are exported as a public RSS feed and can be subscribed by anyone who knows the address specified below.')."</p>";
|
||||||
|
|
||||||
|
$url_path = 'http://' . $_SERVER["HTTP_HOST"] . \
|
||||||
|
parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
|
||||||
|
|
||||||
|
$url_path .= "?op=publish&key=" . get_pref($link, "_PREFS_PUBLISH_KEY");
|
||||||
|
|
||||||
|
print "<p><a id=\"pubGenAddress\" target=\"_new\" href=\"$url_path\">$url_path</a></p>";
|
||||||
|
|
||||||
|
print "<p><input type=\"submit\" onclick=\"return pubRegenKey()\"
|
||||||
|
value=\"".__('Generate another address')."\"></p>";
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
59
prefs.js
59
prefs.js
|
@ -16,6 +16,24 @@ var caller_subop = false;
|
||||||
|
|
||||||
var sanity_check_done = false;
|
var sanity_check_done = false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
function replace_pubkey_callback() {
|
||||||
|
if (xmlhttp.readyState == 4) {
|
||||||
|
try {
|
||||||
|
var link = document.getElementById("pubGenAddress");
|
||||||
|
|
||||||
|
if (xmlhttp.responseXML) {
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
notify_error("Error while changing adress");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("replace_pubkey_callback", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} */
|
||||||
|
|
||||||
function expand_feed_callback() {
|
function expand_feed_callback() {
|
||||||
if (xmlhttp.readyState == 4) {
|
if (xmlhttp.readyState == 4) {
|
||||||
try {
|
try {
|
||||||
|
@ -29,23 +47,6 @@ function expand_feed_callback() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pubitems_callback() {
|
|
||||||
if (xmlhttp.readyState == 4) {
|
|
||||||
try {
|
|
||||||
var container = document.getElementById('prefContent');
|
|
||||||
container.innerHTML=xmlhttp.responseText;
|
|
||||||
selectTab("pubItems", true);
|
|
||||||
|
|
||||||
if (typeof correctPNG != 'undefined') {
|
|
||||||
correctPNG();
|
|
||||||
}
|
|
||||||
notify("");
|
|
||||||
} catch (e) {
|
|
||||||
exception_error("feedlist_callback", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function feedlist_callback() {
|
function feedlist_callback() {
|
||||||
if (xmlhttp.readyState == 4) {
|
if (xmlhttp.readyState == 4) {
|
||||||
try {
|
try {
|
||||||
|
@ -1285,8 +1286,6 @@ function selectTab(id, noupdate, subop) {
|
||||||
updateUsersList();
|
updateUsersList();
|
||||||
} else if (id == "feedBrowser") {
|
} else if (id == "feedBrowser") {
|
||||||
updateBigFeedBrowser();
|
updateBigFeedBrowser();
|
||||||
} else if (id == "pubItems") {
|
|
||||||
updatePublishedItems();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1749,14 +1748,24 @@ function feedlistToggleSLAT() {
|
||||||
updateFeedList()
|
updateFeedList()
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePublishedItems() {
|
/*
|
||||||
|
function pubRegenKey() {
|
||||||
|
|
||||||
if (!xmlhttp_ready(xmlhttp)) {
|
if (!xmlhttp_ready(xmlhttp)) {
|
||||||
printLockingError();
|
printLockingError();
|
||||||
return
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlhttp.open("GET", "backend.php?op=pref-pubitems");
|
var ok = confirm("Replace current publishing address with a new one?");
|
||||||
xmlhttp.onreadystatechange=pubitems_callback;
|
|
||||||
xmlhttp.send(null);
|
|
||||||
|
|
||||||
}
|
if (ok) {
|
||||||
|
|
||||||
|
notify_progress("Trying to change address...");
|
||||||
|
|
||||||
|
xmlhttp.open("GET", "backend.php?op=backend-rpc&subop=regen-pub-key");
|
||||||
|
xmlhttp.onreadystatechange=replace_pubkey_callback;
|
||||||
|
xmlhttp.send(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
} */
|
||||||
|
|
|
@ -108,8 +108,8 @@ window.onload = init;
|
||||||
<div id="feedBrowserTab" class="prefsTab"
|
<div id="feedBrowserTab" class="prefsTab"
|
||||||
onclick="selectTab('feedBrowser')"><?php echo __('Other Feeds') ?></div>
|
onclick="selectTab('feedBrowser')"><?php echo __('Other Feeds') ?></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<div id="pubItemsTab" class="prefsTab"
|
<!-- <div id="pubItemsTab" class="prefsTab"
|
||||||
onclick="selectTab('pubItems')"><?php echo __('Published Articles') ?></div>
|
onclick="selectTab('pubItems')"><?php echo __('Published Articles') ?></div> -->
|
||||||
<div id="filterConfigTab" class="prefsTab"
|
<div id="filterConfigTab" class="prefsTab"
|
||||||
onclick="selectTab('filterConfig')"><?php echo __('Content Filtering') ?></div>
|
onclick="selectTab('filterConfig')"><?php echo __('Content Filtering') ?></div>
|
||||||
<?php if (get_pref($link, 'ENABLE_LABELS')) { ?>
|
<?php if (get_pref($link, 'ENABLE_LABELS')) { ?>
|
||||||
|
|
118
viewfeed.js
118
viewfeed.js
|
@ -334,6 +334,11 @@ function tMark(id) {
|
||||||
return toggleMark(id);
|
return toggleMark(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function tPub(id) {
|
||||||
|
return togglePub(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function toggleMark(id) {
|
function toggleMark(id) {
|
||||||
|
|
||||||
if (!xmlhttp_ready(xmlhttp_rpc)) {
|
if (!xmlhttp_ready(xmlhttp_rpc)) {
|
||||||
|
@ -388,6 +393,60 @@ function toggleMark(id) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function togglePub(id) {
|
||||||
|
|
||||||
|
if (!xmlhttp_ready(xmlhttp_rpc)) {
|
||||||
|
printLockingError();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var query = "backend.php?op=rpc&id=" + id + "&subop=publ";
|
||||||
|
|
||||||
|
var mark_img = document.getElementById("FPPIC-" + id);
|
||||||
|
var vfeedu = document.getElementById("FEEDU--2");
|
||||||
|
var crow = document.getElementById("RROW-" + id);
|
||||||
|
|
||||||
|
if (mark_img.alt != "Unpublish") {
|
||||||
|
mark_img.src = "images/pub_set.png";
|
||||||
|
mark_img.alt = "Unpublish";
|
||||||
|
query = query + "&pub=1";
|
||||||
|
|
||||||
|
if (vfeedu && crow.className.match("Unread")) {
|
||||||
|
vfeedu.innerHTML = (+vfeedu.innerHTML) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
mark_img.src = "images/pub_unset.png";
|
||||||
|
mark_img.alt = "Publish";
|
||||||
|
query = query + "&pub=0";
|
||||||
|
|
||||||
|
if (vfeedu && crow.className.match("Unread")) {
|
||||||
|
vfeedu.innerHTML = (+vfeedu.innerHTML) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var vfeedctr = document.getElementById("FEEDCTR--2");
|
||||||
|
var vfeedr = document.getElementById("FEEDR--2");
|
||||||
|
|
||||||
|
if (vfeedu && vfeedctr) {
|
||||||
|
if ((+vfeedu.innerHTML) > 0) {
|
||||||
|
if (crow.className.match("Unread") && !vfeedr.className.match("Unread")) {
|
||||||
|
vfeedr.className = vfeedr.className + "Unread";
|
||||||
|
vfeedctr.className = "odd";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vfeedctr.className = "invisible";
|
||||||
|
vfeedr.className = vfeedr.className.replace("Unread", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
debug("toggle published for aid " + id);
|
||||||
|
|
||||||
|
new Ajax.Request(query);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function correctHeadlinesOffset(id) {
|
function correctHeadlinesOffset(id) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -587,7 +646,7 @@ function selectionToggleMarked(cdm_mode) {
|
||||||
|
|
||||||
for (i = 0; i < rows.length; i++) {
|
for (i = 0; i < rows.length; i++) {
|
||||||
var row = document.getElementById("RROW-" + rows[i]);
|
var row = document.getElementById("RROW-" + rows[i]);
|
||||||
var mark_img = document.getElementById("FMARKPIC-" + rows[i]);
|
var mark_img = document.getElementById("FMPIC-" + rows[i]);
|
||||||
|
|
||||||
if (row && mark_img) {
|
if (row && mark_img) {
|
||||||
|
|
||||||
|
@ -622,6 +681,63 @@ function selectionToggleMarked(cdm_mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function selectionTogglePublished(cdm_mode) {
|
||||||
|
try {
|
||||||
|
if (!xmlhttp_ready(xmlhttp_rpc)) {
|
||||||
|
printLockingError();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var rows;
|
||||||
|
|
||||||
|
if (cdm_mode) {
|
||||||
|
rows = cdmGetSelectedArticles();
|
||||||
|
} else {
|
||||||
|
rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rows.length == 0) {
|
||||||
|
alert(__("No articles are selected."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < rows.length; i++) {
|
||||||
|
var row = document.getElementById("RROW-" + rows[i]);
|
||||||
|
var mark_img = document.getElementById("FPPIC-" + rows[i]);
|
||||||
|
|
||||||
|
if (row && mark_img) {
|
||||||
|
|
||||||
|
if (mark_img.alt == "Publish") {
|
||||||
|
mark_img.src = "images/pub_set.png";
|
||||||
|
mark_img.alt = "Unpublish";
|
||||||
|
mark_img.setAttribute('onclick',
|
||||||
|
'javascript:togglePub('+rows[i]+', false)');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
mark_img.src = "images/pub_unset.png";
|
||||||
|
mark_img.alt = "Publish";
|
||||||
|
mark_img.setAttribute('onclick',
|
||||||
|
'javascript:togglePub('+rows[i]+', true)');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rows.length > 0) {
|
||||||
|
|
||||||
|
var query = "backend.php?op=rpc&subop=publishSelected&ids=" +
|
||||||
|
param_escape(rows.toString()) + "&cmode=2";
|
||||||
|
|
||||||
|
xmlhttp_rpc.open("GET", query, true);
|
||||||
|
xmlhttp_rpc.onreadystatechange=all_counters_callback;
|
||||||
|
xmlhttp_rpc.send(null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("selectionToggleMarked", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function cdmGetSelectedArticles() {
|
function cdmGetSelectedArticles() {
|
||||||
var sel_articles = new Array();
|
var sel_articles = new Array();
|
||||||
var container = document.getElementById("headlinesInnerContainer");
|
var container = document.getElementById("headlinesInnerContainer");
|
||||||
|
|
Loading…
Reference in New Issue