summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2014-01-09 19:20:45 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2014-01-09 19:20:45 +0100
commitcd50c0849269635f2a20b2bf67750344cee4d5f5 (patch)
treed80aa99af269654bd7b322986ae12142b823f05a
parent15fd7f65784e6f1aec68886e508c1f135d8d8e9f (diff)
downloadIshtar-cd50c0849269635f2a20b2bf67750344cee4d5f5.tar.bz2
Ishtar-cd50c0849269635f2a20b2bf67750344cee4d5f5.zip
Add window for administrativ acts (refs #1587)
-rw-r--r--archaeological_operations/templates/ishtar/sheet_administrativeact.html29
-rw-r--r--archaeological_operations/templates/ishtar/sheet_administrativeact_pdf.html18
-rw-r--r--archaeological_operations/templates/ishtar/sheet_administrativeact_window.html3
-rw-r--r--archaeological_operations/urls.py2
-rw-r--r--archaeological_operations/views.py1
-rw-r--r--ishtar_common/views.py2
6 files changed, 55 insertions, 0 deletions
diff --git a/archaeological_operations/templates/ishtar/sheet_administrativeact.html b/archaeological_operations/templates/ishtar/sheet_administrativeact.html
new file mode 100644
index 000000000..5e80b3f75
--- /dev/null
+++ b/archaeological_operations/templates/ishtar/sheet_administrativeact.html
@@ -0,0 +1,29 @@
+{% extends "ishtar/sheet.html" %}
+{% load i18n %}
+
+{% block head_sheet %}
+{{block.super}}
+<h1>{% trans "Administrative act"%}</h1>
+{% endblock %}
+
+{% block content %}
+<div class='tool'>{%trans "Export as:"%} <a href='{% url show-administrativeact item.pk "odt" %}'>{%trans "OpenOffice.org file"%}</a>, <a href='{% url show-administrativeact item.pk "pdf" %}'>{%trans "PDF file"%}</a></div>
+<h3>{% trans "General"%}</h3>
+<h2>
+<p><label>{%trans "Year:"%}</label> <span class='value'>{{ item.year }}</span>{% if item.numeric_reference %}<label>{%trans " Numerical reference:"%}</label> <span class='value'>{{ item.numeric_reference }}</span></p>{% endif %}
+</h2>
+<p><label>{%trans "Type:"%}</label> <span class='value'>{{ item.act_type }}</span></p>
+<p><label>{%trans "Signature date:"%}</label> <span class='value'>{{ item.signature_date }}</span></p>
+<p><label>{%trans "In charge:"%}</label> <span class='value'>{{ item.in_charge.full_label }}</span></p>
+{% if item.operator %}<p><label>{%trans "Archaeological preventive operator:"%}</label> <span class='value'>{{ item.operator }}</span></p>{% endif %}
+
+{% comment %}<p><label>{%trans "Creation date:"%}</label> <span class='value'>{{ item.creation_date }}</span></p>{% endcomment %}
+{% if item.associated_file %}<p><label>{%trans "Associated file:"%}</label> <span class='value'><a href='#' onclick='load_window("{% url show-file item.associated_file.pk ''%}")'>{{ item.associated_file }}</a></span></p>{% endif %} <!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related file -->
+{% if item.operation %}<p><label>{%trans "Associated operation:"%}</label> <span class='value'><a href='#' onclick='load_window("{% url show-operation item.operation.pk ''%}")'>{{ item.operation }}</a></span></p>{% endif %} <!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related operation -->
+
+{% if item.operation %}{% if item.operation.surface %}<p><label>{%trans "Surface:"%}</label> <span class='value'>{{ item.operation.surface }} m<sup>2</sup> ({{ item.operation.surface_ha }} ha)</span></p>{%endif%} {% endif %}
+{%comment%}{% if item.general_contractor.attached_to %}<p><label>{%trans "General contractor organisation:"%}</label> <span class='value'>{{ item.general_contractor.attached_to }}</span></p>{% endif %} <!-- Contractor's organisation displayed as concat of Name/Adress/postal_code/city -->
+{% if item.general_contractor %}<p><label>{%trans "General contractor:"%}</label> <span class='value'>{{ item.general_contractor.full_label }}</span></p>{% endif %}
+{%endcomment%}
+
+{% endblock %}
diff --git a/archaeological_operations/templates/ishtar/sheet_administrativeact_pdf.html b/archaeological_operations/templates/ishtar/sheet_administrativeact_pdf.html
new file mode 100644
index 000000000..e3c78d733
--- /dev/null
+++ b/archaeological_operations/templates/ishtar/sheet_administrativeact_pdf.html
@@ -0,0 +1,18 @@
+{% extends "ishtar/sheet_administrativeact.html" %}
+{% block header %}
+<link rel="stylesheet" href="{{STATIC_URL}}/media/style_basic.css" />
+{% endblock %}
+{% block main_head %}
+{{ block.super }}
+<div id="pdfheader">
+Ishtar &ndash; {{APP_NAME}} &ndash; {{item}}
+</div>
+{% endblock %}
+{%block head_sheet%}{%endblock%}
+{%block main_foot%}
+<div id="pdffooter">
+&ndash; <pdf:pagenumber/> &ndash;
+</div>
+</body>
+</html>
+{%endblock%}
diff --git a/archaeological_operations/templates/ishtar/sheet_administrativeact_window.html b/archaeological_operations/templates/ishtar/sheet_administrativeact_window.html
new file mode 100644
index 000000000..4ed562ea5
--- /dev/null
+++ b/archaeological_operations/templates/ishtar/sheet_administrativeact_window.html
@@ -0,0 +1,3 @@
+{% extends "ishtar/sheet_administrativeact.html" %}
+{% block main_head %}{%endblock%}
+{% block main_foot %}{%endblock%}
diff --git a/archaeological_operations/urls.py b/archaeological_operations/urls.py
index bd207dd80..26dc5b3d0 100644
--- a/archaeological_operations/urls.py
+++ b/archaeological_operations/urls.py
@@ -81,6 +81,8 @@ urlpatterns += patterns('archaeological_operations.views',
url(r'get-administrativeact-full/(?P<type>.+)?$',
'get_administrativeact', name='get-administrativeact-full',
kwargs={'full':True}),
+ url(r'show-administrativeact(?:/(?P<pk>.+))?/(?P<type>.+)?$',
+ 'show_administrativeact', name='show-administrativeact'),
url(r'generatedoc-administrativeactop/(?P<pk>.+)?/(?P<template_pk>.+)?$',
'generatedoc_administrativeactop',
name='generatedoc-administrativeactop'),
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py
index 714fd62e4..7e5a64ab4 100644
--- a/archaeological_operations/views.py
+++ b/archaeological_operations/views.py
@@ -154,6 +154,7 @@ get_administrativeactop = get_item(models.AdministrativeAct,
get_administrativeact = get_item(models.AdministrativeAct,
'get_administrativeact', 'administrativeact',
extra_request_keys={})
+show_administrativeact = show_item(models.AdministrativeAct, 'administrativeact')
def dashboard_operation(request, *args, **kwargs):
"""
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index 3e0bffd32..7963dc46a 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -385,6 +385,8 @@ def get_item(model, func_name, default_name, extra_request_keys=[],
lnk = link_template % reverse('show-'+default_name,
args=[data[0], ''])
except NoReverseMatch:
+ print '"show-' + default_name + "\" args (" + \
+ unicode(data[0]) + ") url not available"
lnk = ''
res = {'id':data[0], 'link':lnk}
for idx, value in enumerate(data[1:]):