This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArticleRequest.html
150 lines (108 loc) · 5.91 KB
/
ArticleRequest.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
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>ILLiad - Scan Request</title>
<#INCLUDE filename="include_head.html">
</head>
<body>
<#INCLUDE filename="include_header.html">
<#INCLUDE filename="include_menu.html">
<div class="container">
<main id="content" aria-label="Content">
<form id="ArticleRequestForm" action="illiad.dll" method="post" name="ArticleRequest">
<input type="hidden" name="ILLiadForm" value="ArticleRequest">
<input type="hidden" name="ItemInfo1" value="Article">
<input type="hidden" name="Username" value="<#PARAM name='Username'>">
<input type="hidden" name="SessionID" value="<#PARAM name='SessionID'>">
<#FORMSTATE>
<fieldset>
<h2 id="pageHeader">Scan (Request Scans from Non- UA Libraries)</h2>
<#INCLUDE filename="include_article_request_fields.html">
<#INCLUDE filename="include_request_cited.html">
<#INCLUDE filename="include_request_buttons.html">
</fieldset>
<#INCLUDE filename='include_js_helpers.html'> <!--- includes helper javascript functions for interacting with the page's html -->
<script>
$(document).ready(function () {
let parameters = decodeURIComponent(document.location.search);
isDocDelivery = parameters.indexOf('docdelivery=true') !== -1;
console.log(parameters);
if (isDocDelivery) {
requiredFields = requiredFieldsPhotocopyReqDocDelivery;
//$('label[for="Notes"]').css('display', 'none');
hideElement('#requestCited');
//Hide buttons that no longer work
hideElement('#buttonCancel');
$('input[name="ItemInfo1"]').attr('value', 'DocDeliveryPublic');
//If both catalog and document delivery parameters are present, add doc delivery to form for automatic routing
let isCatalog = parameters.indexOf('catalog=true') !== -1;
if (isCatalog) {
$('input[name="ItemInfo1"]').attr('value', 'DocDelivery');
console.log("Catalog param found");
} else {
console.log("Catalog param NOT found");
}
$('#pageHeader').html("UA Scan Express (Request Scans for Electronic Delivery)");
$('#pageHeader').after('<p id="pageIntroduction">Use this form to request a scan of an article from a journal we have in print or a book chapter from a book we have in print (this includes Archival Facility requests). </p>');
unHideElement('#formGroup-ItemInfo2');
hideFormGroup('ESPNumber');
} else {
requiredFields = requiredFieldsPhotocopyReq;
}
requiredFields.forEach(field => {
makeRequired(field);
});
$('#ArticleRequestForm').submit(function (event) {
let missingFields = [];
for (i = 0; i < requiredFields.length; i++) {
let currentField = requiredFields[i];
let currentContent = $('#' + currentField).val();
if (currentField == 'ItemInfo2') {
if ((currentContent == '') || (currentContent == 'No')) {
missingFields.push(currentField);
} else {
$("#" + currentField).removeClass("is-invalid");
}
} else {
if (currentContent == '') {
console.log("FORM UNFILLED!");
missingFields.push(currentField);
} else {
$("#" + currentField).removeClass("is-invalid");
}
}
}
if (missingFields.length > 0) {
for (i = 0; i < missingFields.length; i++) {
let missingField = missingFields[i];
if (i === 0){
// focus first field with error message
$("#"+missingField).focus();
}
addErrorMessageToField(missingField, "Field is missing!");
}
let topErrorMessage = '<p style="color: red;">Required fields are missing.</p>';
console.log("MISSING FIELDS ARRAY");
console.log(missingFields);
topErrorMessage += "</div>";
console.log("TOP ERROR MESSAGE IS");
console.log(topErrorMessage);
if (topErrorMessage == 0) {
topErrorMessage = '<div id="TopErrorMessage">' + topErrorMessage + '</div>';
$('#pageIntroduction').after(topErrorMessage);
} else {
$('#TopErrorMessage').html('');
$('#TopErrorMessage').html(topErrorMessage);
}
return false;
}
});
unHideElement('#content');
});
</script>
</form>
</main>
<#INCLUDE filename="include_footer.html">
</div>
</body>
</html>