Add bugLinkHook to allow customisation of clone links

beta
Vitaliy Filippov 2019-06-05 15:59:43 +03:00
parent cb0f6d025c
commit 5e83139625
3 changed files with 19 additions and 0 deletions

View File

@ -94,8 +94,10 @@ function addCollapseLink(id)
function addReplyLink(num, id) function addReplyLink(num, id)
{ {
var e = document.getElementById('comment_act_'+id); var e = document.getElementById('comment_act_'+id);
if (!e) if (!e)
return; return;
var s = '['; var s = '[';
if (user_settings.quote_replies != 'off') if (user_settings.quote_replies != 'off')
{ {
@ -104,11 +106,16 @@ function addReplyLink(num, id)
} }
s += ', clone to <a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;cloned_comment='+num+'">other</a>'; s += ', clone to <a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;cloned_comment='+num+'">other</a>';
s += '/<a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;product='+encodeURIComponent(bug_info.product)+'&amp;cloned_comment='+num+'">same</a>'; s += '/<a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;product='+encodeURIComponent(bug_info.product)+'&amp;cloned_comment='+num+'">same</a>';
// 4Intranet Bug 69514 - Clone to external product button // 4Intranet Bug 69514 - Clone to external product button
if (bug_info.extprod) if (bug_info.extprod)
s += '/<a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;product='+encodeURIComponent(bug_info.extprod)+'&amp;cloned_comment='+num+'">ext</a>'; s += '/<a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;product='+encodeURIComponent(bug_info.extprod)+'&amp;cloned_comment='+num+'">ext</a>';
else if (bug_info.intprod) else if (bug_info.intprod)
s += '/<a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;product='+encodeURIComponent(bug_info.intprod)+'&amp;cloned_comment='+num+'">int</a>'; s += '/<a href="enter_bug.cgi?cloned_bug_id='+bug_info.id+'&amp;product='+encodeURIComponent(bug_info.intprod)+'&amp;cloned_comment='+num+'">int</a>';
if (window.bugLinkHook)
s += bugLinkHook(num, id);
s += ' product]'; s += ' product]';
e.innerHTML += s; e.innerHTML += s;
} }

View File

@ -33,6 +33,16 @@ function htmlspecialchars(s)
return s; return s;
} }
window.http_build_query = function(data)
{
var encoded = '';
for (var i in data)
{
encoded = encoded+'&'+encodeURIComponent(i)+'='+(data[i] === false || data[i] === null ? '' : encodeURIComponent(data[i]));
}
return encoded.substr(1);
};
// Checks if a specified value 'val' is in the specified array 'arr' // Checks if a specified value 'val' is in the specified array 'arr'
function bz_isValueInArray(arr, val) function bz_isValueInArray(arr, val)
{ {

View File

@ -6,6 +6,8 @@
[% PROCESS "bug/show-header.html.tmpl" %] [% PROCESS "bug/show-header.html.tmpl" %]
[% Hook.process('bug_link_hook') %]
[% PROCESS bug/navigate.html.tmpl %] [% PROCESS bug/navigate.html.tmpl %]
[% PROCESS bug/edit.html.tmpl %] [% PROCESS bug/edit.html.tmpl %]