summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/models.py1
-rw-r--r--ishtar_common/static/media/style.css86
-rw-r--r--ishtar_common/templates/blocks/JQueryJqGrid.html10
-rw-r--r--ishtar_common/templates/ishtar/blocks/window_nav.html47
-rw-r--r--ishtar_common/templates/ishtar/blocks/window_tables/dynamic_documents.html9
-rw-r--r--ishtar_common/templates/ishtar/sheet.html32
-rw-r--r--ishtar_common/templates/ishtar/sheet_organization.html10
-rw-r--r--ishtar_common/templates/ishtar/sheet_person.html7
-rw-r--r--ishtar_common/templates/ishtar/sheet_source.html3
-rw-r--r--ishtar_common/templates/ishtar/sheet_toolbar.html2
-rw-r--r--ishtar_common/templatetags/window_header.py37
-rw-r--r--ishtar_common/templatetags/window_tables.py9
-rw-r--r--ishtar_common/urls.py2
-rw-r--r--ishtar_common/views.py13
14 files changed, 222 insertions, 46 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 87cad0d72..a1cc3cc1b 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1825,6 +1825,7 @@ TARGET_MODELS = [
('Format', _(u"Format")),
('archaeological_operations.models.OperationType', _(u"Operation type")),
('archaeological_operations.models.Period', _(u"Period")),
+ ('archaeological_operations.models.ReportState', _(u"Report state")),
('archaeological_context_records.models.Unit', _(u"Unit")),
('archaeological_finds.models.MaterialType', _(u"Material")),
('archaeological_finds.models.ConservatoryState',
diff --git a/ishtar_common/static/media/style.css b/ishtar_common/static/media/style.css
index 7aef23099..69f86784b 100644
--- a/ishtar_common/static/media/style.css
+++ b/ishtar_common/static/media/style.css
@@ -16,7 +16,7 @@ div.form, ul.form {
background-color: #922;
}
-a.add-button, #reset_wizards{
+.badge, a.add-button, #reset_wizards{
background-color: #D14;
}
@@ -27,15 +27,13 @@ a, a.remove {
color:#D14;
}
+.badge,
a.add-button,
#reset_wizards,
#window h1{
color:#fff;
}
-#context_menu {
-}
-
#context_menu .orange {
color:#dd6011;
}
@@ -77,6 +75,33 @@ hr.spacer{
margin: 13px;
}
+#window hr.clear,
+hr.clear{
+ clear: both;
+ border: 0 solid transparent;
+ height: 0;
+ margin: 0;
+}
+
+.fa-stack-15x {
+ position: absolute;
+ left: 0;
+ width: 100%;
+ text-align: center;
+ font-size: 1.5em;
+ line-height: 1.4em;
+}
+
+.badge{
+ border: 1px solid #D14;
+}
+
+.close-buttons{
+ position: absolute;
+ right: 10px;
+ top: 2px;
+}
+
/* shadows */
#progress-content,
.sheet{
@@ -677,6 +702,13 @@ ul.form .help_text{
margin:0.2em;
}
+.badge{
+ padding: 0.1em 0.3em;
+ border-radius: 1em;
+ line-height: 1.8em;
+ font-style: normal;
+}
+
.autocomplete{
width:300px;
}
@@ -711,6 +743,11 @@ table.confirm tr.spacer td:last-child{
background:url('images/indicator.gif') no-repeat right center;
}
+.gridfooter{
+ text-align: center;
+ font-style: italic;
+}
+
.jqgrid{
cursor:pointer;
}
@@ -760,18 +797,17 @@ table.confirm tr.spacer td:last-child{
.previous_page, .next_page{
position:absolute;
- top:40px;
- font-size: 30px;
+ top:2px;
color: #000;
z-index: 1000;
}
.previous_page{
- left:35px;
+ left:95px;
}
.next_page{
- right:35px;
+ right:95px;
}
a.photo{
@@ -945,24 +981,36 @@ table td.item-list span{
#window .head{
text-align:center;
background-color:#f1f2f6;
- -webkit-border-top-left-radius: 8px;
- -webkit-border-top-right-radius: 8px;
- -moz-border-radius-topleft: 8px;
- -moz-border-radius-topright: 8px;
- border-top-left-radius: 8px;
- border-top-right-radius: 8px;
}
+#window .tool-left,
+#window .tool-right,
#window .tool{
text-align:center;
font-style:italic;
}
+#window .tool-right{
+ float: right;
+ padding: 0 2em;
+}
+
+#window .tool-left{
+ float: left;
+ padding: 0 2em;
+}
+
#window .tool.modify{
font-style:normal;
font-weight:bold;
}
+.history-nav{
+ display: inline-block;
+ width: 100px;
+ vertical-align: top;
+}
+
#window .body{
position:absolute;
padding:2px 10px 6px 10px;
@@ -977,6 +1025,16 @@ table td.item-list span{
text-align:center;
font-size:16px;
margin-top:0;
+ padding: 0.2em;
+}
+
+#window .head, #window h1{
+ -webkit-border-top-left-radius: 8px;
+ -webkit-border-top-right-radius: 8px;
+ -moz-border-radius-topleft: 8px;
+ -moz-border-radius-topright: 8px;
+ border-top-left-radius: 8px;
+ border-top-right-radius: 8px;
}
#window label{
diff --git a/ishtar_common/templates/blocks/JQueryJqGrid.html b/ishtar_common/templates/blocks/JQueryJqGrid.html
index c6a15243a..44f4b0ba8 100644
--- a/ishtar_common/templates/blocks/JQueryJqGrid.html
+++ b/ishtar_common/templates/blocks/JQueryJqGrid.html
@@ -12,13 +12,13 @@
<div id='pager_{{name}}'></div>
<div id='foot_{{name}}' class='gridfooter'>
+
{% if source_full %}
-{% trans "Export as CSV" %} ({{encoding}})
-<a class='{{sname}}-csv' href='{{source}}csv' target='_blank'>{% trans "simple" %}</a> -
-<a class='{{sname}}-csv-full' href='{{source_full}}csv' target='_blank'>{% trans "full" %}</a>
+<a class='badge {{sname}}-csv' href='{{source}}csv' target='_blank' title="{% trans 'Export as CSV' %}">{% trans "CSV" %}</a>
+<a class='badge {{sname}}-csv-full' href='{{source_full}}csv' target='_blank' title="{% trans 'Export as CSV - full' %}">{% trans "CSV full" %}</a>
{% else %}
-<a class='{{sname}}-csv' href="{{source}}csv" target="_blank">{% trans "Export as CSV" %} ({{encoding}})</a>
-{% endif %}
+<a class='{{sname}}-csv' href="{{source}}csv" target="_blank" title="{% trans 'Export as CSV' %}">{% trans "CSV" %}</a>
+{% endif %} {{encoding}}
</div>
{% if multiple %}
diff --git a/ishtar_common/templates/ishtar/blocks/window_nav.html b/ishtar_common/templates/ishtar/blocks/window_nav.html
new file mode 100644
index 000000000..c225a5822
--- /dev/null
+++ b/ishtar_common/templates/ishtar/blocks/window_nav.html
@@ -0,0 +1,47 @@
+{% load url from future %}
+{% load i18n %}
+{% if previous or next %}
+ <div class='tool-right'>
+ {% if previous %}
+ <a class='history-nav' href="#" onclick='load_window("{% url histo_url item.pk previous|date:"c"%}");$("#{{window_id}}").hide();return false;' title="{%trans 'Previous version'%}">
+ <span class="fa-stack">
+ <i class="fa fa-circle fa-stack-2x"></i>
+ <i class="fa fa-step-backward fa-stack-1x fa-inverse"></i>
+ </span>
+ <br/>{{previous}}
+ </a>
+ {% else %}
+ <span class='history-nav'> </span>
+ {% endif %}
+ {% if next %}
+ <a class='history-nav' title="{% trans 'Restore this version' %}" href="#" onclick='if(confirm("{%trans 'Are you sure to restore to this version? All changement made since this version will be lost.' %}")){load_url("{% url revert_url item.pk item.history_date|date:"c"%}");closeAllWindows();load_window("{% url show_url item.pk None %}");}'>
+ <span class="fa-stack fa-lg">
+ <i class="fa fa-circle fa-stack-2x"></i>
+ <i class="fa fa-history fa-stack-1x fa-inverse"></i>
+ </span>
+ <br/>{% trans "Restore" %}
+ </a>
+ <a class='history-nav' href="#" onclick='load_window("{% url histo_url item.pk next|date:"c" %}");$("#{{window_id}}").hide();return false;' title="{%trans 'Next version'%}">
+ <span class="fa-stack">
+ <i class="fa fa-circle fa-stack-2x"></i>
+ <i class="fa fa-step-forward fa-stack-1x fa-inverse"></i>
+ </span>
+ <br/>{{next}}
+ </a>
+ {% else %}
+ <span class='history-nav'> </span>
+ <span class='history-nav'> </span>
+ {% endif %}
+ </div>
+{% endif %}
+<div class='tool-left'>
+ {% block extra_actions %}{% endblock %}
+ {% if modify_url %}<a href='{% url modify_url item.pk %}' title="{% trans 'Modify' %}">
+ <span class="fa-stack fa-lg">
+ <i class="fa fa-circle fa-stack-2x"></i>
+ <i class="fa fa-pencil fa-stack-1x fa-inverse"></i>
+ </span>
+ </a>{% endif %}
+ <a class='badge' href='{% url show_url item.pk "odt" %}' title='{% trans "Export as OpenOffice.org file"%}'>ODT</a> <a class='badge' href='{% url show_url item.pk "pdf" %}' title='{% trans "Export as PDF file"%}'>PDF</a>
+</div>
+<hr class='clear'>
diff --git a/ishtar_common/templates/ishtar/blocks/window_tables/dynamic_documents.html b/ishtar_common/templates/ishtar/blocks/window_tables/dynamic_documents.html
index 8850bd34a..4a81a64fb 100644
--- a/ishtar_common/templates/ishtar/blocks/window_tables/dynamic_documents.html
+++ b/ishtar_common/templates/ishtar/blocks/window_tables/dynamic_documents.html
@@ -6,12 +6,11 @@
<div id='foot_{{name}}' class='gridfooter'>
{% if source_full %}
-{% trans "Export as CSV" %} ({{encoding}})
-<a href='{{simple_source}}csv{{ source_attrs|safe }}' target='_blank'>{% trans "simple" %}</a> -
-<a href='{{source_full}}csv{{ source_attrs|safe }}' target='_blank'>{% trans "full" %}</a>
+<a class="badge" href='{{simple_source}}csv{{ source_attrs|safe }}' target='_blank' title="{% trans 'Export as CSV' %}">{% trans "CSV" %}</a>
+<a class="badge" href='{{source_full}}csv{{ source_attrs|safe }}' target='_blank' title="{% trans 'Export as CSV - full' %}">{% trans "CSV full" %}</a>
{% else %}
-<a href="{{simple_source}}csv{{ source_attrs|safe }}" target="_blank">{% trans "Export as CSV" %} ({{encoding}})</a>
-{% endif %}
+<a class="badge" href="{{simple_source}}csv{{ source_attrs|safe }}" target="_blank" title="{% trans 'Export as CSV' %}">CSV</a>
+{% endif %} {{encoding}}
</div>
<script type="text/javascript" language='javascript'>
diff --git a/ishtar_common/templates/ishtar/sheet.html b/ishtar_common/templates/ishtar/sheet.html
index 5da837ab4..bfefd5eb6 100644
--- a/ishtar_common/templates/ishtar/sheet.html
+++ b/ishtar_common/templates/ishtar/sheet.html
@@ -18,11 +18,35 @@
<div class="head">
-<a href='#' class='previous_page'><i class="fa fa-arrow-circle-left" aria-hidden="true"></i></a>
-<a href='#' onclick='$("#{{window_id}}").hide("slow")'>{% trans "Close" %}</a> -
-<a href='#' onclick='closeAllWindows();'>{% trans "Close all windows" %}</a>
-<a href='#' class='next_page'><i class="fa fa-arrow-circle-right" aria-hidden="true"></i></a>
+<a href='#' class='previous_page'>
+<span class="fa-stack fa-lg">
+ <i class="fa fa-circle fa-stack-2x"></i>
+ <i class="fa fa-arrow-left fa-stack-1x fa-inverse"></i>
+</span>
+</a>
+<div class='close-buttons'>
+<a href='#' onclick='$("#{{window_id}}").hide("slow")' title="{% trans 'Close' %}">
+<span class="fa-stack">
+ <i class="fa fa-circle fa-stack-2x"></i>
+ <i class="fa fa-times fa-stack-1x fa-inverse"></i>
+</span>
+</a>
+<a href='#' onclick='closeAllWindows();' title="{% trans "Close all windows" %}">
+<span class="fa-stack">
+ <i class="fa fa-files-o fa-stack-2x"></i>
+ <i class="fa fa-circle fa-stack-15x"></i>
+ <i class="fa fa-times fa-stack-1x fa-inverse"></i>
+</span>
+</a>
+</div>
+<a href='#' class='next_page'>
+<span class="fa-stack fa-lg">
+ <i class="fa fa-circle fa-stack-2x"></i>
+ <i class="fa fa-arrow-right fa-stack-1x fa-inverse"></i>
+</span>
+</a>
+<h1>{% block head_title %}{% endblock %}</h1>
</div>
<script type="text/javascript" language='javascript'>
diff --git a/ishtar_common/templates/ishtar/sheet_organization.html b/ishtar_common/templates/ishtar/sheet_organization.html
index 8deeebf98..2ece97a8b 100644
--- a/ishtar_common/templates/ishtar/sheet_organization.html
+++ b/ishtar_common/templates/ishtar/sheet_organization.html
@@ -1,14 +1,10 @@
{% extends "ishtar/sheet.html" %}
-{% load i18n %}
+{% load i18n window_header %}
-{% block head_sheet %}
-{{block.super}}
-<h1>{% trans "Organization"%}</h1>
-{% endblock %}
+{% block head_title %}{% trans "Organization" %}{% endblock %}
{% block content %}
-<div class='tool'>{%trans "Export as:"%} <a href='{% url show-organization item.pk "odt" %}'>{%trans "OpenOffice.org file"%}</a>, <a href='{% url show-organization item.pk "pdf" %}'>{%trans "PDF file"%}</a></div>
-
+{% window_nav item window_id 'show-organization' 'organization_modify' %}
<p><label>{% trans "Name" %}</label> <span class='value'>{{item.name}}</span></p>
<p><label>{%trans "Created by:"%}</label> <span class='value'>{{ item.history_creator.ishtaruser.full_label }}</span></p>
{% if item.address %}<p><label>{% trans "Address" %}</label> <span class='value'>{{item.address}}</span></p> {% endif %}
diff --git a/ishtar_common/templates/ishtar/sheet_person.html b/ishtar_common/templates/ishtar/sheet_person.html
index 3c554acdf..f5c42c11a 100644
--- a/ishtar_common/templates/ishtar/sheet_person.html
+++ b/ishtar_common/templates/ishtar/sheet_person.html
@@ -1,10 +1,9 @@
{% extends "ishtar/sheet.html" %}
-{% load i18n window_field window_tables %}
-
-{% block header_title %}<h1>{% trans "Person"%}</h1>{% endblock %}
-{% block toolbar %}{% with current_action='person_modification' %}{% include "ishtar/sheet_toolbar.html" %}{% endwith %}{% endblock %}
+{% load i18n window_field window_tables window_header %}
+{% block head_title %}{% trans "Person"%}{% endblock %}
{% block content %}
+{% window_nav item window_id 'show-person' 'person_modify' %}
<h3>{% trans "Identity" %}</h3>
{% field "Name" item.name %}
diff --git a/ishtar_common/templates/ishtar/sheet_source.html b/ishtar_common/templates/ishtar/sheet_source.html
index bda22ed35..653087753 100644
--- a/ishtar_common/templates/ishtar/sheet_source.html
+++ b/ishtar_common/templates/ishtar/sheet_source.html
@@ -1,7 +1,8 @@
{% extends "ishtar/sheet.html" %}
{% load i18n window_field link_to_window %}
-{% block toolbar %}{% with current_action='operation_source_modification' %}{% include "ishtar/sheet_toolbar.html" %}{% endwith %}{% endblock %}
+
{% block content %}
+{% block window_nav %}{% endblock %}
{% block general %}
{% field "Title" item.title %}
{% field "Index" item.index %}
diff --git a/ishtar_common/templates/ishtar/sheet_toolbar.html b/ishtar_common/templates/ishtar/sheet_toolbar.html
deleted file mode 100644
index d9d4cc1a5..000000000
--- a/ishtar_common/templates/ishtar/sheet_toolbar.html
+++ /dev/null
@@ -1,2 +0,0 @@
-{% load i18n link_to_window %}<div class='tool'>{% trans "Export as:" %} <a href='{{item|link_to_odt}}'>{%trans "OpenOffice.org file"%}</a>, <a href='{{item|link_to_pdf}}'>{%trans "PDF file"%}</a></div>
-{% modify_toolbar item current_action %}
diff --git a/ishtar_common/templatetags/window_header.py b/ishtar_common/templatetags/window_header.py
new file mode 100644
index 000000000..b137f24a5
--- /dev/null
+++ b/ishtar_common/templatetags/window_header.py
@@ -0,0 +1,37 @@
+from django import template
+from django.utils.safestring import mark_safe
+
+register = template.Library()
+
+
+@register.inclusion_tag('ishtar/blocks/window_nav.html')
+def window_nav(item, window_id, show_url, modify_url='', histo_url='',
+ revert_url='', previous=None, nxt=None):
+ return {
+ 'show_url': show_url,
+ 'modify_url': modify_url,
+ 'histo_url': histo_url,
+ 'revert_url': revert_url,
+ 'item': item,
+ 'window_id': window_id,
+ 'previous': previous,
+ 'next': nxt}
+
+
+@register.inclusion_tag('ishtar/blocks/window_file_nav.html')
+def window_file_nav(item, window_id, previous=None, nxt=None):
+ show_url = 'show-file'
+ modify_url = 'file_modify'
+ histo_url = 'show-historized-file'
+ revert_url = 'revert-file'
+ add_operation = ""
+ return {
+ 'show_url': show_url,
+ 'modify_url': modify_url,
+ 'histo_url': histo_url,
+ 'revert_url': revert_url,
+ 'item': item,
+ 'extra_action': mark_safe(add_operation),
+ 'window_id': window_id,
+ 'previous': previous,
+ 'next': nxt}
diff --git a/ishtar_common/templatetags/window_tables.py b/ishtar_common/templatetags/window_tables.py
index 03365c207..578d94535 100644
--- a/ishtar_common/templatetags/window_tables.py
+++ b/ishtar_common/templatetags/window_tables.py
@@ -16,7 +16,8 @@ from archaeological_files.models import File
from archaeological_operations.models import OperationSource, Operation
from archaeological_context_records.models import ContextRecord, \
ContextRecordSource
-from archaeological_finds.models import Find, FindSource, FindTreatments
+from archaeological_finds.models import Find, FindSource, \
+ FindUpstreamTreatments, FindDownstreamTreatments
register = template.Library()
@@ -43,8 +44,10 @@ ASSOCIATED_MODELS['finds_for_ope'] = (
Find, 'get-find-for-ope', 'get-find-full')
ASSOCIATED_MODELS['finds_docs'] = (
FindSource, 'get-findsource', 'get-findsource-full')
-ASSOCIATED_MODELS['finds_treatments'] = (
- FindTreatments, 'get-treatment', 'get-treatment-full')
+ASSOCIATED_MODELS['finds_upstreamtreatments'] = (
+ FindUpstreamTreatments, 'get-upstreamtreatment', '')
+ASSOCIATED_MODELS['finds_downstreamtreatments'] = (
+ FindDownstreamTreatments, 'get-downstreamtreatment', '')
@register.simple_tag(takes_context=True)
diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py
index daaac77e3..a6f24beed 100644
--- a/ishtar_common/urls.py
+++ b/ishtar_common/urls.py
@@ -64,6 +64,8 @@ urlpatterns = patterns(
check_rights(['change_organization', 'change_own_organization'])(
views.organization_modification_wizard),
name='organization_modification'),
+ url(r'organization_modify/(?P<pk>.+)/$', views.organization_modify,
+ name='organization_modify'),
url(r'organization_deletion/(?P<step>.+)?$',
check_rights(['change_organization', 'change_own_organization'])(
views.organization_deletion_wizard), name='organization_deletion'),
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index bbe790efa..79d3054b3 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -143,6 +143,16 @@ organization_modification_wizard = wizards.OrganizationModifWizard.as_view(
label=_(u"Organization modification"),
url_name='organization_modification')
+
+def organization_modify(request, pk):
+ organization_modification_wizard(request)
+ wizards.OrganizationModifWizard.session_set_value(
+ request, 'selec-organization_modification', 'pk', pk, reset=True)
+ return redirect(
+ reverse('organization_modification',
+ kwargs={'step': 'identity-organization_modification'}))
+
+
organization_deletion_wizard = wizards.OrganizationDeletionWizard.as_view(
[('selec-organization_deletion', forms.OrganizationFormSelection),
('final-organization_deletion', FinalDeleteForm)],
@@ -692,7 +702,7 @@ def get_item(model, func_name, default_name, extra_request_keys=[],
new_vals.append(u"{}{}{}".format(
vals[idx], u' - ', format_val(v)))
my_vals = new_vals[:]
- data.append(", ".join(my_vals) or u"")
+ data.append(" ; ".join(my_vals) or u"")
datas.append(data)
if manual_sort_key:
# +1 because the id is added as a first col
@@ -793,6 +803,7 @@ def show_item(model, name, extra_dct=None):
url_name = u"/".join(reverse('show-' + name, args=['0', '']
).split('/')[:-2]) + u"/"
dct['CURRENCY'] = get_current_profile().currency
+ dct['ENCODING'] = settings.ENCODING
dct['current_window_url'] = url_name
date = 'date' in dct and dct.pop('date')
dct['window_id'] = "%s-%d-%s" % (