|
...
|
...
|
@@ -5,7 +5,7 @@ |
|
5
|
5
|
*Title* Making interactive Web sites. |
|
6
|
6
|
|
|
7
|
7
|
*Copyright* Copyright (c) Alain Prouté 2004-2005. |
|
8
|
|
- Copyright (c) Calexium 2007-2016. |
|
|
8
|
+ Copyright (c) Calexium 2007-2017. |
|
9
|
9
|
|
|
10
|
10
|
|
|
11
|
11
|
*Authors* Alain Prouté |
|
...
|
...
|
@@ -47,7 +47,7 @@ |
|
47
|
47
|
--------------------------------------------------------------------------------------- |
|
48
|
48
|
|
|
49
|
49
|
|
|
50
|
|
-read tools/basis.anubis |
|
|
50
|
+transmit tools/basis.anubis |
|
51
|
51
|
read tools/printable_tree.anubis |
|
52
|
52
|
read tools/base64.anubis |
|
53
|
53
|
read tools/random.anubis |
|
...
|
...
|
@@ -55,12 +55,13 @@ read tools/dictionaries.anubis |
|
55
|
55
|
read system/lists.anubis |
|
56
|
56
|
read system/string.anubis |
|
57
|
57
|
read system/logger.anubis |
|
58
|
|
-read CXM_common.anubis |
|
59
|
|
-read CXM_multihost_http_server.anubis |
|
|
58
|
+transmit CXM_common.anubis |
|
|
59
|
+transmit CXM_multihost_http_server.anubis |
|
60
|
60
|
read web/mime.anubis |
|
61
|
61
|
read CXM_cookies.anubis |
|
62
|
62
|
read CXM_json.anubis |
|
63
|
|
-read CXM_web_dump.anubis |
|
|
63
|
+transmit CXM_web_dump.anubis |
|
|
64
|
+transmit CXM_web_arg_utils.anubis |
|
64
|
65
|
|
|
65
|
66
|
//read CXM_html_tooltip.anubis |
|
66
|
67
|
|
|
...
|
...
|
@@ -276,64 +277,6 @@ public type Web_Action($State): |
|
276
|
277
|
In most cases, HTTP informations are not used. This is the reason why they are gathered |
|
277
|
278
|
for simplicity into a unique datum of type 'HTTP_Info'. |
|
278
|
279
|
|
|
279
|
|
-// For your convenience, we introduce the following simpler variants: |
|
280
|
|
-// |
|
281
|
|
-//public define Web_Action($State) |
|
282
|
|
-// http_action |
|
283
|
|
-// ( |
|
284
|
|
-// String name, |
|
285
|
|
-// $State -> Bool allow, |
|
286
|
|
-// (List(Web_arg),$State) -> $State do_it |
|
287
|
|
-// ) = |
|
288
|
|
-// http_action(name, |
|
289
|
|
-// (Maybe($State) ms) |-> if ms is |
|
290
|
|
-// { |
|
291
|
|
-// failure then true, |
|
292
|
|
-// success(s) then allow(s) |
|
293
|
|
-// }, |
|
294
|
|
-// (HTTP_Info h, List(Web_arg) l, Maybe($State) s) |-> if s is |
|
295
|
|
-// { |
|
296
|
|
-// failure then (failure, []), |
|
297
|
|
-// success(s2) then (success(do_it(l,s2)), []) |
|
298
|
|
-// }). |
|
299
|
|
-// |
|
300
|
|
-//public define Web_Action($State) |
|
301
|
|
-// https_action |
|
302
|
|
-// ( |
|
303
|
|
-// String name, |
|
304
|
|
-// $State -> Bool allow, |
|
305
|
|
-// (List(Web_arg),$State) -> $State do_it |
|
306
|
|
-// ) = |
|
307
|
|
-// https_action(name, |
|
308
|
|
-// (Maybe($State) ms) |-> if ms is |
|
309
|
|
-// { |
|
310
|
|
-// failure then true, |
|
311
|
|
-// success(s) then allow(s) |
|
312
|
|
-// }, |
|
313
|
|
-// (HTTP_Info h, List(Web_arg) l, Maybe($State) s) |-> if s is |
|
314
|
|
-// { |
|
315
|
|
-// failure then (failure, []), |
|
316
|
|
-// success(s2) then (success(do_it(l,s2)), []) |
|
317
|
|
-// }). |
|
318
|
|
-// |
|
319
|
|
-//public define Web_Action($State) |
|
320
|
|
-// http_https_action |
|
321
|
|
-// ( |
|
322
|
|
-// String name, |
|
323
|
|
-// $State -> Bool allow, |
|
324
|
|
-// (List(Web_arg),$State) -> $State do_it |
|
325
|
|
-// ) = |
|
326
|
|
-// http_https_action(name, |
|
327
|
|
-// (Maybe($State) ms) |-> if ms is |
|
328
|
|
-// { |
|
329
|
|
-// failure then true, |
|
330
|
|
-// success(s) then allow(s) |
|
331
|
|
-// }, |
|
332
|
|
-// (HTTP_Info h, List(Web_arg) l, Maybe($State) s) |-> if s is |
|
333
|
|
-// { |
|
334
|
|
-// failure then (failure, []), |
|
335
|
|
-// success(s2) then (success(do_it(l,s2)), []) |
|
336
|
|
-// }). |
|
337
|
280
|
|
|
338
|
281
|
|
|
339
|
282
|
|
|
...
|
...
|
@@ -353,19 +296,189 @@ public type HTTP_Answer:... |
|
353
|
296
|
understand the page shown to the client as a representation of the current state of the |
|
354
|
297
|
conversation between the client and the web site, but also containing informations |
|
355
|
298
|
taken from the data bases. |
|
356
|
|
- |
|
357
|
|
-transmit CXM_controller.anubis |
|
358
|
|
- |
|
359
|
|
-public type WEB_Controller($State): |
|
|
299
|
+ |
|
|
300
|
+public type WEB_Action_Name: |
|
|
301
|
+ controller_action( |
|
|
302
|
+ String controller, |
|
|
303
|
+ String action_name |
|
|
304
|
+ ), |
|
|
305
|
+ action_name( |
|
|
306
|
+ String name |
|
|
307
|
+ ) |
|
|
308
|
+. |
|
|
309
|
+ |
|
|
310
|
+public type WEB_Session_Entry: |
|
|
311
|
+ session_entry( |
|
|
312
|
+ String field, |
|
|
313
|
+ String value |
|
|
314
|
+ ). |
|
|
315
|
+ |
|
|
316
|
+public type WEB_Request: |
|
|
317
|
+ web_request( |
|
|
318
|
+ HTTP_Info http_info, |
|
|
319
|
+ List(Web_arg) lwa, |
|
|
320
|
+ Bool is_https, |
|
|
321
|
+ ) |
|
|
322
|
+. |
|
|
323
|
+ |
|
|
324
|
+public type WEB_Session: |
|
|
325
|
+ web_session( |
|
|
326
|
+ String language, |
|
|
327
|
+ List(WEB_Session_Entry) entries, |
|
|
328
|
+ WEB_Request web_request, |
|
|
329
|
+ WEB_Request previous_request |
|
|
330
|
+ ). |
|
|
331
|
+ |
|
|
332
|
+ |
|
|
333
|
+ |
|
|
334
|
+public type WEB_Controller_Result: |
|
|
335
|
+ http_answer( |
|
|
336
|
+ WEB_Session session, //modified session |
|
|
337
|
+ HTTP_Answer http_answer //http answer |
|
|
338
|
+ ), |
|
|
339
|
+ http_answer( |
|
|
340
|
+ HTTP_Answer http_answer //http answer |
|
|
341
|
+ ), |
|
|
342
|
+ redirect( //internal redirection, session is modified to call the right controller and action |
|
|
343
|
+ WEB_Session session |
|
|
344
|
+ ), |
|
|
345
|
+ redirect_to_previous, |
|
|
346
|
+ ajax( |
|
|
347
|
+ HTTP_Answer http_answer |
|
|
348
|
+ ) |
|
|
349
|
+. |
|
|
350
|
+ |
|
|
351
|
+public type WEB_Action_Allowed_Protocol: |
|
|
352
|
+ http, |
|
|
353
|
+ https, |
|
|
354
|
+ http_https. |
|
|
355
|
+ |
|
|
356
|
+public type WEB_Action: |
|
|
357
|
+ web_action( |
|
|
358
|
+ WEB_Action_Name name, // name of action |
|
|
359
|
+ WEB_Action_Allowed_Protocol allowed_proto, |
|
|
360
|
+ (WEB_Session) -> Bool allow, // true if action allowed |
|
|
361
|
+ (WEB_Session) -> WEB_Controller_Result do_it |
|
|
362
|
+ ) |
|
|
363
|
+. |
|
|
364
|
+ |
|
|
365
|
+public type WEB_Controller: |
|
360
|
366
|
web_controller( |
|
361
|
|
- String name, //controller name |
|
362
|
|
- (HTTP_Info http_info, |
|
363
|
|
- List(Web_arg) lwa, |
|
364
|
|
- Bool is_https, |
|
365
|
|
- $State session |
|
366
|
|
- ) -> ($State, HTTP_Answer) view //view renderer |
|
|
367
|
+ String name, //controller name |
|
|
368
|
+ Var(List(WEB_Action)) controller_actions, //list of all actions of that controller |
|
|
369
|
+ (WEB_Session)-> WEB_Controller_Result error //Error renderer |
|
367
|
370
|
) |
|
368
|
371
|
. |
|
|
372
|
+ |
|
|
373
|
+define List(HTTP_header) |
|
|
374
|
+ make_session_cookie_headers |
|
|
375
|
+ ( |
|
|
376
|
+ String website_name, |
|
|
377
|
+ String session_name |
|
|
378
|
+ ) |
|
|
379
|
+ = |
|
|
380
|
+ //println("Set-Cookie state_"+website_name+"="+state_name); |
|
|
381
|
+ [ |
|
|
382
|
+ http_header("Set-Cookie", "session_"+website_name+"="+session_name) |
|
|
383
|
+ ] |
|
|
384
|
+ . |
|
|
385
|
+ |
|
|
386
|
+define WEB_Session -> String // the function constructed returns the name of the state |
|
|
387
|
+ make_save_session_function |
|
|
388
|
+ ( |
|
|
389
|
+ Int timeout, |
|
|
390
|
+ String state_directory |
|
|
391
|
+ ) = |
|
|
392
|
+ (WEB_Session s) |-> |
|
|
393
|
+ //Set the new timeout |
|
|
394
|
+ with time_stamp = now+timeout, |
|
|
395
|
+ to_be_saved = (time_stamp,s), |
|
|
396
|
+ //generate new session name |
|
|
397
|
+ session_name = to_ascii(sha1(s)), |
|
|
398
|
+ //println("make_save_state_function " + state_directory+"/s"+state_name); |
|
|
399
|
+ if save(to_be_saved,state_directory+"/"+session_name) is ok then |
|
|
400
|
+ session_name |
|
|
401
|
+ else |
|
|
402
|
+ println("Cannot create session file in '"+state_directory+"'.\n"); |
|
|
403
|
+ "" |
|
|
404
|
+. |
|
|
405
|
+ |
|
|
406
|
+ |
|
|
407
|
+ When a request arrives, we need to retrieve the previous state from the server's |
|
|
408
|
+ disk. We receive the name of that state. If the state is out of date, the state file is |
|
|
409
|
+ kept 3 days, and then deleted. |
|
|
410
|
+ |
|
|
411
|
+type Previous_Session: |
|
|
412
|
+ not_found, // cannot retrieve the previous state |
|
|
413
|
+ out_of_date(WEB_Session p_session), // the previous state is out of date |
|
|
414
|
+ still_valid(WEB_Session p_session). // the previous state is still valid |
|
|
415
|
+ |
|
|
416
|
+define Previous_Session |
|
|
417
|
+ retrieve_session |
|
|
418
|
+ ( |
|
|
419
|
+ HTTP_Info http_info, |
|
|
420
|
+ String session_directory, |
|
|
421
|
+ String website_name |
|
|
422
|
+ ) = |
|
|
423
|
+ if find_cookie("session_"+website_name, server_get_cookies(http_headers(http_info))) is |
|
|
424
|
+ { |
|
|
425
|
+ failure then not_found |
|
|
426
|
+ success(cookie) then |
|
|
427
|
+ //println("find_cookie(\"state_"+website_name+"\" success"); |
|
|
428
|
+ with session_name = value(cookie), |
|
|
429
|
+ with file_path = session_directory+"/"+session_name, |
|
|
430
|
+ //unserialize the stored session and his timeout value |
|
|
431
|
+ if (RetrieveResult((Int, WEB_Session)))retrieve(file_path) is ok(d) then |
|
|
432
|
+ ( |
|
|
433
|
+ since d is (time_stamp, s), |
|
|
434
|
+ if time_stamp < now then |
|
|
435
|
+ ( |
|
|
436
|
+ forget(remove(file_path)); |
|
|
437
|
+ out_of_date(s) |
|
|
438
|
+ ) |
|
|
439
|
+ else |
|
|
440
|
+ still_valid(s) // state has been successfully retrieved |
|
|
441
|
+ ) |
|
|
442
|
+ else |
|
|
443
|
+ not_found |
|
|
444
|
+ } |
|
|
445
|
+. |
|
|
446
|
+ |
|
|
447
|
+define (List(String) file_names) -> One |
|
|
448
|
+ make_delete_out_of_date_sessions_function |
|
|
449
|
+ ( |
|
|
450
|
+ String state_directory |
|
|
451
|
+ ) = |
|
|
452
|
+ (List(String) file_names) |-df-> |
|
|
453
|
+ if file_names is |
|
|
454
|
+ { |
|
|
455
|
+ [ ] then unique, |
|
|
456
|
+ [h . t] then |
|
|
457
|
+ with file_path = state_directory+"/"+h, |
|
|
458
|
+ if (RetrieveResult((Int, WEB_Session)))retrieve(file_path) is ok(d) |
|
|
459
|
+ then ( |
|
|
460
|
+ if d is (time_stamp,data) then |
|
|
461
|
+ if time_stamp < now |
|
|
462
|
+ then (forget(remove(file_path)); df(t)) |
|
|
463
|
+ else df(t) |
|
|
464
|
+ ) |
|
|
465
|
+ else (forget(remove(file_path)); df(t)) |
|
|
466
|
+ }. |
|
|
467
|
+ |
|
|
468
|
+define One |
|
|
469
|
+ delete_out_of_date_sessions // for all web sites |
|
|
470
|
+ ( |
|
|
471
|
+ List((String, List(String) -> One)) directories_and_functions |
|
|
472
|
+ )= |
|
|
473
|
+ if directories_and_functions is |
|
|
474
|
+ { |
|
|
475
|
+ [ ] then unique, |
|
|
476
|
+ [h . t] then |
|
|
477
|
+ since h is (state_directory, function), |
|
|
478
|
+ function(directory_list(state_directory,"*")); |
|
|
479
|
+ delete_out_of_date_sessions(t) |
|
|
480
|
+ } |
|
|
481
|
+. |
|
369
|
482
|
|
|
370
|
483
|
** (1.5) States. |
|
371
|
484
|
|
|
...
|
...
|
@@ -1236,7 +1349,7 @@ public type HTML_In_Form: |
|
1236
|
1349
|
Int content_width, Int content_height, |
|
1237
|
1350
|
HTML_In_Form content), |
|
1238
|
1351
|
actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, |
|
1239
|
|
- String action_name, List((String,String)) extra_ops, |
|
|
1352
|
+ WEB_Action_Name action_name, List((String,String)) extra_ops, |
|
1240
|
1353
|
List(Actioner_Local_Action)), |
|
1241
|
1354
|
foreign_link_new (Actioner_Target, Actioner_Aspect, String url), |
|
1242
|
1355
|
foreign_link (List(Text_Option), String url), |
|
...
|
...
|
@@ -1293,15 +1406,16 @@ public define HTML_In_Form |
|
1293
|
1406
|
foreign_link([size(tsize)],url,name). |
|
1294
|
1407
|
|
|
1295
|
1408
|
public define HTML_In_Form |
|
1296
|
|
- actioner |
|
1297
|
|
- ( |
|
|
1409
|
+ actioner |
|
|
1410
|
+ ( |
|
1298
|
1411
|
Actioner_Connection conn, |
|
1299
|
1412
|
Actioner_Target targ, |
|
1300
|
1413
|
Actioner_Aspect asp, |
|
1301
|
|
- String action_name, |
|
|
1414
|
+ WEB_Action_Name action, |
|
1302
|
1415
|
List((String,String)) extra_ops |
|
1303
|
|
- ) = |
|
1304
|
|
- actioner(conn,targ,asp,action_name,extra_ops,[]). |
|
|
1416
|
+ )= |
|
|
1417
|
+ actioner(conn,targ,asp,action,extra_ops,[]) |
|
|
1418
|
+. |
|
1305
|
1419
|
|
|
1306
|
1420
|
public define HTML_In_Form |
|
1307
|
1421
|
actioner |
|
...
|
...
|
@@ -1310,7 +1424,7 @@ public define HTML_In_Form |
|
1310
|
1424
|
Actioner_Target targ, |
|
1311
|
1425
|
Actioner_Aspect asp, |
|
1312
|
1426
|
) = |
|
1313
|
|
- actioner(conn, targ, asp, "", [], []). |
|
|
1427
|
+ actioner(conn, targ, asp, action_name(""), [], []). |
|
1314
|
1428
|
|
|
1315
|
1429
|
|
|
1316
|
1430
|
public define HTML_In_Form |
|
...
|
...
|
@@ -1454,10 +1568,10 @@ public type HTML_Off_Form: |
|
1454
|
1568
|
fixed_size (HTML_Size width, HTML_Size height, HTML_Off_Form content), |
|
1455
|
1569
|
fixed_size_2 (HTML_Size width, HTML_Size height, String name_of_HTML_file), |
|
1456
|
1570
|
actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, |
|
1457
|
|
- String action_name, List((String,String)) extra_ops, |
|
|
1571
|
+ WEB_Action_Name action_name, List((String,String)) extra_ops, |
|
1458
|
1572
|
List(Actioner_Local_Action)), |
|
1459
|
1573
|
actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, |
|
1460
|
|
- String action_name, List((String,String)) extra_ops, |
|
|
1574
|
+ WEB_Action_Name action_name, List((String,String)) extra_ops, |
|
1461
|
1575
|
List(Actioner_Local_Action), String form_name), |
|
1462
|
1576
|
foreign_link_new (Actioner_Target, Actioner_Aspect, String url), |
|
1463
|
1577
|
foreign_link (List(Text_Option), String url), |
|
...
|
...
|
@@ -1467,7 +1581,7 @@ public type HTML_Off_Form: |
|
1467
|
1581
|
label (String name), |
|
1468
|
1582
|
form (HTML_Id form_id, List(CoreAttrs), HTML_In_Form content), |
|
1469
|
1583
|
form (HTML_Id form_id, List(CoreAttrs), |
|
1470
|
|
- String action_name, List((String,String)) extra_ops, |
|
|
1584
|
+ WEB_Action_Name action, List((String,String)) extra_ops, |
|
1471
|
1585
|
HTML_In_Form content), |
|
1472
|
1586
|
in_form (HTML_Id form_id, HTML_In_Form content), |
|
1473
|
1587
|
div (List(CoreAttrs), HTML_Off_Form content), |
|
...
|
...
|
@@ -1507,11 +1621,11 @@ public define HTML_Off_Form |
|
1507
|
1621
|
( |
|
1508
|
1622
|
String form_name, |
|
1509
|
1623
|
List(CoreAttrs) options, |
|
1510
|
|
- String action_name, |
|
|
1624
|
+ WEB_Action_Name action, |
|
1511
|
1625
|
List((String,String)) extra_ops, |
|
1512
|
1626
|
HTML_In_Form content |
|
1513
|
1627
|
) = |
|
1514
|
|
- form(html_Id(form_name), options, action_name, extra_ops, content). |
|
|
1628
|
+ form(html_Id(form_name), options, action, extra_ops, content). |
|
1515
|
1629
|
|
|
1516
|
1630
|
|
|
1517
|
1631
|
public define HTML_Off_Form literal(Printable_tree t) = literal_pt(t). |
|
...
|
...
|
@@ -1535,10 +1649,10 @@ public define HTML_Off_Form |
|
1535
|
1649
|
Actioner_Connection conn, |
|
1536
|
1650
|
Actioner_Target targ, |
|
1537
|
1651
|
Actioner_Aspect asp, |
|
1538
|
|
- String action_name, |
|
|
1652
|
+ WEB_Action_Name action, |
|
1539
|
1653
|
List((String,String)) extra_ops |
|
1540
|
1654
|
) = |
|
1541
|
|
- actioner(conn,targ,asp,action_name,extra_ops,[]). |
|
|
1655
|
+ actioner(conn,targ,asp,action,extra_ops,[]). |
|
1542
|
1656
|
|
|
1543
|
1657
|
public define HTML_Off_Form |
|
1544
|
1658
|
table |
|
...
|
...
|
@@ -1772,8 +1886,8 @@ define Printable_tree |
|
1772
|
1886
|
public type HTML_Meta: |
|
1773
|
1887
|
keywords (List(String)), |
|
1774
|
1888
|
refresh (Actioner_Connection connection, |
|
1775
|
|
- Actioner_Target target, |
|
1776
|
|
- String action_name, |
|
|
1889
|
+ Actioner_Target target, |
|
|
1890
|
+ WEB_Action_Name action, |
|
1777
|
1891
|
Int delay), // in seconds |
|
1778
|
1892
|
refresh (String url, Int delay), // in seconds |
|
1779
|
1893
|
meta (String name, String content), |
|
...
|
...
|
@@ -2009,22 +2123,26 @@ public define HTTP_Answer |
|
2009
|
2123
|
*** [1] States. |
|
2010
|
2124
|
*** [1.1] Saving and retrieving states. |
|
2011
|
2125
|
*** [1.2] Deleting out of date states. |
|
|
2126
|
+ |
|
|
2127
|
+ *** [2] Sessions. |
|
|
2128
|
+ *** [2.1] Saving and retrieving sessions. |
|
|
2129
|
+ *** [2.2] Deleting out of date sessions. |
|
|
2130
|
+ |
|
|
2131
|
+ *** [3] Tools. |
|
|
2132
|
+ *** [3.1] Directories. |
|
|
2133
|
+ *** [3.2] Secondary documents. |
|
2012
|
2134
|
|
|
2013
|
|
- *** [2] Tools. |
|
2014
|
|
- *** [2.1] Directories. |
|
2015
|
|
- *** [2.2] Secondary documents. |
|
2016
|
|
- |
|
2017
|
|
- *** [3] Managing web arguments. |
|
|
2135
|
+ *** [4] Managing web arguments. |
|
2018
|
2136
|
*** [3.1] Prefixing web arguments names. |
|
2019
|
2137
|
*** [3.2] Separating web arguments. |
|
2020
|
2138
|
*** [3.3] Applying an action. |
|
2021
|
2139
|
|
|
2022
|
|
- *** [4] Web site descriptions and the 'awp handlers'. |
|
|
2140
|
+ *** [5] Web site descriptions and the 'awp handlers'. |
|
2023
|
2141
|
*** [4.1] The type 'Web_Site'. |
|
2024
|
2142
|
*** [4.2] Making a web site description. |
|
2025
|
2143
|
*** [4.3] Starting the servers. |
|
2026
|
2144
|
|
|
2027
|
|
- *** [5] HTML Formating. |
|
|
2145
|
+ *** [6] HTML Formating. |
|
2028
|
2146
|
*** [5.1] The type 'HTML_Any($T)'. |
|
2029
|
2147
|
*** [5.2] Formating a color. |
|
2030
|
2148
|
*** [5.3] Creating buttons. |
|
...
|
...
|
@@ -2043,7 +2161,7 @@ define Printable_tree |
|
2043
|
2161
|
format |
|
2044
|
2162
|
( |
|
2045
|
2163
|
CommonInfo cinfo, |
|
2046
|
|
- String sn, // state_name |
|
|
2164
|
+ //String sn, // state_name |
|
2047
|
2165
|
Var(Int) ic_v, // 'idnum' counter variable |
|
2048
|
2166
|
HTML_Off_Form element, |
|
2049
|
2167
|
Bool is_https, |
|
...
|
...
|
@@ -2086,7 +2204,8 @@ read CXM_web_arg_encode.anubis |
|
2086
|
2204
|
|
|
2087
|
2205
|
The tool below constructs the function which is able to save a state on the server's |
|
2088
|
2206
|
disk. |
|
2089
|
|
- |
|
|
2207
|
+ |
|
|
2208
|
+ |
|
2090
|
2209
|
define ($State s) -> String // the function constructed returns the name of the state |
|
2091
|
2210
|
make_save_state_function |
|
2092
|
2211
|
( |
|
...
|
...
|
@@ -2129,7 +2248,9 @@ define (String state_name) -> PreviousState($State) |
|
2129
|
2248
|
) |
|
2130
|
2249
|
else still_valid(s) // state has been successfully retrieved |
|
2131
|
2250
|
) |
|
2132
|
|
- else not_found. |
|
|
2251
|
+ else |
|
|
2252
|
+ forget(remove(file_path)); |
|
|
2253
|
+ not_found. |
|
2133
|
2254
|
|
|
2134
|
2255
|
|
|
2135
|
2256
|
|
|
...
|
...
|
@@ -2150,7 +2271,7 @@ define (List(String) file_names) -> One |
|
2150
|
2271
|
{ |
|
2151
|
2272
|
[ ] then unique, |
|
2152
|
2273
|
[h . t] then |
|
2153
|
|
- with file_path = state_directory+"/"+h, |
|
|
2274
|
+ with file_path = state_directory+"/s"+h, |
|
2154
|
2275
|
if (RetrieveResult((Int,$State)))retrieve(file_path) is ok(d) |
|
2155
|
2276
|
then ( |
|
2156
|
2277
|
if d is (time_stamp,data) then |
|
...
|
...
|
@@ -2159,7 +2280,7 @@ define (List(String) file_names) -> One |
|
2159
|
2280
|
else df(t) |
|
2160
|
2281
|
) |
|
2161
|
2282
|
else (forget(remove(file_path)); df(t)) |
|
2162
|
|
- }. |
|
|
2283
|
+ }. |
|
2163
|
2284
|
|
|
2164
|
2285
|
|
|
2165
|
2286
|
The 'labelled arrow' |-df-> is documented in 'documentation/en/anubis_doc.txt'. |
|
...
|
...
|
@@ -2223,7 +2344,7 @@ define One |
|
2223
|
2344
|
else if now > next_time |
|
2224
|
2345
|
then |
|
2225
|
2346
|
( |
|
2226
|
|
- delete_out_of_date_states(directories_and_functions); |
|
|
2347
|
+ delete_out_of_date_states(directories_and_functions); |
|
2227
|
2348
|
delete_states_loop(directories_and_functions, |
|
2228
|
2349
|
timeout, |
|
2229
|
2350
|
now+timeout, |
|
...
|
...
|
@@ -2276,7 +2397,6 @@ define String |
|
2276
|
2397
|
( |
|
2277
|
2398
|
String sd, // site directory |
|
2278
|
2399
|
String as, // authorization_secret |
|
2279
|
|
- String sn, // state name |
|
2280
|
2400
|
$T -> Printable_tree format_element, |
|
2281
|
2401
|
$T content, |
|
2282
|
2402
|
HTML_Size width |
|
...
|
...
|
@@ -2428,8 +2548,6 @@ define (List(Web_arg) lwa, HTTP_Info info) -> Separated_Web_Args($State) |
|
2428
|
2548
|
|
|
2429
|
2549
|
|
|
2430
|
2550
|
|
|
2431
|
|
- |
|
2432
|
|
- |
|
2433
|
2551
|
|
|
2434
|
2552
|
*** [3.3] Applying an action. |
|
2435
|
2553
|
|
|
...
|
...
|
@@ -2546,7 +2664,7 @@ public define Printable_tree |
|
2546
|
2664
|
format |
|
2547
|
2665
|
( |
|
2548
|
2666
|
CommonInfo cinfo, |
|
2549
|
|
- String state_name, |
|
|
2667
|
+ //String state_name, |
|
2550
|
2668
|
List(HTTP_header) headers, |
|
2551
|
2669
|
HTTP_Answer page, |
|
2552
|
2670
|
Bool is_https, |
|
...
|
...
|
@@ -2681,7 +2799,7 @@ public define Web_Site |
|
2681
|
2799
|
}, |
|
2682
|
2800
|
|
|
2683
|
2801
|
format(info(host_name, http_port, https_port, site_directory, secret), |
|
2684
|
|
- state_name, |
|
|
2802
|
+ //state_name, |
|
2685
|
2803
|
additional_headers(new_state) + cookie_headers, |
|
2686
|
2804
|
compute_page(new_state), |
|
2687
|
2805
|
is_https, |
|
...
|
...
|
@@ -2726,17 +2844,17 @@ public define Web_Site |
|
2726
|
2844
|
) -> HTTP_Answer view //view renderer |
|
2727
|
2845
|
) |
|
2728
|
2846
|
|
|
2729
|
|
-define ($State, HTTP_Answer) |
|
2730
|
|
- controller_404 |
|
2731
|
|
- (HTTP_Info http_info, |
|
2732
|
|
- List(Web_arg) lwa, |
|
2733
|
|
- Bool is_https, |
|
2734
|
|
- $State session |
|
2735
|
|
- ) = |
|
2736
|
|
- (session, |
|
|
2847
|
+ |
|
|
2848
|
+ |
|
|
2849
|
+define HTTP_Answer |
|
|
2850
|
+ error_page |
|
|
2851
|
+ ( |
|
|
2852
|
+ HTTP_Status http_status |
|
|
2853
|
+ ) |
|
|
2854
|
+ = |
|
2737
|
2855
|
html_page |
|
2738
|
2856
|
( |
|
2739
|
|
- "page not found", // title of web site |
|
|
2857
|
+ http_status, // status |
|
2740
|
2858
|
[], // list of 'META' tags (empty for this site) |
|
2741
|
2859
|
body // body of page |
|
2742
|
2860
|
( |
|
...
|
...
|
@@ -2746,56 +2864,141 @@ define ($State, HTTP_Answer) |
|
2746
|
2864
|
], |
|
2747
|
2865
|
|
|
2748
|
2866
|
// content of page |
|
2749
|
|
- center(text([size(14)],"Error 404, Page not found")) |
|
|
2867
|
+ sequence([ |
|
|
2868
|
+ text([size(16)], "Anubis Web Server 1.14"), |
|
|
2869
|
+ br, |
|
|
2870
|
+ text([size(16)],"Error "+to_String(http_status)) |
|
|
2871
|
+ ]) |
|
2750
|
2872
|
) |
|
2751
|
|
- )) |
|
|
2873
|
+ ) |
|
2752
|
2874
|
. |
|
2753
|
2875
|
|
|
2754
|
|
-define (HTTP_Info http_info, |
|
2755
|
|
- List(Web_arg) lwa, |
|
2756
|
|
- Bool is_https, |
|
2757
|
|
- $State session |
|
2758
|
|
- ) -> ($State, HTTP_Answer) |
|
|
2876
|
+define WEB_Controller_Result |
|
|
2877
|
+ apply_action |
|
|
2878
|
+ ( |
|
|
2879
|
+ WEB_Session _session, |
|
|
2880
|
+ String requested_action_name, |
|
|
2881
|
+ List(WEB_Action) actions_list |
|
|
2882
|
+ ) = |
|
|
2883
|
+ if actions_list is |
|
|
2884
|
+ { |
|
|
2885
|
+ [] then http_answer(error_page(http_not_found)), |
|
|
2886
|
+ [h . t] then |
|
|
2887
|
+ with action_name = if h.name is |
|
|
2888
|
+ { |
|
|
2889
|
+ controller_action(_, name) then name, |
|
|
2890
|
+ action_name(name) then name |
|
|
2891
|
+ }, |
|
|
2892
|
+ if requested_action_name = action_name then |
|
|
2893
|
+ if h.allowed_proto is |
|
|
2894
|
+ { |
|
|
2895
|
+ //Action only in HTTP |
|
|
2896
|
+ http then |
|
|
2897
|
+ if _session.web_request.is_https then |
|
|
2898
|
+ http_answer(error_page(http_forbidden)) |
|
|
2899
|
+ else |
|
|
2900
|
+ //ask to the server the authorization to execute that action |
|
|
2901
|
+ if h.allow(_session) then |
|
|
2902
|
+ h.do_it(_session) |
|
|
2903
|
+ else |
|
|
2904
|
+ http_answer(error_page(http_unauthorized)) |
|
|
2905
|
+ |
|
|
2906
|
+ //Action only in HTTPS |
|
|
2907
|
+ https then |
|
|
2908
|
+ if _session.web_request.is_https then |
|
|
2909
|
+ //ask to the server the authorization to execute that action |
|
|
2910
|
+ if h.allow(_session) then |
|
|
2911
|
+ h.do_it(_session) |
|
|
2912
|
+ else |
|
|
2913
|
+ http_answer(error_page(http_unauthorized)) |
|
|
2914
|
+ else |
|
|
2915
|
+ http_answer(error_page(http_forbidden)) |
|
|
2916
|
+ //Action in both HTTP / HTTPS |
|
|
2917
|
+ http_https then |
|
|
2918
|
+ //ask to the server the authorization to execute that action |
|
|
2919
|
+ if h.allow(_session) then |
|
|
2920
|
+ h.do_it(_session) |
|
|
2921
|
+ else |
|
|
2922
|
+ http_answer(error_page(http_unauthorized)) |
|
|
2923
|
+ |
|
|
2924
|
+ } |
|
|
2925
|
+ else |
|
|
2926
|
+ apply_action(_session, requested_action_name, t) |
|
|
2927
|
+ } |
|
|
2928
|
+. |
|
|
2929
|
+ |
|
|
2930
|
+define Maybe(WEB_Controller) |
|
2759
|
2931
|
get_controller |
|
2760
|
2932
|
( |
|
2761
|
2933
|
String controller_name, |
|
2762
|
|
- List(WEB_Controller($State)) controllers |
|
|
2934
|
+ List(WEB_Controller) controllers, |
|
2763
|
2935
|
)= |
|
2764
|
2936
|
if controllers is |
|
2765
|
2937
|
{ |
|
2766
|
|
- [] then controller_404, |
|
|
2938
|
+ [] then failure, |
|
2767
|
2939
|
[h . t] then |
|
2768
|
2940
|
if h.name = controller_name then |
|
2769
|
|
- h.view |
|
|
2941
|
+ success(h) |
|
2770
|
2942
|
else |
|
2771
|
2943
|
get_controller(controller_name, t) |
|
2772
|
2944
|
} |
|
2773
|
2945
|
. |
|
2774
|
2946
|
|
|
|
2947
|
+define (Maybe(WEB_Session), HTTP_Answer) |
|
|
2948
|
+ apply_controller_action |
|
|
2949
|
+ ( |
|
|
2950
|
+ WEB_Controller controller, |
|
|
2951
|
+ List(WEB_Controller) controllers, |
|
|
2952
|
+ WEB_Session _session |
|
|
2953
|
+ )= |
|
|
2954
|
+ //get the action name |
|
|
2955
|
+ if get_String(_session.web_request.lwa, "aws_action") is |
|
|
2956
|
+ { |
|
|
2957
|
+ failure then (failure, error_page(http_not_found)), |
|
|
2958
|
+ success(action_name) then |
|
|
2959
|
+ |
|
|
2960
|
+ if apply_action(_session, action_name, *controller.controller_actions) is |
|
|
2961
|
+ { |
|
|
2962
|
+ http_answer(session, answer) then (success(session), answer), |
|
|
2963
|
+ http_answer(answer) then (success(_session), answer), |
|
|
2964
|
+ redirect(new_session) then |
|
|
2965
|
+ if get_controller(get_String(new_session.web_request.lwa, "aws_controller", "root"), controllers) is |
|
|
2966
|
+ { |
|
|
2967
|
+ failure then (failure, error_page(http_not_found)), |
|
|
2968
|
+ success(new_controller) then apply_controller_action(new_controller, controllers, new_session), |
|
|
2969
|
+ } |
|
|
2970
|
+ |
|
|
2971
|
+ redirect_to_previous then |
|
|
2972
|
+ if get_controller(get_String(_session.previous_request.lwa, "aws_controller", "root"), controllers) is |
|
|
2973
|
+ { |
|
|
2974
|
+ failure then (failure, error_page(http_not_found)), |
|
|
2975
|
+ success(new_controller) then |
|
|
2976
|
+ since _session is web_session(lang, entries, _, previous), |
|
|
2977
|
+ apply_controller_action(new_controller, controllers, web_session(lang, entries, previous, previous)), |
|
|
2978
|
+ } |
|
|
2979
|
+ |
|
|
2980
|
+ ajax(answer) then (failure, answer), |
|
|
2981
|
+ } |
|
|
2982
|
+ } |
|
|
2983
|
+. |
|
|
2984
|
+ |
|
2775
|
2985
|
public define Web_Site |
|
2776
|
|
- make_web_site_controller_description |
|
2777
|
|
- ( |
|
2778
|
|
- String website_name, // site_UID |
|
2779
|
|
- List(String) common_names, // for example: ["www.our-business.com"] |
|
2780
|
|
- String site_directory, |
|
2781
|
|
- String state_directory, |
|
2782
|
|
- One -> One init, |
|
|
2986
|
+ make_web_site_controller_description |
|
|
2987
|
+ ( |
|
|
2988
|
+ String website_name, // site_UID |
|
|
2989
|
+ List(String) common_names, // for example: ["www.our-business.com"] |
|
|
2990
|
+ String site_directory, |
|
|
2991
|
+ String state_directory, |
|
|
2992
|
+ One -> One init, |
|
2783
|
2993
|
(HTTP_Info, |
|
2784
|
2994
|
List(Web_arg), |
|
2785
|
|
- Bool is_https) -> $State initial_state, |
|
2786
|
|
- ($State expired, |
|
2787
|
|
- Maybe(String), |
|
2788
|
|
- HTTP_Info, |
|
2789
|
|
- List(Web_arg), |
|
2790
|
|
- Bool is_https) -> $State ticket_expired_state, |
|
2791
|
|
- (Maybe(String), |
|
|
2995
|
+ Bool is_https) -> WEB_Session initial_session, |
|
|
2996
|
+ (WEB_Session, |
|
2792
|
2997
|
HTTP_Info, |
|
2793
|
2998
|
List(Web_arg), |
|
2794
|
|
- Bool is_https) -> $State ticket_lost_state, |
|
2795
|
|
- //List(Web_Action($State)) actions, |
|
2796
|
|
- Var(List(WEB_Controller($State))) web_controllers, |
|
2797
|
|
- //$State -> HTTP_Answer compute_page, |
|
2798
|
|
- $State -> List(HTTP_header) additional_headers, |
|
|
2999
|
+ Bool is_https) -> WEB_Session expired_session, |
|
|
3000
|
+ Var(List(WEB_Controller)) web_controllers, |
|
|
3001
|
+ Maybe(WEB_Session) -> List(HTTP_header) additional_headers, |
|
2799
|
3002
|
Int timeout, |
|
2800
|
3003
|
Redirections redirections, |
|
2801
|
3004
|
String charset, |
|
...
|
...
|
@@ -2805,9 +3008,9 @@ public define Web_Site |
|
2805
|
3008
|
List(MIME) known_mime_types, |
|
2806
|
3009
|
(String action_name, |
|
2807
|
3010
|
List(Web_arg) args) -> One before_send_file |
|
2808
|
|
- //Bool using_state_cookies |
|
2809
|
|
- ) = |
|
2810
|
|
- init(unique); |
|
|
3011
|
+ )= |
|
|
3012
|
+ //call the initialization function |
|
|
3013
|
+ init(unique); |
|
2811
|
3014
|
|
|
2812
|
3015
|
|
|
2813
|
3016
|
// |
|
...
|
...
|
@@ -2820,72 +3023,74 @@ public define Web_Site |
|
2820
|
3023
|
// |
|
2821
|
3024
|
// construct tool functions |
|
2822
|
3025
|
// TODO 'make_separate_web_args_function' must retrieve state_cookies before parsing web_args if using_state_cookies is true |
|
2823
|
|
- with save_state = make_save_state_function(timeout, state_directory), |
|
2824
|
|
- retrieve_state = make_retrieve_state_function(state_directory), |
|
2825
|
|
- separate_web_args = make_separate_web_args_function(state_directory, retrieve_state, website_name), |
|
|
3026
|
+ with save_session = make_save_session_function(timeout, state_directory), |
|
|
3027
|
+ // retrieve_session = make_retrieve_session_function(state_directory, website_name), |
|
|
3028
|
+ //separate_web_args = make_separate_web_args_function(state_directory, retrieve_state), |
|
2826
|
3029
|
//apply_action = make_apply_action_function(actions), |
|
|
3030
|
+ |
|
2827
|
3031
|
// |
|
2828
|
3032
|
// construct the site handler |
|
2829
|
3033
|
// |
|
2830
|
|
- site_handler = (Word32 http_port, Word32 https_port) |-> |
|
|
3034
|
+ site_handler = (Word32 http_port, Word32 https_port) |-> |
|
2831
|
3035
|
((String host_name, |
|
2832
|
3036
|
HTTP_Info http_info, |
|
2833
|
|
- List(Web_arg) lwa, |
|
|
3037
|
+ List(Web_arg) _lwa, |
|
2834
|
3038
|
Bool is_https) |-> |
|
2835
|
3039
|
//(Printable_tree) |
|
|
3040
|
+ println("host_name "+host_name); |
|
2836
|
3041
|
println(dump_http_info(http_info)); |
|
2837
|
|
- println(dump_web_arg_values(lwa)); |
|
|
3042
|
+ println(dump_web_arg_values(_lwa)); |
|
2838
|
3043
|
|
|
2839
|
|
- since separate_web_args(lwa, http_info) is swa(mb_previous_state, mb_action_name, operands), |
|
2840
|
|
- |
|
2841
|
|
- with new_state = if mb_previous_state is |
|
2842
|
|
- { |
|
2843
|
|
- not_found then |
|
2844
|
|
- //println("previous state not found"); |
|
2845
|
|
- if mb_action_name is |
|
2846
|
|
- { |
|
2847
|
|
- failure then initial_state(http_info, operands, is_https), |
|
2848
|
|
- success(_) then |
|
2849
|
|
- ticket_lost_state(mb_action_name, http_info,operands,is_https) |
|
2850
|
|
- }, |
|
2851
|
3044
|
|
|
2852
|
|
- out_of_date(state) then |
|
2853
|
|
- //println("previous out_of_date"); |
|
2854
|
|
- ticket_expired_state(state, mb_action_name, http_info,operands,is_https), |
|
|
3045
|
+ //retrieve the previous session and determine the new one |
|
|
3046
|
+ with current_session = if retrieve_session(http_info, state_directory, website_name) is |
|
|
3047
|
+ { |
|
|
3048
|
+ not_found then |
|
|
3049
|
+ //println("previous state not found"); |
|
|
3050
|
+ initial_session(http_info, _lwa, is_https), |
|
2855
|
3051
|
|
|
2856
|
|
- still_valid(state) then state |
|
|
3052
|
+ out_of_date(previous_session) then |
|
|
3053
|
+ //println("previous out_of_date"); |
|
|
3054
|
+ expired_session(previous_session, http_info, _lwa, is_https), |
|
2857
|
3055
|
|
|
2858
|
|
- }, |
|
2859
|
|
- //if state_and_headers is (session_ticket, mb_new_state, headers) then |
|
2860
|
|
- with state_name = save_state(new_state), |
|
2861
|
|
- //println("Cookie new STATE NAME "+state_name); |
|
2862
|
|
- with cookie_headers = if mb_action_name is |
|
2863
|
|
- { |
|
2864
|
|
- failure then |
|
2865
|
|
- make_state_cookie_headers(website_name, state_name), |
|
2866
|
|
- success(action_name) then |
|
2867
|
|
- if action_name = "none" then |
|
2868
|
|
- [] |
|
2869
|
|
- else if substr(action_name, 0, 5)="ajax_" then |
|
2870
|
|
- [] |
|
2871
|
|
- else |
|
2872
|
|
- make_state_cookie_headers(website_name, state_name) |
|
2873
|
|
- }, |
|
2874
|
|
- with controller = get_controller("root", *web_controllers), |
|
2875
|
|
- since controller(http_info, lwa, is_https, new_state) is (result_state, http_answer), |
|
2876
|
|
- format(info(host_name, http_port, https_port, site_directory, secret), |
|
2877
|
|
- state_name, |
|
2878
|
|
- additional_headers(new_state) + cookie_headers, |
|
2879
|
|
- http_answer, |
|
2880
|
|
- is_https, |
|
2881
|
|
- charset) |
|
2882
|
|
- ), |
|
|
3056
|
+ still_valid(previous_session) then |
|
|
3057
|
+ since previous_session is web_session(lang, entries, previous, _), |
|
|
3058
|
+ web_session(lang, entries, web_request(http_info, _lwa, is_https), previous) |
|
|
3059
|
+ }, |
|
|
3060
|
+ |
|
|
3061
|
+ |
|
|
3062
|
+ //apply the action according to current session |
|
|
3063
|
+ //since apply_controller_action(get_controller(get_String(lwa, "aws_controller", "root"), *web_controllers), *web_controllers, current_session) |
|
|
3064
|
+ since if get_controller(get_String(current_session.web_request.lwa, "aws_controller", "root"), *web_controllers) is |
|
|
3065
|
+ { |
|
|
3066
|
+ failure then (failure, error_page(http_not_found)), |
|
|
3067
|
+ success(new_controller) then apply_controller_action(new_controller, *web_controllers, current_session), |
|
|
3068
|
+ } |
|
|
3069
|
+ is (mb_new_session, http_answer), |
|
|
3070
|
+ |
|
|
3071
|
+ //save the session if need and construct the according cookie |
|
|
3072
|
+ with cookie_headers = |
|
|
3073
|
+ if mb_new_session is |
|
|
3074
|
+ { |
|
|
3075
|
+ failure then [], |
|
|
3076
|
+ success(new_session) then |
|
|
3077
|
+ with session_name = save_session(new_session), |
|
|
3078
|
+ make_session_cookie_headers(website_name, session_name) |
|
|
3079
|
+ }, |
|
|
3080
|
+ |
|
|
3081
|
+ //formatting and send http answer because this is the last function |
|
|
3082
|
+ format(info(host_name, http_port, https_port, site_directory, secret), |
|
|
3083
|
+ //state_name, |
|
|
3084
|
+ additional_headers(mb_new_session) + cookie_headers, |
|
|
3085
|
+ http_answer, |
|
|
3086
|
+ is_https, |
|
|
3087
|
+ charset) |
|
|
3088
|
+ ), |
|
2883
|
3089
|
// |
|
2884
|
3090
|
// make the delete_out_of_date function |
|
2885
|
3091
|
// |
|
2886
|
3092
|
delete_out_of_date = |
|
2887
|
|
- make_delete_out_of_date_states_function((Maybe($State))failure, |
|
2888
|
|
- site_directory+"/states"), |
|
|
3093
|
+ make_delete_out_of_date_sessions_function(site_directory+"/states"), |
|
2889
|
3094
|
// |
|
2890
|
3095
|
// construct the web site description |
|
2891
|
3096
|
// |
|
...
|
...
|
@@ -2899,13 +3104,14 @@ public define Web_Site |
|
2899
|
3104
|
secret, |
|
2900
|
3105
|
known_mime_types, |
|
2901
|
3106
|
site_handler(http_port,https_port), |
|
2902
|
|
- (HTTP_Info http_info, List(Web_arg) lwa) |-> if separate_web_args(lwa, http_info ) is |
|
2903
|
|
- swa(mb_previous_state,mb_action_name,operands) then |
|
2904
|
|
- if mb_action_name is |
|
2905
|
|
- { |
|
2906
|
|
- failure then unique |
|
2907
|
|
- success(an) then before_send_file(an,operands) |
|
2908
|
|
- } |
|
|
3107
|
+ (HTTP_Info http_info, List(Web_arg) lwa) |-> unique |
|
|
3108
|
+// if separate_web_args(lwa, http_info ) is |
|
|
3109
|
+// swa(mb_previous_state,mb_action_name,operands) then |
|
|
3110
|
+// if mb_action_name is |
|
|
3111
|
+// { |
|
|
3112
|
+// failure then unique |
|
|
3113
|
+// success(an) then before_send_file(an,operands) |
|
|
3114
|
+// } |
|
2909
|
3115
|
//using_state_cookies |
|
2910
|
3116
|
), |
|
2911
|
3117
|
delete_out_of_date). |
|
...
|
...
|
@@ -3102,7 +3308,7 @@ type HTML_Any($T): |
|
3102
|
3308
|
any_actioner (Actioner_Connection, |
|
3103
|
3309
|
Actioner_Target, |
|
3104
|
3310
|
Actioner_Aspect, |
|
3105
|
|
- String action_name, |
|
|
3311
|
+ WEB_Action_Name action, |
|
3106
|
3312
|
List((String,String)) extra_ops, |
|
3107
|
3313
|
List(Actioner_Local_Action), |
|
3108
|
3314
|
Maybe(String) form_name), |
|
...
|
...
|
@@ -3298,25 +3504,39 @@ define Int |
|
3298
|
3504
|
window. |
|
3299
|
3505
|
|
|
3300
|
3506
|
define String |
|
3301
|
|
- make_actioner_url |
|
3302
|
|
- ( |
|
3303
|
|
- CommonInfo cinfo, |
|
3304
|
|
- Actioner_Connection connection, |
|
3305
|
|
- Actioner_Target target, |
|
3306
|
|
- String state_name, |
|
3307
|
|
- String action_name, |
|
3308
|
|
- List((String,String)) extra_ops, |
|
3309
|
|
- Bool is_https |
|
3310
|
|
- ) = |
|
|
3507
|
+ make_actioner_url |
|
|
3508
|
+ ( |
|
|
3509
|
+ CommonInfo cinfo, |
|
|
3510
|
+ Actioner_Connection connection, |
|
|
3511
|
+ Actioner_Target target, |
|
|
3512
|
+ WEB_Action_Name action, |
|
|
3513
|
+ List((String,String)) extra_ops, |
|
|
3514
|
+ Bool is_https |
|
|
3515
|
+ ) = |
|
3311
|
3516
|
if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
|
3312
|
3517
|
with strict_url = |
|
3313
|
3518
|
if connection is |
|
3314
|
3519
|
{ |
|
3315
|
3520
|
same then "/", |
|
3316
|
|
- http then "http://"+common_name+":"+http_port+"/", |
|
3317
|
|
- https then "https://"+common_name+":"+https_port+"/", |
|
|
3521
|
+ http then |
|
|
3522
|
+ if http_port = 80 then |
|
|
3523
|
+ "http://"+common_name+"/" |
|
|
3524
|
+ else |
|
|
3525
|
+ "http://"+common_name+":"+http_port+"/", |
|
|
3526
|
+ https then |
|
|
3527
|
+ if https_port = 443 then |
|
|
3528
|
+ "https://"+common_name+"/" |
|
|
3529
|
+ else |
|
|
3530
|
+ "https://"+common_name+":"+https_port+"/", |
|
3318
|
3531
|
} + |
|
3319
|
|
- "?a=" + action_name + |
|
|
3532
|
+ //with action_string = |
|
|
3533
|
+ if action is |
|
|
3534
|
+ { |
|
|
3535
|
+ controller_action(controller, action_name) then "?aws_controller="+controller+"&aws_action="+action_name, |
|
|
3536
|
+ action_name(action_name) then "?aws_action="+action_name |
|
|
3537
|
+ } |
|
|
3538
|
+ //"?a=" + action_name + |
|
|
3539
|
+ + |
|
3320
|
3540
|
format_extra_operands(extra_ops), |
|
3321
|
3541
|
if target is |
|
3322
|
3542
|
{ |
|
...
|
...
|
@@ -3738,7 +3958,7 @@ define Printable_tree |
|
3738
|
3958
|
String url, |
|
3739
|
3959
|
Bool is_https, |
|
3740
|
3960
|
CommonInfo cinfo, |
|
3741
|
|
- String state_name, |
|
|
3961
|
+// String state_name, |
|
3742
|
3962
|
Var(Int) action_count, |
|
3743
|
3963
|
Var(Int) ic_v, // 'idnum' counter variable |
|
3744
|
3964
|
Var(List(HTML_Head_Tag)) head_tags |
|
...
|
...
|
@@ -3781,7 +4001,7 @@ define Printable_tree |
|
3781
|
4001
|
html(html_off_form) then |
|
3782
|
4002
|
[ |
|
3783
|
4003
|
"<a href=\"", full_url, "\">", |
|
3784
|
|
- format(cinfo, state_name, ic_v, html_off_form, is_https, action_count, head_tags), |
|
|
4004
|
+ format(cinfo, ic_v, html_off_form, is_https, action_count, head_tags), |
|
3785
|
4005
|
"</a>" |
|
3786
|
4006
|
] |
|
3787
|
4007
|
}. |
|
...
|
...
|
@@ -3790,11 +4010,10 @@ define Printable_tree |
|
3790
|
4010
|
format_actioner |
|
3791
|
4011
|
( |
|
3792
|
4012
|
CommonInfo cinfo, |
|
3793
|
|
- String state_name, |
|
3794
|
4013
|
Actioner_Connection connection, |
|
3795
|
4014
|
Actioner_Target target, |
|
3796
|
4015
|
Actioner_Aspect aspect, |
|
3797
|
|
- String action_name, |
|
|
4016
|
+ WEB_Action_Name action, |
|
3798
|
4017
|
List((String,String)) extra_ops, |
|
3799
|
4018
|
List(Actioner_Local_Action) local_actions, |
|
3800
|
4019
|
Maybe(String) mb_form_name, |
|
...
|
...
|
@@ -3807,8 +4026,8 @@ define Printable_tree |
|
3807
|
4026
|
|
|
3808
|
4027
|
if cinfo is info(common_name,http_port,https_port,site_dir,secret) then |
|
3809
|
4028
|
with url = make_actioner_url(cinfo,connection,target, |
|
3810
|
|
- state_name,action_name,extra_ops,is_https), |
|
3811
|
|
- with action = format_action(url, aspect, extract_id(aspect), mb_form_name, action_count), |
|
|
4029
|
+ action,extra_ops,is_https), |
|
|
4030
|
+ with formatted_action = format_action(url, aspect, extract_id(aspect), mb_form_name, action_count), |
|
3812
|
4031
|
if aspect is |
|
3813
|
4032
|
{ |
|
3814
|
4033
|
|
|
...
|
...
|
@@ -3821,6 +4040,10 @@ define Printable_tree |
|
3821
|
4040
|
], |
|
3822
|
4041
|
img_link(options, img, alt_text) then |
|
3823
|
4042
|
//if action name is empty, format options on image because maybe there onclick action |
|
|
4043
|
+ with action_name = if action is { |
|
|
4044
|
+ controller_action(_, an) then an, |
|
|
4045
|
+ action_name(an) then an |
|
|
4046
|
+ }, |
|
3824
|
4047
|
if action_name ="" then |
|
3825
|
4048
|
[ |
|
3826
|
4049
|
"<img src=\"", img,"\"", |
|
...
|
...
|
@@ -3833,12 +4056,18 @@ define Printable_tree |
|
3833
|
4056
|
], |
|
3834
|
4057
|
push_button(options, text) then |
|
3835
|
4058
|
[ |
|
3836
|
|
- if action is |
|
|
4059
|
+ if formatted_action is |
|
3837
|
4060
|
{ |
|
3838
|
4061
|
url(u) then ["<a href=\"",u,"\"", format_attrs(options), ">", |
|
3839
|
4062
|
text, "</a>" |
|
3840
|
4063
|
], |
|
3841
|
4064
|
javascript(s,h) then |
|
|
4065
|
+ with action_name = |
|
|
4066
|
+ if action is |
|
|
4067
|
+ { |
|
|
4068
|
+ controller_action(_, an) then an, |
|
|
4069
|
+ action_name(an) then an |
|
|
4070
|
+ }, |
|
3842
|
4071
|
if action_name = "" then |
|
3843
|
4072
|
["<input type=\"button\" value=\"",text,"\"", format_attrs(options), " />"] |
|
3844
|
4073
|
else |
|
...
|
...
|
@@ -3846,7 +4075,7 @@ define Printable_tree |
|
3846
|
4075
|
} |
|
3847
|
4076
|
], |
|
3848
|
4077
|
button(url_off,url_on) then |
|
3849
|
|
- [ if action is |
|
|
4078
|
+ [ if formatted_action is |
|
3850
|
4079
|
{ |
|
3851
|
4080
|
url(u) then ["<a href=\"",u], |
|
3852
|
4081
|
javascript(s,h) then [s,"<a onMouseDown=\"",h] |
|
...
|
...
|
@@ -3859,7 +4088,7 @@ define Printable_tree |
|
3859
|
4088
|
], |
|
3860
|
4089
|
|
|
3861
|
4090
|
button(url_off,url_on,w,h) then |
|
3862
|
|
- [ if action is |
|
|
4091
|
+ [ if formatted_action is |
|
3863
|
4092
|
{ |
|
3864
|
4093
|
url(u) then ["<a href=\"",u], |
|
3865
|
4094
|
javascript(s,h2) then [s,"<a onMouseDown=\"",h2] |
|
...
|
...
|
@@ -3873,12 +4102,16 @@ define Printable_tree |
|
3873
|
4102
|
|
|
3874
|
4103
|
submit(options, text) then |
|
3875
|
4104
|
[ |
|
3876
|
|
- if action is |
|
|
4105
|
+ if formatted_action is |
|
3877
|
4106
|
{ |
|
3878
|
4107
|
url(u) then ["<a href=\"",u,"\"", format_attrs(options), ">", |
|
3879
|
4108
|
text, "</a>" |
|
3880
|
4109
|
], |
|
3881
|
4110
|
javascript(s,h) then |
|
|
4111
|
+ with action_name = if action is { |
|
|
4112
|
+ controller_action(_, an) then an, |
|
|
4113
|
+ action_name(an) then an |
|
|
4114
|
+ }, |
|
3882
|
4115
|
if action_name = "" then // special case where URL (so the action_name) is provided by the form itself |
|
3883
|
4116
|
// so javascript isn't needed. This is the standard HMTL way. |
|
3884
|
4117
|
["<input type=\"submit\" value=\"",text,"\"", format_attrs(options), " />"] |
|
...
|
...
|
@@ -3900,7 +4133,7 @@ define Printable_tree |
|
3900
|
4133
|
[ |
|
3901
|
4134
|
//if custom function name is provided, that name is used instead of autogenerated js function |
|
3902
|
4135
|
if custom_function_name = "" then |
|
3903
|
|
- if action is |
|
|
4136
|
+ if formatted_action is |
|
3904
|
4137
|
{ |
|
3905
|
4138
|
url(u) then ["<select href=\"",u] |
|
3906
|
4139
|
javascript(s,h) then [s,"<select onchange=\"",h] |
|
...
|
...
|
@@ -3914,7 +4147,7 @@ define Printable_tree |
|
3914
|
4147
|
html(html_off_form) then |
|
3915
|
4148
|
[ |
|
3916
|
4149
|
"<a href=\"", url, "\">", |
|
3917
|
|
- format(cinfo, state_name, ic_v, html_off_form, is_https, action_count, head_tags), |
|
|
4150
|
+ format(cinfo, ic_v, html_off_form, is_https, action_count, head_tags), |
|
3918
|
4151
|
"</a>" |
|
3919
|
4152
|
] |
|
3920
|
4153
|
}. |
|
...
|
...
|
@@ -3933,19 +4166,17 @@ define Printable_tree |
|
3933
|
4166
|
|
|
3934
|
4167
|
|
|
3935
|
4168
|
define Printable_tree |
|
3936
|
|
- format_private_download |
|
3937
|
|
- ( |
|
3938
|
|
- CommonInfo cinfo, |
|
3939
|
|
- String sn, // state name |
|
3940
|
|
- String abs_path, // absolute file path on server |
|
3941
|
|
- String name, // name of file as it appears in the browser |
|
3942
|
|
- String extra, // extra extension |
|
3943
|
|
- Maybe((String,List((String,String)))) action |
|
3944
|
|
- |
|
3945
|
|
- ) = |
|
3946
|
|
- if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
|
3947
|
|
- with private_download_directory = site_directory+"/private_download", |
|
3948
|
|
- with auth = make_authorization(site_directory,secret,abs_path), |
|
|
4169
|
+ format_private_download |
|
|
4170
|
+ ( |
|
|
4171
|
+ CommonInfo cinfo, |
|
|
4172
|
+ String abs_path, // absolute file path on server |
|
|
4173
|
+ String name, // name of file as it appears in the browser |
|
|
4174
|
+ String extra, // extra extension |
|
|
4175
|
+ Maybe((String,List((String,String)))) action |
|
|
4176
|
+ ) = |
|
|
4177
|
+ if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
|
|
4178
|
+ with private_download_directory = site_directory+"/private_download", |
|
|
4179
|
+ with auth = make_authorization(site_directory,secret,abs_path), |
|
3949
|
4180
|
[ |
|
3950
|
4181
|
"<a href=\"",name,extra,"?zauth=",auth, |
|
3951
|
4182
|
if action is |
|
...
|
...
|
@@ -3959,9 +4190,6 @@ define Printable_tree |
|
3959
|
4190
|
"</a>" |
|
3960
|
4191
|
]. |
|
3961
|
4192
|
|
|
3962
|
|
- |
|
3963
|
|
- |
|
3964
|
|
- |
|
3965
|
4193
|
*** [5.6] Formating rows and cells in a table. |
|
3966
|
4194
|
|
|
3967
|
4195
|
define Int |
|
...
|
...
|
@@ -4237,7 +4465,6 @@ define String |
|
4237
|
4465
|
define Printable_tree |
|
4238
|
4466
|
format_scroller |
|
4239
|
4467
|
( |
|
4240
|
|
- String sn, |
|
4241
|
4468
|
Int width, |
|
4242
|
4469
|
Int height, |
|
4243
|
4470
|
Int content_width, |
|
...
|
...
|
@@ -4411,7 +4638,6 @@ define Printable_tree |
|
4411
|
4638
|
format |
|
4412
|
4639
|
( |
|
4413
|
4640
|
CommonInfo cinfo, |
|
4414
|
|
- String sn, // state_name |
|
4415
|
4641
|
Var(Int) ic_v, |
|
4416
|
4642
|
HTML_Any($T) element, |
|
4417
|
4643
|
$T -> Printable_tree format_element, // able to format a datum of type $T |
|
...
|
...
|
@@ -4449,9 +4675,9 @@ define Printable_tree |
|
4449
|
4675
|
any_mail_to(email,elem) then |
|
4450
|
4676
|
["<a href=\"mailto:",email,"\">",format_element(elem),"</a>"], |
|
4451
|
4677
|
any_scroller(w,h,cw,ch,c) then |
|
4452
|
|
- format_scroller(sn,w,h,cw,ch,new_idnum(ic_v),c,format_element), |
|
|
4678
|
+ format_scroller(w,h,cw,ch,new_idnum(ic_v),c,format_element), |
|
4453
|
4679
|
any_fixed_size(w,h,c) then |
|
4454
|
|
- with url = create_secondary_document(site_directory,secret,sn,format_element,c,w), |
|
|
4680
|
+ with url = create_secondary_document(site_directory,secret,format_element,c,w), |
|
4455
|
4681
|
["<object data=\"",url,"\" type=\"text/html\" width=\"",format(w),"\" height=\"",format(h),"\" >", |
|
4456
|
4682
|
"secondary document", |
|
4457
|
4683
|
"</object>"], |
|
...
|
...
|
@@ -4462,17 +4688,17 @@ define Printable_tree |
|
4462
|
4688
|
"secondary document", |
|
4463
|
4689
|
"</object>"], |
|
4464
|
4690
|
any_actioner(c,t,a,an,eo,ja,fn) then |
|
4465
|
|
- format_actioner(cinfo,sn,c,t,a,an,eo,ja,fn,is_https, action_count, ic_v, head_tags), |
|
|
4691
|
+ format_actioner(cinfo,c,t,a,an,eo,ja,fn,is_https, action_count, ic_v, head_tags), |
|
4466
|
4692
|
|
|
4467
|
4693
|
any_foreign_link_new(target, aspect, url) then |
|
4468
|
|
- format_foreign_link(target, aspect, url, is_https, cinfo, sn, action_count, ic_v, head_tags), |
|
|
4694
|
+ format_foreign_link(target, aspect, url, is_https, cinfo, action_count, ic_v, head_tags), |
|
4469
|
4695
|
|
|
4470
|
4696
|
any_foreign_link(options,url) then |
|
4471
|
4697
|
["<a href=\"",url,"\" ", format_text_options(options), "></a>"], // IE7 doesn't support the form <a href="..." /> |
|
4472
|
4698
|
any_foreign_link(options,url,name) then |
|
4473
|
4699
|
["<a href=\"",url,"\"><span ", format_text_options(options), ">",name,"</span></a>"], |
|
4474
|
4700
|
any_private_download(url,name,extra_ext,action) then |
|
4475
|
|
- format_private_download(cinfo,sn,url,name,extra_ext,action), |
|
|
4701
|
+ format_private_download(cinfo,url,name,extra_ext,action), |
|
4476
|
4702
|
any_div(options, e) then |
|
4477
|
4703
|
[format_div_option(options), format_element(e),"</div>\n"], |
|
4478
|
4704
|
any_div_empty(options) then |
|
...
|
...
|
@@ -4610,7 +4836,6 @@ define Printable_tree |
|
4610
|
4836
|
( |
|
4611
|
4837
|
CommonInfo cinfo, |
|
4612
|
4838
|
String fn, // form_name |
|
4613
|
|
- String sn, // state_name |
|
4614
|
4839
|
Var(Int) ic_v, // idnum counter variable |
|
4615
|
4840
|
HTML_In_Form element, |
|
4616
|
4841
|
Bool is_https, |
|
...
|
...
|
@@ -4618,7 +4843,7 @@ define Printable_tree |
|
4618
|
4843
|
Var(List(HTML_Head_Tag)) head_tags |
|
4619
|
4844
|
) = |
|
4620
|
4845
|
if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
|
4621
|
|
- with format_element = (HTML_In_Form e) |-> format(cinfo, fn, sn, ic_v, e, is_https, action_count, head_tags), |
|
|
4846
|
+ with format_element = (HTML_In_Form e) |-> format(cinfo, fn, ic_v, e, is_https, action_count, head_tags), |
|
4622
|
4847
|
if element is |
|
4623
|
4848
|
{ |
|
4624
|
4849
|
empty then [], |
|
...
|
...
|
@@ -4626,35 +4851,35 @@ define Printable_tree |
|
4626
|
4851
|
literal(t) then [t], |
|
4627
|
4852
|
sequence(l) then flat(map(format_element,l)) |
|
4628
|
4853
|
text(opts,t) then |
|
4629
|
|
- format(cinfo,sn,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags), |
|
|
4854
|
+ format(cinfo,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags), |
|
4630
|
4855
|
preformated(o,s) then |
|
4631
|
|
- format(cinfo,sn,ic_v,any_preformated(o,s),format_element,is_https, action_count, head_tags), |
|
|
4856
|
+ format(cinfo,ic_v,any_preformated(o,s),format_element,is_https, action_count, head_tags), |
|
4632
|
4857
|
paragraph(opts,t) then |
|
4633
|
|
- format(cinfo,sn,ic_v,any_paragraph(opts,t),format_element,is_https, action_count, head_tags), |
|
|
4858
|
+ format(cinfo,ic_v,any_paragraph(opts,t),format_element,is_https, action_count, head_tags), |
|
4634
|
4859
|
image(opts, url, alt) then |
|
4635
|
|
- format(cinfo,sn,ic_v,any_image(opts, url, alt),format_element,is_https, action_count, head_tags), |
|
|
4860
|
+ format(cinfo,ic_v,any_image(opts, url, alt),format_element,is_https, action_count, head_tags), |
|
4636
|
4861
|
image(opts, url, alt, w, h) then |
|
4637
|
|
- format(cinfo,sn,ic_v,any_image(opts, url, alt, w, h),format_element,is_https, action_count, head_tags), |
|
|
4862
|
+ format(cinfo,ic_v,any_image(opts, url, alt, w, h),format_element,is_https, action_count, head_tags), |
|
4638
|
4863
|
table(opts,header_row,rows,footer_row) then |
|
4639
|
|
- format(cinfo,sn,ic_v,any_table(opts, header_row, rows, footer_row),format_element,is_https, action_count, head_tags), |
|
|
4864
|
+ format(cinfo,ic_v,any_table(opts, header_row, rows, footer_row),format_element,is_https, action_count, head_tags), |
|
4640
|
4865
|
center(e) then |
|
4641
|
|
- format(cinfo,sn,ic_v,any_center(e),format_element,is_https, action_count, head_tags), |
|
|
4866
|
+ format(cinfo,ic_v,any_center(e),format_element,is_https, action_count, head_tags), |
|
4642
|
4867
|
mail_to(a,e) then |
|
4643
|
|
- format(cinfo,sn,ic_v,any_mail_to(a,e),format_element,is_https, action_count, head_tags), |
|
|
4868
|
+ format(cinfo,ic_v,any_mail_to(a,e),format_element,is_https, action_count, head_tags), |
|
4644
|
4869
|
scroller(w,h,cw,ch,c) then |
|
4645
|
|
- format(cinfo,sn,ic_v,any_scroller(w,h,cw,ch,c),format_element,is_https, action_count, head_tags), |
|
|
4870
|
+ format(cinfo,ic_v,any_scroller(w,h,cw,ch,c),format_element,is_https, action_count, head_tags), |
|
4646
|
4871
|
actioner(c,t,a,an,eo,ja) then |
|
4647
|
|
- format(cinfo,sn,ic_v,any_actioner(c,t,a,an,eo,ja,success(fn)),format_element,is_https, action_count, head_tags), |
|
|
4872
|
+ format(cinfo,ic_v,any_actioner(c,t,a,an,eo,ja,success(fn)),format_element,is_https, action_count, head_tags), |
|
4648
|
4873
|
|
|
4649
|
4874
|
foreign_link_new(target, aspect, url) then |
|
4650
|
|
- format(cinfo,sn,ic_v,any_foreign_link_new(target,aspect,url),format_element,is_https, action_count, head_tags), |
|
|
4875
|
+ format(cinfo,ic_v,any_foreign_link_new(target,aspect,url),format_element,is_https, action_count, head_tags), |
|
4651
|
4876
|
|
|
4652
|
4877
|
foreign_link(options,url) then |
|
4653
|
|
- format(cinfo,sn,ic_v,any_foreign_link(options,url),format_element,is_https, action_count, head_tags), |
|
|
4878
|
+ format(cinfo,ic_v,any_foreign_link(options,url),format_element,is_https, action_count, head_tags), |
|
4654
|
4879
|
foreign_link(options,url,name) then |
|
4655
|
|
- format(cinfo,sn,ic_v,any_foreign_link(options,url,name),format_element,is_https, action_count, head_tags), |
|
|
4880
|
+ format(cinfo,ic_v,any_foreign_link(options,url,name),format_element,is_https, action_count, head_tags), |
|
4656
|
4881
|
private_download(url,name,extra,action) then |
|
4657
|
|
- format(cinfo,sn,ic_v,any_private_download(url,name,extra,action),format_element,is_https, action_count, head_tags), |
|
|
4882
|
+ format(cinfo,ic_v,any_private_download(url,name,extra,action),format_element,is_https, action_count, head_tags), |
|
4658
|
4883
|
text_input(options, label_text, id, name, i, w) then |
|
4659
|
4884
|
[ format_label(label_text, id), |
|
4660
|
4885
|
"<input type=\"text\" name=\"",name,"\" id=\"",id,"\" size=\"",w,"\" value=\"",i,"\"",format_attrs([class("in") . options])," />"], |
|
...
|
...
|
@@ -4695,9 +4920,9 @@ define Printable_tree |
|
4695
|
4920
|
[ "<input type=\"checkbox\" name=\"",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\" " else ""),format_attrs([class("in") . options])," />", |
|
4696
|
4921
|
format_label(label, id)] |
|
4697
|
4922
|
div(options, e) then |
|
4698
|
|
- format(cinfo,sn,ic_v,any_div(options, e),format_element,is_https, action_count, head_tags), |
|
|
4923
|
+ format(cinfo,ic_v,any_div(options, e),format_element,is_https, action_count, head_tags), |
|
4699
|
4924
|
div_empty(options) then |
|
4700
|
|
- format(cinfo,sn,ic_v,any_div_empty(options),format_element,is_https, action_count, head_tags), |
|
|
4925
|
+ format(cinfo,ic_v,any_div_empty(options),format_element,is_https, action_count, head_tags), |
|
4701
|
4926
|
hidden(_id, name, value) then |
|
4702
|
4927
|
since _id is html_Id(id), |
|
4703
|
4928
|
["<input type=\"hidden\"",(if id = "" then "" else " id=\""+id+"\"")," name=\"",name,"\" value=\"",value,"\" />"], |
|
...
|
...
|
@@ -4705,17 +4930,17 @@ define Printable_tree |
|
4705
|
4930
|
if p_content is partial_content(tags, html_elements) then |
|
4706
|
4931
|
head_tags <- *head_tags + tags; |
|
4707
|
4932
|
|
|
4708
|
|
- format(cinfo, sn, ic_v, html_elements, is_https, action_count, head_tags), |
|
|
4933
|
+ format(cinfo, ic_v, html_elements, is_https, action_count, head_tags), |
|
4709
|
4934
|
br then ["<br>"], |
|
4710
|
4935
|
progress(options, value, max) then ["<progress max=\"",value,"\" value=\"",max,"\"",format_attrs(options),"></progress>"], |
|
4711
|
4936
|
ol(opts, t) then |
|
4712
|
|
- format(cinfo,sn,ic_v,any_ol(opts,t),format_element,is_https, action_count, head_tags), |
|
|
4937
|
+ format(cinfo,ic_v,any_ol(opts,t),format_element,is_https, action_count, head_tags), |
|
4713
|
4938
|
ul(opts, t) then |
|
4714
|
|
- format(cinfo,sn,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), |
|
|
4939
|
+ format(cinfo,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), |
|
4715
|
4940
|
li(opts, t) then |
|
4716
|
|
- format(cinfo,sn,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), |
|
|
4941
|
+ format(cinfo,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), |
|
4717
|
4942
|
button(options, e) then |
|
4718
|
|
- format(cinfo,sn,ic_v,any_button(options, e),format_element,is_https, action_count, head_tags), |
|
|
4943
|
+ format(cinfo,ic_v,any_button(options, e),format_element,is_https, action_count, head_tags), |
|
4719
|
4944
|
}. |
|
4720
|
4945
|
|
|
4721
|
4946
|
|
|
...
|
...
|
@@ -4821,7 +5046,6 @@ define Printable_tree |
|
4821
|
5046
|
format |
|
4822
|
5047
|
( |
|
4823
|
5048
|
CommonInfo cinfo, |
|
4824
|
|
- String sn, // state_name |
|
4825
|
5049
|
Var(Int) ic_v, // 'idnum' counter variable |
|
4826
|
5050
|
HTML_Off_Form element, |
|
4827
|
5051
|
Bool is_https, |
|
...
|
...
|
@@ -4829,7 +5053,7 @@ define Printable_tree |
|
4829
|
5053
|
Var(List(HTML_Head_Tag)) head_tags |
|
4830
|
5054
|
) = |
|
4831
|
5055
|
if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
|
4832
|
|
- with format_element = (HTML_Off_Form e) |-> format(cinfo, sn, ic_v, e, is_https, action_count, head_tags), |
|
|
5056
|
+ with format_element = (HTML_Off_Form e) |-> format(cinfo, ic_v, e, is_https, action_count, head_tags), |
|
4833
|
5057
|
if element is |
|
4834
|
5058
|
{ |
|
4835
|
5059
|
empty then [], |
|
...
|
...
|
@@ -4837,44 +5061,44 @@ define Printable_tree |
|
4837
|
5061
|
literal(t) then [t], |
|
4838
|
5062
|
sequence(l) then flat(map(format_element,l)), |
|
4839
|
5063
|
text(opts,t) then |
|
4840
|
|
- format(cinfo,sn,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags), |
|
|
5064
|
+ format(cinfo,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags), |
|
4841
|
5065
|
preformated(o,s) then |
|
4842
|
|
- format(cinfo,sn,ic_v,any_preformated(o,s),format_element,is_https, action_count, head_tags), |
|
|
5066
|
+ format(cinfo,ic_v,any_preformated(o,s),format_element,is_https, action_count, head_tags), |
|
4843
|
5067
|
paragraph(opts,t) then |
|
4844
|
|
- format(cinfo,sn,ic_v,any_paragraph(opts,t),format_element,is_https, action_count, head_tags), |
|
|
5068
|
+ format(cinfo,ic_v,any_paragraph(opts,t),format_element,is_https, action_count, head_tags), |
|
4845
|
5069
|
image(opts,url,alt) then |
|
4846
|
|
- format(cinfo,sn,ic_v,any_image(opts,url,alt),format_element,is_https, action_count, head_tags), |
|
|
5070
|
+ format(cinfo,ic_v,any_image(opts,url,alt),format_element,is_https, action_count, head_tags), |
|
4847
|
5071
|
image(opts,url,alt,w,h) then |
|
4848
|
|
- format(cinfo,sn,ic_v,any_image(opts,url,alt,w,h),format_element,is_https, action_count, head_tags), |
|
|
5072
|
+ format(cinfo,ic_v,any_image(opts,url,alt,w,h),format_element,is_https, action_count, head_tags), |
|
4849
|
5073
|
table(opts,header_row, rows, footer_row) then |
|
4850
|
|
- format(cinfo,sn,ic_v,any_table(opts,header_row, rows, footer_row),format_element,is_https, action_count, head_tags), |
|
|
5074
|
+ format(cinfo,ic_v,any_table(opts,header_row, rows, footer_row),format_element,is_https, action_count, head_tags), |
|
4851
|
5075
|
center(e) then |
|
4852
|
|
- format(cinfo,sn,ic_v,any_center(e),format_element,is_https, action_count, head_tags), |
|
|
5076
|
+ format(cinfo,ic_v,any_center(e),format_element,is_https, action_count, head_tags), |
|
4853
|
5077
|
mail_to(a,e) then |
|
4854
|
|
- format(cinfo,sn,ic_v,any_mail_to(a,e),format_element,is_https, action_count, head_tags), |
|
|
5078
|
+ format(cinfo,ic_v,any_mail_to(a,e),format_element,is_https, action_count, head_tags), |
|
4855
|
5079
|
scroller(w,h,cw,ch,c) then |
|
4856
|
|
- format(cinfo,sn,ic_v,any_scroller(w,h,cw,ch,c),format_element,is_https, action_count, head_tags), |
|
|
5080
|
+ format(cinfo,ic_v,any_scroller(w,h,cw,ch,c),format_element,is_https, action_count, head_tags), |
|
4857
|
5081
|
fixed_size(w,h,c) then |
|
4858
|
|
- format(cinfo,sn,ic_v,any_fixed_size(w,h,c),format_element,is_https, action_count, head_tags), |
|
|
5082
|
+ format(cinfo,ic_v,any_fixed_size(w,h,c),format_element,is_https, action_count, head_tags), |
|
4859
|
5083
|
fixed_size_2(w,h,fn) then |
|
4860
|
|
- format(cinfo,sn,ic_v,any_fixed_size_2(w,h,fn),format_element,is_https, action_count, head_tags), |
|
|
5084
|
+ format(cinfo,ic_v,any_fixed_size_2(w,h,fn),format_element,is_https, action_count, head_tags), |
|
4861
|
5085
|
actioner(c,t,a,an,eo,ja) then |
|
4862
|
|
- format(cinfo,sn,ic_v,any_actioner(c,t,a,an,eo,ja,failure),format_element,is_https, action_count, head_tags), |
|
|
5086
|
+ format(cinfo,ic_v,any_actioner(c,t,a,an,eo,ja,failure),format_element,is_https, action_count, head_tags), |
|
4863
|
5087
|
actioner(c,t,a,an,eo,ja,fn) then |
|
4864
|
|
- format(cinfo,sn,ic_v,any_actioner(c,t,a,an,eo,ja,success(fn)),format_element,is_https, action_count, head_tags), |
|
|
5088
|
+ format(cinfo,ic_v,any_actioner(c,t,a,an,eo,ja,success(fn)),format_element,is_https, action_count, head_tags), |
|
4865
|
5089
|
foreign_link_new(target, aspect, url) then |
|
4866
|
|
- format(cinfo,sn,ic_v,any_foreign_link_new(target,aspect,url),format_element,is_https, action_count, head_tags), |
|
|
5090
|
+ format(cinfo,ic_v,any_foreign_link_new(target,aspect,url),format_element,is_https, action_count, head_tags), |
|
4867
|
5091
|
foreign_link(options,url) then |
|
4868
|
|
- format(cinfo,sn,ic_v,any_foreign_link(options,url),format_element,is_https, action_count, head_tags), |
|
|
5092
|
+ format(cinfo,ic_v,any_foreign_link(options,url),format_element,is_https, action_count, head_tags), |
|
4869
|
5093
|
foreign_link(options,url,name) then |
|
4870
|
|
- format(cinfo,sn,ic_v,any_foreign_link(options,url,name),format_element,is_https, action_count, head_tags), |
|
|
5094
|
+ format(cinfo,ic_v,any_foreign_link(options,url,name),format_element,is_https, action_count, head_tags), |
|
4871
|
5095
|
private_download(url,name,extra,action) then |
|
4872
|
|
- format(cinfo,sn,ic_v,any_private_download(url,name,extra,action),format_element,is_https, action_count, head_tags), |
|
|
5096
|
+ format(cinfo,ic_v,any_private_download(url,name,extra,action),format_element,is_https, action_count, head_tags), |
|
4873
|
5097
|
label(n) then ["<a name=\"",n,"\">"], |
|
4874
|
5098
|
form(fn,attributs, c) then |
|
4875
|
5099
|
[ |
|
4876
|
5100
|
"<form id=\"",fn,"\"", |
|
4877
|
|
- format(cinfo,sn,ic_v,any_coreattrs(attributs),format_element,is_https, action_count, head_tags), |
|
|
5101
|
+ format(cinfo,ic_v,any_coreattrs(attributs),format_element,is_https, action_count, head_tags), |
|
4878
|
5102
|
" method=\"post\"", |
|
4879
|
5103
|
enctype(c), |
|
4880
|
5104
|
" action=\"http", |
|
...
|
...
|
@@ -4883,15 +5107,15 @@ define Printable_tree |
|
4883
|
5107
|
// action is set dynamically by |
|
4884
|
5108
|
// the actioner using JavaScript |
|
4885
|
5109
|
if fn is html_Id(id) then |
|
4886
|
|
- format(cinfo,id,sn,ic_v,c,is_https, action_count, head_tags), |
|
|
5110
|
+ format(cinfo,id,ic_v,c,is_https, action_count, head_tags), |
|
4887
|
5111
|
"</form>" |
|
4888
|
5112
|
] |
|
4889
|
|
- form(fn,attributs, action_name, extra_ops, c) then |
|
|
5113
|
+ form(fn,attributs, action, extra_ops, c) then |
|
4890
|
5114
|
with url = make_actioner_url(cinfo, same, same, |
|
4891
|
|
- sn, action_name, extra_ops, is_https), |
|
|
5115
|
+ action, extra_ops, is_https), |
|
4892
|
5116
|
[ |
|
4893
|
5117
|
"<form id=\"",fn,"\"", |
|
4894
|
|
- format(cinfo,sn,ic_v,any_coreattrs(attributs),format_element,is_https, action_count, head_tags), |
|
|
5118
|
+ format(cinfo,ic_v,any_coreattrs(attributs),format_element,is_https, action_count, head_tags), |
|
4895
|
5119
|
" method=\"post\"", |
|
4896
|
5120
|
enctype(c), |
|
4897
|
5121
|
" action=\"" + url + "\">", |
|
...
|
...
|
@@ -4901,20 +5125,20 @@ define Printable_tree |
|
4901
|
5125
|
// action is set dynamically by |
|
4902
|
5126
|
// the actioner using JavaScript |
|
4903
|
5127
|
if fn is html_Id(id) then |
|
4904
|
|
- format(cinfo,id,sn,ic_v,c,is_https, action_count, head_tags), |
|
|
5128
|
+ format(cinfo,id,ic_v,c,is_https, action_count, head_tags), |
|
4905
|
5129
|
"</form>" |
|
4906
|
5130
|
], |
|
4907
|
5131
|
in_form(fn, content) then |
|
4908
|
5132
|
if fn is html_Id(id) then |
|
4909
|
|
- format(cinfo,id,sn,ic_v, content,is_https, action_count, head_tags), |
|
|
5133
|
+ format(cinfo,id,ic_v, content,is_https, action_count, head_tags), |
|
4910
|
5134
|
div(options, e) then |
|
4911
|
|
- format(cinfo, sn, ic_v, any_div(options, e), format_element, is_https, action_count, head_tags), |
|
|
5135
|
+ format(cinfo, ic_v, any_div(options, e), format_element, is_https, action_count, head_tags), |
|
4912
|
5136
|
div(options, p_content) then |
|
4913
|
5137
|
if p_content is partial_content(tags, html_elements) then |
|
4914
|
5138
|
head_tags <- *head_tags +tags; |
|
4915
|
|
- format(cinfo, sn, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags), |
|
|
5139
|
+ format(cinfo, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags), |
|
4916
|
5140
|
div_empty(options) then |
|
4917
|
|
- format(cinfo, sn, ic_v, any_div_empty(options), format_element, is_https, action_count, head_tags), |
|
|
5141
|
+ format(cinfo, ic_v, any_div_empty(options), format_element, is_https, action_count, head_tags), |
|
4918
|
5142
|
iframe(options, css_styles, css_files, js_files, body) then |
|
4919
|
5143
|
if body is body(body_options,elem) then |
|
4920
|
5144
|
[ "<iframe", format_attrs(options), ">\n", |
|
...
|
...
|
@@ -4925,7 +5149,7 @@ define Printable_tree |
|
4925
|
5149
|
add_js_files(js_files), |
|
4926
|
5150
|
"</head>\n", |
|
4927
|
5151
|
"<body ", format(body_options), ">\n", // format body options |
|
4928
|
|
- format(cinfo,sn,ic_v,elem,is_https, action_count, head_tags), |
|
|
5152
|
+ format(cinfo,ic_v,elem,is_https, action_count, head_tags), |
|
4929
|
5153
|
"</body>\n", |
|
4930
|
5154
|
"</html>\n", |
|
4931
|
5155
|
"</iframe>\n", |
|
...
|
...
|
@@ -4933,17 +5157,17 @@ define Printable_tree |
|
4933
|
5157
|
partial(p_content) then |
|
4934
|
5158
|
if p_content is partial_content(tags, html_elements) then |
|
4935
|
5159
|
head_tags <- *head_tags + tags; |
|
4936
|
|
- format(cinfo, sn, ic_v, html_elements, is_https, action_count, head_tags), |
|
|
5160
|
+ format(cinfo, ic_v, html_elements, is_https, action_count, head_tags), |
|
4937
|
5161
|
br then ["<br>"], |
|
4938
|
5162
|
progress(options, value, max) then ["<progress max=\"",value,"\" value=\"",max,"\"",format_attrs(options),"></progress>"], |
|
4939
|
5163
|
ol(opts, t) then |
|
4940
|
|
- format(cinfo,sn,ic_v,any_ol(opts,t),format_element,is_https, action_count, head_tags), |
|
|
5164
|
+ format(cinfo,ic_v,any_ol(opts,t),format_element,is_https, action_count, head_tags), |
|
4941
|
5165
|
ul(opts, t) then |
|
4942
|
|
- format(cinfo,sn,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), |
|
|
5166
|
+ format(cinfo,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), |
|
4943
|
5167
|
li(opts, t) then |
|
4944
|
|
- format(cinfo,sn,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), |
|
|
5168
|
+ format(cinfo,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), |
|
4945
|
5169
|
button(options, e) then |
|
4946
|
|
- format(cinfo, sn, ic_v, any_button(options, e), format_element, is_https, action_count, head_tags), |
|
|
5170
|
+ format(cinfo, ic_v, any_button(options, e), format_element, is_https, action_count, head_tags), |
|
4947
|
5171
|
}. |
|
4948
|
5172
|
|
|
4949
|
5173
|
|
|
...
|
...
|
@@ -4966,29 +5190,29 @@ define Printable_tree |
|
4966
|
5190
|
|
|
4967
|
5191
|
|
|
4968
|
5192
|
define Printable_tree |
|
4969
|
|
- format |
|
4970
|
|
- ( |
|
4971
|
|
- CommonInfo cinfo, |
|
4972
|
|
- String state_name, |
|
4973
|
|
- HTML_Meta m, |
|
4974
|
|
- Bool is_https |
|
4975
|
|
- ) = |
|
4976
|
|
- if m is |
|
4977
|
|
- { |
|
4978
|
|
- keywords(l) then ["<meta name=\"keywords\" content=\"",format_keywords(l),"\" />\n"], |
|
4979
|
|
- refresh(co,ta,an,delay) then |
|
|
5193
|
+ format |
|
|
5194
|
+ ( |
|
|
5195
|
+ CommonInfo cinfo, |
|
|
5196
|
+ HTML_Meta m, |
|
|
5197
|
+ Bool is_https |
|
|
5198
|
+ ) = |
|
|
5199
|
+ if m is |
|
|
5200
|
+ { |
|
|
5201
|
+ keywords(l) then ["<meta name=\"keywords\" content=\"",format_keywords(l),"\" />\n"], |
|
|
5202
|
+ refresh(co,ta,an,delay) then |
|
4980
|
5203
|
["<meta http-equiv=\"Refresh\" content=\"",delay,"; URL=", |
|
4981
|
|
- make_actioner_url(cinfo,co,ta,state_name,an,[],is_https),"\" />\n"], |
|
4982
|
|
- refresh(url,delay) then |
|
|
5204
|
+ make_actioner_url(cinfo,co,ta,an,[],is_https),"\" />\n"], |
|
|
5205
|
+ refresh(url,delay) then |
|
4983
|
5206
|
["<meta http-equiv=\"Refresh\" content=\"",delay,"; URL=",url,"\" />\n"], |
|
4984
|
|
- meta(n,c) then ["<meta name=\"",n,"\" content=\"",c,"\" />\n"], |
|
4985
|
|
- http_equiv(n,c) then ["<meta http-equiv=\"",n,"\" content=\"",c,"\" />\n"], |
|
4986
|
|
- generic_meta(l) then ["<meta ", |
|
|
5207
|
+ meta(n,c) then ["<meta name=\"",n,"\" content=\"",c,"\" />\n"], |
|
|
5208
|
+ http_equiv(n,c) then ["<meta http-equiv=\"",n,"\" content=\"",c,"\" />\n"], |
|
|
5209
|
+ generic_meta(l) then ["<meta ", |
|
4987
|
5210
|
flat(map(((String,String) p) |-> if p is (n,v) then [n,"=\"",v,"\" "], |
|
4988
|
5211
|
l)), |
|
4989
|
5212
|
" />\n"], |
|
4990
|
|
- literal(s) then [s] |
|
4991
|
|
- }. |
|
|
5213
|
+ literal(s) then [s] |
|
|
5214
|
+ } |
|
|
5215
|
+. |
|
4992
|
5216
|
|
|
4993
|
5217
|
define Printable_tree // c'est le nôtre et c'est meilleur |
|
4994
|
5218
|
format |
|
...
|
...
|
@@ -5015,18 +5239,17 @@ define Printable_tree // c'est le nôtre et c'est meilleur |
|
5015
|
5239
|
define Printable_tree |
|
5016
|
5240
|
format |
|
5017
|
5241
|
( |
|
5018
|
|
- CommonInfo cinfo, |
|
5019
|
|
- String state_name, |
|
|
5242
|
+ CommonInfo cinfo, |
|
5020
|
5243
|
List(HTML_Meta) metas, |
|
5021
|
5244
|
Bool is_https, |
|
5022
|
5245
|
String charset |
|
5023
|
5246
|
) = |
|
5024
|
5247
|
if metas is |
|
5025
|
5248
|
{ |
|
5026
|
|
- [] then [format(cinfo,state_name,http_equiv("content-type", |
|
|
5249
|
+ [] then [format(cinfo,http_equiv("content-type", |
|
5027
|
5250
|
"text/html; charset="+charset),is_https)], |
|
5028
|
|
- [h . t] then [format(cinfo,state_name,h,is_https) |
|
5029
|
|
- . format(cinfo,state_name,t,is_https,charset)] |
|
|
5251
|
+ [h . t] then [format(cinfo,h,is_https) |
|
|
5252
|
+ . format(cinfo,t,is_https,charset)] |
|
5030
|
5253
|
}. |
|
5031
|
5254
|
|
|
5032
|
5255
|
define List(HTML_Head_Tag) |
|
...
|
...
|
@@ -5135,33 +5358,26 @@ public define HTML_ajax_content |
|
5135
|
5358
|
to_html_ajax_content |
|
5136
|
5359
|
( |
|
5137
|
5360
|
HTML_Off_Form content_HTML, |
|
5138
|
|
- CommonInfo cinfo, |
|
5139
|
|
- String state_name |
|
|
5361
|
+ CommonInfo cinfo |
|
5140
|
5362
|
)= |
|
5141
|
5363
|
with p_content_head_tags = var((List(HTML_Head_Tag))[]), |
|
5142
|
|
- with content = format(cinfo, state_name, var((Int)0), content_HTML, false, var(0), p_content_head_tags), |
|
|
5364
|
+ with content = format(cinfo, var((Int)0), content_HTML, false, var(0), p_content_head_tags), |
|
5143
|
5365
|
if sort_head_tag(*p_content_head_tags, "", [], []) is html_ajax_content(_, script, js_file, css_file) then |
|
5144
|
5366
|
html_ajax_content(to_String(content), script, js_file, css_file). |
|
5145
|
5367
|
|
|
5146
|
|
-public define HTML_ajax_content |
|
5147
|
|
- to_html_ajax_content |
|
5148
|
|
- ( |
|
5149
|
|
- HTML_Off_Form content_HTML, |
|
5150
|
|
- CommonInfo cinfo |
|
5151
|
|
- )= to_html_ajax_content(content_HTML, cinfo, ""). |
|
5152
|
5368
|
|
|
5153
|
5369
|
public define HTML_ajax_content |
|
5154
|
5370
|
to_html_ajax_content |
|
5155
|
5371
|
( |
|
5156
|
5372
|
HTML_Partial_Content content_HTML, |
|
5157
|
5373
|
CommonInfo cinfo |
|
5158
|
|
- )= to_html_ajax_content(partial(content_HTML), cinfo, ""). |
|
|
5374
|
+ )= to_html_ajax_content(partial(content_HTML), cinfo). |
|
5159
|
5375
|
|
|
5160
|
5376
|
public define Printable_tree |
|
5161
|
5377
|
format |
|
5162
|
5378
|
( |
|
5163
|
5379
|
CommonInfo cinfo, |
|
5164
|
|
- String state_name, |
|
|
5380
|
+ //String state_name, |
|
5165
|
5381
|
List(HTTP_header) additional_headers, |
|
5166
|
5382
|
HTTP_Answer page, |
|
5167
|
5383
|
Bool is_https, |
|
...
|
...
|
@@ -5178,7 +5394,7 @@ public define Printable_tree |
|
5178
|
5394
|
with |
|
5179
|
5395
|
answer_body_body = (Printable_tree) |
|
5180
|
5396
|
[ "<body ", format(options), ">", // format body options |
|
5181
|
|
- format(cinfo,state_name,ic_v,element,is_https, var(0), p_content_head_tags), |
|
|
5397
|
+ format(cinfo,ic_v,element,is_https, var(0), p_content_head_tags), |
|
5182
|
5398
|
"</body>\n", |
|
5183
|
5399
|
|
|
5184
|
5400
|
"</html>"], |
|
...
|
...
|
@@ -5201,7 +5417,14 @@ public define Printable_tree |
|
5201
|
5417
|
html_page(status, title, metas, css_styles, css_files, js_files, script, body) then |
|
5202
|
5418
|
if body is body(options,element) then |
|
5203
|
5419
|
if format(status) is (status_string, status_headers) then |
|
5204
|
|
- with answer_body = |
|
|
5420
|
+ with |
|
|
5421
|
+ answer_body_body = (Printable_tree) |
|
|
5422
|
+ [ "<body ", format(options), ">", // format body options |
|
|
5423
|
+ format(cinfo,ic_v,element,is_https, var(0), p_content_head_tags), |
|
|
5424
|
+ "</body>\n", |
|
|
5425
|
+ "</html>" |
|
|
5426
|
+ ], |
|
|
5427
|
+ answer_body_header = |
|
5205
|
5428
|
[ doctype_w3c_header, |
|
5206
|
5429
|
//html_header, |
|
5207
|
5430
|
"<head>\n", |
|
...
|
...
|
@@ -5222,22 +5445,19 @@ public define Printable_tree |
|
5222
|
5445
|
" { s[0]=0; d.style.visibility = 'hidden'; }; }", |
|
5223
|
5446
|
"</script>\n", |
|
5224
|
5447
|
"<title>",title,"</title>\n", // put title |
|
5225
|
|
- format(cinfo,state_name,metas,is_https,charset), // format the metas |
|
5226
|
|
- "</head>\n", |
|
5227
|
|
- "<body ", format(options), ">", // format body options |
|
5228
|
|
- //"<center>", |
|
5229
|
|
- format(cinfo,state_name,ic_v,element,is_https, var(0), p_content_head_tags), |
|
5230
|
|
- //"</center>", |
|
5231
|
|
- "</body>\n", |
|
5232
|
|
- "</html>" |
|
5233
|
|
- ], |
|
|
5448
|
+ format(cinfo,metas,is_https,charset), // format the metas |
|
|
5449
|
+ format_html_head(*p_content_head_tags, charset), |
|
|
5450
|
+ "</head>\n" |
|
|
5451
|
+ ], |
|
|
5452
|
+ |
|
5234
|
5453
|
[ "HTTP/1.1 " + status_string, crlf, |
|
5235
|
5454
|
format_headers(standard_headers), |
|
5236
|
|
- format_headers(standard_headers_for("text/html", length(answer_body), success(charset))), |
|
|
5455
|
+ format_headers(standard_headers_for("text/html", length(answer_body_header) + length(answer_body_body), success(charset))), |
|
5237
|
5456
|
format_headers(status_headers), |
|
5238
|
5457
|
format_headers(additional_headers), |
|
5239
|
|
- crlf |
|
5240
|
|
- . answer_body |
|
|
5458
|
+ crlf, |
|
|
5459
|
+ answer_body_header . |
|
|
5460
|
+ answer_body_body |
|
5241
|
5461
|
], |
|
5242
|
5462
|
|
|
5243
|
5463
|
plain_text (HTTP_Status status, String text) then |
|
...
|
...
|
@@ -5300,7 +5520,7 @@ public define Printable_tree |
|
5300
|
5520
|
|
|
5301
|
5521
|
html_content(HTTP_Status status, HTML_Off_Form content_HTML) then |
|
5302
|
5522
|
if format(status) is (status_string, status_headers) then |
|
5303
|
|
- with content = format(cinfo, state_name, ic_v, content_HTML, is_https, var(0), p_content_head_tags), |
|
|
5523
|
+ with content = format(cinfo, ic_v, content_HTML, is_https, var(0), p_content_head_tags), |
|
5304
|
5524
|
[ "HTTP/1.1 " + status_string, crlf, |
|
5305
|
5525
|
format_headers(standard_headers), |
|
5306
|
5526
|
format_headers(standard_headers_for("text/html", length(content), success(charset))), |
|
...
|
...
|
@@ -5317,7 +5537,7 @@ public define Printable_tree |
|
5317
|
5537
|
with |
|
5318
|
5538
|
answer_body = (Printable_tree) |
|
5319
|
5539
|
[ |
|
5320
|
|
- format(cinfo, state_name, ic_v, html_content, is_https, var(0), p_content_head_tags), |
|
|
5540
|
+ format(cinfo, ic_v, html_content, is_https, var(0), p_content_head_tags), |
|
5321
|
5541
|
], |
|
5322
|
5542
|
answer_header = (Printable_tree) |
|
5323
|
5543
|
[ |
...
|
...
|
|