diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-11-08 12:44:35 -0500 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-11-08 12:45:16 -0500 |
commit | 0dddb38e93b0f2c67c1c611343255ffc5a4fd2e3 (patch) | |
tree | 17009908161e7b6110537026bb69be71aab4c423 /js | |
parent | c2dfe049465a1e97ca643e54db6b0bbd67d22bf1 (diff) |
[News] importopml implemented via eventsource for incremental notifications to client
Diffstat (limited to 'js')
-rw-r--r-- | js/settings.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/js/settings.js b/js/settings.js index 0f8b5bc38..ed99d8733 100644 --- a/js/settings.js +++ b/js/settings.js @@ -43,13 +43,24 @@ News.Settings={ } param = { - url: OC.filePath('news', 'ajax', 'importopml.php'), + url: OC.filePath('news', 'ajax', 'uploadopml.php'), data: ajaxData, type: 'POST', success: function(jsondata){ if (jsondata.status == 'success') { - $('#notification').html(t('files', '{n_success} out of {n_total} feeds imported successfully!', - {n_success: jsondata.data.countsuccess, n_total: jsondata.data.count})); + var eventSource=new OC.EventSource(OC.filePath('news','ajax','importopml.php'),{source:jsondata.data.source, path:jsondata.data.path}); + eventSource.listen('progress',function(progress){ + $('#notification').html('bingo'); + //News.Objects.Menu.addNode(folderid, jsonData.data.listfeed); + //News.Objects.Menu.load(News.MenuNodeType.Feed, jsonData.data.feedid); + }); + eventSource.listen('success',function(data){ + $('#notification').html('done'); + }); + eventSource.listen('error',function(error){ + $('#notification').fadeOut('400'); + OC.dialogs.alert(error, t('news', 'Error')); + }); } else { OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); |