From c693630090f670ca33981dcdf0b135fdd7432972 Mon Sep 17 00:00:00 2001
From: Étienne Loks
Date: Thu, 4 Apr 2013 12:48:06 +0200
Subject: Operations: search operations by dates (refs #1187)
---
ishtar_common/views.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
(limited to 'ishtar_common/views.py')
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index 4a1a656d9..83833e517 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -173,7 +173,7 @@ HIERARCHIC_LEVELS = 5
HIERARCHIC_FIELDS = ['period', 'unit', 'material_type']
PRIVATE_FIELDS = ('id', 'history_modifier', 'order')
def get_item(model, func_name, default_name, extra_request_keys=[],
- base_request={}, bool_fields=[]):
+ base_request={}, bool_fields=[], dated_fields=[]):
"""
Generic treatment of tables
"""
@@ -213,7 +213,18 @@ def get_item(model, func_name, default_name, extra_request_keys=[],
dct.pop(k)
else:
dct[k] = dct[k] == u"2" and True or False
-
+ for k in dated_fields:
+ if k in dct:
+ if not dct[k]:
+ dct.pop(k)
+ try:
+ items = dct[k].split('/')
+ assert len(items) == 3
+ dct[k] = datetime.date(*map(lambda x: int(x),
+ reversed(items))
+ ).strftime('%Y-%m-%d')
+ except AssertionError:
+ dct.pop(k)
# manage hierarchic conditions
or_reqs = []
for req in dct.copy():
--
cgit v1.2.3
From 157259f4a9a030367f123ae1b2802c529b151197 Mon Sep 17 00:00:00 2001
From: Étienne Loks
Date: Thu, 4 Apr 2013 14:58:05 +0200
Subject: Forms (operations, context records, files): add search by parcel
(refs #575)
---
archaeological_context_records/forms.py | 16 +++++++++---
archaeological_context_records/views.py | 7 ++++--
archaeological_files/forms.py | 17 ++++++++++---
archaeological_files/views.py | 8 ++++--
archaeological_finds/forms.py | 4 +--
archaeological_operations/forms.py | 24 +++++++++++++++---
archaeological_operations/views.py | 14 ++++++++++-
archaeological_operations/widgets.py | 43 +++++++++++++++++++++++++++++++++
archaeological_warehouse/forms.py | 5 ++--
ishtar_common/forms.py | 6 ++++-
ishtar_common/forms_common.py | 4 +--
ishtar_common/static/media/style.css | 3 +++
ishtar_common/views.py | 2 +-
ishtar_common/widgets.py | 6 ++---
14 files changed, 132 insertions(+), 27 deletions(-)
create mode 100644 archaeological_operations/widgets.py
(limited to 'ishtar_common/views.py')
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
+# Copyright (C) 2010-2013 Étienne Loks
# 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/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
+# Copyright (C) 2010-2013 Étienne Loks
# 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={
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py
index 564d0c6fc..ea12c984c 100644
--- a/archaeological_files/forms.py
+++ b/archaeological_files/forms.py
@@ -36,13 +36,14 @@ from ishtar_common.models import Person, PersonType, Town, Organization, \
from archaeological_operations.models import ActType, AdministrativeAct
import models
from ishtar_common.forms import FinalForm, FormSet, ClosingDateFormSelection, \
- formset_factory, get_now, reverse_lazy
+ formset_factory, get_now, reverse_lazy, TableSelect
from ishtar_common.forms_common import get_town_field, get_person_field
from archaeological_operations.forms import AdministrativeActOpeForm, \
- AdministrativeActOpeFormSelection, FinalAdministrativeActDeleteForm
+ AdministrativeActOpeFormSelection, FinalAdministrativeActDeleteForm, \
+ ParcelField
from ishtar_common import widgets
-class FileSelect(forms.Form):
+class FileSelect(TableSelect):
towns = get_town_field()
in_charge = get_person_field(label=_(u"Person in charge"),
person_type='sra_agent')
@@ -50,12 +51,20 @@ class FileSelect(forms.Form):
choices=models.FileType.get_types())
saisine_type = forms.ChoiceField(label=_("Saisine type"), choices=[])
year = forms.IntegerField(label=_("Year"))
+ parcel = ParcelField(label=_("Parcel (section/number)"))
def __init__(self, *args, **kwargs):
super(FileSelect, self).__init__(*args, **kwargs)
self.fields['saisine_type'].choices = models.SaisineType.get_types()
self.fields['saisine_type'].help_text = models.SaisineType.get_help()
+ def get_input_ids(self):
+ ids = super(FileSelect, self).get_input_ids()
+ ids.pop(ids.index('parcel'))
+ ids.append('parcel_0')
+ ids.append('parcel_1')
+ return ids
+
class FileFormSelection(forms.Form):
form_label = _("Archaeological file search")
associated_models = {'pk':models.File}
@@ -170,7 +179,7 @@ class FinalFileDeleteForm(FinalForm):
confirm_msg = " "
confirm_end_msg = _(u"Would you like to delete this archaelogical file ?")
-class AdministrativeActFileSelect(forms.Form):
+class AdministrativeActFileSelect(TableSelect):
associated_file__towns = get_town_field()
act_type = forms.ChoiceField(label=_("Act type"), choices=[])
diff --git a/archaeological_files/views.py b/archaeological_files/views.py
index 3ef8c0f28..2b5003911 100644
--- a/archaeological_files/views.py
+++ b/archaeological_files/views.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2010-2012 Étienne Loks
+# Copyright (C) 2010-2013 Étienne Loks
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -60,7 +60,11 @@ def autocomplete_file(request):
for file in files])
return HttpResponse(data, mimetype='text/plain')
-get_file = get_item(models.File, 'get_file', 'file')
+get_file = get_item(models.File, 'get_file', 'file',
+ extra_request_keys={'parcel_0':'operations__parcels__section',
+ 'parcel_1':'operations__parcels__parcel_number',
+ },
+ )
show_file = show_item(models.File, 'file')
revert_file = revert_item(models.File)
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index c5480d8a8..feaad0e23 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -39,7 +39,7 @@ import models
from ishtar_common import widgets
from ishtar_common.forms import FinalForm, FormSet, FloatField, \
- formset_factory, get_now, get_form_selection, reverse_lazy
+ formset_factory, get_now, get_form_selection, reverse_lazy, TableSelect
from ishtar_common.forms_common import get_town_field, \
SourceForm, SourceSelect, SourceDeletionForm, AuthorFormset
from archaeological_context_records.forms import RecordFormSelection
@@ -81,7 +81,7 @@ class DateForm(forms.Form):
self.fields['dating__dating_type'].choices = DatingType.get_types()
self.fields['dating__dating_type'].help_text = DatingType.get_help()
-class FindSelect(forms.Form):
+class FindSelect(TableSelect):
base_finds__context_record__parcel__town = get_town_field()
base_finds__context_record__operation__year = forms.IntegerField(
label=_(u"Year"))
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index 5501857ba..547daf828 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -35,13 +35,23 @@ from django.utils.translation import ugettext_lazy as _
from ishtar_common.models import valid_id, PersonType, Person, Town
from archaeological_files.models import File
import models
+from widgets import ParcelWidget
from ishtar_common import widgets
from ishtar_common.forms import FinalForm, FormSet, ClosingDateFormSelection, \
- 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 TownForm, TownFormSet, TownFormset, \
AuthorFormset, SourceForm, SourceSelect, \
SourceDeletionForm, get_town_field
+class ParcelField(forms.MultiValueField):
+ def __init__(self, *args, **kwargs):
+ if 'widget' not in kwargs:
+ self.widget = ParcelWidget()
+ return super(ParcelField, self).__init__(*args, **kwargs)
+
+ def compress(data_list):
+ return u"-".join(data_list)
+
class ParcelForm(forms.Form):
form_label = _("Parcels")
base_model = 'parcel'
@@ -93,7 +103,7 @@ ParcelFormSet = formset_factory(ParcelForm, can_delete=True,
formset=ParcelFormSet)
ParcelFormSet.form_label = _(u"Parcels")
-class OperationSelect(forms.Form):
+class OperationSelect(TableSelect):
common_name = forms.CharField(label=_(u"Name"), max_length=30)
if settings.COUNTRY == 'fr':
code_patriarche = forms.IntegerField(
@@ -120,6 +130,7 @@ class OperationSelect(forms.Form):
widget=widgets.JQueryDate)
end_after = forms.DateField(label=_(u"Ended after"),
widget=widgets.JQueryDate)
+ parcel = ParcelField(label=_("Parcel (section/number)"))
end_date = forms.NullBooleanField(label=_(u"Is open?"))
def __init__(self, *args, **kwargs):
@@ -127,6 +138,13 @@ class OperationSelect(forms.Form):
self.fields['operation_type'].choices = models.OperationType.get_types()
self.fields['operation_type'].help_text = models.OperationType.get_help()
+ def get_input_ids(self):
+ ids = super(OperationSelect, self).get_input_ids()
+ ids.pop(ids.index('parcel'))
+ ids.append('parcel_0')
+ ids.append('parcel_1')
+ return ids
+
class OperationFormSelection(forms.Form):
form_label = _(u"Operation search")
associated_models = {'pk':models.Operation}
@@ -425,7 +443,7 @@ OperationSourceFormSelection = get_form_selection(
# Administrative act management for operations #
################################################
-class AdministrativeActOpeSelect(forms.Form):
+class AdministrativeActOpeSelect(TableSelect):
operation__towns = get_town_field()
act_type = forms.ChoiceField(label=_("Act type"), choices=[])
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py
index 4650e4764..84f208bf3 100644
--- a/archaeological_operations/views.py
+++ b/archaeological_operations/views.py
@@ -92,6 +92,14 @@ def get_available_operation_code(request, year=None):
data = json.dumps({'id':models.Operation.get_available_operation_code(year)})
return HttpResponse(data, mimetype='text/plain')
+def get_parcel_parser(key_section, key_number):
+ def func(dct):
+ print dct
+ section, number = dct.get(key_section), dct.get(key_number)
+ if not section or not number:
+ return {}
+ return {key_section:section, key_number:number}
+
get_operation = get_item(models.Operation, 'get_operation', 'operation',
bool_fields = ['end_date__isnull'],
dated_fields = ['start_date__lte', 'start_date__gte',
@@ -102,7 +110,11 @@ get_operation = get_item(models.Operation, 'get_operation', 'operation',
'start_before':'start_date__lte',
'start_after':'start_date__gte',
'end_before':'excavation_end_date__lte',
- 'end_after':'excavation_end_date__gte',})
+ 'end_after':'excavation_end_date__gte',
+ 'parcel_0':'parcels__section',
+ 'parcel_1':'parcels__parcel_number',
+ },
+ )
show_operation = show_item(models.Operation, 'operation')
revert_operation = revert_item(models.Operation)
diff --git a/archaeological_operations/widgets.py b/archaeological_operations/widgets.py
new file mode 100644
index 000000000..0e84b2047
--- /dev/null
+++ b/archaeological_operations/widgets.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2013 Étienne Loks
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+
+# See the file COPYING for details.
+
+from django import forms
+from django.forms import widgets
+
+class ParcelWidget(widgets.MultiWidget):
+ def __init__(self, attrs=None):
+ if not attrs:
+ attrs = {'class':'widget-parcel'}
+ elif 'class' not in attrs:
+ attrs['class'] = 'widget-parcel'
+ else:
+ attrs['class'] += ' widget-parcel'
+ _widgets = (
+ widgets.TextInput(attrs=attrs),
+ widgets.TextInput(attrs=attrs),
+ )
+ super(ParcelWidget, self).__init__(_widgets, attrs)
+
+ def decompress(self, value):
+ if value:
+ return value
+ return [None, None]
+
+ def format_output(self, rendered_widgets):
+ return u' / '.join(rendered_widgets)
diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py
index 2e1bfcc05..69bb2cae3 100644
--- a/archaeological_warehouse/forms.py
+++ b/archaeological_warehouse/forms.py
@@ -27,7 +27,8 @@ from ishtar_common.models import Person, valid_id
from archaeological_finds.models import TreatmentType
import models
from ishtar_common import widgets
-from ishtar_common.forms import name_validator, reverse_lazy, get_form_selection
+from ishtar_common.forms import name_validator, reverse_lazy, \
+ get_form_selection, TableSelect
from archaeological_finds.forms import FindMultipleFormSelection
def get_warehouse_field(label=_(u"Warehouse"), required=True):
@@ -109,7 +110,7 @@ class ContainerForm(forms.Form):
new_item.save()
return new_item
-class ContainerSelect(forms.Form):
+class ContainerSelect(TableSelect):
location = get_warehouse_field()
container_type = forms.ChoiceField(label=_(u"Container type"), choices=[])
reference = forms.CharField(label=_(u"Reference"))
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py
index d66d6d4cc..cb007442e 100644
--- a/ishtar_common/forms.py
+++ b/ishtar_common/forms.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2010-2011 Étienne Loks
+# Copyright (C) 2010-2013 Étienne Loks
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -101,6 +101,10 @@ class FormSet(BaseFormSet):
form.fields[DELETION_FIELD_NAME].label = ''
form.fields[DELETION_FIELD_NAME].widget = widgets.DeleteWidget()
+class TableSelect(forms.Form):
+ def get_input_ids(self):
+ return self.fields.keys()
+
def get_now():
format = formats.get_format('DATE_INPUT_FORMATS')[0]
value = datetime.datetime.now().strftime(format)
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index 34a930e36..52fcfc97a 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -37,7 +37,7 @@ from django.utils.translation import ugettext_lazy as _
import models
import widgets
-from forms import FinalForm, FormSet, reverse_lazy, name_validator
+from forms import FinalForm, FormSet, reverse_lazy, name_validator, TableSelect
def get_town_field(label=_(u"Town"), required=True):
help_text = _(u"Type name, department code and/or postal code of the "
@@ -234,7 +234,7 @@ class SourceForm(forms.Form):
super(SourceForm, self).__init__(*args, **kwargs)
self.fields['source_type'].choices = models.SourceType.get_types()
-class SourceSelect(forms.Form):
+class SourceSelect(TableSelect):
authors = forms.IntegerField(
widget=widgets.JQueryAutoComplete("/" + settings.URL_PATH + \
'autocomplete-author', associated_model=models.Author),
diff --git a/ishtar_common/static/media/style.css b/ishtar_common/static/media/style.css
index 2aa673b51..cad9a224a 100644
--- a/ishtar_common/static/media/style.css
+++ b/ishtar_common/static/media/style.css
@@ -528,3 +528,6 @@ a.remove{
border:1px solid;
}
+.widget-parcel{
+ width:60px;
+}
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index 83833e517..54523996f 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -173,7 +173,7 @@ HIERARCHIC_LEVELS = 5
HIERARCHIC_FIELDS = ['period', 'unit', 'material_type']
PRIVATE_FIELDS = ('id', 'history_modifier', 'order')
def get_item(model, func_name, default_name, extra_request_keys=[],
- base_request={}, bool_fields=[], dated_fields=[]):
+ base_request={}, bool_fields=[], dated_fields=[]):
"""
Generic treatment of tables
"""
diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py
index ecc48a1e8..1fd0b6ac0 100644
--- a/ishtar_common/widgets.py
+++ b/ishtar_common/widgets.py
@@ -219,8 +219,8 @@ class JQueryJqGrid(forms.RadioSelect):
rendered += "\n
%s \n" % unicode(_("Search and select an item"))
extra_cols = []
col_names, col_idx = [], []
- for k in self.form.fields:
- field = self.form.fields[k]
+ for k in self.form.get_input_ids():
+ #field = self.form.fields[k]
col_idx.append(u'"%s"' % k)
for field_name in getattr(self.associated_model, self.table_cols):
field = self.associated_model
@@ -292,7 +292,7 @@ class JQueryJqGrid(forms.RadioSelect):
}
}
var mygrid = jQuery("#grid_%(name)s");
- var url = "%(source)s?submited=1&" + data;
+ var url = "%(source)s?submited=1&" + data;
mygrid.setGridParam({url:url});
mygrid.trigger("reloadGrid");
return false;
--
cgit v1.2.3
From 6c225450c36c0fb58df61dd641f25fa78db2c7a5 Mon Sep 17 00:00:00 2001
From: Étienne Loks
Date: Thu, 4 Apr 2013 18:12:56 +0200
Subject: Rename and move sheets templates
---
.../templates/ishtar/sheet_contextrecord.html | 135 +++++++++++++++
.../ishtar/sheet_contextrecord_window.html | 3 +
.../templates/ishtar/sheet_file.html | 132 +++++++++++++++
.../templates/ishtar/sheet_file_pdf.html | 18 ++
.../templates/ishtar/sheet_file_window.html | 3 +
.../templates/ishtar/sheet_operation.html | 183 +++++++++++++++++++++
.../templates/ishtar/sheet_operation_pdf.html | 18 ++
.../templates/ishtar/sheet_operation_window.html | 3 +
ishtar_common/templates/ishtar/sheet.html | 30 ++++
ishtar_common/templates/sheet.html | 30 ----
ishtar_common/templates/sheet_contextrecord.html | 135 ---------------
.../templates/sheet_contextrecord_window.html | 3 -
ishtar_common/templates/sheet_file.html | 132 ---------------
ishtar_common/templates/sheet_file_pdf.html | 18 --
ishtar_common/templates/sheet_file_window.html | 3 -
ishtar_common/templates/sheet_operation.html | 183 ---------------------
ishtar_common/templates/sheet_operation_pdf.html | 18 --
.../templates/sheet_operation_window.html | 3 -
ishtar_common/views.py | 8 +-
19 files changed, 529 insertions(+), 529 deletions(-)
create mode 100644 archaeological_context_records/templates/ishtar/sheet_contextrecord.html
create mode 100644 archaeological_context_records/templates/ishtar/sheet_contextrecord_window.html
create mode 100644 archaeological_files/templates/ishtar/sheet_file.html
create mode 100644 archaeological_files/templates/ishtar/sheet_file_pdf.html
create mode 100644 archaeological_files/templates/ishtar/sheet_file_window.html
create mode 100644 archaeological_operations/templates/ishtar/sheet_operation.html
create mode 100644 archaeological_operations/templates/ishtar/sheet_operation_pdf.html
create mode 100644 archaeological_operations/templates/ishtar/sheet_operation_window.html
create mode 100644 ishtar_common/templates/ishtar/sheet.html
delete mode 100644 ishtar_common/templates/sheet.html
delete mode 100644 ishtar_common/templates/sheet_contextrecord.html
delete mode 100644 ishtar_common/templates/sheet_contextrecord_window.html
delete mode 100644 ishtar_common/templates/sheet_file.html
delete mode 100644 ishtar_common/templates/sheet_file_pdf.html
delete mode 100644 ishtar_common/templates/sheet_file_window.html
delete mode 100644 ishtar_common/templates/sheet_operation.html
delete mode 100644 ishtar_common/templates/sheet_operation_pdf.html
delete mode 100644 ishtar_common/templates/sheet_operation_window.html
(limited to 'ishtar_common/views.py')
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 %}
+
+
+{% trans "Context Record"%}
+
+{% if item.operation.code_patriarche %}
+{%trans "Complete ID:"%}
+{% else %}
+
{%trans "Patriarche OA code not yet recorded!"%}
+{%trans "Temporary ID:"%}
+{%endif%}
+{{item.full_label}}
+{%if item.unit %}
+{% trans "Type:" %} {{ item.unit }}
+{%endif%}
+{% trans "Chronology:" %} {{ item.datings.all|join:", " }}
+{% trans "Place:" %} {{ item.parcel.town }}
+{% trans "Parcel:" %} {{ item.parcel.short_label }}
+
+{% if item.description or item.lenght or item.width or item.depth %}
+{% trans "Description"%}
+
+{% trans "Description:" %} {{ item.description }}
+{% if item.lenght %}{% trans "Length (cm):" %} {{ item.length }}
{%endif%}
+{% if item.width %}{% trans "Width (cm):" %} {{ item.width }}
{%endif%}
+{% if item.depth %}{% trans "Depth (cm):" %} {{ item.depth }}
{%endif%}
+{% endif %}
+
+{% if item.activity or item.identification or item.interpretation %}
+{% trans "Interpretation"%}
+
+{% if item.activity %}{% trans "Activity:" %} {{ item.activity }}
{%endif%}
+{% if item.identification %}{% trans "Identification:" %} {{ item.identification }}
{%endif%}
+{% if item.interpretation %}{% trans "Interpretation:" %} {{ item.interpretation }}
{%endif%}
+{% endif %}
+
+{% if item.taq or item.taq_estimated or item.tpq or item.tpq_estimated %}
+{% trans "Datations"%}
+{% if item.taq %}{% trans "TAQ:" %} {{ item.taq }}
{%endif%}
+{% if item.taq_estimated %}{% trans "TAQ estimated:" %} {{ item.taq_estimated }}
{%endif%}
+{% if item.tpq %}{% trans "TPQ:" %} {{ item.tpq }}
{%endif%}
+{% if item.tpq_estimated %}{% trans "TPQ estimated:" %} {{ item.tpq_estimated }}
{%endif%}
+{%endif%}
+
+{% if item.operation %}
+{% trans "Operation resume"%}
+{%trans "Year:"%} {{ item.operation.year }}
+{%trans "Numerical reference:"%} {{ item.operation.operation_code }}
+{% if item.operation.code_patriarche %}
+{%trans "Patriarche OA code:"%}
+{{ item.operation.code_patriarche }}
+{% else %}{%trans "Patriarche OA code not yet recorded!"%}
+{%endif%}
+{#{%trans "Operation's name:"%} {{ item.operation.internal_reference }}
#}
+{%trans "Head scientist:"%}
+{{ item.operation.in_charge.full_label }}
+{%trans "State:"%}
+{% if item.operation.is_active %}
+{%trans "Active file"%}
+{% else %}
+{%trans "Closed operation"%}
+{%trans "Closing date:"%} {{ item.operation.closing.date }}
+{%trans "by" %} {{ item.operation.closing.user }}
+{% endif %}
+{%trans "Type:"%} {{ item.operation.operation_type }}
+{%trans "Remains:"%} {{ item.operation.remains.all|join:", " }}
+{%trans "Periods:"%} {{ item.operation.periods.all|join:", " }}
+{% if item.operation.comment %}{%trans "Comment:"%} {{ item.operation.comment }}
{%endif%}
+{% trans "Localisation"%}
+{%trans "Towns:"%} {{ item.operation.towns.all|join:", " }}
+{%trans "Related operation:"%}
+{{ item.operation }}
+{# TODO: Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related operation #}
+{% else %}{%trans "No operation linked to this context unit!"%}
+{% endif %}
+
+
+ {%trans "Documents"%}
+
+ {% trans "Title" %}
+ {% trans "Type" %}
+ {% trans "Authors" %}
+ {#{% trans "Localisation" %} #}
+
+ {% for doc in item.source.all %}
+
+ {{ doc.title }}
+ {{doc.source_type}}
+ {{ doc.authors.all|join:", " }}
+ {#{{ doc.localisation }} #}
+
+ {% empty %}
+ {% trans "No document associated to this context record" %}
+ {% endfor %}
+
+
+
+ {%trans "Finds"%}
+
+ {% trans "Find" %}
+ {% trans "Material type" %}
+ {% trans "Context record" %}
+ {% trans "Periods" %}
+ {% trans "Description" %}
+ {% trans "Weight" %}
+ {% trans "Numbers" %}
+ {% trans "Parcel" %}
+
+
+ {% for find in item.base_finds.all %}
+
+ {{ find.full_label }}
+{# Displayed as (Patriarche operation code)-(Record unit label)-(Finds label). #}
+{# or displayed as (Year)-(index)-(Record unit label)-(Finds label). #}
+ {{ find.material_type_label }}
+{# 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) #}
+
+ {{find.context_record}}
+ {{ find.get_last_find.dating}} {# TODO .all|join:", " ? #}
+ {{ find.get_last_find.description }}
+ {{ find.get_last_find.weight }}
+ {{ find.get_last_find.item_number }}
+ {{ item.context_record.parcel.short_label }}
+ {% trans "Details" %}
+ {#{%trans "Details"%} #}
+
+ {% empty %}
+ {% trans "No find associated to this context record" %}
+ {% endfor %}
+
+
+{% 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_files/templates/ishtar/sheet_file.html b/archaeological_files/templates/ishtar/sheet_file.html
new file mode 100644
index 000000000..1b58aa332
--- /dev/null
+++ b/archaeological_files/templates/ishtar/sheet_file.html
@@ -0,0 +1,132 @@
+{% extends "ishtar/sheet.html" %}
+{% load i18n %}
+{% block content %}
+{% if previous or next %}
+
+{% endif %}
+
+{% trans "General"%}
+{%trans "Year:"%} {{ item.year }}
+{%trans "Numerical reference:"%} {{ item.numeric_reference }}
+
+{%trans "File's name:"%} {{ item.internal_reference }}
+
+{%trans "Edition date:"%} {{ item.history_date }}
+{% if item.reception_date %}{%trans "Reception date:"%} {{ item.reception_date }}
{% endif %}
+{%trans "Creation date:"%} {{ item.creation_date }}
+{% comment %}
+{% if item.deadline_date and not item.acts %}
+ {%trans "Deadline:"%} {% item.deadline_date %}
+{% endif %}
+{% endcomment %}
+
+{%trans "In charge:"%} {{ item.in_charge.full_label }}
+{%trans "State:"%} {% if item.is_active %}{%trans "Active file"%}
+{% else %}{%trans "Closed file"%}
+{%trans "Closing date:"%} {{ item.closing.date }} {%trans "by" %} {{ item.closing.user }}
+{% endif %}
+
+{%trans "Type:"%} {{ item.file_type }}
+
+{% if item.related_file %}{%trans "Related file:"%} {{ item.related_file }}
{% endif %}
+{% if item.comment %}{%trans "Comment:"%} {{ item.comment }}
{%endif%}
+
+{% trans "Localisation"%}
+{%trans "Towns:"%} {{ item.towns.all|join:", " }}
+
+{%trans "Main address:"%} {{ item.address }}
+{% if item.address_complement %}{%trans "Complement:"%} {{ item.address_complement }}
{%endif%}
+{% if item.postal_code %}{%trans "Postal code:"%} {{ item.postal_code }}
{%endif%}
+
+{%trans "Surface:"%} {% if item.total_surface %} {{ item.total_surface }} m2 ({{ item.total_surface_ha }} ha) {%endif%}
+
+
+
+{% if item.is_preventive %}
+{% trans "Preventive archaelogical file"%}
+{%trans "Planed surface:"%} {{ item.total_developed_surface }} m2 ({{ item.total_developed_surface_ha }} ha)
+{%trans "Saisine type:"%} {{ item.saisine_type }}
+{% if item.town_planning_service %}{%trans "Town planning service:"%} {{ item.town_planning_service }}
{% endif %}
+{% if item.permit_type %}{%trans "Permit type:"%} {{ item.permit_type }}
{% endif %}
+{% if item.permit_reference %}{%trans "Permit reference:"%} {{ item.permit_reference }}
{% endif %}
+{% if item.general_contractor.attached_to %}{%trans "General contractor organisation:"%} {{ item.general_contractor.attached_to }}
{% endif %}
+{% if item.general_contractor %}{%trans "General contractor:"%} {{ item.general_contractor.full_label }}
{% endif %}
+{% endif %}
+
+
+ {%trans "Admninistrative acts"%}
+
+ {% trans "Year" %}
+ {% trans "Reference" %}
+ {% trans "Type" %}
+ {% trans "Date" %}
+
+ {% for act in item.administrative_act.all %}
+
+ {{act.signature_date.year}}
+ {{act.ref_sra}}
+ {{act.act_type}}
+ {{act.signature_date}}
+
+ {% empty %}
+ {% trans "No administrative act associated to this archaelogical file" %}
+ {% endfor %}
+
+
+
+ {%trans "Associated operations"%}
+
+ {% trans "Year" %}
+ {% trans "Reference" %}
+ Code Patriarche
+ {% trans "Type" %}
+ {% trans "In charge" %}
+ {% trans "Start date" %}
+ {% trans "Excavation end date" %}
+
+
+ {% for operation in item.operations.all %}
+
+ {{operation.year}}
+ {{operation.operation_code}}
+ {{operation.code_patriarche|default:""}}
+ {{operation.operation_type}}
+ {{operation.in_charge|default:""}}
+ {{operation.start_date|default:""}}
+ {{operation.excavation_end_date|default:""}}
+ {% trans "Details" %}
+
+ {% empty %}
+ {% trans "No operation associated to this archaelogical file" %}
+ {% endfor %}
+
+
+
+ {%trans "Admninistrative acts linked to associated operations"%}
+
+ {% trans "Year" %}
+ {% trans "Reference" %}
+ {% trans "Type" %}
+ {% trans "Date" %}
+
+ {% for act in item.operation_acts %}
+
+ {{act.signature_date.year}}
+ {{act.ref_sra}}
+ {{act.act_type}}
+ {{act.signature_date}}
+
+ {% empty %}
+ {% trans "No administrative act linked to operations" %}
+ {% endfor %}
+
+{% endblock %}
diff --git a/archaeological_files/templates/ishtar/sheet_file_pdf.html b/archaeological_files/templates/ishtar/sheet_file_pdf.html
new file mode 100644
index 000000000..29a4f4dec
--- /dev/null
+++ b/archaeological_files/templates/ishtar/sheet_file_pdf.html
@@ -0,0 +1,18 @@
+{% extends "ishtar/sheet_file.html" %}
+{% block css_head %}
+
+{% endblock %}
+{% block main_head %}
+{{ block.super }}
+
+{% endblock %}
+{%block head_sheet%}{%endblock%}
+{%block main_foot%}
+
+