Projekt

Obecné

Profil

Stáhnout (3.21 KB) Statistiky
| Větev: | Tag: | Revize:
1
<%@page contentType="text/html" pageEncoding="UTF-8"%>
2
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
3

    
4
<!DOCTYPE html>
5
<html>
6
	<head>
7
		<meta charset="utf-8">
8

    
9
		<link rel="stylesheet" href="css/main.css">
10

    
11
		<script src="js/libs/jquery-3.3.1.min.js"></script>
12
		<script src="js/userMenu.js"></script>
13

    
14
		<title>IMiGEr</title>
15
	</head>
16

    
17
	<body>
18
		<c:set var="HOME_URL" value="${initParam.HOME_URL}"/>
19
		<c:set var="isLoggedIn" value="${sessionScope.isLoggedIn}"/>
20
		<c:set var="user" value="${sessionScope.user}"/>
21

    
22
		<header class="header" id="header">
23
			<img src="images/logo.png" class="header-logo" alt="logo of University of West Bohemia" title="University of West Bohemia">
24

    
25
			<h2 class="header-title">Interactive Multimodal Graph Explorer</h2>
26

    
27
			<%@ include file="userMenu.jsp" %>
28
		</header>
29

    
30
		<main>
31
			<div class="upload-form">
32
				<h3>New diagram</h3>
33

    
34
				<c:if test="${not empty errorMessage}">
35
					<p class="alert">${errorMessage}</p>
36
				</c:if>
37

    
38
				<form method="post" enctype="multipart/form-data">
39
					<div class="form-field">
40
						<label for="file">Select SPADe data file:</label><br>
41
						<input type="file" name="file" id="file">
42
					</div>
43

    
44
					<div class="form-field">
45
						Select type of data file:<br>
46
						<label for="spade"><input type="radio" name="jsonFileFormat" value="spade" id="spade" checked> Spade JSON</label><br>
47
						<label for="raw"><input type="radio" name="jsonFileFormat" value="raw" id="raw"> Raw JSON</label><br>
48
					</div>
49

    
50
					<button type="submit">Start visualization</button>
51
				</form>
52
			</div>
53

    
54
			<c:if test="${isLoggedIn}">
55
				<div class="diagrams-menu">
56
					<h3>My diagrams</h3>
57

    
58
					<ul>
59
						<c:forEach items="${diagramsPrivate}" var="diagram">
60
							<li>
61
								<a href="${HOME_URL}graph?diagramId=${diagram.id}">${diagram.name}</a>
62
								<button class="removeDiagramButton" data-name="${diagram.name}" data-id="${diagram.id}"><img src="images/button_cancel.png" alt="odstranit"></button>
63
							</li>
64
						</c:forEach>
65
					</ul>
66
				</div>
67
			</c:if>
68

    
69
			<div class="diagrams-menu">
70
				<h3>Public diagrams</h3>
71

    
72
				<ul>
73
					<c:forEach items="${diagramsPublic}" var="diagram">
74
						<li>
75
							<a href="${HOME_URL}graph?diagramId=${diagram.id}">${diagram.name}</a>
76
						</li>
77
					</c:forEach>
78
				</ul>
79
			</div>
80
		</main>
81

    
82
		<script>
83
			$('.removeDiagramButton').click(function(e) {
84

    
85
			    if(confirm('Are you want to delete ' + $(this).data('name') + '?')) {
86
                    $.ajax({
87
                        'type': 'delete',
88
                        'url': 'api/remove-diagram?diagram_id=' + $(this).data('id'),
89
                        'success': function () {
90
                            location.reload(true);
91
                        },
92
                        'error': function (xhr) {
93
                            switch (xhr.status) {
94
                                case 401:
95
                                    alert('You are either not logged in or not an owner of this diagram.');
96
                                    break;
97
                                default:
98
                                    alert('Something went wrong.');
99
                            }
100
                        },
101
                    });
102
                }
103
			});
104
		</script>
105
	</body>
106
</html>
(5-5/6)