Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1574993
 поиск   регистрация   авторизация 
 
Группа :: Сети/WWW
Пакет: bugzilla

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: bugzilla-simple-query.patch


diff -uNr bugzilla-2.16.3-old/query.cgi bugzilla-2.16.3/query.cgi
--- bugzilla-2.16.3-old/query.cgi	2003-05-28 18:34:39 +0400
+++ bugzilla-2.16.3/query.cgi	2003-05-28 18:37:10 +0400
@@ -374,6 +374,7 @@
 
 # Add in the defaults.
 $vars->{'default'} = \%default;
+$vars->{'cur_tab_name'} = "asearch";
 
 # Generate and return the UI (HTML page) from the appropriate template.
 print "Content-type: text/html\n\n";
diff -uNr bugzilla-2.16.3-old/simple_query.cgi bugzilla-2.16.3/simple_query.cgi
--- bugzilla-2.16.3-old/simple_query.cgi	1970-01-01 03:00:00 +0300
+++ bugzilla-2.16.3/simple_query.cgi	2003-05-28 18:35:03 +0400
@@ -0,0 +1,109 @@
+#!/usr/bonsaitools/bin/perl -wT
+#
+# The contents of this file are subject to the Mozilla Public
+# License Version 1.1 (the "License"); you may not use this file
+# except in compliance with the License. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS
+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# The Original Code is the Bugzilla Bug Tracking System.
+# 
+# The Initial Developer of the Original Code is Netscape Communications
+# Corporation. Portions created by Netscape are Copyright (C) 1998
+# Netscape Communications Corporation. All Rights Reserved.
+#
+# Contributor(s): Alexey Gladkov <legion@altlinux.org>
+
+use diagnostics;
+use strict;
+use lib ".";
+
+require "CGI.pl";
+
+use vars qw(
+	@legal_product
+	$buffer
+    $template
+    $vars
+);
+
+ConnectToDatabase();
+
+if (defined $::FORM{"GoAheadAndLogIn"}) {
+    # We got here from a login page, probably from relogin.cgi.  We better
+    # make sure the password is legit.
+    confirm_login();
+} else {
+    quietly_check_login();
+}
+
+GetVersionTable(); 
+
+if (!defined $::FORM{'product'}) {
+  my @products;
+
+  foreach my $p (@::legal_product) {
+	next if (Param("usebuggroups") && GroupExists($p) && !UserInGroup($p));
+    push @products,$p;
+  }
+ 
+  my $prodsize = scalar(@products);
+  if ($prodsize == 0) {
+      DisplayError("Either no products have been defined to enter bugs ".
+                     "against or you have not been given access to any.\n");
+      exit;
+  } 
+  elsif ($prodsize > 1) {
+    $vars->{'prod'} = \@products;
+	$vars->{'cur_tab_name'} = "ssearch";
+    $vars->{'target'} = "simple_query.cgi";
+        
+	print "Content-type: text/html\n\n";
+    $template->process("search/simple-search.html.tmpl", $vars)
+          || ThrowTemplateError($template->error());
+    exit;        
+  }
+
+}
+
+sub GetQuery {
+  my ($sqlfield,$matchtype,$matchstr) = @_;
+  
+  my $query = "";
+  if ($matchtype eq 'substr') {
+    $query .= " AND " . $sqlfield . " LIKE ";
+    $matchstr = '%' . $matchstr . '%';
+  } elsif ($matchtype eq 'regexp') {
+    $query .= " AND " . $sqlfield . " REGEXP ";
+    $matchstr = '.'
+      unless $matchstr;
+  } elsif ($matchtype eq 'notregexp') {
+    $query .= " AND " . $sqlfield . " NOT REGEXP ";
+    $matchstr = '.'
+      unless $matchstr;
+  } 
+  $query .= SqlQuote($matchstr);
+  return $query;
+}
+
+my $product = SqlQuote($::FORM{'product'});
+my $component = $::FORM{'component_str'} ? $::FORM{'component_str'} : ".*";
+
+my $SQLwhere = GetQuery("value",$::FORM{'component_type'},$component);
+SendSQL("SELECT value FROM components WHERE program=".$product.$SQLwhere);
+
+my $query="";
+while (MoreSQLData()) {
+  my ($comp_value) = FetchSQLData();
+  $query.="&component=".$comp_value;
+}
+
+# We add to buffer our results. 
+$::buffer.=$query;
+
+do 'buglist.cgi';
+
diff -uNr bugzilla-2.16.3-old/template/en/default/account/created.html.tmpl bugzilla-2.16.3/template/en/default/account/created.html.tmpl
--- bugzilla-2.16.3-old/template/en/default/account/created.html.tmpl	2003-05-28 18:34:39 +0400
+++ bugzilla-2.16.3/template/en/default/account/created.html.tmpl	2003-05-28 18:35:03 +0400
@@ -36,7 +36,7 @@
 
 <p>
   When the e-mail arrives, 
-  <a href="query.cgi?GoAheadAndLogIn=1">log in here</a>.
+  <a href="simple_query.cgi?GoAheadAndLogIn=1">log in here</a>.
 </p>
 
 [% PROCESS global/footer.html.tmpl %] 
diff -uNr bugzilla-2.16.3-old/template/en/default/account/prefs/footer.html.tmpl bugzilla-2.16.3/template/en/default/account/prefs/footer.html.tmpl
--- bugzilla-2.16.3-old/template/en/default/account/prefs/footer.html.tmpl	2003-05-28 18:34:39 +0400
+++ bugzilla-2.16.3/template/en/default/account/prefs/footer.html.tmpl	2003-05-28 18:35:03 +0400
@@ -64,7 +64,7 @@
       <td colspan="4">
         <br>                            
         If you create remembered queries using the 
-        <a href="query.cgi">query page</a>,
+        <a href="simple_query.cgi">query page</a>,
         you can then come to this page and choose to have some of them  
         appear in the footer of each Bugzilla page.
         <br>
diff -uNr bugzilla-2.16.3-old/template/en/default/bug/create/user-message.html.tmpl bugzilla-2.16.3/template/en/default/bug/create/user-message.html.tmpl
--- bugzilla-2.16.3-old/template/en/default/bug/create/user-message.html.tmpl	2003-05-28 18:34:39 +0400
+++ bugzilla-2.16.3/template/en/default/bug/create/user-message.html.tmpl	2003-05-28 18:35:03 +0400
@@ -31,4 +31,4 @@
 Before reporting a bug, please read the <a href="bugwritinghelp.html">
 bug writing guidelines</a>, please look at the list of
 <a href="duplicates.cgi">most frequently reported bugs</a>, and please
-<a href="query.cgi">search</a> for the bug.
+<a href="simple_query.cgi">search</a> for the bug.
diff -uNr bugzilla-2.16.3-old/template/en/default/bug/navigate.html.tmpl bugzilla-2.16.3/template/en/default/bug/navigate.html.tmpl
--- bugzilla-2.16.3-old/template/en/default/bug/navigate.html.tmpl	2003-05-28 18:34:39 +0400
+++ bugzilla-2.16.3/template/en/default/bug/navigate.html.tmpl	2003-05-28 18:35:03 +0400
@@ -50,5 +50,5 @@
   &nbsp;&nbsp;<a href="buglist.cgi?regetlastlist=1">Show list</a>
 [% END %]
 
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="query.cgi">Query page</a>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="simple_query.cgi">Query page</a>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="enter_bug.cgi">Enter new bug</a>
diff -uNr bugzilla-2.16.3-old/template/en/default/bug/process/verify-new-product.html.tmpl bugzilla-2.16.3/template/en/default/bug/process/verify-new-product.html.tmpl
--- bugzilla-2.16.3-old/template/en/default/bug/process/verify-new-product.html.tmpl	2003-05-28 18:34:39 +0400
+++ bugzilla-2.16.3/template/en/default/bug/process/verify-new-product.html.tmpl	2003-05-28 18:35:03 +0400
@@ -96,7 +96,7 @@
 
 </form>
 <hr>
-<a href="query.cgi">Cancel and Return to the Query Page</a>
+<a href="simple_query.cgi">Cancel and Return to the Query Page</a>
 
 [% PROCESS global/footer.html.tmpl %]
 
diff -uNr bugzilla-2.16.3-old/template/en/default/global/useful-links.html.tmpl bugzilla-2.16.3/template/en/default/global/useful-links.html.tmpl
--- bugzilla-2.16.3-old/template/en/default/global/useful-links.html.tmpl	2003-05-28 18:34:39 +0400
+++ bugzilla-2.16.3/template/en/default/global/useful-links.html.tmpl	2003-05-28 18:35:03 +0400
@@ -44,7 +44,7 @@
       
       <td valign="middle" nowrap>
         <a href="enter_bug.cgi">New</a> | 
-        <a href="query.cgi">Query</a> |
+        <a href="simple_query.cgi">Query</a> |
         
         <input type="submit" value="Find"> bug # 
         <input name="id" size="6"> | 
@@ -115,7 +115,7 @@
     [% ELSE %]    
       <td valign="middle" align="right">
         <a href="createaccount.cgi">New&nbsp;Account</a> | 
-        <a href="query.cgi?GoAheadAndLogIn=1">Log&nbsp;In</a>
+        <a href="simple_query.cgi?GoAheadAndLogIn=1">Log&nbsp;In</a>
       </td>
     </tr>
     [% END %]
diff -uNr bugzilla-2.16.3-old/template/en/default/index.html.tmpl bugzilla-2.16.3/template/en/default/index.html.tmpl
--- bugzilla-2.16.3-old/template/en/default/index.html.tmpl	2003-05-28 18:34:39 +0400
+++ bugzilla-2.16.3/template/en/default/index.html.tmpl	2003-05-28 18:35:03 +0400
@@ -53,7 +53,7 @@
 
   But it all boils down to a choice of:
   <p>
-  <a href="query.cgi">Query existing bug reports</a><br>
+  <a href="simple_query.cgi">Query existing bug reports</a><br>
   <a href="enter_bug.cgi">Enter a new bug report</a><br>
   <a href="reports.cgi">Get summary reports</a><br>
   </p><p>
@@ -61,7 +61,7 @@
   <a href="userprefs.cgi">Change password or user preferences</a><br>
   <a href="relogin.cgi">Logout [% username FILTER html %]</a><br>
 [% ELSE %]
-  <a href="query.cgi?GoAheadAndLogIn=1">Log in to an existing account</a><br>
+  <a href="simple_query.cgi?GoAheadAndLogIn=1">Log in to an existing account</a><br>
   <a href="createaccount.cgi">Open a new Bugzilla account</a><br>
 [% END %]
   </p><p>
diff -uNr bugzilla-2.16.3-old/template/en/default/list/list.html.tmpl bugzilla-2.16.3/template/en/default/list/list.html.tmpl
--- bugzilla-2.16.3-old/template/en/default/list/list.html.tmpl	2003-05-28 18:34:39 +0400
+++ bugzilla-2.16.3/template/en/default/list/list.html.tmpl	2003-05-28 18:35:03 +0400
@@ -92,7 +92,7 @@
 [% IF bugs.size == 0 %]
   Zarro Boogs found.
   <p>
-    <a href="query.cgi">Query Page</a>
+    <a href="simple_query.cgi">Query Page</a>
     &nbsp;&nbsp;<a href="enter_bug.cgi">Enter New Bug</a>
     <a href="query.cgi?[% urlquerypart FILTER html %]">Edit this query</a>
   </p>
@@ -132,7 +132,7 @@
     <input type="hidden" name="buglist" value="[% buglist %]">
     <input type="submit" value="Long Format">
 
-    <a href="query.cgi">Query Page</a> &nbsp;&nbsp;
+    <a href="simple_query.cgi">Query Page</a> &nbsp;&nbsp;
     <a href="enter_bug.cgi">Enter New Bug</a> &nbsp;&nbsp;
     <a href="colchange.cgi?[% urlquerypart FILTER html %]">Change Columns</a> &nbsp;&nbsp;
 
diff -uNr bugzilla-2.16.3-old/template/en/default/reports/duplicates.html.tmpl bugzilla-2.16.3/template/en/default/reports/duplicates.html.tmpl
--- bugzilla-2.16.3-old/template/en/default/reports/duplicates.html.tmpl	2003-05-28 18:34:39 +0400
+++ bugzilla-2.16.3/template/en/default/reports/duplicates.html.tmpl	2003-05-28 18:35:03 +0400
@@ -160,7 +160,7 @@
   <li>If problem not listed:</li>
 
   <ul>
-    <li>Go to the <a href="query.cgi">Bugzilla Search</a>
+    <li>Go to the <a href="simple_query.cgi">Bugzilla Search</a>
       page to try and locate a similar bug that has already been written.</li>
     <li>If you find your bug in Bugzilla, feel free to comment with any new or
       additional data you may have.</li>
diff -uNr bugzilla-2.16.3-old/template/en/default/search/search.html.tmpl bugzilla-2.16.3/template/en/default/search/search.html.tmpl
--- bugzilla-2.16.3-old/template/en/default/search/search.html.tmpl	2003-05-28 18:34:39 +0400
+++ bugzilla-2.16.3/template/en/default/search/search.html.tmpl	2003-05-28 18:35:03 +0400
@@ -25,10 +25,16 @@
   # search/boolean-charts.html.tmpl.
   #%]
 
-[% PROCESS global/header.html.tmpl 
-  title = "Search for bugs"
-  onload = "selectProduct(document.forms['queryform']);"
-%]
+[% IF cur_tab_name %]
+  [% PROCESS search/switch_tabs.html.tmpl 
+    current_tab_name = cur_tab_name
+  %]
+[% ELSE %]
+  [% PROCESS global/header.html.tmpl 
+	title = "Search for bugs"
+	onload = "selectProduct(document.forms['queryform']);"
+  %]
+[% END %]
 
 [% button_name = "Search" %]
 
diff -uNr bugzilla-2.16.3-old/template/en/default/search/simple-search.html.tmpl bugzilla-2.16.3/template/en/default/search/simple-search.html.tmpl
--- bugzilla-2.16.3-old/template/en/default/search/simple-search.html.tmpl	1970-01-01 03:00:00 +0300
+++ bugzilla-2.16.3/template/en/default/search/simple-search.html.tmpl	2003-05-28 18:35:03 +0400
@@ -0,0 +1,97 @@
+[%# The contents of this file are subject to the Mozilla Public
+  # License Version 1.1 (the "License"); you may not use this file
+  # except in compliance with the License. You may obtain a copy of
+  # the License at http://www.mozilla.org/MPL/
+  #
+  # Software distributed under the License is distributed on an "AS
+  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+  # implied. See the License for the specific language governing
+  # rights and limitations under the License.
+  #
+  # The Original Code is the Bugzilla Bug Tracking System.
+  #
+  # The Initial Developer of the Original Code is Netscape Communications
+  # Corporation. Portions created by Netscape are
+  # Copyright (C) 1998 Netscape Communications Corporation. All
+  # Rights Reserved.
+  #
+  # Contributor(s): Alexey Gladkov <legion@altlinux.org>
+  #%]
+
+[% IF cur_tab_name %]
+  [% PROCESS search/switch_tabs.html.tmpl 
+    current_tab_name = cur_tab_name
+  %]
+[% ELSE %]
+  [% DEFAULT title = "Search for bugs" %]
+  [% PROCESS global/header.html.tmpl %]
+[% END %]
+
+[% query_variants = [ 
+  { value => "allwordssubstr", description => "contains all of the words/strings" },
+  { value => "anywordssubstr", description => "contains any of the words/strings" },
+  { value => "substring", description => "contains the string" },
+  { value => "casesubstring", description => "contains the string (exact case)" },
+  { value => "allwords", description => "contains all of the words" },
+  { value => "anywords", description => "contains any of the words" },
+  { value => "regexp", description => "matches the regexp" },
+  { value => "notregexp", description => "doesn't match the regexp" } ] %]
+
+
+<form action="[% target %]" method="get">
+  <table>
+	<tr>
+	  <td>Product: </td>
+	  <td>
+		<select name="product">
+[% FOREACH p = prod.sort %]
+		  <option value="[% p %]">[% p %]</option>
+[% END %]
+		</select>
+	  </td>
+	</tr>
+	<tr>
+	  <td>Component: </td>
+	  <td>
+		<input type="text" name="component_str">
+		<select name="component_type">
+		    <option value="substr">substring</option>
+		    <option value="regexp">regexp</option>
+		    <option value="notregexp">not regexp</option>
+		</select>
+	  </td>
+	</tr>
+	<tr>
+	  <td>Summary: </td>
+	  <td>
+		<input type="text" name="short_desc">
+    	<select name="short_desc_type">
+    	  [% FOREACH qv = query_variants %]
+      		<option value="[% qv.value %]"
+        	  [% " selected" IF default.short_desc_type.0 == qv.value %]>[% qv.description %]</option>
+    	  [% END %]              
+    	</select>
+	  </td>
+	</tr>
+	<tr>
+	  <td>Comment: </td>
+	  <td>
+		<input type="text" name="long_desc">
+    	<select name="long_desc_type">
+    	  [% FOREACH qv = query_variants %]
+      		<option value="[% qv.value %]"
+        	  [% " selected" IF default.short_desc_type.0 == qv.value %]>[% qv.description %]</option>
+    	  [% END %]              
+    	</select>
+	  </td>
+	</tr>
+	<tr>
+	  <td colspan="2">
+		<button type="submit">Search</button>
+	  </td>
+	</tr>
+  </table>
+  <input type="hidden" name="simple" value="1">
+</form>
+
+[% PROCESS global/footer.html.tmpl %] 
diff -uNr bugzilla-2.16.3-old/template/en/default/search/switch_tabs.html.tmpl bugzilla-2.16.3/template/en/default/search/switch_tabs.html.tmpl
--- bugzilla-2.16.3-old/template/en/default/search/switch_tabs.html.tmpl	1970-01-01 03:00:00 +0300
+++ bugzilla-2.16.3/template/en/default/search/switch_tabs.html.tmpl	2003-05-28 18:35:03 +0400
@@ -0,0 +1,60 @@
+[%# The contents of this file are subject to the Mozilla Public
+  # License Version 1.1 (the "License"); you may not use this file
+  # except in compliance with the License. You may obtain a copy of
+  # the License at http://www.mozilla.org/MPL/
+  #
+  # Software distributed under the License is distributed on an "AS
+  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+  # implied. See the License for the specific language governing
+  # rights and limitations under the License.
+  #
+  # The Original Code is the Bugzilla Bug Tracking System.
+  #
+  # The Initial Developer of the Original Code is Netscape Communications
+  # Corporation. Portions created by Netscape are
+  # Copyright (C) 1998 Netscape Communications Corporation. All
+  # Rights Reserved.
+  #
+  # Contributor(s): Alexey Gladkov <legion@altlinux.org>
+  #%]
+
+[% DEFAULT title = "Search for bugs" %]
+[% PROCESS global/header.html.tmpl 
+   style = "td.selected_tab {
+              border-width: 2px 2px 0px;
+              border-style: solid; 
+            }
+            td.unselected_tab, td.spacer {
+              border-width: 0px 0px 2px 0px;
+              border-style: solid; 
+            }"
+%]
+
+[% tabs = [ { name => "ssearch", description => "Simple search", 
+			  href => "simple_query.cgi" },
+            { name => "asearch", description => "Advanced Search",
+			  href => "query.cgi" } ] %]
+
+<center>
+  <table cellspacing="0" cellpadding="10" border="0" width="100%">
+    <tr>
+      <td class="spacer">&nbsp;</td>
+ 
+      [% FOREACH tab = tabs %]
+        [% IF tab.name == current_tab_name %]
+          [% current_tab = tab %]
+          <td align="center" bgcolor="lightblue" class="selected_tab">
+            [% tab.description %]
+          </td>
+        [% ELSE %]
+          <td align="center" bgcolor="#BBBBEE" class="unselected_tab">
+            <a href="[% tab.href %]">[% tab.description %]</a>
+          </td>
+        [% END %]
+       [% END %]
+ 
+       <td class="spacer">&nbsp;</td>
+     </tr>
+   </table>
+</center>
+
 
design & coding: Vladimir Lettiev aka crux © 2004-2005