diff --git a/ajax/feedlist.php b/ajax/feedlist.php index 92d1e0f20..ac7c1563f 100644 --- a/ajax/feedlist.php +++ b/ajax/feedlist.php @@ -24,6 +24,7 @@ $l = OC_L10N::get('news'); if($feeds == null) { OCP\JSON::error(array('data' => array('message' => $l->t('Error adding folder.')))); +// FIXME undefinded index feedurl OCP\Util::writeLog('news','ajax/feedlist.php: Error updating feeds: '.$_POST['feedurl'], OCP\Util::ERROR); exit(); } diff --git a/js/news.js b/js/news.js index 4a10ccdca..fbadbfa3b 100644 --- a/js/news.js +++ b/js/news.js @@ -119,6 +119,14 @@ News={ $(button).attr("disabled", false); $(button).prop('value', t('news', 'Add feed')); }); + $('#feeds > ul').remove(); + + $.post(OC.filePath('news', 'templates', 'part.feeds.php'), + function(data) { + $('#feeds').append(data); + setupFeedList(); + } + ); }, 'delete':function(feedid) { $('#feeds_delete').tipsy('hide'); @@ -166,7 +174,7 @@ News={ updateFeed:function(feedid, feedurl, folderid) { $.post(OC.filePath('news', 'ajax', 'updatefeed.php'),{'feedid':feedid, 'feedurl':feedurl, 'folderid':folderid},function(jsondata){ if(jsondata.status == 'success'){ - + } else{ //TODO:handle error case @@ -176,6 +184,27 @@ News={ } } +function setupFeedList() { + $('.collapsable').click(function(){ + $(this).parent().children().toggle(); + $(this).toggle(); + }); + + var list = $('.collapsable,.feeds_list').hover( + function() { + $(this).find('#feeds_delete,#feeds_edit').css('display', 'inline'); + $(this).find('#unreaditemcounter').css('display', 'none'); + }, + function() { + $(this).find('#feeds_delete,#feeds_edit').css('display', 'none'); + $(this).find('#unreaditemcounter').css('display', 'inline'); + } + ); + list.find('#feeds_delete').hide(); + list.find('#feeds_edit').hide(); + list.find('#unreaditemcounter').show(); +} + $(document).ready(function(){ $('#addfeed').click(function() { @@ -185,11 +214,6 @@ $(document).ready(function(){ News.UI.overview('#addfolder_dialog','folderdialog.php'); }); - $('.collapsable').click(function(){ - $(this).parent().children().toggle(); - $(this).toggle(); - }); - $('.accordion .title_unread').click(function() { $(this).next().toggle(); return false; @@ -200,27 +224,12 @@ $(document).ready(function(){ return false; }).next().hide(); - var list = $('.collapsable,.feeds_list').hover(function() { - var counter = $(this).find('#unreaditemcounter'); - var elem = $(this).find('#feeds_delete,#feeds_edit'); - if(elem.css('display') == 'none') { - elem.css('display', 'inline'); - counter.css('display', 'none'); - } - else { - elem.css('display', 'none'); - counter.css('display', 'inline'); - } - - return false; - }); - list.find('#feeds_delete').hide(); - list.find('#feeds_edit').hide(); - $('#addfeedfolder').click(function(event) { event.stopPropagation(); }); + setupFeedList(); + var updateInterval = 10000; //how often the feeds should update (in msec) setInterval('News.Feed.updateAll()', updateInterval); diff --git a/templates/part.feeds.php b/templates/part.feeds.php index d8e4a6b01..cee670063 100644 --- a/templates/part.feeds.php +++ b/templates/part.feeds.php @@ -27,7 +27,7 @@ } echo ''; } - - $this->inc("part.itemcounter"); - print_folder($_['allfeeds'], 0); + include("populateroot.php"); + include("part.itemcounter.php"); + print_folder($allfeeds, 0); ?> \ No newline at end of file diff --git a/templates/populateroot.php b/templates/populateroot.php new file mode 100644 index 000000000..a408c25ec --- /dev/null +++ b/templates/populateroot.php @@ -0,0 +1,18 @@ +populate('Everything', 0); + +if ($allfeeds) { + $feedid = isset( $_GET['feedid'] ) ? $_GET['feedid'] : null; + if ($feedid == null) { + + } +} +else { + $feedid = 0; +}