public inbox for gnats-devel@sourceware.org
 help / color / mirror / Atom feed
* A second gnatsweb patch
@ 2002-09-12  7:32 Robert Lupton the Good
  0 siblings, 0 replies; only message in thread
From: Robert Lupton the Good @ 2002-09-12  7:32 UTC (permalink / raw)


[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 468 bytes --]


Here's a second patch to gnatsweb, also ported from my old v2 changes.

2002-09-09  Robert Lupton  <rhl@astro.Princeton.EDU>

	* Add "load saved query" button.  This required adding
	a 'full_cmd' hidden field which allows the command name to be
	different from the string appearing in the button.

	Note that this button allows the user to edit stored queries.

	* Move "Synopsis" to end of list of fields in reports,
	as that's almost always what's wanted.


				R


[-- Attachment #2: Patch to gnatsweb.pl --]
[-- Type: application/octet-stream, Size: 8564 bytes --]

*** /u/dss/cgi-bin/gnatsweb-v4.pl	Mon Sep  9 14:17:52 2002
--- gnats-3.999.1/contrib/gnatsweb/gnatsweb.pl	Mon Sep  9 09:56:40 2002
***************
*** 1896,1902 ****
  
  sub advanced_query_page
  {
-   my($values_hash) = @_;
    my $page = 'Advanced Query';
    page_start_html($page);
    page_heading($page, 'Query Problem Reports');
--- 1896,1901 ----
***************
*** 1924,1935 ****
          "<th nowrap>using regular expression</th>\n",
          "</tr>\n";
    print "<tr>\n<td>Single-line text fields:</td>\n<td>",
!         $q->textfield(-name=>'text', -size=>$width,
! 		      -value=>$$values_hash{Text}),
          "</td>\n</tr>\n",
          "<tr>\n<td>Multi-line text fields:</td>\n<td>",
!         $q->textfield(-name=>'multitext', -size=>$width,
! 		      -value=>$$values_hash{Multitext}),
          "</td>\n</tr>\n",
          "</table>\n";
    print "<div>&nbsp;</div>\n";
--- 1923,1932 ----
          "<th nowrap>using regular expression</th>\n",
          "</tr>\n";
    print "<tr>\n<td>Single-line text fields:</td>\n<td>",
!         $q->textfield(-name=>'text', -size=>$width),
          "</td>\n</tr>\n",
          "<tr>\n<td>Multi-line text fields:</td>\n<td>",
!         $q->textfield(-name=>'multitext', -size=>$width),
          "</td>\n</tr>\n",
          "</table>\n";
    print "<div>&nbsp;</div>\n";
***************
*** 1952,1959 ****
        $param_name =~ s/ /_/;
        $param_name =  field2param ($param_name);
        print "<tr>\n<td>$headerstr:</td>\n<td>",
!           $q->textfield(-name=>$param_name, -size=>$width,
! 			-value=>$$values_hash{$_}),			
            "</td>\n</tr>\n";
        $headerstr = $_." before";
        $param_name = $headerstr;
--- 1949,1955 ----
        $param_name =~ s/ /_/;
        $param_name =  field2param ($param_name);
        print "<tr>\n<td>$headerstr:</td>\n<td>",
!           $q->textfield(-name=>$param_name, -size=>$width),
            "</td>\n</tr>\n";
        $headerstr = $_." before";
        $param_name = $headerstr;
***************
*** 1991,1997 ****
      # 2nd column is regexp search field
      print "<td>",
            $q->textfield(-name=>$lc_fieldname,
!                         -size=>$width, -value=>$$values_hash{$_});
      print "\n";
      # XXX ??? !!! FIXME
      # This should be fixed by allowing a 'not' in front of the fields, so
--- 1987,1993 ----
      # 2nd column is regexp search field
      print "<td>",
            $q->textfield(-name=>$lc_fieldname,
!                         -size=>$width);
      print "\n";
      # XXX ??? !!! FIXME
      # This should be fixed by allowing a 'not' in front of the fields, so
***************
*** 2042,2058 ****
        push (@lcfields, field2param ($_));
      }
    }
-   # move synopsis to end of list so it'll appear last in results;
-   # this is almost always desireable, and the user can override it
-   # with an explicit columns list
-   @lcfields = grep(!/synopsis/, @lcfields);
-   push @lcfields, "synopsis";
- 
    my(@columns) = split(' ', $global_prefs{'columns'});
!   if(!@columns)
!   {
!     @columns = @lcfields;
!   }
    print "<table border=1 cellspacing=0 bgcolor=$cell_bg>\n",
          "<caption>Display</caption>\n",
          "<tr valign=top>\n<td>Display these columns:</td>\n<td>",
--- 2038,2045 ----
        push (@lcfields, field2param ($_));
      }
    }
    my(@columns) = split(' ', $global_prefs{'columns'});
!   @columns = @lcfields unless @columns;
    print "<table border=1 cellspacing=0 bgcolor=$cell_bg>\n",
          "<caption>Display</caption>\n",
          "<tr valign=top>\n<td>Display these columns:</td>\n<td>",
***************
*** 2071,2079 ****
    print "</center>\n";
    print "<hr>",
          $q->p($q->submit('cmd', 'submit query'),
! 	      " or ",
! 	      $q->reset(-name=>'reset'));
!   print $q->end_form();
    page_footer($page);
    page_end_html($page);
  }
--- 2058,2066 ----
    print "</center>\n";
    print "<hr>",
          $q->p($q->submit('cmd', 'submit query'),
!         " or ",
!         $q->reset(-name=>'reset')),
!         $q->end_form();
    page_footer($page);
    page_end_html($page);
  }
***************
*** 2675,2695 ****
            "<tr valign=top>",
            $q->start_form(),
  	  hidden_debug(),
-           "<td> Stored Queries:&nbsp&nbsp&nbsp&nbsp",
-           hidden_db(),
-           $q->hidden(-name=>'full_cmd', -value=>'submit stored query'),
-           $q->submit('cmd', 'submit'),
-           "<td>&nbsp;<td>",
-           $q->popup_menu(-name=>'queryname',
-                          -values=>[ sort(keys %stored_queries) ]),
-           $q->end_form(),
-           $q->start_form(),
- 	  hidden_debug(),
            "<td>",
-           $q->hidden('return_url', $q->self_url()),
            hidden_db(),
!           $q->hidden(-name=>'full_cmd', -value=>'delete stored query'),
!           $q->submit('cmd', 'delete'),
            "<td>&nbsp;<td>",
            $q->popup_menu(-name=>'queryname',
                           -values=>[ sort(keys %stored_queries) ]),
--- 2662,2670 ----
            "<tr valign=top>",
            $q->start_form(),
  	  hidden_debug(),
            "<td>",
            hidden_db(),
!           $q->submit('cmd', 'submit stored query'),
            "<td>&nbsp;<td>",
            $q->popup_menu(-name=>'queryname',
                           -values=>[ sort(keys %stored_queries) ]),
***************
*** 2699,2706 ****
            "<td>",
            $q->hidden('return_url', $q->self_url()),
            hidden_db(),
!           $q->hidden(-name=>'full_cmd', -value=>'load stored query'),
!           $q->submit('cmd', 'load'),
            "<td>&nbsp;<td>",
            $q->popup_menu(-name=>'queryname',
                           -values=>[ sort(keys %stored_queries) ]),
--- 2674,2680 ----
            "<td>",
            $q->hidden('return_url', $q->self_url()),
            hidden_db(),
!           $q->submit('cmd', 'delete stored query'),
            "<td>&nbsp;<td>",
            $q->popup_menu(-name=>'queryname',
                           -values=>[ sort(keys %stored_queries) ]),
***************
*** 2820,2894 ****
    }
  }
  
- # load_stored_query -
- #     Set the current query from a cookie
- #
- #     Queries are stored as individual cookies named
- #     'gnatsweb-query-$queryname'.
- #
- sub load_stored_query
- {
-   my $debug = 0;
-   my $queryname = $q->param('queryname');
-   my $query_string;
-   my $err = '';
-   if (!$queryname)
-   {
-     $err = "Internal error: no 'queryname' parameter";
-   }
-   elsif (!($query_string = $q->cookie("gnatsweb-query-$queryname")))
-   {
-     $err = "No such named query: $queryname";
-   }
-   if ($err)
-   {
-     gerror $err;
-   }
-   else
-   {
-     #
-     # Save values into a hash
-     #
-     my %values;
-     my($key, $val);
-     foreach (split("&", $query_string))
-     {
-       ($key, $val) = split("=");
-       if($key =~ /(before|after)$/)
-       {
- 	$key = ucfirst($`) . " " . ucfirst($1);
-       } else {
- 	$key = ucfirst($key);
-       }
-       if($key eq "Submitter_id") {
- 	$key = "Submitter-Id";
-       }
-       # I'm guessing here... (RHL)
-       $val =~ s/%2A/*/g;
-       $val =~ s/%20/ /g;
-       $val =~ s/%5B/[/g;
-       $val =~ s/%5D/]/g;
-       $val =~ s/%5E/^/g;
-       $val =~ s/%7C/|/g;
-       
-       if($values{$key}) {
- 	$values{$key} .= "|";
-       }
-       $values{$key} .= $val;
-     }
- 
-     print $q->header();
-     initialize();
-     if($debug) {
-       foreach (keys %values)
-       {
- 	print "$_:$values{$_}<BR>";
-       }
-     }
-     advanced_query_page(\%values);
-   }
- }
- 
  # send_html -
  #     Send HTML help file, after first trimming out everything but
  #     <body>..</body>.  This is done in this way for convenience of
--- 2794,2799 ----
***************
*** 4240,4246 ****
    }
  
    $script_name = $q->script_name;
!   my $cmd = $q->param('full_cmd') || $q->param('cmd') || ''; # avoid perl -w warning
  
    ### Cookie-related code must happen before we print the HTML header.
    init_prefs();
--- 4145,4151 ----
    }
  
    $script_name = $q->script_name;
!   my $cmd = $q->param('cmd') || ''; # avoid perl -w warning
  
    ### Cookie-related code must happen before we print the HTML header.
    init_prefs();
***************
*** 4266,4276 ****
      delete_stored_query();
      exit();
    }
-   elsif($cmd eq 'load stored query')
-   {
-     load_stored_query();
-     exit();
-   }
    elsif($cmd eq 'change database')
    {
      # change the user's database in global cookie
--- 4171,4176 ----

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-09-09 19:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-12  7:32 A second gnatsweb patch Robert Lupton the Good

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).