src/catedit/templates/catmodifs.html
changeset 14 fc63b1a3d2ef
child 18 37981f4fdb77
equal deleted inserted replaced
13:ea5f985156b1 14:fc63b1a3d2ef
       
     1 {% if not session["user_logged"] or not session["user_can_edit"] %}
       
     2   {% set readonly="readonly" %}
       
     3 {% else %}
       
     4   {% set readonly=False %}
       
     5 {% endif %}
       
     6 <!DOCTYPE html>
       
     7 <html lang="fr">
       
     8   <head>
       
     9     <meta charset="utf-8">
       
    10       <meta http-equiv="X-UA-Compatible" content="IE=edge">
       
    11       <meta name="viewport" content="width=device-width, initial-scale=1">
       
    12       <title>Mes modifications</title>
       
    13       <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
       
    14       <link href="{{ url_for('static', filename='css/style.css') }}" rel="stylesheet">
       
    15       <script src="{{ url_for('static', filename='js/jquery-1.11.1.min.js') }}" language="Javascript" type="text/javascript"></script>
       
    16       <script>
       
    17         $(document).ready(function(){
       
    18           {% for cat in cat_list %}
       
    19             $("#properties_{{cat.cat_id}}").hide();
       
    20             $("#info_button_{{cat.cat_id}}").click(function(){
       
    21               $("#properties_{{cat.cat_id}}").slideToggle();
       
    22             });
       
    23             $("#delete_cat_{{cat.cat_id}}").hide();
       
    24             $("#delete_button_{{cat.cat_id}}").click(function(){
       
    25               $("#delete_cat_{{cat.cat_id}}").slideToggle();
       
    26             });
       
    27           {% endfor %}
       
    28           {% for cat in modified_cat_list %}
       
    29             $("#properties_modified_{{cat.cat_id}}").hide();
       
    30             $("#info_button_modified_{{cat.cat_id}}").click(function(){
       
    31               $("#properties_modified_{{cat.cat_id}}").slideToggle();
       
    32             });
       
    33             $("#delete_modified_{{cat.cat_id}}").hide();
       
    34             $("#remove_modifs_modified_{{cat.cat_id}}").click(function(){
       
    35               $("#delete_modified_{{cat.cat_id}}").slideToggle();
       
    36             });
       
    37           {% endfor %}
       
    38           {% for cat in created_cat_list %}
       
    39             $("#properties_created_{{cat.cat_id}}").hide();
       
    40             $("#info_button_created_{{cat.cat_id}}").click(function(){
       
    41               $("#properties_created_{{cat.cat_id}}").slideToggle();
       
    42             });
       
    43             $("#delete_created_{{cat.cat_id}}").hide();
       
    44             $("#remove_modifs_created_{{cat.cat_id}}").click(function(){
       
    45               $("#delete_created_{{cat.cat_id}}").slideToggle();
       
    46             });
       
    47           {% endfor %}
       
    48         });
       
    49       </script>
       
    50   </head>
       
    51   <body>
       
    52     <div class="navbar navbar-inverse" role="navigation">
       
    53         <div class="container">
       
    54           <div class="navbar-header">
       
    55             <a class="navbar-brand" href="{{ url_for('cat_recap') }}">
       
    56               <img alt="Brand" src="{{ url_for('static', filename='img/catedit_brand.png') }}" class="navbar-img" width="32" height="32">
       
    57             </a>
       
    58             <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
       
    59               <span class="sr-only">Toggle navigation</span>
       
    60               <span class="icon-bar"></span>
       
    61               <span class="icon-bar"></span>
       
    62               <span class="icon-bar"></span>
       
    63             </button>
       
    64           </div>
       
    65           <div class="collapse navbar-collapse">
       
    66             <ul class="nav navbar-nav">
       
    67               <li><a href="#">Page d'accueil</a></li>
       
    68               {% if session.get("user_logged", None) %}
       
    69               <li><a href="{{ url_for('cat_recap') }}">Vue d'ensemble</a></li>
       
    70               <li><a href="{{ url_for('cat_editor') }}">Créer une catégorie</a></li>
       
    71               <li class="active"><a>Mes modifications</a></li>
       
    72               {% endif %}
       
    73             </ul>
       
    74             <div class="navbar-text navbar-right">
       
    75               {% if not session.get("user_logged", None)%}Non authentifié - <a href="{{ url_for('github_login') }}" class="navbar-link">S'authentifier</a>
       
    76               {% else %} Authentifié: {{ session["user_login"] }} - <a href="{{ url_for('logout') }}" class="navbar-link">Quitter</a>{% endif %}
       
    77             </div>
       
    78           </div>
       
    79         </div>
       
    80     </div>
       
    81     <div class="container">
       
    82       <h2> Créer une catégorie <a href="{{url_for('cat_editor')}}" class="btn btn-default {% if readonly %}disabled{% endif %}"><span class="glyphicon glyphicon-plus"/></a></h2>
       
    83       <h2> Editer ou supprimer une catégorie </h2>
       
    84       <table class="table table-bordered table-condensed">
       
    85         <thead>
       
    86           <tr class="active">
       
    87             <th class="col-md-2"><b>Nom de la catégorie</b></th>
       
    88             <th class="col-md-10" colspan="2"><b>Description de la catégorie</b></th>
       
    89           </tr>
       
    90         </thead>
       
    91         <tbody>
       
    92         {% if not session["user_logged"] %}
       
    93         <tr>
       
    94           <td class="col-md-12" colspan="3">
       
    95             <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
       
    96             <span class="sr-only">Attention:</span>
       
    97             Veuillez vous identifier pour visualiser les catégories
       
    98           </td>
       
    99         </tr>
       
   100         {% else %}
       
   101           {% if cat_list|length == 0 %}
       
   102             <tr>
       
   103               <td class="col-md-12" colspan="3">Aucune catégorie n'a été créée pour l'instant. {% if not readonly %}<a href="{{ url_for('cat_editor') }}">Créer une catégorie</a>{% endif %}</td>
       
   104             </tr>
       
   105           {% else %}
       
   106             {% for cat in cat_list %}
       
   107               <tr>
       
   108                 <td class="col-md-2">{{ cat.cat_label }}</td>
       
   109                 <td class="col-md-8">{{ cat.cat_description}}</td>
       
   110                 <td class="col-md-2 text-center">
       
   111                   <button class="btn btn-default" id="info_button_{{ cat.cat_id }}"><span class="glyphicon glyphicon glyphicon-plus-sign"/></button>
       
   112                   {% if cat.cat_id not in deleted_cat_list %}
       
   113                   <a href="{{ url_for('cat_editor', cat_id=cat.cat_id)}}" class="btn btn-default"><span class="glyphicon glyphicon glyphicon-pencil"/></a>
       
   114                   <button class="btn btn-default" id="delete_button_{{cat.cat_id}}"><span class="glyphicon glyphicon-trash"/></a>
       
   115                   {% endif %}
       
   116                 </td>
       
   117               </tr>
       
   118                 <tr>
       
   119                   <td colspan="3">
       
   120                     <div id="properties_{{cat.cat_id}}">
       
   121                       <dl class="dl-horizontal">
       
   122                       {% if cat.cat_properties|length == 0 %} <dt></dt><dd>Aucune autre propriété</dd>
       
   123                       {% else %}
       
   124                         {% for (predicate, object) in cat.cat_properties %}
       
   125                           <dt>{{ config["PROPERTY_LIST"][predicate]["descriptive_label_fr"] }}</dt>
       
   126                           <dd>
       
   127                             {% if config["PROPERTY_LIST"][predicate]["object_type"]=="uriref-category" %}
       
   128                               {% for cat in cat_list %}
       
   129                                 {% if object == config["CATEGORY_NAMESPACE"]+cat.cat_id %}
       
   130                                   {{ cat.cat_label }}
       
   131                                 {% endif %}
       
   132                               {% endfor %}
       
   133                             {% elif config["PROPERTY_LIST"][predicate]["object_type"]=="uriref-link" %}
       
   134                               <a href="{{ object }}">{{ object }}</a>
       
   135                             {% else %}
       
   136                               {{ object }}
       
   137                             {% endif %}
       
   138                           </dd>
       
   139                         {% endfor %}
       
   140                       {% endif %}
       
   141                       </dl>
       
   142                     </div>
       
   143                     <div id="delete_cat_{{cat.cat_id}}">
       
   144                       <form method="POST" action="{{ url_for('cat_modifs', delete_cat_id=cat.cat_id) }}" class="form-inline align-center">
       
   145                         <fieldset {% if readonly %}disabled{% endif %}>
       
   146                           <div class="input-group">
       
   147                             <div class="input-group-addon">
       
   148                               Vous devrez soumettre les changements pour appliquer la suppression. Supprimer une catégorie édite automatiquement les autres catégories qui y font référence.
       
   149                             </div>
       
   150                             <input type="submit" class="btn btn-default" value="Supprimer">
       
   151                           </div>
       
   152                         </fieldset>
       
   153                       </form>
       
   154                     </div>
       
   155                   </td>
       
   156                 </tr>
       
   157             {% endfor %}
       
   158           {% endif %}
       
   159         {% endif %}
       
   160         </tbody>
       
   161       </table>
       
   162 
       
   163       <h2> Mes modifications </h2>
       
   164       <table class="table table-bordered table-condensed">
       
   165         <thead>
       
   166           <tr class="active">
       
   167             <th class="col-md-2"><b>Nom de la catégorie</b></th>
       
   168             <th class="col-md-10" colspan="2"><b>Description de la catégorie</b></th>
       
   169           </tr>
       
   170         </thead>
       
   171         <tbody>
       
   172         {% if not session["user_logged"] %}
       
   173         <tr>
       
   174           <td class="col-md-12" colspan="3">
       
   175             <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
       
   176             <span class="sr-only">Attention:</span>
       
   177             Veuillez vous identifier pour visualiser les modifications
       
   178           </td>
       
   179         </tr>
       
   180         {% else %}
       
   181           <tr class="success">
       
   182             <td class="col-md-12" colspan="3">
       
   183               <b> Catégories ajoutées</b>
       
   184             </td>
       
   185           </tr>
       
   186           {% if created_cat_list|length == 0 %}
       
   187             <tr>
       
   188               <td class="col-md-12" colspan="3">Aucune catégorie n'a été ajoutée pour l'instant.</td>
       
   189             </tr>
       
   190           {% else %}
       
   191             {% for cat in created_cat_list %}
       
   192               <tr class="success">
       
   193                 <td class="col-md-2">{{ cat.cat_label }}</td>
       
   194                 <td class="col-md-9">{{ cat.cat_description}}</td>
       
   195                 <td class="col-md-1 text-center">
       
   196                   <button class="btn btn-default" id="info_button_created_{{ cat.cat_id }}"><span class="glyphicon glyphicon-plus-sign"/></button>
       
   197                   <button class="btn btn-default" id="remove_modifs_created_{{ cat.cat_id }}"><span class="glyphicon glyphicon-remove-sign"/></button>
       
   198                 </td>
       
   199               </tr>
       
   200               <tr class="success">
       
   201                 <td colspan="3">
       
   202                   <div id="properties_created_{{cat.cat_id}}">
       
   203                     <dl class="dl-horizontal">
       
   204                     {% if cat.cat_properties|length == 0 %} <dt></dt><dd>Aucune autre propriété</dd>
       
   205                     {% else %}
       
   206                       {% for (predicate, object) in cat.cat_properties %}
       
   207                         <dt>{{ config["PROPERTY_LIST"][predicate]["descriptive_label_fr"] }}</dt>
       
   208                         <dd>
       
   209                           {% if config["PROPERTY_LIST"][predicate]["object_type"]=="uriref-category" %}
       
   210                             {% for cat in cat_list %}
       
   211                               {% if object == config["CATEGORY_NAMESPACE"]+cat.cat_id %}
       
   212                                 {{ cat.cat_label }}
       
   213                               {% endif %}
       
   214                             {% endfor %}
       
   215                           {% elif config["PROPERTY_LIST"][predicate]["object_type"]=="uriref-link" %}
       
   216                             <a href="{{ object }}">{{ object }}</a>
       
   217                           {% else %}
       
   218                             {{ object }}
       
   219                           {% endif %}
       
   220                         </dd>
       
   221                       {% endfor %}
       
   222                     {% endif %}
       
   223                     </dl>
       
   224                   </div>
       
   225                   <div id="delete_created_{{cat.cat_id}}">
       
   226                     <form method="POST" action="{{ url_for('cat_modifs', delete_modifs_id=cat.cat_id) }}" class="form-inline align-center">
       
   227                       <fieldset {% if readonly %}disabled{% endif %}>
       
   228                         <div class="input-group">
       
   229                           <div class="input-group-addon">
       
   230                             Vous allez supprimer les changements faits sur cette catégorie.
       
   231                           </div>
       
   232                           <input type="submit" class="btn btn-default" value="Supprimer">
       
   233                         </div>
       
   234                       </fieldset>
       
   235                     </form>
       
   236                   </div>
       
   237                 </td>
       
   238               </tr>
       
   239             {% endfor %}
       
   240           {% endif %}
       
   241           <tr class="warning">
       
   242             <td class="col-md-12" colspan="3">
       
   243               <b> Catégories modifiées</b>
       
   244             </td>
       
   245           </tr>
       
   246           {% if modified_cat_list|length == 0 %}
       
   247           <tr>
       
   248             <td class="col-md-12" colspan="3">Aucune catégorie n'a été modifiée pour l'instant.</td>
       
   249           </tr>
       
   250           {% else %}
       
   251             {% for cat in modified_cat_list %}
       
   252               <tr class="warning">
       
   253                 <td class="col-md-2">{{ cat.cat_label }}</td>
       
   254                 <td class="col-md-9">{{ cat.cat_description}}</td>
       
   255                 <td class="col-md-1 text-center">
       
   256                   <button class="btn btn-default" id="info_button_modified_{{ cat.cat_id }}"><span class="glyphicon glyphicon-plus-sign"/></button>
       
   257                   <button class="btn btn-default" id="remove_modifs_modified_{{ cat.cat_id }}"><span class="glyphicon glyphicon-remove-sign"/></button>
       
   258                 </td>
       
   259               </tr>
       
   260               <tr class="warning">
       
   261                 <td colspan="3">
       
   262                   <div id="properties_modified_{{cat.cat_id}}">
       
   263                     <dl class="dl-horizontal">
       
   264                     {% if cat.cat_properties|length == 0 %} <dt></dt><dd>Aucune autre propriété</dd>
       
   265                     {% else %}
       
   266                       {% for (predicate, object) in cat.cat_properties %}
       
   267                         <dt>{{ config["PROPERTY_LIST"][predicate]["descriptive_label_fr"] }}</dt>
       
   268                         <dd>
       
   269                           {% if config["PROPERTY_LIST"][predicate]["object_type"]=="uriref-category" %}
       
   270                             {% for cat in cat_list %}
       
   271                               {% if object == config["CATEGORY_NAMESPACE"]+cat.cat_id %}
       
   272                                 {{ cat.cat_label }}
       
   273                               {% endif %}
       
   274                             {% endfor %}
       
   275                           {% elif config["PROPERTY_LIST"][predicate]["object_type"]=="uriref-link" %}
       
   276                             <a href="{{ object }}">{{ object }}</a>
       
   277                           {% else %}
       
   278                             {{ object }}
       
   279                           {% endif %}
       
   280                         </dd>
       
   281                       {% endfor %}
       
   282                     {% endif %}
       
   283                     </dl>
       
   284                   </div>
       
   285                   <div id="delete_modified_{{cat.cat_id}}">
       
   286                     <form method="POST" action="{{ url_for('cat_modifs', delete_modifs_id=cat.cat_id) }}" class="form-inline align-center">
       
   287                       <fieldset {% if readonly %}disabled{% endif %}>
       
   288                         <div class="input-group">
       
   289                           <div class="input-group-addon">
       
   290                             Vous allez supprimer les changements faits sur cette catégorie.
       
   291                           </div>
       
   292                           <input type="submit" class="btn btn-default" value="Supprimer">
       
   293                         </div>
       
   294                       </fieldset>
       
   295                     </form>
       
   296                   </div>
       
   297                 </td>
       
   298               </tr>
       
   299             {% endfor %}
       
   300           {% endif %}
       
   301 
       
   302           <tr class="danger">
       
   303             <td class="col-md-12" colspan="3">
       
   304               <b> Catégories supprimées</b>
       
   305             </td>
       
   306           </tr>
       
   307           {% if deleted_cat_list|length == 0 %}
       
   308           <tr>
       
   309             <td class="col-md-12" colspan="3">Aucune catégorie n'a été supprimée pour l'instant.</td>
       
   310           </tr>
       
   311           {% else %}
       
   312             {% for deleted_cat in deleted_cat_list %}
       
   313               {% for existing_cat in cat_list %}
       
   314                 {% if existing_cat.cat_id == deleted_cat %}
       
   315                   <tr class="danger">
       
   316                     <td class="col-md-2">{{ existing_cat.cat_label }}</td>
       
   317                     <td class="col-md-9"><i>Cette catégorie va être supprimée quand vous soumettrez vos modifications.</i></td>
       
   318                     <td class="col-md-1 text-center">
       
   319                       <form method="POST" action="{{ url_for('cat_modifs', delete_cat_id=deleted_cat) }}">
       
   320                         <fieldset {% if readonly %}disabled{% endif %}>
       
   321                           <input type="submit" class="btn btn-default" value="Restaurer">
       
   322                         </fieldset>
       
   323                       </form>
       
   324                     </td>
       
   325                   </tr>
       
   326                 {% endif %}
       
   327               {% endfor %}
       
   328             {% endfor %}
       
   329           {% endif %}
       
   330         {% endif %}
       
   331         </tbody>
       
   332       </table>
       
   333       <h2> Soumettre mes changements </h2>
       
   334       <div class="col-md-12">
       
   335         <form method="POST" action="{{ url_for('cat_modifs')}}">
       
   336           <fieldset {% if readonly %}disabled{% endif %}>
       
   337             {{ commit_form.hidden_tag() }}
       
   338             <div class="form-group">
       
   339               {{ commit_form.commit_message.label }}
       
   340               {{ commit_form.commit_message(size=40, class="form-control", readonly=readonly) }}
       
   341             </div>
       
   342             <button type="submit" class="btn btn-default">Soumettre modifications</button>
       
   343           </fieldset>
       
   344         </form><br>
       
   345       </div>
       
   346     </div>
       
   347   </body>
       
   348 </html>