Ver código fonte

new file: att/fixtures/causale.json
modified: documento/templates/documento.welcome.html
modified: documento/views.py
modified: static/templates/base.html
modified: utente/templates/utente.download.html
deleted: utente/templates/utente.edit.html~
deleted: utente/templates/utente.welcome.html~
modified: utente/views.py

Mauro 1 ano atrás
pai
commit
e14bc9eeba

+ 1 - 0
att/fixtures/causale.json

@@ -0,0 +1 @@
+[{"model": "att.causale", "pk": 1, "fields": {"nome": "Login", "schema": "{u}"}}, {"model": "att.causale", "pk": 2, "fields": {"nome": "Amministrazione", "schema": "{a}"}}, {"model": "att.causale", "pk": 3, "fields": {"nome": "Download", "schema": "Effettuato Download {documento.documento} da parte di {utente.nome}"}}, {"model": "att.causale", "pk": 4, "fields": {"nome": "Cancellazione Utente", "schema": "Rimozione di {u} da parte di {a}"}}, {"model": "att.causale", "pk": 5, "fields": {"nome": "Cancellazione Documento", "schema": "Rimozione documento {d} da parte di {a}"}}, {"model": "att.causale", "pk": 6, "fields": {"nome": "Aggiornamento Utente", "schema": "Aggiornato profilo {utente.id}:{utente.nome}"}}]

+ 2 - 2
documento/templates/documento.welcome.html

@@ -33,10 +33,10 @@
     <table class='table table-striped table-hover'>
       <thead class='thead-dark'>
       <tr>
+        <th scope='col'><input type='checkbox' class='form-check-input' value='0' name='selezione'></th>
         <th scope='col'>Vedi</th>
         <th scope='col'>Utente associato</th>
         <th scope='col'>Documento</th>
-        <th scope='col'>Storage</th>
         <th scope='col'>Descrizione</th>
         <th scope='col'>Inserimento</th>
         <th scope='col'>Cancella</th>
@@ -45,10 +45,10 @@
       <tbody>
         {% for documento in ElencoDocumentiPerAzienda %}
         <tr>
+          <td><input type='checkbox' class='form-check-input' value='{{ documento.id }}' name='selezione'></td>
           <td> <button type='button' class='btn btn-primary btn-block btn-lg mb-2 active' onclick="window.open('{% url "documento:finalize" documento.id documento.utente.id%}')">Vedi</button></td>
           <td> {{ documento.utente.nome }} </td>
           <td> {{ documento.documento }} </td>
-          <td> {{ documento.storage}} </td>
           <td> {{ uu.descrizione }} </td>
           <td> {{ documento.dataupload | date:'d/m/Y' }} </td>
           <td><button type='button' class='btn btn-secondary' data-bs-toggle='modal' data-bs-target='#ConfirmDeleteModal{{ documento.id }}' value='{{ documento.id }}'>Elimina</button></td>

+ 2 - 2
documento/views.py

@@ -88,7 +88,7 @@ def welcome(request):
         data['listaok'] = listaok
         data['listanotok'] = listanotok
 
-  ElencoDocumentiPerAzienda = Documento.objects.filter(azienda=azienda)
+  ElencoDocumentiPerAzienda = Documento.objects.filter(azienda=azienda).order_by("utente__nome")
   data['ElencoDocumentiPerAzienda'] = ElencoDocumentiPerAzienda
   print("Numero documenti associati",len(ElencoDocumentiPerAzienda))
 
@@ -148,6 +148,6 @@ def finalize_download(request,did,uid=None):
   print('fl',fl,mime_type)
   response = FileResponse(open(fl,'rb'),content_type='application/pdf',as_attachment=False)
   #response['Content-Disposition'] = "attachment; filename=%s" % documento.documento
-  setLog(causale=3,utente=utente,documento=documento,azienda=documento.azienda)
+  setNewLog(3,{'utente':utente,'documento':documento,'azienda':utente.azienda})
   return response
 

+ 5 - 7
static/templates/base.html

@@ -17,7 +17,7 @@
   {% endblock %}
 </head>
 
-<body style='padding-top:100px;'> <!-- occhio, che non prende css/style.css -->
+<body style='padding-top:50px;padding-bottom:20px;'>
 <nav class="navbar fixed-top navbar-expand-lg navbar-light bg-light">
 </nav>
 
@@ -90,10 +90,8 @@
 <div class='separator'></div>
 
 <div class='fixed-bottom'>
-      {% block bottom %}
-         <br><br>
-        <a href='http://marchioitalia.it'>Powered by MarchioItalia</a>
-        Icons made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon"> www.flaticon.com</a>
-      {% endblock %}
+  {% block bottom %}
+    <a href='http://marchioitalia.it'>Powered by MarchioItalia</a>
+       Icons made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon"> www.flaticon.com</a>
+  {% endblock %}
 </div>
-

+ 5 - 5
utente/templates/utente.download.html

@@ -83,11 +83,11 @@
     <div class='form-outline mb-3'>
       <label class='form-label' for='mail'>Mail</label>
       <input type='text' class='form-control' id='mail' name='mail' value='{{ utente.mail }}'>
-   </div>
-   <div>
-      <input type='submit' class="btn btn-secondary" value='Aggiorna'>
-      <input type='submit' class="btn btn-primary" name="ritorna" value="Logout">
-   </div>
+    </div>
+    <div>
+    <input type='submit' class="btn btn-secondary" name='aggiorna' value='Aggiorna'/>
+    <input type='submit' class="btn btn-primary" name="ritorna" value="Logout">
+    </div>
   </form>
 </div>
 

+ 0 - 63
utente/templates/utente.edit.html~

@@ -1,63 +0,0 @@
-{% extends 'base.html' %}
-
-{% block top %}
-    <div class='form-outline mb-4 text-center btn-primary h3'>
-           {{ HeaderTitle }}
-    </div>
-    <div class='form-outline mb-4 text-center btn-primary h3'>
-           Azienda in elaborazione: {{ azienda.nome }}
-    </div>
-    <div class='form-outline mb-4 text-center btn-primary h3'>
-           Amministratore: {{ admin.username }}
-    </div>
-{% endblock %}
-
-{% block body %}
-
-  {% if utente.errors %}
-    {% for field in utente %}
-        {% for error in field.errors %}
-            <div class="alert alert-danger">
-                <strong>{{ error|escape }}</strong>
-            </div>
-        {% endfor %}
-    {% endfor %}
-    {% for error in utente.non_field_errors %}
-        <div class="alert alert-danger">
-            <strong>{{ error|escape }}</strong>
-        </div>
-    {% endfor %}
-  {% else %}
-    Nessun Errore rilevato
-  {% endif %}
-
-  <form name='UserEdit' method='post' enctype='multipart/form-data'>
-    {% csrf_token %}
-    <div class='form-group'>
-      <label for="codicefiscale">Codice Fiscale</label>
-      <input type='text' class='form-control' name='codicefiscale' id='codicefiscale' value='{{ utente.codicefiscale.value }}'>
-
-      <label for="nome">Nome Cognome</label>
-      <input type='text' class='form-control form-control-lg' name='nome' id='nome' value='{{ utente.nome.value }}'>
-
-      <label for="luogonascita">Luogo di nascita</label>
-      <input type='text' class='form-control' name='luogonascita' id='luogonascita' value='{{ luogonascita.value }}'>
-
-      <label for="datanascita">Data di nascita</label>
-      <input type='text' class='form-control' name='datanascita' id='datanascita' value='{{ datanascita.value }}'>
-
-      <label for="email" class="form-control-label">Email</label>
-      <input type='email' class='form-control' name='email' id='email' value='{{ email.value }}'
-    </div>
-
-    <div class="form-check">
-     <input type="checkbox" class="form-check-input" name='CancellaUtente' id='CancellaUtente'>
-     <Label class="form-check-label" for='CancellaUtente'>Cancella Questo record!<label>
-    </div>
-
-    <div>
-      <input type='submit' class="btn btn-primary" value='Aggiorna'>
-    </td>
-  </form>
-{% endblock %}
-

+ 0 - 113
utente/templates/utente.welcome.html~

@@ -1,113 +0,0 @@
-{% extends 'base.html' %}
-
-{% block top %}
-    <div class='form-outline mb-4 text-center btn-primary h3'>
-           {{ HeaderTitle }}
-    </div>
-    <div clasS='form-outline mb-4 text-center btn-primary h3'>
-           Azienda in elaborazione: {{ azienda.nome }}
-    </div>
-    <div clasS='form-outline mb-4 text-center btn-primary h3'>
-           Amministratore: {{ admin.username }}
-    </div>
-{% endblock %}
-
-{% block body %}
-  <form name="inputUtente" method="POST">
-  {% csrf_token %}
-  <table class='table table-striped table-hover'>
-    <thead class='thead-dark'>
-      <tr>
-        <th scope='col'>Id</th>
-        <th scope='col'>Nome</th>
-        <th scope='col'>Codice Fiscale</th>
-        <th scope='col'>Data di Nascita</th>
-	<th scope='col'>Luogo di Nascita</th>
-	<th scope='col'>documenti</th>
-        <th scope='col'>Mail</th>
-	<th scope='col'>Password</th>
-      </tr>
-    </thead>
-    <tbody>
-      {% csrf_token %}
-      {% for uu in utenti %}
-        <tr>
-	  <td> <input type='submit' name='scelta' value='{{ uu.id }}'></td>
-          <td> {{ uu.nome }} </td>
-	  <td> {{ uu.codicefiscale }} </td>
-	  <td> {{ uu.datanascita|date:'d/m/Y' }} </td>
-	  <td> {{ uu.luogonascita }} </td>
-	  <td> {{ uu.documenti }} </td>
-          <td> {{ uu.mail }} </td>
-          <td> {{ uu.password }} </td>
-	</tr>
-      {% endfor %} 
-    </tbody>
-  </table>
-  </form>
-  <div class='form-control'>
-    <input type='submit' name='scelta' value='0'>
-    
-    <a href='documento:upload'>Upload Multipli</a>
-  </div>
-{% endblock %}
-
-{% block bodybottom %}
-  <div>
-	  &nbsp;
-  </div>
-  <br>
-  <form name='upload' method='post' enctype='multipart/form-data'>
-    {% csrf_token %}
-    <table class='table table-striped table-hover'>
-      <tbody>
-        <tr>
-         <form name='upload' method='post' enctype='multipart/form-data'>
-           {% csrf_token %}
-   
-           <td><input type='file' name='indice' id='indice' value='{{ uf.indice }}' accept='text/csv'></td>
-           <td><input type='file' name='allegati' id='allegati' value='{{ uf.allegati }}' accept='application/pdf' multiple></td>
-           <td><input type='submit' value='Inserisci'><td>
-         </form>
-         <td>
-           <button type='button' class='btn btn-secondary' name='umf'
-           data-toggle='modal' data-target='#UploadMultipleFile'>
-           Multi Upload</Button>
-         </td>
-                   	  
-        </tr>
-      </tbody>
-    </table>  
-    
-      	  <!-- modal -->
-	  <div class="modal fade" id="UploadMultipleFile" tabindex="-1" role="dialog"
-	  aria-labelledby="Upload Multi File" aria-hidden="true">
-            <div class="modal-dialog" role="document">
-              <div class="modal-content">
-                <form name='upload' method='post' enctype='multipart/form-data'>
-                {% csrf_token %}
- 
-                <div class="modal-header">
-                  <h5 class="modal-title"
-                  id="TitleUploadMultipleFile">Upload Multi File</h5>
-                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
-                    <span aria-hidden="true">&times;</span>
-                  </button>
-                </div>
-                <div class="modal-body">
-	          <td><input type='file' name='indice' id='indice' value='{{ uf.indice }}' accept='text/csv'></td>
-	          <td><input type='file' name='allegati' id='allegati' value='{{ uf.allegati }}' accept='application/pdf' multiple></td>
-	          <td><input type='submit' value='Inserisci'>
-                </div>
-                <div class="modal-footer">
-                  <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
-                  <button type="submit" class="btn btn-primary" name="upload"
-                  value="Inserisci">Inserisci</button>
-                </div>
-                </form>
-              </div>
-            </div>
-          </div>
-          <!-- end Modal -->
-{% endblock %}
-

+ 2 - 2
utente/views.py

@@ -205,8 +205,7 @@ def download(request):
     print("Non rilevo UserId in request.session")
     return HttpResponseRedirect(reverse("login:start"))
 
-  if 'UserId' in request.session:
-    data['UserId'] = request.session['UserId']
+  data['UserId'] = request.session['UserId']
 
   #filtro:
   # avendo il dato utente... vediamo come muoverci
@@ -236,6 +235,7 @@ def download(request):
       utente.mail = pinmail.cleaned_data['mail']
       utente.save()
       print('utente aggiornato',utente.id)
+      setNewLog(6,{'utente':utente})
 
   # verifica bonta' mail.
   regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b'