Bug 40933

Merge Wiki (Bug 13593) and ViewVC (Bug 37020) integration into Bugzilla 3.2 (+refuck)


git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@79 6955db30-a419-402b-8a0d-67ecbb4d7f56
custis
vfilippov 2008-12-26 13:18:47 +00:00
parent b67247e53b
commit bf6ab899d4
7 changed files with 108 additions and 6 deletions

View File

@ -43,6 +43,7 @@ use constant DB_COLUMNS => qw(
initialowner
initialqacontact
description
wiki_url
);
use constant REQUIRED_CREATE_FIELDS => qw(
@ -416,10 +417,11 @@ sub product {
#### Accessors ####
###############################
sub id { return $_[0]->{'id'}; }
sub name { return $_[0]->{'name'}; }
sub description { return $_[0]->{'description'}; }
sub product_id { return $_[0]->{'product_id'}; }
sub id { return $_[0]->{id}; }
sub name { return $_[0]->{name}; }
sub description { return $_[0]->{description}; }
sub wiki_url { return $_[0]->{wiki_url}; }
sub product_id { return $_[0]->{product_id}; }
###############################
#### Subroutines ####

View File

@ -119,7 +119,8 @@ sub get_param_list {
choices => ['', @legal_OS],
default => '',
checker => \&check_opsys
} );
},
);
return @param_list;
}

View File

@ -0,0 +1,52 @@
#!/usr/bin/perl
# ëÏÎÆÉÇÕÒÁÃÉÑ ÉÎÔÅÇÒÁÃÉÉ ÓÏ ×ÓÅ×ÏÚÍÏÖÎÙÍÉ ÷ÉËÁÍÉ É ÷ØÀ×ÉÓÑÍÉ
package extensions::custis::lib::Config;
use strict;
use warnings;
use Bugzilla::Config::Common;
sub get_param_list
{
return (
{
name => 'wiki_url',
type => 's',
default => 'http://wiki.office.custis.ru/wiki/index.php/',
},
{
name => 'viewvc_url',
type => 's',
default => 'http://viewvc.office.custis.ru/viewvc.py/',
},
{
name => 'smwiki_url',
type => 's',
default => 'http://penguin.office.custis.ru/smwiki/index.php/',
},
{
name => 'smboa_url',
type => 's',
default => 'http://penguin.office.custis.ru/smboa/index.php/',
},
{
name => 'sbwiki_url',
type => 's',
default => 'http://sobin.office.custis.ru/sbwiki/index.php/',
},
{
name => 'rdwiki_url',
type => 's',
default => 'http://radey.office.custis.ru/rdwiki/index.php/',
},
);
}
1;

View File

@ -1071,6 +1071,7 @@ use constant ABSTRACT_SCHEMA => {
COLUMN => 'userid',
DELETE => 'SET NULL'}},
description => {TYPE => 'MEDIUMTEXT', NOTNULL => 1},
wiki_url => {TYPE => 'TINYTEXT', NOTNULL => 1},
],
INDEXES => [
components_product_id_idx => {FIELDS => [qw(product_id name)],

View File

@ -55,6 +55,9 @@ use IO::Dir;
use base qw(Template);
my ($custom_p, $custom_proto);
$custom_proto = do (bz_locations()->{libpath} . "/extensions/custom_url.pl");
# As per the Template::Base documentation, the _init() method is being called
# by the new() constructor. We take advantage of this in order to plug our
# UTF-8-aware Parser object in neatly after the original _init() method has
@ -208,6 +211,17 @@ sub quoteUrls {
("\0\0" . ($count-1) . "\0\0")
~egox;
if ($custom_proto && %$custom_proto)
{
$custom_p ||= join '|', keys %$custom_proto;
$text =~ s
~\b($custom_p):([^\s<>\"\#]+)(\#[^\s<>\"\#]+)?
~($tmp = &{$custom_proto->{$1}}(html_quote($2),$3)) &&
($things[$count++] = "<a href=\"$tmp\">$&</a>") &&
("\0\0" . ($count-1) . "\0\0")
~gesox;
}
# We have to quote now, otherwise the html itself is escaped
# THIS MEANS THAT A LITERAL ", <, >, ' MUST BE ESCAPED FOR A MATCH

28
extensions/custom_url.pl Normal file
View File

@ -0,0 +1,28 @@
#!/usr/bin/perl
# Custom URL protocol definitions for CustIS Bugzilla
use Bugzilla::Util;
sub processWikiAnchor
{
my ($anchor) = (@_);
return "" unless $anchor;
$anchor = url_quote(substr($anchor,1));
$anchor =~ s/%/./g;
return $anchor;
}
sub processWikiUrl
{
Bugzilla->params->{$_[0]."_url"} . $_[1] . '#' . processWikiAnchor($_[2]);
}
return {
wiki => sub { processWikiUrl("wiki", @_) },
smwiki => sub { processWikiUrl("smwiki", @_) },
smboa => sub { processWikiUrl("smboa", @_) },
sbwiki => sub { processWikiUrl("sbwiki", @_) },
fawiki => sub { processWikiUrl("fawiki", @_) },
kswiki => sub { processWikiUrl("kswiki", @_) },
rdwiki => sub { processWikiUrl("rdwiki", @_) },
};

View File

@ -260,12 +260,16 @@
cols = constants.COMMENT_COLS
%]
<br>
<div id="knob-buttons">
<div id="knob-buttons" style="text-align: right">
<input type="button" value="Preview" onclick="document.getElementById('wrapcommentpreview').style.display='table-cell';document.getElementById('commentpreview').src='page.cgi?id=previewcomment.html&comment='+escape(document.changeform.comment.value);scrTo('commentpreview')">
<input type="submit" value="Commit" id="commit">
[% IF bug.user.canmove %]
<input type="submit" name="action" id="action" value="[% Param("move-button-text") %]">
[% END %]
<br>Look for [% terms.Bug %] in:
<a href="[% Param('viewvc_url') %]?view=query&comment=bug[% bug.bug_id %]+[% bug.bug_id %]&comment_match=fulltext&querysort=date&date=all">CVS&SVN</a>
/
<a href="[% bug.component_obj.wiki_url || Param('wiki_url') %][% terms.Bug %]_[% bug.bug_id %]">Wiki</a>
</div>
<table class="status">
<tr>