diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-14 23:09:23 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-14 23:09:23 +0200 |
commit | 598ce8cb29880b0c06fd51c0402fcaf8e27dfd08 (patch) | |
tree | 2e54c6d2df5448c680ff904ed8c502785d73cc0c /js | |
parent | 9b06280402269bd3ee92038160f0f269311558a0 (diff) | |
parent | 51bf7344a712d0ce140020e75099b11a8d007639 (diff) |
Merge branch 'newsapp' of git://gitorious.org/owncloud/apps into newsapp
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); +}); |