From 9112586eeca8ca5216d66b1820d175c12ef3cf0d Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Fri, 2 Nov 2012 15:29:41 -0400 Subject: [News] import opml from local filesystem now works --- js/settings.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/settings.js b/js/settings.js index 24440d67d..1eedcbfd0 100644 --- a/js/settings.js +++ b/js/settings.js @@ -10,6 +10,7 @@ News.Settings={ OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); } }); + $('#appsettings_popup').remove(); }, browseFile:function(filelist){ if(!filelist) { @@ -17,6 +18,27 @@ News.Settings={ return; } var file = filelist[0]; + //check file format/size/... + var formData = new FormData(); + formData.append('file', file); + $.ajax({ + url: OC.filePath('news', 'ajax', 'importopml.php'), + data: formData, + cache: false, + contentType: false, + processData: false, + type: 'POST', + success: function(jsondata){ + if (jsondata.status == 'success') { + var message = jsondata.data.countsuccess + t('news', ' out of ') + jsondata.data.count + + t('news', ' feeds imported successfully from ') + jsondata.data.title; + OC.dialogs.alert(message, t('news', 'Success')); + } + else { + OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); + } + } + }); }, importOpml:function(path){ $.post(OC.filePath('news', 'ajax', 'importopml.php'), { path: path }, function(jsondata){ @@ -42,7 +64,6 @@ $('#cloudlink').click(function() { * and filepicker doesn't support multiple MIME types filter. */ OC.dialogs.filepicker(t('news', 'Select file'), News.Settings.cloudFileSelected, false, '', true); - $('#appsettings_popup').remove(); }); $('#browselink').click(function() { -- cgit v1.2.3