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
|
<label for="jsonFileFormat">Select type of JSON:</label><br>
|
46
|
<select name="jsonFileFormat" id="jsonFileFormat">
|
47
|
<option value="spade">Spade JSON</option>
|
48
|
<option value="raw">Raw JSON</option>
|
49
|
</select>
|
50
|
</div>
|
51
|
|
52
|
<button type="submit">Start visualization</button>
|
53
|
</form>
|
54
|
</div>
|
55
|
|
56
|
<c:if test="${isLoggedIn}">
|
57
|
<div class="diagrams-menu">
|
58
|
<h3>My diagrams</h3>
|
59
|
|
60
|
<ul>
|
61
|
<c:forEach items="${diagramsPrivate}" var="diagram">
|
62
|
<li>
|
63
|
<a href="${HOME_URL}graph?diagramId=${diagram.id}">${diagram.name}</a>
|
64
|
<button class="removeDiagramButton" data-name="${diagram.name}" data-id="${diagram.id}"><img src="images/button_cancel.png" alt="odstranit"></button>
|
65
|
</li>
|
66
|
</c:forEach>
|
67
|
</ul>
|
68
|
</div>
|
69
|
</c:if>
|
70
|
|
71
|
<div class="diagrams-menu">
|
72
|
<h3>Public diagrams</h3>
|
73
|
|
74
|
<ul>
|
75
|
<c:forEach items="${diagramsPublic}" var="diagram">
|
76
|
<li>
|
77
|
<a href="${HOME_URL}graph?diagramId=${diagram.id}">${diagram.name}</a>
|
78
|
</li>
|
79
|
</c:forEach>
|
80
|
</ul>
|
81
|
</div>
|
82
|
</main>
|
83
|
|
84
|
<script>
|
85
|
$('.removeDiagramButton').click(function(e) {
|
86
|
|
87
|
if(confirm('Are you want to delete ' + $(this).data('name') + '?')) {
|
88
|
$.ajax({
|
89
|
'type': 'delete',
|
90
|
'url': 'api/remove-diagram?diagram_id=' + $(this).data('id'),
|
91
|
'success': function () {
|
92
|
location.reload(true);
|
93
|
},
|
94
|
'error': function (xhr) {
|
95
|
switch (xhr.status) {
|
96
|
case 401:
|
97
|
alert('You are either not logged in or not an owner of this diagram.');
|
98
|
break;
|
99
|
default:
|
100
|
alert('Something went wrong.');
|
101
|
}
|
102
|
},
|
103
|
});
|
104
|
}
|
105
|
});
|
106
|
</script>
|
107
|
</body>
|
108
|
</html>
|