sftpgo/templates/webadmin/sharedcomponents.html
Nicola Murino 21682d1c1d
add license header to source files
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
2022-07-17 20:16:00 +02:00

232 lines
No EOL
12 KiB
HTML

<!--
Copyright (C) 2019-2022 Nicola Murino
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
{{define "shared_user_group"}}
<script type="text/javascript">
$("body").on("click", ".add_new_dirperms_field_btn", function () {
var index = $(".form_field_dirperms_outer").find(".form_field_dirperms_outer_row").length;
while (document.getElementById("idSubDirPermsPath"+index) != null){
index++;
}
$(".form_field_dirperms_outer").append(`
<div class="row form_field_dirperms_outer_row">
<div class="form-group col-md-8">
<input type="text" class="form-control" id="idSubDirPermsPath${index}" name="sub_perm_path${index}" placeholder="directory path, i.e. /dir" value="" maxlength="255">
</div>
<div class="form-group col-md-3">
<select class="form-control" id="idSubDirPermissions${index}" name="sub_perm_permissions${index}" multiple>
</select>
</div>
<div class="form-group col-md-1">
<button class="btn btn-circle btn-danger remove_dirperms_btn_frm_field">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
`);
{{- range .ValidPerms}}
$("#idSubDirPermissions"+index).append($('<option>').val('{{.}}').text('{{.}}'));
{{- end}}
$("#idSubDirPermissions"+index).selectpicker();
});
$("body").on("click", ".remove_dirperms_btn_frm_field", function () {
$(this).closest(".form_field_dirperms_outer_row").remove();
});
$("body").on("click", ".add_new_vfolder_field_btn", function () {
var index = $(".form_field_vfolders_outer").find(".form_field_vfolder_outer_row").length;
while (document.getElementById("idVolderPath" + index) != null) {
index++;
}
$(".form_field_vfolders_outer").append(`
<div class="row form_field_vfolder_outer_row">
<div class="form-group col-md-3">
<input type="text" class="form-control" id="idVolderPath${index}" name="vfolder_path" placeholder="mount path, i.e. /vfolder" value="" maxlength="255">
</div>
<div class="form-group col-md-3">
<select class="form-control" id="idVfolderName${index}" name="vfolder_name">
<option value=""></option>
</select>
</div>
<div class="form-group col-md-3">
<input type="number" class="form-control" id="idVfolderQuotaSize${index}" name="vfolder_quota_size"
value="" min="-1" aria-describedby="vqsHelpBlock${index}">
<small id="vqsHelpBlock${index}" class="form-text text-muted">
Quota size (bytes)
</small>
</div>
<div class="form-group col-md-2">
<input type="number" class="form-control" id="idVfolderQuotaFiles${index}" name="vfolder_quota_files"
value="" min="-1" aria-describedby="vqfHelpBlock${index}">
<small id="vqfHelpBlock${index}" class="form-text text-muted">
Quota files
</small>
</div>
<div class="form-group col-md-1">
<button class="btn btn-circle btn-danger remove_vfolder_btn_frm_field">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
`);
{{- range .VirtualFolders}}
$("#idVfolderName"+index).append($('<option>').val('{{.Name}}').text('{{.Name}}'));
{{- end}}
$("#idVfolderName"+index).selectpicker({'liveSearch': true});
});
$("body").on("click", ".remove_vfolder_btn_frm_field", function () {
$(this).closest(".form_field_vfolder_outer_row").remove();
});
$("body").on("click", ".add_new_bwlimit_field_btn", function () {
var index = $(".form_field_bwlimits_outer").find(".form_field_bwlimits_outer_row").length;
while (document.getElementById("idBandwidthLimitSources"+index) != null){
index++;
}
$(".form_field_bwlimits_outer").append(`
<div class="row form_field_bwlimits_outer_row">
<div class="form-group col-md-8">
<textarea class="form-control" id="idBandwidthLimitSources0" name="bandwidth_limit_sources${index}" rows="4" placeholder=""
aria-describedby="bwLimitSourcesHelpBlock${index}"></textarea>
<small id="bwLimitSourcesHelpBlock${index}" class="form-text text-muted">
Comma separated IP/Mask in CIDR format, example: "192.168.1.0/24,10.8.0.100/32"
</small>
</div>
<div class="col-md-3">
<div class="form-group">
<input type="number" class="form-control" id="idUploadBandwidthSource${index}" name="upload_bandwidth_source${index}"
placeholder="" value="" min="0" aria-describedby="ulHelpBlock${index}">
<small id="ulHelpBlock${index}" class="form-text text-muted">
UL (KB/s). 0 means no limit
</small>
</div>
<div class="form-group">
<input type="number" class="form-control" id="idDownloadBandwidthSource${index}" name="download_bandwidth_source${index}"
placeholder="" value="" min="0" aria-describedby="dlHelpBlock${index}">
<small id="dlHelpBlock${index}" class="form-text text-muted">
DL (KB/s). 0 means no limit
</small>
</div>
</div>
<div class="form-group col-md-1">
<button class="btn btn-circle btn-danger remove_bwlimit_btn_frm_field">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
`);
});
$("body").on("click", ".remove_bwlimit_btn_frm_field", function () {
$(this).closest(".form_field_bwlimits_outer_row").remove();
});
$("body").on("click", ".add_new_dtlimit_field_btn", function () {
var index = $(".form_field_dtlimits_outer").find(".form_field_dtlimits_outer_row").length;
while (document.getElementById("idDataTransferLimitSources"+index) != null){
index++;
}
$(".form_field_dtlimits_outer").append(`
<div class="row form_field_dtlimits_outer_row">
<div class="form-group col-md-5">
<textarea class="form-control" id="idDataTransferLimitSources${index}" name="data_transfer_limit_sources${index}" rows="4" placeholder=""
aria-describedby="dtLimitSourcesHelpBlock${index}"></textarea>
<small id="dtLimitSourcesHelpBlock${index}" class="form-text text-muted">
Comma separated IP/Mask in CIDR format, example: "192.168.1.0/24,10.8.0.100/32"
</small>
</div>
<div class="col-md-3">
<div class="form-group">
<input type="number" class="form-control" id="idUploadTransferSource${index}" name="upload_data_transfer_source${index}"
placeholder="" value="" min="0" aria-describedby="ulDtHelpBlock${index}">
<small id="ulDtHelpBlock${index}" class="form-text text-muted">
UL (MB). 0 means no limit
</small>
</div>
<div class="form-group">
<input type="number" class="form-control" id="idDownloadTransferSource${index}" name="download_data_transfer_source${index}"
placeholder="" value="" min="0" aria-describedby="dlDtHelpBlock${index}">
<small id="dlDtHelpBlock${index}" class="form-text text-muted">
DL (MB). 0 means no limit
</small>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<input type="number" class="form-control" id="idTotalTransferSource${index}" name="total_data_transfer_source${index}"
placeholder="" value="" min="0" aria-describedby="totalDtHelpBlock${index}">
<small id="totalDtHelpBlock${index}" class="form-text text-muted">
Total (MB). 0 means no limit
</small>
</div>
</div>
<div class="form-group col-md-1">
<button class="btn btn-circle btn-danger remove_dtlimit_btn_frm_field">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
`);
});
$("body").on("click", ".remove_dtlimit_btn_frm_field", function () {
$(this).closest(".form_field_dtlimits_outer_row").remove();
});
$("body").on("click", ".add_new_pattern_field_btn", function () {
var index = $(".form_field_patterns_outer").find(".form_field_patterns_outer_row").length;
while (document.getElementById("idPatternPath"+index) != null){
index++;
}
$(".form_field_patterns_outer").append(`
<div class="row form_field_patterns_outer_row">
<div class="form-group col-md-3">
<input type="text" class="form-control" id="idPatternPath${index}" name="pattern_path${index}" placeholder="directory path, i.e. /dir" value="" maxlength="255">
</div>
<div class="form-group col-md-4">
<input type="text" class="form-control" id="idPatterns${index}" name="patterns${index}" placeholder="*.zip,?.txt" value="" maxlength="255">
</div>
<div class="form-group col-md-2">
<select class="form-control" id="idPatternType${index}" name="pattern_type${index}">
<option value="denied">Denied</option>
<option value="allowed">Allowed</option>
</select>
</div>
<div class="form-group col-md-2">
<select class="form-control" id="idPatternPolicy${index}" name="pattern_policy${index}">
<option value="0">Visible</option>
<option value="1">Hidden</option>
</select>
</div>
<div class="form-group col-md-1">
<button class="btn btn-circle btn-danger remove_pattern_btn_frm_field">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
`);
$("#idPatternType"+index).selectpicker();
$("#idPatternPolicy"+index).selectpicker();
});
$("body").on("click", ".remove_pattern_btn_frm_field", function () {
$(this).closest(".form_field_patterns_outer_row").remove();
});
</script>
{{end}}