1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
#! @PERL@ -w
# List the messages in a user's log directory
# Copyright (c) 2005 by Rhyolite Software
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE
# BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# Rhyolite Software DCC 1.2.74-1.6 $Revision$
# @configure_input@
# This file must protected with an equivalent to httpd.conf lines
# in the README file.
use strict 'subs';
my($page_size) = 60;
my($total_msgs);
# get DCC parameters
local($list_msg_link, $user_dir); # quiet -w warnings
do('@cgibin@/common') || die("could not get DCC configuration: $!\n");
get_query();
local(%msgs_date, %msgs_from, %msgs_subject, $msg_first, $msg_last, @msgs_num);
get_log_msgs($query{msg} ? $query{msg} : "", $page_size);
html_head("Messages Logged for $user at $hostname");
$total_msgs = @msgs_num;
if ($total_msgs) {
print "<H3>$total_msgs messages logged for <EM>$user</EM> at $hostname</H3>\n<P>\n";
} else {
print "<H3>No messages logged for <EM>$user</EM> at $hostname</H3>\n<P>\n";
}
print "<P class=warn><B>\n";
print $query{result} ? html_str_encode($query{result}) : " ";
print "</B>\n<P>\n";
common_buttons();
print "</TABLE>\n";
if ($total_msgs) {
my($msg_num, $msg, $next_date, $last_date);
print <<EOF;
<P>
<TABLE border=1 cellpadding="2%"
summary="messages logged for $user at $hostname">
EOF
print_links();
for ($msg_num = $msg_first; $msg_num <= $msg_last; ++$msg_num) {
my($msg) = $msgs_num[$msg_num];
next if (!$msg);
$next_date = $msgs_date{$msg};
if ($next_date =~ s/(.*) .*/$1/) {
if (! $last_date) {
print "<TR><TH>Message<TH>$next_date<TH>Author<TH>Subject\n";
} elsif ($last_date ne $next_date) {
print "<TR><TH> <TH>$next_date<TH> <TH> \n";
}
$last_date = $next_date;
}
print <<EOF;
<TR><TD class=mono>$list_msg_link?msg=$msg">$msg</A>
<TD class=mono>$msgs_date{$msg}
<TD>$msgs_from{$msg}
<TD>$msgs_subject{$msg}
EOF
}
print_links();
print "</TABLE>\n";
}
print <<EOF;
</BODY>
</HTML>
EOF
# re-enable mail notifications
unlink("$user_dir/notify.marker", "$user_dir/notify.pending",
"$user_dir/notify.block");
close(MARK)
if (open(MARK, "> $user_dir/notify.marker"));
sub print_links {
my($msg_num);
print "<TR><TD colspan=4>\n";
if ($msg_first > 0) {
$msg_num = $msg_first - $page_size;
$msg_num = 0 if ($msg_num < 0);
print " $list_log_link?msg=$msgs_num[0]\">Newest</A>\n";
print " $list_log_link?msg=$msgs_num[$msg_num]\">Newer</A>\n";
} else {
print " Newest\n";
print " Newer\n";
}
if ($msg_last < $total_msgs-1) {
print " $list_log_link?msg=$msgs_num[$msg_last+1]\">Older</A>\n";
$msg_num = $total_msgs - $page_size;
$msg_num = $msg_last if ($msg_num < $msg_last);
print " $list_log_link?msg=$msgs_num[$msg_num]\">Oldest</A>\n";
} else {
print " Older\n";
print " Oldest\n";
}
}
|