diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-31 23:40:22 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-31 23:40:22 -0400 |
commit | eca49d72c47eb9b59cb3192f24a442d4d3303092 (patch) | |
tree | 70bf63e7cf73fa3642c55b750972273973579cb6 /js | |
parent | 44510977870d854196a28c644a7b61c7bbe55e6f (diff) |
news app welcomes the new settings popup
Diffstat (limited to 'js')
-rw-r--r-- | js/news.js | 71 | ||||
-rw-r--r-- | js/settings.js | 65 |
2 files changed, 68 insertions, 68 deletions
diff --git a/js/news.js b/js/news.js index 91ce532b2..19adacb89 100644 --- a/js/news.js +++ b/js/news.js @@ -27,26 +27,6 @@ News={ }else{ $('#dialog_holder').load(OC.filePath('news', 'ajax', dialogfile), function(jsondata){ if(jsondata.status != 'error'){ - if(dialogtype == '#import_dialog') { - //TODO: group all the following calls in a method - $('#browsebtn, #cloudbtn, #importbtn').hide(); - $('#cloudbtn, #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.Opml.cloudFileSelected, false, '', true); - }); - $('#browsebtn, #browselink').click(function() { - $('#file_upload_start').trigger('click'); - }); - $('#file_upload_start').change(function() { - News.Opml.browseFile(this.files); - }); - $('#importbtn').click(function() { - News.Opml.import(this); - }); - } $(dialogtype).dialog({ dialogClass:'dialog', minWidth: 600, @@ -62,51 +42,6 @@ News={ return false; } }, - Opml: { - importpath:'', - importkind:'', - 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.Opml.importkind = 'cloud'; - News.Opml.importpath = jsondata.data.tmp; - } - else{ - OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); - } - }); - }, - browseFile:function(filelist){ - if(!filelist) { - OC.dialogs.alert(t('news','No files selected.'), t('news', 'Error')); - 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); - }, - import:function(button){ - $(button).attr("disabled", true); - $(button).prop('value', t('news', 'Importing...')); - - var path = ''; - if (News.Opml.importkind == 'cloud') { - path = News.Opml.importpath; - } else { - - } - - $.post(OC.filePath('news', 'ajax', 'importopml.php'), { path: path }, function(jsondata){ - if (jsondata.status == 'success') { - alert(jsondata.data.title); - } - }); - - } - }, Folder: { submit:function(button){ var displayname = $("#folder_add_name").val().trim(); @@ -310,9 +245,9 @@ $(document).ready(function(){ $('#addfeedfolder').click(function(event) { event.stopPropagation(); }); - - $('#settingsbtn').click(function() { - News.UI.overview('#import_dialog', 'importdialog.php'); + + $('#settingsbtn').on('click keydown', function() { + OC.appSettings({appid:'news', loadJS:true}); }); setupFeedList(); diff --git a/js/settings.js b/js/settings.js new file mode 100644 index 000000000..b1f81410e --- /dev/null +++ b/js/settings.js @@ -0,0 +1,65 @@ +News={ + Settings: { + importpath:'', + importkind:'', + 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 = 'cloud'; + News.Settings.importpath = jsondata.data.tmp; + } + else{ + OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); + } + }); + }, + browseFile:function(filelist){ + if(!filelist) { + OC.dialogs.alert(t('news','No files selected.'), t('news', 'Error')); + 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); + }, + import:function(button){ + $(button).attr("disabled", true); + $(button).prop('value', t('news', 'Importing...')); + + var path = ''; + if (News.Settings.importkind == 'cloud') { + path = News.Settings.importpath; + } else { + + } + + $.post(OC.filePath('news', 'ajax', 'importopml.php'), { path: path }, function(jsondata){ + if (jsondata.status == 'success') { + alert(jsondata.data.title); + } + }); + + } + } +} + +$('#browsebtn, #cloudbtn, #importbtn').hide(); +$('#cloudbtn, #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); +}); +$('#browsebtn, #browselink').click(function() { + $('#file_upload_start').trigger('click'); +}); +$('#file_upload_start').change(function() { + News.Settings.browseFile(this.files); +}); +$('#importbtn').click(function() { + News.Settings.import(this); +}); |