-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcollection.js
80 lines (63 loc) · 1.84 KB
/
collection.js
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
(function(root) {
'use strict';
function loadSuccess(resp)
{
var res, id, i, sz;
if (null === (res = parseJSON(resp)))
return;
id = parseInt(getQueryVariable('id'));
for (i = 0, sz = res.principal.colns.length; i < sz; i++)
if (res.principal.colns[i].id === id)
break;
if (i === sz) {
location.href = '@HTDOCS@/home.html';
return;
}
classSet(document.getElementById('loading'), 'hide');
classUnset(document.getElementById('loaded'), 'hide');
principalFill(res.principal);
colnFill(document, res.principal, res.principal.colns[i]);
}
function loadSetup()
{
classUnset(document.getElementById('loading'), 'hide');
classSet(document.getElementById('loaded'), 'hide');
}
function load()
{
var id;
if (null !== (id = getQueryVariable('id')) &&
NaN !== parseInt(id))
sendQuery('@CGIURI@/index.json',
loadSetup, loadSuccess, null);
else
location.href = '@HTDOCS@/home.html';
}
function setcolnpropsError(code, prefix)
{
var cls;
cls = 'setcolnprops-error-sys';
if (400 === code)
cls = 'setcolnprops-error-form';
classUnset(document.getElementById(cls), 'hide');
classUnset(document.getElementById(prefix + '-btn'), 'hide');
classSet(document.getElementById(prefix + '-pbtn'), 'hide');
}
function setcolnpropsSetup(name)
{
var list, i, sz;
list = document.getElementsByClassName('setcolnprops-error');
for (i = 0, sz = list.length; i < sz; i++)
classSet(list[i], 'hide');
classSet(document.getElementById(name + '-btn'), 'hide');
classUnset(document.getElementById(name + '-pbtn'), 'hide');
}
function setcolnprops(e, prefix)
{
return(sendForm(e, function() { setcolnpropsSetup(prefix); },
function(code) { setcolnpropsError(code, prefix); },
function() { document.location.reload(); }));
}
root.load = load;
root.setcolnprops = setcolnprops;
})(this);