/* Minified: jquery.selectSubscribers.js, widgets.ObjectSubscriptions.js */
jQuery.fn.selectSubscribers=function(s){var settings=jQuery.extend({},s);return this.each(function(){var wrapper=$(this);wrapper.find("div.user_group li").each(function(){var list_element=$(this);if($.inArray(list_element.attr("user_id"),s.can_see_private)!==-1){list_element.attr("can_see_private",1)}else{list_element.attr("can_see_private",0)}});var filter_by_visibility=function(visibility){var wrapper=$(this);wrapper.find("div.user_group").each(function(){var group=$(this);group.show();if(visibility==1){group.find("li").show()}else{group.find('li[can_see_private="0"]').hide();group.find('li[can_see_private="1"]').show()}if(group.find("li:visible").length){group.show()}else{group.hide()}});wrapper.find('input[type="checkbox"]:not(:visible):checked').attr("checked",false)};this.filterByVisibility=filter_by_visibility})};
App.widgets.ObjectSubscriptions=function(){return{init:function(wrapper_id,settings){var wrapper=$("#"+wrapper_id);var settings=jQuery.extend({subscription_event:null,unsubscription_event:null},settings);var update_list_of_subscribers=function(event,subscribers){if(jQuery.isArray(subscribers)){var size=subscribers.length;switch(size){case 0:wrapper.find("span.list_of_subscribers").text(App.lang("No subscribers"));break;case 1:wrapper.find("span.list_of_subscribers").text(App.lang(":subscriber is subscribed",{subscriber:subscribers["0"]["short_display_name"]}));break;default:var subscribers_string="";var counter=1;for(var i in subscribers){subscribers_string+=subscribers[i]["short_display_name"];if(counter<size){if(counter==size-1){subscribers_string+=App.lang(" and ")}else{subscribers_string+=", "}}counter++}wrapper.find("span.list_of_subscribers").text(App.lang(":subscribers are subscribed",{subscribers:subscribers_string}))}}else{wrapper.find("span.list_of_subscribers").text(App.lang("No subscribers"))}};App.Wireframe.Events.bind(settings.subscription_event,update_list_of_subscribers);App.Wireframe.Events.bind(settings.unsubscription_event,update_list_of_subscribers)}}}();
