-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathacceptedpapers.php
executable file
·113 lines (103 loc) · 3.32 KB
/
acceptedpapers.php
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
<!DOCTYPE html>
<html lang="en">
<head>
<?php // The header includes the head tag and start of body
require "includes/head.php";
?>
<meta property="og:title" content="<?php echo $META['shortName'];?> accepted papers"/>
<meta name="twitter:title" content="<?php echo $META['shortName'];?> accepted papers"/>
<title>
<?php echo $META['shortName'];?> Accepted Papers
</title>
</head>
<body>
<?php require "includes/nav.php"; ?>
<main class="container">
<h2 class="indPageTitle">
Accepted Papers
</h2>
<!-- NOTE: if json/papers.json exists, then this will be hidden. -->
<p id="notYetAvailable">
This information is not yet available. This information will be available after authors are notified, which should
occur by <?php echo $META['finalNotification'];?>. Thank you for your patience.
</p>
<!-- NOTE: if json/papers.json is malformed, this will be shown. -->
<p id="jsonWarning" class="text-danger d-none">
The papers.json file is malformed.
</p>
<!-- NOTE: if json/papers.json is fetched and parsed, this is populated. -->
<div id="accepted">
</div>
<!-- Handlebars import of accepted papers in websubrev export format. See
json/sample_papers.json -->
<script id="acceptedScript" type="text/x-handlebars-template">
<p>
These papers are listed in order of submission.
</p>
<ol>
{{#each acceptedPapers}}
<li>
<h5 class="paperTitle">
{{title}}
</h5>
<p>
{{authors}}
<br>
<small class="fst-italic">{{affiliations}}</small>
</p>
</li>
{{/each}}
</ol>
</script>
</main>
<?php include "includes/footer.php";?>
<!-- Handlebars -->
<script src="https://iacr.org/libs/js/handlebars/handlebars-v4.1.0.js" type="text/javascript"></script>
<script>
function removeDups(arr) {
let unique = {};
arr.forEach(function(i) {
if(!unique[i]) {
unique[i] = true;
}
});
return Object.keys(unique);
}
try {
fetch('json/papers.json',
{credentials: 'same-origin'})
.then(response => {
console.dir(response);
console.dir(response.status);
if (response.ok && response.status == 200) {
return response.json();
}
})
.then(data => {
if (data) {
data.acceptedPapers.forEach((paper) => {
paper.authors = paper.authors.join(', ');
});
data.acceptedPapers.forEach((paper) => {
paper.affiliations = removeDups(paper.affiliations).join('; ');
});
var theTemplateScript = $("#acceptedScript").html();
var theTemplate = Handlebars.compile(theTemplateScript);
var theCompiledHtml = theTemplate(data);
$('#accepted').html(theCompiledHtml);
$('#notYetAvailable').hide();
}
})
.catch((e) => {
console.log('an error occurred');
$('#jsonWarning').removeClass('d-none');
console.dir(e);
});
} catch (error) {
console.dir(error);
$('jsonWarning').html('The server is failing or your browser is not supported.');
$('#jsonWarning').removeClass('d-none');
}
</script>
</body>
</html>