1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
angular.module('main',[]).
  config(function($routeProvider) {
    $routeProvider.
      when('/', {controller:ListController, templateUrl:'resources/views/list.html'}).
      when('/view/:id', {controller:VforumController, templateUrl:'resources/views/vforum.html'}).
      otherwise({redirectTo:'/'});
  }).factory('presentationService', function($http)
  {
	  var promise;
	  if (!angular.isDefined(promise)) promise = $http.post('resources/request.php', $data, {timeout:20000});
	  return promise;
});

function ListController($scope, presentationService)
{
	$scope.error 					= null;
	$scope.presentations 	= null;
	$scope.requesting 		= true;
	$scope.currentTitle 	= '-1';
	$data = {
		'type' : 'presentations'
	};

	presentationService.then(function success(response)
	{
    $scope.requesting = false;
    $scope.presentations = response.data;
	}, function error(response)
	{
    $scope.requesting = false;
    log(status + ', data:" ' + response.data + '"');
	});
}