add toggle_collapse_cat()

This commit is contained in:
Andrew Dolgov 2009-12-24 15:36:02 +03:00
parent fe430670ab
commit 7f969260c1
3 changed files with 32 additions and 56 deletions

View File

@ -173,34 +173,7 @@
case "collapse": case "collapse":
$cat_id = db_escape_string($_GET["cid"]); $cat_id = db_escape_string($_GET["cid"]);
toggle_collapse_cat($link, $cat_id);
if ($cat_id > 0) {
db_query($link, "UPDATE ttrss_feed_categories SET
collapsed = NOT collapsed WHERE id = '$cat_id' AND owner_uid = " .
$_SESSION["uid"]);
} else {
$pref_name = '';
switch ($cat_id) {
case -1:
$pref_name = '_COLLAPSED_SPECIAL';
break;
case -2:
$pref_name = '_COLLAPSED_LABELS';
break;
case 0:
$pref_name = '_COLLAPSED_UNCAT';
break;
}
if ($pref_name) {
if (get_pref($link, $pref_name)) {
set_pref($link, $pref_name, 'false');
} else {
set_pref($link, $pref_name, 'true');
}
}
}
return; return;
break; break;

View File

@ -6266,4 +6266,34 @@
return $str; return $str;
} }
function toggle_collapse_cat($link, $cat_id) {
if ($cat_id > 0) {
db_query($link, "UPDATE ttrss_feed_categories SET
collapsed = NOT collapsed WHERE id = '$cat_id' AND owner_uid = " .
$_SESSION["uid"]);
} else {
$pref_name = '';
switch ($cat_id) {
case -1:
$pref_name = '_COLLAPSED_SPECIAL';
break;
case -2:
$pref_name = '_COLLAPSED_LABELS';
break;
case 0:
$pref_name = '_COLLAPSED_UNCAT';
break;
}
if ($pref_name) {
if (get_pref($link, $pref_name)) {
set_pref($link, $pref_name, 'false');
} else {
set_pref($link, $pref_name, 'true');
}
}
}
}
?> ?>

View File

@ -26,34 +26,7 @@
if ($subop == "tc" && !$go) { if ($subop == "tc" && !$go) {
$cat_id = db_escape_string($_GET["id"]); $cat_id = db_escape_string($_GET["id"]);
toggle_collapse_cat($link, $cat_id);
if ($cat_id > 0) {
db_query($link, "UPDATE ttrss_feed_categories SET
collapsed = NOT collapsed WHERE id = '$cat_id' AND owner_uid = " .
$_SESSION["uid"]);
} else {
$pref_name = '';
switch ($cat_id) {
case -1:
$pref_name = '_COLLAPSED_SPECIAL';
break;
case -2:
$pref_name = '_COLLAPSED_LABELS';
break;
case 0:
$pref_name = '_COLLAPSED_UNCAT';
break;
}
if ($pref_name) {
if (get_pref($link, $pref_name)) {
set_pref($link, $pref_name, 'false');
} else {
set_pref($link, $pref_name, 'true');
}
}
}
header("Location: index.php"); header("Location: index.php");
return; return;