diff options
-rw-r--r-- | packages/views.py | 65 | ||||
-rw-r--r-- | templates/packages/flag.html | 31 | ||||
-rw-r--r-- | templates/packages/flagged.html | 7 | ||||
-rw-r--r-- | templates/packages/flaghelp.html | 16 | ||||
-rw-r--r-- | templates/packages/outofdate.txt | 17 | ||||
-rw-r--r-- | urls.py | 8 |
6 files changed, 144 insertions, 0 deletions
diff --git a/packages/views.py b/packages/views.py index a839ca6b..451b2bc5 100644 --- a/packages/views.py +++ b/packages/views.py @@ -56,6 +56,14 @@ def details(request, name='', repo='', arch=''): return HttpResponseRedirect("/packages/?arch=%s&repo=%s&q=%s" % ( arch.lower(), repo.title(), name)) +def getmaintainer(request, name, repo, arch): + "Returns the maintainer as a plaintext." + + pkg= get_object_or_404(Package, + pkgname=name, repo__name__iexact=repo, arch__name=arch) + + return HttpResponse(str(pkg.maintainer if pkg.maintainer_id else 'None')) + class PackageSearchForm(forms.Form): repo = forms.ChoiceField(required=False) arch = forms.ChoiceField(required=False) @@ -197,6 +205,63 @@ def signoff_package(request, arch, pkgname): return signoffs(request) +def flaghelp(request): + return render_to_response('packages/flaghelp.html') + +class FlagForm(forms.Form): + email = forms.EmailField(label='* E-mail Address') + usermessage = forms.CharField(label='Message To Dev', + widget=forms.Textarea, required=False) + # The field below is used to filter out bots that blindly fill out all input elements + website = forms.CharField(label='', + widget=forms.TextInput(attrs={'style': 'display:none;'}), + required=False) + +def flag(request, pkgid): + pkg = get_object_or_404(Package, id=pkgid) + context = {'pkg': pkg} + if pkg.needupdate == 1: + # already flagged. do nothing. + return render_to_response('packages/flagged.html', context) + + if request.POST: + form = FlagForm(request.POST) + if form.is_valid() and form.cleaned_data['website'] == '': + # flag all architectures + pkgs = Package.objects.filter( + pkgname=pkg.pkgname, repo=pkg.repo) + for package in pkgs: + package.needupdate = 1 + package.save() + + if pkg.maintainer_id == 0: + toemail = 'arch-notifications@archlinux.org' + subject = 'Orphan %s package [%s] marked out-of-date' % (pkg.repo.name, pkg.pkgname) + else: + toemail = pkg.maintainer.email + subject = '%s package [%s] marked out-of-date' % (pkg.repo.name, pkg.pkgname) + + # send notification email to the maintainer + t = loader.get_template('packages/outofdate.txt') + c = Context({ + 'email': form.cleaned_data['email'], + 'message': form.cleaned_data['usermessage'], + 'pkg': pkg, + 'weburl': 'http://www.archlinux.org'+ pkg.get_absolute_url() + }) + send_mail(subject, + t.render(c), + 'Arch Website Notification <nobody@archlinux.org>', + [toemail], + fail_silently=True) + context['confirmed'] = True + else: + form = FlagForm() + + context['form'] = form + + return render_to_response('packages/flag.html', context) + # vim: set ts=4 sw=4 et: diff --git a/templates/packages/flag.html b/templates/packages/flag.html new file mode 100644 index 00000000..ffcfcbb4 --- /dev/null +++ b/templates/packages/flag.html @@ -0,0 +1,31 @@ +{% extends "base.html" %} +{% block title %}Arch Linux - Flag Package - {{ pkg.pkgname }}{% endblock %} +{% block content %} + {% if confirmed %} + Thank you. Maintainers have been notified. + {% else %} + <span style="font-family: verdana, arial, helvetica"> + If you notice that one of Arch's packages is out of date (ie, there is a + newer <b>stable</b> release available), then please notify us using the + form below. + <br><br> + The message box portion of the flag utility is optional, and meant for short messages only. If you need more than 200 characters for your message, then file a bug report, email the maintainer directly, or send an email to the arch-general mailing list with your additional text. + <br><br> + <b>Note:</b> Please do <i>not</i> use this facility if the package is + broken! Use the <a target="_blank" + href='http://bugs.archlinux.org'>bug tracker</a> instead. + </span> + <br /><br /> + <p> + Please confirm your flag request for {{pkg.pkgname}}: + </p> + <form method="post" action="."> + <table> + {{form}} + </table> + <input type="submit" value=" Confirm " /> + <br /> + </form> + {% endif %} +{% endblock %} + diff --git a/templates/packages/flagged.html b/templates/packages/flagged.html new file mode 100644 index 00000000..738b633f --- /dev/null +++ b/templates/packages/flagged.html @@ -0,0 +1,7 @@ +{% extends "base.html" %} +{% block title %}Arch Linux - Flag Package - {{ pkg.pkgname }}{% endblock %} +{% block content %} + <p> + {{pkg.pkgname}} on {{pkg.arch}} has already been flagged out of date. + </p> +{% endblock %} diff --git a/templates/packages/flaghelp.html b/templates/packages/flaghelp.html new file mode 100644 index 00000000..aa03bf63 --- /dev/null +++ b/templates/packages/flaghelp.html @@ -0,0 +1,16 @@ +<html> +<head><title>Flagging Packages</title></head> +<body> +<span style="font-family: verdana, arial, helvetica"> +If you notice that one of Arch's packages is out of date (ie, there is a newer +<b>stable</b> release available), then please notify us by using the <b>Flag</b> +button in the <i>Package Details</i> screen. This will notify the maintainer +responsible for that package so they can update it. +<br><br> +The message box portion of the flag utility is optional, and meant for short messages only. If you need more than 200 characters for your message, then file a bug report, email the maintainer directly, or send an email to the arch-general mailing list with your additional text. +<br><br> +<b>Note:</b> Please do <i>not</i> use this facility if the package is broken! +Use the <a target="_blank" href='http://bugs.archlinux.org'>bugtracker</a> instead. +</span> +</body> +</html> diff --git a/templates/packages/outofdate.txt b/templates/packages/outofdate.txt new file mode 100644 index 00000000..abe3a738 --- /dev/null +++ b/templates/packages/outofdate.txt @@ -0,0 +1,17 @@ + +* Note: this is an automated message + +{{ email }} wants to notify you that the following package may be out +of date: + + Package Name: {{ pkg.pkgname }} + Architecture: {{ pkg.arch.name }} + Repository: {{ pkg.repo.name }} + ({{ weburl }}) + +{% if message %} +The user provided the following additional text: + +{{ message }} +{% endif %} + @@ -24,6 +24,8 @@ sitemaps = { admin.autodiscover() urlpatterns = patterns('', + (r'^packages/flag/(\d+)/$', 'archweb.packages.views.flag'), + (r'^packages/flaghelp/$', 'archweb.packages.views.flaghelp'), (r'^packages/unflag/(\d+)/$', 'archweb.packages.views.unflag'), (r'^packages/files/(\d+)/$', 'archweb.packages.views.files'), (r'^packages/signoffs/$', 'archweb.packages.views.signoffs'), @@ -31,6 +33,10 @@ urlpatterns = patterns('', 'archweb.packages.views.signoff_package'), (r'^packages/update/$', 'archweb.packages.views.update'), + # Preference is for the packages/ url below, but search is kept + # because other projects link to it + (r'^packages/search/$', 'archweb.packages.views.search'), + (r'^packages/search/(?P<page>\d+)/$', 'archweb.packages.views.search'), (r'^packages/$', 'archweb.packages.views.search'), (r'^packages/(?P<page>\d+)/$', 'archweb.packages.views.search'), @@ -40,6 +46,8 @@ urlpatterns = patterns('', 'archweb.packages.views.details'), (r'^packages/(?P<repo>[A-z0-9\-]+)/(?P<arch>[A-z0-9]+)/(?P<name>[A-z0-9\-+.]+)/$', 'archweb.packages.views.details'), + (r'^packages/(?P<repo>[A-z0-9\-]+)/(?P<arch>[A-z0-9]+)/(?P<name>[A-z0-9\-+.]+)/maintainer/$', + 'archweb.packages.views.getmaintainer'), (r'^todo/(\d+)/$', 'archweb.todolists.views.view'), (r'^todo/add/$', 'archweb.todolists.views.add'), |