patch.bugzilla-3 #1

  • //
  • guest/
  • robert_cowham/
  • perforce/
  • utils/
  • p4dtg/
  • P4DTG-Windows/
  • doc/
  • bugz3mysql5/
  • patch.bugzilla-3
  • View
  • Commits
  • Open Download .zip Download (2 KB)
diff -r -u bugzilla/show_bug.cgi bugzilla-nopatch/show_bug.cgi
--- bugzilla/show_bug.cgi	2007-10-18 23:46:11.000000000 -0700
+++ bugzilla-nopatch/show_bug.cgi	2008-03-31 12:56:38.000000000 -0700
@@ -138,5 +138,38 @@
 
 print $cgi->header($format->{'ctype'});
 
+# Function to convert the cf_p4fixes custom field into links to
+# a P4Web installation.  Input to this function is a whitespace
+# separated string of numbers like "3452 212 6563 2324" which is
+# generated by the Perforce P4DTG Bugzilla plugin.
+sub p4web()
+{
+    # Don't show the header if we don't have any fixes.
+    if( !length "@_" )
+    { return; }
+
+    # URL of your P4Web installation.
+    my $p4web_base = "http://p4web-URL.example.com/";
+    my $p4web_ac   = "?ac=10";
+
+    my @f = split( /\s+/, "@_" );
+    my $r = '<tr><th class="field_label">
+             <label for="cf_fixes">Perforce fixes:</label>
+                </th>
+              <td class="field_value" colspan="1">';
+
+    foreach my $c ( @f )
+    {
+        $r .= "<a href='" . $p4web_base . $c . $p4web_ac . "'>"
+            . $c . "</a> ";
+    }
+
+    $r .=     '</td></tr>';
+
+    return $r;
+}
+
+$vars->{ p4web } = \&p4web;
+
 $template->process("$format->{'template'}", $vars)
   || ThrowTemplateError($template->error());
diff -r -u bugzilla/template/en/default/bug/field.html.tmpl bugzilla-nopatch/template/en/default/bug/field.html.tmpl
--- bugzilla/template/en/default/bug/field.html.tmpl	2008-01-12 09:20:51.000000000 -0800
+++ bugzilla-nopatch/template/en/default/bug/field.html.tmpl	2008-03-31 12:56:35.000000000 -0700
@@ -29,6 +29,7 @@
   #               the field value.
   #%]
 
+[% IF field.name != 'cf_p4fixes' %]
 <th class="field_label">
   [% IF editable %]
     <label for="[% field.name FILTER html %]">
@@ -36,9 +37,14 @@
     [% field_descs.${field.name} FILTER html %]:
   [% '</label>' IF editable %]
 </th>
+[% END %]
 
 <td class="field_value" [% "colspan=\"$value_span\"" FILTER none IF value_span %]>
-[% IF editable %]
+
+[% IF field.name == 'cf_p4fixes' %]
+   [% p4web( bug.${ field.name } ) %]
+
+[% ELSIF editable %]
   [% SWITCH field.type %]
     [% CASE constants.FIELD_TYPE_FREETEXT %]
         <input id="[% field.name FILTER html %]" name="[% field.name FILTER html %]"
# Change User Description Committed
#1 9669 Robert Cowham P4DTG 2010.2 for Windows