diff options
Diffstat (limited to 'archaeological_context_records')
4 files changed, 155 insertions, 6 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index 41e4a1e20..fce5193d6 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2012 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2010-2013 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -36,16 +36,17 @@ import models from ishtar_common import widgets from ishtar_common.forms import FinalForm, FinalForm, FormSet, \ - formset_factory, get_now, reverse_lazy, get_form_selection + formset_factory, get_now, reverse_lazy, get_form_selection, TableSelect from ishtar_common.forms_common import get_town_field, SourceForm, \ SourceSelect, AuthorFormset -from archaeological_operations.forms import OperationSelect +from archaeological_operations.forms import OperationSelect, ParcelField -class RecordSelect(forms.Form): +class RecordSelect(TableSelect): parcel__town = get_town_field() operation__year = forms.IntegerField(label=_(u"Year")) datings__period = forms.ChoiceField(label=_(u"Period"), choices=[]) unit = forms.ChoiceField(label=_(u"Unit type"), choices=[]) + parcel = ParcelField(label=_("Parcel (section/number)")) def __init__(self, *args, **kwargs): super(RecordSelect, self).__init__(*args, **kwargs) self.fields['datings__period'].choices = Period.get_types() @@ -53,6 +54,13 @@ class RecordSelect(forms.Form): self.fields['unit'].choices = models.Unit.get_types() self.fields['unit'].help_text = models.Unit.get_help() + def get_input_ids(self): + ids = super(RecordSelect, self).get_input_ids() + ids.pop(ids.index('parcel')) + ids.append('parcel_0') + ids.append('parcel_1') + return ids + class RecordFormSelection(forms.Form): form_label = _("Context record search") associated_models = {'pk':models.ContextRecord} diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html new file mode 100644 index 000000000..d8e06f022 --- /dev/null +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -0,0 +1,135 @@ +{% extends "ishtar/sheet.html" %} +{% load i18n %} +{% block content %} +<div class='tool'>{%trans "Export as:"%} <a href='{% url show-file item.pk "odt" %}'>{%trans "OpenOffice.org file"%}</a>, <a href='{% url show-file item.pk "pdf" %}'>{%trans "PDF file"%}</a></div> + +<h3>{% trans "Context Record"%}</h3> + +{% if item.operation.code_patriarche %} +<p><label>{%trans "Complete ID:"%}</label> +{% else %} +<p class='alert'><label>{%trans "Patriarche OA code not yet recorded!"%}</label></p> +<p><label>{%trans "Temporary ID:"%}</label> +{%endif%} +<span class='value'>{{item.full_label}}</span></p> +{%if item.unit %} +<p><label>{% trans "Type:" %}</label> <span class='value'>{{ item.unit }}</span></p> +{%endif%} +<p><label>{% trans "Chronology:" %}</label> <span class='value'>{{ item.datings.all|join:", " }}</span></p> +<p><label>{% trans "Place:" %}</label> <span class='value'>{{ item.parcel.town }}</span></p> +<p><label>{% trans "Parcel:" %}</label> <span class='value'>{{ item.parcel.short_label }}</span></p> + +{% if item.description or item.lenght or item.width or item.depth %} +<h3>{% trans "Description"%}</h3> + +<p><label>{% trans "Description:" %}</label> <span class='value'>{{ item.description }}</span></p> +{% if item.lenght %}<p><label>{% trans "Length (cm):" %}</label> <span class='value'>{{ item.length }}</span></p>{%endif%} +{% if item.width %}<p><label>{% trans "Width (cm):" %}</label> <span class='value'>{{ item.width }}</span></p>{%endif%} +{% if item.depth %}<p><label>{% trans "Depth (cm):" %}</label> <span class='value'>{{ item.depth }}</span></p>{%endif%} +{% endif %} + +{% if item.activity or item.identification or item.interpretation %} +<h3>{% trans "Interpretation"%}</h3> + +{% if item.activity %}<p><label>{% trans "Activity:" %}</label> <span class='value'>{{ item.activity }}</span></p>{%endif%} +{% if item.identification %}<p><label>{% trans "Identification:" %}</label> <span class='value'>{{ item.identification }}</span></p>{%endif%} +{% if item.interpretation %}<p><label>{% trans "Interpretation:" %}</label> <span class='value'>{{ item.interpretation }}</span></p>{%endif%} +{% endif %} + +{% if item.taq or item.taq_estimated or item.tpq or item.tpq_estimated %} +<h3>{% trans "Datations"%}</h3> +{% if item.taq %}<p><label>{% trans "TAQ:" %}</label> <span class='value'>{{ item.taq }}</span></p>{%endif%} +{% if item.taq_estimated %}<p><label>{% trans "TAQ estimated:" %}</label> <span class='value'>{{ item.taq_estimated }}</span></p>{%endif%} +{% if item.tpq %}<p><label>{% trans "TPQ:" %}</label> <span class='value'>{{ item.tpq }}</span></p>{%endif%} +{% if item.tpq_estimated %}<p><label>{% trans "TPQ estimated:" %}</label> <span class='value'>{{ item.tpq_estimated }}</span></p>{%endif%} +{%endif%} + +{% if item.operation %} +<h3>{% trans "Operation resume"%}</h3> +<p><label>{%trans "Year:"%}</label> <span class='value'>{{ item.operation.year }}</span></p> +<p><label>{%trans "Numerical reference:"%}</label> <span class='value'>{{ item.operation.operation_code }}</span></p> +{% if item.operation.code_patriarche %} +<p><label>{%trans "Patriarche OA code:"%}</label> +<span class='value'>{{ item.operation.code_patriarche }}</span></p> +{% else %}<p class='alert'><label>{%trans "Patriarche OA code not yet recorded!"%}</label></p> +{%endif%} +{#<p><label>{%trans "Operation's name:"%}</label><span class='value'>{{ item.operation.internal_reference }}</span></p>#} +<p><label>{%trans "Head scientist:"%}</label> +<span class='value'>{{ item.operation.in_charge.full_label }}</span></p> +<p><label>{%trans "State:"%}</label> +{% if item.operation.is_active %} +<span class='value'>{%trans "Active file"%}</span></p> +{% else %} +<span class='value'>{%trans "Closed operation"%}</span></p> +<p><label>{%trans "Closing date:"%}</label> <span class='value'>{{ item.operation.closing.date }} +<strong>{%trans "by" %}</strong> {{ item.operation.closing.user }}</span></p> +{% endif %} +<p><label>{%trans "Type:"%}</label> <span class='value'>{{ item.operation.operation_type }}</span></p> +<p><label>{%trans "Remains:"%}</label> <span class='value'>{{ item.operation.remains.all|join:", " }}</span></p> +<p><label>{%trans "Periods:"%}</label> <span class='value'>{{ item.operation.periods.all|join:", " }}</span></p> +{% if item.operation.comment %}<p><label>{%trans "Comment:"%}</label> <span class='value'>{{ item.operation.comment }}</span></p>{%endif%} +<h3>{% trans "Localisation"%}</h3> +<p><label>{%trans "Towns:"%}</label> <span class='value'>{{ item.operation.towns.all|join:", " }}</span></p> +<p><label>{%trans "Related operation:"%}</label> +<span class='value'><a href="#" onclick='load_window("{% url show-operation item.operation.pk ''%}");'>{{ item.operation }}</a></span></p> +{# TODO: Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related operation #} +{% else %}<p class='alert'><label>{%trans "No operation linked to this context unit!"%}</label></p> +{% endif %} + +<table> + <caption>{%trans "Documents"%}</caption> + <tr> + <th>{% trans "Title" %}</th> + <th>{% trans "Type" %}</th> + <th>{% trans "Authors" %}</th> + {#<th>{% trans "Localisation" %}</th>#} + </tr> + {% for doc in item.source.all %} + <tr> + <td class='string'>{{ doc.title }}</td> + <td class='string'>{{doc.source_type}}</td> + <td class='string'>{{ doc.authors.all|join:", " }}</td> + {#<td>{{ doc.localisation }}</td>#} + </tr> + {% empty %} + <tr><td colspan="4" class='no_items'>{% trans "No document associated to this context record" %}</td></tr> + {% endfor %} +</table> + +<table> + <caption>{%trans "Finds"%}</caption> + <tr> + <th>{% trans "Find" %}</th> + <th>{% trans "Material type" %}</th> + <th>{% trans "Context record" %}</th> + <th>{% trans "Periods" %}</th> + <th>{% trans "Description" %}</th> + <th>{% trans "Weight" %}</th> + <th>{% trans "Numbers" %}</th> + <th>{% trans "Parcel" %}</th> + <th class='link'> </th> + </tr> + {% for find in item.base_finds.all %} + <tr> + <td>{{ find.full_label }}</td> +{# Displayed as (Patriarche operation code)-(Record unit label)-(Finds label). #} +{# or displayed as (Year)-(index)-(Record unit label)-(Finds label). #} + <td>{{ find.material_type_label }}</td> +{# Displayed as (Patriarche operation code)-(Record unit label)-(material code)-(Finds label indexed by material type). #} +{# or displayed as (Year)-(index)-(Record unit label)-(material code)-(Finds label indexed by material type) #} + + <td class='string'>{{find.context_record}}</td> + <td>{{ find.get_last_find.dating}}</td>{# TODO .all|join:", " ? #} + <td>{{ find.get_last_find.description }}</td> + <td>{{ find.get_last_find.weight }}</td> + <td>{{ find.get_last_find.item_number }}</td> + <td>{{ item.context_record.parcel.short_label }}</td> + <td class='link'><a href="#">{% trans "Details" %}</a></td> + {#<a href="#" onclick='load_window("{% url show-find find.pk%}");'>{%trans "Details"%}</a></td>#} + </tr> + {% empty %} + <tr><td colspan="9" class='no_items'>{% trans "No find associated to this context record" %}</td></tr> + {% endfor %} +</table> + +{% endblock %} diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord_window.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord_window.html new file mode 100644 index 000000000..b485ebd47 --- /dev/null +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord_window.html @@ -0,0 +1,3 @@ +{% extends "ishtar/sheet_contextrecord.html" %} +{% block main_head %}{%endblock%} +{% block main_foot %}{%endblock%} diff --git a/archaeological_context_records/views.py b/archaeological_context_records/views.py index bd18ffa49..c59446bcf 100644 --- a/archaeological_context_records/views.py +++ b/archaeological_context_records/views.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2012 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2010-2013 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -30,7 +30,10 @@ get_contextrecord = get_item(models.ContextRecord, 'get_contextrecord', 'contextrecord', extra_request_keys={'parcel__town':'parcel__town__pk', 'operation__year':'operation__year__contains', - 'datings__period':'datings__period__pk'},) + 'datings__period':'datings__period__pk', + 'parcel_0':'operation__parcels__section', + 'parcel_1':'operation__parcels__parcel_number', + },) get_contextrecordsource = get_item(models.ContextRecordSource, 'get_contextrecordsource', 'contextrecordsource', extra_request_keys={ |
