-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.pl
executable file
·53 lines (41 loc) · 1.35 KB
/
view.pl
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
#!/usr/bin/perl -w
# File: view.pl
# Time-stamp: <Tue Aug 16 16:14:04 2005>
#
# anonymous view of an item.
use strict;
use lib qw(.);
use PMT;
use PMT::Common;
use Data::Dumper;
my $cgi = new CGI();
my $iid = $cgi->param('iid') || "";
my $message = $cgi->param('message') || "";
my $user = PMT::User->retrieve("anonymous");
my $item = PMT::Item->retrieve($iid);
my $template = get_template("anonymous_view.tmpl");
$template->param($item->data());
$template->param(message => $message);
$template->param(page_title => $item->title);
use Text::Tiki;
my $tiki = new Text::Tiki;
my $description = $item->description;
$description =~ s/\(([^\)\(]+\@[^\)\(]+)\)/( $1 )/g; # workaround horrible bug in Text::Tiki
$description =~ s/(\w+)\+(\w+)\@/$1+$2@/g; # workaround for second awful Text::Tiki bug
$template->param(description_html => $tiki->format($description));
my @full_history = ();
my %history_items = ();
foreach my $h (@{$item->history()}) {
$history_items{$h->{event_date_time}} = $h;
}
foreach my $c (@{$item->get_comments()}) {
$history_items{$c->{add_date_time}} = $c;
}
foreach my $i (sort keys %history_items) {
my $t = $history_items{$i};
$t->{timestamp} = $i;
push @full_history, $t;
}
$template->param(full_history => \@full_history);
$template->param(resolve_times => $item->resolve_times);
print $cgi->header(), $template->output();