mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-25 09:00:27 +00:00
parent
7d8823307f
commit
59bb578b89
1 changed files with 19 additions and 2 deletions
|
@ -124,6 +124,13 @@
|
||||||
<label for="rename_old_name" class="col-form-label">Old name</label>
|
<label for="rename_old_name" class="col-form-label">Old name</label>
|
||||||
<input type="text" class="form-control" id="rename_old_name" readonly>
|
<input type="text" class="form-control" id="rename_old_name" readonly>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="rename_new_dir" class="col-form-label">New base dir</label>
|
||||||
|
<input type="text" class="form-control" id="rename_new_dir" required aria-describedby="renameNewDirHelpBlock">
|
||||||
|
<small id="renameNewDirHelpBlock" class="form-text text-muted">
|
||||||
|
Setting a directory other than the current one will move the item there. This directory must exists
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="rename_new_name" class="col-form-label">New name</label>
|
<label for="rename_new_name" class="col-form-label">New name</label>
|
||||||
<input type="text" class="form-control" id="rename_new_name" required>
|
<input type="text" class="form-control" id="rename_new_name" required>
|
||||||
|
@ -736,14 +743,23 @@
|
||||||
var itemType = getTypeFromMeta(selected);
|
var itemType = getTypeFromMeta(selected);
|
||||||
var itemName = getNameFromMeta(selected);
|
var itemName = getNameFromMeta(selected);
|
||||||
var targetName = replaceSlash($("#rename_new_name").val());
|
var targetName = replaceSlash($("#rename_new_name").val());
|
||||||
|
var targetDir = $("#rename_new_dir").val();
|
||||||
|
if (targetDir != "/") {
|
||||||
|
targetDir = targetDir.endsWith('/') ? targetDir.slice(0, -1) : targetDir;
|
||||||
|
}
|
||||||
|
if (targetDir.trim() == ""){
|
||||||
|
targetDir = "{{.CurrentDir}}";
|
||||||
|
} else {
|
||||||
|
targetDir = encodeURIComponent(targetDir);
|
||||||
|
}
|
||||||
var path;
|
var path;
|
||||||
if (itemType == "1"){
|
if (itemType == "1"){
|
||||||
path = '{{.DirsURL}}';
|
path = '{{.DirsURL}}';
|
||||||
} else {
|
} else {
|
||||||
path = '{{.FilesURL}}';
|
path = '{{.FilesURL}}';
|
||||||
}
|
}
|
||||||
path+='?path={{.CurrentDir}}'+encodeURIComponent("/"+itemName)+'&target={{.CurrentDir}}'+encodeURIComponent("/"+targetName);
|
path+='?path={{.CurrentDir}}'+encodeURIComponent("/"+itemName)+'&target='+targetDir+encodeURIComponent("/"+targetName);
|
||||||
$('renameModal').modal('hide');
|
$('#renameModal').modal('hide');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: path,
|
url: path,
|
||||||
type: 'PATCH',
|
type: 'PATCH',
|
||||||
|
@ -833,6 +849,7 @@
|
||||||
var selected = table.column(0).checkboxes.selected()[0];
|
var selected = table.column(0).checkboxes.selected()[0];
|
||||||
var itemName = getNameFromMeta(selected);
|
var itemName = getNameFromMeta(selected);
|
||||||
$("#rename_old_name").val(itemName);
|
$("#rename_old_name").val(itemName);
|
||||||
|
$("#rename_new_dir").val(decodeURIComponent("{{.CurrentDir}}".replace(/\+/g, '%20')));
|
||||||
$("#rename_new_name").val("");
|
$("#rename_new_name").val("");
|
||||||
$('#renameModal').modal('show');
|
$('#renameModal').modal('show');
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue