|
...
|
...
|
@@ -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,11 +55,14 @@ 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
|
+transmit CXM_web_dump.anubis |
|
|
64
|
+transmit CXM_web_arg_utils.anubis |
|
|
65
|
+ |
|
63
|
66
|
//read CXM_html_tooltip.anubis |
|
64
|
67
|
|
|
65
|
68
|
* (1) Structure of a web site. |
|
...
|
...
|
@@ -274,64 +277,6 @@ public type Web_Action($State): |
|
274
|
277
|
In most cases, HTTP informations are not used. This is the reason why they are gathered |
|
275
|
278
|
for simplicity into a unique datum of type 'HTTP_Info'. |
|
276
|
279
|
|
|
277
|
|
-// For your convenience, we introduce the following simpler variants: |
|
278
|
|
-// |
|
279
|
|
-//public define Web_Action($State) |
|
280
|
|
-// http_action |
|
281
|
|
-// ( |
|
282
|
|
-// String name, |
|
283
|
|
-// $State -> Bool allow, |
|
284
|
|
-// (List(Web_arg),$State) -> $State do_it |
|
285
|
|
-// ) = |
|
286
|
|
-// http_action(name, |
|
287
|
|
-// (Maybe($State) ms) |-> if ms is |
|
288
|
|
-// { |
|
289
|
|
-// failure then true, |
|
290
|
|
-// success(s) then allow(s) |
|
291
|
|
-// }, |
|
292
|
|
-// (HTTP_Info h, List(Web_arg) l, Maybe($State) s) |-> if s is |
|
293
|
|
-// { |
|
294
|
|
-// failure then (failure, []), |
|
295
|
|
-// success(s2) then (success(do_it(l,s2)), []) |
|
296
|
|
-// }). |
|
297
|
|
-// |
|
298
|
|
-//public define Web_Action($State) |
|
299
|
|
-// https_action |
|
300
|
|
-// ( |
|
301
|
|
-// String name, |
|
302
|
|
-// $State -> Bool allow, |
|
303
|
|
-// (List(Web_arg),$State) -> $State do_it |
|
304
|
|
-// ) = |
|
305
|
|
-// https_action(name, |
|
306
|
|
-// (Maybe($State) ms) |-> if ms is |
|
307
|
|
-// { |
|
308
|
|
-// failure then true, |
|
309
|
|
-// success(s) then allow(s) |
|
310
|
|
-// }, |
|
311
|
|
-// (HTTP_Info h, List(Web_arg) l, Maybe($State) s) |-> if s is |
|
312
|
|
-// { |
|
313
|
|
-// failure then (failure, []), |
|
314
|
|
-// success(s2) then (success(do_it(l,s2)), []) |
|
315
|
|
-// }). |
|
316
|
|
-// |
|
317
|
|
-//public define Web_Action($State) |
|
318
|
|
-// http_https_action |
|
319
|
|
-// ( |
|
320
|
|
-// String name, |
|
321
|
|
-// $State -> Bool allow, |
|
322
|
|
-// (List(Web_arg),$State) -> $State do_it |
|
323
|
|
-// ) = |
|
324
|
|
-// http_https_action(name, |
|
325
|
|
-// (Maybe($State) ms) |-> if ms is |
|
326
|
|
-// { |
|
327
|
|
-// failure then true, |
|
328
|
|
-// success(s) then allow(s) |
|
329
|
|
-// }, |
|
330
|
|
-// (HTTP_Info h, List(Web_arg) l, Maybe($State) s) |-> if s is |
|
331
|
|
-// { |
|
332
|
|
-// failure then (failure, []), |
|
333
|
|
-// success(s2) then (success(do_it(l,s2)), []) |
|
334
|
|
-// }). |
|
335
|
280
|
|
|
336
|
281
|
|
|
337
|
282
|
|
|
...
|
...
|
@@ -351,10 +296,189 @@ public type HTTP_Answer:... |
|
351
|
296
|
understand the page shown to the client as a representation of the current state of the |
|
352
|
297
|
conversation between the client and the web site, but also containing informations |
|
353
|
298
|
taken from the data bases. |
|
|
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: |
|
|
366
|
+ web_controller( |
|
|
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 |
|
|
370
|
+ ) |
|
|
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
|
+. |
|
354
|
405
|
|
|
355
|
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 |
|
356
|
415
|
|
|
357
|
|
- |
|
|
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
|
+. |
|
358
|
482
|
|
|
359
|
483
|
** (1.5) States. |
|
360
|
484
|
|
|
...
|
...
|
@@ -1225,7 +1349,7 @@ public type HTML_In_Form: |
|
1225
|
1349
|
Int content_width, Int content_height, |
|
1226
|
1350
|
HTML_In_Form content), |
|
1227
|
1351
|
actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, |
|
1228
|
|
- String action_name, List((String,String)) extra_ops, |
|
|
1352
|
+ WEB_Action_Name action_name, List((String,String)) extra_ops, |
|
1229
|
1353
|
List(Actioner_Local_Action)), |
|
1230
|
1354
|
foreign_link_new (Actioner_Target, Actioner_Aspect, String url), |
|
1231
|
1355
|
foreign_link (List(Text_Option), String url), |
|
...
|
...
|
@@ -1282,15 +1406,32 @@ public define HTML_In_Form |
|
1282
|
1406
|
foreign_link([size(tsize)],url,name). |
|
1283
|
1407
|
|
|
1284
|
1408
|
public define HTML_In_Form |
|
1285
|
|
- actioner |
|
1286
|
|
- ( |
|
|
1409
|
+ actioner |
|
|
1410
|
+ ( |
|
1287
|
1411
|
Actioner_Connection conn, |
|
1288
|
1412
|
Actioner_Target targ, |
|
1289
|
1413
|
Actioner_Aspect asp, |
|
1290
|
|
- String action_name, |
|
|
1414
|
+ WEB_Action_Name action, |
|
1291
|
1415
|
List((String,String)) extra_ops |
|
1292
|
|
- ) = |
|
1293
|
|
- actioner(conn,targ,asp,action_name,extra_ops,[]). |
|
|
1416
|
+ )= |
|
|
1417
|
+ actioner(conn,targ,asp,action,extra_ops,[]) |
|
|
1418
|
+. |
|
|
1419
|
+ |
|
|
1420
|
+public define HTML_In_Form |
|
|
1421
|
+/* Older call with String as action instead of WEB_Action_Name. |
|
|
1422
|
+ * This function exists only for compatibility with older project. |
|
|
1423
|
+ * Please condiser to use above function instead |
|
|
1424
|
+ */ |
|
|
1425
|
+ actioner |
|
|
1426
|
+ ( |
|
|
1427
|
+ Actioner_Connection conn, |
|
|
1428
|
+ Actioner_Target targ, |
|
|
1429
|
+ Actioner_Aspect asp, |
|
|
1430
|
+ String action, |
|
|
1431
|
+ List((String,String)) extra_ops |
|
|
1432
|
+ )= |
|
|
1433
|
+ actioner(conn,targ,asp,action_name(action),extra_ops,[]) |
|
|
1434
|
+. |
|
1294
|
1435
|
|
|
1295
|
1436
|
public define HTML_In_Form |
|
1296
|
1437
|
actioner |
|
...
|
...
|
@@ -1299,7 +1440,7 @@ public define HTML_In_Form |
|
1299
|
1440
|
Actioner_Target targ, |
|
1300
|
1441
|
Actioner_Aspect asp, |
|
1301
|
1442
|
) = |
|
1302
|
|
- actioner(conn, targ, asp, "", [], []). |
|
|
1443
|
+ actioner(conn, targ, asp, action_name(""), [], []). |
|
1303
|
1444
|
|
|
1304
|
1445
|
|
|
1305
|
1446
|
public define HTML_In_Form |
|
...
|
...
|
@@ -1443,10 +1584,10 @@ public type HTML_Off_Form: |
|
1443
|
1584
|
fixed_size (HTML_Size width, HTML_Size height, HTML_Off_Form content), |
|
1444
|
1585
|
fixed_size_2 (HTML_Size width, HTML_Size height, String name_of_HTML_file), |
|
1445
|
1586
|
actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, |
|
1446
|
|
- String action_name, List((String,String)) extra_ops, |
|
|
1587
|
+ WEB_Action_Name action_name, List((String,String)) extra_ops, |
|
1447
|
1588
|
List(Actioner_Local_Action)), |
|
1448
|
1589
|
actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, |
|
1449
|
|
- String action_name, List((String,String)) extra_ops, |
|
|
1590
|
+ WEB_Action_Name action_name, List((String,String)) extra_ops, |
|
1450
|
1591
|
List(Actioner_Local_Action), String form_name), |
|
1451
|
1592
|
foreign_link_new (Actioner_Target, Actioner_Aspect, String url), |
|
1452
|
1593
|
foreign_link (List(Text_Option), String url), |
|
...
|
...
|
@@ -1456,7 +1597,7 @@ public type HTML_Off_Form: |
|
1456
|
1597
|
label (String name), |
|
1457
|
1598
|
form (HTML_Id form_id, List(CoreAttrs), HTML_In_Form content), |
|
1458
|
1599
|
form (HTML_Id form_id, List(CoreAttrs), |
|
1459
|
|
- String action_name, List((String,String)) extra_ops, |
|
|
1600
|
+ WEB_Action_Name action, List((String,String)) extra_ops, |
|
1460
|
1601
|
HTML_In_Form content), |
|
1461
|
1602
|
in_form (HTML_Id form_id, HTML_In_Form content), |
|
1462
|
1603
|
div (List(CoreAttrs), HTML_Off_Form content), |
|
...
|
...
|
@@ -1496,11 +1637,11 @@ public define HTML_Off_Form |
|
1496
|
1637
|
( |
|
1497
|
1638
|
String form_name, |
|
1498
|
1639
|
List(CoreAttrs) options, |
|
1499
|
|
- String action_name, |
|
|
1640
|
+ WEB_Action_Name action, |
|
1500
|
1641
|
List((String,String)) extra_ops, |
|
1501
|
1642
|
HTML_In_Form content |
|
1502
|
1643
|
) = |
|
1503
|
|
- form(html_Id(form_name), options, action_name, extra_ops, content). |
|
|
1644
|
+ form(html_Id(form_name), options, action, extra_ops, content). |
|
1504
|
1645
|
|
|
1505
|
1646
|
|
|
1506
|
1647
|
public define HTML_Off_Form literal(Printable_tree t) = literal_pt(t). |
|
...
|
...
|
@@ -1524,10 +1665,26 @@ public define HTML_Off_Form |
|
1524
|
1665
|
Actioner_Connection conn, |
|
1525
|
1666
|
Actioner_Target targ, |
|
1526
|
1667
|
Actioner_Aspect asp, |
|
1527
|
|
- String action_name, |
|
|
1668
|
+ WEB_Action_Name action, |
|
1528
|
1669
|
List((String,String)) extra_ops |
|
1529
|
1670
|
) = |
|
1530
|
|
- actioner(conn,targ,asp,action_name,extra_ops,[]). |
|
|
1671
|
+ actioner(conn,targ,asp,action,extra_ops,[]). |
|
|
1672
|
+ |
|
|
1673
|
+public define HTML_Off_Form |
|
|
1674
|
+/* Older call with String as action instead of WEB_Action_Name. |
|
|
1675
|
+ * This function exists only for compatibility with older project. |
|
|
1676
|
+ * Please condiser to use above function instead |
|
|
1677
|
+ */ |
|
|
1678
|
+ actioner |
|
|
1679
|
+ ( |
|
|
1680
|
+ Actioner_Connection conn, |
|
|
1681
|
+ Actioner_Target targ, |
|
|
1682
|
+ Actioner_Aspect asp, |
|
|
1683
|
+ String action, |
|
|
1684
|
+ List((String,String)) extra_ops |
|
|
1685
|
+ )= |
|
|
1686
|
+ actioner(conn,targ,asp,action_name(action),extra_ops,[]) |
|
|
1687
|
+. |
|
1531
|
1688
|
|
|
1532
|
1689
|
public define HTML_Off_Form |
|
1533
|
1690
|
table |
|
...
|
...
|
@@ -1761,8 +1918,8 @@ define Printable_tree |
|
1761
|
1918
|
public type HTML_Meta: |
|
1762
|
1919
|
keywords (List(String)), |
|
1763
|
1920
|
refresh (Actioner_Connection connection, |
|
1764
|
|
- Actioner_Target target, |
|
1765
|
|
- String action_name, |
|
|
1921
|
+ Actioner_Target target, |
|
|
1922
|
+ WEB_Action_Name action, |
|
1766
|
1923
|
Int delay), // in seconds |
|
1767
|
1924
|
refresh (String url, Int delay), // in seconds |
|
1768
|
1925
|
meta (String name, String content), |
|
...
|
...
|
@@ -1771,7 +1928,19 @@ public type HTML_Meta: |
|
1771
|
1928
|
literal (String). |
|
1772
|
1929
|
|
|
1773
|
1930
|
Meta tags are put in the 'head' of the HTML page. |
|
1774
|
|
- |
|
|
1931
|
+ |
|
|
1932
|
+public define HTML_Meta |
|
|
1933
|
+ refresh |
|
|
1934
|
+ ( |
|
|
1935
|
+ Actioner_Connection connection, |
|
|
1936
|
+ Actioner_Target target, |
|
|
1937
|
+ String action, |
|
|
1938
|
+ Int delay |
|
|
1939
|
+ )= |
|
|
1940
|
+ refresh(connection, target, action_name(action), delay) |
|
|
1941
|
+. |
|
|
1942
|
+ |
|
|
1943
|
+ |
|
1775
|
1944
|
|
|
1776
|
1945
|
public type Body_Option: |
|
1777
|
1946
|
core_attrs(List(CoreAttrs)), |
|
...
|
...
|
@@ -1998,22 +2167,26 @@ public define HTTP_Answer |
|
1998
|
2167
|
*** [1] States. |
|
1999
|
2168
|
*** [1.1] Saving and retrieving states. |
|
2000
|
2169
|
*** [1.2] Deleting out of date states. |
|
|
2170
|
+ |
|
|
2171
|
+ *** [2] Sessions. |
|
|
2172
|
+ *** [2.1] Saving and retrieving sessions. |
|
|
2173
|
+ *** [2.2] Deleting out of date sessions. |
|
|
2174
|
+ |
|
|
2175
|
+ *** [3] Tools. |
|
|
2176
|
+ *** [3.1] Directories. |
|
|
2177
|
+ *** [3.2] Secondary documents. |
|
2001
|
2178
|
|
|
2002
|
|
- *** [2] Tools. |
|
2003
|
|
- *** [2.1] Directories. |
|
2004
|
|
- *** [2.2] Secondary documents. |
|
2005
|
|
- |
|
2006
|
|
- *** [3] Managing web arguments. |
|
|
2179
|
+ *** [4] Managing web arguments. |
|
2007
|
2180
|
*** [3.1] Prefixing web arguments names. |
|
2008
|
2181
|
*** [3.2] Separating web arguments. |
|
2009
|
2182
|
*** [3.3] Applying an action. |
|
2010
|
2183
|
|
|
2011
|
|
- *** [4] Web site descriptions and the 'awp handlers'. |
|
|
2184
|
+ *** [5] Web site descriptions and the 'awp handlers'. |
|
2012
|
2185
|
*** [4.1] The type 'Web_Site'. |
|
2013
|
2186
|
*** [4.2] Making a web site description. |
|
2014
|
2187
|
*** [4.3] Starting the servers. |
|
2015
|
2188
|
|
|
2016
|
|
- *** [5] HTML Formating. |
|
|
2189
|
+ *** [6] HTML Formating. |
|
2017
|
2190
|
*** [5.1] The type 'HTML_Any($T)'. |
|
2018
|
2191
|
*** [5.2] Formating a color. |
|
2019
|
2192
|
*** [5.3] Creating buttons. |
|
...
|
...
|
@@ -2032,7 +2205,7 @@ define Printable_tree |
|
2032
|
2205
|
format |
|
2033
|
2206
|
( |
|
2034
|
2207
|
CommonInfo cinfo, |
|
2035
|
|
- String sn, // state_name |
|
|
2208
|
+ //String sn, // state_name |
|
2036
|
2209
|
Var(Int) ic_v, // 'idnum' counter variable |
|
2037
|
2210
|
HTML_Off_Form element, |
|
2038
|
2211
|
Bool is_https, |
|
...
|
...
|
@@ -2075,7 +2248,8 @@ read CXM_web_arg_encode.anubis |
|
2075
|
2248
|
|
|
2076
|
2249
|
The tool below constructs the function which is able to save a state on the server's |
|
2077
|
2250
|
disk. |
|
2078
|
|
- |
|
|
2251
|
+ |
|
|
2252
|
+ |
|
2079
|
2253
|
define ($State s) -> String // the function constructed returns the name of the state |
|
2080
|
2254
|
make_save_state_function |
|
2081
|
2255
|
( |
|
...
|
...
|
@@ -2118,7 +2292,9 @@ define (String state_name) -> PreviousState($State) |
|
2118
|
2292
|
) |
|
2119
|
2293
|
else still_valid(s) // state has been successfully retrieved |
|
2120
|
2294
|
) |
|
2121
|
|
- else not_found. |
|
|
2295
|
+ else |
|
|
2296
|
+ forget(remove(file_path)); |
|
|
2297
|
+ not_found. |
|
2122
|
2298
|
|
|
2123
|
2299
|
|
|
2124
|
2300
|
|
|
...
|
...
|
@@ -2139,7 +2315,7 @@ define (List(String) file_names) -> One |
|
2139
|
2315
|
{ |
|
2140
|
2316
|
[ ] then unique, |
|
2141
|
2317
|
[h . t] then |
|
2142
|
|
- with file_path = state_directory+"/"+h, |
|
|
2318
|
+ with file_path = state_directory+"/s"+h, |
|
2143
|
2319
|
if (RetrieveResult((Int,$State)))retrieve(file_path) is ok(d) |
|
2144
|
2320
|
then ( |
|
2145
|
2321
|
if d is (time_stamp,data) then |
|
...
|
...
|
@@ -2148,7 +2324,7 @@ define (List(String) file_names) -> One |
|
2148
|
2324
|
else df(t) |
|
2149
|
2325
|
) |
|
2150
|
2326
|
else (forget(remove(file_path)); df(t)) |
|
2151
|
|
- }. |
|
|
2327
|
+ }. |
|
2152
|
2328
|
|
|
2153
|
2329
|
|
|
2154
|
2330
|
The 'labelled arrow' |-df-> is documented in 'documentation/en/anubis_doc.txt'. |
|
...
|
...
|
@@ -2212,7 +2388,7 @@ define One |
|
2212
|
2388
|
else if now > next_time |
|
2213
|
2389
|
then |
|
2214
|
2390
|
( |
|
2215
|
|
- delete_out_of_date_states(directories_and_functions); |
|
|
2391
|
+ delete_out_of_date_states(directories_and_functions); |
|
2216
|
2392
|
delete_states_loop(directories_and_functions, |
|
2217
|
2393
|
timeout, |
|
2218
|
2394
|
now+timeout, |
|
...
|
...
|
@@ -2265,7 +2441,6 @@ define String |
|
2265
|
2441
|
( |
|
2266
|
2442
|
String sd, // site directory |
|
2267
|
2443
|
String as, // authorization_secret |
|
2268
|
|
- String sn, // state name |
|
2269
|
2444
|
$T -> Printable_tree format_element, |
|
2270
|
2445
|
$T content, |
|
2271
|
2446
|
HTML_Size width |
|
...
|
...
|
@@ -2417,8 +2592,6 @@ define (List(Web_arg) lwa, HTTP_Info info) -> Separated_Web_Args($State) |
|
2417
|
2592
|
|
|
2418
|
2593
|
|
|
2419
|
2594
|
|
|
2420
|
|
- |
|
2421
|
|
- |
|
2422
|
2595
|
|
|
2423
|
2596
|
*** [3.3] Applying an action. |
|
2424
|
2597
|
|
|
...
|
...
|
@@ -2535,7 +2708,7 @@ public define Printable_tree |
|
2535
|
2708
|
format |
|
2536
|
2709
|
( |
|
2537
|
2710
|
CommonInfo cinfo, |
|
2538
|
|
- String state_name, |
|
|
2711
|
+ //String state_name, |
|
2539
|
2712
|
List(HTTP_header) headers, |
|
2540
|
2713
|
HTTP_Answer page, |
|
2541
|
2714
|
Bool is_https, |
|
...
|
...
|
@@ -2670,7 +2843,7 @@ public define Web_Site |
|
2670
|
2843
|
}, |
|
2671
|
2844
|
|
|
2672
|
2845
|
format(info(host_name, http_port, https_port, site_directory, secret), |
|
2673
|
|
- state_name, |
|
|
2846
|
+ //state_name, |
|
2674
|
2847
|
additional_headers(new_state) + cookie_headers, |
|
2675
|
2848
|
compute_page(new_state), |
|
2676
|
2849
|
is_https, |
|
...
|
...
|
@@ -2706,7 +2879,287 @@ public define Web_Site |
|
2706
|
2879
|
), |
|
2707
|
2880
|
delete_out_of_date). |
|
2708
|
2881
|
|
|
|
2882
|
+ public type WEB_Controller: |
|
|
2883
|
+ web_controller( |
|
|
2884
|
+ String name, //controller name |
|
|
2885
|
+ (HTTP_Info http_info, |
|
|
2886
|
+ List(Web_arg) lwa, |
|
|
2887
|
+ Bool is_https |
|
|
2888
|
+ ) -> HTTP_Answer view //view renderer |
|
|
2889
|
+ ) |
|
|
2890
|
+ |
|
|
2891
|
+ |
|
|
2892
|
+ |
|
|
2893
|
+define HTTP_Answer |
|
|
2894
|
+ error_page |
|
|
2895
|
+ ( |
|
|
2896
|
+ HTTP_Status http_status |
|
|
2897
|
+ ) |
|
|
2898
|
+ = |
|
|
2899
|
+ html_page |
|
|
2900
|
+ ( |
|
|
2901
|
+ http_status, // status |
|
|
2902
|
+ [], // list of 'META' tags (empty for this site) |
|
|
2903
|
+ body // body of page |
|
|
2904
|
+ ( |
|
|
2905
|
+ // list of body options |
|
|
2906
|
+ [ |
|
|
2907
|
+ background_color(rgb(255,200,200)) |
|
|
2908
|
+ ], |
|
|
2909
|
+ |
|
|
2910
|
+ // content of page |
|
|
2911
|
+ sequence([ |
|
|
2912
|
+ text([size(16)], "Anubis Web Server 1.14"), |
|
|
2913
|
+ br, |
|
|
2914
|
+ text([size(16)],"Error "+to_String(http_status)) |
|
|
2915
|
+ ]) |
|
|
2916
|
+ ) |
|
|
2917
|
+ ) |
|
|
2918
|
+. |
|
|
2919
|
+ |
|
|
2920
|
+define WEB_Controller_Result |
|
|
2921
|
+ apply_action |
|
|
2922
|
+ ( |
|
|
2923
|
+ WEB_Session _session, |
|
|
2924
|
+ String requested_action_name, |
|
|
2925
|
+ List(WEB_Action) actions_list |
|
|
2926
|
+ ) = |
|
|
2927
|
+ if actions_list is |
|
|
2928
|
+ { |
|
|
2929
|
+ [] then http_answer(error_page(http_not_found)), |
|
|
2930
|
+ [h . t] then |
|
|
2931
|
+ with action_name = if h.name is |
|
|
2932
|
+ { |
|
|
2933
|
+ controller_action(_, name) then name, |
|
|
2934
|
+ action_name(name) then name |
|
|
2935
|
+ }, |
|
|
2936
|
+ if requested_action_name = action_name then |
|
|
2937
|
+ if h.allowed_proto is |
|
|
2938
|
+ { |
|
|
2939
|
+ //Action only in HTTP |
|
|
2940
|
+ http then |
|
|
2941
|
+ if _session.web_request.is_https then |
|
|
2942
|
+ http_answer(error_page(http_forbidden)) |
|
|
2943
|
+ else |
|
|
2944
|
+ //ask to the server the authorization to execute that action |
|
|
2945
|
+ if h.allow(_session) then |
|
|
2946
|
+ h.do_it(_session) |
|
|
2947
|
+ else |
|
|
2948
|
+ http_answer(error_page(http_unauthorized)) |
|
|
2949
|
+ |
|
|
2950
|
+ //Action only in HTTPS |
|
|
2951
|
+ https then |
|
|
2952
|
+ if _session.web_request.is_https then |
|
|
2953
|
+ //ask to the server the authorization to execute that action |
|
|
2954
|
+ if h.allow(_session) then |
|
|
2955
|
+ h.do_it(_session) |
|
|
2956
|
+ else |
|
|
2957
|
+ http_answer(error_page(http_unauthorized)) |
|
|
2958
|
+ else |
|
|
2959
|
+ http_answer(error_page(http_forbidden)) |
|
|
2960
|
+ //Action in both HTTP / HTTPS |
|
|
2961
|
+ http_https then |
|
|
2962
|
+ //ask to the server the authorization to execute that action |
|
|
2963
|
+ if h.allow(_session) then |
|
|
2964
|
+ h.do_it(_session) |
|
|
2965
|
+ else |
|
|
2966
|
+ http_answer(error_page(http_unauthorized)) |
|
|
2967
|
+ |
|
|
2968
|
+ } |
|
|
2969
|
+ else |
|
|
2970
|
+ apply_action(_session, requested_action_name, t) |
|
|
2971
|
+ } |
|
|
2972
|
+. |
|
|
2973
|
+ |
|
|
2974
|
+define Maybe(WEB_Controller) |
|
|
2975
|
+ get_controller |
|
|
2976
|
+ ( |
|
|
2977
|
+ String controller_name, |
|
|
2978
|
+ List(WEB_Controller) controllers, |
|
|
2979
|
+ )= |
|
|
2980
|
+ if controllers is |
|
|
2981
|
+ { |
|
|
2982
|
+ [] then failure, |
|
|
2983
|
+ [h . t] then |
|
|
2984
|
+ if h.name = controller_name then |
|
|
2985
|
+ success(h) |
|
|
2986
|
+ else |
|
|
2987
|
+ get_controller(controller_name, t) |
|
|
2988
|
+ } |
|
|
2989
|
+. |
|
|
2990
|
+ |
|
|
2991
|
+define (Maybe(WEB_Session), HTTP_Answer) |
|
|
2992
|
+ apply_controller_action |
|
|
2993
|
+ ( |
|
|
2994
|
+ WEB_Controller controller, |
|
|
2995
|
+ List(WEB_Controller) controllers, |
|
|
2996
|
+ WEB_Session _session |
|
|
2997
|
+ )= |
|
|
2998
|
+ //get the action name |
|
|
2999
|
+ if get_String(_session.web_request.lwa, "aws_action") is |
|
|
3000
|
+ { |
|
|
3001
|
+ failure then (failure, error_page(http_not_found)), |
|
|
3002
|
+ success(action_name) then |
|
|
3003
|
+ |
|
|
3004
|
+ if apply_action(_session, action_name, *controller.controller_actions) is |
|
|
3005
|
+ { |
|
|
3006
|
+ http_answer(session, answer) then (success(session), answer), |
|
|
3007
|
+ http_answer(answer) then (success(_session), answer), |
|
|
3008
|
+ redirect(new_session) then |
|
|
3009
|
+ if get_controller(get_String(new_session.web_request.lwa, "aws_controller", "root"), controllers) is |
|
|
3010
|
+ { |
|
|
3011
|
+ failure then (failure, error_page(http_not_found)), |
|
|
3012
|
+ success(new_controller) then apply_controller_action(new_controller, controllers, new_session), |
|
|
3013
|
+ } |
|
|
3014
|
+ |
|
|
3015
|
+ redirect_to_previous then |
|
|
3016
|
+ if get_controller(get_String(_session.previous_request.lwa, "aws_controller", "root"), controllers) is |
|
|
3017
|
+ { |
|
|
3018
|
+ failure then (failure, error_page(http_not_found)), |
|
|
3019
|
+ success(new_controller) then |
|
|
3020
|
+ since _session is web_session(lang, entries, _, previous), |
|
|
3021
|
+ apply_controller_action(new_controller, controllers, web_session(lang, entries, previous, previous)), |
|
|
3022
|
+ } |
|
|
3023
|
+ |
|
|
3024
|
+ ajax(answer) then (failure, answer), |
|
|
3025
|
+ } |
|
|
3026
|
+ } |
|
|
3027
|
+. |
|
|
3028
|
+ |
|
|
3029
|
+public define Web_Site |
|
|
3030
|
+ make_web_site_controller_description |
|
|
3031
|
+ ( |
|
|
3032
|
+ String website_name, // site_UID |
|
|
3033
|
+ List(String) common_names, // for example: ["www.our-business.com"] |
|
|
3034
|
+ String site_directory, |
|
|
3035
|
+ String state_directory, |
|
|
3036
|
+ One -> One init, |
|
|
3037
|
+ (HTTP_Info, |
|
|
3038
|
+ List(Web_arg), |
|
|
3039
|
+ Bool is_https) -> WEB_Session initial_session, |
|
|
3040
|
+ (WEB_Session, |
|
|
3041
|
+ HTTP_Info, |
|
|
3042
|
+ List(Web_arg), |
|
|
3043
|
+ Bool is_https) -> WEB_Session expired_session, |
|
|
3044
|
+ Var(List(WEB_Controller)) web_controllers, |
|
|
3045
|
+ Maybe(WEB_Session) -> List(HTTP_header) additional_headers, |
|
|
3046
|
+ Int timeout, |
|
|
3047
|
+ Redirections redirections, |
|
|
3048
|
+ String charset, |
|
|
3049
|
+ List(String) journal_extensions, |
|
|
3050
|
+ List(String) journal_headers, |
|
|
3051
|
+ String secret, |
|
|
3052
|
+ List(MIME) known_mime_types, |
|
|
3053
|
+ (String action_name, |
|
|
3054
|
+ List(Web_arg) args) -> One before_send_file |
|
|
3055
|
+ )= |
|
|
3056
|
+ //call the initialization function |
|
|
3057
|
+ init(unique); |
|
|
3058
|
+ |
|
|
3059
|
+ |
|
|
3060
|
+ // |
|
|
3061
|
+ // make required directories (if needed) |
|
|
3062
|
+ // |
|
|
3063
|
+ with //web_sites_directory = (String) make_directory(my_anubis_directory+"/web_sites"), |
|
|
3064
|
+ base_directory = (String) make_directory(site_directory), |
|
|
3065
|
+ // state_directory = make_directory(site_directory+"/states"), |
|
|
3066
|
+ forget((String)make_directory(site_directory+"/public")); |
|
|
3067
|
+ // |
|
|
3068
|
+ // construct tool functions |
|
|
3069
|
+ // TODO 'make_separate_web_args_function' must retrieve state_cookies before parsing web_args if using_state_cookies is true |
|
|
3070
|
+ with save_session = make_save_session_function(timeout, state_directory), |
|
|
3071
|
+ // retrieve_session = make_retrieve_session_function(state_directory, website_name), |
|
|
3072
|
+ //separate_web_args = make_separate_web_args_function(state_directory, retrieve_state), |
|
|
3073
|
+ //apply_action = make_apply_action_function(actions), |
|
|
3074
|
+ |
|
|
3075
|
+ // |
|
|
3076
|
+ // construct the site handler |
|
|
3077
|
+ // |
|
|
3078
|
+ site_handler = (Word32 http_port, Word32 https_port) |-> |
|
|
3079
|
+ ((String host_name, |
|
|
3080
|
+ HTTP_Info http_info, |
|
|
3081
|
+ List(Web_arg) _lwa, |
|
|
3082
|
+ Bool is_https) |-> |
|
|
3083
|
+ //(Printable_tree) |
|
|
3084
|
+ println("host_name "+host_name); |
|
|
3085
|
+ println(dump_http_info(http_info)); |
|
|
3086
|
+ println(dump_web_arg_values(_lwa)); |
|
|
3087
|
+ |
|
|
3088
|
+ |
|
|
3089
|
+ //retrieve the previous session and determine the new one |
|
|
3090
|
+ with current_session = if retrieve_session(http_info, state_directory, website_name) is |
|
|
3091
|
+ { |
|
|
3092
|
+ not_found then |
|
|
3093
|
+ //println("previous state not found"); |
|
|
3094
|
+ initial_session(http_info, _lwa, is_https), |
|
|
3095
|
+ |
|
|
3096
|
+ out_of_date(previous_session) then |
|
|
3097
|
+ //println("previous out_of_date"); |
|
|
3098
|
+ expired_session(previous_session, http_info, _lwa, is_https), |
|
2709
|
3099
|
|
|
|
3100
|
+ still_valid(previous_session) then |
|
|
3101
|
+ since previous_session is web_session(lang, entries, previous, _), |
|
|
3102
|
+ web_session(lang, entries, web_request(http_info, _lwa, is_https), previous) |
|
|
3103
|
+ }, |
|
|
3104
|
+ |
|
|
3105
|
+ |
|
|
3106
|
+ //apply the action according to current session |
|
|
3107
|
+ //since apply_controller_action(get_controller(get_String(lwa, "aws_controller", "root"), *web_controllers), *web_controllers, current_session) |
|
|
3108
|
+ since if get_controller(get_String(current_session.web_request.lwa, "aws_controller", "root"), *web_controllers) is |
|
|
3109
|
+ { |
|
|
3110
|
+ failure then (failure, error_page(http_not_found)), |
|
|
3111
|
+ success(new_controller) then apply_controller_action(new_controller, *web_controllers, current_session), |
|
|
3112
|
+ } |
|
|
3113
|
+ is (mb_new_session, http_answer), |
|
|
3114
|
+ |
|
|
3115
|
+ //save the session if need and construct the according cookie |
|
|
3116
|
+ with cookie_headers = |
|
|
3117
|
+ if mb_new_session is |
|
|
3118
|
+ { |
|
|
3119
|
+ failure then [], |
|
|
3120
|
+ success(new_session) then |
|
|
3121
|
+ with session_name = save_session(new_session), |
|
|
3122
|
+ make_session_cookie_headers(website_name, session_name) |
|
|
3123
|
+ }, |
|
|
3124
|
+ |
|
|
3125
|
+ //formatting and send http answer because this is the last function |
|
|
3126
|
+ format(info(host_name, http_port, https_port, site_directory, secret), |
|
|
3127
|
+ //state_name, |
|
|
3128
|
+ additional_headers(mb_new_session) + cookie_headers, |
|
|
3129
|
+ http_answer, |
|
|
3130
|
+ is_https, |
|
|
3131
|
+ charset) |
|
|
3132
|
+ ), |
|
|
3133
|
+ // |
|
|
3134
|
+ // make the delete_out_of_date function |
|
|
3135
|
+ // |
|
|
3136
|
+ delete_out_of_date = |
|
|
3137
|
+ make_delete_out_of_date_sessions_function(site_directory+"/states"), |
|
|
3138
|
+ // |
|
|
3139
|
+ // construct the web site description |
|
|
3140
|
+ // |
|
|
3141
|
+ web_site((Word32 http_port, Word32 https_port) |-> |
|
|
3142
|
+ web_site_description(common_names, |
|
|
3143
|
+ site_directory, |
|
|
3144
|
+ redirections, |
|
|
3145
|
+ charset, |
|
|
3146
|
+ journal_extensions, |
|
|
3147
|
+ journal_headers, |
|
|
3148
|
+ secret, |
|
|
3149
|
+ known_mime_types, |
|
|
3150
|
+ site_handler(http_port,https_port), |
|
|
3151
|
+ (HTTP_Info http_info, List(Web_arg) lwa) |-> unique |
|
|
3152
|
+// if separate_web_args(lwa, http_info ) is |
|
|
3153
|
+// swa(mb_previous_state,mb_action_name,operands) then |
|
|
3154
|
+// if mb_action_name is |
|
|
3155
|
+// { |
|
|
3156
|
+// failure then unique |
|
|
3157
|
+// success(an) then before_send_file(an,operands) |
|
|
3158
|
+// } |
|
|
3159
|
+ //using_state_cookies |
|
|
3160
|
+ ), |
|
|
3161
|
+ delete_out_of_date). |
|
|
3162
|
+ |
|
2710
|
3163
|
|
|
2711
|
3164
|
define String |
|
2712
|
3165
|
get_site_uid |
|
...
|
...
|
@@ -2831,17 +3284,17 @@ public define Start_Web_Sites_Result |
|
2831
|
3284
|
|
|
2832
|
3285
|
|
|
2833
|
3286
|
public define One |
|
2834
|
|
- start_web_sites |
|
2835
|
|
- ( |
|
2836
|
|
- Word32 ip_address, // the IP address shared by the web sites |
|
2837
|
|
- Word32 http_port, // usually: 80 |
|
2838
|
|
- Word32 https_port, // usually: 443 |
|
2839
|
|
- String ssl_certificate_common_name, |
|
2840
|
|
- List(Web_Site) web_sites, // web sites to be started |
|
2841
|
|
- (One) -> Bool shutdown_required, |
|
2842
|
|
- Logger log |
|
2843
|
|
- ) = |
|
2844
|
|
- if (Start_Web_Sites_Result)start_web_sites(ip_address, |
|
|
3287
|
+ start_web_sites |
|
|
3288
|
+ ( |
|
|
3289
|
+ Word32 ip_address, // the IP address shared by the web sites |
|
|
3290
|
+ Word32 http_port, // usually: 80 |
|
|
3291
|
+ Word32 https_port, // usually: 443 |
|
|
3292
|
+ String ssl_certificate_common_name, |
|
|
3293
|
+ List(Web_Site) web_sites, // web sites to be started |
|
|
3294
|
+ (One) -> Bool shutdown_required, |
|
|
3295
|
+ Logger log //logger where to report the error |
|
|
3296
|
+ )= |
|
|
3297
|
+ if (Start_Web_Sites_Result)start_web_sites(ip_address, |
|
2845
|
3298
|
http_port, |
|
2846
|
3299
|
https_port, |
|
2847
|
3300
|
ssl_certificate_common_name, |
|
...
|
...
|
@@ -2899,7 +3352,7 @@ type HTML_Any($T): |
|
2899
|
3352
|
any_actioner (Actioner_Connection, |
|
2900
|
3353
|
Actioner_Target, |
|
2901
|
3354
|
Actioner_Aspect, |
|
2902
|
|
- String action_name, |
|
|
3355
|
+ WEB_Action_Name action, |
|
2903
|
3356
|
List((String,String)) extra_ops, |
|
2904
|
3357
|
List(Actioner_Local_Action), |
|
2905
|
3358
|
Maybe(String) form_name), |
|
...
|
...
|
@@ -3095,25 +3548,39 @@ define Int |
|
3095
|
3548
|
window. |
|
3096
|
3549
|
|
|
3097
|
3550
|
define String |
|
3098
|
|
- make_actioner_url |
|
3099
|
|
- ( |
|
3100
|
|
- CommonInfo cinfo, |
|
3101
|
|
- Actioner_Connection connection, |
|
3102
|
|
- Actioner_Target target, |
|
3103
|
|
- String state_name, |
|
3104
|
|
- String action_name, |
|
3105
|
|
- List((String,String)) extra_ops, |
|
3106
|
|
- Bool is_https |
|
3107
|
|
- ) = |
|
|
3551
|
+ make_actioner_url |
|
|
3552
|
+ ( |
|
|
3553
|
+ CommonInfo cinfo, |
|
|
3554
|
+ Actioner_Connection connection, |
|
|
3555
|
+ Actioner_Target target, |
|
|
3556
|
+ WEB_Action_Name action, |
|
|
3557
|
+ List((String,String)) extra_ops, |
|
|
3558
|
+ Bool is_https |
|
|
3559
|
+ ) = |
|
3108
|
3560
|
if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
|
3109
|
3561
|
with strict_url = |
|
3110
|
3562
|
if connection is |
|
3111
|
3563
|
{ |
|
3112
|
3564
|
same then "/", |
|
3113
|
|
- http then "http://"+common_name+":"+http_port+"/", |
|
3114
|
|
- https then "https://"+common_name+":"+https_port+"/", |
|
|
3565
|
+ http then |
|
|
3566
|
+ if http_port = 80 then |
|
|
3567
|
+ "http://"+common_name+"/" |
|
|
3568
|
+ else |
|
|
3569
|
+ "http://"+common_name+":"+http_port+"/", |
|
|
3570
|
+ https then |
|
|
3571
|
+ if https_port = 443 then |
|
|
3572
|
+ "https://"+common_name+"/" |
|
|
3573
|
+ else |
|
|
3574
|
+ "https://"+common_name+":"+https_port+"/", |
|
3115
|
3575
|
} + |
|
3116
|
|
- "?a=" + action_name + |
|
|
3576
|
+ //with action_string = |
|
|
3577
|
+ if action is |
|
|
3578
|
+ { |
|
|
3579
|
+ controller_action(controller, action_name) then "?aws_controller="+controller+"&aws_action="+action_name, |
|
|
3580
|
+ action_name(action_name) then "?aws_action="+action_name |
|
|
3581
|
+ } |
|
|
3582
|
+ //"?a=" + action_name + |
|
|
3583
|
+ + |
|
3117
|
3584
|
format_extra_operands(extra_ops), |
|
3118
|
3585
|
if target is |
|
3119
|
3586
|
{ |
|
...
|
...
|
@@ -3535,7 +4002,7 @@ define Printable_tree |
|
3535
|
4002
|
String url, |
|
3536
|
4003
|
Bool is_https, |
|
3537
|
4004
|
CommonInfo cinfo, |
|
3538
|
|
- String state_name, |
|
|
4005
|
+// String state_name, |
|
3539
|
4006
|
Var(Int) action_count, |
|
3540
|
4007
|
Var(Int) ic_v, // 'idnum' counter variable |
|
3541
|
4008
|
Var(List(HTML_Head_Tag)) head_tags |
|
...
|
...
|
@@ -3578,7 +4045,7 @@ define Printable_tree |
|
3578
|
4045
|
html(html_off_form) then |
|
3579
|
4046
|
[ |
|
3580
|
4047
|
"<a href=\"", full_url, "\">", |
|
3581
|
|
- format(cinfo, state_name, ic_v, html_off_form, is_https, action_count, head_tags), |
|
|
4048
|
+ format(cinfo, ic_v, html_off_form, is_https, action_count, head_tags), |
|
3582
|
4049
|
"</a>" |
|
3583
|
4050
|
] |
|
3584
|
4051
|
}. |
|
...
|
...
|
@@ -3587,11 +4054,10 @@ define Printable_tree |
|
3587
|
4054
|
format_actioner |
|
3588
|
4055
|
( |
|
3589
|
4056
|
CommonInfo cinfo, |
|
3590
|
|
- String state_name, |
|
3591
|
4057
|
Actioner_Connection connection, |
|
3592
|
4058
|
Actioner_Target target, |
|
3593
|
4059
|
Actioner_Aspect aspect, |
|
3594
|
|
- String action_name, |
|
|
4060
|
+ WEB_Action_Name action, |
|
3595
|
4061
|
List((String,String)) extra_ops, |
|
3596
|
4062
|
List(Actioner_Local_Action) local_actions, |
|
3597
|
4063
|
Maybe(String) mb_form_name, |
|
...
|
...
|
@@ -3604,8 +4070,8 @@ define Printable_tree |
|
3604
|
4070
|
|
|
3605
|
4071
|
if cinfo is info(common_name,http_port,https_port,site_dir,secret) then |
|
3606
|
4072
|
with url = make_actioner_url(cinfo,connection,target, |
|
3607
|
|
- state_name,action_name,extra_ops,is_https), |
|
3608
|
|
- with action = format_action(url, aspect, extract_id(aspect), mb_form_name, action_count), |
|
|
4073
|
+ action,extra_ops,is_https), |
|
|
4074
|
+ with formatted_action = format_action(url, aspect, extract_id(aspect), mb_form_name, action_count), |
|
3609
|
4075
|
if aspect is |
|
3610
|
4076
|
{ |
|
3611
|
4077
|
|
|
...
|
...
|
@@ -3618,6 +4084,10 @@ define Printable_tree |
|
3618
|
4084
|
], |
|
3619
|
4085
|
img_link(options, img, alt_text) then |
|
3620
|
4086
|
//if action name is empty, format options on image because maybe there onclick action |
|
|
4087
|
+ with action_name = if action is { |
|
|
4088
|
+ controller_action(_, an) then an, |
|
|
4089
|
+ action_name(an) then an |
|
|
4090
|
+ }, |
|
3621
|
4091
|
if action_name ="" then |
|
3622
|
4092
|
[ |
|
3623
|
4093
|
"<img src=\"", img,"\"", |
|
...
|
...
|
@@ -3630,12 +4100,18 @@ define Printable_tree |
|
3630
|
4100
|
], |
|
3631
|
4101
|
push_button(options, text) then |
|
3632
|
4102
|
[ |
|
3633
|
|
- if action is |
|
|
4103
|
+ if formatted_action is |
|
3634
|
4104
|
{ |
|
3635
|
4105
|
url(u) then ["<a href=\"",u,"\"", format_attrs(options), ">", |
|
3636
|
4106
|
text, "</a>" |
|
3637
|
4107
|
], |
|
3638
|
4108
|
javascript(s,h) then |
|
|
4109
|
+ with action_name = |
|
|
4110
|
+ if action is |
|
|
4111
|
+ { |
|
|
4112
|
+ controller_action(_, an) then an, |
|
|
4113
|
+ action_name(an) then an |
|
|
4114
|
+ }, |
|
3639
|
4115
|
if action_name = "" then |
|
3640
|
4116
|
["<input type=\"button\" value=\"",text,"\"", format_attrs(options), " />"] |
|
3641
|
4117
|
else |
|
...
|
...
|
@@ -3643,7 +4119,7 @@ define Printable_tree |
|
3643
|
4119
|
} |
|
3644
|
4120
|
], |
|
3645
|
4121
|
button(url_off,url_on) then |
|
3646
|
|
- [ if action is |
|
|
4122
|
+ [ if formatted_action is |
|
3647
|
4123
|
{ |
|
3648
|
4124
|
url(u) then ["<a href=\"",u], |
|
3649
|
4125
|
javascript(s,h) then [s,"<a onMouseDown=\"",h] |
|
...
|
...
|
@@ -3656,7 +4132,7 @@ define Printable_tree |
|
3656
|
4132
|
], |
|
3657
|
4133
|
|
|
3658
|
4134
|
button(url_off,url_on,w,h) then |
|
3659
|
|
- [ if action is |
|
|
4135
|
+ [ if formatted_action is |
|
3660
|
4136
|
{ |
|
3661
|
4137
|
url(u) then ["<a href=\"",u], |
|
3662
|
4138
|
javascript(s,h2) then [s,"<a onMouseDown=\"",h2] |
|
...
|
...
|
@@ -3670,12 +4146,16 @@ define Printable_tree |
|
3670
|
4146
|
|
|
3671
|
4147
|
submit(options, text) then |
|
3672
|
4148
|
[ |
|
3673
|
|
- if action is |
|
|
4149
|
+ if formatted_action is |
|
3674
|
4150
|
{ |
|
3675
|
4151
|
url(u) then ["<a href=\"",u,"\"", format_attrs(options), ">", |
|
3676
|
4152
|
text, "</a>" |
|
3677
|
4153
|
], |
|
3678
|
4154
|
javascript(s,h) then |
|
|
4155
|
+ with action_name = if action is { |
|
|
4156
|
+ controller_action(_, an) then an, |
|
|
4157
|
+ action_name(an) then an |
|
|
4158
|
+ }, |
|
3679
|
4159
|
if action_name = "" then // special case where URL (so the action_name) is provided by the form itself |
|
3680
|
4160
|
// so javascript isn't needed. This is the standard HMTL way. |
|
3681
|
4161
|
["<input type=\"submit\" value=\"",text,"\"", format_attrs(options), " />"] |
|
...
|
...
|
@@ -3697,7 +4177,7 @@ define Printable_tree |
|
3697
|
4177
|
[ |
|
3698
|
4178
|
//if custom function name is provided, that name is used instead of autogenerated js function |
|
3699
|
4179
|
if custom_function_name = "" then |
|
3700
|
|
- if action is |
|
|
4180
|
+ if formatted_action is |
|
3701
|
4181
|
{ |
|
3702
|
4182
|
url(u) then ["<select href=\"",u] |
|
3703
|
4183
|
javascript(s,h) then [s,"<select onchange=\"",h] |
|
...
|
...
|
@@ -3711,7 +4191,7 @@ define Printable_tree |
|
3711
|
4191
|
html(html_off_form) then |
|
3712
|
4192
|
[ |
|
3713
|
4193
|
"<a href=\"", url, "\">", |
|
3714
|
|
- format(cinfo, state_name, ic_v, html_off_form, is_https, action_count, head_tags), |
|
|
4194
|
+ format(cinfo, ic_v, html_off_form, is_https, action_count, head_tags), |
|
3715
|
4195
|
"</a>" |
|
3716
|
4196
|
] |
|
3717
|
4197
|
}. |
|
...
|
...
|
@@ -3730,19 +4210,17 @@ define Printable_tree |
|
3730
|
4210
|
|
|
3731
|
4211
|
|
|
3732
|
4212
|
define Printable_tree |
|
3733
|
|
- format_private_download |
|
3734
|
|
- ( |
|
3735
|
|
- CommonInfo cinfo, |
|
3736
|
|
- String sn, // state name |
|
3737
|
|
- String abs_path, // absolute file path on server |
|
3738
|
|
- String name, // name of file as it appears in the browser |
|
3739
|
|
- String extra, // extra extension |
|
3740
|
|
- Maybe((String,List((String,String)))) action |
|
3741
|
|
- |
|
3742
|
|
- ) = |
|
3743
|
|
- if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
|
3744
|
|
- with private_download_directory = site_directory+"/private_download", |
|
3745
|
|
- with auth = make_authorization(site_directory,secret,abs_path), |
|
|
4213
|
+ format_private_download |
|
|
4214
|
+ ( |
|
|
4215
|
+ CommonInfo cinfo, |
|
|
4216
|
+ String abs_path, // absolute file path on server |
|
|
4217
|
+ String name, // name of file as it appears in the browser |
|
|
4218
|
+ String extra, // extra extension |
|
|
4219
|
+ Maybe((String,List((String,String)))) action |
|
|
4220
|
+ ) = |
|
|
4221
|
+ if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
|
|
4222
|
+ with private_download_directory = site_directory+"/private_download", |
|
|
4223
|
+ with auth = make_authorization(site_directory,secret,abs_path), |
|
3746
|
4224
|
[ |
|
3747
|
4225
|
"<a href=\"",name,extra,"?zauth=",auth, |
|
3748
|
4226
|
if action is |
|
...
|
...
|
@@ -3756,9 +4234,6 @@ define Printable_tree |
|
3756
|
4234
|
"</a>" |
|
3757
|
4235
|
]. |
|
3758
|
4236
|
|
|
3759
|
|
- |
|
3760
|
|
- |
|
3761
|
|
- |
|
3762
|
4237
|
*** [5.6] Formating rows and cells in a table. |
|
3763
|
4238
|
|
|
3764
|
4239
|
define Int |
|
...
|
...
|
@@ -4034,7 +4509,6 @@ define String |
|
4034
|
4509
|
define Printable_tree |
|
4035
|
4510
|
format_scroller |
|
4036
|
4511
|
( |
|
4037
|
|
- String sn, |
|
4038
|
4512
|
Int width, |
|
4039
|
4513
|
Int height, |
|
4040
|
4514
|
Int content_width, |
|
...
|
...
|
@@ -4208,7 +4682,6 @@ define Printable_tree |
|
4208
|
4682
|
format |
|
4209
|
4683
|
( |
|
4210
|
4684
|
CommonInfo cinfo, |
|
4211
|
|
- String sn, // state_name |
|
4212
|
4685
|
Var(Int) ic_v, |
|
4213
|
4686
|
HTML_Any($T) element, |
|
4214
|
4687
|
$T -> Printable_tree format_element, // able to format a datum of type $T |
|
...
|
...
|
@@ -4246,9 +4719,9 @@ define Printable_tree |
|
4246
|
4719
|
any_mail_to(email,elem) then |
|
4247
|
4720
|
["<a href=\"mailto:",email,"\">",format_element(elem),"</a>"], |
|
4248
|
4721
|
any_scroller(w,h,cw,ch,c) then |
|
4249
|
|
- format_scroller(sn,w,h,cw,ch,new_idnum(ic_v),c,format_element), |
|
|
4722
|
+ format_scroller(w,h,cw,ch,new_idnum(ic_v),c,format_element), |
|
4250
|
4723
|
any_fixed_size(w,h,c) then |
|
4251
|
|
- with url = create_secondary_document(site_directory,secret,sn,format_element,c,w), |
|
|
4724
|
+ with url = create_secondary_document(site_directory,secret,format_element,c,w), |
|
4252
|
4725
|
["<object data=\"",url,"\" type=\"text/html\" width=\"",format(w),"\" height=\"",format(h),"\" >", |
|
4253
|
4726
|
"secondary document", |
|
4254
|
4727
|
"</object>"], |
|
...
|
...
|
@@ -4259,17 +4732,17 @@ define Printable_tree |
|
4259
|
4732
|
"secondary document", |
|
4260
|
4733
|
"</object>"], |
|
4261
|
4734
|
any_actioner(c,t,a,an,eo,ja,fn) then |
|
4262
|
|
- format_actioner(cinfo,sn,c,t,a,an,eo,ja,fn,is_https, action_count, ic_v, head_tags), |
|
|
4735
|
+ format_actioner(cinfo,c,t,a,an,eo,ja,fn,is_https, action_count, ic_v, head_tags), |
|
4263
|
4736
|
|
|
4264
|
4737
|
any_foreign_link_new(target, aspect, url) then |
|
4265
|
|
- format_foreign_link(target, aspect, url, is_https, cinfo, sn, action_count, ic_v, head_tags), |
|
|
4738
|
+ format_foreign_link(target, aspect, url, is_https, cinfo, action_count, ic_v, head_tags), |
|
4266
|
4739
|
|
|
4267
|
4740
|
any_foreign_link(options,url) then |
|
4268
|
4741
|
["<a href=\"",url,"\" ", format_text_options(options), "></a>"], // IE7 doesn't support the form <a href="..." /> |
|
4269
|
4742
|
any_foreign_link(options,url,name) then |
|
4270
|
4743
|
["<a href=\"",url,"\"><span ", format_text_options(options), ">",name,"</span></a>"], |
|
4271
|
4744
|
any_private_download(url,name,extra_ext,action) then |
|
4272
|
|
- format_private_download(cinfo,sn,url,name,extra_ext,action), |
|
|
4745
|
+ format_private_download(cinfo,url,name,extra_ext,action), |
|
4273
|
4746
|
any_div(options, e) then |
|
4274
|
4747
|
[format_div_option(options), format_element(e),"</div>\n"], |
|
4275
|
4748
|
any_div_empty(options) then |
|
...
|
...
|
@@ -4407,7 +4880,6 @@ define Printable_tree |
|
4407
|
4880
|
( |
|
4408
|
4881
|
CommonInfo cinfo, |
|
4409
|
4882
|
String fn, // form_name |
|
4410
|
|
- String sn, // state_name |
|
4411
|
4883
|
Var(Int) ic_v, // idnum counter variable |
|
4412
|
4884
|
HTML_In_Form element, |
|
4413
|
4885
|
Bool is_https, |
|
...
|
...
|
@@ -4415,7 +4887,7 @@ define Printable_tree |
|
4415
|
4887
|
Var(List(HTML_Head_Tag)) head_tags |
|
4416
|
4888
|
) = |
|
4417
|
4889
|
if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
|
4418
|
|
- with format_element = (HTML_In_Form e) |-> format(cinfo, fn, sn, ic_v, e, is_https, action_count, head_tags), |
|
|
4890
|
+ with format_element = (HTML_In_Form e) |-> format(cinfo, fn, ic_v, e, is_https, action_count, head_tags), |
|
4419
|
4891
|
if element is |
|
4420
|
4892
|
{ |
|
4421
|
4893
|
empty then [], |
|
...
|
...
|
@@ -4423,35 +4895,35 @@ define Printable_tree |
|
4423
|
4895
|
literal(t) then [t], |
|
4424
|
4896
|
sequence(l) then flat(map(format_element,l)) |
|
4425
|
4897
|
text(opts,t) then |
|
4426
|
|
- format(cinfo,sn,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags), |
|
|
4898
|
+ format(cinfo,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags), |
|
4427
|
4899
|
preformated(o,s) then |
|
4428
|
|
- format(cinfo,sn,ic_v,any_preformated(o,s),format_element,is_https, action_count, head_tags), |
|
|
4900
|
+ format(cinfo,ic_v,any_preformated(o,s),format_element,is_https, action_count, head_tags), |
|
4429
|
4901
|
paragraph(opts,t) then |
|
4430
|
|
- format(cinfo,sn,ic_v,any_paragraph(opts,t),format_element,is_https, action_count, head_tags), |
|
|
4902
|
+ format(cinfo,ic_v,any_paragraph(opts,t),format_element,is_https, action_count, head_tags), |
|
4431
|
4903
|
image(opts, url, alt) then |
|
4432
|
|
- format(cinfo,sn,ic_v,any_image(opts, url, alt),format_element,is_https, action_count, head_tags), |
|
|
4904
|
+ format(cinfo,ic_v,any_image(opts, url, alt),format_element,is_https, action_count, head_tags), |
|
4433
|
4905
|
image(opts, url, alt, w, h) then |
|
4434
|
|
- format(cinfo,sn,ic_v,any_image(opts, url, alt, w, h),format_element,is_https, action_count, head_tags), |
|
|
4906
|
+ format(cinfo,ic_v,any_image(opts, url, alt, w, h),format_element,is_https, action_count, head_tags), |
|
4435
|
4907
|
table(opts,header_row,rows,footer_row) then |
|
4436
|
|
- format(cinfo,sn,ic_v,any_table(opts, header_row, rows, footer_row),format_element,is_https, action_count, head_tags), |
|
|
4908
|
+ format(cinfo,ic_v,any_table(opts, header_row, rows, footer_row),format_element,is_https, action_count, head_tags), |
|
4437
|
4909
|
center(e) then |
|
4438
|
|
- format(cinfo,sn,ic_v,any_center(e),format_element,is_https, action_count, head_tags), |
|
|
4910
|
+ format(cinfo,ic_v,any_center(e),format_element,is_https, action_count, head_tags), |
|
4439
|
4911
|
mail_to(a,e) then |
|
4440
|
|
- format(cinfo,sn,ic_v,any_mail_to(a,e),format_element,is_https, action_count, head_tags), |
|
|
4912
|
+ format(cinfo,ic_v,any_mail_to(a,e),format_element,is_https, action_count, head_tags), |
|
4441
|
4913
|
scroller(w,h,cw,ch,c) then |
|
4442
|
|
- format(cinfo,sn,ic_v,any_scroller(w,h,cw,ch,c),format_element,is_https, action_count, head_tags), |
|
|
4914
|
+ format(cinfo,ic_v,any_scroller(w,h,cw,ch,c),format_element,is_https, action_count, head_tags), |
|
4443
|
4915
|
actioner(c,t,a,an,eo,ja) then |
|
4444
|
|
- format(cinfo,sn,ic_v,any_actioner(c,t,a,an,eo,ja,success(fn)),format_element,is_https, action_count, head_tags), |
|
|
4916
|
+ format(cinfo,ic_v,any_actioner(c,t,a,an,eo,ja,success(fn)),format_element,is_https, action_count, head_tags), |
|
4445
|
4917
|
|
|
4446
|
4918
|
foreign_link_new(target, aspect, url) then |
|
4447
|
|
- format(cinfo,sn,ic_v,any_foreign_link_new(target,aspect,url),format_element,is_https, action_count, head_tags), |
|
|
4919
|
+ format(cinfo,ic_v,any_foreign_link_new(target,aspect,url),format_element,is_https, action_count, head_tags), |
|
4448
|
4920
|
|
|
4449
|
4921
|
foreign_link(options,url) then |
|
4450
|
|
- format(cinfo,sn,ic_v,any_foreign_link(options,url),format_element,is_https, action_count, head_tags), |
|
|
4922
|
+ format(cinfo,ic_v,any_foreign_link(options,url),format_element,is_https, action_count, head_tags), |
|
4451
|
4923
|
foreign_link(options,url,name) then |
|
4452
|
|
- format(cinfo,sn,ic_v,any_foreign_link(options,url,name),format_element,is_https, action_count, head_tags), |
|
|
4924
|
+ format(cinfo,ic_v,any_foreign_link(options,url,name),format_element,is_https, action_count, head_tags), |
|
4453
|
4925
|
private_download(url,name,extra,action) then |
|
4454
|
|
- format(cinfo,sn,ic_v,any_private_download(url,name,extra,action),format_element,is_https, action_count, head_tags), |
|
|
4926
|
+ format(cinfo,ic_v,any_private_download(url,name,extra,action),format_element,is_https, action_count, head_tags), |
|
4455
|
4927
|
text_input(options, label_text, id, name, i, w) then |
|
4456
|
4928
|
[ format_label(label_text, id), |
|
4457
|
4929
|
"<input type=\"text\" name=\"",name,"\" id=\"",id,"\" size=\"",w,"\" value=\"",i,"\"",format_attrs([class("in") . options])," />"], |
|
...
|
...
|
@@ -4492,9 +4964,9 @@ define Printable_tree |
|
4492
|
4964
|
[ "<input type=\"checkbox\" name=\"",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\" " else ""),format_attrs([class("in") . options])," />", |
|
4493
|
4965
|
format_label(label, id)] |
|
4494
|
4966
|
div(options, e) then |
|
4495
|
|
- format(cinfo,sn,ic_v,any_div(options, e),format_element,is_https, action_count, head_tags), |
|
|
4967
|
+ format(cinfo,ic_v,any_div(options, e),format_element,is_https, action_count, head_tags), |
|
4496
|
4968
|
div_empty(options) then |
|
4497
|
|
- format(cinfo,sn,ic_v,any_div_empty(options),format_element,is_https, action_count, head_tags), |
|
|
4969
|
+ format(cinfo,ic_v,any_div_empty(options),format_element,is_https, action_count, head_tags), |
|
4498
|
4970
|
hidden(_id, name, value) then |
|
4499
|
4971
|
since _id is html_Id(id), |
|
4500
|
4972
|
["<input type=\"hidden\"",(if id = "" then "" else " id=\""+id+"\"")," name=\"",name,"\" value=\"",value,"\" />"], |
|
...
|
...
|
@@ -4502,17 +4974,17 @@ define Printable_tree |
|
4502
|
4974
|
if p_content is partial_content(tags, html_elements) then |
|
4503
|
4975
|
head_tags <- *head_tags + tags; |
|
4504
|
4976
|
|
|
4505
|
|
- format(cinfo, sn, ic_v, html_elements, is_https, action_count, head_tags), |
|
|
4977
|
+ format(cinfo, ic_v, html_elements, is_https, action_count, head_tags), |
|
4506
|
4978
|
br then ["<br>"], |
|
4507
|
4979
|
progress(options, value, max) then ["<progress max=\"",value,"\" value=\"",max,"\"",format_attrs(options),"></progress>"], |
|
4508
|
4980
|
ol(opts, t) then |
|
4509
|
|
- format(cinfo,sn,ic_v,any_ol(opts,t),format_element,is_https, action_count, head_tags), |
|
|
4981
|
+ format(cinfo,ic_v,any_ol(opts,t),format_element,is_https, action_count, head_tags), |
|
4510
|
4982
|
ul(opts, t) then |
|
4511
|
|
- format(cinfo,sn,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), |
|
|
4983
|
+ format(cinfo,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), |
|
4512
|
4984
|
li(opts, t) then |
|
4513
|
|
- format(cinfo,sn,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), |
|
|
4985
|
+ format(cinfo,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), |
|
4514
|
4986
|
button(options, e) then |
|
4515
|
|
- format(cinfo,sn,ic_v,any_button(options, e),format_element,is_https, action_count, head_tags), |
|
|
4987
|
+ format(cinfo,ic_v,any_button(options, e),format_element,is_https, action_count, head_tags), |
|
4516
|
4988
|
}. |
|
4517
|
4989
|
|
|
4518
|
4990
|
|
|
...
|
...
|
@@ -4618,7 +5090,6 @@ define Printable_tree |
|
4618
|
5090
|
format |
|
4619
|
5091
|
( |
|
4620
|
5092
|
CommonInfo cinfo, |
|
4621
|
|
- String sn, // state_name |
|
4622
|
5093
|
Var(Int) ic_v, // 'idnum' counter variable |
|
4623
|
5094
|
HTML_Off_Form element, |
|
4624
|
5095
|
Bool is_https, |
|
...
|
...
|
@@ -4626,7 +5097,7 @@ define Printable_tree |
|
4626
|
5097
|
Var(List(HTML_Head_Tag)) head_tags |
|
4627
|
5098
|
) = |
|
4628
|
5099
|
if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
|
4629
|
|
- with format_element = (HTML_Off_Form e) |-> format(cinfo, sn, ic_v, e, is_https, action_count, head_tags), |
|
|
5100
|
+ with format_element = (HTML_Off_Form e) |-> format(cinfo, ic_v, e, is_https, action_count, head_tags), |
|
4630
|
5101
|
if element is |
|
4631
|
5102
|
{ |
|
4632
|
5103
|
empty then [], |
|
...
|
...
|
@@ -4634,44 +5105,44 @@ define Printable_tree |
|
4634
|
5105
|
literal(t) then [t], |
|
4635
|
5106
|
sequence(l) then flat(map(format_element,l)), |
|
4636
|
5107
|
text(opts,t) then |
|
4637
|
|
- format(cinfo,sn,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags), |
|
|
5108
|
+ format(cinfo,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags), |
|
4638
|
5109
|
preformated(o,s) then |
|
4639
|
|
- format(cinfo,sn,ic_v,any_preformated(o,s),format_element,is_https, action_count, head_tags), |
|
|
5110
|
+ format(cinfo,ic_v,any_preformated(o,s),format_element,is_https, action_count, head_tags), |
|
4640
|
5111
|
paragraph(opts,t) then |
|
4641
|
|
- format(cinfo,sn,ic_v,any_paragraph(opts,t),format_element,is_https, action_count, head_tags), |
|
|
5112
|
+ format(cinfo,ic_v,any_paragraph(opts,t),format_element,is_https, action_count, head_tags), |
|
4642
|
5113
|
image(opts,url,alt) then |
|
4643
|
|
- format(cinfo,sn,ic_v,any_image(opts,url,alt),format_element,is_https, action_count, head_tags), |
|
|
5114
|
+ format(cinfo,ic_v,any_image(opts,url,alt),format_element,is_https, action_count, head_tags), |
|
4644
|
5115
|
image(opts,url,alt,w,h) then |
|
4645
|
|
- format(cinfo,sn,ic_v,any_image(opts,url,alt,w,h),format_element,is_https, action_count, head_tags), |
|
|
5116
|
+ format(cinfo,ic_v,any_image(opts,url,alt,w,h),format_element,is_https, action_count, head_tags), |
|
4646
|
5117
|
table(opts,header_row, rows, footer_row) then |
|
4647
|
|
- format(cinfo,sn,ic_v,any_table(opts,header_row, rows, footer_row),format_element,is_https, action_count, head_tags), |
|
|
5118
|
+ format(cinfo,ic_v,any_table(opts,header_row, rows, footer_row),format_element,is_https, action_count, head_tags), |
|
4648
|
5119
|
center(e) then |
|
4649
|
|
- format(cinfo,sn,ic_v,any_center(e),format_element,is_https, action_count, head_tags), |
|
|
5120
|
+ format(cinfo,ic_v,any_center(e),format_element,is_https, action_count, head_tags), |
|
4650
|
5121
|
mail_to(a,e) then |
|
4651
|
|
- format(cinfo,sn,ic_v,any_mail_to(a,e),format_element,is_https, action_count, head_tags), |
|
|
5122
|
+ format(cinfo,ic_v,any_mail_to(a,e),format_element,is_https, action_count, head_tags), |
|
4652
|
5123
|
scroller(w,h,cw,ch,c) then |
|
4653
|
|
- format(cinfo,sn,ic_v,any_scroller(w,h,cw,ch,c),format_element,is_https, action_count, head_tags), |
|
|
5124
|
+ format(cinfo,ic_v,any_scroller(w,h,cw,ch,c),format_element,is_https, action_count, head_tags), |
|
4654
|
5125
|
fixed_size(w,h,c) then |
|
4655
|
|
- format(cinfo,sn,ic_v,any_fixed_size(w,h,c),format_element,is_https, action_count, head_tags), |
|
|
5126
|
+ format(cinfo,ic_v,any_fixed_size(w,h,c),format_element,is_https, action_count, head_tags), |
|
4656
|
5127
|
fixed_size_2(w,h,fn) then |
|
4657
|
|
- format(cinfo,sn,ic_v,any_fixed_size_2(w,h,fn),format_element,is_https, action_count, head_tags), |
|
|
5128
|
+ format(cinfo,ic_v,any_fixed_size_2(w,h,fn),format_element,is_https, action_count, head_tags), |
|
4658
|
5129
|
actioner(c,t,a,an,eo,ja) then |
|
4659
|
|
- format(cinfo,sn,ic_v,any_actioner(c,t,a,an,eo,ja,failure),format_element,is_https, action_count, head_tags), |
|
|
5130
|
+ format(cinfo,ic_v,any_actioner(c,t,a,an,eo,ja,failure),format_element,is_https, action_count, head_tags), |
|
4660
|
5131
|
actioner(c,t,a,an,eo,ja,fn) then |
|
4661
|
|
- format(cinfo,sn,ic_v,any_actioner(c,t,a,an,eo,ja,success(fn)),format_element,is_https, action_count, head_tags), |
|
|
5132
|
+ format(cinfo,ic_v,any_actioner(c,t,a,an,eo,ja,success(fn)),format_element,is_https, action_count, head_tags), |
|
4662
|
5133
|
foreign_link_new(target, aspect, url) then |
|
4663
|
|
- format(cinfo,sn,ic_v,any_foreign_link_new(target,aspect,url),format_element,is_https, action_count, head_tags), |
|
|
5134
|
+ format(cinfo,ic_v,any_foreign_link_new(target,aspect,url),format_element,is_https, action_count, head_tags), |
|
4664
|
5135
|
foreign_link(options,url) then |
|
4665
|
|
- format(cinfo,sn,ic_v,any_foreign_link(options,url),format_element,is_https, action_count, head_tags), |
|
|
5136
|
+ format(cinfo,ic_v,any_foreign_link(options,url),format_element,is_https, action_count, head_tags), |
|
4666
|
5137
|
foreign_link(options,url,name) then |
|
4667
|
|
- format(cinfo,sn,ic_v,any_foreign_link(options,url,name),format_element,is_https, action_count, head_tags), |
|
|
5138
|
+ format(cinfo,ic_v,any_foreign_link(options,url,name),format_element,is_https, action_count, head_tags), |
|
4668
|
5139
|
private_download(url,name,extra,action) then |
|
4669
|
|
- format(cinfo,sn,ic_v,any_private_download(url,name,extra,action),format_element,is_https, action_count, head_tags), |
|
|
5140
|
+ format(cinfo,ic_v,any_private_download(url,name,extra,action),format_element,is_https, action_count, head_tags), |
|
4670
|
5141
|
label(n) then ["<a name=\"",n,"\">"], |
|
4671
|
5142
|
form(fn,attributs, c) then |
|
4672
|
5143
|
[ |
|
4673
|
5144
|
"<form id=\"",fn,"\"", |
|
4674
|
|
- format(cinfo,sn,ic_v,any_coreattrs(attributs),format_element,is_https, action_count, head_tags), |
|
|
5145
|
+ format(cinfo,ic_v,any_coreattrs(attributs),format_element,is_https, action_count, head_tags), |
|
4675
|
5146
|
" method=\"post\"", |
|
4676
|
5147
|
enctype(c), |
|
4677
|
5148
|
" action=\"http", |
|
...
|
...
|
@@ -4680,15 +5151,15 @@ define Printable_tree |
|
4680
|
5151
|
// action is set dynamically by |
|
4681
|
5152
|
// the actioner using JavaScript |
|
4682
|
5153
|
if fn is html_Id(id) then |
|
4683
|
|
- format(cinfo,id,sn,ic_v,c,is_https, action_count, head_tags), |
|
|
5154
|
+ format(cinfo,id,ic_v,c,is_https, action_count, head_tags), |
|
4684
|
5155
|
"</form>" |
|
4685
|
5156
|
] |
|
4686
|
|
- form(fn,attributs, action_name, extra_ops, c) then |
|
|
5157
|
+ form(fn,attributs, action, extra_ops, c) then |
|
4687
|
5158
|
with url = make_actioner_url(cinfo, same, same, |
|
4688
|
|
- sn, action_name, extra_ops, is_https), |
|
|
5159
|
+ action, extra_ops, is_https), |
|
4689
|
5160
|
[ |
|
4690
|
5161
|
"<form id=\"",fn,"\"", |
|
4691
|
|
- format(cinfo,sn,ic_v,any_coreattrs(attributs),format_element,is_https, action_count, head_tags), |
|
|
5162
|
+ format(cinfo,ic_v,any_coreattrs(attributs),format_element,is_https, action_count, head_tags), |
|
4692
|
5163
|
" method=\"post\"", |
|
4693
|
5164
|
enctype(c), |
|
4694
|
5165
|
" action=\"" + url + "\">", |
|
...
|
...
|
@@ -4698,20 +5169,20 @@ define Printable_tree |
|
4698
|
5169
|
// action is set dynamically by |
|
4699
|
5170
|
// the actioner using JavaScript |
|
4700
|
5171
|
if fn is html_Id(id) then |
|
4701
|
|
- format(cinfo,id,sn,ic_v,c,is_https, action_count, head_tags), |
|
|
5172
|
+ format(cinfo,id,ic_v,c,is_https, action_count, head_tags), |
|
4702
|
5173
|
"</form>" |
|
4703
|
5174
|
], |
|
4704
|
5175
|
in_form(fn, content) then |
|
4705
|
5176
|
if fn is html_Id(id) then |
|
4706
|
|
- format(cinfo,id,sn,ic_v, content,is_https, action_count, head_tags), |
|
|
5177
|
+ format(cinfo,id,ic_v, content,is_https, action_count, head_tags), |
|
4707
|
5178
|
div(options, e) then |
|
4708
|
|
- format(cinfo, sn, ic_v, any_div(options, e), format_element, is_https, action_count, head_tags), |
|
|
5179
|
+ format(cinfo, ic_v, any_div(options, e), format_element, is_https, action_count, head_tags), |
|
4709
|
5180
|
div(options, p_content) then |
|
4710
|
5181
|
if p_content is partial_content(tags, html_elements) then |
|
4711
|
5182
|
head_tags <- *head_tags +tags; |
|
4712
|
|
- format(cinfo, sn, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags), |
|
|
5183
|
+ format(cinfo, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags), |
|
4713
|
5184
|
div_empty(options) then |
|
4714
|
|
- format(cinfo, sn, ic_v, any_div_empty(options), format_element, is_https, action_count, head_tags), |
|
|
5185
|
+ format(cinfo, ic_v, any_div_empty(options), format_element, is_https, action_count, head_tags), |
|
4715
|
5186
|
iframe(options, css_styles, css_files, js_files, body) then |
|
4716
|
5187
|
if body is body(body_options,elem) then |
|
4717
|
5188
|
[ "<iframe", format_attrs(options), ">\n", |
|
...
|
...
|
@@ -4722,7 +5193,7 @@ define Printable_tree |
|
4722
|
5193
|
add_js_files(js_files), |
|
4723
|
5194
|
"</head>\n", |
|
4724
|
5195
|
"<body ", format(body_options), ">\n", // format body options |
|
4725
|
|
- format(cinfo,sn,ic_v,elem,is_https, action_count, head_tags), |
|
|
5196
|
+ format(cinfo,ic_v,elem,is_https, action_count, head_tags), |
|
4726
|
5197
|
"</body>\n", |
|
4727
|
5198
|
"</html>\n", |
|
4728
|
5199
|
"</iframe>\n", |
|
...
|
...
|
@@ -4730,17 +5201,17 @@ define Printable_tree |
|
4730
|
5201
|
partial(p_content) then |
|
4731
|
5202
|
if p_content is partial_content(tags, html_elements) then |
|
4732
|
5203
|
head_tags <- *head_tags + tags; |
|
4733
|
|
- format(cinfo, sn, ic_v, html_elements, is_https, action_count, head_tags), |
|
|
5204
|
+ format(cinfo, ic_v, html_elements, is_https, action_count, head_tags), |
|
4734
|
5205
|
br then ["<br>"], |
|
4735
|
5206
|
progress(options, value, max) then ["<progress max=\"",value,"\" value=\"",max,"\"",format_attrs(options),"></progress>"], |
|
4736
|
5207
|
ol(opts, t) then |
|
4737
|
|
- format(cinfo,sn,ic_v,any_ol(opts,t),format_element,is_https, action_count, head_tags), |
|
|
5208
|
+ format(cinfo,ic_v,any_ol(opts,t),format_element,is_https, action_count, head_tags), |
|
4738
|
5209
|
ul(opts, t) then |
|
4739
|
|
- format(cinfo,sn,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), |
|
|
5210
|
+ format(cinfo,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), |
|
4740
|
5211
|
li(opts, t) then |
|
4741
|
|
- format(cinfo,sn,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), |
|
|
5212
|
+ format(cinfo,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), |
|
4742
|
5213
|
button(options, e) then |
|
4743
|
|
- format(cinfo, sn, ic_v, any_button(options, e), format_element, is_https, action_count, head_tags), |
|
|
5214
|
+ format(cinfo, ic_v, any_button(options, e), format_element, is_https, action_count, head_tags), |
|
4744
|
5215
|
}. |
|
4745
|
5216
|
|
|
4746
|
5217
|
|
|
...
|
...
|
@@ -4763,29 +5234,29 @@ define Printable_tree |
|
4763
|
5234
|
|
|
4764
|
5235
|
|
|
4765
|
5236
|
define Printable_tree |
|
4766
|
|
- format |
|
4767
|
|
- ( |
|
4768
|
|
- CommonInfo cinfo, |
|
4769
|
|
- String state_name, |
|
4770
|
|
- HTML_Meta m, |
|
4771
|
|
- Bool is_https |
|
4772
|
|
- ) = |
|
4773
|
|
- if m is |
|
4774
|
|
- { |
|
4775
|
|
- keywords(l) then ["<meta name=\"keywords\" content=\"",format_keywords(l),"\" />\n"], |
|
4776
|
|
- refresh(co,ta,an,delay) then |
|
|
5237
|
+ format |
|
|
5238
|
+ ( |
|
|
5239
|
+ CommonInfo cinfo, |
|
|
5240
|
+ HTML_Meta m, |
|
|
5241
|
+ Bool is_https |
|
|
5242
|
+ ) = |
|
|
5243
|
+ if m is |
|
|
5244
|
+ { |
|
|
5245
|
+ keywords(l) then ["<meta name=\"keywords\" content=\"",format_keywords(l),"\" />\n"], |
|
|
5246
|
+ refresh(co,ta,an,delay) then |
|
4777
|
5247
|
["<meta http-equiv=\"Refresh\" content=\"",delay,"; URL=", |
|
4778
|
|
- make_actioner_url(cinfo,co,ta,state_name,an,[],is_https),"\" />\n"], |
|
4779
|
|
- refresh(url,delay) then |
|
|
5248
|
+ make_actioner_url(cinfo,co,ta,an,[],is_https),"\" />\n"], |
|
|
5249
|
+ refresh(url,delay) then |
|
4780
|
5250
|
["<meta http-equiv=\"Refresh\" content=\"",delay,"; URL=",url,"\" />\n"], |
|
4781
|
|
- meta(n,c) then ["<meta name=\"",n,"\" content=\"",c,"\" />\n"], |
|
4782
|
|
- http_equiv(n,c) then ["<meta http-equiv=\"",n,"\" content=\"",c,"\" />\n"], |
|
4783
|
|
- generic_meta(l) then ["<meta ", |
|
|
5251
|
+ meta(n,c) then ["<meta name=\"",n,"\" content=\"",c,"\" />\n"], |
|
|
5252
|
+ http_equiv(n,c) then ["<meta http-equiv=\"",n,"\" content=\"",c,"\" />\n"], |
|
|
5253
|
+ generic_meta(l) then ["<meta ", |
|
4784
|
5254
|
flat(map(((String,String) p) |-> if p is (n,v) then [n,"=\"",v,"\" "], |
|
4785
|
5255
|
l)), |
|
4786
|
5256
|
" />\n"], |
|
4787
|
|
- literal(s) then [s] |
|
4788
|
|
- }. |
|
|
5257
|
+ literal(s) then [s] |
|
|
5258
|
+ } |
|
|
5259
|
+. |
|
4789
|
5260
|
|
|
4790
|
5261
|
define Printable_tree // c'est le nôtre et c'est meilleur |
|
4791
|
5262
|
format |
|
...
|
...
|
@@ -4812,18 +5283,17 @@ define Printable_tree // c'est le nôtre et c'est meilleur |
|
4812
|
5283
|
define Printable_tree |
|
4813
|
5284
|
format |
|
4814
|
5285
|
( |
|
4815
|
|
- CommonInfo cinfo, |
|
4816
|
|
- String state_name, |
|
|
5286
|
+ CommonInfo cinfo, |
|
4817
|
5287
|
List(HTML_Meta) metas, |
|
4818
|
5288
|
Bool is_https, |
|
4819
|
5289
|
String charset |
|
4820
|
5290
|
) = |
|
4821
|
5291
|
if metas is |
|
4822
|
5292
|
{ |
|
4823
|
|
- [] then [format(cinfo,state_name,http_equiv("content-type", |
|
|
5293
|
+ [] then [format(cinfo,http_equiv("content-type", |
|
4824
|
5294
|
"text/html; charset="+charset),is_https)], |
|
4825
|
|
- [h . t] then [format(cinfo,state_name,h,is_https) |
|
4826
|
|
- . format(cinfo,state_name,t,is_https,charset)] |
|
|
5295
|
+ [h . t] then [format(cinfo,h,is_https) |
|
|
5296
|
+ . format(cinfo,t,is_https,charset)] |
|
4827
|
5297
|
}. |
|
4828
|
5298
|
|
|
4829
|
5299
|
define List(HTML_Head_Tag) |
|
...
|
...
|
@@ -4932,33 +5402,26 @@ public define HTML_ajax_content |
|
4932
|
5402
|
to_html_ajax_content |
|
4933
|
5403
|
( |
|
4934
|
5404
|
HTML_Off_Form content_HTML, |
|
4935
|
|
- CommonInfo cinfo, |
|
4936
|
|
- String state_name |
|
|
5405
|
+ CommonInfo cinfo |
|
4937
|
5406
|
)= |
|
4938
|
5407
|
with p_content_head_tags = var((List(HTML_Head_Tag))[]), |
|
4939
|
|
- with content = format(cinfo, state_name, var((Int)0), content_HTML, false, var(0), p_content_head_tags), |
|
|
5408
|
+ with content = format(cinfo, var((Int)0), content_HTML, false, var(0), p_content_head_tags), |
|
4940
|
5409
|
if sort_head_tag(*p_content_head_tags, "", [], []) is html_ajax_content(_, script, js_file, css_file) then |
|
4941
|
5410
|
html_ajax_content(to_String(content), script, js_file, css_file). |
|
4942
|
5411
|
|
|
4943
|
|
-public define HTML_ajax_content |
|
4944
|
|
- to_html_ajax_content |
|
4945
|
|
- ( |
|
4946
|
|
- HTML_Off_Form content_HTML, |
|
4947
|
|
- CommonInfo cinfo |
|
4948
|
|
- )= to_html_ajax_content(content_HTML, cinfo, ""). |
|
4949
|
5412
|
|
|
4950
|
5413
|
public define HTML_ajax_content |
|
4951
|
5414
|
to_html_ajax_content |
|
4952
|
5415
|
( |
|
4953
|
5416
|
HTML_Partial_Content content_HTML, |
|
4954
|
5417
|
CommonInfo cinfo |
|
4955
|
|
- )= to_html_ajax_content(partial(content_HTML), cinfo, ""). |
|
|
5418
|
+ )= to_html_ajax_content(partial(content_HTML), cinfo). |
|
4956
|
5419
|
|
|
4957
|
5420
|
public define Printable_tree |
|
4958
|
5421
|
format |
|
4959
|
5422
|
( |
|
4960
|
5423
|
CommonInfo cinfo, |
|
4961
|
|
- String state_name, |
|
|
5424
|
+ //String state_name, |
|
4962
|
5425
|
List(HTTP_header) additional_headers, |
|
4963
|
5426
|
HTTP_Answer page, |
|
4964
|
5427
|
Bool is_https, |
|
...
|
...
|
@@ -4975,7 +5438,7 @@ public define Printable_tree |
|
4975
|
5438
|
with |
|
4976
|
5439
|
answer_body_body = (Printable_tree) |
|
4977
|
5440
|
[ "<body ", format(options), ">", // format body options |
|
4978
|
|
- format(cinfo,state_name,ic_v,element,is_https, var(0), p_content_head_tags), |
|
|
5441
|
+ format(cinfo,ic_v,element,is_https, var(0), p_content_head_tags), |
|
4979
|
5442
|
"</body>\n", |
|
4980
|
5443
|
|
|
4981
|
5444
|
"</html>"], |
|
...
|
...
|
@@ -4998,7 +5461,14 @@ public define Printable_tree |
|
4998
|
5461
|
html_page(status, title, metas, css_styles, css_files, js_files, script, body) then |
|
4999
|
5462
|
if body is body(options,element) then |
|
5000
|
5463
|
if format(status) is (status_string, status_headers) then |
|
5001
|
|
- with answer_body = |
|
|
5464
|
+ with |
|
|
5465
|
+ answer_body_body = (Printable_tree) |
|
|
5466
|
+ [ "<body ", format(options), ">", // format body options |
|
|
5467
|
+ format(cinfo,ic_v,element,is_https, var(0), p_content_head_tags), |
|
|
5468
|
+ "</body>\n", |
|
|
5469
|
+ "</html>" |
|
|
5470
|
+ ], |
|
|
5471
|
+ answer_body_header = |
|
5002
|
5472
|
[ doctype_w3c_header, |
|
5003
|
5473
|
//html_header, |
|
5004
|
5474
|
"<head>\n", |
|
...
|
...
|
@@ -5019,22 +5489,19 @@ public define Printable_tree |
|
5019
|
5489
|
" { s[0]=0; d.style.visibility = 'hidden'; }; }", |
|
5020
|
5490
|
"</script>\n", |
|
5021
|
5491
|
"<title>",title,"</title>\n", // put title |
|
5022
|
|
- format(cinfo,state_name,metas,is_https,charset), // format the metas |
|
5023
|
|
- "</head>\n", |
|
5024
|
|
- "<body ", format(options), ">", // format body options |
|
5025
|
|
- //"<center>", |
|
5026
|
|
- format(cinfo,state_name,ic_v,element,is_https, var(0), p_content_head_tags), |
|
5027
|
|
- //"</center>", |
|
5028
|
|
- "</body>\n", |
|
5029
|
|
- "</html>" |
|
5030
|
|
- ], |
|
|
5492
|
+ format(cinfo,metas,is_https,charset), // format the metas |
|
|
5493
|
+ format_html_head(*p_content_head_tags, charset), |
|
|
5494
|
+ "</head>\n" |
|
|
5495
|
+ ], |
|
|
5496
|
+ |
|
5031
|
5497
|
[ "HTTP/1.1 " + status_string, crlf, |
|
5032
|
5498
|
format_headers(standard_headers), |
|
5033
|
|
- format_headers(standard_headers_for("text/html", length(answer_body), success(charset))), |
|
|
5499
|
+ format_headers(standard_headers_for("text/html", length(answer_body_header) + length(answer_body_body), success(charset))), |
|
5034
|
5500
|
format_headers(status_headers), |
|
5035
|
5501
|
format_headers(additional_headers), |
|
5036
|
|
- crlf |
|
5037
|
|
- . answer_body |
|
|
5502
|
+ crlf, |
|
|
5503
|
+ answer_body_header . |
|
|
5504
|
+ answer_body_body |
|
5038
|
5505
|
], |
|
5039
|
5506
|
|
|
5040
|
5507
|
plain_text (HTTP_Status status, String text) then |
|
...
|
...
|
@@ -5097,7 +5564,7 @@ public define Printable_tree |
|
5097
|
5564
|
|
|
5098
|
5565
|
html_content(HTTP_Status status, HTML_Off_Form content_HTML) then |
|
5099
|
5566
|
if format(status) is (status_string, status_headers) then |
|
5100
|
|
- with content = format(cinfo, state_name, ic_v, content_HTML, is_https, var(0), p_content_head_tags), |
|
|
5567
|
+ with content = format(cinfo, ic_v, content_HTML, is_https, var(0), p_content_head_tags), |
|
5101
|
5568
|
[ "HTTP/1.1 " + status_string, crlf, |
|
5102
|
5569
|
format_headers(standard_headers), |
|
5103
|
5570
|
format_headers(standard_headers_for("text/html", length(content), success(charset))), |
|
...
|
...
|
@@ -5114,7 +5581,7 @@ public define Printable_tree |
|
5114
|
5581
|
with |
|
5115
|
5582
|
answer_body = (Printable_tree) |
|
5116
|
5583
|
[ |
|
5117
|
|
- format(cinfo, state_name, ic_v, html_content, is_https, var(0), p_content_head_tags), |
|
|
5584
|
+ format(cinfo, ic_v, html_content, is_https, var(0), p_content_head_tags), |
|
5118
|
5585
|
], |
|
5119
|
5586
|
answer_header = (Printable_tree) |
|
5120
|
5587
|
[ |
...
|
...
|
|