diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-11-02 00:59:44 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-11-02 15:30:32 -0400 |
commit | 6682d2e55d9b16d73a062d823ec3fa485bc725e4 (patch) | |
tree | 1f471166cd16d97f111eeb54ec3d74c628e2b718 /js/settings.js | |
parent | 58c838feda8aecc6dff1f798320f8d215a88ea87 (diff) |
[News] make the import opml interface slimmer
Diffstat (limited to 'js/settings.js')
-rw-r--r-- | js/settings.js | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/js/settings.js b/js/settings.js index fff0e60a4..24440d67d 100644 --- a/js/settings.js +++ b/js/settings.js @@ -1,16 +1,10 @@ News = News || {} + News.Settings={ - importkind: '', - importpath: '', - IMPORTCLOUD:'cloud', - IMPORTLOCAL:'local', cloudFileSelected:function(path){ $.getJSON(OC.filePath('news', 'ajax', 'selectfromcloud.php'),{'path':path},function(jsondata){ if(jsondata.status == 'success'){ - $('#browsebtn, #cloudbtn, #importbtn').show(); - $('#opml_file').text(t('news', 'File ') + path + t('news', ' loaded from cloud.')); - News.Settings.importkind = News.Settings.IMPORTCLOUD; - News.Settings.importpath = jsondata.data.tmp; + News.Settings.importOpml(jsondata.data.tmp); } else{ OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); @@ -23,21 +17,8 @@ News.Settings={ return; } var file = filelist[0]; - $('#browsebtn, #cloudbtn, #importbtn').show(); - $('#opml_file').text(t('news', 'File ') + file.name + t('news', ' loaded from local filesystem.')); - $('#opml_file').prop('value', file.name); }, - importOpml:function(button){ - $(button).attr("disabled", true); - $(button).prop('value', t('news', 'Importing...')); - - var path = ''; - if (News.Settings.importkind == News.Settings.IMPORTCLOUD) { - path = News.Settings.importpath; - } else if (this.importkind == this.IMPORTLOCAL) { - - } - + importOpml:function(path){ $.post(OC.filePath('news', 'ajax', 'importopml.php'), { path: path }, function(jsondata){ if (jsondata.status == 'success') { var message = jsondata.data.countsuccess + t('news', ' out of ') + jsondata.data.count + @@ -46,8 +27,6 @@ News.Settings={ } else { OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); } - $(button).prop('value', t('news', 'Import')); - $(button).attr("disabled", false); }); }, exportOpml:function(button){ @@ -56,17 +35,17 @@ News.Settings={ } } -$('#browsebtn, #cloudbtn, #importbtn').hide(); -$('#cloudbtn, #cloudlink').click(function() { +$('#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); + $('#appsettings_popup').remove(); }); -$('#browsebtn, #browselink').click(function() { +$('#browselink').click(function() { $('#file_upload_start').trigger('click'); }); @@ -74,10 +53,6 @@ $('#file_upload_start').change(function() { News.Settings.browseFile(this.files); }); -$('#importbtn').click(function() { - News.Settings.importOpml(this); -}); - $('#exportbtn').click(function() { News.Settings.exportOpml(this); }); |