s/issue/bug/g + updated ncdc-share-report

This commit is contained in:
Yorhel 2012-03-30 13:50:56 +02:00
parent 05c36a1aef
commit d6865e7b42
5 changed files with 121 additions and 119 deletions

View file

@ -12,8 +12,9 @@ BEGIN { ($ROOT = abs_path $0) =~ s{index\.cgi$}{}; }
my @changes = (
[ '2012-03-24', '/ncdu/issue', 'Moved issue tracker from sourceforge to this site' ],
[ '2012-03-17', '/ncdc/issue', 'Wrote a small issue tracker for ncdc' ],
[ '2012-03-30', '/dump', 'Updated ncdc-share-report for Go 1' ],
[ '2012-03-24', '/ncdu/bug', 'Moved ncdu bug tracker from sourceforge to this site' ],
[ '2012-03-17', '/ncdc/bug', 'Wrote a small bug tracker for ncdc' ],
[ '2012-03-14', '/ncdc', 'ncdc 1.9 released.' ],
[ '2012-02-15', '/doc/commvis', 'Added an article on my new communication system.' ],
[ '2012-02-13', '/ncdc', 'ncdc 1.8 released.' ],
@ -76,16 +77,16 @@ TUWF::register(
qr{dump/grenamr} => sub { podpage(shift, 'dump-grenamr', 'dump', 'grenamr', 'GTK+ Mass File Renamer') },
qr{dump/nccolour} => sub { podpage(shift, 'dump-nccolour', 'dump', 'nccolour', 'Colours in NCurses') },
qr{feed\.atom} => \&atom,
qr{(ncdc|ncdu)/issue} => \&issue_list,
qr{(ncdc|ncdu)/issue/post} => \&issue_post,
qr{(ncdc|ncdu)/issue/new} => \&issue_new,
qr{(ncdc|ncdu)/issue/([1-9][0-9]*)} => \&issue_item,
qr{(ncdc|ncdu)/bug} => \&bug_list,
qr{(ncdc|ncdu)/bug/post} => \&bug_post,
qr{(ncdc|ncdu)/bug/new} => \&bug_new,
qr{(ncdc|ncdu)/bug/([1-9][0-9]*)} => \&bug_item,
);
TUWF::set(
logfile => '/www/err.log',
error_404_handler => \&notfound,
mail_from => 'Yorhel\'s issue tracker <projects@yorhel.nl>',
mail_from => 'Yorhel\'s Bug Tracker <projects@yorhel.nl>',
# this is a fairly static site, allow some aggressive caching
pre_request_handler => sub { $_[0]->resHeader('Cache-Control', 's-max-age=86400, max-age=3600'); 1; },
);
@ -189,6 +190,7 @@ sub notfound {
[ 'dump/grenamr', '/dump/grenamr' ],
);
return $s->resRedirect("/$u", 'perm') if $u =~ s/\/$//;
return $s->resRedirect("/$1/bug$2", 'perm') if $u =~ /^(ncd[uc])\/issue(.*)$/;
$s->resStatus(404);
$s->htmlHeader(title => '404', page => '404');
txt 'Sorry, there is no page at this URI. Try one of the links from the menu to find the page you are looking for.';
@ -198,69 +200,69 @@ sub notfound {
# Issue handling
# Bug tracker
sub _issue_init {
require "$ROOT/Issue.pm";
sub _bug_init {
require "$ROOT/Bug.pm";
my($s, $p) = @_;
$s->resHeader('Cache-Control', 'no-cache');
$s->_load_module('TUWF::DB');
$s->{_TUWF}{db_login} = [ undef, undef, undef ];
$s->dbInit;
return TUWF::Issue->new(prefix => $p.'_', admins => [ $ENV{ISSUE_CODE} ]);
return TUWF::Bug->new(prefix => $p.'_', admins => [ $ENV{ISSUE_CODE} ]);
}
sub issue_list {
sub bug_list {
my($s, $p) = @_;
my $is = _issue_init(@_);
$s->htmlHeader(title => "\u$p Issue tracker", page => $p, sec => 'issue');
br; a href => "/$p/issue/new", 'Report new issue'; br; br;
$is->htmlListing((scalar $is->dbListing()), sub { "/$p/issue/".shift });
br; a href => "/$p/issue/new", 'Report new issue'; br; br;
my $is = _bug_init(@_);
$s->htmlHeader(title => "\u$p Bug tracker", page => $p, sec => 'bug');
br; a href => "/$p/bug/new", 'Report new bug'; br; br;
$is->htmlListing((scalar $is->dbListing()), sub { "/$p/bug/".shift });
br; a href => "/$p/bug/new", 'Report new bug'; br; br;
$s->htmlFooter;
}
sub issue_new {
sub bug_new {
my($s, $p) = @_;
my $is = _issue_init(@_);
$s->htmlHeader(title => "\u$p: Report new issue", page => $p, sec => 'issue');
br; a href => "/$p/issue", 'Back to the issue index'; br; br;
$is->htmlForm(undef, "/$p/issue/post");
my $is = _bug_init(@_);
$s->htmlHeader(title => "\u$p: Report new bug", page => $p, sec => 'bug');
br; a href => "/$p/bug", 'Back to the bug index'; br; br;
$is->htmlForm(undef, "/$p/bug/post");
$s->htmlFooter;
}
sub issue_post {
sub bug_post {
my($s, $p) = @_;
return $s->resNotFound if $s->reqMethod() ne 'POST';
my $is = _issue_init($s, $p);
my($f, $l) = $is->handleForm(sub { "http://dev.yorhel.nl/$p/issue/".shift });
my $is = _bug_init($s, $p);
my($f, $l) = $is->handleForm(sub { "http://dev.yorhel.nl/$p/bug/".shift });
if($f->{_err}) {
$s->htmlHeader(title => 'Error creating message', page => $p, sec => 'issue');
$s->htmlHeader(title => 'Error creating message', page => $p, sec => 'bug');
p 'There was an error in the form. Please use the \'back\' button of your
browser to go back to the form (hopefully) without losing your message.
There was an error in the following fields: '.join(', ', map {(my$f=$_->[0])=~s/issue_// ;"\u$f"} @{$f->{_err}}).'.';
There was an error in the following fields: '.join(', ', map {(my$f=$_->[0])=~s/bug_// ;"\u$f"} @{$f->{_err}}).'.';
return $s->htmlFooter;
}
$s->resRedirect("/$p/issue/$l->{issue}", 'post');
$s->resRedirect("/$p/bug/$l->{bug}", 'post');
}
sub issue_item {
sub bug_item {
my($s, $p, $i) = @_;
my $is = _issue_init($s, $p);
my $is = _bug_init($s, $p);
my $item = $is->dbItem($i);
return $s->resNotFound if !@$item;
my $last = $item->[$#$item];
$s->htmlHeader(title => "\u$p: $last->{summary}", page => $p, sec => 'issue');
br; a href => "/$p/issue", 'Back to the issue index'; br; br;
$s->htmlHeader(title => "\u$p: $last->{summary}", page => $p, sec => 'bug');
br; a href => "/$p/bug", 'Back to the bug index'; br; br;
$is->htmlItem($item);
$is->htmlForm($last, "/$p/issue/post") if !$last->{closed};
br; a href => "/$p/issue", 'Back to the issue index'; br; br;
$is->htmlForm($last, "/$p/bug/post") if !$last->{closed};
br; a href => "/$p/bug", 'Back to the bug index'; br; br;
$s->htmlFooter;
}
@ -404,7 +406,7 @@ sub htmlMenu {
$m->('/ncdu/man', 'Manual', $o{sec} eq 'man');
$m->('/ncdu/changes', 'Changelog', $o{sec} eq 'changes');
$m->('/ncdu/scr', 'Screenshots', $o{sec} eq 'scr');
$m->('/ncdu/issue', 'Issue tracker', $o{sec} eq 'issue');
$m->('/ncdu/bug', 'Bug tracker', $o{sec} eq 'bug');
});
$m->('/ncdc', 'Ncdc', $o{page} eq 'ncdc', sub {
$m->('/ncdc', 'Info', !$o{sec});
@ -412,7 +414,7 @@ sub htmlMenu {
$m->('/ncdc/man', 'Manual', $o{sec} eq 'man');
$m->('/ncdc/changes', 'Changelog', $o{sec} eq 'changes');
$m->('/ncdc/scr', 'Screenshots', $o{sec} eq 'scr');
$m->('/ncdc/issue', 'Issue tracker', $o{sec} eq 'issue');
$m->('/ncdc/bug', 'Bug tracker', $o{sec} eq 'bug');
});
$m->('/tuwf', 'Tuwf', $o{page} eq 'tuwf', sub {
$m->('/tuwf', 'Info', !$o{sec});