From 0dbf1d02600ef4075ceffe9c62c1ed32cc24592f Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Mon, 24 Dec 2012 13:45:52 -0500 Subject: Show status icons for mount points in external storage UI --- apps/files_external/js/settings.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'apps/files_external/js/settings.js') diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 0dc983ca8ad..eb74dd487f7 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -4,6 +4,7 @@ OC.MountConfig={ if (mountPoint == '') { return false; } + var statusSpan = $(tr).find('.status span'); var backendClass = $(tr).find('.backend').data('class'); var configuration = $(tr).find('.configuration input'); var addMountPoint = true; @@ -27,6 +28,7 @@ OC.MountConfig={ } }); if (addMountPoint) { + var status = false; if ($('#externalStorage').data('admin') === true) { var isPersonal = false; var multiselect = $(tr).find('.chzn-select').val(); @@ -47,7 +49,14 @@ OC.MountConfig={ oldUsers.splice($.inArray(applicable, oldUsers), 1); } } - $.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 }, function(result) { + statusSpan.removeClass(); + if (result && result.status == 'success' && result.data.message) { + statusSpan.addClass('success'); + } else { + statusSpan.addClass('error'); + } + }); }); var mountType = 'group'; $.each(oldGroups, function(index, applicable) { @@ -61,7 +70,14 @@ OC.MountConfig={ var isPersonal = true; var mountType = 'user'; 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 }, function(result) { + statusSpan.removeClass(); + if (result && result.status == 'success' && result.data.message) { + statusSpan.addClass('success'); + } else { + statusSpan.addClass('error'); + } + }); } return true; } @@ -82,6 +98,7 @@ $(document).ready(function() { $(tr).find('.mountPoint input').val(suggestMountPoint(selected.replace(/\s+/g, ''))); } $(tr).addClass(backendClass); + $(tr).find('.status').append(''); $(tr).find('.backend').data('class', backendClass); var configurations = $(this).data('configurations'); var td = $(tr).find('td.configuration'); -- cgit v1.2.3 From a0e47a2c67f0fe5ff3ed07174e0922dae67707dc Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Mon, 24 Dec 2012 13:55:37 -0500 Subject: Prevent javascript error if no value is set for the multiselect --- apps/files_external/js/settings.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'apps/files_external/js/settings.js') diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index eb74dd487f7..a3abcfebb8b 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -27,11 +27,16 @@ OC.MountConfig={ classOptions[$(input).data('parameter')] = $(input).val(); } }); + if ($('#externalStorage').data('admin') === true) { + var multiselect = $(tr).find('.chzn-select').val(); + if (multiselect == null) { + return false; + } + } if (addMountPoint) { var status = false; if ($('#externalStorage').data('admin') === true) { var isPersonal = false; - var multiselect = $(tr).find('.chzn-select').val(); var oldGroups = $(tr).find('.applicable').data('applicable-groups'); var oldUsers = $(tr).find('.applicable').data('applicable-users'); $.each(multiselect, function(index, value) { -- cgit v1.2.3 From 30a07e95737e3bed7be1d418c49fa9b60e160e7b Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Wed, 26 Dec 2012 13:35:22 -0500 Subject: Save configuration after paste events and 2 seconds after typing --- apps/files_external/js/settings.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'apps/files_external/js/settings.js') diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index a3abcfebb8b..f2a08ed6dfb 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -157,8 +157,23 @@ $(document).ready(function() { return defaultMountPoint+append; } - $('#externalStorage td').live('change', function() { - OC.MountConfig.saveStorage($(this).parent()); + $('#externalStorage td').live('paste', function() { + var tr = $(this).parent(); + setTimeout(function() { + OC.MountConfig.saveStorage(tr); + }, 20); + }); + + var timer; + + $('#externalStorage td').live('keyup', function() { + clearTimeout(timer); + var tr = $(this).parent(); + if ($(this).val) { + timer = setTimeout(function() { + OC.MountConfig.saveStorage(tr); + }, 2000); + } }); $('td.remove>img').live('click', function() { -- cgit v1.2.3 From 595e72ade8906346c9de8500685f5968d67afd2f Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Fri, 28 Dec 2012 15:56:48 -0500 Subject: Fix some of the default mount points creating sub folders i.e. SMB / CIFS, ownCloud / WebDAV --- apps/files_external/js/settings.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'apps/files_external/js/settings.js') diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index f2a08ed6dfb..182c427e180 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -100,7 +100,7 @@ $(document).ready(function() { 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).find('.mountPoint input').val(suggestMountPoint(selected)); } $(tr).addClass(backendClass); $(tr).find('.status').append(''); @@ -136,6 +136,11 @@ $(document).ready(function() { }); function suggestMountPoint(defaultMountPoint) { + var pos = defaultMountPoint.indexOf('/'); + if (pos !== -1) { + defaultMountPoint = defaultMountPoint.substring(0, pos); + } + defaultMountPoint = defaultMountPoint.replace(/\s+/g, ''); var i = 1; var append = ''; var match = true; -- cgit v1.2.3 From 442a045ef605f63c1fed3868ef9ddad28c33409b Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Fri, 28 Dec 2012 17:38:24 -0500 Subject: Fix problems with chosen multiselect --- apps/files_external/js/settings.js | 46 +++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 15 deletions(-) (limited to 'apps/files_external/js/settings.js') diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 182c427e180..25f6ed57984 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -39,6 +39,8 @@ OC.MountConfig={ var isPersonal = false; var oldGroups = $(tr).find('.applicable').data('applicable-groups'); var oldUsers = $(tr).find('.applicable').data('applicable-users'); + var groups = []; + var users = []; $.each(multiselect, function(index, value) { var pos = value.indexOf('(group)'); if (pos != -1) { @@ -47,12 +49,14 @@ OC.MountConfig={ if ($.inArray(applicable, oldGroups) != -1) { oldGroups.splice($.inArray(applicable, oldGroups), 1); } + groups.push(applicable); } else { var mountType = 'user'; var applicable = value; if ($.inArray(applicable, oldUsers) != -1) { oldUsers.splice($.inArray(applicable, oldUsers), 1); } + users.push(applicable); } $.post(OC.filePath('files_external', 'ajax', 'addMountPoint.php'), { mountPoint: mountPoint, class: backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, isPersonal: isPersonal }, function(result) { statusSpan.removeClass(); @@ -63,6 +67,8 @@ OC.MountConfig={ } }); }); + $(tr).find('.applicable').data('applicable-groups', groups); + $(tr).find('.applicable').data('applicable-users', users); var mountType = 'group'; $.each(oldGroups, function(index, applicable) { $.post(OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), { mountPoint: mountPoint, mountType: mountType, applicable: applicable, isPersonal: isPersonal }); @@ -128,7 +134,11 @@ $(document).ready(function() { return false; } }); - $('.chz-select').chosen(); + // Reset chosen + var chosen = $(tr).find('.applicable select'); + chosen.parent().find('div').remove(); + chosen.removeAttr('id').removeClass('chzn-done').css({display:'inline-block'}); + chosen.chosen(); $(tr).find('td').last().attr('class', 'remove'); $(tr).find('td').last().removeAttr('style'); $(tr).removeAttr('id'); @@ -171,9 +181,9 @@ $(document).ready(function() { var timer; - $('#externalStorage td').live('keyup', function() { + $('#externalStorage td input').live('keyup', function() { clearTimeout(timer); - var tr = $(this).parent(); + var tr = $(this).parent().parent(); if ($(this).val) { timer = setTimeout(function() { OC.MountConfig.saveStorage(tr); @@ -181,6 +191,10 @@ $(document).ready(function() { } }); + $('.applicable .chzn-select').live('change', function() { + OC.MountConfig.saveStorage($(this).parent().parent()); + }); + $('td.remove>img').live('click', function() { var tr = $(this).parent().parent(); var mountPoint = $(tr).find('.mountPoint input').val(); @@ -193,23 +207,25 @@ $(document).ready(function() { if ($('#externalStorage').data('admin') === true) { var isPersonal = false; var multiselect = $(tr).find('.chzn-select').val(); - $.each(multiselect, function(index, value) { - var pos = value.indexOf('(group)'); - if (pos != -1) { - var mountType = 'group'; - var applicable = value.substr(0, pos); - } else { - var mountType = 'user'; - var applicable = value; - } - $.post(OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), { mountPoint: mountPoint, mountType: mountType, applicable: applicable, isPersonal: isPersonal }); - }); + if (multiselect != null) { + $.each(multiselect, function(index, value) { + var pos = value.indexOf('(group)'); + if (pos != -1) { + var mountType = 'group'; + var applicable = value.substr(0, pos); + } else { + var mountType = 'user'; + var applicable = value; + } + $.post(OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), { mountPoint: mountPoint, mountType: mountType, applicable: applicable, isPersonal: isPersonal }); + }); + } } else { var mountType = 'user'; var applicable = OC.currentUser; var isPersonal = true; + $.post(OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), { mountPoint: mountPoint, mountType: mountType, applicable: applicable, isPersonal: isPersonal }); } - $.post(OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), { mountPoint: mountPoint, mountType: mountType, applicable: applicable, isPersonal: isPersonal }); $(tr).remove(); }); -- cgit v1.2.3 From a69de3a8f1dd3ef9a17b0f65b7058681eebb6145 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Tue, 1 Jan 2013 16:19:40 -0500 Subject: Turn off async for saving mount points, improve input detection for Google and Dropbox 'Grant Access' buttons --- apps/files_external/js/dropbox.js | 49 +++++++++++++----------- apps/files_external/js/google.js | 67 ++++++++++++++++---------------- apps/files_external/js/settings.js | 78 ++++++++++++++++++++++++++++++-------- 3 files changed, 123 insertions(+), 71 deletions(-) (limited to 'apps/files_external/js/settings.js') diff --git a/apps/files_external/js/dropbox.js b/apps/files_external/js/dropbox.js index 247d6bb8bb6..92a92467c79 100644 --- a/apps/files_external/js/dropbox.js +++ b/apps/files_external/js/dropbox.js @@ -24,14 +24,12 @@ $(document).ready(function() { $(tr).find('.configuration input').attr('disabled', 'disabled'); $(tr).find('.configuration').append(''+t('files_external', 'Access granted')+''); } else { - OC.dialogs.alert(result.data.message, - t('files_external', 'Error configuring Dropbox storage') - ); + OC.dialogs.alert(result.data.message, t('files_external', 'Error configuring Dropbox storage')); } }); } - } else if ($(this).find('.mountPoint input').val() != '' && $(config).find('[data-parameter="app_key"]').val() != '' && $(config).find('[data-parameter="app_secret"]').val() != '' && $(this).find('.dropbox').length == 0) { - $(this).find('.configuration').append(''+t('files_external', 'Grant access')+''); + } else { + onDropboxInputsChange($(this)); } } }); @@ -39,18 +37,27 @@ $(document).ready(function() { $('#externalStorage tbody tr.OC_Filestorage_Dropbox td').live('paste', function() { var tr = $(this).parent(); setTimeout(function() { - showButton(tr); + onDropboxInputsChange(tr); }, 20); }); $('#externalStorage tbody tr.OC_Filestorage_Dropbox td').live('keyup', function() { - showButton($(this).parent()); + onDropboxInputsChange($(this).parent()); }); - function showButton(tr) { + $('#externalStorage tbody tr.OC_Filestorage_Dropbox .chzn-select').live('change', function() { + onDropboxInputsChange($(this).parent().parent()); + }); + + function onDropboxInputsChange(tr) { if ($(tr).find('[data-parameter="configured"]').val() != 'true') { var config = $(tr).find('.configuration'); - if ($(tr).find('.mountPoint input').val() != '' && $(config).find('[data-parameter="app_key"]').val() != '' && $(config).find('[data-parameter="app_secret"]').val() != '') { + if ($(tr).find('.mountPoint input').val() != '' + && $(config).find('[data-parameter="app_key"]').val() != '' + && $(config).find('[data-parameter="app_secret"]').val() != '' + && ($(tr).find('.chzn-select').length == 0 + || $(tr).find('.chzn-select').val() != null)) + { if ($(tr).find('.dropbox').length == 0) { $(config).append(''+t('files_external', 'Grant access')+''); } else { @@ -64,8 +71,10 @@ $(document).ready(function() { $('.dropbox').live('click', function(event) { event.preventDefault(); + var tr = $(this).parent().parent(); var app_key = $(this).parent().find('[data-parameter="app_key"]').val(); var app_secret = $(this).parent().find('[data-parameter="app_secret"]').val(); + var statusSpan = $(tr).find('.status span'); if (app_key != '' && app_secret != '') { var tr = $(this).parent().parent(); var configured = $(this).parent().find('[data-parameter="configured"]'); @@ -76,25 +85,19 @@ $(document).ready(function() { $(configured).val('false'); $(token).val(result.data.request_token); $(token_secret).val(result.data.request_token_secret); - if (OC.MountConfig.saveStorage(tr)) { - window.location = result.data.url; - } else { - OC.dialogs.alert( - t('files_external', 'Fill out all required fields'), - t('files_external', 'Error configuring Dropbox storage') - ); - } + OC.MountConfig.saveStorage(tr); + statusSpan.removeClass(); + statusSpan.addClass('waiting'); + window.location = result.data.url; } else { - OC.dialogs.alert(result.data.message, - t('files_external', 'Error configuring Dropbox storage') - ); + OC.dialogs.alert(result.data.message, t('files_external', 'Error configuring Dropbox storage')); } }); } else { OC.dialogs.alert( - t('files_external', 'Please provide a valid Dropbox app key and secret.'), - t('files_external', 'Error configuring Dropbox storage') - ); + t('files_external', 'Please provide a valid Dropbox app key and secret.'), + t('files_external', 'Error configuring Dropbox storage') + ); } }); diff --git a/apps/files_external/js/google.js b/apps/files_external/js/google.js index f9fb8078612..a3b3e9cb3d2 100644 --- a/apps/files_external/js/google.js +++ b/apps/files_external/js/google.js @@ -3,8 +3,7 @@ $(document).ready(function() { $('#externalStorage tbody tr.OC_Filestorage_Google').each(function() { var configured = $(this).find('[data-parameter="configured"]'); if ($(configured).val() == 'true') { - $(this).find('.configuration') - .append(''+t('files_external', 'Access granted')+''); + $(this).find('.configuration').append(''+t('files_external', 'Access granted')+''); } else { var token = $(this).find('[data-parameter="token"]'); var token_secret = $(this).find('[data-parameter="token_secret"]'); @@ -22,37 +21,44 @@ $(document).ready(function() { OC.MountConfig.saveStorage(tr); $(tr).find('.configuration').append(''+t('files_external', 'Access granted')+''); } else { - OC.dialogs.alert(result.data.message, - t('files_external', 'Error configuring Google Drive storage') - ); + OC.dialogs.alert(result.data.message, t('files_external', 'Error configuring Google Drive storage')); } }); - } else if ($(this).find('.google').length == 0) { - $(this).find('.configuration').append(''+t('files_external', 'Grant access')+''); + } else { + onGoogleInputsChange(this); } } }); - $('#externalStorage tbody tr').live('change', function() { - if ($(this).hasClass('OC_Filestorage_Google') && $(this).find('[data-parameter="configured"]').val() != 'true') { - if ($(this).find('.mountPoint input').val() != '') { - if ($(this).find('.google').length == 0) { - $(this).find('.configuration').append(''+t('files_external', 'Grant access')+''); - } - } - } + $('#externalStorage tbody tr.OC_Filestorage_Google td').live('paste', function() { + var tr = $(this).parent(); + setTimeout(function() { + onGoogleInputsChange(tr); + }, 20); }); - $('#externalStorage tbody tr .mountPoint input').live('keyup', function() { - var tr = $(this).parent().parent(); - if ($(tr).hasClass('OC_Filestorage_Google') && $(tr).find('[data-parameter="configured"]').val() != 'true' && $(tr).find('.google').length > 0) { - if ($(this).val() != '') { - $(tr).find('.google').show(); - } else { + $('#externalStorage tbody tr.OC_Filestorage_Google td').live('keyup', function() { + onGoogleInputsChange($(this).parent()); + }); + + $('#externalStorage tbody tr.OC_Filestorage_Google .chzn-select').live('change', function() { + onGoogleInputsChange($(this).parent().parent()); + }); + + function onGoogleInputsChange(tr) { + if ($(tr).find('[data-parameter="configured"]').val() != 'true') { + var config = $(tr).find('.configuration'); + if ($(tr).find('.mountPoint input').val() != '' && ($(tr).find('.chzn-select').length == 0 || $(tr).find('.chzn-select').val() != null)) { + if ($(tr).find('.google').length == 0) { + $(config).append(''+t('files_external', 'Grant access')+''); + } else { + $(tr).find('.google').show(); + } + } else if ($(tr).find('.google').length > 0) { $(tr).find('.google').hide(); } } - }); + } $('.google').live('click', function(event) { event.preventDefault(); @@ -60,23 +66,18 @@ $(document).ready(function() { var configured = $(this).parent().find('[data-parameter="configured"]'); var token = $(this).parent().find('[data-parameter="token"]'); var token_secret = $(this).parent().find('[data-parameter="token_secret"]'); + var statusSpan = $(tr).find('.status span'); $.post(OC.filePath('files_external', 'ajax', 'google.php'), { step: 1, callback: location.protocol + '//' + location.host + location.pathname }, function(result) { if (result && result.status == 'success') { $(configured).val('false'); $(token).val(result.data.request_token); $(token_secret).val(result.data.request_token_secret); - if (OC.MountConfig.saveStorage(tr)) { - window.location = result.data.url; - } else { - OC.dialogs.alert( - t('files_external', 'Fill out all required fields'), - t('files_external', 'Error configuring Google Drive storage') - ); - } + OC.MountConfig.saveStorage(tr); + statusSpan.removeClass(); + statusSpan.addClass('waiting'); + window.location = result.data.url; } else { - OC.dialogs.alert(result.data.message, - t('files_external', 'Error configuring Google Drive storage') - ); + OC.dialogs.alert(result.data.message, t('files_external', 'Error configuring Google Drive storage')); } }); }); diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 25f6ed57984..b98fcf1b0ae 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -58,12 +58,25 @@ OC.MountConfig={ } users.push(applicable); } - $.post(OC.filePath('files_external', 'ajax', 'addMountPoint.php'), { mountPoint: mountPoint, class: backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, isPersonal: isPersonal }, function(result) { - statusSpan.removeClass(); - if (result && result.status == 'success' && result.data.message) { - statusSpan.addClass('success'); - } else { - statusSpan.addClass('error'); + $.ajax({type: 'POST', + url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'), + data: { + mountPoint: mountPoint, + class: backendClass, + classOptions: classOptions, + mountType: mountType, + applicable: applicable, + isPersonal: isPersonal + }, + async: false, + success: function(result) { + statusSpan.removeClass(); + if (result && result.status == 'success' && result.data.message) { + status = true; + statusSpan.addClass('success'); + } else { + statusSpan.addClass('error'); + } } }); }); @@ -71,26 +84,61 @@ OC.MountConfig={ $(tr).find('.applicable').data('applicable-users', users); var mountType = 'group'; $.each(oldGroups, function(index, applicable) { - $.post(OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), { mountPoint: mountPoint, mountType: mountType, applicable: applicable, isPersonal: isPersonal }); + $.ajax({type: 'POST', + url: OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), + data: { + mountPoint: mountPoint, + class: backendClass, + classOptions: classOptions, + mountType: mountType, + applicable: applicable, + isPersonal: isPersonal + }, + async: false + }); }); var mountType = 'user'; $.each(oldUsers, function(index, applicable) { - $.post(OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), { mountPoint: mountPoint, mountType: mountType, applicable: applicable, isPersonal: isPersonal }); + $.ajax({type: 'POST', + url: OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), + data: { + mountPoint: mountPoint, + class: backendClass, + classOptions: classOptions, + mountType: mountType, + applicable: applicable, + isPersonal: isPersonal + }, + async: false + }); }); } else { var isPersonal = true; var mountType = 'user'; var applicable = OC.currentUser; - $.post(OC.filePath('files_external', 'ajax', 'addMountPoint.php'), { mountPoint: mountPoint, class: backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, isPersonal: isPersonal }, function(result) { - statusSpan.removeClass(); - if (result && result.status == 'success' && result.data.message) { - statusSpan.addClass('success'); - } else { - statusSpan.addClass('error'); + $.ajax({type: 'POST', + url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'), + data: { + mountPoint: mountPoint, + class: backendClass, + classOptions: classOptions, + mountType: mountType, + applicable: applicable, + isPersonal: isPersonal + }, + async: false, + success: function(result) { + statusSpan.removeClass(); + if (result && result.status == 'success' && result.data.message) { + status = true; + statusSpan.addClass('success'); + } else { + statusSpan.addClass('error'); + } } }); } - return true; + return status; } } }; -- cgit v1.2.3 From db90f2c296c4a74933c2d258d8b335a3093db0f9 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Wed, 2 Jan 2013 12:13:59 -0500 Subject: Listen to checkbox changes as well --- apps/files_external/js/settings.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apps/files_external/js/settings.js') diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index b98fcf1b0ae..2a8d8d2c284 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -239,6 +239,10 @@ $(document).ready(function() { } }); + $('#externalStorage td input:checkbox').live('change', function() { + OC.MountConfig.saveStorage($(this).parent().parent().parent()); + }); + $('.applicable .chzn-select').live('change', function() { OC.MountConfig.saveStorage($(this).parent().parent()); }); -- cgit v1.2.3 From 010c4c289123da70ccceee22e9f56927d7fe553f Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Tue, 12 Feb 2013 23:27:31 +0100 Subject: adding spinner while talking to the backend --- apps/files_external/css/settings.css | 1 + apps/files_external/js/settings.js | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'apps/files_external/js/settings.js') diff --git a/apps/files_external/css/settings.css b/apps/files_external/css/settings.css index 94b453793b1..2580fe48ae0 100644 --- a/apps/files_external/css/settings.css +++ b/apps/files_external/css/settings.css @@ -2,6 +2,7 @@ td.status>span { display:inline-block; height:16px; width:16px; } span.success { background-image: url('../img/success.png'); background-repeat:no-repeat; } span.error { background-image: url('../img/error.png'); background-repeat:no-repeat; } span.waiting { background-image: url('../img/waiting.png'); background-repeat:no-repeat; } +span.pending { background-image: url('%webroot%/core/img/loading.gif'); background-repeat:no-repeat; } td.mountPoint, td.backend { width:10em; } td.remove>img { visibility:hidden; padding-top:0.8em; } tr:hover>td.remove>img { visibility:visible; cursor:pointer; } diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 5dffbce5bdf..30b2eac417f 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -58,6 +58,8 @@ OC.MountConfig={ } users.push(applicable); } + statusSpan.removeClass(); + statusSpan.addClass('pending'); $.ajax({type: 'POST', url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'), data: { @@ -68,7 +70,7 @@ OC.MountConfig={ applicable: applicable, isPersonal: isPersonal }, - async: false, + async: true, success: function(result) { statusSpan.removeClass(); if (result && result.status == 'success' && result.data.message) { @@ -116,6 +118,8 @@ OC.MountConfig={ var isPersonal = true; var mountType = 'user'; var applicable = OC.currentUser; + statusSpan.removeClass(); + statusSpan.addClass('pending'); $.ajax({type: 'POST', url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'), data: { @@ -126,7 +130,7 @@ OC.MountConfig={ applicable: applicable, isPersonal: isPersonal }, - async: false, + async: true, success: function(result) { statusSpan.removeClass(); if (result && result.status == 'success' && result.data.message) { -- cgit v1.2.3 From 037c3ee4ecf6f3ffae0f1707074ac13b234dc1ec Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Wed, 13 Feb 2013 00:23:37 +0100 Subject: fixing issues with UTF8 characters in translatable strings --- apps/files_external/css/settings.css | 1 - apps/files_external/js/settings.js | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'apps/files_external/js/settings.js') diff --git a/apps/files_external/css/settings.css b/apps/files_external/css/settings.css index 2580fe48ae0..94b453793b1 100644 --- a/apps/files_external/css/settings.css +++ b/apps/files_external/css/settings.css @@ -2,7 +2,6 @@ td.status>span { display:inline-block; height:16px; width:16px; } span.success { background-image: url('../img/success.png'); background-repeat:no-repeat; } span.error { background-image: url('../img/error.png'); background-repeat:no-repeat; } span.waiting { background-image: url('../img/waiting.png'); background-repeat:no-repeat; } -span.pending { background-image: url('%webroot%/core/img/loading.gif'); background-repeat:no-repeat; } td.mountPoint, td.backend { width:10em; } td.remove>img { visibility:hidden; padding-top:0.8em; } tr:hover>td.remove>img { visibility:visible; cursor:pointer; } diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index 30b2eac417f..5dffbce5bdf 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -58,8 +58,6 @@ OC.MountConfig={ } users.push(applicable); } - statusSpan.removeClass(); - statusSpan.addClass('pending'); $.ajax({type: 'POST', url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'), data: { @@ -70,7 +68,7 @@ OC.MountConfig={ applicable: applicable, isPersonal: isPersonal }, - async: true, + async: false, success: function(result) { statusSpan.removeClass(); if (result && result.status == 'success' && result.data.message) { @@ -118,8 +116,6 @@ OC.MountConfig={ var isPersonal = true; var mountType = 'user'; var applicable = OC.currentUser; - statusSpan.removeClass(); - statusSpan.addClass('pending'); $.ajax({type: 'POST', url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'), data: { @@ -130,7 +126,7 @@ OC.MountConfig={ applicable: applicable, isPersonal: isPersonal }, - async: true, + async: false, success: function(result) { statusSpan.removeClass(); if (result && result.status == 'success' && result.data.message) { -- cgit v1.2.3 From 05a8766cbc5826a89e52248994e3e2d0b6c57be5 Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Wed, 20 Feb 2013 12:06:08 +0100 Subject: attach on() events to external storage table, dom events in the table will always bubble up here --- apps/files_external/js/settings.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'apps/files_external/js/settings.js') diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index be24812869e..ac408786ff6 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -146,7 +146,7 @@ OC.MountConfig={ $(document).ready(function() { $('.chzn-select').chosen(); - $('#selectBackend').on('change', function() { + $('#externalStorage').on('change', '#selectBackend', function() { var tr = $(this).parent().parent(); $('#externalStorage tbody').append($(tr).clone()); $('#externalStorage tbody tr').last().find('.mountPoint input').val(''); @@ -243,11 +243,11 @@ $(document).ready(function() { OC.MountConfig.saveStorage($(this).parent().parent().parent()); }); - $('.applicable').on('change', '.chzn-select', function() { + $('#externalStorage').on('change', '.applicable .chzn-select', function() { OC.MountConfig.saveStorage($(this).parent().parent()); }); - $('td.remove>img').on('click', function() { + $('#externalStorage').on('click', 'td.remove>img', function() { var tr = $(this).parent().parent(); var mountPoint = $(tr).find('.mountPoint input').val(); if ( ! mountPoint) { -- cgit v1.2.3