diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-02 23:39:19 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-07-02 23:39:19 -0400 |
commit | 72c730bf5fb21f58589a836483585dabd6866520 (patch) | |
tree | a57dab8dcf88ce5a4f1172ba89663aa52947fdb8 /js | |
parent | f8f6fd3d778fe95bac15e52747ff5b1f6461c136 (diff) |
button to add feed; selection of a feed
Diffstat (limited to 'js')
-rw-r--r-- | js/news.js | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/js/news.js b/js/news.js index e97d1227c..4014aca6e 100644 --- a/js/news.js +++ b/js/news.js @@ -20,7 +20,7 @@ News={ return false; } }, - Feeds: { + Folder: { submit:function(button){ var displayname = $("#folder_add_name").val().trim(); @@ -41,6 +41,28 @@ News={ } }); } + }, + Feed: { + submit: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; + } + + var url; + url = OC.filePath('news', 'ajax', 'newfeed.php'); + + $.post(url, { feedurl: feedurl }, + function(jsondata){ + if(jsondata.status == 'success'){ + $(button).closest('tr').prev().html(jsondata.page).show().next().remove(); + } else { + OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); + } + }); + } } } |