Project

General

Profile

1
dojo.require('dojo.rpc.*');
2
dojo.hostenv.writeIncludes();
3
dojo.require();
4

    
5
const EP_MANAGER = new dojo.rpc.JsonService('EPublication');
6
const FLASH_FILE = 'pages/flash/uoa-enhanced-publications.swf';
7

    
8
function loadEntities() {
9
	EP_MANAGER.getEntities().addCallbacks(loadEntitiesCallback, traceError);
10
}
11

    
12
function loadEntitiesCallback(result) {
13
	object.loadEntitiesCallback(result);
14
}
15

    
16
function loadRelations() {
17
	EP_MANAGER.getRelations().addCallbacks(loadRelationsCallback, traceError);
18
}
19

    
20
function loadRelationsCallback(result) {
21
	object.loadRelationsCallback(result);
22
}
23

    
24
function loadDropboxContents() {
25
	EP_MANAGER.getDropboxContents().addCallbacks(loadDropboxContentsCallback, traceError);
26
}
27

    
28
function loadDropboxContentsCallback(result) {
29
	object.loadDropboxContentsCallback(result);
30
}
31

    
32
function loadGraph(id) {
33
	EP_MANAGER.getGraph(id).addCallbacks(loadGraphCallback, traceError);
34
}
35

    
36
function loadGraphCallback(result) {
37
	object.loadGraphCallback(result);
38
}
39

    
40
function saveGraph(rootId, commands) {
41
	EP_MANAGER.saveGraph(rootId, commands).addCallbacks(saveGraphCallback, traceError);
42
}
43

    
44
function saveGraphCallback(result) {
45
	object.saveGraphCallback(result);
46
}
47

    
48
function traceError(error) {
49
	object.traceError(error);
50
}
51

    
52
var object = null;
53

    
54
function render(containerId, epId) {
55
	object = document.createElement('object');
56
	object.data = FLASH_FILE;
57
	object.type = 'application/x-shockwave-flash';
58
	object.width = '100%';
59
	object.height = '100%';
60
	var movie = document.createElement('param');
61
	movie.setAttribute('name', 'movie');
62
	movie.setAttribute('value', FLASH_FILE);
63
	object.appendChild(movie);
64
	var quality = document.createElement('param');
65
	quality.setAttribute('name', 'quality');
66
	quality.setAttribute('value', 'high');
67
	object.appendChild(quality);
68
	var flashVars = document.createElement('param');
69
	flashVars.setAttribute('name', 'FlashVars');
70
	var flashVarsValue = '';
71
	flashVars.setAttribute('value', 'id=' + encodeURIComponent(epId));
72
	object.appendChild(flashVars);
73
	var container = document.getElementById(containerId);
74
	while (container.length)
75
		container.childNodes.shift();
76
	container.appendChild(object);
77
}
(1-1/21)