Add override to display short view of headers in messages.

This commit is contained in:
Retro_Guy 2023-09-18 05:07:20 -07:00
parent 2676176737
commit 37a55abb9a
7 changed files with 183 additions and 87 deletions

View File

@ -226,6 +226,10 @@
font-size: 0.9em;
}
.np_header_button_checkbox {
transform: scale(0.8);
}
.np_header_button_link:hover {
color: var(--color-section-background);
background: var(--color-section-link);

View File

@ -226,6 +226,10 @@
font-size: 0.9em;
}
.np_header_button_checkbox {
transform: scale(0.8);
}
.np_header_button_link:hover {
color: var(--color-section-background);
background: var(--color-section-link);

View File

@ -226,6 +226,10 @@
font-size: 0.9em;
}
.np_header_button_checkbox {
transform: scale(0.8);
}
.np_header_button_link:hover {
color: var(--color-section-background);
background: var(--color-section-link);

View File

@ -226,6 +226,10 @@
font-size: 0.9em;
}
.np_header_button_checkbox {
transform: scale(0.8);
}
.np_header_button_link:hover {
color: var(--color-section-background);
background: var(--color-section-link);

View File

@ -226,6 +226,10 @@
font-size: 0.9em;
}
.np_header_button_checkbox {
transform: scale(0.8);
}
.np_header_button_link:hover {
color: var(--color-section-background);
background: var(--color-section-link);

View File

@ -356,10 +356,17 @@ function message_thread($id, $group, $thread, $highlightids = false)
* $group: the name of the newsgroup, is needed for the links to post.php3
* and the header.
*/
function show_header($head, $group, $local_poster = false)
{
global $article_show, $text_header, $file_article, $attachment_show;
global $file_attachment, $anonym_address, $CONFIG;
global $file_attachment, $anonym_address, $CONFIG, $OVERRIDES;
if($OVERRIDES['short_headers'] == true) {
show_header_short($head, $group, $local_poster);
return;
}
if (isset($_COOKIE['tzo'])) {
$offset = $_COOKIE['tzo'];
} else {
@ -472,6 +479,69 @@ function show_header($head, $group, $local_poster = false)
echo '</div>';
}
function show_header_short($head, $group, $local_poster = false)
{
global $article_show, $text_header, $file_article, $attachment_show;
global $file_attachment, $anonym_address, $CONFIG;
if (isset($_COOKIE['tzo'])) {
$offset = $_COOKIE['tzo'];
} else {
$offset = intval($CONFIG['timezone']);
}
echo '<div class="np_article_header">';
echo '<b>';
if ($article_show["Subject"]) {
echo htmlspecialchars($head->subject) . "<br>";
}
echo '</b>';
$poster = address_decode($head->from, "nowhere");
if ($head->name != "") {
$displayname = create_name_link($head->name, $head->from);
} else {
if (isset($CONFIG['hide_email']) && $CONFIG['hide_email'] == true) {
$displayname = truncate_email($head->from);
} else {
$displayname = htmlspecialchars($head->from);
}
}
$ts = new DateTime(date($text_header["date_format"], $head->date), new DateTimeZone('UTC'));
$ts->add(DateInterval::createFromDateString($offset . ' minutes'));
if ($offset != 0) {
$displaydate = $ts->format('D, j M Y H:i') . "<br>\n";
} else {
$displaydate = $ts->format($text_header["date_format"]) . "<br>\n";
}
unset($ts);
if ((isset($attachment_show)) && ($attachment_show == true) && (isset($head->content_type[1]))) {
echo '<div class=np_ob_posted_date>';
echo $text_header["attachments"];
for ($i = 1; $i < count($head->content_type); $i ++) {
if (! strcmp($head->content_type[$i], "text/html")) {
$contype = "HTML Version";
} else {
$contype = $head->content_type_name[$i];
}
echo '<a href="' . $file_attachment . '?group=' . urlencode($group) . '&' . 'id=' . urlencode($head->number) . '&' . 'attachment=' . $i . '">' . $contype . '</a> (' . $head->content_type[$i] . ')';
if ($i < count($head->content_type) - 1)
echo ', ';
}
echo '</div>';
}
if ($article_show["trigger_headers"]) {
echo '<div class=np_ob_posted_date>';
echo '<input type="checkbox" class="np_header_button_checkbox" id="trigger_headers" title="Show headers">';
echo '<div class="display_headers_on">' . display_full_headers($head->number, $group, $head->name, $head->from) . '</div>';
if($local_poster) {
echo "&nbsp;by: <i>".$displayname."</i> - ".$displaydate;
} else {
echo "&nbsp;by: ".$displayname." - ".$displaydate;
}
echo '</div>';
}
echo '</p>';
echo '</div>';
}
function display_full_headers($article, $group, $name, $from, $getface = false)
{
global $spoolpath, $CONFIG;

View File

@ -5,6 +5,12 @@ return [
// spoolnews.php
'maxarticles_per_run' => 100,
'maxfirstrequest' => 100
'maxfirstrequest' => 100,
// Display short view of headers (only subject, name, date)
'short_headers' => false,
// Just leave this here to avoid comma errors
'comma' => true
];
?>