From Tony: Search plugin for Firefox/IE/etc.
- Legacy-Id: 2138
This commit is contained in:
parent
b5223b46b7
commit
4d4caf149f
|
@ -38,7 +38,7 @@ from django.template import RequestContext
|
|||
from django.views.decorators.cache import cache_page
|
||||
from ietf.idtracker.models import IDState, IESGLogin, IDSubState, Area, InternetDraft, Rfc, IDInternal, IETFWG
|
||||
from ietf.idrfc.models import RfcIndex
|
||||
from django.http import Http404, HttpResponse
|
||||
from django.http import Http404, HttpResponse, HttpResponsePermanentRedirect
|
||||
from ietf.idrfc.idrfc_wrapper import IdWrapper,RfcWrapper,IdRfcWrapper
|
||||
from ietf.utils import normalize_draftname
|
||||
|
||||
|
@ -47,6 +47,7 @@ class SearchForm(forms.Form):
|
|||
rfcs = forms.BooleanField(required=False,initial=True)
|
||||
activeDrafts = forms.BooleanField(required=False,initial=True)
|
||||
oldDrafts = forms.BooleanField(required=False,initial=False)
|
||||
lucky = forms.BooleanField(required=False,initial=False)
|
||||
|
||||
by = forms.ChoiceField(choices=[(x,x) for x in ('author','group','area','ad','state')], required=False, initial='wg', label='Foobar')
|
||||
author = forms.CharField(required=False)
|
||||
|
@ -262,6 +263,12 @@ def search_results(request):
|
|||
meta['by'] = form.cleaned_data['by']
|
||||
if 'ajax' in request.REQUEST and request.REQUEST['ajax']:
|
||||
return render_to_response('idrfc/search_results.html', {'docs':results, 'meta':meta}, context_instance=RequestContext(request))
|
||||
elif form.cleaned_data['lucky'] and len(results)==1:
|
||||
doc = results[0]
|
||||
if doc.id:
|
||||
return HttpResponsePermanentRedirect(doc.id.get_absolute_url())
|
||||
else:
|
||||
return HttpResponsePermanentRedirect(doc.rfc.get_absolute_url())
|
||||
else:
|
||||
return render_to_response('idrfc/search_main.html', {'form':form, 'docs':results,'meta':meta}, context_instance=RequestContext(request))
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ IETF.user_groups = { {% for group in user.groups.all %}"{{group}}":true{% if not
|
|||
{% else %}
|
||||
<link rel="icon" href="/images/ietf-icon-blue.bmp" />
|
||||
{% endifnotequal %}
|
||||
<link rel="search" href="/js/datatracker-search.xml" type="application/opensearchdescription+xml" title="IETF Datatracker Search" />
|
||||
</head>
|
||||
<body class="yui-skin-sam" {% block bodyAttrs %}{%endblock%}>
|
||||
<div style="background-color:{% if server_mode %}{% ifnotequal server_mode "production" %}#c00000{% else %}#313163{% endifnotequal %}{%else %}#313163{%endif%};color:white;font-size:150%;height:35px;">
|
||||
|
|
13
static/js/datatracker-search.xml
Normal file
13
static/js/datatracker-search.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
|
||||
<ShortName>IETF Datatracker Search</ShortName>
|
||||
<Description>Use datatracker.ietf.org to search for Internet-Drafts and RFCs</Description>
|
||||
<Tags>Requests For Comments</Tags>
|
||||
<Url type="text/html"
|
||||
template="http://datatracker.ietf.org/doc/search/?name={searchTerms}&activeDrafts=on&rfcs=on&lucky=on"/>
|
||||
<LongName>datatracker.ietf.org RFC and Internet-Draft Search</LongName>
|
||||
<Image height="16" width="16" type="image/vnd.microsoft.icon">http://datatracker.ietf.org/images/ietf-icon-blue.bmp</Image>
|
||||
<Developer>Tony Hansen</Developer>
|
||||
<Language>en-us</Language>
|
||||
</OpenSearchDescription>
|
||||
|
Loading…
Reference in a new issue