News={
DropDownMenu: {
fade:function(menu){
$(menu).toggle();
return false;
},
dropdown:function(button){
var list = $(button).parent().find('ul#dropdownmenu');
if (list.css('display') == 'none')
list.slideDown('fast').show();
else
list.slideUp('fast');
return false;
},
selectItem:function(item, folderid){
var parent = $(item).parent().parent();
parent.find('#dropdownBtn').text($(item).text());
parent.find(':input[name="folderid"]').val(folderid);
parent.find('ul#dropdownmenu').slideUp('fast');
}
},
UI: {
overview:function(dialogtype, dialogfile){
if($(dialogtype).dialog('isOpen') == true){
$(dialogtype).dialog('moveToTop');
}else{
$('#dialog_holder').load(OC.filePath('news', 'ajax', dialogfile), function(jsondata){
if(jsondata.status != 'error'){
$(dialogtype).dialog({
dialogClass:'dialog',
minWidth: 600,
close: function(event, ui) {
$(this).dialog('destroy').remove();
}
}).css('overflow','visible');
} else {
alert(jsondata.data.message);
}
});
}
return false;
}
},
Folder: {
submit:function(button){
var displayname = $("#folder_add_name").val().trim();
if(displayname.length == 0) {
OC.dialogs.alert(t('news', 'Name of the folder cannot be empty.'), t('news', 'Error'));
return false;
}
$(button).attr("disabled", true);
$(button).prop('value', t('news', 'Adding...'));
var folderid = $('#inputfolderid:input[name="folderid"]').val();
var url;
url = OC.filePath('news', 'ajax', 'createfolder.php');
$.post(url, { name: displayname, parentid: folderid },
function(jsondata){
if(jsondata.status == 'success'){
// if we got a parent folder
if(folderid > 0){
$('.collapsable_container[data-id="' + folderid + '"] > ul').append(jsondata.data.listfolder);
} else {
$('#feeds').append(jsondata.data.listfolder);
}
setupFeedList();
transformCollapsableTrigger();
$('#addfolder_dialog').dialog('destroy').remove();
} else {
OC.dialogs.alert(jsondata.data.message, t('news', 'Error'));
}
$("#folder_add_name").val('');
$(button).attr("disabled", false);
$(button).prop('value', t('news','Add folder'));
});
},
'delete':function(folderid) {
$('.feeds_delete').tipsy('hide');
OC.dialogs.confirm(t('news', 'Are you sure you want to delete this folder and all its feeds?'), t('news', 'Warning'), function(answer) {
if(answer == true) {
var rightcontent = $('div.rightcontent');
var shownfeedid = rightcontent.attr('data-id');
$.post(OC.filePath('news', 'ajax', 'deletefolder.php'),{'folderid':folderid, 'shownfeedid':shownfeedid},function(jsondata){
if(jsondata.status == 'success'){
$('.collapsable_container[data-id="' + jsondata.data.folderid + '"]').remove();
if(jsondata.data.part_items) {
rightcontent.empty();
rightcontent.html(jsondata.data.part_items);
}
transformCollapsableTrigger();
}
else{
OC.dialogs.alert(jsondata.data.message, t('news', 'Error'));
}
});
}
});
return false;
}
},
Feed: {
id:'',
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;
}
$(button).attr("disabled", true);
$(button).prop('value', t('news', 'Adding...'));
var