var suggestionBox=angular.module("silverpeas.suggestionBox",["silverpeas.services","silverpeas.directives"]);suggestionBox.controller("mainController",["context","SuggestionBox","$scope",function(c,b,a){var d=b.get({id:c.suggestionBoxId,componentInstanceId:c.component});a.suggestionBox=d;if(typeof c.suggestionId!=="undefined"){d.suggestions.get(c.suggestionId).then(function(e){a.suggestion=e})}if(c.userRole!=="ADMIN"&&c.userRole!=="PUBLISHER"&&c.userRole!=="WRITER"){a.readerView="lecteur-view"}a.goAt=function(e){window.location=e};a.maxItemsToRender=3}]);suggestionBox.controller("suggestionsInDraftController",["context","$scope","$rootScope",function(c,b,a){var d=b.suggestionBox;b.publish=function(e){d.suggestions.publish(e).then(function(f){a.$broadcast("suggestionModified",f)})};b.loadInDraft=function(){d.suggestions.get("inDraft").then(function(e){b.inDraftSuggestions=e})};b.loadInDraft();b.$on("suggestionModified",function(e){b.loadInDraft()})}]);suggestionBox.controller("myOutOfDraftSuggestionsController",["context","$scope","$rootScope",function(c,b,a){var d=b.suggestionBox;b.loadMyOutOfDraft=function(){d.suggestions.get("outOfDraft").then(function(e){b.myOutOfDraftSuggestions=e})};b.loadMyOutOfDraft();b.$on("suggestionModified",function(e){b.loadMyOutOfDraft()})}]);suggestionBox.controller("publishedSuggestionsController",["context","$scope","$rootScope",function(c,b,a){var d=b.suggestionBox;b.loadPublished=function(){d.suggestions.get("published",{page:{number:1,size:b.maxItemsToRender},sortby:"validation.validationDate"}).then(function(e){b.publishedSuggestions=e})};b.loadPublished();b.$on("suggestionModified",function(e){b.loadPublished()})}]);suggestionBox.controller("buzzPublishedSuggestionsController",["context","$scope",function(b,a){var c=a.suggestionBox;a.loadBuzzPublished=function(){c.suggestions.get("published",{page:{number:1,size:a.maxItemsToRender},sortby:"commentCount"}).then(function(e){a.buzzPublishedSuggestions=[];a.buzzPublishedSuggestions.maxlength=e.maxlength;for(var d=0;d<e.length;d++){if(e[d].commentCount>0){a.buzzPublishedSuggestions.push(e[d])}}})};a.loadBuzzPublished();a.$on("suggestionModified",function(d){a.loadBuzzPublished()})}]);suggestionBox.controller("lastCommentsController",["context","$scope",function(b,a){var c=a.suggestionBox;c.suggestions.lastComments(a.maxItemsToRender).then(function(d){a.lastComments=d})}]);