]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 359943: Prev/Next <link rel>s not working on process_bug.cgi page - Patch by...
authorlpsolit%gmail.com <>
Wed, 6 Feb 2008 19:34:49 +0000 (19:34 +0000)
committerlpsolit%gmail.com <>
Wed, 6 Feb 2008 19:34:49 +0000 (19:34 +0000)
process_bug.cgi
template/en/default/bug/process/header.html.tmpl
template/en/default/bug/show.html.tmpl
template/en/default/global/site-navigation.html.tmpl

index 1cc4e542d1305dcd74cb4d882d2300cb4d7eb280..4ea6c1f7f947521b404b0ec651da40dc55bb74f5 100755 (executable)
@@ -203,11 +203,35 @@ $vars->{'title_tag'} = "bug_processed";
 
 # Set up the vars for navigational <link> elements
 my @bug_list;
-if ($cgi->cookie("BUGLIST") && defined $cgi->param('id')) {
+if ($cgi->cookie("BUGLIST")) {
     @bug_list = split(/:/, $cgi->cookie("BUGLIST"));
     $vars->{'bug_list'} = \@bug_list;
 }
 
+my ($action, $next_bug);
+if (defined $cgi->param('id')) {
+    $action = Bugzilla->user->settings->{'post_bug_submit_action'}->{'value'};
+
+    if ($action eq 'next_bug') {
+        my $cur = lsearch(\@bug_list, $cgi->param('id'));
+        if ($cur >= 0 && $cur < $#bug_list) {
+            $next_bug = $bug_list[$cur + 1];
+            # No need to check whether the user can see the bug or not.
+            # All we want is its ID. An error will be thrown later
+            # if the user cannot see it.
+            $vars->{'bug'} = {bug_id => $next_bug};
+        }
+    }
+    # Include both action = 'same_bug' and 'nothing'.
+    else {
+        $vars->{'bug'} = {bug_id => $cgi->param('id')};
+    }
+}
+else {
+    # param('id') is not defined when changing multiple bugs at once.
+    $action = 'nothing';
+}
+
 # For each bug, we have to check if the user can edit the bug the product
 # is currently in, before we allow them to change anything.
 foreach my $bug (@bug_objects) {
@@ -615,23 +639,10 @@ eval {
     $vars->{'patchviewerinstalled'} = 1;
 };
 
-my $action;
-if (defined $cgi->param('id')) {
-    $action = Bugzilla->user->settings->{'post_bug_submit_action'}->{'value'};
-} else {
-    # param('id') is not defined when changing multiple bugs
-    $action = 'nothing';
-}
-
 if (Bugzilla->usage_mode == USAGE_MODE_EMAIL) {
     # Do nothing.
 }
 elsif ($action eq 'next_bug') {
-    my $next_bug;
-    my $cur = lsearch(\@bug_list, $cgi->param("id"));
-    if ($cur >= 0 && $cur < $#bug_list) {
-        $next_bug = $bug_list[$cur + 1];
-    }
     if ($next_bug) {
         if (detaint_natural($next_bug) && Bugzilla->user->can_see_bug($next_bug)) {
             my $bug = new Bugzilla::Bug($next_bug);
@@ -664,9 +675,6 @@ elsif ($action eq 'next_bug') {
 
 # End the response page.
 unless (Bugzilla->usage_mode == USAGE_MODE_EMAIL) {
-    # The user pref is 'Do nothing', so all we need is the current bug ID.
-    $vars->{'bug'} = {bug_id => scalar $cgi->param('id')};
-
     $template->process("bug/navigate.html.tmpl", $vars)
         || ThrowTemplateError($template->error());
     $template->process("global/footer.html.tmpl", $vars)
index f31a9f8e4b318b5895d0addc57157b75d9aeb357..5472aa7ddf101d65097b16ff68f3953780559a5c 100644 (file)
@@ -44,5 +44,6 @@
 [% PROCESS global/header.html.tmpl
   javascript_urls = [ "js/util.js", "js/keyword-chooser.js", "js/field.js",
                       "js/yui/yahoo-dom-event.js", "js/yui/calendar.js" ]
-    style_urls = [ "skins/standard/yui/calendar.css", "skins/standard/show_bug.css" ]
- %]
+  style_urls = [ "skins/standard/yui/calendar.css", "skins/standard/show_bug.css" ]
+  doc_section = "bug_page.html"
+%]
index a6f9e8b97851dc6e5b148d79c1f1cc35f9068282..78d166537aaf4e9818a073b6e98534e076a79b62 100644 (file)
@@ -41,8 +41,8 @@
                   ]
     javascript_urls = [ "js/util.js", "js/keyword-chooser.js", "js/field.js",
                         "js/yui/yahoo-dom-event.js", "js/yui/calendar.js" ]
-     style_urls = [ "skins/standard/yui/calendar.css", "skins/standard/show_bug.css" ]
-doc_section = "bug_page.html"
+    style_urls = [ "skins/standard/yui/calendar.css", "skins/standard/show_bug.css" ]
+    doc_section = "bug_page.html"
   %]
 [% END %]
 
index d533627a3772acf674a13f856a6b708f62c35e81..2acbcf44d5794d0b8c8382c023da801f0d157fff 100644 (file)
   <link rel="Top" href="[% urlbase FILTER html %]">
 
   [%# *** Bug List Navigation *** %]
-  [% IF bug && bug_list && bug_list.size > 0 %]
+  [% IF bug_list && bug_list.size > 0 %]
     <link rel="Up" href="buglist.cgi?regetlastlist=1">
 
     <link rel="First" href="show_bug.cgi?id=[% bug_list.first %]">
     <link rel="Last" href="show_bug.cgi?id=[% bug_list.last %]">
 
-    [% current_bug_idx = lsearch(bug_list, bug.bug_id) %]
+    [% IF bug && bug.bug_id %]
+      [% current_bug_idx = lsearch(bug_list, bug.bug_id) %]
+      [% IF current_bug_idx != -1 %]
 
-    [% IF current_bug_idx != -1 %]
+        [% IF current_bug_idx > 0 %]
+          [% prev_bug = current_bug_idx - 1 %]
+          <link rel="Prev" href="show_bug.cgi?id=[% bug_list.$prev_bug %]">
+        [% END %]
 
-      [% IF current_bug_idx > 0 %]
-      [% prev_bug = current_bug_idx - 1 %]
-        <link rel="Prev" href="show_bug.cgi?id=[% bug_list.$prev_bug %]">
-      [% END %]
+        [% IF current_bug_idx + 1 < bug_list.size %]
+          [% next_bug = current_bug_idx + 1 %]
+          <link rel="Next" href="show_bug.cgi?id=[% bug_list.$next_bug %]">
+        [% END %]
 
-      [% IF current_bug_idx + 1 < bug_list.size %]
-        [% next_bug = current_bug_idx + 1 %]
-        <link rel="Next" href="show_bug.cgi?id=[% bug_list.$next_bug %]">
       [% END %]
-
     [% END %]
   [% END %]