Project

General

Profile

1
<!DOCTYPE HTML>
2
<html xmlns:th="http://www.thymeleaf.org">
3

    
4
<head>
5
	<meta charset="utf-8">
6
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7
	<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
8
	<meta http-equiv="Pragma" content="no-cache">
9
	<meta http-equiv="Expires" content="0">
10
	
11
	<!-- Bootstrap CSS -->
12
	<link rel="stylesheet" href="resources/css/bootstrap.min.css" />
13
	<!-- Icons CSS -->
14
	<link rel="stylesheet" href="resources/css/fontawesome-all.min.css">
15
	
16
	<title>Organizations Database: authorization request</title>
17
</head>
18

    
19
<body ng-app="authReqApp" ng-controller="authReqCtrl">
20

    
21
	<div class="container">
22
		<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
23
			<a class="navbar-brand" href="#"> 
24
				<img src="resources/images/openaire_logo_small.png" width="30" height="30" alt="OpenOrgs Database"> OpenOrgs Database
25
			</a>
26
		</nav>
27
		
28
		<div ng-if="registrationMessage">
29
			<div class="alert" style="margin-top: 25px" ng-class="{'alert-info': registrationStatus == 1, 'alert-warning': registrationStatus == 2, 'alert-danger': registrationStatus == -1}">{{registrationMessage}}</div>
30
			<a class="btn btn-sm btn-primary" th:href="@{/logout}">return to login form</a>
31
		</div>		
32

    
33
	    <div class="card" style="margin-top: 25px" ng-if="registrationStatus == 0">
34
			<div class="card-body">
35
				<h5 class="card-title">Authorization request</h5>
36
				<p class="card-text" th:inline="text">
37
					Hello '[[${#httpServletRequest.remoteUser}]]', you do not have permission to ... <br />
38
					If you want to contribute to ... compile the form, an administrator will authorize you as soon as possible.
39
				</p>	
40
		
41
				<form class="small">
42
					<div class="card" style="margin-top: 25px">
43
						<div class="card-header">Select your countries</div>
44
							
45
						<div class="card-body">
46
							<div class="form-group row">
47
								<div class="col-sm-2" ng-repeat="c in vocs.countries">
48
									<div class="form-check form-check-inline">
49
										<input class="form-check-input" type="checkbox" checklist-model="countries" checklist-value="c"/>
50
										<label class="form-check-label">{{c}}</label>
51
									</div>
52
								</div>
53
							</div>
54
						</div>
55
							
56
						<div class="card-footer">
57
							<button id="btnRegister" class="btn btn-sm btn-primary" ng-click="register()">send request</button>
58
							<a class="btn btn-sm btn-danger" th:href="@{/logout}">abort request</a>
59
						</div>
60
					</div>
61
				</form>
62

    
63
			</div>
64
		</div>
65
	</div>
66

    
67
	<script src="resources/js/jquery-3.4.1.min.js"></script>
68
	<script src="resources/js/popper.min.js"></script>
69
	<script src="resources/js/bootstrap.min.js"></script>
70
	<script src="resources/js/jquery-3.4.1.min.js"></script>
71
	<script src="resources/js/popper.min.js"></script>
72
	<script src="resources/js/bootstrap.min.js"></script>
73
	<script src="resources/js/angular.min.js"></script>
74
	<script src='resources/js/checklist-model.js'></script>
75

    
76
	<script>
77
	angular.module('authReqApp', ['checklist-model']).controller('authReqCtrl', function($scope, $http) {
78
		$scope.vocs = {};
79
		$scope.countries = [];
80
		$scope.registrationStatus = 0;
81
		$scope.registrationMessage = '';
82
		
83
		$http.get('public_api/vocabularies').then(function successCallback(res) {
84
			$scope.vocs = res.data;
85
		}, function errorCallback(res) {
86
			alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
87
		});
88
		
89
		$scope.register = function (email) {
90
			$('#btnRegister').attr("disabled", "disabled");
91
			$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
92
			$http.post('public_api/newUser', $scope.countries).then(function successCallback(res) {
93
				$scope.registrationStatus = res.data.status;
94
				if (res.data.status == 1) {
95
					$scope.registrationMessage = 'Registration saved !';
96
				} else {
97
					$scope.registrationMessage = 'User already registered !';
98
				}
99
			}, function errorCallback(res) {
100
				$scope.registerStatus = -1;
101
				$scope.registrationMessage = 'Error saving registration !';
102
				alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
103
			});
104
		}
105
	});
106
	</script>
107
	
108
</body>
109

    
110
</html>
(1-1/3)