forked from colin-combe/CLMS-UI
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgithubForm.html
100 lines (90 loc) · 3.67 KB
/
githubForm.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>GitHub Issue Reporting Form</title>
<link rel="stylesheet" href="../vendor/css/common.css" />
<link rel="stylesheet" href="../vendor/css/jquery-ui.css" />
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="../vendor/js/jquery-3.4.1.js"></script>
<script type="text/javascript" src="../vendor/js/jquery-ui.js"></script>
<style>
* {
box-sizing: border-box;
}
body {
padding: 1.5em;
margin: 0;
}
.wideDivider {
margin: 1em 0em;
border-top: 8px solid #aaa;
}
h2 {
color: #44a;
}
input:invalid, textarea:invalid {
border-color: #f88;
}
input, textarea {
color: #222;
}
input:disabled {
color: #aaa;
}
</style>
</head>
<body>
<div class="wideDivider"/>
<h1>Report a xiVIEW Issue</h1>
<form action="" name="issueForm" id="issueForm" method="post">
<h2>Title</h2>
<input type="text" id="issueName" name="issueName" form="issueForm" size="50" required>
<h2>Details</h2>
<h4>Required (Plain text only, but please be as descriptive as possible, include search IDs etc)</h4>
<textarea id="issueText" class="text" cols="86" rows ="16" name="issueText" form="issueForm" required></textarea>
<div id="recaptchaWidget" data-sitekey="getFromConfig.json"></div>
<span class="error">< Please check the captcha form</span>
<br/>
<h2 id="submitLabel">Submit Issue</h2>
<input type="submit" value="SUBMIT" id="submitButton">
</form>
<div class="wideDivider"/>
<script>
var onloadCallback = function () {
$.when (
$.getJSON("publicKey.json"),
).done (function (config) {
// set recaptcha public key in widget
$("#recaptchaWidget")
.attr("class", "g-recaptcha")
.attr("data-sitekey", config.googleRecaptchaPublicKey)
;
grecaptcha.render('recaptchaWidget', {'sitekey': config.googleRecaptchaPublicKey});
$("#issueForm").submit(function (event) {
event.preventDefault();
$.post (
"../vendor/php/githubIssue.php",
$("#issueForm").serialize()+"&"+"g-recaptcha-response="+grecaptcha.getResponse(),
).done (function (data) {
//console.log (data);
try {
var json = JSON.parse (data);
if (json.success) {
$("#submitLabel").html("Thank you, issue has been submitted: "+json.msg);
$("#submitButton").prop ("disabled", true);
} else if (json.fail || json.status === "fail") {
$("#submitLabel").text(json.msg || (json.error+": "+json.field));
}
} catch (err) {
$("#submitLabel").text("An error occurred. Please contact your Xi Administrator.");
}
})
});
});
}
</script>
<script src="https://www.recaptcha.net/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
</body>
</html>