зеркало из https://github.com/nextcloud/news.git
Refresh feed list when you a feed
This commit is contained in:
Родитель
4ce3565909
Коммит
c5f03e0ca5
|
@ -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();
|
||||
}
|
||||
|
|
55
js/news.js
55
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);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
}
|
||||
echo '</ul></li></ul>';
|
||||
}
|
||||
|
||||
$this->inc("part.itemcounter");
|
||||
print_folder($_['allfeeds'], 0);
|
||||
include("populateroot.php");
|
||||
include("part.itemcounter.php");
|
||||
print_folder($allfeeds, 0);
|
||||
?>
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('news');
|
||||
|
||||
$foldermapper = new OC_News_FolderMapper(OCP\USER::getUser());
|
||||
|
||||
$allfeeds = $foldermapper->populate('Everything', 0);
|
||||
|
||||
if ($allfeeds) {
|
||||
$feedid = isset( $_GET['feedid'] ) ? $_GET['feedid'] : null;
|
||||
if ($feedid == null) {
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
$feedid = 0;
|
||||
}
|
Загрузка…
Ссылка в новой задаче