diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm
index f5719e82c..56dc5e757 100644
--- a/Bugzilla/Component.pm
+++ b/Bugzilla/Component.pm
@@ -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 ####
diff --git a/Bugzilla/Config/BugFields.pm b/Bugzilla/Config/BugFields.pm
index db5d0a2ff..a6ad75c2b 100644
--- a/Bugzilla/Config/BugFields.pm
+++ b/Bugzilla/Config/BugFields.pm
@@ -119,7 +119,8 @@ sub get_param_list {
choices => ['', @legal_OS],
default => '',
checker => \&check_opsys
- } );
+ },
+ );
return @param_list;
}
diff --git a/Bugzilla/Config/Integration.pm b/Bugzilla/Config/Integration.pm
new file mode 100644
index 000000000..018e7d0ed
--- /dev/null
+++ b/Bugzilla/Config/Integration.pm
@@ -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;
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index 02e4bfd0d..76a1dd2ad 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -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)],
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 8a322fae5..4ef2a97ad 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -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++] = "$&") &&
+ ("\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
diff --git a/extensions/custom_url.pl b/extensions/custom_url.pl
new file mode 100644
index 000000000..cb1623be1
--- /dev/null
+++ b/extensions/custom_url.pl
@@ -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", @_) },
+};
diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl
index 564649f44..a639d7ad2 100644
--- a/template/en/default/bug/edit.html.tmpl
+++ b/template/en/default/bug/edit.html.tmpl
@@ -260,12 +260,16 @@
cols = constants.COMMENT_COLS
%]
-