diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/news.js | 45 | ||||
-rw-r--r-- | js/settings.js | 11 |
2 files changed, 54 insertions, 2 deletions
diff --git a/js/news.js b/js/news.js index 373562e5e..257d67e2d 100644 --- a/js/news.js +++ b/js/news.js @@ -159,6 +159,51 @@ News={ } }); }, + submitFirstRun:function(button){ + + var feedurl = $("#feed_add_url").val().trim(); + + if(feedurl.length == 0) { + OC.dialogs.alert(t('news', 'URL cannot be empty.'), t('news', 'Error')); + return false; + } + + $(button).attr("disabled", true); + $(button).prop('value', t('news', 'Adding...')); + + $.ajax({ + type: "POST", + url: OC.filePath('news', 'ajax', 'createfeed.php'), + data: { 'feedurl': feedurl, 'folderid': folderid }, + dataType: "json", + success: function(jsondata){ + if(jsondata.status == 'success'){ + $('.collapsable_container[data-id="' + folderid + '"] > ul').append(jsondata.data.listfeed); + setupFeedList(); + News.Feed.load(jsondata.data.feedid); + window.reload(); + + OC.dialogs.confirm(t('news', 'Do you want to add another feed?'), t('news', 'Feed added!'), function(answer) { + if(!answer) { + $('#addfeed_dialog').dialog('destroy').remove(); + $('ul.accordion').before(jsondata.data.part_newfeed); + } + }); + } else { + OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); + } + $("#feed_add_url").val(''); + $(button).attr("disabled", false); + $(button).prop('value', t('news', 'Add feed')); + }, + error: function(xhr) { + OC.dialogs.alert(t('news', 'Error while parsing the feed'), t('news', 'Fatal Error')); + $("#feed_add_url").val(''); + $(button).attr("disabled", false); + $(button).prop('value', t('news', 'Add feed')); + } + }); + }, 'delete':function(feedid) { $('.feeds_delete').tipsy('hide'); OC.dialogs.confirm(t('news', 'Are you sure you want to delete this feed?'), t('news', 'Warning'), function(answer) { diff --git a/js/settings.js b/js/settings.js index c5a7e43ce..6709884ec 100644 --- a/js/settings.js +++ b/js/settings.js @@ -27,7 +27,7 @@ News.Settings={ $('#opml_file').text(t('news', 'File ') + file.name + t('news', ' loaded from local filesystem.')); $('#opml_file').prop('value', file.name); }, - import:function(button){ + importOpml:function(button){ $(button).attr("disabled", true); $(button).prop('value', t('news', 'Importing...')); @@ -51,6 +51,10 @@ News.Settings={ $(button).prop('value', t('news', 'Import')); $(button).attr("disabled", false); }); + }, + exportOpml:function(button){ + //TODO + alert("test"); } } @@ -73,6 +77,9 @@ $('#file_upload_start').change(function() { }); $('#importbtn').click(function() { - News.Settings.import(this); + News.Settings.importOpml(this); }); +$('#exportbtn').click(function() { + News.Settings.exportOpml(this); +}); |