Interface improvements: homepage, workshop, submitpage + it is now possible to edit changes + added CategoryChangesAPI
{% if not session["user_logged"] or not session["user_can_edit"] %}
{% set readonly="readonly" %}
{% else %}
{% set readonly=False %}
{% endif %}
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Editeur de catégorie</title>
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/style.css') }}" rel="stylesheet">
</head>
<body>
<div class="navbar navbar-inverse" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="{{ url_for('cat_index') }}">
<img alt="Brand" src="{{ url_for('static', filename='img/catedit_brand.png') }}" class="navbar-img" width="32" height="32">
</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="{{ url_for('cat_index') }}">Page d'accueil</a></li>
{% if session.get("user_logged", None) %}
<li><a href="{{ url_for('cat_recap') }}">Atelier</a></li>
{% endif %}
</ul>
<div class="navbar-text navbar-right">
{% if not session.get("user_logged", None)%} Non authentifié - <a href="{{ url_for('github_login') }}" class="navbar-link">S'authentifier</a>
{% else %} Authentifié: {{ session["user_login"] }} - <a href="{{ url_for('logout') }}" class="navbar-link">Quitter</a>{% endif %}
</div>
</div>
</div>
</div>
<div class="container">
{% if session["user_logged"] and not session["user_can_edit"] %}
<div class="alert alert-warning" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<span class="sr-only">Attention:</span>
Vous n'avez pas accès en écriture au repository contenant les catégories - Vous ne pourrez pas les modifier.
</div>
{% endif %}
{% if not session["user_logged"] %}
<div class="alert alert-warning" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<span class="sr-only">Attention:</span>
Vous devez être authentifié pour modifier les catégories.
</div> {% endif %}
{% if form.label.errors or form.description.errors %}
<div class="alert alert-danger">
<strong>
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
Erreur:
</strong>
Vous n'avez pas rempli certains champs obligatoires.
</div>
{% endif %}
<h2>{% if cat_id: %} Edition : <small>Catégorie existante</small>{% else %}Création : <small>Nouvelle catégorie</small>{% endif %}</h2>
{% if readonly %} <fieldset disabled> {% endif %}
<form method="POST" action="{% if cat_id %}{{ url_for('cat_editor', cat_id=cat_id) }}{% else %}{{ url_for('cat_editor') }}{% endif %}" id="cat_form" role="form">
{{ form.hidden_tag() }}
{% if form.label.errors %}
{% set label_placeholder="Champ obligatoire" %}
{% endif %}
{% if form.description.errors %}
{% set description_placeholder="Champ obligatoire" %}
{% endif %}
{{ form.label.label }} <br> {{ form.label(size=40, class="form-control", readonly=readonly, placeholder=label_placeholder) }} <br>
{{ form.description.label }} <br> {{ form.description(size=150, class="form-control", readonly=readonly, placeholder=description_placeholder) }} <br>
<label>Propriétés </label>
<div class="form-inline">
<select id="property_selector" class="form-control" onChange="CatEditScripts.displayCorrespondingField();" {{readonly}}>
<option label="property_type_default" selected>
Liste des propriétés ...
</option>
{% for predicate in config["PROPERTY_LIST"] %}
<option value='{{ predicate }}' label={{ config["PROPERTY_LIST"][predicate]["object_type"] }} >{{ config["PROPERTY_LIST"][predicate]["descriptive_label_fr"] }}</option>
{% endfor %}
</select>
<input type="text" id="literal-field" class="hidden form-control">
<input type="text" id="uriref-link-field" placeholder="http://my-example.com" class="hidden form-control">
<select class="hidden form-control" id="uriref-category-field">
<option value="default" selected> Liste des catégories </option>
{% for cat in cat_list %}
<option value="{{ cat.cat_id }}"> {{ cat.cat_label }} </option>
{% endfor %}
</select>
<input type="button" value="Ajouter propriété" onClick="CatEditScripts.addProperty('properties','property_table_body');" class="btn btn-default" {{ readonly }}>
</div>
<div class="alert alert-warning hidden" role="alert" id="uriref-category-field-text">
</div>
<div id="properties" class="row hidden">
<div class="row">
<div class="col-md-6">
<br>
<table id="property_table" class="table table-condensed">
<tbody id="property_table_body">
{% set property_count=1 %}
{% for (predicate, object) in cat_properties %}
<tr id="property_tr{{property_count}}">
{% if config["PROPERTY_LIST"][predicate]["object_type"]=="uriref-category" %}
{% for cat in cat_list %}
{% if object == config["CATEGORY_NAMESPACE"]+cat.cat_id %}
{% if cat.cat_id not in deleted_cat_list %}
<input type="hidden" id="property_predicate{{ property_count }}" name="property_predicate" value="{{predicate}}"/>
<input type="hidden" id="property_object{{ property_count }}" name="property_object" value="{{cat.cat_id}}"/>
<td id="predicate_td{{ property_count }}">
<strong>{{ config["PROPERTY_LIST"][predicate]["descriptive_label_fr"] }}</strong>
</td>
<td id="object_td{{ property_count }}">
{{ cat.cat_label }}
</td>
<td id="delete_button_td{{ property_count }}">
<input type="button" id="property_delete_button{{ property_count }}" class="btn btn-default property-delete-button" onClick="CatEditScripts.removeProperty({{ property_count }}, 'properties')" value="Supprimer">
</td>
{% endif %}
{% endif %}
{% endfor %}
{% else %}
<input type="hidden" id="property_predicate{{ property_count }}" name="property_predicate" value="{{predicate}}"/>
<input type="hidden" id="property_object{{ property_count }}" name="property_object" value="{{object}}"/>
<td id="predicate_td{{ property_count }}">
<strong>{{ config["PROPERTY_LIST"][predicate]["descriptive_label_fr"] }}</strong>
</td>
<td id="object_td{{ property_count }}">
{% if config["PROPERTY_LIST"][predicate]["object_type"]=="uriref-link" %}
<a href="{{ object }}">{{ object }}</a>
{% else %}
{{ object }}
{% endif %}
</td>
<td id="delete_button_td{{ property_count }}">
<input type="button" id="property_delete_button{{ property_count }}" class="btn btn-default property-delete-button" onClick="CatEditScripts.removeProperty({{ property_count }}, 'properties')" value="Supprimer">
</td>
{% endif %}
{% set property_count=property_count+1 %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div><br>
<br><input type="submit" value="Sauvegarder" class="btn btn-default">
<a href="{{ url_for('cat_recap')}}"class="btn btn-default">Annuler</a>
</form>
{% if readonly %} </fieldset> {% endif %}
<script src="{{ url_for('static', filename='js/property_functions.js') }}" language="Javascript" type="text/javascript"></script>
{% if cat_id %}
<script type=text/javascript>
CatEditScripts.initPropertyCount("properties",{{cat_properties|length}});
CatEditScripts.initCreatedProperties({{cat_properties|length}});
</script>
{% endif %}
</body>
</html>