{% set tg_session_id = project.main_config.get_tg_session_id(instance) %} {% set is_valid_session = project.get_tgp(instance).check_session() %} {% set action = 'upload' %} {% include 'includes/get_sessionid.html' %}
{% include 'includes/set_sessionid.html' %} {% if tg_session_id %}
New project:
Select from existing projects
{% set tg_project_id = project.main_config.get_tg_project_id(instance) %} {% for tg_project in project.get_tgp(instance).get_tg_projects() %}
{{ tg_project.name }} {{ tg_project.id }} TEI: {{ tg_project.tei_count }} Img: {{ tg_project.img_count }} Other: {{ tg_project.other_count }}
{% endfor %}
{% endif %}
{% if is_valid_session %}

Upload to {{ instance|capitalize }} Instance

{% if instance == 'test' %} This upload is for testing purposes. {% else %} This starts a real publication.
Please ensure all data is correct.
{% endif %}
{% if not tg_project_id %} {% else %} {% set p_validation = project.get_validation_results(refresh=False, file_attributes=True) %} {% set tg_project = tg_project if tg_project else project.get_tgp(instance) %} {% set all_tgp_contents = tg_project.get_project_contents() %} {% for c_validation in p_validation["subprojects"] %}
{{c_validation.title}}
{% for file_name, file_errors in c_validation.files.items() %} {% if 'file_attributes' in c_validation %} {% set title = c_validation.file_attributes[file_name]['work_title'] %} {% else %} {% set title = file_name %} {% endif %} {% endfor %}
{{title}} ({{file_name}}) {% if len(file_errors) == 0 %} {% else %} {% endif %} {% if all_tgp_contents[title] %} {% else %} {% endif %} {% if all_tgp_contents[title] and all_tgp_contents[title]['published'] %} {% else %} {% endif %}
{% if c_validation.stats.error == 0 %}
{% else %}
Validation Errors detected – please fix before uploading.
{% endif %}
{% endfor %}
Other Files
{% for filename in project.project_config.other_files.get_all_files() %} {% endfor %}
 
{{filename}}   {% if all_tgp_contents[filename] %} {% else %} {% endif %} {% if all_tgp_contents[filename] and all_tgp_contents[filename]['published'] %} {% else %} {% endif %}
{% endif %}
{% endif %}