cpee-frames 1.0.5 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/cpee-frames.gemspec +1 -1
- data/lib/cpee-frames/frames.xml +0 -8
- data/lib/cpee-frames/implementation.rb +40 -63
- data/lib/cpee-frames/ui/template.html +12 -16
- data/lib/cpee-frames/ui/tutorial.html +89 -108
- data/server/frames +2 -0
- data/tools/cpee-frames +5 -5
- data/ui/examples/button.html +48 -0
- data/ui/examples/questions.css +23 -0
- data/ui/examples/questions.html +238 -0
- data/ui/examples/spinner.html +34 -0
- data/ui/examples/text.css +1 -0
- data/ui/examples/text.html +21 -0
- data/ui/js/frames.js +17 -0
- data/ui/js/ui.js +12 -127
- metadata +10 -11
- data/lib/cpee-frames/ui/framedata.html +0 -57
- data/lib/cpee-frames/ui/menu.html +0 -66
- data/lib/cpee-frames/ui/test.html +0 -52
- data/ui/js/frame_data.js +0 -55
- data/ui/js/test.js +0 -61
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
5
|
+
<title>Button</title>
|
|
6
|
+
<script type="text/javascript" src="/js_libs/jquery.min.js"></script>
|
|
7
|
+
<script type="text/javascript" src="../js/frames.js"></script>
|
|
8
|
+
<style>
|
|
9
|
+
:root {
|
|
10
|
+
--x-ui-outside-color: #000000;
|
|
11
|
+
--x-ui-border-color: #a1a1a1;
|
|
12
|
+
|
|
13
|
+
--x-ui-content-border-color: #ffed00;
|
|
14
|
+
--x-ui-content-light-background: #f0f0f0;
|
|
15
|
+
--x-ui-content-hover-background: #99cce660;
|
|
16
|
+
|
|
17
|
+
--x-frames-back: #ffffff;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body {
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
background-color: var(--x-frames-back);
|
|
24
|
+
height: 100vh;
|
|
25
|
+
}
|
|
26
|
+
div {
|
|
27
|
+
height: 100%;
|
|
28
|
+
padding: 1em;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
}
|
|
31
|
+
button {
|
|
32
|
+
height: 100%;
|
|
33
|
+
width: 100%;
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
</style>
|
|
38
|
+
<script>
|
|
39
|
+
// you have access to cpee.data and cpee.callback, because frames.js (remote includable) fills it through postMessage
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
</head>
|
|
43
|
+
<body>
|
|
44
|
+
<div>
|
|
45
|
+
<button onclick="cpee_callback(cpee.callback,cpee.data)" value="ok">Measure</button>
|
|
46
|
+
</div>
|
|
47
|
+
</body>
|
|
48
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--x-custom-border-color: #a1a1a1;
|
|
3
|
+
--x-custom-outside-color: #ffffff;
|
|
4
|
+
--x-custom-background-color: #ffffff;
|
|
5
|
+
--x-custom-light-text-color: #333;
|
|
6
|
+
--x-custom-light-back-color: #e8e8e8;
|
|
7
|
+
--x-custom-link-color: #425d73;
|
|
8
|
+
--x-custom-content-border-left-color: #eaeaea;
|
|
9
|
+
--x-custom-content-border-right-color: #777777;
|
|
10
|
+
--x-custom-content-light-background: #e8e8e8;
|
|
11
|
+
--x-custom-content-active-background: #c061cb;
|
|
12
|
+
--x-custom-content-hover-background: #99cce660;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@font-face {
|
|
16
|
+
font-family: adawaita-sans;
|
|
17
|
+
src: url(/js_libs/AdwaitaSans-Regular.ttf);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body {
|
|
21
|
+
font-family: adawaita-sans;
|
|
22
|
+
margin: 1em;
|
|
23
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
5
|
+
<title>Questions</title>
|
|
6
|
+
<script type="text/javascript" src="/js_libs/jquery.min.js"></script>
|
|
7
|
+
<script type="text/javascript" src="/js_libs/marked.min.js"></script>
|
|
8
|
+
<script type="text/javascript" src="../js/frames.js"></script>
|
|
9
|
+
|
|
10
|
+
<link rel="stylesheet" href="questions.css" type="text/css"/>
|
|
11
|
+
|
|
12
|
+
<style>
|
|
13
|
+
.scale a.button:first-child {
|
|
14
|
+
border-top-left-radius: 0.2em;
|
|
15
|
+
border-bottom-left-radius: 0.2em;
|
|
16
|
+
border-left: solid 1px var(--x-custom-content-border-left-color);
|
|
17
|
+
}
|
|
18
|
+
.scale a.button:last-child {
|
|
19
|
+
border-top-right-radius: 0.2em;
|
|
20
|
+
border-bottom-right-radius: 0.2em;
|
|
21
|
+
}
|
|
22
|
+
.scale a.button.down:first-child {
|
|
23
|
+
border-left: solid 1px var(--x-custom-content-border-right-color);
|
|
24
|
+
}
|
|
25
|
+
.scale a.button {
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
display: inline-block;
|
|
28
|
+
text-align: center;
|
|
29
|
+
width: 2em;
|
|
30
|
+
user-select: none;
|
|
31
|
+
background: -moz-linear-gradient(top, var(--x-custom-background-color), var(--x-custom-content-light-background));
|
|
32
|
+
background: -webkit-linear-gradient(top, var(--x-custom-background-color), var(--x-custom-content-light-background));
|
|
33
|
+
border-top: solid 1px var(--x-custom-content-border-left-color);
|
|
34
|
+
border-bottom: solid 1px var(--x-custom-content-border-right-color);
|
|
35
|
+
border-right: solid 1px var(--x-custom-content-border-right-color);
|
|
36
|
+
padding: 0.1em 0.4em;
|
|
37
|
+
}
|
|
38
|
+
.scale a.button.down {
|
|
39
|
+
background: -moz-linear-gradient(bottom, var(--x-custom-background-color), var(--x-custom-content-active-background));
|
|
40
|
+
background: -webkit-linear-gradient(bottom, var(--x-custom-background-color), var(--x-custom-content-active-background));
|
|
41
|
+
border-top: solid 1px var(--x-custom-content-border-right-color);
|
|
42
|
+
border-bottom: solid 1px var(--x-custom-content-border-left-color);
|
|
43
|
+
border-right: solid 1px var(--x-custom-content-border-left-color);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.buttons {
|
|
47
|
+
line-height: 2em;
|
|
48
|
+
}
|
|
49
|
+
.buttons a.button {
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
user-select: none;
|
|
52
|
+
background: -moz-linear-gradient(top, var(--x-custom-background-color), var(--x-custom-content-light-background));
|
|
53
|
+
background: -webkit-linear-gradient(top, var(--x-custom-background-color), var(--x-custom-content-light-background));
|
|
54
|
+
border-radius: 0.2em;
|
|
55
|
+
border-top: solid 0.1em var(--x-custom-content-border-left-color);
|
|
56
|
+
border-left: solid 0.1em var(--x-custom-content-border-left-color);
|
|
57
|
+
border-bottom: solid 0.1em var(--x-custom-content-border-right-color);
|
|
58
|
+
border-right: solid 0.1em var(--x-custom-content-border-right-color);
|
|
59
|
+
padding: 0.1em 0.4em;
|
|
60
|
+
}
|
|
61
|
+
.buttons a.button.down {
|
|
62
|
+
background: -moz-linear-gradient(bottom, var(--x-custom-background-color), var(--x-custom-content-active-background));
|
|
63
|
+
background: -webkit-linear-gradient(bottom, var(--x-custom-background-color), var(--x-custom-content-active-background));
|
|
64
|
+
border-top: solid 0.1em var(--x-custom-content-border-right-color);
|
|
65
|
+
border-left: solid 0.1em var(--x-custom-content-border-right-color);
|
|
66
|
+
border-bottom: solid 0.1em var(--x-custom-content-border-left-color);
|
|
67
|
+
border-right: solid 0.1em var(--x-custom-content-border-left-color);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.container {
|
|
71
|
+
padding-top: 0.2em;
|
|
72
|
+
padding-bottom: 0.5em;
|
|
73
|
+
}
|
|
74
|
+
.container .text {
|
|
75
|
+
padding-bottom: 0.2em;
|
|
76
|
+
}
|
|
77
|
+
.container .feedback textarea {
|
|
78
|
+
box-sizing: border-box;
|
|
79
|
+
width: 100%;
|
|
80
|
+
resize: none;
|
|
81
|
+
height: 12em;
|
|
82
|
+
}
|
|
83
|
+
.container .input input {
|
|
84
|
+
box-sizing: border-box;
|
|
85
|
+
width: 100%;
|
|
86
|
+
}
|
|
87
|
+
input[type=radio] {
|
|
88
|
+
vertical-align: top;
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
91
|
+
|
|
92
|
+
<script>
|
|
93
|
+
function doit(data) {
|
|
94
|
+
let ret = {};
|
|
95
|
+
for (let i=0; i<data.length; i++) {
|
|
96
|
+
if ($('.scale .down',data[i]).length > 0) {
|
|
97
|
+
ret[$(data[i]).attr('id')] = $('.down',data[i]).attr('data-val');
|
|
98
|
+
} else if ($('.buttons .down',data[i]).length > 0) {
|
|
99
|
+
const dat = $('.buttons .button',data[i]);
|
|
100
|
+
ret[$(data[i]).attr('id')] = {};
|
|
101
|
+
for (let j=0; j<dat.length; j++) {
|
|
102
|
+
const d = $(dat[j]);
|
|
103
|
+
ret[$(data[i]).attr('id')][d.text()] = (d.hasClass('down')) ? true : false;
|
|
104
|
+
};
|
|
105
|
+
} else if ($('.feedback textarea',data[i]).length > 0) {
|
|
106
|
+
ret[$(data[i]).attr('id')] = $('.feedback textarea',data[i]).val();
|
|
107
|
+
} else if ($('.input input[type=text]',data[i]).length > 0) {
|
|
108
|
+
ret[$(data[i]).attr('id')] = $('.input input',data[i]).val();
|
|
109
|
+
} else if ($('.select input:radio',data[i]).length > 0) {
|
|
110
|
+
ret[$(data[i]).attr('id')] = $('.select input:checked',data[i]).val();
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
$.ajax({
|
|
114
|
+
type: "PUT",
|
|
115
|
+
url: cpee.callback,
|
|
116
|
+
contentType: "application/json",
|
|
117
|
+
data: JSON.stringify(ret)
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
$(document).on('cpee:message',function() {
|
|
122
|
+
Object.entries(cpee.data).forEach((e,_) => {
|
|
123
|
+
let ele = { name: e[0], value: e[1] };
|
|
124
|
+
if (ele.name.match(/^text_(.*)/)) {
|
|
125
|
+
let clone = document.importNode(document.querySelector('template#text').content,true);
|
|
126
|
+
$('.container',clone).attr('id',ele.name);
|
|
127
|
+
$('.text',clone).html(marked.parseInline(ele.value.replace(/\\n/g,'<br>')));
|
|
128
|
+
$('#content').append(clone);
|
|
129
|
+
} else if (ele.name.match(/^scale_(.*)/)) {
|
|
130
|
+
let clone = document.importNode(document.querySelector('template#scale').content,true);
|
|
131
|
+
$('.container',clone).attr('id',ele.name);
|
|
132
|
+
$('.text',clone).html(marked.parseInline(ele.value.replace(/\\n/g,'<br>')));
|
|
133
|
+
$('#content').append(clone);
|
|
134
|
+
} else if (ele.name.match(/^input_(.*)/)) {
|
|
135
|
+
let clone = document.importNode(document.querySelector('template#input').content,true);
|
|
136
|
+
$('.container',clone).attr('id',ele.name);
|
|
137
|
+
$('.text',clone).html(marked.parseInline(ele.value.replace(/\\n/g,'<br>')));
|
|
138
|
+
$('#content').append(clone);
|
|
139
|
+
} else if (ele.name.match(/^feedback_(.*)/)) {
|
|
140
|
+
let clone = document.importNode(document.querySelector('template#feedback').content,true);
|
|
141
|
+
$('.container',clone).attr('id',ele.name);
|
|
142
|
+
$('.text',clone).html(marked.parseInline(ele.value.replace(/\\n/g,'<br>')));
|
|
143
|
+
$('#content').append(clone);
|
|
144
|
+
} else if (ele.name.match(/^select_(.*)/)) {
|
|
145
|
+
let clone = document.importNode(document.querySelector('template#select').content,true);
|
|
146
|
+
$('.container',clone).attr('id',ele.name);
|
|
147
|
+
ele.value.split(';').forEach((o)=>{
|
|
148
|
+
o = o.trim();
|
|
149
|
+
o = marked.parseInline(o.replace(/\\n/g,'<br>'));
|
|
150
|
+
let opt = document.importNode(document.querySelector('template#option').content,true);
|
|
151
|
+
$('input',opt).attr('name',ele.name);
|
|
152
|
+
$('input',opt).attr('value',o);
|
|
153
|
+
$('input',opt).attr('id',o);
|
|
154
|
+
$('label',opt).text(o);
|
|
155
|
+
$('label',opt).attr('for',o);
|
|
156
|
+
$('.select',clone).append(opt);
|
|
157
|
+
});
|
|
158
|
+
$('#content').append(clone);
|
|
159
|
+
} else if (ele.name.match(/^buttons_(.*)/)) {
|
|
160
|
+
let clone = document.importNode(document.querySelector('template#buttons').content,true);
|
|
161
|
+
$('.container',clone).attr('id',ele.name);
|
|
162
|
+
ele.value.split(';').forEach((o)=>{
|
|
163
|
+
o = o.trim();
|
|
164
|
+
o = marked.parseInline(o.replace(/\\n/g,'<br>'));
|
|
165
|
+
let opt = document.importNode(document.querySelector('template#button').content,true);
|
|
166
|
+
$('.button',opt).text(o);
|
|
167
|
+
$('.buttons',clone).append(opt);
|
|
168
|
+
});
|
|
169
|
+
$('#content').append(clone);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
$('.scale a.button').click(function() {
|
|
175
|
+
let n = $(this).parents('.container');
|
|
176
|
+
$('a.button',n).removeClass('down');
|
|
177
|
+
$(this).toggleClass("down")
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
$('.buttons a.button').click(function() {
|
|
181
|
+
let n = $(this).parents('.container');
|
|
182
|
+
$(this).toggleClass("down")
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
</script>
|
|
186
|
+
</head>
|
|
187
|
+
<body>
|
|
188
|
+
<template id="text">
|
|
189
|
+
<div class='container' id=''>
|
|
190
|
+
<div class='text'></div>
|
|
191
|
+
</div>
|
|
192
|
+
</template>
|
|
193
|
+
<template id="scale">
|
|
194
|
+
<div class='container' id=''>
|
|
195
|
+
<div class='text'></div>
|
|
196
|
+
<div class='scale'><a class="button" data-val="2">++</a><a class="button" data-val="1">+</a><a class="button" data-val="0">0</a><a class="button" data-val="-1">-</a><a class="button" data-val="-2">--</a></div>
|
|
197
|
+
</div>
|
|
198
|
+
</template>
|
|
199
|
+
<template id="feedback">
|
|
200
|
+
<div class='container' id=''>
|
|
201
|
+
<div class='text'></div>
|
|
202
|
+
<div class='feedback'>
|
|
203
|
+
<textarea></textarea>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
</template>
|
|
207
|
+
<template id="input">
|
|
208
|
+
<div class='container' id=''>
|
|
209
|
+
<div class='text'></div>
|
|
210
|
+
<div class='input'>
|
|
211
|
+
<input type="text"></input>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
</template>
|
|
215
|
+
<template id="option">
|
|
216
|
+
<input type='radio' name='' value=''/><label for=""></label><br/>
|
|
217
|
+
</template>
|
|
218
|
+
<template id="select">
|
|
219
|
+
<div class='container' id=''>
|
|
220
|
+
<div class='select'></div>
|
|
221
|
+
</div>
|
|
222
|
+
</template>
|
|
223
|
+
<template id="button">
|
|
224
|
+
<a class='button'/>
|
|
225
|
+
</template>
|
|
226
|
+
<template id="buttons">
|
|
227
|
+
<div class='container' id=''>
|
|
228
|
+
<div class='buttons'></div>
|
|
229
|
+
</div>
|
|
230
|
+
</template>
|
|
231
|
+
|
|
232
|
+
<p id="content"></p>
|
|
233
|
+
|
|
234
|
+
<p>
|
|
235
|
+
<button onclick="doit($('.container'))" value="ok">Save & Continue</button>
|
|
236
|
+
</p>
|
|
237
|
+
</body>
|
|
238
|
+
</html>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
5
|
+
<title>Spinner</title>
|
|
6
|
+
<style>
|
|
7
|
+
.spinner-container {
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
height: 100vh;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.spinner {
|
|
15
|
+
border: 8px solid #f3f3f3;
|
|
16
|
+
border-top: 8px solid #3498db;
|
|
17
|
+
border-radius: 50%;
|
|
18
|
+
width: 60px;
|
|
19
|
+
height: 60px;
|
|
20
|
+
animation: spin 2s linear infinite;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes spin {
|
|
24
|
+
0% { transform: rotate(0deg); }
|
|
25
|
+
100% { transform: rotate(360deg); }
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<div class="spinner-container">
|
|
31
|
+
<div class="spinner"></div>
|
|
32
|
+
</div>
|
|
33
|
+
</body>
|
|
34
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
questions.css
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
5
|
+
<title>Text</title>
|
|
6
|
+
<script type="text/javascript" src="/js_libs/jquery.min.js"></script>
|
|
7
|
+
<script type="text/javascript" src="/js_libs/marked.min.js"></script>
|
|
8
|
+
<script type="text/javascript" src="../js/frames.js"></script>
|
|
9
|
+
|
|
10
|
+
<link rel="stylesheet" href="text.css" type="text/css"/>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
$(document).on('cpee:message',function() {
|
|
14
|
+
$('#text').html(marked.parseInline(cpee.data.text.replace(/\\n/g,'<br>')));
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
</head>
|
|
18
|
+
<body>
|
|
19
|
+
<p id='text'></p>
|
|
20
|
+
</body>
|
|
21
|
+
</html>
|
data/ui/js/frames.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var cpee = { data: null, callback: null};
|
|
2
|
+
window.addEventListener("message", (event) => {
|
|
3
|
+
if (/(tum\.de|cpee\.org)$/.test(event.origin)) {
|
|
4
|
+
cpee.data = event.data.data;
|
|
5
|
+
cpee.callback = event.data.callback;
|
|
6
|
+
$(document).trigger("cpee:message");
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
function cpee_callback(callback,json) {
|
|
11
|
+
$.ajax({
|
|
12
|
+
type: "PUT",
|
|
13
|
+
url: callback,
|
|
14
|
+
contentType: "application/json",
|
|
15
|
+
data: json
|
|
16
|
+
});
|
|
17
|
+
}
|
data/ui/js/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var reason ="";
|
|
1
|
+
var reason = "";
|
|
2
2
|
var storage = []; //{col:1, row:1, colamount:1, rowamount: 1}];
|
|
3
3
|
|
|
4
4
|
function doOverlap(l1x, l1y, r1x, r1y, l2x, l2y, r2x, r2y) {
|
|
@@ -16,12 +16,10 @@ function makeFrame(lx, ly, rx, ry, content = "", id = "", defaultpara = "", show
|
|
|
16
16
|
for (i = 0; i < window.storage.length; i++) {
|
|
17
17
|
if(doOverlap(window.storage[i].lx, window.storage[i].ly, window.storage[i].rx, window.storage[i].ry, lx, ly, rx, ry)){
|
|
18
18
|
$(".item" + window.storage[i].lx + "-" + window.storage[i].ly).remove();
|
|
19
|
-
//clearRectangel(window.storage[i].lx, window.storage[i].ly, window.storage[i].rx, window.storage[i].ry)
|
|
20
19
|
window.storage.splice(i,1);
|
|
21
20
|
--i;
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
|
-
console.log(content);
|
|
25
23
|
if(content != "empty"){
|
|
26
24
|
//add new ellement to storage
|
|
27
25
|
window.storage.push({lx:lx, ly:ly, rx:rx, ry: ry})
|
|
@@ -31,13 +29,13 @@ function makeFrame(lx, ly, rx, ry, content = "", id = "", defaultpara = "", show
|
|
|
31
29
|
cell.classList.add("grid-item");
|
|
32
30
|
cell.classList.add("item" + lx + "-" + ly);
|
|
33
31
|
|
|
34
|
-
spancol=
|
|
35
|
-
if(rx-lx+1 > 1){
|
|
32
|
+
spancol = ''
|
|
33
|
+
if (rx-lx+1 > 1) {
|
|
36
34
|
spancol = " / span " + (rx-lx+1);
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
spanrow=
|
|
40
|
-
if(ry-ly+1 > 1){
|
|
37
|
+
spanrow = '';
|
|
38
|
+
if (ry-ly+1 > 1) {
|
|
41
39
|
spanrow = " / span " + (ry-ly+1);
|
|
42
40
|
}
|
|
43
41
|
|
|
@@ -49,106 +47,21 @@ function makeFrame(lx, ly, rx, ry, content = "", id = "", defaultpara = "", show
|
|
|
49
47
|
$(cell).css({"grid-column": (lx+1) + spancol, "grid-row": ly+1 + spanrow});
|
|
50
48
|
|
|
51
49
|
container.appendChild(cell);
|
|
52
|
-
//Create new element with width, heigth and content
|
|
53
|
-
//$(".item" + lx + "-" + ly).css({"display": "block", "border-style": "solid", "border-color": "blue", "grid-column": (lx+1) + " / span " + (rx-lx+1), "grid-row": ly+1 + " / span " + (ry-ly+1)});
|
|
54
50
|
|
|
55
51
|
if(content != null && content != ""){
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if(defaultpara != "{}"){
|
|
59
|
-
var fullurl = fullurl + "?";
|
|
60
|
-
for (var key in defaultpara) {
|
|
61
|
-
if (defaultpara.hasOwnProperty(key)) {
|
|
62
|
-
fullurl = fullurl + key + "=" + encodeURIComponent(defaultpara[key]) + "&";
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
fullurl = fullurl.slice(0, -1);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
$(".item" + lx + "-" + ly).html("<iframe style='height: 100%; width: 100%' name='" + id +"' id='" + id +"' src='" + fullurl + "' title='' frameBorder='0' ></iframe>");
|
|
69
|
-
|
|
70
|
-
if(showbutton){
|
|
71
|
-
$(".item" + lx + "-" + ly).append('<button class="formbutton" type="button" onclick="sendForm(\'' + '.item' + lx + '-' + ly +'\', \'' + encodeURIComponent(id) + '\', \'' + lx + '\', \'' + ly + '\')">' + showbutton + '</button>')
|
|
52
|
+
if (!/^https?:\/\//.test(content)) {
|
|
53
|
+
content = location.origin + content;
|
|
72
54
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
));
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
//hideRectangel(lx, ly, rx, ry)
|
|
83
|
-
}
|
|
84
|
-
else{
|
|
55
|
+
let fullurl = encodeURI(content);
|
|
56
|
+
let iframe = $("<iframe style='height: 100%; width: 100%' src=\"" + fullurl + "\" id=\"" + id + "\" title='' frameBorder='0'></iframe>")[0];
|
|
57
|
+
iframe.onload = () => { iframe.contentWindow.postMessage({ data: defaultpara, callback: id }, fullurl); };
|
|
58
|
+
$(".item" + lx + "-" + ly).html(iframe);
|
|
59
|
+
} else{
|
|
85
60
|
$(".item" + lx + "-" + ly).html("No language available.<br> Nicht in der Sprache verfügbar.");
|
|
86
61
|
}
|
|
87
62
|
}
|
|
88
63
|
}
|
|
89
64
|
|
|
90
|
-
function sendForm(menuitem, cpeecallback,lx,ly){
|
|
91
|
-
//Call iframe function that button has been pressed iframe should send json back
|
|
92
|
-
//document.getElementById(decodeURIComponent(cpeecallback)).contentWindow.buttonPressed(cpeecallback);
|
|
93
|
-
|
|
94
|
-
var formdata;
|
|
95
|
-
if (typeof document.getElementById(decodeURIComponent(cpeecallback)).contentWindow.buttonPressed !== 'undefined' && $.isFunction(document.getElementById(decodeURIComponent(cpeecallback)).contentWindow.buttonPressed)) {
|
|
96
|
-
var formdata = document.getElementById(decodeURIComponent(cpeecallback)).contentWindow.buttonPressed();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
$.ajax({
|
|
100
|
-
type: "PUT",
|
|
101
|
-
url: decodeURIComponent(cpeecallback),
|
|
102
|
-
contentType: "application/json",
|
|
103
|
-
data: JSON.stringify(formdata),
|
|
104
|
-
success: function (data) {
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
//Its a design question if removing the frame should be done within centurio, do have more controll, or automatic within code?
|
|
109
|
-
//close frame
|
|
110
|
-
|
|
111
|
-
$(menuitem).remove();
|
|
112
|
-
//remove frame from Server
|
|
113
|
-
$.ajax({
|
|
114
|
-
type: "Post",
|
|
115
|
-
url: "",
|
|
116
|
-
headers: {"content-id": "deleteframe"},
|
|
117
|
-
data: {lx: lx, ly: ly},
|
|
118
|
-
success: function (data) {
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function sendData(dataelement, datavalue){
|
|
124
|
-
$.ajax({
|
|
125
|
-
type: "Get",
|
|
126
|
-
url: 'cpeeinstance.url',
|
|
127
|
-
success: function(ret) {
|
|
128
|
-
$.ajax({
|
|
129
|
-
type: "Put",
|
|
130
|
-
url: ret + "/properties/dataelements/" + dataelement,
|
|
131
|
-
data: {value: datavalue},
|
|
132
|
-
success: function (data) {
|
|
133
|
-
alert("Data Sent")
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function sendCallback(callbackUrl, jsonToSend){
|
|
141
|
-
$.ajax({
|
|
142
|
-
type: "PUT",
|
|
143
|
-
url: callbackUrl,
|
|
144
|
-
contentType: "application/json",
|
|
145
|
-
data: jsonToSend,
|
|
146
|
-
success: function (data) {
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
|
|
152
65
|
function showDocument() {
|
|
153
66
|
$.ajax({
|
|
154
67
|
type: "GET",
|
|
@@ -190,10 +103,6 @@ function clearDocument() {
|
|
|
190
103
|
$('#reason').text(reason);
|
|
191
104
|
}
|
|
192
105
|
|
|
193
|
-
function reloadAllFrames() {
|
|
194
|
-
location.reload();
|
|
195
|
-
}
|
|
196
|
-
|
|
197
106
|
function init() {
|
|
198
107
|
es = new EventSource('sse/');
|
|
199
108
|
es.onopen = function() {
|
|
@@ -236,32 +145,8 @@ function makeGrid(x, y) {
|
|
|
236
145
|
const container = document.getElementById("container");
|
|
237
146
|
container.style.setProperty('--grid-rows', y);
|
|
238
147
|
container.style.setProperty('--grid-cols', x);
|
|
239
|
-
/*
|
|
240
|
-
for (c = 0; c < (x * y); c++) {
|
|
241
|
-
let cell = document.createElement("div");
|
|
242
|
-
//cell.innerText = (c + 1);
|
|
243
|
-
cell.classList.add("item" + (c% y) + "-" + (Math.floor(c / y )));
|
|
244
|
-
|
|
245
|
-
cell.classList.add("grid-item");
|
|
246
|
-
|
|
247
|
-
container.appendChild(cell);
|
|
248
|
-
};
|
|
249
|
-
*/
|
|
250
148
|
};
|
|
251
149
|
|
|
252
|
-
//https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Function/caller
|
|
253
|
-
function sendJson(callback, jsonToSend){
|
|
254
|
-
$.ajax({
|
|
255
|
-
type: "PUT",
|
|
256
|
-
url: callback,
|
|
257
|
-
contentType: "application/json",
|
|
258
|
-
data: JSON.stringify(jsonToSend),
|
|
259
|
-
success: function (data) {
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
|
|
265
150
|
$(document).ready(function() {
|
|
266
151
|
init();
|
|
267
152
|
});
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cpee-frames
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Manuell Gall
|
|
8
8
|
- Juergen 'eTM' Mangler
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: tools
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: riddl
|
|
@@ -55,10 +54,7 @@ files:
|
|
|
55
54
|
- cpee-frames.gemspec
|
|
56
55
|
- lib/cpee-frames/frames.xml
|
|
57
56
|
- lib/cpee-frames/implementation.rb
|
|
58
|
-
- lib/cpee-frames/ui/framedata.html
|
|
59
|
-
- lib/cpee-frames/ui/menu.html
|
|
60
57
|
- lib/cpee-frames/ui/template.html
|
|
61
|
-
- lib/cpee-frames/ui/test.html
|
|
62
58
|
- lib/cpee-frames/ui/tutorial.html
|
|
63
59
|
- server/frames
|
|
64
60
|
- server/frames.conf
|
|
@@ -67,15 +63,19 @@ files:
|
|
|
67
63
|
- ui/css/favicon-32x32.png
|
|
68
64
|
- ui/css/favicon-96x96.png
|
|
69
65
|
- ui/css/frames.css
|
|
70
|
-
- ui/
|
|
66
|
+
- ui/examples/button.html
|
|
67
|
+
- ui/examples/questions.css
|
|
68
|
+
- ui/examples/questions.html
|
|
69
|
+
- ui/examples/spinner.html
|
|
70
|
+
- ui/examples/text.css
|
|
71
|
+
- ui/examples/text.html
|
|
72
|
+
- ui/js/frames.js
|
|
71
73
|
- ui/js/language.js
|
|
72
|
-
- ui/js/test.js
|
|
73
74
|
- ui/js/ui.js
|
|
74
75
|
homepage: https://github.com/ManuelGall/cpee-frames
|
|
75
76
|
licenses:
|
|
76
77
|
- GPL-3.0
|
|
77
78
|
metadata: {}
|
|
78
|
-
post_install_message:
|
|
79
79
|
rdoc_options: []
|
|
80
80
|
require_paths:
|
|
81
81
|
- lib
|
|
@@ -90,8 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
90
90
|
- !ruby/object:Gem::Version
|
|
91
91
|
version: '0'
|
|
92
92
|
requirements: []
|
|
93
|
-
rubygems_version: 3.
|
|
94
|
-
signing_key:
|
|
93
|
+
rubygems_version: 3.6.9
|
|
95
94
|
specification_version: 4
|
|
96
95
|
summary: Dashboard management service with UI and backend for the cpee.org family
|
|
97
96
|
of workflow management tools
|