diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-01-27 04:15:53 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-01-27 04:15:53 +0100 |
commit | ae7393db3d99a7ac223ae917129cccd9f49888e3 (patch) | |
tree | 7f54b72b0d01c38afd1378365a67e4f192922423 /js/settings.js | |
parent | 483784caa38bd6131405ac474347a215584e30a5 (diff) |
merged the angularjs branch
Diffstat (limited to 'js/settings.js')
-rw-r--r-- | js/settings.js | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/js/settings.js b/js/settings.js deleted file mode 100644 index 4ab664250..000000000 --- a/js/settings.js +++ /dev/null @@ -1,101 +0,0 @@ -News = News || {} - -News.Settings={ - cloudFileSelected:function(path){ - $.getJSON(OC.filePath('news', 'ajax', 'selectfromcloud.php'),{'path':path},function(jsondata){ - if(jsondata.status == 'success'){ - News.Settings.importOpml('fromCloud', jsondata.data.tmp); - } - else{ - OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); - } - }); - $('#appsettings_popup').remove(); - }, - browseFile:function(filelist){ - if(!filelist) { - OC.dialogs.alert(t('news','No files selected.'), t('news', 'Error')); - return; - } - var file = filelist[0]; - //check file format/size/... - var formData = new FormData(); - formData.append('file', file); - - News.Settings.importOpml('fromFile', formData); - $('#appsettings_popup').remove(); - }, - importOpml:function(type, data){ - - $('#notification').fadeIn(); - $('#notification').html(t('news', 'Importing OPML file...')); - - if (type == 'fromCloud') { - ajaxData = { path: data }; - settings = {}; - } - else if (type == 'fromFile') { - ajaxData = data; - settings = { cache: false, contentType: false, processData: false }; - } - else { - throw t('news', 'Not a valid type'); - } - - param = { - url: OC.filePath('news', 'ajax', 'uploadopml.php'), - data: ajaxData, - type: 'POST', - success: function(jsondata){ - if (jsondata.status == 'success') { - var eventSource=new OC.EventSource(OC.filePath('news','ajax','importopml.php'),{source:jsondata.data.source, path:jsondata.data.path}); - eventSource.listen('progress',function(progress){ - if (progress.data.type == 'feed') { - News.Objects.Menu.addNode(progress.data.folderid, progress.data.listfeed); - } else if (progress.data.type == 'folder') { - News.Objects.Menu.addNode(0, progress.data.listfolder); - } - }); - eventSource.listen('success',function(data){ - $('#notification').html(t('news', 'Importing done')); - }); - eventSource.listen('error',function(error){ - $('#notification').fadeOut('400'); - OC.dialogs.alert(error, t('news', 'Error while importing feeds.')); - }); - } - else { - OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); - } - $('#notification').delay('2500').fadeOut('400'); - } - }; - - $.ajax($.extend(param, settings)); - }, - exportOpml:function(button){ - document.location.href = OC.linkTo('news', 'opmlexporter.php'); - $('#appsettings_popup').remove(); - } -} - - -$('#cloudlink').click(function() { - /* - * it needs to be filtered by MIME type, but there are too many MIME types corresponding to opml - * and filepicker doesn't support multiple MIME types filter. - */ - OC.dialogs.filepicker(t('news', 'Select file'), News.Settings.cloudFileSelected, false, '', true); -}); - -$('#browselink').click(function() { - $('#file_upload_start').trigger('click'); -}); - -$('#file_upload_start').change(function() { - News.Settings.browseFile(this.files); -}); - -$('#exportbtn').click(function() { - News.Settings.exportOpml(this); -}); |