From 0dddb38e93b0f2c67c1c611343255ffc5a4fd2e3 Mon Sep 17 00:00:00 2001 From: Alessandro Cosentino Date: Thu, 8 Nov 2012 12:44:35 -0500 Subject: [News] importopml implemented via eventsource for incremental notifications to client --- js/settings.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'js') 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')); -- cgit v1.2.3