forked from rwth-acis/OCD-Web-Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
covers.html
188 lines (187 loc) · 9.39 KB
/
covers.html
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!DOCTYPE html>
<html>
<!-- Displays basic/meta information on multiple covers -->
<head>
<title>OCD - Covers</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="CSS/layout.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//npmcdn.com/[email protected]/dist/js/tether.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="JS/contentHandler.js"></script>
<script src="node_modules/js-base64/base64.js"></script>
<script src="JS/ServiceAPI/moduleHelper.js"></script>
<script src="JS/ServiceAPI/serviceAPI.js"></script>
<script src="JS/requestHandler.js"></script>
<script src="node_modules/tablesorter/dist/js/jquery.tablesorter.min.js"></script>
<script src="JS/coverTableHandler.js"></script>
<script src="node_modules/file-saver/dist/FileSaver.min.js"></script>
<script type="text/javascript">
/*
* Defines current page and page size.
*/
var COVERS_PER_PAGE = 20;
var pageNumber = 0;
/*
* Executed after page loading.
*/
$(document).ready(function() {
/* Number of the cover table page to display */
pageNumber = getUrlVar("page");
if(!pageNumber) {
pageNumber = 0;
}
$('.pageNumWrapper').append(pageNumber);
/* Index of the first cover to be displayed */
var firstIndex = COVERS_PER_PAGE * pageNumber;
/* Identifiers for the cover information to display */
var cells = ["Name", "Graph", "CreationMethod", "Communities", "R", ".xml", ".txt"];
var graphIdQueryExtension = getUrlVar("graphId");
if(!graphIdQueryExtension) {
graphIdQueryExtension = "";
}
else {
graphIdQueryExtension = "&graphId=" + graphIdQueryExtension;
}
/* Requests the cover information */
sendRequest("get", "covers?executionStatuses=COMPLETED&includeMeta=TRUE&"
+ "firstIndex=" + firstIndex + "&length=" + COVERS_PER_PAGE + graphIdQueryExtension, "",
/* Response handler */
function(coverMetasXml) {
/*
* CoverMetas request succeeded
*/
if(!graphIdQueryExtension || graphIdQueryExtension == "") {
if ($(coverMetasXml).find("Id").length === 0 && pageNumber > 0) {
pageNumber--;
var newUrl = "covers.html?page=" + pageNumber;
window.location.href = newUrl;
}
}
else {
if ($(coverMetasXml).find("Id").length === 0 && pageNumber > 0) {
pageNumber--;
var newUrl = "covers.html?page=" + pageNumber + "&graphId=" + graphIdQueryExtension;
window.location.href = newUrl;
}
}
$(coverMetasXml).find("Cover").each(function() {
appendCoverRow($('#coverTable'), $(this), cells);
});
/*
* Sort Table
*/
try {
$("#coverTable").tablesorter({sortList: [[1,0],[0,0]],
headers: { 6: { sorter: false}, 7: {sorter: false}, 8: {sorter: false}}});
} catch(err) { /* table empty */ }
/*
* Register event handlers
*/
registerCoverTable();
},
/* Error handler */
function(errorData) {
/*
* GraphIds request failed
*/
showConnectionErrorMessage("Cover metas were not received.", errorData);
});
/* Page control for the cover page to be displayed */
$('.pageLeft').click(function(){
if(pageNumber > 0) {
pageNumber--;
var newUrl = "covers.html?page=" + pageNumber;
var graphIdQueryExtension = getUrlVar("graphId");
if(!graphIdQueryExtension) {
graphIdQueryExtension = "";
}
else {
graphIdQueryExtension = "&graphId=" + graphIdQueryExtension;
}
newUrl += graphIdQueryExtension;
window.location.href = newUrl;
}
});
$('.pageRight').click(function(){
pageNumber++;
var newUrl = "covers.html?page=" + pageNumber;
var graphIdQueryExtension = getUrlVar("graphId");
if(!graphIdQueryExtension) {
graphIdQueryExtension = "";
}
else {
graphIdQueryExtension = "&graphId=" + graphIdQueryExtension;
}
newUrl += graphIdQueryExtension;
window.location.href = newUrl;
});
});
</script>
</head>
<body>
<div id="wrapper">
<div id="contentWrapper">
<div id="content">
<!-- Displays error messages -->
<div id="errorMessageWrapper">
<div id="errorMessage"></div>
</div>
<!-- Page control for the cover table -->
<div class = "pageControlWrapper">
<div class="pageControl">
<div class="pageLeftWrapper">
<img class="icon iconBtn pageLeft" src="IMG/open-iconic/svg/chevron-left.svg" alt="r">
</div>
<div class = "pageNumWrapper">
</div>
<div class="pageRightWrapper">
<img class="icon iconBtn pageRight" src="IMG/open-iconic/svg/chevron-right.svg" alt="r">
</div>
</div>
</div>
<!-- Cover meta information table -->
<div class="tableWrapper table-responsive">
<table id="coverTable" class="cover table table-striped">
<thead>
<tr>
<th class="hidden" title="CoverId"></th>
<th class="hidden" title="GraphId"></th>
<th width="300" title="Cover Name" class="sortable">
Name
<img class="icon iconBtn" src="IMG/open-iconic/svg/sort-ascending.svg" alt="d">
</th>
<th width="300" title="Graph Name" class="sortable">
Graph
<img class="icon iconBtn" src="IMG/open-iconic/svg/sort-ascending.svg" alt="d">
</th>
<th width="300" title="Algorithm Name" class="sortable">
Creation Method
<img class="icon iconBtn" src="IMG/open-iconic/svg/sort-ascending.svg" alt="d">
</th>
<th width="100" title="Community Count" class="sortable">
Communities
<img class="icon iconBtn" src="IMG/open-iconic/svg/sort-ascending.svg" alt="d">
</th>
<th width="20" title="Remove Cover">
R
</th>
<th width="30" title="Save Cover XML">
.xml
</th>
<th width="30" title="Save Cover Matrix">
.txt
</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
</body>
</html>