summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2012-11-02 15:29:41 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2012-11-02 15:30:32 -0400
commit9112586eeca8ca5216d66b1820d175c12ef3cf0d (patch)
treefc8c97ab616ff72f07b70cc63ee260faf9b14a1c /js
parent6682d2e55d9b16d73a062d823ec3fa485bc725e4 (diff)
[News] import opml from local filesystem now works
Diffstat (limited to 'js')
-rw-r--r--js/settings.js23
1 files changed, 22 insertions, 1 deletions
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() {