From 003913e3fc578011d54bda2960f9fc8bf46fdec6 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 29 Feb 2016 00:40:22 +0300 Subject: [PATCH] Support multiple "look for bug in" URLs --- Bugzilla/Config/Integration.pm | 10 ++------- show_bug.cgi | 2 ++ skins/standard/params.css | 8 +++++++ .../admin/params/integration.html.tmpl | 13 +++++------- template/en/default/bug/edit.html.tmpl | 21 +++++++------------ 5 files changed, 25 insertions(+), 29 deletions(-) diff --git a/Bugzilla/Config/Integration.pm b/Bugzilla/Config/Integration.pm index 08a62e5ad..6c24a00b6 100644 --- a/Bugzilla/Config/Integration.pm +++ b/Bugzilla/Config/Integration.pm @@ -26,14 +26,8 @@ sub get_param_list }, { - name => 'viewvc_url', - type => 't', - default => '', - }, - - { - name => 'git_url', - type => 't', + name => 'look_in_urls', + type => 'l', default => '', }, diff --git a/show_bug.cgi b/show_bug.cgi index 68a030d47..9165218ae 100755 --- a/show_bug.cgi +++ b/show_bug.cgi @@ -156,6 +156,8 @@ $vars->{comment_indexes} = sub return [ map { [ $_->{count}, $_->{comment_id}, $_->{type} != CMT_WORKTIME && $_->{type} != CMT_BACKDATED_WORKTIME ? 1 : 0 ] } @$comments ]; }; +$vars->{look_in_urls} = [ map { [ split /:/, $_, 2 ] } grep { /^(?!\s*(#|$))/so } split /\n/, Bugzilla->params->{look_in_urls} ]; + Bugzilla->cgi->send_header($format->{ctype}); $template->process($format->{template}, $vars) || ThrowTemplateError($template->error()); diff --git a/skins/standard/params.css b/skins/standard/params.css index 4eec75261..2041a572a 100644 --- a/skins/standard/params.css +++ b/skins/standard/params.css @@ -59,3 +59,11 @@ dd { padding: .5em; font-size: small; } + +pre.cfg_example { + margin: 8px 0; + padding: 4px; + background: white; + float: left; + border: 1px solid gray; +} diff --git a/template/en/default/admin/params/integration.html.tmpl b/template/en/default/admin/params/integration.html.tmpl index 7bc745256..c5cd6af21 100644 --- a/template/en/default/admin/params/integration.html.tmpl +++ b/template/en/default/admin/params/integration.html.tmpl @@ -18,18 +18,15 @@ _ " \$EMAIL will be replaced by cleartext user email, so you should only never use it in public networks;" _ " \$MD5 will be replaced by MD5 hash of user email, just like it is required by real Gravatar service." _ " You can also disable avatar display by clearing this parameter.", - viewvc_url => - "ViewVC query URL for browsing bug-related commits. Bugzilla4Intranet links to ViewVC search page with full-text query 'bugXXX XXX'" - _ " which allows to show commits with the bug number in the commit message (like 'Bug XXX' or 'BugXXX').", - git_url => - "Git (GitBlit or other web UI) full-text query URL for browsing bug-related commits. '$q' in URL will be replaced by 'bugXXX XXX'" - _ " which allows to show commits with the bug number in the commit message (like 'Bug XXX' or 'BugXXX').", + look_in_urls => + "

VCS/Wiki/whatever query URLs for 'Look for bug in ...' links, one per line, separated by ':'.

" _ + "
CVS/SVN: http://viewvc.local/?view=query&comment=bug\$BUG+\$BUG&comment_match=fulltext&querysort=date&date=all
" _ + "

$BUG will be replaced with bug ID in these URLs.

", wiki_url => "Default MediaWiki URL for bug links. Bugzilla4Intranet links to <wiki_url>/Bug_XXX pages when this is non-empty.", mediawiki_urls => "

Known MediaWiki URLs to be quoted in bug comments, one per line. Example:

" - _ "
wikipedia http://en.wikipedia.org/wiki/
" + _ "
wikipedia http://en.wikipedia.org/wiki/
" _ "

Links like wikipedia:Article_name#Section" _ " and wikipedia:[[Article name#Section]]
will be quoted" _ " and lead to Section (optional) of Article name page in the Wikipedia.

", diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl index caee396a3..3909656bd 100644 --- a/template/en/default/bug/edit.html.tmpl +++ b/template/en/default/bug/edit.html.tmpl @@ -1008,22 +1008,17 @@ document.changeform = document.[% cfname %]; [% BLOCK commit_button %] [% IF user.id %] [% w = BLOCK %] - [% look_in_viewvc = Param('viewvc_url') %] - [% look_in_git = Param('git_url') %] [% look_in_wiki = bug.component_obj.wiki_url || bug.product_obj.wiki_url || Param('wiki_url') %] - [% IF look_in_viewvc || look_in_git || look_in_wiki %] + [% IF look_in_wiki %] + [% look_in_wiki = look_in_wiki _ 'Bug_$BUG' %] + [% look_in_urls.push([ 'Wiki', look_in_wiki ]) %] + [% END %] + [% IF look_in_urls %] Look for [% terms.Bug %] in: - [% IF look_in_viewvc %] - CVS&SVN - [% IF look_in_git || look_in_wiki %] / [% END -%] + [% FOREACH link = look_in_urls %] + [% IF !loop.first %], [% END %] + [% link.0 | html %] [% END %] - [% IF look_in_git %] - Git - [% IF look_in_wiki %] / [% END %] - [% END %] - [% IF look_in_wiki %] - Wiki - [%- END -%] [% END %] [% END %]