collapsable categories
This commit is contained in:
parent
28bcadff2b
commit
fe14aeb84c
4 changed files with 83 additions and 4 deletions
29
backend.php
29
backend.php
|
@ -372,7 +372,10 @@
|
|||
AND ttrss_user_entries.ref_id = ttrss_entries.id
|
||||
AND owner_uid = '$owner_uid') as unread,
|
||||
(SELECT title FROM ttrss_feed_categories
|
||||
WHERE id = cat_id) AS category
|
||||
WHERE id = cat_id) AS category,
|
||||
cat_id,
|
||||
(SELECT collapsed FROM ttrss_feed_categories
|
||||
WHERE id = cat_id) AS collapsed
|
||||
FROM ttrss_feeds WHERE owner_uid = '$owner_uid' ORDER BY $order_by_qpart");
|
||||
|
||||
$actid = $_GET["actid"];
|
||||
|
@ -395,6 +398,8 @@
|
|||
$total = $line["total"];
|
||||
$unread = $line["unread"];
|
||||
|
||||
$cat_id = $line["cat_id"];
|
||||
|
||||
$tmp_category = $line["category"];
|
||||
|
||||
if (!$tmp_category) {
|
||||
|
@ -421,8 +426,18 @@
|
|||
|
||||
$category = $tmp_category;
|
||||
|
||||
print "<li class=\"feedCat\">$category</li>";
|
||||
print "<li id=\"feedCatHolder\"><ul class=\"feedCatList\">";
|
||||
$collapsed = $line["collapsed"];
|
||||
|
||||
if ($collapsed == "t" || $collapsed == "1") {
|
||||
$holder_class = "invisible";
|
||||
$tmp_category .= "...";
|
||||
} else {
|
||||
$holder_class = "";
|
||||
}
|
||||
|
||||
print "<li class=\"feedCat\" id=\"FCAT-$cat_id\">
|
||||
<a href=\"javascript:toggleCollapseCat($cat_id)\">$tmp_category</a></li>";
|
||||
print "<li id=\"feedCatHolder\" class=\"$holder_class\"><ul class=\"feedCatList\">";
|
||||
}
|
||||
|
||||
printFeedEntry($feed_id, $class, $feed, $unread,
|
||||
|
@ -648,6 +663,14 @@
|
|||
last_read = NOW(),unread = false WHERE owner_uid = " . $_SESSION["uid"]);
|
||||
}
|
||||
|
||||
if ($subop == "collapse") {
|
||||
$cat_id = db_escape_string($_GET["cid"]);
|
||||
db_query($link, "UPDATE ttrss_feed_categories SET
|
||||
collapsed = NOT collapsed WHERE id = '$cat_id' AND owner_uid = " .
|
||||
$_SESSION["uid"]);
|
||||
return;
|
||||
}
|
||||
|
||||
outputFeedList($link, $tags);
|
||||
|
||||
}
|
||||
|
|
49
feedlist.js
49
feedlist.js
|
@ -1,3 +1,23 @@
|
|||
var xmlhttp = false;
|
||||
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
|
||||
function viewfeed(feed, skip, subop, doc) {
|
||||
try {
|
||||
|
@ -136,6 +156,35 @@ function localHotkeyHandler(keycode) {
|
|||
|
||||
}
|
||||
|
||||
function toggleCollapseCat(cat) {
|
||||
try {
|
||||
if (!xmlhttp_ready(xmlhttp)) {
|
||||
printLockingError();
|
||||
return;
|
||||
}
|
||||
|
||||
var cat_elem = document.getElementById("FCAT-" + cat);
|
||||
var cat_list = cat_elem.nextSibling;
|
||||
var caption = cat_elem.lastChild;
|
||||
|
||||
if (cat_list.className.match("invisible")) {
|
||||
cat_list.className = "";
|
||||
caption.innerHTML = caption.innerHTML.replace("...", "");
|
||||
} else {
|
||||
cat_list.className = "invisible";
|
||||
caption.innerHTML = caption.innerHTML + "...";
|
||||
}
|
||||
|
||||
xmlhttp_rpc.open("GET", "backend.php?op=feeds&subop=collapse&cid=" +
|
||||
param_escape(cat), true);
|
||||
xmlhttp_rpc.onreadystatechange=rpc_pnotify_callback;
|
||||
xmlhttp_rpc.send(null);
|
||||
|
||||
} catch (e) {
|
||||
exception_error(e);
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
hideOrShowFeeds(document, getCookie("ttrss_vf_hreadf") == 1);
|
||||
document.onkeydown = hotkey_handler;
|
||||
|
|
|
@ -153,6 +153,14 @@ ul.feedList li.feedCat {
|
|||
font-size : small;
|
||||
}
|
||||
|
||||
ul.feedList li.feedCat a {
|
||||
color : #707070;
|
||||
}
|
||||
|
||||
ul.feedList li.feedCat a:hover {
|
||||
color : #5050aa;
|
||||
}
|
||||
|
||||
ul.feedCatList {
|
||||
list-style-type : none;
|
||||
margin : 0px;
|
||||
|
|
|
@ -602,4 +602,3 @@ function toggleDispRead() {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue