diff --git a/ietf/iesg/views.py b/ietf/iesg/views.py index 85796ab40..a241b03cf 100644 --- a/ietf/iesg/views.py +++ b/ietf/iesg/views.py @@ -357,14 +357,6 @@ def agenda_documents(request): sections = agenda_sections() fill_in_agenda_docs(date, sections, docs_by_date[d]) - for doc in docs_by_date[d]: - if doc.type_id=='draft': - if doc.get_state_slug() != "rfc": - doc.iprUrl = "/ipr/search?option=document_search&id_document_tag=" + str(doc.name) - else: - doc.iprUrl = "/ipr/search?option=rfc_search&rfc_search=" + str(doc.rfc_number()) - doc.iprCount = len(doc.ipr()) - telechats.append({ "date":date, "sections": sorted((num, section) for num, section in sections.iteritems() diff --git a/ietf/ipr/search.py b/ietf/ipr/search.py index 68fe4315b..cf071401d 100644 --- a/ietf/ipr/search.py +++ b/ietf/ipr/search.py @@ -39,38 +39,34 @@ def patent_file_search(url, q): return q in text return False -def search(request, type="", q="", id=""): +def search(request): wgs = Group.objects.filter(type="wg").select_related().order_by("acronym") - args = request.REQUEST.items() - if args: - for key, value in args: - if key == "option": - type = value - if re.match(".*search", key): - q = value - if re.match(".*id", key): - id = value - if (type and q) or id: - #log("Got query: type=%s, q=%s, id=%s" % (type, q, id)) + search_type = request.GET.get("option") + if search_type: + docid = request.GET.get("id") or request.GET.get("id_document_tag") or "" + + q = "" + for key, value in request.GET.items(): + if key.endswith("search"): + q = value + + if search_type and (q or docid): # Search by RFC number or draft-identifier # Document list with IPRs - if type in ["document_search", "rfc_search"]: + if search_type in ["document_search", "rfc_search"]: doc = q - if type == "document_search": - if q: + + if docid: + start = DocAlias.objects.filter(name=docid) + else: + if search_type == "document_search": q = normalize_draftname(q) start = DocAlias.objects.filter(name__contains=q, name__startswith="draft") - if id: - start = DocAlias.objects.filter(name=id) - if type == "rfc_search": - if q: - try: - q = int(q, 10) - except: - q = -1 - start = DocAlias.objects.filter(name__contains=q, name__startswith="rfc") - if start.count() == 1: + elif search_type == "rfc_search": + start = DocAlias.objects.filter(name="rfc%s" % q.lstrip("0")) + + if len(start) == 1: first = start[0] doc = str(first) docs = related_docs(first) @@ -78,7 +74,7 @@ def search(request, type="", q="", id=""): iprs.sort(key=lambda x: (x.submitted_date, x.ipr_id)) return render("ipr/search_doc_result.html", {"q": q, "iprs": iprs, "docs": docs, "doc": doc }, context_instance=RequestContext(request) ) - elif start.count(): + elif start: return render("ipr/search_doc_list.html", {"q": q, "docs": start }, context_instance=RequestContext(request) ) else: @@ -87,7 +83,7 @@ def search(request, type="", q="", id=""): # Search by legal name # IPR list with documents - elif type == "patent_search": + elif search_type == "patent_search": iprs = IprDetail.objects.filter(legal_name__icontains=q, status__in=[1,3]).order_by("-submitted_date", "-ipr_id") count = iprs.count() iprs = [ ipr for ipr in iprs if not ipr.updated_by.all() ] @@ -96,7 +92,7 @@ def search(request, type="", q="", id=""): # Search by content of email or pagent_info field # IPR list with documents - elif type == "patent_info_search": + elif search_type == "patent_info_search": if len(q) < 3: return render("ipr/search_error.html", {"q": q, "error": "The search string must contain at least three characters" }, context_instance=RequestContext(request) ) @@ -119,7 +115,7 @@ def search(request, type="", q="", id=""): # Search by wg acronym # Document list with IPRs - elif type == "wg_search": + elif search_type == "wg_search": docs = list(DocAlias.objects.filter(document__group__acronym=q)) related = [] for doc in docs: @@ -136,7 +132,7 @@ def search(request, type="", q="", id=""): # Search by rfc and id title # Document list with IPRs - elif type == "title_search": + elif search_type == "title_search": docs = list(DocAlias.objects.filter(document__title__icontains=q)) related = [] for doc in docs: @@ -153,7 +149,7 @@ def search(request, type="", q="", id=""): # Search by title of IPR disclosure # IPR list with documents - elif type == "ipr_title_search": + elif search_type == "ipr_title_search": iprs = IprDetail.objects.filter(title__icontains=q, status__in=[1,3]).order_by("-submitted_date", "-ipr_id") count = iprs.count() iprs = [ ipr for ipr in iprs if not ipr.updated_by.all() ] @@ -161,7 +157,7 @@ def search(request, type="", q="", id=""): context_instance=RequestContext(request) ) else: - raise Http404("Unexpected search type in IPR query: %s" % type) + raise Http404("Unexpected search type in IPR query: %s" % search_type) return HttpResponseRedirect(request.path) return render("ipr/search.html", {"wgs": wgs}, context_instance=RequestContext(request)) diff --git a/ietf/templates/doc/search/ipr_column_with_label.html b/ietf/templates/doc/search/ipr_column_with_label.html index 434460ddd..3582ccd6a 100644 --- a/ietf/templates/doc/search/ipr_column_with_label.html +++ b/ietf/templates/doc/search/ipr_column_with_label.html @@ -1,36 +1,5 @@ -{% comment %} -Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). -All rights reserved. Contact: Pasi Eronen - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of the Nokia Corporation and/or its - subsidiary(-ies) nor the names of its contributors may be used - to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -{% endcomment %} -{% load ietf_filters %} -{% if doc.iprCount %} IPR:{{ doc.iprCount }} {% endif %} + + {% if doc.type_id == "draft" and doc.ipr %} + IPR: {{ doc.ipr|length }} + {% endif %} diff --git a/ietf/templates/ipr/search.html b/ietf/templates/ipr/search.html index d7bbf2697..29fdff2a1 100644 --- a/ietf/templates/ipr/search.html +++ b/ietf/templates/ipr/search.html @@ -11,92 +11,92 @@ label { float:left; width: 200px; }

IPR Search

Document Search

-
- + + + + + +
- - - - + -
- - - - -
+ function check_numeric(val) { + if (IsNumeric(val)) { + return true; + } else { + alert ("Please enter numerics only"); + return false; + } + return false; + } + // --> + +
+ + + + +

Keyword Search

-
- - - - -
-
- - - - -
- * The search string must contain at least three characters, including at least one digit, and include punctuation marks. For best results, please enter the entire string, or as much of it as possible. +
+ + + + +
+
+ + + + +
-
- - - - -
-
- - - - -
-
- - - - -
+ * The search string must contain at least three characters, including at least one digit, and include punctuation marks. For best results, please enter the entire string, or as much of it as possible. + +
+ + + + +
+
+ + + + +
+
+ + + + +

Back to IPR Disclosure Page

diff --git a/ietf/templates/ipr/search_doc_list.html b/ietf/templates/ipr/search_doc_list.html index df3f64b98..c117740c8 100644 --- a/ietf/templates/ipr/search_doc_list.html +++ b/ietf/templates/ipr/search_doc_list.html @@ -8,7 +8,7 @@

Please select one of following I-Ds

{% endblock %}