cpee-frames 1.0.6 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08d58fb0e3ead41a726a13e9c2882566ce9517b33db09d2a598f3d4c309efce3'
4
- data.tar.gz: 5a11e363e355246150f36896193d5ca42524af006438470e11770f17336a7647
3
+ metadata.gz: 307042175036cde47b123d2754cdd44a8348f41a14560f32790d533a7c6ce6f7
4
+ data.tar.gz: f1e6c989dad86242bab7086e3f9eba0233b3f7883d2ff473dfce439caeb8d379
5
5
  SHA512:
6
- metadata.gz: ae2f0971be48e1ec132cd40822962d8b0c1845112790fcf02e0378f6d61624869e44890402b9c0072b22c5771e2405761d0cbf268f9520184c500030d6c7ebbc
7
- data.tar.gz: 69dc3c99cd8bf566d329354d44663e80b8d4bcc17950d2ef2507945549f223fc962bf2ba17ba53aaa7785740a01747eb346549855a84063edb7b4136533c4b23
6
+ metadata.gz: 16b54380b6ef43d0b0448c0776afe1ceaa1b8e434135a2b8aae380b55984482f4d1069bbf03f28f550bcb14f5cbabe8ba7a577ffb229db35230cb1d288a2c4e6
7
+ data.tar.gz: 06c4ffce6e21dbd1327540090badc22a396ef6105ca37ff7d18aebfeb80eb01af53a1e572db1c09b9fed9a52d184eb3e7056e7803178172ec40143866d485c13
data/cpee-frames.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee-frames"
3
- s.version = "1.0.6"
3
+ s.version = "2.0.0"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "GPL-3.0"
6
6
  s.summary = "Dashboard management service with UI and backend for the cpee.org family of workflow management tools"
@@ -31,8 +31,6 @@
31
31
  <parameter name="ly" type="nonNegativeInteger"/>
32
32
  <parameter name="x_amount" type="nonNegativeInteger"/>
33
33
  <parameter name="y_amount" type="nonNegativeInteger"/>
34
- <parameter name="button" type="string"/>
35
- <parameter name="style" type="string"/>
36
34
  <parameter name="urls" type="string"/>
37
35
  <parameter name="default" type="string"/>
38
36
  </message>
@@ -42,8 +40,6 @@
42
40
  <parameter name="ly" type="nonNegativeInteger"/>
43
41
  <parameter name="x_amount" type="nonNegativeInteger"/>
44
42
  <parameter name="y_amount" type="nonNegativeInteger"/>
45
- <parameter name="button" type="string"/>
46
- <parameter name="style" type="string"/>
47
43
  <parameter name="urls" type="string"/>
48
44
  <parameter name="default" type="string"/>
49
45
  </message>
@@ -126,10 +122,6 @@
126
122
  <post />
127
123
  </resource>
128
124
 
129
- <resource relative="test">
130
- <put in="string"/>
131
- </resource>
132
-
133
125
  <resource relative='handler'>
134
126
  <post />
135
127
  <resource relative='sse'>
@@ -39,7 +39,6 @@ module CPEE
39
39
  return true
40
40
  end
41
41
 
42
-
43
42
  # https://coderwall.com/p/atyfyq/ruby-string-to-boolean
44
43
  # showbutton
45
44
  refine String do #{{{
@@ -101,7 +100,7 @@ module CPEE
101
100
  file = File.read(path)
102
101
  data_hash = JSON::parse(file)
103
102
 
104
- #check if new frame overlaps others if it does, delete overlapped frames
103
+ # check if new frame overlaps others if it does, delete overlapped frames
105
104
  data_hash["data"].each do | c |
106
105
  if CPEE::Frames::overlap?(c['lx'], c['ly'], c['rx'], c['ry'], @p[1].value.to_i, @p[2].value.to_i, (@p[1].value.to_i + @p[3].value.to_i - 1), (@p[2].value.to_i + @p[4].value.to_i - 1))
107
106
  data_hash["data"].delete(c)
@@ -109,29 +108,27 @@ module CPEE
109
108
  end
110
109
 
111
110
  #check if url is set
112
- if @p[7].value != ""
113
- urls = JSON::parse(@p[7].value);
111
+ if @p[5].value != ""
112
+ urls = JSON::parse(@p[5].value);
114
113
 
115
- if @p[8].value == ""
116
- hash = {lx: @p[1].value.to_i, ly: @p[2].value.to_i, rx: (@p[1].value.to_i + @p[3].value.to_i - 1), ry: (@p[2].value.to_i + @p[4].value.to_i - 1), url: urls, showbutton: @p[5].value, style: @p[6].value, default: "{}", callback: @h['CPEE_CALLBACK']};
114
+ if @p[6].value == ""
115
+ hash = {lx: @p[1].value.to_i, ly: @p[2].value.to_i, rx: (@p[1].value.to_i + @p[3].value.to_i - 1), ry: (@p[2].value.to_i + @p[4].value.to_i - 1), url: urls, default: "{}", callback: @h['CPEE_CALLBACK']};
117
116
  else
118
- hash = {lx: @p[1].value.to_i, ly: @p[2].value.to_i, rx: (@p[1].value.to_i + @p[3].value.to_i - 1), ry: (@p[2].value.to_i + @p[4].value.to_i - 1), url: urls, showbutton: @p[5].value, style: @p[6].value, default: JSON::parse(@p[8].value), callback: @h['CPEE_CALLBACK']};
117
+ hash = {lx: @p[1].value.to_i, ly: @p[2].value.to_i, rx: (@p[1].value.to_i + @p[3].value.to_i - 1), ry: (@p[2].value.to_i + @p[4].value.to_i - 1), url: urls, default: JSON::parse(@p[6].value), callback: @h['CPEE_CALLBACK']};
119
118
  end
120
119
 
121
- data_hash["data"].push(hash)
120
+ data_hash['data'].push(hash)
122
121
  File.write(path, JSON.dump(data_hash))
123
122
 
124
- #only send active url to client
123
+ # only send active url to client
125
124
  infofile = File.join(data_dir,@r.last,'info.json')
126
125
  infojson = JSON::parse(File.read(infofile))
127
126
  hash["url"] = urls.find{ |h| h['lang'] == infojson["lang"]}['url']
128
127
 
129
-
130
128
  @a[0].send(JSON.dump(hash))
131
129
  else
132
130
  File.write(path, JSON.dump(data_hash))
133
- hash = {lx: @p[1].value.to_i, ly: @p[2].value.to_i, rx: (@p[1].value.to_i + @p[3].value.to_i - 1), ry: (@p[2].value.to_i + @p[4].value.to_i - 1), url: "empty", showbutton: @p[5].value, style: @p[6].value, default: "{}", callback: @h['CPEE_CALLBACK']};
134
-
131
+ hash = {lx: @p[1].value.to_i, ly: @p[2].value.to_i, rx: (@p[1].value.to_i + @p[3].value.to_i - 1), ry: (@p[2].value.to_i + @p[4].value.to_i - 1), url: "empty", default: "{}", callback: @h['CPEE_CALLBACK']};
135
132
 
136
133
  @a[0].send(JSON.dump(hash))
137
134
  end
@@ -147,37 +144,35 @@ module CPEE
147
144
  file = File.read(path)
148
145
  data_hash = JSON::parse(file)
149
146
 
150
- #check if new frame overlaps others if it does, delete overlapped frames
147
+ # check if new frame overlaps others if it does, delete overlapped frames
151
148
  data_hash["data"].each do | c |
152
149
  if CPEE::Frames::overlap?(c['lx'], c['ly'], c['rx'], c['ry'], @p[1].value.to_i, @p[2].value.to_i, (@p[1].value.to_i + @p[3].value.to_i - 1), (@p[2].value.to_i + @p[4].value.to_i - 1))
153
150
  data_hash["data"].delete(c)
154
151
  end
155
152
  end
156
153
 
157
-
158
- #check if url is set
159
- if @p[7].value != ""
160
- urls = JSON::parse(@p[7].value);
161
- if @p[8].value == ""
162
- hash = {lx: @p[1].value.to_i, ly: @p[2].value.to_i, rx: (@p[1].value.to_i + @p[3].value.to_i - 1), ry: (@p[2].value.to_i + @p[4].value.to_i - 1), url: urls, showbutton: @p[5].value, style: @p[6].value, default: "{}", callback: @h['CPEE_CALLBACK']};
154
+ # check if url is set
155
+ if @p[5].value != ""
156
+ urls = JSON::parse(@p[5].value);
157
+ if @p[6].value == ""
158
+ hash = {lx: @p[1].value.to_i, ly: @p[2].value.to_i, rx: (@p[1].value.to_i + @p[3].value.to_i - 1), ry: (@p[2].value.to_i + @p[4].value.to_i - 1), url: urls, default: "{}", callback: @h['CPEE_CALLBACK']};
163
159
  else
164
- hash = {lx: @p[1].value.to_i, ly: @p[2].value.to_i, rx: (@p[1].value.to_i + @p[3].value.to_i - 1), ry: (@p[2].value.to_i + @p[4].value.to_i - 1), url: urls, showbutton: @p[5].value, style: @p[6].value, default: JSON::parse(@p[8].value), callback: @h['CPEE_CALLBACK']};
160
+ hash = {lx: @p[1].value.to_i, ly: @p[2].value.to_i, rx: (@p[1].value.to_i + @p[3].value.to_i - 1), ry: (@p[2].value.to_i + @p[4].value.to_i - 1), url: urls, default: JSON::parse(@p[6].value), callback: @h['CPEE_CALLBACK']};
165
161
  end
166
- data_hash["data"].push(hash)
162
+ data_hash['data'].push(hash)
167
163
  File.write(path, JSON.dump(data_hash))
168
164
 
169
- #only send active url to client
165
+ # only send active url to client
170
166
  infofile = File.join(data_dir,@r.last,'info.json')
171
167
  infojson = JSON::parse(File.read(infofile))
172
168
  hash["url"] = urls.find{ |h| h['lang'] == infojson["lang"]}['url']
173
169
 
174
170
  File.write(File.join(data_dir,@r.last,'callback'),@h['CPEE_CALLBACK'])
175
171
 
176
-
177
172
  @a[0].send(JSON.dump(hash))
178
173
  else
179
174
  File.write(path, JSON.dump(data_hash))
180
- hash = {lx: @p[1].value.to_i, ly: @p[2].value.to_i, rx: (@p[1].value.to_i + @p[3].value.to_i - 1), ry: (@p[2].value.to_i + @p[4].value.to_i - 1), url: "empty", showbutton: @p[5].value, style: @p[6].value, default: "{}", callback: @h['CPEE_CALLBACK']};
175
+ hash = {lx: @p[1].value.to_i, ly: @p[2].value.to_i, rx: (@p[1].value.to_i + @p[3].value.to_i - 1), ry: (@p[2].value.to_i + @p[4].value.to_i - 1), url: "empty", default: "{}", callback: @h['CPEE_CALLBACK']};
181
176
 
182
177
  File.write(File.join(data_dir,@r.last,'callback'),@h['CPEE_CALLBACK'])
183
178
 
@@ -216,7 +211,6 @@ module CPEE
216
211
  data_dir = @a[1]
217
212
  pp "in delete"
218
213
  if cbu = File.read(File.join(data_dir,@r.last,'callback'))
219
- pp "XYZ"
220
214
  send = { 'operation' => @p[0].value }
221
215
  case send['operation']
222
216
  when 'result'
@@ -227,11 +221,11 @@ module CPEE
227
221
  Typhoeus.put(cbu, body: JSON::generate(send), headers: { 'content-type' => 'application/json'})
228
222
  end
229
223
 
230
- #File.unlink(File.join(data_dir,@r.last,'callback')) rescue nil
231
- #File.unlink(File.join(data_dir,@r.last,'cpeeinstance.url')) rescue nil
232
- #File.unlink(File.join(data_dir,@r.last,'style.url')) rescue nil
233
- #File.unlink(File.join(data_dir,@r.last,'document.xml')) rescue nil
234
- #File.unlink(File.join(data_dir,@r.last,'info.json')) rescue nil
224
+ # File.unlink(File.join(data_dir,@r.last,'callback')) rescue nil
225
+ # File.unlink(File.join(data_dir,@r.last,'cpeeinstance.url')) rescue nil
226
+ # File.unlink(File.join(data_dir,@r.last,'style.url')) rescue nil
227
+ # File.unlink(File.join(data_dir,@r.last,'document.xml')) rescue nil
228
+ # File.unlink(File.join(data_dir,@r.last,'info.json')) rescue nil
235
229
 
236
230
  @a[0].send('reset')
237
231
  nil
@@ -247,7 +241,7 @@ module CPEE
247
241
  infofile = File.join(data_dir,@r[-2],'info.json')
248
242
  infojson = JSON::parse(File.read(infofile))
249
243
 
250
- #remove not used languages
244
+ # remove not used languages
251
245
  file = JSON::parse(File.read(fname))
252
246
 
253
247
  file["data"].each do |child|
@@ -317,7 +311,7 @@ module CPEE
317
311
  fname = File.join(data_dir,@r[-2],'info.json')
318
312
  if File.exist? fname
319
313
  infojson = JSON::parse(File.read(fname))
320
- Riddl::Parameter::Complex.new('value','application/json',infojson["langs"])
314
+ Riddl::Parameter::Complex.new('value','application/json',JSON::generate(infojson["langs"]))
321
315
  else
322
316
  @status = 404
323
317
  end
@@ -374,12 +368,6 @@ module CPEE
374
368
  end
375
369
  end #}}}
376
370
 
377
- class OutputTest < Riddl::Implementation #{{{
378
- def response
379
- puts "Test"
380
- end
381
- end #}}}
382
-
383
371
  class Handler < Riddl::Implementation #{{{
384
372
  def response
385
373
  data_dir = @a[1]
@@ -420,7 +408,7 @@ module CPEE
420
408
  end
421
409
  end #}}}
422
410
 
423
- class SSE2 < Riddl::SSEImplementation #{{{
411
+ class SSE_Handler < Riddl::SSEImplementation #{{{
424
412
  def onopen
425
413
  signals = @a[0]
426
414
  signals.add self
@@ -498,7 +486,7 @@ module CPEE
498
486
  on resource 'handler' do
499
487
  run Handler, opts[:signals2]["handler"], opts[:data_dir] if post
500
488
  on resource 'sse' do
501
- run SSE2, opts[:signals2]["handler"] if sse
489
+ run SSE_Handler, opts[:signals2]["handler"] if sse
502
490
  end
503
491
  end
504
492
 
@@ -512,21 +500,18 @@ module CPEE
512
500
  run GetLangs, opts[:data_dir] if get
513
501
  run SetLang, opts[:signals][idx], opts[:data_dir] if post 'lang'
514
502
  end
515
- on resource 'style.url' do
516
- run GetStyle, opts[:data_dir] if get
517
- end
518
503
  on resource 'cpeeinstance.url' do
519
504
  run GetCpeeInstance, opts[:data_dir] if get
520
505
  end
506
+ on resource 'style.url' do
507
+ run GetStyle, opts[:data_dir] if get
508
+ end
521
509
  on resource 'info.json' do
522
510
  run GetInfo, opts[:data_dir] if get
523
511
  end
524
512
  on resource 'frames.json' do
525
513
  run GetFrames, opts[:data_dir] if get
526
514
  end
527
- on resource 'test' do
528
- run OutputTest if put
529
- end
530
515
 
531
516
  on resource 'dataelements.json' do
532
517
  run SetDataElements, opts[:data_dir] if post
@@ -49,11 +49,10 @@
49
49
  <script>
50
50
  if (location.href.match(/\/$/) == null) {
51
51
  location.href = location.href + '/';
52
- }
52
+ }
53
53
  </script>
54
54
  </head>
55
55
  <body is="x-ui">
56
- <div id="container">
57
- </div>
56
+ <div id="container"></div>
58
57
  </body>
59
58
  </html>
@@ -45,126 +45,107 @@
45
45
  </script>
46
46
  </head>
47
47
  <body is="x-ui">
48
- <div id="container">
49
-
50
48
  First Steps:<br>
51
- <ul>
52
-
53
- <li>define Endpoint: *adapt to your needs*</li>
54
- <ul>
55
- <li>init: https-post://your.server/frames/</li>
56
- <li>frames: https-put://your.server/frames/</li>
57
- </ul>
58
- <li>define Data Element: (url where your frame will be reached)</li>
59
- <ul>
60
- <li><a href="getConfigs">check if frame is not already in use </a></li>
61
- <li>frameID: YourFrameName</a></li>
62
- </ul>
63
- <li>Create Init Activity</li>
64
- <ul>
65
- <li>Create a new "Service Call with Script"</li>
66
- <li>Set the Endpoint to "init"</li>
67
- <li>Set your arguments e.g. width: 10, height:10, languge: de-at and some title</li>
68
- <li>Set the Prepare Code to: "endpoints.init = File.join(endpoints.init,data.frameID)" where data.frameID is the name from the variable we created before</li>
69
- </ul>
70
- <li>Create Frame Activity</li>
71
- <ul>
72
- <li>Create a new "Service Call with Script"</li>
73
- <li>Set the Endpoint to "frames"</li>
74
- <li>Set your argument Type to "Set UI and contion" (default option)
75
- <li>Set your other arguments e.g. DisplacementLeft:0, top:0, width:10, Height:10</li>
76
- <li>In Section "Form Url" click on the button "New Language"</li>
77
- <li>Define the URL that should be displayed</li>
78
- <li>Set the Prepare Code to: "endpoints.frames = File.join(endpoints.frames,data.frameID)" where data.frameID is the name from the variable we created before</li>
49
+ <ul>
79
50
 
80
- </ul>
81
- <li>Execute your Process</li>
82
- <li>Open your frame URL (add the defined name (YourFrameName) to the url currently open in this browser Window</li>
51
+ <li>Define endpoints: *adapt to your needs*. The brackets are necessary</li>
52
+ <ul>
53
+ <li>init: https-post://{your.server}/out/frames/{YourFrameName}</li>
54
+ <li>frames: https-put://{your.server}/out/frames/{YourFrameName}</li>
55
+ <li><a href="getConfigs">Check if YourFrameName is not already in use</a></li>
56
+ </ul>
57
+ <li>Create <strong>Init</strong> activity</li>
58
+ <ul>
59
+ <li>Create a new "Service Call with Script"</li>
60
+ <li>Set the Endpoint to "init"</li>
61
+ <li>Set your arguments, e.g., width: 10, height:10, languge: de-at and some title</li>
83
62
  </ul>
63
+ <li>Create <strong>Frame</strong> activity</li>
64
+ <ul>
65
+ <li>Create a new "Service Call with Script"</li>
66
+ <li>Set the Endpoint to "frames"</li>
67
+ <li>Set your argument Type to "Set UI and contion" (default option)
68
+ <li>Set your other arguments, e.g., displacement left:0, top:0, width:10, height:10</li>
69
+ <li>In section "Page URL" click on the button "New Page/Language"</li>
70
+ <li>Define the URL that should be displayed</li>
71
+ <li>Add parameters, that are sent to the displayed page. You have to include https://cpee.org/out/frames/js/frames.js in the displayed HTML. Then you can access <em>cpee.data</em> and <em>cpee.callback</em></li>
72
+ </ul>
73
+ <li>Execute your Process</li>
74
+ <li>Open your frame URL - add (YourFrameName) to the URL currently open in this browser window</li>
75
+ </ul>
84
76
 
77
+ Other Steps:<br>
78
+ <ul>
85
79
 
86
- Ohter Steps:<br>
80
+ <li>My new frame site process runs through once and then its done</li>
87
81
  <ul>
88
-
89
- <li>My new frame site process runs through once and then its done</li>
90
- <ul>
91
- <li>Use an endless loop within your proces engine</li>
92
- <li>Be aware that in case you do not wait for input at some point your loop will run a gazillion times per second!!!</li>
93
- </ul>
94
- <li>Ohhh nooo i forgot the process engine instance that drives my frames application</li>
95
- <ul>
96
- <li>In the case your site is not empty</li>
97
- <ul>
98
- <li>Inspect the site (ctrl+shift+c)</li>
99
- <li>Find one of your iframes</li>
100
- <li>Arguments "name" or "id" will give you the instance ID</li>
101
- </ul>
102
- <li>In the case your site is empty</li>
103
- <ul>
104
- <li>HAHA</li>
105
- <li>Nah its not that bad, look in your process engine; the best thing to do is to use the design service next time</li>
106
- </ul>
107
- </ul>
82
+ <li>Use an endless loop within your proces engine</li>
83
+ <li>Be aware that in case you do not wait for input at some point your loop will run a gazillion times per second!!!</li>
108
84
  </ul>
109
-
110
- There are more Ohter Steps?<br>
85
+ <li>Ohhh nooo i forgot the process engine instance that drives my frames application</li>
111
86
  <ul>
112
- <li>My Frame needs to Return something to the process engine Step1</li>
113
- <ul>
114
- <li>Create a new "Service Call with Script"</li>
115
- <li>Set the Endpoint to "frames"</li>
116
- <li>Set your argument Type to "Set UI and wait for input"
117
- <li>Set your other arguments e.g. DisplacementLeft:0, top:0, width:10, Height:10</li>
118
- <li>In Section "Form Url" click on the button "New Language"</li>
119
- <li>Define the URL that should be displayed</li>
120
- <li>Set the Prepare Code to: "endpoints.frames = File.join(endpoints.frames,data.frameID)" where data.frameID is the name from the variable we created before</li>
121
- <li>Set the Finalize Code to: "data.yourDataElementName = result</li>
122
- <li>How to return data from your Frame? see Step2 (below)</li>
123
- </ul>
124
- <li>My Frame needs to Return something to the process engine Step2</li>
125
- <ul>
126
- <li>You have some fancy html site that wants to send oodles of data back to centurio</li>
127
- <li>Within your frame call the javascript function parent.sendJson(window.name,yourJsonDataHere)</li>
128
- <li>All you need to change is define "yourJsonDataHere"</li>
129
- </ul>
130
- <li>I want to delete some frames</li>
87
+ <li>In the case your site is not empty</li>
131
88
  <ul>
132
- <li>Create a new "Service Call with Script"</li>
133
- <li>Set the Endpoint to "frames"</li>
134
- <li>Set your argument Type to "Set UI and contion" (default option)
135
- <li>Set your other arguments e.g. DisplacementLeft:0, top:0, width:10, Height:10 to match the frames you would like to delete</li>
136
- <li>Set the Prepare Code to: "endpoints.frames = File.join(endpoints.frames,data.frameID)" where data.frameID is the name from the variable we created before</li>
137
- <li>Thats it</li>
89
+ <li>Inspect the site (ctrl+shift+c)</li>
90
+ <li>Find one of your iframes</li>
91
+ <li>The attribute "id" contains the callback URL, which contains your instance ID</li>
138
92
  </ul>
139
- <li>Do i need to delete a frame in order to create one at that poisiton?</li>
93
+ <li>In the case your site is empty</li>
140
94
  <ul>
141
- <li>Nope, when one frame overlaps one or multiple frames the overlapped ones will be deleted automatically</li>
95
+ <li>You did something wrong</li>
142
96
  </ul>
143
97
  </ul>
144
-
145
-
146
-
147
- I Would like to use the Forms service:<br>
148
- <ul>
149
- <li>Will be described soon ;)</li>
150
98
  </ul>
151
99
 
152
- Data Handling:<br>
100
+ More Helpful Tips:<br>
153
101
  <ul>
154
- <li>Will be described soon ;)</li>
102
+ <li>Tip A: My process engine needs to receive something from a frame</li>
103
+ <ul>
104
+ <li>Create a new task "Service Call with Scripts"</li>
105
+ <li>Set the endpoint to "frames"</li>
106
+ <li>Set your argument type to "Set UI and wait for input"</li>
107
+ <li>Set your other arguments, e.g., displacement left:0, top:0, width:10, height:10</li>
108
+ <li>In section "Page URL" click on the button "New Page/Language"</li>
109
+ <li>Define the URL that should be displayed</li>
110
+ <li>Set the Finalize to: "data.yourDataElementName = result"</li>
111
+ <li>How to return data from your frame? See Tip B below</li>
112
+ </ul>
113
+ <li>Tip B: My Frame needs to return something to the process engine</li>
114
+ <ul>
115
+ <li>You have some fancy HTML site that wants to send oodles of data back to your cpee</li>
116
+ <li>Include https://cpee.org/out/frames/js/frames.js in your fancy HTML</li>
117
+ <li>Within your fancy HTML call the javascript function cpee_callback(cpee.callback,yourJsonDataHere)</li>
118
+ <li>All you need to change is define "yourJsonDataHere"</li>
119
+ </ul>
120
+ <li>Tip C: I want to delete some frames</li>
121
+ <ul>
122
+ <li>Create a new task "Service Call with Script"</li>
123
+ <li>Set the endpoint to "frames"</li>
124
+ <li>Set your argument type to "Set UI and continue" (default option)</li>
125
+ <li>Set your other arguments, e.g., displacement left:0, top:0, width:10, height:10 to match the frames you would like to delete</li>
126
+ <li>Execute</li>
127
+ </ul>
128
+ <li>Tip D: I want to access the data that i sent to my fancy HTML</li>
129
+ <ul>
130
+ <li>You have some fancy HTML site that serves as a template and wants to display oodles of data sent from the cpee</li>
131
+ <li>Include https://cpee.org/out/frames/js/frames.js in your fancy HTML</li>
132
+ <li>Access the data with <em>cpee.data</em>. Its JSON</li>
133
+ <li>Be careful. If you want to access the <em>cpee.data</em> you can only do so after the data is received. For jquery use <em>$(document).on('cpee:message',()=>{...})</em> instead of <em>$(document).ready(()=>{...})</em></li>
134
+ </ul>
155
135
  </ul>
156
136
 
157
-
158
- Other questions you could have: (note this is not other steps!)<br>
137
+ Questions:
159
138
  <ul>
160
- <li>I want to do a circular iframe</li>
139
+ <li>Question: Do i need to delete a frame in order to create one at that position?</li>
140
+ <ul>
141
+ <li>Nope, when one frame overlaps one or multiple frames, the overlapped ones will be deleted automatically</li>
142
+ </ul>
143
+ <li>Question: I want to do a circular iframe. Can I?</li>
161
144
  <ul>
162
145
  <li>Why?</li>
163
- <li>You have to manage this within your html site</li>
146
+ <li>No!</li>
147
+ <li>You have to manage this within your fancy HTML</li>
164
148
  </ul>
165
149
  </ul>
166
-
167
- </div>
168
-
169
150
  </body>
170
151
  </html>
data/server/frames CHANGED
@@ -18,6 +18,8 @@
18
18
 
19
19
  if File.exist?(File.join(__dir__,'..','lib','cpee-frames','implementation.rb'))
20
20
  require_relative File.join(__dir__,'..','lib','cpee-frames','implementation')
21
+ elsif File.exist?(File.join(Dir.home,'Projects','cpee-frames','lib','cpee-frames','implementation.rb'))
22
+ require_relative File.join(Dir.home, 'Projects','cpee-frames','lib','cpee-frames','implementation')
21
23
  else
22
24
  require 'cpee-frames/implementation'
23
25
  end
data/tools/cpee-frames CHANGED
@@ -47,14 +47,14 @@ exname = File.basename($0)
47
47
 
48
48
  ARGV.options { |opt|
49
49
  opt.summary_indent = ' ' * 2
50
- opt.summary_width = 15
51
- opt.banner = "Usage:\n#{opt.summary_indent}#{exname} new [DIR] | newui [DIR]\n"
50
+ opt.summary_width = 11
51
+ opt.banner = "Usage:\n#{opt.summary_indent}#{exname} new [DIR] | cpui [DIR]\n"
52
52
  opt.on("Options:")
53
53
  opt.on("--help", "-h", "This text") { puts opt; exit }
54
54
  opt.on("")
55
- opt.on(wrap("new [DIR] scaffolds a sample logging service. Add a handler to a cpee instance to experience the pleasure.",78,18,0))
55
+ opt.on(wrap("new [DIR] scaffolds a sample frames. It has built-in documentation.",78,14,0))
56
56
  opt.on("")
57
- opt.on(wrap("newui [DIR] scaffolds css/js directors that are use by the UI into your webserver dir."))
57
+ opt.on(wrap("cpui [DIR] scaffolds css/js directors that are use by the UI into your webserver dir.",78,14,0))
58
58
  opt.parse!
59
59
  }
60
60
  if (ARGV.length != 2)
@@ -72,7 +72,7 @@ if command == 'new'
72
72
  else
73
73
  puts 'Directory already exists.'
74
74
  end
75
- elsif command == 'newui'
75
+ elsif command == 'cpui'
76
76
  if !File.exist?(dir)
77
77
  FileUtils.cp_r(File.join(curpath,'..','ui'),dir)
78
78
  else
@@ -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
+ }