diff --git a/euscanwww/djeuscan/models.py b/euscanwww/djeuscan/models.py
index 0c38909..6626a41 100644
--- a/euscanwww/djeuscan/models.py
+++ b/euscanwww/djeuscan/models.py
@@ -1,3 +1,5 @@
+import json
+
from django.db import models
from django.core.validators import RegexValidator, validate_email, URLValidator
from django.core.exceptions import ValidationError
@@ -215,6 +217,14 @@ class EuscanResult(models.Model):
self.full_clean()
super(EuscanResult, self).save(*args, **kwargs)
+ def messages(self):
+ result = json.loads(self.result)
+
+ if result and self.package.cp() in result:
+ return result[self.package.cp()]['messages']
+ else:
+ return ""
+
def __unicode__(self):
return '[%s] %s/%s' % (
self.datetime, self.package.category, self.package.name
diff --git a/euscanwww/djeuscan/templates/euscan/_package_details.html b/euscanwww/djeuscan/templates/euscan/_package_details.html
new file mode 100644
index 0000000..1e04911
--- /dev/null
+++ b/euscanwww/djeuscan/templates/euscan/_package_details.html
@@ -0,0 +1,122 @@
+{% load djeuscan_helpers %}
+{% load url from future %}
+
+
+ {% if package.description %}
+ - Description
+ - {{ package.description }}
+ {% endif %}
+ {% if package.homepage %}
+ - Homepage
+ -
+ {% for homepage in package.homepages %}
+ {{ homepage }}
+ {% endfor %}
+
+ {% endif %}
+ {% if package.herds.all %}
+ - Herds
+ -
+ {% for herd in package.herds.all %}
+
+ {{ herd.herd }}
+
+ <{{ herd.email }}>
+ {% endfor %}
+
+ {% endif %}
+ {% if package.maintainers.all %}
+ - Maintainers
+ -
+ {% for maintainer in package.maintainers.all %}
+ {% if maintainer.name != maintainer.email %}
+
+ {{ maintainer.name }}
+
+ <{{ maintainer.email }}>
+ {% else %}
+
+ {{ maintainer.email }}
+
+ {% endif %}
+ {% endfor %}
+
+ {% endif %}
+ {% if packaged %}
+ - Packaged Versions
+ -
+
+ {% for version in packaged %}
+ -
+ {% if version.overlay == "gentoo" %}
+
+ {% else %}
+
+ {% endif %}
+
+ {% if version.vtype and not version.vtype|is_stable %}
+
+ {% endif %}
+
+ {{ version.version }}-{{ version.revision }} :{{ version.slot }} [{{ version.overlay }}]
+
+ {% endfor %}
+
+
+ {% endif %}
+ {% if upstream %}
+ - Upstream versions
+ -
+
+ {% for version in upstream %}
+ -
+
+
+ {% if version.vtype and not version.vtype|is_stable %}
+
+ {% endif %}
+
+ {{ version.version }} - {{ version.urls }}
+ {% if confidence < 100 %}({{ version.confidence }}%){% endif %}
+
+ {% endfor %}
+
+
+ {% endif %}
+ {% if vlog %}
+ - Version history
+ -
+
+ {% for version in vlog %}
+ {% if version.action == version.VERSION_ADDED %}
+ -
+ {% else %}
+
-
+ {% endif %}
+ {% if version.overlay == "gentoo" %}
+
+ {% elif version.overlay %}
+
+ {% else %}
+
+ {% endif %}
+
+ {% if version.vtype and not version.vtype|is_stable %}
+
+ {% endif %}
+
+ {{ version }} - {{ version.datetime }}
+
+
+ {% endfor %}
+
+
+ {% endif %}
+ {% if log %}
+ - euscan log
+ -
+
Date: {{ log.datetime }}
+
{{ msg|ansi_to_html|safe }}
+
+ {% endif %}
+
diff --git a/euscanwww/djeuscan/templates/euscan/package.html b/euscanwww/djeuscan/templates/euscan/package.html
index 2357318..8c90efe 100644
--- a/euscanwww/djeuscan/templates/euscan/package.html
+++ b/euscanwww/djeuscan/templates/euscan/package.html
@@ -1,7 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load sub %}
-{% load djeuscan_helpers %}
{% load url from future %}
{% block meta %}
@@ -26,12 +25,6 @@
{% block content %}
-{% if thanks_for_reporting %}
-
- Thanks! Your report has been sent to admins
-
-{% endif %}
-
A refresh request is in progress, please wait...
@@ -56,158 +49,18 @@
{% endif %}
-
- {% if package.description %}
- - Description
- - {{ package.description }}
- {% endif %}
- {% if package.homepage %}
- - Homepage
- -
- {% for homepage in package.homepages %}
- {{ homepage }}
- {% endfor %}
-
- {% endif %}
- {% if package.herds.all %}
- - Herds
- -
- {% for herd in package.herds.all %}
-
- {{ herd.herd }}
-
- <{{ herd.email }}>
- {% endfor %}
-
- {% endif %}
- {% if package.maintainers.all %}
- - Maintainers
- -
- {% for maintainer in package.maintainers.all %}
- {% if maintainer.name != maintainer.email %}
-
- {{ maintainer.name }}
-
- <{{ maintainer.email }}>
- {% else %}
-
- {{ maintainer.email }}
-
- {% endif %}
- {% endfor %}
-
- {% endif %}
- {% if packaged %}
- - Packaged Versions
- -
-
- {% for version in packaged %}
- -
- {% if version.overlay == "gentoo" %}
-
- {% else %}
-
- {% endif %}
- {% if version.vtype and not version.vtype|is_stable %}
-
- {% endif %}
-
- {{ version.version }}-{{ version.revision }} :{{ version.slot }} [{{ version.overlay }}]
-
- {% endfor %}
-
-
- {% endif %}
- {% if upstream %}
- - Upstream versions
- -
-
- {% for version in upstream %}
- -
-
-
- {% if version.vtype and not version.vtype|is_stable %}
-
- {% endif %}
-
- {{ version.version }} - {{ version.urls }}
- {% if confidence < 100 %}({{ version.confidence }}%){% endif %}
-
- {% endfor %}
-
-
- {% endif %}
- - Version history
- -
-
- {% for version in vlog %}
- {% if version.action == version.VERSION_ADDED %}
- -
- {% else %}
-
-
- {% endif %}
- {% if version.overlay == "gentoo" %}
-
- {% elif version.overlay %}
-
- {% else %}
-
- {% endif %}
-
- {% if version.vtype and not version.vtype|is_stable %}
-
- {% endif %}
-
- {{ version }} - {{ version.datetime }}
-
-
- {% endfor %}
-
-
- {% if log %}
- - euscan log
- -
-
Date: {{ log.datetime }}
-
{{ msg|ansi_to_html|safe }}
-
- {% endif %}
-
+{% include "euscan/_package_details.html" %}
-Report problems
-
+{% if user.is_authenticated %}
+
+{% endif %}
diff --git a/euscanwww/djeuscan/templates/euscan/problem.html b/euscanwww/djeuscan/templates/euscan/problem.html
new file mode 100644
index 0000000..828b7ab
--- /dev/null
+++ b/euscanwww/djeuscan/templates/euscan/problem.html
@@ -0,0 +1,57 @@
+{% extends "euscan/_datatable.html" %}
+
+{% load sub %}
+{% load djeuscan_helpers %}
+{% load url from future %}
+
+{% block title %}
+{{ block.super }} - Report Problem: {{ package.category }}/{{ package.name }}
+{% endblock %}
+
+{% block content %}
+
+{% if thanks_for_reporting %}
+
+ Thanks! Your report has been sent to admins
+
+{% endif %}
+
+
+ Report Problem: {{ package.category }}/{{ package.name }}
+
+
+{% include "euscan/_package_details.html" %}
+
+
+
+{% endblock %}
diff --git a/euscanwww/djeuscan/urls.py b/euscanwww/djeuscan/urls.py
index e4611d7..b1b1f88 100644
--- a/euscanwww/djeuscan/urls.py
+++ b/euscanwww/djeuscan/urls.py
@@ -22,6 +22,8 @@ package_patterns = patterns('djeuscan.views',
'unfavourite/$'), 'unfavourite_package', name="unfavourite_package"),
url((r'^(?P[\w+][\w+.-]*)/(?P[\w+][\w+.-]*)/'
'refresh$'), "refresh_package", name="refresh_package"),
+ url(r'^(?P[\w+][\w+.-]*)/(?P[\w+][\w+.-]*)/problem$',
+ 'problem', name="problem"),
)
categories_patterns = patterns('djeuscan.views',
diff --git a/euscanwww/djeuscan/views.py b/euscanwww/djeuscan/views.py
index 3d96cb0..c9abfca 100644
--- a/euscanwww/djeuscan/views.py
+++ b/euscanwww/djeuscan/views.py
@@ -1,7 +1,6 @@
""" Views """
import inspect
-import json
from annoying.decorators import render_to, ajax_request
from django.http import Http404
@@ -188,7 +187,6 @@ def overlay(request, overlay):
return {'overlay': overlay, 'packages': packages, 'last_scan': last_scan,
'favourited': favourited}
-
@render_to('euscan/package.html')
def package(request, category, package):
package = get_object_or_404(Package, category=category, name=package)
@@ -203,13 +201,6 @@ def package(request, category, package):
log = log[0] if log else None
vlog = VersionLog.objects.for_package(package, order=True)
- result = json.loads(log.result) if log else None
-
- if result and package.cp() in result:
- msg = result[package.cp()]['messages']
- else:
- msg = ""
-
try:
last_scan = EuscanResult.objects.for_package(package).latest().datetime
except EuscanResult.DoesNotExist:
@@ -230,42 +221,62 @@ def package(request, category, package):
except RefreshPackageQuery.DoesNotExist:
refreshed = False
- thanks_for_reporting = False
- if request.method == "POST":
- problem_form = ProblemReportForm(package, request.POST)
- if problem_form.is_valid():
- ProblemReport(
- package=package,
- version=problem_form.cleaned_data["version"],
- subject=problem_form.cleaned_data["subject"],
- message=problem_form.cleaned_data["message"],
- ).save()
- thanks_for_reporting = True
- else:
- problem_form = ProblemReportForm(package)
-
return {
'package': package,
'packaged': packaged,
'upstream': upstream,
- 'log': log,
+ 'log': log.messages(),
'vlog': vlog,
- 'msg': msg,
+ 'msg' : log.messages() if log else "",
'last_scan': last_scan,
'favourited': favourited,
'refreshed': refreshed,
- 'problem_form': problem_form,
- 'thanks_for_reporting': thanks_for_reporting
}
+@login_required
+@render_to('euscan/problem.html')
+def problem(request, category, package):
+ package = get_object_or_404(Package, category=category, name=package)
+ packaged = Version.objects.filter(package=package, packaged=True)
+ upstream = Version.objects.filter(package=package, packaged=False)
+
+ log = EuscanResult.objects.filter(package=package).\
+ order_by('-datetime')[:1]
+ log = log[0] if log else None
+
+ thanks_for_reporting = False
+
+ if request.method == "POST":
+ form = ProblemReportForm(package, request.POST)
+ if form.is_valid():
+ ProblemReport(
+ package=package,
+ version=form.cleaned_data["version"],
+ subject=form.cleaned_data["subject"],
+ message=form.cleaned_data["message"],
+ ).save()
+ thanks_for_reporting = True
+ else:
+ form = ProblemReportForm(package)
+
+ return {
+ 'form': form,
+ 'thanks_for_reporting': thanks_for_reporting,
+ 'package': package,
+ 'packaged': packaged,
+ 'upstream': upstream,
+ 'msg' : log.messages() if log else "",
+ }
@render_to('euscan/world.html')
def world(request):
world_form = WorldForm()
packages_form = PackagesForm()
- return {'world_form': world_form,
- 'packages_form': packages_form}
+ return {
+ 'world_form': world_form,
+ 'packages_form': packages_form
+ }
@render_to('euscan/world_scan.html')
diff --git a/euscanwww/htdocs/img/bug.png b/euscanwww/htdocs/img/bug.png
new file mode 100644
index 0000000..c33bfb9
Binary files /dev/null and b/euscanwww/htdocs/img/bug.png differ