Add show/hide toggle on section group display page.

This commit is contained in:
Retro_Guy 2024-05-07 04:45:38 -07:00
parent dfbee69ee8
commit 187e1b917b
3 changed files with 56 additions and 16 deletions

View File

@ -631,6 +631,17 @@ h1.np_post_headline {
margin-top: 10px;
}
/* show or hide groups toggle */
.np_show_hide_toggle {
margin-top: 0;
margin-bottom: 0;
text-decoration: none;
text-align: center;
color: var(--color-highlight);
font-family: Arial, Helvetica, sans-serif;
font-size: 1.2em;
}
/* =========== specifically for rocksolid overboard =========== */
/* results table */

View File

@ -4,6 +4,10 @@ if (! isset($_SESSION['last_access']) || (time() - $_SESSION['last_access']) > 6
$_SESSION['last_access'] = time();
}
header("Expires: " . gmdate("D, d M Y H:i:s", time() + (30)) . " GMT");
header("Cache-Control: max-age=30");
header("Pragma: cache");
$_SESSION['isframed'] = 1;
include "config.inc.php";
@ -26,8 +30,8 @@ include "head.inc";
echo '<h1 class="np_thread_headline">' . basename(getcwd()) . '</h1>';
echo '<table cellpadding="0" cellspacing="0" class="np_buttonbar"><tr>';
// If logged in: button for new only
// If logged in: button for new only
if (isset($_COOKIE['mail_name'])) {
if (isset($OVERRIDES['overboard_disable_new_link']) && $OVERRIDES['overboard_disable_new_link'] === true) {
$newlink = false;
@ -46,6 +50,14 @@ if (isset($_COOKIE['mail_name'])) {
}
}
}
if ($userdata = get_user_mail_auth_data($_COOKIE['mail_name'])) {
$userfile = $spooldir . '/' . strtolower($_COOKIE['mail_name']) . '-articleviews.dat';
$user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . strtolower($_COOKIE['mail_name']) . '.config'));
if (isset($_POST['hide_unsub'])) {
$user_config['hide_unsub'] = $_POST['hide_unsub'];
file_put_contents($config_dir . '/userconfig/' . strtolower($_COOKIE['mail_name']) . '.config', serialize($user_config));
}
}
}
// View Latest button

View File

@ -615,14 +615,6 @@ function groups_show($gruppen)
$userfile = $spooldir . '/' . strtolower($_COOKIE['mail_name']) . '-articleviews.dat';
$user_config = unserialize(file_get_contents($config_dir . '/userconfig/' . strtolower($_COOKIE['mail_name']) . '.config'));
}
if (! isset($user_config['hide_unsub'])) {
if (isset($OVERRIDES['hide_unsub'])) {
$user_config['hide_unsub'] = $OVERRIDES['hide_unsub'];
} else {
$user_config['hide_unsub'] = 'hide';
}
}
}
for ($i = 0; $i < $c; $i ++) {
unset($groupdisplay);
@ -762,11 +754,37 @@ function groups_show($gruppen)
foreach ($nonsubs as $nonsub) {
echo $nonsub;
}
echo "</td></div></table>\n";
echo "</table><table>";
echo '<tr><td class="np_show_hide_toggle">';
if (isset($user_config['hide_unsub']) && $user_config['hide_unsub'] == 'hide') {
echo '<font class="np_last_posted_date">&nbsp;Unsubscribed groups are HIDDEN. Visit <a href="/spoolnews/user.php">User/Configuration</a> to change<br />';
echo '&nbsp;or select groups from <a href="/common/grouplist.php">Grouplist</a> to add groups</font>';
echo '&nbsp;Unsubscribed groups are HIDDEN.';
echo '&nbsp;Select groups from <a href="/common/grouplist.php">Grouplist</a> to add groups';
}
if (isset($userdata)) {
show_groups_hide_toggle();
}
echo '</td></tr>';
echo '</table>';
}
function show_groups_hide_toggle()
{
global $user_config;
echo '<form method="post" action="' . $_SERVER['REQUEST_URI'] . '">';
echo '&nbsp;Unsubscribed Groups: ';
if ($user_config['hide_unsub'] == 'hide') {
echo '<input type="radio" name="hide_unsub" value="show">Show';
echo '&nbsp;';
echo '<input type="radio" name="hide_unsub" value="hide" checked>Hide';
echo '&nbsp;';
} else {
echo '<input type="radio" name="hide_unsub" value="show" checked>Show';
echo '&nbsp;';
echo '<input type="radio" name="hide_unsub" value="hide">Hide';
echo '&nbsp;';
}
echo '<input class="np_button_link" type="submit" value="Reload" name="reload">';
echo '</form >';
}
/*
@ -1077,10 +1095,10 @@ function display_links_in_body($text)
$pattern = "!$pattern!";
$text = preg_replace($pattern, '<a href="' . $linkurl . '" rel="nofollow" target="_blank">' . $url . '</a>', $text, 1);
}
if(file_exists($config_dir . '/rewrite_body.inc.php')) {
if (file_exists($config_dir . '/rewrite_body.inc.php')) {
include ($config_dir . '/rewrite_body.inc.php');
}
echo $text;
if ($isquote) {
echo '</blockquote>';
@ -1566,8 +1584,7 @@ function get_newsgroups_by_msgid($msgid, $noarray = false)
}
$overview_dbh = null;
if ($noarray) {
return(implode(",", $groups));
return (implode(",", $groups));
} else {
return ($groups);
}