{% endif %}
{% block forejs %}{% endblock %}
- <link rel="search" type="application/opensearchdescription+xml" href="open_search.xml" title="Web Search" />
+ <link rel="search" type="application/opensearchdescription+xml" href="/{{settings.FORUM_SCRIPT_ALIAS}}opensearch.xml" title="{{ settings.APP_SHORT_NAME }} Search" />
</head>
<body>
<div class="notify" style="display:none">
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
+ <ShortName>{{ settings.APP_SHORT_NAME }} Search</ShortName>
+ <Description>Search {{ settings.APP_SHORT_NAME }} using your browser.</Description>
+ <Tags>{{ settings.APP_KEYWORDS }}</Tags>
+ <Url type="text/html" template="{{ settings.APP_URL }}/search/?q={searchTerms}&t=question"/>
+</OpenSearchDescription>
\ No newline at end of file
#url(r'^%s/$' % _('signin/'), 'django_authopenid.views.signin', name='signin'),
url(r'^%s$' % _('about/'), app.meta.about, name='about'),
url(r'^%s$' % _('faq/'), app.meta.faq, name='faq'),
+ url(r'^opensearch\.xml$', app.meta.opensearch, name='opensearch'),
url(r'^%s$' % _('privacy/'), app.meta.privacy, name='privacy'),
url(r'^%s$' % _('logout/'), app.meta.logout, name='logout'),
url(r'^%s(?P<id>\d+)/%s$' % (_('answers/'), _('edit/')), app.writers.edit_answer, name='edit_answer'),
from itertools import groupby
from django.shortcuts import render_to_response, get_object_or_404
from django.core.urlresolvers import reverse
-from django.template import RequestContext
+from django.template import RequestContext, loader
from django.http import HttpResponseRedirect, HttpResponse
from forum import settings
from forum.forms import FeedbackForm
return render_to_response('faq.html', {'text' : text}, context_instance=RequestContext(request))
+
+def opensearch(request):
+ return render_to_response('opensearch.html', {'settings' : settings}, context_instance=RequestContext(request))
+
+
def feedback(request):
if request.method == "POST":
form = FeedbackForm(request.POST)
if page_title is None:
page_title = _("Questions")
+ keywords = ""
+ if request.GET.get("q"):
+ keywords = request.GET.get("q").strip()
+
answer_count = Answer.objects.filter(deleted=None, parent__in=questions).count()
answer_description = _("answers")
"questions" : questions,
"questions_count" : questions.count(),
"answer_count" : answer_count,
+ "keywords" : keywords,
#"tags_autocomplete" : _get_tags_cache_json(),
"list_description": list_description,
"answer_description": answer_description,
+++ /dev/null
-from forum.settings.base import Setting, SettingSet
-from django.forms.widgets import Textarea
-from forum import settings as django_settings
-
-OPEN_SEARCH_SET = SettingSet('OpenSearch', 'OpenSearch', "Set up the open_search.xml file.", 3000)
-
-OPEN_SEARCH_FILE = Setting('OPEN_SEARCH_FILE',
-("""
-<?xml version="1.0" encoding="UTF-8"?>
- <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
- <ShortName>%s Web Search</ShortName>
- <Description>Use %s to search the Web.</Description>
- <Tags>%s</Tags>
- <Url type="application/rss+xml"
- template="%s/?q={searchTerms}&pw={startPage?}"/>
- </OpenSearchDescription>
-""" % (django_settings.APP_SHORT_NAME, django_settings.APP_URL, django_settings.APP_KEYWORDS, django_settings.APP_URL)),
-OPEN_SEARCH_SET,
-dict(label = "open_search.xml file",
- help_text = "The open_search.xml file.",
- widget=Textarea(attrs={'rows': '20', 'cols' : '70'})))
\ No newline at end of file
+++ /dev/null
-from django.conf.urls.defaults import *
-from django.http import HttpResponse
-import settings
-
-urlpatterns = patterns('',
- (r'^open_search.xml$', lambda r: HttpResponse(settings.OPEN_SEARCH_FILE.value)),
-)