Suggest mount point name, don't reload custom javascript file
This commit is contained in:
parent
98c7d40fcd
commit
d3bdab286b
|
@ -1,4 +1,4 @@
|
||||||
OC.MountConfig={
|
OC.MountConfig={
|
||||||
saveStorage:function(tr) {
|
saveStorage:function(tr) {
|
||||||
var mountPoint = $(tr).find('.mountPoint input').val();
|
var mountPoint = $(tr).find('.mountPoint input').val();
|
||||||
if (mountPoint == '') {
|
if (mountPoint == '') {
|
||||||
|
@ -63,6 +63,7 @@ OC.MountConfig={
|
||||||
var applicable = OC.currentUser;
|
var applicable = OC.currentUser;
|
||||||
$.post(OC.filePath('files_external', 'ajax', 'addMountPoint.php'), { mountPoint: mountPoint, class: backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
|
$.post(OC.filePath('files_external', 'ajax', 'addMountPoint.php'), { mountPoint: mountPoint, class: backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,6 +78,10 @@ $(document).ready(function() {
|
||||||
var selected = $(this).find('option:selected').text();
|
var selected = $(this).find('option:selected').text();
|
||||||
var backendClass = $(this).val();
|
var backendClass = $(this).val();
|
||||||
$(this).parent().text(selected);
|
$(this).parent().text(selected);
|
||||||
|
if ($(tr).find('.mountPoint input').val() == '') {
|
||||||
|
$(tr).find('.mountPoint input').val(suggestMountPoint(selected.replace(/\s+/g, '')));
|
||||||
|
}
|
||||||
|
$(tr).addClass(backendClass);
|
||||||
$(tr).find('.backend').data('class', backendClass);
|
$(tr).find('.backend').data('class', backendClass);
|
||||||
var configurations = $(this).data('configurations');
|
var configurations = $(this).data('configurations');
|
||||||
var td = $(tr).find('td.configuration');
|
var td = $(tr).find('td.configuration');
|
||||||
|
@ -95,7 +100,7 @@ $(document).ready(function() {
|
||||||
td.append('<input type="text" data-parameter="'+parameter+'" placeholder="'+placeholder+'" />');
|
td.append('<input type="text" data-parameter="'+parameter+'" placeholder="'+placeholder+'" />');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (parameters['custom']) {
|
if (parameters['custom'] && $('#externalStorage tbody tr.'+backendClass).length == 1) {
|
||||||
OC.addScript('files_external', parameters['custom']);
|
OC.addScript('files_external', parameters['custom']);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -108,6 +113,28 @@ $(document).ready(function() {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function suggestMountPoint(defaultMountPoint) {
|
||||||
|
var i = 1;
|
||||||
|
var append = '';
|
||||||
|
var match = true;
|
||||||
|
while (match && i < 20) {
|
||||||
|
match = false;
|
||||||
|
$('#externalStorage tbody td.mountPoint input').each(function(index, mountPoint) {
|
||||||
|
if ($(mountPoint).val() == defaultMountPoint+append) {
|
||||||
|
match = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (match) {
|
||||||
|
append = i;
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return defaultMountPoint+append;
|
||||||
|
}
|
||||||
|
|
||||||
$('#externalStorage td').live('change', function() {
|
$('#externalStorage td').live('change', function() {
|
||||||
OC.MountConfig.saveStorage($(this).parent());
|
OC.MountConfig.saveStorage($(this).parent());
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue