diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-08-14 13:39:53 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-08-14 13:39:53 -0400 |
commit | 0d5bd3a636218a18b0fa81c6897614e37943455c (patch) | |
tree | 3dc7b211ac71e0d169b01e4a2a2a7e130e50b854 /js/news.js | |
parent | ded448fd10b1383c5c48eb90e7659550b1db7b01 (diff) |
small things added to firstrun page and settings
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 bf1f36ad4..59db7cf19 100644 --- a/js/news.js +++ b/js/news.js @@ -150,6 +150,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) { |