(function(){
    angular.module("mediaModal").controller("GalleryController", function($scope, availableResources, $uibModalInstance) {

        $scope.availableResources=availableResources;
        $scope.appState = {};
        $scope.selectedImages = [];

        $scope.tabSelected = function(resource){
            $scope.$broadcast("currentResourceChanged", resource.webServiceType)
        };

        $scope.cancel = function(){
            $uibModalInstance.dismiss("cancel");
        };

        $scope.selectImages = function(){
            $uibModalInstance.close($scope.selectedImages);
        }
    });
}());