1
|
window.addEvent('domready', function () {
|
2
|
// publications
|
3
|
$$('div.publication').each(function (publication) {
|
4
|
publication.license = publication.getElement('select.license');
|
5
|
if (publication.license == null)
|
6
|
publication.getElement('div.licenseErrorMessage').hide();
|
7
|
else {
|
8
|
publication.license.errorMessage = publication.getElement('div.licenseErrorMessage');
|
9
|
publication.license.errorMessage.hide();
|
10
|
}
|
11
|
publication.embargoEndDate = publication.getElement('input.embargoEndDate-'+publication.id);
|
12
|
if (publication.embargoEndDate == null)
|
13
|
publication.getElement('div.embargoEndDateErrorMessage').hide();
|
14
|
else {
|
15
|
publication.embargoEndDate.errorMessage = publication.getElement('div.embargoEndDateErrorMessage');
|
16
|
publication.embargoEndDate.errorMessage.hide();
|
17
|
}
|
18
|
if ((publication.licese != null) && (publication.embargoEndDate != null)) {
|
19
|
publication.license.addEvent('change', function () {
|
20
|
publication.embargoEndDate.disabled = publication.license.value != 'EMBARGO';
|
21
|
});
|
22
|
publication.license.fireEvent('change');
|
23
|
}
|
24
|
});
|
25
|
// proceed button
|
26
|
$('proceedForm').addEvent('submit', function () {
|
27
|
var submit = true;
|
28
|
$$('div.publication').each(function (publication) {
|
29
|
|
30
|
publication.license = publication.getElement('select.license');
|
31
|
|
32
|
publication.embargoEndDate = document.getElementById("embargoEndDate-"+publication.id);
|
33
|
|
34
|
//publication.embargoEndDate = publication.getElement('input.embargoEndDate-'+publication.id);
|
35
|
if ((publication.license != null)) {
|
36
|
publication.embargoEndDate.errorMessage = publication.getElement('div.embargoEndDateErrorMessage');
|
37
|
switch (publication.license.value) {
|
38
|
case 'OPEN':
|
39
|
case 'CLOSED':
|
40
|
case 'RESTRICTED':
|
41
|
publication.license.errorMessage.hide();
|
42
|
publication.embargoEndDate.errorMessage.hide();
|
43
|
break;
|
44
|
case 'EMBARGO':
|
45
|
publication.license.errorMessage.hide();
|
46
|
if ( (publication.embargoEndDate != null)&&(publication.embargoEndDate.value == '')) {
|
47
|
publication.embargoEndDate.errorMessage.show();
|
48
|
submit=false;
|
49
|
return false;
|
50
|
} else{
|
51
|
publication.embargoEndDate.errorMessage.hide();
|
52
|
}
|
53
|
break;
|
54
|
default:
|
55
|
|
56
|
publication.license.errorMessage.show();
|
57
|
publication.embargoEndDate.errorMessage.hide();
|
58
|
submit=false;
|
59
|
return false;
|
60
|
|
61
|
}
|
62
|
}
|
63
|
});
|
64
|
return submit;
|
65
|
});
|
66
|
// project tooltips
|
67
|
$$('div.project').each(function (project) {
|
68
|
var acronym = project.getElement('span.acronym');
|
69
|
acronym.addEvent('mouseover', function () {
|
70
|
tooltip.pop(acronym, '#' + acronym.dataset.info, {offsetX: -20, license: tooltipLicense});
|
71
|
});
|
72
|
});
|
73
|
// publication tooltips
|
74
|
$$('div.publication').each(function (publication) {
|
75
|
var title = publication.getElement('span.title');
|
76
|
title.addEvent('mouseover', function () {
|
77
|
tooltip.pop(title, '#' + title.dataset.info, {offsetX: -20, license: tooltipLicense});
|
78
|
});
|
79
|
});
|
80
|
// proceed button
|
81
|
$('proceedForm').addEvent('submit', function () {
|
82
|
var submit = true;
|
83
|
$$('div.publication').each(function (publication) {
|
84
|
if ((publication.license != null) && (publication.embargoEndDate != null)) {
|
85
|
}
|
86
|
});
|
87
|
return submit;
|
88
|
});
|
89
|
|
90
|
});
|
91
|
|