summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-13 17:09:37 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-13 17:10:58 -0400
commitd3bdab286b77c58bf8c1accfdb3946402ed9535a (patch)
tree96deb47358420413963eb994fed26b63ccf4719a /apps
parent98c7d40fcdebeffe3fa335c93df4c97c7fabf5d9 (diff)
downloadnextcloud-server-d3bdab286b77c58bf8c1accfdb3946402ed9535a.tar.gz
nextcloud-server-d3bdab286b77c58bf8c1accfdb3946402ed9535a.zip
Suggest mount point name, don't reload custom javascript file
Diffstat (limited to 'apps')
-rw-r--r--apps/files_external/js/settings.js31
1 files changed, 29 insertions, 2 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index 0d942e7845b..23f02bbefcb 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -1,4 +1,4 @@
-OC.MountConfig={
+OC.MountConfig={
saveStorage:function(tr) {
var mountPoint = $(tr).find('.mountPoint input').val();
if (mountPoint == '') {
@@ -63,6 +63,7 @@ OC.MountConfig={
var applicable = OC.currentUser;
$.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 backendClass = $(this).val();
$(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);
var configurations = $(this).data('configurations');
var td = $(tr).find('td.configuration');
@@ -95,7 +100,7 @@ $(document).ready(function() {
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']);
}
return false;
@@ -108,6 +113,28 @@ $(document).ready(function() {
$(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() {
OC.MountConfig.saveStorage($(this).parent());
});