11
11
div Tabs
12
12
div Tab
13
13
div ScriptName
14
- div DefaultsPanel
14
+ div StepsPanel
15
15
div BlocksPanel
16
16
div ContentPanel
17
- div StepsPanel
17
+ div DefaultsPanel
18
18
span Status
19
19
span Span
20
20
input NameEditor
26
26
img Delete
27
27
img Cycle
28
28
a Link
29
- module DefaultsModule
29
+ module StepsModule
30
30
module BlocksModule
31
31
module ContentModule
32
- module StepsModule
32
+ module DefaultsModule
33
33
variable Mobile
34
34
variable Current
35
35
variable Content
46
46
variable Message
47
47
variable Section
48
48
variable Item
49
- variable Array
49
+ variable CurrentScriptName
50
50
variable N
51
51
52
52
! The browser
162
162
index SectionButton to 0
163
163
create SectionButton in Tab
164
164
set the style of SectionButton to `width:100%`
165
- set the content of SectionButton to `Defaults `
166
- create DefaultsPanel in ContentDiv
167
- set the style of DefaultsPanel to `position:absolute;left:0;top:0;width:100%;height:100%;`
165
+ set the content of SectionButton to `Steps `
166
+ create StepsPanel in ContentDiv
167
+ set the style of StepsPanel to `position:absolute;left:0;top:0;width:100%;height:100%;`
168
168
create Tab in Tabs
169
169
set the style of Tab to `display:inline-block;width:` cat N cat `px`
170
170
index SectionButton to 1
@@ -186,24 +186,13 @@ L2:
186
186
index SectionButton to 3
187
187
create SectionButton in Tab
188
188
set the style of SectionButton to `width:100%`
189
- set the content of SectionButton to `Steps `
190
- create StepsPanel in ContentDiv
191
- set the style of StepsPanel to `position:absolute;left:0;top:0;width:100%;height:100%;`
189
+ set the content of SectionButton to `Defaults `
190
+ create DefaultsPanel in ContentDiv
191
+ set the style of DefaultsPanel to `position:absolute;left:0;top:0;width:100%;height:100%;`
192
192
193
- put -1 into Section
194
- on click SectionButton
195
- begin
196
- put the index of SectionButton into N
197
- if Section is not -1
198
- begin
199
- index SectionButton to Section
200
- set style `background` of SectionButton to ``
201
- end
202
- put N into Section
203
- index SectionButton to Section
204
- set style `background` of SectionButton to `lightgray`
205
- gosub to UpdateCurrentSection
206
- end
193
+ put 0 into Section
194
+ index SectionButton to 0
195
+ on click SectionButton gosub to SelectSection
207
196
208
197
! Create the file browser
209
198
create Overlay in Body
232
221
233
222
on click New
234
223
begin
235
- gosub to StopTestModule
236
- if Content is not Current
224
+ ! gosub to StopTestModule
225
+ if Presentation is not Current
237
226
begin
238
227
if confirm `Content has changed. Do you want to save it?`
239
228
begin
@@ -243,14 +232,16 @@ L2:
243
232
set the content of Status to `No script name has been given`
244
233
go to ResetStatus
245
234
end
246
- if PasswordValid rest post Content to `_save/json~ ` cat Name
247
- else put Content into storage as CurrentName
235
+ if PasswordValid rest post Presentation to `_save/json/ ` cat Name
236
+ else put Presentation into storage as CurrentName
248
237
end
249
238
end
250
239
clear FileIsOpen
251
240
set the content of NameEditor to empty
252
- put empty into Content
253
- put Content into Current
241
+ put empty into CurrentScriptName
242
+ put empty into Presentation
243
+ put empty into Current
244
+ gosub to UpdateCurrentSection
254
245
end
255
246
256
247
on click Open go to DoOpen
@@ -264,14 +255,17 @@ L2:
264
255
set the content of Status to `No script name has been given`
265
256
go to ResetStatus
266
257
end
267
- if the position of `.ecs ` in Name is -1 put Name cat `.ecs ` into Name
258
+ if the position of `.json ` in Name is -1 put Name cat `.json ` into Name
268
259
replace ` ` with `_` in Name
269
- if Content is not Current
260
+ set the content of NameEditor to Name
261
+ if Name is not CurrentScriptName put empty into Current
262
+ if Presentation is not Current
270
263
begin
271
- if PasswordValid rest post Content to `_save/json~ ` cat Name
272
- else put Content into storage as Name
273
- put Content into Current
264
+ if PasswordValid rest post Presentation to `_save/json/ ` cat Name
265
+ else put Presentation into storage as Name
266
+ put Presentation into Current
274
267
set the content of Status to `Presentation '` cat Name cat `' saved`
268
+ put Name into CurrentScriptName
275
269
fork to ResetStatus
276
270
end
277
271
else
@@ -292,43 +286,29 @@ L2:
292
286
end
293
287
if confirm `Are you sure you want to delete "` cat Name cat `"?`
294
288
begin
295
- if PasswordValid rest post Content to `_delete/json~ ` cat Name
289
+ if PasswordValid rest post to `_delete/json/ ` cat Name
296
290
else remove Name from storage
297
291
set the content of Status to `Script "` cat Name cat `" deleted`
298
292
set the content of NameEditor to empty
299
- put empty into Content
300
- put Content into Current
293
+ put empty into CurrentScriptName
294
+ put empty into Presentation
295
+ put Presentation into Current
301
296
go to ResetStatus
302
297
end
303
298
end
304
299
305
- set Presentation to object
306
- set Item to object
307
- set property `global` of Presentation to Item
308
- set property `container` of Presentation to Item
309
- set property `defaults` of Presentation to Item
310
- set property `blocks` of Presentation to Item
311
- set property `content` of Presentation to Item
312
- set Item to object
313
- set property `comment` of Item to `Pause for a second`
314
- set property `action` of Item to `pause`
315
- set property `duration` of Item to 1
316
- set Array to array
317
- json add Item to Array
318
- set property `steps` of Presentation to Array
319
- put Presentation into Current
320
- gosub to SetupDefaults
300
+ gosub to SetupSteps
321
301
gosub to SetupBlocks
322
302
gosub to SetupContent
323
- gosub to SetupSteps
324
- gosub to UpdateCurrentSection
303
+ gosub to SetupDefaults
304
+ gosub to SelectSection
325
305
stop
326
306
327
- SetupDefaults :
328
- if DefaultsModule is not running
307
+ SetupSteps :
308
+ if StepsModule is not running
329
309
begin
330
- rest get Script from `/resources/ecs/defaults .txt`
331
- run Script with DefaultsPanel and Presentation as DefaultsModule
310
+ rest get Script from `/resources/ecs/steps .txt`
311
+ run Script with StepsPanel and Presentation as StepsModule
332
312
end
333
313
return
334
314
@@ -348,23 +328,31 @@ SetupContent:
348
328
end
349
329
return
350
330
351
- SetupSteps :
352
- if StepsModule is not running
331
+ SetupDefaults :
332
+ if DefaultsModule is not running
353
333
begin
354
- rest get Script from `/resources/ecs/steps .txt`
355
- run Script with StepsPanel and Presentation as StepsModule
334
+ rest get Script from `/resources/ecs/defaults .txt`
335
+ run Script with DefaultsPanel and Presentation as DefaultsModule
356
336
end
357
337
return
358
338
339
+ SelectSection:
340
+ put the index of SectionButton into N
341
+ index SectionButton to Section
342
+ set style `background` of SectionButton to ``
343
+ put N into Section
344
+ index SectionButton to Section
345
+ set style `background` of SectionButton to `lightgray`
346
+
359
347
UpdateCurrentSection:
360
- set style `display` of DefaultsPanel to `none`
348
+ set style `display` of StepsPanel to `none`
361
349
set style `display` of BlocksPanel to `none`
362
350
set style `display` of ContentPanel to `none`
363
- set style `display` of StepsPanel to `none`
351
+ set style `display` of DefaultsPanel to `none`
364
352
if Section is 0
365
353
begin
366
- set style `display` of DefaultsPanel to `block`
367
- send to DefaultsModule
354
+ set style `display` of StepsPanel to `block`
355
+ send to StepsModule
368
356
end
369
357
else if Section is 1
370
358
begin
@@ -378,8 +366,8 @@ UpdateCurrentSection:
378
366
end
379
367
else if Section is 3
380
368
begin
381
- set style `display` of StepsPanel to `block`
382
- send to StepsModule
369
+ set style `display` of DefaultsPanel to `block`
370
+ send to DefaultsModule
383
371
end
384
372
return
385
373
@@ -392,7 +380,7 @@ DoOpen:
392
380
begin
393
381
if confirm `Content has changed. Do you want to save it?`
394
382
begin
395
- if PasswordValid rest post Content to `_save/json~ ` cat Name
383
+ if PasswordValid rest post Content to `_save/json/ ` cat Name
396
384
else put Content into storage as Name
397
385
end
398
386
end
@@ -484,6 +472,7 @@ DoOpen:
484
472
SelectFile:
485
473
index File to the index of FileName
486
474
set the content of NameEditor to File
475
+ put File into CurrentScriptName
487
476
if PasswordValid rest get Presentation from `/resources/json/` cat File
488
477
else get Presentation from storage as File
489
478
put Presentation into Current
0 commit comments