Mercurial > repos > rhope
comparison framework.vistxt @ 0:76568becd6d6
Rhope Alpha 2a source import
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 28 Apr 2009 23:06:07 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:76568becd6d6 |
---|---|
1 Import webserver.vistxt | |
2 | |
3 Framework Handler(8,0) | |
4 |: | |
5 page <- New@Page[title(6), path(1), use session(7), queryvars(3), headers(4)] | |
6 out list <- [handler(5)]Do[ [[New@List[]]Append[page]]Append[path(1)] ] | |
7 handler page <- [out list]Index[0] | |
8 If[[request type(2)] = ["POST"]] | |
9 |: | |
10 final page <- Process POST[handler page, con(0), headers(4)] | |
11 :||: | |
12 final page <- Val[handler page] | |
13 :| | |
14 string,headers <- [final page]Render | |
15 | |
16 [HTTP OK[client(0), Get Content Type[".html"], [string]Length, headers] | |
17 ]Put String[string] | |
18 :| | |
19 | |
20 Handler Fixer(1,1) | |
21 |: | |
22 If[[Type Of[handler(0)]] = ["List"]] | |
23 |: | |
24 out(0) <- [[["Framework Handler"]Set Input[5, [handler(0)]Index[0]]]Set Input[6, [handler(0)]Index[1]]]Set Input[7, [handler(0)]Index[2]] | |
25 :||: | |
26 out(0) <- handler(0) | |
27 :| | |
28 :| | |
29 | |
30 Start Web(1,0) | |
31 |: | |
32 Print["Starting Rhope Web Server"] | |
33 Listen on Port[80,["Connection Start"]Set Input[1, Map[handlers(0),"Handler Fixer"]]] | |
34 Wait Forever[] | |
35 :| | |
36 | |
37 Get Class(1,1) | |
38 |: | |
39 If[[[[container(0)]Class >>]Length] > [0]] | |
40 |: | |
41 class(0) <- [[" class=\""]Append[[container(0)]Class >>]]Append["\""] | |
42 :||: | |
43 class(0) <- "" | |
44 :| | |
45 :| | |
46 | |
47 Company Web Event | |
48 |: | |
49 Event Name | |
50 Origin | |
51 Data | |
52 :| | |
53 | |
54 New@Web Event(3,1) | |
55 |: | |
56 out(0) <- [[[Build["Web Event"]]Event Name <<[name(0)]]Origin <<[origin(1)]]Data <<[data(2)] | |
57 :| | |
58 | |
59 Company Web Container | |
60 |: | |
61 Tag Name | |
62 Class | |
63 Propagate Events | |
64 Children | |
65 Handlers | |
66 Named Children | |
67 Session | |
68 Use Session | |
69 :| | |
70 | |
71 New@Web Container(1,1) | |
72 |: | |
73 out(0) <- [[[[[[[Build["Web Container"] | |
74 ]Tag Name <<["div"] | |
75 ]Class <<[class(0)] | |
76 ]Propagate Events <<[No] | |
77 ]Children <<[New@List[]] | |
78 ]Named Children <<[New@Dictionary[]] | |
79 ]Handlers <<[New@Dictionary[]] | |
80 ]Use Session <<[No] | |
81 :| | |
82 | |
83 Name@Web Container(1,2) | |
84 |: | |
85 none(1) <- cont(0) | |
86 :| | |
87 | |
88 Render Child(2,1) | |
89 |: | |
90 out(0) <- [start(0)]Append[[container(1)]Render] | |
91 :| | |
92 | |
93 Set Session@Web Container(2,1) | |
94 |: | |
95 out(0) <- [ | |
96 [ | |
97 [container(0)]Use Session <<[Yes] | |
98 ]Session <<[session(1)] | |
99 ]Children <<[ Map[ [container(0)]Children >>, ["Set Session"]Set Input[1, session(1)] ] ] | |
100 :| | |
101 | |
102 Set Handler@Web Container(3,1) | |
103 |: | |
104 out(0) <- [container(0)]Handlers <<[ [[container(0)]Handlers >> ]Set[event name(1), handler(2)] ] | |
105 :| | |
106 | |
107 Render@Web Container(1,2) | |
108 |: | |
109 out(0) <- [[[[[[["<"]Append[ [container(0)]Tag Name >> ] | |
110 ]Append[Get Class[container(0)]] | |
111 ]Append[">\n\t"] | |
112 ]Append[Fold[["Render Child"]<String@Worker, "", [container(0)]Children >>]] | |
113 ]Append["\n</"] | |
114 ]Append[ [container(0)]Tag Name >> ] | |
115 ]Append[">\n"] | |
116 :| | |
117 | |
118 Container Event Handler(2,2) | |
119 |: | |
120 event <- [events(1)]Index[index(2)] | |
121 [[container(0)]Handlers >>]Index[ [event]Event Name >>] | |
122 |: | |
123 result list <- [~]Do[ | |
124 [[New@List[]]Append[container(0)]]Append[event] | |
125 ] | |
126 new container <- [result list]Index[0] | |
127 [result list]Index[1] | |
128 |: | |
129 events(1) <- [result events]Append[~] | |
130 :||: | |
131 events(1) <- Val[result events] | |
132 :| | |
133 :||: | |
134 new container <- container(0) | |
135 events(1) <- Val[result events] | |
136 :| | |
137 | |
138 [events(1)]Next[index(2)] | |
139 |: | |
140 cont(0), result events <- Container Event Handler[new container, events(1), ~] | |
141 :||: | |
142 cont(0) <- Val[new container] | |
143 result events <- New@List[] | |
144 :| | |
145 :| | |
146 | |
147 Container Postback Helper(4,2) | |
148 |: | |
149 ,current events <- [[[container(0)]Children >>]Index[index(2)]]Postback[post data(1)] | |
150 |: | |
151 new container <- [container(0)]Children <<[[[container(0)]Children >>]Set[index(2), ~]] | |
152 :| | |
153 events <- Concatenate[events(3), current events] | |
154 [[new container]Children >>]Next[index(2)] | |
155 |: | |
156 out(0), events(1) <- Container Postback Helper[new container, post data(1), ~, events] | |
157 :||: | |
158 [events]First | |
159 |: | |
160 out(0), newevents <- Container Event Handler[new container, events, ~] | |
161 events(1) <- Concatenate[events, newevents] | |
162 :||: | |
163 out(0) <- Val[new container] | |
164 events(1) <- Val[events] | |
165 :| | |
166 :| | |
167 :| | |
168 | |
169 Postback@Web Container(2,2) | |
170 |: | |
171 [[container(0)]Children >>]First | |
172 |: | |
173 out(0), events <- Container Postback Helper[container(0), post data(1), ~, New@List[]] | |
174 If[[container(0)]Propagate Events >>] | |
175 |: | |
176 events(1) <- Val[events] | |
177 :||: | |
178 events(1) <- New@List[] | |
179 :| | |
180 :||: | |
181 out(0) <- container(0) | |
182 events(1) <- New@List[] | |
183 :| | |
184 :| | |
185 | |
186 Add Child(2,1) | |
187 |: | |
188 If[[cont(0)]Use Session >>] | |
189 |: | |
190 child <- [child(1)]Set Session[[cont(0)]Session >>] | |
191 :||: | |
192 child <- Val[child(1)] | |
193 :| | |
194 with child <- [cont(0)]Children <<[ [[cont(0)]Children >>]Append[child] ] | |
195 | |
196 [child]Name | |
197 |: | |
198 out(0) <- [with child]Named Children <<[ [[with child]Named Children >>]Set[~, [[[with child]Children >>]Length] - [1]] ] | |
199 :||: | |
200 out(0) <- Val[with child] | |
201 :| | |
202 :| | |
203 | |
204 Get Child By Name(2,2) | |
205 |: | |
206 ,not found(1) <- [[container(0)]Named Children >>]Index[name(1)] | |
207 |: | |
208 out(0) <- [[container(0)]Children >>]Index[~] | |
209 :| | |
210 :| | |
211 | |
212 Company Page | |
213 |: | |
214 Title | |
215 URL | |
216 CSS | |
217 Children | |
218 Named Children | |
219 Handlers | |
220 Use Session | |
221 Session | |
222 Session ID | |
223 :| | |
224 | |
225 Set Handler@Page(3,1) | |
226 |: | |
227 out(0) <- [container(0)]Handlers <<[ [[container(0)]Handlers >> ]Set[event name(1), handler(2)] ] | |
228 :| | |
229 | |
230 New@Page(5,1) | |
231 |: | |
232 page <- [[[[[[[Build["Page"] | |
233 ]Title <<[title(0)] | |
234 ]URL <<[url(1)] | |
235 ]CSS <<[[New@List[]]Append["/default.css"]] | |
236 ]Children <<[New@List[]] | |
237 ]Named Children <<[New@Dictionary[]] | |
238 ]Handlers <<[New@Dictionary[]] | |
239 ]Use Session <<[use session(2)] | |
240 If[use session(2)] | |
241 |: | |
242 Load@Session[queryvars(3), headers(4)] | |
243 |: | |
244 out(0) <- [[page]Session <<[~]]Session ID <<[ [~]Session ID>>] | |
245 :| | |
246 :||: | |
247 out(0) <- Val[page] | |
248 :| | |
249 :| | |
250 | |
251 Get Action@Page(1,1) | |
252 |: | |
253 If[[page(0)]Use Session>>] | |
254 |: | |
255 [[page(0)]Session >>]Get Link Params | |
256 |: | |
257 out(0) <- [[[page(0)]URL >>]Append["?"]]Append[~] | |
258 :||: | |
259 out(0) <- [page(0)]URL >> | |
260 :| | |
261 :||: | |
262 out(0) <- [page(0)]URL >> | |
263 :| | |
264 :| | |
265 | |
266 Render@Page(1,2) | |
267 |: | |
268 out(0) <- [[[[[[["<html>\n\t<head>\n\t\t<title>"]Append[[page(0)]Title >>] | |
269 ]Append["</title>\n\t\t<link rel=\"stylesheet\" href=\""] | |
270 ]Append[[[page(0)]CSS >>]Join["\">\n\t\t<link rel=\"stylesheet\" href=\""]] | |
271 ]Append["\">\n\t</head>\n\t<body>\n\t<form method=\"POST\" action=\""] | |
272 ]Append[[[page(0)]Get Action]Append["\">\n"]] | |
273 ]Append[Fold[["Render Child"]<String@Worker, "", [page(0)]Children >>]] | |
274 ]Append["\t</form>\n\t</body>\n</html>"] | |
275 If[[page(0)]Use Session>>] | |
276 |: | |
277 headers(1) <- [[page(0)]Session >>]Finalize[New@Dictionary[]] | |
278 :||: | |
279 headers(1) <- New@Dictionary[] | |
280 :| | |
281 :| | |
282 | |
283 Clear Children(1,1) | |
284 |: | |
285 out(0) <- [[page(0)]Children <<[New@List[]]]Named Children <<[New@Dictionary[]] | |
286 :| | |
287 | |
288 Set@Page(3,1) | |
289 |: | |
290 out(0) <- [page(0)]Session <<[ [[page(0)]Session >>]Set[key(1), val(2)] ] | |
291 :| | |
292 | |
293 Index@Page(2,2) | |
294 |: | |
295 out(0),not found(1) <- [[page(0)]Session >>]Index[key(1)] | |
296 :| | |
297 | |
298 First@Page(1,2) | |
299 |: | |
300 first(0),not found(1) <- [[page(0)]Session >>]First | |
301 :| | |
302 | |
303 Next@Page(2,2) | |
304 |: | |
305 next(0),not found(1) <- [[page(0)]Session >>]Next[last(1)] | |
306 :| | |
307 | |
308 Add CSS@Page(1,1) | |
309 |: | |
310 out(0) <- [page(0)]CSS <<[ [[page(0)]CSS >>]Append[css(1)] ] | |
311 :| | |
312 | |
313 Clear CSS@Page(1,1) | |
314 |: | |
315 out(0) <- [page(0)]CSS <<[New@List[]] | |
316 :| | |
317 | |
318 Decode Helper Decode(3,1) | |
319 |: | |
320 code,rest <- [[list(0)]Index[index(2)]]Slice[2] | |
321 newlist <- [destlist(1)]Set[index(2), [[""]Put Byte[From Hex@Whole Number[code]]]Append[rest]] | |
322 [list(0)]Next[index(2)] | |
323 |: | |
324 out(0) <- Decode Helper Decode[list(0), newlist, ~] | |
325 :||: | |
326 out(0) <- Val[newlist] | |
327 :| | |
328 :| | |
329 | |
330 Decode Helper Straight(3,1) | |
331 |: | |
332 newlist <- [destlist(1)]Set[index(2), [list(0)]Index[index(2)]] | |
333 [list(0)]Next[index(2)] | |
334 |: | |
335 out(0) <- Decode Helper Decode[list(0), newlist, ~] | |
336 :||: | |
337 out(0) <- Val[newlist] | |
338 :| | |
339 :| | |
340 | |
341 URL Decode(1,1) | |
342 |: | |
343 parts <- [val(0)]Split["%"] | |
344 [parts]First | |
345 |: | |
346 val(0) <- [Decode Helper Straight[parts, New@List[], ~]]Join[""] | |
347 :||: | |
348 val(0) <- val(0) | |
349 :| | |
350 :| | |
351 | |
352 URL Encode Path(1,1) | |
353 |: | |
354 out(0) <- [[[[string(0)]Replace["%","%25"]]Replace[" ","%20"]]Replace["/","%2F"]]Replace["?","%3F"] | |
355 :| | |
356 | |
357 Decode Pair(2,2) | |
358 |: | |
359 val(0) <- URL Decode[val(0)] | |
360 key(1) <- URL Decode[key(1)] | |
361 :| | |
362 | |
363 Process POST(3,1) | |
364 |: | |
365 [con(1)]Get FString[[headers(2)]Index["Content-Length"]] |::| | |
366 |: | |
367 post string <- [~]Replace["+"," "] | |
368 :| | |
369 post data <- Key Value Map[Dict Split[post string, "=", "&"], ["Decode Pair"]<String@Worker] | |
370 out(0) <- [page(0)]Postback[post data] | |
371 :| | |
372 | |
373 Postback@Page(2,2) | |
374 |: | |
375 [[container(0)]Children >>]First | |
376 |: | |
377 out(0), events(1) <- Container Postback Helper[container(0), post data(1), ~, New@List[]] | |
378 :||: | |
379 page(0) <- page(0) | |
380 :| | |
381 events(1) <- New@List[] | |
382 :| | |
383 | |
384 Company Web Text | |
385 |: | |
386 Text | |
387 Enclosing Tag | |
388 :| | |
389 | |
390 New@Web Text(2,1) | |
391 |: | |
392 out(0) <- [[Build["Web Text"]]Text <<[text(0)]]Enclosing Tag <<[tag(1)] | |
393 :| | |
394 | |
395 Name@Web Text(1,2) | |
396 |: | |
397 none(1) <- text(0) | |
398 :| | |
399 | |
400 Escape HTML Text(1,1) | |
401 |: | |
402 out(0) <- [[[string(0)]Replace["&","&"]]Replace["<", "<"]]Replace[">", ">"] | |
403 :| | |
404 | |
405 Render@Web Text(1,2) | |
406 |: | |
407 processed text <- [Escape HTML Text[[text(0)]Text >>]]Replace["\n","<br>\n\t"] | |
408 If[[[[text(0)]Enclosing Tag >>]Length] = [0]] | |
409 |: | |
410 out(0) <- Val[processed text] | |
411 :||: | |
412 out(0) <- [[[["<"]Append[[text(0)]Enclosing Tag >>]]Append[">"]]Append[processed text]]Append[[["</"]Append[[text(0)]Enclosing Tag >>]]Append[">"]] | |
413 :| | |
414 :| | |
415 | |
416 Postback@Web Text(2,2) | |
417 |: | |
418 out(0) <- in(0) | |
419 events(1) <- New@List[] | |
420 :| | |
421 | |
422 Set Session@Web Text(2,1) | |
423 |: | |
424 (0) <- (0) | |
425 :| | |
426 | |
427 Render@String(1,2) | |
428 |: | |
429 out(0) <- [New@Web Text[string(0),""]]Render | |
430 :| | |
431 | |
432 Name@String(1,2) | |
433 |: | |
434 none(1) <- string(0) | |
435 :| | |
436 | |
437 Postback@String(2,2) | |
438 |: | |
439 out(0) <- in(0) | |
440 events(1) <- New@List[] | |
441 :| | |
442 | |
443 Set Session@String(2,1) | |
444 |: | |
445 (0) <- (0) | |
446 :| | |
447 | |
448 Company Web Field | |
449 |: | |
450 Name | |
451 Value | |
452 Type | |
453 Class | |
454 :| | |
455 | |
456 Name@Web Field(1,2) | |
457 |: | |
458 name(0) <- [field(0)]Name >> | |
459 :| | |
460 | |
461 New@Web Field(3,1) | |
462 |: | |
463 out(0) <- [[[[Build["Web Field"]]Name <<[name(0)]]Value <<[value(1)]]Type <<[type(2)]]Class <<[""] | |
464 :| | |
465 | |
466 Set Session@Web Field(2,1) | |
467 |: | |
468 (0) <- (0) | |
469 :| | |
470 | |
471 Render@Web Field(1,2) | |
472 |: | |
473 If[[[field(0)]Type >>] = ["multiline"]] | |
474 |: | |
475 out(0) <- [[[[[["<textarea name=\""]Append[[field(0)]Name >>]]Append["\""]]Append[Get Class[field(0)]]]Append[">"]]Append[[field(0)]Value >>]]Append["</textarea>"] | |
476 :||: | |
477 out(0) <- [[[[[[[["<input type=\""]Append[[field(0)]Type >>]]Append["\" name=\""]]Append[[field(0)]Name >>]]Append["\""]]Append[Get Class[field(0)]]]Append[" value=\""]]Append[[field(0)]Value >>]]Append["\">"] | |
478 :| | |
479 | |
480 :| | |
481 | |
482 Postback@Web Field(2,2) | |
483 |: | |
484 [post data(1)]Index[[field(0)]Name >>] | |
485 |: | |
486 out(0) <- [field(0)]Value <<[~] | |
487 | |
488 If[[[field(0)]Value >>] = [~]] | |
489 |: | |
490 event(1) <- New@List[] | |
491 :||: | |
492 event(1) <- [New@List[]]Append[ New@Web Event["change", [field(0)]Name >>, [field(0)]Value >>] ] | |
493 :| | |
494 :||: | |
495 out(0) <- field(0) | |
496 event(1) <- New@List[] | |
497 :| | |
498 :| | |
499 | |
500 Company Web Button | |
501 |: | |
502 Name | |
503 Label | |
504 Class | |
505 :| | |
506 | |
507 New@Web Button(2,1) | |
508 |: | |
509 out(0) <- [[[Build["Web Button"]]Name <<[name(0)]]Label <<[label(1)]]Class <<[""] | |
510 :| | |
511 | |
512 Name@Web Button(1,2) | |
513 |: | |
514 name(0) <- [button(0)]Name >> | |
515 :| | |
516 | |
517 Set Session@Web Button(2,1) | |
518 |: | |
519 (0) <- (0) | |
520 :| | |
521 | |
522 Postback@Web Button(2,2) | |
523 |: | |
524 out(0) <- button(0) | |
525 [post data(1)]Index[[button(0)]Name >>] | |
526 |: | |
527 events(1) <- [New@List[]]Append[ New@Web Event["click", [button(0)]Name >>, 0] ] | |
528 :||: | |
529 events(1) <- New@List[] | |
530 :| | |
531 :| | |
532 | |
533 Render@Web Button(1,2) | |
534 |: | |
535 out(0) <- [[[[[["<input type=\"submit\" name=\""]Append[[field(0)]Name >>]]Append["\""]]Append[Get Class[button(0)]]]Append[" value=\""]]Append[[button(0)]Label >>]]Append["\">"] | |
536 :| | |
537 | |
538 Company Session | |
539 |: | |
540 Session ID | |
541 IP Address | |
542 Use Cookies | |
543 Data | |
544 :| | |
545 | |
546 Get Unique ID(0,1) uses Session | |
547 |: | |
548 out(0) <- [[[::ID]<Whole Number@String]Append["_"]]Append[Random[]] | |
549 ::ID <- [::ID]+[1] | |
550 :| | |
551 | |
552 New@Session(0,1) | |
553 |: | |
554 out(0) <- [[[Build["Session"]]Session ID <<[Get Unique ID[]]]Use Cookies <<[No]]Data <<[New@Dictionary[]] | |
555 :| | |
556 | |
557 Load@Session(2,1) uses Session | |
558 |: | |
559 ,checkquery <- [headers(1)]Index["Cookie"] | |
560 |: | |
561 parts <- Dict Split[~, "=", "; "] | |
562 ,checkquery <- [parts]Index["session_id"] | |
563 |: | |
564 ,checkquery <- [::Sessions]Index[~] | |
565 |: | |
566 out(0) <- [~]Use Cookies <<[Yes] | |
567 :| | |
568 :| | |
569 :| | |
570 | |
571 | |
572 checkquery | |
573 |: | |
574 ,makenew <- [queryvars(0)]Index["session_id"] | |
575 |: | |
576 out(0), makenew <- [::Sessions]Index[~] | |
577 :| | |
578 :| | |
579 | |
580 makenew | |
581 |: | |
582 out(0) <- New@Session[] | |
583 :| | |
584 :| | |
585 | |
586 Get Link Params@Session(1,2) | |
587 |: | |
588 If[[session(0)]Use Cookies >>] | |
589 |: | |
590 no params(1) <- No | |
591 :||: | |
592 out(0) <- ["session_id="]Append[[session(0)]Session ID >>] | |
593 :| | |
594 :| | |
595 | |
596 Set@Session(3,1) | |
597 |: | |
598 out(0) <- [session(0)]Data <<[ [[session(0)]Data >>]Set[key(1), val(2)] ] | |
599 :| | |
600 | |
601 Index@Session(2,2) | |
602 |: | |
603 out(0),not found(1) <- [[session(0)]Data >>]Index[key(1)] | |
604 :| | |
605 | |
606 First@Session(1,2) | |
607 |: | |
608 first(0),not found(1) <- [[session(0)]Data >>]First | |
609 :| | |
610 | |
611 Next@Session(2,2) | |
612 |: | |
613 next(0),not found(1) <- [[session(0)]Data >>]Next[last(1)] | |
614 :| | |
615 | |
616 Init Session Store(0,1) | |
617 |: | |
618 Init Store["Session"] | |
619 out(0) <- 0 | |
620 :| | |
621 | |
622 Set Session Store(0,0) uses Session | |
623 |: | |
624 ::ID <- 1 | |
625 ::Sessions <- New@Dictionary[] | |
626 :| | |
627 | |
628 Init Sessions(0,1) | |
629 |: | |
630 Init Session Store[] |: | |
631 Set Session Store[] :| | |
632 out(0) <- 0 | |
633 :| | |
634 | |
635 Finalize@Session(2,1) uses Session | |
636 |: | |
637 ::Sessions <- [::Sessions]Set[[session(0)]Session ID >>, session(0)] | |
638 out headers(0) <- [headers(1)]Set["Set-Cookie", ["session_id="]Append[[session(0)]Session ID >>]] | |
639 :| | |
640 | |
641 Company Web Link | |
642 |: | |
643 Text | |
644 Target | |
645 Class | |
646 Query Params | |
647 :| | |
648 | |
649 New@Web Link(2,1) | |
650 |: | |
651 out(0) <- [[[[Build["Web Link"]]Text <<[text(0)]]Target <<[target(1)]]Class <<[""]]Query Params <<[New@Dictionary[]] | |
652 :| | |
653 | |
654 | |
655 With Session@Web Link(3,1) | |
656 |: | |
657 New@Web Link[text(0), target(1)] | |
658 |: | |
659 out(0) <- [~]Query Params <<[[[~]Query Params >>]Set["session_id", [session(2)]Session ID >>]] | |
660 :| | |
661 :| | |
662 | |
663 Render@Web Link(1,2) | |
664 |: | |
665 [[link(0)]Query Params>>]First | |
666 |: | |
667 queryvars <- ["?"]Append[Key Value Join[[link(0)]Query Params>>, "=","&"]] | |
668 :||: | |
669 queryvars <- "" | |
670 :| | |
671 out(0) <- [[[[[[["<a href=\""]Append[[link(0)]Target>>]]Append[queryvars]]Append["\""] | |
672 ]Append[Get Class[link(0)]]]Append[">"]]Append[Escape HTML Text[[link(0)]Text>>]]]Append["</a>"] | |
673 :| | |
674 | |
675 Postback@Web Link(2,2) | |
676 |: | |
677 out(0) <- in(0) | |
678 events(1) <- New@List[] | |
679 :| | |
680 | |
681 Name@Web Link(1,2) | |
682 |: | |
683 none(1) <- link(0) | |
684 :| | |
685 | |
686 Set Session@Web Link(2,1) | |
687 |: | |
688 If[[[[link(0)]Target >>]Slice[7]] = ["http://"]] | |
689 |: | |
690 out(0) <- link(0) | |
691 :||: | |
692 If[[session(1)]Use Cookies >>] | |
693 |: | |
694 out(0) <- link(0) | |
695 :||: | |
696 out(0) <- [link(0)]Query Params <<[[[link(0)]Query Params >>]Set["session_id", [session(1)]Session ID>>]] | |
697 :| | |
698 :| | |
699 :| | |
700 | |
701 Company Web Table | |
702 |: | |
703 Headers | |
704 Data | |
705 :| | |
706 | |
707 New@Web Table(2,1) | |
708 |: | |
709 out(0) <- [[Build["Web Table"]]Headers <<[headers(0)]]Data <<[data(1)] | |
710 :| | |
711 | |
712 Name@Web Table(1,2) | |
713 |: | |
714 none(1) <- link(0) | |
715 :| | |
716 | |
717 Set Session@Web Table(2,1) | |
718 |: | |
719 (0) <- (0) | |
720 :| | |
721 | |
722 Postback@Web Table(2,2) | |
723 |: | |
724 (0) <- (0) | |
725 (1) <- {} | |
726 :| | |
727 | |
728 Make Header Row(2,1) | |
729 |: | |
730 out(0) <- [[[string(0)]Append["\t\t\t<th>"]]Append[header(1)]]Append["</th>\n"] | |
731 :| | |
732 | |
733 Get Header Row@Web Table(1,1) | |
734 |: | |
735 If[[[[table(0)]Headers >>]Length] > [0]] | |
736 |: | |
737 out(0) <- [Fold[["Make Header Row"]<String@Worker, "\t\t<tr>\n", [table(0)]Headers >>]]Append["\t\t</tr>\n"] | |
738 :||: | |
739 out(0) <- "" | |
740 :| | |
741 :| | |
742 | |
743 Make Table Cell(2,1) | |
744 |: | |
745 out(0) <- [[[string(0)]Append["\t\t\t<td>"]]Append[[cell(1)]Render]]Append["</td>\n"] | |
746 :| | |
747 | |
748 Make Table Row(2,1) | |
749 |: | |
750 out(0) <- [Fold[["Make Table Cell"]<String@Worker, [string(0)]Append["\t\t<tr>\n"], row(1)]]Append["\t\t</tr>"] | |
751 :| | |
752 | |
753 Render@Web Table(1,2) | |
754 |: | |
755 out(0) <- [ | |
756 [ | |
757 ["\t<table>\n"]Append[[table(0)]Get Header Row] | |
758 ]Append[ Fold[["Make Table Row"]<String@Worker, "", [table(0)]Data >>] ] | |
759 ]Append["\t</table>\n"] | |
760 :| | |
761 |