forked from bigbio/proma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Settings-Template.html
211 lines (170 loc) · 6.5 KB
/
Settings-Template.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<style>
body,
html {
font-family: 'Roboto', sans-serif;
font-size: 14px;
color: #666666;
padding: 10px;
}
p {
margin: 0;
}
#loading,
#loading-preferences {
padding: 30px;
}
#info {
padding: 10px;
font-weight: bolder;
}
.PROMA-header {
padding-top: 5px;
height: 75px;
}
.btn-green {
text-align: center;
padding: 5px 8px;
border-radius: 4px;
border: none;
background-color: #4FBA6F;
width: 100%;
color: white;
display: block;
cursor: pointer;
}
.bth-green:hover {
background-color: #4FBA6F;
}
.restrictions {
padding: 10px;
background-color: #ecf0f1;
border-radius: 4px;
}
.hidden {
display: none;
}
</style>
<script>
var ontologies = {};
var selectedOntologyService = 'OLS';
$(function () {
google.script.run.withSuccessHandler(setOntologies)
.loadOntologies();
google.script.run.withSuccessHandler(setInsertionPreference)
.loadPreferences();
});
function setInsertionPreference(data) {
insertionOneColumn = data;
$('#option_same_column').attr('checked', insertionOneColumn);
$('#option_different_column').attr('checked', !insertionOneColumn);
$('#loading-preferences').addClass('hidden');
$('#preferences').removeClass('hidden');
}
function updateInsertionPreferences() {
insertionOneColumn = $('#option_same_column').is(":checked");
console.log(insertionOneColumn);
google.script.run.setOntologyInsertionPreference(insertionOneColumn);
}
function setOntologies(data) {
ontologies = data;
$('#loading').addClass('hidden');
$('#restrictions').removeClass('hidden');
renderRestrictions();
}
function renderRestrictions() {
$('#ontology').html('');
$('#hiddenService').val(selectedOntologyService);
Object.keys(ontologies[selectedOntologyService]).sort().forEach(function (d) {
$('#ontology').append('<option value="' + d + ' - ' + ontologies[selectedOntologyService][d].name + '">' + d + ' - ' + ontologies[selectedOntologyService][d].name + '</option>');
});
}
function showAddRestrictionStatus(callback) {
$('#info').removeClass('hidden');
$('#info').text(callback);
window.setTimeout(function () {
$('#info').text('');
$('#info').addClass('hidden');
}, 10000);
}
function preventFormSubmit() {
var forms = document.querySelectorAll('form');
for (var i = 0; i < forms.length; i++) {
forms[i].addEventListener('submit', function (event) {
event.preventDefault();
});
}
}
function addRestriction(formObject) {
console.log(formObject);
var columnName = $('#columnName').val();
if (columnName != "") {
google.script.run.withSuccessHandler(showAddRestrictionStatus).addRestrictionHandler(formObject)
} else {
showAddRestrictionStatus('Column Name must not be empty.');
}
}
</script>
</head>
<body>
<div class="PROMA-header" align="center">
<img src="https://raw.githubusercontent.com/bigbio/proma/main/figures/logo_with_name.png" width="225" height="60">
</div>
<br /><br />
<div align="left" id="options">
<div id="loading-preferences" align="center">
<img src="//s-media-cache-ak0.pinimg.com/originals/0a/59/71/0a59718a5ee79a0558930ca9907c0659.gif"
width="40px" />
<p>Loading Preferences
</div>
</div>
<div id="preferences" class="hidden">
<p style="font-weight: bolder">How do you want ontology terms to be entered in the spreadsheet?</p>
<br />
<input type="radio" id="option_same_column" name="ontologyFormat" value="same"
onchange="updateInsertionPreferences()">
<label for="male">Place term name and accession in same column</label><br>
<input type="radio" id="option_different_column" name="ontologyFormat" onchange="updateInsertionPreferences()"
value="different" checked>
<label for="female">Place term name and accession in different columns.</label><br>
</div>
<br /><br />
<p style="font-weight: bolder">Do you wish to restrict the search space for columns?</p>
<p style="font-size: 12px; color: #bbbbbb">All restrictions are added to the 'Restrictions' sheet.</p>
<br />
<div id="loading" align="center">
<img src="//s-media-cache-ak0.pinimg.com/originals/0a/59/71/0a59718a5ee79a0558930ca9907c0659.gif" width="40px"
/>
<p>Loading Ontologies</p>
</div>
<div id="restrictions" class="restrictions hidden">
<form id="ontologySelectionForm" onsubmit="addRestriction(this)">
<div>
<p style="font-weight: bolder">Column Name</p>
<input id="columnName" name="columnName" type="text" style="width: 96%" />
</div>
<br />
<div>
<p style="font-weight: bolder">Ontology</p>
<select id="ontology" name="ontology" style="width: 100%;">
</select>
</div>
<input id="hiddenService" name="service" type="hidden" />
<br />
<p id="info" class="hidden"></p>
<button type="submit" class="btn-green">Add Restriction</button>
</form>
</div>
<br />
<br />
<p>
<span class="btn-green" onclick="google.script.run.viewRestrictionHandler()">
View all restrictions
</span>
</p>
</body>
</html>