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/news.js | |
parent | 9b06280402269bd3ee92038160f0f269311558a0 (diff) | |
parent | 51bf7344a712d0ce140020e75099b11a8d007639 (diff) |
Merge branch 'newsapp' of git://gitorious.org/owncloud/apps into newsapp
Diffstat (limited to 'js/news.js')
-rw-r--r-- | js/news.js | 45 |
1 files changed, 45 insertions, 0 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) { |