quotawahnsinn
This commit is contained in:
parent
6977dc51f7
commit
80b3542a87
|
|
@ -102,9 +102,9 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -124,6 +124,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<!-- ADDING GROUP PERMS -->
|
<!-- ADDING GROUP PERMS -->
|
||||||
{% for aggroup in agencygroups %}
|
{% for aggroup in agencygroups %}
|
||||||
{% for p in aggroup.group.permissions.all %}
|
{% for p in aggroup.group.permissions.all %}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
{% load crispy_forms_tags %}
|
{% load crispy_forms_tags %}
|
||||||
<div class="row">
|
<div class="col-9">
|
||||||
<div class="col-6 mt-3">
|
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -13,26 +12,27 @@
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="form_type" value="agencymodform">
|
<input type="hidden" name="form_type" value="agencymodform">
|
||||||
<input type="hidden" name="settings_area" value="moduls">
|
<input type="hidden" name="settings_area" value="moduls">
|
||||||
{% for formfield in modulform %}
|
{% for formfield in modulform %}
|
||||||
{% if formfield.name == 'module_organigramm' or formfield.name == 'module_timemanagement' %}
|
{% if formfield.name == 'module_organigramm' or formfield.name == 'module_timemanagement' %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{formfield.label_tag}}</td>
|
<td>{{formfield.label_tag}}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if formfield.name == 'module_organigramm' and user.profile.agency.module_organigramm %}
|
{% if formfield.name == 'module_organigramm' and user.profile.agency.module_organigramm %}
|
||||||
<button type="button" class="btn btn-sm btn-primary" onclick="javascript:$('#modulesettings_{{formfield.name}}').modal('toggle');"><i class="fas fa-cog"></i></button>
|
<button type="button" class="btn btn-sm btn-primary" onclick="javascript:$('#modulesettings_{{formfield.name}}').modal('toggle');"><i class="fas fa-cog"></i></button>
|
||||||
{% elif formfield.name == 'module_timemanagement' and user.profile.agency.module_timemanagement %}
|
{% elif formfield.name == 'module_timemanagement' and user.profile.agency.module_timemanagement %}
|
||||||
<button type="button" class="btn btn-sm btn-primary" onclick="javascript:$('#modulesettings_{{formfield.name}}').modal('toggle');"><i class="fas fa-cog"></i></button>
|
<button type="button" class="btn btn-sm btn-primary" onclick="javascript:$('#modulesettings_{{formfield.name}}').modal('toggle');"><i class="fas fa-cog"></i></button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</form>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% for formfield in modulform %}
|
{% for formfield in modulform %}
|
||||||
|
|
||||||
<div class="modal fade" id="modulesettings_{{formfield.name}}" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="" aria-hidden="true">
|
<div class="modal fade" id="modulesettings_{{formfield.name}}" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="" aria-hidden="true">
|
||||||
<div class="modal-dialog modal-lg " role="document" >
|
<div class="modal-dialog modal-lg " role="document" >
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
|
@ -54,29 +54,26 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
Keine Einstellungen vorhanden.
|
Keine Einstellungen vorhanden.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
{% if formfield.name == 'module_organigramm' and user.profile.agency.module_organigramm %}
|
{% if formfield.name == 'module_organigramm' and user.profile.agency.module_organigramm %}
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
||||||
<button id="" type="button" onclick="javascript:updateOrganigrammSettings()" class="btn btn-primary" data-dismiss="modal" >Speichern</button>
|
<button id="" type="button" onclick="javascript:updateOrganigrammSettings()" class="btn btn-primary" data-dismiss="modal" >Speichern</button>
|
||||||
|
|
||||||
<button type="button" class="btn" data-dismiss="modal">Abbrechen</button>
|
<button type="button" class="btn" data-dismiss="modal">Abbrechen</button>
|
||||||
</div>
|
</div>
|
||||||
{% elif formfield.name == 'module_timemanagement' and user.profile.agency.module_timemanagement %}
|
{% elif formfield.name == 'module_timemanagement' and user.profile.agency.module_timemanagement %}
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
||||||
<button id="" type="button " onclick="javascript:updateTmSettings()" class="btn btn-primary" data-dismiss="modal" >Speichern</button>
|
<button id="" type="button " onclick="javascript:updateTmSettings()" class="btn btn-primary" data-dismiss="modal" >Speichern</button>
|
||||||
|
|
||||||
<button type="button" class="btn" data-dismiss="modal">Abbrechen</button>
|
<button type="button" class="btn" data-dismiss="modal">Abbrechen</button>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-primary" data-dismiss="modal">Schließen</button>
|
<button type="button" class="btn btn-primary" data-dismiss="modal">Schließen</button>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
{% load crispy_forms_tags %}
|
{% load crispy_forms_tags %}
|
||||||
<div class="col-6 mt-3">
|
|
||||||
|
<div class="col-9">
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Modul</th>
|
<th scope="col">Modul</th>
|
||||||
<th scope="col">Aktiviert</th>
|
|
||||||
<th scope="col">Einstellungen</th>
|
<th scope="col">Einstellungen</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
@ -13,23 +13,24 @@
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="form_type" value="agencymodform">
|
<input type="hidden" name="form_type" value="agencymodform">
|
||||||
<input type="hidden" name="settings_area" value="moduls">
|
<input type="hidden" name="settings_area" value="moduls">
|
||||||
{% for formfield in modulform %}
|
{% for formfield in modulform %}
|
||||||
<tr>
|
{% if formfield.name == 'module_organigramm' or formfield.name == 'module_timemanagement' %}
|
||||||
<td>{{formfield.label_tag}}</td>
|
<tr>
|
||||||
<td>{{formfield}}</td>
|
<td>{{formfield.label_tag}}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if formfield.name == 'module_organigramm' and user.profile.agency.module_organigramm %}
|
{% if formfield.name == 'module_organigramm' and user.profile.agency.module_organigramm %}
|
||||||
<button type="button" class="btn btn-sm btn-primary" onclick="javascript:$('#modulesettings_{{formfield.name}}').modal('toggle');"><i class="fas fa-cog"></i></button>
|
<button type="button" class="btn btn-sm btn-primary" onclick="javascript:$('#modulesettings_{{formfield.name}}').modal('toggle');"><i class="fas fa-cog"></i></button>
|
||||||
{% elif formfield.name == 'module_timemanagement' and user.profile.agency.module_timemanagement %}
|
{% elif formfield.name == 'module_timemanagement' and user.profile.agency.module_timemanagement %}
|
||||||
<button type="button" class="btn btn-sm btn-primary" onclick="javascript:$('#modulesettings_{{formfield.name}}').modal('toggle');"><i class="fas fa-cog"></i></button>
|
<button type="button" class="btn btn-sm btn-primary" onclick="javascript:$('#modulesettings_{{formfield.name}}').modal('toggle');"><i class="fas fa-cog"></i></button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</form>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<button type="submit" class="btn btn-primary" data-toggle="tooltip" data-placement="top" title="Mit dem Speichern wird die Seite neu geladen, damit alle Einstellungen aktualisiert werden. Werden Module deaktiviert, gehen die Einstellungen und zugewiesenen Rechte nicht verloren.">Moduleinstellungen aktualisieren</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% for formfield in modulform %}
|
{% for formfield in modulform %}
|
||||||
|
|
@ -79,4 +80,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
||||||
|
|
@ -393,13 +393,13 @@
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: "/dasettings/ajax",
|
url: "/dasettings/ajax",
|
||||||
data:{
|
data:{
|
||||||
action : "update_notifications",
|
//action : "update_notifications",
|
||||||
|
action : "",
|
||||||
fieldname : ele,
|
fieldname : ele,
|
||||||
new_stat : new_stat
|
new_stat : new_stat
|
||||||
},
|
},
|
||||||
success: function( data )
|
success: function( data )
|
||||||
{
|
{
|
||||||
console.log(data);
|
|
||||||
if(data['success']){
|
if(data['success']){
|
||||||
$('#notchange_done').toast('show');
|
$('#notchange_done').toast('show');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
{% load counter_tag %}
|
||||||
|
{% getAGGroupQuotaData request as agquota %}
|
||||||
|
|
||||||
|
<div class="progress mb-2">
|
||||||
|
<div class="progress-bar bg-success" role="progressbar" aria-valuenow="{{agquota.1}}" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
<div class="progress-bar bg-danger" role="progressbar" style="width: {{agquota.2}}%" aria-valuenow="{{agquota.2}}" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
{{agquota.1|filesizeformat}} / {{agquota.0|filesizeformat}}
|
||||||
|
</div>
|
||||||
|
<small>Sie können mehr Speicherplatz für die Agentur dazubuchen und anschließend jedem Mitarbeiter ein bestimmtes Speicherkontingent zuweisen. Der Speicherplatz wird dann vom Agenturspeicher abgezogen.</small>
|
||||||
|
<br /><br />
|
||||||
|
<table class="table hover" id="usertableall_quota">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Vorname</th>
|
||||||
|
<th scope="col">Nachname</th>
|
||||||
|
<th scope="col">Speicherplatz</th>
|
||||||
|
<th scope="col">Kontingent in MB</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="tableresults">
|
||||||
|
{% for item in usersofagency %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="{% url 'user_updateprofile' item.pk 0 %}">{{item.first_name }}</a></td>
|
||||||
|
<td><a href="{% url 'user_updateprofile' item.pk 0 %}">{{ item.last_name }}</a></td>
|
||||||
|
<td>
|
||||||
|
{% getUserQuotaData item as userquotadata %}
|
||||||
|
<div class="progress mb-2">
|
||||||
|
<div class="progress-bar bg-success" role="progressbar" aria-valuenow="{{userquotadata.1}}" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
<div class="progress-bar bg-danger" role="progressbar" style="width: {{userquotadata.2}}%" aria-valuenow="{{userquotadata.2}}" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
{{userquotadata.0|filesizeformat }} (davon {{userquotadata.1|filesizeformat }})
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if request.user.profile.agency.agencypackage > 0 %}
|
||||||
|
<input type="text" class="form-control userquotatextinput" value="{{userquotadata.3 }}" aria-describedby="" id="userquota_{{item.pk}}" style="max-width: 40%;">
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="form-group">
|
||||||
|
<button onclick="updateAGQuota()" class="btn btn-primary" id="savenewquota">Speicherplatzverteilung speichern</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var quotavalues = "agency_{{request.user.profile.agency.pk}}__2146274449_SEPERATOR_userquota_23__3324342";
|
||||||
|
// If we change it here, we have to change it on the server, too!
|
||||||
|
var seperator = "_SEPERATOR_";
|
||||||
|
|
||||||
|
function updateAGQuota(){
|
||||||
|
var quotavalues = "";
|
||||||
|
var allUserInputs = $(".userquotatextinput");
|
||||||
|
|
||||||
|
|
||||||
|
for(i = 0; i < allUserInputs.length; i++){
|
||||||
|
quotavalues = quotavalues + allUserInputs[i].id + "__" + allUserInputs[i].value + seperator;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(quotavalues);
|
||||||
|
$("#savenewquota").prop("disabled", true);
|
||||||
|
|
||||||
|
$.ajax(
|
||||||
|
{
|
||||||
|
type: "GET",
|
||||||
|
url: "/dasettings/ajax",
|
||||||
|
data:{
|
||||||
|
action : "quotaag_update",
|
||||||
|
quotavalues : quotavalues
|
||||||
|
},
|
||||||
|
success: function( data )
|
||||||
|
{
|
||||||
|
window.location = window.location;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set DataTable
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('#usertableall_quota').DataTable({
|
||||||
|
order: [3, 'desc'],
|
||||||
|
"language": {
|
||||||
|
"search" : "Suche",
|
||||||
|
"info": "Zeige _START_ bis _END_ von _TOTAL_ Einträgen",
|
||||||
|
"lengthMenu": "Zeige _MENU_ Einträge",
|
||||||
|
"zeroRecords": "Nichts gefunden",
|
||||||
|
"infoEmpty": "Keine Einträge",
|
||||||
|
"paginate": {
|
||||||
|
"first": "Erste",
|
||||||
|
"last": "Letzte",
|
||||||
|
"next": "Nächste",
|
||||||
|
"previous": "Zurück"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"pageLength": 20,
|
||||||
|
"buttons" : {
|
||||||
|
"className" : "btn-danger"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
@ -55,6 +55,11 @@
|
||||||
<a class="nav-link" id="calc-tab" data-toggle="tab" href="#calc" role="tab" aria-controls="calc" aria-selected="false"><i class="fas fa-coins"></i> Abrechnung</a>
|
<a class="nav-link" id="calc-tab" data-toggle="tab" href="#calc" role="tab" aria-controls="calc" aria-selected="false"><i class="fas fa-coins"></i> Abrechnung</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if user|usergperm:"agencyinfo" %}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="quota-tab" data-toggle="tab" href="#quota" role="tab" aria-controls="quota" aria-selected="false"><i class="fas fa-database"></i> Speicherplatz</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
{% if user|usergperm:"agencynetwork" %}
|
{% if user|usergperm:"agencynetwork" %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" id="agencynetwork-tab" data-toggle="tab" href="#agencynetwork" role="tab" aria-controls="agencynetwork" aria-selected="false"><i class="fas fa-project-diagram"></i> Agenturverbund</a>
|
<a class="nav-link" id="agencynetwork-tab" data-toggle="tab" href="#agencynetwork" role="tab" aria-controls="agencynetwork" aria-selected="false"><i class="fas fa-project-diagram"></i> Agenturverbund</a>
|
||||||
|
|
@ -77,7 +82,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if user|usergperm:"modulesconfig" %}
|
{% if user|usergperm:"modulesconfig" %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" id="moduls-tab" data-toggle="tab" href="#moduls" role="tab" aria-controls="moduls" aria-selected="false"><i class="fas fa-sliders-h"></i> Module</a>
|
<a class="nav-link" id="moduleconfig-tab" data-toggle="tab" href="#moduleconfig" role="tab" aria-controls="moduleconfig" aria-selected="false"><i class="fas fa-sliders-h"></i> Module</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -93,6 +98,16 @@
|
||||||
endblock
|
endblock
|
||||||
</div>
|
</div>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
{% if user|usergperm:"modulesconfig" %}
|
||||||
|
<div class="tab-pane fade" id="moduleconfig" role="tabpanel" aria-labelledby="moduleconfig-tab">
|
||||||
|
<h5 class="mt-3">Module{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Hier werden Module aktiviert oder deaktiviert sowie individuelle Einstellungen der Module gemacht. Wird ein Modul deaktiviert, gehen Einstellungen und Dateien nicht verloren." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||||
|
{% block moduls_content %}
|
||||||
|
{% include "dasettings/moduls_content.html" %}
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="tab-pane fade" id="notifications" role="tabpanel" aria-labelledby="notifications-tab">
|
<div class="tab-pane fade" id="notifications" role="tabpanel" aria-labelledby="notifications-tab">
|
||||||
<h5 class="mt-3">Benachrichtigungen{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Stellen Sie hier ein, welche Art der Benachrichtigung (E-Mail oder Push) Sie für welches Ereignis (Gruppenzuweisungen, Veröffentlichung eines Standards, neue Agenturnews usw.) erhalten möchten." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
<h5 class="mt-3">Benachrichtigungen{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Stellen Sie hier ein, welche Art der Benachrichtigung (E-Mail oder Push) Sie für welches Ereignis (Gruppenzuweisungen, Veröffentlichung eines Standards, neue Agenturnews usw.) erhalten möchten." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||||
|
|
||||||
|
|
@ -120,6 +135,15 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if user|usergperm:"agencyinfo" %}
|
||||||
|
<div class="tab-pane fade" id="quota" role="tabpanel" aria-labelledby="quota-tab">
|
||||||
|
<h5 class="mt-3">Speicherplatz{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Hier können Sie den aktuellen Speicherplatz zuweisen und bearbeiten." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||||
|
<hr>
|
||||||
|
{% block quota_content %}
|
||||||
|
{% include "dasettings/quota_content.html" %}
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% if user|usergperm:"agencynetwork" %}
|
{% if user|usergperm:"agencynetwork" %}
|
||||||
<div class="tab-pane fade" id="agencynetwork" role="tabpanel" aria-labelledby="agencynetwork-tab">
|
<div class="tab-pane fade" id="agencynetwork" role="tabpanel" aria-labelledby="agencynetwork-tab">
|
||||||
<h5 class="mt-3">Agenturverbünde{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Verwalten Sie hier Ihre eigenen Agenturverbünde und in welchen Sie Mitglied sind." class="far fa-question-circle"></i></small>{% endif %}
|
<h5 class="mt-3">Agenturverbünde{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Verwalten Sie hier Ihre eigenen Agenturverbünde und in welchen Sie Mitglied sind." class="far fa-question-circle"></i></small>{% endif %}
|
||||||
|
|
@ -163,14 +187,6 @@
|
||||||
{% include "dasettings/groups_content.html" %}
|
{% include "dasettings/groups_content.html" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
{% if user|usergperm:"modulesconfig" %}
|
|
||||||
<div class="tab-pane fade" id="moduls" role="tabpanel" aria-labelledby="moduls-tab">
|
|
||||||
<h5 class="mt-3">Module{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Hier werden Module aktiviert oder deaktiviert sowie individuelle Einstellungen der Module gemacht. Wird ein Modul deaktiviert, gehen Einstellungen und Dateien nicht verloren." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
|
||||||
{% block moduls_content %}
|
|
||||||
{% include "dasettings/moduls_content.html" %}
|
|
||||||
{% endblock %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -179,6 +195,7 @@
|
||||||
var defaultsettingsview = "notifications";
|
var defaultsettingsview = "notifications";
|
||||||
/* COOKIE FOR SAVING OPEN TAB */
|
/* COOKIE FOR SAVING OPEN TAB */
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
$(".toast").hide();
|
||||||
|
|
||||||
$(".toast").toast({
|
$(".toast").toast({
|
||||||
autohide: true,
|
autohide: true,
|
||||||
|
|
|
||||||
|
|
@ -624,6 +624,75 @@ def SettingsAjaxRouter(request):
|
||||||
setattr(request.user.usernotifications, request.GET['fieldname'], False)
|
setattr(request.user.usernotifications, request.GET['fieldname'], False)
|
||||||
request.user.usernotifications.save()
|
request.user.usernotifications.save()
|
||||||
success = True
|
success = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# QUOTA
|
||||||
|
elif request.method == 'GET' and request.GET['action'] == "quotaag_update" :
|
||||||
|
success = False
|
||||||
|
quotavalues = request.GET['quotavalues']
|
||||||
|
|
||||||
|
quotavalues_array = quotavalues.split("_SEPERATOR_")
|
||||||
|
|
||||||
|
newsumquota = 0
|
||||||
|
|
||||||
|
for newquotavalue in quotavalues_array:
|
||||||
|
ele = newquotavalue.split("__")
|
||||||
|
|
||||||
|
if("user" in ele[0]):
|
||||||
|
newsumquota += int(ele[1])
|
||||||
|
|
||||||
|
# CONVERTING MAX MB TO BYTES
|
||||||
|
newsumquota = newsumquota*1024
|
||||||
|
newsumquota = newsumquota*1024
|
||||||
|
|
||||||
|
# GETTING POSSIBLE BYTES FROM AGENCY
|
||||||
|
r = requests.request("PROPFIND", settings.NEXTCLOUD_URL + "remote.php/dav/files/" + request.user.username + "/Agenturdaten", headers={'Content-Type' : 'text/xml', 'Authorization' : "Bearer " + request.user.profile.nc_sid})
|
||||||
|
|
||||||
|
split_response = r.text.split("<d:quota-used-bytes>")
|
||||||
|
inuse = split_response[1].split("</d:quota-used-bytes>")[0]
|
||||||
|
|
||||||
|
# QUOTA
|
||||||
|
split_response = r.text.split("<d:quota-available-bytes>")
|
||||||
|
quota = split_response[1].split("</d:quota-available-bytes>")[0]
|
||||||
|
|
||||||
|
# TODO: Hier wird ja jedesmal die Agenturquota reduziert, dass ist natürlich doof!
|
||||||
|
|
||||||
|
# Check if needed Quota is bigger than inuse
|
||||||
|
newagencyquota = int(quota) - int(newsumquota)
|
||||||
|
if( newagencyquota > int(inuse) ):
|
||||||
|
for newquotavalue in quotavalues_array:
|
||||||
|
ele = newquotavalue.split("__")
|
||||||
|
if("user" in ele[0]):
|
||||||
|
userid = ele[0].split("_")[1]
|
||||||
|
userquota = int(ele[1])*1024
|
||||||
|
userquota = userquota*1024
|
||||||
|
headers = {
|
||||||
|
'Accept' : 'application/json',
|
||||||
|
'Access-Control-Allow-Headers' : 'OCS-APIRequest',
|
||||||
|
'OCS-APIRequest' : 'true'
|
||||||
|
}
|
||||||
|
data_nc = {
|
||||||
|
"key" : "quota",
|
||||||
|
"value" : userquota
|
||||||
|
}
|
||||||
|
r = requests.put(settings.NEXTCLOUD_URL + "/ocs/v1.php/cloud/users/" + User.objects.get(pk=userid).username,headers=headers, auth=(settings.NEXTCLOUD_USER_API, settings.NEXTCLOUD_PW_API), data=data_nc)
|
||||||
|
|
||||||
|
# Updating the AgencyQuota
|
||||||
|
data = {
|
||||||
|
"quota" : newagencyquota,
|
||||||
|
"user" : request.user.username
|
||||||
|
}
|
||||||
|
|
||||||
|
r = requests.post(settings.NEXTCLOUD_URL + "ocs/v2.php/apps/da_agency/api/v1/updategfquota?format=json", auth=(settings.NEXTCLOUD_USER_API, settings.NEXTCLOUD_PW_API), data=data)
|
||||||
|
|
||||||
|
ag = request.user.profile.agency
|
||||||
|
ag.agencyquota = newagencyquota
|
||||||
|
ag.save()
|
||||||
|
success = True
|
||||||
|
|
||||||
# UPDATE TOOLTUP
|
# UPDATE TOOLTUP
|
||||||
elif request.method == 'GET' and request.GET['action'] == "change_showtooltips" :
|
elif request.method == 'GET' and request.GET['action'] == "change_showtooltips" :
|
||||||
newtooltipvalue = False
|
newtooltipvalue = False
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1177,3 +1177,42 @@ def getNCDirInfosURL(request, ncid):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
# QUOTA
|
||||||
|
@register.simple_tag
|
||||||
|
def getAGGroupQuotaData(request):
|
||||||
|
r = requests.request("PROPFIND", settings.NEXTCLOUD_URL + "remote.php/dav/files/" + request.user.username + "/Agenturdaten", headers={'Content-Type' : 'text/xml', 'Authorization' : "Bearer " + request.user.profile.nc_sid})
|
||||||
|
|
||||||
|
# IN USE
|
||||||
|
split_response = r.text.split("<d:quota-used-bytes>")
|
||||||
|
inuse = split_response[1].split("</d:quota-used-bytes>")[0]
|
||||||
|
|
||||||
|
# QUOTA
|
||||||
|
split_response = r.text.split("<d:quota-available-bytes>")
|
||||||
|
quota = split_response[1].split("</d:quota-available-bytes>")[0]
|
||||||
|
|
||||||
|
# PERCENT VALUE
|
||||||
|
percent = (100 / int(quota))*int(inuse)
|
||||||
|
|
||||||
|
return [quota, inuse, str(round(percent, 0)).replace(",", ".")]
|
||||||
|
|
||||||
|
# User QUOTA
|
||||||
|
import re, math
|
||||||
|
@register.simple_tag
|
||||||
|
def getUserQuotaData(userdata):
|
||||||
|
r = requests.request("GET", settings.NEXTCLOUD_URL + "/ocs/v1.php/cloud/users/" + userdata.username, auth=(settings.NEXTCLOUD_USER_API, settings.NEXTCLOUD_PW_API), headers={'Content-Type' : 'text/xml', 'OCS-APIRequest': "true"})
|
||||||
|
|
||||||
|
quotadata = [int(s) for s in re.findall('<quota>(.+?)</quota>', r.text)]
|
||||||
|
inuse = [int(s) for s in re.findall('<used>(.+?)</used>', r.text)]
|
||||||
|
|
||||||
|
i = int(math.floor(math.log(quotadata[0], 1024)))
|
||||||
|
p = math.pow(1024, i)
|
||||||
|
# s for textlabel
|
||||||
|
s = round(quotadata[0] / p, 2)
|
||||||
|
|
||||||
|
# PERCENT
|
||||||
|
percent = (100 / int(quotadata[0]))*int(inuse[0])
|
||||||
|
|
||||||
|
# TODO: Hier werden GB nicht korrekt umgerechnet in MB
|
||||||
|
|
||||||
|
return [quotadata[0], inuse[0], str(round(percent, 0)).replace(",", "."), str(s).split(".")[0]]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,11 @@ class Agency(models.Model):
|
||||||
# RECOVERDIR
|
# RECOVERDIR
|
||||||
module_recoverdir = models.BooleanField(default=False)
|
module_recoverdir = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
# QUOTA
|
||||||
|
agencyquota = models.BigIntegerField(default=2146274449)
|
||||||
|
agencypackage = models.IntegerField(default=0)
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'{self.name}'
|
return f'{self.name}'
|
||||||
|
|
||||||
|
|
@ -260,6 +265,8 @@ class Profile(models.Model):
|
||||||
user_messages_mail = models.BooleanField(default=True)
|
user_messages_mail = models.BooleanField(default=True)
|
||||||
user_messages_push = models.BooleanField(default=True)
|
user_messages_push = models.BooleanField(default=True)
|
||||||
|
|
||||||
|
userquota = models.BigIntegerField(default=104857600)
|
||||||
|
|
||||||
# ONLINESTATUS
|
# ONLINESTATUS
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue