Commit 8fcf167e257f3f858ece91523697ee609600b31e
1 parent
8dc27220
[*] BIG CHANGE. Maybe that xlib will become 2.0
Removed all HTML_In_Form, HTML_Off_Form, HTML_Partial_Content type and replaced it by the new type HTML. Update all library according to that change. [-] removed the generic_form.anubis and generic_table.anubis which was obsolete.
Showing
49 changed files
with
9506 additions
and
4157 deletions
Show diff stats
generic/types/stepper.anubis
| 1 | + | |
| 2 | +Microsoft Visual Studio Solution File, Format Version 9.00 | |
| 3 | +# Visual Studio 2005 | |
| 4 | +# SharpDevelop 1.0.12.108 | |
| 5 | +Project("{B6712916-30DE-4a3e-A54C-2A79AC984AEE}") = "minimal_web_site", "minimal_web_site.aproj", "{F2C65267-0D20-4964-A5D8-602BD42C01A4}" | |
| 6 | +EndProject | |
| 7 | +Global | |
| 8 | + GlobalSection(SolutionConfigurationPlatforms) = preSolution | |
| 9 | + Debug|Any CPU = Debug|Any CPU | |
| 10 | + Release|Any CPU = Release|Any CPU | |
| 11 | + EndGlobalSection | |
| 12 | + GlobalSection(ProjectConfigurationPlatforms) = postSolution | |
| 13 | + {F2C65267-0D20-4964-A5D8-602BD42C01A4}.Debug|Any CPU.Build.0 = Debug|Any CPU | |
| 14 | + {F2C65267-0D20-4964-A5D8-602BD42C01A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |
| 15 | + {F2C65267-0D20-4964-A5D8-602BD42C01A4}.Release|Any CPU.Build.0 = Release|Any CPU | |
| 16 | + {F2C65267-0D20-4964-A5D8-602BD42C01A4}.Release|Any CPU.ActiveCfg = Release|Any CPU | |
| 17 | + EndGlobalSection | |
| 18 | +EndGlobal | ... | ... |
web/controllers_web_site.anubis
| ... | ... | @@ -127,7 +127,7 @@ public type WEB_Page_Renderer: |
| 127 | 127 | web_page_renderer( |
| 128 | 128 | String app, //application |
| 129 | 129 | String name, //renderer name |
| 130 | - (WEB_Session _session, List(WEB_Plugin), HTML_Partial_Content _content) -> HTTP_Answer page_layout //call back for rendering page | |
| 130 | + (WEB_Session _session, List(WEB_Plugin), HTML _content) -> HTTP_Answer page_layout //call back for rendering page | |
| 131 | 131 | ) |
| 132 | 132 | . |
| 133 | 133 | |
| ... | ... | @@ -156,7 +156,7 @@ define HTTP_Answer |
| 156 | 156 | pre("Error "+to_String(http_status)), |
| 157 | 157 | pre("Internal message :"+message), |
| 158 | 158 | br, |
| 159 | - in_form(html_Id(""),text_area(wan(""), init(dump(_session)), 120, 60)) | |
| 159 | + textarea(120, 60, text(dump(_session))) | |
| 160 | 160 | ]) |
| 161 | 161 | ) |
| 162 | 162 | ) |
| ... | ... | @@ -183,14 +183,14 @@ public define WEB_Controller_Result |
| 183 | 183 | public define WEB_Controller_Result |
| 184 | 184 | ajax |
| 185 | 185 | ( |
| 186 | - HTML_Partial_Content content | |
| 186 | + HTML content | |
| 187 | 187 | )= |
| 188 | 188 | ajax(failure, content, ""). |
| 189 | 189 | |
| 190 | 190 | public define WEB_Controller_Result |
| 191 | 191 | ajax |
| 192 | 192 | ( |
| 193 | - HTML_Partial_Content content, | |
| 193 | + HTML content, | |
| 194 | 194 | String additional_script |
| 195 | 195 | )= |
| 196 | 196 | ajax(failure, content, additional_script). |
| ... | ... | @@ -199,7 +199,7 @@ public define WEB_Controller_Result |
| 199 | 199 | ajax |
| 200 | 200 | ( |
| 201 | 201 | WEB_Session session, //modified session |
| 202 | - HTML_Partial_Content content | |
| 202 | + HTML content | |
| 203 | 203 | )= |
| 204 | 204 | ajax(success(session), content, ""). |
| 205 | 205 | |
| ... | ... | @@ -207,7 +207,7 @@ public define WEB_Controller_Result |
| 207 | 207 | ajax |
| 208 | 208 | ( |
| 209 | 209 | WEB_Session session, //modified session |
| 210 | - HTML_Partial_Content content, | |
| 210 | + HTML content, | |
| 211 | 211 | String additional_script |
| 212 | 212 | )= |
| 213 | 213 | ajax(success(session), content, additional_script). |
| ... | ... | @@ -246,7 +246,7 @@ public define WEB_Controller_Result |
| 246 | 246 | |
| 247 | 247 | public define WEB_Controller_Result |
| 248 | 248 | renderer_content( |
| 249 | - HTML_Partial_Content content, | |
| 249 | + HTML content, | |
| 250 | 250 | )= |
| 251 | 251 | renderer_content(failure, content) |
| 252 | 252 | . |
| ... | ... | @@ -254,7 +254,7 @@ public define WEB_Controller_Result |
| 254 | 254 | public define WEB_Controller_Result |
| 255 | 255 | renderer_content( |
| 256 | 256 | WEB_Session session, //modified session if success else failure |
| 257 | - HTML_Partial_Content content, | |
| 257 | + HTML content, | |
| 258 | 258 | )= |
| 259 | 259 | renderer_content(success(session), content) |
| 260 | 260 | . |
| ... | ... | @@ -262,7 +262,7 @@ public define WEB_Controller_Result |
| 262 | 262 | public define WEB_Controller_Result |
| 263 | 263 | partial_content |
| 264 | 264 | ( |
| 265 | - HTML_Partial_Content content, | |
| 265 | + HTML content, | |
| 266 | 266 | )= |
| 267 | 267 | http_answer(html_page( |
| 268 | 268 | "", // title of web site |
| ... | ... | @@ -273,7 +273,7 @@ public define WEB_Controller_Result |
| 273 | 273 | [], |
| 274 | 274 | |
| 275 | 275 | // content of page |
| 276 | - partial(content) | |
| 276 | + content | |
| 277 | 277 | )) |
| 278 | 278 | ) |
| 279 | 279 | . |
| ... | ... | @@ -285,7 +285,7 @@ define WEB_Page_Renderer |
| 285 | 285 | web_page_renderer("AWS", "AWS_DEFAULT_PAGE", |
| 286 | 286 | ( WEB_Session _session, |
| 287 | 287 | List(WEB_Plugin) _plugins, |
| 288 | - HTML_Partial_Content _content | |
| 288 | + HTML _content | |
| 289 | 289 | ) |-> |
| 290 | 290 | with _title = get_page_title(_session), |
| 291 | 291 | html_page |
| ... | ... | @@ -296,7 +296,7 @@ define WEB_Page_Renderer |
| 296 | 296 | body // body of page |
| 297 | 297 | ( |
| 298 | 298 | [], //body options empty |
| 299 | - (HTML_Off_Form)partial(_content) | |
| 299 | + _content | |
| 300 | 300 | ) |
| 301 | 301 | ) |
| 302 | 302 | ) |
| ... | ... | @@ -430,8 +430,8 @@ define WEB_Page_Renderer |
| 430 | 430 | } |
| 431 | 431 | . |
| 432 | 432 | |
| 433 | -public define JsonValue to_html_ajax_content(Printable_tree content_HTML, String additional_script). | |
| 434 | -public define JsonValue to_html_ajax_content(HTML_Partial_Content content_HTML, CommonInfo cinfo, String additional_script). | |
| 433 | +public define JsonValue to_html_ajax_content(Printable_tree content_HTML, String additional_script). | |
| 434 | +public define JsonValue to_html_ajax_content(HTML content_HTML, CommonInfo cinfo, String additional_script). | |
| 435 | 435 | |
| 436 | 436 | define String |
| 437 | 437 | get_controller_from_web_arg | ... | ... |
web/counter.anubis
| ... | ... | @@ -17,7 +17,7 @@ read web/making_a_web_site.anubis |
| 17 | 17 | |
| 18 | 18 | This is the counter to be inserted into a web page: |
| 19 | 19 | |
| 20 | -public define HTML_Off_Form | |
| 20 | +public define HTML | |
| 21 | 21 | web_counter |
| 22 | 22 | ( |
| 23 | 23 | String directory, // where the counter file will be located |
| ... | ... | @@ -57,7 +57,7 @@ define List(Word8) |
| 57 | 57 | else l. |
| 58 | 58 | |
| 59 | 59 | |
| 60 | -define HTML_Off_Form | |
| 60 | +define HTML | |
| 61 | 61 | web_counter |
| 62 | 62 | ( |
| 63 | 63 | Int n, // value of counter |
| ... | ... | @@ -76,7 +76,7 @@ define HTML_Off_Form |
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | |
| 79 | -public define HTML_Off_Form | |
| 79 | +public define HTML | |
| 80 | 80 | web_counter |
| 81 | 81 | ( |
| 82 | 82 | String directory, // where the counter file will be located |
| ... | ... | @@ -110,4 +110,4 @@ public define One |
| 110 | 110 | }. |
| 111 | 111 | |
| 112 | 112 | |
| 113 | - | |
| 114 | 113 | \ No newline at end of file |
| 114 | + | ... | ... |
web/dojo.anubis
| ... | ... | @@ -49,7 +49,7 @@ define String |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | |
| 52 | -public define HTML_Off_Form | |
| 52 | +public define HTML | |
| 53 | 53 | dojo_button |
| 54 | 54 | ( |
| 55 | 55 | String name, |
| ... | ... | @@ -74,11 +74,11 @@ public type InputDial: |
| 74 | 74 | input_hidden(HTML_Id id, WebArgValue value). |
| 75 | 75 | |
| 76 | 76 | |
| 77 | -define List(HTML_Off_Form) | |
| 77 | +define List(HTML) | |
| 78 | 78 | format_list_data |
| 79 | 79 | ( |
| 80 | 80 | List((List(CoreAttrs), WebArgValue, String)) list_data, |
| 81 | - List(HTML_Off_Form) result_list | |
| 81 | + List(HTML) result_list | |
| 82 | 82 | )= |
| 83 | 83 | if list_data is |
| 84 | 84 | { |
| ... | ... | @@ -88,7 +88,7 @@ define List(HTML_Off_Form) |
| 88 | 88 | format_list_data(t, [literal("<option value=\"" + wa.value + "\">" + label + "</option>") . result_list]) |
| 89 | 89 | }. |
| 90 | 90 | |
| 91 | -public define HTML_Off_Form | |
| 91 | +public define HTML | |
| 92 | 92 | dojo_combobox |
| 93 | 93 | ( |
| 94 | 94 | WebArgName the_name, |
| ... | ... | @@ -106,7 +106,7 @@ public define HTML_Off_Form |
| 106 | 106 | literal("</select>") |
| 107 | 107 | ]). |
| 108 | 108 | |
| 109 | -define HTML_Off_Form | |
| 109 | +define HTML | |
| 110 | 110 | _maybe_label |
| 111 | 111 | ( |
| 112 | 112 | String label_text, |
| ... | ... | @@ -115,7 +115,7 @@ define HTML_Off_Form |
| 115 | 115 | if length(label_text) > 0 then literal("<label for=\"" + html_id.id + "\">" + label_text + "</label>") |
| 116 | 116 | else literal(""). |
| 117 | 117 | |
| 118 | -public define HTML_Off_Form | |
| 118 | +public define HTML | |
| 119 | 119 | dojo_checkbox |
| 120 | 120 | ( |
| 121 | 121 | WebArgName the_name, |
| ... | ... | @@ -131,7 +131,7 @@ public define HTML_Off_Form |
| 131 | 131 | ]). |
| 132 | 132 | |
| 133 | 133 | |
| 134 | -define HTML_Off_Form | |
| 134 | +define HTML | |
| 135 | 135 | input_in_dialog |
| 136 | 136 | ( |
| 137 | 137 | InputDial input_data |
| ... | ... | @@ -189,7 +189,7 @@ define HTML_Off_Form |
| 189 | 189 | } |
| 190 | 190 | . |
| 191 | 191 | |
| 192 | -define List(HTML_Off_Form) | |
| 192 | +define List(HTML) | |
| 193 | 193 | inputs_in_dialog |
| 194 | 194 | ( |
| 195 | 195 | List(InputDial) inputs_data |
| ... | ... | @@ -200,7 +200,7 @@ define List(HTML_Off_Form) |
| 200 | 200 | [h . t] then [input_in_dialog(h) . inputs_in_dialog(t)] |
| 201 | 201 | }. |
| 202 | 202 | |
| 203 | -public define HTML_Off_Form | |
| 203 | +public define HTML | |
| 204 | 204 | dijit_dialog |
| 205 | 205 | ( |
| 206 | 206 | String name, |
| ... | ... | @@ -233,7 +233,7 @@ public define HTML_Off_Form |
| 233 | 233 | ]) |
| 234 | 234 | . |
| 235 | 235 | |
| 236 | -public define HTML_Off_Form | |
| 236 | +public define HTML | |
| 237 | 237 | dojo_dialog |
| 238 | 238 | ( |
| 239 | 239 | String name, |
| ... | ... | @@ -330,7 +330,7 @@ public define String |
| 330 | 330 | + "]; |
| 331 | 331 | </script>". |
| 332 | 332 | |
| 333 | -public define HTML_Off_Form | |
| 333 | +public define HTML | |
| 334 | 334 | dojo_make_grid_script |
| 335 | 335 | ( |
| 336 | 336 | HTML_Id html_id, |
| ... | ... | @@ -346,7 +346,7 @@ public define HTML_Off_Form |
| 346 | 346 | }); |
| 347 | 347 | </script>"). |
| 348 | 348 | |
| 349 | -public define HTML_Off_Form | |
| 349 | +public define HTML | |
| 350 | 350 | dojo_grid |
| 351 | 351 | ( |
| 352 | 352 | HTML_Id html_id, |
| ... | ... | @@ -358,7 +358,7 @@ public define HTML_Off_Form |
| 358 | 358 | empty, [], empty). |
| 359 | 359 | |
| 360 | 360 | |
| 361 | -public define HTML_Off_Form | |
| 361 | +public define HTML | |
| 362 | 362 | dojo_grid |
| 363 | 363 | ( |
| 364 | 364 | HTML_Id html_id, |
| ... | ... | @@ -384,11 +384,11 @@ public define HTML_Off_Form |
| 384 | 384 | //<div id=\"gridContainer\"></div>"). |
| 385 | 385 | |
| 386 | 386 | |
| 387 | -public define HTML_Off_Form | |
| 387 | +public define HTML | |
| 388 | 388 | dojo_message_box |
| 389 | 389 | ( |
| 390 | - HTML_Off_Form name1, | |
| 391 | - HTML_Off_Form name2, | |
| 390 | + HTML name1, | |
| 391 | + HTML name2, | |
| 392 | 392 | )= |
| 393 | 393 | sequence([ |
| 394 | 394 | br, |
| ... | ... | @@ -401,7 +401,7 @@ public define HTML_Off_Form |
| 401 | 401 | |
| 402 | 402 | |
| 403 | 403 | |
| 404 | -public define HTML_Off_Form | |
| 404 | +public define HTML | |
| 405 | 405 | dojo_tooltip |
| 406 | 406 | ( |
| 407 | 407 | String title, |
| ... | ... | @@ -452,13 +452,13 @@ define String |
| 452 | 452 | }. |
| 453 | 453 | |
| 454 | 454 | |
| 455 | -public define HTML_Off_Form | |
| 455 | +public define HTML | |
| 456 | 456 | dojo_ContentPane |
| 457 | 457 | ( |
| 458 | 458 | List(CoreAttrs) attributes, |
| 459 | 459 | BorderContainerRegion region, |
| 460 | 460 | Bool splitter, |
| 461 | - HTML_Off_Form content | |
| 461 | + HTML content | |
| 462 | 462 | ) = |
| 463 | 463 | div([ attr("dojoType", "dijit.layout.ContentPane"), |
| 464 | 464 | attr("region", to_String(region)), |
| ... | ... | @@ -478,17 +478,17 @@ public define HTML_In_Form |
| 478 | 478 | attr("splitter", if splitter then "true" else "false") . attributes ], |
| 479 | 479 | content). |
| 480 | 480 | |
| 481 | -public define HTML_Off_Form | |
| 481 | +public define HTML | |
| 482 | 482 | dojo_TabContainer |
| 483 | 483 | ( |
| 484 | 484 | List(CoreAttrs) attributes, |
| 485 | - HTML_Off_Form content | |
| 485 | + HTML content | |
| 486 | 486 | ) = |
| 487 | 487 | div([attr("dojoType", "dijit.layout.TabContainer") . attributes ], |
| 488 | 488 | content). |
| 489 | 489 | |
| 490 | 490 | |
| 491 | -public define HTML_Off_Form | |
| 491 | +public define HTML | |
| 492 | 492 | dojo_BorderContainer |
| 493 | 493 | ( |
| 494 | 494 | List(CoreAttrs) attributes, |
| ... | ... | @@ -498,7 +498,7 @@ public define HTML_Off_Form |
| 498 | 498 | Bool persist, |
| 499 | 499 | Bool closable, |
| 500 | 500 | String container, |
| 501 | - HTML_Off_Form content | |
| 501 | + HTML content | |
| 502 | 502 | ) = |
| 503 | 503 | with the_attributes = (List(CoreAttrs)) [attr("dojoType", "dijit.layout.BorderContainer"), attr("dojoAttachPoint", container), |
| 504 | 504 | attr("design", to_String(design)), attr("liveSplitters", live_splitter), attr("persist", persist), |
| ... | ... | @@ -532,7 +532,7 @@ public define HTML_In_Form |
| 532 | 532 | }, |
| 533 | 533 | div(total_attributes, content). |
| 534 | 534 | |
| 535 | -public define HTML_Off_Form | |
| 535 | +public define HTML | |
| 536 | 536 | dojo_tree |
| 537 | 537 | ( |
| 538 | 538 | List(CoreAttrs) attributes, |
| ... | ... | @@ -541,24 +541,24 @@ public define HTML_Off_Form |
| 541 | 541 | |
| 542 | 542 | |
| 543 | 543 | |
| 544 | -public define HTML_Off_Form | |
| 544 | +public define HTML | |
| 545 | 545 | dojo_Toolbar |
| 546 | 546 | ( |
| 547 | 547 | List(CoreAttrs) attributes, |
| 548 | - HTML_Off_Form content | |
| 548 | + HTML content | |
| 549 | 549 | )= |
| 550 | 550 | div([attr("dojoType", "dijit.Toolbar") . attributes ], |
| 551 | 551 | content). |
| 552 | 552 | |
| 553 | 553 | |
| 554 | -public define HTML_Off_Form | |
| 554 | +public define HTML | |
| 555 | 555 | dojo_tooltip |
| 556 | 556 | ( |
| 557 | 557 | List(CoreAttrs) attributes, |
| 558 | 558 | // List(Text_Option) txt_attr, |
| 559 | 559 | HTML_Id html_id, |
| 560 | 560 | String label, |
| 561 | - HTML_Off_Form tooltip_content, | |
| 561 | + HTML tooltip_content, | |
| 562 | 562 | )= |
| 563 | 563 | sequence([ |
| 564 | 564 | text([id(html_id.id)], label), |
| ... | ... | @@ -566,7 +566,7 @@ public define HTML_Off_Form |
| 566 | 566 | ]). |
| 567 | 567 | |
| 568 | 568 | |
| 569 | -public define HTML_Off_Form | |
| 569 | +public define HTML | |
| 570 | 570 | dojo_button |
| 571 | 571 | ( |
| 572 | 572 | HTML_Id html_id, |
| ... | ... | @@ -615,12 +615,12 @@ public define HTML_In_Form |
| 615 | 615 | }). |
| 616 | 616 | |
| 617 | 617 | |
| 618 | -public define HTML_Off_Form | |
| 618 | +public define HTML | |
| 619 | 619 | dojo_declaration |
| 620 | 620 | ( |
| 621 | 621 | String name, |
| 622 | 622 | List(CoreAttrs) attributes, |
| 623 | - HTML_Off_Form content | |
| 623 | + HTML content | |
| 624 | 624 | )= |
| 625 | 625 | div([attr("dojoType", "dijit.Declaration"), attr("widgetClass", name) . attributes ], |
| 626 | 626 | content). |
| ... | ... | @@ -636,13 +636,13 @@ public define HTML_In_Form |
| 636 | 636 | div([attr("dojoType", "dijit.Declaration"), attr("widgetClass", name) . attributes ], |
| 637 | 637 | content). |
| 638 | 638 | |
| 639 | -public define HTML_Off_Form | |
| 639 | +public define HTML | |
| 640 | 640 | dojo_editor |
| 641 | 641 | ( |
| 642 | 642 | List(CoreAttrs) attributes, |
| 643 | 643 | HTML_Id html_id, |
| 644 | 644 | WebArgName input_name, |
| 645 | - HTML_Off_Form text, | |
| 645 | + HTML text, | |
| 646 | 646 | )= |
| 647 | 647 | div([id(html_id.id), attr("name", input_name.name), attr("dojoType", "dijit.Editor") |
| 648 | 648 | ,attr("extraPlugins", "['|', 'foreColor','hiliteColor',{name:'dojox.editor.plugins.FontChoice', command:'fontName', generic:true},'fontSize','formatBlock','|','createLink','insertImage']") |
| ... | ... | @@ -690,7 +690,7 @@ public define HTML_In_Form |
| 690 | 690 | // selector_c([attr("dojoType", "dijit.form.ComboBox") . attributes], label, id, name, 1, list_data, selected, non_mandatory). |
| 691 | 691 | selector_c([attr("dojoType", "dijit.form.ComboBox") . attributes], label(label_str, no_help), id, name, 1, list_data, selected). |
| 692 | 692 | |
| 693 | -public define HTML_Off_Form | |
| 693 | +public define HTML | |
| 694 | 694 | dojo_toaster |
| 695 | 695 | ( |
| 696 | 696 | List(CoreAttrs) attributes, |
| ... | ... | @@ -712,7 +712,7 @@ public define HTML_Off_Form |
| 712 | 712 | . attributes ]), |
| 713 | 713 | literal("")). |
| 714 | 714 | |
| 715 | -public define HTML_Off_Form | |
| 715 | +public define HTML | |
| 716 | 716 | dojo_progressBar |
| 717 | 717 | ( |
| 718 | 718 | List(CoreAttrs) attributes, |
| ... | ... | @@ -725,7 +725,7 @@ public define HTML_Off_Form |
| 725 | 725 | div([id(html_id.id), class("progress_bar"), attr("indeterminate", "true"), attr("dojoType", "dijit.ProgressBar") . attributes], literal("")) |
| 726 | 726 | ]). |
| 727 | 727 | |
| 728 | -public define HTML_Off_Form | |
| 728 | +public define HTML | |
| 729 | 729 | dojo_progressBar |
| 730 | 730 | ( |
| 731 | 731 | List(CoreAttrs) attributes, | ... | ... |
web/dropzone.anubis
| ... | ... | @@ -11,7 +11,7 @@ read system/string.anubis |
| 11 | 11 | read xlib/web/making_a_web_site.anubis |
| 12 | 12 | read xlib/web/jquery.anubis |
| 13 | 13 | |
| 14 | -public define HTML_Partial_Content | |
| 14 | +public define HTML | |
| 15 | 15 | dropzone |
| 16 | 16 | ( |
| 17 | 17 | String dropzone_form_name, |
| ... | ... | @@ -23,7 +23,7 @@ public define HTML_Partial_Content |
| 23 | 23 | List((String,String)) extra_ops, |
| 24 | 24 | ) = |
| 25 | 25 | with dropzone_form_id = to_lower(dropzone_form_name+"_"+generate_random_string(15)), |
| 26 | - partial_content( | |
| 26 | + head_tags( | |
| 27 | 27 | [ js(js_file("xlib/js/dropzone.js")), |
| 28 | 28 | css(css_file("xlib/css/dropzone.css")), |
| 29 | 29 | js_script(" |
| ... | ... | @@ -42,11 +42,11 @@ public define HTML_Partial_Content |
| 42 | 42 | $('#"+dropzone_form_id+"').dropzone(); " |
| 43 | 43 | ) |
| 44 | 44 | ], |
| 45 | - form(dropzone_form_id, [class("dropzone")], submit_action, extra_ops, empty) | |
| 45 | + form([id(dropzone_form_id), class("dropzone"), action(submit_action, extra_ops)]) | |
| 46 | 46 | ) |
| 47 | 47 | . |
| 48 | 48 | |
| 49 | -public define HTML_Partial_Content | |
| 49 | +public define HTML | |
| 50 | 50 | dropzone |
| 51 | 51 | ( |
| 52 | 52 | String dropzone_form_name, | ... | ... |
web/fonts/awesome.anubis
| ... | ... | @@ -14,7 +14,7 @@ public type Font_Awesome: |
| 14 | 14 | ) |
| 15 | 15 | . |
| 16 | 16 | |
| 17 | -public define HTML_Off_Form | |
| 17 | +public define HTML | |
| 18 | 18 | to_HTML |
| 19 | 19 | ( |
| 20 | 20 | Font_Awesome fa, |
| ... | ... | @@ -27,7 +27,7 @@ public define HTML_Off_Form |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | |
| 30 | -public define HTML_Off_Form | |
| 30 | +public define HTML | |
| 31 | 31 | to_HTML |
| 32 | 32 | ( |
| 33 | 33 | Font_Awesome fa, |
| ... | ... | @@ -36,7 +36,7 @@ public define HTML_Off_Form |
| 36 | 36 | to_HTML(fa, attrs, "") |
| 37 | 37 | . |
| 38 | 38 | |
| 39 | -public define HTML_Off_Form | |
| 39 | +public define HTML | |
| 40 | 40 | to_HTML |
| 41 | 41 | ( |
| 42 | 42 | Font_Awesome fa, |
| ... | ... | @@ -46,7 +46,7 @@ public define HTML_Off_Form |
| 46 | 46 | . |
| 47 | 47 | |
| 48 | 48 | |
| 49 | -public define HTML_Off_Form | |
| 49 | +public define HTML | |
| 50 | 50 | to_HTML |
| 51 | 51 | ( |
| 52 | 52 | Font_Awesome fa, |
| ... | ... | @@ -55,7 +55,7 @@ public define HTML_Off_Form |
| 55 | 55 | to_HTML(fa, [], text) |
| 56 | 56 | . |
| 57 | 57 | |
| 58 | -public define HTML_Off_Form | |
| 58 | +public define HTML | |
| 59 | 59 | to_HTML |
| 60 | 60 | ( |
| 61 | 61 | Font_Awesome fa |
| ... | ... | @@ -63,49 +63,49 @@ public define HTML_Off_Form |
| 63 | 63 | to_HTML(fa, [], "") |
| 64 | 64 | . |
| 65 | 65 | |
| 66 | -public define HTML_In_Form | |
| 67 | - to_HTML | |
| 68 | - ( | |
| 69 | - Font_Awesome fa, | |
| 70 | - List(CoreAttrs) attrs, | |
| 71 | - String text | |
| 72 | - )= | |
| 73 | - since fa is awesome(code), | |
| 74 | - i([class("fa fa-"+code), attr("aria-hidden", "true")]+attrs, text) | |
| 75 | -. | |
| 76 | - | |
| 77 | -public define HTML_In_Form | |
| 78 | - to_HTML | |
| 79 | - ( | |
| 80 | - Font_Awesome fa, | |
| 81 | - List(CoreAttrs) attrs | |
| 82 | - )= | |
| 83 | - to_HTML(fa, attrs, "") | |
| 84 | -. | |
| 85 | - | |
| 86 | -public define HTML_In_Form | |
| 87 | - to_HTML | |
| 88 | - ( | |
| 89 | - Font_Awesome fa, | |
| 90 | - CoreAttrs attr | |
| 91 | - )= | |
| 92 | - to_HTML(fa, [attr], "") | |
| 93 | -. | |
| 94 | - | |
| 95 | - | |
| 96 | -public define HTML_In_Form | |
| 97 | - to_HTML | |
| 98 | - ( | |
| 99 | - Font_Awesome fa, | |
| 100 | - String text | |
| 101 | - )= | |
| 102 | - to_HTML(fa, [], text) | |
| 103 | -. | |
| 104 | - | |
| 105 | -public define HTML_In_Form | |
| 106 | - to_HTML | |
| 107 | - ( | |
| 108 | - Font_Awesome fa | |
| 109 | - )= | |
| 110 | - to_HTML(fa, [], "") | |
| 111 | -. | |
| 66 | +//public define HTML_In_Form | |
| 67 | +// to_HTML | |
| 68 | +// ( | |
| 69 | +// Font_Awesome fa, | |
| 70 | +// List(CoreAttrs) attrs, | |
| 71 | +// String text | |
| 72 | +// )= | |
| 73 | +// since fa is awesome(code), | |
| 74 | +// i([class("fa fa-"+code), attr("aria-hidden", "true")]+attrs, text) | |
| 75 | +//. | |
| 76 | + | |
| 77 | +//public define HTML_In_Form | |
| 78 | +// to_HTML | |
| 79 | +// ( | |
| 80 | +// Font_Awesome fa, | |
| 81 | +// List(CoreAttrs) attrs | |
| 82 | +// )= | |
| 83 | +// to_HTML(fa, attrs, "") | |
| 84 | +//. | |
| 85 | +// | |
| 86 | +//public define HTML_In_Form | |
| 87 | +// to_HTML | |
| 88 | +// ( | |
| 89 | +// Font_Awesome fa, | |
| 90 | +// CoreAttrs attr | |
| 91 | +// )= | |
| 92 | +// to_HTML(fa, [attr], "") | |
| 93 | +//. | |
| 94 | +// | |
| 95 | +// | |
| 96 | +//public define HTML_In_Form | |
| 97 | +// to_HTML | |
| 98 | +// ( | |
| 99 | +// Font_Awesome fa, | |
| 100 | +// String text | |
| 101 | +// )= | |
| 102 | +// to_HTML(fa, [], text) | |
| 103 | +//. | |
| 104 | +// | |
| 105 | +//public define HTML_In_Form | |
| 106 | +// to_HTML | |
| 107 | +// ( | |
| 108 | +// Font_Awesome fa | |
| 109 | +// )= | |
| 110 | +// to_HTML(fa, [], "") | |
| 111 | +//. | ... | ... |
web/form.anubis
| ... | ... | @@ -49,44 +49,44 @@ public type CXM_Form_Field: |
| 49 | 49 | //--- text input field ---------------------------------------------------------------- |
| 50 | 50 | input( |
| 51 | 51 | List(CoreAttrs) options, |
| 52 | - HTML_Label label, | |
| 53 | - HTML_Id id, | |
| 54 | - WebArgName web_arg_name, | |
| 55 | - InitialValue init_value, | |
| 56 | - Width width, | |
| 57 | - Mandatory mandatory | |
| 52 | + HTML_Label label, | |
| 53 | + HTML_Id id, | |
| 54 | + WebArgName web_arg_name, | |
| 55 | + InitialValue init_value, | |
| 56 | + Width width, | |
| 57 | + Mandatory mandatory | |
| 58 | 58 | ), |
| 59 | 59 | |
| 60 | 60 | input_readonly( |
| 61 | 61 | List(CoreAttrs) options, |
| 62 | - HTML_Label label, | |
| 62 | + HTML_Label label, | |
| 63 | 63 | HTML_Id id, |
| 64 | - WebArgName web_arg_name, | |
| 65 | - InitialValue init_value, | |
| 66 | - Width width | |
| 64 | + WebArgName web_arg_name, | |
| 65 | + InitialValue init_value, | |
| 66 | + Width width | |
| 67 | 67 | ), |
| 68 | 68 | |
| 69 | 69 | //--- text area field ----------------------------------------------------------------- |
| 70 | 70 | text_area( |
| 71 | - List(TextAreaOption) options, | |
| 72 | - HTML_Label label, | |
| 73 | - HTML_Id id, | |
| 74 | - WebArgName web_arg_name, | |
| 75 | - InitialValue init_value, | |
| 76 | - Width width, | |
| 77 | - Int height, | |
| 78 | - Mandatory mandatory | |
| 71 | + List(CoreAttrs) options, | |
| 72 | + HTML_Label label, | |
| 73 | + HTML_Id id, | |
| 74 | + WebArgName web_arg_name, | |
| 75 | + InitialValue init_value, | |
| 76 | + Width width, | |
| 77 | + Int height, | |
| 78 | + Mandatory mandatory | |
| 79 | 79 | ), |
| 80 | 80 | |
| 81 | 81 | //--- password input field ------------------------------------------------------------ |
| 82 | 82 | password_input( |
| 83 | 83 | List(CoreAttrs) options, |
| 84 | - HTML_Label label, | |
| 84 | + HTML_Label label, | |
| 85 | 85 | HTML_Id id, |
| 86 | 86 | WebArgName web_arg_name, |
| 87 | 87 | InitialValue init_value, |
| 88 | - Width width, | |
| 89 | - Mandatory mandatory), | |
| 88 | + Width width, | |
| 89 | + Mandatory mandatory), | |
| 90 | 90 | |
| 91 | 91 | //--- phone field ------------------------------------------------------------ |
| 92 | 92 | phone_input( |
| ... | ... | @@ -162,7 +162,7 @@ public type CXM_Form_Field: |
| 162 | 162 | HTML_Id id, |
| 163 | 163 | WebArgName web_arg_name, |
| 164 | 164 | Int size, |
| 165 | - List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items, | |
| 165 | + List((List(CoreAttrs), WebArgValue, String, HTML)) items, | |
| 166 | 166 | Maybe(InitialValue) selected, |
| 167 | 167 | Mandatory mandatory), |
| 168 | 168 | |
| ... | ... | @@ -252,13 +252,13 @@ public type CXM_Form_Field: |
| 252 | 252 | Width width, |
| 253 | 253 | Mandatory mandatory), |
| 254 | 254 | |
| 255 | - raw_in_form (HTML_In_Form html), | |
| 255 | + raw_in_form (HTML html), | |
| 256 | 256 | label_for ( String label, |
| 257 | 257 | HTML_Id id, |
| 258 | - HTML_In_Form input), | |
| 259 | - div (List(CoreAttrs), List(HTML_In_Form) contents), | |
| 258 | + HTML input), | |
| 259 | + div (List(CoreAttrs), List(HTML) contents), | |
| 260 | 260 | div (List(CoreAttrs), List(CXM_Form_Field) fields), |
| 261 | - partial (HTML_Partial_Content p_content), | |
| 261 | + html (HTML p_content), | |
| 262 | 262 | br, |
| 263 | 263 | hr (List(CoreAttrs) options), |
| 264 | 264 | // input_with_help (CXM_Form_Field field, |
| ... | ... | @@ -376,14 +376,6 @@ public define CXM_Form_Field |
| 376 | 376 | public define CXM_Form_Field |
| 377 | 377 | upload(HTML_Label label, HTML_Id id, WebArgName name, Width width, Mandatory mand) |
| 378 | 378 | = upload([], label, id, name, width, mand). |
| 379 | - | |
| 380 | - public define CXM_Form_Field | |
| 381 | - input_with_help (CXM_Form_Field field, String help_text) | |
| 382 | - = input_with_help (field, failure, help_text, 250). | |
| 383 | - | |
| 384 | - public define CXM_Form_Field | |
| 385 | - input_with_help (CXM_Form_Field field, String help_text, Int width) | |
| 386 | - = input_with_help (field, failure, help_text, width). | |
| 387 | 379 | |
| 388 | 380 | public define CXM_Form_Field |
| 389 | 381 | ip_input |
| ... | ... | @@ -433,7 +425,7 @@ public define CXM_Form_Field |
| 433 | 425 | div |
| 434 | 426 | ( |
| 435 | 427 | List(CoreAttrs) attrs, |
| 436 | - HTML_In_Form content | |
| 428 | + HTML content | |
| 437 | 429 | )= |
| 438 | 430 | div(attrs, [content]) |
| 439 | 431 | . |
| ... | ... | @@ -441,7 +433,7 @@ public define CXM_Form_Field |
| 441 | 433 | public define CXM_Form_Field |
| 442 | 434 | div |
| 443 | 435 | ( |
| 444 | - HTML_In_Form content | |
| 436 | + HTML content | |
| 445 | 437 | )= |
| 446 | 438 | div([], [content]) |
| 447 | 439 | . |
| ... | ... | @@ -449,13 +441,13 @@ public define CXM_Form_Field |
| 449 | 441 | |
| 450 | 442 | // ////////////////////////////////////////////////////////// |
| 451 | 443 | |
| 452 | -define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content)) | |
| 444 | +define (List((List(CoreAttrs), WebArgValue, String)), List(HTML)) | |
| 453 | 445 | construct_selector_hide_show |
| 454 | 446 | ( |
| 455 | 447 | String div_id, |
| 456 | - List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items, | |
| 448 | + List((List(CoreAttrs), WebArgValue, String, HTML)) items, | |
| 457 | 449 | List((List(CoreAttrs), WebArgValue, String)) so_far_1, |
| 458 | - List(HTML_Partial_Content) so_far_2, | |
| 450 | + List(HTML) so_far_2, | |
| 459 | 451 | Int n |
| 460 | 452 | ) = |
| 461 | 453 | if items is |
| ... | ... | @@ -464,17 +456,17 @@ define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content) |
| 464 | 456 | [h . t] then |
| 465 | 457 | since h is (cores, wav, label, content), |
| 466 | 458 | with linked_element = div_id + n, |
| 467 | - construct_selector_hide_show(div_id, t, [([data("linked_element", linked_element) . cores], wav, label) . so_far_1], [ partial_content([], div([id(linked_element), style("display: none")], content)) . so_far_2 ], n + 1) | |
| 459 | + construct_selector_hide_show(div_id, t, [([data("linked_element", linked_element) . cores], wav, label) . so_far_1], [ div([id(linked_element), style("display: none")], content) . so_far_2 ], n + 1) | |
| 468 | 460 | }. |
| 469 | 461 | |
| 470 | -define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content)) | |
| 462 | +define (List((List(CoreAttrs), WebArgValue, String)), List(HTML)) | |
| 471 | 463 | construct_selector_hide_show |
| 472 | 464 | ( |
| 473 | 465 | String div_id, |
| 474 | - List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items | |
| 466 | + List((List(CoreAttrs), WebArgValue, String, HTML)) items | |
| 475 | 467 | ) = construct_selector_hide_show(div_id, items, [], [], 0). |
| 476 | 468 | |
| 477 | -public define HTML_In_Form | |
| 469 | +public define HTML | |
| 478 | 470 | format_div_CXM_Form_Field |
| 479 | 471 | ( |
| 480 | 472 | List(CXM_Form_Field) field, |
| ... | ... | @@ -484,7 +476,7 @@ public define HTML_In_Form |
| 484 | 476 | ). |
| 485 | 477 | |
| 486 | 478 | |
| 487 | -public define HTML_In_Form | |
| 479 | +public define HTML | |
| 488 | 480 | format_CXM_Form_Field |
| 489 | 481 | ( |
| 490 | 482 | CXM_Form_Field ff, //CXM_Form_Field to format |
| ... | ... | @@ -523,14 +515,11 @@ public define HTML_In_Form |
| 523 | 515 | |
| 524 | 516 | if ff is |
| 525 | 517 | { |
| 526 | - no_field then | |
| 527 | - empty, | |
| 518 | + no_field then empty, | |
| 528 | 519 | |
| 529 | - title(t) then | |
| 530 | - literal("<h3>"+t+"</h3>"), | |
| 520 | + title(t) then h3(t), | |
| 531 | 521 | |
| 532 | - message(t) then | |
| 533 | - literal(t), | |
| 522 | + message(t) then literal(t), | |
| 534 | 523 | |
| 535 | 524 | input(options, _label, id, wan, default, w, mand) then |
| 536 | 525 | text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), |
| ... | ... | @@ -539,39 +528,38 @@ public define HTML_In_Form |
| 539 | 528 | text_input_ro([class("in") . options], _label, id, name, init, pixels(w)), |
| 540 | 529 | |
| 541 | 530 | text_area(options, _label, id, wan, default, w, height, mand) then |
| 542 | - text_area([input_attrs([class("in")]) . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w), height), | |
| 531 | + text_area([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w), height), | |
| 543 | 532 | |
| 544 | 533 | password_input(options, _label, id, name, init, w, mand) then |
| 545 | 534 | password_input([class("in") . options], star(_label, mand), id, name, init, pixels(w)), |
| 546 | 535 | |
| 547 | - phone_input(mb_sms_options, icon_options, options, _label, id, wan, default, phone_type, w, mand) then | |
| 536 | + phone_input(mb_sms_options, icon_options, options, _label, _id, wan, default, phone_type, w, mand) then | |
| 548 | 537 | sequence([ |
| 549 | 538 | if mb_sms_options is |
| 550 | 539 | { |
| 551 | 540 | failure then empty, |
| 552 | - success(sms_options) then image([event(onmouseover, "/icons/16x16/send_sms.png")]+sms_options, "/icons/16x16/sms.png", "") | |
| 541 | + success(sms_options) then img([event(onmouseover, "/icons/16x16/send_sms.png")]+sms_options, "/icons/16x16/sms.png") | |
| 553 | 542 | }, |
| 554 | - image(icon_options, "/icons/16x16/"+to_Icon(phone_type), ""), | |
| 555 | - text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), | |
| 543 | + img(icon_options, "/icons/16x16/"+to_Icon(phone_type)), | |
| 544 | + input([class("in"), id(_id.id), name(wan.name), init(get_String(lwa, wan.name, default.value)), size(pixels(w)). options]), | |
| 556 | 545 | ]), |
| 557 | 546 | |
| 558 | 547 | email_input(icon_options, options, _label, id, wan, default, w, mand) then |
| 559 | 548 | sequence([ |
| 560 | - image(icon_options, "/icons/16x16/email_edit.png", ""), | |
| 549 | + img(icon_options, "/icons/16x16/email_edit.png"), | |
| 561 | 550 | text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), |
| 562 | 551 | ]), |
| 563 | 552 | |
| 564 | 553 | url_input(icon_options, options, _label, id, wan, default, w, mand) then |
| 565 | 554 | sequence([ |
| 566 | - image(icon_options, "/icons/16x16/url.png", ""), | |
| 555 | + img(icon_options, "/icons/16x16/url.png"), | |
| 567 | 556 | text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), |
| 568 | 557 | ]), |
| 569 | 558 | |
| 570 | - hidden(id, name, init) then | |
| 571 | - hidden(id, name, init), | |
| 559 | + hidden(h_id, wan, wav) then hidden(wan.name, wav.value), | |
| 572 | 560 | |
| 573 | 561 | explain(t) then |
| 574 | - div([class("sub")], literal(t)), | |
| 562 | + div(class("sub"), literal(t)), | |
| 575 | 563 | |
| 576 | 564 | selector(options, _label, id, wan, size, items, selected, mand) then |
| 577 | 565 | if selected is |
| ... | ... | @@ -591,8 +579,8 @@ public define HTML_In_Form |
| 591 | 579 | with div_id = generate_random_string(15), |
| 592 | 580 | since construct_selector_hide_show(div_id, items_with_partial) is (items, partial_content_list), |
| 593 | 581 | sequence([ |
| 594 | - selector_c([class("in"), class("cxm_selector_hide_show"), event(onchange, "select_hide_show('" + div_id + "', this);")], star(_label, mand), id, wan, size, reverse(items), if selected is { failure then init(""), success(default) then init(get_String(lwa, wan.name, default.value)) } ), | |
| 595 | - partial(partial_content(partial_content_list)) | |
| 582 | + selector_c([class("in cxm_selector_hide_show"), event(onchange, "select_hide_show('" + div_id + "', this);")], star(_label, mand), id, wan, size, reverse(items), if selected is { failure then init(""), success(default) then init(get_String(lwa, wan.name, default.value)) } ), | |
| 583 | + sequence(partial_content_list) | |
| 596 | 584 | ]), |
| 597 | 585 | |
| 598 | 586 | checkbox(options, _label, id, wan, checked, mand) then |
| ... | ... | @@ -604,7 +592,7 @@ public define HTML_In_Form |
| 604 | 592 | checkbox_hide_show(options, _label, wan, checked, fields) then |
| 605 | 593 | with div_id = generate_random_string(15), |
| 606 | 594 | sequence([ |
| 607 | - check_box([data("show_id", div_id), class("in"), class("cxm_checkbox_hide_show"), event(onclick, "checked_hide_show_element('"+div_id+"', this);")], _label, html_Id("checkbox_"+div_id), wan, get_Bool(lwa, wan.name, checked)), | |
| 595 | + check_box([data("show_id", div_id), class("in cxm_checkbox_hide_show"), event(onclick, "checked_hide_show_element('"+div_id+"', this);")], _label, html_Id("checkbox_"+div_id), wan, get_Bool(lwa, wan.name, checked)), | |
| 608 | 596 | div([id(div_id), style("display:"+if checked then "block" else "none")], format_div_CXM_Form_Field(fields, lwa, _class, b_with_label)) |
| 609 | 597 | ]), |
| 610 | 598 | |
| ... | ... | @@ -644,39 +632,29 @@ public define HTML_In_Form |
| 644 | 632 | ), |
| 645 | 633 | ]), |
| 646 | 634 | one_line_fields(fields) then |
| 647 | - table([nude, class("form_one_line")],[row([], | |
| 648 | - map((CXM_Form_Field ff2) |-> cell([],format_CXM_Form_Field(ff2, lwa, _class, b_with_label)),fields))]) | |
| 635 | + table(class("form_one_line nude"),[tr( | |
| 636 | + map((CXM_Form_Field ff2) |-> td(format_CXM_Form_Field(ff2, lwa, _class, b_with_label)),fields))]) | |
| 649 | 637 | , |
| 650 | - | |
| 651 | 638 | upload(options, _label, id, name, w, mand) then |
| 652 | 639 | file_upload([class("in") . options], star(_label, mand), id, name, pixels(w)), |
| 653 | 640 | |
| 654 | - raw_in_form(html) then html, | |
| 655 | -// div([class("in")], html), | |
| 656 | - label_for(label, id, input) then | |
| 641 | + raw_in_form(html) then div(class("in"), html), | |
| 642 | + label_for(_label, _id, input) then | |
| 657 | 643 | sequence([ |
| 658 | - if id is html_Id(_id) then | |
| 659 | - literal("<label for=\"" + _id + "\">" + label + "</label>"), | |
| 644 | + label(for(_id.id), _label), | |
| 660 | 645 | input |
| 661 | 646 | ]), |
| 662 | 647 | |
| 663 | 648 | div(options, e) then div(options, e), |
| 664 | 649 | div(options, fields)then div(options, format_div_CXM_Form_Field(fields, lwa, _class, b_with_label)), |
| 665 | - partial(p_content) then partial(p_content), | |
| 650 | + html(p_content) then p_content, | |
| 666 | 651 | br then br, |
| 667 | 652 | hr(opts) then hr(opts), |
| 668 | -// input_with_help(input, help_title, help_text, width) then | |
| 669 | -// sequence([ | |
| 670 | -// format_CXM_Form_Field(input, lwa, html_tooltip(force_String(help_title), help_text, width)), | |
| 671 | -// ]), | |
| 672 | - | |
| 673 | - fieldset(options, legend, fields) then | |
| 674 | - sequence([ | |
| 675 | - literal("<fieldset" + format_attrs(options) + ">"), | |
| 676 | - literal(if length(legend) > 0 then "<legend>" + legend + "</legend>" else ""), | |
| 653 | + fieldset(options, _legend, fields) then | |
| 654 | + fieldset(options, [ | |
| 655 | + if _legend = "" then legend(_legend) else empty, | |
| 677 | 656 | format_div_CXM_Form_Field(fields, lwa, _class, b_with_label), |
| 678 | - literal("</fieldset>") | |
| 679 | - ]), | |
| 657 | + ]), | |
| 680 | 658 | |
| 681 | 659 | blank_space then |
| 682 | 660 | div([class("blank_space")], literal(" ")), |
| ... | ... | @@ -698,31 +676,8 @@ public define HTML_In_Form |
| 698 | 676 | empty then literal("") |
| 699 | 677 | }. |
| 700 | 678 | |
| 701 | - public define HTML_In_Form | |
| 702 | - format_div_CXM_Form_Field | |
| 703 | - ( | |
| 704 | - CXM_Form_Field field, | |
| 705 | - List(Web_arg) lwa, | |
| 706 | - String _class, | |
| 707 | - Bool b_with_label | |
| 708 | - )= | |
| 709 | - if field is empty then | |
| 710 | - empty | |
| 711 | - else if field is no_field then | |
| 712 | - empty | |
| 713 | - else if field is hidden(id, name, init) then | |
| 714 | - format_CXM_Form_Field(field, lwa, _class, b_with_label) | |
| 715 | - else if field is br then | |
| 716 | - format_CXM_Form_Field(field, lwa, _class, b_with_label) | |
| 717 | - else if field is text_area(options, _label, id, wan, default, w, height, mand) then | |
| 718 | - div([], format_CXM_Form_Field(field, lwa, _class, b_with_label)) | |
| 719 | - else | |
| 720 | - div([class(_class)], format_CXM_Form_Field(field, lwa, _class, b_with_label)) | |
| 721 | -. | |
| 722 | - | |
| 723 | - | |
| 724 | 679 | |
| 725 | -public define HTML_In_Form | |
| 680 | +public define HTML | |
| 726 | 681 | format_div_CXM_Form_Field |
| 727 | 682 | ( |
| 728 | 683 | List(CXM_Form_Field) fields, |
| ... | ... | @@ -739,7 +694,7 @@ public define HTML_In_Form |
| 739 | 694 | empty |
| 740 | 695 | else if field is no_field then |
| 741 | 696 | empty |
| 742 | - else if field is hidden(id, name, init) then | |
| 697 | + else if field is hidden(_id, name, init) then | |
| 743 | 698 | format_CXM_Form_Field(field, lwa, _class, b_with_label) |
| 744 | 699 | else if field is br then |
| 745 | 700 | format_CXM_Form_Field(field, lwa, _class, b_with_label) |
| ... | ... | @@ -750,8 +705,8 @@ public define HTML_In_Form |
| 750 | 705 | , fields)) |
| 751 | 706 | . |
| 752 | 707 | |
| 753 | -public define HTML_In_Form | |
| 754 | - to_HTML_In_Form | |
| 708 | +public define HTML | |
| 709 | + to_HTML | |
| 755 | 710 | ( |
| 756 | 711 | List(CXM_Form_Field) fields, |
| 757 | 712 | List(Web_arg) lwa, |
| ... | ... | @@ -761,61 +716,47 @@ public define HTML_In_Form |
| 761 | 716 | format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) |
| 762 | 717 | . |
| 763 | 718 | |
| 764 | - "form_field aligned" | |
| 765 | - | |
| 766 | - public define HTML_In_Form | |
| 767 | - fieldset | |
| 768 | - ( | |
| 769 | - CXM_Form_Field field, | |
| 770 | - List(Web_arg) lwa, | |
| 771 | - String _class, | |
| 772 | - Bool b_with_label | |
| 773 | - )= | |
| 774 | - fieldset([field], lwa, _class, b_with_label) | |
| 775 | -. | |
| 776 | - | |
| 777 | - | |
| 778 | -public define HTML_In_Form | |
| 779 | - to_HTML_In_Form | |
| 719 | +public define HTML | |
| 720 | + to_HTML | |
| 780 | 721 | ( |
| 781 | 722 | List(CXM_Form_Field) fields, |
| 782 | 723 | String _class, |
| 783 | 724 | Bool b_with_label |
| 784 | 725 | )= |
| 785 | - to_HTML_In_Form(fields, [], _class, b_with_label). | |
| 726 | + to_HTML(fields, [], _class, b_with_label). | |
| 786 | 727 | |
| 787 | -public define HTML_In_Form | |
| 788 | - to_HTML_In_Form | |
| 728 | +public define HTML | |
| 729 | + to_HTML | |
| 789 | 730 | ( |
| 790 | 731 | List(CXM_Form_Field) fields, |
| 791 | 732 | List(Web_arg) lwa |
| 792 | 733 | )= |
| 793 | - to_HTML_In_Form(fields, lwa, "form_field aligned", true) | |
| 734 | + to_HTML(fields, lwa, "form_field aligned", true) | |
| 794 | 735 | . |
| 795 | 736 | |
| 796 | -public define HTML_In_Form | |
| 797 | - to_HTML_In_Form | |
| 737 | +public define HTML | |
| 738 | + to_HTML | |
| 798 | 739 | ( |
| 799 | 740 | CXM_Form_Field field, |
| 800 | 741 | List(Web_arg) lwa |
| 801 | 742 | )= |
| 802 | - to_HTML_In_Form([field], lwa, "form_field aligned", true) | |
| 743 | + to_HTML([field], lwa, "form_field aligned", true) | |
| 803 | 744 | . |
| 804 | 745 | |
| 805 | -public define HTML_In_Form | |
| 806 | - to_HTML_In_Form | |
| 746 | +public define HTML | |
| 747 | + to_HTML | |
| 807 | 748 | ( |
| 808 | 749 | List(CXM_Form_Field) fields |
| 809 | 750 | )= |
| 810 | - to_HTML_In_Form(fields, [], "form_field aligned", true) | |
| 751 | + to_HTML(fields, [], "form_field aligned", true) | |
| 811 | 752 | . |
| 812 | 753 | |
| 813 | -public define HTML_Off_Form | |
| 754 | +public define HTML | |
| 814 | 755 | cxm_form |
| 815 | 756 | ( |
| 816 | 757 | HTML_Id form_Id, |
| 817 | 758 | List(CoreAttrs) options, |
| 818 | - WEB_Action_Name action, | |
| 759 | + WEB_Action_Name _action, | |
| 819 | 760 | List((String,String)) extra_ops, |
| 820 | 761 | List(Web_arg) lwa, |
| 821 | 762 | List(CXM_Form_Field) fields, |
| ... | ... | @@ -823,39 +764,32 @@ public define HTML_Off_Form |
| 823 | 764 | Bool b_with_label |
| 824 | 765 | ) = |
| 825 | 766 | form( |
| 826 | - form_Id, | |
| 827 | - [class("cxm_form") . options], | |
| 828 | - action, | |
| 829 | - extra_ops, | |
| 767 | + [id(form_Id.id), class("cxm_form"), action(_action, extra_ops) . options], | |
| 830 | 768 | format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) |
| 831 | 769 | ). |
| 832 | 770 | |
| 833 | -public define HTML_Off_Form | |
| 834 | -/* older manner to call CXM_form with action as String. | |
| 835 | - * this function only exists for compatibility with older projects. Please consider | |
| 836 | - * to use the above function with WEB_Action_Name instead of String | |
| 837 | -*/ | |
| 838 | - cxm_form | |
| 839 | - ( | |
| 840 | - HTML_Id form_Id, | |
| 841 | - List(CoreAttrs) options, | |
| 842 | - String action, //older manner to call action with String | |
| 843 | - List((String,String)) extra_ops, | |
| 844 | - List(Web_arg) lwa, | |
| 845 | - List(CXM_Form_Field) fields, | |
| 846 | - String _class, | |
| 847 | - Bool b_with_label | |
| 848 | - ) = | |
| 849 | - | |
| 850 | - form( | |
| 851 | - form_Id, | |
| 852 | - [class("cxm_form") . options], | |
| 853 | - action_name(action), | |
| 854 | - extra_ops, | |
| 855 | - format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) | |
| 856 | - ). | |
| 771 | +//public define HTML | |
| 772 | +///* older manner to call CXM_form with action as String. | |
| 773 | +// * this function only exists for compatibility with older projects. Please consider | |
| 774 | +// * to use the above function with WEB_Action_Name instead of String | |
| 775 | +//*/ | |
| 776 | +// cxm_form | |
| 777 | +// ( | |
| 778 | +// HTML_Id form_Id, | |
| 779 | +// List(CoreAttrs) options, | |
| 780 | +// String _action, //older manner to call action with String | |
| 781 | +// List((String,String)) extra_ops, | |
| 782 | +// List(Web_arg) lwa, | |
| 783 | +// List(CXM_Form_Field) fields, | |
| 784 | +// String _class, | |
| 785 | +// Bool b_with_label | |
| 786 | +// ) = | |
| 787 | +// form( | |
| 788 | +// [class("cxm_form"), id(form_Id.id), action(_action, extra_ops) . options], | |
| 789 | +// format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) | |
| 790 | +// ). | |
| 857 | 791 | |
| 858 | -public define HTML_Off_Form | |
| 792 | +public define HTML | |
| 859 | 793 | cxm_form |
| 860 | 794 | ( |
| 861 | 795 | String form_name, |
| ... | ... | @@ -869,7 +803,7 @@ public define HTML_Off_Form |
| 869 | 803 | )= |
| 870 | 804 | cxm_form(html_Id(form_name), options, action, extra_ops, lwa, form_fields, _class, b_with_label). |
| 871 | 805 | |
| 872 | -public define HTML_Off_Form | |
| 806 | +public define HTML | |
| 873 | 807 | cxm_form |
| 874 | 808 | ( |
| 875 | 809 | String form_name, |
| ... | ... | @@ -882,7 +816,7 @@ public define HTML_Off_Form |
| 882 | 816 | cxm_form(form_name, options, action, extra_ops, lwa, form_fields, "form_field aligned", true) |
| 883 | 817 | . |
| 884 | 818 | |
| 885 | -public define HTML_Off_Form | |
| 819 | +public define HTML | |
| 886 | 820 | cxm_form |
| 887 | 821 | ( |
| 888 | 822 | String form_name, |
| ... | ... | @@ -897,7 +831,7 @@ public define HTML_Off_Form |
| 897 | 831 | cxm_form(html_Id(form_name), options, action_name(action), extra_ops, lwa, form_fields, "form_field aligned", b_with_label) |
| 898 | 832 | . |
| 899 | 833 | |
| 900 | -public define HTML_Off_Form | |
| 834 | +public define HTML | |
| 901 | 835 | cxm_form |
| 902 | 836 | ( |
| 903 | 837 | String form_name, |
| ... | ... | @@ -910,28 +844,28 @@ public define HTML_Off_Form |
| 910 | 844 | cxm_form(html_Id(form_name), options, action_name(action), extra_ops, lwa, form_fields, "form_field aligned", true) |
| 911 | 845 | . |
| 912 | 846 | |
| 913 | -public define HTML_Off_Form | |
| 847 | +public define HTML | |
| 914 | 848 | cxm_form |
| 915 | 849 | ( |
| 916 | 850 | String form_id, |
| 917 | 851 | List(CoreAttrs) options, |
| 918 | - List(HTML_In_Form) fields, | |
| 852 | + List(HTML) fields, | |
| 919 | 853 | String _class |
| 920 | 854 | ) = |
| 921 | - cxm_form(html_Id(form_id), options, action_name(""), [], [], map((HTML_In_Form field) |-> raw_in_form(field), fields), _class, true ) | |
| 855 | + cxm_form(html_Id(form_id), options, action_name(""), [], [], map((HTML field) |-> raw_in_form(field), fields), _class, true ) | |
| 922 | 856 | . |
| 923 | 857 | |
| 924 | -public define HTML_Off_Form | |
| 858 | +public define HTML | |
| 925 | 859 | cxm_form |
| 926 | 860 | ( |
| 927 | 861 | String form_id, |
| 928 | - List(CoreAttrs) options, | |
| 929 | - List(HTML_In_Form) fields | |
| 862 | + List(CoreAttrs) options, | |
| 863 | + List(HTML) fields | |
| 930 | 864 | ) = |
| 931 | - cxm_form(html_Id(form_id), options, action_name(""), [], [], map((HTML_In_Form field) |-> raw_in_form(field), fields), "form_field aligned", true ) | |
| 865 | + cxm_form(html_Id(form_id), options, action_name(""), [], [], map((HTML field) |-> raw_in_form(field), fields), "form_field aligned", true ) | |
| 932 | 866 | . |
| 933 | 867 | |
| 934 | -public define HTML_Off_Form | |
| 868 | +public define HTML | |
| 935 | 869 | cxm_form |
| 936 | 870 | ( |
| 937 | 871 | String form_id, |
| ... | ... | @@ -943,16 +877,16 @@ public define HTML_Off_Form |
| 943 | 877 | ) = |
| 944 | 878 | cxm_form(html_Id(form_id), options, action_name(""), [], lwa, fields, _class, b_with_label). |
| 945 | 879 | |
| 946 | -public define HTML_Off_Form | |
| 880 | +public define HTML | |
| 947 | 881 | cxm_form |
| 948 | 882 | ( |
| 949 | 883 | String form_id, |
| 950 | - List(HTML_In_Form) fields, | |
| 884 | + List(HTML) fields, | |
| 951 | 885 | String _class |
| 952 | 886 | ) = |
| 953 | - cxm_form(html_Id(form_id), [], action_name(""), [], [], map((HTML_In_Form field) |-> raw_in_form(field), fields), _class, true ). | |
| 887 | + cxm_form(html_Id(form_id), [], action_name(""), [], [], map((HTML field) |-> raw_in_form(field), fields), _class, true ). | |
| 954 | 888 | |
| 955 | -public define HTML_Off_Form | |
| 889 | +public define HTML | |
| 956 | 890 | cxm_form |
| 957 | 891 | ( |
| 958 | 892 | String form_id, |
| ... | ... | @@ -962,7 +896,7 @@ public define HTML_Off_Form |
| 962 | 896 | ) = |
| 963 | 897 | cxm_form(form_id, [], lwa, fields, _class, true). |
| 964 | 898 | |
| 965 | -public define HTML_Off_Form | |
| 899 | +public define HTML | |
| 966 | 900 | cxm_form |
| 967 | 901 | ( |
| 968 | 902 | String form_id, |
| ... | ... | @@ -971,7 +905,7 @@ public define HTML_Off_Form |
| 971 | 905 | ) = |
| 972 | 906 | cxm_form(form_id, [], lwa, fields, "form_field aligned", true). |
| 973 | 907 | |
| 974 | -public define HTML_Off_Form | |
| 908 | +public define HTML | |
| 975 | 909 | cxm_form |
| 976 | 910 | ( |
| 977 | 911 | String form_id, |
| ... | ... | @@ -980,7 +914,7 @@ public define HTML_Off_Form |
| 980 | 914 | ) = |
| 981 | 915 | cxm_form(form_id, options, [], fields, "form_field aligned", true). |
| 982 | 916 | |
| 983 | -public define HTML_Off_Form | |
| 917 | +public define HTML | |
| 984 | 918 | cxm_form |
| 985 | 919 | ( |
| 986 | 920 | String form_id, |
| ... | ... | @@ -989,7 +923,7 @@ public define HTML_Off_Form |
| 989 | 923 | ) = |
| 990 | 924 | cxm_form(html_Id(form_id), [], action_name(""), [], [], fields, _class, true). |
| 991 | 925 | |
| 992 | -public define HTML_Off_Form | |
| 926 | +public define HTML | |
| 993 | 927 | cxm_form |
| 994 | 928 | ( |
| 995 | 929 | String form_id, | ... | ... |
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: フランスのトトロ | |
| 4 | + * Date: 07/12/2014 | |
| 5 | + * Time: 16:49 | |
| 6 | + * © David RENÉ | |
| 7 | + */ | |
| 8 | + | |
| 9 | +// ************************************************************************************* | |
| 10 | +// *** Generic form | |
| 11 | +// ************************************************************************************* | |
| 12 | +read tools/basis.anubis | |
| 13 | +read system/string.anubis | |
| 14 | +read xlib/web/common.anubis | |
| 15 | +read xlib/web/web_arg_utils.anubis | |
| 16 | +read xlib/web/making_a_web_site.anubis | |
| 17 | +read xlib/web/html_tooltip.anubis | |
| 18 | +read xlib/web/widgets.anubis | |
| 19 | +read xlib/web/widgets/specialized_elements.anubis | |
| 20 | + | |
| 21 | +public type Mandatory: // used to mark fields as mandatory. | |
| 22 | + mandatory, | |
| 23 | + non_mandatory. | |
| 24 | + | |
| 25 | +public type Width: | |
| 26 | + small, //10 char | |
| 27 | + narrow_small, //20 char | |
| 28 | + narrow, //50 char | |
| 29 | + wide, //70 char | |
| 30 | + custom(Int). | |
| 31 | + | |
| 32 | +public type FormFieldWidth: | |
| 33 | + auto, | |
| 34 | + custom(Int). | |
| 35 | + | |
| 36 | +public type CXM_Form_Field: | |
| 37 | + no_field, // empty field | |
| 38 | + | |
| 39 | + //--- title field --------------------------------------------------------------------- | |
| 40 | + title( | |
| 41 | + String text | |
| 42 | + ), | |
| 43 | + | |
| 44 | + //--- message field ------------------------------------------------------------------- | |
| 45 | + message( | |
| 46 | + String text | |
| 47 | + ), | |
| 48 | + | |
| 49 | + //--- text input field ---------------------------------------------------------------- | |
| 50 | + input( | |
| 51 | + List(CoreAttrs) options, | |
| 52 | + HTML_Label label, | |
| 53 | + HTML_Id id, | |
| 54 | + WebArgName web_arg_name, | |
| 55 | + InitialValue init_value, | |
| 56 | + Width width, | |
| 57 | + Mandatory mandatory | |
| 58 | + ), | |
| 59 | + | |
| 60 | + input_readonly( | |
| 61 | + List(CoreAttrs) options, | |
| 62 | + HTML_Label label, | |
| 63 | + HTML_Id id, | |
| 64 | + WebArgName web_arg_name, | |
| 65 | + InitialValue init_value, | |
| 66 | + Width width | |
| 67 | + ), | |
| 68 | + | |
| 69 | + //--- text area field ----------------------------------------------------------------- | |
| 70 | + text_area( | |
| 71 | + List(TextAreaOption) options, | |
| 72 | + HTML_Label label, | |
| 73 | + HTML_Id id, | |
| 74 | + WebArgName web_arg_name, | |
| 75 | + InitialValue init_value, | |
| 76 | + Width width, | |
| 77 | + Int height, | |
| 78 | + Mandatory mandatory | |
| 79 | + ), | |
| 80 | + | |
| 81 | + //--- password input field ------------------------------------------------------------ | |
| 82 | + password_input( | |
| 83 | + List(CoreAttrs) options, | |
| 84 | + HTML_Label label, | |
| 85 | + HTML_Id id, | |
| 86 | + WebArgName web_arg_name, | |
| 87 | + InitialValue init_value, | |
| 88 | + Width width, | |
| 89 | + Mandatory mandatory), | |
| 90 | + | |
| 91 | + //--- phone field ------------------------------------------------------------ | |
| 92 | + phone_input( | |
| 93 | + Maybe(List(CoreAttrs)) sms_icon_options, //if there is sms available it's success with the options (generally the js call to edit sms) | |
| 94 | + List(CoreAttrs) phone_icon_options, | |
| 95 | + List(CoreAttrs) text_options, | |
| 96 | + HTML_Label label, | |
| 97 | + HTML_Id id, | |
| 98 | + WebArgName web_arg_name, | |
| 99 | + InitialValue init_value, | |
| 100 | + Phone_Type phone_type, | |
| 101 | + Width width, | |
| 102 | + Mandatory mandatory), | |
| 103 | + | |
| 104 | + //--- email field ------------------------------------------------------------ | |
| 105 | + email_input( | |
| 106 | + List(CoreAttrs) icon_options, | |
| 107 | + List(CoreAttrs) options, | |
| 108 | + HTML_Label label, | |
| 109 | + HTML_Id id, | |
| 110 | + WebArgName web_arg_name, | |
| 111 | + InitialValue init_value, | |
| 112 | + Width width, | |
| 113 | + Mandatory mandatory), | |
| 114 | + | |
| 115 | + //--- url field ------------------------------------------------------------ | |
| 116 | + url_input( | |
| 117 | + List(CoreAttrs) icon_options, | |
| 118 | + List(CoreAttrs) options, | |
| 119 | + HTML_Label label, | |
| 120 | + HTML_Id id, | |
| 121 | + WebArgName web_arg_name, | |
| 122 | + InitialValue init_value, | |
| 123 | + Width width, | |
| 124 | + Mandatory mandatory), | |
| 125 | + | |
| 126 | + //--- hidden field ------------------------------------------------------------ | |
| 127 | + hidden( | |
| 128 | + HTML_Id id, | |
| 129 | + WebArgName web_arg_name, | |
| 130 | + WebArgValue init_value | |
| 131 | + ), | |
| 132 | + //--- explanation field --------------------------------------------------------------- | |
| 133 | + explain( | |
| 134 | + String text | |
| 135 | + ), | |
| 136 | + | |
| 137 | + //--- selector field ------------------------------------------------------------------ | |
| 138 | + selector( | |
| 139 | + List(CoreAttrs) options, | |
| 140 | + HTML_Label label, | |
| 141 | + HTML_Id id, | |
| 142 | + WebArgName web_arg_name, | |
| 143 | + Int size, | |
| 144 | + List(String) items, | |
| 145 | + Maybe(InitialValue) selected, | |
| 146 | + Mandatory mandatory | |
| 147 | + ), | |
| 148 | + | |
| 149 | + selector_c( | |
| 150 | + List(CoreAttrs) options, | |
| 151 | + HTML_Label label, | |
| 152 | + HTML_Id id, | |
| 153 | + WebArgName web_arg_name, | |
| 154 | + Int size, | |
| 155 | + List((List(CoreAttrs), WebArgValue, String)) items, | |
| 156 | + Maybe(InitialValue) selected, | |
| 157 | + Mandatory mandatory | |
| 158 | + ), | |
| 159 | + | |
| 160 | + selector_hide_show (List(CoreAttrs) options, | |
| 161 | + HTML_Label label, | |
| 162 | + HTML_Id id, | |
| 163 | + WebArgName web_arg_name, | |
| 164 | + Int size, | |
| 165 | + List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items, | |
| 166 | + Maybe(InitialValue) selected, | |
| 167 | + Mandatory mandatory), | |
| 168 | + | |
| 169 | + //--- checkbox field ------------------------------------------------------------------ | |
| 170 | + checkbox (List(CoreAttrs) options, | |
| 171 | + HTML_Label label, | |
| 172 | + HTML_Id id, | |
| 173 | + WebArgName web_arg_name, | |
| 174 | + Bool checked, | |
| 175 | + Mandatory mandatory), | |
| 176 | + | |
| 177 | + // the same one, but with the tag on the right of the checkbox | |
| 178 | + checkboxr( | |
| 179 | + List(CoreAttrs) options, | |
| 180 | + HTML_Label label, | |
| 181 | + HTML_Id id, | |
| 182 | + WebArgName web_arg_name, | |
| 183 | + Bool checked, | |
| 184 | + Mandatory mandatory | |
| 185 | + ), | |
| 186 | + | |
| 187 | + //checkbox_hide_show | |
| 188 | + checkbox_hide_show( | |
| 189 | + List(CoreAttrs) options, | |
| 190 | + HTML_Label label, | |
| 191 | + WebArgName web_arg_name, | |
| 192 | + Bool checked, | |
| 193 | + List(CXM_Form_Field) fields | |
| 194 | + ), | |
| 195 | + | |
| 196 | + //--- radio-button field -------------------------------------------------------------- | |
| 197 | + radio_button( | |
| 198 | + List(CoreAttrs) options, | |
| 199 | + HTML_Label label, | |
| 200 | + HTML_Id id, | |
| 201 | + WebArgName web_arg_name, | |
| 202 | + WebArgValue web_arg_value, | |
| 203 | + Bool checked, | |
| 204 | + Mandatory mandatory | |
| 205 | + ), | |
| 206 | + //radio_button_hide_show | |
| 207 | + radio_button_hide_show( | |
| 208 | + List(CoreAttrs) options, | |
| 209 | + HTML_Label label, | |
| 210 | + WebArgName web_arg_name, | |
| 211 | + WebArgValue web_arg_value, | |
| 212 | + Bool checked, | |
| 213 | + List(CXM_Form_Field) fields | |
| 214 | + ), | |
| 215 | + // the same one, but with the tag on the right of the radio_button | |
| 216 | + radio_buttonr (List(CoreAttrs) options, | |
| 217 | + HTML_Label label, | |
| 218 | + HTML_Id id, | |
| 219 | + WebArgName web_arg_name, | |
| 220 | + WebArgValue web_arg_value, | |
| 221 | + Bool checked, | |
| 222 | + Mandatory mandatory), | |
| 223 | + | |
| 224 | + radio_button_list( | |
| 225 | + List(CoreAttrs) options, | |
| 226 | + HTML_Label label, | |
| 227 | + HTML_Id id, | |
| 228 | + WebArgName web_arg_name, | |
| 229 | + List((WebArgValue, String)) web_arg_value, | |
| 230 | + Maybe(InitialValue) selected, | |
| 231 | + Mandatory mandatory, | |
| 232 | + Bool is_wide), | |
| 233 | + | |
| 234 | +// //--- fields table -------------------------------------------------------------------- | |
| 235 | +// fields_table (String tag, | |
| 236 | +// List(FormField) fields), | |
| 237 | +// | |
| 238 | +// //--- fields line --------------------------------------------------------------------- | |
| 239 | +// fields_line (String tag, | |
| 240 | +// List(FormField) fields), | |
| 241 | + one_line_fields (List(CXM_Form_Field) fields), | |
| 242 | + | |
| 243 | +// | |
| 244 | +// //--- preview field ------------------------------------------------------------------- | |
| 245 | +// preview (String html_text), | |
| 246 | + | |
| 247 | + //--- upload field ------------------------------------------------------------------- | |
| 248 | + upload (List(CoreAttrs) options, | |
| 249 | + HTML_Label label, | |
| 250 | + HTML_Id id, | |
| 251 | + WebArgName name, | |
| 252 | + Width width, | |
| 253 | + Mandatory mandatory), | |
| 254 | + | |
| 255 | + raw_in_form (HTML_Off_Form html), | |
| 256 | + label_for ( String label, | |
| 257 | + HTML_Id id, | |
| 258 | + HTML_Off_Form input), | |
| 259 | + div (List(CoreAttrs), List(HTML_Off_Form) contents), | |
| 260 | + div (List(CoreAttrs), List(CXM_Form_Field) fields), | |
| 261 | + partial (HTML_Partial_Content p_content), | |
| 262 | + br, | |
| 263 | + hr (List(CoreAttrs) options), | |
| 264 | +// input_with_help (CXM_Form_Field field, | |
| 265 | +// Maybe(String) help_title, | |
| 266 | +// String help_text, | |
| 267 | +// Int width), | |
| 268 | + | |
| 269 | + fieldset (List(CoreAttrs) options, | |
| 270 | + String legend, | |
| 271 | + List(CXM_Form_Field) fields), | |
| 272 | + | |
| 273 | + blank_space, | |
| 274 | + blank_space (HtmlClass class), | |
| 275 | + | |
| 276 | + //--- submit button ------------------------------------------------------------------- | |
| 277 | + submit (List(CoreAttrs) options, | |
| 278 | + HtmlClass class, | |
| 279 | + WEB_Action_Name action_name, | |
| 280 | + Maybe(String) label, | |
| 281 | + String button_text, | |
| 282 | + List((String,String)) extra_operands), | |
| 283 | + empty. | |
| 284 | + | |
| 285 | +// ////////////////////////////////////////////// | |
| 286 | +// Alternate constructors: | |
| 287 | + | |
| 288 | +public define CXM_Form_Field | |
| 289 | + fieldset | |
| 290 | + ( | |
| 291 | + HTML_Id fieldSetId, | |
| 292 | + List(CXM_Form_Field) fields | |
| 293 | + ) = | |
| 294 | + fieldset([id(fieldSetId.id)], "", fields). | |
| 295 | + | |
| 296 | +public define CXM_Form_Field | |
| 297 | + fieldset | |
| 298 | + ( | |
| 299 | + List(CXM_Form_Field) fields | |
| 300 | + ) = | |
| 301 | + fieldset([], "", fields). | |
| 302 | + | |
| 303 | +public define CXM_Form_Field | |
| 304 | + fieldset | |
| 305 | + ( | |
| 306 | + String legend, | |
| 307 | + List(CXM_Form_Field) fields | |
| 308 | + ) = | |
| 309 | + fieldset([], legend, fields). | |
| 310 | + | |
| 311 | +public define CXM_Form_Field | |
| 312 | + input(WebArgName n, InitialValue init_value, Width width) | |
| 313 | + = input([], no_label, html_Id(n.name), n, init_value, width, non_mandatory). | |
| 314 | + | |
| 315 | +public define CXM_Form_Field | |
| 316 | + input(HTML_Label label, WebArgName n, InitialValue init_value, Width width) | |
| 317 | + = input([], label, html_Id(n.name), n, init_value, width, non_mandatory). | |
| 318 | + | |
| 319 | +public define CXM_Form_Field | |
| 320 | + input(HTML_Label label, WebArgName n, InitialValue init_value, Width width, Mandatory mand) | |
| 321 | + = input([], label, html_Id(n.name), n, init_value, width, mand). | |
| 322 | + | |
| 323 | +public define CXM_Form_Field | |
| 324 | + input(HTML_Label label, HTML_Id id, WebArgName n, InitialValue init_value, Width width, Mandatory mand) | |
| 325 | + = input([], label, id, n, init_value, width, mand). | |
| 326 | + | |
| 327 | +public define CXM_Form_Field | |
| 328 | + input(List(CoreAttrs) options, HTML_Label label, WebArgName n, InitialValue init_value, Width width, Mandatory mand) | |
| 329 | + = input(options, label, html_Id(n.name), n, init_value, width, mand). | |
| 330 | + | |
| 331 | +public define CXM_Form_Field | |
| 332 | + input_readonly(HTML_Label label, WebArgName n, InitialValue init_value, Width width) | |
| 333 | + = input_readonly([], label, html_Id(n.name), n, init_value, width). | |
| 334 | + | |
| 335 | +public define CXM_Form_Field | |
| 336 | + password_input(HTML_Label label, WebArgName n, InitialValue init_value, Width width, Mandatory mand) | |
| 337 | + = password_input([], label, html_Id(n.name), n, init_value, width, mand). | |
| 338 | + | |
| 339 | +public define CXM_Form_Field | |
| 340 | + checkbox(HTML_Label label, WebArgName n, Bool checked, Mandatory mand) | |
| 341 | + = checkbox([], label, html_Id(n.name), n, checked, mand). | |
| 342 | + | |
| 343 | +public define CXM_Form_Field | |
| 344 | + checkboxr(HTML_Label label, WebArgName n, Bool checked, Mandatory mand) | |
| 345 | + = checkboxr([], label, html_Id(n.name), n, checked, mand). | |
| 346 | + | |
| 347 | +public define CXM_Form_Field | |
| 348 | + radio_button(HTML_Label label, WebArgName n, WebArgValue value, Bool checked, Mandatory mand) | |
| 349 | + = radio_button([], label, html_Id(n.name), n, value, checked, mand). | |
| 350 | + | |
| 351 | +public define CXM_Form_Field | |
| 352 | + radio_buttonr(HTML_Label label, WebArgName n, WebArgValue value, Bool checked, Mandatory mand) | |
| 353 | + = radio_buttonr([], label, html_Id(n.name), n, value, checked, mand). | |
| 354 | + | |
| 355 | +public define CXM_Form_Field | |
| 356 | + submit(WEB_Action_Name action_name, HtmlClass class, Maybe(String) label, String button_text, List((String,String)) extra_operands) | |
| 357 | + = submit([], class, action_name, label, button_text, extra_operands). | |
| 358 | + | |
| 359 | +public define CXM_Form_Field | |
| 360 | + submit(WEB_Action_Name action_name, Maybe(String) label, String button_text, List((String,String)) extra_operands) | |
| 361 | + = submit([], htmlClass(""), action_name, label, button_text, extra_operands). | |
| 362 | + | |
| 363 | +public define CXM_Form_Field | |
| 364 | + submit(WEB_Action_Name action_name, Maybe(String) label, String button_text) | |
| 365 | + = submit([], htmlClass(""), action_name, label, button_text, []). | |
| 366 | + | |
| 367 | +public define CXM_Form_Field //Helper for older project wich use only String as Action name | |
| 368 | + submit(String _action_name, Maybe(String) label, String button_text, List((String,String)) extra_operands) | |
| 369 | + = submit([], htmlClass(""), action_name(_action_name), label, button_text, extra_operands). | |
| 370 | + | |
| 371 | + | |
| 372 | +public define CXM_Form_Field | |
| 373 | + upload(HTML_Label label, HTML_Id id, WebArgName name, Width width) | |
| 374 | + = upload([], label, id, name, width, non_mandatory). | |
| 375 | + | |
| 376 | +public define CXM_Form_Field | |
| 377 | + upload(HTML_Label label, HTML_Id id, WebArgName name, Width width, Mandatory mand) | |
| 378 | + = upload([], label, id, name, width, mand). | |
| 379 | + | |
| 380 | +public define CXM_Form_Field | |
| 381 | + ip_input | |
| 382 | + ( | |
| 383 | + String label, | |
| 384 | + HTML_Id id, | |
| 385 | + WebArgName wan_prefix, | |
| 386 | + String ip | |
| 387 | + )= | |
| 388 | + label_for( | |
| 389 | + label, | |
| 390 | + id, | |
| 391 | + ip_input(id, wan_prefix, ip) | |
| 392 | + ). | |
| 393 | + | |
| 394 | + | |
| 395 | +public define CXM_Form_Field | |
| 396 | + partial_ip_input | |
| 397 | + ( | |
| 398 | + String label, | |
| 399 | + HTML_Id id, | |
| 400 | + WebArgName wan_prefix, | |
| 401 | + List(String) ip_fixed_part, | |
| 402 | + String ip | |
| 403 | + )= | |
| 404 | + label_for( | |
| 405 | + label, | |
| 406 | + id, | |
| 407 | + partial_ip_input(id, wan_prefix, ip_fixed_part, ip) | |
| 408 | + ). | |
| 409 | + | |
| 410 | +public define CXM_Form_Field | |
| 411 | + hidden | |
| 412 | + ( | |
| 413 | + WebArgName web_arg_name, | |
| 414 | + WebArgValue value | |
| 415 | + )= | |
| 416 | + hidden(html_Id(""), web_arg_name, value). | |
| 417 | + | |
| 418 | +public define CXM_Form_Field | |
| 419 | + hr | |
| 420 | + = | |
| 421 | + hr([]) | |
| 422 | +. | |
| 423 | + | |
| 424 | +public define CXM_Form_Field | |
| 425 | + div | |
| 426 | + ( | |
| 427 | + List(CoreAttrs) attrs, | |
| 428 | + HTML_Off_Form content | |
| 429 | + )= | |
| 430 | + div(attrs, [content]) | |
| 431 | +. | |
| 432 | + | |
| 433 | +public define CXM_Form_Field | |
| 434 | + div | |
| 435 | + ( | |
| 436 | + HTML_Off_Form content | |
| 437 | + )= | |
| 438 | + div([], [content]) | |
| 439 | +. | |
| 440 | + //--- explanation field --------------------- | |
| 441 | + | |
| 442 | +// ////////////////////////////////////////////////////////// | |
| 443 | + | |
| 444 | +define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content)) | |
| 445 | + construct_selector_hide_show | |
| 446 | + ( | |
| 447 | + String div_id, | |
| 448 | + List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items, | |
| 449 | + List((List(CoreAttrs), WebArgValue, String)) so_far_1, | |
| 450 | + List(HTML_Partial_Content) so_far_2, | |
| 451 | + Int n | |
| 452 | + ) = | |
| 453 | + if items is | |
| 454 | + { | |
| 455 | + [] then (so_far_1, so_far_2), | |
| 456 | + [h . t] then | |
| 457 | + since h is (cores, wav, label, content), | |
| 458 | + with linked_element = div_id + n, | |
| 459 | + construct_selector_hide_show(div_id, t, [([data("linked_element", linked_element) . cores], wav, label) . so_far_1], [ partial_content([], div([id(linked_element), style("display: none")], content)) . so_far_2 ], n + 1) | |
| 460 | + }. | |
| 461 | + | |
| 462 | +define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content)) | |
| 463 | + construct_selector_hide_show | |
| 464 | + ( | |
| 465 | + String div_id, | |
| 466 | + List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items | |
| 467 | + ) = construct_selector_hide_show(div_id, items, [], [], 0). | |
| 468 | + | |
| 469 | +public define HTML_Off_Form | |
| 470 | + format_div_CXM_Form_Field | |
| 471 | + ( | |
| 472 | + List(CXM_Form_Field) field, | |
| 473 | + List(Web_arg) lwa, | |
| 474 | + String _class, | |
| 475 | + Bool b_with_label | |
| 476 | + ). | |
| 477 | + | |
| 478 | + | |
| 479 | +public define HTML_Off_Form | |
| 480 | + format_CXM_Form_Field | |
| 481 | + ( | |
| 482 | + CXM_Form_Field ff, //CXM_Form_Field to format | |
| 483 | + List(Web_arg) lwa, //web arguments of the session, can be useful for the current drawing | |
| 484 | + String _class, | |
| 485 | + Bool b_with_label //if false, no need to show/generate label | |
| 486 | + ) = | |
| 487 | + with star = (HTML_Label l, Mandatory m) | |
| 488 | + |-> | |
| 489 | + (HTML_Label) | |
| 490 | + if b_with_label then | |
| 491 | + if m is | |
| 492 | + { | |
| 493 | + mandatory then | |
| 494 | + if l is | |
| 495 | + { | |
| 496 | + no_label then l, | |
| 497 | + label(str, help) then label(str + "<span>*</span>", help), | |
| 498 | + } | |
| 499 | + non_mandatory then l | |
| 500 | + } | |
| 501 | + else | |
| 502 | + no_label | |
| 503 | + , | |
| 504 | + pixels = (Width width) | |
| 505 | + |-> | |
| 506 | + if width is | |
| 507 | + { | |
| 508 | + small then 10, | |
| 509 | + narrow_small then 20, | |
| 510 | + narrow then 50, | |
| 511 | + wide then 70, | |
| 512 | + custom(n) then n | |
| 513 | + }, | |
| 514 | + | |
| 515 | + | |
| 516 | + if ff is | |
| 517 | + { | |
| 518 | + no_field then empty, | |
| 519 | + | |
| 520 | + title(t) then h3(t), | |
| 521 | + | |
| 522 | + message(t) then literal(t), | |
| 523 | + | |
| 524 | + input(options, _label, id, wan, default, w, mand) then | |
| 525 | + text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), | |
| 526 | + | |
| 527 | + input_readonly(options, _label, id, name, init, w) then | |
| 528 | + text_input_ro([class("in") . options], _label, id, name, init, pixels(w)), | |
| 529 | + | |
| 530 | + text_area(options, _label, id, wan, default, w, height, mand) then | |
| 531 | + text_area([input_attrs([class("in")]) . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w), height), | |
| 532 | + | |
| 533 | + password_input(options, _label, id, name, init, w, mand) then | |
| 534 | + password_input([class("in") . options], star(_label, mand), id, name, init, pixels(w)), | |
| 535 | + | |
| 536 | + phone_input(mb_sms_options, icon_options, options, _label, _id, wan, default, phone_type, w, mand) then | |
| 537 | + sequence([ | |
| 538 | + if mb_sms_options is | |
| 539 | + { | |
| 540 | + failure then empty, | |
| 541 | + success(sms_options) then img([event(onmouseover, "/icons/16x16/send_sms.png")]+sms_options, "/icons/16x16/sms.png") | |
| 542 | + }, | |
| 543 | + img(icon_options, "/icons/16x16/"+to_Icon(phone_type)), | |
| 544 | + input([class("in"), id(_id.id), name(wan.name), init(get_String(lwa, wan.name, default.value)), size(pixels(w)). options]), | |
| 545 | + ]), | |
| 546 | + | |
| 547 | + email_input(icon_options, options, _label, id, wan, default, w, mand) then | |
| 548 | + sequence([ | |
| 549 | + img(icon_options, "/icons/16x16/email_edit.png"), | |
| 550 | + text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), | |
| 551 | + ]), | |
| 552 | + | |
| 553 | + url_input(icon_options, options, _label, id, wan, default, w, mand) then | |
| 554 | + sequence([ | |
| 555 | + img(icon_options, "/icons/16x16/url.png"), | |
| 556 | + text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), | |
| 557 | + ]), | |
| 558 | + | |
| 559 | + hidden(h_id, name, init) then hidden(name, init), | |
| 560 | + | |
| 561 | + explain(t) then | |
| 562 | + div([class("sub")], literal(t)), | |
| 563 | + | |
| 564 | + selector(options, _label, id, wan, size, items, selected, mand) then | |
| 565 | + if selected is | |
| 566 | + { | |
| 567 | + failure then selector([class("in") . options], star(_label, mand), id, wan, size, items), | |
| 568 | + success(default) then selector([class("in") . options], star(_label, mand), id, wan, size, items, init(get_String(lwa, wan.name, default.value))), | |
| 569 | + }, | |
| 570 | + | |
| 571 | + selector_c(options, _label, id, wan, size, items, selected, mand) then | |
| 572 | + if selected is | |
| 573 | + { | |
| 574 | + failure then selector_c([class("in") . options], star(_label, mand), id, wan, size, items), | |
| 575 | + success(default) then selector_c([class("in") . options], star(_label, mand), id, wan, size, items, init(get_String(lwa, wan.name, default.value))), | |
| 576 | + }, | |
| 577 | + | |
| 578 | + selector_hide_show(options, _label, id, wan, size, items_with_partial, selected, mand) then | |
| 579 | + with div_id = generate_random_string(15), | |
| 580 | + since construct_selector_hide_show(div_id, items_with_partial) is (items, partial_content_list), | |
| 581 | + sequence([ | |
| 582 | + selector_c([class("in"), class("cxm_selector_hide_show"), event(onchange, "select_hide_show('" + div_id + "', this);")], star(_label, mand), id, wan, size, reverse(items), if selected is { failure then init(""), success(default) then init(get_String(lwa, wan.name, default.value)) } ), | |
| 583 | + partial(partial_content(partial_content_list)) | |
| 584 | + ]), | |
| 585 | + | |
| 586 | + checkbox(options, _label, id, wan, checked, mand) then | |
| 587 | + check_box([class("in") . options], star(_label, mand), id, wan, get_Bool(lwa, wan.name, checked)), | |
| 588 | + | |
| 589 | + checkboxr(options, _label, id, wan, checked, mand) then | |
| 590 | + check_box_r([class("in") . options], star(_label, mand), id, wan, get_Bool(lwa, wan.name, checked)), | |
| 591 | + | |
| 592 | + checkbox_hide_show(options, _label, wan, checked, fields) then | |
| 593 | + with div_id = generate_random_string(15), | |
| 594 | + sequence([ | |
| 595 | + check_box([data("show_id", div_id), class("in cxm_checkbox_hide_show"), event(onclick, "checked_hide_show_element('"+div_id+"', this);")], _label, html_Id("checkbox_"+div_id), wan, get_Bool(lwa, wan.name, checked)), | |
| 596 | + div([id(div_id), style("display:"+if checked then "block" else "none")], format_div_CXM_Form_Field(fields, lwa, _class, b_with_label)) | |
| 597 | + ]), | |
| 598 | + | |
| 599 | + radio_button(options, _label, id, wan, val, checked, mand) then | |
| 600 | + radio_button([class("in"), event(onclick, "radio_hide_show_group('"+wan.name+"', this);") . options], star(_label, mand), id, wan, val, get_Bool(lwa, wan.name, checked)), | |
| 601 | + | |
| 602 | + radio_button_hide_show(options, _label, wan, val, checked, fields) then | |
| 603 | + with div_id = generate_random_string(15), | |
| 604 | + sequence([ | |
| 605 | + radio_button([data("show_id", div_id), class("in"), class("cxm_radio_hide_show"), event(onclick, "radio_hide_show_group('"+wan.name+"', this);")], _label, html_Id("radio_button_hide_show_"+div_id), wan, val, get_Bool(lwa, wan.name, checked)), | |
| 606 | + div([id(div_id), style("display:"+if checked then "block" else "none")], format_div_CXM_Form_Field(fields, lwa, _class, b_with_label)) | |
| 607 | + ]), | |
| 608 | + | |
| 609 | + radio_buttonr(options, _label, id, wan, val, checked, mand) then | |
| 610 | + radio_button_r([class("in") . options], star(_label, mand), id, wan, val, get_Bool(lwa, wan.name, checked)), | |
| 611 | + | |
| 612 | + radio_button_list (options, _label, id, wan, items, selected, mand, wide) then | |
| 613 | + with new_selected = | |
| 614 | + if get_String(lwa, wan.name) is | |
| 615 | + { | |
| 616 | + failure then selected, | |
| 617 | + success(value) then success(init(value)) | |
| 618 | + }, | |
| 619 | + | |
| 620 | + sequence([ | |
| 621 | + //literal("<label for=\"" + wan.name + "\">" + label + star(_label, mand) + "</label>"), | |
| 622 | + div( [class("radiolist")], sequence( | |
| 623 | + with i = var((Int)-1), | |
| 624 | + itemclass = if wide then "radiolistitem_wide" else "radiolistitem", | |
| 625 | + map( ((WebArgValue, String) item) |-> | |
| 626 | + i <- *i + 1; | |
| 627 | + if item is (wav, item_label) then | |
| 628 | + with _id = if id is html_Id(the_id) then html_Id(the_id + "_radio_" + *i), | |
| 629 | + div([class(itemclass)], radio_button_r(options, label(item_label), _id, wan, wav, | |
| 630 | + if new_selected is success(v) then wav.value = v.value else false)), | |
| 631 | + items)) | |
| 632 | + ), | |
| 633 | + ]), | |
| 634 | + one_line_fields(fields) then | |
| 635 | + table([nude, class("form_one_line")],[row([], | |
| 636 | + map((CXM_Form_Field ff2) |-> cell([],format_CXM_Form_Field(ff2, lwa, _class, b_with_label)),fields))]) | |
| 637 | + , | |
| 638 | + | |
| 639 | + upload(options, _label, id, name, w, mand) then | |
| 640 | + file_upload([class("in") . options], star(_label, mand), id, name, pixels(w)), | |
| 641 | + | |
| 642 | + raw_in_form(html) then html, | |
| 643 | +// div([class("in")], html), | |
| 644 | + label_for(label, id, input) then | |
| 645 | + sequence([ | |
| 646 | + if id is html_Id(_id) then | |
| 647 | + literal("<label for=\"" + _id + "\">" + label + "</label>"), | |
| 648 | + input | |
| 649 | + ]), | |
| 650 | + | |
| 651 | + div(options, e) then div(options, e), | |
| 652 | + div(options, fields)then div(options, format_div_CXM_Form_Field(fields, lwa, _class, b_with_label)), | |
| 653 | + partial(p_content) then partial(p_content), | |
| 654 | + br then br, | |
| 655 | + hr(opts) then hr(opts), | |
| 656 | +// input_with_help(input, help_title, help_text, width) then | |
| 657 | +// sequence([ | |
| 658 | +// format_CXM_Form_Field(input, lwa, html_tooltip(force_String(help_title), help_text, width)), | |
| 659 | +// ]), | |
| 660 | + | |
| 661 | + fieldset(options, legend, fields) then | |
| 662 | + sequence([ | |
| 663 | + literal("<fieldset" + format_attrs(options) + ">"), | |
| 664 | + literal(if length(legend) > 0 then "<legend>" + legend + "</legend>" else ""), | |
| 665 | + format_div_CXM_Form_Field(fields, lwa, _class, b_with_label), | |
| 666 | + literal("</fieldset>") | |
| 667 | + ]), | |
| 668 | + | |
| 669 | + blank_space then | |
| 670 | + div([class("blank_space")], literal(" ")), | |
| 671 | + | |
| 672 | + blank_space(htmlClass) then | |
| 673 | + div([class(htmlClass.class)], literal(" ")), | |
| 674 | + | |
| 675 | + submit(attrs, htmlClass, action_name, Maybe(String) mb_label, button_text, extra_operands) then | |
| 676 | + actioner( same, // TODO change this to allow external URL | |
| 677 | + if mb_label is | |
| 678 | + { | |
| 679 | + failure then same, | |
| 680 | + success(n) then same(n) | |
| 681 | + }, | |
| 682 | + submit(attrs + [class(htmlClass.class + " cxm_submit")], button_text), | |
| 683 | + action_name, | |
| 684 | + extra_operands | |
| 685 | + ), | |
| 686 | + empty then literal("") | |
| 687 | + }. | |
| 688 | + | |
| 689 | + | |
| 690 | +public define HTML_Off_Form | |
| 691 | + format_div_CXM_Form_Field | |
| 692 | + ( | |
| 693 | + List(CXM_Form_Field) fields, | |
| 694 | + List(Web_arg) lwa, | |
| 695 | + String _class, | |
| 696 | + Bool b_with_label | |
| 697 | + )= | |
| 698 | + //println("format_div_CXM_Form_Field"); | |
| 699 | + sequence( map((CXM_Form_Field field) | |
| 700 | + |-> | |
| 701 | + //with css_line = if line = 0 then " odd_line" else " even_line", | |
| 702 | + //println("class "+css_line+" line "+line); | |
| 703 | + if field is empty then | |
| 704 | + empty | |
| 705 | + else if field is no_field then | |
| 706 | + empty | |
| 707 | + else if field is hidden(_id, name, init) then | |
| 708 | + format_CXM_Form_Field(field, lwa, _class, b_with_label) | |
| 709 | + else if field is br then | |
| 710 | + format_CXM_Form_Field(field, lwa, _class, b_with_label) | |
| 711 | + else if field is text_area(options, _label, id, wan, default, w, height, mand) then | |
| 712 | + div([class(_class)], format_CXM_Form_Field(field, lwa, _class, b_with_label)) | |
| 713 | + else | |
| 714 | + div([class(_class)], format_CXM_Form_Field(field, lwa, _class, b_with_label)) | |
| 715 | + , fields)) | |
| 716 | +. | |
| 717 | + | |
| 718 | +public define HTML_Off_Form | |
| 719 | + to_HTML_Off_Form | |
| 720 | + ( | |
| 721 | + List(CXM_Form_Field) fields, | |
| 722 | + List(Web_arg) lwa, | |
| 723 | + String _class, | |
| 724 | + Bool b_with_label | |
| 725 | + )= | |
| 726 | + format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) | |
| 727 | +. | |
| 728 | + | |
| 729 | +public define HTML_Off_Form | |
| 730 | + to_HTML_Off_Form | |
| 731 | + ( | |
| 732 | + List(CXM_Form_Field) fields, | |
| 733 | + String _class, | |
| 734 | + Bool b_with_label | |
| 735 | + )= | |
| 736 | + to_HTML_Off_Form(fields, [], _class, b_with_label). | |
| 737 | + | |
| 738 | +public define HTML_Off_Form | |
| 739 | + to_HTML_Off_Form | |
| 740 | + ( | |
| 741 | + List(CXM_Form_Field) fields, | |
| 742 | + List(Web_arg) lwa | |
| 743 | + )= | |
| 744 | + to_HTML_Off_Form(fields, lwa, "form_field aligned", true) | |
| 745 | +. | |
| 746 | + | |
| 747 | +public define HTML_Off_Form | |
| 748 | + to_HTML_Off_Form | |
| 749 | + ( | |
| 750 | + CXM_Form_Field field, | |
| 751 | + List(Web_arg) lwa | |
| 752 | + )= | |
| 753 | + to_HTML_Off_Form([field], lwa, "form_field aligned", true) | |
| 754 | +. | |
| 755 | + | |
| 756 | +public define HTML_Off_Form | |
| 757 | + to_HTML_Off_Form | |
| 758 | + ( | |
| 759 | + List(CXM_Form_Field) fields | |
| 760 | + )= | |
| 761 | + to_HTML_Off_Form(fields, [], "form_field aligned", true) | |
| 762 | +. | |
| 763 | + | |
| 764 | +public define HTML_Off_Form | |
| 765 | + cxm_form | |
| 766 | + ( | |
| 767 | + HTML_Id form_Id, | |
| 768 | + List(CoreAttrs) options, | |
| 769 | + WEB_Action_Name action, | |
| 770 | + List((String,String)) extra_ops, | |
| 771 | + List(Web_arg) lwa, | |
| 772 | + List(CXM_Form_Field) fields, | |
| 773 | + String _class, | |
| 774 | + Bool b_with_label | |
| 775 | + ) = | |
| 776 | + form( | |
| 777 | + //form_Id, | |
| 778 | + [class("cxm_form"), id(form_Id.id) . options], | |
| 779 | + action, | |
| 780 | + extra_ops, | |
| 781 | + format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) | |
| 782 | + ). | |
| 783 | + | |
| 784 | +public define HTML_Off_Form | |
| 785 | +/* older manner to call CXM_form with action as String. | |
| 786 | + * this function only exists for compatibility with older projects. Please consider | |
| 787 | + * to use the above function with WEB_Action_Name instead of String | |
| 788 | +*/ | |
| 789 | + cxm_form | |
| 790 | + ( | |
| 791 | + HTML_Id form_Id, | |
| 792 | + List(CoreAttrs) options, | |
| 793 | + String action, //older manner to call action with String | |
| 794 | + List((String,String)) extra_ops, | |
| 795 | + List(Web_arg) lwa, | |
| 796 | + List(CXM_Form_Field) fields, | |
| 797 | + String _class, | |
| 798 | + Bool b_with_label | |
| 799 | + ) = | |
| 800 | + | |
| 801 | + form( | |
| 802 | + //form_Id, | |
| 803 | + [class("cxm_form"), id(form_Id.id) . options], | |
| 804 | + action_name(action), | |
| 805 | + extra_ops, | |
| 806 | + format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) | |
| 807 | + ). | |
| 808 | + | |
| 809 | +public define HTML_Off_Form | |
| 810 | + cxm_form | |
| 811 | + ( | |
| 812 | + String form_name, | |
| 813 | + List(CoreAttrs) options, | |
| 814 | + WEB_Action_Name action, | |
| 815 | + List((String,String)) extra_ops, | |
| 816 | + List(Web_arg) lwa, | |
| 817 | + List(CXM_Form_Field) form_fields, | |
| 818 | + String _class, | |
| 819 | + Bool b_with_label | |
| 820 | + )= | |
| 821 | + cxm_form(html_Id(form_name), options, action, extra_ops, lwa, form_fields, _class, b_with_label). | |
| 822 | + | |
| 823 | +public define HTML_Off_Form | |
| 824 | + cxm_form | |
| 825 | + ( | |
| 826 | + String form_name, | |
| 827 | + List(CoreAttrs) options, | |
| 828 | + WEB_Action_Name action, | |
| 829 | + List((String,String)) extra_ops, | |
| 830 | + List(Web_arg) lwa, | |
| 831 | + List(CXM_Form_Field) form_fields | |
| 832 | + )= | |
| 833 | + cxm_form(form_name, options, action, extra_ops, lwa, form_fields, "form_field aligned", true) | |
| 834 | +. | |
| 835 | + | |
| 836 | +public define HTML_Off_Form | |
| 837 | + cxm_form | |
| 838 | + ( | |
| 839 | + String form_name, | |
| 840 | + List(CoreAttrs) options, | |
| 841 | + String action, | |
| 842 | + List((String,String)) extra_ops, | |
| 843 | + List(Web_arg) lwa, | |
| 844 | + List(CXM_Form_Field) form_fields, | |
| 845 | + | |
| 846 | + Bool b_with_label | |
| 847 | + )= | |
| 848 | + cxm_form(html_Id(form_name), options, action_name(action), extra_ops, lwa, form_fields, "form_field aligned", b_with_label) | |
| 849 | +. | |
| 850 | + | |
| 851 | +public define HTML_Off_Form | |
| 852 | + cxm_form | |
| 853 | + ( | |
| 854 | + String form_name, | |
| 855 | + List(CoreAttrs) options, | |
| 856 | + String action, | |
| 857 | + List((String,String)) extra_ops, | |
| 858 | + List(Web_arg) lwa, | |
| 859 | + List(CXM_Form_Field) form_fields | |
| 860 | + )= | |
| 861 | + cxm_form(html_Id(form_name), options, action_name(action), extra_ops, lwa, form_fields, "form_field aligned", true) | |
| 862 | +. | |
| 863 | + | |
| 864 | +public define HTML_Off_Form | |
| 865 | + cxm_form | |
| 866 | + ( | |
| 867 | + String form_id, | |
| 868 | + List(CoreAttrs) options, | |
| 869 | + List(HTML_Off_Form) fields, | |
| 870 | + String _class | |
| 871 | + ) = | |
| 872 | + cxm_form(html_Id(form_id), options, action_name(""), [], [], map((HTML_Off_Form field) |-> raw_in_form(field), fields), _class, true ) | |
| 873 | +. | |
| 874 | + | |
| 875 | +public define HTML_Off_Form | |
| 876 | + cxm_form | |
| 877 | + ( | |
| 878 | + String form_id, | |
| 879 | + List(CoreAttrs) options, | |
| 880 | + List(HTML_Off_Form) fields | |
| 881 | + ) = | |
| 882 | + cxm_form(options, action_name(""), [], [], map((HTML_Off_Form field) |-> raw_in_form(field), fields), "form_field aligned", true ) | |
| 883 | +. | |
| 884 | + | |
| 885 | +public define HTML_Off_Form | |
| 886 | + cxm_form | |
| 887 | + ( | |
| 888 | + String form_id, | |
| 889 | + List(CoreAttrs) options, | |
| 890 | + List(Web_arg) lwa, | |
| 891 | + List(CXM_Form_Field) fields, | |
| 892 | + String _class, | |
| 893 | + Bool b_with_label | |
| 894 | + ) = | |
| 895 | + cxm_form(html_Id(form_id), options, action_name(""), [], lwa, fields, _class, b_with_label). | |
| 896 | + | |
| 897 | +public define HTML_Off_Form | |
| 898 | + cxm_form | |
| 899 | + ( | |
| 900 | + String form_id, | |
| 901 | + List(HTML_Off_Form) fields, | |
| 902 | + String _class | |
| 903 | + ) = | |
| 904 | + cxm_form(html_Id(form_id), [], action_name(""), [], [], map((HTML_Off_Form field) |-> raw_in_form(field), fields), _class, true ). | |
| 905 | + | |
| 906 | +public define HTML_Off_Form | |
| 907 | + cxm_form | |
| 908 | + ( | |
| 909 | + String form_id, | |
| 910 | + List(Web_arg) lwa, | |
| 911 | + List(CXM_Form_Field) fields, | |
| 912 | + String _class | |
| 913 | + ) = | |
| 914 | + cxm_form(form_id, [], lwa, fields, _class, true). | |
| 915 | + | |
| 916 | +public define HTML_Off_Form | |
| 917 | + cxm_form | |
| 918 | + ( | |
| 919 | + String form_id, | |
| 920 | + List(Web_arg) lwa, | |
| 921 | + List(CXM_Form_Field) fields, | |
| 922 | + ) = | |
| 923 | + cxm_form(form_id, [], lwa, fields, "form_field aligned", true). | |
| 924 | + | |
| 925 | +public define HTML_Off_Form | |
| 926 | + cxm_form | |
| 927 | + ( | |
| 928 | + String form_id, | |
| 929 | + List(CoreAttrs) options, | |
| 930 | + List(CXM_Form_Field) fields, | |
| 931 | + ) = | |
| 932 | + cxm_form(form_id, options, [], fields, "form_field aligned", true). | |
| 933 | + | |
| 934 | +public define HTML_Off_Form | |
| 935 | + cxm_form | |
| 936 | + ( | |
| 937 | + String form_id, | |
| 938 | + List(CXM_Form_Field) fields, | |
| 939 | + String _class | |
| 940 | + ) = | |
| 941 | + cxm_form(html_Id(form_id), [], action_name(""), [], [], fields, _class, true). | |
| 942 | + | |
| 943 | +public define HTML_Off_Form | |
| 944 | + cxm_form | |
| 945 | + ( | |
| 946 | + String form_id, | |
| 947 | + List(CXM_Form_Field) fields | |
| 948 | + ) = | |
| 949 | + cxm_form(html_Id(form_id), [], action_name(""), [], [], fields, "form_field aligned", true). | ... | ... |
| 1 | +diff a/web/form.anubis b/web/form.anubis (rejected hunks) | |
| 2 | +@@ -521,7 +521,6 @@ | |
| 3 | + | |
| 4 | + message(t) then literal(t), | |
| 5 | + | |
| 6 | +- input(options, _label, id, wan, default, w, mand) then | |
| 7 | + input(options, _label, _id, _name, default, w, mand) then | |
| 8 | + sequence([ | |
| 9 | + input([class("in"), options], name(_name.name), value(get_String(lwa, wan.name, default.value)), size(pixels(w)) . options], star(_label, mand)), | ... | ... |
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: フランスのトトロ aka (David RENÉ) | |
| 4 | + * Date: 01/05/2026 | |
| 5 | + * Time: 15:11 | |
| 6 | + * © David RENÉ | |
| 7 | + */ | |
| 8 | + | |
| 9 | + | |
| 10 | +transmit xlib/web/widgets/left_menu.anubis | |
| 11 | +read xlib/web/making_a_web_site.anubis | |
| 12 | +read xlib/web/web_action.anubis | |
| 13 | +read xlib/web/load_content.anubis | |
| 14 | + | |
| 15 | +define List(HTML) | |
| 16 | + make_sidebar | |
| 17 | + ( | |
| 18 | + (String) -> String _T, //translator function | |
| 19 | + List(Left_Menu_Entry) entries, | |
| 20 | + String selected, | |
| 21 | + List(HTML) so_far | |
| 22 | + )= | |
| 23 | + if entries is | |
| 24 | + { | |
| 25 | + [] then reverse(so_far), //reverse to be in the right direction | |
| 26 | + [h . t] then | |
| 27 | + with entry = | |
| 28 | + if h is | |
| 29 | + { | |
| 30 | + left_menu_entry(_menu_id, subentry, _classes, _action, _text, _extra) then | |
| 31 | + with item_class = if subentry then "subitem " else "item ", | |
| 32 | + li(class("nav-item"), | |
| 33 | + p([class(item_class+_menu_id+"_icon"+(if _menu_id=selected then " selected" else "")+ " "+join(" ", _classes))],actioner(same,same, link(_T(_text)),_action,_extra))), | |
| 34 | + | |
| 35 | + left_menu_entry_js(_menu_id, subentry, _classes, _js_to_call, _text) then | |
| 36 | + with item_class = if subentry then "subitem " else "item ", | |
| 37 | + li(class("nav-item"), | |
| 38 | + p([class(item_class+"clickable "+_menu_id+"_icon"+(if _menu_id=selected then " active" else "")+ " "+join(" ", _classes)), | |
| 39 | + event(onclick, _js_to_call)],text(_T(_text)))), | |
| 40 | + | |
| 41 | + left_menu_entry_load_content(_menu_id, subentry, _classes, _action, _text, _extra, _target_id, _replace, _overlay) then | |
| 42 | + with item_class = if subentry then "subitem " else "item ", | |
| 43 | + li(class("nav-item"), | |
| 44 | + p([class(item_class+"clickable "+_menu_id+"_icon"+(if _menu_id=selected then " active" else "")+ " "+join(" ", _classes)), | |
| 45 | + event(onclick, load_content(_target_id, _action, _extra, _replace, _overlay))],text(_T(_text)))), | |
| 46 | + | |
| 47 | + title(_title_id, subtitle, _classes, _text) then | |
| 48 | + p([class(if subtitle then "menu_subtitle" else "menu_title"), class((if _title_id=selected then " active" else "")+ " "+join(" ", _classes))], text([],_T(_text))) | |
| 49 | +// p([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) | |
| 50 | + }, | |
| 51 | + make_sidebar(_T, t, selected, [ entry . so_far]) | |
| 52 | + }. | |
| 53 | + | |
| 54 | +public define HTML | |
| 55 | + make_sidebar | |
| 56 | + ( | |
| 57 | + (String) -> String _T, //translator function | |
| 58 | + Left_Menu l_menu | |
| 59 | + )= | |
| 60 | + if l_menu is | |
| 61 | + { | |
| 62 | + no_left_menu then empty, | |
| 63 | + left_menu(entries, selected) then | |
| 64 | + head_tags([css(css_file("/css/left_menu.css"))], | |
| 65 | + make_sidebar(_T, entries, selected, []) | |
| 66 | + ) | |
| 67 | + } | |
| 68 | +. | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | +public define One set_current_left_menu(WEB_Session s, String v) = replace_String(s.fields, "AWS_CURRENT_LEFT_MENU", v). | |
| 73 | +public define One set_current_left_menu(Var(List(Session_Field)) fields, String v) = replace_String(fields, "AWS_CURRENT_LEFT_MENU", v). | |
| 74 | +public define String get_current_left_menu(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_LEFT_MENU", ""). | |
| 75 | + | |
| 76 | +public define One set_selected_left_menu_entry(WEB_Session s, String v) = replace_String(s.fields, "AWS_SELECTED_LEFT_MENU_ENTRY", v). | |
| 77 | +public define One set_selected_left_menu_entry(Var(List(Session_Field)) fields, String v) = replace_String(fields, "AWS_SELECTED_LEFT_MENU_ENTRY", v). | |
| 78 | +public define String get_selected_left_menu_entry(WEB_Session s) = get_String (s.fields, "AWS_SELECTED_LEFT_MENU_ENTRY", ""). | ... | ... |
web/generic_form.anubis deleted
| 1 | - | |
| 2 | - | |
| 3 | - | |
| 4 | - *Project* The Anubis Project | |
| 5 | - | |
| 6 | - *Title* | |
| 7 | - | |
| 8 | - *Copyright* Copyright (c) Alain Prouté 2005. | |
| 9 | - | |
| 10 | - | |
| 11 | - *Author* Alain Prouté | |
| 12 | - | |
| 13 | - | |
| 14 | - | |
| 15 | - In this file we rationalize the construction of forms. | |
| 16 | - | |
| 17 | - | |
| 18 | - | |
| 19 | -read CXM_making_a_web_site.anubis | |
| 20 | -read tools/basis.anubis | |
| 21 | - | |
| 22 | - | |
| 23 | -public type Mandatory: // used to mark fields as mandatory. | |
| 24 | - mandatory, | |
| 25 | - non_mandatory. | |
| 26 | - | |
| 27 | -public type Width: | |
| 28 | - small, | |
| 29 | - narrow, | |
| 30 | - wide, | |
| 31 | - custom(Int). | |
| 32 | - | |
| 33 | -public type FormFieldWidth: | |
| 34 | - auto, | |
| 35 | - custom(Int). | |
| 36 | - | |
| 37 | - | |
| 38 | - | |
| 39 | - Sorts of fields that you can put in a form: | |
| 40 | - | |
| 41 | -public type FormField: | |
| 42 | - | |
| 43 | - //--- title field --------------------------------------------------------------------- | |
| 44 | - title (String text), | |
| 45 | - title (Int text_size, | |
| 46 | - String text), | |
| 47 | - title_f (List(Text_Option) -> HTML_In_Form), | |
| 48 | - | |
| 49 | - //--- message field ------------------------------------------------------------------- | |
| 50 | - message (Result(String,String) msg), | |
| 51 | - message_f (Result(List(Text_Option) -> HTML_In_Form,List(Text_Option) -> HTML_In_Form)), | |
| 52 | - | |
| 53 | - //--- text input field ---------------------------------------------------------------- | |
| 54 | - input (WebArgName web_arg_name, | |
| 55 | - String tag, | |
| 56 | - Width width, | |
| 57 | - InitialValue init_value, | |
| 58 | - Mandatory mandatory), | |
| 59 | - input (WebArgName web_arg_name, | |
| 60 | - Width width, | |
| 61 | - InitialValue init_value), | |
| 62 | - input_f (WebArgName web_arg_name, | |
| 63 | - List(Text_Option) -> HTML_In_Form tag, | |
| 64 | - Width width, | |
| 65 | - InitialValue init_value, | |
| 66 | - Mandatory mandatory), | |
| 67 | - | |
| 68 | - //--- password input field ------------------------------------------------------------ | |
| 69 | - password_input (WebArgName web_arg_name, | |
| 70 | - String tag, | |
| 71 | - Mandatory mandatory), | |
| 72 | - password_input_f (WebArgName web_arg_name, | |
| 73 | - List(Text_Option) -> HTML_In_Form tag, | |
| 74 | - Mandatory mandatory), | |
| 75 | - | |
| 76 | - //--- explanation field --------------------------------------------------------------- | |
| 77 | - explain (String text), | |
| 78 | - explain (String text, | |
| 79 | - FormFieldWidth width), | |
| 80 | - explain_f (List(Text_Option) -> HTML_In_Form), | |
| 81 | - | |
| 82 | - //--- selector field ------------------------------------------------------------------ | |
| 83 | - selector (WebArgName web_arg_name, | |
| 84 | - String tag, | |
| 85 | - List(String) items, | |
| 86 | - Maybe(InitialValue) selected, | |
| 87 | - Mandatory mandatory), | |
| 88 | - selector_f (WebArgName web_arg_name, | |
| 89 | - List(Text_Option) -> HTML_In_Form, | |
| 90 | - List(String) items, | |
| 91 | - Maybe(InitialValue) selected, | |
| 92 | - Mandatory mandatory), | |
| 93 | - selector_c (WebArgName web_arg_name, | |
| 94 | - String tag, | |
| 95 | - List((List(CoreAttrs), WebArgValue, String)) items, | |
| 96 | - Maybe(InitialValue) selected, | |
| 97 | - Mandatory mandatory), | |
| 98 | - | |
| 99 | - | |
| 100 | - | |
| 101 | - //--- checkbox field ------------------------------------------------------------------ | |
| 102 | - checkbox (WebArgName web_arg_name, | |
| 103 | - String tag, | |
| 104 | - Bool checked, | |
| 105 | - Mandatory mandatory), | |
| 106 | - // the same one, but with the tag on the right of the checkbox | |
| 107 | - checkboxr (WebArgName web_arg_name, | |
| 108 | - String tag, | |
| 109 | - Bool checked, | |
| 110 | - Mandatory mandatory), | |
| 111 | - checkbox_f (WebArgName web_arg_name, | |
| 112 | - List(Text_Option) -> HTML_In_Form, | |
| 113 | - Bool checked, | |
| 114 | - Mandatory mandatory), | |
| 115 | - | |
| 116 | - //--- radio-button field -------------------------------------------------------------- | |
| 117 | - radio_button (WebArgName web_arg_name, | |
| 118 | - WebArgValue web_arg_value, | |
| 119 | - String tag, | |
| 120 | - Bool checked, | |
| 121 | - Mandatory mandatory), | |
| 122 | - // the same one, but with the tag on the right of the radio_button | |
| 123 | - radio_buttonr (WebArgName web_arg_name, | |
| 124 | - WebArgValue web_arg_value, | |
| 125 | - String tag, | |
| 126 | - Bool checked, | |
| 127 | - Mandatory mandatory), | |
| 128 | - | |
| 129 | - //--- text area field ----------------------------------------------------------------- | |
| 130 | - text_area (WebArgName web_arg_name, | |
| 131 | - InitialValue initial_text), | |
| 132 | - text_area (WebArgName web_arg_name, | |
| 133 | - String tag, | |
| 134 | - InitialValue initial_text), | |
| 135 | - text_area (WebArgName web_arg_name, | |
| 136 | - String tag, | |
| 137 | - InitialValue initial_text, | |
| 138 | - Int width, | |
| 139 | - Int height), | |
| 140 | - | |
| 141 | - //--- fields table -------------------------------------------------------------------- | |
| 142 | - fields_table (String tag, | |
| 143 | - List(FormField) fields), | |
| 144 | - | |
| 145 | - //--- fields line --------------------------------------------------------------------- | |
| 146 | - fields_line (String tag, | |
| 147 | - List(FormField) fields), | |
| 148 | - fields_line (List(FormField) fields), | |
| 149 | - | |
| 150 | - //--- preview field ------------------------------------------------------------------- | |
| 151 | - preview (String html_text), | |
| 152 | - | |
| 153 | - //--- submit button ------------------------------------------------------------------- | |
| 154 | - submit (String action_name, | |
| 155 | - Maybe(String) label, | |
| 156 | - String button_text, | |
| 157 | - List((String,String)) extra_operands). | |
| 158 | - | |
| 159 | - | |
| 160 | - Convenience functions: | |
| 161 | - | |
| 162 | -public define FormField title(List(Text_Option) -> HTML_In_Form f) = title_f(f). | |
| 163 | -public define FormField | |
| 164 | - message(Result(List(Text_Option) -> HTML_In_Form,List(Text_Option) -> HTML_In_Form) f) = message_f(f). | |
| 165 | -public define FormField input(WebArgName web_arg_name, | |
| 166 | - List(Text_Option) -> HTML_In_Form tag, | |
| 167 | - Width width, | |
| 168 | - InitialValue init_value, | |
| 169 | - Mandatory mandatory) | |
| 170 | - = input_f(web_arg_name,tag,width,init_value,mandatory). | |
| 171 | -public define FormField password_input(WebArgName web_arg_name, | |
| 172 | - List(Text_Option) -> HTML_In_Form tag, | |
| 173 | - Mandatory mandatory) | |
| 174 | - = password_input_f(web_arg_name,tag,mandatory). | |
| 175 | -public define FormField explain(List(Text_Option) -> HTML_In_Form f) = explain_f(f). | |
| 176 | -public define FormField selector(WebArgName web_arg_name, | |
| 177 | - List(Text_Option) -> HTML_In_Form f, | |
| 178 | - List(String) items, | |
| 179 | - Maybe(InitialValue) selected, | |
| 180 | - Mandatory mandatory) | |
| 181 | - = selector_f(web_arg_name,f,items,selected,mandatory). | |
| 182 | -public define FormField checkbox(WebArgName web_arg_name, | |
| 183 | - List(Text_Option) -> HTML_In_Form f, | |
| 184 | - Bool checked, | |
| 185 | - Mandatory mandatory) | |
| 186 | - = checkbox_f(web_arg_name,f,checked,mandatory). | |
| 187 | - | |
| 188 | - Make the form itself with: | |
| 189 | - | |
| 190 | -public define HTML_Off_Form | |
| 191 | - generic_form | |
| 192 | - ( | |
| 193 | - String form_name, | |
| 194 | - RGB background_color, | |
| 195 | - Int width, | |
| 196 | - List(FormField) fields | |
| 197 | - ). | |
| 198 | - | |
| 199 | - | |
| 200 | - | |
| 201 | - --- That's all for the public part ! -------------------------------------------------- | |
| 202 | - | |
| 203 | -// TO DO update code of CXM generic form | |
| 204 | -define HTML_Row(HTML_In_Form) | |
| 205 | - format_form_field | |
| 206 | - ( | |
| 207 | - FormField ff | |
| 208 | - ) = | |
| 209 | - with star = (Mandatory m) |-> (HTML_In_Form)text([color(rgb(255,0,0)),size(12)], | |
| 210 | - if m is | |
| 211 | - { | |
| 212 | - mandatory then "*", | |
| 213 | - non_mandatory then "" | |
| 214 | - }), | |
| 215 | - row( | |
| 216 | - if ff is | |
| 217 | - { | |
| 218 | - title(t) then (List(HTML_Cell(HTML_In_Form))) | |
| 219 | - [ | |
| 220 | - cell([columns(3),h_center],text([size(16),bold,color(rgb(0,0,0))],t)) | |
| 221 | - ], | |
| 222 | - | |
| 223 | - title(s,t) then (List(HTML_Cell(HTML_In_Form))) | |
| 224 | - [ | |
| 225 | - cell([columns(3),h_center],text([size(s),bold,color(rgb(0,0,0))],t)) | |
| 226 | - ], | |
| 227 | - | |
| 228 | - title_f(t) then (List(HTML_Cell(HTML_In_Form))) | |
| 229 | - [ | |
| 230 | - cell([columns(3),h_center],t([size(16),bold,color(rgb(0,0,0))])) | |
| 231 | - ], | |
| 232 | - | |
| 233 | - message(r) then (List(HTML_Cell(HTML_In_Form))) if r is | |
| 234 | - { | |
| 235 | - error(msg) then [cell([columns(3),h_center], | |
| 236 | - text([size(10),color(rgb(240,0,0))],msg))] | |
| 237 | - ok(msg) then [cell([columns(3),h_center], | |
| 238 | - text([size(10),color(rgb(0,150,0))],msg))] | |
| 239 | - }, | |
| 240 | - | |
| 241 | - message_f(r) then (List(HTML_Cell(HTML_In_Form))) if r is | |
| 242 | - { | |
| 243 | - error(msg) then [cell([columns(3),h_center], | |
| 244 | - msg([size(10),color(rgb(240,0,0))]))] | |
| 245 | - ok(msg) then [cell([columns(3),h_center], | |
| 246 | - msg([size(10),color(rgb(0,150,0))]))] | |
| 247 | - }, | |
| 248 | - | |
| 249 | - input(wan,tag,w,init,mand) then (List(HTML_Cell(HTML_In_Form))) | |
| 250 | - [ | |
| 251 | - cell([right ], text([size(10)],tag)), | |
| 252 | - cell([width(7) ], star(mand)), | |
| 253 | - cell([left ], text_input([], "",html_Id(""), wan, init,if w is | |
| 254 | - { | |
| 255 | - small then 10, | |
| 256 | - narrow then 50, | |
| 257 | - wide then 70, | |
| 258 | - custom(n) then n | |
| 259 | - })) | |
| 260 | - ], | |
| 261 | - | |
| 262 | - input(wan,w,init) then (List(HTML_Cell(HTML_In_Form))) | |
| 263 | - [ | |
| 264 | - cell([left,columns(3) ], text_input([], "", html_Id(""), wan,init,if w is | |
| 265 | - { | |
| 266 | - small then 10, | |
| 267 | - narrow then 30, | |
| 268 | - wide then 70, | |
| 269 | - custom(n) then n | |
| 270 | - })) | |
| 271 | - ], | |
| 272 | - | |
| 273 | - input_f(wan,tag,w,init,mand) then (List(HTML_Cell(HTML_In_Form))) | |
| 274 | - [ | |
| 275 | - cell([right ], tag([size(10)])), | |
| 276 | - cell([width(7) ], star(mand)), | |
| 277 | - cell([left ], text_input([], "", html_Id(""),wan,init,if w is | |
| 278 | - { | |
| 279 | - small then 15, | |
| 280 | - narrow then 30, | |
| 281 | - wide then 70, | |
| 282 | - custom(n) then n | |
| 283 | - })) | |
| 284 | - ], | |
| 285 | - | |
| 286 | - password_input(wan,tag,mand) then (List(HTML_Cell(HTML_In_Form))) | |
| 287 | - [ | |
| 288 | - cell([right ], text([size(10)],tag)), | |
| 289 | - cell([width(7) ], star(mand)), | |
| 290 | - cell([left ], password_input([], "",html_Id(""), wan, init(""), 30)) | |
| 291 | - ], | |
| 292 | - | |
| 293 | - password_input_f(wan,tag,mand) then (List(HTML_Cell(HTML_In_Form))) | |
| 294 | - [ | |
| 295 | - cell([right ], tag([size(10)])), | |
| 296 | - cell([width(7) ], star(mand)), | |
| 297 | - cell([left ], password_input([], "",html_Id(""), wan, init(""), 30)) | |
| 298 | - ], | |
| 299 | - | |
| 300 | - explain(t) then (List(HTML_Cell(HTML_In_Form))) | |
| 301 | - [ | |
| 302 | - cell([columns(3),h_center], | |
| 303 | - table([nude],[row(cell([width(500)], | |
| 304 | - paragraph([/*justified,*/size(10),color(rgb(0,100,0))],literal(t))))])) | |
| 305 | - ], | |
| 306 | - | |
| 307 | - explain(t,w) then (List(HTML_Cell(HTML_In_Form))) | |
| 308 | - [ | |
| 309 | - cell([columns(3),h_center], | |
| 310 | - table([nude],[row(cell( | |
| 311 | - if w is | |
| 312 | - { | |
| 313 | - auto then [], | |
| 314 | - custom(i) then [width(i)] | |
| 315 | - }, | |
| 316 | - paragraph([/*justified,*/size(10),color(rgb(0,100,0))], literal(t))))])) | |
| 317 | - ], | |
| 318 | - | |
| 319 | - explain_f(t) then (List(HTML_Cell(HTML_In_Form))) | |
| 320 | - [ | |
| 321 | - cell([columns(3),h_center], | |
| 322 | - table([nude],[row(cell([width(500)], | |
| 323 | - t([/*justified,*/size(10),color(rgb(0,100,0))])))])) | |
| 324 | - ], | |
| 325 | - | |
| 326 | - selector(wan,tag,items,selected,mand) then (List(HTML_Cell(HTML_In_Form))) | |
| 327 | - [ | |
| 328 | - cell([right ], text([size(10)],tag)), | |
| 329 | - cell([width(7)], star(mand)), | |
| 330 | - cell([left ], if selected is | |
| 331 | - { | |
| 332 | - failure then selector([], "", html_Id(""), wan,1,items) | |
| 333 | - success(sel) then selector([], "", html_Id(""), wan,1,items, sel) | |
| 334 | - }) | |
| 335 | - ], | |
| 336 | - | |
| 337 | - selector_f(wan,tag,items,selected,mand) then (List(HTML_Cell(HTML_In_Form))) | |
| 338 | - [ | |
| 339 | - cell([right ], tag([size(10)])), | |
| 340 | - cell([width(7)], star(mand)), | |
| 341 | - cell([left ], if selected is | |
| 342 | - { | |
| 343 | - failure then selector([], "", html_Id(""), wan,1,items) | |
| 344 | - success(sel) then selector([], "", html_Id(""), wan,1,items, sel) | |
| 345 | - }) | |
| 346 | - ], | |
| 347 | - | |
| 348 | - selector_c(wan,tag,items,selected,mand) then (List(HTML_Cell(HTML_In_Form))) | |
| 349 | - [ | |
| 350 | - cell([right ], text([size(10)],tag)), | |
| 351 | - cell([width(7)], star(mand)), | |
| 352 | - cell([left ], if selected is | |
| 353 | - { | |
| 354 | - failure then selector_c([], "", html_Id(""), wan,1,items) | |
| 355 | - success(sel) then selector_c([], "", html_Id(""), wan,1,items,sel) | |
| 356 | - }) | |
| 357 | - ], | |
| 358 | - | |
| 359 | - checkbox(wan,tag,checked,mand) then (List(HTML_Cell(HTML_In_Form))) | |
| 360 | - [ | |
| 361 | - cell([right ], text([size(10)],tag)), | |
| 362 | - cell([width(7)], star(mand)), | |
| 363 | - cell([left ], check_box([], "",html_Id(""),wan, wav(wan.name),checked)) | |
| 364 | - ], | |
| 365 | - | |
| 366 | - checkboxr(wan,tag,checked,mand) then (List(HTML_Cell(HTML_In_Form))) | |
| 367 | - [ | |
| 368 | - cell([right ], check_box([], "",html_Id(""),wan, wav(wan.name),checked)), | |
| 369 | - cell([width(7)], star(mand)), | |
| 370 | - cell([left ], text([size(10)],tag)) | |
| 371 | - ], | |
| 372 | - | |
| 373 | - checkbox_f(wan,tag,checked,mand) then (List(HTML_Cell(HTML_In_Form))) | |
| 374 | - [ | |
| 375 | - cell([right ], tag([size(10)])), | |
| 376 | - cell([width(7)], star(mand)), | |
| 377 | - cell([left ], check_box([], "",html_Id(""),wan,wav(wan.name),checked)) | |
| 378 | - ], | |
| 379 | - | |
| 380 | - radio_button(wan,wav,tag,checked,mand) then (List(HTML_Cell(HTML_In_Form))) | |
| 381 | - [ | |
| 382 | - cell([right ], text([size(10)],tag)), | |
| 383 | - cell([width(7)], star(mand)), | |
| 384 | - cell([left ], radio_button([], "", html_Id(""), wan, wav, checked)) | |
| 385 | - ], | |
| 386 | - | |
| 387 | - radio_buttonr(wan,wav,tag,checked,mand) then (List(HTML_Cell(HTML_In_Form))) | |
| 388 | - [ | |
| 389 | - cell([right ], radio_button([], "", html_Id(""), wan, wav, checked)), | |
| 390 | - cell([width(7)], star(mand)), | |
| 391 | - cell([left ], text([size(10)],tag)) | |
| 392 | - ], | |
| 393 | - | |
| 394 | - text_area(wan,tx) then (List(HTML_Cell(HTML_In_Form))) | |
| 395 | - [ | |
| 396 | - cell([h_center,columns(3)],text_area([wrap_lines],wan,tx,75,10)) | |
| 397 | - ], | |
| 398 | - | |
| 399 | - text_area(wan,tag,tx) then (List(HTML_Cell(HTML_In_Form))) | |
| 400 | - [ | |
| 401 | - cell([right,top], text([size(10)],tag)), | |
| 402 | - cell([width(7)], text([],"")), | |
| 403 | - cell([h_center],text_area([wrap_lines],wan,tx,75,10)) | |
| 404 | - ], | |
| 405 | - | |
| 406 | - text_area(wan,tag,tx,w,h) then (List(HTML_Cell(HTML_In_Form))) | |
| 407 | - [ | |
| 408 | - cell([right,top], text([size(10)],tag)), | |
| 409 | - cell([width(7)], text([],"")), | |
| 410 | - cell([h_center],text_area([wrap_lines],wan,tx,w,h)) | |
| 411 | - ], | |
| 412 | - | |
| 413 | - fields_table(tag,fields) then (List(HTML_Cell(HTML_In_Form))) | |
| 414 | - [ | |
| 415 | - cell([right,top], text([size(10)],tag)), | |
| 416 | - cell([width(7)], text([],"")), | |
| 417 | - cell([left,top], table([],map((FormField ff2) |-> format_form_field(ff2),fields))) | |
| 418 | - ], | |
| 419 | - | |
| 420 | - fields_line(tag,fields) then (List(HTML_Cell(HTML_In_Form))) | |
| 421 | - [ | |
| 422 | - cell([right,top], text([size(10)],tag)), | |
| 423 | - cell([width(7)], text([],"")), | |
| 424 | - cell([left,top], table([nude],[row([], //border(0,0,3,rgb(0,0,0)) | |
| 425 | - map((FormField ff2) |-> cell([top],table([nude],[format_form_field(ff2)])),fields))])) | |
| 426 | - ], | |
| 427 | - | |
| 428 | - fields_line(fields) then (List(HTML_Cell(HTML_In_Form))) | |
| 429 | - [ | |
| 430 | - cell([left,top,columns(3)], table([nude],[row([], | |
| 431 | - map((FormField ff2) |-> cell([top],table([nude],[format_form_field(ff2)])),fields))])) | |
| 432 | - ], | |
| 433 | - | |
| 434 | - preview(html_text) then (List(HTML_Cell(HTML_In_Form))) | |
| 435 | - [ | |
| 436 | - cell([top,left,columns(3),background_color(rgb(255,255,255))], | |
| 437 | - table([border(0,8,0,rgb(0,0,0))], | |
| 438 | - [row(cell([left,top,height(200)],literal(html_text)))])) | |
| 439 | - ], | |
| 440 | - | |
| 441 | - submit(action_name,mb_label,button_text,extra_operands) then (List(HTML_Cell(HTML_In_Form))) | |
| 442 | - [ | |
| 443 | - cell([columns(3),right],actioner(same, | |
| 444 | - if mb_label is | |
| 445 | - { | |
| 446 | - failure then same, | |
| 447 | - success(n) then same(n) | |
| 448 | - }, | |
| 449 | - submit([], button_text), | |
| 450 | - action_name, | |
| 451 | - extra_operands)) | |
| 452 | - ] | |
| 453 | - }). | |
| 454 | - | |
| 455 | - | |
| 456 | - | |
| 457 | -// TO DO update code of CXM generic form | |
| 458 | -public define HTML_Off_Form | |
| 459 | - generic_form | |
| 460 | - ( | |
| 461 | - String form_name, | |
| 462 | - RGB bg_color, | |
| 463 | - Int w, | |
| 464 | - List(FormField) fields | |
| 465 | - ) = | |
| 466 | - table([border(0,0,5,bg_color),percentage_width(100), | |
| 467 | - background_color(bg_color)],[row(cell([h_center], | |
| 468 | - form(form_name,[],table([border(0,2,0,bg_color)], | |
| 469 | - map(format_form_field, fields)))))]). | |
| 470 | - | |
| 471 | - |
web/generic_login.anubis
| ... | ... | @@ -28,7 +28,7 @@ read CXM_generic_form.anubis |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | |
| 31 | -public define HTML_Off_Form | |
| 31 | +public define HTML | |
| 32 | 32 | login_form |
| 33 | 33 | ( |
| 34 | 34 | String wrong_message, |
| ... | ... | @@ -62,7 +62,7 @@ public define Maybe($User) |
| 62 | 62 | |
| 63 | 63 | *** [1] Connection sur site sécurisée |
| 64 | 64 | |
| 65 | -public define HTML_Off_Form | |
| 65 | +public define HTML | |
| 66 | 66 | login_form |
| 67 | 67 | ( |
| 68 | 68 | String wrong_message, | ... | ... |
web/generic_table.anubis deleted
| 1 | - | |
| 2 | - *Project* The Anubis Project | |
| 3 | - | |
| 4 | - *Title* Generic table page. | |
| 5 | - | |
| 6 | - *Copyright* Copyright (c) Alain Prouté 2004. | |
| 7 | - | |
| 8 | - | |
| 9 | - *Author* Alain Prouté | |
| 10 | - *Author* Olivier Duvernois | |
| 11 | - *Author* David René (import into xlib) | |
| 12 | - | |
| 13 | - ---------------------------------------------------------------------------------------- | |
| 14 | - | |
| 15 | - | |
| 16 | - | |
| 17 | - | |
| 18 | -read tools/basis.anubis | |
| 19 | -read common.anubis | |
| 20 | -read making_a_web_site.anubis | |
| 21 | - | |
| 22 | - | |
| 23 | - The purpose is to print on a html browser a table from a List($Data) using the function | |
| 24 | - 'generic_table()' describe below. | |
| 25 | - | |
| 26 | - Note : the explanations are only given for HTML_Item and its components. But they are | |
| 27 | - also available for HTML_Form and HTML_Element and their components. | |
| 28 | - | |
| 29 | - | |
| 30 | - A table may have the following look : | |
| 31 | - | |
| 32 | - +-----+----------+--------+-----------------------+ ............... | |
| 33 | - | | | | name 3 | | |
| 34 | - | num | name1 | name2 |-----------+-----------+ columns_name | |
| 35 | - | | | | name 31 | name 32 | | |
| 36 | - +-----+----------+--------+-----------+-----------+ ............... | |
| 37 | - | 1 | data11 | data12 | data131 | data132 | line 1 with background color a | |
| 38 | - +-----+----------+--------+-----------+-----------+ ............... | |
| 39 | - | 2 | data21 | data22 | data231 | data232 | line 2 with background color b | |
| 40 | - +-----+----------+--------+-----------+-----------+ ............... | |
| 41 | - | 3 | data31 | data32 | data331 | data332 | line 3 with background color a | |
| 42 | - +-----+----------+--------+-----------+-----------+ ............... | |
| 43 | - | |
| 44 | - | n | datan1 | datan2 | datan31 | datan32 | line n with background color ? | |
| 45 | - +-----+----------+--------+-----------+-----------+ ............... | |
| 46 | - |total| total1 | | | total32 | total line | |
| 47 | - +-----+----------+--------+-----------+-----------+ ............... | |
| 48 | - | |
| 49 | - For the total-line, assuming that datax1 to dataxn and datax32 to datan32 are numbers | |
| 50 | - (Int, Float or Maybe(Float)). | |
| 51 | - | |
| 52 | - | |
| 53 | - The columns name are just a List(Item_Row). | |
| 54 | - | |
| 55 | - The column 'num' is in the case you want to enumerate your data. The existence of this | |
| 56 | - column depends on the line function. | |
| 57 | - | |
| 58 | - Lines are given by the function : (RGB color,Int num,$Data d) -> Item_Row | |
| 59 | - | |
| 60 | - where : - (RGB)color is the color of the background of the row (the 'a color' or 'b | |
| 61 | - color'); | |
| 62 | - - (Int)num the number of the data (to enumerate). | |
| 63 | - | |
| 64 | - So, this function must be written something like : | |
| 65 | - | |
| 66 | - (RGB color, Int num,$Data d) |-> | |
| 67 | - row([background_color(color)], // and of course possibly other row-options | |
| 68 | - [ | |
| 69 | - cell([], (Int -> $HTML)(num) ) | |
| 70 | - . ($Data -> List(Cell))d // how data is printed in cells | |
| 71 | - ]). | |
| 72 | - | |
| 73 | - But, for the above convenient function with no enumeration, you can only write : | |
| 74 | - | |
| 75 | - (RGB color, $Data d) |-> | |
| 76 | - row([background_color(color)], // and of course possibly other row-options | |
| 77 | - ($Data -> List(Cell))d // how data is printed in cells | |
| 78 | - ). | |
| 79 | - | |
| 80 | - | |
| 81 | - If you want to sum by column your data, use the following type : | |
| 82 | - | |
| 83 | -public type Total_Line($Data,$Upplet,$Row): | |
| 84 | - no_total, | |
| 85 | - total | |
| 86 | - ( | |
| 87 | - ($Upplet,$Data) -> $Upplet sum_functions, | |
| 88 | - $Upplet -> $Row print_total_line, | |
| 89 | - $Upplet initial_value | |
| 90 | - ). | |
| 91 | - | |
| 92 | - $Row is for HTML_Row($HTML). | |
| 93 | - $Upplet represents the components of $Data that will be sum. | |
| 94 | - | |
| 95 | - Example : | |
| 96 | - with the above sheme table, $Data is something like : | |
| 97 | - type $Data | |
| 98 | - data | |
| 99 | - ( | |
| 100 | - Data1 d1, | |
| 101 | - Data2 d2 | |
| 102 | - Data3 d3 | |
| 103 | - ). | |
| 104 | - and type Data3: | |
| 105 | - data3 | |
| 106 | - ( | |
| 107 | - Data31 d31, | |
| 108 | - Data32 d32 | |
| 109 | - ). | |
| 110 | - | |
| 111 | - So $Upplet will be (Data1,Data32) : sums are wanted for those 2 datum | |
| 112 | - | |
| 113 | - The function ($Upplet,$Data) -> $Upplet will be written like : | |
| 114 | - ($Upplet u,$Data d) -> if u is (u1,u2) then (u1+d1(d), u2+d32(d3(d))) | |
| 115 | - | |
| 116 | - (if of course (Data1 + Data1) and (Data32 + Data32) are defined). | |
| 117 | - | |
| 118 | - | |
| 119 | - | |
| 120 | - - Several columns - | |
| 121 | - ------------------- | |
| 122 | - | |
| 123 | - If you want to print your data on sevaral columns (i.e. considering the above table | |
| 124 | - scheme as a column), you must specify the number of columns. You will obtain : | |
| 125 | - | |
| 126 | - Here is a List($Data) : l = [a,b,c,d,e,f,g,h,i,j,k,l,m]; | |
| 127 | - and f : (RGB,Int,$Data) -> Item_Row | |
| 128 | - You want to print this list on 3 columns. | |
| 129 | - The result will be : | |
| 130 | - | |
| 131 | - | |
| 132 | - +-----------+-----------+-----------+ | |
| 133 | - | col.names | col.names | col.names | | |
| 134 | - +-----------+-----------+-----------+ | |
| 135 | - | f(a) | f(f) | f(k) | | |
| 136 | - +-----------+-----------+-----------+ | |
| 137 | - | f(b) | f(g) | f(l) | | |
| 138 | - +-----------+-----------+-----------+ Each column is a table as defined | |
| 139 | - | f(c) | f(h) | f(m) | above. | |
| 140 | - +-----------+-----------+-----------+ | |
| 141 | - | f(d) | f(i) | | | |
| 142 | - +-----------+-----------+-----------+ | |
| 143 | - | f(e) | f(j) | | | |
| 144 | - +-----------+-----------+-----------+ | |
| 145 | - | |
| 146 | - | |
| 147 | - If several columns are required, it's also asked for spaces between two colums. | |
| 148 | - | |
| 149 | - So use the following type : | |
| 150 | - | |
| 151 | -public type HowManyColumns: | |
| 152 | - _1, | |
| 153 | - several (Int col_nb, | |
| 154 | - Int spacer). | |
| 155 | - | |
| 156 | - | |
| 157 | - | |
| 158 | - | |
| 159 | - - Now the Generic table definition - | |
| 160 | - ------------------------------------ | |
| 161 | - | |
| 162 | - Here is the most customizable generic table. Below, they are some convenience functions. | |
| 163 | - | |
| 164 | -public define HTML_Off_Form | |
| 165 | - generic_table | |
| 166 | - ( | |
| 167 | - List($Data) data, | |
| 168 | - List(Table_Option) lto, | |
| 169 | - List(HTML_Row(HTML_Off_Form)) columns_name, | |
| 170 | - HowManyColumns number_of_columns, | |
| 171 | - (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 172 | - RGB a_color, | |
| 173 | - RGB b_color, | |
| 174 | - Total_Line($Data,$Upplet,HTML_Row(HTML_Off_Form)) total_line | |
| 175 | - ). | |
| 176 | - | |
| 177 | -public define HTML_In_Form | |
| 178 | - generic_table | |
| 179 | - ( | |
| 180 | - List($Data) data, | |
| 181 | - List(Table_Option) lto, | |
| 182 | - List(HTML_Row(HTML_In_Form)) columns_name, | |
| 183 | - HowManyColumns number_of_columns, | |
| 184 | - (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 185 | - RGB a_color, | |
| 186 | - RGB b_color, | |
| 187 | - Total_Line($Data,$Upplet,HTML_Row(HTML_In_Form)) total_line | |
| 188 | - ). | |
| 189 | - | |
| 190 | - | |
| 191 | - | |
| 192 | - Note : | |
| 193 | - List(Table_Option) : if you choose 'nude' (i.e. border(0,0,0)), don't forget a | |
| 194 | - horizontal spacer between the cells contain in the 'line_format' row. If you don't put | |
| 195 | - any, each data will be closer to the next one. | |
| 196 | - | |
| 197 | - | |
| 198 | - | |
| 199 | - - Convenience functions - | |
| 200 | - ------------------------- | |
| 201 | - | |
| 202 | - 1/ Table without multicolumns, enumeration and total-line: | |
| 203 | - | |
| 204 | -public define HTML_Off_Form | |
| 205 | - generic_table | |
| 206 | - ( | |
| 207 | - List($Data) data, | |
| 208 | - List(Table_Option) lto, | |
| 209 | - List(HTML_Row(HTML_Off_Form)) columns_name, | |
| 210 | - (RGB,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 211 | - RGB a_color, | |
| 212 | - RGB b_color | |
| 213 | - ). | |
| 214 | - | |
| 215 | -public define HTML_In_Form | |
| 216 | - generic_table | |
| 217 | - ( | |
| 218 | - List($Data) data, | |
| 219 | - List(Table_Option) lto, | |
| 220 | - List(HTML_Row(HTML_In_Form)) columns_name, | |
| 221 | - (RGB,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 222 | - RGB a_color, | |
| 223 | - RGB b_color | |
| 224 | - ). | |
| 225 | - | |
| 226 | - | |
| 227 | - | |
| 228 | - 2/ Table with total-line and without multicolumns, enumeration. | |
| 229 | - | |
| 230 | - | |
| 231 | -public define HTML_Off_Form | |
| 232 | - generic_table | |
| 233 | - ( | |
| 234 | - List($Data) data, | |
| 235 | - List(Table_Option) lto, | |
| 236 | - List(HTML_Row(HTML_Off_Form)) columns_name, | |
| 237 | - (RGB,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 238 | - RGB a_color, | |
| 239 | - RGB b_color, | |
| 240 | - Total_Line($Data,$Upplet,HTML_Row(HTML_Off_Form)) total_line | |
| 241 | - ). | |
| 242 | - | |
| 243 | -public define HTML_In_Form | |
| 244 | - generic_table | |
| 245 | - ( | |
| 246 | - List($Data) data, | |
| 247 | - List(Table_Option) lto, | |
| 248 | - List(HTML_Row(HTML_In_Form)) columns_name, | |
| 249 | - (RGB,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 250 | - RGB a_color, | |
| 251 | - RGB b_color, | |
| 252 | - Total_Line($Data,$Upplet,HTML_Row(HTML_In_Form)) total_line | |
| 253 | - ). | |
| 254 | - | |
| 255 | - | |
| 256 | - 3/ Table with multicolumns, enumeration, but without total | |
| 257 | - | |
| 258 | -public define HTML_Off_Form | |
| 259 | - generic_table | |
| 260 | - ( | |
| 261 | - List($Data) data, | |
| 262 | - List(Table_Option) lto, | |
| 263 | - List(HTML_Row(HTML_Off_Form)) columns_name, | |
| 264 | - HowManyColumns number_of_columns, | |
| 265 | - (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 266 | - RGB a_color, | |
| 267 | - RGB b_color | |
| 268 | - ). | |
| 269 | - | |
| 270 | -public define HTML_In_Form | |
| 271 | - generic_table | |
| 272 | - ( | |
| 273 | - List($Data) data, | |
| 274 | - List(Table_Option) lto, | |
| 275 | - List(HTML_Row(HTML_In_Form)) columns_name, | |
| 276 | - HowManyColumns number_of_columns, | |
| 277 | - (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 278 | - RGB a_color, | |
| 279 | - RGB b_color | |
| 280 | - ). | |
| 281 | - | |
| 282 | - | |
| 283 | - | |
| 284 | - 4/ Table with multicolumns and without enumeration & total | |
| 285 | - | |
| 286 | -public define HTML_Off_Form | |
| 287 | - generic_table | |
| 288 | - ( | |
| 289 | - List($Data) data, | |
| 290 | - List(Table_Option) lto, | |
| 291 | - List(HTML_Row(HTML_Off_Form)) columns_name, | |
| 292 | - HowManyColumns number_of_columns, | |
| 293 | - (RGB,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 294 | - RGB a_color, | |
| 295 | - RGB b_color | |
| 296 | - ). | |
| 297 | - | |
| 298 | -public define HTML_In_Form | |
| 299 | - generic_table | |
| 300 | - ( | |
| 301 | - List($Data) data, | |
| 302 | - List(Table_Option) lto, | |
| 303 | - List(HTML_Row(HTML_In_Form)) columns_name, | |
| 304 | - HowManyColumns number_of_columns, | |
| 305 | - (RGB,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 306 | - RGB a_color, | |
| 307 | - RGB b_color | |
| 308 | - ). | |
| 309 | - | |
| 310 | - | |
| 311 | - --- That's all for public part. ------------------------------------------------------------------------- | |
| 312 | - | |
| 313 | - | |
| 314 | - When the datum $Data must be presented on several columns, the initial list must be | |
| 315 | - re-composed : sot the type Print_Table. | |
| 316 | - | |
| 317 | -type Print_Table($Data): | |
| 318 | - print_table | |
| 319 | - ( | |
| 320 | - $Data data, | |
| 321 | - Int num | |
| 322 | - ). | |
| 323 | - | |
| 324 | - | |
| 325 | - *** Transform List($Data) into List(Print_Table($Data)) | |
| 326 | - | |
| 327 | - | |
| 328 | -define (List(Print_Table($Data)),List($Data)) | |
| 329 | - get_n_elements | |
| 330 | - ( | |
| 331 | - List($Data) l, | |
| 332 | - List(Print_Table($Data)) result, | |
| 333 | - Int n, | |
| 334 | - Int ct, // counter | |
| 335 | - Int num | |
| 336 | - ) = | |
| 337 | - if l is | |
| 338 | - { | |
| 339 | - [] then (reverse(result),[]), | |
| 340 | - [h . t] then | |
| 341 | - if ct = n | |
| 342 | - then (reverse([print_table(h,num+1) . result]),t) | |
| 343 | - else get_n_elements(t,[print_table(h,num+1) . result],n,ct+1,num+1) | |
| 344 | - }. | |
| 345 | - | |
| 346 | - | |
| 347 | -define List(List(Print_Table($Data))) | |
| 348 | - short_lists | |
| 349 | - ( | |
| 350 | - List($Data) l, | |
| 351 | - Int nb, // number of element of short list | |
| 352 | - Int ct // counter for numbering data (initialized at 0) | |
| 353 | - ) = | |
| 354 | - if get_n_elements(l,[],nb,1,ct) is (result,unused) | |
| 355 | - then if unused is | |
| 356 | - { | |
| 357 | - [] then [result], | |
| 358 | - [_ . _] then [result . short_lists(unused,nb,ct+nb)] | |
| 359 | - }. | |
| 360 | - | |
| 361 | - | |
| 362 | - - Generic row - | |
| 363 | - --------------- | |
| 364 | - | |
| 365 | -define (List(HTML_Row($HTML)),$Upplet) | |
| 366 | - generic_rows | |
| 367 | - ( | |
| 368 | - List(Print_Table($Data)) lpt, | |
| 369 | - (RGB,Int,$Data) -> HTML_Row($HTML) line_format, | |
| 370 | - RGB a_color, | |
| 371 | - RGB b_color, | |
| 372 | - ($Upplet,$Data) -> $Upplet do_sum, | |
| 373 | - List(HTML_Row($HTML)) rows, | |
| 374 | - $Upplet sum | |
| 375 | - ) = | |
| 376 | - if lpt is | |
| 377 | - { | |
| 378 | - [] then (reverse(rows),sum), | |
| 379 | - [h . t] then | |
| 380 | - generic_rows(t,line_format,b_color,a_color,do_sum, | |
| 381 | - [line_format(a_color,num(h),data(h)) . rows],do_sum(sum,data(h))) | |
| 382 | - }. | |
| 383 | - | |
| 384 | - | |
| 385 | - | |
| 386 | - - HTML_In_Form - | |
| 387 | - ---------------- | |
| 388 | - | |
| 389 | -define List(HTML_Cell(HTML_In_Form)) | |
| 390 | - generic_cells | |
| 391 | - ( | |
| 392 | - List(List(Print_Table($Data))) print_data, | |
| 393 | - List(Table_Option) lto, | |
| 394 | - List(HTML_Row(HTML_In_Form)) names, | |
| 395 | - (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 396 | - RGB a_color, | |
| 397 | - RGB b_color, | |
| 398 | - ($Upplet,$Data) -> $Upplet do_sum, | |
| 399 | - $Upplet -> HTML_Row(HTML_In_Form) total_line, | |
| 400 | - $Upplet value, | |
| 401 | - Int spacer | |
| 402 | - ) = | |
| 403 | - if print_data is | |
| 404 | - { | |
| 405 | - [] then (List(HTML_Cell(HTML_In_Form))) [], | |
| 406 | - [h . t] then | |
| 407 | - if generic_rows(h,line_format,a_color,b_color,do_sum,(List(HTML_Row(HTML_In_Form)))[],value) is | |
| 408 | - (rows,new_value) then | |
| 409 | - if t is [] | |
| 410 | - then [cell([top],table(lto,names+rows+[total_line(new_value)]))] | |
| 411 | - else [ | |
| 412 | - cell([top],table(lto,append(names,rows))) | |
| 413 | - . if spacer = 0 | |
| 414 | - then generic_cells | |
| 415 | - (t,lto,names,line_format,a_color,b_color,do_sum,total_line,new_value,spacer) | |
| 416 | - else [cell([width(spacer)],text([],"")) | |
| 417 | - . generic_cells | |
| 418 | - (t,lto,names,line_format,a_color,b_color,do_sum,total_line,new_value,spacer)] | |
| 419 | - ] | |
| 420 | - }. | |
| 421 | - | |
| 422 | -//public define Int | |
| 423 | -// Int x (mod Int y) | |
| 424 | -// = | |
| 425 | -// if x / y is | |
| 426 | -// { | |
| 427 | -// failure then 0, | |
| 428 | -// success(result) then | |
| 429 | -// if result is (q, r) then r | |
| 430 | -// }. | |
| 431 | -// | |
| 432 | - | |
| 433 | - | |
| 434 | -public define HTML_In_Form | |
| 435 | - generic_table | |
| 436 | - ( | |
| 437 | - List($Data) l, | |
| 438 | - List(Table_Option) lto, | |
| 439 | - List(HTML_Row(HTML_In_Form)) names, | |
| 440 | - HowManyColumns hm_col, | |
| 441 | - (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 442 | - RGB a_color, | |
| 443 | - RGB b_color, | |
| 444 | - Total_Line($Data,$Upplet,HTML_Row(HTML_In_Form)) total_line | |
| 445 | - ) = | |
| 446 | - table([], | |
| 447 | - if l is [] | |
| 448 | - then [] | |
| 449 | - else | |
| 450 | - with nbl = length(l), | |
| 451 | - [ | |
| 452 | - row([], | |
| 453 | - if total_line is | |
| 454 | - { | |
| 455 | - no_total then | |
| 456 | - with col_nb = if hm_col is | |
| 457 | - { | |
| 458 | - _1 then 1, | |
| 459 | - several(n,_) then n | |
| 460 | - }, | |
| 461 | - with spacer = if hm_col is | |
| 462 | - { | |
| 463 | - _1 then 0, | |
| 464 | - several(n,sp) then sp | |
| 465 | - }, | |
| 466 | - generic_cells | |
| 467 | - (short_lists(l,nbl\col_nb + if (nbl (mod col_nb)) > 0 then 1 else 0,0), | |
| 468 | - lto,names,line_format,a_color,b_color, | |
| 469 | - (One u,$Data d) |-> unique,(One _) |-> row([],[]),unique,spacer), | |
| 470 | - total(sum_fct,total_line,init) then | |
| 471 | - with col_nb = if hm_col is | |
| 472 | - { | |
| 473 | - _1 then 1, | |
| 474 | - several(n,_) then n | |
| 475 | - }, | |
| 476 | - with spacer = if hm_col is | |
| 477 | - { | |
| 478 | - _1 then 0, | |
| 479 | - several(n,sp) then sp | |
| 480 | - }, | |
| 481 | - generic_cells | |
| 482 | - ( | |
| 483 | - short_lists(l,nbl\col_nb + if (nbl (mod col_nb)) > 0 then 1 else 0,0), | |
| 484 | - lto,names,line_format,a_color,b_color, | |
| 485 | - sum_fct,total_line,init,spacer | |
| 486 | - ) | |
| 487 | - }) | |
| 488 | - ]). | |
| 489 | - | |
| 490 | - | |
| 491 | - - HTML_Off_Form - | |
| 492 | - ---------------- | |
| 493 | - | |
| 494 | -define List(HTML_Cell(HTML_Off_Form)) | |
| 495 | - generic_cells | |
| 496 | - ( | |
| 497 | - List(List(Print_Table($Data))) print_data, | |
| 498 | - List(Table_Option) lto, | |
| 499 | - List(HTML_Row(HTML_Off_Form)) names, | |
| 500 | - (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 501 | - RGB a_color, | |
| 502 | - RGB b_color, | |
| 503 | - ($Upplet,$Data) -> $Upplet do_sum, | |
| 504 | - $Upplet -> HTML_Row(HTML_Off_Form) total_line, | |
| 505 | - $Upplet value, | |
| 506 | - Int spacer | |
| 507 | - ) = | |
| 508 | - if print_data is | |
| 509 | - { | |
| 510 | - [] then (List(HTML_Cell(HTML_Off_Form))) [], | |
| 511 | - [h . t] then | |
| 512 | - if generic_rows(h,line_format,a_color,b_color,do_sum,(List(HTML_Row(HTML_Off_Form)))[],value) is | |
| 513 | - (rows,new_value) then | |
| 514 | - if t is [] | |
| 515 | - then [cell([top],table(lto,(names+rows+[total_line(new_value)])))] | |
| 516 | - else [ | |
| 517 | - cell([top],table(lto,append(names,rows))) | |
| 518 | - . if spacer =0 | |
| 519 | - then generic_cells | |
| 520 | - (t,lto,names,line_format,a_color,b_color,do_sum,total_line,new_value,spacer) | |
| 521 | - else [cell([width(spacer)],text([],"")) | |
| 522 | - . generic_cells | |
| 523 | - (t,lto,names,line_format,a_color,b_color,do_sum,total_line,new_value,spacer)] | |
| 524 | - ] | |
| 525 | - }. | |
| 526 | - | |
| 527 | -public define HTML_Off_Form | |
| 528 | - generic_table | |
| 529 | - ( | |
| 530 | - List($Data) l, | |
| 531 | - List(Table_Option) lto, | |
| 532 | - List(HTML_Row(HTML_Off_Form)) names, | |
| 533 | - HowManyColumns hm_col, | |
| 534 | - (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 535 | - RGB a_color, | |
| 536 | - RGB b_color, | |
| 537 | - Total_Line($Data,$Upplet,HTML_Row(HTML_Off_Form)) total_line | |
| 538 | - ) = | |
| 539 | - table([], | |
| 540 | - with nbl = length(l), | |
| 541 | - [ | |
| 542 | - row([], | |
| 543 | - if total_line is | |
| 544 | - { | |
| 545 | - no_total then | |
| 546 | - with col_nb = if hm_col is | |
| 547 | - { | |
| 548 | - _1 then 1, | |
| 549 | - several(n,_) then n | |
| 550 | - }, | |
| 551 | - with spacer = if hm_col is | |
| 552 | - { | |
| 553 | - _1 then 0, | |
| 554 | - several(n,sp) then sp | |
| 555 | - }, | |
| 556 | - generic_cells | |
| 557 | - ( | |
| 558 | - short_lists(l,nbl\col_nb + if (nbl (mod col_nb)) > 0 then 1 else 0,0), | |
| 559 | - lto,names,line_format,a_color,b_color, | |
| 560 | - (One u,$Data d) |-> unique,(One _) |-> row([],[]),unique,spacer | |
| 561 | - ), | |
| 562 | - total(sum_fct,total_line,init) then | |
| 563 | - with col_nb = if hm_col is | |
| 564 | - { | |
| 565 | - _1 then 1, | |
| 566 | - several(n,_) then n | |
| 567 | - }, | |
| 568 | - with spacer = if hm_col is | |
| 569 | - { | |
| 570 | - _1 then 0, | |
| 571 | - several(n,sp) then sp | |
| 572 | - }, | |
| 573 | - generic_cells | |
| 574 | - ( | |
| 575 | - short_lists(l,nbl\col_nb + if (nbl (mod col_nb)) > 0 then 1 else 0,0), | |
| 576 | - lto,names,line_format,a_color,b_color, | |
| 577 | - sum_fct,total_line,init,spacer | |
| 578 | - ) | |
| 579 | - }) | |
| 580 | - ]). | |
| 581 | - | |
| 582 | - | |
| 583 | - | |
| 584 | - - Convenience functions : | |
| 585 | - | |
| 586 | -public define HTML_Off_Form | |
| 587 | - generic_table | |
| 588 | - ( | |
| 589 | - List($Data) data, | |
| 590 | - List(Table_Option) lto, | |
| 591 | - List(HTML_Row(HTML_Off_Form)) columns_name, | |
| 592 | - (RGB,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 593 | - RGB a_color, | |
| 594 | - RGB b_color | |
| 595 | - ) = | |
| 596 | - generic_table | |
| 597 | - ( | |
| 598 | - (List($Data)) data, | |
| 599 | - (List(Table_Option)) lto, | |
| 600 | - (List(HTML_Row(HTML_Off_Form))) columns_name, | |
| 601 | - (HowManyColumns) _1, | |
| 602 | - ((RGB,Int,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), | |
| 603 | - (RGB) a_color, | |
| 604 | - (RGB) b_color, | |
| 605 | - (Total_Line($Data,$Data,HTML_Row(HTML_Off_Form))) no_total | |
| 606 | - ). | |
| 607 | - | |
| 608 | -public define HTML_In_Form | |
| 609 | - generic_table | |
| 610 | - ( | |
| 611 | - List($Data) data, | |
| 612 | - List(Table_Option) lto, | |
| 613 | - List(HTML_Row(HTML_In_Form)) columns_name, | |
| 614 | - (RGB,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 615 | - RGB a_color, | |
| 616 | - RGB b_color | |
| 617 | - ) = | |
| 618 | - generic_table | |
| 619 | - ( | |
| 620 | - (List($Data)) data, | |
| 621 | - (List(Table_Option)) lto, | |
| 622 | - (List(HTML_Row(HTML_In_Form))) columns_name, | |
| 623 | - (HowManyColumns) _1, | |
| 624 | - ((RGB,Int,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), | |
| 625 | - (RGB) a_color, | |
| 626 | - (RGB) b_color, | |
| 627 | - (Total_Line($Data,$Data,HTML_Row(HTML_In_Form))) no_total | |
| 628 | - ). | |
| 629 | - | |
| 630 | - | |
| 631 | - 2/ Table with total-line and without multicolumns, enumeration. | |
| 632 | - | |
| 633 | - | |
| 634 | -public define HTML_Off_Form | |
| 635 | - generic_table | |
| 636 | - ( | |
| 637 | - List($Data) data, | |
| 638 | - List(Table_Option) lto, | |
| 639 | - List(HTML_Row(HTML_Off_Form)) columns_name, | |
| 640 | - (RGB,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 641 | - RGB a_color, | |
| 642 | - RGB b_color, | |
| 643 | - Total_Line($Data,$Upplet,HTML_Row(HTML_Off_Form)) total_line | |
| 644 | - ) = | |
| 645 | - generic_table | |
| 646 | - ( | |
| 647 | - (List($Data)) data, | |
| 648 | - (List(Table_Option)) lto, | |
| 649 | - (List(HTML_Row(HTML_Off_Form))) columns_name, | |
| 650 | - (HowManyColumns) _1, | |
| 651 | - ((RGB,Int,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), | |
| 652 | - (RGB) a_color, | |
| 653 | - (RGB) b_color, | |
| 654 | - (Total_Line($Data,$Upplet,(HTML_Row(HTML_Off_Form)))) total_line | |
| 655 | - ). | |
| 656 | - | |
| 657 | -public define HTML_In_Form | |
| 658 | - generic_table | |
| 659 | - ( | |
| 660 | - List($Data) data, | |
| 661 | - List(Table_Option) lto, | |
| 662 | - List(HTML_Row(HTML_In_Form)) columns_name, | |
| 663 | - (RGB,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 664 | - RGB a_color, | |
| 665 | - RGB b_color, | |
| 666 | - Total_Line($Data,$Upplet,HTML_Row(HTML_In_Form)) total_line | |
| 667 | - ) = | |
| 668 | - generic_table | |
| 669 | - ( | |
| 670 | - (List($Data)) data, | |
| 671 | - (List(Table_Option)) lto, | |
| 672 | - (List(HTML_Row(HTML_In_Form))) columns_name, | |
| 673 | - (HowManyColumns) _1, | |
| 674 | - ((RGB,Int,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), | |
| 675 | - (RGB) a_color, | |
| 676 | - (RGB) b_color, | |
| 677 | - (Total_Line($Data,$Upplet,(HTML_Row(HTML_In_Form)))) total_line | |
| 678 | - ). | |
| 679 | - | |
| 680 | - | |
| 681 | - | |
| 682 | - | |
| 683 | - 3/ Table with multicolumns, enumeration, but without total | |
| 684 | - | |
| 685 | -public define HTML_Off_Form | |
| 686 | - generic_table | |
| 687 | - ( | |
| 688 | - List($Data) data, | |
| 689 | - List(Table_Option) lto, | |
| 690 | - List(HTML_Row(HTML_Off_Form)) columns_name, | |
| 691 | - HowManyColumns number_of_columns, | |
| 692 | - (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 693 | - RGB a_color, | |
| 694 | - RGB b_color | |
| 695 | - ) = | |
| 696 | - generic_table | |
| 697 | - ( | |
| 698 | - (List($Data)) data, | |
| 699 | - (List(Table_Option)) lto, | |
| 700 | - (List(HTML_Row(HTML_Off_Form))) columns_name, | |
| 701 | - (HowManyColumns) number_of_columns, | |
| 702 | - ((RGB,Int,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int n,$Data d) |-> line_format(r,n,d), | |
| 703 | - (RGB) a_color, | |
| 704 | - (RGB) b_color, | |
| 705 | - (Total_Line($Data,$Data,(HTML_Row(HTML_Off_Form)))) no_total | |
| 706 | - ). | |
| 707 | - | |
| 708 | - | |
| 709 | -public define HTML_In_Form | |
| 710 | - generic_table | |
| 711 | - ( | |
| 712 | - List($Data) data, | |
| 713 | - List(Table_Option) lto, | |
| 714 | - List(HTML_Row(HTML_In_Form)) columns_name, | |
| 715 | - HowManyColumns number_of_columns, | |
| 716 | - (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 717 | - RGB a_color, | |
| 718 | - RGB b_color | |
| 719 | - ) = | |
| 720 | - generic_table | |
| 721 | - ( | |
| 722 | - (List($Data)) data, | |
| 723 | - (List(Table_Option)) lto, | |
| 724 | - (List(HTML_Row(HTML_In_Form))) columns_name, | |
| 725 | - (HowManyColumns) number_of_columns, | |
| 726 | - ((RGB,Int,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int n,$Data d) |-> line_format(r,n,d), | |
| 727 | - (RGB) a_color, | |
| 728 | - (RGB) b_color, | |
| 729 | - (Total_Line($Data,$Data,(HTML_Row(HTML_In_Form)))) no_total | |
| 730 | - ). | |
| 731 | - | |
| 732 | - | |
| 733 | - | |
| 734 | - 4/ Table with multicolumns and without enumeration & total | |
| 735 | - | |
| 736 | -public define HTML_Off_Form | |
| 737 | - generic_table | |
| 738 | - ( | |
| 739 | - List($Data) data, | |
| 740 | - List(Table_Option) lto, | |
| 741 | - List(HTML_Row(HTML_Off_Form)) columns_name, | |
| 742 | - HowManyColumns number_of_columns, | |
| 743 | - (RGB,$Data) -> HTML_Row(HTML_Off_Form) line_format, | |
| 744 | - RGB a_color, | |
| 745 | - RGB b_color | |
| 746 | - ) = | |
| 747 | - generic_table | |
| 748 | - ( | |
| 749 | - (List($Data)) data, | |
| 750 | - (List(Table_Option)) lto, | |
| 751 | - (List(HTML_Row(HTML_Off_Form))) columns_name, | |
| 752 | - (HowManyColumns) number_of_columns, | |
| 753 | - ((RGB,Int,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), | |
| 754 | - (RGB) a_color, | |
| 755 | - (RGB) b_color, | |
| 756 | - (Total_Line($Data,$Data,(HTML_Row(HTML_Off_Form)))) no_total | |
| 757 | - ). | |
| 758 | - | |
| 759 | - | |
| 760 | -public define HTML_In_Form | |
| 761 | - generic_table | |
| 762 | - ( | |
| 763 | - List($Data) data, | |
| 764 | - List(Table_Option) lto, | |
| 765 | - List(HTML_Row(HTML_In_Form)) columns_name, | |
| 766 | - HowManyColumns number_of_columns, | |
| 767 | - (RGB,$Data) -> HTML_Row(HTML_In_Form) line_format, | |
| 768 | - RGB a_color, | |
| 769 | - RGB b_color | |
| 770 | - ) = | |
| 771 | - generic_table | |
| 772 | - ( | |
| 773 | - (List($Data)) data, | |
| 774 | - (List(Table_Option)) lto, | |
| 775 | - (List(HTML_Row(HTML_In_Form))) columns_name, | |
| 776 | - (HowManyColumns) number_of_columns, | |
| 777 | - ((RGB,Int,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), | |
| 778 | - (RGB) a_color, | |
| 779 | - (RGB) b_color, | |
| 780 | - (Total_Line($Data,$Data,(HTML_Row(HTML_In_Form)))) no_total | |
| 781 | - ). | |
| 782 | - | |
| 783 | - | |
| 784 | - | |
| 785 | - |
web/html_tooltip.anubis
| ... | ... | @@ -11,9 +11,9 @@ read tools/basis.anubis |
| 11 | 11 | read xlib/web/common.anubis |
| 12 | 12 | read xlib/web/making_a_web_site.anubis |
| 13 | 13 | |
| 14 | -//public type HTML_Off_Form:... | |
| 14 | +//public type HTML:... | |
| 15 | 15 | |
| 16 | - public define HTML_Off_Form | |
| 16 | + public define HTML | |
| 17 | 17 | html_tooltip |
| 18 | 18 | ( |
| 19 | 19 | String title, |
| ... | ... | @@ -23,7 +23,7 @@ read xlib/web/making_a_web_site.anubis |
| 23 | 23 | |
| 24 | 24 | actioner(same,same, link([id("help_" + keyword), class("jTip jTip_help"), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_id", keyword)], []). |
| 25 | 25 | |
| 26 | - public define HTML_Off_Form | |
| 26 | + public define HTML | |
| 27 | 27 | html_tooltip |
| 28 | 28 | ( |
| 29 | 29 | String title, |
| ... | ... | @@ -55,7 +55,7 @@ read xlib/web/making_a_web_site.anubis |
| 55 | 55 | |
| 56 | 56 | actioner(same,same, link([id("help_" + keyword), class("jTip jTip_help"), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_id", keyword), ("width", to_decimal(width))], []). |
| 57 | 57 | |
| 58 | - public define HTML_Off_Form | |
| 58 | + public define HTML | |
| 59 | 59 | html_tooltip_ext |
| 60 | 60 | ( |
| 61 | 61 | String title, |
| ... | ... | @@ -64,7 +64,7 @@ read xlib/web/making_a_web_site.anubis |
| 64 | 64 | ) = |
| 65 | 65 | actioner(same,same, link([id("help_" + keyword), class("jTip jTip_"+class_suffix), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_ext", keyword)], []). |
| 66 | 66 | |
| 67 | - public define HTML_Off_Form | |
| 67 | + public define HTML | |
| 68 | 68 | html_tooltip_ext |
| 69 | 69 | ( |
| 70 | 70 | String title, | ... | ... |
web/jQuery/jq_animate.anubis
| ... | ... | @@ -378,7 +378,7 @@ public define List(HTML_Head_Tag) |
| 378 | 378 | ) = |
| 379 | 379 | generate_head_tags(jq_selector, anims). |
| 380 | 380 | |
| 381 | -public define HTML_Partial_Content | |
| 381 | +public define HTML | |
| 382 | 382 | jquery_animate |
| 383 | 383 | ( |
| 384 | 384 | JQuerySelector jq_selector, |
| ... | ... | @@ -394,7 +394,7 @@ public define List(HTML_Head_Tag) |
| 394 | 394 | ) = |
| 395 | 395 | generate_head_tags(jq_selector, [ anim_type ]). |
| 396 | 396 | |
| 397 | -public define HTML_Partial_Content | |
| 397 | +public define HTML | |
| 398 | 398 | jquery_animate |
| 399 | 399 | ( |
| 400 | 400 | JQuerySelector jq_selector, | ... | ... |
web/jQuery/jq_button.anubis
| ... | ... | @@ -68,18 +68,18 @@ define HTML_Head_Tag |
| 68 | 68 | js_inline(jquery_ready("$('#"+button_id+"').click(function(e){" + js_action + "});")) |
| 69 | 69 | . |
| 70 | 70 | |
| 71 | -define HTML_Partial_Content | |
| 71 | +define HTML | |
| 72 | 72 | _jquery_buttons |
| 73 | 73 | ( |
| 74 | 74 | List(JQuery_button) buttons, |
| 75 | 75 | List(HTML_Head_Tag) html_tags, |
| 76 | - List(HTML_Off_Form) html_buttons | |
| 76 | + List(HTML) html_buttons | |
| 77 | 77 | ) |
| 78 | 78 | = |
| 79 | 79 | if buttons is |
| 80 | 80 | { |
| 81 | 81 | [ ] then |
| 82 | - partial_content( | |
| 82 | + head_tags( | |
| 83 | 83 | reverse(html_tags), |
| 84 | 84 | sequence(reverse(html_buttons)) |
| 85 | 85 | ), |
| ... | ... | @@ -158,14 +158,14 @@ define HTML_Partial_Content |
| 158 | 158 | } |
| 159 | 159 | . |
| 160 | 160 | |
| 161 | -public define HTML_Partial_Content | |
| 161 | +public define HTML | |
| 162 | 162 | jquery_buttons |
| 163 | 163 | ( |
| 164 | 164 | String buttons_container_id, |
| 165 | 165 | List(JQuery_button) buttons |
| 166 | 166 | ) |
| 167 | 167 | = |
| 168 | - partial_content( | |
| 168 | + head_tags( | |
| 169 | 169 | [ js_inline(jquery_ready("$('#"+buttons_container_id+"').buttonset();")) ], |
| 170 | 170 | div(id(buttons_container_id), _jquery_buttons(buttons, [], [])) |
| 171 | 171 | // sequence([ |
| ... | ... | @@ -176,7 +176,7 @@ public define HTML_Partial_Content |
| 176 | 176 | ) |
| 177 | 177 | . |
| 178 | 178 | |
| 179 | -public define HTML_Partial_Content | |
| 179 | +public define HTML | |
| 180 | 180 | jquery_button |
| 181 | 181 | ( |
| 182 | 182 | JQuery_button button |
| ... | ... | @@ -184,11 +184,11 @@ public define HTML_Partial_Content |
| 184 | 184 | = |
| 185 | 185 | if button is jQuery_button(bt_type, id, name, label, actioner, primary, secondary) then |
| 186 | 186 | with onclick_action=jquery_button_get_onclick_action(id, actioner), |
| 187 | -// btn_seq = (HTML_Off_Form)sequence([literal("<button type=\""+to_String(bt_type)+"\" id=\""+id+"\" name=\""+name+"\">"), table([attr("cellspacing", "5")], [row([cell(text(label))])]), literal("</button>")]), | |
| 188 | - btn_seq = (HTML_Off_Form)sequence([literal("<button class=\"cxm_button\" type=\""+to_String(bt_type)+"\" id=\""+id+"\" name=\""+name+"\">"+label+"</button>")]), | |
| 187 | +// btn_seq = (HTML)sequence([literal("<button type=\""+to_String(bt_type)+"\" id=\""+id+"\" name=\""+name+"\">"), table([attr("cellspacing", "5")], [row([cell(text(label))])]), literal("</button>")]), | |
| 188 | + btn_seq = (HTML)sequence([literal("<button class=\"cxm_button\" type=\""+to_String(bt_type)+"\" id=\""+id+"\" name=\""+name+"\">"+label+"</button>")]), | |
| 189 | 189 | if jquery_icon_to_string(primary) = "" then |
| 190 | 190 | if jquery_icon_to_string(secondary) = "" then |
| 191 | - partial_content( | |
| 191 | + head_tags( | |
| 192 | 192 | [ |
| 193 | 193 | js_inline(jquery_ready("$('#"+id+"').button();")), |
| 194 | 194 | onclick_action |
| ... | ... | @@ -198,7 +198,7 @@ public define HTML_Partial_Content |
| 198 | 198 | //literal("<button type=\""+to_String(bt_type)+"\" id=\""+id+"\" name=\""+name+"\">"+label+"</button>") |
| 199 | 199 | ) |
| 200 | 200 | else |
| 201 | - partial_content( | |
| 201 | + head_tags( | |
| 202 | 202 | [ |
| 203 | 203 | js_inline(jquery_ready("$('#"+id+"').button({icons:{secondary:'"+jquery_icon_to_string(secondary)+"'}});")), |
| 204 | 204 | onclick_action |
| ... | ... | @@ -208,7 +208,7 @@ public define HTML_Partial_Content |
| 208 | 208 | ) |
| 209 | 209 | else |
| 210 | 210 | if jquery_icon_to_string(secondary) = "" then |
| 211 | - partial_content( | |
| 211 | + head_tags( | |
| 212 | 212 | [ |
| 213 | 213 | js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"'}});")), |
| 214 | 214 | onclick_action |
| ... | ... | @@ -217,7 +217,7 @@ public define HTML_Partial_Content |
| 217 | 217 | //literal("<button type=\""+to_String(bt_type)+"\" id=\""+id+"\">"+label+"</button>") |
| 218 | 218 | ) |
| 219 | 219 | else |
| 220 | - partial_content( | |
| 220 | + head_tags( | |
| 221 | 221 | [ |
| 222 | 222 | js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"',secondary:'"+jquery_icon_to_string(secondary)+"'}});")), |
| 223 | 223 | onclick_action |
| ... | ... | @@ -236,7 +236,7 @@ public type Icon_orientation: |
| 236 | 236 | public type JQuery_img_button: |
| 237 | 237 | jquery_img_button(String img_url, String label_text, String id, JQuery_Actioner jq_action, Icon_orientation orientation). |
| 238 | 238 | |
| 239 | -public define HTML_Off_Form | |
| 239 | +public define HTML | |
| 240 | 240 | jquery_button_html |
| 241 | 241 | ( |
| 242 | 242 | JQuery_img_button jq_img_button, |
| ... | ... | @@ -246,15 +246,15 @@ public define HTML_Off_Form |
| 246 | 246 | button([id(button_id), class("jq_img_btn")], |
| 247 | 247 | if orientation is |
| 248 | 248 | { |
| 249 | - top then table([class("jq_img_btn_table")],[ row( cell(img(img_url))), row( cell(text(label_text))) ]), | |
| 250 | - bottom then table([class("jq_img_btn_table")],[ row( cell(text(label_text))), row( cell(img(img_url))) ]), | |
| 251 | - left then table([class("jq_img_btn_table")],[ row( [cell(img(img_url)), cell(text(label_text)) ]) ]), | |
| 252 | - right then table([class("jq_img_btn_table")],[ row( [cell(text(label_text)), cell(img(img_url)) ]) ]), | |
| 249 | + top then table(class("jq_img_btn_table"), [ tr( td( img(img_url))), tr( td( text(label_text))) ]), | |
| 250 | + bottom then table(class("jq_img_btn_table"), [ tr( td( text(label_text))), tr( td( img(img_url))) ]), | |
| 251 | + left then table(class("jq_img_btn_table"), tr( [ td(img(img_url)), td(text(label_text)) ])), | |
| 252 | + right then table(class("jq_img_btn_table"), tr( [ td(text(label_text)), td(img(img_url)) ])), | |
| 253 | 253 | }). |
| 254 | 254 | |
| 255 | 255 | |
| 256 | 256 | |
| 257 | -public define HTML_Partial_Content | |
| 257 | +public define HTML | |
| 258 | 258 | jquery_button |
| 259 | 259 | ( |
| 260 | 260 | JQuery_img_button button |
| ... | ... | @@ -264,7 +264,7 @@ public define HTML_Partial_Content |
| 264 | 264 | generate_random_string(10) |
| 265 | 265 | else |
| 266 | 266 | button_id, |
| 267 | - partial_content( | |
| 267 | + head_tags( | |
| 268 | 268 | [ |
| 269 | 269 | jquery_button_get_onclick_action(button_id_str, actioner), |
| 270 | 270 | css(css_file("xlib/css/button.css")), |
| ... | ... | @@ -273,7 +273,7 @@ public define HTML_Partial_Content |
| 273 | 273 | jquery_button_html(button, button_id_str)) |
| 274 | 274 | . |
| 275 | 275 | |
| 276 | -public define HTML_Partial_Content | |
| 276 | +public define HTML | |
| 277 | 277 | jq_button_confirm |
| 278 | 278 | ( |
| 279 | 279 | String button_label, |
| ... | ... | @@ -296,18 +296,16 @@ public define HTML_Partial_Content |
| 296 | 296 | button_name = uid, |
| 297 | 297 | _actioner = jQuery_actioner(same, jqscript("Xlib.make_confirm_dialog(this, " /*+ to_js_string("/?a=" + url + format_extra_operands(extra_ops))+*/ + to_JS_String(jquery_button_get_onclick_action(actioner)) + ");")), |
| 298 | 298 | |
| 299 | - partial_content([ | |
| 299 | + head_tags([ | |
| 300 | 300 | js(js_file("xlib/js/xlib.js")), |
| 301 | 301 | css(css_file("xlib/css/button.css")), |
| 302 | 302 | js_inline(jquery_ready(js_data)) |
| 303 | 303 | ], |
| 304 | - sequence([ | |
| 305 | - partial(jquery_button(jQuery_button(button, uid, button_name, button_label, _actioner, jq_icon_none, jq_icon_none))) | |
| 306 | - ]) | |
| 304 | + jquery_button(jQuery_button(button, uid, button_name, button_label, _actioner, jq_icon_none, jq_icon_none)) | |
| 307 | 305 | ) |
| 308 | 306 | . |
| 309 | 307 | |
| 310 | -public define HTML_Partial_Content | |
| 308 | +public define HTML | |
| 311 | 309 | jq_button_confirm |
| 312 | 310 | ( |
| 313 | 311 | JQuery_img_button button, |
| ... | ... | @@ -332,17 +330,16 @@ public define HTML_Partial_Content |
| 332 | 330 | _button_name = uid, |
| 333 | 331 | _actioner = jQuery_actioner(same, jqscript("Xlib.make_confirm_dialog(this, " + to_JS_String(jquery_button_get_onclick_action(actioner)) +");")), |
| 334 | 332 | |
| 335 | - partial_content([ | |
| 333 | + head_tags([ | |
| 336 | 334 | js(js_file("xlib/js/xlib.js")), |
| 337 | 335 | js_inline(jquery_ready(js_data)) |
| 338 | 336 | ], |
| 339 | - sequence([ | |
| 340 | - partial(jquery_button(jquery_img_button(img_url, button_label, _button_name, _actioner, orientation))) | |
| 341 | - ]) | |
| 337 | + jquery_button(jquery_img_button(img_url, button_label, _button_name, _actioner, orientation)) | |
| 338 | + | |
| 342 | 339 | ) |
| 343 | 340 | . |
| 344 | 341 | |
| 345 | -public define HTML_Partial_Content | |
| 342 | +public define HTML | |
| 346 | 343 | img_submit_button |
| 347 | 344 | ( |
| 348 | 345 | String img, //path to image |
| ... | ... | @@ -353,7 +350,7 @@ public define HTML_Partial_Content |
| 353 | 350 | )= |
| 354 | 351 | jquery_button(jquery_img_button(img, label, "", jQuery_actioner(same, jqform(form_id, action, extra_ops)), left)). |
| 355 | 352 | |
| 356 | -public define HTML_Partial_Content | |
| 353 | +public define HTML | |
| 357 | 354 | img_submit_button |
| 358 | 355 | ( |
| 359 | 356 | String img, //path to image |
| ... | ... | @@ -363,7 +360,7 @@ public define HTML_Partial_Content |
| 363 | 360 | )= |
| 364 | 361 | jquery_button(jquery_img_button(img, label, "", jQuery_actioner(same, jqform(form_id, action, [])), left)). |
| 365 | 362 | |
| 366 | -public define HTML_Partial_Content | |
| 363 | +public define HTML | |
| 367 | 364 | img_submit_button |
| 368 | 365 | ( |
| 369 | 366 | String label, //translated label of the button |
| ... | ... | @@ -372,7 +369,7 @@ public define HTML_Partial_Content |
| 372 | 369 | )= |
| 373 | 370 | jquery_button(jquery_img_button(icn16_check, label, "", jQuery_actioner(same, jqform(form_id, action, [])), left)). |
| 374 | 371 | |
| 375 | -public define HTML_Partial_Content | |
| 372 | +public define HTML | |
| 376 | 373 | img_submit_button_load |
| 377 | 374 | ( |
| 378 | 375 | String label, //translated label of the button |
| ... | ... | @@ -383,7 +380,7 @@ public define HTML_Partial_Content |
| 383 | 380 | )= |
| 384 | 381 | jquery_button(jquery_img_button(icn16_check, label, "", jQuery_actioner(same, jqformload(form_id, target_id, action, extra_args)), left)). |
| 385 | 382 | |
| 386 | -public define HTML_Partial_Content | |
| 383 | +public define HTML | |
| 387 | 384 | img_submit_button_load |
| 388 | 385 | ( |
| 389 | 386 | String label, //translated label of the button |
| ... | ... | @@ -394,7 +391,7 @@ public define HTML_Partial_Content |
| 394 | 391 | jquery_button(jquery_img_button(icn16_check, label, "", jQuery_actioner(same, jqformload(form_id, target_id, action, [])), left)). |
| 395 | 392 | |
| 396 | 393 | |
| 397 | -public define HTML_Partial_Content | |
| 394 | +public define HTML | |
| 398 | 395 | img_submit_button |
| 399 | 396 | ( |
| 400 | 397 | String label, //translated label of the button |
| ... | ... | @@ -403,7 +400,7 @@ public define HTML_Partial_Content |
| 403 | 400 | jquery_button(jquery_img_button(icn16_check, label, "", jQuery_actioner(same, jqform(form_id, no_action, [])), left)) |
| 404 | 401 | . |
| 405 | 402 | |
| 406 | -public define HTML_Partial_Content | |
| 403 | +public define HTML | |
| 407 | 404 | img_button |
| 408 | 405 | ( |
| 409 | 406 | String icon, //URL of |
| ... | ... | @@ -415,7 +412,7 @@ public define HTML_Partial_Content |
| 415 | 412 | . |
| 416 | 413 | |
| 417 | 414 | |
| 418 | -public define HTML_Partial_Content | |
| 415 | +public define HTML | |
| 419 | 416 | img_button |
| 420 | 417 | ( |
| 421 | 418 | String icon, //URL of |
| ... | ... | @@ -427,7 +424,7 @@ public define HTML_Partial_Content |
| 427 | 424 | jquery_button(jquery_img_button(icon, label, "", jQuery_actioner(same, jqload(target, action, extra_ops)), left)) |
| 428 | 425 | . |
| 429 | 426 | |
| 430 | -public define HTML_Partial_Content | |
| 427 | +public define HTML | |
| 431 | 428 | img_button |
| 432 | 429 | ( |
| 433 | 430 | String icon, | ... | ... |
web/jQuery/jq_checkbox.anubis
| ... | ... | @@ -43,7 +43,7 @@ define String |
| 43 | 43 | " + off_script + " |
| 44 | 44 | }". |
| 45 | 45 | |
| 46 | -public define HTML_Partial_Content | |
| 46 | +public define HTML | |
| 47 | 47 | jq_img_checkbox |
| 48 | 48 | ( |
| 49 | 49 | String checkbox_id, |
| ... | ... | @@ -61,7 +61,7 @@ public define HTML_Partial_Content |
| 61 | 61 | jquery_button(jquery_img_button(image_url, checkbox_label, checkbox_id, jQuery_actioner(same, jqscript(checkbox_onclick_script(checkbox_id, on_script, off_script))), orientation)) |
| 62 | 62 | ). |
| 63 | 63 | |
| 64 | -public define HTML_Partial_Content | |
| 64 | +public define HTML | |
| 65 | 65 | jq_img_checkbox |
| 66 | 66 | ( |
| 67 | 67 | String checkbox_id, | ... | ... |
web/jQuery/jq_datatable.anubis
| ... | ... | @@ -59,29 +59,29 @@ public define List(HTML_Head_Tag) |
| 59 | 59 | // js(js_file("jquery/plug-in/DataTables-1.10.7/extensions/responsive/js/dataTables.responsive.js")), |
| 60 | 60 | ] |
| 61 | 61 | . |
| 62 | -public define HTML_Partial_Content | |
| 62 | +public define HTML | |
| 63 | 63 | jquery_datatable |
| 64 | 64 | ( |
| 65 | 65 | String table_id, |
| 66 | - HTML_Off_Form table | |
| 66 | + HTML table | |
| 67 | 67 | ) |
| 68 | 68 | = |
| 69 | - partial_content(jquery_datatables_1_10_init + | |
| 69 | + head_tags(jquery_datatables_1_10_init + | |
| 70 | 70 | [ js_inline(jquery_ready("$('#"+table_id+"').DataTable();")) ], |
| 71 | 71 | table |
| 72 | 72 | ) |
| 73 | 73 | . |
| 74 | 74 | |
| 75 | -public define HTML_Partial_Content | |
| 75 | +public define HTML | |
| 76 | 76 | jquery_datatable |
| 77 | 77 | ( |
| 78 | 78 | String table_id, |
| 79 | - HTML_Off_Form table, | |
| 79 | + HTML table, | |
| 80 | 80 | Bool enable_jqueryui, |
| 81 | 81 | ) |
| 82 | 82 | = |
| 83 | 83 | if enable_jqueryui then |
| 84 | - partial_content( jquery_datatables_1_10_init + | |
| 84 | + head_tags( jquery_datatables_1_10_init + | |
| 85 | 85 | [ js_inline(jquery_ready("$('#"+table_id+"').DataTable({\"jQueryUI\":true});")) ], |
| 86 | 86 | table |
| 87 | 87 | ) |
| ... | ... | @@ -90,11 +90,11 @@ public define HTML_Partial_Content |
| 90 | 90 | . |
| 91 | 91 | |
| 92 | 92 | |
| 93 | -public define HTML_Partial_Content | |
| 93 | +public define HTML | |
| 94 | 94 | jquery_datatable |
| 95 | 95 | ( |
| 96 | 96 | String table_id, |
| 97 | - HTML_Partial_Content table, | |
| 97 | + HTML table, | |
| 98 | 98 | Bool enable_jqueryui, |
| 99 | 99 | Bool enable_pagination, |
| 100 | 100 | JQuery_datatable_pagination_type pagination_type, |
| ... | ... | @@ -108,7 +108,7 @@ public define HTML_Partial_Content |
| 108 | 108 | String web_dir |
| 109 | 109 | ) |
| 110 | 110 | = |
| 111 | - partial_content( jquery_datatables_1_10_init + | |
| 111 | + head_tags( jquery_datatables_1_10_init + | |
| 112 | 112 | [ |
| 113 | 113 | js_inline(jquery_ready(" |
| 114 | 114 | $.fn.dataTable.ext.legacy.ajax = true; |
| ... | ... | @@ -139,27 +139,11 @@ public define HTML_Partial_Content |
| 139 | 139 | ) |
| 140 | 140 | . |
| 141 | 141 | |
| 142 | -public define HTML_Partial_Content | |
| 142 | +public define HTML | |
| 143 | 143 | jquery_datatable |
| 144 | 144 | ( |
| 145 | 145 | String table_id, |
| 146 | - HTML_Off_Form table, | |
| 147 | - Bool enable_jqueryui, | |
| 148 | - Bool enable_pagination, | |
| 149 | - JQuery_datatable_pagination_type pagination_type, | |
| 150 | - JQuery_datatable_scrollY_type scrollY, | |
| 151 | - Bool enable_change_page_length, // if true, "enable_pagination" must be true too. | |
| 152 | - Bool enable_search_field, | |
| 153 | - Bool enable_columns_sorting, | |
| 154 | - String web_dir | |
| 155 | - ) = | |
| 156 | - jquery_datatable(table_id, partial_content(table), enable_jqueryui, enable_pagination, pagination_type, false, scrollY, enable_change_page_length, enable_search_field, enable_columns_sorting, "en", no_extra, web_dir). | |
| 157 | - | |
| 158 | -public define HTML_Partial_Content | |
| 159 | - jquery_datatable | |
| 160 | - ( | |
| 161 | - String table_id, | |
| 162 | - HTML_Partial_Content table, | |
| 146 | + HTML table, | |
| 163 | 147 | Bool enable_jqueryui, |
| 164 | 148 | Bool enable_pagination, |
| 165 | 149 | JQuery_datatable_pagination_type pagination_type, | ... | ... |
web/jQuery/jq_dialog.anubis
| ... | ... | @@ -17,8 +17,8 @@ public type JQuery_dialog_id: |
| 17 | 17 | |
| 18 | 18 | public type JQuery_dialog: |
| 19 | 19 | empty, |
| 20 | - p_content(HTML_Partial_Content content), | |
| 21 | - off_form(HTML_Off_Form o_form), | |
| 20 | + p_content(HTML content), | |
| 21 | + off_form(HTML o_form), | |
| 22 | 22 | ajax(WEB_Action_Name url). |
| 23 | 23 | |
| 24 | 24 | public define JQuery_dialog ajax(String url) = ajax(action_name(url)). |
| ... | ... | @@ -52,7 +52,7 @@ public define String |
| 52 | 52 | . |
| 53 | 53 | |
| 54 | 54 | |
| 55 | -public define HTML_Partial_Content | |
| 55 | +public define HTML | |
| 56 | 56 | jq_dialog_create |
| 57 | 57 | ( |
| 58 | 58 | JQuery_dialog_id dial_id, |
| ... | ... | @@ -88,19 +88,21 @@ $( \"#"+dlg_id+"\" ).dialog({ |
| 88 | 88 | if content is |
| 89 | 89 | { |
| 90 | 90 | empty then |
| 91 | - partial_content([js], div([id(dlg_id)], empty)), | |
| 91 | + head_tags([js], div([id(dlg_id)], empty)), | |
| 92 | 92 | p_content(pc) then |
| 93 | - if pc is partial_content(tags, html) then | |
| 94 | - partial_content( [js . tags ], div([id(dlg_id)], html)), //html code of the dialog | |
| 93 | + if pc is head_tags(tags, html) then | |
| 94 | + head_tags( [js . tags ], div(id(dlg_id), html)) //html code of the dialog | |
| 95 | + else | |
| 96 | + pc, | |
| 95 | 97 | off_form(html) then |
| 96 | - partial_content( [js], div([id(dlg_id)], html)), //html code of the dialog | |
| 98 | + head_tags(js, div(id(dlg_id), html)), //html code of the dialog | |
| 97 | 99 | ajax(_url) then |
| 98 | 100 | with url = format_web_action_name(_url), |
| 99 | 101 | //println("jq_dialog_create : \njs_str ->"+js_str+"\nurl ->"+url); |
| 100 | - partial_content( [js], div([id(dlg_id), attr("ajax_url",url)])) | |
| 102 | + head_tags( [js], div([id(dlg_id), attr("ajax_url",url)])) | |
| 101 | 103 | }. |
| 102 | 104 | |
| 103 | -public define HTML_Partial_Content | |
| 105 | +public define HTML | |
| 104 | 106 | jq_dialog_create |
| 105 | 107 | ( |
| 106 | 108 | JQuery_dialog_id dial_id, |
| ... | ... | @@ -110,7 +112,7 @@ public define HTML_Partial_Content |
| 110 | 112 | )= |
| 111 | 113 | jq_dialog_create(dial_id, content, false, size, extra_param). |
| 112 | 114 | |
| 113 | -public define HTML_Partial_Content | |
| 115 | +public define HTML | |
| 114 | 116 | jq_dialog_create |
| 115 | 117 | ( |
| 116 | 118 | JQuery_dialog_id dial_id, |
| ... | ... | @@ -119,7 +121,7 @@ public define HTML_Partial_Content |
| 119 | 121 | )= |
| 120 | 122 | jq_dialog_create(dial_id, content, false, size, ""). |
| 121 | 123 | |
| 122 | -public define HTML_Partial_Content | |
| 124 | +public define HTML | |
| 123 | 125 | jq_dialog_create |
| 124 | 126 | ( |
| 125 | 127 | JQuery_dialog_id dial_id, |
| ... | ... | @@ -128,7 +130,7 @@ public define HTML_Partial_Content |
| 128 | 130 | )= |
| 129 | 131 | jq_dialog_create(dial_id, content, false, auto, extra_param). |
| 130 | 132 | |
| 131 | -public define HTML_Partial_Content | |
| 133 | +public define HTML | |
| 132 | 134 | jq_dialog_create |
| 133 | 135 | ( |
| 134 | 136 | JQuery_dialog_id dial_id, |
| ... | ... | @@ -136,7 +138,7 @@ public define HTML_Partial_Content |
| 136 | 138 | )= |
| 137 | 139 | jq_dialog_create(dial_id, content, false, auto, ""). |
| 138 | 140 | |
| 139 | -public define HTML_Partial_Content | |
| 141 | +public define HTML | |
| 140 | 142 | jq_dialog_create |
| 141 | 143 | ( |
| 142 | 144 | JQuery_dialog_id dial_id, |
| ... | ... | @@ -188,15 +190,14 @@ public define String |
| 188 | 190 | )= |
| 189 | 191 | _jq_dialog_open(success(html), dialog_id, params). |
| 190 | 192 | |
| 191 | -public define HTML_Partial_Content | |
| 193 | +public define HTML | |
| 192 | 194 | jq_dialog_open |
| 193 | 195 | ( |
| 194 | 196 | String html, |
| 195 | 197 | JQuery_dialog_id dialog_id, |
| 196 | 198 | String params |
| 197 | 199 | )= |
| 198 | - partial_content([], | |
| 199 | - literal(_jq_dialog_open(success(html), dialog_id, params))). | |
| 200 | + literal(_jq_dialog_open(success(html), dialog_id, params)). | |
| 200 | 201 | |
| 201 | 202 | public define String |
| 202 | 203 | jq_dialog_open | ... | ... |
web/jQuery/jq_eudock.anubis
web/jQuery/jq_jqplot.anubis
web/jQuery/jq_radio.anubis
| ... | ... | @@ -80,7 +80,7 @@ define String |
| 80 | 80 | "radio.removeClass('unchecked').addClass('checked');" |
| 81 | 81 | ) + on_script. |
| 82 | 82 | |
| 83 | -public define HTML_Partial_Content | |
| 83 | +public define HTML | |
| 84 | 84 | jq_img_radio |
| 85 | 85 | ( |
| 86 | 86 | String radio_id, |
| ... | ... | @@ -92,14 +92,14 @@ public define HTML_Partial_Content |
| 92 | 92 | String on_script, |
| 93 | 93 | Icon_orientation orientation |
| 94 | 94 | ) = |
| 95 | - partial_content( | |
| 95 | + head_tags( | |
| 96 | 96 | [ |
| 97 | 97 | js_inline(jquery_ready(radio_init_script(radio_id, radio_group, initial_state))) |
| 98 | 98 | ], |
| 99 | 99 | jquery_button(jquery_img_button(image_url, checkbox_label, radio_id, jQuery_actioner(same, jqscript(radio_onclick_script(radio_id, radio_group, multi_select_with_shift, on_script))), orientation)) |
| 100 | 100 | ). |
| 101 | 101 | |
| 102 | -public define HTML_Partial_Content | |
| 102 | +public define HTML | |
| 103 | 103 | jq_img_radio |
| 104 | 104 | ( |
| 105 | 105 | String radio_id, |
| ... | ... | @@ -112,7 +112,7 @@ public define HTML_Partial_Content |
| 112 | 112 | ) = |
| 113 | 113 | jq_img_radio(radio_id, none, initial_state, false, image_url, checkbox_label, script, orientation). |
| 114 | 114 | |
| 115 | -public define HTML_Partial_Content | |
| 115 | +public define HTML | |
| 116 | 116 | jq_img_radio |
| 117 | 117 | ( |
| 118 | 118 | String radio_id, | ... | ... |
web/jQuery/jq_tabs.anubis
| ... | ... | @@ -13,27 +13,27 @@ read xlib/web/common.anubis |
| 13 | 13 | read tools/basis.anubis |
| 14 | 14 | |
| 15 | 15 | public type JQuery_tab: |
| 16 | - jQuery_tab(String title, HTML_Partial_Content content) | |
| 16 | + jQuery_tab(String title, HTML content) | |
| 17 | 17 | . |
| 18 | 18 | |
| 19 | 19 | // Helper to be compatible with the first version of JQuery_tab which |
| 20 | - // take HTML_Off_Form as second argument instead of HTML_Partial_Content. | |
| 20 | + // take HTML as second argument instead of HTML. | |
| 21 | 21 | |
| 22 | 22 | public define JQuery_tab |
| 23 | 23 | jQuery_tab |
| 24 | 24 | ( |
| 25 | 25 | String title, |
| 26 | - HTML_Off_Form content | |
| 26 | + HTML content | |
| 27 | 27 | )= |
| 28 | 28 | jQuery_tab(title, partial_content([], content)). |
| 29 | 29 | |
| 30 | -define HTML_Partial_Content | |
| 30 | +define HTML | |
| 31 | 31 | _jquery_tabs |
| 32 | 32 | ( |
| 33 | 33 | String tabs_container_id, |
| 34 | 34 | List(JQuery_tab) tabs, |
| 35 | 35 | String tabs_titles, |
| 36 | - List(HTML_Off_Form) tabs_contents, | |
| 36 | + List(HTML) tabs_contents, | |
| 37 | 37 | List(HTML_Head_Tag) tabs_heads, |
| 38 | 38 | Int count |
| 39 | 39 | ) |
| ... | ... | @@ -66,7 +66,7 @@ define HTML_Partial_Content |
| 66 | 66 | } |
| 67 | 67 | . |
| 68 | 68 | |
| 69 | -public define HTML_Partial_Content | |
| 69 | +public define HTML | |
| 70 | 70 | jquery_tabs |
| 71 | 71 | ( |
| 72 | 72 | String tabs_container_id, |
| ... | ... | @@ -106,7 +106,7 @@ public define HTML_Partial_Content |
| 106 | 106 | div([id(tabs_container_id)], html) |
| 107 | 107 | ). |
| 108 | 108 | |
| 109 | -public define HTML_Partial_Content | |
| 109 | +public define HTML | |
| 110 | 110 | jquery_tabs |
| 111 | 111 | ( |
| 112 | 112 | String tabs_container_id, | ... | ... |
web/jQuery/jq_tiptip.anubis
| ... | ... | @@ -62,13 +62,13 @@ public define List(HTML_Head_Tag) |
| 62 | 62 | . |
| 63 | 63 | |
| 64 | 64 | |
| 65 | -/* Create a tipTip tooltip with a HTML_Partial_Content and position */ | |
| 66 | -public define HTML_Partial_Content | |
| 65 | +/* Create a tipTip tooltip with a HTML and position */ | |
| 66 | +public define HTML | |
| 67 | 67 | jquery_tiptip |
| 68 | 68 | ( |
| 69 | 69 | String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! |
| 70 | 70 | String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix |
| 71 | - HTML_Partial_Content tooltip_partial_content, | |
| 71 | + HTML tooltip_partial_content, | |
| 72 | 72 | JQ_tiptip_position position |
| 73 | 73 | ) |
| 74 | 74 | = |
| ... | ... | @@ -91,38 +91,38 @@ public define HTML_Partial_Content |
| 91 | 91 | ) |
| 92 | 92 | . |
| 93 | 93 | |
| 94 | -/* Create a tipTip tooltip with a HTML_Off_Form and position */ | |
| 95 | -public define HTML_Partial_Content | |
| 94 | +/* Create a tipTip tooltip with a HTML and position */ | |
| 95 | +public define HTML | |
| 96 | 96 | jquery_tiptip |
| 97 | 97 | ( |
| 98 | 98 | String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! |
| 99 | 99 | String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix |
| 100 | - HTML_Off_Form html_content, | |
| 100 | + HTML html_content, | |
| 101 | 101 | JQ_tiptip_position position |
| 102 | 102 | ) |
| 103 | 103 | = |
| 104 | 104 | jquery_tiptip(rollovered_id, tooltip_id, partial_content([], html_content), position) |
| 105 | 105 | . |
| 106 | 106 | |
| 107 | -/* Create a tipTip tooltip with a HTML_Partial_Content */ | |
| 108 | -public define HTML_Partial_Content | |
| 107 | +/* Create a tipTip tooltip with a HTML */ | |
| 108 | +public define HTML | |
| 109 | 109 | jquery_tiptip |
| 110 | 110 | ( |
| 111 | 111 | String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! |
| 112 | 112 | String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix |
| 113 | - HTML_Partial_Content tooltip_partial_content | |
| 113 | + HTML tooltip_partial_content | |
| 114 | 114 | ) |
| 115 | 115 | = |
| 116 | 116 | jquery_tiptip(rollovered_id, tooltip_id, tooltip_partial_content, jq_tiptip_bottom) |
| 117 | 117 | . |
| 118 | 118 | |
| 119 | -/* Create a tipTip tooltip with a HTML_Off_Form */ | |
| 120 | -public define HTML_Partial_Content | |
| 119 | +/* Create a tipTip tooltip with a HTML */ | |
| 120 | +public define HTML | |
| 121 | 121 | jquery_tiptip |
| 122 | 122 | ( |
| 123 | 123 | String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! |
| 124 | 124 | String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix |
| 125 | - HTML_Off_Form html_content | |
| 125 | + HTML html_content | |
| 126 | 126 | ) |
| 127 | 127 | = |
| 128 | 128 | jquery_tiptip(rollovered_id, tooltip_id, partial_content([], html_content)) | ... | ... |
web/jQuery/jq_toolbar.anubis
| ... | ... | @@ -9,11 +9,11 @@ |
| 9 | 9 | read xlib/web/making_a_web_site.anubis |
| 10 | 10 | read xlib/web/jQuery/jq_button.anubis |
| 11 | 11 | |
| 12 | -public define HTML_Partial_Content | |
| 12 | +public define HTML | |
| 13 | 13 | _jquery_toolbar |
| 14 | 14 | ( |
| 15 | 15 | List(JQuery_img_button) buttons, |
| 16 | - List(HTML_Cell(HTML_Off_Form)) so_far | |
| 16 | + List(HTML_Cell(HTML)) so_far | |
| 17 | 17 | )= |
| 18 | 18 | if buttons is |
| 19 | 19 | { |
| ... | ... | @@ -24,7 +24,7 @@ public define HTML_Partial_Content |
| 24 | 24 | _jquery_toolbar(t, [ cell(partial(jquery_button(h))) . so_far]) |
| 25 | 25 | }. |
| 26 | 26 | |
| 27 | -public define HTML_Partial_Content | |
| 27 | +public define HTML | |
| 28 | 28 | jquery_toolbar |
| 29 | 29 | ( |
| 30 | 30 | List(JQuery_img_button) buttons | ... | ... |
web/l3/l3.anubis
| ... | ... | @@ -11,10 +11,10 @@ read xlib/web/making_a_web_site.anubis |
| 11 | 11 | transmit locale/L3.anubis |
| 12 | 12 | transmit locale/L3LanguageInfo.anubis |
| 13 | 13 | |
| 14 | -define List(HTML_Off_Form) | |
| 14 | +define List(HTML) | |
| 15 | 15 | construct_language_option_list |
| 16 | 16 | ( |
| 17 | - List(HTML_Off_Form) so_far, | |
| 17 | + List(HTML) so_far, | |
| 18 | 18 | List(L3LanguageInfo) lang_list |
| 19 | 19 | ) = |
| 20 | 20 | if lang_list is |
| ... | ... | @@ -26,15 +26,15 @@ define List(HTML_Off_Form) |
| 26 | 26 | construct_language_option_list( [option(value(code_lang), text(code_lang +" | " + english_name + " | " + self_name)) . so_far], t) |
| 27 | 27 | }. |
| 28 | 28 | |
| 29 | -public define List(HTML_Off_Form) | |
| 29 | +public define List(HTML) | |
| 30 | 30 | l3_get_language_option_list = |
| 31 | 31 | construct_language_option_list([], standard_languages) |
| 32 | 32 | . |
| 33 | 33 | |
| 34 | -public define List(HTML_Off_Form) | |
| 34 | +public define List(HTML) | |
| 35 | 35 | _l3_get_all_chapters_options_list |
| 36 | 36 | ( |
| 37 | - List(HTML_Off_Form) so_far, | |
| 37 | + List(HTML) so_far, | |
| 38 | 38 | List(String) chapters_list |
| 39 | 39 | )= |
| 40 | 40 | if chapters_list is |
| ... | ... | @@ -45,7 +45,7 @@ public define List(HTML_Off_Form) |
| 45 | 45 | } |
| 46 | 46 | . |
| 47 | 47 | |
| 48 | -public define List(HTML_Off_Form) | |
| 48 | +public define List(HTML) | |
| 49 | 49 | l3_get_all_chapters_options_list |
| 50 | 50 | ( |
| 51 | 51 | String collection_name | ... | ... |
web/load_content.anubis
| ... | ... | @@ -122,7 +122,7 @@ public define String |
| 122 | 122 | load_content(target, web_action, [], replace, true) |
| 123 | 123 | . |
| 124 | 124 | |
| 125 | -public define HTML_Partial_Content | |
| 125 | +public define HTML | |
| 126 | 126 | load_content_init |
| 127 | 127 | ( |
| 128 | 128 | String target, |
| ... | ... | @@ -131,14 +131,13 @@ public define HTML_Partial_Content |
| 131 | 131 | Bool replace, |
| 132 | 132 | Bool overlay |
| 133 | 133 | )= |
| 134 | - partial_content([ | |
| 134 | + head_tags([ | |
| 135 | 135 | js(js_file("xlib/js/xlib.js")), |
| 136 | 136 | js_inline(script("text/javascript","$(document).ready(function(){"+load_content(target, web_action, extra_args, replace, overlay)+"});")) |
| 137 | - ], | |
| 138 | - empty) | |
| 137 | + ]) | |
| 139 | 138 | . |
| 140 | 139 | |
| 141 | -public define HTML_Partial_Content | |
| 140 | +public define HTML | |
| 142 | 141 | load_content_init |
| 143 | 142 | ( |
| 144 | 143 | String target, |
| ... | ... | @@ -149,7 +148,7 @@ public define HTML_Partial_Content |
| 149 | 148 | load_content_init(target, web_action, extra_args, replace, true) |
| 150 | 149 | . |
| 151 | 150 | |
| 152 | -public define HTML_Partial_Content | |
| 151 | +public define HTML | |
| 153 | 152 | load_content_init |
| 154 | 153 | ( |
| 155 | 154 | String target, |
| ... | ... | @@ -159,7 +158,7 @@ public define HTML_Partial_Content |
| 159 | 158 | load_content_init(target, web_action, extra_args, false, true) |
| 160 | 159 | . |
| 161 | 160 | |
| 162 | -public define HTML_Partial_Content | |
| 161 | +public define HTML | |
| 163 | 162 | load_content_init |
| 164 | 163 | ( |
| 165 | 164 | String target, |
| ... | ... | @@ -168,7 +167,7 @@ public define HTML_Partial_Content |
| 168 | 167 | load_content_init(target, web_action, [], false, true) |
| 169 | 168 | . |
| 170 | 169 | |
| 171 | -public define HTML_Partial_Content | |
| 170 | +public define HTML | |
| 172 | 171 | load_content_init |
| 173 | 172 | ( |
| 174 | 173 | String target, | ... | ... |
web/making_a_web_site.anubis
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | *Copyright* Copyright (c) Alain Prouté 2004-2005. |
| 8 | 8 | Copyright (c) Calexium 2007-2017. |
| 9 | - Copyright (c) David René 2007-2021. | |
| 9 | + Copyright (c) David René 2007-2026. | |
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 | *Authors* Alain Prouté |
| ... | ... | @@ -372,26 +372,6 @@ public define String |
| 372 | 372 | |
| 373 | 373 | $State -> HTTP_Answer |
| 374 | 374 | |
| 375 | - where the type 'HTTP_Answer' (defined below in this file) abstractly represents HTML | |
| 376 | - pages. | |
| 377 | - | |
| 378 | -//public type HTTP_Answer:... | |
| 379 | - | |
| 380 | - It should be clear that states and pages are deeply linked together. Indeed, we really | |
| 381 | - understand the page shown to the client as a representation of the current state of the | |
| 382 | - conversation between the client and the web site, but also containing informations | |
| 383 | - taken from the data bases. | |
| 384 | - | |
| 385 | - | |
| 386 | -//public type HTML_Partial_Content:... | |
| 387 | - | |
| 388 | - | |
| 389 | - | |
| 390 | - | |
| 391 | - | |
| 392 | - | |
| 393 | - | |
| 394 | - | |
| 395 | 375 | |
| 396 | 376 | public define List(HTTP_header) |
| 397 | 377 | make_session_cookie_headers |
| ... | ... | @@ -504,44 +484,6 @@ public type Web_Site:... |
| 504 | 484 | |
| 505 | 485 | Producing such a datum may be performed by: |
| 506 | 486 | |
| 507 | - public define Web_Site | |
| 508 | - make_web_site_description | |
| 509 | - ( | |
| 510 | - List(String) common_names, // for example: ["www.our-business.com", | |
| 511 | - // "192.168.0.1"] | |
| 512 | - // the second one is just for testing | |
| 513 | - String site_directory, // where 'public' and other directories are | |
| 514 | - // located (should NOT end with '/') | |
| 515 | - String state_directory, | |
| 516 | - One -> One init, | |
| 517 | - (HTTP_Info, | |
| 518 | - List(Web_arg), | |
| 519 | - Bool is_https) -> $State initial_state, | |
| 520 | - ($State expired, | |
| 521 | - Maybe(String), | |
| 522 | - HTTP_Info, | |
| 523 | - List(Web_arg), | |
| 524 | - Bool is_https) -> $State ticket_expired_state, | |
| 525 | - (Maybe(String), | |
| 526 | - HTTP_Info, | |
| 527 | - List(Web_arg), | |
| 528 | - Bool is_https) -> $State ticket_lost_state, | |
| 529 | - List(Web_Action($State)) actions, | |
| 530 | - $State -> HTTP_Answer compute_page, | |
| 531 | - $State -> List(HTTP_header) additional_headers, | |
| 532 | - List(HTTP_header) constant_additional_headers, | |
| 533 | - Int timeout, // seconds (todo: minutes) | |
| 534 | - Redirections redirections, | |
| 535 | - String charset, | |
| 536 | - List(String) journal_extensions, | |
| 537 | - List(String) journal_headers, | |
| 538 | - String authorization_secret, | |
| 539 | - List(MIME) known_mime_types, | |
| 540 | - (String action_name, | |
| 541 | - List(Web_arg) args)-> One before_send_file | |
| 542 | - ). | |
| 543 | - | |
| 544 | - | |
| 545 | 487 | Explanations: |
| 546 | 488 | |
| 547 | 489 | 'common_names' is the list of names of the site (the name the browser must send as the |
| ... | ... | @@ -706,7 +648,7 @@ public define Start_Web_Sites_Result |
| 706 | 648 | For easy reference, we gather below the definitions of all the types used by the HTML |
| 707 | 649 | interface, and we comment them immediately. |
| 708 | 650 | |
| 709 | - //public type HTML_Off_Form:... | |
| 651 | + //public type HTML:... | |
| 710 | 652 | |
| 711 | 653 | |
| 712 | 654 | public define Printable_tree [HTML_Id x . Printable_tree y] = str_pt(x.id, y). |
| ... | ... | @@ -719,20 +661,17 @@ public define CoreAttrs attr(String name, Bool value) = attr(name, if value th |
| 719 | 661 | public define CoreAttrs attr(String name, Int value) = attr(name, to_String(value)). |
| 720 | 662 | |
| 721 | 663 | |
| 722 | -public define InputAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). | |
| 664 | +//public define InputAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). | |
| 723 | 665 | |
| 724 | 666 | |
| 725 | 667 | |
| 726 | -public define Text_Option | |
| 727 | - tooltip(String s) = title(s). | |
| 668 | +//public define Text_Option | |
| 669 | +// tooltip(String s) = title(s). | |
| 728 | 670 | |
| 729 | 671 | A list of 'Text_Option' must be given with each text you want to put in your page. |
| 730 | 672 | |
| 731 | 673 | public define CoreAttrs |
| 732 | 674 | tooltip(String s) = title(s). |
| 733 | -public define InputAttrs | |
| 734 | - tooltip(String s) = title(s). | |
| 735 | - | |
| 736 | 675 | |
| 737 | 676 | public type I18n: |
| 738 | 677 | lang (String), |
| ... | ... | @@ -830,100 +769,7 @@ public define String |
| 830 | 769 | }. |
| 831 | 770 | |
| 832 | 771 | |
| 833 | -public define Table_Option nude = border(0,0,0,rgb(0,0,0)). | |
| 834 | - | |
| 835 | - | |
| 836 | - A list of 'Table_Option' must be given with each table. | |
| 837 | - | |
| 838 | - | |
| 839 | - | |
| 840 | - | |
| 841 | - | |
| 842 | - | |
| 843 | - A list of 'Cell_Option' must be given with each cell and each row in a table. Options | |
| 844 | - given with a row apply to all the cells in the row, but are superseded by options given | |
| 845 | - with cells, which apply only to the cell they are given with. | |
| 846 | - | |
| 847 | - | |
| 848 | - | |
| 849 | - | |
| 850 | - | |
| 851 | - The parameter $T is later instantiated either to 'HTML_In_Form' or to 'HTML_Off_Form', | |
| 852 | - depending on where you put your table (within a form or not within a form). For your | |
| 853 | - convenience, we define the following particular case: | |
| 854 | - | |
| 855 | -public define HTML_Cell($T) | |
| 856 | - cell | |
| 857 | - ( | |
| 858 | - $T content | |
| 859 | - )= | |
| 860 | - cell([],content) | |
| 861 | -. | |
| 862 | - | |
| 863 | -public define HTML_Cell($T) | |
| 864 | - cell | |
| 865 | - ( | |
| 866 | - Cell_Option option, | |
| 867 | - $T content | |
| 868 | - ) = | |
| 869 | - cell([option],content) | |
| 870 | -. | |
| 871 | - | |
| 872 | -public define HTML_Header_Cell($T) | |
| 873 | - header_cell | |
| 874 | - ( | |
| 875 | - $T content | |
| 876 | - ) = | |
| 877 | - header_cell([],content). | |
| 878 | - | |
| 879 | - | |
| 880 | - | |
| 881 | - | |
| 882 | - Same remark as for 'HTML_Cell($T)'. We define several convenience functions: | |
| 883 | - | |
| 884 | -public define HTML_Row($T) | |
| 885 | - row | |
| 886 | - ( | |
| 887 | - List(HTML_Cell($T)) cells | |
| 888 | - )= | |
| 889 | - row([],cells). | |
| 890 | - | |
| 891 | -public define HTML_Row($T) | |
| 892 | - row | |
| 893 | - ( | |
| 894 | - HTML_Cell($T) cell | |
| 895 | - )= | |
| 896 | - row([],[cell]). | |
| 897 | - | |
| 898 | -public define HTML_Row($T) | |
| 899 | - row | |
| 900 | - ( | |
| 901 | - List(Cell_Option) options, | |
| 902 | - HTML_Cell($T) cell | |
| 903 | - )= | |
| 904 | - row(options,[cell]). | |
| 905 | - | |
| 906 | -public define HTML_Row($T) | |
| 907 | - row | |
| 908 | - ( | |
| 909 | - Cell_Option option, | |
| 910 | - HTML_Cell($T) cell | |
| 911 | - )= | |
| 912 | - row([option],[cell]). | |
| 913 | - | |
| 914 | -public define HTML_Header_Row($T) | |
| 915 | - header_row | |
| 916 | - ( | |
| 917 | - List(HTML_Header_Cell($T)) cells | |
| 918 | - ) = | |
| 919 | - header_row([],cells). | |
| 920 | - | |
| 921 | -public define HTML_Header_Row($T) | |
| 922 | - header_row | |
| 923 | - ( | |
| 924 | - HTML_Header_Cell($T) cell | |
| 925 | - ) = | |
| 926 | - header_row([],[cell]). | |
| 772 | +//public define Table_Option nude = border(0,0,0,rgb(0,0,0)). | |
| 927 | 773 | |
| 928 | 774 | |
| 929 | 775 | |
| ... | ... | @@ -954,7 +800,7 @@ public define Actioner_Aspect |
| 954 | 800 | public define Actioner_Aspect |
| 955 | 801 | link |
| 956 | 802 | ( |
| 957 | - List(Text_Option) options, | |
| 803 | + List(CoreAttrs) options, | |
| 958 | 804 | String text |
| 959 | 805 | )= |
| 960 | 806 | link(options, text, failure). |
| ... | ... | @@ -970,7 +816,7 @@ public define Actioner_Aspect |
| 970 | 816 | public define Actioner_Aspect |
| 971 | 817 | link |
| 972 | 818 | ( |
| 973 | - List(Text_Option) options, | |
| 819 | + List(CoreAttrs) options, | |
| 974 | 820 | Int i |
| 975 | 821 | ) = |
| 976 | 822 | link(options, to_decimal(i), failure). |
| ... | ... | @@ -1058,7 +904,7 @@ public define HTML_Help |
| 1058 | 904 | |
| 1059 | 905 | /* It contains |
| 1060 | 906 | * - a List of HTML_Head_Tag representing necessaries head tags for the content. ex: jquery js files, js script, css specific styles, ... |
| 1061 | - * - a HTML_Off_Form representing the HTML code for the part of the page we want to display | |
| 907 | + * - a HTML representing the HTML code for the part of the page we want to display | |
| 1062 | 908 | */ |
| 1063 | 909 | //public type HTML_In_Form:... |
| 1064 | 910 | |
| ... | ... | @@ -1084,24 +930,13 @@ public define List(HTML_Head_Tag) |
| 1084 | 930 | convenience function: |
| 1085 | 931 | |
| 1086 | 932 | |
| 1087 | -public define HTML_In_Form text_input(HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width) = text_input([], label, id, name, init, width). | |
| 1088 | 933 | |
| 1089 | -public define HTML_In_Form literal(Printable_tree t) = literal_pt(t). | |
| 934 | +public define HTML literal(Printable_tree t) = literal_pt(t). | |
| 1090 | 935 | |
| 1091 | -public define HTML_In_Form image(String url) = image([], url, url). | |
| 1092 | 936 | |
| 1093 | -public define HTML_In_Form image(String url, Int width, Int height) = image([], url, url, width, height). | |
| 1094 | 937 | |
| 1095 | -public define HTML_In_Form | |
| 1096 | - foreign_link | |
| 1097 | - ( | |
| 1098 | - Int tsize, | |
| 1099 | - String url, | |
| 1100 | - String name | |
| 1101 | - ) = | |
| 1102 | - foreign_link([size(tsize)],url,name). | |
| 1103 | 938 | |
| 1104 | -public define HTML_In_Form | |
| 939 | +public define HTML | |
| 1105 | 940 | /* Older call with String as action instead of WEB_Action_Name. |
| 1106 | 941 | * This function exists only for compatibility with older project. |
| 1107 | 942 | * Please condiser to use above function instead |
| ... | ... | @@ -1118,7 +953,7 @@ public define HTML_In_Form |
| 1118 | 953 | actioner(conn,targ,asp,action_name(action),extra_ops,local_actions) |
| 1119 | 954 | . |
| 1120 | 955 | |
| 1121 | -public define HTML_In_Form | |
| 956 | +public define HTML | |
| 1122 | 957 | actioner |
| 1123 | 958 | ( |
| 1124 | 959 | Actioner_Connection conn, |
| ... | ... | @@ -1130,7 +965,7 @@ public define HTML_In_Form |
| 1130 | 965 | actioner(conn,targ,asp,action,extra_ops,[]) |
| 1131 | 966 | . |
| 1132 | 967 | |
| 1133 | -public define HTML_In_Form | |
| 968 | +public define HTML | |
| 1134 | 969 | /* Older call with String as action instead of WEB_Action_Name. |
| 1135 | 970 | * This function exists only for compatibility with older project. |
| 1136 | 971 | * Please condiser to use above function instead |
| ... | ... | @@ -1146,7 +981,7 @@ public define HTML_In_Form |
| 1146 | 981 | actioner(conn,targ,asp,action_name(action),extra_ops,[]) |
| 1147 | 982 | . |
| 1148 | 983 | |
| 1149 | -public define HTML_In_Form | |
| 984 | +public define HTML | |
| 1150 | 985 | actioner |
| 1151 | 986 | ( |
| 1152 | 987 | Actioner_Connection conn, |
| ... | ... | @@ -1154,62 +989,8 @@ public define HTML_In_Form |
| 1154 | 989 | Actioner_Aspect asp, |
| 1155 | 990 | )= |
| 1156 | 991 | actioner(conn, targ, asp, action_name(""), [], []). |
| 1157 | - | |
| 1158 | - | |
| 1159 | -public define HTML_In_Form | |
| 1160 | - text_area | |
| 1161 | - ( | |
| 1162 | - WebArgName name, | |
| 1163 | - InitialValue init, | |
| 1164 | - Int width, | |
| 1165 | - Int height | |
| 1166 | - ) = | |
| 1167 | - text_area([], no_label, html_Id(""), name,init,width,height). | |
| 1168 | - | |
| 1169 | -public define HTML_In_Form | |
| 1170 | - text_area | |
| 1171 | - ( | |
| 1172 | - List(TextAreaOption) options, | |
| 1173 | - WebArgName name, | |
| 1174 | - InitialValue init, | |
| 1175 | - Int width, | |
| 1176 | - Int height | |
| 1177 | - ) = | |
| 1178 | - text_area(options, no_label, html_Id(""), name,init,width,height). | |
| 1179 | - | |
| 1180 | -public define HTML_In_Form | |
| 1181 | - table | |
| 1182 | - ( | |
| 1183 | - List(HTML_Row(HTML_In_Form)) rows | |
| 1184 | - ) = | |
| 1185 | - table([],empty,rows,empty). | |
| 1186 | - | |
| 1187 | -public define HTML_In_Form | |
| 1188 | - table | |
| 1189 | - ( | |
| 1190 | - List(Table_Option) options, | |
| 1191 | - List(HTML_Row(HTML_In_Form)) rows | |
| 1192 | - ) = | |
| 1193 | - table(options,empty,rows,empty). | |
| 1194 | - | |
| 1195 | -public define HTML_In_Form | |
| 1196 | - table | |
| 1197 | - ( | |
| 1198 | - HTML_Header_Row(HTML_In_Form) h_row, | |
| 1199 | - List(HTML_Row(HTML_In_Form)) rows | |
| 1200 | - ) = | |
| 1201 | - table([],h_row,rows,empty). | |
| 1202 | - | |
| 1203 | -public define HTML_In_Form | |
| 1204 | - table | |
| 1205 | - ( | |
| 1206 | - List(Table_Option) options, | |
| 1207 | - HTML_Header_Row(HTML_In_Form) h_row, | |
| 1208 | - List(HTML_Row(HTML_In_Form)) rows | |
| 1209 | - ) = | |
| 1210 | - table(options,h_row,rows,empty). | |
| 1211 | - | |
| 1212 | -public define HTML_In_Form | |
| 992 | + | |
| 993 | + public define HTML_In_Form | |
| 1213 | 994 | private_download |
| 1214 | 995 | ( |
| 1215 | 996 | String abs_path, |
| ... | ... | @@ -1218,7 +999,7 @@ public define HTML_In_Form |
| 1218 | 999 | ) = |
| 1219 | 1000 | private_download(abs_path,name,extra_ext,failure). |
| 1220 | 1001 | |
| 1221 | -public define HTML_In_Form | |
| 1002 | + public define HTML_In_Form | |
| 1222 | 1003 | private_download |
| 1223 | 1004 | ( |
| 1224 | 1005 | String abs_path, |
| ... | ... | @@ -1228,90 +1009,6 @@ public define HTML_In_Form |
| 1228 | 1009 | List((String,String)) args |
| 1229 | 1010 | ) = |
| 1230 | 1011 | private_download(abs_path,name,extra_ext,success((action_name,args))). |
| 1231 | - | |
| 1232 | - | |
| 1233 | - | |
| 1234 | -public define HTML_In_Form | |
| 1235 | - text | |
| 1236 | - ( | |
| 1237 | - List(CoreAttrs) l, | |
| 1238 | - Int i | |
| 1239 | - ) = | |
| 1240 | - text(l, to_decimal(i)). | |
| 1241 | - | |
| 1242 | -public define HTML_In_Form | |
| 1243 | - text | |
| 1244 | - ( | |
| 1245 | - String s | |
| 1246 | - )= | |
| 1247 | - text([],s) | |
| 1248 | -. | |
| 1249 | - | |
| 1250 | -public define HTML_In_Form | |
| 1251 | - text | |
| 1252 | - ( | |
| 1253 | - Int i | |
| 1254 | - ) = | |
| 1255 | - text([], i) | |
| 1256 | -. | |
| 1257 | - | |
| 1258 | -public define HTML_In_Form | |
| 1259 | - div | |
| 1260 | - ( | |
| 1261 | - HTML_In_Form element | |
| 1262 | - )= | |
| 1263 | - div([], [element]) | |
| 1264 | -. | |
| 1265 | - | |
| 1266 | -public define HTML_In_Form | |
| 1267 | - div | |
| 1268 | - ( | |
| 1269 | - List(CoreAttrs) attrs, | |
| 1270 | - HTML_In_Form element | |
| 1271 | - )= | |
| 1272 | - div(attrs, [element]) | |
| 1273 | -. | |
| 1274 | - | |
| 1275 | -public define HTML_In_Form | |
| 1276 | - span | |
| 1277 | - ( | |
| 1278 | - String s | |
| 1279 | - )= | |
| 1280 | - span([],s) | |
| 1281 | -. | |
| 1282 | - | |
| 1283 | -public define HTML_In_Form | |
| 1284 | - span | |
| 1285 | - ( | |
| 1286 | - Int i | |
| 1287 | - ) = | |
| 1288 | - span([], to_decimal(i)) | |
| 1289 | -. | |
| 1290 | - | |
| 1291 | -public define HTML_In_Form | |
| 1292 | - radio_button (List(CoreAttrs) options, HTML_Label label, WebArgName n, WebArgValue value, Bool checked) | |
| 1293 | - = radio_button (options, label, html_Id(n.name), n, value, checked). | |
| 1294 | - | |
| 1295 | -public define HTML_In_Form | |
| 1296 | - radio_button_r (List(CoreAttrs) options, HTML_Label label, WebArgName n, WebArgValue value, Bool checked) | |
| 1297 | - = radio_button_r (options, label, html_Id(n.name), n, value, checked). | |
| 1298 | - | |
| 1299 | -public define HTML_In_Form | |
| 1300 | - check_box (List(CoreAttrs) options, HTML_Label label, WebArgName n, Bool checked) | |
| 1301 | - = check_box (options, label, html_Id(n.name), n, checked). | |
| 1302 | - | |
| 1303 | -public define HTML_In_Form | |
| 1304 | - check_box_r (List(CoreAttrs) options, HTML_Label label, WebArgName n, Bool checked) | |
| 1305 | - = check_box_r (options, label, html_Id(n.name), n, checked). | |
| 1306 | - | |
| 1307 | -public define HTML_In_Form | |
| 1308 | - file_upload (WebArgName n, Int width) | |
| 1309 | - = file_upload([], no_label, html_Id(n.name), n, width). | |
| 1310 | - | |
| 1311 | -public define HTML_In_Form | |
| 1312 | - hidden (WebArgName name, WebArgValue value) | |
| 1313 | - = | |
| 1314 | - hidden(html_Id(""), name, value). | |
| 1315 | 1012 | |
| 1316 | 1013 | public type Input_Type: |
| 1317 | 1014 | button, |
| ... | ... | @@ -1417,6 +1114,69 @@ public type FormMethod: |
| 1417 | 1114 | post |
| 1418 | 1115 | . |
| 1419 | 1116 | |
| 1117 | +public define String format_attrs (List(CoreAttrs) attributs). | |
| 1118 | + | |
| 1119 | + Formating choices for a <select> tag. | |
| 1120 | + | |
| 1121 | +public define Printable_tree | |
| 1122 | + format_choices | |
| 1123 | + ( | |
| 1124 | + List(String) l | |
| 1125 | + ) = | |
| 1126 | + if l is | |
| 1127 | + { | |
| 1128 | + [ ] then [ ], | |
| 1129 | + [h . t] then ["<option>", h, "</option>\n" . format_choices(t)] | |
| 1130 | + } | |
| 1131 | +. | |
| 1132 | + | |
| 1133 | + | |
| 1134 | +public define Printable_tree | |
| 1135 | + format_choices | |
| 1136 | + ( | |
| 1137 | + List(String) l, | |
| 1138 | + InitialValue selected | |
| 1139 | + ) = | |
| 1140 | + if l is | |
| 1141 | + { | |
| 1142 | + [ ] then [ ], | |
| 1143 | + [h . t] then if h = selected.value | |
| 1144 | + then ["<option selected=\"selected\">", h, "</option>\n" . format_choices(t)] | |
| 1145 | + else ["<option>", h, "</option>\n" . format_choices(t,selected)] | |
| 1146 | + }. | |
| 1147 | + | |
| 1148 | + | |
| 1149 | +public define Printable_tree | |
| 1150 | + format_choices | |
| 1151 | + ( | |
| 1152 | + List((List(CoreAttrs),WebArgValue,String)) l | |
| 1153 | + ) = | |
| 1154 | + if l is | |
| 1155 | + { | |
| 1156 | + [ ] then [ ], | |
| 1157 | + [h . t] then | |
| 1158 | + if h is (attrs,val,item) | |
| 1159 | + then ["<option value=\""+encode_HTML_entities(val.value)+"\" "+format_attrs(attrs)+">", item, "</option>\n" . format_choices(t)] | |
| 1160 | + }. | |
| 1161 | + | |
| 1162 | +public define Printable_tree | |
| 1163 | + format_choices | |
| 1164 | + ( | |
| 1165 | + List((List(CoreAttrs),WebArgValue,String)) l, | |
| 1166 | + InitialValue selected | |
| 1167 | + ) = | |
| 1168 | + if l is | |
| 1169 | + { | |
| 1170 | + [ ] then [ ], | |
| 1171 | + [h . t] then | |
| 1172 | + if h is (attrs,val,item) then | |
| 1173 | + if val.value = selected.value | |
| 1174 | + then ["<option value=\""+encode_HTML_entities(val.value)+"\" "+format_attrs(attrs)+" selected=\"selected\">", item, "</option>\n" . format_choices(t)] | |
| 1175 | + else ["<option value=\""+encode_HTML_entities(val.value)+"\" "+format_attrs(attrs)+" >", item, "</option>\n" . format_choices(t,selected)] | |
| 1176 | + }. | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1420 | 1180 | //public type HTML_Body:... |
| 1421 | 1181 | |
| 1422 | 1182 | public define CoreAttrs formaction(WEB_Action_Name action, List((String,String)) extra_ops) = attr("formaction", format_web_action_name(action, extra_ops)). |
| ... | ... | @@ -1425,227 +1185,286 @@ public define CoreAttrs formaction(WEB_Action_Name action) |
| 1425 | 1185 | public define CoreAttrs formmethod(FormMethod method) = attr("formmethod", if method is { get then "get", post then "post"}). |
| 1426 | 1186 | |
| 1427 | 1187 | |
| 1428 | - 'HTML_Off_Form' defines all the elements you may put outside any form. | |
| 1188 | + 'HTML' defines all the elements you may put outside any form. | |
| 1429 | 1189 | |
| 1430 | 1190 | |
| 1431 | 1191 | public define CoreAttrs method(String value) = attr("method", value). |
| 1192 | +public define CoreAttrs method(FormMethod method) = attr("method", if method is { get then "get", post then "post"}). | |
| 1432 | 1193 | public define CoreAttrs action(WEB_Action_Name action)= attr("action", "/"+format_web_action_name(action)). |
| 1433 | 1194 | public define CoreAttrs action(WEB_Action_Name action, List((String,String)) extra_ops)= attr("action", "/"+format_web_action_name(action, extra_ops)). |
| 1434 | 1195 | public define CoreAttrs formmethod(String value) = attr("formmethod", value). |
| 1435 | 1196 | public define CoreAttrs form(String value) = attr("form", value). |
| 1436 | 1197 | public define CoreAttrs for(String value) = attr("for", value). |
| 1437 | 1198 | |
| 1438 | - | |
| 1439 | -public define HTML_Off_Form text(List(CoreAttrs) attrs, Int i) = text(attrs, to_decimal(i)). | |
| 1440 | -public define HTML_Off_Form text(CoreAttrs attr, Int i) = text([attr], i). | |
| 1441 | -public define HTML_Off_Form text(Int i) = text([], i). | |
| 1442 | -public define HTML_Off_Form text(String s) = text([], s). | |
| 1443 | -public define HTML_Off_Form text(CoreAttrs attr, String s) = text([attr], s). | |
| 1444 | - | |
| 1445 | -public define HTML_Off_Form a(A_href _href) = a([], _href, _self, []). | |
| 1446 | -public define HTML_Off_Form a(List(CoreAttrs) attrs, A_href _href) = a(attrs, _href, _self, []). | |
| 1447 | -public define HTML_Off_Form a(List(CoreAttrs) attrs, A_href _href, HTML_Off_Form content) = a(attrs, _href, _self, [content]). | |
| 1448 | -public define HTML_Off_Form a(List(CoreAttrs) attrs, A_href _href, List(HTML_Off_Form) content) = a(attrs, _href, _self, content). | |
| 1449 | -public define HTML_Off_Form a(A_href _href, HTML_Off_Form content) = a([], _href, _self, [content]). | |
| 1450 | -public define HTML_Off_Form a(A_href _href, String _text) = a([], _href, _self, [text(_text)]). | |
| 1451 | -public define HTML_Off_Form a(A_href _href, List(HTML_Off_Form) content) = a([], _href, _self, content). | |
| 1452 | -public define HTML_Off_Form a(List(CoreAttrs) attrs, A_href _href, A_target _target, HTML_Off_Form content) = a(attrs, _href, _target, [content]). | |
| 1453 | -public define HTML_Off_Form a(CoreAttrs attr, A_href _href, A_target _target, HTML_Off_Form content) = a([attr], _href, _target, [content]). | |
| 1454 | -public define HTML_Off_Form a(A_href _href, A_target _target, HTML_Off_Form content) = a([], _href, _target, [content]). | |
| 1455 | -public define HTML_Off_Form a(A_href _href, A_target _target, List(HTML_Off_Form) content) = a([], _href, _target, content). | |
| 1456 | -public define HTML_Off_Form a(CoreAttrs attr, A_href _href, A_target _target, List(HTML_Off_Form) content) = a([attr], _href, _target, content). | |
| 1457 | -public define HTML_Off_Form a(CoreAttrs attr, A_href _href, List(HTML_Off_Form) content) = a([attr], _href, _self, content). | |
| 1458 | -public define HTML_Off_Form a(CoreAttrs attr, A_href _href, HTML_Off_Form content) = a([attr], _href, _self, [content]). | |
| 1199 | +/**********/ | |
| 1200 | +public define HTML format_label(HTML_Label _label, HTML_Id _id). | |
| 1201 | + | |
| 1202 | +/**********/ | |
| 1203 | + | |
| 1204 | +//public define HTML html_tag(String tag_name, HTML_Head_Tag head, List(CoreAttrs) attrs, List(HTML) contents) = html_tag(tag_name, [head], attrs, contents). | |
| 1205 | +//public define HTML html_tag(String tag_name, List(HTML_Head_Tag) heads, List(CoreAttrs) attrs, HTML content) = html_tag(tag_name, heads, attrs, [content]). | |
| 1206 | +//public define HTML html_tag(String tag_name, HTML_Head_Tag head, List(CoreAttrs) attrs, HTML content) = html_tag(tag_name, [head], attrs, [content]). | |
| 1207 | +//public define HTML html_tag(String tag_name, List(HTML_Head_Tag) heads, List(CoreAttrs) attrs) = html_tag(tag_name, heads, attrs, []). | |
| 1208 | +//public define HTML html_tag(String tag_name, HTML_Head_Tag head, List(CoreAttrs) attrs) = html_tag(tag_name, [head], attrs, []). | |
| 1209 | +//public define HTML html_tag(String tag_name, List(HTML_Head_Tag) heads, CoreAttrs attr, List(HTML) contents) = html_tag(tag_name, heads, [attr], contents). | |
| 1210 | +//public define HTML html_tag(String tag_name, HTML_Head_Tag head, CoreAttrs attr, List(HTML) contents) = html_tag(tag_name, [head], [attr], contents). | |
| 1211 | +//public define HTML html_tag(String tag_name, List(HTML_Head_Tag) heads, CoreAttrs attr, HTML content) = html_tag(tag_name, heads, [attr], [content]). | |
| 1212 | +//public define HTML html_tag(String tag_name, HTML_Head_Tag head, CoreAttrs attr, HTML content) = html_tag(tag_name, [head], [attr], [content]). | |
| 1213 | +//public define HTML html_tag(String tag_name, List(HTML_Head_Tag) heads, CoreAttrs attr) = html_tag(tag_name, heads, [attr], []). | |
| 1214 | +//public define HTML html_tag(String tag_name, HTML_Head_Tag head, CoreAttrs attr) = html_tag(tag_name, [head], [attr], []). | |
| 1215 | +//public define HTML html_tag(String tag_name, List(HTML_Head_Tag) heads, List(HTML) contents) = html_tag(tag_name, heads, [], contents). | |
| 1216 | +//public define HTML html_tag(String tag_name, HTML_Head_Tag head, List(HTML) contents) = html_tag(tag_name, [head], [], contents). | |
| 1217 | +//public define HTML html_tag(String tag_name, List(HTML_Head_Tag) heads, HTML content) = html_tag(tag_name, heads, [], [content]). | |
| 1218 | +//public define HTML html_tag(String tag_name, HTML_Head_Tag head, HTML content) = html_tag(tag_name, [head], [], [content]). | |
| 1219 | +//public define HTML html_tag(String tag_name, List(HTML_Head_Tag) heads) = html_tag(tag_name, heads, [], []). | |
| 1220 | +//public define HTML html_tag(String tag_name, HTML_Head_Tag head) = html_tag(tag_name, [head], [], []). | |
| 1221 | +// | |
| 1222 | +//public define HTML html_tag(String tag_name, List(CoreAttrs) attrs, List(HTML) contents) = html_tag(tag_name, [], attrs, contents). | |
| 1223 | +//public define HTML html_tag(String tag_name, List(CoreAttrs) attrs, HTML content) = html_tag(tag_name, [], attrs, [content]). | |
| 1224 | +//public define HTML html_tag(String tag_name, CoreAttrs attr, List(HTML) contents) = html_tag(tag_name, [], [attr], contents). | |
| 1225 | +//public define HTML html_tag(String tag_name, CoreAttrs attr, HTML content) = html_tag(tag_name, [], [attr], [content]). | |
| 1226 | +//public define HTML html_tag(String tag_name, List(CoreAttrs) attrs) = html_tag(tag_name, [], attrs, []). | |
| 1227 | +//public define HTML html_tag(String tag_name, CoreAttrs attr) = html_tag(tag_name, [], [attr], []). | |
| 1228 | +//public define HTML html_tag(String tag_name, List(HTML) contents) = html_tag(tag_name, [], [], contents). | |
| 1229 | +//public define HTML html_tag(String tag_name, HTML content) = html_tag(tag_name, [], [], [content]). | |
| 1230 | +//public define HTML html_tag(String tag_name) = html_tag(tag_name, [], [], []). | |
| 1231 | + | |
| 1232 | +//public define HTML html_tag(String tag_name, List(CoreAttrs) attrs, List(HTML) contents) = html_tag(tag_name, attrs, contents). | |
| 1233 | +public define HTML html_tag(String tag_name, List(CoreAttrs) attrs, HTML content) = html_tag(tag_name, attrs, [content]). | |
| 1234 | +public define HTML html_tag(String tag_name, CoreAttrs attr, List(HTML) contents) = html_tag(tag_name, [attr], contents). | |
| 1235 | +public define HTML html_tag(String tag_name, CoreAttrs attr, HTML content) = html_tag(tag_name, [attr], [content]). | |
| 1236 | +public define HTML html_tag(String tag_name, List(CoreAttrs) attrs) = html_tag(tag_name, attrs, []). | |
| 1237 | +public define HTML html_tag(String tag_name, CoreAttrs attr) = html_tag(tag_name, [attr], []). | |
| 1238 | +public define HTML html_tag(String tag_name, List(HTML) contents) = html_tag(tag_name, [], contents). | |
| 1239 | +public define HTML html_tag(String tag_name, HTML content) = html_tag(tag_name, [], [content]). | |
| 1240 | +public define HTML html_tag(String tag_name) = html_tag(tag_name, [], []). | |
| 1241 | + | |
| 1242 | + | |
| 1243 | +public define HTML text(List(CoreAttrs) attrs, Int i) = text(attrs, to_decimal(i)). | |
| 1244 | +public define HTML text(CoreAttrs attr, Int i) = text([attr], i). | |
| 1245 | +public define HTML text(Int i) = text([], i). | |
| 1246 | +public define HTML text(String s) = text([], s). | |
| 1247 | +public define HTML text(CoreAttrs attr, String s) = text([attr], s). | |
| 1248 | + | |
| 1249 | +public define HTML a(A_href _href) = a([], _href, _self, []). | |
| 1250 | +public define HTML a(List(CoreAttrs) attrs, A_href _href) = a(attrs, _href, _self, []). | |
| 1251 | +public define HTML a(List(CoreAttrs) attrs, A_href _href, HTML content) = a(attrs, _href, _self, [content]). | |
| 1252 | +public define HTML a(List(CoreAttrs) attrs, A_href _href, List(HTML) content) = a(attrs, _href, _self, content). | |
| 1253 | +public define HTML a(A_href _href, HTML content) = a([], _href, _self, [content]). | |
| 1254 | +public define HTML a(A_href _href, String _text) = a([], _href, _self, [text(_text)]). | |
| 1255 | +public define HTML a(A_href _href, List(HTML) content) = a([], _href, _self, content). | |
| 1256 | +public define HTML a(List(CoreAttrs) attrs, A_href _href, A_target _target, HTML content) = a(attrs, _href, _target, [content]). | |
| 1257 | +public define HTML a(CoreAttrs attr, A_href _href, A_target _target, HTML content) = a([attr], _href, _target, [content]). | |
| 1258 | +public define HTML a(A_href _href, A_target _target, HTML content) = a([], _href, _target, [content]). | |
| 1259 | +public define HTML a(A_href _href, A_target _target, List(HTML) content) = a([], _href, _target, content). | |
| 1260 | +public define HTML a(CoreAttrs attr, A_href _href, A_target _target, List(HTML) content) = a([attr], _href, _target, content). | |
| 1261 | +public define HTML a(CoreAttrs attr, A_href _href, List(HTML) content) = a([attr], _href, _self, content). | |
| 1262 | +public define HTML a(CoreAttrs attr, A_href _href, HTML content) = a([attr], _href, _self, [content]). | |
| 1263 | +public define HTML a(List(CoreAttrs) attrs, HTML content) = html_tag("a", attrs, [content]). | |
| 1264 | +public define HTML a(List(CoreAttrs) attrs) = html_tag("a", attrs). | |
| 1265 | + | |
| 1266 | + /// helper for <a> tag | |
| 1267 | +public define HTML mail_to(String email, HTML element) = a(href("mailto:"+email), element). | |
| 1268 | +public define HTML foreign_link(Int tsize, String url, String name) = a(size(tsize),href(url),text(name)). | |
| 1459 | 1269 | |
| 1460 | 1270 | // <article> |
| 1461 | -public define HTML_Off_Form article(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("article", attrs, content). | |
| 1462 | -public define HTML_Off_Form article(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("article", attrs, [content]). | |
| 1463 | -public define HTML_Off_Form article(List(HTML_Off_Form) content) = html_tag("article", [], content). | |
| 1464 | -public define HTML_Off_Form article(HTML_Off_Form content) = html_tag("article", [], [content]). | |
| 1271 | +public define HTML article(List(CoreAttrs) attrs, List(HTML) content) = html_tag("article", attrs, content). | |
| 1272 | +public define HTML article(List(CoreAttrs) attrs, HTML content) = html_tag("article", attrs, [content]). | |
| 1273 | +public define HTML article(List(HTML) content) = html_tag("article", content). | |
| 1274 | +public define HTML article(HTML content) = html_tag("article", [content]). | |
| 1465 | 1275 | |
| 1466 | 1276 | // <aside> |
| 1467 | -public define HTML_Off_Form aside(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("aside", attrs, content). | |
| 1468 | -public define HTML_Off_Form aside(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("aside", attrs, [content]). | |
| 1469 | -public define HTML_Off_Form aside(List(HTML_Off_Form) content) = html_tag("aside", [], content). | |
| 1470 | -public define HTML_Off_Form aside(HTML_Off_Form content) = html_tag("aside", [], [content]). | |
| 1277 | +public define HTML aside(List(CoreAttrs) attrs, List(HTML) content) = html_tag("aside", attrs, content). | |
| 1278 | +public define HTML aside(List(CoreAttrs) attrs, HTML content) = html_tag("aside", attrs, [content]). | |
| 1279 | +public define HTML aside(List(HTML) content) = html_tag("aside", content). | |
| 1280 | +public define HTML aside(HTML content) = html_tag("aside", [content]). | |
| 1471 | 1281 | |
| 1472 | 1282 | // <b> text in bold face |
| 1473 | -public define HTML_Off_Form b(String string) = html_tag("b", [], [text(string)]). | |
| 1474 | -public define HTML_Off_Form b(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("b", attrs, [content]). | |
| 1475 | -public define HTML_Off_Form b(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("b", [attr], content). | |
| 1476 | -public define HTML_Off_Form b(CoreAttrs attr, HTML_Off_Form content) = html_tag("b", [attr], [content]). | |
| 1477 | -public define HTML_Off_Form b(List(CoreAttrs) attrs, String string) = html_tag("b", attrs, [text(string)]). | |
| 1478 | -public define HTML_Off_Form b(CoreAttrs attr, String string) = html_tag("b", [attr], [text(string)]). | |
| 1283 | +public define HTML b(String string) = html_tag("b", [text(string)]). | |
| 1284 | +public define HTML b(List(CoreAttrs) attrs, HTML content) = html_tag("b", attrs, [content]). | |
| 1285 | +public define HTML b(CoreAttrs attr, List(HTML) content) = html_tag("b", [attr], content). | |
| 1286 | +public define HTML b(CoreAttrs attr, HTML content) = html_tag("b", [attr], [content]). | |
| 1287 | +public define HTML b(List(CoreAttrs) attrs, String string) = html_tag("b", attrs, [text(string)]). | |
| 1288 | +public define HTML b(CoreAttrs attr, String string) = html_tag("b", [attr], [text(string)]). | |
| 1479 | 1289 | |
| 1480 | 1290 | // <br> |
| 1481 | -public define HTML_Off_Form br = html_void_tag("br", []). | |
| 1482 | -public define HTML_Off_Form br(List(CoreAttrs) attrs) = html_void_tag("br", attrs). | |
| 1291 | +public define HTML br = html_void_tag("br", []). | |
| 1292 | +public define HTML br(List(CoreAttrs) attrs) = html_void_tag("br", attrs). | |
| 1483 | 1293 | |
| 1484 | 1294 | // <button> |
| 1485 | -public define HTML_Off_Form button(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("button", attrs, content). | |
| 1486 | -public define HTML_Off_Form button(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("button", attrs, [content]). | |
| 1487 | -public define HTML_Off_Form button(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("button", [attr], content). | |
| 1488 | -public define HTML_Off_Form button(CoreAttrs attr, HTML_Off_Form content) = html_tag("button", [attr], [content]). | |
| 1489 | -public define HTML_Off_Form button(List(CoreAttrs) attrs) = html_tag("button", attrs, []). | |
| 1490 | -public define HTML_Off_Form button(List(CoreAttrs) attrs, String string) = html_tag("button", attrs, [text(string)]). | |
| 1491 | -public define HTML_Off_Form button(List(HTML_Off_Form) content) = html_tag("button", [], content). | |
| 1492 | -public define HTML_Off_Form button(HTML_Off_Form content) = html_tag("button", [], [content]). | |
| 1295 | +public define HTML button(List(CoreAttrs) attrs, List(HTML) content) = html_tag("button", attrs, content). | |
| 1296 | +public define HTML button(List(CoreAttrs) attrs, HTML content) = html_tag("button", attrs, [content]). | |
| 1297 | +public define HTML button(CoreAttrs attr, List(HTML) content) = html_tag("button", [attr], content). | |
| 1298 | +public define HTML button(CoreAttrs attr, HTML content) = html_tag("button", [attr], [content]). | |
| 1299 | +public define HTML button(List(CoreAttrs) attrs) = html_tag("button", attrs). | |
| 1300 | +public define HTML button(List(CoreAttrs) attrs, String string) = html_tag("button", attrs, [text(string)]). | |
| 1301 | +public define HTML button(List(HTML) content) = html_tag("button", content). | |
| 1302 | +public define HTML button(HTML content) = html_tag("button", [content]). | |
| 1493 | 1303 | |
| 1494 | 1304 | // <canvas> |
| 1495 | -public define HTML_Off_Form canvas(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("canvas", attrs, content). | |
| 1496 | -public define HTML_Off_Form canvas(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("canvas", attrs, [content]). | |
| 1497 | -public define HTML_Off_Form canvas(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("canvas", [attr], content). | |
| 1498 | -public define HTML_Off_Form canvas(CoreAttrs attr, HTML_Off_Form content) = html_tag("canvas", [attr], [content]). | |
| 1499 | -public define HTML_Off_Form canvas(List(CoreAttrs) attrs) = html_tag("canvas", attrs, []). | |
| 1500 | -public define HTML_Off_Form canvas(List(HTML_Off_Form) content) = html_tag("canvas", [], content). | |
| 1501 | -public define HTML_Off_Form canvas(HTML_Off_Form content) = html_tag("canvas", [], [content]). | |
| 1502 | -public define HTML_Off_Form canvas(CoreAttrs cattr, Int width, Int height) = html_tag("canvas", [cattr, | |
| 1305 | +public define HTML canvas(List(CoreAttrs) attrs, List(HTML) content) = html_tag("canvas", attrs, content). | |
| 1306 | +public define HTML canvas(List(CoreAttrs) attrs, HTML content) = html_tag("canvas", attrs, [content]). | |
| 1307 | +public define HTML canvas(CoreAttrs attr, List(HTML) content) = html_tag("canvas", [attr], content). | |
| 1308 | +public define HTML canvas(CoreAttrs attr, HTML content) = html_tag("canvas", [attr], [content]). | |
| 1309 | +public define HTML canvas(List(CoreAttrs) attrs) = html_tag("canvas", attrs). | |
| 1310 | +public define HTML canvas(List(HTML) content) = html_tag("canvas", content). | |
| 1311 | +public define HTML canvas(HTML content) = html_tag("canvas", [content]). | |
| 1312 | +public define HTML canvas(CoreAttrs cattr, Int width, Int height) = html_tag("canvas", [cattr, | |
| 1503 | 1313 | attr("width", to_String(width)), |
| 1504 | 1314 | attr("height", to_String(height)) |
| 1505 | - ], []). | |
| 1506 | -public define HTML_Off_Form canvas(List(CoreAttrs) attrs, Int width, Int height) = html_tag("canvas", [ | |
| 1315 | + ]). | |
| 1316 | +public define HTML canvas(List(CoreAttrs) attrs, Int width, Int height) = html_tag("canvas", [ | |
| 1507 | 1317 | attr("width", to_String(width)), |
| 1508 | 1318 | attr("height", to_String(height)). |
| 1509 | 1319 | attrs |
| 1510 | - ], []). | |
| 1320 | + ]). | |
| 1511 | 1321 | // <datalist> |
| 1512 | -public define HTML_Off_Form datalist(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("datalist", attrs, content). | |
| 1513 | -public define HTML_Off_Form datalist(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("datalist", attrs, [content]). | |
| 1514 | -public define HTML_Off_Form datalist(List(HTML_Off_Form) content) = html_tag("datalist", [], content). | |
| 1515 | -public define HTML_Off_Form datalist(HTML_Off_Form content) = html_tag("datalist", [], [content]). | |
| 1322 | +public define HTML datalist(List(CoreAttrs) attrs, List(HTML) content) = html_tag("datalist", attrs, content). | |
| 1323 | +public define HTML datalist(List(CoreAttrs) attrs, HTML content) = html_tag("datalist", attrs, [content]). | |
| 1324 | +public define HTML datalist(List(HTML) content) = html_tag("datalist", content). | |
| 1325 | +public define HTML datalist(HTML content) = html_tag("datalist", [content]). | |
| 1516 | 1326 | |
| 1517 | 1327 | // <div> |
| 1518 | -public define HTML_Off_Form div(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("div", attrs, content). | |
| 1519 | -public define HTML_Off_Form div(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("div", attrs, [content]). | |
| 1520 | -public define HTML_Off_Form div(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("div", [attr], content). | |
| 1521 | -public define HTML_Off_Form div(CoreAttrs attr, HTML_Off_Form content) = html_tag("div", [attr], [content]). | |
| 1522 | -public define HTML_Off_Form div(List(HTML_Off_Form) content) = html_tag("div", [], content). | |
| 1523 | -public define HTML_Off_Form div(HTML_Off_Form content) = html_tag("div", [], [content]). | |
| 1524 | -public define HTML_Off_Form div(List(CoreAttrs) attrs) = html_tag("div", attrs, []). | |
| 1525 | -public define HTML_Off_Form div(CoreAttrs attr) = html_tag("div", [attr], []). | |
| 1526 | - | |
| 1527 | -public define HTML_Off_Form div(String string) = html_tag("div", [], [text(string)]). | |
| 1528 | -public define HTML_Off_Form div(CoreAttrs attr, String string) = html_tag("div", [attr], [text(string)]). | |
| 1529 | -public define HTML_Off_Form div(List(CoreAttrs) attrs, String string) = html_tag("div", attrs, [text(string)]). | |
| 1530 | - | |
| 1531 | -public define HTML_Off_Form div(List(CoreAttrs) attrs, HTML_Partial_Content content) = div(attrs, [content]). | |
| 1532 | -public define HTML_Off_Form div(List(HTML_Partial_Content) content) = div([], content). | |
| 1533 | -public define HTML_Off_Form div(CoreAttrs attr, HTML_Partial_Content content) = div([attr], [content]). | |
| 1534 | -public define HTML_Off_Form div(HTML_Partial_Content content) = div([], [content]). | |
| 1535 | - | |
| 1536 | -//public define HTML_Partial_Content div(List(CoreAttrs) attrs, HTML_Partial_Content content) = partial_content([], div(attrs, [content])). | |
| 1537 | -//public define HTML_Partial_Content div(CoreAttrs attr, HTML_Partial_Content content) = partial_content([], div([attr], [content])). | |
| 1538 | -//public define HTML_Partial_Content div(List(HTML_Partial_Content) content) = partial_content([], div([], content)). | |
| 1539 | -//public define HTML_Partial_Content div(HTML_Partial_Content content) = partial_content([], div([], [content])). | |
| 1328 | +public define HTML div(List(CoreAttrs) attrs, List(HTML) content) = html_tag("div", attrs, content). | |
| 1329 | +public define HTML div(List(CoreAttrs) attrs, HTML content) = html_tag("div", attrs, [content]). | |
| 1330 | +public define HTML div(CoreAttrs attr, List(HTML) content) = html_tag("div", [attr], content). | |
| 1331 | +public define HTML div(CoreAttrs attr, HTML content) = html_tag("div", [attr], [content]). | |
| 1332 | +public define HTML div(List(HTML) content) = html_tag("div", content). | |
| 1333 | +public define HTML div(HTML content) = html_tag("div", [content]). | |
| 1334 | +public define HTML div(List(CoreAttrs) attrs) = html_tag("div", attrs). | |
| 1335 | +public define HTML div(CoreAttrs attr) = html_tag("div", [attr]). | |
| 1336 | + | |
| 1337 | +public define HTML div(String string) = html_tag("div", [text(string)]). | |
| 1338 | +public define HTML div(CoreAttrs attr, String string) = html_tag("div", [attr], [text(string)]). | |
| 1339 | +public define HTML div(List(CoreAttrs) attrs, String string) = html_tag("div", attrs, [text(string)]). | |
| 1340 | + | |
| 1341 | +//public define HTML div(List(CoreAttrs) attrs, HTML content) = html_tag("div", attrs, [content]). | |
| 1342 | +//public define HTML div(List(HTML) content) = html_tag("div", [], content). | |
| 1343 | +//public define HTML div(CoreAttrs attr, HTML content) = html_tag("div", [attr], [content]). | |
| 1344 | +//public define HTML div(HTML content) = html_tag("div", [], [content]). | |
| 1345 | + | |
| 1346 | +//public define HTML div(List(CoreAttrs) attrs, HTML content) = partial_content([], div(attrs, [content])). | |
| 1347 | +//public define HTML div(CoreAttrs attr, HTML content) = partial_content([], div([attr], [content])). | |
| 1348 | +//public define HTML div(List(HTML) content) = partial_content([], div([], content)). | |
| 1349 | +//public define HTML div(HTML content) = partial_content([], div([], [content])). | |
| 1540 | 1350 | |
| 1541 | 1351 | // <dd> |
| 1542 | -public define HTML_Off_Form dd(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("dd", attrs, content). | |
| 1543 | -public define HTML_Off_Form dd(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("dd", attrs, [content]). | |
| 1544 | -public define HTML_Off_Form dd(List(HTML_Off_Form) content) = html_tag("dd", [], content). | |
| 1545 | -public define HTML_Off_Form dd(HTML_Off_Form content) = html_tag("dd", [], [content]). | |
| 1352 | +public define HTML dd(List(CoreAttrs) attrs, List(HTML) content) = html_tag("dd", attrs, content). | |
| 1353 | +public define HTML dd(List(CoreAttrs) attrs, HTML content) = html_tag("dd", attrs, [content]). | |
| 1354 | +public define HTML dd(List(HTML) content) = html_tag("dd", content). | |
| 1355 | +public define HTML dd(HTML content) = html_tag("dd", [content]). | |
| 1546 | 1356 | |
| 1547 | 1357 | // <dl> |
| 1548 | -public define HTML_Off_Form dl(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("dl", attrs, content). | |
| 1549 | -public define HTML_Off_Form dl(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("dl", attrs, [content]). | |
| 1550 | -public define HTML_Off_Form dl(List(HTML_Off_Form) content) = html_tag("dl", [], content). | |
| 1551 | -public define HTML_Off_Form dl(HTML_Off_Form content) = html_tag("dl", [], [content]). | |
| 1358 | +public define HTML dl(List(CoreAttrs) attrs, List(HTML) content) = html_tag("dl", attrs, content). | |
| 1359 | +public define HTML dl(List(CoreAttrs) attrs, HTML content) = html_tag("dl", attrs, [content]). | |
| 1360 | +public define HTML dl(List(HTML) content) = html_tag("dl", content). | |
| 1361 | +public define HTML dl(HTML content) = html_tag("dl", [content]). | |
| 1552 | 1362 | |
| 1553 | 1363 | // <dt> |
| 1554 | -public define HTML_Off_Form dt(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("dt", attrs, content). | |
| 1555 | -public define HTML_Off_Form dt(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("dt", attrs, [content]). | |
| 1556 | -public define HTML_Off_Form dt(List(HTML_Off_Form) content) = html_tag("dt", [], content). | |
| 1557 | -public define HTML_Off_Form dt(HTML_Off_Form content) = html_tag("dt", [], [content]). | |
| 1364 | +public define HTML dt(List(CoreAttrs) attrs, List(HTML) content) = html_tag("dt", attrs, content). | |
| 1365 | +public define HTML dt(List(CoreAttrs) attrs, HTML content) = html_tag("dt", attrs, [content]). | |
| 1366 | +public define HTML dt(List(HTML) content) = html_tag("dt", content). | |
| 1367 | +public define HTML dt(HTML content) = html_tag("dt", [content]). | |
| 1558 | 1368 | |
| 1559 | 1369 | // <em> |
| 1560 | -public define HTML_Off_Form em(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("em", attrs, content). | |
| 1561 | -public define HTML_Off_Form em(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("em", attrs, [content]). | |
| 1562 | -public define HTML_Off_Form em(List(HTML_Off_Form) content) = html_tag("em", [], content). | |
| 1563 | -public define HTML_Off_Form em(HTML_Off_Form content) = html_tag("em", [], [content]). | |
| 1370 | +public define HTML em(List(CoreAttrs) attrs, List(HTML) content) = html_tag("em", attrs, content). | |
| 1371 | +public define HTML em(List(CoreAttrs) attrs, HTML content) = html_tag("em", attrs, [content]). | |
| 1372 | +public define HTML em(List(HTML) content) = html_tag("em", content). | |
| 1373 | +public define HTML em(HTML content) = html_tag("em", [content]). | |
| 1374 | + | |
| 1375 | + // <fieldset> | |
| 1376 | +public define HTML fieldset(List(CoreAttrs) attrs, List(HTML) content) = html_tag("fieldset", attrs, content). | |
| 1377 | +public define HTML fieldset(List(CoreAttrs) attrs, HTML content) = html_tag("fieldset", attrs, [content]). | |
| 1378 | +public define HTML fieldset(List(HTML) content) = html_tag("fieldset", content). | |
| 1379 | +public define HTML fieldset(HTML content) = html_tag("fieldset", [content]). | |
| 1564 | 1380 | |
| 1565 | 1381 | // <footer> |
| 1566 | -public define HTML_Off_Form footer(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("footer", attrs, content). | |
| 1567 | -public define HTML_Off_Form footer(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("footer", attrs, [content]). | |
| 1568 | -public define HTML_Off_Form footer(List(HTML_Off_Form) content) = html_tag("footer", [], content). | |
| 1569 | -public define HTML_Off_Form footer(HTML_Off_Form content) = html_tag("footer", [], [content]). | |
| 1382 | +public define HTML footer(List(CoreAttrs) attrs, List(HTML) content) = html_tag("footer", attrs, content). | |
| 1383 | +public define HTML footer(List(CoreAttrs) attrs, HTML content) = html_tag("footer", attrs, [content]). | |
| 1384 | +public define HTML footer(List(HTML) content) = html_tag("footer", content). | |
| 1385 | +public define HTML footer(HTML content) = html_tag("footer", [content]). | |
| 1570 | 1386 | |
| 1571 | 1387 | // <form> |
| 1572 | -public define HTML_Off_Form form(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("form", attrs, content). | |
| 1573 | -public define HTML_Off_Form form(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("form", attrs, [content]). | |
| 1574 | -public define HTML_Off_Form form(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("form", [attr], content). | |
| 1575 | -public define HTML_Off_Form form(CoreAttrs attr, HTML_Off_Form content) = html_tag("form", [attr], [content]). | |
| 1576 | -public define HTML_Off_Form form(List(CoreAttrs) attrs) = html_tag("form", attrs, []). | |
| 1577 | -public define HTML_Off_Form form(CoreAttrs attr) = html_tag("form", [attr], []). | |
| 1388 | +public define HTML form(List(CoreAttrs) attrs, List(HTML) content) = html_tag("form", attrs, content). | |
| 1389 | +public define HTML form(List(CoreAttrs) attrs, HTML content) = html_tag("form", attrs, [content]). | |
| 1390 | +public define HTML form(CoreAttrs attr, List(HTML) content) = html_tag("form", [attr], content). | |
| 1391 | +public define HTML form(CoreAttrs attr, HTML content) = html_tag("form", [attr], [content]). | |
| 1392 | +public define HTML form(List(CoreAttrs) attrs) = html_tag("form", attrs). | |
| 1393 | +public define HTML form(CoreAttrs attr) = html_tag("form", [attr]). | |
| 1578 | 1394 | |
| 1579 | -public define HTML_Off_Form form(List(HTML_Off_Form) content) = html_tag("form", [], content). | |
| 1580 | -public define HTML_Off_Form form(HTML_Off_Form content) = html_tag("form", [], [content]). | |
| 1395 | +public define HTML form(List(HTML) content) = html_tag("form", content). | |
| 1396 | +public define HTML form(HTML content) = html_tag("form", [content]). | |
| 1581 | 1397 | |
| 1582 | 1398 | |
| 1583 | 1399 | // <header> |
| 1584 | -public define HTML_Off_Form header(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("header", attrs, content). | |
| 1585 | -public define HTML_Off_Form header(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("header", attrs, [content]). | |
| 1586 | -public define HTML_Off_Form header(List(HTML_Off_Form) content) = html_tag("header", [], content). | |
| 1587 | -public define HTML_Off_Form header(HTML_Off_Form content) = html_tag("header", [], [content]). | |
| 1400 | +public define HTML header(List(CoreAttrs) attrs, List(HTML) content) = html_tag("header", attrs, content). | |
| 1401 | +public define HTML header(List(CoreAttrs) attrs, HTML content) = html_tag("header", attrs, [content]). | |
| 1402 | +public define HTML header(List(HTML) content) = html_tag("header", content). | |
| 1403 | +public define HTML header(HTML content) = html_tag("header", [content]). | |
| 1588 | 1404 | |
| 1589 | 1405 | // <h1> |
| 1590 | -public define HTML_Off_Form h1(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h1", attrs, content). | |
| 1591 | -public define HTML_Off_Form h1(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("h1", [attr], content). | |
| 1592 | -public define HTML_Off_Form h1(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h1", attrs, [content]). | |
| 1593 | -public define HTML_Off_Form h1(CoreAttrs attr, HTML_Off_Form content) = html_tag("h1", [attr], [content]). | |
| 1594 | -public define HTML_Off_Form h1(List(HTML_Off_Form) content) = html_tag("h1", [], content). | |
| 1595 | -public define HTML_Off_Form h1(HTML_Off_Form content) = html_tag("h1", [], [content]). | |
| 1406 | +public define HTML h1(List(CoreAttrs) attrs, List(HTML) content) = html_tag("h1", attrs, content). | |
| 1407 | +public define HTML h1(CoreAttrs attr, List(HTML) content) = html_tag("h1", [attr], content). | |
| 1408 | +public define HTML h1(List(CoreAttrs) attrs, HTML content) = html_tag("h1", attrs, [content]). | |
| 1409 | +public define HTML h1(CoreAttrs attr, HTML content) = html_tag("h1", [attr], [content]). | |
| 1410 | +public define HTML h1(List(HTML) content) = html_tag("h1", content). | |
| 1411 | +public define HTML h1(HTML content) = html_tag("h1", [content]). | |
| 1596 | 1412 | // <h2> |
| 1597 | -public define HTML_Off_Form h2(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h2", attrs, content). | |
| 1598 | -public define HTML_Off_Form h2(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h2", attrs, [content]). | |
| 1599 | -public define HTML_Off_Form h2(List(HTML_Off_Form) content) = html_tag("h2", [], content). | |
| 1600 | -public define HTML_Off_Form h2(HTML_Off_Form content) = html_tag("h2", [], [content]). | |
| 1413 | +public define HTML h2(List(CoreAttrs) attrs, List(HTML) content) = html_tag("h2", attrs, content). | |
| 1414 | +public define HTML h2(List(CoreAttrs) attrs, HTML content) = html_tag("h2", attrs, [content]). | |
| 1415 | +public define HTML h2(List(HTML) content) = html_tag("h2", content). | |
| 1416 | +public define HTML h2(HTML content) = html_tag("h2", [content]). | |
| 1601 | 1417 | // <h3> |
| 1602 | -public define HTML_Off_Form h3(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h3", attrs, content). | |
| 1603 | -public define HTML_Off_Form h3(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h3", attrs, [content]). | |
| 1604 | -public define HTML_Off_Form h3(List(HTML_Off_Form) content) = html_tag("h3", [], content). | |
| 1605 | -public define HTML_Off_Form h3(HTML_Off_Form content) = html_tag("h3", [], [content]). | |
| 1418 | +public define HTML h3(List(CoreAttrs) attrs, List(HTML) content) = html_tag("h3", attrs, content). | |
| 1419 | +public define HTML h3(List(CoreAttrs) attrs, HTML content) = html_tag("h3", attrs, [content]). | |
| 1420 | +public define HTML h3(List(HTML) content) = html_tag("h3", content). | |
| 1421 | +public define HTML h3(HTML content) = html_tag("h3", [content]). | |
| 1422 | +public define HTML h3(String content) = html_tag("h3", [text(content)]). | |
| 1423 | + | |
| 1606 | 1424 | // <h4> |
| 1607 | -public define HTML_Off_Form h4(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h4", attrs, content). | |
| 1608 | -public define HTML_Off_Form h4(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h4", attrs, [content]). | |
| 1609 | -public define HTML_Off_Form h4(List(HTML_Off_Form) content) = html_tag("h4", [], content). | |
| 1610 | -public define HTML_Off_Form h4(HTML_Off_Form content) = html_tag("h4", [], [content]). | |
| 1425 | +public define HTML h4(List(CoreAttrs) attrs, List(HTML) content) = html_tag("h4", attrs, content). | |
| 1426 | +public define HTML h4(List(CoreAttrs) attrs, HTML content) = html_tag("h4", attrs, [content]). | |
| 1427 | +public define HTML h4(List(HTML) content) = html_tag("h4", content). | |
| 1428 | +public define HTML h4(HTML content) = html_tag("h4", [content]). | |
| 1611 | 1429 | // <h5> |
| 1612 | -public define HTML_Off_Form h5(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h5", attrs, content). | |
| 1613 | -public define HTML_Off_Form h5(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h5", attrs, [content]). | |
| 1614 | -public define HTML_Off_Form h5(List(HTML_Off_Form) content) = html_tag("h5", [], content). | |
| 1615 | -public define HTML_Off_Form h5(HTML_Off_Form content) = html_tag("h5", [], [content]). | |
| 1430 | +public define HTML h5(List(CoreAttrs) attrs, List(HTML) content) = html_tag("h5", attrs, content). | |
| 1431 | +public define HTML h5(List(CoreAttrs) attrs, HTML content) = html_tag("h5", attrs, [content]). | |
| 1432 | +public define HTML h5(List(HTML) content) = html_tag("h5", content). | |
| 1433 | +public define HTML h5(HTML content) = html_tag("h5", [content]). | |
| 1616 | 1434 | |
| 1617 | 1435 | // <h6> |
| 1618 | -public define HTML_Off_Form h6(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h6", attrs, content). | |
| 1619 | -public define HTML_Off_Form h6(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h6", attrs, [content]). | |
| 1620 | -public define HTML_Off_Form h6(List(HTML_Off_Form) content) = html_tag("h6", [], content). | |
| 1621 | -public define HTML_Off_Form h6(HTML_Off_Form content) = html_tag("h6", [], [content]). | |
| 1436 | +public define HTML h6(List(CoreAttrs) attrs, List(HTML) content) = html_tag("h6", attrs, content). | |
| 1437 | +public define HTML h6(List(CoreAttrs) attrs, HTML content) = html_tag("h6", attrs, [content]). | |
| 1438 | +public define HTML h6(List(HTML) content) = html_tag("h6", content). | |
| 1439 | +public define HTML h6(HTML content) = html_tag("h6", [content]). | |
| 1622 | 1440 | |
| 1623 | 1441 | // <hr> |
| 1624 | -public define HTML_Off_Form hr = html_void_tag("hr", []). | |
| 1625 | -public define HTML_Off_Form hr(List(CoreAttrs) attrs) = html_void_tag("hr", attrs). | |
| 1626 | -public define HTML_Off_Form hr(CoreAttrs attr) = html_void_tag("hr", [attr]). | |
| 1442 | +public define HTML hr = html_void_tag("hr", []). | |
| 1443 | +public define HTML hr(List(CoreAttrs) attrs) = html_void_tag("hr", attrs). | |
| 1444 | +public define HTML hr(CoreAttrs attr) = html_void_tag("hr", [attr]). | |
| 1627 | 1445 | |
| 1628 | 1446 | // <i> |
| 1629 | -public define HTML_Off_Form i(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("i", attrs, content). | |
| 1630 | -public define HTML_Off_Form i(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("i", attrs, [content]). | |
| 1631 | -public define HTML_Off_Form i(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("i", [attr], content). | |
| 1632 | -public define HTML_Off_Form i(CoreAttrs attr, HTML_Off_Form content) = html_tag("i", [attr], [content]). | |
| 1633 | -public define HTML_Off_Form i(List(HTML_Off_Form) content) = html_tag("i", [], content). | |
| 1634 | -public define HTML_Off_Form i(HTML_Off_Form content) = html_tag("i", [], [content]). | |
| 1635 | -public define HTML_Off_Form i(String string) = html_tag("i", [], [text(string)]). | |
| 1636 | -public define HTML_Off_Form i(CoreAttrs attr, String string) = html_tag("i", [attr], [text(string)]). | |
| 1637 | -public define HTML_Off_Form i(List(CoreAttrs) attrs, String string) = html_tag("i", attrs, [text(string)]). | |
| 1447 | +public define HTML i(List(CoreAttrs) attrs, List(HTML) content) = html_tag("i", attrs, content). | |
| 1448 | +public define HTML i(List(CoreAttrs) attrs, HTML content) = html_tag("i", attrs, [content]). | |
| 1449 | +public define HTML i(List(CoreAttrs) attrs) = html_tag("i", attrs). | |
| 1450 | +public define HTML i(CoreAttrs attr, List(HTML) content) = html_tag("i", [attr], content). | |
| 1451 | +public define HTML i(CoreAttrs attr, HTML content) = html_tag("i", [attr], [content]). | |
| 1452 | +public define HTML i(List(HTML) content) = html_tag("i", content). | |
| 1453 | +public define HTML i(HTML content) = html_tag("i", [content]). | |
| 1454 | +public define HTML i(String string) = html_tag("i", [text(string)]). | |
| 1455 | +public define HTML i(CoreAttrs attr, String string) = html_tag("i", [attr], [text(string)]). | |
| 1456 | +public define HTML i(List(CoreAttrs) attrs, String string) = html_tag("i", attrs, [text(string)]). | |
| 1638 | 1457 | |
| 1639 | 1458 | // <iframe> |
| 1640 | -public define HTML_Off_Form iframe(CoreAttrs _attr, String src, Int width, Int height) = | |
| 1641 | - html_tag("iframe", [_attr, attr("src",src), width_px(width), height_px(height)], []). | |
| 1642 | -public define HTML_Off_Form iframe(String src, Int width, Int height) = | |
| 1643 | - html_tag("iframe", [attr("src",src), width_px(width), height_px(height)], []). | |
| 1644 | -public define HTML_Off_Form iframe(String src) = html_tag("iframe", [attr("src",src)], []). | |
| 1459 | +public define HTML iframe(CoreAttrs _attr, String src, Int width, Int height) = | |
| 1460 | + html_tag("iframe", [_attr, attr("src",src), width_px(width), height_px(height)]). | |
| 1461 | +public define HTML iframe(String src, Int width, Int height) = | |
| 1462 | + html_tag("iframe", [attr("src",src), width_px(width), height_px(height)]). | |
| 1463 | +public define HTML iframe(String src) = html_tag("iframe", [attr("src",src)]). | |
| 1645 | 1464 | |
| 1646 | 1465 | // <input> |
| 1647 | -public define HTML_Off_Form input(List(CoreAttrs) attrs) = html_void_tag("input", attrs). | |
| 1648 | -public define HTML_Off_Form input(CoreAttrs attr) = html_void_tag("input", [attr]). | |
| 1466 | +public define HTML input(List(CoreAttrs) attrs) = html_void_tag("input", attrs). | |
| 1467 | +public define HTML input(CoreAttrs attr) = html_void_tag("input", [attr]). | |
| 1649 | 1468 | |
| 1650 | 1469 | public define CoreAttrs type(Input_Type value)= attr("type", to_String(value)). |
| 1651 | 1470 | public define CoreAttrs type(String value)= attr("type", value). |
| ... | ... | @@ -1653,359 +1472,484 @@ public define CoreAttrs name(String value)= attr("name", value). |
| 1653 | 1472 | public define CoreAttrs value(String value)= attr("value", value). |
| 1654 | 1473 | public define CoreAttrs placeholder(String value) = attr("placeholder", value). |
| 1655 | 1474 | public define CoreAttrs init(String value)= attr("value", encode_HTML_entities(value)). |
| 1475 | + | |
| 1656 | 1476 | //-- BEGIN of <input> preset type |
| 1657 | - | |
| 1477 | + | |
| 1478 | + /// hidden value | |
| 1479 | +public define HTML hidden(List(CoreAttrs) attrs, String _name, String _value, String form) = input([type(hidden), name(_name), value(encode_HTML_entities(_value)), attr("form", form) . attrs]). | |
| 1480 | +public define HTML hidden(CoreAttrs attr, String name, String value, String form) = hidden([attr], name, value, form). | |
| 1481 | +public define HTML hidden(String name, String value, String form) = hidden([], name, value, form). | |
| 1482 | +public define HTML hidden(String _name, String _value) = input([type(hidden), name(_name), value(encode_HTML_entities(_value))]). | |
| 1483 | + | |
| 1484 | +public define HTML text_input(List(CoreAttrs) options, HTML_Label label, HTML_Id _id, WebArgName wan, InitialValue init, Int w) = | |
| 1485 | + sequence([ | |
| 1486 | + format_label(label, _id), | |
| 1487 | + input([class("in"), type(text), id(_id.id), name(wan.name), size(w), value(encode_HTML_entities(init.value)). options]) | |
| 1488 | + ]). | |
| 1489 | + | |
| 1490 | +public define HTML text_input(HTML_Label label, HTML_Id _id, WebArgName wan, InitialValue init, Int _width) = | |
| 1491 | + sequence([ | |
| 1492 | + format_label(label, _id), | |
| 1493 | + input([class("in"), type(text), id(_id.id), name(wan.name), size(_width), value(encode_HTML_entities(init.value))]) | |
| 1494 | + ]). | |
| 1495 | + | |
| 1496 | + | |
| 1497 | +// text_input_ro(options, label_text, id, name, init, w) then | |
| 1498 | +// [ format_label(label_text, id), | |
| 1499 | +// "<input readonly=\"readonly\" type=\"text\" name=\"",name,"\" id=\"",id,"\" size=\"",w,"\" value=\"",encode_HTML_entities(init.value),"\"",format_attrs([class("in") . options])," />"], | |
| 1500 | + | |
| 1501 | +public define HTML text_input_ro(List(CoreAttrs) options, HTML_Label label, HTML_Id _id, WebArgName wan, InitialValue init, Int w) = | |
| 1502 | + sequence([ | |
| 1503 | + format_label(label, _id), | |
| 1504 | + input([class("in"), boolean("readonly"), type(text), id(_id.id), name(wan.name), size(w), value(encode_HTML_entities(init.value)). options]) | |
| 1505 | + ]). | |
| 1506 | + | |
| 1507 | +public define HTML password_input(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, InitialValue init, Int w) = | |
| 1508 | + sequence([ | |
| 1509 | + format_label(label, _id), | |
| 1510 | + input([class("in"), type(password), id(_id.id), name(wan.name), size(w), value(encode_HTML_entities(init.value)). attrs]) | |
| 1511 | + ]). | |
| 1512 | + | |
| 1513 | + | |
| 1658 | 1514 | /// Checkbox |
| 1659 | -public define HTML_Off_Form checkbox(List(CoreAttrs) attrs, String name, String form, Bool checked) = input([type("checkbox"), attr("name",name), attr("form", form), bool_attr(checked, "checked") . attrs]). | |
| 1660 | -public define HTML_Off_Form checkbox(List(CoreAttrs) attrs, String name, Bool checked) = input([type("checkbox"), attr("name",name), bool_attr(checked, "checked") . attrs]). | |
| 1661 | -public define HTML_Off_Form checkbox(String name, String form, Bool checked) = checkbox([], name, form, checked). | |
| 1662 | -public define HTML_Off_Form checkbox(String name, Bool checked) = checkbox([], name, checked). | |
| 1515 | + | |
| 1516 | +public define HTML checkbox(List(CoreAttrs) attrs) = input([type(checkbox) . attrs]). | |
| 1517 | +public define HTML checkbox(List(CoreAttrs) attrs, String _name, String _form, Bool checked) = input([type(checkbox), name(_name), form(_form), bool_attr(checked, "checked") . attrs]). | |
| 1518 | +public define HTML checkbox(List(CoreAttrs) attrs, String _name, Bool checked) = input([type(checkbox), name(_name), bool_attr(checked, "checked") . attrs]). | |
| 1519 | +public define HTML checkbox(String name, String form, Bool checked) = checkbox([], name, form, checked). | |
| 1520 | +public define HTML checkbox(String name, Bool checked) = checkbox([], name, checked). | |
| 1521 | + | |
| 1522 | +public define HTML check_box(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, Bool checked) = | |
| 1523 | + sequence([ | |
| 1524 | + format_label(label, _id), | |
| 1525 | + hidden("~"+wan.name, "~true"), | |
| 1526 | + input([type(checkbox), name(wan.name), id(_id.id), value("true"), bool_attr(checked, "checked"), class("in") . attrs]) | |
| 1527 | + ]) | |
| 1528 | +. | |
| 1529 | + | |
| 1530 | +public define HTML check_box(List(CoreAttrs) attrs, HTML_Label label, WebArgName wan, Bool checked) | |
| 1531 | + = check_box (attrs, label, html_Id(wan.name), wan, checked). | |
| 1532 | + | |
| 1533 | +public define HTML check_box_r(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, Bool checked) = | |
| 1534 | + sequence([ | |
| 1535 | + input([type(checkbox), name(wan.name), id(_id.id), value("true"), bool_attr(checked, "checked"), class("in") . attrs]), | |
| 1536 | + format_label(label, _id), | |
| 1537 | + hidden("~"+wan.name, "~true"), | |
| 1538 | + ]) | |
| 1539 | +. | |
| 1540 | +public define HTML check_box_r(List(CoreAttrs) attrs, HTML_Label label, WebArgName wan, Bool checked) | |
| 1541 | + = check_box_r (attrs, label, html_Id(wan.name), wan, checked). | |
| 1542 | + | |
| 1543 | +public define HTML file_upload(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, Int width)= | |
| 1544 | + sequence([ | |
| 1545 | + format_label(label, _id), | |
| 1546 | + input([type(file), id(_id.id), size(width), name(wan.name), class("in") . attrs]) | |
| 1547 | + ]) | |
| 1548 | +. | |
| 1663 | 1549 | |
| 1550 | +public define HTML file_upload(WebArgName n, Int width)= file_upload([], no_label, html_Id(n.name), n, width). | |
| 1551 | + | |
| 1664 | 1552 | /// Radio button |
| 1665 | -public define HTML_Off_Form radio(List(CoreAttrs) attrs, String name, String value, String form, Bool checked) = input([type("radio"), attr("name",name), attr("value",value), attr("form", form), bool_attr(checked, "checked") . attrs]). | |
| 1666 | -public define HTML_Off_Form radio(List(CoreAttrs) attrs, String name, String value, String form) = radio(attrs, name, value, form, false). | |
| 1667 | -public define HTML_Off_Form radio(String name, String value, String form, Bool checked) = radio([], name, value, form, checked). | |
| 1668 | -public define HTML_Off_Form radio(String name, String value, String form) = radio([], name, value, form, false). | |
| 1553 | +public define HTML radio(List(CoreAttrs) attrs, String _name, String _value, String _form, Bool checked) = input([type(radio), name(_name), value(_value), form(_form), bool_attr(checked, "checked") . attrs]). | |
| 1554 | +public define HTML radio(List(CoreAttrs) attrs, String name, String value, String form) = radio(attrs, name, value, form, false). | |
| 1555 | +public define HTML radio(String name, String value, String form, Bool checked) = radio([], name, value, form, checked). | |
| 1556 | +public define HTML radio(String name, String value, String form) = radio([], name, value, form, false). | |
| 1557 | +public define HTML radio(String _name, String _value) = input([type(radio), name(_name), value(_value)]). | |
| 1558 | + | |
| 1559 | +public define HTML radio_button(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, WebArgValue _value, Bool checked) = | |
| 1560 | + sequence([ | |
| 1561 | + format_label(label, _id), | |
| 1562 | + input([type(radio), name(wan.name), id(_id.id), value(_value.value), bool_attr(checked, "checked"), class("in") . attrs]) | |
| 1563 | + ]) | |
| 1564 | +. | |
| 1669 | 1565 | |
| 1670 | - /// hidden value | |
| 1671 | -public define HTML_Off_Form hidden(List(CoreAttrs) attrs, String name, String value, String form) = input([type("hidden"), attr("name",name), attr("value",value), attr("form", form) . attrs]). | |
| 1672 | -public define HTML_Off_Form hidden(CoreAttrs attr, String name, String value, String form) = hidden([attr], name, value, form). | |
| 1673 | -public define HTML_Off_Form hidden(String name, String value, String form) = hidden([], name, value, form). | |
| 1674 | -public define HTML_Off_Form hidden(String _name, String _value) = input([type("hidden"), name(_name), value(_value)]). | |
| 1566 | +public define HTML radio_button(List(CoreAttrs) attrs, HTML_Label label, WebArgName wan, WebArgValue value, Bool checked) | |
| 1567 | + = radio_button (attrs, label, html_Id(wan.name), wan, value, checked). | |
| 1568 | + | |
| 1569 | + | |
| 1570 | +public define HTML radio_button_r(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, WebArgValue _value, Bool checked) = | |
| 1571 | + sequence([ | |
| 1572 | + input([type(radio), name(wan.name), id(_id.id), value(_value.value), bool_attr(checked, "checked"), class("in") . attrs]), | |
| 1573 | + format_label(label, _id) | |
| 1574 | + ]) | |
| 1575 | +. | |
| 1675 | 1576 | |
| 1577 | +public define HTML radio_button_r(List(CoreAttrs) attrs, HTML_Label label, WebArgName wan, WebArgValue value, Bool checked) | |
| 1578 | + = radio_button_r(attrs, label, html_Id(wan.name), wan, value, checked). | |
| 1579 | + | |
| 1676 | 1580 | //-- END of <input> preset type |
| 1677 | 1581 | |
| 1678 | 1582 | // <img> |
| 1679 | -public define HTML_Off_Form img(List(CoreAttrs) attrs, String src, String alt) = html_void_tag("img", attrs + [attr("src",src), attr("alt",alt)] ). | |
| 1680 | -public define HTML_Off_Form img(CoreAttrs _attr, String src, String alt) = html_void_tag("img", [_attr, attr("src",src), attr("alt",alt)] ). | |
| 1681 | -public define HTML_Off_Form img(String src) = img([], src, ""). | |
| 1682 | -public define HTML_Off_Form img(String src, String alt) = img([], src, alt). | |
| 1683 | -public define HTML_Off_Form img(List(CoreAttrs) attrs, String src) = img(attrs, src, ""). | |
| 1684 | -public define HTML_Off_Form img(CoreAttrs attr, String src) = img([attr], src, ""). | |
| 1685 | -public define HTML_Off_Form img(String src, Int width, Int height) = img([attr("width",to_String(width)+"px"), attr("height",to_String(height)+"px")], src, src). | |
| 1686 | -public define HTML_Off_Form img(String src, String alt, Int width, Int height) = | |
| 1583 | +public define HTML img(List(CoreAttrs) attrs, String src, String alt) = html_void_tag("img", attrs + [attr("src",src), attr("alt",alt)] ). | |
| 1584 | +public define HTML img(CoreAttrs _attr, String src, String alt) = html_void_tag("img", [_attr, attr("src",src), attr("alt",alt)] ). | |
| 1585 | +public define HTML img(String src) = img([], src, ""). | |
| 1586 | +public define HTML img(String src, String alt) = img([], src, alt). | |
| 1587 | +public define HTML img(List(CoreAttrs) attrs, String src) = img(attrs, src, ""). | |
| 1588 | +public define HTML img(CoreAttrs attr, String src) = img([attr], src, ""). | |
| 1589 | +public define HTML img(String src, Int width, Int height) = img([attr("width",to_String(width)+"px"), attr("height",to_String(height)+"px")], src, src). | |
| 1590 | +public define HTML img(String src, String alt, Int width, Int height) = | |
| 1687 | 1591 | html_void_tag("img", [attr("src",src), attr("alt",alt), attr("width",to_String(width)+"px"), attr("height",to_String(height)+"px")]). |
| 1688 | 1592 | |
| 1689 | -public define HTML_Off_Form img(List(CoreAttrs) attrs, String src, String alt, Int width, Int height) = | |
| 1593 | +public define HTML img(List(CoreAttrs) attrs, String src, String alt, Int width, Int height) = | |
| 1690 | 1594 | html_void_tag("img", attrs + [attr("src",src), attr("alt",alt), attr("width",to_String(width)+"px"), attr("height",to_String(height)+"px")]). |
| 1691 | 1595 | |
| 1692 | -public define HTML_Off_Form img(CoreAttrs _attr, String src, String alt, Int width, Int height) = | |
| 1596 | +public define HTML img(CoreAttrs _attr, String src, String alt, Int width, Int height) = | |
| 1693 | 1597 | html_void_tag("img", [_attr, attr("src",src), attr("alt",alt), width_px(width), height_px(height)]). |
| 1694 | 1598 | |
| 1695 | 1599 | // <label> |
| 1696 | -public define HTML_Off_Form label(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("label", attrs, content). | |
| 1697 | -public define HTML_Off_Form label(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("label", [attr], content). | |
| 1698 | -public define HTML_Off_Form label(List(HTML_Off_Form) content) = html_tag("label", [], content). | |
| 1699 | -public define HTML_Off_Form label(HTML_Off_Form content) = html_tag("label", [], [content]). | |
| 1700 | -public define HTML_Off_Form label(String string) = html_tag("label", [], [text(string)]). | |
| 1701 | -public define HTML_Off_Form label(CoreAttrs attr, String string) = html_tag("label", [attr], [text(string)]). | |
| 1702 | -public define HTML_Off_Form label(List(CoreAttrs) attrs, String string) = html_tag("label", attrs, [text(string)]). | |
| 1600 | +public define HTML label(List(CoreAttrs) attrs, List(HTML) content) = html_tag("label", attrs, content). | |
| 1601 | +public define HTML label(CoreAttrs attr, List(HTML) content) = html_tag("label", [attr], content). | |
| 1602 | +public define HTML label(List(HTML) content) = html_tag("label", content). | |
| 1603 | +public define HTML label(HTML content) = html_tag("label", [content]). | |
| 1604 | +public define HTML label(String string) = html_tag("label", [text(string)]). | |
| 1605 | +public define HTML label(CoreAttrs attr, String string) = html_tag("label", [attr], [text(string)]). | |
| 1606 | +public define HTML label(List(CoreAttrs) attrs, String string) = html_tag("label", attrs, [text(string)]). | |
| 1607 | + | |
| 1608 | + // <legend> | |
| 1609 | +public define HTML legend(List(CoreAttrs) attrs, List(HTML) content) = html_tag("legend", attrs, content). | |
| 1610 | +public define HTML legend(List(CoreAttrs) attrs, HTML content) = html_tag("legend", attrs, [content]). | |
| 1611 | +public define HTML legend(CoreAttrs attr, List(HTML) content) = html_tag("legend", [attr], content). | |
| 1612 | +public define HTML legend(CoreAttrs attr, HTML content) = html_tag("legend", [attr], [content]). | |
| 1613 | +public define HTML legend(List(HTML) content) = html_tag("legend", content). | |
| 1614 | +public define HTML legend(HTML content) = html_tag("legend", [content]). | |
| 1615 | +public define HTML legend(String content) = html_tag("legend", [text(content)]). | |
| 1703 | 1616 | |
| 1704 | 1617 | // <li> |
| 1705 | -public define HTML_Off_Form li(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("li", attrs, content). | |
| 1706 | -public define HTML_Off_Form li(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("li", attrs, [content]). | |
| 1707 | -public define HTML_Off_Form li(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("li", [attr], content). | |
| 1708 | -public define HTML_Off_Form li(CoreAttrs attr, HTML_Off_Form content) = html_tag("li", [attr], [content]). | |
| 1709 | -public define HTML_Off_Form li(List(HTML_Off_Form) content) = html_tag("li", [], content). | |
| 1710 | -public define HTML_Off_Form li(HTML_Off_Form content) = html_tag("li", [], [content]). | |
| 1711 | -public define HTML_Off_Form li(String string) = html_tag("li", [], [text(string)]). | |
| 1712 | -public define HTML_Off_Form li(CoreAttrs attr, String string) = html_tag("li", [attr], [text(string)]). | |
| 1713 | -public define HTML_Off_Form li(List(CoreAttrs) attrs, String string) = html_tag("li", attrs, [text(string)]). | |
| 1618 | +public define HTML li(List(CoreAttrs) attrs, List(HTML) content) = html_tag("li", attrs, content). | |
| 1619 | +public define HTML li(List(CoreAttrs) attrs, HTML content) = html_tag("li", attrs, [content]). | |
| 1620 | +public define HTML li(CoreAttrs attr, List(HTML) content) = html_tag("li", [attr], content). | |
| 1621 | +public define HTML li(CoreAttrs attr, HTML content) = html_tag("li", [attr], [content]). | |
| 1622 | +public define HTML li(List(HTML) content) = html_tag("li", content). | |
| 1623 | +public define HTML li(HTML content) = html_tag("li", [content]). | |
| 1624 | +public define HTML li(String string) = html_tag("li", [text(string)]). | |
| 1625 | +public define HTML li(CoreAttrs attr, String string) = html_tag("li", [attr], [text(string)]). | |
| 1626 | +public define HTML li(List(CoreAttrs) attrs, String string) = html_tag("li", attrs, [text(string)]). | |
| 1714 | 1627 | |
| 1715 | 1628 | // <main> |
| 1716 | -public define HTML_Off_Form main(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("main", attrs, content). | |
| 1717 | -public define HTML_Off_Form main(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("main", attrs, [content]). | |
| 1718 | -public define HTML_Off_Form main(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("main", [attr], content). | |
| 1719 | -public define HTML_Off_Form main(CoreAttrs attr, HTML_Off_Form content) = html_tag("main", [attr], [content]). | |
| 1720 | -public define HTML_Off_Form main(List(HTML_Off_Form) content) = html_tag("main", [], content). | |
| 1721 | -public define HTML_Off_Form main(HTML_Off_Form content) = html_tag("main", [], [content]). | |
| 1629 | +public define HTML main(List(CoreAttrs) attrs, List(HTML) content) = html_tag("main", attrs, content). | |
| 1630 | +public define HTML main(List(CoreAttrs) attrs, HTML content) = html_tag("main", attrs, [content]). | |
| 1631 | +public define HTML main(CoreAttrs attr, List(HTML) content) = html_tag("main", [attr], content). | |
| 1632 | +public define HTML main(CoreAttrs attr, HTML content) = html_tag("main", [attr], [content]). | |
| 1633 | +public define HTML main(List(HTML) content) = html_tag("main", content). | |
| 1634 | +public define HTML main(HTML content) = html_tag("main", [content]). | |
| 1722 | 1635 | |
| 1723 | 1636 | // <nav> |
| 1724 | -public define HTML_Off_Form nav(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("nav", attrs, content). | |
| 1725 | -public define HTML_Off_Form nav(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("nav", attrs, [content]). | |
| 1726 | -public define HTML_Off_Form nav(List(HTML_Off_Form) content) = html_tag("nav", [], content). | |
| 1727 | -public define HTML_Off_Form nav(HTML_Off_Form content) = html_tag("nav", [], [content]). | |
| 1637 | +public define HTML nav(List(CoreAttrs) attrs, List(HTML) content) = html_tag("nav", attrs, content). | |
| 1638 | +public define HTML nav(List(CoreAttrs) attrs, HTML content) = html_tag("nav", attrs, [content]). | |
| 1639 | +public define HTML nav(CoreAttrs attr, List(HTML) content) = html_tag("nav", [attr], content). | |
| 1640 | +public define HTML nav(CoreAttrs attr, HTML content) = html_tag("nav", [attr], [content]). | |
| 1641 | +public define HTML nav(List(HTML) content) = html_tag("nav", content). | |
| 1642 | +public define HTML nav(HTML content) = html_tag("nav", [content]). | |
| 1728 | 1643 | |
| 1729 | 1644 | // <ol> |
| 1730 | -public define HTML_Off_Form ol(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("ol", attrs, content). | |
| 1731 | -public define HTML_Off_Form ol(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("ol", attrs, [content]). | |
| 1732 | -public define HTML_Off_Form ol(List(HTML_Off_Form) content) = html_tag("ol", [], content). | |
| 1733 | -public define HTML_Off_Form ol(HTML_Off_Form content) = html_tag("ol", [], [content]). | |
| 1645 | +public define HTML ol(List(CoreAttrs) attrs, List(HTML) content) = html_tag("ol", attrs, content). | |
| 1646 | +public define HTML ol(List(CoreAttrs) attrs, HTML content) = html_tag("ol", attrs, [content]). | |
| 1647 | +public define HTML ol(List(HTML) content) = html_tag("ol", content). | |
| 1648 | +public define HTML ol(HTML content) = html_tag("ol", [content]). | |
| 1734 | 1649 | |
| 1735 | 1650 | // <option> |
| 1736 | -public define HTML_Off_Form option(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("option", attrs, content). | |
| 1737 | -public define HTML_Off_Form option(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("option", attrs, [content]). | |
| 1738 | -public define HTML_Off_Form option(List(HTML_Off_Form) content) = html_tag("option", [], content). | |
| 1739 | -public define HTML_Off_Form option(CoreAttrs attr, HTML_Off_Form content) = html_tag("option", [attr], [content]). | |
| 1740 | -public define HTML_Off_Form option(HTML_Off_Form content) = html_tag("option", [], [content]). | |
| 1741 | -public define HTML_Off_Form option(String _value, String _text) = html_tag("option", [value(_value)], [text(_text)]). | |
| 1651 | +public define HTML option(List(CoreAttrs) attrs, List(HTML) content) = html_tag("option", attrs, content). | |
| 1652 | +public define HTML option(List(CoreAttrs) attrs, HTML content) = html_tag("option", attrs, [content]). | |
| 1653 | +public define HTML option(List(HTML) content) = html_tag("option", content). | |
| 1654 | +public define HTML option(CoreAttrs attr, HTML content) = html_tag("option", [attr], [content]). | |
| 1655 | +public define HTML option(HTML content) = html_tag("option", [content]). | |
| 1656 | +public define HTML option(String _value, String _text) = html_tag("option", [value(_value)], [text(_text)]). | |
| 1657 | + | |
| 1742 | 1658 | // <p> |
| 1743 | -public define HTML_Off_Form p(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("p", attrs, content). | |
| 1744 | -public define HTML_Off_Form p(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("p", attrs, [content]). | |
| 1745 | -public define HTML_Off_Form p(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("p", [attr], content). | |
| 1746 | -public define HTML_Off_Form p(CoreAttrs attr, HTML_Off_Form content) = html_tag("p", [attr], [content]). | |
| 1747 | -public define HTML_Off_Form p(CoreAttrs attr, String _text) = html_tag("p", [attr], [text(_text)]). | |
| 1748 | -public define HTML_Off_Form p(List(HTML_Off_Form) content) = html_tag("p", [], content). | |
| 1749 | -public define HTML_Off_Form p(HTML_Off_Form content) = html_tag("p", [], [content]). | |
| 1659 | +public define HTML p(List(CoreAttrs) attrs, List(HTML) content) = html_tag("p", attrs, content). | |
| 1660 | +public define HTML p(List(CoreAttrs) attrs, HTML content) = html_tag("p", attrs, [content]). | |
| 1661 | +public define HTML p(CoreAttrs attr, List(HTML) content) = html_tag("p", [attr], content). | |
| 1662 | +public define HTML p(CoreAttrs attr, HTML content) = html_tag("p", [attr], [content]). | |
| 1663 | +public define HTML p(CoreAttrs attr, String _text) = html_tag("p", [attr], [text(_text)]). | |
| 1664 | +public define HTML p(List(HTML) content) = html_tag("p", content). | |
| 1665 | +public define HTML p(HTML content) = html_tag("p", [content]). | |
| 1750 | 1666 | |
| 1751 | 1667 | // <pre> preformatted |
| 1752 | -public define HTML_Off_Form pre(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("pre", attrs, content). | |
| 1753 | -public define HTML_Off_Form pre(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("pre", attrs, [content]). | |
| 1754 | -public define HTML_Off_Form pre(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("pre", [attr], content). | |
| 1755 | -public define HTML_Off_Form pre(CoreAttrs attr, HTML_Off_Form content) = html_tag("pre", [attr], [content]). | |
| 1756 | -public define HTML_Off_Form pre(List(HTML_Off_Form) content) = html_tag("pre", [], content). | |
| 1757 | -public define HTML_Off_Form pre(HTML_Off_Form content) = html_tag("pre", [], [content]). | |
| 1758 | -public define HTML_Off_Form pre(String string) = html_tag("pre", [], [text(string)]). | |
| 1759 | -public define HTML_Off_Form pre(CoreAttrs attr, String string) = html_tag("pre", [attr], [text(string)]). | |
| 1760 | -public define HTML_Off_Form pre(List(CoreAttrs) attrs, String string) = html_tag("pre", attrs, [text(string)]). | |
| 1668 | +public define HTML pre(List(CoreAttrs) attrs, List(HTML) content) = html_tag("pre", attrs, content). | |
| 1669 | +public define HTML pre(List(CoreAttrs) attrs, HTML content) = html_tag("pre", attrs, [content]). | |
| 1670 | +public define HTML pre(CoreAttrs attr, List(HTML) content) = html_tag("pre", [attr], content). | |
| 1671 | +public define HTML pre(CoreAttrs attr, HTML content) = html_tag("pre", [attr], [content]). | |
| 1672 | +public define HTML pre(List(HTML) content) = html_tag("pre", content). | |
| 1673 | +public define HTML pre(HTML content) = html_tag("pre", [content]). | |
| 1674 | +public define HTML pre(String string) = html_tag("pre", [text(string)]). | |
| 1675 | +public define HTML pre(CoreAttrs attr, String string) = html_tag("pre", [attr], [text(string)]). | |
| 1676 | +public define HTML pre(List(CoreAttrs) attrs, String string) = html_tag("pre", attrs, [text(string)]). | |
| 1761 | 1677 | |
| 1762 | 1678 | // <progress> |
| 1763 | -public define HTML_Off_Form progress(List(CoreAttrs) attrs, Int value, Int max, List(HTML_Off_Form) content) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], content). | |
| 1764 | -public define HTML_Off_Form progress(List(CoreAttrs) attrs, Int value, Int max, HTML_Off_Form content) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], [content]). | |
| 1765 | -public define HTML_Off_Form progress(CoreAttrs _attr, Int value, Int max, HTML_Off_Form content) = html_tag("progress", [attr("value", value), attr("max", max) , _attr], [content]). | |
| 1766 | -public define HTML_Off_Form progress(Int value, Int max, HTML_Off_Form content) = html_tag("progress", [attr("value", value), attr("max", max)], [content]). | |
| 1767 | -public define HTML_Off_Form progress(List(CoreAttrs) attrs, Int value, Int max, String content) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], [text(content)]). | |
| 1768 | -public define HTML_Off_Form progress(CoreAttrs _attr, Int value, Int max, String content) = html_tag("progress", [attr("value", value), attr("max", max), _attr], [text(content)]). | |
| 1769 | -public define HTML_Off_Form progress(List(CoreAttrs) attrs, Int value, Int max) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], []). | |
| 1770 | -public define HTML_Off_Form progress(CoreAttrs _attr, Int value, Int max) = html_tag("progress", [attr("value", value), attr("max", max), _attr], []). | |
| 1771 | -public define HTML_Off_Form progress(Int value, Int max, String content) = html_tag("progress", [attr("value", value), attr("max", max)], [text(content)]). | |
| 1772 | -public define HTML_Off_Form progress(Int value, Int max) = html_tag("progress", [attr("value", value), attr("max", max)], []). | |
| 1679 | +public define HTML progress(List(CoreAttrs) attrs, Int value, Int max, List(HTML) content) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], content). | |
| 1680 | +public define HTML progress(List(CoreAttrs) attrs, Int value, Int max, HTML content) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], [content]). | |
| 1681 | +public define HTML progress(CoreAttrs _attr, Int value, Int max, HTML content) = html_tag("progress", [attr("value", value), attr("max", max) , _attr], [content]). | |
| 1682 | +public define HTML progress(Int value, Int max, HTML content) = html_tag("progress", [attr("value", value), attr("max", max)], [content]). | |
| 1683 | +public define HTML progress(List(CoreAttrs) attrs, Int value, Int max, String content) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], [text(content)]). | |
| 1684 | +public define HTML progress(CoreAttrs _attr, Int value, Int max, String content) = html_tag("progress", [attr("value", value), attr("max", max), _attr], [text(content)]). | |
| 1685 | +public define HTML progress(List(CoreAttrs) attrs, Int value, Int max) = html_tag("progress", [attr("value", value), attr("max", max) . attrs]). | |
| 1686 | +public define HTML progress(CoreAttrs _attr, Int value, Int max) = html_tag("progress", [attr("value", value), attr("max", max), _attr]). | |
| 1687 | +public define HTML progress(Int value, Int max, String content) = html_tag("progress", [attr("value", value), attr("max", max)], [text(content)]). | |
| 1688 | +public define HTML progress(Int value, Int max) = html_tag("progress", [attr("value", value), attr("max", max)]). | |
| 1773 | 1689 | |
| 1774 | 1690 | // <script> |
| 1775 | -public define HTML_Off_Form script(String file_name, List(JS_Attribute) attrs) = literal_pt(add_js_files([js_file(file_name, attrs)])). | |
| 1776 | -public define HTML_Off_Form script(String content) = literal_pt(add_script([script("text/javascript", content)])). | |
| 1691 | +public define HTML script(String file_name, List(JS_Attribute) attrs) = literal_pt(add_js_files([js_file(file_name, attrs)])). | |
| 1692 | +public define HTML script(String content) = literal_pt(add_script([script("text/javascript", content)])). | |
| 1777 | 1693 | |
| 1778 | 1694 | // <section> |
| 1779 | -public define HTML_Off_Form section(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("section", attrs, content). | |
| 1780 | -public define HTML_Off_Form section(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("section", attrs, [content]). | |
| 1781 | -public define HTML_Off_Form section(List(HTML_Off_Form) content) = html_tag("section", [], content). | |
| 1782 | -public define HTML_Off_Form section(HTML_Off_Form content) = html_tag("section", [], [content]). | |
| 1695 | +public define HTML section(List(CoreAttrs) attrs, List(HTML) content) = html_tag("section", attrs, content). | |
| 1696 | +public define HTML section(List(CoreAttrs) attrs, HTML content) = html_tag("section", attrs, [content]). | |
| 1697 | +public define HTML section(List(HTML) content) = html_tag("section", content). | |
| 1698 | +public define HTML section(HTML content) = html_tag("section", [content]). | |
| 1783 | 1699 | |
| 1784 | 1700 | // <select> |
| 1785 | -public define HTML_Off_Form select(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("select", attrs, content). | |
| 1786 | -public define HTML_Off_Form select(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("select", attrs, [content]). | |
| 1787 | -public define HTML_Off_Form select(List(CoreAttrs) attrs) = html_tag("select", attrs, []). | |
| 1788 | -public define HTML_Off_Form select(List(HTML_Off_Form) content) = html_tag("select", [], content). | |
| 1789 | -public define HTML_Off_Form select(HTML_Off_Form content) = html_tag("select", [], [content]). | |
| 1701 | +public define HTML select(List(CoreAttrs) attrs, List(HTML) content) = html_tag("select", attrs, content). | |
| 1702 | +public define HTML select(List(CoreAttrs) attrs, HTML content) = html_tag("select", attrs, [content]). | |
| 1703 | +public define HTML select(List(CoreAttrs) attrs) = html_tag("select", attrs). | |
| 1704 | +public define HTML select(List(HTML) content) = html_tag("select", content). | |
| 1705 | +public define HTML select(HTML content) = html_tag("select", [content]). | |
| 1706 | + | |
| 1707 | + //selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices), | |
| 1708 | +public define HTML selector(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, Int s, List(String) choices)= | |
| 1709 | + sequence([ | |
| 1710 | + format_label(label, _id), | |
| 1711 | + select([id(_id.id), name(wan.name), size(s) , class("in") . attrs], literal_pt(format_choices(choices))) | |
| 1712 | + ]) | |
| 1713 | +. | |
| 1714 | + | |
| 1715 | + //selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices, InitialValue selected), | |
| 1716 | +public define HTML selector(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, Int s, List(String) choices , InitialValue selected)= | |
| 1717 | + sequence([ | |
| 1718 | + format_label(label, _id), | |
| 1719 | + select([id(_id.id), name(wan.name), size(s) , class("in") . attrs], literal_pt(format_choices(choices, selected))) | |
| 1720 | + ]) | |
| 1721 | +. | |
| 1790 | 1722 | |
| 1723 | + //selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices), | |
| 1724 | + | |
| 1725 | +public define HTML selector_c(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, Int s, List((List(CoreAttrs),WebArgValue,String)) choices)= | |
| 1726 | + sequence([ | |
| 1727 | + format_label(label, _id), | |
| 1728 | + select([id(_id.id), name(wan.name), size(s) , class("in") . attrs], literal_pt(format_choices(choices))) | |
| 1729 | + ]) | |
| 1730 | +. | |
| 1731 | + | |
| 1732 | + //selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, InitialValue selected), | |
| 1733 | +public define HTML selector_c(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, Int s, List((List(CoreAttrs),WebArgValue,String)) choices, InitialValue selected)= | |
| 1734 | + sequence([ | |
| 1735 | + format_label(label, _id), | |
| 1736 | + select([id(_id.id), name(wan.name), size(s) , class("in") . attrs], literal_pt(format_choices(choices, selected))) | |
| 1737 | + ]) | |
| 1738 | +. | |
| 1791 | 1739 | |
| 1792 | 1740 | // <span> |
| 1793 | -public define HTML_Off_Form span(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("span", attrs, content). | |
| 1794 | -public define HTML_Off_Form span(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("span", attrs, [content]). | |
| 1795 | -public define HTML_Off_Form span(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("span", [attr], content). | |
| 1796 | -public define HTML_Off_Form span(CoreAttrs attr, HTML_Off_Form content) = html_tag("span", [attr], [content]). | |
| 1797 | -public define HTML_Off_Form span(List(HTML_Off_Form) content) = html_tag("span", [], content). | |
| 1798 | -public define HTML_Off_Form span(HTML_Off_Form content) = html_tag("span", [], [content]). | |
| 1799 | -public define HTML_Off_Form span(Int i) = html_tag("span", [], [text(to_decimal(i))]). | |
| 1800 | -public define HTML_Off_Form span(List(CoreAttrs) attrs, String s) = html_tag("span", attrs, [text(s)]). | |
| 1801 | -public define HTML_Off_Form span(CoreAttrs attr, String s) = html_tag("span", [attr],[text(s)]). | |
| 1802 | -public define HTML_Off_Form span(String s) = html_tag("span", [], [text(s)]). | |
| 1803 | -public define HTML_Off_Form span(List(CoreAttrs) attrs) = html_tag("span", attrs, []). | |
| 1804 | -public define HTML_Off_Form span(CoreAttrs attr) = html_tag("span", [attr],[]). | |
| 1741 | +public define HTML span(List(CoreAttrs) attrs, List(HTML) content) = html_tag("span", attrs, content). | |
| 1742 | +public define HTML span(List(CoreAttrs) attrs, HTML content) = html_tag("span", attrs, [content]). | |
| 1743 | +public define HTML span(CoreAttrs attr, List(HTML) content) = html_tag("span", [attr], content). | |
| 1744 | +public define HTML span(CoreAttrs attr, HTML content) = html_tag("span", [attr], [content]). | |
| 1745 | +public define HTML span(List(HTML) content) = html_tag("span", content). | |
| 1746 | +public define HTML span(HTML content) = html_tag("span", [content]). | |
| 1747 | +public define HTML span(Int i) = html_tag("span", [text(to_decimal(i))]). | |
| 1748 | +public define HTML span(List(CoreAttrs) attrs, String s) = html_tag("span", attrs, [text(s)]). | |
| 1749 | +public define HTML span(CoreAttrs attr, String s) = html_tag("span", [attr],[text(s)]). | |
| 1750 | +public define HTML span(String s) = html_tag("span", [text(s)]). | |
| 1751 | +public define HTML span(List(CoreAttrs) attrs) = html_tag("span", attrs). | |
| 1752 | +public define HTML span(CoreAttrs attr) = html_tag("span", [attr]). | |
| 1805 | 1753 | |
| 1806 | 1754 | // <strong> |
| 1807 | -public define HTML_Off_Form strong(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("strong", attrs, content). | |
| 1808 | -public define HTML_Off_Form strong(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("strong", attrs, [content]). | |
| 1809 | -public define HTML_Off_Form strong(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("strong", [attr], content). | |
| 1810 | -public define HTML_Off_Form strong(CoreAttrs attr, HTML_Off_Form content) = html_tag("strong", [attr], [content]). | |
| 1811 | -public define HTML_Off_Form strong(List(HTML_Off_Form) content) = html_tag("strong", [], content). | |
| 1812 | -public define HTML_Off_Form strong(HTML_Off_Form content) = html_tag("strong", [], [content]). | |
| 1755 | +public define HTML strong(List(CoreAttrs) attrs, List(HTML) content) = html_tag("strong", attrs, content). | |
| 1756 | +public define HTML strong(List(CoreAttrs) attrs, HTML content) = html_tag("strong", attrs, [content]). | |
| 1757 | +public define HTML strong(CoreAttrs attr, List(HTML) content) = html_tag("strong", [attr], content). | |
| 1758 | +public define HTML strong(CoreAttrs attr, HTML content) = html_tag("strong", [attr], [content]). | |
| 1759 | +public define HTML strong(List(HTML) content) = html_tag("strong", content). | |
| 1760 | +public define HTML strong(HTML content) = html_tag("strong", [content]). | |
| 1813 | 1761 | |
| 1814 | 1762 | // <svg> |
| 1815 | -public define HTML_Off_Form svg(List(CoreAttrs) attrs) = html_tag("svg", attrs, []). | |
| 1763 | +public define HTML svg(List(CoreAttrs) attrs) = html_tag("svg", attrs). | |
| 1816 | 1764 | |
| 1817 | 1765 | |
| 1818 | 1766 | // <table> |
| 1819 | -public define HTML_Off_Form table(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("table", attrs, content). | |
| 1820 | -public define HTML_Off_Form table(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("table", attrs, [content]). | |
| 1821 | -public define HTML_Off_Form table(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("table", [attr], content). | |
| 1822 | -public define HTML_Off_Form table(CoreAttrs attr, HTML_Off_Form content) = html_tag("table", [attr], [content]). | |
| 1823 | -public define HTML_Off_Form table(List(HTML_Off_Form) content) = html_tag("table", [], content). | |
| 1824 | -public define HTML_Off_Form table(HTML_Off_Form content) = html_tag("table", [], [content]). | |
| 1767 | +public define HTML table(List(CoreAttrs) attrs, List(HTML) content) = html_tag("table", attrs, content). | |
| 1768 | +public define HTML table(List(CoreAttrs) attrs, HTML content) = html_tag("table", attrs, [content]). | |
| 1769 | +public define HTML table(CoreAttrs attr, List(HTML) content) = html_tag("table", [attr], content). | |
| 1770 | +public define HTML table(CoreAttrs attr, HTML content) = html_tag("table", [attr], [content]). | |
| 1771 | +public define HTML table(List(HTML) content) = html_tag("table", content). | |
| 1772 | +public define HTML table(HTML content) = html_tag("table", [content]). | |
| 1773 | + | |
| 1774 | + // <textarea> | |
| 1775 | + // CoreAttrs for textarea | |
| 1776 | +public define CoreAttrs wrap_lines = attr("wrap", "hard"). | |
| 1777 | +public define CoreAttrs read_only = bool_attr(true, "readonly"). | |
| 1778 | +public define CoreAttrs cols(Int value) = attr("cols",to_String(value)). | |
| 1779 | +public define CoreAttrs rows(Int value) = attr("rows",to_String(value)). | |
| 1780 | + | |
| 1781 | +public define HTML textarea(List(CoreAttrs) attrs, List(HTML) content) = html_tag("textarea", attrs, content). | |
| 1782 | +public define HTML textarea(List(CoreAttrs) attrs, HTML content) = html_tag("textarea", attrs, [content]). | |
| 1783 | + | |
| 1784 | +public define HTML textarea(List(CoreAttrs) attrs, Int _cols, Int _rows, List(HTML) content) | |
| 1785 | + = html_tag("textarea", [cols(_cols), rows(_rows) . attrs], content). | |
| 1786 | + | |
| 1787 | +public define HTML textarea(List(CoreAttrs) attrs, Int _cols, Int _rows, HTML content) | |
| 1788 | + = html_tag("textarea", [cols(_cols), rows(_rows) . attrs], [content]). | |
| 1789 | + | |
| 1790 | +public define HTML textarea(Int _cols, Int _rows, HTML content) = html_tag("textarea", [cols(_cols), rows(_rows)], [content]). | |
| 1791 | +public define HTML textarea(CoreAttrs attr, List(HTML) content) = html_tag("textarea", [attr], content). | |
| 1792 | +public define HTML textarea(CoreAttrs attr, HTML content) = html_tag("textarea", [attr], [content]). | |
| 1793 | + | |
| 1794 | +//public define HTML password_input(List(CoreAttrs) options, HTML_Label label, HTML_Id _id, WebArgName wan, InitialValue init, Int w) = | |
| 1795 | +public define HTML text_area(List(CoreAttrs) options, HTML_Label label, HTML_Id _id, WebArgName wan, InitialValue init, Int width, Int height) = | |
| 1796 | + sequence([ | |
| 1797 | + format_label(label, _id), | |
| 1798 | + textarea([class("in"), type(password), id(_id.id), name(wan.name), cols(width), rows(height) . options], text(init.value)) | |
| 1799 | + ]) | |
| 1800 | +. | |
| 1801 | + | |
| 1802 | +public define HTML text_area(WebArgName name, InitialValue init, Int width, Int height) = | |
| 1803 | + text_area([], no_label, html_Id(""), name, init, width, height). | |
| 1804 | + | |
| 1805 | +public define HTML text_area(List(CoreAttrs) options, WebArgName name, InitialValue init, Int width, Int height)= | |
| 1806 | + text_area(options, no_label, html_Id(""), name,init,width,height). | |
| 1807 | + | |
| 1808 | +// text_area(options,label_text, id, n, init, w, h) then | |
| 1809 | +// [ format_label(label_text, id), "<textarea ",format(options)," id=\"",id,"\" name=\"",n,"\" cols=\"",w,"\" rows=\"",h,"\">",encode_HTML_entities(init.value),"</textarea>"], | |
| 1810 | + | |
| 1825 | 1811 | |
| 1826 | 1812 | // <thead> |
| 1827 | -public define HTML_Off_Form thead(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("thead", attrs, content). | |
| 1828 | -public define HTML_Off_Form thead(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("thead", attrs, [content]). | |
| 1829 | -public define HTML_Off_Form thead(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("thead", [attr], content). | |
| 1830 | -public define HTML_Off_Form thead(CoreAttrs attr, HTML_Off_Form content) = html_tag("thead", [attr], [content]). | |
| 1831 | -public define HTML_Off_Form thead(List(HTML_Off_Form) content) = html_tag("thead", [], content). | |
| 1832 | -public define HTML_Off_Form thead(HTML_Off_Form content) = html_tag("thead", [], [content]). | |
| 1813 | +public define HTML thead(List(CoreAttrs) attrs, List(HTML) content) = html_tag("thead", attrs, content). | |
| 1814 | +public define HTML thead(List(CoreAttrs) attrs, HTML content) = html_tag("thead", attrs, [content]). | |
| 1815 | +public define HTML thead(CoreAttrs attr, List(HTML) content) = html_tag("thead", [attr], content). | |
| 1816 | +public define HTML thead(CoreAttrs attr, HTML content) = html_tag("thead", [attr], [content]). | |
| 1817 | +public define HTML thead(List(HTML) content) = html_tag("thead", content). | |
| 1818 | +public define HTML thead(HTML content) = html_tag("thead", [content]). | |
| 1833 | 1819 | |
| 1834 | 1820 | // <tbody> |
| 1835 | -public define HTML_Off_Form tbody(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("tbody", attrs, content). | |
| 1836 | -public define HTML_Off_Form tbody(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("tbody", attrs, [content]). | |
| 1837 | -public define HTML_Off_Form tbody(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("tbody", [attr], content). | |
| 1838 | -public define HTML_Off_Form tbody(CoreAttrs attr, HTML_Off_Form content) = html_tag("tbody", [attr], [content]). | |
| 1839 | -public define HTML_Off_Form tbody(List(HTML_Off_Form) content) = html_tag("tbody", [], content). | |
| 1840 | -public define HTML_Off_Form tbody(HTML_Off_Form content) = html_tag("tbody", [], [content]). | |
| 1821 | +public define HTML tbody(List(CoreAttrs) attrs, List(HTML) content) = html_tag("tbody", attrs, content). | |
| 1822 | +public define HTML tbody(List(CoreAttrs) attrs, HTML content) = html_tag("tbody", attrs, [content]). | |
| 1823 | +public define HTML tbody(CoreAttrs attr, List(HTML) content) = html_tag("tbody", [attr], content). | |
| 1824 | +public define HTML tbody(CoreAttrs attr, HTML content) = html_tag("tbody", [attr], [content]). | |
| 1825 | +public define HTML tbody(List(HTML) content) = html_tag("tbody", content). | |
| 1826 | +public define HTML tbody(HTML content) = html_tag("tbody", [content]). | |
| 1841 | 1827 | |
| 1842 | 1828 | // <tfoot> |
| 1843 | -public define HTML_Off_Form tfoot(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("tfoot", attrs, content). | |
| 1844 | -public define HTML_Off_Form tfoot(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("tfoot", attrs, [content]). | |
| 1845 | -public define HTML_Off_Form tfoot(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("tfoot", [attr], content). | |
| 1846 | -public define HTML_Off_Form tfoot(CoreAttrs attr, HTML_Off_Form content) = html_tag("tfoot", [attr], [content]). | |
| 1847 | -public define HTML_Off_Form tfoot(List(HTML_Off_Form) content) = html_tag("tfoot", [], content). | |
| 1848 | -public define HTML_Off_Form tfoot(HTML_Off_Form content) = html_tag("tfoot", [], [content]). | |
| 1829 | +public define HTML tfoot(List(CoreAttrs) attrs, List(HTML) content) = html_tag("tfoot", attrs, content). | |
| 1830 | +public define HTML tfoot(List(CoreAttrs) attrs, HTML content) = html_tag("tfoot", attrs, [content]). | |
| 1831 | +public define HTML tfoot(CoreAttrs attr, List(HTML) content) = html_tag("tfoot", [attr], content). | |
| 1832 | +public define HTML tfoot(CoreAttrs attr, HTML content) = html_tag("tfoot", [attr], [content]). | |
| 1833 | +public define HTML tfoot(List(HTML) content) = html_tag("tfoot", content). | |
| 1834 | +public define HTML tfoot(HTML content) = html_tag("tfoot", [content]). | |
| 1849 | 1835 | |
| 1850 | 1836 | // <th> |
| 1851 | -public define HTML_Off_Form th(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("th", attrs, content). | |
| 1852 | -public define HTML_Off_Form th(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("th", attrs, [content]). | |
| 1853 | -public define HTML_Off_Form th(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("th", [attr], content). | |
| 1854 | -public define HTML_Off_Form th(CoreAttrs attr, HTML_Off_Form content) = html_tag("th", [attr], [content]). | |
| 1855 | -public define HTML_Off_Form th(CoreAttrs attr) = html_tag("th", [attr], []). | |
| 1856 | -public define HTML_Off_Form th(List(HTML_Off_Form) content) = html_tag("th", [], content). | |
| 1857 | -public define HTML_Off_Form th(HTML_Off_Form content) = html_tag("th", [], [content]). | |
| 1858 | -public define HTML_Off_Form th(String string) = html_tag("th", [], [text(string)]). | |
| 1859 | -public define HTML_Off_Form th(CoreAttrs attr, String string) = html_tag("th", [attr], [text(string)]). | |
| 1860 | -public define HTML_Off_Form th(List(CoreAttrs) attrs, String string) = html_tag("th", attrs, [text(string)]). | |
| 1861 | -public define HTML_Off_Form th = html_tag("th", [], []). | |
| 1837 | +public define HTML th(List(CoreAttrs) attrs, List(HTML) content) = html_tag("th", attrs, content). | |
| 1838 | +public define HTML th(List(CoreAttrs) attrs, HTML content) = html_tag("th", attrs, [content]). | |
| 1839 | +public define HTML th(CoreAttrs attr, List(HTML) content) = html_tag("th", [attr], content). | |
| 1840 | +public define HTML th(CoreAttrs attr, HTML content) = html_tag("th", [attr], [content]). | |
| 1841 | +public define HTML th(CoreAttrs attr) = html_tag("th", [attr]). | |
| 1842 | +public define HTML th(List(HTML) content) = html_tag("th", content). | |
| 1843 | +public define HTML th(HTML content) = html_tag("th", [content]). | |
| 1844 | +public define HTML th(String string) = html_tag("th", [text(string)]). | |
| 1845 | +public define HTML th(CoreAttrs attr, String string) = html_tag("th", [attr], [text(string)]). | |
| 1846 | +public define HTML th(List(CoreAttrs) attrs, String string) = html_tag("th", attrs, [text(string)]). | |
| 1847 | +public define HTML th = html_tag("th"). | |
| 1862 | 1848 | |
| 1863 | 1849 | // <td> |
| 1864 | -public define HTML_Off_Form td(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("td", attrs, content). | |
| 1865 | -public define HTML_Off_Form td(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("td", attrs, [content]). | |
| 1866 | -public define HTML_Off_Form td(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("td", [attr], content). | |
| 1867 | -public define HTML_Off_Form td(CoreAttrs attr, HTML_Off_Form content) = html_tag("td", [attr], [content]). | |
| 1868 | -public define HTML_Off_Form td(List(HTML_Off_Form) content) = html_tag("td", [], content). | |
| 1869 | -public define HTML_Off_Form td(HTML_Off_Form content) = html_tag("td", [], [content]). | |
| 1870 | -public define HTML_Off_Form td(List(CoreAttrs) attrs, String string) = html_tag("td", attrs, [text(string)]). | |
| 1871 | -public define HTML_Off_Form td(CoreAttrs attr, String string) = html_tag("td", [attr], [text(string)]). | |
| 1872 | -public define HTML_Off_Form td(String string) = html_tag("td", [], [text(string)]). | |
| 1873 | -public define HTML_Off_Form td(List(CoreAttrs) attrs, Int i) = html_tag("td", attrs, [text(to_decimal(i))]). | |
| 1874 | -public define HTML_Off_Form td(CoreAttrs attr, Int i) = html_tag("td", [attr], [text(to_decimal(i))]). | |
| 1875 | -public define HTML_Off_Form td(Int i) = html_tag("td", [], [text(to_decimal(i))]). | |
| 1850 | + // CoreAttrs for <td> | |
| 1851 | +//public define CoreAttrs colspan(Int value) = attr("colspan", to_String(value)). | |
| 1852 | +//public define CoreAttrs rowspan(Int value) = attr("rowspan", to_String(value)). | |
| 1853 | +//public define CoreAttrs headers(String header_id) = attr("headers", header_id). | |
| 1854 | + | |
| 1855 | +public define HTML td(List(CoreAttrs) attrs, List(HTML) content) = html_tag("td", attrs, content). | |
| 1856 | +public define HTML td(List(CoreAttrs) attrs, HTML content) = html_tag("td", attrs, [content]). | |
| 1857 | +public define HTML td(CoreAttrs attr, List(HTML) content) = html_tag("td", [attr], content). | |
| 1858 | +public define HTML td(CoreAttrs attr, HTML content) = html_tag("td", [attr], [content]). | |
| 1859 | +public define HTML td(List(HTML) content) = html_tag("td", content). | |
| 1860 | +public define HTML td(HTML content) = html_tag("td", [content]). | |
| 1861 | +public define HTML td(List(CoreAttrs) attrs, String string) = html_tag("td", attrs, [text(string)]). | |
| 1862 | +public define HTML td(CoreAttrs attr, String string) = html_tag("td", [attr], [text(string)]). | |
| 1863 | +public define HTML td(String string) = html_tag("td", [text(string)]). | |
| 1864 | +public define HTML td(List(CoreAttrs) attrs, Int i) = html_tag("td", attrs, [text(to_decimal(i))]). | |
| 1865 | +public define HTML td(CoreAttrs attr, Int i) = html_tag("td", [attr], [text(to_decimal(i))]). | |
| 1866 | +public define HTML td(Int i) = html_tag("td", [text(to_decimal(i))]). | |
| 1876 | 1867 | |
| 1877 | 1868 | // <tr> |
| 1878 | -public define HTML_Off_Form tr(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("tr", attrs, content). | |
| 1879 | -public define HTML_Off_Form tr(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("tr", attrs, [content]). | |
| 1880 | -public define HTML_Off_Form tr(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("tr", [attr], content). | |
| 1881 | -public define HTML_Off_Form tr(CoreAttrs attr, HTML_Off_Form content) = html_tag("tr", [attr], [content]). | |
| 1882 | -public define HTML_Off_Form tr(List(HTML_Off_Form) content) = html_tag("tr", [], content). | |
| 1883 | -public define HTML_Off_Form tr(HTML_Off_Form content) = html_tag("tr", [], [content]). | |
| 1869 | +public define HTML tr(List(CoreAttrs) attrs, List(HTML) content) = html_tag("tr", attrs, content). | |
| 1870 | +public define HTML tr(List(CoreAttrs) attrs, HTML content) = html_tag("tr", attrs, [content]). | |
| 1871 | +public define HTML tr(CoreAttrs attr, List(HTML) content) = html_tag("tr", [attr], content). | |
| 1872 | +public define HTML tr(CoreAttrs attr, HTML content) = html_tag("tr", [attr], [content]). | |
| 1873 | +public define HTML tr(List(HTML) content) = html_tag("tr", content). | |
| 1874 | +public define HTML tr(HTML content) = html_tag("tr", [content]). | |
| 1884 | 1875 | |
| 1876 | + // <ul> | |
| 1877 | +public define HTML ul(List(CoreAttrs) attrs, List(HTML) content) = html_tag("ul", attrs, content). | |
| 1878 | +public define HTML ul(List(CoreAttrs) attrs, HTML content) = html_tag("ul", attrs, [content]). | |
| 1879 | +public define HTML ul(CoreAttrs attr, List(HTML) content) = html_tag("ul", [attr], content). | |
| 1880 | +public define HTML ul(CoreAttrs attr, HTML content) = html_tag("ul", [attr], [content]). | |
| 1881 | +public define HTML ul(List(HTML) content) = html_tag("ul", content). | |
| 1882 | +public define HTML ul(HTML content) = html_tag("ul", [content]). | |
| 1885 | 1883 | |
| 1886 | - // <textarea> | |
| 1887 | - // CoreAttrs for textarea | |
| 1888 | -public define CoreAttrs wrap_lines = attr("wrap", "hard"). | |
| 1889 | -public define CoreAttrs read_only = bool_attr(true, "readonly"). | |
| 1884 | +//public define HTML empty = html_tag( | |
| 1890 | 1885 | |
| 1891 | -public define HTML_Off_Form textarea(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("textarea", attrs, content). | |
| 1892 | -public define HTML_Off_Form textarea(List(CoreAttrs) attrs, Int cols, Int rows, List(HTML_Off_Form) content) | |
| 1893 | - = html_tag("textarea", [attr("cols",to_String(cols)), attr("rows",to_String(rows)) . attrs], content). | |
| 1894 | -public define HTML_Off_Form textarea(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("textarea", attrs, [content]). | |
| 1895 | -public define HTML_Off_Form textarea(List(CoreAttrs) attrs, Int cols, Int rows, HTML_Off_Form content) | |
| 1896 | - = html_tag("textarea", [attr("cols",to_String(cols)), attr("rows",to_String(rows)) . attrs], [content]). | |
| 1897 | -public define HTML_Off_Form textarea(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("textarea", [attr], content). | |
| 1898 | -public define HTML_Off_Form textarea(CoreAttrs attr, HTML_Off_Form content) = html_tag("textarea", [attr], [content]). | |
| 1886 | +//public define HTML | |
| 1887 | +// form | |
| 1888 | +// ( | |
| 1889 | +// String form_name, | |
| 1890 | +// List(CoreAttrs) options, | |
| 1891 | +// HTML content | |
| 1892 | +// ) = | |
| 1893 | +// form([id(form_name). options], [content]). | |
| 1899 | 1894 | |
| 1900 | - // <ul> | |
| 1901 | -public define HTML_Off_Form ul(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("ul", attrs, content). | |
| 1902 | -public define HTML_Off_Form ul(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("ul", attrs, [content]). | |
| 1903 | -public define HTML_Off_Form ul(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("ul", [attr], content). | |
| 1904 | -public define HTML_Off_Form ul(CoreAttrs attr, HTML_Off_Form content) = html_tag("ul", [attr], [content]). | |
| 1905 | -public define HTML_Off_Form ul(List(HTML_Off_Form) content) = html_tag("ul", [], content). | |
| 1906 | -public define HTML_Off_Form ul(HTML_Off_Form content) = html_tag("ul", [], [content]). | |
| 1895 | +//public define HTML | |
| 1896 | +// form | |
| 1897 | +// ( | |
| 1898 | +// String form_name, | |
| 1899 | +// List(CoreAttrs) options, | |
| 1900 | +// List(HTML) contents | |
| 1901 | +// ) = | |
| 1902 | +// form([id(form_name) . options], contents). | |
| 1907 | 1903 | |
| 1908 | 1904 | |
| 1909 | -public define HTML_Off_Form | |
| 1910 | - form | |
| 1911 | - ( | |
| 1912 | - String form_name, | |
| 1913 | - List(CoreAttrs) options, | |
| 1914 | - HTML_In_Form content | |
| 1915 | - ) = | |
| 1916 | - form(html_Id(form_name), options, [content]). | |
| 1905 | + | |
| 1906 | +public define HTML image(String url) = img(url). | |
| 1907 | +public define HTML image(String url, Int width, Int height) = img(url, width, height). | |
| 1917 | 1908 | |
| 1918 | -public define HTML_Off_Form | |
| 1919 | - form | |
| 1920 | - ( | |
| 1921 | - String form_name, | |
| 1922 | - List(CoreAttrs) options, | |
| 1923 | - List(HTML_In_Form) contents | |
| 1924 | - ) = | |
| 1925 | - form(html_Id(form_name), options, contents). | |
| 1926 | - | |
| 1927 | -public define HTML_Off_Form | |
| 1909 | + | |
| 1910 | + | |
| 1911 | +public define HTML | |
| 1928 | 1912 | form |
| 1929 | 1913 | ( |
| 1930 | - String form_name, | |
| 1931 | 1914 | List(CoreAttrs) options, |
| 1932 | - WEB_Action_Name action, | |
| 1915 | + WEB_Action_Name _action, | |
| 1933 | 1916 | List((String,String)) extra_ops, |
| 1934 | - HTML_In_Form content | |
| 1917 | + HTML content | |
| 1935 | 1918 | ) = |
| 1936 | - form(html_Id(form_name), options, action, extra_ops, [content]). | |
| 1919 | + form([action(_action, extra_ops). options], [content]). | |
| 1937 | 1920 | |
| 1938 | -public define HTML_Off_Form | |
| 1921 | +public define HTML | |
| 1939 | 1922 | form |
| 1940 | 1923 | ( |
| 1941 | - HTML_Id form_id, | |
| 1942 | 1924 | List(CoreAttrs) options, |
| 1943 | 1925 | WEB_Action_Name action, |
| 1944 | 1926 | List((String,String)) extra_ops, |
| 1945 | - HTML_In_Form content | |
| 1927 | + List(HTML) contents | |
| 1946 | 1928 | ) = |
| 1947 | - form(form_id, options, action, extra_ops, [content]). | |
| 1929 | + form(options, action, extra_ops, contents). | |
| 1948 | 1930 | |
| 1949 | -public define HTML_Off_Form | |
| 1931 | +public define HTML | |
| 1950 | 1932 | form |
| 1951 | 1933 | ( |
| 1952 | - String form_name, | |
| 1953 | - List(CoreAttrs) options, | |
| 1954 | - WEB_Action_Name action, | |
| 1955 | - List((String,String)) extra_ops, | |
| 1956 | - List(HTML_In_Form) contents | |
| 1957 | - ) = | |
| 1958 | - form(html_Id(form_name), options, action, extra_ops, contents). | |
| 1959 | - | |
| 1960 | -public define HTML_Off_Form | |
| 1961 | - form | |
| 1962 | - ( | |
| 1963 | - String form_name, | |
| 1964 | 1934 | List(CoreAttrs) options, |
| 1965 | 1935 | String action, |
| 1966 | 1936 | List((String,String)) extra_ops, |
| 1967 | - HTML_In_Form content | |
| 1937 | + HTML content | |
| 1968 | 1938 | ) = |
| 1969 | - form(html_Id(form_name), options, action_name(action), extra_ops, [content]). | |
| 1939 | + form(options, action_name(action), extra_ops, [content]). | |
| 1970 | 1940 | |
| 1971 | -public define HTML_Off_Form | |
| 1941 | +public define HTML | |
| 1972 | 1942 | form |
| 1973 | 1943 | ( |
| 1974 | 1944 | String form_name, |
| 1975 | 1945 | List(CoreAttrs) options, |
| 1976 | 1946 | String action, |
| 1977 | 1947 | List((String,String)) extra_ops, |
| 1978 | - List(HTML_In_Form) contents | |
| 1948 | + List(HTML) contents | |
| 1979 | 1949 | ) = |
| 1980 | - form(html_Id(form_name), options, action_name(action), extra_ops, contents). | |
| 1981 | - | |
| 1982 | -public define HTML_Off_Form literal(Printable_tree t) = literal_pt(t). | |
| 1983 | -//public define HTML_Off_Form fixed_size(HTML_Size width, HTML_Size height, String name_of_HTML_file) | |
| 1984 | -// = fixed_size_2(width,height,name_of_HTML_file). | |
| 1985 | - | |
| 1986 | - | |
| 1987 | -public define HTML_Off_Form | |
| 1988 | - foreign_link | |
| 1989 | - ( | |
| 1990 | - Int tsize, | |
| 1991 | - String url, | |
| 1992 | - String name | |
| 1993 | - ) = | |
| 1994 | - foreign_link([size(tsize)],url,name). | |
| 1995 | - | |
| 1996 | - | |
| 1997 | -public define HTML_Off_Form | |
| 1998 | - actioner | |
| 1999 | - ( | |
| 2000 | - Actioner_Connection conn, | |
| 2001 | - Actioner_Target targ, | |
| 2002 | - Actioner_Aspect asp, | |
| 2003 | - WEB_Action_Name action, | |
| 2004 | - List((String,String)) extra_ops | |
| 2005 | - ) = | |
| 2006 | - actioner(conn,targ,asp,action,extra_ops,[]). | |
| 1950 | + form(form_name, options, action, extra_ops, contents). | |
| 2007 | 1951 | |
| 2008 | -public define HTML_Off_Form | |
| 1952 | +public define HTML | |
| 2009 | 1953 | actioner |
| 2010 | 1954 | ( |
| 2011 | 1955 | Actioner_Connection conn, |
| ... | ... | @@ -2017,7 +1961,7 @@ public define HTML_Off_Form |
| 2017 | 1961 | ) = |
| 2018 | 1962 | actioner(conn,targ,asp,action,extra_ops,[], form_name). |
| 2019 | 1963 | |
| 2020 | -public define HTML_Off_Form | |
| 1964 | +public define HTML | |
| 2021 | 1965 | actioner |
| 2022 | 1966 | ( |
| 2023 | 1967 | Actioner_Aspect asp, |
| ... | ... | @@ -2026,52 +1970,18 @@ public define HTML_Off_Form |
| 2026 | 1970 | ) = |
| 2027 | 1971 | actioner(same, same, asp, action, extra_ops, []). |
| 2028 | 1972 | |
| 2029 | -public define HTML_Off_Form | |
| 1973 | +public define HTML | |
| 2030 | 1974 | actioner |
| 2031 | 1975 | ( |
| 2032 | 1976 | Actioner_Aspect asp, |
| 2033 | 1977 | WEB_Action_Name action, |
| 2034 | 1978 | List((String,String)) extra_ops, |
| 2035 | 1979 | String form_name |
| 2036 | - ) = | |
| 2037 | - actioner(same, same, asp, action, extra_ops, [], form_name). | |
| 2038 | - | |
| 2039 | -public define HTML_Off_Form | |
| 2040 | -/* Older call with String as action instead of WEB_Action_Name. | |
| 2041 | - * This function exists only for compatibility with older project. | |
| 2042 | - * Please condiser to use above function instead | |
| 2043 | - */ | |
| 2044 | - actioner | |
| 2045 | - ( | |
| 2046 | - Actioner_Connection conn, | |
| 2047 | - Actioner_Target targ, | |
| 2048 | - Actioner_Aspect asp, | |
| 2049 | - String action, | |
| 2050 | - List((String,String)) extra_ops, | |
| 2051 | - List(Actioner_Local_Action) local_actions | |
| 2052 | - )= | |
| 2053 | - actioner(conn,targ,asp,action_name(action),extra_ops,local_actions) | |
| 2054 | -. | |
| 2055 | - | |
| 2056 | -public define HTML_Off_Form | |
| 2057 | -/* Older call with String as action instead of WEB_Action_Name. | |
| 2058 | - * This function exists only for compatibility with older project. | |
| 2059 | - * Please condiser to use above function instead | |
| 2060 | - */ | |
| 2061 | - actioner | |
| 2062 | - ( | |
| 2063 | - Actioner_Connection conn, | |
| 2064 | - Actioner_Target targ, | |
| 2065 | - Actioner_Aspect asp, | |
| 2066 | - String action, | |
| 2067 | - List((String,String)) extra_ops, | |
| 2068 | - List(Actioner_Local_Action) local_actions, | |
| 2069 | - String form_name | |
| 2070 | - )= | |
| 2071 | - actioner(conn, targ, asp, action_name(action), extra_ops, local_actions, form_name) | |
| 2072 | -. | |
| 1980 | + ) = | |
| 1981 | + actioner(same, same, asp, action, extra_ops, [], form_name). | |
| 1982 | + | |
| 2073 | 1983 | |
| 2074 | -public define HTML_Off_Form | |
| 1984 | +public define HTML | |
| 2075 | 1985 | /* Older call with String as action instead of WEB_Action_Name. |
| 2076 | 1986 | * This function exists only for compatibility with older project. |
| 2077 | 1987 | * Please condiser to use above function instead |
| ... | ... | @@ -2082,12 +1992,14 @@ public define HTML_Off_Form |
| 2082 | 1992 | Actioner_Target targ, |
| 2083 | 1993 | Actioner_Aspect asp, |
| 2084 | 1994 | String action, |
| 2085 | - List((String,String)) extra_ops | |
| 1995 | + List((String,String)) extra_ops, | |
| 1996 | + List(Actioner_Local_Action) local_actions, | |
| 1997 | + String form_name | |
| 2086 | 1998 | )= |
| 2087 | - actioner(conn,targ,asp,action_name(action),extra_ops,[]) | |
| 1999 | + actioner(conn, targ, asp, action_name(action), extra_ops, local_actions, form_name) | |
| 2088 | 2000 | . |
| 2089 | 2001 | |
| 2090 | -public define HTML_Off_Form | |
| 2002 | +public define HTML | |
| 2091 | 2003 | /* Older call with String as action instead of WEB_Action_Name. |
| 2092 | 2004 | * This function exists only for compatibility with older project. |
| 2093 | 2005 | * Please condiser to use above function instead |
| ... | ... | @@ -2104,100 +2016,27 @@ public define HTML_Off_Form |
| 2104 | 2016 | actioner(conn, targ, asp, action_name(action), extra_ops, [], form_name) |
| 2105 | 2017 | . |
| 2106 | 2018 | |
| 2107 | -public define HTML_Off_Form | |
| 2108 | - table | |
| 2109 | - ( | |
| 2110 | - List(HTML_Row(HTML_Off_Form)) rows | |
| 2111 | - )= | |
| 2112 | - table([], empty, rows,empty) | |
| 2113 | -. | |
| 2114 | - | |
| 2115 | -public define HTML_Off_Form | |
| 2116 | - table | |
| 2117 | - ( | |
| 2118 | - List(Table_Option) options, | |
| 2119 | - List(HTML_Row(HTML_Off_Form)) rows | |
| 2120 | - ) = | |
| 2121 | - table(options,empty,rows,empty) | |
| 2122 | -. | |
| 2123 | - | |
| 2124 | -public define HTML_Off_Form | |
| 2125 | - table | |
| 2126 | - ( | |
| 2127 | - Table_Option option, | |
| 2128 | - HTML_Row(HTML_Off_Form) row | |
| 2129 | - ) = | |
| 2130 | - table([option], empty, [row], empty) | |
| 2131 | -. | |
| 2132 | - | |
| 2133 | -public define HTML_Off_Form | |
| 2134 | - table | |
| 2135 | - ( | |
| 2136 | - HTML_Header_Row(HTML_Off_Form) h_row, | |
| 2137 | - List(HTML_Row(HTML_Off_Form)) rows | |
| 2138 | - ) = | |
| 2139 | - table([],h_row,rows,empty) | |
| 2140 | -. | |
| 2141 | - | |
| 2142 | -public define HTML_Off_Form | |
| 2143 | - table | |
| 2144 | - ( | |
| 2145 | - List(Table_Option) options, | |
| 2146 | - HTML_Header_Row(HTML_Off_Form) h_row, | |
| 2147 | - List(HTML_Row(HTML_Off_Form)) rows | |
| 2148 | - ) = | |
| 2149 | - table(options,h_row,rows,empty) | |
| 2150 | -. | |
| 2151 | - | |
| 2152 | -public define HTML_Off_Form | |
| 2153 | - table | |
| 2154 | - ( | |
| 2155 | - Table_Option option, | |
| 2156 | - HTML_Header_Row(HTML_Off_Form) h_row, | |
| 2157 | - List(HTML_Row(HTML_Off_Form)) rows | |
| 2158 | - ) = | |
| 2159 | - table([option], h_row, rows,empty) | |
| 2160 | -. | |
| 2161 | - | |
| 2162 | - We add two convenience functions for 'row'. The reason why we add two functions, one | |
| 2163 | - for 'HTML_In_Form' and one for 'HTML_Off_Form', is that adding a schema with an | |
| 2164 | - arbitrary '$T' creates too many ambiguities. This is due to the fact that, if we do so, | |
| 2165 | - the arguments of the function do not refer to any of the types defined here. | |
| 2166 | - | |
| 2167 | -public define HTML_Row(HTML_In_Form) | |
| 2168 | - row | |
| 2169 | - ( | |
| 2170 | - HTML_In_Form content | |
| 2171 | - ) = | |
| 2172 | - row([],[cell([],content)]). | |
| 2173 | - | |
| 2174 | -public define HTML_Row(HTML_Off_Form) | |
| 2175 | - row | |
| 2176 | - ( | |
| 2177 | - HTML_Off_Form content | |
| 2178 | - ) = | |
| 2179 | - row([],[cell([],content)]). | |
| 2180 | - | |
| 2181 | -public define HTML_Cell(HTML_Off_Form) | |
| 2019 | +public define HTML | |
| 2182 | 2020 | cells_to_column_in_cell |
| 2183 | 2021 | ( |
| 2184 | - List(HTML_Cell(HTML_Off_Form)) cells | |
| 2022 | + List(HTML) cells | |
| 2185 | 2023 | )= |
| 2186 | - cell( | |
| 2024 | + td( | |
| 2187 | 2025 | table( |
| 2188 | - map( (HTML_Cell(HTML_Off_Form) current_cell) |-> row(current_cell), cells) | |
| 2189 | - )). | |
| 2026 | + map( ((HTML) current_cell) |-> tr(current_cell), cells) | |
| 2027 | + )) | |
| 2028 | +. | |
| 2190 | 2029 | |
| 2191 | -public define HTML_Off_Form | |
| 2030 | +public define HTML | |
| 2192 | 2031 | cells_to_line |
| 2193 | 2032 | ( |
| 2194 | - List(HTML_Off_Form) cells | |
| 2033 | + List(HTML) cells | |
| 2195 | 2034 | )= |
| 2196 | - table([row( | |
| 2197 | - map (((HTML_Off_Form) current_cell) |-> cell(current_cell), cells))]) | |
| 2035 | + table([tr( | |
| 2036 | + map (((HTML) current_cell) |-> td(current_cell), cells))]) | |
| 2198 | 2037 | . |
| 2199 | 2038 | |
| 2200 | -public define HTML_Off_Form | |
| 2039 | +public define HTML | |
| 2201 | 2040 | private_download |
| 2202 | 2041 | ( |
| 2203 | 2042 | String abs_path, |
| ... | ... | @@ -2207,7 +2046,7 @@ public define HTML_Off_Form |
| 2207 | 2046 | private_download(abs_path,name,extra_ext,failure). |
| 2208 | 2047 | |
| 2209 | 2048 | |
| 2210 | -public define HTML_Off_Form | |
| 2049 | +public define HTML | |
| 2211 | 2050 | private_download |
| 2212 | 2051 | ( |
| 2213 | 2052 | String abs_path, |
| ... | ... | @@ -2219,147 +2058,83 @@ public define HTML_Off_Form |
| 2219 | 2058 | private_download(abs_path,name,extra_ext,success((action_name,args))). |
| 2220 | 2059 | |
| 2221 | 2060 | . |
| 2222 | - | |
| 2223 | - | |
| 2224 | - | |
| 2225 | -public define HTML_In_Form | |
| 2226 | - hr | |
| 2227 | - = | |
| 2228 | - hr([]) | |
| 2229 | -. | |
| 2230 | - | |
| 2231 | -public define HTML_In_Form | |
| 2232 | - button | |
| 2233 | - ( | |
| 2234 | - List(HTML_In_Form) elements | |
| 2235 | - )= | |
| 2236 | - button([], elements) | |
| 2237 | -. | |
| 2238 | - | |
| 2239 | -public define HTML_In_Form | |
| 2240 | - button | |
| 2241 | - ( | |
| 2242 | - List(CoreAttrs) attrs, | |
| 2243 | - HTML_In_Form element | |
| 2244 | - )= | |
| 2245 | - button(attrs, [element]) | |
| 2246 | -. | |
| 2247 | - | |
| 2248 | -public define HTML_In_Form | |
| 2249 | - button | |
| 2250 | - ( | |
| 2251 | - HTML_In_Form element | |
| 2252 | - )= | |
| 2253 | - button([], [element]) | |
| 2254 | -. | |
| 2255 | - - Cell a gap between two other cells : | |
| 2256 | - | |
| 2257 | -public define HTML_Cell(HTML_Off_Form) | |
| 2258 | - width_gap | |
| 2259 | - ( | |
| 2260 | - Int w | |
| 2261 | - )= | |
| 2262 | - cell([width(w)], empty). | |
| 2263 | - | |
| 2264 | -public define HTML_Cell(HTML_In_Form) | |
| 2265 | - width_gap | |
| 2266 | - ( | |
| 2267 | - Int w | |
| 2268 | - )= | |
| 2269 | - cell([width(w)],empty) | |
| 2270 | -. | |
| 2271 | - - Row a gap between two other rows : | |
| 2272 | - | |
| 2273 | -public define HTML_Row(HTML_Off_Form) | |
| 2274 | - height_gap | |
| 2275 | - ( | |
| 2276 | - Int h | |
| 2277 | - )= | |
| 2278 | - row([],[cell([height(h)],empty)]). | |
| 2279 | - | |
| 2280 | -public define HTML_Row(HTML_In_Form) | |
| 2281 | - height_gap | |
| 2282 | - ( | |
| 2283 | - Int h | |
| 2284 | - )= | |
| 2285 | - row([],[cell([height(h)],empty)]) | |
| 2286 | -. | |
| 2287 | - | |
| 2288 | - | |
| 2061 | + | |
| 2289 | 2062 | Notice that the two types have alternatives in common (same name, same arguments types, |
| 2290 | 2063 | up to the value of the parameter $T), which correspond to elements which may be put |
| 2291 | 2064 | anywhere in the page. |
| 2292 | 2065 | |
| 2293 | -public define HTML_Partial_Content | |
| 2294 | - partial_content | |
| 2295 | - ( | |
| 2296 | - List(HTML_Head_Tag) tags, | |
| 2297 | - List(HTML_Off_Form) content | |
| 2298 | - )= | |
| 2299 | - partial_content(tags, sequence(content)). | |
| 2300 | - | |
| 2301 | -public define HTML_Partial_Content | |
| 2302 | - partial_content | |
| 2303 | - ( | |
| 2304 | - HTML_Off_Form content | |
| 2305 | - )= | |
| 2306 | - partial_content([], content). | |
| 2307 | - | |
| 2308 | -public define HTML_Partial_Content | |
| 2309 | - partial_content | |
| 2310 | - ( | |
| 2311 | - List(HTML_Off_Form) content | |
| 2312 | - )= | |
| 2313 | - partial_content([], sequence(content)). | |
| 2314 | - | |
| 2315 | -public define HTML_Partial_Content | |
| 2316 | - partial_content | |
| 2066 | +//public define HTML | |
| 2067 | +// partial_content | |
| 2068 | +// ( | |
| 2069 | +// List(HTML_Head_Tag) tags, | |
| 2070 | +// List(HTML) content | |
| 2071 | +// )= | |
| 2072 | +// partial_content(tags, sequence(content)). | |
| 2073 | +// | |
| 2074 | +//public define HTML | |
| 2075 | +// partial_content | |
| 2076 | +// ( | |
| 2077 | +// HTML content | |
| 2078 | +// )= | |
| 2079 | +// partial_content([], content). | |
| 2080 | +// | |
| 2081 | +//public define HTML | |
| 2082 | +// partial_content | |
| 2083 | +// ( | |
| 2084 | +// List(HTML) content | |
| 2085 | +// )= | |
| 2086 | +// partial_content([], sequence(content)). | |
| 2087 | +// | |
| 2088 | +public define HTML | |
| 2089 | + add_head_tags | |
| 2317 | 2090 | ( |
| 2318 | 2091 | List(HTML_Head_Tag) tags, |
| 2319 | - HTML_Partial_Content p_content | |
| 2092 | + HTML p_content | |
| 2320 | 2093 | )= |
| 2321 | - if p_content is partial_content(ptags, html) then | |
| 2322 | - partial_content(tags + ptags, html). | |
| 2094 | + if p_content is head_tags(_head_tags, html) then | |
| 2095 | + head_tags(tags + _head_tags, html) | |
| 2096 | + else | |
| 2097 | + p_content | |
| 2098 | +. | |
| 2323 | 2099 | |
| 2324 | -define HTML_Partial_Content | |
| 2100 | +define HTML | |
| 2325 | 2101 | list_to_pcontent |
| 2326 | 2102 | ( |
| 2327 | - List(HTML_Partial_Content) l_p_content, | |
| 2328 | - List(HTML_Head_Tag) so_far_tags, | |
| 2329 | - List(HTML_Off_Form) so_far_html | |
| 2103 | + List(HTML) l_content, | |
| 2104 | + List(HTML_Head_Tag) so_far_tags, | |
| 2105 | + List(HTML) so_far_html | |
| 2330 | 2106 | )= |
| 2331 | - if l_p_content is | |
| 2107 | + if l_content is | |
| 2332 | 2108 | { |
| 2333 | - [] then partial_content(so_far_tags, sequence(reverse(so_far_html))), | |
| 2109 | + [] then head_tags(so_far_tags, reverse(so_far_html)), | |
| 2334 | 2110 | [h . t] then |
| 2335 | 2111 | //extract resurgent type and symbols of h |
| 2336 | - if h is partial_content(tags, html) then | |
| 2337 | - list_to_pcontent(t, so_far_tags + tags, [html . so_far_html]) | |
| 2112 | + if h is head_tags(tags, html) then | |
| 2113 | + list_to_pcontent(t, so_far_tags + tags, html + so_far_html) | |
| 2114 | + else | |
| 2115 | + list_to_pcontent(t, so_far_tags, [h . so_far_html]) | |
| 2338 | 2116 | }. |
| 2339 | 2117 | |
| 2340 | -public define HTML_Partial_Content | |
| 2341 | - partial_content | |
| 2342 | - ( | |
| 2343 | - List(HTML_Partial_Content) l_p_content | |
| 2344 | - )= | |
| 2345 | - list_to_pcontent(l_p_content, [], []). | |
| 2346 | - | |
| 2347 | -public define HTML_Partial_Content | |
| 2348 | - partial_empty | |
| 2349 | - = | |
| 2350 | - partial_content(empty) | |
| 2351 | -. | |
| 2118 | +//public define HTML | |
| 2119 | +// partial_content | |
| 2120 | +// ( | |
| 2121 | +// List(HTML) l_p_content | |
| 2122 | +// )= | |
| 2123 | +// list_to_pcontent(l_p_content, [], []). | |
| 2124 | +// | |
| 2125 | +//public define HTML | |
| 2126 | +// partial_empty | |
| 2127 | +// = | |
| 2128 | +// partial_content(empty) | |
| 2129 | +//. | |
| 2352 | 2130 | |
| 2353 | -define String | |
| 2131 | + define String | |
| 2354 | 2132 | format |
| 2355 | 2133 | ( |
| 2356 | 2134 | List(Text_Option) l |
| 2357 | 2135 | ). |
| 2358 | - | |
| 2359 | - | |
| 2360 | - | |
| 2361 | - | |
| 2362 | -define Printable_tree | |
| 2136 | + | |
| 2137 | + define Printable_tree | |
| 2363 | 2138 | format_css_styles |
| 2364 | 2139 | ( |
| 2365 | 2140 | List(CSS_Style) l |
| ... | ... | @@ -2392,14 +2167,7 @@ public define HTML_Meta |
| 2392 | 2167 | )= |
| 2393 | 2168 | refresh(connection, target, action_name(action), delay) |
| 2394 | 2169 | . |
| 2395 | - | |
| 2396 | - | |
| 2397 | - | |
| 2398 | - | |
| 2399 | - | |
| 2400 | - | |
| 2401 | - | |
| 2402 | - | |
| 2170 | + | |
| 2403 | 2171 | public define HTTP_Answer |
| 2404 | 2172 | html_page |
| 2405 | 2173 | ( |
| ... | ... | @@ -2407,17 +2175,7 @@ public define HTTP_Answer |
| 2407 | 2175 | List(HTML_Head_Tag) head_tags, |
| 2408 | 2176 | HTML_Body body |
| 2409 | 2177 | )= |
| 2410 | - html_page(http_ok, title, head_tags,[],[],[],[],body). | |
| 2411 | - | |
| 2412 | -public define HTTP_Answer | |
| 2413 | - html_page | |
| 2414 | - ( | |
| 2415 | - String title, | |
| 2416 | - List(HTML_Head_Tag) head_tags, | |
| 2417 | - List(CSS_Style) styles, | |
| 2418 | - HTML_Body body | |
| 2419 | - )= | |
| 2420 | - html_page(http_ok, title, head_tags, styles, [], [], [], body). | |
| 2178 | + html_page(http_ok, title, head_tags,[],[],[],body). | |
| 2421 | 2179 | |
| 2422 | 2180 | public define HTTP_Answer |
| 2423 | 2181 | web_controller_error_page |
| ... | ... | @@ -2465,11 +2223,11 @@ public define HTTP_Answer |
| 2465 | 2223 | Anubis in order to forbid non meaningful placement of elements. |
| 2466 | 2224 | |
| 2467 | 2225 | The type 'HTML_In_Form' defines elements to be put within forms. Similarly, |
| 2468 | - 'HTML_Off_Form' defines elements not to be put within forms. Both types are recursive, | |
| 2469 | - and 'HTML_Off_Form' refers to 'HTML_In_Form' (via the 'form' alternative, of course), | |
| 2226 | + 'HTML' defines elements not to be put within forms. Both types are recursive, | |
| 2227 | + and 'HTML' refers to 'HTML_In_Form' (via the 'form' alternative, of course), | |
| 2470 | 2228 | but the two types are not cross recursive. This is the reason why it is impossible to |
| 2471 | 2229 | put a form within a form. In order to construct a web page, you essentially have to |
| 2472 | - produce a datum of type 'HTML_Off_Form' (maybe containing data of type 'HTML_In_Form'). | |
| 2230 | + produce a datum of type 'HTML' (maybe containing data of type 'HTML_In_Form'). | |
| 2473 | 2231 | |
| 2474 | 2232 | In practice, you don't have to worry so much about these two types, because elements |
| 2475 | 2233 | which may be put anywhere are constructed for both types by functions with the same |
| ... | ... | @@ -2492,7 +2250,7 @@ public define HTTP_Answer |
| 2492 | 2250 | |
| 2493 | 2251 | define RGB text_color = rgb(10,40,40). |
| 2494 | 2252 | |
| 2495 | - define HTML_Off_Form | |
| 2253 | + define HTML | |
| 2496 | 2254 | text |
| 2497 | 2255 | ( |
| 2498 | 2256 | String the_text |
| ... | ... | @@ -2510,7 +2268,7 @@ public define HTTP_Answer |
| 2510 | 2268 | convenience functions. This also suggests a trick. You may want for example different |
| 2511 | 2269 | colors for 'in form' texts and 'off form' texts. This may be achieved automatically by |
| 2512 | 2270 | defining two functions as above, with the same name and same argument type, but |
| 2513 | - returning either a 'HTML_In_Form' or a 'HTML_Off_Form'. | |
| 2271 | + returning either a 'HTML_In_Form' or a 'HTML'. | |
| 2514 | 2272 | |
| 2515 | 2273 | If this preliminary work is well done, you will not waste your time later when you |
| 2516 | 2274 | concentrate on the actual informational content of your pages. |
| ... | ... | @@ -2646,7 +2404,7 @@ define Printable_tree |
| 2646 | 2404 | ( |
| 2647 | 2405 | CommonInfo cinfo, |
| 2648 | 2406 | Var(Int) ic_v, // 'idnum' counter variable |
| 2649 | - HTML_Off_Form element, | |
| 2407 | + HTML element, | |
| 2650 | 2408 | Bool is_https, |
| 2651 | 2409 | Var(Int) action_count, |
| 2652 | 2410 | Var(List(HTML_Head_Tag)) head_tags |
| ... | ... | @@ -2851,10 +2609,6 @@ define One |
| 2851 | 2609 | |
| 2852 | 2610 | The above loop must be run in a separate virtual machine. This will be done just after |
| 2853 | 2611 | the two servers are started. |
| 2854 | - | |
| 2855 | - | |
| 2856 | - | |
| 2857 | - | |
| 2858 | 2612 | |
| 2859 | 2613 | *** [2] Tools. |
| 2860 | 2614 | |
| ... | ... | @@ -3315,7 +3069,7 @@ public define Web_Site |
| 3315 | 3069 | |
| 3316 | 3070 | |
| 3317 | 3071 | public define JsonValue to_html_ajax_content(Printable_tree content_HTML, String additional_script). |
| 3318 | -public define JsonValue to_html_ajax_content(HTML_Partial_Content content_HTML, CommonInfo cinfo, String additional_script). | |
| 3072 | +public define JsonValue to_html_ajax_content(HTML content_HTML, CommonInfo cinfo, String additional_script). | |
| 3319 | 3073 | |
| 3320 | 3074 | |
| 3321 | 3075 | |
| ... | ... | @@ -3492,20 +3246,16 @@ public define One |
| 3492 | 3246 | *** [5.1] The type 'HTML_Any($T)'. |
| 3493 | 3247 | |
| 3494 | 3248 | The type 'HTML_Any($T)' gathers elements which may be put anywhere in the page. The |
| 3495 | - parameter $T becomes either 'HTML_Off_Form' or 'HTML_In_Form'. | |
| 3249 | + parameter $T becomes either 'HTML' or 'HTML_In_Form'. | |
| 3496 | 3250 | |
| 3497 | -type HTML_Any($T): | |
| 3251 | + type HTML_Any($T): | |
| 3498 | 3252 | any_text (List(CoreAttrs), String the_text), |
| 3499 | - any_preformated (List(Text_Option), String), | |
| 3500 | - any_paragraph (List(Text_Option), List($T) content), | |
| 3501 | - any_image (List(CoreAttrs), String url, String alternate), | |
| 3502 | - any_image (List(CoreAttrs), String url, String alternate, Int width, Int height), | |
| 3503 | - any_table (List(Table_Option), HTML_Header_Row($T), List(HTML_Row($T)), HTML_Footer_Row($T)), | |
| 3504 | - any_center ($T), | |
| 3505 | - any_mail_to (String email, $T element), | |
| 3506 | - any_scroller (Int width, Int height, | |
| 3507 | - Int content_width, Int content_height, | |
| 3508 | - $T content), | |
| 3253 | + any_preformated (List(CoreAttrs), String), | |
| 3254 | + any_paragraph (List(CoreAttrs), List($T) content), | |
| 3255 | + //any_image (List(CoreAttrs), String url, String alternate), | |
| 3256 | + //any_image (List(CoreAttrs), String url, String alternate, Int width, Int height), | |
| 3257 | + //any_center ($T), | |
| 3258 | + //any_mail_to (String email, $T element), | |
| 3509 | 3259 | any_fixed_size (HTML_Size width, HTML_Size height, $T content), |
| 3510 | 3260 | any_fixed_size_2 (HTML_Size width, HTML_Size height, String name_of_HTML_file), |
| 3511 | 3261 | any_actioner (Actioner_Connection, |
| ... | ... | @@ -3516,8 +3266,8 @@ type HTML_Any($T): |
| 3516 | 3266 | List(Actioner_Local_Action), |
| 3517 | 3267 | Maybe(String) form_name), |
| 3518 | 3268 | any_foreign_link_new (Actioner_Target, Actioner_Aspect, String url), |
| 3519 | - any_foreign_link (List(Text_Option), String url), | |
| 3520 | - any_foreign_link (List(Text_Option), String url, String name), | |
| 3269 | + any_foreign_link (List(CoreAttrs), String url), | |
| 3270 | + any_foreign_link (List(CoreAttrs), String url, String name), | |
| 3521 | 3271 | any_private_download (String abs_path, String name, String extra_ext, |
| 3522 | 3272 | Maybe((String,List((String,String))))), |
| 3523 | 3273 | any_div (List(CoreAttrs), List($T) element), |
| ... | ... | @@ -3592,11 +3342,7 @@ define RGBA |
| 3592 | 3342 | |
| 3593 | 3343 | &oname=value |
| 3594 | 3344 | |
| 3595 | -public define String | |
| 3596 | - format_attrs | |
| 3597 | - ( | |
| 3598 | - List(CoreAttrs) attributs | |
| 3599 | - ). | |
| 3345 | + | |
| 3600 | 3346 | |
| 3601 | 3347 | //public define String |
| 3602 | 3348 | // format_extra_operands |
| ... | ... | @@ -3636,65 +3382,7 @@ define String |
| 3636 | 3382 | |
| 3637 | 3383 | |
| 3638 | 3384 | |
| 3639 | - Formating choices for a <select> tag. | |
| 3640 | - | |
| 3641 | -public define Printable_tree | |
| 3642 | - format_choices | |
| 3643 | - ( | |
| 3644 | - List(String) l | |
| 3645 | - ) = | |
| 3646 | - if l is | |
| 3647 | - { | |
| 3648 | - [ ] then [ ], | |
| 3649 | - [h . t] then ["<option>", h, "</option>\n" . format_choices(t)] | |
| 3650 | - }. | |
| 3651 | - | |
| 3652 | - | |
| 3653 | -public define Printable_tree | |
| 3654 | - format_choices | |
| 3655 | - ( | |
| 3656 | - List(String) l, | |
| 3657 | - InitialValue selected | |
| 3658 | - ) = | |
| 3659 | - if l is | |
| 3660 | - { | |
| 3661 | - [ ] then [ ], | |
| 3662 | - [h . t] then if h = selected.value | |
| 3663 | - then ["<option selected=\"selected\">", h, "</option>\n" . format_choices(t)] | |
| 3664 | - else ["<option>", h, "</option>\n" . format_choices(t,selected)] | |
| 3665 | - }. | |
| 3666 | - | |
| 3667 | - | |
| 3668 | -public define Printable_tree | |
| 3669 | - format_choices | |
| 3670 | - ( | |
| 3671 | - List((List(CoreAttrs),WebArgValue,String)) l | |
| 3672 | - ) = | |
| 3673 | - if l is | |
| 3674 | - { | |
| 3675 | - [ ] then [ ], | |
| 3676 | - [h . t] then | |
| 3677 | - if h is (attrs,val,item) | |
| 3678 | - then ["<option value=\""+encode_HTML_entities(val.value)+"\" "+format_attrs(attrs)+">", item, "</option>\n" . format_choices(t)] | |
| 3679 | - }. | |
| 3680 | - | |
| 3681 | -public define Printable_tree | |
| 3682 | - format_choices | |
| 3683 | - ( | |
| 3684 | - List((List(CoreAttrs),WebArgValue,String)) l, | |
| 3685 | - InitialValue selected | |
| 3686 | - ) = | |
| 3687 | - if l is | |
| 3688 | - { | |
| 3689 | - [ ] then [ ], | |
| 3690 | - [h . t] then | |
| 3691 | - if h is (attrs,val,item) then | |
| 3692 | - if val.value = selected.value | |
| 3693 | - then ["<option value=\""+encode_HTML_entities(val.value)+"\" "+format_attrs(attrs)+" selected=\"selected\">", item, "</option>\n" . format_choices(t)] | |
| 3694 | - else ["<option value=\""+encode_HTML_entities(val.value)+"\" "+format_attrs(attrs)+" >", item, "</option>\n" . format_choices(t,selected)] | |
| 3695 | - }. | |
| 3696 | - | |
| 3697 | - | |
| 3385 | + | |
| 3698 | 3386 | |
| 3699 | 3387 | Note: this counter is private to the virtual machine, hence there is one counter by |
| 3700 | 3388 | client and by page : it seems that a new VM (simply a delegate) is started for each request. |
| ... | ... | @@ -3844,78 +3532,76 @@ define URL_or_JavaScript |
| 3844 | 3532 | |
| 3845 | 3533 | Now, we format the actioner according to its aspect. |
| 3846 | 3534 | |
| 3847 | -define List(Text_Option) | |
| 3848 | - get_text_options | |
| 3849 | - ( | |
| 3850 | - List(Text_Option) l | |
| 3851 | - ) | |
| 3852 | - = | |
| 3853 | - if l is | |
| 3854 | - { | |
| 3855 | - [] then [], | |
| 3856 | - [h . t ] then | |
| 3857 | - if h is class(_) then | |
| 3858 | - get_text_options(t) | |
| 3859 | - else if h is id(_) then | |
| 3860 | - get_text_options(t) | |
| 3861 | - else if h is style(_) then | |
| 3862 | - get_text_options(t) | |
| 3863 | - else if h is title(_) then | |
| 3864 | - get_text_options(t) | |
| 3865 | - else if h is core_attrs(_) then | |
| 3866 | - get_text_options(t) | |
| 3867 | - else | |
| 3868 | - [ h . get_text_options(t) ] | |
| 3869 | - | |
| 3870 | - }. | |
| 3871 | - | |
| 3535 | +//define List(Text_Option) | |
| 3536 | +// get_text_options | |
| 3537 | +// ( | |
| 3538 | +// List(Text_Option) l | |
| 3539 | +// ) | |
| 3540 | +// = | |
| 3541 | +// if l is | |
| 3542 | +// { | |
| 3543 | +// [] then [], | |
| 3544 | +// [h . t ] then | |
| 3545 | +// if h is class(_) then | |
| 3546 | +// get_text_options(t) | |
| 3547 | +// else if h is id(_) then | |
| 3548 | +// get_text_options(t) | |
| 3549 | +// else if h is style(_) then | |
| 3550 | +// get_text_options(t) | |
| 3551 | +// else if h is title(_) then | |
| 3552 | +// get_text_options(t) | |
| 3553 | +// else if h is core_attrs(_) then | |
| 3554 | +// get_text_options(t) | |
| 3555 | +// else | |
| 3556 | +// [ h . get_text_options(t) ] | |
| 3557 | +// | |
| 3558 | +// }. | |
| 3559 | +// | |
| 3872 | 3560 | /** |
| 3873 | 3561 | * Extract the CSS class list from the list of Text_Option |
| 3874 | 3562 | */ |
| 3875 | -define List(CoreAttrs) | |
| 3876 | - get_css_class | |
| 3877 | - ( | |
| 3878 | - List(Text_Option) l | |
| 3879 | - ) | |
| 3880 | - = | |
| 3881 | - if l is | |
| 3882 | - { | |
| 3883 | - [] then [], | |
| 3884 | - [h . t ] then | |
| 3885 | - | |
| 3886 | - | |
| 3887 | - if h is class(name) then | |
| 3888 | - [ class(name) . get_css_class(t) ] | |
| 3889 | - else if h is id(name) then | |
| 3890 | - [ id(name) . get_css_class(t) ] | |
| 3891 | - else if h is style(the_style) then | |
| 3892 | - [ style(the_style) . get_css_class(t) ] | |
| 3893 | - else if h is title(name) then | |
| 3894 | - [ tooltip(name) . get_css_class(t) ] | |
| 3895 | - else if h is attr(name, value) then | |
| 3896 | - [ attr(name, value) . get_css_class(t) ] | |
| 3897 | - else | |
| 3898 | - get_css_class(t) | |
| 3899 | - } | |
| 3900 | - . | |
| 3563 | +//define List(CoreAttrs) | |
| 3564 | +// get_css_class | |
| 3565 | +// ( | |
| 3566 | +// List(Text_Option) l | |
| 3567 | +// ) | |
| 3568 | +// = | |
| 3569 | +// if l is | |
| 3570 | +// { | |
| 3571 | +// [] then [], | |
| 3572 | +// [h . t ] then | |
| 3573 | +// if h is class(name) then | |
| 3574 | +// [ class(name) . get_css_class(t) ] | |
| 3575 | +// else if h is id(name) then | |
| 3576 | +// [ id(name) . get_css_class(t) ] | |
| 3577 | +// else if h is style(the_style) then | |
| 3578 | +// [ style(the_style) . get_css_class(t) ] | |
| 3579 | +// else if h is title(name) then | |
| 3580 | +// [ tooltip(name) . get_css_class(t) ] | |
| 3581 | +// else if h is attr(name, value) then | |
| 3582 | +// [ attr(name, value) . get_css_class(t) ] | |
| 3583 | +// else | |
| 3584 | +// get_css_class(t) | |
| 3585 | +// } | |
| 3586 | +//. | |
| 3901 | 3587 | |
| 3902 | 3588 | |
| 3903 | -define List(CoreAttrs) | |
| 3904 | - get_core_attrs | |
| 3905 | - ( | |
| 3906 | - List(Text_Option) l | |
| 3907 | - ) | |
| 3908 | - = | |
| 3909 | - if l is | |
| 3910 | - { | |
| 3911 | - [] then [], | |
| 3912 | - [h . t ] then | |
| 3913 | - if h is core_attrs(attrs) then | |
| 3914 | - attrs + get_core_attrs(t) | |
| 3915 | - else | |
| 3916 | - get_core_attrs(t) | |
| 3917 | - } | |
| 3918 | - . | |
| 3589 | +//define List(CoreAttrs) | |
| 3590 | +// get_core_attrs | |
| 3591 | +// ( | |
| 3592 | +// List(Text_Option) l | |
| 3593 | +// ) | |
| 3594 | +// = | |
| 3595 | +// if l is | |
| 3596 | +// { | |
| 3597 | +// [] then [], | |
| 3598 | +// [h . t ] then | |
| 3599 | +// if h is core_attrs(attrs) then | |
| 3600 | +// attrs + get_core_attrs(t) | |
| 3601 | +// else | |
| 3602 | +// get_core_attrs(t) | |
| 3603 | +// } | |
| 3604 | +// . | |
| 3919 | 3605 | |
| 3920 | 3606 | define Printable_tree |
| 3921 | 3607 | format |
| ... | ... | @@ -3933,54 +3619,54 @@ define Printable_tree |
| 3933 | 3619 | }. |
| 3934 | 3620 | |
| 3935 | 3621 | |
| 3936 | -define String | |
| 3937 | - format_attrs | |
| 3938 | - ( | |
| 3939 | - List(InputAttrs) attributs, | |
| 3940 | - List(String) classes, | |
| 3941 | - List(String) styles | |
| 3942 | - )= | |
| 3943 | - if attributs is | |
| 3944 | - { | |
| 3945 | - [] then | |
| 3946 | - if length(classes) = 0 then "" else " class=\""+join(" ",classes)+"\""+ | |
| 3947 | - if length(styles) = 0 then "" else " style=\""+join(";",styles)+"\"", | |
| 3948 | - [h . t] then | |
| 3949 | - with new_classes = if h is class(class_name) then [class_name. classes] else classes, | |
| 3950 | - new_styles = if h is style(style_string) then [style_string . styles] else styles, | |
| 3951 | - current = if h is | |
| 3952 | - { | |
| 3953 | - id(id_name) then | |
| 3954 | - " id=\"" + id_name + "\"", | |
| 3955 | - class(class_name) then "", | |
| 3956 | - style(style_string) then "", | |
| 3957 | - title(title_string) then | |
| 3958 | - " title=\"" + title_string + "\"", | |
| 3959 | - | |
| 3960 | - lang(lang) then | |
| 3961 | - " xml:lang=" + lang, | |
| 3962 | - dir(reading_Way) then | |
| 3963 | - if reading_Way is | |
| 3964 | - { | |
| 3965 | - ltr then " dir=ltr", | |
| 3966 | - rtl then " dir=rtl" | |
| 3967 | - }, | |
| 3968 | - | |
| 3969 | - accesskey(key) then | |
| 3970 | - " accesskey=\"" + key + "\"", | |
| 3971 | - tabindex(index) then | |
| 3972 | - " tabindex=\"" + index + "\"", | |
| 3973 | - | |
| 3974 | - attr(name, value) then | |
| 3975 | - " " + name + "=\"" + value + "\"", | |
| 3976 | - | |
| 3977 | - event(e, value) then | |
| 3978 | - " " + event_name(e) + "=\"" + value + "\"", | |
| 3979 | - data(name, value) then | |
| 3980 | - " data-" + to_lower(name) + "=\"" + value + "\"", | |
| 3981 | - }, | |
| 3982 | - current + format_attrs(t, classes, styles) | |
| 3983 | - }. | |
| 3622 | +//define String | |
| 3623 | +// format_attrs | |
| 3624 | +// ( | |
| 3625 | +// List(InputAttrs) attributs, | |
| 3626 | +// List(String) classes, | |
| 3627 | +// List(String) styles | |
| 3628 | +// )= | |
| 3629 | +// if attributs is | |
| 3630 | +// { | |
| 3631 | +// [] then | |
| 3632 | +// if length(classes) = 0 then "" else " class=\""+join(" ",classes)+"\""+ | |
| 3633 | +// if length(styles) = 0 then "" else " style=\""+join(";",styles)+"\"", | |
| 3634 | +// [h . t] then | |
| 3635 | +// with new_classes = if h is class(class_name) then [class_name. classes] else classes, | |
| 3636 | +// new_styles = if h is style(style_string) then [style_string . styles] else styles, | |
| 3637 | +// current = if h is | |
| 3638 | +// { | |
| 3639 | +// id(id_name) then | |
| 3640 | +// " id=\"" + id_name + "\"", | |
| 3641 | +// class(class_name) then "", | |
| 3642 | +// style(style_string) then "", | |
| 3643 | +// title(title_string) then | |
| 3644 | +// " title=\"" + title_string + "\"", | |
| 3645 | +// | |
| 3646 | +// lang(lang) then | |
| 3647 | +// " xml:lang=" + lang, | |
| 3648 | +// dir(reading_Way) then | |
| 3649 | +// if reading_Way is | |
| 3650 | +// { | |
| 3651 | +// ltr then " dir=ltr", | |
| 3652 | +// rtl then " dir=rtl" | |
| 3653 | +// }, | |
| 3654 | +// | |
| 3655 | +// accesskey(key) then | |
| 3656 | +// " accesskey=\"" + key + "\"", | |
| 3657 | +// tabindex(index) then | |
| 3658 | +// " tabindex=\"" + index + "\"", | |
| 3659 | +// | |
| 3660 | +// attr(name, value) then | |
| 3661 | +// " " + name + "=\"" + value + "\"", | |
| 3662 | +// | |
| 3663 | +// event(e, value) then | |
| 3664 | +// " " + event_name(e) + "=\"" + value + "\"", | |
| 3665 | +// data(name, value) then | |
| 3666 | +// " data-" + to_lower(name) + "=\"" + value + "\"", | |
| 3667 | +// }, | |
| 3668 | +// current + format_attrs(t, classes, styles) | |
| 3669 | +// }. | |
| 3984 | 3670 | |
| 3985 | 3671 | public define List(CoreAttrs) extract_attributes(HTML_tooltip htt). |
| 3986 | 3672 | |
| ... | ... | @@ -4068,33 +3754,13 @@ define String |
| 4068 | 3754 | current + format_attrs(t + new_attrs, new_classes, new_styles) |
| 4069 | 3755 | }. |
| 4070 | 3756 | |
| 4071 | -define String | |
| 4072 | - format_attrs | |
| 4073 | - ( | |
| 4074 | - List(InputAttrs) attributs | |
| 4075 | - )= | |
| 4076 | - format_attrs(attributs, [], []). | |
| 4077 | - | |
| 4078 | 3757 | public define String |
| 4079 | 3758 | format_attrs |
| 4080 | 3759 | ( |
| 4081 | 3760 | List(CoreAttrs) attributs |
| 4082 | - )= | |
| 4083 | - format_attrs(attributs, [], []). | |
| 4084 | - | |
| 4085 | -define String | |
| 4086 | - format_text_options | |
| 4087 | - ( | |
| 4088 | - List(Text_Option) l | |
| 4089 | - ) | |
| 4090 | - = | |
| 4091 | - with text_options = get_text_options(l), | |
| 4092 | - core_attrs = get_css_class(l) + get_core_attrs(l), | |
| 4093 | - (if length(text_options)= 0 then "" else " style=\"" + format(text_options) + "\" ") | |
| 4094 | - + | |
| 4095 | - (if length(core_attrs) = 0 then "" else format_attrs(core_attrs)) | |
| 4096 | - . | |
| 4097 | - | |
| 3761 | + )= | |
| 3762 | + format_attrs(attributs, [], []). | |
| 3763 | + | |
| 4098 | 3764 | define Printable_tree |
| 4099 | 3765 | format_div_option |
| 4100 | 3766 | ( |
| ... | ... | @@ -4166,7 +3832,7 @@ define Printable_tree |
| 4166 | 3832 | link(opt, text, mb_name) then |
| 4167 | 3833 | with name_tag = if mb_name is success(n) then " name=\"" + n + "\"" else "", |
| 4168 | 3834 | [ |
| 4169 | - "<a href=\"", full_url, "\"", format_text_options(opt), name_tag, ">", | |
| 3835 | + "<a href=\"", full_url, "\"", format_attrs(opt), name_tag, ">", | |
| 4170 | 3836 | text, |
| 4171 | 3837 | "</a>" |
| 4172 | 3838 | ], |
| ... | ... | @@ -4192,10 +3858,10 @@ define Printable_tree |
| 4192 | 3858 | // [ ], |
| 4193 | 3859 | immediate_selector(opt,name,size,choices,selected,function) then |
| 4194 | 3860 | [ ], |
| 4195 | - html(options, html_off_form) then | |
| 3861 | + html(options, html) then | |
| 4196 | 3862 | [ |
| 4197 | 3863 | "<a href=\"", full_url,"\"", format_attrs(options), ">", |
| 4198 | - format(cinfo, ic_v, html_off_form, is_https, action_count, head_tags), | |
| 3864 | + format(cinfo, ic_v, html, is_https, action_count, head_tags), | |
| 4199 | 3865 | "</a>" |
| 4200 | 3866 | ] |
| 4201 | 3867 | }. |
| ... | ... | @@ -4234,10 +3900,10 @@ define Printable_tree |
| 4234 | 3900 | url(_) then "" |
| 4235 | 3901 | }, |
| 4236 | 3902 | if action_name = "" then |
| 4237 | - ["<a ", format_text_options(opt), name_tag, ">", text, "</a>" ] | |
| 3903 | + ["<a ", format_attrs(opt), name_tag, ">", text, "</a>" ] | |
| 4238 | 3904 | else |
| 4239 | 3905 | ["<a href=\"",url,"\"", |
| 4240 | - format_text_options(opt), name_tag, ">", | |
| 3906 | + format_attrs(opt), name_tag, ">", | |
| 4241 | 3907 | text, |
| 4242 | 3908 | "</a>" |
| 4243 | 3909 | ], |
| ... | ... | @@ -4329,15 +3995,6 @@ define Printable_tree |
| 4329 | 3995 | } |
| 4330 | 3996 | ], |
| 4331 | 3997 | |
| 4332 | -// immediate_selector(options,name,size,choices) then | |
| 4333 | -// [ if action is | |
| 4334 | -// { | |
| 4335 | -// url(u) then ["<select href=\"",u] | |
| 4336 | -// javascript(s,h) then [s,"<select onchange=\"",h] | |
| 4337 | -// }, | |
| 4338 | -// "\" name=\"",name,"\" size=\"",size,"\"", format_attrs(options), ">", | |
| 4339 | -// format_choices(choices),"</select>" | |
| 4340 | -// ], | |
| 4341 | 3998 | immediate_selector(options, name, size, choices, mb_selected, custom_function_name) then |
| 4342 | 3999 | [ |
| 4343 | 4000 | //if custom function name is provided, that name is used instead of autogenerated js function |
| ... | ... | @@ -4353,10 +4010,10 @@ define Printable_tree |
| 4353 | 4010 | "\" name=\"",name,"\" size=\"",size,"\"", format_attrs(options), ">", |
| 4354 | 4011 | if mb_selected is success(selected) then format_choices(choices, selected) else format_choices(choices),"</select>" |
| 4355 | 4012 | ], |
| 4356 | - html(options, html_off_form) then | |
| 4013 | + html(options, html) then | |
| 4357 | 4014 | [ |
| 4358 | 4015 | "<a href=\"", url,"\"", format_attrs(options), ">", |
| 4359 | - format(cinfo, ic_v, html_off_form, is_https, action_count, head_tags), | |
| 4016 | + format(cinfo, ic_v, html, is_https, action_count, head_tags), | |
| 4360 | 4017 | "</a>" |
| 4361 | 4018 | ] |
| 4362 | 4019 | }. |
| ... | ... | @@ -4401,283 +4058,14 @@ define Printable_tree |
| 4401 | 4058 | |
| 4402 | 4059 | *** [5.6] Formating rows and cells in a table. |
| 4403 | 4060 | |
| 4404 | -define Int | |
| 4405 | - percent | |
| 4406 | - ( | |
| 4407 | - Int p | |
| 4408 | - ) = | |
| 4409 | - if p < 0 then 0 else if p > 100 then 100 else p. | |
| 4410 | - | |
| 4411 | - | |
| 4412 | - | |
| 4413 | - | |
| 4414 | - Formating cell options. | |
| 4415 | - | |
| 4416 | - | |
| 4417 | - | |
| 4418 | -define String | |
| 4419 | - format | |
| 4420 | - ( | |
| 4421 | - BackgroundOption o | |
| 4422 | - ) = | |
| 4423 | - if o is | |
| 4424 | - { | |
| 4425 | - repeat then "", | |
| 4426 | - repeat_horizontal then "; background-repeat: repeat-x", | |
| 4427 | - repeat_vertical then "; background-repeat: repeat-y", | |
| 4428 | - no_repeat then "; background-repeat: no-repeat", | |
| 4429 | - center then "; background-position: center top" | |
| 4430 | - }. | |
| 4431 | - | |
| 4432 | -define String | |
| 4433 | - format | |
| 4434 | - ( | |
| 4435 | - List(BackgroundOption) l | |
| 4436 | - ) = | |
| 4437 | - if l is | |
| 4438 | - { | |
| 4439 | - [ ] then "", | |
| 4440 | - [h . t] then format(h)+format(t) | |
| 4441 | - }. | |
| 4442 | - | |
| 4443 | - | |
| 4444 | -define String | |
| 4445 | - format | |
| 4446 | - ( | |
| 4447 | - List(Cell_Option) options | |
| 4448 | - ) = | |
| 4449 | - if options is | |
| 4450 | - { | |
| 4451 | - [ ] then "", | |
| 4452 | - [h . t] then | |
| 4453 | - if h is | |
| 4454 | - { | |
| 4455 | - core_attrs(core_attr_list) then format_attrs(core_attr_list), | |
| 4456 | - left then " align=\"left\"", | |
| 4457 | - h_center then " align=\"center\"", | |
| 4458 | - right then " align=\"right\"", | |
| 4459 | - top then " valign=\"top\"", | |
| 4460 | - v_center then " valign=\"middle\"", | |
| 4461 | - bottom then " valign=\"bottom\"", | |
| 4462 | - base_line then " valign=\"baseline\"", | |
| 4463 | - background_color(c) then " bgcolor=\""+html_format(c)+"\"", | |
| 4464 | - background_image(n,o) then " style=\"background: url("+n+")"+format(o)+"\"", | |
| 4465 | - width(w) then " width=\""+w+"\"", | |
| 4466 | - percentage_width(n) then " width=\""+percent(n)+"%\"", | |
| 4467 | - height(h2) then " height=\""+h2+"\"", | |
| 4468 | - columns(n) then " colspan=\""+n+"\"", | |
| 4469 | - rows(n) then " rowspan=\""+n+"\"", | |
| 4470 | - nowrap then " nowrap", | |
| 4471 | - style(style_string) then " style=\"" + style_string + "\"", | |
| 4472 | - class(class_name) then " class=\""+class_name+"\"" | |
| 4473 | - } | |
| 4474 | - + format(t) | |
| 4475 | - }. | |
| 4476 | - | |
| 4477 | - | |
| 4478 | - Normalizing a list of cell options (horizontal position must be specified; the default | |
| 4479 | - is 'left'). | |
| 4480 | - | |
| 4481 | - Formating cells in a row. | |
| 4482 | - | |
| 4483 | -define Printable_tree | |
| 4484 | - format | |
| 4485 | - ( | |
| 4486 | - List(HTML_Cell($T)) cells, | |
| 4487 | - $T -> Printable_tree format_element | |
| 4488 | - ) = | |
| 4489 | - if cells is | |
| 4490 | - { | |
| 4491 | - [ ] then [ ], | |
| 4492 | - [h . t] then if h is cell(options,element) then | |
| 4493 | - ["<td",format(reverse(options)),">", | |
| 4494 | - format_element(element), | |
| 4495 | - "</td>" | |
| 4496 | - . format(t,format_element)] | |
| 4497 | - }. | |
| 4498 | - | |
| 4499 | -define Printable_tree | |
| 4500 | - format | |
| 4501 | - ( | |
| 4502 | - List(HTML_Header_Cell($T)) cells, | |
| 4503 | - $T -> Printable_tree format_element | |
| 4504 | - ) = | |
| 4505 | - if cells is | |
| 4506 | - { | |
| 4507 | - [ ] then [ ], | |
| 4508 | - [h . t] then if h is header_cell(options,element) then | |
| 4509 | - ["<th ",format(reverse(options)),">", | |
| 4510 | - format_element(element), | |
| 4511 | - "</th>" | |
| 4512 | - . format(t,format_element)] | |
| 4513 | - }. | |
| 4514 | - | |
| 4515 | - Formating the rows in a table. | |
| 4516 | - | |
| 4517 | -define Printable_tree | |
| 4518 | - format | |
| 4519 | - ( | |
| 4520 | - List(HTML_Row($T)) rows, | |
| 4521 | - $T -> Printable_tree format_element, | |
| 4522 | - )= | |
| 4523 | - if rows is | |
| 4524 | - { | |
| 4525 | - [ ] then [ ], | |
| 4526 | - [h . t] then | |
| 4527 | - if h is | |
| 4528 | - { | |
| 4529 | - empty then format(t, format_element), | |
| 4530 | - row(options, cells) then | |
| 4531 | - ["<tr",format(reverse(options)),">", format(cells, format_element), "</tr>\n" | |
| 4532 | - . format(t, format_element)] | |
| 4533 | - } | |
| 4534 | - } | |
| 4535 | -. | |
| 4536 | - | |
| 4537 | -define Printable_tree | |
| 4538 | - format | |
| 4539 | - ( | |
| 4540 | - HTML_Header_Row($T) row, | |
| 4541 | - $T -> Printable_tree format_element | |
| 4542 | - ) = | |
| 4543 | - if row is | |
| 4544 | - { | |
| 4545 | - empty then [ ], | |
| 4546 | - header_row(options,cells) then | |
| 4547 | - ["<thead> <tr",format(reverse(options)),">", | |
| 4548 | - format(cells,format_element), | |
| 4549 | - "</tr> </thead>\n" | |
| 4550 | - ] | |
| 4551 | - }. | |
| 4552 | - | |
| 4553 | -define Printable_tree | |
| 4554 | - format | |
| 4555 | - ( | |
| 4556 | - HTML_Footer_Row($T) row, | |
| 4557 | - $T -> Printable_tree format_element | |
| 4558 | - ) = | |
| 4559 | - if row is | |
| 4560 | - { | |
| 4561 | - empty then [ ], | |
| 4562 | - footer_row(options,cells) then | |
| 4563 | - ["<tfoot> <tr",format(reverse(options)),">", | |
| 4564 | - format(cells,format_element), | |
| 4565 | - "</tr> </tfoot>\n" | |
| 4566 | - ] | |
| 4567 | - }. | |
| 4568 | - | |
| 4569 | -define Printable_tree | |
| 4570 | - format1 | |
| 4571 | - ( | |
| 4572 | - List(TextAreaOption) l | |
| 4573 | - ) = | |
| 4574 | - if l is | |
| 4575 | - { | |
| 4576 | - [] then [], | |
| 4577 | - [h . t] then if h is | |
| 4578 | - { | |
| 4579 | - input_attrs(input_attr_list) then [format_attrs(input_attr_list) . format1(t)], | |
| 4580 | - disabled then [" disabled=\"disabled\" " . format1(t)] | |
| 4581 | - read_only then [" readonly=\"readonly\" " . format1(t)] | |
| 4582 | - wrap_lines then [" wrap=\"wrap\" " . format1(t)] | |
| 4583 | - } | |
| 4584 | - }. | |
| 4585 | - | |
| 4586 | -define Printable_tree | |
| 4587 | - format | |
| 4588 | - ( | |
| 4589 | - List(TextAreaOption) l | |
| 4590 | - )= | |
| 4591 | - if member(l, wrap_lines) then | |
| 4592 | - format1(l) | |
| 4593 | - else | |
| 4594 | - [" wrap=\"off\" " . format1(l)] | |
| 4595 | -. | |
| 4596 | - | |
| 4597 | - | |
| 4598 | - *** [5.7] Formating elements which may be put anywhere. | |
| 4599 | - | |
| 4600 | - The function below involves the parameter $T which is later instantiated as | |
| 4601 | - 'HTML_In_Form' or as 'HTML_Off_Form'. Now, since there are dictinct 'format' functions | |
| 4602 | - for these two types, and because formating of tables requires recursive calls of such | |
| 4603 | - functions, it is necessary to provide the 'format' function to be called recursively as | |
| 4604 | - an argument. Putting naively a call to 'format' will not work, because the compiler | |
| 4605 | - will look for a function able to format data of type $T (which is at that time distinct | |
| 4606 | - from any other type, including our two types). Such a function does not exist. Hence | |
| 4607 | - the function to be called for formating elements must be passed as a functional | |
| 4608 | - argument (called 'format_element' below). Actually, what we pass is a function taking | |
| 4609 | - a unique argument of type $T. Other informations (like the name of the state) are | |
| 4610 | - already in the function by way of full functionality. | |
| 4611 | - | |
| 4612 | - | |
| 4613 | - Formating text options. They are formated in CSS syntax, to be used within a | |
| 4614 | - 'style=...'. | |
| 4615 | - | |
| 4616 | -define String | |
| 4617 | - format | |
| 4618 | - ( | |
| 4619 | - List(Text_Option) l | |
| 4620 | - ) = | |
| 4621 | - if l is | |
| 4622 | - { | |
| 4623 | - [ ] then "", | |
| 4624 | - [h . t] then if h is | |
| 4625 | - { | |
| 4626 | - core_attrs(core_attr_list) then format_attrs(core_attr_list), | |
| 4627 | - size(n) then "font-size:"+n+"pt", | |
| 4628 | - font(fn) then "font-family:"+fn, | |
| 4629 | - color(c) then if c is rgb(r,g,b) then | |
| 4630 | - "color:rgb("+to_decimal(r)+","+to_decimal(g)+","+to_decimal(b)+")", | |
| 4631 | - italic then "font-style:italic", | |
| 4632 | - oblique then "font-style:oblique", | |
| 4633 | - small_capitals then "font-variant:small-caps", | |
| 4634 | - bold then "font-weight:bold", | |
| 4635 | - underlined then "text-decoration:underline", | |
| 4636 | - left_justified then "text-align:left", | |
| 4637 | - right_justified then "text-align:right", | |
| 4638 | - justified then "text-align:justify", | |
| 4639 | - line_through then "text-decoration:line-through", | |
| 4640 | - nowrap then "white-space:nowrap", | |
| 4641 | - class(class_name)then " class=\"" + class_name +"\"", | |
| 4642 | - id(id_name) then " id=\"" + id_name +"\"", | |
| 4643 | - style(style_string) then " style=\"" + style_string + "\"", | |
| 4644 | - title(s) then " title=\"" + s +"\"" | |
| 4645 | - attr(n,v) then " " + n + "=\"" + v +"\"" | |
| 4646 | - } + if t is [ ] then "" else ("; "+format(t)) | |
| 4647 | - }. | |
| 4648 | - | |
| 4649 | - | |
| 4650 | - | |
| 4651 | - Formating table options. | |
| 4652 | - | |
| 4653 | -define String | |
| 4654 | - format | |
| 4655 | - ( | |
| 4656 | - List(Table_Option) l, | |
| 4657 | - Bool border_seen | |
| 4658 | - ) = | |
| 4659 | - if l is | |
| 4660 | - { | |
| 4661 | - [ ] then if border_seen then "" else " border=\"0\" cellspacing=\"0\" cellpadding=\"0\"", | |
| 4662 | - [h . t] then if h is | |
| 4663 | - { | |
| 4664 | - core_attrs(core_attr_list) then format_attrs(core_attr_list), | |
| 4665 | - background_color(c) then " bgcolor=\""+html_format(c)+"\""+format(t,border_seen), | |
| 4666 | - background_image(url) then " background="+url+format(t,border_seen), | |
| 4667 | - border(o,top,i,c) then " border=\""+o+"\" cellspacing=\""+top+"\" cellpadding=\""+i+"\""+ | |
| 4668 | - //" bordercolor="+format(c)+ | |
| 4669 | - format(t,true), | |
| 4670 | - width(w) then " width=\""+w+"\""+format(t,border_seen), | |
| 4671 | - percentage_width(p) then " width=\""+percent(p)+"%\""+format(t,border_seen), | |
| 4672 | - attr(name, value) then " " + name + "=\"" + value + "\"" +format(t,border_seen), | |
| 4673 | - class(name) then " class=\""+name+"\"" | |
| 4674 | - } | |
| 4675 | - }. | |
| 4676 | - | |
| 4677 | - | |
| 4678 | - | |
| 4679 | - | |
| 4061 | +//define Int | |
| 4062 | +// percent | |
| 4063 | +// ( | |
| 4064 | +// Int p | |
| 4065 | +// ) = | |
| 4066 | +// if p < 0 then 0 else if p > 100 then 100 else p. | |
| 4680 | 4067 | |
| 4068 | + | |
| 4681 | 4069 | define Printable_tree |
| 4682 | 4070 | format_scroller |
| 4683 | 4071 | ( |
| ... | ... | @@ -4766,7 +4154,7 @@ define Printable_tree |
| 4766 | 4154 | }. |
| 4767 | 4155 | |
| 4768 | 4156 | |
| 4769 | -define Printable_tree | |
| 4157 | + define Printable_tree | |
| 4770 | 4158 | add_css_styles |
| 4771 | 4159 | ( |
| 4772 | 4160 | List(CSS_Style) css_styles |
| ... | ... | @@ -4784,7 +4172,7 @@ define Printable_tree |
| 4784 | 4172 | |
| 4785 | 4173 | // The function below formats a datum of type 'HTML_Any($T)'. |
| 4786 | 4174 | |
| 4787 | -define Printable_tree | |
| 4175 | + define Printable_tree | |
| 4788 | 4176 | format |
| 4789 | 4177 | ( |
| 4790 | 4178 | CommonInfo cinfo, |
| ... | ... | @@ -4798,55 +4186,14 @@ define Printable_tree |
| 4798 | 4186 | if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
| 4799 | 4187 | if element is |
| 4800 | 4188 | { |
| 4801 | - any_text(opts , t) then | |
| 4802 | - if opts is | |
| 4803 | - { | |
| 4804 | - [] then [t], | |
| 4805 | - [_ . _] then ["<span", format_attrs(opts), ">",t,"</span>"] | |
| 4806 | - }, | |
| 4807 | - any_preformated(opts,s) then | |
| 4808 | - ["<span", format_text_options(opts), "><pre>",s,"</pre></span>"], | |
| 4809 | - //["<pre>",s,"</pre>"], | |
| 4810 | - any_paragraph(opts,l) then | |
| 4811 | - ["<p", format_text_options(opts), ">", flat(map(($T e) |-> format_element(e), l)),"</p>\n"], | |
| 4812 | - any_image(opts, url, _alt) then | |
| 4813 | - with alt = if _alt = "" then "" else "alt=\""+_alt+"\"", | |
| 4814 | - ["<img ",alt," src=\"",url,"\" ", format_attrs(opts)," />"], | |
| 4815 | - any_image(opts, url, alt, w, h) then | |
| 4816 | - ["<img alt=\"",alt,"\" src=\"",url,"\" width=\"",w,"\" height=\"",h,"\" ", format_attrs(opts)," />"], | |
| 4817 | - any_table(opts,h_row, rows, f_row) then | |
| 4818 | - ["<table",format(reverse(opts),false),">", | |
| 4819 | - format(h_row, format_element), | |
| 4820 | - "<tbody>",format(rows,format_element),"</tbody>", | |
| 4821 | - format(f_row, format_element), | |
| 4822 | - "</table>\n"], | |
| 4823 | - any_center(e) then | |
| 4824 | - ["<center>",format_element(e),"</center>"], | |
| 4825 | - any_mail_to(email,elem) then | |
| 4826 | - ["<a href=\"mailto:",email,"\">",format_element(elem),"</a>"], | |
| 4827 | - any_scroller(w,h,cw,ch,c) then | |
| 4828 | - format_scroller(w,h,cw,ch,new_idnum(ic_v),c,format_element), | |
| 4829 | - any_fixed_size(w,h,c) then | |
| 4830 | - with url = create_secondary_document(site_directory,secret,format_element,c,w), | |
| 4831 | - ["<object data=\"",url,"\" type=\"text/html\" width=\"",format(w),"\" height=\"",format(h),"\" >", | |
| 4832 | - "secondary document", | |
| 4833 | - "</object>"], | |
| 4834 | - any_fixed_size_2(w,h,fn) then | |
| 4835 | - with url = fn+"?zauth="+make_authorization(site_directory,secret, | |
| 4836 | - fn), | |
| 4837 | - ["<object data=\"",url,"\" type=\"text/html\" width=\"",format(w),"\" height=\"",format(h),"\" >", | |
| 4838 | - "secondary document", | |
| 4839 | - "</object>"], | |
| 4840 | - any_actioner(c,t,a,an,eo,ja,fn) then | |
| 4841 | - format_actioner(cinfo,c,t,a,an,eo,ja,fn,is_https, action_count, ic_v, head_tags), | |
| 4842 | 4189 | |
| 4843 | 4190 | any_foreign_link_new(target, aspect, url) then |
| 4844 | 4191 | format_foreign_link(target, aspect, url, is_https, cinfo, action_count, ic_v, head_tags), |
| 4845 | 4192 | |
| 4846 | 4193 | any_foreign_link(options,url) then |
| 4847 | - ["<a href=\"",url,"\" ", format_text_options(options), "></a>"], // IE7 doesn't support the form <a href="..." /> | |
| 4194 | + ["<a href=\"",url,"\" ", format_attrs(options), "></a>"], // IE7 doesn't support the form <a href="..." /> | |
| 4848 | 4195 | any_foreign_link(options,url,name) then |
| 4849 | - ["<a href=\"",url,"\"><span ", format_text_options(options), ">",name,"</span></a>"], | |
| 4196 | + ["<a href=\"",url,"\"><span ", format_attrs(options), ">",name,"</span></a>"], | |
| 4850 | 4197 | any_private_download(url,name,extra_ext,action) then |
| 4851 | 4198 | format_private_download(cinfo,url,name,extra_ext,action), |
| 4852 | 4199 | any_div(options, l) then |
| ... | ... | @@ -4879,22 +4226,6 @@ define Printable_tree |
| 4879 | 4226 | |
| 4880 | 4227 | // *** [5.8] Formating 'in form' elements. |
| 4881 | 4228 | |
| 4882 | - | |
| 4883 | -//public define Printable_tree | |
| 4884 | -// format | |
| 4885 | -// ( | |
| 4886 | -// HTML_tooltip tooltip | |
| 4887 | -// )= | |
| 4888 | -// if tooltip is | |
| 4889 | -// { | |
| 4890 | -// html_tooltip(title, keyword, width) then | |
| 4891 | -// ["<a id=\"help_",keyword,"\" class=\"jTipu jTip_help\" name=\"",title,"\" href=\"/?a=ajax_show_tooltip&tooltip_id=",keyword,(if width > 0 then ["&width=",width,"\""] else ["\""]), "></a>"], | |
| 4892 | -// | |
| 4893 | -// html_tooltip_ext(title, extend_type, class_suffix, ext_args) then | |
| 4894 | -// with extra_args = format_extra_operands(ext_args), | |
| 4895 | -// ["<a id=\"jTip\" class=\"jTipu jTip_",class_suffix,"\" name=\"",title,"\" href=\"/?a=ajax_show_tooltip&tooltip_ext=",extend_type+extra_args,"\"></a>"] | |
| 4896 | -// }. | |
| 4897 | - | |
| 4898 | 4229 | public define List(CoreAttrs) |
| 4899 | 4230 | extract_attributes |
| 4900 | 4231 | ( |
| ... | ... | @@ -4904,26 +4235,18 @@ public define List(CoreAttrs) |
| 4904 | 4235 | { |
| 4905 | 4236 | html_tooltip(title, keyword, width) then //TODO |
| 4906 | 4237 | [] |
| 4907 | - //["<a id=\"help_",keyword,"\" class=\"jTipu \" name=\"",title,"\" href=\"/?a=ajax_show_tooltip&tooltip_id=",keyword,(if width > 0 then ["&width=",width,"\""] else ["\""]), "><i class=\"fa fa-info\" aria-hidden=\"true\" style=\"color:#2e6da4\"></i></a>"], | |
| 4908 | - | |
| 4238 | + | |
| 4909 | 4239 | html_tooltip_ext(title, extend_type, class_suffix, ext_args) then //TODO |
| 4910 | - //[] | |
| 4240 | + | |
| 4911 | 4241 | with extra_args = format_extra_operands(ext_args), |
| 4912 | 4242 | [id("jTip"), class("jTipu jTip_"+class_suffix), data("name",title), data("href", "/?a=ajax_show_tooltip&tooltip_ext="+extend_type+extra_args)] |
| 4913 | 4243 | |
| 4914 | 4244 | html_tooltip_ext(title, extend_type, ext_args) then //TODO |
| 4915 | 4245 | with extra_args = format_extra_operands(ext_args), |
| 4916 | 4246 | [id("jTip"), class("jTipu"), data("name",title), data("href", "/?a=ajax_show_tooltip&tooltip_ext="+extend_type+extra_args)] |
| 4917 | -// [] | |
| 4918 | - //with extra_args = format_extra_operands(ext_args), | |
| 4919 | - //["<a id=\"jTip\" class=\"jTipu \" name=\"",title,"\" href=\"/?a=ajax_show_tooltip&tooltip_ext=",extend_type+extra_args,"\"><i class=\"fa fa-info\" aria-hidden=\"true\" style=\"color:#2e6da4\"></i></a>"], | |
| 4920 | 4247 | |
| 4921 | 4248 | html_tooltip(title, web_action, extra_args) then |
| 4922 | - [ id("jTip"), class("jTipu"), data("name", title), data("href", "/"+format_web_action_name(web_action, extra_args)) | |
| 4923 | - ] | |
| 4924 | - | |
| 4925 | - //["<a id=\"jTip\" class=\"jTipu \" name=\"",title,"\" href=\"/", format_web_action_name(web_action, extra_args) ,"\"><i class=\"fa fa-info\" aria-hidden=\"true\" style=\"color:#2e6da4\"></i></a>"], | |
| 4926 | - | |
| 4249 | + [ id("jTip"), class("jTipu"), data("name", title), data("href", "/"+format_web_action_name(web_action, extra_args))] | |
| 4927 | 4250 | } |
| 4928 | 4251 | . |
| 4929 | 4252 | |
| ... | ... | @@ -4952,31 +4275,45 @@ public define Printable_tree |
| 4952 | 4275 | |
| 4953 | 4276 | } |
| 4954 | 4277 | . |
| 4955 | - | |
| 4956 | -public define HTML_Off_Form | |
| 4278 | + | |
| 4279 | +public define HTML | |
| 4280 | + format | |
| 4281 | + ( | |
| 4282 | + HTML_tooltip tooltip | |
| 4283 | + )= | |
| 4284 | + if tooltip is | |
| 4285 | + { | |
| 4286 | + html_tooltip(title, keyword, width) then | |
| 4287 | + a([id("help_"+keyword), class("jTipu"), data("name", title), data("href", "/?a=ajax_show_tooltip&tooltip_id="+keyword+(if width > 0 then "&width="+width+"\"" else "\""))], | |
| 4288 | + i([class("fa fa-info"), aria("hidden","true"), style("color:#2e6da4")])), | |
| 4289 | + | |
| 4290 | + html_tooltip_ext(title, extend_type, class_suffix, ext_args) then | |
| 4291 | + with extra_args = format_extra_operands(ext_args), | |
| 4292 | + a([id("jTip"), class("jTipu jTip_"+class_suffix), data("name", title), data("href", "/?a=ajax_show_tooltip&tooltip_ext="+extend_type+extra_args)]) | |
| 4293 | + | |
| 4294 | + html_tooltip_ext(title, extend_type, ext_args) then | |
| 4295 | + with extra_args = format_extra_operands(ext_args), | |
| 4296 | + a([id("jTip"), class("jTipu"), data("name", title), data("href", "/?a=ajax_show_tooltip&tooltip_ext="+extend_type+extra_args)], | |
| 4297 | + i([class("fa fa-info"), aria("hidden","true"), style("color:#2e6da4")])), | |
| 4298 | + | |
| 4299 | + html_tooltip(title, web_action, extra_args) then | |
| 4300 | + a([id("jTip"), class("jTipu"), data("name", title), data("href", "/"+format_web_action_name(web_action, extra_args))], | |
| 4301 | + i([class("fa fa-info"), aria("hidden","true"), style("color:#2e6da4")])), | |
| 4302 | + } | |
| 4303 | +. | |
| 4304 | + | |
| 4305 | +public define HTML | |
| 4957 | 4306 | html_tooltip |
| 4958 | 4307 | ( |
| 4959 | 4308 | String title, |
| 4960 | 4309 | WEB_Action_Name web_action, |
| 4961 | 4310 | List((String,String)) extra_args, |
| 4962 | - HTML_Off_Form html_element, | |
| 4311 | + HTML html_element, | |
| 4963 | 4312 | )= |
| 4964 | - sequence([ | |
| 4965 | - literal_pt(["<span id=\"jTip\" class=\"jTipu\" data-name=\"",title,"\" data-href=\"/", format_web_action_name(web_action, extra_args) ,"\">"]), | |
| 4966 | - html_element, | |
| 4967 | - literal_pt(["</span>"]) | |
| 4968 | - ]) | |
| 4313 | + span([id("jTip"), class("jTipu"), data("name", title), data("href", "/"+format_web_action_name(web_action, extra_args))], html_element) | |
| 4969 | 4314 | . |
| 4970 | 4315 | |
| 4971 | -public define HTML_Off_Form | |
| 4972 | - html_tooltip | |
| 4973 | - ( | |
| 4974 | - String title, | |
| 4975 | - String keyword, | |
| 4976 | - ) = | |
| 4977 | - literal_pt(format(html_tooltip(title, keyword, 0))). | |
| 4978 | - | |
| 4979 | -public define HTML_In_Form | |
| 4316 | +public define HTML | |
| 4980 | 4317 | html_tooltip |
| 4981 | 4318 | ( |
| 4982 | 4319 | String title, |
| ... | ... | @@ -4984,7 +4321,7 @@ public define HTML_In_Form |
| 4984 | 4321 | ) = |
| 4985 | 4322 | literal_pt(format(html_tooltip(title, keyword, 0))). |
| 4986 | 4323 | |
| 4987 | -public define HTML_Off_Form | |
| 4324 | +public define HTML | |
| 4988 | 4325 | html_tooltip |
| 4989 | 4326 | ( |
| 4990 | 4327 | String keyword, |
| ... | ... | @@ -4992,13 +4329,6 @@ public define HTML_Off_Form |
| 4992 | 4329 | ) = |
| 4993 | 4330 | literal_pt(format(html_tooltip("", keyword, size))). |
| 4994 | 4331 | |
| 4995 | -public define HTML_In_Form | |
| 4996 | - html_tooltip | |
| 4997 | - ( | |
| 4998 | - String keyword, | |
| 4999 | - Int size, | |
| 5000 | - ) = | |
| 5001 | - literal_pt(format(html_tooltip("", keyword, size))). | |
| 5002 | 4332 | |
| 5003 | 4333 | public define Printable_tree |
| 5004 | 4334 | format_help |
| ... | ... | @@ -5008,8 +4338,8 @@ public define Printable_tree |
| 5008 | 4338 | ) = |
| 5009 | 4339 | if _help is |
| 5010 | 4340 | { |
| 5011 | - no_help then label, | |
| 5012 | - tooltip(html_tooltip, position) then | |
| 4341 | + no_help then label, | |
| 4342 | + tooltip(html_tooltip, position) then | |
| 5013 | 4343 | if position is |
| 5014 | 4344 | { |
| 5015 | 4345 | left then pt_pt(format(html_tooltip),label), |
| ... | ... | @@ -5035,7 +4365,7 @@ public define Printable_tree |
| 5035 | 4365 | ) = |
| 5036 | 4366 | if _label is |
| 5037 | 4367 | { |
| 5038 | - no_label then [], | |
| 4368 | + no_label then [], | |
| 5039 | 4369 | label(text, help) then |
| 5040 | 4370 | format_help( |
| 5041 | 4371 | ["<label"+(if _id.id ="" then "" else " for=\""+_id.id+"\"")+">",text,"</label>"], |
| ... | ... | @@ -5043,234 +4373,27 @@ public define Printable_tree |
| 5043 | 4373 | ) |
| 5044 | 4374 | }. |
| 5045 | 4375 | |
| 5046 | - | |
| 5047 | -define Printable_tree | |
| 5048 | - format | |
| 4376 | +public define HTML | |
| 4377 | + format_label | |
| 5049 | 4378 | ( |
| 5050 | - CommonInfo cinfo, | |
| 5051 | - String fn, // form_name | |
| 5052 | - Var(Int) ic_v, // idnum counter variable | |
| 5053 | - HTML_In_Form element, | |
| 5054 | - Bool is_https, | |
| 5055 | - Var(Int) action_count, | |
| 5056 | - Var(List(HTML_Head_Tag)) head_tags | |
| 4379 | + HTML_Label _label, | |
| 4380 | + HTML_Id _id | |
| 5057 | 4381 | ) = |
| 5058 | - if cinfo is info(common_name,http_port,https_port,site_directory,secret) then | |
| 5059 | - with format_element = (HTML_In_Form e) |-> format(cinfo, fn, ic_v, e, is_https, action_count, head_tags), | |
| 5060 | - if element is | |
| 5061 | - { | |
| 5062 | - empty then [], | |
| 5063 | - literal_pt(t) then t, | |
| 5064 | - literal(t) then [t], | |
| 5065 | - sequence(l) then flat(map(format_element,l)) | |
| 5066 | - text(opts,t) then | |
| 5067 | - format(cinfo,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags), | |
| 5068 | - preformated(o,s) then | |
| 5069 | - format(cinfo,ic_v,any_preformated(o,s),format_element,is_https, action_count, head_tags), | |
| 5070 | - paragraph(opts,t) then | |
| 5071 | - format(cinfo,ic_v,any_paragraph(opts,t),format_element,is_https, action_count, head_tags), | |
| 5072 | - image(opts, url, alt) then | |
| 5073 | - format(cinfo,ic_v,any_image(opts, url, alt),format_element,is_https, action_count, head_tags), | |
| 5074 | - image(opts, url, alt, w, h) then | |
| 5075 | - format(cinfo,ic_v,any_image(opts, url, alt, w, h),format_element,is_https, action_count, head_tags), | |
| 5076 | - table(opts,header_row,rows,footer_row) then | |
| 5077 | - format(cinfo,ic_v,any_table(opts, header_row, rows, footer_row),format_element,is_https, action_count, head_tags), | |
| 5078 | - center(e) then | |
| 5079 | - format(cinfo,ic_v,any_center(e),format_element,is_https, action_count, head_tags), | |
| 5080 | - mail_to(a,e) then | |
| 5081 | - format(cinfo,ic_v,any_mail_to(a,e),format_element,is_https, action_count, head_tags), | |
| 5082 | - scroller(w,h,cw,ch,c) then | |
| 5083 | - format(cinfo,ic_v,any_scroller(w,h,cw,ch,c),format_element,is_https, action_count, head_tags), | |
| 5084 | - actioner(c,t,a,an,eo,ja) then | |
| 5085 | - format(cinfo,ic_v,any_actioner(c,t,a,an,eo,ja,success(fn)),format_element,is_https, action_count, head_tags), | |
| 5086 | - | |
| 5087 | - foreign_link_new(target, aspect, url) then | |
| 5088 | - format(cinfo,ic_v,any_foreign_link_new(target,aspect,url),format_element,is_https, action_count, head_tags), | |
| 5089 | - | |
| 5090 | - foreign_link(options,url) then | |
| 5091 | - format(cinfo,ic_v,any_foreign_link(options,url),format_element,is_https, action_count, head_tags), | |
| 5092 | - foreign_link(options,url,name) then | |
| 5093 | - format(cinfo,ic_v,any_foreign_link(options,url,name),format_element,is_https, action_count, head_tags), | |
| 5094 | - private_download(url,name,extra,action) then | |
| 5095 | - format(cinfo,ic_v,any_private_download(url,name,extra,action),format_element,is_https, action_count, head_tags), | |
| 5096 | - text_input(options, label_text, id, name, init, w) then | |
| 5097 | - [ format_label(label_text, id), | |
| 5098 | - "<input type=\"text\" name=\"",name,"\" id=\"",id,"\" size=\"",w,"\" value=\"",encode_HTML_entities(init.value),"\"",format_attrs([class("in") . options])," />"], | |
| 5099 | - text_input_ro(options, label_text, id, name, init, w) then | |
| 5100 | - [ format_label(label_text, id), | |
| 5101 | - "<input readonly=\"readonly\" type=\"text\" name=\"",name,"\" id=\"",id,"\" size=\"",w,"\" value=\"",encode_HTML_entities(init.value),"\"",format_attrs([class("in") . options])," />"], | |
| 5102 | - password_input(options, label_text, id, name, init, w) then | |
| 5103 | - [ format_label(label_text, id), | |
| 5104 | - "<input type=\"password\" name=\"",name,"\" id=\"",id,"\" size=\"",w,"\" value=\"",encode_HTML_entities(init.value),"\"",format_attrs([class("in") . options])," />"], | |
| 5105 | - text_area(options,label_text, id, n, init, w, h) then | |
| 5106 | - [ format_label(label_text, id), "<textarea ",format(options)," id=\"",id,"\" name=\"",n,"\" cols=\"",w,"\" rows=\"",h,"\">",encode_HTML_entities(init.value),"</textarea>"], | |
| 5107 | - file_upload(options, label, id, n, w) then | |
| 5108 | - [ format_label(label, id), | |
| 5109 | - "<input type=\"file\" id=\"",id,"\" size=\"",w,"\" name=\"",n,"\"",format_attrs([class("in") . options])," />"], | |
| 5110 | - selector(options, label, id, n,s,cs) then | |
| 5111 | - [ format_label(label, id), | |
| 5112 | - "<select id=\"",id,"\" name=\"",n,"\" size=\"",s,"\" ",format_attrs([class("in") . options]),">",format_choices(cs),"</select>"], | |
| 5113 | - selector(options, label, id, n,s,cs,sd) then | |
| 5114 | - [ format_label(label, id), | |
| 5115 | - "<select id=\"",id,"\" name=\"",n,"\" size=\"",s,"\" ",format_attrs([class("in") . options]),">",format_choices(cs,sd),"</select>"], | |
| 5116 | - selector_c(options, label, id, n,s,cs) then | |
| 5117 | - [ format_label(label, id), | |
| 5118 | - "<select id=\"",id,"\" name=\"",n,"\" size=\"",s,"\" ",format_attrs([class("in") . options]),">",format_choices(cs),"</select>"], | |
| 5119 | - selector_c(options, label, id, n,s,cs,sd) then | |
| 5120 | - [ format_label(label, id), | |
| 5121 | - "<select id=\"",id,"\" name=\"",n,"\" size=\"",s,"\" ",format_attrs([class("in") . options]),">",format_choices(cs,sd),"</select>"], | |
| 5122 | - | |
| 5123 | - radio_button(options, label, id, n, value, c) then | |
| 5124 | - [ format_label(label, id), | |
| 5125 | - "<input type=\"radio\" name=\"",n,"\" id=\"",id,"\" value=\"",value,"\"",(if c then " checked=\"checked\"" else ""),format_attrs([class("in") . options])," />"], | |
| 5126 | - radio_button_r(options, label, id, n, value, c) then | |
| 5127 | - [ "<input type=\"radio\" name=\"",n,"\" id=\"",id,"\" value=\"",value,"\"",(if c then " checked=\"checked\"" else ""),format_attrs([class("in") . options])," />", | |
| 5128 | - format_label(label, id)], | |
| 5129 | - check_box(options, label, id, n, c) then | |
| 5130 | - [ format_label(label, id), | |
| 5131 | - "<input type=\"hidden\" name=\"~",n,"\" value=\"~true\" /><input type=\"checkbox\" name=\"",n,"\" id=\"",id,"\" value=\"true\"",(if c then " checked=\"checked\" " else ""),format_attrs([class("in") . options])," />"] | |
| 5132 | - check_box_r(options, label, id, n, c) then | |
| 5133 | - [ "<input type=\"hidden\" name=\"~",n,"\" value=\"~true\" /><input type=\"checkbox\" name=\"",n,"\" id=\"",id,"\" value=\"true\"",(if c then " checked=\"checked\" " else ""),format_attrs([class("in") . options])," />", | |
| 5134 | - format_label(label, id)] | |
| 5135 | - div(options, e) then | |
| 5136 | - format(cinfo,ic_v,any_div(options, e),format_element,is_https, action_count, head_tags), | |
| 5137 | - div_empty(options) then | |
| 5138 | - format(cinfo,ic_v,any_div_empty(options),format_element,is_https, action_count, head_tags), | |
| 5139 | - hidden(_id, name, init) then | |
| 5140 | - since _id is html_Id(id), | |
| 5141 | - ["<input type=\"hidden\"",(if id = "" then "" else " id=\""+id+"\"")," name=\"",name,"\" value=\"",encode_HTML_entities(init.value),"\" />"], | |
| 5142 | - partial(p_content) then | |
| 5143 | - if p_content is partial_content(tags, html_elements) then | |
| 5144 | - head_tags <- *head_tags + tags; | |
| 5145 | - | |
| 5146 | - format(cinfo, ic_v, html_elements, is_https, action_count, head_tags), | |
| 5147 | - br then ["<br>"], | |
| 5148 | - progress(options, value, max) then ["<progress max=\"",value,"\" value=\"",max,"\"",format_attrs(options),"></progress>"], | |
| 5149 | - ol(opts, t) then | |
| 5150 | - format(cinfo,ic_v,any_ol(opts,t),format_element,is_https, action_count, head_tags), | |
| 5151 | - ul(opts, t) then | |
| 5152 | - format(cinfo,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), | |
| 5153 | - li(opts, t) then | |
| 5154 | - format(cinfo,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), | |
| 5155 | - button(options, e) then | |
| 5156 | - format(cinfo,ic_v,any_button(options, e),format_element,is_https, action_count, head_tags), | |
| 5157 | - i(opts, t) then | |
| 5158 | - format(cinfo,ic_v,any_i(opts,t),format_element,is_https, action_count, head_tags), | |
| 5159 | - span(opts,t) then | |
| 5160 | - format(cinfo,ic_v,any_span(opts,t),format_element,is_https, action_count, head_tags) | |
| 5161 | - hr(opts) then | |
| 5162 | - format(cinfo,ic_v,any_hr(opts),format_element,is_https, action_count, head_tags) | |
| 5163 | - }. | |
| 5164 | - | |
| 5165 | - | |
| 5166 | - | |
| 5167 | - | |
| 5168 | - | |
| 5169 | - | |
| 4382 | + if _label is | |
| 4383 | + { | |
| 4384 | + no_label then empty, | |
| 4385 | + label(text, help) then | |
| 4386 | + literal_pt( | |
| 4387 | + format_help( | |
| 4388 | + ["<label"+(if _id.id ="" then "" else " for=\""+_id.id+"\"")+">",text,"</label>"], | |
| 4389 | + help | |
| 4390 | + )) | |
| 4391 | + }. | |
| 4392 | + | |
| 5170 | 4393 | *** [5.9] Formating 'off form' elements. |
| 5171 | 4394 | |
| 5172 | 4395 | The encryption type 'multipart/form-data' is required for a form containing an upload. |
| 5173 | 4396 | |
| 5174 | - | |
| 5175 | -define Bool | |
| 5176 | - contains_an_upload | |
| 5177 | - ( | |
| 5178 | - HTML_In_Form form_content | |
| 5179 | - ). | |
| 5180 | - | |
| 5181 | -define Bool | |
| 5182 | - contains_an_upload | |
| 5183 | - ( | |
| 5184 | - HTML_Row(HTML_In_Form) row | |
| 5185 | - ) = | |
| 5186 | - if row is | |
| 5187 | - { | |
| 5188 | - empty then false, | |
| 5189 | - row(_, cells) then | |
| 5190 | - mapor(contains_an_upload, | |
| 5191 | - map(content, cells)) | |
| 5192 | - } | |
| 5193 | -. | |
| 5194 | - | |
| 5195 | -define Bool | |
| 5196 | - contains_an_upload | |
| 5197 | - ( | |
| 5198 | - HTML_Footer_Row(HTML_In_Form) row | |
| 5199 | - )= | |
| 5200 | - if row is | |
| 5201 | - { | |
| 5202 | - empty then false, | |
| 5203 | - footer_row(_, cells) then | |
| 5204 | - mapor(contains_an_upload, | |
| 5205 | - map(content,cells)) | |
| 5206 | - }. | |
| 5207 | - | |
| 5208 | -define Bool | |
| 5209 | - contains_an_upload | |
| 5210 | - ( | |
| 5211 | - HTML_In_Form form_content | |
| 5212 | - ) = | |
| 5213 | - if form_content is | |
| 5214 | - { | |
| 5215 | - empty then false, | |
| 5216 | - literal_pt(t) then false, | |
| 5217 | - literal(t) then false, | |
| 5218 | - sequence(l) then mapor(contains_an_upload,l), | |
| 5219 | - text(o,t) then false, | |
| 5220 | - preformated(o,s) then false, | |
| 5221 | - paragraph(o,l) then mapor(contains_an_upload,l), | |
| 5222 | - image(o,u,a) then false, | |
| 5223 | - image(o,u,a,w,h) then false, | |
| 5224 | - table(o,_,rows,f_row) then if mapor(contains_an_upload,rows) then true | |
| 5225 | - else contains_an_upload(f_row), | |
| 5226 | - center(e) then contains_an_upload(e), | |
| 5227 | - mail_to(m,e) then false, // 'e' may but should not contain an upload | |
| 5228 | - scroller(w,h,cw,ch,e) then contains_an_upload(e), | |
| 5229 | - actioner(c,t,a,an,eo,ja) then false, | |
| 5230 | - foreign_link_new(_,_,_) then false, | |
| 5231 | - foreign_link(o,u) then false, | |
| 5232 | - foreign_link(o,u,n) then false, | |
| 5233 | - private_download(p,n,e,a) then false, | |
| 5234 | - text_input(o,lt,l,n,i,w) then false, | |
| 5235 | - text_input_ro(o,lt,l,n,i,w) then false, | |
| 5236 | - password_input(o,lt,l,n,i,w) then false, | |
| 5237 | - text_area(o,lt,id,n,i,w,h) then false, | |
| 5238 | - file_upload(o,l,i,n,w) then true, | |
| 5239 | - selector(o,l,i,n,s,c) then false, | |
| 5240 | - selector(o,l,i,n,s,c,p) then false, | |
| 5241 | - selector_c(o,l,i,n,s,c) then false, | |
| 5242 | - selector_c(o,l,i,n,s,c,p) then false, | |
| 5243 | - radio_button(o,_,_,n,v,c) then false, | |
| 5244 | - radio_button_r(o,_,_,n,v,c) then false, | |
| 5245 | - check_box(o,_,_,n,c) then false, | |
| 5246 | - check_box_r(o,_,_,n,c) then false, | |
| 5247 | - div(o,l) then mapor(contains_an_upload,l), //contains_an_upload(c), | |
| 5248 | - div_empty(o) then false, | |
| 5249 | - hidden(_,_,_) then false, | |
| 5250 | - partial(_) then false, | |
| 5251 | - br then false, | |
| 5252 | - progress(_,_,_) then false, | |
| 5253 | - ol(_,l) then mapor(contains_an_upload,l), | |
| 5254 | - ul(_,l) then mapor(contains_an_upload,l), | |
| 5255 | - li(_,l) then mapor(contains_an_upload,l), | |
| 5256 | - button(_,_) then false, | |
| 5257 | - i(_,_) then false, | |
| 5258 | - span(_,_) then false, | |
| 5259 | - hr(_) then false | |
| 5260 | - } | |
| 5261 | -. | |
| 5262 | - | |
| 5263 | -define String | |
| 5264 | - enctype | |
| 5265 | - ( | |
| 5266 | - List(HTML_In_Form) form_contents | |
| 5267 | - )= | |
| 5268 | - if mapor(contains_an_upload, form_contents) then | |
| 5269 | - " enctype=\"multipart/form-data\"" | |
| 5270 | - else | |
| 5271 | - "" | |
| 5272 | -. | |
| 5273 | - | |
| 5274 | 4397 | define Printable_tree |
| 5275 | 4398 | format_href |
| 5276 | 4399 | ( |
| ... | ... | @@ -5305,7 +4428,7 @@ define Printable_tree |
| 5305 | 4428 | ( |
| 5306 | 4429 | CommonInfo cinfo, |
| 5307 | 4430 | Var(Int) ic_v, // 'idnum' counter variable |
| 5308 | - List(HTML_Off_Form) elements, | |
| 4431 | + List(HTML) elements, | |
| 5309 | 4432 | Bool is_https, |
| 5310 | 4433 | Var(Int) action_count, |
| 5311 | 4434 | Var(List(HTML_Head_Tag)) head_tags |
| ... | ... | @@ -5316,13 +4439,13 @@ define Printable_tree |
| 5316 | 4439 | ( |
| 5317 | 4440 | CommonInfo cinfo, |
| 5318 | 4441 | Var(Int) ic_v, // 'idnum' counter variable |
| 5319 | - HTML_Off_Form element, | |
| 4442 | + HTML element, | |
| 5320 | 4443 | Bool is_https, |
| 5321 | 4444 | Var(Int) action_count, |
| 5322 | - Var(List(HTML_Head_Tag)) head_tags | |
| 4445 | + Var(List(HTML_Head_Tag)) global_head_tags | |
| 5323 | 4446 | ) = |
| 5324 | 4447 | if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
| 5325 | - with format_element = (HTML_Off_Form e) |-> format(cinfo, ic_v, e, is_https, action_count, head_tags), | |
| 4448 | + with format_element = (HTML e) |-> format(cinfo, ic_v, e, is_https, action_count, global_head_tags), | |
| 5326 | 4449 | if element is |
| 5327 | 4450 | { |
| 5328 | 4451 | a(opts, _href, _target, l) then ["<a ", format_attrs(opts), format_href(_href), format_target(_target), ">",flat(map(format_element,l)),"</a>\n"], |
| ... | ... | @@ -5330,88 +4453,75 @@ define Printable_tree |
| 5330 | 4453 | literal_pt(t) then t, |
| 5331 | 4454 | literal(t) then [t], |
| 5332 | 4455 | sequence(l) then flat(map(format_element,l)), |
| 5333 | - text(opts,t) then | |
| 5334 | - format(cinfo,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags), | |
| 5335 | - table(opts,header_row, rows, footer_row) then | |
| 5336 | - format(cinfo,ic_v,any_table(opts,header_row, rows, footer_row),format_element,is_https, action_count, head_tags), | |
| 4456 | + text(opts,t) then | |
| 4457 | + if opts is | |
| 4458 | + { | |
| 4459 | + [] then [t], | |
| 4460 | + [_ . _] then ["<span", format_attrs(opts), ">",t,"</span>"] | |
| 4461 | + }, | |
| 5337 | 4462 | actioner(c,t,a,an,eo,ja) then |
| 5338 | - format(cinfo,ic_v,any_actioner(c,t,a,an,eo,ja,failure),format_element,is_https, action_count, head_tags), | |
| 4463 | + //format(cinfo,ic_v, | |
| 4464 | + format_actioner(cinfo,c,t,a,an,eo,ja,failure,is_https, action_count, ic_v, global_head_tags), | |
| 4465 | + // is_https, action_count, head_tags), | |
| 4466 | + | |
| 5339 | 4467 | actioner(c,t,a,an,eo,ja,fn) then |
| 5340 | - format(cinfo,ic_v,any_actioner(c,t,a,an,eo,ja,success(fn)),format_element,is_https, action_count, head_tags), | |
| 5341 | - foreign_link_new(target, aspect, url) then | |
| 5342 | - format(cinfo,ic_v,any_foreign_link_new(target,aspect,url),format_element,is_https, action_count, head_tags), | |
| 5343 | - foreign_link(options,url) then | |
| 5344 | - format(cinfo,ic_v,any_foreign_link(options,url),format_element,is_https, action_count, head_tags), | |
| 5345 | - foreign_link(options,url,name) then | |
| 5346 | - format(cinfo,ic_v,any_foreign_link(options,url,name),format_element,is_https, action_count, head_tags), | |
| 5347 | - private_download(url,name,extra,action) then | |
| 5348 | - format(cinfo,ic_v,any_private_download(url,name,extra,action),format_element,is_https, action_count, head_tags), | |
| 5349 | - form(fn,attributs, l) then | |
| 5350 | - [ | |
| 5351 | - "<form id=\"",fn,"\"", | |
| 5352 | - format(cinfo,ic_v,any_coreattrs(attributs),format_element,is_https, action_count, head_tags), | |
| 5353 | - " method=\"post\"", | |
| 5354 | - enctype(l), | |
| 5355 | - " action=\"http", | |
| 5356 | - if is_https then "s" else "", | |
| 5357 | - "://",common_name,":",to_decimal(http_port),"/\">", | |
| 5358 | - // action is set dynamically by | |
| 5359 | - // the actioner using JavaScript | |
| 5360 | - if fn is html_Id(id) then | |
| 5361 | - flat(map((HTML_In_Form e) |-> format(cinfo,id,ic_v,e,is_https, action_count, head_tags), l)), | |
| 5362 | - "</form>" | |
| 5363 | - ] | |
| 5364 | - form(fn,attributs, action, extra_ops, l) then | |
| 5365 | - with url = make_actioner_url(cinfo, same, same, | |
| 5366 | - action, extra_ops, is_https), | |
| 5367 | - [ | |
| 5368 | - "<form id=\"",fn,"\"", | |
| 5369 | - format(cinfo,ic_v, any_coreattrs(attributs),format_element,is_https, action_count, head_tags), | |
| 5370 | - " method=\"post\"", | |
| 5371 | - enctype(l), | |
| 5372 | - " action=\"" + url + "\">", | |
| 5373 | -// " action=\"http", | |
| 5374 | -// if is_https then "s" else "", | |
| 5375 | -// "://",common_name,":",http_port,"/\">", | |
| 5376 | - // action is set dynamically by | |
| 5377 | - // the actioner using JavaScript | |
| 5378 | - if fn is html_Id(id) then | |
| 5379 | - flat(map((HTML_In_Form e) |-> format(cinfo,id,ic_v,e,is_https, action_count, head_tags),l)), | |
| 5380 | - "</form>" | |
| 5381 | - ], | |
| 5382 | - in_form(fn, content) then | |
| 5383 | - if fn is html_Id(id) then | |
| 5384 | - format(cinfo,id,ic_v, content,is_https, action_count, head_tags), | |
| 5385 | - div(options, p_content) then | |
| 5386 | - with html_elements = map((HTML_Partial_Content pc) |-> since pc is partial_content(tags, html_elem), head_tags <- *head_tags +tags; html_elem, p_content), | |
| 4468 | + //format(cinfo,ic_v, | |
| 4469 | + format_actioner(cinfo,c,t,a,an,eo,ja,success(fn),is_https, action_count, ic_v, global_head_tags), | |
| 4470 | + // format_element,is_https, action_count, head_tags), | |
| 5387 | 4471 | |
| 5388 | - format(cinfo, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags), | |
| 5389 | - iframe(options, css_styles, css_files, js_files, body) then | |
| 5390 | - println("formating iframe"); | |
| 5391 | - if body is body(body_options,elem) then | |
| 5392 | - [ "<iframe", format_attrs(options), " srcdoc=\"\n", | |
| 4472 | + foreign_link_new(target, aspect, url) then | |
| 4473 | + //format(cinfo,ic_v, | |
| 4474 | + format_foreign_link(target, aspect, url, is_https, cinfo, action_count, ic_v, global_head_tags), | |
| 4475 | + //format_element,is_https, action_count, head_tags), | |
| 4476 | + | |
| 4477 | + | |
| 4478 | +// foreign_link(options,url,name) then | |
| 4479 | +// format(cinfo,ic_v,any_foreign_link(options,url,name),format_element,is_https, action_count, head_tags), | |
| 4480 | + private_download(url, name, extra, action) then | |
| 4481 | + //format(cinfo,ic_v, | |
| 4482 | + format_private_download(cinfo, url, name, extra, action), | |
| 4483 | + //format_element,is_https, action_count, head_tags), | |
| 4484 | + | |
| 4485 | +// div(options, p_content) then | |
| 4486 | +// with html_elements = map((HTML pc) |-> | |
| 4487 | +// since pc is partial_content(tags, html_elem), | |
| 4488 | +// head_tags <- *head_tags + tags; //accumulate the tags | |
| 4489 | +// html_elem, //return the HTML element | |
| 4490 | +// p_content), | |
| 4491 | +// | |
| 4492 | +// //format(cinfo, ic_v, | |
| 4493 | + | |
| 4494 | +// [format_div_option(options), flat(map((HTML e) |-> format_element(e), html_elements)),"</div>\n"], | |
| 4495 | + //format_element, is_https, action_count, head_tags), | |
| 4496 | +// iframe(options, css_styles, css_files, js_files, body) then | |
| 4497 | +// println("formating iframe"); | |
| 4498 | +// if body is body(body_options,elem) then | |
| 4499 | +// [ "<iframe", format_attrs(options), " srcdoc=\"\n", | |
| 4500 | +// | |
| 4501 | +// encode_HTML_quote(to_String([ | |
| 4502 | +// "<html style=\"margin: 0pt; padding: 0pt;\">\n", | |
| 4503 | +// "<head>\n", | |
| 4504 | +// //add_css_styles(css_styles), | |
| 4505 | +// add_css_files(css_files), | |
| 4506 | +// add_js_files(js_files), | |
| 4507 | +// "</head>\n", | |
| 4508 | +// "<body ", format_attrs(body_options), ">\n", // format body options | |
| 4509 | +// format(cinfo,ic_v, elem ,is_https, action_count, head_tags), | |
| 4510 | +// "</body>\n", | |
| 4511 | +// "</html>\n",])), | |
| 4512 | +// | |
| 4513 | +// "\"></iframe>\n", | |
| 4514 | +// ], | |
| 4515 | + head_tags(_head_tags, html_elements) then | |
| 4516 | + global_head_tags <- *global_head_tags + _head_tags; //accumulate the tags | |
| 4517 | +// if p_content is partial_content(tags, html_elements) then | |
| 4518 | +// head_tags <- *head_tags + tags; | |
| 4519 | +// format(cinfo, ic_v, html_elements, is_https, action_count, head_tags), | |
| 4520 | + flat(map(format_element, html_elements)) | |
| 4521 | + | |
| 5393 | 4522 | |
| 5394 | - encode_HTML_quote(to_String([ | |
| 5395 | - "<html style=\"margin: 0pt; padding: 0pt;\">\n", | |
| 5396 | - "<head>\n", | |
| 5397 | - add_css_styles(css_styles), | |
| 5398 | - add_css_files(css_files), | |
| 5399 | - add_js_files(js_files), | |
| 5400 | - "</head>\n", | |
| 5401 | - "<body ", format_attrs(body_options), ">\n", // format body options | |
| 5402 | - format(cinfo,ic_v, elem ,is_https, action_count, head_tags), | |
| 5403 | - "</body>\n", | |
| 5404 | - "</html>\n",])), | |
| 5405 | - | |
| 5406 | - "\"></iframe>\n", | |
| 5407 | - ], | |
| 5408 | - partial(p_content) then | |
| 5409 | - if p_content is partial_content(tags, html_elements) then | |
| 5410 | - head_tags <- *head_tags + tags; | |
| 5411 | - format(cinfo, ic_v, html_elements, is_https, action_count, head_tags), | |
| 5412 | -// i(opts, t) then | |
| 5413 | -// format(cinfo,ic_v,any_i(opts,t),format_element,is_https, action_count, head_tags), | |
| 5414 | 4523 | html_tag(tag_name, opts, l) then ["<",tag_name, format_attrs(opts), ">", flat(map(format_element,l)), "</",tag_name,">\n"], |
| 4524 | +// html_tag(tag_name, opts) then ["<",tag_name, format_attrs(opts), "></",tag_name,">\n"], | |
| 5415 | 4525 | html_void_tag(tag_name, opts) then ["<",tag_name, format_attrs(opts), ">"], |
| 5416 | 4526 | }. |
| 5417 | 4527 | |
| ... | ... | @@ -5420,13 +4530,13 @@ define Printable_tree |
| 5420 | 4530 | ( |
| 5421 | 4531 | CommonInfo cinfo, |
| 5422 | 4532 | Var(Int) ic_v, // 'idnum' counter variable |
| 5423 | - List(HTML_Off_Form) elements, | |
| 4533 | + List(HTML) elements, | |
| 5424 | 4534 | Bool is_https, |
| 5425 | 4535 | Var(Int) action_count, |
| 5426 | 4536 | Var(List(HTML_Head_Tag)) head_tags |
| 5427 | 4537 | ) = |
| 5428 | 4538 | if cinfo is info(common_name,http_port,https_port,site_directory,secret) then |
| 5429 | - flat(map((HTML_Off_Form element) |-> | |
| 4539 | + flat(map((HTML element) |-> | |
| 5430 | 4540 | format(cinfo, ic_v, element, is_https, action_count, head_tags), |
| 5431 | 4541 | elements)) |
| 5432 | 4542 | . |
| ... | ... | @@ -5620,7 +4730,7 @@ public define HTML_ajax_content |
| 5620 | 4730 | public define HTML_ajax_content |
| 5621 | 4731 | to_html_ajax_content |
| 5622 | 4732 | ( |
| 5623 | - HTML_Off_Form content_HTML, | |
| 4733 | + HTML content_HTML, | |
| 5624 | 4734 | CommonInfo cinfo |
| 5625 | 4735 | )= |
| 5626 | 4736 | //println("to_html_ajax_content(content_HTML, cinfo)"); |
| ... | ... | @@ -5632,7 +4742,7 @@ public define HTML_ajax_content |
| 5632 | 4742 | public define String |
| 5633 | 4743 | to_String |
| 5634 | 4744 | ( |
| 5635 | - HTML_Off_Form content_HTML, | |
| 4745 | + HTML content_HTML, | |
| 5636 | 4746 | CommonInfo cinfo |
| 5637 | 4747 | )= |
| 5638 | 4748 | //println("to_html_ajax_content(content_HTML, cinfo)"); |
| ... | ... | @@ -5645,13 +4755,13 @@ public define String |
| 5645 | 4755 | public define JsonValue |
| 5646 | 4756 | to_html_ajax_content |
| 5647 | 4757 | ( |
| 5648 | - HTML_Partial_Content content_HTML, | |
| 4758 | + HTML content_HTML, | |
| 5649 | 4759 | CommonInfo cinfo, |
| 5650 | 4760 | String additional_script |
| 5651 | 4761 | )= |
| 5652 | 4762 | //println("to_html_ajax_content(content_HTML, cinfo, additional_script)"); |
| 5653 | 4763 | //println("additional_script"+additional_script); |
| 5654 | - since to_html_ajax_content(partial(content_HTML), cinfo) is html_ajax_content(html, script, js_files, css_files), | |
| 4764 | + since to_html_ajax_content(content_HTML, cinfo) is html_ajax_content(html, script, js_files, css_files), | |
| 5655 | 4765 | json_object([ |
| 5656 | 4766 | json_member("html", json_string(html)), |
| 5657 | 4767 | json_member("js_files", to_json_array(js_files)), |
| ... | ... | @@ -5663,7 +4773,7 @@ public define JsonValue |
| 5663 | 4773 | public define JsonValue |
| 5664 | 4774 | to_html_ajax_content |
| 5665 | 4775 | ( |
| 5666 | - HTML_Partial_Content content_HTML, | |
| 4776 | + HTML content_HTML, | |
| 5667 | 4777 | CommonInfo cinfo |
| 5668 | 4778 | )= to_html_ajax_content(content_HTML, cinfo, ""). |
| 5669 | 4779 | |
| ... | ... | @@ -5723,7 +4833,7 @@ public define AWP_Handler_Answer //Printable_tree |
| 5723 | 4833 | answer_body_body |
| 5724 | 4834 | ]), |
| 5725 | 4835 | |
| 5726 | - html_page(status, title, head_tags, css_styles, css_files, js_files, script, body) then | |
| 4836 | + html_page(status, title, head_tags, /*css_styles,*/ css_files, js_files, script, body) then | |
| 5727 | 4837 | if body is body(options,element) then |
| 5728 | 4838 | if format(status) is (status_string, status_headers) then |
| 5729 | 4839 | with |
| ... | ... | @@ -5737,7 +4847,7 @@ public define AWP_Handler_Answer //Printable_tree |
| 5737 | 4847 | [ doctype_w3c_header, |
| 5738 | 4848 | //html_header, |
| 5739 | 4849 | "<head>\n", |
| 5740 | - add_css_styles(css_styles), | |
| 4850 | + //add_css_styles(css_styles), | |
| 5741 | 4851 | add_css_files(css_files), |
| 5742 | 4852 | add_js_files(js_files), |
| 5743 | 4853 | add_script(script), |
| ... | ... | @@ -5797,7 +4907,7 @@ public define AWP_Handler_Answer //Printable_tree |
| 5797 | 4907 | if format(status) is (status_string, status_headers) then |
| 5798 | 4908 | printable_tree([ |
| 5799 | 4909 | "HTTP/1.1 " + status_string, crlf, |
| 5800 | - format_headers(status_headers), | |
| 4910 | + format_headers(standard_headers), | |
| 5801 | 4911 | format_headers(standard_headers_for(to_String(mime_type), length(content), failure)), |
| 5802 | 4912 | format_headers(status_headers), |
| 5803 | 4913 | format_headers(other_headers), |
| ... | ... | @@ -5839,7 +4949,7 @@ public define AWP_Handler_Answer //Printable_tree |
| 5839 | 4949 | http_raw(Printable_tree content) then |
| 5840 | 4950 | printable_tree(content), |
| 5841 | 4951 | |
| 5842 | - html_content(HTTP_Status status, HTML_Off_Form content_HTML) then | |
| 4952 | + html_content(HTTP_Status status, HTML content_HTML) then | |
| 5843 | 4953 | if format(status) is (status_string, status_headers) then |
| 5844 | 4954 | with content = format(cinfo, ic_v, content_HTML, is_https, var(0), p_content_head_tags), |
| 5845 | 4955 | printable_tree([ |
| ... | ... | @@ -5852,29 +4962,30 @@ public define AWP_Handler_Answer //Printable_tree |
| 5852 | 4962 | content |
| 5853 | 4963 | ]), |
| 5854 | 4964 | //HMTL content with some header |
| 5855 | - html_partial_content(HTTP_Status status, HTML_Partial_Content p_content) then | |
| 5856 | - | |
| 5857 | - since p_content is partial_content(head_tags, html_content), | |
| 5858 | - since format(status) is (status_string, status_headers), | |
| 5859 | - with | |
| 5860 | - answer_body = (Printable_tree) | |
| 5861 | - [ | |
| 5862 | - format(cinfo, ic_v, html_content, is_https, var(0), p_content_head_tags), | |
| 5863 | - ], | |
| 5864 | - answer_header = (Printable_tree) | |
| 5865 | - [ | |
| 5866 | - // html_header, | |
| 5867 | - format_html_head(head_tags + *p_content_head_tags), | |
| 5868 | - ], | |
| 5869 | - printable_tree([ | |
| 5870 | - "HTTP/1.1 " + status_string, crlf, | |
| 5871 | - format_headers(standard_headers), | |
| 5872 | - format_headers(standard_headers_for("text/html", length(answer_header) + length(answer_body), success(charset))), | |
| 5873 | - format_headers(status_headers), | |
| 5874 | - format_headers(additional_headers), | |
| 5875 | - crlf, | |
| 5876 | - answer_header . | |
| 5877 | - answer_body | |
| 5878 | - ]), | |
| 5879 | - }. | |
| 4965 | +// HTML(HTTP_Status status, HTML p_content) then | |
| 4966 | +// | |
| 4967 | +// since p_content is partial_content(head_tags, html_content), | |
| 4968 | +// since format(status) is (status_string, status_headers), | |
| 4969 | +// with | |
| 4970 | +// answer_body = (Printable_tree) | |
| 4971 | +// [ | |
| 4972 | +// format(cinfo, ic_v, html_content, is_https, var(0), p_content_head_tags), | |
| 4973 | +// ], | |
| 4974 | +// answer_header = (Printable_tree) | |
| 4975 | +// [ | |
| 4976 | +// // html_header, | |
| 4977 | +// format_html_head(head_tags + *p_content_head_tags), | |
| 4978 | +// ], | |
| 4979 | +// printable_tree([ | |
| 4980 | +// "HTTP/1.1 " + status_string, crlf, | |
| 4981 | +// format_headers(standard_headers), | |
| 4982 | +// format_headers(standard_headers_for("text/html", length(answer_header) + length(answer_body), success(charset))), | |
| 4983 | +// format_headers(status_headers), | |
| 4984 | +// format_headers(additional_headers), | |
| 4985 | +// crlf, | |
| 4986 | +// answer_header . | |
| 4987 | +// answer_body | |
| 4988 | +// ]), | |
| 4989 | + } | |
| 4990 | +. | |
| 5880 | 4991 | ... | ... |
Changes suppressed. Click to show
| 1 | + | |
| 2 | + | |
| 3 | + *Project* Anubis | |
| 4 | + | |
| 5 | + *Title* Making interactive Web sites. | |
| 6 | + | |
| 7 | + *Copyright* Copyright (c) Alain Prouté 2004-2005. | |
| 8 | + Copyright (c) Calexium 2007-2017. | |
| 9 | + Copyright (c) David René 2007-2021. | |
| 10 | + | |
| 11 | + | |
| 12 | + *Authors* Alain Prouté | |
| 13 | + David René | |
| 14 | + Jérémy Larrieu | |
| 15 | + Julien Verneuil | |
| 16 | + | |
| 17 | + | |
| 18 | + *Revised* May 2015 | |
| 19 | + | |
| 20 | + | |
| 21 | + *Overview* | |
| 22 | + | |
| 23 | + In this file we propose simple tools for making well structured interactive and secured | |
| 24 | + web sites. | |
| 25 | + | |
| 26 | + | |
| 27 | + ----------------------------------- Table of Contents --------------------------------- | |
| 28 | + | |
| 29 | + * (1) Structure of a web site. | |
| 30 | + ** (1.1) Three sorts of data. | |
| 31 | + ** (1.2) How requests are handled. | |
| 32 | + ** (1.3) What web pages are made of. | |
| 33 | + ** (1.4) Actions. | |
| 34 | + ** (1.5) States. | |
| 35 | + | |
| 36 | + * (2) Carrying on. | |
| 37 | + ** (2.1) Describing your web sites. | |
| 38 | + ** (2.2) Directories on the server's disk. | |
| 39 | + ** (2.3) Starting your web sites. | |
| 40 | + | |
| 41 | + * (3) The HTML interface. | |
| 42 | + ** (3.1) Types used by the HTML interface. | |
| 43 | + ** (3.2) ``in form'' versus ``off form''. | |
| 44 | + ** (3.3) Defining your own style. | |
| 45 | + ** (3.4) Actioners and forms. | |
| 46 | + ** (3.5) Local popup. | |
| 47 | + | |
| 48 | + --------------------------------------------------------------------------------------- | |
| 49 | + | |
| 50 | + | |
| 51 | +transmit tools/basis.anubis | |
| 52 | +read tools/printable_tree.anubis | |
| 53 | +read tools/base64.anubis | |
| 54 | +read tools/random.anubis | |
| 55 | +read tools/avlt_dictionaries.anubis | |
| 56 | +read system/lists.anubis | |
| 57 | +read system/string.anubis | |
| 58 | +read system/logger.anubis | |
| 59 | +transmit xlib/web/common.anubis | |
| 60 | +transmit xlib/web/multihost_http_server.anubis | |
| 61 | +read web/mime.anubis | |
| 62 | + | |
| 63 | +read xlib/web/cookies.anubis | |
| 64 | +read xlib/web/json.anubis | |
| 65 | +transmit xlib/web/web_dump.anubis | |
| 66 | +transmit xlib/web/web_arg_utils.anubis | |
| 67 | +transmit xlib/web/web_session.anubis | |
| 68 | +transmit xlib/web/web_action.anubis | |
| 69 | + | |
| 70 | +transmit xlib/web/types/web_action_name.anubis | |
| 71 | +transmit xlib/web/types/making_a_web_site.anubis | |
| 72 | + | |
| 73 | +//TODO move anywhere | |
| 74 | + | |
| 75 | + | |
| 76 | +define List(Word8) | |
| 77 | +/** Test for HTML entity which must be encoded | |
| 78 | + * and return the encoded entity if needed | |
| 79 | + */ | |
| 80 | + get_entity | |
| 81 | + ( | |
| 82 | + Word8 _char, | |
| 83 | + List(Word8) tail | |
| 84 | + )= | |
| 85 | + //test for the ampersand | |
| 86 | + if _char = '&' then | |
| 87 | + //test if it's already an encoded string like & < etc. In that case we do nothing | |
| 88 | + if insensitive_equal(['&','a','m','p',';'], tail, 0) then [_char] | |
| 89 | + else if insensitive_equal(['&','l','t',';'], tail, 0) then [_char] | |
| 90 | + else if insensitive_equal(['&','g','t',';'], tail, 0) then [_char] | |
| 91 | + else if insensitive_equal(['&','q','u','o','t',';'], tail, 0) then [_char] | |
| 92 | + else | |
| 93 | + [';','p','m','a','&'] | |
| 94 | + //test for '<' etc. | |
| 95 | + else if _char = '<' then [';','t','l','&'] | |
| 96 | + else if _char = '>' then [';','t','g','&'] | |
| 97 | + else if _char = '\"' then [';','t','o','u','q','&'] | |
| 98 | + else [_char] | |
| 99 | +. | |
| 100 | + | |
| 101 | +define String | |
| 102 | + _HTML_encode_entities | |
| 103 | + ( | |
| 104 | + List(Word8) source, | |
| 105 | + List(Word8) current | |
| 106 | + )= | |
| 107 | + if source is | |
| 108 | + { | |
| 109 | + [] then implode(reverse(current)), | |
| 110 | + [c . t] then | |
| 111 | + _HTML_encode_entities(t, get_entity(c, t) + current) | |
| 112 | + } | |
| 113 | +. | |
| 114 | + | |
| 115 | +public define String | |
| 116 | + encode_HTML_entities | |
| 117 | + ( | |
| 118 | + String source | |
| 119 | + )= | |
| 120 | + _HTML_encode_entities(explode(source), []) | |
| 121 | +. | |
| 122 | + | |
| 123 | +define List(Word8) | |
| 124 | +/** Test for HTML entity which must be encoded | |
| 125 | + * and return the encoded entity if needed | |
| 126 | + */ | |
| 127 | + get_entity_quote | |
| 128 | + ( | |
| 129 | + Word8 _char, | |
| 130 | + List(Word8) tail | |
| 131 | + )= | |
| 132 | + //test for the ampersand | |
| 133 | + if _char = '&' then | |
| 134 | + //test if it's already an encoded string like & < etc. In that case we do nothing | |
| 135 | + if insensitive_equal(['&','a','m','p',';'], tail, 0) then [_char] | |
| 136 | + else if insensitive_equal(['&','l','t',';'], tail, 0) then [_char] | |
| 137 | + else if insensitive_equal(['&','g','t',';'], tail, 0) then [_char] | |
| 138 | + else if insensitive_equal(['&','q','u','o','t',';'], tail, 0) then [_char] | |
| 139 | + else | |
| 140 | + [';','p','m','a','&'] | |
| 141 | + //test for '"' only. | |
| 142 | + else if _char = '\"' then [';','t','o','u','q','&'] | |
| 143 | + else [_char] | |
| 144 | +. | |
| 145 | + | |
| 146 | +define String | |
| 147 | + _HTML_encode_quote | |
| 148 | + ( | |
| 149 | + List(Word8) source, | |
| 150 | + List(Word8) current | |
| 151 | + )= | |
| 152 | + if source is | |
| 153 | + { | |
| 154 | + [] then implode(reverse(current)), | |
| 155 | + [c . t] then | |
| 156 | + _HTML_encode_quote(t, get_entity_quote(c, t) + current) | |
| 157 | + } | |
| 158 | +. | |
| 159 | + | |
| 160 | +public define String | |
| 161 | + encode_HTML_quote | |
| 162 | + ( | |
| 163 | + String source | |
| 164 | + )= | |
| 165 | + _HTML_encode_quote(explode(source), []) | |
| 166 | +. | |
| 167 | + | |
| 168 | + * (1) Structure of a web site. | |
| 169 | + | |
| 170 | + First of all we need to explain what a web site should be made of. Ideally, the | |
| 171 | + visitor (also called the 'client') should see the web site working as any other | |
| 172 | + interactive computer software. So, it should be clear that a 'session' (i.e. a visit | |
| 173 | + to the web site, including the consultation of several pages) is some kind of | |
| 174 | + conversation between the visitor and the web site, and that the web site should | |
| 175 | + maintain a 'current state' of this conversation. At each new request (click) from the | |
| 176 | + visitor, this state must be updated. This whole conversation is called a 'session' and | |
| 177 | + should not be confused with a single request. | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + ** (1.1) Three sorts of data. | |
| 182 | + | |
| 183 | + All the data needed for putting a web site at work may be dispatched into three | |
| 184 | + categories: | |
| 185 | + | |
| 186 | + 1. Constant data (data that never change). These data may be hard coded into the | |
| 187 | + Anubis source files of the web site. | |
| 188 | + | |
| 189 | + 2. Permanent data (data which always exist independantly of the users connected to | |
| 190 | + the web site). These data are normally recorded into data bases. | |
| 191 | + | |
| 192 | + 3. Session data (data which depend on a particular visitor and which exist only | |
| 193 | + during the time he visits the web site). These data are stored into so-called | |
| 194 | + 'states'. | |
| 195 | + | |
| 196 | + | |
| 197 | + It is important to determine which data belongs to which category. This is part of your | |
| 198 | + design decisions. | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + ** (1.2) How requests are handled. | |
| 203 | + | |
| 204 | + We want to separate the following two functionalities (which are used at each request | |
| 205 | + (click) during a single session): | |
| 206 | + | |
| 207 | + - computing the new state from the previous state and from the client request, and | |
| 208 | + updating the data base, | |
| 209 | + | |
| 210 | + - computing the page to be sent to the client from the new current state and from | |
| 211 | + the informations in the data base. | |
| 212 | + | |
| 213 | + | |
| 214 | + The next picture shows the structure we have in mind: | |
| 215 | + | |
| 216 | + | |
| 217 | + request +---------+ HTML page (with state name in cookie) | |
| 218 | + .-------------------| client |<--------------. | |
| 219 | + | .-----------------| | | | |
| 220 | + | | session +---------+ | | |
| 221 | + | | in cookie | | |
| 222 | + | | | client side | |
| 223 | + ............................................................................ | |
| 224 | + | | | server side | |
| 225 | + | | | | |
| 226 | + | | .-------------------. | | |
| 227 | + | | | previous session | | | |
| 228 | + V V V | | | |
| 229 | + +---------------+ +---------------+ +--------------+ | |
| 230 | + | compute state | | server's disk | | compute page | | |
| 231 | + +---------------+ +---------------+ +--------------+ | |
| 232 | + ^ | | ^ ^ ^ ^ ^ | |
| 233 | + | | | | | | | | | |
| 234 | + | | `--------------------+--------------------' | | | |
| 235 | + | | new state | | | | |
| 236 | + read | `------------------------+--------------------' | | |
| 237 | + write | new state name | | |
| 238 | + update V | | |
| 239 | + +-----------+ | | |
| 240 | + | data base |--------------------------------------------' | |
| 241 | + +-----------+ read only | |
| 242 | + | |
| 243 | + | |
| 244 | + When the client begins a session, there is no previous state. In this case, a default | |
| 245 | + 'initial state' is used instead. | |
| 246 | + | |
| 247 | + The data base may be updated by 'compute state' box, but should not be update by the | |
| 248 | + 'compute page' box. The 'compute page' box should be allowed only to read the data | |
| 249 | + base. | |
| 250 | + | |
| 251 | + In this file, all the above stuff is defined, except the 'compute state' and 'compute | |
| 252 | + page' boxes. You just have to provide the function for computing a new state (compute | |
| 253 | + state) and the function for computing the page (compute page) from the new state. You | |
| 254 | + don't have to worry about state names, saving and retrieving states and the like. | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + ** (1.3) What web pages are made of. | |
| 261 | + | |
| 262 | + What the client can see in his browser's window may be called a 'page'. Within a page, | |
| 263 | + we have several sorts of components: | |
| 264 | + | |
| 265 | + - 'local' components, i.e. all components which do not open a connection, like | |
| 266 | + texts, images, etc... possibly using JavaScript programmation, | |
| 267 | + | |
| 268 | + - 'actioners', which, when clicked upon, open a connection with our web site; they | |
| 269 | + may appear as links or buttons, etc... | |
| 270 | + | |
| 271 | + - 'foreign links', which when clicked upon, open a connection with another web site | |
| 272 | + (or ours eventually). | |
| 273 | + | |
| 274 | + Of course, what an actioner does is just ask our web site to perform an action. To that | |
| 275 | + end, the actioner essentially sends the name of the action to be performed. However, it | |
| 276 | + may be necessary to provide additional informations which may be seen as 'operands' of | |
| 277 | + the action. In order to attach operands to an action, HTML provides the notion of | |
| 278 | + 'form'. Indeed, a form contains essentially a set of input fields into which the client | |
| 279 | + may put values for the required operands of the action, and a submit button, which is | |
| 280 | + the actioner itself. Notice that a single form may contain several submit buttons, | |
| 281 | + which simply means that there are several distincts actions taking the same set of | |
| 282 | + operands. | |
| 283 | + | |
| 284 | + Restrictions must be put on the use of all theses gadgets. Indeed, for example, | |
| 285 | + putting a form within another form is officially meaningless in HTML, and the client's | |
| 286 | + browser may be seriously disturbed by this. In this file, we propose an interface to | |
| 287 | + the HTML language, which forbids such meaningless things, simply by imposing a strict | |
| 288 | + typing of HTML concepts. | |
| 289 | + | |
| 290 | + Each web site may be accessible through two communication channels: | |
| 291 | + | |
| 292 | + - a non secured channel (HTTP), | |
| 293 | + - a secured channel (HTTPS). | |
| 294 | + | |
| 295 | + Nevertheless, the whole thing should be considered as a single web site. For example, | |
| 296 | + you may have a secured page, obtained through HTTPS, containing public images obtained | |
| 297 | + through HTTP. An actioner in a non secured page may open a secured connection, and | |
| 298 | + conversely. | |
| 299 | + | |
| 300 | + Summarizing, a web page is made of local elements, foreign links and actioners. | |
| 301 | + Actioners receive operands from forms, and they also choose to communicate through the | |
| 302 | + non secured or through the secured channel. | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + +-------------------+ | |
| 307 | + | page | | |
| 308 | + | | +---------------+ | |
| 309 | + | +--------------+ | | next page | | |
| 310 | + | | form | | | (non secured) | | |
| 311 | + | | +----------+ | | HTTP | | | |
| 312 | + | | | actioner |---------------------------->| | | |
| 313 | + | | +----------+ | | +---------------+ | |
| 314 | + | | | | | |
| 315 | + | | +----------+ | | +---------------+ | |
| 316 | + | | | actioner |---------------------------->| next page | | |
| 317 | + | | +----------+ | | HTTPS | (secured) | | |
| 318 | + | | | | | | | |
| 319 | + | +--------------+ | | | | |
| 320 | + | | +---------------+ | |
| 321 | + | | | |
| 322 | + +-------------------+ | |
| 323 | + | |
| 324 | + | |
| 325 | + Notice that actioners need no be necessarily put into forms. In that case, they work as | |
| 326 | + ordinary links, but they still may receive operands as we shall see. | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + ** (1.4) Actions. | |
| 332 | + | |
| 333 | + The client opens a new connection with our web site whenever he clicks on an | |
| 334 | + actioner. The result is that a request is sent, essentially made of a list of 'web | |
| 335 | + arguments'. Each web argument is a pair (name,value). One of these web arguments, the | |
| 336 | + 'action' web argument (whose name is "a"), determines the action to be performed. The | |
| 337 | + other web arguments (not including "s", used to identify the state) are the operands | |
| 338 | + for this action. | |
| 339 | + | |
| 340 | + Hence, the 'compute state' box in the picture above, splits naturally into as many | |
| 341 | + sub-boxes as there are actions. For this reason, we define the following type for | |
| 342 | + representing actions (where '$State' is the type representing session informations): | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + 'http_action's are executed only under HTTP, and 'https_action's are executed only | |
| 347 | + under HTTPS. 'http_https_action's may be executed under both types of connections. | |
| 348 | + | |
| 349 | + Each action has a name, which is used to identify the action. Each action also has a | |
| 350 | + function 'allow' whose job is to verify that the action is allowed in the current | |
| 351 | + state, and a function 'do_it' for performing the action. The function 'do_it' receives | |
| 352 | + a lot of informations: | |
| 353 | + | |
| 354 | + - 'HTTP informations': | |
| 355 | + - the IP address of the client, | |
| 356 | + - the URI requested by the client (after redirection), | |
| 357 | + - the list of HTTP headers generated by the client's browser, | |
| 358 | + - the list of web arguments sent by the client (except "s" and "a"), | |
| 359 | + - the previous state (or the 'initial' or 'ticket expired' state if no previous | |
| 360 | + state can be found). | |
| 361 | + | |
| 362 | + In most cases, HTTP informations are not used. This is the reason why they are gathered | |
| 363 | + for simplicity into a unique datum of type 'HTTP_Info'. | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + When you define your web site, you must provide the list of all the actions of the | |
| 369 | + site. When a new state has been computed, a graphical representation of this state | |
| 370 | + must be sent to the client. To that end, you must provide a function (named below | |
| 371 | + 'compute_page') of type: | |
| 372 | + | |
| 373 | + $State -> HTTP_Answer | |
| 374 | + | |
| 375 | + where the type 'HTTP_Answer' (defined below in this file) abstractly represents HTML | |
| 376 | + pages. | |
| 377 | + | |
| 378 | +//public type HTTP_Answer:... | |
| 379 | + | |
| 380 | + It should be clear that states and pages are deeply linked together. Indeed, we really | |
| 381 | + understand the page shown to the client as a representation of the current state of the | |
| 382 | + conversation between the client and the web site, but also containing informations | |
| 383 | + taken from the data bases. | |
| 384 | + | |
| 385 | + | |
| 386 | +//public type HTML_Partial_Content:... | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | +public define List(HTTP_header) | |
| 397 | + make_session_cookie_headers | |
| 398 | + ( | |
| 399 | + String website_name, | |
| 400 | + String session_name | |
| 401 | + ) | |
| 402 | + = | |
| 403 | + //println("Set-Cookie state_"+website_name+"="+state_name); | |
| 404 | + [ | |
| 405 | + http_header("Set-Cookie", "session_"+website_name+"="+session_name+"; SameSite=Strict") | |
| 406 | + ] | |
| 407 | + . | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + When a request arrives, we need to retrieve the previous state from the server's | |
| 412 | + disk. We receive the name of that state. If the state is out of date, the state file is | |
| 413 | + kept 3 days, and then deleted. | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | +define One | |
| 419 | + delete_out_of_date_sessions // for all web sites | |
| 420 | + ( | |
| 421 | + List((String, List(String) -> One)) directories_and_functions | |
| 422 | + )= | |
| 423 | + if directories_and_functions is | |
| 424 | + { | |
| 425 | + [ ] then unique, | |
| 426 | + [h . t] then | |
| 427 | + since h is (state_directory, function), | |
| 428 | + function(directory_list(state_directory,"*")); | |
| 429 | + delete_out_of_date_sessions(t) | |
| 430 | + } | |
| 431 | +. | |
| 432 | + | |
| 433 | + ** (1.5) States. | |
| 434 | + | |
| 435 | + Now, we explain how you can define the type (say 'State') to be used as an instance of | |
| 436 | + the type parameter '$State'. The following is just a suggestion. | |
| 437 | + | |
| 438 | + Each state determines a page (since 'compute_page' computes a page from a | |
| 439 | + state). However, some components of the state may be independant of the page. It may be | |
| 440 | + the case for example for the indication of the natural language used by the | |
| 441 | + client. Hence, a state should be made of (at least) two parts: | |
| 442 | + | |
| 443 | + - informations which are the same for all pages, | |
| 444 | + - informations which are particular to each page. | |
| 445 | + | |
| 446 | + For example, you could define: | |
| 447 | + | |
| 448 | + type Page: // one alternative per page, with particular informations | |
| 449 | + login(...), // in the components | |
| 450 | + main_page(...), | |
| 451 | + ...etc... | |
| 452 | + | |
| 453 | + Now, the type 'State' could be defined as follows: | |
| 454 | + | |
| 455 | + type State: | |
| 456 | + state(Language, // informations valid for all pages | |
| 457 | + ..., | |
| 458 | + Page). // informations particular to a page | |
| 459 | + | |
| 460 | + However, if you are making a secured web site within which clients should be identified | |
| 461 | + (by id and password), it may be a good idea to have two sorts of states, one for non | |
| 462 | + identified clients and one for identified clients. In this case, define the type | |
| 463 | + 'State' as follows (this is just a suggestion): | |
| 464 | + | |
| 465 | + type State: | |
| 466 | + non_identified(Language), | |
| 467 | + identified(String id, | |
| 468 | + Language, | |
| 469 | + Page). | |
| 470 | + | |
| 471 | + When a request arrives, check if the previous state is 'identified(...)' or | |
| 472 | + 'non_identified(...)', and don't provide access to certain pages to non identified | |
| 473 | + clients. This is required for security. | |
| 474 | + | |
| 475 | + Some more words on security. If your site needs to identify clients, define the | |
| 476 | + initial state as 'non_identified(...)'. Construct a 'login' page, and check the id and | |
| 477 | + password of the client. If the id and password are correct, then change the state of | |
| 478 | + the client to 'identified(...)'. No other action should be able to do that. Now, be | |
| 479 | + confident that clients cannot forge states. The only information they have is the name | |
| 480 | + of a state, not the state itself which is never sent over the network, but only stored | |
| 481 | + on the server's disk. The name of the state is constructed using strong cryptographical | |
| 482 | + methods (sha1). If everything (since the 'login' page) is performed under HTTPS, even | |
| 483 | + state names cannot be seen by a third party. So, if the system retrieves a previous | |
| 484 | + state of the form 'identified(...)', you can be confident that your client is well | |
| 485 | + identified, and you can send him confidential informations. | |
| 486 | + | |
| 487 | + States have a limited life time. It may happen that a client clicks on a button at a | |
| 488 | + time its state is out of date. In this case, this system considers that the new state | |
| 489 | + is a special state named 'ticket expired'. You must provide a function producing this | |
| 490 | + state when you describe your web site. The page corresponding to this state must just | |
| 491 | + inform the client that he/she waited a too long time before clicking on a button, and | |
| 492 | + has to restart (a new conversation) from the begining. | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + * (2) Carrying on. | |
| 497 | + | |
| 498 | + ** (2.1) Describing your web sites. | |
| 499 | + | |
| 500 | + Before you may start your web site, you must describe it, i.e. produce a datum of the | |
| 501 | + opaque type 'Web_Site'. | |
| 502 | + | |
| 503 | +public type Web_Site:... | |
| 504 | + | |
| 505 | + Producing such a datum may be performed by: | |
| 506 | + | |
| 507 | + public define Web_Site | |
| 508 | + make_web_site_description | |
| 509 | + ( | |
| 510 | + List(String) common_names, // for example: ["www.our-business.com", | |
| 511 | + // "192.168.0.1"] | |
| 512 | + // the second one is just for testing | |
| 513 | + String site_directory, // where 'public' and other directories are | |
| 514 | + // located (should NOT end with '/') | |
| 515 | + String state_directory, | |
| 516 | + One -> One init, | |
| 517 | + (HTTP_Info, | |
| 518 | + List(Web_arg), | |
| 519 | + Bool is_https) -> $State initial_state, | |
| 520 | + ($State expired, | |
| 521 | + Maybe(String), | |
| 522 | + HTTP_Info, | |
| 523 | + List(Web_arg), | |
| 524 | + Bool is_https) -> $State ticket_expired_state, | |
| 525 | + (Maybe(String), | |
| 526 | + HTTP_Info, | |
| 527 | + List(Web_arg), | |
| 528 | + Bool is_https) -> $State ticket_lost_state, | |
| 529 | + List(Web_Action($State)) actions, | |
| 530 | + $State -> HTTP_Answer compute_page, | |
| 531 | + $State -> List(HTTP_header) additional_headers, | |
| 532 | + List(HTTP_header) constant_additional_headers, | |
| 533 | + Int timeout, // seconds (todo: minutes) | |
| 534 | + Redirections redirections, | |
| 535 | + String charset, | |
| 536 | + List(String) journal_extensions, | |
| 537 | + List(String) journal_headers, | |
| 538 | + String authorization_secret, | |
| 539 | + List(MIME) known_mime_types, | |
| 540 | + (String action_name, | |
| 541 | + List(Web_arg) args)-> One before_send_file | |
| 542 | + ). | |
| 543 | + | |
| 544 | + | |
| 545 | + Explanations: | |
| 546 | + | |
| 547 | + 'common_names' is the list of names of the site (the name the browser must send as the | |
| 548 | + value of the 'Host' HTTP header in order to access the site must be in that list). Such | |
| 549 | + a name generally looks like this: | |
| 550 | + | |
| 551 | + www.somewhere.com | |
| 552 | + | |
| 553 | + If you are using HTTPS, you also have an 'X.509 SSL server certificate'. The name of | |
| 554 | + the site must be exactly the same as the name on the certificate (which is precisely | |
| 555 | + called the 'common name' in the X.509 jargon). If the two names do not match, the site | |
| 556 | + will still work, but the transaction will not be transparent to the client. His browser | |
| 557 | + will complain that the name of the certificate does not match the name of the site, and | |
| 558 | + he will have to accept the certificate manually. | |
| 559 | + | |
| 560 | + 'site_directory' is the absolute path to the directory where the files needed by the | |
| 561 | + site are located. Usually this directory looks like: | |
| 562 | + | |
| 563 | + my_anubis/web_sites/www.somewhere.com | |
| 564 | + | |
| 565 | + However, this information is not computed from 'common_name', so that you can change | |
| 566 | + the common name (for example temporarily, for networking reasons) without loosing | |
| 567 | + access to the files. | |
| 568 | + | |
| 569 | + 'ticket_expired_state(expired_state,http_info,lwa,is_https)' must produce the state | |
| 570 | + whose graphical representation is a page explaining to the user that its 'ticket' (or | |
| 571 | + 'session information') has expired, and that he/she must close all popup windows and | |
| 572 | + start a new session. The arguments of the function contain the previous (expired) | |
| 573 | + state and all current informations concerning the user. This arguments may be useful | |
| 574 | + for example for producing the expiration message in the language chosen by the user. | |
| 575 | + You can also (and this may be much smarter) send a 'ticket prolongation page' | |
| 576 | + (including a new login for example), and resume the same conversation, since you have | |
| 577 | + all the pertinent informations at hand. In the case the ticket is definitely lost, the | |
| 578 | + second fonction 'ticket_lost_state' is used. | |
| 579 | + | |
| 580 | + Notice that despite the fact that the parameter $State is involved in the arguments of | |
| 581 | + the above function, the type 'Web_Site' does not depend on this parameter. This allows | |
| 582 | + to produce lists of web site descriptions, where each description may be constructed | |
| 583 | + with a different instance of $State. This is required because distinct sites must have | |
| 584 | + distinct types of session informations. This is made possible by the fact that the | |
| 585 | + type is obscure, and the constructor replaced by a function which assembles | |
| 586 | + 'ticket_expired_state', ticket_lost_state', 'actions' and 'compute_page' into a single | |
| 587 | + entity not depending on $State. You should have a look to the private part of this file | |
| 588 | + if you want more precisions about this programming technique. | |
| 589 | + | |
| 590 | + 'charset' is a string which will determine the character encoding to be used by the | |
| 591 | + browser. Typically, this string is one of: "UTF-8", "ISO-8859-1", "Windows-1252", | |
| 592 | + etc... | |
| 593 | + | |
| 594 | + 'before_send_file' is a function which is executed just before the HTTP server sends a | |
| 595 | + file. It gets an action name and the web arguments received with the request for that | |
| 596 | + file. Notice that this action name and these web arguments may be put into a | |
| 597 | + 'private_download' element, and will come back to the server at the time of the | |
| 598 | + download. | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + ** (2.2) Directories on the server's disk. | |
| 603 | + | |
| 604 | + The description of your site contains the name of the directory within which the | |
| 605 | + required files are located. This may be for example: | |
| 606 | + | |
| 607 | + my_anubis/web_sites/www.our-business.com/ | |
| 608 | + | |
| 609 | + This is called the 'site directory' (for the given site). Within the site directory, | |
| 610 | + the following directories are created by this program: | |
| 611 | + | |
| 612 | + states | |
| 613 | + public | |
| 614 | + journal | |
| 615 | + private_download | |
| 616 | + upload_temporary | |
| 617 | + | |
| 618 | + The directory 'states' is used for storing states (session informations). Out of date | |
| 619 | + states are automatically removed after some time. | |
| 620 | + | |
| 621 | + The tree rooted at 'public' contains files that the server is allowed to send to the | |
| 622 | + clients. For security reasons, the server never sends a file which is not within the | |
| 623 | + tree whose root is this 'public' directory (except for the 'private download' mecanism; | |
| 624 | + see 'web/multihost_http_server.anubis'). Also, the MIME type (see 'web/mime.anubis') | |
| 625 | + must have been recognized before the file may be sent. | |
| 626 | + | |
| 627 | + The directory 'journal' contains the jounal files. The roles of the remaining | |
| 628 | + directories 'private_download' and 'upload_temporary' is explained in | |
| 629 | + 'multihost_http_server.anubis', where you will also find further informations on | |
| 630 | + 'public' and 'journal'. | |
| 631 | + | |
| 632 | + | |
| 633 | + ** (2.3) Web servers parameters. | |
| 634 | + | |
| 635 | + The web servers have several parameters useful for administration. They are described | |
| 636 | + as follows: | |
| 637 | + | |
| 638 | + public type WebServersParameters: | |
| 639 | + wsparms(Var(Bool) shutdown_required, | |
| 640 | + | |
| 641 | + ** (2.4) Starting your web sites. | |
| 642 | + | |
| 643 | + When you have described all your web sites (you may want to have several web sites, and | |
| 644 | + they are distinguished by their 'common name'), you may start them all together using | |
| 645 | + 'start_web_sites' below. This function returns a result of the following type: | |
| 646 | + | |
| 647 | +public type Start_Web_Sites_Result: | |
| 648 | + cannot_bind_to_port(Word32), | |
| 649 | + cannot_bind_to_port(Word32,Word32), | |
| 650 | + ok(Server http_server, | |
| 651 | + Server https_server). | |
| 652 | + | |
| 653 | + Indeed, it may happen that the system cannot bind (begin to listen) to one of the two | |
| 654 | + ports (or to both). The main reason is that another server is already listening on that | |
| 655 | + port. Another reason may be that 'anbexec' has not been correctly installed, i.e. that | |
| 656 | + the 's' bit has not been set for 'user' and 'group' (there is not such problem under | |
| 657 | + Windows). Also notice that the Linux kernel may need a rather long time (up to several | |
| 658 | + minutes) before liberating a listening port. Now, if the system can bind to the two | |
| 659 | + ports, the pair of the two servers is returned. Two tools are useful for manipulating | |
| 660 | + servers: | |
| 661 | + | |
| 662 | + shutdown of type Server -> One | |
| 663 | + is_down of type Server -> Bool | |
| 664 | + | |
| 665 | + They are defined in 'predefined.anubis' (together with the type 'Server'). | |
| 666 | + | |
| 667 | + | |
| 668 | +public define Start_Web_Sites_Result | |
| 669 | + start_web_sites | |
| 670 | + ( | |
| 671 | + Word32 ip_address, // the IP address shared by the web sites | |
| 672 | + Word32 http_port, // usually: 80 | |
| 673 | + Word32 https_port, // usually: 443 | |
| 674 | + String ssl_certificate_common_name, | |
| 675 | + List(Web_Site) web_sites, // web sites to be started | |
| 676 | + (One) -> Bool shutdown_required | |
| 677 | + ). | |
| 678 | + | |
| 679 | + 'ip_address' is the IP address on which the two servers listen. If you put 0, the | |
| 680 | + servers listen on all the IP addresses of the machine. This may be useful if the | |
| 681 | + machine has several network interfaces. | |
| 682 | + | |
| 683 | + 'ssl_certificate_common_name' is the common name of the SSL certificate that 'anbexec' | |
| 684 | + loads when it starts. One instance of 'anbexec' cannot handle more than one SSL server | |
| 685 | + certificate. This is due to a problem of conception of SSL itself. See the book 'SSL | |
| 686 | + and TLS' by Eric Rescorla (at Addison Wesley) for more explanations. | |
| 687 | + | |
| 688 | + Notice that the number of servers is always 2, regardless of the number of web sites | |
| 689 | + you are starting. | |
| 690 | + | |
| 691 | + The dynamic variable 'shutdown_required' may be used to control the shutdown of the two | |
| 692 | + servers from within the web site (typically the administration part). The servers will | |
| 693 | + shutdown as soon as this variable contains 'true'. So you must provide a variable | |
| 694 | + containing 'false' otherwise your servers will not run. You may also use the primitive | |
| 695 | + 'must_restart' (see 'predefined.anubis') to control the restarting of your servers. | |
| 696 | + | |
| 697 | + * (3) The HTML interface. | |
| 698 | + | |
| 699 | + We propose an interface to dynamic HTML. Dynamic HTML includes HTML, and a combination | |
| 700 | + of CSS (Cascading Style Sheet) and JavaScript techniques for making HTML elements more | |
| 701 | + reactive and attractive on the client side. | |
| 702 | + | |
| 703 | + | |
| 704 | + ** (3.1) Types used by the HTML interface. | |
| 705 | + | |
| 706 | + For easy reference, we gather below the definitions of all the types used by the HTML | |
| 707 | + interface, and we comment them immediately. | |
| 708 | + | |
| 709 | + //public type HTML_Off_Form:... | |
| 710 | + | |
| 711 | + | |
| 712 | +public define Printable_tree [HTML_Id x . Printable_tree y] = str_pt(x.id, y). | |
| 713 | +public define Printable_tree [HtmlClass x . Printable_tree y] = str_pt(x.class, y). | |
| 714 | +public define Printable_tree [WebArgName x . Printable_tree y] = str_pt(x.name, y). | |
| 715 | +public define Printable_tree [WebArgValue x . Printable_tree y] = str_pt(x.value, y). | |
| 716 | +public define Printable_tree [InitialValue x . Printable_tree y] = str_pt(x.value, y). | |
| 717 | + | |
| 718 | +public define CoreAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). | |
| 719 | +public define CoreAttrs attr(String name, Int value) = attr(name, to_String(value)). | |
| 720 | + | |
| 721 | + | |
| 722 | +public define InputAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | +public define Text_Option | |
| 727 | + tooltip(String s) = title(s). | |
| 728 | + | |
| 729 | + A list of 'Text_Option' must be given with each text you want to put in your page. | |
| 730 | + | |
| 731 | +public define CoreAttrs | |
| 732 | + tooltip(String s) = title(s). | |
| 733 | +public define InputAttrs | |
| 734 | + tooltip(String s) = title(s). | |
| 735 | + | |
| 736 | + | |
| 737 | +public type I18n: | |
| 738 | + lang (String), | |
| 739 | + dir (Reading_Way). | |
| 740 | + | |
| 741 | + | |
| 742 | + A list of 'DIV_Option' must be given with each DIV you want to put in your page. | |
| 743 | + | |
| 744 | +public define String | |
| 745 | + event_name | |
| 746 | + ( | |
| 747 | + HtmlEvents e | |
| 748 | + ) = | |
| 749 | + if e is | |
| 750 | + { | |
| 751 | + onafterprint then "onafterprint", //HTML5 Script to be run after the document is printed | |
| 752 | + onbeforeprint then "onbeforeprint", //HTML5 Script to be run before the document is printed | |
| 753 | + onbeforeunload then "onbeforeunload", //HTML5 Script to be run when the document is about to be unloaded | |
| 754 | + onerror then "onerror", //HTML5 Script to be run when an error occurs | |
| 755 | + onhashchange then "onhashchange", //HTML5 Script to be run when there has been changes to the anchor part of the a URL | |
| 756 | + onload then "onload", // Fires after the page is finished loading | |
| 757 | + onmessage then "onmessage", //HTML5 Script to be run when the message is triggered | |
| 758 | + onoffline then "onoffline", //HTML5 Script to be run when the browser starts to work offline | |
| 759 | + ononline then "ononline", //HTML5 Script to be run when the browser starts to work online | |
| 760 | + onpagehide then "onpagehide", //HTML5 Script to be run when a user navigates away from a page | |
| 761 | + onpageshow then "onpageshow", //HTML5 Script to be run when a user navigates to a page | |
| 762 | + onpopstate then "onpopstate", //HTML5 Script to be run when the window's history changes | |
| 763 | + onresize then "onresize", //HTML5 Fires when the browser window is resized | |
| 764 | + onstorage then "onstorage", //HTML5 Script to be run when a Web Storage area is updated | |
| 765 | + onunload then "onunload", // Fires once a page has unloaded (or the browser window has been closed) | |
| 766 | + // Form element events | |
| 767 | + onblur then "onblur", // Fires the moment that the element loses focus | |
| 768 | + onchange then "onchange", // Fires the moment when the value of the element is changed | |
| 769 | + oncontextmenu then "oncontextmenu", //HTML5 Script to be run when a context menu is triggered | |
| 770 | + onfocus then "onfocus", // Fires the moment when the element gets focus | |
| 771 | + oninput then "oninput", //HTML5 Script to be run when an element gets user input | |
| 772 | + oninvalid then "oninvalid", //HTML5 Script to be run when an element is invalid | |
| 773 | + onreset then "onreset", // Fires when the Reset button in a form is clicked | |
| 774 | + onsearch then "onsearch", // Fires when the user writes something in a search field (for <input="search">) | |
| 775 | + onselect then "onselect", // Fires after some text has been selected in an element | |
| 776 | + onsubmit then "onsubmit", // Fires when a form is submitted | |
| 777 | + // Keyboard events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) | |
| 778 | + onkeydown then "onkeydown", // Fires when a user is pressing a key | |
| 779 | + onkeypress then "onkeypress", // Fires when a user presses a key | |
| 780 | + onkeyup then "onkeyup", // Fires when a user releases a key | |
| 781 | + // Mouse events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) | |
| 782 | + onclick then "onclick", // Fires on a mouse click on the element | |
| 783 | + ondblclick then "ondblclick", // Fires on a mouse double-click on the element | |
| 784 | + onmousedown then "onmousedown", // Fires when a mouse button is pressed down on an element | |
| 785 | + onmousemove then "onmousemove", // Fires when the mouse pointer is moving while it is over an element | |
| 786 | + onmouseout then "onmouseout", // Fires when the mouse pointer moves out of an element | |
| 787 | + onmouseover then "onmouseover", // Fires when the mouse pointer moves over an element | |
| 788 | + onmouseup then "onmouseup", // Fires when a mouse button is released over an element | |
| 789 | + onwheel then "onwheel", //HTML5 Fires when the mouse wheel rolls up or down over an element | |
| 790 | + //Drag Events | |
| 791 | + ondrag then "ondrag", //HMTL5 Script to be run when an element is dragged | |
| 792 | + ondragend then "ondragend", //HTML5 Script to be run at the end of a drag operation | |
| 793 | + ondragenter then "ondragenter", //HTML5 Script to be run when an element has been dragged to a valid drop target | |
| 794 | + ondragleave then "ondragleave", //HTML5 Script to be run when an element leaves a valid drop target | |
| 795 | + ondragover then "ondragover", //HTML5 Script to be run when an element is being dragged over a valid drop target | |
| 796 | + ondragstart then "ondragstart", //HTML5 Script to be run at the start of a drag operation | |
| 797 | + ondrop then "ondrop", //HTML5 Script to be run when dragged element is being dropped | |
| 798 | + onscroll then "onscroll", //HTML5 Script to be run when an element's scrollbar is being scrolled | |
| 799 | + //Clipboard Events | |
| 800 | + oncopy then "oncopy", //HTML5 Fires when the user copies the content of an element | |
| 801 | + oncut then "oncut", //HTML5 Fires when the user cuts the content of an element | |
| 802 | + onpaste then "onpaste", //HTML5 Fires when the user pastes some content in an element | |
| 803 | + //Media Events | |
| 804 | + onabort then "onabort", //HTML5 Script to be run on abort | |
| 805 | + oncanplay then "oncanplay", //HTML5 Script to be run when a file is ready to start playing (when it has buffered enough to begin) | |
| 806 | + oncanplaythrough then "oncanplaythrough", //HTML5 Script to be run when a file can be played all the way to the end without pausing for buffering | |
| 807 | + oncuechange then "oncuechange", //HTML5 Script to be run when the cue changes in a <track> element | |
| 808 | + ondurationchange then "ondurationchange", //HTML5 Script to be run when the length of the media changes | |
| 809 | + onemptied then "onemptied", //HTML5 Script to be run when something bad happens and the file is suddenly unavailable (like unexpectedly disconnects) | |
| 810 | + onended then "onended", //HTML5 Script to be run when the media has reach the end (a useful event for messages like "thanks for listening") | |
| 811 | + onerror then "onerror", //HTML5 Script to be run when an error occurs when the file is being loaded | |
| 812 | + onloadeddata then "onloadeddata", //HTML5 Script to be run when media data is loaded | |
| 813 | + onloadedmetadata then "onloadedmetadata", //HTML5 Script to be run when meta data (like dimensions and duration) are loaded | |
| 814 | + onloadstart then "onloadstart", //HTML5 Script to be run just as the file begins to load before anything is actually loaded | |
| 815 | + onpause then "onpause", //HTML5 Script to be run when the media is paused either by the user or programmatically | |
| 816 | + onplay then "onplay", //HTML5 Script to be run when the media is ready to start playing | |
| 817 | + onplaying then "onplaying", //HTML5 Script to be run when the media actually has started playing | |
| 818 | + onprogress then "onprogress", //HTML5 Script to be run when the browser is in the process of getting the media data | |
| 819 | + onratechange then "onratechange", //HTML5 Script to be run each time the playback rate changes (like when a user switches to a slow motion or fast forward mode) | |
| 820 | + onseeked then "onseeked", //HTML5 Script to be run when the seeking attribute is set to false indicating that seeking has ended | |
| 821 | + onseeking then "onseeking", //HTML5 Script to be run when the seeking attribute is set to true indicating that seeking is active | |
| 822 | + onstalled then "onstalled", //HTML5 Script to be run when the browser is unable to fetch the media data for whatever reason | |
| 823 | + onsuspend then "onsuspend", //HTML5 Script to be run when fetching the media data is stopped before it is completely loaded for whatever reason | |
| 824 | + ontimeupdate then "ontimeupdate", //HTML5 Script to be run when the playing position has changed (like when the user fast forwards to a different point in the media) | |
| 825 | + onvolumechange then "onvolumechange", //HTML5 Script to be run each time the volume is changed which (includes setting the volume to "mute") | |
| 826 | + onwaiting then "onwaiting", //HTML5 Script to be run when the media has paused but is expected to resume (like when the media pauses to buffer more data) | |
| 827 | + //Misc Events | |
| 828 | + onshow then "onshow", //HTML5 Fires when a <menu> element is shown as a context menu | |
| 829 | + ontoggle then "ontoggle" | |
| 830 | + }. | |
| 831 | + | |
| 832 | + | |
| 833 | +public define Table_Option nude = border(0,0,0,rgb(0,0,0)). | |
| 834 | + | |
| 835 | + | |
| 836 | + A list of 'Table_Option' must be given with each table. | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + A list of 'Cell_Option' must be given with each cell and each row in a table. Options | |
| 844 | + given with a row apply to all the cells in the row, but are superseded by options given | |
| 845 | + with cells, which apply only to the cell they are given with. | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + The parameter $T is later instantiated either to 'HTML_In_Form' or to 'HTML_Off_Form', | |
| 852 | + depending on where you put your table (within a form or not within a form). For your | |
| 853 | + convenience, we define the following particular case: | |
| 854 | + | |
| 855 | +public define HTML_Cell($T) | |
| 856 | + cell | |
| 857 | + ( | |
| 858 | + $T content | |
| 859 | + )= | |
| 860 | + cell([],content) | |
| 861 | +. | |
| 862 | + | |
| 863 | +public define HTML_Cell($T) | |
| 864 | + cell | |
| 865 | + ( | |
| 866 | + Cell_Option option, | |
| 867 | + $T content | |
| 868 | + ) = | |
| 869 | + cell([option],content) | |
| 870 | +. | |
| 871 | + | |
| 872 | +public define HTML_Header_Cell($T) | |
| 873 | + header_cell | |
| 874 | + ( | |
| 875 | + $T content | |
| 876 | + ) = | |
| 877 | + header_cell([],content). | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + Same remark as for 'HTML_Cell($T)'. We define several convenience functions: | |
| 883 | + | |
| 884 | +public define HTML_Row($T) | |
| 885 | + row | |
| 886 | + ( | |
| 887 | + List(HTML_Cell($T)) cells | |
| 888 | + )= | |
| 889 | + row([],cells). | |
| 890 | + | |
| 891 | +public define HTML_Row($T) | |
| 892 | + row | |
| 893 | + ( | |
| 894 | + HTML_Cell($T) cell | |
| 895 | + )= | |
| 896 | + row([],[cell]). | |
| 897 | + | |
| 898 | +public define HTML_Row($T) | |
| 899 | + row | |
| 900 | + ( | |
| 901 | + List(Cell_Option) options, | |
| 902 | + HTML_Cell($T) cell | |
| 903 | + )= | |
| 904 | + row(options,[cell]). | |
| 905 | + | |
| 906 | +public define HTML_Row($T) | |
| 907 | + row | |
| 908 | + ( | |
| 909 | + Cell_Option option, | |
| 910 | + HTML_Cell($T) cell | |
| 911 | + )= | |
| 912 | + row([option],[cell]). | |
| 913 | + | |
| 914 | +public define HTML_Header_Row($T) | |
| 915 | + header_row | |
| 916 | + ( | |
| 917 | + List(HTML_Header_Cell($T)) cells | |
| 918 | + ) = | |
| 919 | + header_row([],cells). | |
| 920 | + | |
| 921 | +public define HTML_Header_Row($T) | |
| 922 | + header_row | |
| 923 | + ( | |
| 924 | + HTML_Header_Cell($T) cell | |
| 925 | + ) = | |
| 926 | + header_row([],[cell]). | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | +public define Actioner_Aspect | |
| 931 | + immediate_selector | |
| 932 | + ( | |
| 933 | + List(CoreAttrs) core_attrs, | |
| 934 | + WebArgName name, | |
| 935 | + Int size, | |
| 936 | + List((List(CoreAttrs),WebArgValue,String)) choices | |
| 937 | + )= | |
| 938 | + immediate_selector(core_attrs, name, size, choices, failure, "") | |
| 939 | + . | |
| 940 | + | |
| 941 | +public define Actioner_Aspect | |
| 942 | + immediate_selector | |
| 943 | + ( | |
| 944 | + List(CoreAttrs) core_attrs, | |
| 945 | + WebArgName name, | |
| 946 | + Int size, | |
| 947 | + List((List(CoreAttrs),WebArgValue,String)) choices, | |
| 948 | + Maybe(InitialValue) selected | |
| 949 | + )= | |
| 950 | + immediate_selector(core_attrs, name, size, choices, selected, "") | |
| 951 | + . | |
| 952 | + | |
| 953 | + | |
| 954 | +public define Actioner_Aspect | |
| 955 | + link | |
| 956 | + ( | |
| 957 | + List(Text_Option) options, | |
| 958 | + String text | |
| 959 | + )= | |
| 960 | + link(options, text, failure). | |
| 961 | + | |
| 962 | +public define Actioner_Aspect | |
| 963 | + link | |
| 964 | + ( | |
| 965 | + String text | |
| 966 | + ) = | |
| 967 | + link([], text, failure). | |
| 968 | + | |
| 969 | + | |
| 970 | +public define Actioner_Aspect | |
| 971 | + link | |
| 972 | + ( | |
| 973 | + List(Text_Option) options, | |
| 974 | + Int i | |
| 975 | + ) = | |
| 976 | + link(options, to_decimal(i), failure). | |
| 977 | + | |
| 978 | +public define Actioner_Aspect | |
| 979 | + link | |
| 980 | + ( | |
| 981 | + Int i | |
| 982 | + ) = | |
| 983 | + link([], i). | |
| 984 | + | |
| 985 | +public define Actioner_Aspect | |
| 986 | + button | |
| 987 | + ( | |
| 988 | + String url_img | |
| 989 | + ) = | |
| 990 | + button(url_img,url_img). | |
| 991 | + | |
| 992 | + Actioners are explained in details below. | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | +public define String | |
| 999 | + to_String | |
| 1000 | + ( | |
| 1001 | + CSS_File_Media css_file_media | |
| 1002 | + )= | |
| 1003 | + if css_file_media is | |
| 1004 | + { | |
| 1005 | + screen then "screen", | |
| 1006 | + tty then "tty", | |
| 1007 | + tv then "tv", | |
| 1008 | + projection then "projection", | |
| 1009 | + handheld then "handheld", | |
| 1010 | + print then "print", | |
| 1011 | + braille then "braille", | |
| 1012 | + aural then "aural", | |
| 1013 | + all then "all" | |
| 1014 | + }. | |
| 1015 | + | |
| 1016 | + | |
| 1017 | +//public type HTML_Meta:... | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | +public define HTML_Head_Tag | |
| 1022 | + js_script | |
| 1023 | + ( | |
| 1024 | + String script_content | |
| 1025 | + )= | |
| 1026 | + js_inline(script("text/javascript", script_content)) | |
| 1027 | +. | |
| 1028 | + /* Label with help */ | |
| 1029 | + | |
| 1030 | + | |
| 1031 | +public define HTML_tooltip | |
| 1032 | + html_tooltip | |
| 1033 | + ( | |
| 1034 | + String keyword, | |
| 1035 | + Int width | |
| 1036 | + )= | |
| 1037 | + html_tooltip("", keyword, width). | |
| 1038 | + | |
| 1039 | +public define HTML_tooltip | |
| 1040 | + html_tooltip | |
| 1041 | + ( | |
| 1042 | + String title, | |
| 1043 | + String keyword | |
| 1044 | + )= | |
| 1045 | + html_tooltip(title, keyword, 0). | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | +public define HTML_Help | |
| 1050 | + tooltip | |
| 1051 | + ( | |
| 1052 | + HTML_tooltip h_tooltip | |
| 1053 | + )= | |
| 1054 | + tooltip(h_tooltip, left) | |
| 1055 | +. | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + /* It contains | |
| 1060 | + * - a List of HTML_Head_Tag representing necessaries head tags for the content. ex: jquery js files, js script, css specific styles, ... | |
| 1061 | + * - a HTML_Off_Form representing the HTML code for the part of the page we want to display | |
| 1062 | + */ | |
| 1063 | +//public type HTML_In_Form:... | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | +public define List(HTML_Head_Tag) | |
| 1068 | + to_HTML_Head_Tag | |
| 1069 | + ( | |
| 1070 | + List(CSS_File) css_file_list | |
| 1071 | + )= | |
| 1072 | + map((CSS_File css_f) |-> css(css_f), css_file_list). | |
| 1073 | + | |
| 1074 | +public define List(HTML_Head_Tag) | |
| 1075 | + to_HTML_Head_Tag | |
| 1076 | + ( | |
| 1077 | + List(JS_File) js_file_list | |
| 1078 | + )= | |
| 1079 | + map((JS_File js_f) |-> js(js_f), js_file_list). | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + 'HTML_In_Form' defines all the elements you may put within a form. We define a | |
| 1084 | + convenience function: | |
| 1085 | + | |
| 1086 | + | |
| 1087 | +public define HTML_Off_Form text_input(HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width) = text_input([], label, id, name, init, width). | |
| 1088 | + | |
| 1089 | +public define HTML_Off_Form literal(Printable_tree t) = literal_pt(t). | |
| 1090 | + | |
| 1091 | +public define HTML_Off_Form image(String url) = image([], url, url). | |
| 1092 | + | |
| 1093 | +public define HTML_Off_Form image(String url, Int width, Int height) = image([], url, url, width, height). | |
| 1094 | + | |
| 1095 | +public define HTML_In_Form | |
| 1096 | + foreign_link | |
| 1097 | + ( | |
| 1098 | + Int tsize, | |
| 1099 | + String url, | |
| 1100 | + String name | |
| 1101 | + ) = | |
| 1102 | + foreign_link([size(tsize)],url,name). | |
| 1103 | + | |
| 1104 | +public define HTML_In_Form | |
| 1105 | +/* Older call with String as action instead of WEB_Action_Name. | |
| 1106 | + * This function exists only for compatibility with older project. | |
| 1107 | + * Please condiser to use above function instead | |
| 1108 | + */ | |
| 1109 | + actioner | |
| 1110 | + ( | |
| 1111 | + Actioner_Connection conn, | |
| 1112 | + Actioner_Target targ, | |
| 1113 | + Actioner_Aspect asp, | |
| 1114 | + String action, | |
| 1115 | + List((String,String)) extra_ops, | |
| 1116 | + List(Actioner_Local_Action) local_actions | |
| 1117 | + )= | |
| 1118 | + actioner(conn,targ,asp,action_name(action),extra_ops,local_actions) | |
| 1119 | +. | |
| 1120 | + | |
| 1121 | +public define HTML_In_Form | |
| 1122 | + actioner | |
| 1123 | + ( | |
| 1124 | + Actioner_Connection conn, | |
| 1125 | + Actioner_Target targ, | |
| 1126 | + Actioner_Aspect asp, | |
| 1127 | + WEB_Action_Name action, | |
| 1128 | + List((String,String)) extra_ops | |
| 1129 | + )= | |
| 1130 | + actioner(conn,targ,asp,action,extra_ops,[]) | |
| 1131 | +. | |
| 1132 | + | |
| 1133 | +public define HTML_In_Form | |
| 1134 | +/* Older call with String as action instead of WEB_Action_Name. | |
| 1135 | + * This function exists only for compatibility with older project. | |
| 1136 | + * Please condiser to use above function instead | |
| 1137 | + */ | |
| 1138 | + actioner | |
| 1139 | + ( | |
| 1140 | + Actioner_Connection conn, | |
| 1141 | + Actioner_Target targ, | |
| 1142 | + Actioner_Aspect asp, | |
| 1143 | + String action, | |
| 1144 | + List((String,String)) extra_ops | |
| 1145 | + )= | |
| 1146 | + actioner(conn,targ,asp,action_name(action),extra_ops,[]) | |
| 1147 | +. | |
| 1148 | + | |
| 1149 | +public define HTML_In_Form | |
| 1150 | + actioner | |
| 1151 | + ( | |
| 1152 | + Actioner_Connection conn, | |
| 1153 | + Actioner_Target targ, | |
| 1154 | + Actioner_Aspect asp, | |
| 1155 | + )= | |
| 1156 | + actioner(conn, targ, asp, action_name(""), [], []). | |
| 1157 | + | |
| 1158 | + | |
| 1159 | +public define HTML_In_Form | |
| 1160 | + text_area | |
| 1161 | + ( | |
| 1162 | + WebArgName name, | |
| 1163 | + InitialValue init, | |
| 1164 | + Int width, | |
| 1165 | + Int height | |
| 1166 | + ) = | |
| 1167 | + text_area([], no_label, html_Id(""), name,init,width,height). | |
| 1168 | + | |
| 1169 | +public define HTML_In_Form | |
| 1170 | + text_area | |
| 1171 | + ( | |
| 1172 | + List(TextAreaOption) options, | |
| 1173 | + WebArgName name, | |
| 1174 | + InitialValue init, | |
| 1175 | + Int width, | |
| 1176 | + Int height | |
| 1177 | + ) = | |
| 1178 | + text_area(options, no_label, html_Id(""), name,init,width,height). | |
| 1179 | + | |
| 1180 | +public define HTML_In_Form | |
| 1181 | + table | |
| 1182 | + ( | |
| 1183 | + List(HTML_Row(HTML_In_Form)) rows | |
| 1184 | + ) = | |
| 1185 | + table([],empty,rows,empty). | |
| 1186 | + | |
| 1187 | +public define HTML_In_Form | |
| 1188 | + table | |
| 1189 | + ( | |
| 1190 | + List(Table_Option) options, | |
| 1191 | + List(HTML_Row(HTML_In_Form)) rows | |
| 1192 | + ) = | |
| 1193 | + table(options,empty,rows,empty). | |
| 1194 | + | |
| 1195 | +public define HTML_In_Form | |
| 1196 | + table | |
| 1197 | + ( | |
| 1198 | + HTML_Header_Row(HTML_In_Form) h_row, | |
| 1199 | + List(HTML_Row(HTML_In_Form)) rows | |
| 1200 | + ) = | |
| 1201 | + table([],h_row,rows,empty). | |
| 1202 | + | |
| 1203 | +public define HTML_In_Form | |
| 1204 | + table | |
| 1205 | + ( | |
| 1206 | + List(Table_Option) options, | |
| 1207 | + HTML_Header_Row(HTML_In_Form) h_row, | |
| 1208 | + List(HTML_Row(HTML_In_Form)) rows | |
| 1209 | + ) = | |
| 1210 | + table(options,h_row,rows,empty). | |
| 1211 | + | |
| 1212 | +public define HTML_In_Form | |
| 1213 | + private_download | |
| 1214 | + ( | |
| 1215 | + String abs_path, | |
| 1216 | + String name, | |
| 1217 | + String extra_ext | |
| 1218 | + ) = | |
| 1219 | + private_download(abs_path,name,extra_ext,failure). | |
| 1220 | + | |
| 1221 | +public define HTML_In_Form | |
| 1222 | + private_download | |
| 1223 | + ( | |
| 1224 | + String abs_path, | |
| 1225 | + String name, | |
| 1226 | + String extra_ext, | |
| 1227 | + String action_name, | |
| 1228 | + List((String,String)) args | |
| 1229 | + ) = | |
| 1230 | + private_download(abs_path,name,extra_ext,success((action_name,args))). | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | +public define HTML_In_Form | |
| 1235 | + text | |
| 1236 | + ( | |
| 1237 | + List(CoreAttrs) l, | |
| 1238 | + Int i | |
| 1239 | + ) = | |
| 1240 | + text(l, to_decimal(i)). | |
| 1241 | + | |
| 1242 | +public define HTML_In_Form | |
| 1243 | + text | |
| 1244 | + ( | |
| 1245 | + String s | |
| 1246 | + )= | |
| 1247 | + text([],s) | |
| 1248 | +. | |
| 1249 | + | |
| 1250 | +public define HTML_In_Form | |
| 1251 | + text | |
| 1252 | + ( | |
| 1253 | + Int i | |
| 1254 | + ) = | |
| 1255 | + text([], i) | |
| 1256 | +. | |
| 1257 | + | |
| 1258 | +public define HTML_In_Form | |
| 1259 | + div | |
| 1260 | + ( | |
| 1261 | + HTML_In_Form element | |
| 1262 | + )= | |
| 1263 | + div([], [element]) | |
| 1264 | +. | |
| 1265 | + | |
| 1266 | +public define HTML_In_Form | |
| 1267 | + div | |
| 1268 | + ( | |
| 1269 | + List(CoreAttrs) attrs, | |
| 1270 | + HTML_In_Form element | |
| 1271 | + )= | |
| 1272 | + div(attrs, [element]) | |
| 1273 | +. | |
| 1274 | + | |
| 1275 | +public define HTML_In_Form | |
| 1276 | + span | |
| 1277 | + ( | |
| 1278 | + String s | |
| 1279 | + )= | |
| 1280 | + span([],s) | |
| 1281 | +. | |
| 1282 | + | |
| 1283 | +public define HTML_In_Form | |
| 1284 | + span | |
| 1285 | + ( | |
| 1286 | + Int i | |
| 1287 | + ) = | |
| 1288 | + span([], to_decimal(i)) | |
| 1289 | +. | |
| 1290 | + | |
| 1291 | +public define HTML_In_Form | |
| 1292 | + radio_button (List(CoreAttrs) options, HTML_Label label, WebArgName n, WebArgValue value, Bool checked) | |
| 1293 | + = radio_button (options, label, html_Id(n.name), n, value, checked). | |
| 1294 | + | |
| 1295 | +public define HTML_In_Form | |
| 1296 | + radio_button_r (List(CoreAttrs) options, HTML_Label label, WebArgName n, WebArgValue value, Bool checked) | |
| 1297 | + = radio_button_r (options, label, html_Id(n.name), n, value, checked). | |
| 1298 | + | |
| 1299 | +public define HTML_In_Form | |
| 1300 | + check_box (List(CoreAttrs) options, HTML_Label label, WebArgName n, Bool checked) | |
| 1301 | + = check_box (options, label, html_Id(n.name), n, checked). | |
| 1302 | + | |
| 1303 | +public define HTML_In_Form | |
| 1304 | + check_box_r (List(CoreAttrs) options, HTML_Label label, WebArgName n, Bool checked) | |
| 1305 | + = check_box_r (options, label, html_Id(n.name), n, checked). | |
| 1306 | + | |
| 1307 | +public define HTML_In_Form | |
| 1308 | + file_upload (WebArgName n, Int width) | |
| 1309 | + = file_upload([], no_label, html_Id(n.name), n, width). | |
| 1310 | + | |
| 1311 | +public define HTML_In_Form | |
| 1312 | + hidden (WebArgName name, WebArgValue value) | |
| 1313 | + = | |
| 1314 | + hidden(html_Id(""), name, value). | |
| 1315 | + | |
| 1316 | +public type Input_Type: | |
| 1317 | +button, | |
| 1318 | +checkbox, | |
| 1319 | +color, | |
| 1320 | +date, | |
| 1321 | +datetime_local, | |
| 1322 | +email, | |
| 1323 | +file, | |
| 1324 | +hidden, | |
| 1325 | +image, | |
| 1326 | +month, | |
| 1327 | +number, | |
| 1328 | +password, | |
| 1329 | +radio, | |
| 1330 | +range, | |
| 1331 | +reset, | |
| 1332 | +search, | |
| 1333 | +submit, | |
| 1334 | +tel, | |
| 1335 | +text, | |
| 1336 | +time, | |
| 1337 | +url, | |
| 1338 | +week | |
| 1339 | +. | |
| 1340 | + | |
| 1341 | +public define String | |
| 1342 | + to_String | |
| 1343 | + ( | |
| 1344 | + Input_Type type | |
| 1345 | + )= | |
| 1346 | + if type is | |
| 1347 | + { | |
| 1348 | + button then "button", | |
| 1349 | + checkbox then "checkbox", | |
| 1350 | + color then "color", | |
| 1351 | + date then "date", | |
| 1352 | + datetime_local then "datetime_local", | |
| 1353 | + email then "email", | |
| 1354 | + file then "file", | |
| 1355 | + hidden then "hidden", | |
| 1356 | + image then "image", | |
| 1357 | + month then "month", | |
| 1358 | + number then "number", | |
| 1359 | + password then "password", | |
| 1360 | + radio then "radio", | |
| 1361 | + range then "range", | |
| 1362 | + reset then "reset", | |
| 1363 | + search then "search", | |
| 1364 | + submit then "submit", | |
| 1365 | + tel then "tel", | |
| 1366 | + text then "text", | |
| 1367 | + time then "time", | |
| 1368 | + url then "url", | |
| 1369 | + week then "week" | |
| 1370 | + } | |
| 1371 | +. | |
| 1372 | + | |
| 1373 | +define Printable_tree | |
| 1374 | + add_js_files_attributes | |
| 1375 | + ( | |
| 1376 | + List(JS_Attribute) l | |
| 1377 | + ) = | |
| 1378 | + if l is | |
| 1379 | + { | |
| 1380 | + [ ] then [ ], | |
| 1381 | + [h . t] then | |
| 1382 | + [ " " + to_String(h) | |
| 1383 | + . add_js_files_attributes(t)] | |
| 1384 | + } | |
| 1385 | +. | |
| 1386 | + | |
| 1387 | + | |
| 1388 | +define Printable_tree | |
| 1389 | + add_js_files | |
| 1390 | + ( | |
| 1391 | + List(JS_File) l | |
| 1392 | + ) = | |
| 1393 | + if l is | |
| 1394 | + { | |
| 1395 | + [ ] then [ ], | |
| 1396 | + [h . t] then | |
| 1397 | + [ ["<script src=\""+ file_name(h) +"\" type=\"text/javascript\"" | |
| 1398 | + . add_js_files_attributes(attributes(h)) ] | |
| 1399 | + . ["></script>\n" | |
| 1400 | + . add_js_files(t)] ] | |
| 1401 | + } | |
| 1402 | +. | |
| 1403 | + | |
| 1404 | +define Printable_tree | |
| 1405 | + add_script | |
| 1406 | + ( | |
| 1407 | + List(Script) l | |
| 1408 | + ) = | |
| 1409 | + if l is | |
| 1410 | + { | |
| 1411 | + [ ] then [ ], | |
| 1412 | + [h . t] then [ "<script type=\""+ script_type(h) +"\">\n"+ content(h) + "\n</script>\n" . add_script(t) ] | |
| 1413 | + }. | |
| 1414 | + | |
| 1415 | +public type FormMethod: | |
| 1416 | + get, | |
| 1417 | + post | |
| 1418 | +. | |
| 1419 | + | |
| 1420 | +//public type HTML_Body:... | |
| 1421 | + | |
| 1422 | +public define CoreAttrs formaction(WEB_Action_Name action, List((String,String)) extra_ops) = attr("formaction", format_web_action_name(action, extra_ops)). | |
| 1423 | +public define CoreAttrs formaction(WEB_Action_Name action, (String,String) extra_op) = attr("formaction", format_web_action_name(action, extra_op)). | |
| 1424 | +public define CoreAttrs formaction(WEB_Action_Name action) = attr("formaction", format_web_action_name(action)). | |
| 1425 | +public define CoreAttrs formmethod(FormMethod method) = attr("formmethod", if method is { get then "get", post then "post"}). | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + 'HTML_Off_Form' defines all the elements you may put outside any form. | |
| 1429 | + | |
| 1430 | + | |
| 1431 | +public define CoreAttrs method(String value) = attr("method", value). | |
| 1432 | +public define CoreAttrs action(WEB_Action_Name action)= attr("action", "/"+format_web_action_name(action)). | |
| 1433 | +public define CoreAttrs action(WEB_Action_Name action, List((String,String)) extra_ops)= attr("action", "/"+format_web_action_name(action, extra_ops)). | |
| 1434 | +public define CoreAttrs formmethod(String value) = attr("formmethod", value). | |
| 1435 | +public define CoreAttrs form(String value) = attr("form", value). | |
| 1436 | +public define CoreAttrs for(String value) = attr("for", value). | |
| 1437 | + | |
| 1438 | + | |
| 1439 | +public define HTML_Off_Form text(List(CoreAttrs) attrs, Int i) = text(attrs, to_decimal(i)). | |
| 1440 | +public define HTML_Off_Form text(CoreAttrs attr, Int i) = text([attr], i). | |
| 1441 | +public define HTML_Off_Form text(Int i) = text([], i). | |
| 1442 | +public define HTML_Off_Form text(String s) = text([], s). | |
| 1443 | +public define HTML_Off_Form text(CoreAttrs attr, String s) = text([attr], s). | |
| 1444 | + | |
| 1445 | +public define HTML_Off_Form a(A_href _href) = a([], _href, _self, []). | |
| 1446 | +public define HTML_Off_Form a(List(CoreAttrs) attrs, A_href _href) = a(attrs, _href, _self, []). | |
| 1447 | +public define HTML_Off_Form a(List(CoreAttrs) attrs, A_href _href, HTML_Off_Form content) = a(attrs, _href, _self, [content]). | |
| 1448 | +public define HTML_Off_Form a(List(CoreAttrs) attrs, A_href _href, List(HTML_Off_Form) content) = a(attrs, _href, _self, content). | |
| 1449 | +public define HTML_Off_Form a(A_href _href, HTML_Off_Form content) = a([], _href, _self, [content]). | |
| 1450 | +public define HTML_Off_Form a(A_href _href, String _text) = a([], _href, _self, [text(_text)]). | |
| 1451 | +public define HTML_Off_Form a(A_href _href, List(HTML_Off_Form) content) = a([], _href, _self, content). | |
| 1452 | +public define HTML_Off_Form a(List(CoreAttrs) attrs, A_href _href, A_target _target, HTML_Off_Form content) = a(attrs, _href, _target, [content]). | |
| 1453 | +public define HTML_Off_Form a(CoreAttrs attr, A_href _href, A_target _target, HTML_Off_Form content) = a([attr], _href, _target, [content]). | |
| 1454 | +public define HTML_Off_Form a(A_href _href, A_target _target, HTML_Off_Form content) = a([], _href, _target, [content]). | |
| 1455 | +public define HTML_Off_Form a(A_href _href, A_target _target, List(HTML_Off_Form) content) = a([], _href, _target, content). | |
| 1456 | +public define HTML_Off_Form a(CoreAttrs attr, A_href _href, A_target _target, List(HTML_Off_Form) content) = a([attr], _href, _target, content). | |
| 1457 | +public define HTML_Off_Form a(CoreAttrs attr, A_href _href, List(HTML_Off_Form) content) = a([attr], _href, _self, content). | |
| 1458 | +public define HTML_Off_Form a(CoreAttrs attr, A_href _href, HTML_Off_Form content) = a([attr], _href, _self, [content]). | |
| 1459 | + | |
| 1460 | + // <article> | |
| 1461 | +public define HTML_Off_Form article(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("article", attrs, content). | |
| 1462 | +public define HTML_Off_Form article(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("article", attrs, [content]). | |
| 1463 | +public define HTML_Off_Form article(List(HTML_Off_Form) content) = html_tag("article", [], content). | |
| 1464 | +public define HTML_Off_Form article(HTML_Off_Form content) = html_tag("article", [], [content]). | |
| 1465 | + | |
| 1466 | + // <aside> | |
| 1467 | +public define HTML_Off_Form aside(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("aside", attrs, content). | |
| 1468 | +public define HTML_Off_Form aside(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("aside", attrs, [content]). | |
| 1469 | +public define HTML_Off_Form aside(List(HTML_Off_Form) content) = html_tag("aside", [], content). | |
| 1470 | +public define HTML_Off_Form aside(HTML_Off_Form content) = html_tag("aside", [], [content]). | |
| 1471 | + | |
| 1472 | + // <b> text in bold face | |
| 1473 | +public define HTML_Off_Form b(String string) = html_tag("b", [], [text(string)]). | |
| 1474 | +public define HTML_Off_Form b(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("b", attrs, [content]). | |
| 1475 | +public define HTML_Off_Form b(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("b", [attr], content). | |
| 1476 | +public define HTML_Off_Form b(CoreAttrs attr, HTML_Off_Form content) = html_tag("b", [attr], [content]). | |
| 1477 | +public define HTML_Off_Form b(List(CoreAttrs) attrs, String string) = html_tag("b", attrs, [text(string)]). | |
| 1478 | +public define HTML_Off_Form b(CoreAttrs attr, String string) = html_tag("b", [attr], [text(string)]). | |
| 1479 | + | |
| 1480 | + // <br> | |
| 1481 | +public define HTML_Off_Form br = html_void_tag("br", []). | |
| 1482 | +public define HTML_Off_Form br(List(CoreAttrs) attrs) = html_void_tag("br", attrs). | |
| 1483 | + | |
| 1484 | + // <button> | |
| 1485 | +public define HTML_Off_Form button(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("button", attrs, content). | |
| 1486 | +public define HTML_Off_Form button(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("button", attrs, [content]). | |
| 1487 | +public define HTML_Off_Form button(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("button", [attr], content). | |
| 1488 | +public define HTML_Off_Form button(CoreAttrs attr, HTML_Off_Form content) = html_tag("button", [attr], [content]). | |
| 1489 | +public define HTML_Off_Form button(List(CoreAttrs) attrs) = html_tag("button", attrs, []). | |
| 1490 | +public define HTML_Off_Form button(List(CoreAttrs) attrs, String string) = html_tag("button", attrs, [text(string)]). | |
| 1491 | +public define HTML_Off_Form button(List(HTML_Off_Form) content) = html_tag("button", [], content). | |
| 1492 | +public define HTML_Off_Form button(HTML_Off_Form content) = html_tag("button", [], [content]). | |
| 1493 | + | |
| 1494 | + // <canvas> | |
| 1495 | +public define HTML_Off_Form canvas(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("canvas", attrs, content). | |
| 1496 | +public define HTML_Off_Form canvas(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("canvas", attrs, [content]). | |
| 1497 | +public define HTML_Off_Form canvas(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("canvas", [attr], content). | |
| 1498 | +public define HTML_Off_Form canvas(CoreAttrs attr, HTML_Off_Form content) = html_tag("canvas", [attr], [content]). | |
| 1499 | +public define HTML_Off_Form canvas(List(CoreAttrs) attrs) = html_tag("canvas", attrs, []). | |
| 1500 | +public define HTML_Off_Form canvas(List(HTML_Off_Form) content) = html_tag("canvas", [], content). | |
| 1501 | +public define HTML_Off_Form canvas(HTML_Off_Form content) = html_tag("canvas", [], [content]). | |
| 1502 | +public define HTML_Off_Form canvas(CoreAttrs cattr, Int width, Int height) = html_tag("canvas", [cattr, | |
| 1503 | + attr("width", to_String(width)), | |
| 1504 | + attr("height", to_String(height)) | |
| 1505 | + ], []). | |
| 1506 | +public define HTML_Off_Form canvas(List(CoreAttrs) attrs, Int width, Int height) = html_tag("canvas", [ | |
| 1507 | + attr("width", to_String(width)), | |
| 1508 | + attr("height", to_String(height)). | |
| 1509 | + attrs | |
| 1510 | + ], []). | |
| 1511 | + // <datalist> | |
| 1512 | +public define HTML_Off_Form datalist(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("datalist", attrs, content). | |
| 1513 | +public define HTML_Off_Form datalist(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("datalist", attrs, [content]). | |
| 1514 | +public define HTML_Off_Form datalist(List(HTML_Off_Form) content) = html_tag("datalist", [], content). | |
| 1515 | +public define HTML_Off_Form datalist(HTML_Off_Form content) = html_tag("datalist", [], [content]). | |
| 1516 | + | |
| 1517 | + // <div> | |
| 1518 | +public define HTML_Off_Form div(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("div", attrs, content). | |
| 1519 | +public define HTML_Off_Form div(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("div", attrs, [content]). | |
| 1520 | +public define HTML_Off_Form div(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("div", [attr], content). | |
| 1521 | +public define HTML_Off_Form div(CoreAttrs attr, HTML_Off_Form content) = html_tag("div", [attr], [content]). | |
| 1522 | +public define HTML_Off_Form div(List(HTML_Off_Form) content) = html_tag("div", [], content). | |
| 1523 | +public define HTML_Off_Form div(HTML_Off_Form content) = html_tag("div", [], [content]). | |
| 1524 | +public define HTML_Off_Form div(List(CoreAttrs) attrs) = html_tag("div", attrs, []). | |
| 1525 | +public define HTML_Off_Form div(CoreAttrs attr) = html_tag("div", [attr], []). | |
| 1526 | + | |
| 1527 | +public define HTML_Off_Form div(String string) = html_tag("div", [], [text(string)]). | |
| 1528 | +public define HTML_Off_Form div(CoreAttrs attr, String string) = html_tag("div", [attr], [text(string)]). | |
| 1529 | +public define HTML_Off_Form div(List(CoreAttrs) attrs, String string) = html_tag("div", attrs, [text(string)]). | |
| 1530 | + | |
| 1531 | +public define HTML_Off_Form div(List(CoreAttrs) attrs, HTML_Partial_Content content) = div(attrs, [content]). | |
| 1532 | +public define HTML_Off_Form div(List(HTML_Partial_Content) content) = div([], content). | |
| 1533 | +public define HTML_Off_Form div(CoreAttrs attr, HTML_Partial_Content content) = div([attr], [content]). | |
| 1534 | +public define HTML_Off_Form div(HTML_Partial_Content content) = div([], [content]). | |
| 1535 | + | |
| 1536 | +//public define HTML_Partial_Content div(List(CoreAttrs) attrs, HTML_Partial_Content content) = partial_content([], div(attrs, [content])). | |
| 1537 | +//public define HTML_Partial_Content div(CoreAttrs attr, HTML_Partial_Content content) = partial_content([], div([attr], [content])). | |
| 1538 | +//public define HTML_Partial_Content div(List(HTML_Partial_Content) content) = partial_content([], div([], content)). | |
| 1539 | +//public define HTML_Partial_Content div(HTML_Partial_Content content) = partial_content([], div([], [content])). | |
| 1540 | + | |
| 1541 | + // <dd> | |
| 1542 | +public define HTML_Off_Form dd(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("dd", attrs, content). | |
| 1543 | +public define HTML_Off_Form dd(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("dd", attrs, [content]). | |
| 1544 | +public define HTML_Off_Form dd(List(HTML_Off_Form) content) = html_tag("dd", [], content). | |
| 1545 | +public define HTML_Off_Form dd(HTML_Off_Form content) = html_tag("dd", [], [content]). | |
| 1546 | + | |
| 1547 | + // <dl> | |
| 1548 | +public define HTML_Off_Form dl(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("dl", attrs, content). | |
| 1549 | +public define HTML_Off_Form dl(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("dl", attrs, [content]). | |
| 1550 | +public define HTML_Off_Form dl(List(HTML_Off_Form) content) = html_tag("dl", [], content). | |
| 1551 | +public define HTML_Off_Form dl(HTML_Off_Form content) = html_tag("dl", [], [content]). | |
| 1552 | + | |
| 1553 | + // <dt> | |
| 1554 | +public define HTML_Off_Form dt(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("dt", attrs, content). | |
| 1555 | +public define HTML_Off_Form dt(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("dt", attrs, [content]). | |
| 1556 | +public define HTML_Off_Form dt(List(HTML_Off_Form) content) = html_tag("dt", [], content). | |
| 1557 | +public define HTML_Off_Form dt(HTML_Off_Form content) = html_tag("dt", [], [content]). | |
| 1558 | + | |
| 1559 | + // <em> | |
| 1560 | +public define HTML_Off_Form em(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("em", attrs, content). | |
| 1561 | +public define HTML_Off_Form em(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("em", attrs, [content]). | |
| 1562 | +public define HTML_Off_Form em(List(HTML_Off_Form) content) = html_tag("em", [], content). | |
| 1563 | +public define HTML_Off_Form em(HTML_Off_Form content) = html_tag("em", [], [content]). | |
| 1564 | + | |
| 1565 | + // <fieldset> | |
| 1566 | +public define HTML_Off_Form fieldset(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("fieldset", attrs, content). | |
| 1567 | +public define HTML_Off_Form fieldset(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("fieldset", attrs, [content]). | |
| 1568 | +public define HTML_Off_Form fieldset(List(HTML_Off_Form) content) = html_tag("fieldset", [], content). | |
| 1569 | +public define HTML_Off_Form fieldset(HTML_Off_Form content) = html_tag("fieldset", [], [content]). | |
| 1570 | + | |
| 1571 | + // <footer> | |
| 1572 | +public define HTML_Off_Form footer(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("footer", attrs, content). | |
| 1573 | +public define HTML_Off_Form footer(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("footer", attrs, [content]). | |
| 1574 | +public define HTML_Off_Form footer(List(HTML_Off_Form) content) = html_tag("footer", [], content). | |
| 1575 | +public define HTML_Off_Form footer(HTML_Off_Form content) = html_tag("footer", [], [content]). | |
| 1576 | + | |
| 1577 | + // <form> | |
| 1578 | +public define HTML_Off_Form form(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("form", attrs, content). | |
| 1579 | +public define HTML_Off_Form form(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("form", attrs, [content]). | |
| 1580 | +public define HTML_Off_Form form(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("form", [attr], content). | |
| 1581 | +public define HTML_Off_Form form(CoreAttrs attr, HTML_Off_Form content) = html_tag("form", [attr], [content]). | |
| 1582 | +public define HTML_Off_Form form(List(CoreAttrs) attrs) = html_tag("form", attrs, []). | |
| 1583 | +public define HTML_Off_Form form(CoreAttrs attr) = html_tag("form", [attr], []). | |
| 1584 | + | |
| 1585 | +public define HTML_Off_Form form(List(HTML_Off_Form) content) = html_tag("form", [], content). | |
| 1586 | +public define HTML_Off_Form form(HTML_Off_Form content) = html_tag("form", [], [content]). | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + // <header> | |
| 1590 | +public define HTML_Off_Form header(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("header", attrs, content). | |
| 1591 | +public define HTML_Off_Form header(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("header", attrs, [content]). | |
| 1592 | +public define HTML_Off_Form header(List(HTML_Off_Form) content) = html_tag("header", [], content). | |
| 1593 | +public define HTML_Off_Form header(HTML_Off_Form content) = html_tag("header", [], [content]). | |
| 1594 | + | |
| 1595 | + // <h1> | |
| 1596 | +public define HTML_Off_Form h1(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h1", attrs, content). | |
| 1597 | +public define HTML_Off_Form h1(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("h1", [attr], content). | |
| 1598 | +public define HTML_Off_Form h1(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h1", attrs, [content]). | |
| 1599 | +public define HTML_Off_Form h1(CoreAttrs attr, HTML_Off_Form content) = html_tag("h1", [attr], [content]). | |
| 1600 | +public define HTML_Off_Form h1(List(HTML_Off_Form) content) = html_tag("h1", [], content). | |
| 1601 | +public define HTML_Off_Form h1(HTML_Off_Form content) = html_tag("h1", [], [content]). | |
| 1602 | + // <h2> | |
| 1603 | +public define HTML_Off_Form h2(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h2", attrs, content). | |
| 1604 | +public define HTML_Off_Form h2(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h2", attrs, [content]). | |
| 1605 | +public define HTML_Off_Form h2(List(HTML_Off_Form) content) = html_tag("h2", [], content). | |
| 1606 | +public define HTML_Off_Form h2(HTML_Off_Form content) = html_tag("h2", [], [content]). | |
| 1607 | + // <h3> | |
| 1608 | +public define HTML_Off_Form h3(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h3", attrs, content). | |
| 1609 | +public define HTML_Off_Form h3(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h3", attrs, [content]). | |
| 1610 | +public define HTML_Off_Form h3(List(HTML_Off_Form) content) = html_tag("h3", [], content). | |
| 1611 | +public define HTML_Off_Form h3(HTML_Off_Form content) = html_tag("h3", [], [content]). | |
| 1612 | +public define HTML_Off_Form h3(String content) = html_tag("h3", [], [text(content)]). | |
| 1613 | + | |
| 1614 | + // <h4> | |
| 1615 | +public define HTML_Off_Form h4(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h4", attrs, content). | |
| 1616 | +public define HTML_Off_Form h4(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h4", attrs, [content]). | |
| 1617 | +public define HTML_Off_Form h4(List(HTML_Off_Form) content) = html_tag("h4", [], content). | |
| 1618 | +public define HTML_Off_Form h4(HTML_Off_Form content) = html_tag("h4", [], [content]). | |
| 1619 | + // <h5> | |
| 1620 | +public define HTML_Off_Form h5(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h5", attrs, content). | |
| 1621 | +public define HTML_Off_Form h5(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h5", attrs, [content]). | |
| 1622 | +public define HTML_Off_Form h5(List(HTML_Off_Form) content) = html_tag("h5", [], content). | |
| 1623 | +public define HTML_Off_Form h5(HTML_Off_Form content) = html_tag("h5", [], [content]). | |
| 1624 | + | |
| 1625 | + // <h6> | |
| 1626 | +public define HTML_Off_Form h6(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h6", attrs, content). | |
| 1627 | +public define HTML_Off_Form h6(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h6", attrs, [content]). | |
| 1628 | +public define HTML_Off_Form h6(List(HTML_Off_Form) content) = html_tag("h6", [], content). | |
| 1629 | +public define HTML_Off_Form h6(HTML_Off_Form content) = html_tag("h6", [], [content]). | |
| 1630 | + | |
| 1631 | + // <hr> | |
| 1632 | +public define HTML_Off_Form hr = html_void_tag("hr", []). | |
| 1633 | +public define HTML_Off_Form hr(List(CoreAttrs) attrs) = html_void_tag("hr", attrs). | |
| 1634 | +public define HTML_Off_Form hr(CoreAttrs attr) = html_void_tag("hr", [attr]). | |
| 1635 | + | |
| 1636 | + // <i> | |
| 1637 | +public define HTML_Off_Form i(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("i", attrs, content). | |
| 1638 | +public define HTML_Off_Form i(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("i", attrs, [content]). | |
| 1639 | +public define HTML_Off_Form i(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("i", [attr], content). | |
| 1640 | +public define HTML_Off_Form i(CoreAttrs attr, HTML_Off_Form content) = html_tag("i", [attr], [content]). | |
| 1641 | +public define HTML_Off_Form i(List(HTML_Off_Form) content) = html_tag("i", [], content). | |
| 1642 | +public define HTML_Off_Form i(HTML_Off_Form content) = html_tag("i", [], [content]). | |
| 1643 | +public define HTML_Off_Form i(String string) = html_tag("i", [], [text(string)]). | |
| 1644 | +public define HTML_Off_Form i(CoreAttrs attr, String string) = html_tag("i", [attr], [text(string)]). | |
| 1645 | +public define HTML_Off_Form i(List(CoreAttrs) attrs, String string) = html_tag("i", attrs, [text(string)]). | |
| 1646 | + | |
| 1647 | + // <iframe> | |
| 1648 | +public define HTML_Off_Form iframe(CoreAttrs _attr, String src, Int width, Int height) = | |
| 1649 | + html_tag("iframe", [_attr, attr("src",src), width_px(width), height_px(height)], []). | |
| 1650 | +public define HTML_Off_Form iframe(String src, Int width, Int height) = | |
| 1651 | + html_tag("iframe", [attr("src",src), width_px(width), height_px(height)], []). | |
| 1652 | +public define HTML_Off_Form iframe(String src) = html_tag("iframe", [attr("src",src)], []). | |
| 1653 | + | |
| 1654 | + // <input> | |
| 1655 | +public define HTML_Off_Form input(List(CoreAttrs) attrs) = html_void_tag("input", attrs). | |
| 1656 | +public define HTML_Off_Form input(CoreAttrs attr) = html_void_tag("input", [attr]). | |
| 1657 | + | |
| 1658 | +public define CoreAttrs type(Input_Type value)= attr("type", to_String(value)). | |
| 1659 | +public define CoreAttrs type(String value)= attr("type", value). | |
| 1660 | +public define CoreAttrs name(String value)= attr("name", value). | |
| 1661 | +public define CoreAttrs value(String value)= attr("value", value). | |
| 1662 | +public define CoreAttrs placeholder(String value) = attr("placeholder", value). | |
| 1663 | +public define CoreAttrs init(String value)= attr("value", encode_HTML_entities(value)). | |
| 1664 | + //-- BEGIN of <input> preset type | |
| 1665 | + | |
| 1666 | +public define HTML_Off_Form text_input(List(CoreAttrs) options, HTML_Label label_text, WebArgName _name, InitialValue _init, Int w) = | |
| 1667 | + sequence([ | |
| 1668 | + format_label(label_text), | |
| 1669 | + input([class("in"), id(_id), name(_name), value(_int), size(w), options]) | |
| 1670 | + ]). | |
| 1671 | + | |
| 1672 | + /// Checkbox | |
| 1673 | +public define HTML_Off_Form checkbox(List(CoreAttrs) attrs, String _name, String _form, Bool checked) = input([type(checkbox), name(_name), form(_form), bool_attr(checked, "checked") . attrs]). | |
| 1674 | +public define HTML_Off_Form checkbox(List(CoreAttrs) attrs, String _name, Bool checked) = input([type(checkbox), name(_name), bool_attr(checked, "checked") . attrs]). | |
| 1675 | +public define HTML_Off_Form checkbox(String name, String form, Bool checked) = checkbox([], name, form, checked). | |
| 1676 | +public define HTML_Off_Form checkbox(String name, Bool checked) = checkbox([], name, checked). | |
| 1677 | + | |
| 1678 | + /// Radio button | |
| 1679 | +public define HTML_Off_Form radio(List(CoreAttrs) attrs, String _name, String _value, String _form, Bool checked) = input([type(radio), name(_name), value(_value), form(_form), bool_attr(checked, "checked") . attrs]). | |
| 1680 | +public define HTML_Off_Form radio(List(CoreAttrs) attrs, String name, String value, String form) = radio(attrs, name, value, form, false). | |
| 1681 | +public define HTML_Off_Form radio(String name, String value, String form, Bool checked) = radio([], name, value, form, checked). | |
| 1682 | +public define HTML_Off_Form radio(String name, String value, String form) = radio([], name, value, form, false). | |
| 1683 | + | |
| 1684 | + /// hidden value | |
| 1685 | +public define HTML_Off_Form hidden(List(CoreAttrs) attrs, String name, String value, String form) = input([type("hidden"), attr("name",name), attr("value",value), attr("form", form) . attrs]). | |
| 1686 | +public define HTML_Off_Form hidden(CoreAttrs attr, String name, String value, String form) = hidden([attr], name, value, form). | |
| 1687 | +public define HTML_Off_Form hidden(String name, String value, String form) = hidden([], name, value, form). | |
| 1688 | +public define HTML_Off_Form hidden(String _name, String _value) = input([type("hidden"), name(_name), value(_value)]). | |
| 1689 | + | |
| 1690 | + //-- END of <input> preset type | |
| 1691 | + | |
| 1692 | + // <img> | |
| 1693 | +public define HTML_Off_Form img(List(CoreAttrs) attrs, String src, String alt) = html_void_tag("img", attrs + [attr("src",src), attr("alt",alt)] ). | |
| 1694 | +public define HTML_Off_Form img(CoreAttrs _attr, String src, String alt) = html_void_tag("img", [_attr, attr("src",src), attr("alt",alt)] ). | |
| 1695 | +public define HTML_Off_Form img(String src) = img([], src, ""). | |
| 1696 | +public define HTML_Off_Form img(String src, String alt) = img([], src, alt). | |
| 1697 | +public define HTML_Off_Form img(List(CoreAttrs) attrs, String src) = img(attrs, src, ""). | |
| 1698 | +public define HTML_Off_Form img(CoreAttrs attr, String src) = img([attr], src, ""). | |
| 1699 | +public define HTML_Off_Form img(String src, Int width, Int height) = img([attr("width",to_String(width)+"px"), attr("height",to_String(height)+"px")], src, src). | |
| 1700 | +public define HTML_Off_Form img(String src, String alt, Int width, Int height) = | |
| 1701 | + html_void_tag("img", [attr("src",src), attr("alt",alt), attr("width",to_String(width)+"px"), attr("height",to_String(height)+"px")]). | |
| 1702 | + | |
| 1703 | +public define HTML_Off_Form img(List(CoreAttrs) attrs, String src, String alt, Int width, Int height) = | |
| 1704 | + html_void_tag("img", attrs + [attr("src",src), attr("alt",alt), attr("width",to_String(width)+"px"), attr("height",to_String(height)+"px")]). | |
| 1705 | + | |
| 1706 | +public define HTML_Off_Form img(CoreAttrs _attr, String src, String alt, Int width, Int height) = | |
| 1707 | + html_void_tag("img", [_attr, attr("src",src), attr("alt",alt), width_px(width), height_px(height)]). | |
| 1708 | + | |
| 1709 | + // <label> | |
| 1710 | +public define HTML_Off_Form label(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("label", attrs, content). | |
| 1711 | +public define HTML_Off_Form label(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("label", [attr], content). | |
| 1712 | +public define HTML_Off_Form label(List(HTML_Off_Form) content) = html_tag("label", [], content). | |
| 1713 | +public define HTML_Off_Form label(HTML_Off_Form content) = html_tag("label", [], [content]). | |
| 1714 | +public define HTML_Off_Form label(String string) = html_tag("label", [], [text(string)]). | |
| 1715 | +public define HTML_Off_Form label(CoreAttrs attr, String string) = html_tag("label", [attr], [text(string)]). | |
| 1716 | +public define HTML_Off_Form label(List(CoreAttrs) attrs, String string) = html_tag("label", attrs, [text(string)]). | |
| 1717 | + | |
| 1718 | + // <legend> | |
| 1719 | +public define HTML_Off_Form legend(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("legend", attrs, content). | |
| 1720 | +public define HTML_Off_Form legend(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("legend", attrs, [content]). | |
| 1721 | +public define HTML_Off_Form legend(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("legend", [attr], content). | |
| 1722 | +public define HTML_Off_Form legend(CoreAttrs attr, HTML_Off_Form content) = html_tag("legend", [attr], [content]). | |
| 1723 | +public define HTML_Off_Form legend(List(HTML_Off_Form) content) = html_tag("legend", [], content). | |
| 1724 | +public define HTML_Off_Form legend(HTML_Off_Form content) = html_tag("legend", [], [content]). | |
| 1725 | + | |
| 1726 | + // <li> | |
| 1727 | +public define HTML_Off_Form li(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("li", attrs, content). | |
| 1728 | +public define HTML_Off_Form li(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("li", attrs, [content]). | |
| 1729 | +public define HTML_Off_Form li(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("li", [attr], content). | |
| 1730 | +public define HTML_Off_Form li(CoreAttrs attr, HTML_Off_Form content) = html_tag("li", [attr], [content]). | |
| 1731 | +public define HTML_Off_Form li(List(HTML_Off_Form) content) = html_tag("li", [], content). | |
| 1732 | +public define HTML_Off_Form li(HTML_Off_Form content) = html_tag("li", [], [content]). | |
| 1733 | +public define HTML_Off_Form li(String string) = html_tag("li", [], [text(string)]). | |
| 1734 | +public define HTML_Off_Form li(CoreAttrs attr, String string) = html_tag("li", [attr], [text(string)]). | |
| 1735 | +public define HTML_Off_Form li(List(CoreAttrs) attrs, String string) = html_tag("li", attrs, [text(string)]). | |
| 1736 | + | |
| 1737 | + // <main> | |
| 1738 | +public define HTML_Off_Form main(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("main", attrs, content). | |
| 1739 | +public define HTML_Off_Form main(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("main", attrs, [content]). | |
| 1740 | +public define HTML_Off_Form main(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("main", [attr], content). | |
| 1741 | +public define HTML_Off_Form main(CoreAttrs attr, HTML_Off_Form content) = html_tag("main", [attr], [content]). | |
| 1742 | +public define HTML_Off_Form main(List(HTML_Off_Form) content) = html_tag("main", [], content). | |
| 1743 | +public define HTML_Off_Form main(HTML_Off_Form content) = html_tag("main", [], [content]). | |
| 1744 | + | |
| 1745 | + // <nav> | |
| 1746 | +public define HTML_Off_Form nav(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("nav", attrs, content). | |
| 1747 | +public define HTML_Off_Form nav(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("nav", attrs, [content]). | |
| 1748 | +public define HTML_Off_Form nav(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("nav", [attr], content). | |
| 1749 | +public define HTML_Off_Form nav(CoreAttrs attr, HTML_Off_Form content) = html_tag("nav", [attr], [content]). | |
| 1750 | +public define HTML_Off_Form nav(List(HTML_Off_Form) content) = html_tag("nav", [], content). | |
| 1751 | +public define HTML_Off_Form nav(HTML_Off_Form content) = html_tag("nav", [], [content]). | |
| 1752 | + | |
| 1753 | + // <ol> | |
| 1754 | +public define HTML_Off_Form ol(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("ol", attrs, content). | |
| 1755 | +public define HTML_Off_Form ol(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("ol", attrs, [content]). | |
| 1756 | +public define HTML_Off_Form ol(List(HTML_Off_Form) content) = html_tag("ol", [], content). | |
| 1757 | +public define HTML_Off_Form ol(HTML_Off_Form content) = html_tag("ol", [], [content]). | |
| 1758 | + | |
| 1759 | + // <option> | |
| 1760 | +public define HTML_Off_Form option(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("option", attrs, content). | |
| 1761 | +public define HTML_Off_Form option(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("option", attrs, [content]). | |
| 1762 | +public define HTML_Off_Form option(List(HTML_Off_Form) content) = html_tag("option", [], content). | |
| 1763 | +public define HTML_Off_Form option(CoreAttrs attr, HTML_Off_Form content) = html_tag("option", [attr], [content]). | |
| 1764 | +public define HTML_Off_Form option(HTML_Off_Form content) = html_tag("option", [], [content]). | |
| 1765 | +public define HTML_Off_Form option(String _value, String _text) = html_tag("option", [value(_value)], [text(_text)]). | |
| 1766 | + // <p> | |
| 1767 | +public define HTML_Off_Form p(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("p", attrs, content). | |
| 1768 | +public define HTML_Off_Form p(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("p", attrs, [content]). | |
| 1769 | +public define HTML_Off_Form p(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("p", [attr], content). | |
| 1770 | +public define HTML_Off_Form p(CoreAttrs attr, HTML_Off_Form content) = html_tag("p", [attr], [content]). | |
| 1771 | +public define HTML_Off_Form p(CoreAttrs attr, String _text) = html_tag("p", [attr], [text(_text)]). | |
| 1772 | +public define HTML_Off_Form p(List(HTML_Off_Form) content) = html_tag("p", [], content). | |
| 1773 | +public define HTML_Off_Form p(HTML_Off_Form content) = html_tag("p", [], [content]). | |
| 1774 | + | |
| 1775 | + // <pre> preformatted | |
| 1776 | +public define HTML_Off_Form pre(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("pre", attrs, content). | |
| 1777 | +public define HTML_Off_Form pre(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("pre", attrs, [content]). | |
| 1778 | +public define HTML_Off_Form pre(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("pre", [attr], content). | |
| 1779 | +public define HTML_Off_Form pre(CoreAttrs attr, HTML_Off_Form content) = html_tag("pre", [attr], [content]). | |
| 1780 | +public define HTML_Off_Form pre(List(HTML_Off_Form) content) = html_tag("pre", [], content). | |
| 1781 | +public define HTML_Off_Form pre(HTML_Off_Form content) = html_tag("pre", [], [content]). | |
| 1782 | +public define HTML_Off_Form pre(String string) = html_tag("pre", [], [text(string)]). | |
| 1783 | +public define HTML_Off_Form pre(CoreAttrs attr, String string) = html_tag("pre", [attr], [text(string)]). | |
| 1784 | +public define HTML_Off_Form pre(List(CoreAttrs) attrs, String string) = html_tag("pre", attrs, [text(string)]). | |
| 1785 | + | |
| 1786 | + // <progress> | |
| 1787 | +public define HTML_Off_Form progress(List(CoreAttrs) attrs, Int value, Int max, List(HTML_Off_Form) content) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], content). | |
| 1788 | +public define HTML_Off_Form progress(List(CoreAttrs) attrs, Int value, Int max, HTML_Off_Form content) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], [content]). | |
| 1789 | +public define HTML_Off_Form progress(CoreAttrs _attr, Int value, Int max, HTML_Off_Form content) = html_tag("progress", [attr("value", value), attr("max", max) , _attr], [content]). | |
| 1790 | +public define HTML_Off_Form progress(Int value, Int max, HTML_Off_Form content) = html_tag("progress", [attr("value", value), attr("max", max)], [content]). | |
| 1791 | +public define HTML_Off_Form progress(List(CoreAttrs) attrs, Int value, Int max, String content) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], [text(content)]). | |
| 1792 | +public define HTML_Off_Form progress(CoreAttrs _attr, Int value, Int max, String content) = html_tag("progress", [attr("value", value), attr("max", max), _attr], [text(content)]). | |
| 1793 | +public define HTML_Off_Form progress(List(CoreAttrs) attrs, Int value, Int max) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], []). | |
| 1794 | +public define HTML_Off_Form progress(CoreAttrs _attr, Int value, Int max) = html_tag("progress", [attr("value", value), attr("max", max), _attr], []). | |
| 1795 | +public define HTML_Off_Form progress(Int value, Int max, String content) = html_tag("progress", [attr("value", value), attr("max", max)], [text(content)]). | |
| 1796 | +public define HTML_Off_Form progress(Int value, Int max) = html_tag("progress", [attr("value", value), attr("max", max)], []). | |
| 1797 | + | |
| 1798 | + // <script> | |
| 1799 | +public define HTML_Off_Form script(String file_name, List(JS_Attribute) attrs) = literal_pt(add_js_files([js_file(file_name, attrs)])). | |
| 1800 | +public define HTML_Off_Form script(String content) = literal_pt(add_script([script("text/javascript", content)])). | |
| 1801 | + | |
| 1802 | + // <section> | |
| 1803 | +public define HTML_Off_Form section(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("section", attrs, content). | |
| 1804 | +public define HTML_Off_Form section(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("section", attrs, [content]). | |
| 1805 | +public define HTML_Off_Form section(List(HTML_Off_Form) content) = html_tag("section", [], content). | |
| 1806 | +public define HTML_Off_Form section(HTML_Off_Form content) = html_tag("section", [], [content]). | |
| 1807 | + | |
| 1808 | + // <select> | |
| 1809 | +public define HTML_Off_Form select(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("select", attrs, content). | |
| 1810 | +public define HTML_Off_Form select(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("select", attrs, [content]). | |
| 1811 | +public define HTML_Off_Form select(List(CoreAttrs) attrs) = html_tag("select", attrs, []). | |
| 1812 | +public define HTML_Off_Form select(List(HTML_Off_Form) content) = html_tag("select", [], content). | |
| 1813 | +public define HTML_Off_Form select(HTML_Off_Form content) = html_tag("select", [], [content]). | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + // <span> | |
| 1817 | +public define HTML_Off_Form span(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("span", attrs, content). | |
| 1818 | +public define HTML_Off_Form span(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("span", attrs, [content]). | |
| 1819 | +public define HTML_Off_Form span(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("span", [attr], content). | |
| 1820 | +public define HTML_Off_Form span(CoreAttrs attr, HTML_Off_Form content) = html_tag("span", [attr], [content]). | |
| 1821 | +public define HTML_Off_Form span(List(HTML_Off_Form) content) = html_tag("span", [], content). | |
| 1822 | +public define HTML_Off_Form span(HTML_Off_Form content) = html_tag("span", [], [content]). | |
| 1823 | +public define HTML_Off_Form span(Int i) = html_tag("span", [], [text(to_decimal(i))]). | |
| 1824 | +public define HTML_Off_Form span(List(CoreAttrs) attrs, String s) = html_tag("span", attrs, [text(s)]). | |
| 1825 | +public define HTML_Off_Form span(CoreAttrs attr, String s) = html_tag("span", [attr],[text(s)]). | |
| 1826 | +public define HTML_Off_Form span(String s) = html_tag("span", [], [text(s)]). | |
| 1827 | +public define HTML_Off_Form span(List(CoreAttrs) attrs) = html_tag("span", attrs, []). | |
| 1828 | +public define HTML_Off_Form span(CoreAttrs attr) = html_tag("span", [attr],[]). | |
| 1829 | + | |
| 1830 | + // <strong> | |
| 1831 | +public define HTML_Off_Form strong(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("strong", attrs, content). | |
| 1832 | +public define HTML_Off_Form strong(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("strong", attrs, [content]). | |
| 1833 | +public define HTML_Off_Form strong(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("strong", [attr], content). | |
| 1834 | +public define HTML_Off_Form strong(CoreAttrs attr, HTML_Off_Form content) = html_tag("strong", [attr], [content]). | |
| 1835 | +public define HTML_Off_Form strong(List(HTML_Off_Form) content) = html_tag("strong", [], content). | |
| 1836 | +public define HTML_Off_Form strong(HTML_Off_Form content) = html_tag("strong", [], [content]). | |
| 1837 | + | |
| 1838 | + // <svg> | |
| 1839 | +public define HTML_Off_Form svg(List(CoreAttrs) attrs) = html_tag("svg", attrs, []). | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + // <table> | |
| 1843 | +public define HTML_Off_Form table(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("table", attrs, content). | |
| 1844 | +public define HTML_Off_Form table(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("table", attrs, [content]). | |
| 1845 | +public define HTML_Off_Form table(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("table", [attr], content). | |
| 1846 | +public define HTML_Off_Form table(CoreAttrs attr, HTML_Off_Form content) = html_tag("table", [attr], [content]). | |
| 1847 | +public define HTML_Off_Form table(List(HTML_Off_Form) content) = html_tag("table", [], content). | |
| 1848 | +public define HTML_Off_Form table(HTML_Off_Form content) = html_tag("table", [], [content]). | |
| 1849 | + | |
| 1850 | + // <textarea> | |
| 1851 | + // CoreAttrs for textarea | |
| 1852 | +public define CoreAttrs wrap_lines = attr("wrap", "hard"). | |
| 1853 | +public define CoreAttrs read_only = bool_attr(true, "readonly"). | |
| 1854 | +public define CoreAttrs cols(Int value) = attr("cols",to_String(value)). | |
| 1855 | +public define CoreAttrs rows(Int value) = attr("rows",to_String(value)). | |
| 1856 | + | |
| 1857 | +public define HTML_Off_Form textarea(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("textarea", attrs, content). | |
| 1858 | +public define HTML_Off_Form textarea(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("textarea", attrs, [content]). | |
| 1859 | + | |
| 1860 | +public define HTML_Off_Form textarea(List(CoreAttrs) attrs, Int _cols, Int _rows, List(HTML_Off_Form) content) | |
| 1861 | + = html_tag("textarea", [cols(_cols), rows(_rows) . attrs], content). | |
| 1862 | + | |
| 1863 | +public define HTML_Off_Form textarea(List(CoreAttrs) attrs, Int _cols, Int _rows, HTML_Off_Form content) | |
| 1864 | + = html_tag("textarea", [cols(_cols), rows(_rows) . attrs], [content]). | |
| 1865 | + | |
| 1866 | +public define HTML_Off_Form textarea(Int _cols, Int _rows, HTML_Off_Form content) = html_tag("textarea", [cols(_cols), rows(_rows)], [content]). | |
| 1867 | +public define HTML_Off_Form textarea(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("textarea", [attr], content). | |
| 1868 | +public define HTML_Off_Form textarea(CoreAttrs attr, HTML_Off_Form content) = html_tag("textarea", [attr], [content]). | |
| 1869 | + | |
| 1870 | + // <thead> | |
| 1871 | +public define HTML_Off_Form thead(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("thead", attrs, content). | |
| 1872 | +public define HTML_Off_Form thead(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("thead", attrs, [content]). | |
| 1873 | +public define HTML_Off_Form thead(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("thead", [attr], content). | |
| 1874 | +public define HTML_Off_Form thead(CoreAttrs attr, HTML_Off_Form content) = html_tag("thead", [attr], [content]). | |
| 1875 | +public define HTML_Off_Form thead(List(HTML_Off_Form) content) = html_tag("thead", [], content). | |
| 1876 | +public define HTML_Off_Form thead(HTML_Off_Form content) = html_tag("thead", [], [content]). | |
| 1877 | + | |
| 1878 | + // <tbody> | |
| 1879 | +public define HTML_Off_Form tbody(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("tbody", attrs, content). | |
| 1880 | +public define HTML_Off_Form tbody(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("tbody", attrs, [content]). | |
| 1881 | +public define HTML_Off_Form tbody(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("tbody", [attr], content). | |
| 1882 | +public define HTML_Off_Form tbody(CoreAttrs attr, HTML_Off_Form content) = html_tag("tbody", [attr], [content]). | |
| 1883 | +public define HTML_Off_Form tbody(List(HTML_Off_Form) content) = html_tag("tbody", [], content). | |
| 1884 | +public define HTML_Off_Form tbody(HTML_Off_Form content) = html_tag("tbody", [], [content]). | |
| 1885 | + | |
| 1886 | + // <tfoot> | |
| 1887 | +public define HTML_Off_Form tfoot(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("tfoot", attrs, content). | |
| 1888 | +public define HTML_Off_Form tfoot(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("tfoot", attrs, [content]). | |
| 1889 | +public define HTML_Off_Form tfoot(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("tfoot", [attr], content). | |
| 1890 | +public define HTML_Off_Form tfoot(CoreAttrs attr, HTML_Off_Form content) = html_tag("tfoot", [attr], [content]). | |
| 1891 | +public define HTML_Off_Form tfoot(List(HTML_Off_Form) content) = html_tag("tfoot", [], content). | |
| 1892 | +public define HTML_Off_Form tfoot(HTML_Off_Form content) = html_tag("tfoot", [], [content]). | |
| 1893 | + | |
| 1894 | + // <th> | |
| 1895 | +public define HTML_Off_Form th(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("th", attrs, content). | |
| 1896 | +public define HTML_Off_Form th(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("th", attrs, [content]). | |
| 1897 | +public define HTML_Off_Form th(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("th", [attr], content). | |
| 1898 | +public define HTML_Off_Form th(CoreAttrs attr, HTML_Off_Form content) = html_tag("th", [attr], [content]). | |
| 1899 | +public define HTML_Off_Form th(CoreAttrs attr) = html_tag("th", [attr], []). | |
| 1900 | +public define HTML_Off_Form th(List(HTML_Off_Form) content) = html_tag("th", [], content). | |
| 1901 | +public define HTML_Off_Form th(HTML_Off_Form content) = html_tag("th", [], [content]). | |
| 1902 | +public define HTML_Off_Form th(String string) = html_tag("th", [], [text(string)]). | |
| 1903 | +public define HTML_Off_Form th(CoreAttrs attr, String string) = html_tag("th", [attr], [text(string)]). | |
| 1904 | +public define HTML_Off_Form th(List(CoreAttrs) attrs, String string) = html_tag("th", attrs, [text(string)]). | |
| 1905 | +public define HTML_Off_Form th = html_tag("th", [], []). | |
| 1906 | + | |
| 1907 | + // <td> | |
| 1908 | + // CoreAttrs for <td> | |
| 1909 | +//public define CoreAttrs colspan(Int value) = attr("colspan", to_String(value)). | |
| 1910 | +//public define CoreAttrs rowspan(Int value) = attr("rowspan", to_String(value)). | |
| 1911 | +//public define CoreAttrs headers(String header_id) = attr("headers", header_id). | |
| 1912 | + | |
| 1913 | +public define HTML_Off_Form td(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("td", attrs, content). | |
| 1914 | +public define HTML_Off_Form td(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("td", attrs, [content]). | |
| 1915 | +public define HTML_Off_Form td(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("td", [attr], content). | |
| 1916 | +public define HTML_Off_Form td(CoreAttrs attr, HTML_Off_Form content) = html_tag("td", [attr], [content]). | |
| 1917 | +public define HTML_Off_Form td(List(HTML_Off_Form) content) = html_tag("td", [], content). | |
| 1918 | +public define HTML_Off_Form td(HTML_Off_Form content) = html_tag("td", [], [content]). | |
| 1919 | +public define HTML_Off_Form td(List(CoreAttrs) attrs, String string) = html_tag("td", attrs, [text(string)]). | |
| 1920 | +public define HTML_Off_Form td(CoreAttrs attr, String string) = html_tag("td", [attr], [text(string)]). | |
| 1921 | +public define HTML_Off_Form td(String string) = html_tag("td", [], [text(string)]). | |
| 1922 | +public define HTML_Off_Form td(List(CoreAttrs) attrs, Int i) = html_tag("td", attrs, [text(to_decimal(i))]). | |
| 1923 | +public define HTML_Off_Form td(CoreAttrs attr, Int i) = html_tag("td", [attr], [text(to_decimal(i))]). | |
| 1924 | +public define HTML_Off_Form td(Int i) = html_tag("td", [], [text(to_decimal(i))]). | |
| 1925 | + | |
| 1926 | + // <tr> | |
| 1927 | +public define HTML_Off_Form tr(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("tr", attrs, content). | |
| 1928 | +public define HTML_Off_Form tr(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("tr", attrs, [content]). | |
| 1929 | +public define HTML_Off_Form tr(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("tr", [attr], content). | |
| 1930 | +public define HTML_Off_Form tr(CoreAttrs attr, HTML_Off_Form content) = html_tag("tr", [attr], [content]). | |
| 1931 | +public define HTML_Off_Form tr(List(HTML_Off_Form) content) = html_tag("tr", [], content). | |
| 1932 | +public define HTML_Off_Form tr(HTML_Off_Form content) = html_tag("tr", [], [content]). | |
| 1933 | + | |
| 1934 | + // <ul> | |
| 1935 | +public define HTML_Off_Form ul(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("ul", attrs, content). | |
| 1936 | +public define HTML_Off_Form ul(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("ul", attrs, [content]). | |
| 1937 | +public define HTML_Off_Form ul(CoreAttrs attr, List(HTML_Off_Form) content) = html_tag("ul", [attr], content). | |
| 1938 | +public define HTML_Off_Form ul(CoreAttrs attr, HTML_Off_Form content) = html_tag("ul", [attr], [content]). | |
| 1939 | +public define HTML_Off_Form ul(List(HTML_Off_Form) content) = html_tag("ul", [], content). | |
| 1940 | +public define HTML_Off_Form ul(HTML_Off_Form content) = html_tag("ul", [], [content]). | |
| 1941 | + | |
| 1942 | +//public define HTML_Off_Form empty = html_tag( | |
| 1943 | + | |
| 1944 | +//public define HTML_Off_Form | |
| 1945 | +// form | |
| 1946 | +// ( | |
| 1947 | +// String form_name, | |
| 1948 | +// List(CoreAttrs) options, | |
| 1949 | +// HTML_Off_Form content | |
| 1950 | +// ) = | |
| 1951 | +// form([id(form_name). options], [content]). | |
| 1952 | + | |
| 1953 | +//public define HTML_Off_Form | |
| 1954 | +// form | |
| 1955 | +// ( | |
| 1956 | +// String form_name, | |
| 1957 | +// List(CoreAttrs) options, | |
| 1958 | +// List(HTML_Off_Form) contents | |
| 1959 | +// ) = | |
| 1960 | +// form([id(form_name) . options], contents). | |
| 1961 | + | |
| 1962 | +public define HTML_Off_Form | |
| 1963 | + form | |
| 1964 | + ( | |
| 1965 | + List(CoreAttrs) options, | |
| 1966 | + WEB_Action_Name _action, | |
| 1967 | + List((String,String)) extra_ops, | |
| 1968 | + HTML_Off_Form content | |
| 1969 | + ) = | |
| 1970 | + form([action(_action, extra_ops). options], [content]). | |
| 1971 | + | |
| 1972 | +//public define HTML_Off_Form | |
| 1973 | +// form | |
| 1974 | +// ( | |
| 1975 | +// List(CoreAttrs) options, | |
| 1976 | +// WEB_Action_Name action, | |
| 1977 | +// List((String,String)) extra_ops, | |
| 1978 | +// HTML_Off_Form content | |
| 1979 | +// ) = | |
| 1980 | +// form(options, action, extra_ops, [content]). | |
| 1981 | + | |
| 1982 | +public define HTML_Off_Form | |
| 1983 | + form | |
| 1984 | + ( | |
| 1985 | + List(CoreAttrs) options, | |
| 1986 | + WEB_Action_Name action, | |
| 1987 | + List((String,String)) extra_ops, | |
| 1988 | + List(HTML_Off_Form) contents | |
| 1989 | + ) = | |
| 1990 | + form(options, action, extra_ops, contents). | |
| 1991 | + | |
| 1992 | +public define HTML_Off_Form | |
| 1993 | + form | |
| 1994 | + ( | |
| 1995 | + List(CoreAttrs) options, | |
| 1996 | + String action, | |
| 1997 | + List((String,String)) extra_ops, | |
| 1998 | + HTML_Off_Form content | |
| 1999 | + ) = | |
| 2000 | + form(options, action_name(action), extra_ops, [content]). | |
| 2001 | + | |
| 2002 | +public define HTML_Off_Form | |
| 2003 | + form | |
| 2004 | + ( | |
| 2005 | + String form_name, | |
| 2006 | + List(CoreAttrs) options, | |
| 2007 | + String action, | |
| 2008 | + List((String,String)) extra_ops, | |
| 2009 | + List(HTML_Off_Form) contents | |
| 2010 | + ) = | |
| 2011 | + form(options, action_name(action), extra_ops, contents). | |
| 2012 | + | |
| 2013 | +public define HTML_Off_Form literal(Printable_tree t) = literal_pt(t). | |
| 2014 | +//public define HTML_Off_Form fixed_size(HTML_Size width, HTML_Size height, String name_of_HTML_file) | |
| 2015 | +// = fixed_size_2(width,height,name_of_HTML_file). | |
| 2016 | + | |
| 2017 | + | |
| 2018 | +public define HTML_Off_Form | |
| 2019 | + foreign_link | |
| 2020 | + ( | |
| 2021 | + Int tsize, | |
| 2022 | + String url, | |
| 2023 | + String name | |
| 2024 | + ) = | |
| 2025 | + foreign_link([size(tsize)],url,name). | |
| 2026 | + | |
| 2027 | + | |
| 2028 | +public define HTML_Off_Form | |
| 2029 | + actioner | |
| 2030 | + ( | |
| 2031 | + Actioner_Connection conn, | |
| 2032 | + Actioner_Target targ, | |
| 2033 | + Actioner_Aspect asp, | |
| 2034 | + WEB_Action_Name action, | |
| 2035 | + List((String,String)) extra_ops | |
| 2036 | + ) = | |
| 2037 | + actioner(conn,targ,asp,action,extra_ops,[]). | |
| 2038 | + | |
| 2039 | +public define HTML_Off_Form | |
| 2040 | + actioner | |
| 2041 | + ( | |
| 2042 | + Actioner_Connection conn, | |
| 2043 | + Actioner_Target targ, | |
| 2044 | + Actioner_Aspect asp, | |
| 2045 | + WEB_Action_Name action, | |
| 2046 | + List((String,String)) extra_ops, | |
| 2047 | + String form_name | |
| 2048 | + ) = | |
| 2049 | + actioner(conn,targ,asp,action,extra_ops,[], form_name). | |
| 2050 | + | |
| 2051 | +public define HTML_Off_Form | |
| 2052 | + actioner | |
| 2053 | + ( | |
| 2054 | + Actioner_Aspect asp, | |
| 2055 | + WEB_Action_Name action, | |
| 2056 | + List((String,String)) extra_ops | |
| 2057 | + ) = | |
| 2058 | + actioner(same, same, asp, action, extra_ops, []). | |
| 2059 | + | |
| 2060 | +public define HTML_Off_Form | |
| 2061 | + actioner | |
| 2062 | + ( | |
| 2063 | + Actioner_Aspect asp, | |
| 2064 | + WEB_Action_Name action, | |
| 2065 | + List((String,String)) extra_ops, | |
| 2066 | + String form_name | |
| 2067 | + ) = | |
| 2068 | + actioner(same, same, asp, action, extra_ops, [], form_name). | |
| 2069 | + | |
| 2070 | +public define HTML_Off_Form | |
| 2071 | +/* Older call with String as action instead of WEB_Action_Name. | |
| 2072 | + * This function exists only for compatibility with older project. | |
| 2073 | + * Please condiser to use above function instead | |
| 2074 | + */ | |
| 2075 | + actioner | |
| 2076 | + ( | |
| 2077 | + Actioner_Connection conn, | |
| 2078 | + Actioner_Target targ, | |
| 2079 | + Actioner_Aspect asp, | |
| 2080 | + String action, | |
| 2081 | + List((String,String)) extra_ops, | |
| 2082 | + List(Actioner_Local_Action) local_actions | |
| 2083 | + )= | |
| 2084 | + actioner(conn,targ,asp,action_name(action),extra_ops,local_actions) | |
| 2085 | +. | |
| 2086 | + | |
| 2087 | +public define HTML_Off_Form | |
| 2088 | +/* Older call with String as action instead of WEB_Action_Name. | |
| 2089 | + * This function exists only for compatibility with older project. | |
| 2090 | + * Please condiser to use above function instead | |
| 2091 | + */ | |
| 2092 | + actioner | |
| 2093 | + ( | |
| 2094 | + Actioner_Connection conn, | |
| 2095 | + Actioner_Target targ, | |
| 2096 | + Actioner_Aspect asp, | |
| 2097 | + String action, | |
| 2098 | + List((String,String)) extra_ops, | |
| 2099 | + List(Actioner_Local_Action) local_actions, | |
| 2100 | + String form_name | |
| 2101 | + )= | |
| 2102 | + actioner(conn, targ, asp, action_name(action), extra_ops, local_actions, form_name) | |
| 2103 | +. | |
| 2104 | + | |
| 2105 | +public define HTML_Off_Form | |
| 2106 | +/* Older call with String as action instead of WEB_Action_Name. | |
| 2107 | + * This function exists only for compatibility with older project. | |
| 2108 | + * Please condiser to use above function instead | |
| 2109 | + */ | |
| 2110 | + actioner | |
| 2111 | + ( | |
| 2112 | + Actioner_Connection conn, | |
| 2113 | + Actioner_Target targ, | |
| 2114 | + Actioner_Aspect asp, | |
| 2115 | + String action, | |
| 2116 | + List((String,String)) extra_ops | |
| 2117 | + )= | |
| 2118 | + actioner(conn,targ,asp,action_name(action),extra_ops,[]) | |
| 2119 | +. | |
| 2120 | + | |
| 2121 | +public define HTML_Off_Form | |
| 2122 | +/* Older call with String as action instead of WEB_Action_Name. | |
| 2123 | + * This function exists only for compatibility with older project. | |
| 2124 | + * Please condiser to use above function instead | |
| 2125 | + */ | |
| 2126 | + actioner | |
| 2127 | + ( | |
| 2128 | + Actioner_Connection conn, | |
| 2129 | + Actioner_Target targ, | |
| 2130 | + Actioner_Aspect asp, | |
| 2131 | + String action, | |
| 2132 | + List((String,String)) extra_ops, | |
| 2133 | + String form_name | |
| 2134 | + )= | |
| 2135 | + actioner(conn, targ, asp, action_name(action), extra_ops, [], form_name) | |
| 2136 | +. | |
| 2137 | + | |
| 2138 | +//public define HTML_Off_Form | |
| 2139 | +// table | |
| 2140 | +// ( | |
| 2141 | +// List(HTML_Row(HTML_Off_Form)) rows | |
| 2142 | +// )= | |
| 2143 | +// table([], empty, rows,empty) | |
| 2144 | +//. | |
| 2145 | + | |
| 2146 | +//public define HTML_Off_Form | |
| 2147 | +// table | |
| 2148 | +// ( | |
| 2149 | +// List(Table_Option) options, | |
| 2150 | +// List(HTML_Row(HTML_Off_Form)) rows | |
| 2151 | +// ) = | |
| 2152 | +// table(options,empty,rows,empty) | |
| 2153 | +//. | |
| 2154 | + | |
| 2155 | +//public define HTML_Off_Form | |
| 2156 | +// table | |
| 2157 | +// ( | |
| 2158 | +// Table_Option option, | |
| 2159 | +// HTML_Row(HTML_Off_Form) row | |
| 2160 | +// ) = | |
| 2161 | +// table([option], empty, [row], empty) | |
| 2162 | +//. | |
| 2163 | +// | |
| 2164 | +//public define HTML_Off_Form | |
| 2165 | +// table | |
| 2166 | +// ( | |
| 2167 | +// HTML_Header_Row(HTML_Off_Form) h_row, | |
| 2168 | +// List(HTML_Row(HTML_Off_Form)) rows | |
| 2169 | +// ) = | |
| 2170 | +// table([],h_row,rows,empty) | |
| 2171 | +//. | |
| 2172 | + | |
| 2173 | +//public define HTML_Off_Form | |
| 2174 | +// table | |
| 2175 | +// ( | |
| 2176 | +// List(Table_Option) options, | |
| 2177 | +// HTML_Header_Row(HTML_Off_Form) h_row, | |
| 2178 | +// List(HTML_Row(HTML_Off_Form)) rows | |
| 2179 | +// ) = | |
| 2180 | +// table(options,h_row,rows,empty) | |
| 2181 | +//. | |
| 2182 | + | |
| 2183 | +//public define HTML_Off_Form | |
| 2184 | +// table | |
| 2185 | +// ( | |
| 2186 | +// Table_Option option, | |
| 2187 | +// HTML_Header_Row(HTML_Off_Form) h_row, | |
| 2188 | +// List(HTML_Row(HTML_Off_Form)) rows | |
| 2189 | +// ) = | |
| 2190 | +// table([option], h_row, rows,empty) | |
| 2191 | +//. | |
| 2192 | + | |
| 2193 | + We add two convenience functions for 'row'. The reason why we add two functions, one | |
| 2194 | + for 'HTML_In_Form' and one for 'HTML_Off_Form', is that adding a schema with an | |
| 2195 | + arbitrary '$T' creates too many ambiguities. This is due to the fact that, if we do so, | |
| 2196 | + the arguments of the function do not refer to any of the types defined here. | |
| 2197 | + | |
| 2198 | +public define HTML_Row(HTML_In_Form) | |
| 2199 | + row | |
| 2200 | + ( | |
| 2201 | + HTML_In_Form content | |
| 2202 | + ) = | |
| 2203 | + row([],[cell([],content)]). | |
| 2204 | + | |
| 2205 | +public define HTML_Row(HTML_Off_Form) | |
| 2206 | + row | |
| 2207 | + ( | |
| 2208 | + HTML_Off_Form content | |
| 2209 | + ) = | |
| 2210 | + row([],[cell([],content)]). | |
| 2211 | + | |
| 2212 | +//public define HTML_Cell(HTML_Off_Form) | |
| 2213 | +// cells_to_column_in_cell | |
| 2214 | +// ( | |
| 2215 | +// List(HTML_Cell(HTML_Off_Form)) cells | |
| 2216 | +// )= | |
| 2217 | +// cell( | |
| 2218 | +// table( | |
| 2219 | +// map( (HTML_Cell(HTML_Off_Form) current_cell) |-> row(current_cell), cells) | |
| 2220 | +// )). | |
| 2221 | + | |
| 2222 | +//public define HTML_Off_Form | |
| 2223 | +// cells_to_line | |
| 2224 | +// ( | |
| 2225 | +// List(HTML_Off_Form) cells | |
| 2226 | +// )= | |
| 2227 | +// table([row( | |
| 2228 | +// map (((HTML_Off_Form) current_cell) |-> cell(current_cell), cells))]) | |
| 2229 | +// . | |
| 2230 | + | |
| 2231 | +public define HTML_Off_Form | |
| 2232 | + private_download | |
| 2233 | + ( | |
| 2234 | + String abs_path, | |
| 2235 | + String name, | |
| 2236 | + String extra_ext | |
| 2237 | + ) = | |
| 2238 | + private_download(abs_path,name,extra_ext,failure). | |
| 2239 | + | |
| 2240 | + | |
| 2241 | +public define HTML_Off_Form | |
| 2242 | + private_download | |
| 2243 | + ( | |
| 2244 | + String abs_path, | |
| 2245 | + String name, | |
| 2246 | + String extra_ext, | |
| 2247 | + String action_name, | |
| 2248 | + List((String,String)) args | |
| 2249 | + ) = | |
| 2250 | + private_download(abs_path,name,extra_ext,success((action_name,args))). | |
| 2251 | + | |
| 2252 | +. | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | +public define HTML_In_Form | |
| 2257 | + hr | |
| 2258 | + = | |
| 2259 | + hr([]) | |
| 2260 | +. | |
| 2261 | + | |
| 2262 | +public define HTML_In_Form | |
| 2263 | + button | |
| 2264 | + ( | |
| 2265 | + List(HTML_In_Form) elements | |
| 2266 | + )= | |
| 2267 | + button([], elements) | |
| 2268 | +. | |
| 2269 | + | |
| 2270 | +public define HTML_In_Form | |
| 2271 | + button | |
| 2272 | + ( | |
| 2273 | + List(CoreAttrs) attrs, | |
| 2274 | + HTML_In_Form element | |
| 2275 | + )= | |
| 2276 | + button(attrs, [element]) | |
| 2277 | +. | |
| 2278 | + | |
| 2279 | +public define HTML_In_Form | |
| 2280 | + button | |
| 2281 | + ( | |
| 2282 | + HTML_In_Form element | |
| 2283 | + )= | |
| 2284 | + button([], [element]) | |
| 2285 | +. | |
| 2286 | + - Cell a gap between two other cells : | |
| 2287 | + | |
| 2288 | +public define HTML_Cell(HTML_Off_Form) | |
| 2289 | + width_gap | |
| 2290 | + ( | |
| 2291 | + Int w | |
| 2292 | + )= | |
| 2293 | + cell([width(w)], empty). | |
| 2294 | + | |
| 2295 | +public define HTML_Cell(HTML_In_Form) | |
| 2296 | + width_gap | |
| 2297 | + ( | |
| 2298 | + Int w | |
| 2299 | + )= | |
| 2300 | + cell([width(w)],empty) | |
| 2301 | +. | |
| 2302 | + - Row a gap between two other rows : | |
| 2303 | + | |
| 2304 | +public define HTML_Row(HTML_Off_Form) | |
| 2305 | + height_gap | |
| 2306 | + ( | |
| 2307 | + Int h | |
| 2308 | + )= | |
| 2309 | + row([],[cell([height(h)],empty)]). | |
| 2310 | + | |
| 2311 | +public define HTML_Row(HTML_In_Form) | |
| 2312 | + height_gap | |
| 2313 | + ( | |
| 2314 | + Int h | |
| 2315 | + )= | |
| 2316 | + row([],[cell([height(h)],empty)]) | |
| 2317 | +. | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + Notice that the two types have alternatives in common (same name, same arguments types, | |
| 2321 | + up to the value of the parameter $T), which correspond to elements which may be put | |
| 2322 | + anywhere in the page. | |
| 2323 | + | |
| 2324 | +public define HTML_Partial_Content | |
| 2325 | + partial_content | |
| 2326 | + ( | |
| 2327 | + List(HTML_Head_Tag) tags, | |
| 2328 | + List(HTML_Off_Form) content | |
| 2329 | + )= | |
| 2330 | + partial_content(tags, sequence(content)). | |
| 2331 | + | |
| 2332 | +public define HTML_Partial_Content | |
| 2333 | + partial_content | |
| 2334 | + ( | |
| 2335 | + HTML_Off_Form content | |
| 2336 | + )= | |
| 2337 | + partial_content([], content). | |
| 2338 | + | |
| 2339 | +public define HTML_Partial_Content | |
| 2340 | + partial_content | |
| 2341 | + ( | |
| 2342 | + List(HTML_Off_Form) content | |
| 2343 | + )= | |
| 2344 | + partial_content([], sequence(content)). | |
| 2345 | + | |
| 2346 | +public define HTML_Partial_Content | |
| 2347 | + partial_content | |
| 2348 | + ( | |
| 2349 | + List(HTML_Head_Tag) tags, | |
| 2350 | + HTML_Partial_Content p_content | |
| 2351 | + )= | |
| 2352 | + if p_content is partial_content(ptags, html) then | |
| 2353 | + partial_content(tags + ptags, html). | |
| 2354 | + | |
| 2355 | +define HTML_Partial_Content | |
| 2356 | + list_to_pcontent | |
| 2357 | + ( | |
| 2358 | + List(HTML_Partial_Content) l_p_content, | |
| 2359 | + List(HTML_Head_Tag) so_far_tags, | |
| 2360 | + List(HTML_Off_Form) so_far_html | |
| 2361 | + )= | |
| 2362 | + if l_p_content is | |
| 2363 | + { | |
| 2364 | + [] then partial_content(so_far_tags, sequence(reverse(so_far_html))), | |
| 2365 | + [h . t] then | |
| 2366 | + //extract resurgent type and symbols of h | |
| 2367 | + if h is partial_content(tags, html) then | |
| 2368 | + list_to_pcontent(t, so_far_tags + tags, [html . so_far_html]) | |
| 2369 | + }. | |
| 2370 | + | |
| 2371 | +public define HTML_Partial_Content | |
| 2372 | + partial_content | |
| 2373 | + ( | |
| 2374 | + List(HTML_Partial_Content) l_p_content | |
| 2375 | + )= | |
| 2376 | + list_to_pcontent(l_p_content, [], []). | |
| 2377 | + | |
| 2378 | +public define HTML_Partial_Content | |
| 2379 | + partial_empty | |
| 2380 | + = | |
| 2381 | + partial_content(empty) | |
| 2382 | +. | |
| 2383 | + | |
| 2384 | +define String | |
| 2385 | + format | |
| 2386 | + ( | |
| 2387 | + List(Text_Option) l | |
| 2388 | + ). | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | +define Printable_tree | |
| 2394 | + format_css_styles | |
| 2395 | + ( | |
| 2396 | + List(CSS_Style) l | |
| 2397 | + ) = | |
| 2398 | + if l is | |
| 2399 | + { | |
| 2400 | + [ ] then [ ], | |
| 2401 | + [h . t] then | |
| 2402 | + [ if h is | |
| 2403 | + { | |
| 2404 | + text_options(tos) then | |
| 2405 | + [" body, span, p { ", format(tos), " }\n" ] | |
| 2406 | + } | |
| 2407 | + . format_css_styles(t)] | |
| 2408 | + }. | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + Meta tags are put in the 'head' of the HTML page. | |
| 2415 | + | |
| 2416 | +public define HTML_Meta | |
| 2417 | + refresh | |
| 2418 | + ( | |
| 2419 | + Actioner_Connection connection, | |
| 2420 | + Actioner_Target target, | |
| 2421 | + String action, | |
| 2422 | + Int delay | |
| 2423 | + )= | |
| 2424 | + refresh(connection, target, action_name(action), delay) | |
| 2425 | +. | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | +public define HTTP_Answer | |
| 2435 | + html_page | |
| 2436 | + ( | |
| 2437 | + String title, | |
| 2438 | + List(HTML_Head_Tag) head_tags, | |
| 2439 | + HTML_Body body | |
| 2440 | + )= | |
| 2441 | + html_page(http_ok, title, head_tags,[],[],[],[],body). | |
| 2442 | + | |
| 2443 | +public define HTTP_Answer | |
| 2444 | + html_page | |
| 2445 | + ( | |
| 2446 | + String title, | |
| 2447 | + List(HTML_Head_Tag) head_tags, | |
| 2448 | + List(CSS_Style) styles, | |
| 2449 | + HTML_Body body | |
| 2450 | + )= | |
| 2451 | + html_page(http_ok, title, head_tags, styles, [], [], [], body). | |
| 2452 | + | |
| 2453 | +public define HTTP_Answer | |
| 2454 | + web_controller_error_page | |
| 2455 | + ( | |
| 2456 | + String name | |
| 2457 | + ) | |
| 2458 | + = | |
| 2459 | + html_page | |
| 2460 | + ( | |
| 2461 | + name+" Controller error", // title of web site | |
| 2462 | + [], // list of 'META' tags (empty for this site) | |
| 2463 | + body // body of page | |
| 2464 | + ( | |
| 2465 | + // list of body options | |
| 2466 | + [ | |
| 2467 | + //background_color(rgb(255,200,200)) | |
| 2468 | + // add more body options here | |
| 2469 | + ], | |
| 2470 | + | |
| 2471 | + // content of page | |
| 2472 | + text(name+" Controller error") | |
| 2473 | + ) | |
| 2474 | + ) | |
| 2475 | +. | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + 'HTTP_Answer' represents the final product of the construction of a web page. | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + *** (3.2) ``in form'' versus ``off form''. | |
| 2484 | + | |
| 2485 | + There is a variety of HTML elements: texts, buttons, links, forms, inputs, etc... Some | |
| 2486 | + of them may have a content, which is yet another HTML element (or several). Hence, it | |
| 2487 | + is meaningful to say that an element is 'within' another one. Now, putting any element | |
| 2488 | + within any other one may be meaningless. For example, an input element must be put | |
| 2489 | + within a form (otherwise, it is useless), and a from within another form has no precise | |
| 2490 | + meaning (and is forbidden by the HTML specification). | |
| 2491 | + | |
| 2492 | + Actually, the main criterium is ``within a form or not within a form''. So, HTML | |
| 2493 | + elements in a given page are separated into two categories: those who are within a | |
| 2494 | + form, and the others. Nevertheless, there are elements which may belong to both | |
| 2495 | + categories, like images and texts. We want to make use of the strong typing mecanism of | |
| 2496 | + Anubis in order to forbid non meaningful placement of elements. | |
| 2497 | + | |
| 2498 | + The type 'HTML_In_Form' defines elements to be put within forms. Similarly, | |
| 2499 | + 'HTML_Off_Form' defines elements not to be put within forms. Both types are recursive, | |
| 2500 | + and 'HTML_Off_Form' refers to 'HTML_In_Form' (via the 'form' alternative, of course), | |
| 2501 | + but the two types are not cross recursive. This is the reason why it is impossible to | |
| 2502 | + put a form within a form. In order to construct a web page, you essentially have to | |
| 2503 | + produce a datum of type 'HTML_Off_Form' (maybe containing data of type 'HTML_In_Form'). | |
| 2504 | + | |
| 2505 | + In practice, you don't have to worry so much about these two types, because elements | |
| 2506 | + which may be put anywhere are constructed for both types by functions with the same | |
| 2507 | + name and the same arguments. Hence, for both types, you just write the same thing. You | |
| 2508 | + are warned by the compiler only when you try to put an element at a place it is not | |
| 2509 | + allowed. | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + *** (3.3) Defining your own style. | |
| 2514 | + | |
| 2515 | + We provide generic tools for constructing HTML elements. However, your web site needs | |
| 2516 | + to have a ``style''. | |
| 2517 | + | |
| 2518 | + To that end, you need to write down a set of ``styling functions'', using the tools | |
| 2519 | + defined here. These styling functions allow the introduction of your colors and other | |
| 2520 | + visual characteristics into the constructed elements once and for all. For example, you | |
| 2521 | + may want all your texts to be rendered in the ``Helvetica'' font, in size 14 and using | |
| 2522 | + some 'text_color'. You may write something like this: | |
| 2523 | + | |
| 2524 | + define RGB text_color = rgb(10,40,40). | |
| 2525 | + | |
| 2526 | + define HTML_Off_Form | |
| 2527 | + text | |
| 2528 | + ( | |
| 2529 | + String the_text | |
| 2530 | + ) = | |
| 2531 | + text([font("helvetica"),size(14),color(text_color)], | |
| 2532 | + the_text). | |
| 2533 | + | |
| 2534 | + (and the same one for type 'HTML_In_Form') so that in order to put a piece of text in a | |
| 2535 | + page, you just write: | |
| 2536 | + | |
| 2537 | + text("... some text ...") | |
| 2538 | + | |
| 2539 | + and you don't have to provide the font, size and color for each text. If you want to | |
| 2540 | + have several styles of text presentation, you just write several sets of such | |
| 2541 | + convenience functions. This also suggests a trick. You may want for example different | |
| 2542 | + colors for 'in form' texts and 'off form' texts. This may be achieved automatically by | |
| 2543 | + defining two functions as above, with the same name and same argument type, but | |
| 2544 | + returning either a 'HTML_In_Form' or a 'HTML_Off_Form'. | |
| 2545 | + | |
| 2546 | + If this preliminary work is well done, you will not waste your time later when you | |
| 2547 | + concentrate on the actual informational content of your pages. | |
| 2548 | + | |
| 2549 | + This general principle should be applied to all sorts of elements. This is the best | |
| 2550 | + thing to do in order to separate the functions defining the visual style from the | |
| 2551 | + functions defining the informational content itself, so that changing the style without | |
| 2552 | + changing the content becomes easy. This is also the best way for having a clean and | |
| 2553 | + easily readable source for your web site. | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + *** (3.4) Actioners and forms. | |
| 2560 | + | |
| 2561 | + We have gathered several notions from HTML into that of an 'actioner'. An actioner is | |
| 2562 | + an HTML element which opens a connection to our server when clicked upon. Actioners may | |
| 2563 | + have different visual aspects. They may look like hypertext links or like buttons | |
| 2564 | + (rollovers), or even like selectors (with immediate action). In any case, their | |
| 2565 | + behavior is the same: they open a connection to our server, and send a set of 'web | |
| 2566 | + arguments', i.e. pairs 'name=value'. Among these web arguments, one of them denotes | |
| 2567 | + the action to be performed, and the others should be considered as operands for this | |
| 2568 | + action. Actually, the precise behavior of the actioner has several variants. | |
| 2569 | + | |
| 2570 | + The connection with the server may be secured (HTTPS) or non secured (HTTP). See the | |
| 2571 | + type 'Actioner_Connection' above. | |
| 2572 | + | |
| 2573 | + You must also choose where the answer must be rendered. This may be in the same window | |
| 2574 | + or in another window (or frame). If it is in another window, the name of that window | |
| 2575 | + must be given. If the window does not exist, the browser will create it. Optionally, | |
| 2576 | + you may give the dimensions of the new window and other characteristics. See the type | |
| 2577 | + 'Actioner_Target' above. | |
| 2578 | + | |
| 2579 | + The actioner also has a visual aspect. See the type 'Actioner_Aspect' above. In the | |
| 2580 | + case of a rollover button, you provide the URLs of two images (of the same size) | |
| 2581 | + representing the button: | |
| 2582 | + | |
| 2583 | + url_off: to be used when the mouse is not over the button, | |
| 2584 | + url_on: to be used when the mouse is over the button. | |
| 2585 | + | |
| 2586 | + You can also create rollover buttons without creating images. Just use the second | |
| 2587 | + alternative named 'button'. The server creates the images automatically. | |
| 2588 | + | |
| 2589 | + The purpose of forms is just to give operands to actioners. If the actioner is placed | |
| 2590 | + within a form, all the input elements which are within this form provide operands to | |
| 2591 | + the actioner (except sometimes when they are not set by the client). If it is not put | |
| 2592 | + within a form, the actioner gets no operand, except if the name of a form is explicitly | |
| 2593 | + given, in which case the actioner gets all the inputs from that form as | |
| 2594 | + operands. Furthermore, you may want to give extra operands to the actioner. This may be | |
| 2595 | + useful for separating families of actioners with the same action name. Extra operands | |
| 2596 | + 'name=value' must be given in the form of pairs '(name,value)'. | |
| 2597 | + | |
| 2598 | + Notice that the name of a form may be used by an actioner which is off the form, so as | |
| 2599 | + to get the operands provided by this form. Also notice that several actioners may refer | |
| 2600 | + to the same form, being either in the form, or referring to the form from the | |
| 2601 | + outside. These actioners simply get the same set of operands, even if they correspond | |
| 2602 | + to distinct actions. | |
| 2603 | + | |
| 2604 | + Input elements may be put only within a form. | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
| 2608 | + *** (3.5) Local popup. | |
| 2609 | + | |
| 2610 | + This element looks like a link or a rollover button. When this button is clicked upon, | |
| 2611 | + a 'popup window' appears. Actually, this popup window is just a layer in the same HTML | |
| 2612 | + page, which becomes suddenly visible. It is realized with a '<div>' HTML tag. In | |
| 2613 | + particular, clicking on the button does not open any connection. This is why it is | |
| 2614 | + called 'local'. The arguments have the following roles: | |
| 2615 | + | |
| 2616 | + Actioner_Aspect aspect of the button (same semantics as for actioners) | |
| 2617 | + content content of the popup window | |
| 2618 | + x, y, position of the popup window on the HTML page (not relative | |
| 2619 | + to the button but to the page itself) | |
| 2620 | + title title of the popup window | |
| 2621 | + color color of the title bar and close button in the popup window. | |
| 2622 | + A lightened version of this color is used for the background | |
| 2623 | + of the popup window. | |
| 2624 | + width width of the title bar | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| 2629 | + | |
| 2630 | + --- That's all for the public part ! -------------------------------------------------- | |
| 2631 | + | |
| 2632 | + | |
| 2633 | + | |
| 2634 | + | |
| 2635 | + | |
| 2636 | + ----------------------------------- Table of Contents --------------------------------- | |
| 2637 | + | |
| 2638 | + *** [1] States. | |
| 2639 | + *** [1.1] Saving and retrieving states. | |
| 2640 | + *** [1.2] Deleting out of date states. | |
| 2641 | + | |
| 2642 | + *** [2] Sessions. | |
| 2643 | + *** [2.1] Saving and retrieving sessions. | |
| 2644 | + *** [2.2] Deleting out of date sessions. | |
| 2645 | + | |
| 2646 | + *** [3] Tools. | |
| 2647 | + *** [3.1] Directories. | |
| 2648 | + *** [3.2] Secondary documents. | |
| 2649 | + | |
| 2650 | + *** [4] Managing web arguments. | |
| 2651 | + *** [3.1] Prefixing web arguments names. | |
| 2652 | + *** [3.2] Separating web arguments. | |
| 2653 | + *** [3.3] Applying an action. | |
| 2654 | + | |
| 2655 | + *** [5] Web site descriptions and the 'awp handlers'. | |
| 2656 | + *** [4.1] The type 'Web_Site'. | |
| 2657 | + *** [4.2] Making a web site description. | |
| 2658 | + *** [4.3] Starting the servers. | |
| 2659 | + | |
| 2660 | + *** [6] HTML Formating. | |
| 2661 | + *** [5.1] The type 'HTML_Any($T)'. | |
| 2662 | + *** [5.2] Formating a color. | |
| 2663 | + *** [5.3] Creating buttons. | |
| 2664 | + *** [5.4] Formating an actioner. | |
| 2665 | + *** [5.5] Formating a private download link. | |
| 2666 | + *** [5.6] Formating rows and cells in a table. | |
| 2667 | + *** [5.7] Formating elements which may be put anywhere. | |
| 2668 | + *** [5.8] Formating 'in form' elements. | |
| 2669 | + *** [5.9] Formating 'off form' elements. | |
| 2670 | + *** [5.10] Formating meta-tags. | |
| 2671 | + | |
| 2672 | + --------------------------------------------------------------------------------------- | |
| 2673 | +public type CommonInfo:... | |
| 2674 | + | |
| 2675 | +define Printable_tree | |
| 2676 | + format | |
| 2677 | + ( | |
| 2678 | + CommonInfo cinfo, | |
| 2679 | + Var(Int) ic_v, // 'idnum' counter variable | |
| 2680 | + HTML_Off_Form element, | |
| 2681 | + Bool is_https, | |
| 2682 | + Var(Int) action_count, | |
| 2683 | + Var(List(HTML_Head_Tag)) head_tags | |
| 2684 | + ). | |
| 2685 | + | |
| 2686 | +public define String | |
| 2687 | + doctype_w3c_header | |
| 2688 | + = | |
| 2689 | + "<!DOCTYPE html>\n". //html 5 | |
| 2690 | + | |
| 2691 | + | |
| 2692 | + *** [1] States. | |
| 2693 | + | |
| 2694 | + We have to define functions for saving a state, retrieving a state, deleting out of | |
| 2695 | + date states. We need one such function per web site. The types of the first two | |
| 2696 | + functions depend on the parameter $State. This is not the case of the third one. The | |
| 2697 | + fact that the instance of $State is variable from one web sites to the other implies | |
| 2698 | + rather subtle manipulations using full functionality. | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + *** [1.1] Saving and retrieving states. | |
| 2702 | + | |
| 2703 | + Each state is saved into a file on the server's disk (in the directory represented by | |
| 2704 | + the symbol 'state_directory', which is 'my_anubis/web_sites/common_name/states'). The | |
| 2705 | + state is saved together with a time stamp whose value is obtained by adding the current | |
| 2706 | + time to the given timeout for states. The state receives a name obtained by hashing | |
| 2707 | + (using sha1) the content of the file itself, and then encoding the hash with | |
| 2708 | + 'web_arg_encode'. The name of the file into which the state is saved is the | |
| 2709 | + concatenation of "s" and the name of the state. | |
| 2710 | + | |
| 2711 | +read web_arg_encode.anubis | |
| 2712 | + | |
| 2713 | + The tool below constructs the function which is able to save a state on the server's | |
| 2714 | + disk. | |
| 2715 | + | |
| 2716 | + | |
| 2717 | +define ($State s) -> String // the function constructed returns the name of the state | |
| 2718 | + make_save_state_function | |
| 2719 | + ( | |
| 2720 | + Int timeout, | |
| 2721 | + String state_directory, | |
| 2722 | + (LogLevel, String) -> One logger | |
| 2723 | + )= | |
| 2724 | + ($State s) |-> | |
| 2725 | + with time_stamp = now+timeout, | |
| 2726 | + to_be_saved = (time_stamp,s), | |
| 2727 | + state_name = to_ascii(sha1(s)), | |
| 2728 | + //println("make_save_state_function " + state_directory+"/s"+state_name); | |
| 2729 | + if save(to_be_saved,state_directory+"/s"+state_name) is ok then | |
| 2730 | + state_name | |
| 2731 | + else | |
| 2732 | + logger(logError, "Cannot create state file in '"+state_directory+"'.\n"); | |
| 2733 | + "" | |
| 2734 | +. | |
| 2735 | + | |
| 2736 | + | |
| 2737 | + When a request arrives, we need to retrieve the previous state from the server's | |
| 2738 | + disk. We receive the name of that state. If the state is out of date, the state file is | |
| 2739 | + kept 3 days, and then deleted. | |
| 2740 | + | |
| 2741 | +type PreviousState($State): | |
| 2742 | + not_found, // cannot retrieve the previous state | |
| 2743 | + out_of_date($State), // the previous state is out of date | |
| 2744 | + still_valid($State). // the previous state is still valid | |
| 2745 | + | |
| 2746 | +define (String state_name) -> PreviousState($State) | |
| 2747 | + make_retrieve_state_function | |
| 2748 | + ( | |
| 2749 | + String state_directory | |
| 2750 | + ) = | |
| 2751 | + (String state_name) |-> | |
| 2752 | + with file_path = state_directory+"/s"+state_name, | |
| 2753 | + if (RetrieveResult((Int,$State)))retrieve(file_path) is ok(d) | |
| 2754 | + then ( | |
| 2755 | + if d is (time_stamp,s) then | |
| 2756 | + if time_stamp < now | |
| 2757 | + then ( | |
| 2758 | + forget(remove(file_path)); | |
| 2759 | + out_of_date(s) | |
| 2760 | + ) | |
| 2761 | + else still_valid(s) // state has been successfully retrieved | |
| 2762 | + ) | |
| 2763 | + else | |
| 2764 | + forget(remove(file_path)); | |
| 2765 | + not_found. | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + *** [1.2] Deleting out of date states. | |
| 2770 | + | |
| 2771 | + We also need to delete states which are out of date and which will never be deleted by | |
| 2772 | + the above method. This may be performed by a machine doing this periodically (say once | |
| 2773 | + per states life time period). | |
| 2774 | + | |
| 2775 | +define (List(String) file_names) -> One | |
| 2776 | + make_delete_out_of_date_states_function | |
| 2777 | + ( | |
| 2778 | + Maybe($State) dummy, | |
| 2779 | + String state_directory | |
| 2780 | + )= | |
| 2781 | + (List(String) file_names) |-df-> | |
| 2782 | + if file_names is | |
| 2783 | + { | |
| 2784 | + [ ] then unique, | |
| 2785 | + [h . t] then | |
| 2786 | + //we can't delete the "." and ".." file. So go to next file in the list | |
| 2787 | + if h = "." | h = ".." then | |
| 2788 | + df(t) | |
| 2789 | + else | |
| 2790 | + with file_path = state_directory+"/"+h, | |
| 2791 | + if (RetrieveResult((Int,$State)))retrieve(file_path) is ok(d) | |
| 2792 | + then ( | |
| 2793 | + if d is (time_stamp,data) then | |
| 2794 | + if time_stamp < now | |
| 2795 | + then (forget(remove(file_path)); df(t)) | |
| 2796 | + else df(t) | |
| 2797 | + ) | |
| 2798 | + else (forget(remove(file_path)); df(t)) | |
| 2799 | + } | |
| 2800 | +. | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + The 'labelled arrow' |-df-> is documented in 'documentation/en/anubis_doc.txt'. | |
| 2804 | + | |
| 2805 | + Note: The argument 'dummy' (of type Maybe($State)) is not used in the body of the | |
| 2806 | + function (hence its name). Nevertheless, it is required. Indeed, the Anubis compiler | |
| 2807 | + does not accept a parameter in the body of a function (here the parameter is required | |
| 2808 | + by the use of 'retrieve') if this parameter does not appear in the type of the | |
| 2809 | + function. This is because this would create ambiguities that no explicit typing may | |
| 2810 | + ever resolve. If you put a double slash in front of the declaration of 'dummy' above, | |
| 2811 | + and if you compile this file, you will get a message like this one: | |
| 2812 | + | |
| 2813 | + Error in 'making_a_web_site.anubis', line 1300, column 7: | |
| 2814 | + A definition may not contain parameters which are not present | |
| 2815 | + in the declaration part (hidden parameters): | |
| 2816 | + $State | |
| 2817 | + | |
| 2818 | + The type of the function constructed by 'make_delete_out_of_date_states_function' is | |
| 2819 | + independant of the parameter $State. This is important because this allows to create | |
| 2820 | + the list of such functions for all web sites. From this list, it is possible to call | |
| 2821 | + the functions one after the other, so deleting out of date states for all web | |
| 2822 | + sites. Actually, the next function receives a list of pairs (state_directory,function), | |
| 2823 | + one for each web site. | |
| 2824 | + | |
| 2825 | +define One | |
| 2826 | + delete_out_of_date_states // for all web sites | |
| 2827 | + ( | |
| 2828 | + List((String, List(String) -> One)) directories_and_functions | |
| 2829 | + ) = | |
| 2830 | + if directories_and_functions is | |
| 2831 | + { | |
| 2832 | + [ ] then unique, | |
| 2833 | + [h . t] then if h is (state_directory,function) then | |
| 2834 | + function(directory_list(state_directory,"*")); | |
| 2835 | + delete_out_of_date_states(t) | |
| 2836 | + }. | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + The above function must be called periodically in a separate virtual machine. The | |
| 2840 | + period we have choosen is (rather logically) the life time of states itself. This may | |
| 2841 | + be achieved by an 'infinite' loop, using a 'sleep(timeout)'. However, the loop must not | |
| 2842 | + be really infinite, because the servers may be shutdown. Hence, our loop must test | |
| 2843 | + (rather frequently; say every second) if the servers are down. If they are, the loop | |
| 2844 | + must be exited. | |
| 2845 | + | |
| 2846 | +define One | |
| 2847 | + delete_states_loop | |
| 2848 | + ( | |
| 2849 | + List((String,List(String) -> One)) directories_and_functions, | |
| 2850 | + Int timeout, | |
| 2851 | + Int next_time, | |
| 2852 | + Server http_server, | |
| 2853 | + Server https_server, | |
| 2854 | + (One) -> Bool shutdown_required | |
| 2855 | + ) = | |
| 2856 | + if shutdown_required(unique) | |
| 2857 | + then (shutdown(http_server); shutdown(https_server)) | |
| 2858 | + else unique; | |
| 2859 | + if (is_down(http_server) & is_down(https_server)) | |
| 2860 | + then unique | |
| 2861 | + else if now > next_time | |
| 2862 | + then | |
| 2863 | + ( | |
| 2864 | + delete_out_of_date_states(directories_and_functions); | |
| 2865 | + delete_states_loop(directories_and_functions, | |
| 2866 | + timeout, | |
| 2867 | + now+timeout, | |
| 2868 | + http_server, | |
| 2869 | + https_server, | |
| 2870 | + shutdown_required) | |
| 2871 | + ) | |
| 2872 | + else | |
| 2873 | + ( | |
| 2874 | + sleep(1000); // sleep just one second and try again | |
| 2875 | + delete_states_loop(directories_and_functions, | |
| 2876 | + timeout, | |
| 2877 | + next_time, | |
| 2878 | + http_server, | |
| 2879 | + https_server, | |
| 2880 | + shutdown_required) | |
| 2881 | + ). | |
| 2882 | + | |
| 2883 | + The above loop must be run in a separate virtual machine. This will be done just after | |
| 2884 | + the two servers are started. | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + *** [2] Tools. | |
| 2891 | + | |
| 2892 | + *** [2.1] Directories. | |
| 2893 | + *** [2.2] Secondary documents. | |
| 2894 | + | |
| 2895 | + Some HTML elements (like '<object>', '<frame>') cannot receive their content directly | |
| 2896 | + from the current document, but only through an URL. For this reason, we implement a | |
| 2897 | + mecanism for creating secondary documents on the fly. To that end we use the 'private | |
| 2898 | + download' mecanism. | |
| 2899 | + | |
| 2900 | + A secondary document is formated by the same functions as the main document itself. The | |
| 2901 | + next function takes an 'off form' element, creates the file containing the secondary | |
| 2902 | + document in HTML format, and returns the URL at which the document will be available. | |
| 2903 | + | |
| 2904 | +define String | |
| 2905 | + create_secondary_document | |
| 2906 | + ( | |
| 2907 | + String sd, // site directory | |
| 2908 | + String as, // authorization_secret | |
| 2909 | + $T -> Printable_tree format_element, | |
| 2910 | + $T content, | |
| 2911 | + HTML_Size width | |
| 2912 | + ) = | |
| 2913 | + with private_download_directory = sd+"/private_download", | |
| 2914 | + hash = web_arg_encode(sha1(content)), | |
| 2915 | + file_content = (Printable_tree) | |
| 2916 | + [doctype_w3c_header, | |
| 2917 | + "<html><body><table ", | |
| 2918 | + if width is | |
| 2919 | + { | |
| 2920 | + absolute(w) then ["width=\"",w-25], | |
| 2921 | + percentage(w) then ["width=\"95%\""] | |
| 2922 | + },"\"><tbody><tr><td align=right>", | |
| 2923 | + format_element(content), | |
| 2924 | + "</td></tr></tbody></table></body></html>" | |
| 2925 | + ], | |
| 2926 | + file_name = "sd"+hash+".html", | |
| 2927 | + file_path = private_download_directory+"/"+file_name, | |
| 2928 | + if write_to_file(file_path,file_content) is | |
| 2929 | + { | |
| 2930 | + cannot_open_file then print("Cannot open file '"+file_path+"'.\n"); "", | |
| 2931 | + write_error(n) then print("Error writing file '"+file_path+"'.\n"); "", | |
| 2932 | + ok then file_name+"?zauth="+ | |
| 2933 | + make_authorization(sd,as,private_download_directory+"/"+file_name) | |
| 2934 | + }. | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + *** [2.3] Generating unique ids. | |
| 2940 | + | |
| 2941 | + In order to uniquely name object for JavaScript we generate unique ids from a counter. | |
| 2942 | + | |
| 2943 | +define Int | |
| 2944 | + new_idnum | |
| 2945 | + ( | |
| 2946 | + Var(Int) ic_v // 'idnum' counter variable | |
| 2947 | + ) = | |
| 2948 | + protect | |
| 2949 | + with result = *ic_v+1, | |
| 2950 | + ic_v <- result; | |
| 2951 | + result. | |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + *** [3] Managing web arguments. | |
| 2959 | + | |
| 2960 | + Web arguments are those pairs 'name=value' which are transmitted through the HTTP | |
| 2961 | + protocol. We need precise naming conventions for these web arguments. | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + *** [3.2] Separating web arguments. | |
| 2966 | + | |
| 2967 | + When a new request arrives, we need to separate the web arguments, that is to say: | |
| 2968 | + | |
| 2969 | + - find the value of "s", and recover the corresponding state, | |
| 2970 | + - find the value of "a", which is the name of the action to be performed, | |
| 2971 | + - get the list of all the remaining web arguments (operands of the action). | |
| 2972 | + | |
| 2973 | + We must also determine if the previous state may be recovered. If it is not the case | |
| 2974 | + (either because the previous state name is invalid, or the previous state is out of | |
| 2975 | + date), we must check if there is an action name. Indeed, the presence of an action name | |
| 2976 | + indicates that the user has clicked on one of our buttons or links. If on the contrary | |
| 2977 | + there is no action name the user has just entered our address in his browser. In this | |
| 2978 | + last case, we must send the first page of our site (maybe a 'login' page), but if there | |
| 2979 | + is an action, we must send a page just saying that the session ticket has expired. If | |
| 2980 | + the previous state is recovered and there is no action, the new state is the same as | |
| 2981 | + the previous state. | |
| 2982 | + | |
| 2983 | + The result of the separation of the web arguments is of type: | |
| 2984 | + | |
| 2985 | +type Separated_Web_Args($State): | |
| 2986 | + swa(PreviousState($State) previous_state, | |
| 2987 | + Maybe(String) action_name, | |
| 2988 | + List(Web_arg) operands). | |
| 2989 | + | |
| 2990 | + | |
| 2991 | + | |
| 2992 | + The next function constructs the function which separates the web arguments. | |
| 2993 | + | |
| 2994 | +define (List(Web_arg) lwa, HTTP_Info info) -> Separated_Web_Args($State) | |
| 2995 | + make_separate_web_args_function | |
| 2996 | + ( | |
| 2997 | + String state_directory, | |
| 2998 | + String -> PreviousState($State) retrieve_state, | |
| 2999 | + String website_name | |
| 3000 | + ) = | |
| 3001 | + (List(Web_arg) lwa, HTTP_Info info) |-swaf-> | |
| 3002 | + if lwa is | |
| 3003 | + { | |
| 3004 | + [ ] then | |
| 3005 | + // | |
| 3006 | + // no web arg found => no previous state and no action | |
| 3007 | + // | |
| 3008 | + //println("find_cookie(\"state_"+website_name+"\", ..."); | |
| 3009 | + if find_cookie("state_"+website_name, server_get_cookies(http_headers(info))) is | |
| 3010 | + { | |
| 3011 | + failure then | |
| 3012 | + //println("find_cookie(\"state_"+website_name+"\" failure"); | |
| 3013 | + swa(not_found,failure,[]), | |
| 3014 | + | |
| 3015 | + success(cookie) then | |
| 3016 | + //println("find_cookie(\"state_"+website_name+"\" success"); | |
| 3017 | + swa(retrieve_state(value(cookie)),failure,[]) | |
| 3018 | + }, | |
| 3019 | + | |
| 3020 | + //swa(failure,failure,[]), | |
| 3021 | + | |
| 3022 | + [wa_1 . wa_others] then | |
| 3023 | + // | |
| 3024 | + // at least one web arg => | |
| 3025 | + // separate other web args, and insert the first one as needed | |
| 3026 | + // | |
| 3027 | + if (Separated_Web_Args($State))swaf(wa_others, info) is | |
| 3028 | + { | |
| 3029 | + swa(ps1, // possible previous state | |
| 3030 | + an1, // maybe an action name | |
| 3031 | + op1) // operands so far | |
| 3032 | + then | |
| 3033 | + if wa_1 is | |
| 3034 | + { | |
| 3035 | + web_arg(n, value) then | |
| 3036 | + with name = if substr(n,0,4) = "amp;" then substr(n, 4, length(n) - 4) else n, | |
| 3037 | + if name = "a" then | |
| 3038 | + swa(ps1,success(value),op1) | |
| 3039 | + else if name = "aws_action" | name = "aws_a" then | |
| 3040 | + swa(ps1,success(value),op1) | |
| 3041 | + //else if name = "t" then | |
| 3042 | + // swa(ps1,an1,[web_arg("target",value) . op1]) | |
| 3043 | + else | |
| 3044 | + swa(ps1,an1,[web_arg(name,value) . op1]), | |
| 3045 | + | |
| 3046 | + upload(n,v,t) then | |
| 3047 | + swa(ps1,an1,[wa_1 . op1]) | |
| 3048 | + } | |
| 3049 | + } | |
| 3050 | + }. | |
| 3051 | + | |
| 3052 | + *** [3.3] Applying an action. | |
| 3053 | + | |
| 3054 | + When the web arguments are separated (and their names cleaned up from prefixes), we may | |
| 3055 | + apply the action to the operands and the current state. We search for the action to be | |
| 3056 | + applied in the list of actions. If no action is found, the new state is the same as | |
| 3057 | + the previous state. Also, we deny the application of an HTTP action if the request | |
| 3058 | + arrives through the HTTPS channel and conversely. | |
| 3059 | + | |
| 3060 | +define ($State previous, | |
| 3061 | + String action_name, | |
| 3062 | + HTTP_Info http_info, | |
| 3063 | + List(Web_arg) lwa, | |
| 3064 | + Bool is_https) -> $State | |
| 3065 | + make_apply_action_function | |
| 3066 | + ( | |
| 3067 | + List(Web_Action($State)) actions_list, | |
| 3068 | + (LogLevel, String) -> One logger //logger | |
| 3069 | + )= | |
| 3070 | + with f = | |
| 3071 | + ($State previous, | |
| 3072 | + String action_name, | |
| 3073 | + HTTP_Info http_info, | |
| 3074 | + List(Web_arg) lwa, | |
| 3075 | + Bool is_https, | |
| 3076 | + List(Web_Action($State)) actions) |-f-> | |
| 3077 | + //println("Looking for action ["+action_name+"]"); | |
| 3078 | + if actions is | |
| 3079 | + { | |
| 3080 | + [ ] then | |
| 3081 | + logger(logError, "action '"+action_name+"' not found.\n"); previous, | |
| 3082 | + [ac1 . others] then if ac1 is | |
| 3083 | + { | |
| 3084 | + //check for http action | |
| 3085 | + http_action(an, allow, do_it) then | |
| 3086 | + | |
| 3087 | + //Action name found | |
| 3088 | + if an = action_name then | |
| 3089 | + if is_https then | |
| 3090 | + (logger(logError, "HTTP action '"+an+"' called through HTTPS (denied).\n"); previous) | |
| 3091 | + else | |
| 3092 | + if allow(previous) then | |
| 3093 | + do_it(http_info,lwa,previous) | |
| 3094 | + else | |
| 3095 | + previous | |
| 3096 | + else | |
| 3097 | + f(previous,action_name,http_info,lwa,is_https,others), | |
| 3098 | + //check https action | |
| 3099 | + https_action(an,allow,do_it) then | |
| 3100 | + if an = action_name | |
| 3101 | + then if is_https | |
| 3102 | + then if allow(previous) | |
| 3103 | + then do_it(http_info,lwa,previous) | |
| 3104 | + else previous | |
| 3105 | + else (logger(logError, "HTTPS action '"+an+"' called through HTTP (denied).\n"); | |
| 3106 | + previous) | |
| 3107 | + else f(previous,action_name,http_info,lwa,is_https,others), | |
| 3108 | + | |
| 3109 | + http_https_action(an,allow,do_it) then | |
| 3110 | + if an = action_name then | |
| 3111 | + println("Action ["+action_name+"] found"); | |
| 3112 | + if allow(previous) | |
| 3113 | + then do_it(http_info,lwa,previous) | |
| 3114 | + else | |
| 3115 | + println("user not allowed to execute that Action ["+action_name+"]"); | |
| 3116 | + previous | |
| 3117 | + else f(previous,action_name,http_info,lwa,is_https,others), | |
| 3118 | + | |
| 3119 | + } | |
| 3120 | + }, | |
| 3121 | + ($State previous, | |
| 3122 | + String action_name, | |
| 3123 | + HTTP_Info http_info, | |
| 3124 | + List(Web_arg) lwa, | |
| 3125 | + Bool is_https) |-> | |
| 3126 | + f(previous, action_name, http_info, lwa, is_https, actions_list). | |
| 3127 | + | |
| 3128 | + *** [4] Web site descriptions and the 'awp handlers'. | |
| 3129 | + | |
| 3130 | + *** [4.1] The type 'Web_Site'. | |
| 3131 | + | |
| 3132 | + The type 'Web_Site_Description' is defined in 'web/multihost_http_server.anubis'. We | |
| 3133 | + need another one, because, we have some extra informations to record for each site. | |
| 3134 | + | |
| 3135 | +public type Web_Site: | |
| 3136 | + web_site((Word32,Word32) -> Web_Site_Description description, | |
| 3137 | + List(String) -> One delete_out_of_date). | |
| 3138 | + | |
| 3139 | + | |
| 3140 | + | |
| 3141 | + | |
| 3142 | + *** [4.2] Making a web site description. | |
| 3143 | + | |
| 3144 | + Below is the function which creates a web site description. It first creates (if | |
| 3145 | + needed) the directories for the site, then constructs the tool functions for the site, | |
| 3146 | + and the site handler. Finally, it constructs the web site description. | |
| 3147 | + | |
| 3148 | + We gather common (constant) informations in the following type: | |
| 3149 | + | |
| 3150 | +public type CommonInfo: | |
| 3151 | + info(String common_name, | |
| 3152 | + Word32 http_port, | |
| 3153 | + Word32 https_port, | |
| 3154 | + String site_directory, | |
| 3155 | + String authorization_secret | |
| 3156 | + ). | |
| 3157 | + | |
| 3158 | + We need a forward declaration. | |
| 3159 | + | |
| 3160 | +public define AWP_Handler_Answer | |
| 3161 | + format | |
| 3162 | + ( | |
| 3163 | + CommonInfo cinfo, | |
| 3164 | + List(HTTP_header) headers, | |
| 3165 | + HTTP_Answer page, | |
| 3166 | + Bool is_https, | |
| 3167 | + String charset | |
| 3168 | + ). | |
| 3169 | + | |
| 3170 | + | |
| 3171 | +define Printable_tree | |
| 3172 | + format | |
| 3173 | + ( | |
| 3174 | + HTML_Size s | |
| 3175 | + ) = | |
| 3176 | + if s is | |
| 3177 | + { | |
| 3178 | + absolute(x) then ["\"",x,"\""], | |
| 3179 | + percentage(x) then ["\"",x,"%\""] | |
| 3180 | + }. | |
| 3181 | + | |
| 3182 | +define List(HTTP_header) | |
| 3183 | + make_state_cookie_headers | |
| 3184 | + ( | |
| 3185 | + String website_name, | |
| 3186 | + String state_name | |
| 3187 | + ) | |
| 3188 | + = | |
| 3189 | + //println("Set-Cookie state_"+website_name+"="+state_name); | |
| 3190 | + [ | |
| 3191 | + http_header("Set-Cookie", "state_"+website_name+"="+state_name) | |
| 3192 | + ] | |
| 3193 | + . | |
| 3194 | + | |
| 3195 | + | |
| 3196 | +public define Web_Site | |
| 3197 | + make_web_site_description | |
| 3198 | + ( | |
| 3199 | + String website_name, // site_UID | |
| 3200 | + List(String) common_names, // for example: ["www.our-business.com"] | |
| 3201 | + String site_directory, | |
| 3202 | + String state_directory, | |
| 3203 | + One -> One init, | |
| 3204 | + (HTTP_Info, | |
| 3205 | + List(Web_arg), | |
| 3206 | + Bool is_https) -> $State initial_state, | |
| 3207 | + ($State expired, | |
| 3208 | + Maybe(String), | |
| 3209 | + HTTP_Info, | |
| 3210 | + List(Web_arg), | |
| 3211 | + Bool is_https) -> $State ticket_expired_state, | |
| 3212 | + (Maybe(String), | |
| 3213 | + HTTP_Info, | |
| 3214 | + List(Web_arg), | |
| 3215 | + Bool is_https) -> $State ticket_lost_state, | |
| 3216 | + List(Web_Action($State)) actions, | |
| 3217 | + $State -> HTTP_Answer compute_page, | |
| 3218 | + $State -> List(HTTP_header) additional_headers, | |
| 3219 | + List(HTTP_header) constant_additional_headers, | |
| 3220 | + Int timeout, | |
| 3221 | + Redirections redirections, | |
| 3222 | + String charset, | |
| 3223 | + List(String) journal_extensions, | |
| 3224 | + List(String) journal_headers, | |
| 3225 | + (LogLevel, String) -> One logger, //logger | |
| 3226 | + String secret, | |
| 3227 | + List(MIME) known_mime_types, | |
| 3228 | + (String action_name, | |
| 3229 | + List(Web_arg) args) -> One before_send_file | |
| 3230 | + )= | |
| 3231 | + init(unique); | |
| 3232 | + | |
| 3233 | + | |
| 3234 | + // | |
| 3235 | + // make required directories (if needed) | |
| 3236 | + // | |
| 3237 | + with //web_sites_directory = (String) make_directory(my_anubis_directory+"/web_sites"), | |
| 3238 | + base_directory = (String) make_directory(site_directory), | |
| 3239 | + // state_directory = make_directory(site_directory+"/states"), | |
| 3240 | + forget((String)make_directory(site_directory+"/public")); | |
| 3241 | + // | |
| 3242 | + // construct tool functions | |
| 3243 | + // TODO 'make_separate_web_args_function' must retrieve state_cookies before parsing web_args if using_state_cookies is true | |
| 3244 | + with save_state = make_save_state_function(timeout, state_directory, logger), | |
| 3245 | + retrieve_state = make_retrieve_state_function(state_directory), | |
| 3246 | + separate_web_args = make_separate_web_args_function(state_directory, retrieve_state, website_name), | |
| 3247 | + apply_action = make_apply_action_function(actions, logger), | |
| 3248 | + // | |
| 3249 | + // construct the site handler | |
| 3250 | + // | |
| 3251 | + site_handler = (Word32 http_port, Word32 https_port) |-> | |
| 3252 | + ((String host_name, | |
| 3253 | + HTTP_Info http_info, | |
| 3254 | + List(Web_arg) lwa, | |
| 3255 | + Bool is_https) |-> | |
| 3256 | + //println(dump_web_arg_values(lwa)); | |
| 3257 | + since separate_web_args(lwa, http_info) is swa(mb_previous_state, mb_action_name, operands), | |
| 3258 | + with new_state = if mb_previous_state is | |
| 3259 | + { | |
| 3260 | + not_found then | |
| 3261 | + //println("previous state not found"); | |
| 3262 | + if mb_action_name is | |
| 3263 | + { | |
| 3264 | + failure then initial_state(http_info, operands, is_https), | |
| 3265 | + success(_) then | |
| 3266 | + ticket_lost_state(mb_action_name, http_info,operands,is_https) | |
| 3267 | + }, | |
| 3268 | + | |
| 3269 | + out_of_date(state) then | |
| 3270 | + //println("previous out_of_date"); | |
| 3271 | + ticket_expired_state(state, mb_action_name, http_info,operands,is_https), | |
| 3272 | + | |
| 3273 | + still_valid(state) then | |
| 3274 | + //println("previous still_valid"); | |
| 3275 | + if mb_action_name is | |
| 3276 | + { | |
| 3277 | + failure then state, | |
| 3278 | + success(action_name) then | |
| 3279 | + apply_action(state,action_name,http_info,operands,is_https) | |
| 3280 | + } | |
| 3281 | + }, | |
| 3282 | + //if state_and_headers is (session_ticket, mb_new_state, headers) then | |
| 3283 | + with state_name = save_state(new_state), | |
| 3284 | + //println("Cookie new STATE NAME "+state_name); | |
| 3285 | + with cookie_headers = if mb_action_name is | |
| 3286 | + { | |
| 3287 | + failure then | |
| 3288 | + make_state_cookie_headers(website_name, state_name), | |
| 3289 | + success(action_name) then | |
| 3290 | + if action_name = "none" then | |
| 3291 | + [] | |
| 3292 | + else if substr(action_name, 0, 5)="ajax_" then | |
| 3293 | + [] | |
| 3294 | + else | |
| 3295 | + make_state_cookie_headers(website_name, state_name) | |
| 3296 | + }, | |
| 3297 | + | |
| 3298 | + format(info(host_name, http_port, https_port, site_directory, secret), | |
| 3299 | + additional_headers(new_state) + cookie_headers, | |
| 3300 | + compute_page(new_state), | |
| 3301 | + is_https, | |
| 3302 | + charset) | |
| 3303 | + ), | |
| 3304 | + // | |
| 3305 | + // make the delete_out_of_date function | |
| 3306 | + // | |
| 3307 | + delete_out_of_date = | |
| 3308 | + make_delete_out_of_date_states_function((Maybe($State))failure, | |
| 3309 | + site_directory+"/states"), | |
| 3310 | + // | |
| 3311 | + // construct the web site description | |
| 3312 | + // | |
| 3313 | + web_site((Word32 http_port, Word32 https_port) |-> | |
| 3314 | + web_site_description(common_names, | |
| 3315 | + site_directory, | |
| 3316 | + redirections, | |
| 3317 | + charset, | |
| 3318 | + journal_extensions, | |
| 3319 | + journal_headers, | |
| 3320 | + logger, | |
| 3321 | + secret, | |
| 3322 | + known_mime_types, | |
| 3323 | + site_handler(http_port, https_port), | |
| 3324 | + constant_additional_headers, | |
| 3325 | + (HTTP_Info http_info, List(Web_arg) lwa) |-> if separate_web_args(lwa, http_info ) is | |
| 3326 | + swa(mb_previous_state,mb_action_name,operands) then | |
| 3327 | + if mb_action_name is | |
| 3328 | + { | |
| 3329 | + failure then unique | |
| 3330 | + success(an) then before_send_file(an,operands) | |
| 3331 | + } | |
| 3332 | + //using_state_cookies | |
| 3333 | + ), | |
| 3334 | + delete_out_of_date). | |
| 3335 | + | |
| 3336 | + public type WEB_Controller: | |
| 3337 | + web_controller( | |
| 3338 | + String name, //controller name | |
| 3339 | + (HTTP_Info http_info, | |
| 3340 | + List(Web_arg) lwa, | |
| 3341 | + Bool is_https | |
| 3342 | + ) -> HTTP_Answer view //view renderer | |
| 3343 | + ) | |
| 3344 | + | |
| 3345 | + | |
| 3346 | + | |
| 3347 | + | |
| 3348 | +public define JsonValue to_html_ajax_content(Printable_tree content_HTML, String additional_script). | |
| 3349 | +public define JsonValue to_html_ajax_content(HTML_Partial_Content content_HTML, CommonInfo cinfo, String additional_script). | |
| 3350 | + | |
| 3351 | + | |
| 3352 | + | |
| 3353 | +define String | |
| 3354 | + get_site_uid | |
| 3355 | + ( | |
| 3356 | + String site_path, | |
| 3357 | + (LogLevel, String) -> One logger //logger | |
| 3358 | + )= | |
| 3359 | + with file_name = site_path+"/site_UID", | |
| 3360 | + if read_from_file(file_name) is | |
| 3361 | + { | |
| 3362 | + cannot_find_file then | |
| 3363 | + logger(logInfo,"site UID doesn't exists. Generating one now"); | |
| 3364 | + with uid = generate_random_string(9), | |
| 3365 | + if write_to_file(file_name, to_byte_array(uid)) is | |
| 3366 | + { | |
| 3367 | + cannot_open_file then logger(logError, "Can't create site UID here "+file_name);"", | |
| 3368 | + write_error(_) then logger(logError, "Can't write site UID here "+file_name);"", | |
| 3369 | + ok then uid | |
| 3370 | + } | |
| 3371 | + read_error(_) then | |
| 3372 | + logger(logError, "cannot read site UID from "+file_name);"" | |
| 3373 | + ok(ba) then to_string(ba) | |
| 3374 | + } | |
| 3375 | + . | |
| 3376 | + | |
| 3377 | +// Compatibility function for older websites | |
| 3378 | + public define Web_Site | |
| 3379 | + make_web_site_description | |
| 3380 | + ( | |
| 3381 | + List(String) common_names, // for example: ["www.our-business.com"] | |
| 3382 | + String site_directory, | |
| 3383 | + String state_directory, | |
| 3384 | + One -> One init, | |
| 3385 | + (HTTP_Info, | |
| 3386 | + List(Web_arg), | |
| 3387 | + Bool is_https) -> $State initial_state, | |
| 3388 | + ($State expired, | |
| 3389 | + Maybe(String), | |
| 3390 | + HTTP_Info, | |
| 3391 | + List(Web_arg), | |
| 3392 | + Bool is_https) -> $State ticket_expired_state, | |
| 3393 | + (Maybe(String), | |
| 3394 | + HTTP_Info, | |
| 3395 | + List(Web_arg), | |
| 3396 | + Bool is_https) -> $State ticket_lost_state, | |
| 3397 | + List(Web_Action($State)) actions, | |
| 3398 | + $State -> HTTP_Answer compute_page, | |
| 3399 | + $State -> List(HTTP_header) additional_headers, | |
| 3400 | + List(HTTP_header) constant_additional_headers, | |
| 3401 | + Int timeout, | |
| 3402 | + Redirections redirections, | |
| 3403 | + String charset, | |
| 3404 | + List(String) journal_extensions, | |
| 3405 | + List(String) journal_headers, | |
| 3406 | + (LogLevel, String) -> One logger, //logger | |
| 3407 | + String secret, | |
| 3408 | + List(MIME) known_mime_types, | |
| 3409 | + (String action_name, | |
| 3410 | + List(Web_arg) args) -> One before_send_file | |
| 3411 | + //Bool using_state_cookies | |
| 3412 | + ) | |
| 3413 | + = | |
| 3414 | + //generate an unique ID if doesn't exist in root of site_directory | |
| 3415 | + with site_UID = get_site_uid(site_directory, logger), | |
| 3416 | + make_web_site_description(site_UID, common_names, site_directory, state_directory, init, initial_state, ticket_expired_state, ticket_lost_state, actions, compute_page, additional_headers, constant_additional_headers, timeout, redirections, charset, journal_extensions, journal_headers, logger, secret, known_mime_types, before_send_file) | |
| 3417 | +. | |
| 3418 | + | |
| 3419 | + | |
| 3420 | + | |
| 3421 | + *** [4.3] Starting the servers. | |
| 3422 | + | |
| 3423 | +public define Start_Web_Sites_Result | |
| 3424 | + start_web_sites | |
| 3425 | + ( | |
| 3426 | + Word32 ip_address, // the IP address shared by the web sites | |
| 3427 | + Word32 http_port, // usually: 80 | |
| 3428 | + Word32 https_port, // usually: 443 | |
| 3429 | + String ssl_certificate_common_name, | |
| 3430 | + List(Web_Site) web_sites, // web sites to be started | |
| 3431 | + (One) -> Bool shutdown_required | |
| 3432 | + ) = | |
| 3433 | + with get_description = (Web_Site ws) |-> description(ws)(http_port,https_port), | |
| 3434 | + with http_server_r = | |
| 3435 | + start_http_server(ip_address,http_port, | |
| 3436 | + map(get_description,web_sites), | |
| 3437 | + //load_denial_of_service_info, | |
| 3438 | + shutdown_required), | |
| 3439 | + with https_server_r = | |
| 3440 | + start_https_server(ip_address,https_port, | |
| 3441 | + ssl_certificate_common_name, | |
| 3442 | + map(get_description,web_sites), | |
| 3443 | + shutdown_required), | |
| 3444 | + if http_server_r is ok(http_server) | |
| 3445 | + then | |
| 3446 | + ( | |
| 3447 | + if https_server_r is ok(https_server) | |
| 3448 | + then | |
| 3449 | + ( | |
| 3450 | + start_http_servers_tasks(map(get_description,web_sites), | |
| 3451 | + [http_server,https_server], | |
| 3452 | + 600); // period of 10 minutes | |
| 3453 | + delegate | |
| 3454 | + delete_states_loop( | |
| 3455 | + map((Web_Site ws) |-> | |
| 3456 | + (site_directory(description(ws)(http_port,https_port))+ | |
| 3457 | + "/states",delete_out_of_date(ws)), | |
| 3458 | + web_sites), | |
| 3459 | + 3600*24*3, // keep out of date states 3 days | |
| 3460 | + now, | |
| 3461 | + http_server, | |
| 3462 | + https_server, | |
| 3463 | + shutdown_required), | |
| 3464 | + ok(http_server,https_server) | |
| 3465 | + ) | |
| 3466 | + else cannot_bind_to_port(https_port) | |
| 3467 | + ) | |
| 3468 | + else | |
| 3469 | + ( | |
| 3470 | + if https_server_r is ok(https_server) | |
| 3471 | + then cannot_bind_to_port(http_port) | |
| 3472 | + else cannot_bind_to_port(http_port,https_port) | |
| 3473 | + ). | |
| 3474 | + | |
| 3475 | + | |
| 3476 | +public define One | |
| 3477 | + start_web_sites | |
| 3478 | + ( | |
| 3479 | + Word32 ip_address, // the IP address shared by the web sites | |
| 3480 | + Word32 http_port, // usually: 80 | |
| 3481 | + Word32 https_port, // usually: 443 | |
| 3482 | + String ssl_certificate_common_name, | |
| 3483 | + List(Web_Site) web_sites, // web sites to be started | |
| 3484 | + (One) -> Bool shutdown_required, | |
| 3485 | + (LogLevel, String) -> One logger //logger where to report the error | |
| 3486 | + )= | |
| 3487 | + if (Start_Web_Sites_Result)start_web_sites(ip_address, | |
| 3488 | + http_port, | |
| 3489 | + https_port, | |
| 3490 | + ssl_certificate_common_name, | |
| 3491 | + web_sites, | |
| 3492 | + shutdown_required) is | |
| 3493 | + { | |
| 3494 | + cannot_bind_to_port(n) then logger(logError, "Cannot bind to port: "+n), | |
| 3495 | + cannot_bind_to_port(n,m) then logger(logError, "Cannot bind to ports: "+n+", "+m), | |
| 3496 | + ok(s1,s2) then logger(logInfo, "Servers started on ports "+http_port+" (HTTP) and "+https_port+" (HTTPS).") | |
| 3497 | + }. | |
| 3498 | + | |
| 3499 | + | |
| 3500 | + | |
| 3501 | + | |
| 3502 | + | |
| 3503 | + *** [5] HTML Formating. | |
| 3504 | + | |
| 3505 | + We need to translate HTML elements as defined above into actual HTML text. | |
| 3506 | + | |
| 3507 | + Actioners require special informations, which must be transmitted when needed by the | |
| 3508 | + 'format' functions: | |
| 3509 | + | |
| 3510 | + - the 'common name', which is used for URLs, | |
| 3511 | + - the HTTP/HTTPS port number, | |
| 3512 | + - the 'state name', which must be transmitted when the actioner is clicked upon, | |
| 3513 | + - the 'form name' (if any) to which the actioner refers. | |
| 3514 | + | |
| 3515 | + If the actioner is off form, and if it refers to a form, the name of that form is | |
| 3516 | + already known by the actioner. On the contrary, if the actioner is 'in form', it refers | |
| 3517 | + implicitly to the form containing it. The name of that form is transmitted to the | |
| 3518 | + 'format' functions called from within the formating of that form. | |
| 3519 | + | |
| 3520 | + | |
| 3521 | + | |
| 3522 | + | |
| 3523 | + *** [5.1] The type 'HTML_Any($T)'. | |
| 3524 | + | |
| 3525 | + The type 'HTML_Any($T)' gathers elements which may be put anywhere in the page. The | |
| 3526 | + parameter $T becomes either 'HTML_Off_Form' or 'HTML_In_Form'. | |
| 3527 | + | |
| 3528 | +type HTML_Any($T): | |
| 3529 | + any_text (List(CoreAttrs), String the_text), | |
| 3530 | + any_preformated (List(Text_Option), String), | |
| 3531 | + any_paragraph (List(Text_Option), List($T) content), | |
| 3532 | + any_image (List(CoreAttrs), String url, String alternate), | |
| 3533 | + any_image (List(CoreAttrs), String url, String alternate, Int width, Int height), | |
| 3534 | + any_table (List(Table_Option), HTML_Header_Row($T), List(HTML_Row($T)), HTML_Footer_Row($T)), | |
| 3535 | + any_center ($T), | |
| 3536 | + any_mail_to (String email, $T element), | |
| 3537 | + any_scroller (Int width, Int height, | |
| 3538 | + Int content_width, Int content_height, | |
| 3539 | + $T content), | |
| 3540 | + any_fixed_size (HTML_Size width, HTML_Size height, $T content), | |
| 3541 | + any_fixed_size_2 (HTML_Size width, HTML_Size height, String name_of_HTML_file), | |
| 3542 | + any_actioner (Actioner_Connection, | |
| 3543 | + Actioner_Target, | |
| 3544 | + Actioner_Aspect, | |
| 3545 | + WEB_Action_Name action, | |
| 3546 | + List((String,String)) extra_ops, | |
| 3547 | + List(Actioner_Local_Action), | |
| 3548 | + Maybe(String) form_name), | |
| 3549 | + any_foreign_link_new (Actioner_Target, Actioner_Aspect, String url), | |
| 3550 | + any_foreign_link (List(Text_Option), String url), | |
| 3551 | + any_foreign_link (List(Text_Option), String url, String name), | |
| 3552 | + any_private_download (String abs_path, String name, String extra_ext, | |
| 3553 | + Maybe((String,List((String,String))))), | |
| 3554 | + any_div (List(CoreAttrs), List($T) element), | |
| 3555 | + any_div_empty (List(CoreAttrs)), | |
| 3556 | + any_coreattrs (List(CoreAttrs)), | |
| 3557 | + any_ol (List(CoreAttrs), List($T) content), | |
| 3558 | + any_ul (List(CoreAttrs), List($T) content), | |
| 3559 | + any_li (List(CoreAttrs), List($T) content), | |
| 3560 | + any_button (List(CoreAttrs), List($T) element), | |
| 3561 | + any_i (List(CoreAttrs), String text), | |
| 3562 | + any_span (List(CoreAttrs), String text), | |
| 3563 | + any_hr (List(CoreAttrs)) | |
| 3564 | +. | |
| 3565 | + | |
| 3566 | + | |
| 3567 | + | |
| 3568 | + *** [5.2] Formating a color. | |
| 3569 | + | |
| 3570 | + RGB colors are formatted as '#rrggbb' where rr, gg and bb are two characters | |
| 3571 | + hexadecimal values. | |
| 3572 | + | |
| 3573 | +define String | |
| 3574 | + html_format | |
| 3575 | + ( | |
| 3576 | + RGB color | |
| 3577 | + ) = | |
| 3578 | + if color is rgb(r,g,b) then | |
| 3579 | + "#" + to_hexa(r) | |
| 3580 | + + to_hexa(g) | |
| 3581 | + + to_hexa(b). | |
| 3582 | + | |
| 3583 | + | |
| 3584 | + The following is a very arbitrary definition of the opposite color. The thing which is | |
| 3585 | + important is that it is far from the original, so that characters in 'opposite' color | |
| 3586 | + are clearly visible over the original. | |
| 3587 | + | |
| 3588 | +define RGB | |
| 3589 | + opposite | |
| 3590 | + ( | |
| 3591 | + RGB color | |
| 3592 | + ) = | |
| 3593 | + if color is rgb(r,g,b) then | |
| 3594 | + rgb(255-r, | |
| 3595 | + 255-g, | |
| 3596 | + 255-b). | |
| 3597 | + | |
| 3598 | + Converting RGB to RGBA. | |
| 3599 | + | |
| 3600 | +define RGBA | |
| 3601 | + to_rgba | |
| 3602 | + ( | |
| 3603 | + RGB color | |
| 3604 | + ) = | |
| 3605 | + if color is rgb(r,g,b) then rgba(r,g,b,255). | |
| 3606 | + | |
| 3607 | + | |
| 3608 | + *** [5.4] Formating an actioner. | |
| 3609 | + | |
| 3610 | + An actioner works as follows. Assume first that it refers to a form. When it is clicked | |
| 3611 | + upon, the actioner puts (via 'onMouseDown') the URL into the 'action' attribute of the | |
| 3612 | + form, and submits the form, using the JavaScript command 'form_name.submit()'. If the | |
| 3613 | + actioner does not refer to a form, it fires the URL directly via 'href', because in | |
| 3614 | + that case, the actioner is always an <a> tag. | |
| 3615 | + | |
| 3616 | + The URL itself is composed using the connection sort (same, http or https), the common | |
| 3617 | + name and port number (if needed), the state name, the action name, and the extra | |
| 3618 | + operands, which are put into a query string. It may look like this: | |
| 3619 | + | |
| 3620 | + http://common_name:port/?s=state_name&a=action_name&oname=value... | |
| 3621 | + | |
| 3622 | + Each extra operand is a pair of strings: (name,value). It is formated as: | |
| 3623 | + | |
| 3624 | + &oname=value | |
| 3625 | + | |
| 3626 | +public define String | |
| 3627 | + format_attrs | |
| 3628 | + ( | |
| 3629 | + List(CoreAttrs) attributs | |
| 3630 | + ). | |
| 3631 | + | |
| 3632 | +//public define String | |
| 3633 | +// format_extra_operands | |
| 3634 | +// ( | |
| 3635 | +// List((String,String)) l | |
| 3636 | +// ) = | |
| 3637 | +// if l is | |
| 3638 | +// { | |
| 3639 | +// [ ] then "", | |
| 3640 | +// [h . t] then if h is (n,v) then | |
| 3641 | +// "&"+n+"="+v+format_extra_operands(t) | |
| 3642 | +// } | |
| 3643 | +//. | |
| 3644 | + | |
| 3645 | + | |
| 3646 | + It seams that the standard requires "&" instead of "&" ! | |
| 3647 | + | |
| 3648 | + In case the target is another window, we need to format the options for this window. | |
| 3649 | + | |
| 3650 | +define String | |
| 3651 | + format | |
| 3652 | + ( | |
| 3653 | + List(Other_Window_Option) l | |
| 3654 | + ) = | |
| 3655 | + if l is | |
| 3656 | + { | |
| 3657 | + [ ] then "", | |
| 3658 | + [h . t] then if h is | |
| 3659 | + { | |
| 3660 | + resizable then "resizable", | |
| 3661 | + scrollbars then "scrollbars", | |
| 3662 | + width(w) then "width="+w, | |
| 3663 | + height(h2) then "height="+h2 | |
| 3664 | + } + if t is [ ] then "" else (","+format(t)) | |
| 3665 | + } | |
| 3666 | +. | |
| 3667 | + | |
| 3668 | + | |
| 3669 | + | |
| 3670 | + Formating choices for a <select> tag. | |
| 3671 | + | |
| 3672 | +public define Printable_tree | |
| 3673 | + format_choices | |
| 3674 | + ( | |
| 3675 | + List(String) l | |
| 3676 | + ) = | |
| 3677 | + if l is | |
| 3678 | + { | |
| 3679 | + [ ] then [ ], | |
| 3680 | + [h . t] then ["<option>", h, "</option>\n" . format_choices(t)] | |
| 3681 | + }. | |
| 3682 | + | |
| 3683 | + | |
| 3684 | +public define Printable_tree | |
| 3685 | + format_choices | |
| 3686 | + ( | |
| 3687 | + List(String) l, | |
| 3688 | + InitialValue selected | |
| 3689 | + ) = | |
| 3690 | + if l is | |
| 3691 | + { | |
| 3692 | + [ ] then [ ], | |
| 3693 | + [h . t] then if h = selected.value | |
| 3694 | + then ["<option selected=\"selected\">", h, "</option>\n" . format_choices(t)] | |
| 3695 | + else ["<option>", h, "</option>\n" . format_choices(t,selected)] | |
| 3696 | + }. | |
| 3697 | + | |
| 3698 | + | |
| 3699 | +public define Printable_tree | |
| 3700 | + format_choices | |
| 3701 | + ( | |
| 3702 | + List((List(CoreAttrs),WebArgValue,String)) l | |
| 3703 | + ) = | |
| 3704 | + if l is | |
| 3705 | + { | |
| 3706 | + [ ] then [ ], | |
| 3707 | + [h . t] then | |
| 3708 | + if h is (attrs,val,item) | |
| 3709 | + then ["<option value=\""+encode_HTML_entities(val.value)+"\" "+format_attrs(attrs)+">", item, "</option>\n" . format_choices(t)] | |
| 3710 | + }. | |
| 3711 | + | |
| 3712 | +public define Printable_tree | |
| 3713 | + format_choices | |
| 3714 | + ( | |
| 3715 | + List((List(CoreAttrs),WebArgValue,String)) l, | |
| 3716 | + InitialValue selected | |
| 3717 | + ) = | |
| 3718 | + if l is | |
| 3719 | + { | |
| 3720 | + [ ] then [ ], | |
| 3721 | + [h . t] then | |
| 3722 | + if h is (attrs,val,item) then | |
| 3723 | + if val.value = selected.value | |
| 3724 | + then ["<option value=\""+encode_HTML_entities(val.value)+"\" "+format_attrs(attrs)+" selected=\"selected\">", item, "</option>\n" . format_choices(t)] | |
| 3725 | + else ["<option value=\""+encode_HTML_entities(val.value)+"\" "+format_attrs(attrs)+" >", item, "</option>\n" . format_choices(t,selected)] | |
| 3726 | + }. | |
| 3727 | + | |
| 3728 | + | |
| 3729 | + | |
| 3730 | + Note: this counter is private to the virtual machine, hence there is one counter by | |
| 3731 | + client and by page : it seems that a new VM (simply a delegate) is started for each request. | |
| 3732 | + | |
| 3733 | +define Int | |
| 3734 | + new_count | |
| 3735 | + ( | |
| 3736 | + Var(Int) count | |
| 3737 | + ) | |
| 3738 | + = | |
| 3739 | + count <- *count+1; | |
| 3740 | + *count. | |
| 3741 | + | |
| 3742 | + | |
| 3743 | + The next function composes the URL. It is a JavaScript URL when the target is another | |
| 3744 | + window. | |
| 3745 | + | |
| 3746 | +//public define String | |
| 3747 | +// format_web_action_name | |
| 3748 | +// ( | |
| 3749 | +// WEB_Action_Name action | |
| 3750 | +// )= | |
| 3751 | +// if action is | |
| 3752 | +// { | |
| 3753 | +// no_action then "", | |
| 3754 | +// controller_action(controller, action_name) then "?aws_controller="+controller+"&aws_action="+action_name, | |
| 3755 | +// action_name(action_name) then "?aws_action="+action_name, | |
| 3756 | +// url(url) then url | |
| 3757 | +// } | |
| 3758 | +//. | |
| 3759 | +// | |
| 3760 | +//public define String | |
| 3761 | +// format_web_action_name | |
| 3762 | +// ( | |
| 3763 | +// WEB_Action_Name action, | |
| 3764 | +// List((String,String)) extra_ops, | |
| 3765 | +// )= | |
| 3766 | +// format_web_action_name(action) | |
| 3767 | +// + | |
| 3768 | +// format_extra_operands(extra_ops) | |
| 3769 | +//. | |
| 3770 | + | |
| 3771 | +define String | |
| 3772 | + make_actioner_url | |
| 3773 | + ( | |
| 3774 | + CommonInfo cinfo, | |
| 3775 | + Actioner_Connection connection, | |
| 3776 | + Actioner_Target target, | |
| 3777 | + WEB_Action_Name action, | |
| 3778 | + List((String,String)) extra_ops, | |
| 3779 | + Bool is_https | |
| 3780 | + ) = | |
| 3781 | + if cinfo is info(common_name,http_port,https_port,site_directory,secret) then | |
| 3782 | + with strict_url = | |
| 3783 | + if connection is | |
| 3784 | + { | |
| 3785 | + same then "/", | |
| 3786 | + http then | |
| 3787 | + if http_port = 80 then | |
| 3788 | + "http://"+common_name+"/" | |
| 3789 | + else | |
| 3790 | + "http://"+common_name+":"+http_port+"/", | |
| 3791 | + https then | |
| 3792 | + if https_port = 443 then | |
| 3793 | + "https://"+common_name+"/" | |
| 3794 | + else | |
| 3795 | + "https://"+common_name+":"+https_port+"/", | |
| 3796 | + } + | |
| 3797 | + //with action_string = | |
| 3798 | + format_web_action_name(action, extra_ops), | |
| 3799 | + if target is | |
| 3800 | + { | |
| 3801 | + same then strict_url, | |
| 3802 | + same(label) then strict_url+"#"+label, | |
| 3803 | + other(wn,ops) then | |
| 3804 | + | |
| 3805 | + "javascript:void window.open('"+strict_url+"&t="+wn+"','"+ | |
| 3806 | + "w"+to_ascii(sha1(wn))+"','"+format(ops)+"')" | |
| 3807 | + }. | |
| 3808 | + | |
| 3809 | +define String | |
| 3810 | + make_foreign_link_url | |
| 3811 | + ( | |
| 3812 | + Actioner_Target target, | |
| 3813 | + String url | |
| 3814 | + ) = | |
| 3815 | + if target is | |
| 3816 | + { | |
| 3817 | + same then "/", | |
| 3818 | + same(label) then "/#"+label, | |
| 3819 | + other(wn,ops) then | |
| 3820 | + | |
| 3821 | + "javascript:void window.open('"+url+"','"+ | |
| 3822 | + "w"+to_ascii(sha1(wn))+"','"+format(ops)+"')" | |
| 3823 | + }. | |
| 3824 | + | |
| 3825 | + | |
| 3826 | + Depending on the fact that the actioner refers to a form or not, the URL is used in two | |
| 3827 | + different ways. If the actioner does not refer to a form, it is realized by a '<a>' | |
| 3828 | + tag, with a 'href' attribute. If it refers to a form, it is still realized by a '<a>' | |
| 3829 | + tag, but with no href attribute. In this case, we use the 'onMouseDown' or 'onChange' | |
| 3830 | + event handler. The handler calls a JavaScript function which puts the URL as the value | |
| 3831 | + of the 'action' attribute of the form, and submits the form. | |
| 3832 | + | |
| 3833 | +type URL_or_JavaScript: | |
| 3834 | + url (String), | |
| 3835 | + javascript (Printable_tree script, Printable_tree handler). | |
| 3836 | + | |
| 3837 | + | |
| 3838 | + It was as shown below, in order to allow submission of a form from outside the form, | |
| 3839 | + but this makes problems: | |
| 3840 | + | |
| 3841 | +define URL_or_JavaScript | |
| 3842 | + format_action | |
| 3843 | + ( | |
| 3844 | + String the_url, | |
| 3845 | + Actioner_Aspect aspect, | |
| 3846 | + Maybe(String) mb_id, | |
| 3847 | + Maybe(String) mb_form_name, | |
| 3848 | + Var(Int) action_count | |
| 3849 | + ) = | |
| 3850 | + if mb_form_name is | |
| 3851 | + { | |
| 3852 | + failure then | |
| 3853 | + url(the_url), | |
| 3854 | + success(form_name) then | |
| 3855 | + with n = new_count(action_count), | |
| 3856 | + fn_name = "pfu_" + if mb_id is | |
| 3857 | + { | |
| 3858 | + failure then form_name + "_" + n, | |
| 3859 | + success(id) then id, | |
| 3860 | + }, | |
| 3861 | + javascript( | |
| 3862 | + [ | |
| 3863 | + "<script type=\"text/javascript\" language =\"JavaScript\">\n", | |
| 3864 | + "function ", fn_name, "() {\n", | |
| 3865 | + " var fa = document.forms.",form_name,";\n", | |
| 3866 | + " var u = \"",the_url,"\";\n", | |
| 3867 | + " fa.action = u;", | |
| 3868 | + if aspect is submit(_, _) then " }\n" | |
| 3869 | + else "\n fa.submit(); }\n", | |
| 3870 | + "</script>\n" | |
| 3871 | + ], | |
| 3872 | + [fn_name,"();"] | |
| 3873 | + ) | |
| 3874 | + }. | |
| 3875 | + | |
| 3876 | + Now, we format the actioner according to its aspect. | |
| 3877 | + | |
| 3878 | +define List(Text_Option) | |
| 3879 | + get_text_options | |
| 3880 | + ( | |
| 3881 | + List(Text_Option) l | |
| 3882 | + ) | |
| 3883 | + = | |
| 3884 | + if l is | |
| 3885 | + { | |
| 3886 | + [] then [], | |
| 3887 | + [h . t ] then | |
| 3888 | + if h is class(_) then | |
| 3889 | + get_text_options(t) | |
| 3890 | + else if h is id(_) then | |
| 3891 | + get_text_options(t) | |
| 3892 | + else if h is style(_) then | |
| 3893 | + get_text_options(t) | |
| 3894 | + else if h is title(_) then | |
| 3895 | + get_text_options(t) | |
| 3896 | + else if h is core_attrs(_) then | |
| 3897 | + get_text_options(t) | |
| 3898 | + else | |
| 3899 | + [ h . get_text_options(t) ] | |
| 3900 | + | |
| 3901 | + }. | |
| 3902 | + | |
| 3903 | + /** | |
| 3904 | + * Extract the CSS class list from the list of Text_Option | |
| 3905 | + */ | |
| 3906 | +define List(CoreAttrs) | |
| 3907 | + get_css_class | |
| 3908 | + ( | |
| 3909 | + List(Text_Option) l | |
| 3910 | + ) | |
| 3911 | + = | |
| 3912 | + if l is | |
| 3913 | + { | |
| 3914 | + [] then [], | |
| 3915 | + [h . t ] then | |
| 3916 | + | |
| 3917 | + | |
| 3918 | + if h is class(name) then | |
| 3919 | + [ class(name) . get_css_class(t) ] | |
| 3920 | + else if h is id(name) then | |
| 3921 | + [ id(name) . get_css_class(t) ] | |
| 3922 | + else if h is style(the_style) then | |
| 3923 | + [ style(the_style) . get_css_class(t) ] | |
| 3924 | + else if h is title(name) then | |
| 3925 | + [ tooltip(name) . get_css_class(t) ] | |
| 3926 | + else if h is attr(name, value) then | |
| 3927 | + [ attr(name, value) . get_css_class(t) ] | |
| 3928 | + else | |
| 3929 | + get_css_class(t) | |
| 3930 | + } | |
| 3931 | + . | |
| 3932 | + | |
| 3933 | + | |
| 3934 | +define List(CoreAttrs) | |
| 3935 | + get_core_attrs | |
| 3936 | + ( | |
| 3937 | + List(Text_Option) l | |
| 3938 | + ) | |
| 3939 | + = | |
| 3940 | + if l is | |
| 3941 | + { | |
| 3942 | + [] then [], | |
| 3943 | + [h . t ] then | |
| 3944 | + if h is core_attrs(attrs) then | |
| 3945 | + attrs + get_core_attrs(t) | |
| 3946 | + else | |
| 3947 | + get_core_attrs(t) | |
| 3948 | + } | |
| 3949 | + . | |
| 3950 | + | |
| 3951 | +define Printable_tree | |
| 3952 | + format | |
| 3953 | + ( | |
| 3954 | + List(Actioner_Local_Action) l | |
| 3955 | + ) = | |
| 3956 | + if l is | |
| 3957 | + { | |
| 3958 | + [ ] then [ ], | |
| 3959 | + [h . t] then [if h is | |
| 3960 | + { | |
| 3961 | + close_window then [" window.close(); "] | |
| 3962 | + } | |
| 3963 | + . format(t)] | |
| 3964 | + }. | |
| 3965 | + | |
| 3966 | + | |
| 3967 | +define String | |
| 3968 | + format_attrs | |
| 3969 | + ( | |
| 3970 | + List(InputAttrs) attributs, | |
| 3971 | + List(String) classes, | |
| 3972 | + List(String) styles | |
| 3973 | + )= | |
| 3974 | + if attributs is | |
| 3975 | + { | |
| 3976 | + [] then | |
| 3977 | + if length(classes) = 0 then "" else " class=\""+join(" ",classes)+"\""+ | |
| 3978 | + if length(styles) = 0 then "" else " style=\""+join(";",styles)+"\"", | |
| 3979 | + [h . t] then | |
| 3980 | + with new_classes = if h is class(class_name) then [class_name. classes] else classes, | |
| 3981 | + new_styles = if h is style(style_string) then [style_string . styles] else styles, | |
| 3982 | + current = if h is | |
| 3983 | + { | |
| 3984 | + id(id_name) then | |
| 3985 | + " id=\"" + id_name + "\"", | |
| 3986 | + class(class_name) then "", | |
| 3987 | + style(style_string) then "", | |
| 3988 | + title(title_string) then | |
| 3989 | + " title=\"" + title_string + "\"", | |
| 3990 | + | |
| 3991 | + lang(lang) then | |
| 3992 | + " xml:lang=" + lang, | |
| 3993 | + dir(reading_Way) then | |
| 3994 | + if reading_Way is | |
| 3995 | + { | |
| 3996 | + ltr then " dir=ltr", | |
| 3997 | + rtl then " dir=rtl" | |
| 3998 | + }, | |
| 3999 | + | |
| 4000 | + accesskey(key) then | |
| 4001 | + " accesskey=\"" + key + "\"", | |
| 4002 | + tabindex(index) then | |
| 4003 | + " tabindex=\"" + index + "\"", | |
| 4004 | + | |
| 4005 | + attr(name, value) then | |
| 4006 | + " " + name + "=\"" + value + "\"", | |
| 4007 | + | |
| 4008 | + event(e, value) then | |
| 4009 | + " " + event_name(e) + "=\"" + value + "\"", | |
| 4010 | + data(name, value) then | |
| 4011 | + " data-" + to_lower(name) + "=\"" + value + "\"", | |
| 4012 | + }, | |
| 4013 | + current + format_attrs(t, classes, styles) | |
| 4014 | + }. | |
| 4015 | + | |
| 4016 | +public define List(CoreAttrs) extract_attributes(HTML_tooltip htt). | |
| 4017 | + | |
| 4018 | +define String | |
| 4019 | + format_attrs | |
| 4020 | + ( | |
| 4021 | + List(CoreAttrs) attributs, | |
| 4022 | + List(String) classes, //class accumulator | |
| 4023 | + List(String) styles //styles accumulator | |
| 4024 | + )= | |
| 4025 | + if attributs is | |
| 4026 | + { | |
| 4027 | + [] then | |
| 4028 | + //concat all accumulated classes and styles | |
| 4029 | + (if length(classes) = 0 then "" else " class=\""+join(" ",classes)+"\"")+ | |
| 4030 | + if length(styles) = 0 then "" else " style=\""+join(";",styles)+"\"", | |
| 4031 | + [h . t] then | |
| 4032 | + with new_classes = if h is class(class_name) then [class_name. classes] else classes, | |
| 4033 | + new_styles = if h is style(style_string) then [style_string . styles] else styles, | |
| 4034 | + new_attrs = if h is tooltip(tt) then extract_attributes(tt) else [], | |
| 4035 | + | |
| 4036 | + current = if h is | |
| 4037 | + { | |
| 4038 | + empty then "", | |
| 4039 | + id(id_name) then | |
| 4040 | + " id=\"" + id_name + "\"", | |
| 4041 | + class(class_name) then "", //do nothing here, because we accumulate the class until we have some other attributes | |
| 4042 | + style(style_string) then "", //do nothing here, because we accumulate the style until we have some other attributes | |
| 4043 | + title(title_string) then | |
| 4044 | + " title=\"" + title_string + "\"", | |
| 4045 | + | |
| 4046 | + lang(lang) then | |
| 4047 | + " xml:lang=" + lang, | |
| 4048 | + dir(reading_Way) then | |
| 4049 | + if reading_Way is | |
| 4050 | + { | |
| 4051 | + ltr then " dir=ltr", | |
| 4052 | + rtl then " dir=rtl" | |
| 4053 | + }, | |
| 4054 | + | |
| 4055 | + accesskey(key) then | |
| 4056 | + " accesskey=\"" + key + "\"", | |
| 4057 | + tabindex(index) then | |
| 4058 | + " tabindex=\"" + index + "\"", | |
| 4059 | + attr(name, value) then | |
| 4060 | + " " + name + "=\"" + value + "\"", | |
| 4061 | + bool_attr(bool, value)then | |
| 4062 | + if bool then " "+value+" " else "", | |
| 4063 | + event(e, value) then | |
| 4064 | + " " + event_name(e) + "=\"" + value + "\"", | |
| 4065 | + tooltip(_) then "", //do nothing here, because we extract attributes at first in new_attrs | |
| 4066 | + data(name, value) then | |
| 4067 | + " data-" + to_lower(name) + "=\"" + value + "\"", | |
| 4068 | + | |
| 4069 | + contenteditable(value)then //boolean value | |
| 4070 | + " contenteditable=\""+ to_String(value)+ "\"" | |
| 4071 | + | |
| 4072 | + contextmenu(id_name) then //ID value | |
| 4073 | + " contextmenu=\"" + id_name + "\"", | |
| 4074 | + | |
| 4075 | + draggable(value) then //boolean value | |
| 4076 | + " draggable=\""+ to_String(value)+ "\"", | |
| 4077 | + | |
| 4078 | + enterkeyhint(value) then | |
| 4079 | + " enterkeyhint=\""+ value + "\"", | |
| 4080 | + | |
| 4081 | + hidden(value) then //boolean value | |
| 4082 | + " hidden=\""+ (if value then "hidden" else "") + "\"", | |
| 4083 | + | |
| 4084 | + inert then | |
| 4085 | + " inert", | |
| 4086 | + | |
| 4087 | + inputmode(value) then | |
| 4088 | + " inputmode =\"" + value + "\"", | |
| 4089 | + | |
| 4090 | + popover then | |
| 4091 | + " popover", | |
| 4092 | + | |
| 4093 | + spellcheck(value) then //boolean value | |
| 4094 | + " spellcheck=\""+ to_String(value)+ "\"" | |
| 4095 | + | |
| 4096 | + translate(value) then | |
| 4097 | + " translate=\"" + if value then "yes\"" else "no\"" | |
| 4098 | + }, | |
| 4099 | + current + format_attrs(t + new_attrs, new_classes, new_styles) | |
| 4100 | + }. | |
| 4101 | + | |
| 4102 | +define String | |
| 4103 | + format_attrs | |
| 4104 | + ( | |
| 4105 | + List(InputAttrs) attributs | |
| 4106 | + )= | |
| 4107 | + format_attrs(attributs, [], []). | |
| 4108 | + | |
| 4109 | +public define String | |
| 4110 | + format_attrs | |
| 4111 | + ( | |
| 4112 | + List(CoreAttrs) attributs | |
| 4113 | + )= | |
| 4114 | + format_attrs(attributs, [], []). | |
| 4115 | + | |
| 4116 | +define String | |
| 4117 | + format_text_options | |
| 4118 | + ( | |
| 4119 | + List(Text_Option) l | |
| 4120 | + ) | |
| 4121 | + = | |
| 4122 | + with text_options = get_text_options(l), | |
| 4123 | + core_attrs = get_css_class(l) + get_core_attrs(l), | |
| 4124 | + (if length(text_options)= 0 then "" else " style=\"" + format(text_options) + "\" ") | |
| 4125 | + + | |
| 4126 | + (if length(core_attrs) = 0 then "" else format_attrs(core_attrs)) | |
| 4127 | + . | |
| 4128 | + | |
| 4129 | +define Printable_tree | |
| 4130 | + format_div_option | |
| 4131 | + ( | |
| 4132 | + List(CoreAttrs) options | |
| 4133 | + )= | |
| 4134 | + ["<div" + format_attrs(options) + ">"] | |
| 4135 | +. | |
| 4136 | + | |
| 4137 | +define Maybe(String) | |
| 4138 | + extract_id | |
| 4139 | + ( | |
| 4140 | + List(CoreAttrs) attrbs | |
| 4141 | + ) = | |
| 4142 | + if attrbs is | |
| 4143 | + { | |
| 4144 | + [] then failure, | |
| 4145 | + [h . t] then | |
| 4146 | + if h is id(value) then success(value) | |
| 4147 | + else extract_id(t) | |
| 4148 | + } | |
| 4149 | +. | |
| 4150 | + | |
| 4151 | +define Maybe(String) | |
| 4152 | + extract_id | |
| 4153 | + ( | |
| 4154 | + Actioner_Aspect aspect | |
| 4155 | + ) = | |
| 4156 | + if aspect is | |
| 4157 | + { | |
| 4158 | + link(_,_,_) then failure, | |
| 4159 | + img_link(_,_,_) then failure, | |
| 4160 | + push_button(opts,_) then extract_id(opts), | |
| 4161 | + button(_,_) then failure, | |
| 4162 | + button(_,_,_,_) then failure, | |
| 4163 | + submit(opts,_) then extract_id(opts), | |
| 4164 | + //immediate_selector(_,_,_,_) then failure, | |
| 4165 | + immediate_selector(_,_,_,_,_,_) then failure, | |
| 4166 | + html(_, _) then failure, | |
| 4167 | + }. | |
| 4168 | + | |
| 4169 | +to do Complete format_foreign_link | |
| 4170 | +//TODO Complete format_foreign_link | |
| 4171 | + | |
| 4172 | + CommonInfo cinfo, | |
| 4173 | + String state_name, | |
| 4174 | + Var(Int) action_count, | |
| 4175 | + Var(Int) ic_v // 'idnum' counter variable | |
| 4176 | + | |
| 4177 | +define Printable_tree | |
| 4178 | + format_foreign_link | |
| 4179 | + ( | |
| 4180 | +// CommonInfo cinfo, | |
| 4181 | + Actioner_Target target, | |
| 4182 | + Actioner_Aspect aspect, | |
| 4183 | + String url, | |
| 4184 | + Bool is_https, | |
| 4185 | + CommonInfo cinfo, | |
| 4186 | +// String state_name, | |
| 4187 | + Var(Int) action_count, | |
| 4188 | + Var(Int) ic_v, // 'idnum' counter variable | |
| 4189 | + Var(List(HTML_Head_Tag)) head_tags | |
| 4190 | + ) = | |
| 4191 | + //if cinfo is info(common_name,http_port,https_port,site_dir,secret) then | |
| 4192 | + with full_url = make_foreign_link_url(target,url), | |
| 4193 | +// with action = format_action(full_url, aspect, extract_id(aspect), mb_form_name), | |
| 4194 | + if aspect is | |
| 4195 | + { | |
| 4196 | + | |
| 4197 | + link(opt, text, mb_name) then | |
| 4198 | + with name_tag = if mb_name is success(n) then " name=\"" + n + "\"" else "", | |
| 4199 | + [ | |
| 4200 | + "<a href=\"", full_url, "\"", format_text_options(opt), name_tag, ">", | |
| 4201 | + text, | |
| 4202 | + "</a>" | |
| 4203 | + ], | |
| 4204 | + img_link(opt, img, alt_text) then | |
| 4205 | + [ | |
| 4206 | + "<a href=\"", full_url ,"\"", format_attrs(opt),"><img src=\"", img, | |
| 4207 | + "\" alt=\"" + alt_text + "\" border=\"0\"></a>" | |
| 4208 | + ], | |
| 4209 | + push_button(options, text) then | |
| 4210 | + ["<a href=\"",full_url,"\"", format_attrs(options), ">", | |
| 4211 | + text, "</a>" | |
| 4212 | + ], | |
| 4213 | + button(url_off,url_on) then | |
| 4214 | + [ ], | |
| 4215 | + | |
| 4216 | + button(url_off,url_on,w,h) then | |
| 4217 | + [ ], | |
| 4218 | + | |
| 4219 | + submit(options, text) then | |
| 4220 | + [ ], | |
| 4221 | + | |
| 4222 | + //immediate_selector(opt,name,size,choices) then | |
| 4223 | + // [ ], | |
| 4224 | + immediate_selector(opt,name,size,choices,selected,function) then | |
| 4225 | + [ ], | |
| 4226 | + html(options, html_off_form) then | |
| 4227 | + [ | |
| 4228 | + "<a href=\"", full_url,"\"", format_attrs(options), ">", | |
| 4229 | + format(cinfo, ic_v, html_off_form, is_https, action_count, head_tags), | |
| 4230 | + "</a>" | |
| 4231 | + ] | |
| 4232 | + }. | |
| 4233 | + | |
| 4234 | +define Printable_tree | |
| 4235 | + format_actioner | |
| 4236 | + ( | |
| 4237 | + CommonInfo cinfo, | |
| 4238 | + Actioner_Connection connection, | |
| 4239 | + Actioner_Target target, | |
| 4240 | + Actioner_Aspect aspect, | |
| 4241 | + WEB_Action_Name action, | |
| 4242 | + List((String,String)) extra_ops, | |
| 4243 | + List(Actioner_Local_Action) local_actions, | |
| 4244 | + Maybe(String) mb_form_name, | |
| 4245 | + Bool is_https, | |
| 4246 | + Var(Int) action_count, | |
| 4247 | + Var(Int) ic_v, // 'idnum' counter variable | |
| 4248 | + Var(List(HTML_Head_Tag)) head_tags | |
| 4249 | + | |
| 4250 | + ) = | |
| 4251 | + | |
| 4252 | + if cinfo is info(common_name,http_port,https_port,site_dir,secret) then | |
| 4253 | + with url = make_actioner_url(cinfo,connection,target, | |
| 4254 | + action,extra_ops,is_https), | |
| 4255 | + with formatted_action = format_action(url, aspect, extract_id(aspect), mb_form_name, action_count), | |
| 4256 | + if aspect is | |
| 4257 | + { | |
| 4258 | + | |
| 4259 | + link(opt, text, mb_name) then | |
| 4260 | + with name_tag = if mb_name is success(n) then " name=\"" + n + "\"" else "", | |
| 4261 | + with action_name = if action is { | |
| 4262 | + no_action then "" | |
| 4263 | + controller_action(_, an) then an, | |
| 4264 | + action_name(an) then an, | |
| 4265 | + url(_) then "" | |
| 4266 | + }, | |
| 4267 | + if action_name = "" then | |
| 4268 | + ["<a ", format_text_options(opt), name_tag, ">", text, "</a>" ] | |
| 4269 | + else | |
| 4270 | + ["<a href=\"",url,"\"", | |
| 4271 | + format_text_options(opt), name_tag, ">", | |
| 4272 | + text, | |
| 4273 | + "</a>" | |
| 4274 | + ], | |
| 4275 | + img_link(options, img, alt_text) then | |
| 4276 | + //if action name is empty, format options on image because maybe there onclick action | |
| 4277 | + with action_name = if action is { | |
| 4278 | + no_action then "" | |
| 4279 | + controller_action(_, an) then an, | |
| 4280 | + action_name(an) then an, | |
| 4281 | + url(_) then "" | |
| 4282 | + }, | |
| 4283 | + if action_name ="" then | |
| 4284 | + [ | |
| 4285 | + "<img src=\"", img,"\"", | |
| 4286 | + format_attrs(options)," alt=\"" + alt_text + "\" border=\"0\">" | |
| 4287 | + ] | |
| 4288 | + else | |
| 4289 | + [ | |
| 4290 | + "<a href=\"", url,"\"", format_attrs(options),"><img src=\"", img, | |
| 4291 | + "\" alt=\"" + alt_text + "\" border=\"0\"></a>" | |
| 4292 | + ], | |
| 4293 | + push_button(options, text) then | |
| 4294 | + [ | |
| 4295 | + if formatted_action is | |
| 4296 | + { | |
| 4297 | + url(u) then ["<a href=\"",u,"\"", format_attrs(options), ">", | |
| 4298 | + text, "</a>" | |
| 4299 | + ], | |
| 4300 | + javascript(s,h) then | |
| 4301 | + with action_name = | |
| 4302 | + if action is | |
| 4303 | + { | |
| 4304 | + no_action then "", | |
| 4305 | + controller_action(_, an) then an, | |
| 4306 | + action_name(an) then an, | |
| 4307 | + url(_) then "" | |
| 4308 | + }, | |
| 4309 | + if action_name = "" then | |
| 4310 | + ["<input type=\"button\" value=\"",encode_HTML_entities(text),"\"", format_attrs(options), " />"] | |
| 4311 | + else | |
| 4312 | + [s,"<input type=\"button\" value=\"",encode_HTML_entities(text),"\"", format_attrs(options), " onclick=\"",h,"\" />"] | |
| 4313 | + } | |
| 4314 | + ], | |
| 4315 | + button(url_off,url_on) then | |
| 4316 | + [ if formatted_action is | |
| 4317 | + { | |
| 4318 | + url(u) then ["<a href=\"",u], | |
| 4319 | + javascript(s,h) then [s,"<a onMouseDown=\"",h] | |
| 4320 | + }, | |
| 4321 | + "\" style=\"text-decoration:none\">", | |
| 4322 | + "<img alt=\"",url_off,"\" src=\"",url_off,"\" border=0", | |
| 4323 | + " onMouseOver=\"this.src='",url_on,"'\" ", | |
| 4324 | + " onMouseOut=\"this.src='",url_off,"'\">", | |
| 4325 | + "</a>" | |
| 4326 | + ], | |
| 4327 | + | |
| 4328 | + button(url_off,url_on,w,h) then | |
| 4329 | + [ if formatted_action is | |
| 4330 | + { | |
| 4331 | + url(u) then ["<a href=\"",u], | |
| 4332 | + javascript(s,h2) then [s,"<a onMouseDown=\"",h2] | |
| 4333 | + }, | |
| 4334 | + "\" style=\"text-decoration:none\">", | |
| 4335 | + "<img width=",w," height=",h," alt=\"",url_off,"\" src=\"",url_off,"\" border=0", | |
| 4336 | + " onMouseOver=\"this.src='",url_on,"'\" ", | |
| 4337 | + " onMouseOut=\"this.src='",url_off,"'\">", | |
| 4338 | + "</a>" | |
| 4339 | + ], | |
| 4340 | + | |
| 4341 | + submit(options, text) then | |
| 4342 | + [ | |
| 4343 | + if formatted_action is | |
| 4344 | + { | |
| 4345 | + url(u) then ["<a href=\"",u,"\"", format_attrs(options), ">", | |
| 4346 | + text, "</a>" | |
| 4347 | + ], | |
| 4348 | + javascript(s,h) then | |
| 4349 | + with action_name = if action is { | |
| 4350 | + no_action then "", | |
| 4351 | + controller_action(_, an) then an, | |
| 4352 | + action_name(an) then an, | |
| 4353 | + url(_) then "" | |
| 4354 | + }, | |
| 4355 | + if action_name = "" then // special case where URL (so the action_name) is provided by the form itself | |
| 4356 | + // so javascript isn't needed. This is the standard HMTL way. | |
| 4357 | + ["<input type=\"submit\" value=\"",text,"\"", format_attrs(options), " />"] | |
| 4358 | + else | |
| 4359 | + [s,"<input type=\"submit\" value=\"",text,"\"", format_attrs(options), " onclick=\"",h,"\" />"] | |
| 4360 | + } | |
| 4361 | + ], | |
| 4362 | + | |
| 4363 | +// immediate_selector(options,name,size,choices) then | |
| 4364 | +// [ if action is | |
| 4365 | +// { | |
| 4366 | +// url(u) then ["<select href=\"",u] | |
| 4367 | +// javascript(s,h) then [s,"<select onchange=\"",h] | |
| 4368 | +// }, | |
| 4369 | +// "\" name=\"",name,"\" size=\"",size,"\"", format_attrs(options), ">", | |
| 4370 | +// format_choices(choices),"</select>" | |
| 4371 | +// ], | |
| 4372 | + immediate_selector(options, name, size, choices, mb_selected, custom_function_name) then | |
| 4373 | + [ | |
| 4374 | + //if custom function name is provided, that name is used instead of autogenerated js function | |
| 4375 | + if custom_function_name = "" then | |
| 4376 | + if formatted_action is | |
| 4377 | + { | |
| 4378 | + url(u) then ["<select href=\"",u] | |
| 4379 | + javascript(s,h) then [s,"<select onchange=\"",h] | |
| 4380 | + } | |
| 4381 | + else | |
| 4382 | + ["<select onchange=\"",custom_function_name], | |
| 4383 | + | |
| 4384 | + "\" name=\"",name,"\" size=\"",size,"\"", format_attrs(options), ">", | |
| 4385 | + if mb_selected is success(selected) then format_choices(choices, selected) else format_choices(choices),"</select>" | |
| 4386 | + ], | |
| 4387 | + html(options, html_off_form) then | |
| 4388 | + [ | |
| 4389 | + "<a href=\"", url,"\"", format_attrs(options), ">", | |
| 4390 | + format(cinfo, ic_v, html_off_form, is_https, action_count, head_tags), | |
| 4391 | + "</a>" | |
| 4392 | + ] | |
| 4393 | + }. | |
| 4394 | + | |
| 4395 | + | |
| 4396 | + | |
| 4397 | + | |
| 4398 | + | |
| 4399 | + | |
| 4400 | + *** [5.5] Formating a private download link. | |
| 4401 | + | |
| 4402 | + We get the absolute path of the file to be downloaded, and the name under which it | |
| 4403 | + should appear to the client. The function 'format_private_download' creates an | |
| 4404 | + hypertext link for downloading the file. The secured mecanism of private download is | |
| 4405 | + used. This function is called by the function which formats HTML_Any($T) elements. | |
| 4406 | + | |
| 4407 | + | |
| 4408 | +define Printable_tree | |
| 4409 | + format_private_download | |
| 4410 | + ( | |
| 4411 | + CommonInfo cinfo, | |
| 4412 | + String abs_path, // absolute file path on server | |
| 4413 | + String name, // name of file as it appears in the browser | |
| 4414 | + String extra, // extra extension | |
| 4415 | + Maybe((String,List((String,String)))) action | |
| 4416 | + ) = | |
| 4417 | + if cinfo is info(common_name,http_port,https_port,site_directory,secret) then | |
| 4418 | + with private_download_directory = site_directory+"/private_download", | |
| 4419 | + with auth = make_authorization(site_directory,secret,abs_path), | |
| 4420 | + [ | |
| 4421 | + "<a href=\"",name,extra,"?zauth=",auth, | |
| 4422 | + if action is | |
| 4423 | + { | |
| 4424 | + failure then [ ] | |
| 4425 | + success(a) then if a is (an,args) then | |
| 4426 | + ["&a=",an,format_extra_operands(args)] | |
| 4427 | + }, | |
| 4428 | + "\">", | |
| 4429 | + name, | |
| 4430 | + "</a>" | |
| 4431 | + ]. | |
| 4432 | + | |
| 4433 | + *** [5.6] Formating rows and cells in a table. | |
| 4434 | + | |
| 4435 | +define Int | |
| 4436 | + percent | |
| 4437 | + ( | |
| 4438 | + Int p | |
| 4439 | + ) = | |
| 4440 | + if p < 0 then 0 else if p > 100 then 100 else p. | |
| 4441 | + | |
| 4442 | + | |
| 4443 | + | |
| 4444 | + | |
| 4445 | + Formating cell options. | |
| 4446 | + | |
| 4447 | + | |
| 4448 | + | |
| 4449 | +define String | |
| 4450 | + format | |
| 4451 | + ( | |
| 4452 | + BackgroundOption o | |
| 4453 | + ) = | |
| 4454 | + if o is | |
| 4455 | + { | |
| 4456 | + repeat then "", | |
| 4457 | + repeat_horizontal then "; background-repeat: repeat-x", | |
| 4458 | + repeat_vertical then "; background-repeat: repeat-y", | |
| 4459 | + no_repeat then "; background-repeat: no-repeat", | |
| 4460 | + center then "; background-position: center top" | |
| 4461 | + }. | |
| 4462 | + | |
| 4463 | +define String | |
| 4464 | + format | |
| 4465 | + ( | |
| 4466 | + List(BackgroundOption) l | |
| 4467 | + ) = | |
| 4468 | + if l is | |
| 4469 | + { | |
| 4470 | + [ ] then "", | |
| 4471 | + [h . t] then format(h)+format(t) | |
| 4472 | + }. | |
| 4473 | + | |
| 4474 | + | |
| 4475 | +define String | |
| 4476 | + format | |
| 4477 | + ( | |
| 4478 | + List(Cell_Option) options | |
| 4479 | + ) = | |
| 4480 | + if options is | |
| 4481 | + { | |
| 4482 | + [ ] then "", | |
| 4483 | + [h . t] then | |
| 4484 | + if h is | |
| 4485 | + { | |
| 4486 | + core_attrs(core_attr_list) then format_attrs(core_attr_list), | |
| 4487 | + left then " align=\"left\"", | |
| 4488 | + h_center then " align=\"center\"", | |
| 4489 | + right then " align=\"right\"", | |
| 4490 | + top then " valign=\"top\"", | |
| 4491 | + v_center then " valign=\"middle\"", | |
| 4492 | + bottom then " valign=\"bottom\"", | |
| 4493 | + base_line then " valign=\"baseline\"", | |
| 4494 | + background_color(c) then " bgcolor=\""+html_format(c)+"\"", | |
| 4495 | + background_image(n,o) then " style=\"background: url("+n+")"+format(o)+"\"", | |
| 4496 | + width(w) then " width=\""+w+"\"", | |
| 4497 | + percentage_width(n) then " width=\""+percent(n)+"%\"", | |
| 4498 | + height(h2) then " height=\""+h2+"\"", | |
| 4499 | + columns(n) then " colspan=\""+n+"\"", | |
| 4500 | + rows(n) then " rowspan=\""+n+"\"", | |
| 4501 | + nowrap then " nowrap", | |
| 4502 | + style(style_string) then " style=\"" + style_string + "\"", | |
| 4503 | + class(class_name) then " class=\""+class_name+"\"" | |
| 4504 | + } | |
| 4505 | + + format(t) | |
| 4506 | + }. | |
| 4507 | + | |
| 4508 | + | |
| 4509 | + Normalizing a list of cell options (horizontal position must be specified; the default | |
| 4510 | + is 'left'). | |
| 4511 | + | |
| 4512 | + Formating cells in a row. | |
| 4513 | + | |
| 4514 | +define Printable_tree | |
| 4515 | + format | |
| 4516 | + ( | |
| 4517 | + List(HTML_Cell($T)) cells, | |
| 4518 | + $T -> Printable_tree format_element | |
| 4519 | + ) = | |
| 4520 | + if cells is | |
| 4521 | + { | |
| 4522 | + [ ] then [ ], | |
| 4523 | + [h . t] then if h is cell(options,element) then | |
| 4524 | + ["<td",format(reverse(options)),">", | |
| 4525 | + format_element(element), | |
| 4526 | + "</td>" | |
| 4527 | + . format(t,format_element)] | |
| 4528 | + }. | |
| 4529 | + | |
| 4530 | +define Printable_tree | |
| 4531 | + format | |
| 4532 | + ( | |
| 4533 | + List(HTML_Header_Cell($T)) cells, | |
| 4534 | + $T -> Printable_tree format_element | |
| 4535 | + ) = | |
| 4536 | + if cells is | |
| 4537 | + { | |
| 4538 | + [ ] then [ ], | |
| 4539 | + [h . t] then if h is header_cell(options,element) then | |
| 4540 | + ["<th ",format(reverse(options)),">", | |
| 4541 | + format_element(element), | |
| 4542 | + "</th>" | |
| 4543 | + . format(t,format_element)] | |
| 4544 | + }. | |
| 4545 | + | |
| 4546 | + Formating the rows in a table. | |
| 4547 | + | |
| 4548 | +define Printable_tree | |
| 4549 | + format | |
| 4550 | + ( | |
| 4551 | + List(HTML_Row($T)) rows, | |
| 4552 | + $T -> Printable_tree format_element, | |
| 4553 | + )= | |
| 4554 | + if rows is | |
| 4555 | + { | |
| 4556 | + [ ] then [ ], | |
| 4557 | + [h . t] then | |
| 4558 | + if h is | |
| 4559 | + { | |
| 4560 | + empty then format(t, format_element), | |
| 4561 | + row(options, cells) then | |
| 4562 | + ["<tr",format(reverse(options)),">", format(cells, format_element), "</tr>\n" | |
| 4563 | + . format(t, format_element)] | |
| 4564 | + } | |
| 4565 | + } | |
| 4566 | +. | |
| 4567 | + | |
| 4568 | +define Printable_tree | |
| 4569 | + format | |
| 4570 | + ( | |
| 4571 | + HTML_Header_Row($T) row, | |
| 4572 | + $T -> Printable_tree format_element | |
| 4573 | + ) = | |
| 4574 | + if row is | |
| 4575 | + { | |
| 4576 | + empty then [ ], | |
| 4577 | + header_row(options,cells) then | |
| 4578 | + ["<thead> <tr",format(reverse(options)),">", | |
| 4579 | + format(cells,format_element), | |
| 4580 | + "</tr> </thead>\n" | |
| 4581 | + ] | |
| 4582 | + }. | |
| 4583 | + | |
| 4584 | +define Printable_tree | |
| 4585 | + format | |
| 4586 | + ( | |
| 4587 | + HTML_Footer_Row($T) row, | |
| 4588 | + $T -> Printable_tree format_element | |
| 4589 | + ) = | |
| 4590 | + if row is | |
| 4591 | + { | |
| 4592 | + empty then [ ], | |
| 4593 | + footer_row(options,cells) then | |
| 4594 | + ["<tfoot> <tr",format(reverse(options)),">", | |
| 4595 | + format(cells,format_element), | |
| 4596 | + "</tr> </tfoot>\n" | |
| 4597 | + ] | |
| 4598 | + }. | |
| 4599 | + | |
| 4600 | +define Printable_tree | |
| 4601 | + format1 | |
| 4602 | + ( | |
| 4603 | + List(TextAreaOption) l | |
| 4604 | + ) = | |
| 4605 | + if l is | |
| 4606 | + { | |
| 4607 | + [] then [], | |
| 4608 | + [h . t] then if h is | |
| 4609 | + { | |
| 4610 | + input_attrs(input_attr_list) then [format_attrs(input_attr_list) . format1(t)], | |
| 4611 | + disabled then [" disabled=\"disabled\" " . format1(t)] | |
| 4612 | + read_only then [" readonly=\"readonly\" " . format1(t)] | |
| 4613 | + wrap_lines then [" wrap=\"wrap\" " . format1(t)] | |
| 4614 | + } | |
| 4615 | + }. | |
| 4616 | + | |
| 4617 | +define Printable_tree | |
| 4618 | + format | |
| 4619 | + ( | |
| 4620 | + List(TextAreaOption) l | |
| 4621 | + )= | |
| 4622 | + if member(l, wrap_lines) then | |
| 4623 | + format1(l) | |
| 4624 | + else | |
| 4625 | + [" wrap=\"off\" " . format1(l)] | |
| 4626 | +. | |
| 4627 | + | |
| 4628 | + | |
| 4629 | + *** [5.7] Formating elements which may be put anywhere. | |
| 4630 | + | |
| 4631 | + The function below involves the parameter $T which is later instantiated as | |
| 4632 | + 'HTML_In_Form' or as 'HTML_Off_Form'. Now, since there are dictinct 'format' functions | |
| 4633 | + for these two types, and because formating of tables requires recursive calls of such | |
| 4634 | + functions, it is necessary to provide the 'format' function to be called recursively as | |
| 4635 | + an argument. Putting naively a call to 'format' will not work, because the compiler | |
| 4636 | + will look for a function able to format data of type $T (which is at that time distinct | |
| 4637 | + from any other type, including our two types). Such a function does not exist. Hence | |
| 4638 | + the function to be called for formating elements must be passed as a functional | |
| 4639 | + argument (called 'format_element' below). Actually, what we pass is a function taking | |
| 4640 | + a unique argument of type $T. Other informations (like the name of the state) are | |
| 4641 | + already in the function by way of full functionality. | |
| 4642 | + | |
| 4643 | + | |
| 4644 | + Formating text options. They are formated in CSS syntax, to be used within a | |
| 4645 | + 'style=...'. | |
| 4646 | + | |
| 4647 | +define String | |
| 4648 | + format | |
| 4649 | + ( | |
| 4650 | + List(Text_Option) l | |
| 4651 | + ) = | |
| 4652 | + if l is | |
| 4653 | + { | |
| 4654 | + [ ] then "", | |
| 4655 | + [h . t] then if h is | |
| 4656 | + { | |
| 4657 | + core_attrs(core_attr_list) then format_attrs(core_attr_list), | |
| 4658 | + size(n) then "font-size:"+n+"pt", | |
| 4659 | + font(fn) then "font-family:"+fn, | |
| 4660 | + color(c) then if c is rgb(r,g,b) then | |
| 4661 | + "color:rgb("+to_decimal(r)+","+to_decimal(g)+","+to_decimal(b)+")", | |
| 4662 | + italic then "font-style:italic", | |
| 4663 | + oblique then "font-style:oblique", | |
| 4664 | + small_capitals then "font-variant:small-caps", | |
| 4665 | + bold then "font-weight:bold", | |
| 4666 | + underlined then "text-decoration:underline", | |
| 4667 | + left_justified then "text-align:left", | |
| 4668 | + right_justified then "text-align:right", | |
| 4669 | + justified then "text-align:justify", | |
| 4670 | + line_through then "text-decoration:line-through", | |
| 4671 | + nowrap then "white-space:nowrap", | |
| 4672 | + class(class_name)then " class=\"" + class_name +"\"", | |
| 4673 | + id(id_name) then " id=\"" + id_name +"\"", | |
| 4674 | + style(style_string) then " style=\"" + style_string + "\"", | |
| 4675 | + title(s) then " title=\"" + s +"\"" | |
| 4676 | + attr(n,v) then " " + n + "=\"" + v +"\"" | |
| 4677 | + } + if t is [ ] then "" else ("; "+format(t)) | |
| 4678 | + }. | |
| 4679 | + | |
| 4680 | + | |
| 4681 | + | |
| 4682 | + Formating table options. | |
| 4683 | + | |
| 4684 | +define String | |
| 4685 | + format | |
| 4686 | + ( | |
| 4687 | + List(Table_Option) l, | |
| 4688 | + Bool border_seen | |
| 4689 | + ) = | |
| 4690 | + if l is | |
| 4691 | + { | |
| 4692 | + [ ] then if border_seen then "" else " border=\"0\" cellspacing=\"0\" cellpadding=\"0\"", | |
| 4693 | + [h . t] then if h is | |
| 4694 | + { | |
| 4695 | + core_attrs(core_attr_list) then format_attrs(core_attr_list), | |
| 4696 | + background_color(c) then " bgcolor=\""+html_format(c)+"\""+format(t,border_seen), | |
| 4697 | + background_image(url) then " background="+url+format(t,border_seen), | |
| 4698 | + border(o,top,i,c) then " border=\""+o+"\" cellspacing=\""+top+"\" cellpadding=\""+i+"\""+ | |
| 4699 | + //" bordercolor="+format(c)+ | |
| 4700 | + format(t,true), | |
| 4701 | + width(w) then " width=\""+w+"\""+format(t,border_seen), | |
| 4702 | + percentage_width(p) then " width=\""+percent(p)+"%\""+format(t,border_seen), | |
| 4703 | + attr(name, value) then " " + name + "=\"" + value + "\"" +format(t,border_seen), | |
| 4704 | + class(name) then " class=\""+name+"\"" | |
| 4705 | + } | |
| 4706 | + }. | |
| 4707 | + | |
| 4708 | + | |
| 4709 | + | |
| 4710 | + | |
| 4711 | + | |
| 4712 | +define Printable_tree | |
| 4713 | + format_scroller | |
| 4714 | + ( | |
| 4715 | + Int width, | |
| 4716 | + Int height, | |
| 4717 | + Int content_width, | |
| 4718 | + Int content_height, | |
| 4719 | + Int idnum, // identifying the scroller | |
| 4720 | + $T content, | |
| 4721 | + $T -> Printable_tree format_element | |
| 4722 | + ) = | |
| 4723 | + [ | |
| 4724 | + "<script type = \"text/javascript\" language=\"JavaScript\">", | |
| 4725 | + "function doscroll_",idnum,"(dx,dy) {\n", | |
| 4726 | + " if (document.layers) { var c_",idnum," = eval(document.cs_",idnum,"); } else\n", | |
| 4727 | + " if (document.getElementById) {var c_",idnum," = eval(\"document.getElementById('cs_", | |
| 4728 | + idnum,"').style\"); } else\n", | |
| 4729 | + " if (document.all) { var c_",idnum," = eval(document.all.cs_",idnum,".style); };\n", | |
| 4730 | + " var x_",idnum," = parseInt(c_",idnum,".left);\n", | |
| 4731 | + " var y_",idnum," = parseInt(c_",idnum,".top);\n", | |
| 4732 | + " if ((x_",idnum,"+dx <= 0) && (x_",idnum,"+dx > ",width-content_width,"))\n", | |
| 4733 | + " { x_",idnum," += dx; }\n", | |
| 4734 | + " if ((y_",idnum,"+dy <= 0) && (y_",idnum,"+dy > ",height-content_height,"))\n", | |
| 4735 | + " { y_",idnum," += dy; }\n", | |
| 4736 | + " c_",idnum,".left = x_",idnum,";\n", | |
| 4737 | + " c_",idnum,".top = y_",idnum,";\n", | |
| 4738 | + " }\n", | |
| 4739 | + "</script>\n", | |
| 4740 | + "<table>", | |
| 4741 | + "<tbody>", | |
| 4742 | + "<tr>", | |
| 4743 | + "<td align=left valign=top", | |
| 4744 | + " width=",width, | |
| 4745 | + " height=",height, | |
| 4746 | + ">", | |
| 4747 | + "<div id=\"ws_",idnum,"\" style=\"position:absolute; width:",width,"px; height:",height,"px;", | |
| 4748 | + " clip:rect(0px ",width,"px ",height,"px 0px)\">", | |
| 4749 | + "<div id=\"cs_",idnum,"\" style=\"position:absolute; left:0px; top:0px\">", | |
| 4750 | + format_element(content), | |
| 4751 | + "</div>", | |
| 4752 | + "</div>", | |
| 4753 | + "</td>", | |
| 4754 | + "<td valign=bottom>", | |
| 4755 | + "<table>", | |
| 4756 | + "<tbody>", | |
| 4757 | + "<tr><td><img alt=\"sroll up\" src=\"scrollup.gif\" onmousedown=\"doscroll_", idnum,"(0,20);\"></td></tr>", | |
| 4758 | + "<tr><td><img alt=\"scroll down\" src=\"scrolldown.gif\" onmousedown=\"doscroll_", idnum,"(0,-20);\"></td></tr>", | |
| 4759 | + "</tbody>", | |
| 4760 | + "</table>", | |
| 4761 | + "</td>", | |
| 4762 | + "</tr>", | |
| 4763 | + (if content_width > width then | |
| 4764 | + [ | |
| 4765 | + "<tr>", | |
| 4766 | + "<td align=right>", | |
| 4767 | + "<table>", | |
| 4768 | + "<tbody>", | |
| 4769 | + "<tr>", | |
| 4770 | + "<td><img alt=\"scroll left\" src=\"scrollleft.gif\" onmousedown=\"doscroll_", idnum,"(20,0);\"></td>", | |
| 4771 | + "<td><img alt=\"scroll right\" src=\"scrollright.gif\" onmousedown=\"doscroll_", idnum,"(-20,0);\"></td>", | |
| 4772 | + "</tr>", | |
| 4773 | + "</tbody>", | |
| 4774 | + "</table>", | |
| 4775 | + "</td>", | |
| 4776 | + "</tr>", | |
| 4777 | + ] else [ ]), | |
| 4778 | + "</tbody>", | |
| 4779 | + "</table>" | |
| 4780 | + ]. | |
| 4781 | + | |
| 4782 | + | |
| 4783 | + | |
| 4784 | + | |
| 4785 | +define Printable_tree | |
| 4786 | + add_css_files | |
| 4787 | + ( | |
| 4788 | + List(CSS_File) l | |
| 4789 | + ) = | |
| 4790 | + if l is | |
| 4791 | + { | |
| 4792 | + [ ] then [ ], | |
| 4793 | + [h . t] then | |
| 4794 | + since h is css_file(file_name, media), | |
| 4795 | + [ ["<link rel=\"stylesheet\" type=\"text/css\" href=\"" + file_name + "\" media=\""+to_String(media)+"\"/>\n" ] | |
| 4796 | + . add_css_files(t)] | |
| 4797 | + }. | |
| 4798 | + | |
| 4799 | + | |
| 4800 | +define Printable_tree | |
| 4801 | + add_css_styles | |
| 4802 | + ( | |
| 4803 | + List(CSS_Style) css_styles | |
| 4804 | + ) = | |
| 4805 | + | |
| 4806 | + if css_styles is | |
| 4807 | + { | |
| 4808 | + [] then [], | |
| 4809 | + [_ . _] then [ "<style type=\"text/css\"><!--\n", | |
| 4810 | + format_css_styles(css_styles), | |
| 4811 | + " --></style>\n" | |
| 4812 | + ] | |
| 4813 | + }. | |
| 4814 | + | |
| 4815 | + | |
| 4816 | + // The function below formats a datum of type 'HTML_Any($T)'. | |
| 4817 | + | |
| 4818 | +define Printable_tree | |
| 4819 | + format | |
| 4820 | + ( | |
| 4821 | + CommonInfo cinfo, | |
| 4822 | + Var(Int) ic_v, | |
| 4823 | + HTML_Any($T) element, | |
| 4824 | + $T -> Printable_tree format_element, // able to format a datum of type $T | |
| 4825 | + Bool is_https, | |
| 4826 | + Var(Int) action_count, | |
| 4827 | + Var(List(HTML_Head_Tag)) head_tags | |
| 4828 | + ) = | |
| 4829 | + if cinfo is info(common_name,http_port,https_port,site_directory,secret) then | |
| 4830 | + if element is | |
| 4831 | + { | |
| 4832 | + any_text(opts , t) then | |
| 4833 | + if opts is | |
| 4834 | + { | |
| 4835 | + [] then [t], | |
| 4836 | + [_ . _] then ["<span", format_attrs(opts), ">",t,"</span>"] | |
| 4837 | + }, | |
| 4838 | + any_preformated(opts,s) then | |
| 4839 | + ["<span", format_text_options(opts), "><pre>",s,"</pre></span>"], | |
| 4840 | + //["<pre>",s,"</pre>"], | |
| 4841 | + any_paragraph(opts,l) then | |
| 4842 | + ["<p", format_text_options(opts), ">", flat(map(($T e) |-> format_element(e), l)),"</p>\n"], | |
| 4843 | + any_image(opts, url, _alt) then | |
| 4844 | + with alt = if _alt = "" then "" else "alt=\""+_alt+"\"", | |
| 4845 | + ["<img ",alt," src=\"",url,"\" ", format_attrs(opts)," />"], | |
| 4846 | + any_image(opts, url, alt, w, h) then | |
| 4847 | + ["<img alt=\"",alt,"\" src=\"",url,"\" width=\"",w,"\" height=\"",h,"\" ", format_attrs(opts)," />"], | |
| 4848 | + any_table(opts,h_row, rows, f_row) then | |
| 4849 | + ["<table",format(reverse(opts),false),">", | |
| 4850 | + format(h_row, format_element), | |
| 4851 | + "<tbody>",format(rows,format_element),"</tbody>", | |
| 4852 | + format(f_row, format_element), | |
| 4853 | + "</table>\n"], | |
| 4854 | + any_center(e) then | |
| 4855 | + ["<center>",format_element(e),"</center>"], | |
| 4856 | + any_mail_to(email,elem) then | |
| 4857 | + ["<a href=\"mailto:",email,"\">",format_element(elem),"</a>"], | |
| 4858 | + any_scroller(w,h,cw,ch,c) then | |
| 4859 | + format_scroller(w,h,cw,ch,new_idnum(ic_v),c,format_element), | |
| 4860 | + any_fixed_size(w,h,c) then | |
| 4861 | + with url = create_secondary_document(site_directory,secret,format_element,c,w), | |
| 4862 | + ["<object data=\"",url,"\" type=\"text/html\" width=\"",format(w),"\" height=\"",format(h),"\" >", | |
| 4863 | + "secondary document", | |
| 4864 | + "</object>"], | |
| 4865 | + any_fixed_size_2(w,h,fn) then | |
| 4866 | + with url = fn+"?zauth="+make_authorization(site_directory,secret, | |
| 4867 | + fn), | |
| 4868 | + ["<object data=\"",url,"\" type=\"text/html\" width=\"",format(w),"\" height=\"",format(h),"\" >", | |
| 4869 | + "secondary document", | |
| 4870 | + "</object>"], | |
| 4871 | + any_actioner(c,t,a,an,eo,ja,fn) then | |
| 4872 | + format_actioner(cinfo,c,t,a,an,eo,ja,fn,is_https, action_count, ic_v, head_tags), | |
| 4873 | + | |
| 4874 | + any_foreign_link_new(target, aspect, url) then | |
| 4875 | + format_foreign_link(target, aspect, url, is_https, cinfo, action_count, ic_v, head_tags), | |
| 4876 | + | |
| 4877 | + any_foreign_link(options,url) then | |
| 4878 | + ["<a href=\"",url,"\" ", format_text_options(options), "></a>"], // IE7 doesn't support the form <a href="..." /> | |
| 4879 | + any_foreign_link(options,url,name) then | |
| 4880 | + ["<a href=\"",url,"\"><span ", format_text_options(options), ">",name,"</span></a>"], | |
| 4881 | + any_private_download(url,name,extra_ext,action) then | |
| 4882 | + format_private_download(cinfo,url,name,extra_ext,action), | |
| 4883 | + any_div(options, l) then | |
| 4884 | + [format_div_option(options), flat(map(($T e) |-> format_element(e), l)),"</div>\n"], | |
| 4885 | + any_div_empty(options) then | |
| 4886 | + [format_div_option(options), "</div>\n"], | |
| 4887 | + any_coreattrs(attributs) then | |
| 4888 | + [format_attrs(attributs)], | |
| 4889 | + any_ol(opts, l) then | |
| 4890 | + ["<ol", format_attrs(opts), ">", flat(map(($T e) |-> format_element(e), l)),"</ol>\n"], | |
| 4891 | + any_ul(opts, l) then | |
| 4892 | + ["<ul", format_attrs(opts), ">", flat(map(($T e) |-> format_element(e), l)),"</ul>\n"], | |
| 4893 | + any_li(opts, l) then | |
| 4894 | + ["<li", format_attrs(opts), ">", flat(map(($T e) |-> format_element(e), l)),"</li>\n"], | |
| 4895 | + any_button(options, l) then | |
| 4896 | + [["<button" + format_attrs(options) + ">"], flat(map(($T e) |-> format_element(e), l)),"</button>\n"], | |
| 4897 | + any_i(opts,t) then | |
| 4898 | + if t = "" then | |
| 4899 | + ["<i", format_attrs(opts), "></i>\n"] | |
| 4900 | + else | |
| 4901 | + ["<i", format_attrs(opts), ">",t,"</i>\n"], | |
| 4902 | + any_span(opts , t) then | |
| 4903 | + ["<span", format_attrs(opts), ">",t,"</span>"] | |
| 4904 | + any_hr(opts) then | |
| 4905 | + ["<hr", format_attrs(opts),">"] | |
| 4906 | + } | |
| 4907 | +. | |
| 4908 | + | |
| 4909 | + | |
| 4910 | + | |
| 4911 | + // *** [5.8] Formating 'in form' elements. | |
| 4912 | + | |
| 4913 | + | |
| 4914 | +//public define Printable_tree | |
| 4915 | +// format | |
| 4916 | +// ( | |
| 4917 | +// HTML_tooltip tooltip | |
| 4918 | +// )= | |
| 4919 | +// if tooltip is | |
| 4920 | +// { | |
| 4921 | +// html_tooltip(title, keyword, width) then | |
| 4922 | +// ["<a id=\"help_",keyword,"\" class=\"jTipu jTip_help\" name=\"",title,"\" href=\"/?a=ajax_show_tooltip&tooltip_id=",keyword,(if width > 0 then ["&width=",width,"\""] else ["\""]), "></a>"], | |
| 4923 | +// | |
| 4924 | +// html_tooltip_ext(title, extend_type, class_suffix, ext_args) then | |
| 4925 | +// with extra_args = format_extra_operands(ext_args), | |
| 4926 | +// ["<a id=\"jTip\" class=\"jTipu jTip_",class_suffix,"\" name=\"",title,"\" href=\"/?a=ajax_show_tooltip&tooltip_ext=",extend_type+extra_args,"\"></a>"] | |
| 4927 | +// }. | |
| 4928 | + | |
| 4929 | +public define List(CoreAttrs) | |
| 4930 | + extract_attributes | |
| 4931 | + ( | |
| 4932 | + HTML_tooltip tooltip | |
| 4933 | + )= | |
| 4934 | + if tooltip is | |
| 4935 | + { | |
| 4936 | + html_tooltip(title, keyword, width) then //TODO | |
| 4937 | + [] | |
| 4938 | + //["<a id=\"help_",keyword,"\" class=\"jTipu \" name=\"",title,"\" href=\"/?a=ajax_show_tooltip&tooltip_id=",keyword,(if width > 0 then ["&width=",width,"\""] else ["\""]), "><i class=\"fa fa-info\" aria-hidden=\"true\" style=\"color:#2e6da4\"></i></a>"], | |
| 4939 | + | |
| 4940 | + html_tooltip_ext(title, extend_type, class_suffix, ext_args) then //TODO | |
| 4941 | + //[] | |
| 4942 | + with extra_args = format_extra_operands(ext_args), | |
| 4943 | + [id("jTip"), class("jTipu jTip_"+class_suffix), data("name",title), data("href", "/?a=ajax_show_tooltip&tooltip_ext="+extend_type+extra_args)] | |
| 4944 | + | |
| 4945 | + html_tooltip_ext(title, extend_type, ext_args) then //TODO | |
| 4946 | + with extra_args = format_extra_operands(ext_args), | |
| 4947 | + [id("jTip"), class("jTipu"), data("name",title), data("href", "/?a=ajax_show_tooltip&tooltip_ext="+extend_type+extra_args)] | |
| 4948 | +// [] | |
| 4949 | + //with extra_args = format_extra_operands(ext_args), | |
| 4950 | + //["<a id=\"jTip\" class=\"jTipu \" name=\"",title,"\" href=\"/?a=ajax_show_tooltip&tooltip_ext=",extend_type+extra_args,"\"><i class=\"fa fa-info\" aria-hidden=\"true\" style=\"color:#2e6da4\"></i></a>"], | |
| 4951 | + | |
| 4952 | + html_tooltip(title, web_action, extra_args) then | |
| 4953 | + [ id("jTip"), class("jTipu"), data("name", title), data("href", "/"+format_web_action_name(web_action, extra_args)) | |
| 4954 | + ] | |
| 4955 | + | |
| 4956 | + //["<a id=\"jTip\" class=\"jTipu \" name=\"",title,"\" href=\"/", format_web_action_name(web_action, extra_args) ,"\"><i class=\"fa fa-info\" aria-hidden=\"true\" style=\"color:#2e6da4\"></i></a>"], | |
| 4957 | + | |
| 4958 | + } | |
| 4959 | +. | |
| 4960 | + | |
| 4961 | + literal_pt(["<span id=\"jTip\" class=\"jTipu\" data-name=\"",title,"\" data-href=\"/", format_web_action_name(web_action, extra_args) ,"\">"]), | |
| 4962 | + | |
| 4963 | + | |
| 4964 | +public define Printable_tree | |
| 4965 | + format | |
| 4966 | + ( | |
| 4967 | + HTML_tooltip tooltip | |
| 4968 | + )= | |
| 4969 | + if tooltip is | |
| 4970 | + { | |
| 4971 | + html_tooltip(title, keyword, width) then | |
| 4972 | + ["<a id=\"help_",keyword,"\" class=\"jTipu \" data-name=\"",title,"\" data-href=\"/?a=ajax_show_tooltip&tooltip_id=",keyword,(if width > 0 then ["&width=",width,"\""] else ["\""]), "><i class=\"fa fa-info\" aria-hidden=\"true\" style=\"color:#2e6da4\"></i></a>"], | |
| 4973 | + | |
| 4974 | + html_tooltip_ext(title, extend_type, class_suffix, ext_args) then | |
| 4975 | + with extra_args = format_extra_operands(ext_args), | |
| 4976 | + ["<a id=\"jTip\" class=\"jTipu jTip_",class_suffix,"\" data-name=\"",title,"\" data-href=\"/?a=ajax_show_tooltip&tooltip_ext=",extend_type+extra_args,"\"></a>"] | |
| 4977 | + | |
| 4978 | + html_tooltip_ext(title, extend_type, ext_args) then | |
| 4979 | + with extra_args = format_extra_operands(ext_args), | |
| 4980 | + ["<a id=\"jTip\" class=\"jTipu \" data-name=\"",title,"\" data-href=\"/?a=ajax_show_tooltip&tooltip_ext=",extend_type+extra_args,"\"><i class=\"fa fa-info\" aria-hidden=\"true\" style=\"color:#2e6da4\"></i></a>"], | |
| 4981 | + html_tooltip(title, web_action, extra_args) then | |
| 4982 | + ["<a id=\"jTip\" class=\"jTipu \" data-name=\"",title,"\" data-href=\"/", format_web_action_name(web_action, extra_args) ,"\"><i class=\"fa fa-info\" aria-hidden=\"true\" style=\"color:#2e6da4\"></i></a>"], | |
| 4983 | + | |
| 4984 | + } | |
| 4985 | +. | |
| 4986 | + | |
| 4987 | +public define HTML_Off_Form | |
| 4988 | + html_tooltip | |
| 4989 | + ( | |
| 4990 | + String title, | |
| 4991 | + WEB_Action_Name web_action, | |
| 4992 | + List((String,String)) extra_args, | |
| 4993 | + HTML_Off_Form html_element, | |
| 4994 | + )= | |
| 4995 | + span([id("jTip"), class("jTipu"), data("name", title), data("href", "/"+format_web_action_name(web_action, extra_args))], html_element) | |
| 4996 | +. | |
| 4997 | + | |
| 4998 | +public define HTML_Off_Form | |
| 4999 | + html_tooltip | |
| 5000 | + ( | |
| 5001 | + String title, | |
| 5002 | + String keyword, | |
| 5003 | + ) = | |
| 5004 | + literal_pt(format(html_tooltip(title, keyword, 0))). | |
| 5005 | + | |
| 5006 | +public define HTML_In_Form | |
| 5007 | + html_tooltip | |
| 5008 | + ( | |
| 5009 | + String title, | |
| 5010 | + String keyword, | |
| 5011 | + ) = | |
| 5012 | + literal_pt(format(html_tooltip(title, keyword, 0))). | |
| 5013 | + | |
| 5014 | +public define HTML_Off_Form | |
| 5015 | + html_tooltip | |
| 5016 | + ( | |
| 5017 | + String keyword, | |
| 5018 | + Int size, | |
| 5019 | + ) = | |
| 5020 | + literal_pt(format(html_tooltip("", keyword, size))). | |
| 5021 | + | |
| 5022 | +public define HTML_In_Form | |
| 5023 | + html_tooltip | |
| 5024 | + ( | |
| 5025 | + String keyword, | |
| 5026 | + Int size, | |
| 5027 | + ) = | |
| 5028 | + literal_pt(format(html_tooltip("", keyword, size))). | |
| 5029 | + | |
| 5030 | +public define Printable_tree | |
| 5031 | + format_help | |
| 5032 | + ( | |
| 5033 | + Printable_tree label, | |
| 5034 | + HTML_Help _help | |
| 5035 | + ) = | |
| 5036 | + if _help is | |
| 5037 | + { | |
| 5038 | + no_help then label, | |
| 5039 | + tooltip(html_tooltip, position) then | |
| 5040 | + if position is | |
| 5041 | + { | |
| 5042 | + left then pt_pt(format(html_tooltip),label), | |
| 5043 | + right then pt_pt(label, format(html_tooltip)) | |
| 5044 | + } | |
| 5045 | + }. | |
| 5046 | + | |
| 5047 | + | |
| 5048 | + | |
| 5049 | +public define HTML_Label | |
| 5050 | + label | |
| 5051 | + ( | |
| 5052 | + String text | |
| 5053 | + )= | |
| 5054 | + label(text, no_help). | |
| 5055 | + | |
| 5056 | + | |
| 5057 | + | |
| 5058 | + | |
| 5059 | +define Printable_tree | |
| 5060 | + format | |
| 5061 | + ( | |
| 5062 | + CommonInfo cinfo, | |
| 5063 | + String fn, // form_name | |
| 5064 | + Var(Int) ic_v, // idnum counter variable | |
| 5065 | + HTML_In_Form element, | |
| 5066 | + Bool is_https, | |
| 5067 | + Var(Int) action_count, | |
| 5068 | + Var(List(HTML_Head_Tag)) head_tags | |
| 5069 | + ) = | |
| 5070 | + if cinfo is info(common_name,http_port,https_port,site_directory,secret) then | |
| 5071 | + with format_element = (HTML_In_Form e) |-> format(cinfo, fn, ic_v, e, is_https, action_count, head_tags), | |
| 5072 | + if element is | |
| 5073 | + { | |
| 5074 | + empty then [], | |
| 5075 | + literal_pt(t) then t, | |
| 5076 | + literal(t) then [t], | |
| 5077 | + sequence(l) then flat(map(format_element,l)) | |
| 5078 | + text(opts,t) then | |
| 5079 | + format(cinfo,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags), | |
| 5080 | + preformated(o,s) then | |
| 5081 | + format(cinfo,ic_v,any_preformated(o,s),format_element,is_https, action_count, head_tags), | |
| 5082 | + paragraph(opts,t) then | |
| 5083 | + format(cinfo,ic_v,any_paragraph(opts,t),format_element,is_https, action_count, head_tags), | |
| 5084 | + image(opts, url, alt) then | |
| 5085 | + format(cinfo,ic_v,any_image(opts, url, alt),format_element,is_https, action_count, head_tags), | |
| 5086 | + image(opts, url, alt, w, h) then | |
| 5087 | + format(cinfo,ic_v,any_image(opts, url, alt, w, h),format_element,is_https, action_count, head_tags), | |
| 5088 | + table(opts,header_row,rows,footer_row) then | |
| 5089 | + format(cinfo,ic_v,any_table(opts, header_row, rows, footer_row),format_element,is_https, action_count, head_tags), | |
| 5090 | + center(e) then | |
| 5091 | + format(cinfo,ic_v,any_center(e),format_element,is_https, action_count, head_tags), | |
| 5092 | + mail_to(a,e) then | |
| 5093 | + format(cinfo,ic_v,any_mail_to(a,e),format_element,is_https, action_count, head_tags), | |
| 5094 | + scroller(w,h,cw,ch,c) then | |
| 5095 | + format(cinfo,ic_v,any_scroller(w,h,cw,ch,c),format_element,is_https, action_count, head_tags), | |
| 5096 | + actioner(c,t,a,an,eo,ja) then | |
| 5097 | + format(cinfo,ic_v,any_actioner(c,t,a,an,eo,ja,success(fn)),format_element,is_https, action_count, head_tags), | |
| 5098 | + | |
| 5099 | + foreign_link_new(target, aspect, url) then | |
| 5100 | + format(cinfo,ic_v,any_foreign_link_new(target,aspect,url),format_element,is_https, action_count, head_tags), | |
| 5101 | + | |
| 5102 | + foreign_link(options,url) then | |
| 5103 | + format(cinfo,ic_v,any_foreign_link(options,url),format_element,is_https, action_count, head_tags), | |
| 5104 | + foreign_link(options,url,name) then | |
| 5105 | + format(cinfo,ic_v,any_foreign_link(options,url,name),format_element,is_https, action_count, head_tags), | |
| 5106 | + private_download(url,name,extra,action) then | |
| 5107 | + format(cinfo,ic_v,any_private_download(url,name,extra,action),format_element,is_https, action_count, head_tags), | |
| 5108 | + text_input(options, label_text, id, name, init, w) then | |
| 5109 | + [ format_label(label_text, id), | |
| 5110 | + "<input type=\"text\" name=\"",name,"\" id=\"",id,"\" size=\"",w,"\" value=\"",encode_HTML_entities(init.value),"\"",format_attrs([class("in") . options])," />"], | |
| 5111 | + text_input_ro(options, label_text, id, name, init, w) then | |
| 5112 | + [ format_label(label_text, id), | |
| 5113 | + "<input readonly=\"readonly\" type=\"text\" name=\"",name,"\" id=\"",id,"\" size=\"",w,"\" value=\"",encode_HTML_entities(init.value),"\"",format_attrs([class("in") . options])," />"], | |
| 5114 | + password_input(options, label_text, id, name, init, w) then | |
| 5115 | + [ format_label(label_text, id), | |
| 5116 | + "<input type=\"password\" name=\"",name,"\" id=\"",id,"\" size=\"",w,"\" value=\"",encode_HTML_entities(init.value),"\"",format_attrs([class("in") . options])," />"], | |
| 5117 | + text_area(options,label_text, id, n, init, w, h) then | |
| 5118 | + [ format_label(label_text, id), "<textarea ",format(options)," id=\"",id,"\" name=\"",n,"\" cols=\"",w,"\" rows=\"",h,"\">",encode_HTML_entities(init.value),"</textarea>"], | |
| 5119 | + file_upload(options, label, id, n, w) then | |
| 5120 | + [ format_label(label, id), | |
| 5121 | + "<input type=\"file\" id=\"",id,"\" size=\"",w,"\" name=\"",n,"\"",format_attrs([class("in") . options])," />"], | |
| 5122 | + selector(options, label, id, n,s,cs) then | |
| 5123 | + [ format_label(label, id), | |
| 5124 | + "<select id=\"",id,"\" name=\"",n,"\" size=\"",s,"\" ",format_attrs([class("in") . options]),">",format_choices(cs),"</select>"], | |
| 5125 | + selector(options, label, id, n,s,cs,sd) then | |
| 5126 | + [ format_label(label, id), | |
| 5127 | + "<select id=\"",id,"\" name=\"",n,"\" size=\"",s,"\" ",format_attrs([class("in") . options]),">",format_choices(cs,sd),"</select>"], | |
| 5128 | + selector_c(options, label, id, n,s,cs) then | |
| 5129 | + [ format_label(label, id), | |
| 5130 | + "<select id=\"",id,"\" name=\"",n,"\" size=\"",s,"\" ",format_attrs([class("in") . options]),">",format_choices(cs),"</select>"], | |
| 5131 | + selector_c(options, label, id, n,s,cs,sd) then | |
| 5132 | + [ format_label(label, id), | |
| 5133 | + "<select id=\"",id,"\" name=\"",n,"\" size=\"",s,"\" ",format_attrs([class("in") . options]),">",format_choices(cs,sd),"</select>"], | |
| 5134 | + | |
| 5135 | + radio_button(options, label, id, n, value, c) then | |
| 5136 | + [ format_label(label, id), | |
| 5137 | + "<input type=\"radio\" name=\"",n,"\" id=\"",id,"\" value=\"",value,"\"",(if c then " checked=\"checked\"" else ""),format_attrs([class("in") . options])," />"], | |
| 5138 | + radio_button_r(options, label, id, n, value, c) then | |
| 5139 | + [ "<input type=\"radio\" name=\"",n,"\" id=\"",id,"\" value=\"",value,"\"",(if c then " checked=\"checked\"" else ""),format_attrs([class("in") . options])," />", | |
| 5140 | + format_label(label, id)], | |
| 5141 | + check_box(options, label, id, n, c) then | |
| 5142 | + [ format_label(label, id), | |
| 5143 | + "<input type=\"hidden\" name=\"~",n,"\" value=\"~true\" /><input type=\"checkbox\" name=\"",n,"\" id=\"",id,"\" value=\"true\"",(if c then " checked=\"checked\" " else ""),format_attrs([class("in") . options])," />"] | |
| 5144 | + check_box_r(options, label, id, n, c) then | |
| 5145 | + [ "<input type=\"hidden\" name=\"~",n,"\" value=\"~true\" /><input type=\"checkbox\" name=\"",n,"\" id=\"",id,"\" value=\"true\"",(if c then " checked=\"checked\" " else ""),format_attrs([class("in") . options])," />", | |
| 5146 | + format_label(label, id)] | |
| 5147 | + div(options, e) then | |
| 5148 | + format(cinfo,ic_v,any_div(options, e),format_element,is_https, action_count, head_tags), | |
| 5149 | + div_empty(options) then | |
| 5150 | + format(cinfo,ic_v,any_div_empty(options),format_element,is_https, action_count, head_tags), | |
| 5151 | + hidden(_id, name, init) then | |
| 5152 | + since _id is html_Id(id), | |
| 5153 | + ["<input type=\"hidden\"",(if id = "" then "" else " id=\""+id+"\"")," name=\"",name,"\" value=\"",encode_HTML_entities(init.value),"\" />"], | |
| 5154 | + partial(p_content) then | |
| 5155 | + if p_content is partial_content(tags, html_elements) then | |
| 5156 | + head_tags <- *head_tags + tags; | |
| 5157 | + | |
| 5158 | + format(cinfo, ic_v, html_elements, is_https, action_count, head_tags), | |
| 5159 | + br then ["<br>"], | |
| 5160 | + progress(options, value, max) then ["<progress max=\"",value,"\" value=\"",max,"\"",format_attrs(options),"></progress>"], | |
| 5161 | + ol(opts, t) then | |
| 5162 | + format(cinfo,ic_v,any_ol(opts,t),format_element,is_https, action_count, head_tags), | |
| 5163 | + ul(opts, t) then | |
| 5164 | + format(cinfo,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags), | |
| 5165 | + li(opts, t) then | |
| 5166 | + format(cinfo,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags), | |
| 5167 | + button(options, e) then | |
| 5168 | + format(cinfo,ic_v,any_button(options, e),format_element,is_https, action_count, head_tags), | |
| 5169 | + i(opts, t) then | |
| 5170 | + format(cinfo,ic_v,any_i(opts,t),format_element,is_https, action_count, head_tags), | |
| 5171 | + span(opts,t) then | |
| 5172 | + format(cinfo,ic_v,any_span(opts,t),format_element,is_https, action_count, head_tags) | |
| 5173 | + hr(opts) then | |
| 5174 | + format(cinfo,ic_v,any_hr(opts),format_element,is_https, action_count, head_tags) | |
| 5175 | + }. | |
| 5176 | + | |
| 5177 | + | |
| 5178 | + | |
| 5179 | + | |
| 5180 | + | |
| 5181 | + | |
| 5182 | + *** [5.9] Formating 'off form' elements. | |
| 5183 | + | |
| 5184 | + The encryption type 'multipart/form-data' is required for a form containing an upload. | |
| 5185 | + | |
| 5186 | + | |
| 5187 | +define Bool | |
| 5188 | + contains_an_upload | |
| 5189 | + ( | |
| 5190 | + HTML_In_Form form_content | |
| 5191 | + ). | |
| 5192 | + | |
| 5193 | +define Bool | |
| 5194 | + contains_an_upload | |
| 5195 | + ( | |
| 5196 | + HTML_Row(HTML_In_Form) row | |
| 5197 | + ) = | |
| 5198 | + if row is | |
| 5199 | + { | |
| 5200 | + empty then false, | |
| 5201 | + row(_, cells) then | |
| 5202 | + mapor(contains_an_upload, | |
| 5203 | + map(content, cells)) | |
| 5204 | + } | |
| 5205 | +. | |
| 5206 | + | |
| 5207 | +define Bool | |
| 5208 | + contains_an_upload | |
| 5209 | + ( | |
| 5210 | + HTML_Footer_Row(HTML_In_Form) row | |
| 5211 | + )= | |
| 5212 | + if row is | |
| 5213 | + { | |
| 5214 | + empty then false, | |
| 5215 | + footer_row(_, cells) then | |
| 5216 | + mapor(contains_an_upload, | |
| 5217 | + map(content,cells)) | |
| 5218 | + }. | |
| 5219 | + | |
| 5220 | +define Bool | |
| 5221 | + contains_an_upload | |
| 5222 | + ( | |
| 5223 | + HTML_In_Form form_content | |
| 5224 | + ) = | |
| 5225 | + if form_content is | |
| 5226 | + { | |
| 5227 | + empty then false, | |
| 5228 | + literal_pt(t) then false, | |
| 5229 | + literal(t) then false, | |
| 5230 | + sequence(l) then mapor(contains_an_upload,l), | |
| 5231 | + text(o,t) then false, | |
| 5232 | + preformated(o,s) then false, | |
| 5233 | + paragraph(o,l) then mapor(contains_an_upload,l), | |
| 5234 | + image(o,u,a) then false, | |
| 5235 | + image(o,u,a,w,h) then false, | |
| 5236 | + table(o,_,rows,f_row) then if mapor(contains_an_upload,rows) then true | |
| 5237 | + else contains_an_upload(f_row), | |
| 5238 | + center(e) then contains_an_upload(e), | |
| 5239 | + mail_to(m,e) then false, // 'e' may but should not contain an upload | |
| 5240 | + scroller(w,h,cw,ch,e) then contains_an_upload(e), | |
| 5241 | + actioner(c,t,a,an,eo,ja) then false, | |
| 5242 | + foreign_link_new(_,_,_) then false, | |
| 5243 | + foreign_link(o,u) then false, | |
| 5244 | + foreign_link(o,u,n) then false, | |
| 5245 | + private_download(p,n,e,a) then false, | |
| 5246 | + text_input(o,lt,l,n,i,w) then false, | |
| 5247 | + text_input_ro(o,lt,l,n,i,w) then false, | |
| 5248 | + password_input(o,lt,l,n,i,w) then false, | |
| 5249 | + text_area(o,lt,id,n,i,w,h) then false, | |
| 5250 | + file_upload(o,l,i,n,w) then true, | |
| 5251 | + selector(o,l,i,n,s,c) then false, | |
| 5252 | + selector(o,l,i,n,s,c,p) then false, | |
| 5253 | + selector_c(o,l,i,n,s,c) then false, | |
| 5254 | + selector_c(o,l,i,n,s,c,p) then false, | |
| 5255 | + radio_button(o,_,_,n,v,c) then false, | |
| 5256 | + radio_button_r(o,_,_,n,v,c) then false, | |
| 5257 | + check_box(o,_,_,n,c) then false, | |
| 5258 | + check_box_r(o,_,_,n,c) then false, | |
| 5259 | + div(o,l) then mapor(contains_an_upload,l), //contains_an_upload(c), | |
| 5260 | + div_empty(o) then false, | |
| 5261 | + hidden(_,_,_) then false, | |
| 5262 | + partial(_) then false, | |
| 5263 | + br then false, | |
| 5264 | + progress(_,_,_) then false, | |
| 5265 | + ol(_,l) then mapor(contains_an_upload,l), | |
| 5266 | + ul(_,l) then mapor(contains_an_upload,l), | |
| 5267 | + li(_,l) then mapor(contains_an_upload,l), | |
| 5268 | + button(_,_) then false, | |
| 5269 | + i(_,_) then false, | |
| 5270 | + span(_,_) then false, | |
| 5271 | + hr(_) then false | |
| 5272 | + } | |
| 5273 | +. | |
| 5274 | + | |
| 5275 | +define String | |
| 5276 | + enctype | |
| 5277 | + ( | |
| 5278 | + List(HTML_In_Form) form_contents | |
| 5279 | + )= | |
| 5280 | + if mapor(contains_an_upload, form_contents) then | |
| 5281 | + " enctype=\"multipart/form-data\"" | |
| 5282 | + else | |
| 5283 | + "" | |
| 5284 | +. | |
| 5285 | + | |
| 5286 | +define Printable_tree | |
| 5287 | + format_href | |
| 5288 | + ( | |
| 5289 | + A_href _href | |
| 5290 | + )= | |
| 5291 | + if _href is | |
| 5292 | + { | |
| 5293 | + href(str) then if str = "" then [] else [" href=\"", str, "\""], | |
| 5294 | + href(action, extra) then [" href=\"",format_web_action_name(action, extra), "\""] | |
| 5295 | + } | |
| 5296 | +. | |
| 5297 | + | |
| 5298 | +define Printable_tree | |
| 5299 | + format_target | |
| 5300 | + ( | |
| 5301 | + A_target _target | |
| 5302 | + )= | |
| 5303 | + [" target=\"", | |
| 5304 | + if _target is | |
| 5305 | + { | |
| 5306 | + _blank then "_blank", | |
| 5307 | + _self then "_self", | |
| 5308 | + _parent then "_parent", | |
| 5309 | + _top then "_top", | |
| 5310 | + framename(name) then name | |
| 5311 | + }, | |
| 5312 | + "\""] | |
| 5313 | +. | |
| 5314 | + | |
| 5315 | +define Printable_tree | |
| 5316 | + format | |
| 5317 | + ( | |
| 5318 | + CommonInfo cinfo, | |
| 5319 | + Var(Int) ic_v, // 'idnum' counter variable | |
| 5320 | + List(HTML_Off_Form) elements, | |
| 5321 | + Bool is_https, | |
| 5322 | + Var(Int) action_count, | |
| 5323 | + Var(List(HTML_Head_Tag)) head_tags | |
| 5324 | + ). | |
| 5325 | + | |
| 5326 | +define Printable_tree | |
| 5327 | + format | |
| 5328 | + ( | |
| 5329 | + CommonInfo cinfo, | |
| 5330 | + Var(Int) ic_v, // 'idnum' counter variable | |
| 5331 | + HTML_Off_Form element, | |
| 5332 | + Bool is_https, | |
| 5333 | + Var(Int) action_count, | |
| 5334 | + Var(List(HTML_Head_Tag)) head_tags | |
| 5335 | + ) = | |
| 5336 | + if cinfo is info(common_name,http_port,https_port,site_directory,secret) then | |
| 5337 | + with format_element = (HTML_Off_Form e) |-> format(cinfo, ic_v, e, is_https, action_count, head_tags), | |
| 5338 | + if element is | |
| 5339 | + { | |
| 5340 | + a(opts, _href, _target, l) then ["<a ", format_attrs(opts), format_href(_href), format_target(_target), ">",flat(map(format_element,l)),"</a>\n"], | |
| 5341 | + empty then [], | |
| 5342 | + literal_pt(t) then t, | |
| 5343 | + literal(t) then [t], | |
| 5344 | + sequence(l) then flat(map(format_element,l)), | |
| 5345 | + text(opts,t) then | |
| 5346 | + format(cinfo,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags), | |
| 5347 | +// table(opts,header_row, rows, footer_row) then | |
| 5348 | +// format(cinfo,ic_v,any_table(opts,header_row, rows, footer_row),format_element,is_https, action_count, head_tags), | |
| 5349 | + actioner(c,t,a,an,eo,ja) then | |
| 5350 | + format(cinfo,ic_v,any_actioner(c,t,a,an,eo,ja,failure),format_element,is_https, action_count, head_tags), | |
| 5351 | + actioner(c,t,a,an,eo,ja,fn) then | |
| 5352 | + format(cinfo,ic_v,any_actioner(c,t,a,an,eo,ja,success(fn)),format_element,is_https, action_count, head_tags), | |
| 5353 | + foreign_link_new(target, aspect, url) then | |
| 5354 | + format(cinfo,ic_v,any_foreign_link_new(target,aspect,url),format_element,is_https, action_count, head_tags), | |
| 5355 | +// foreign_link(options,url) then | |
| 5356 | +// format(cinfo,ic_v,any_foreign_link(options,url),format_element,is_https, action_count, head_tags), | |
| 5357 | + foreign_link(options,url,name) then | |
| 5358 | + format(cinfo,ic_v,any_foreign_link(options,url,name),format_element,is_https, action_count, head_tags), | |
| 5359 | + private_download(url,name,extra,action) then | |
| 5360 | + format(cinfo,ic_v,any_private_download(url,name,extra,action),format_element,is_https, action_count, head_tags), | |
| 5361 | +// form(fn, attributs, l) then | |
| 5362 | +// [ | |
| 5363 | +// "<form id=\"",fn,"\"", | |
| 5364 | +// format(cinfo,ic_v,any_coreattrs(attributs),format_element,is_https, action_count, head_tags), | |
| 5365 | +// " method=\"post\"", | |
| 5366 | +// enctype(l), | |
| 5367 | +// " action=\"http",( | |
| 5368 | +// if is_https then "s" else "", | |
| 5369 | +// "://",common_name,":",to_decimal(http_port),"/\">", | |
| 5370 | +// // action is set dynamically by | |
| 5371 | +// // the actioner using JavaScript | |
| 5372 | +// if fn is html_Id(id) then | |
| 5373 | +// flat(map((HTML_In_Form e) |-> format(cinfo,id,ic_v,e,is_https, action_count, head_tags), l)), | |
| 5374 | +// "</form>" | |
| 5375 | +// ] | |
| 5376 | +// form(fn,attributs, action, extra_ops, l) then | |
| 5377 | +// with url = make_actioner_url(cinfo, same, same, | |
| 5378 | +// action, extra_ops, is_https), | |
| 5379 | +// [ | |
| 5380 | +// "<form id=\"",fn,"\"", | |
| 5381 | +// format(cinfo,ic_v, any_coreattrs(attributs),format_element,is_https, action_count, head_tags), | |
| 5382 | +// " method=\"post\"", | |
| 5383 | +// enctype(l), | |
| 5384 | +// " action=\"" + url + "\">", | |
| 5385 | +//// " action=\"http", | |
| 5386 | +//// if is_https then "s" else "", | |
| 5387 | +//// "://",common_name,":",http_port,"/\">", | |
| 5388 | +// // action is set dynamically by | |
| 5389 | +// // the actioner using JavaScript | |
| 5390 | +// if fn is html_Id(id) then | |
| 5391 | +// flat(map((HTML_In_Form e) |-> format(cinfo,id,ic_v,e,is_https, action_count, head_tags),l)), | |
| 5392 | +// "</form>" | |
| 5393 | +// ], | |
| 5394 | +// in_form(fn, content) then | |
| 5395 | +// if fn is html_Id(id) then | |
| 5396 | +// format(cinfo,id,ic_v, content,is_https, action_count, head_tags), | |
| 5397 | + div(options, p_content) then | |
| 5398 | + with html_elements = map((HTML_Partial_Content pc) |-> since pc is partial_content(tags, html_elem), head_tags <- *head_tags +tags; html_elem, p_content), | |
| 5399 | + | |
| 5400 | + format(cinfo, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags), | |
| 5401 | + iframe(options, css_styles, css_files, js_files, body) then | |
| 5402 | + println("formating iframe"); | |
| 5403 | + if body is body(body_options,elem) then | |
| 5404 | + [ "<iframe", format_attrs(options), " srcdoc=\"\n", | |
| 5405 | + | |
| 5406 | + encode_HTML_quote(to_String([ | |
| 5407 | + "<html style=\"margin: 0pt; padding: 0pt;\">\n", | |
| 5408 | + "<head>\n", | |
| 5409 | + add_css_styles(css_styles), | |
| 5410 | + add_css_files(css_files), | |
| 5411 | + add_js_files(js_files), | |
| 5412 | + "</head>\n", | |
| 5413 | + "<body ", format_attrs(body_options), ">\n", // format body options | |
| 5414 | + format(cinfo,ic_v, elem ,is_https, action_count, head_tags), | |
| 5415 | + "</body>\n", | |
| 5416 | + "</html>\n",])), | |
| 5417 | + | |
| 5418 | + "\"></iframe>\n", | |
| 5419 | + ], | |
| 5420 | + partial(p_content) then | |
| 5421 | + if p_content is partial_content(tags, html_elements) then | |
| 5422 | + head_tags <- *head_tags + tags; | |
| 5423 | + format(cinfo, ic_v, html_elements, is_https, action_count, head_tags), | |
| 5424 | +// i(opts, t) then | |
| 5425 | +// format(cinfo,ic_v,any_i(opts,t),format_element,is_https, action_count, head_tags), | |
| 5426 | + html_tag(tag_name, opts, l) then ["<",tag_name, format_attrs(opts), ">", flat(map(format_element,l)), "</",tag_name,">\n"], | |
| 5427 | + html_void_tag(tag_name, opts) then ["<",tag_name, format_attrs(opts), ">"], | |
| 5428 | + }. | |
| 5429 | + | |
| 5430 | +define Printable_tree | |
| 5431 | + format | |
| 5432 | + ( | |
| 5433 | + CommonInfo cinfo, | |
| 5434 | + Var(Int) ic_v, // 'idnum' counter variable | |
| 5435 | + List(HTML_Off_Form) elements, | |
| 5436 | + Bool is_https, | |
| 5437 | + Var(Int) action_count, | |
| 5438 | + Var(List(HTML_Head_Tag)) head_tags | |
| 5439 | + ) = | |
| 5440 | + if cinfo is info(common_name,http_port,https_port,site_directory,secret) then | |
| 5441 | + flat(map((HTML_Off_Form element) |-> | |
| 5442 | + format(cinfo, ic_v, element, is_https, action_count, head_tags), | |
| 5443 | + elements)) | |
| 5444 | +. | |
| 5445 | + | |
| 5446 | + *** [5.10] Formating meta-tags. | |
| 5447 | + | |
| 5448 | +define Printable_tree | |
| 5449 | + format_keywords | |
| 5450 | + ( | |
| 5451 | + List(String) l | |
| 5452 | + ) = | |
| 5453 | + if l is | |
| 5454 | + { | |
| 5455 | + [] then [ ], | |
| 5456 | + [h . t] then if t is [] | |
| 5457 | + then [h] | |
| 5458 | + else [h , ", " . format_keywords(t)] | |
| 5459 | + }. | |
| 5460 | + | |
| 5461 | + | |
| 5462 | +define Printable_tree | |
| 5463 | + format | |
| 5464 | + ( | |
| 5465 | + CommonInfo cinfo, | |
| 5466 | + HTML_Meta m, | |
| 5467 | + Bool is_https | |
| 5468 | + ) = | |
| 5469 | + if m is | |
| 5470 | + { | |
| 5471 | + keywords(l) then ["<meta name=\"keywords\" content=\"",format_keywords(l),"\" />\n"], | |
| 5472 | + refresh(co,ta,an,delay) then | |
| 5473 | + ["<meta http-equiv=\"Refresh\" content=\"",delay,"; URL=", | |
| 5474 | + make_actioner_url(cinfo,co,ta,an,[],is_https),"\" />\n"], | |
| 5475 | + refresh(url,delay) then | |
| 5476 | + ["<meta http-equiv=\"Refresh\" content=\"",delay,"; URL=",url,"\" />\n"], | |
| 5477 | + meta(n,c) then ["<meta name=\"",n,"\" content=\"",c,"\" />\n"], | |
| 5478 | + http_equiv(n,c) then ["<meta http-equiv=\"",n,"\" content=\"",c,"\" />\n"], | |
| 5479 | + generic_meta(l) then ["<meta ", | |
| 5480 | + flat(map(((String,String) p) |-> if p is (n,v) then [n,"=\"",v,"\" "], | |
| 5481 | + l)), | |
| 5482 | + " />\n"], | |
| 5483 | + literal(s) then [s] | |
| 5484 | + } | |
| 5485 | +. | |
| 5486 | + | |
| 5487 | +define Printable_tree // c'est le nôtre et c'est meilleur | |
| 5488 | + format | |
| 5489 | + ( | |
| 5490 | + HTML_Meta m, | |
| 5491 | + ) = | |
| 5492 | + if m is | |
| 5493 | + { | |
| 5494 | + keywords(l) then ["<meta name=\"keywords\" content=\"",format_keywords(l),"\" />\n"], | |
| 5495 | + refresh(co,ta,an,delay) then | |
| 5496 | + ["<!-- TODO refresh(co,ta,an,delay) --> "], // TODO | |
| 5497 | + refresh(url,delay) then | |
| 5498 | + ["<meta http-equiv=\"Refresh\" content=\"",delay,"; URL=",url,"\" />\n"], | |
| 5499 | + meta(n,c) then ["<meta name=\"",n,"\" content=\"",c,"\" />\n"], | |
| 5500 | + http_equiv(n,c) then ["<meta http-equiv=\"",n,"\" content=\"",c,"\" />\n"], | |
| 5501 | + generic_meta(l) then ["<meta ", | |
| 5502 | + flat(map(((String,String) p) |-> if p is (n,v) then [n,"=\"",v,"\" "], | |
| 5503 | + l)), | |
| 5504 | + " />\n"], | |
| 5505 | + literal(s) then [s] | |
| 5506 | + }. | |
| 5507 | + | |
| 5508 | + | |
| 5509 | +define Printable_tree | |
| 5510 | + format | |
| 5511 | + ( | |
| 5512 | + CommonInfo cinfo, | |
| 5513 | + List(HTML_Meta) metas, | |
| 5514 | + Bool is_https, | |
| 5515 | + String charset | |
| 5516 | + ) = | |
| 5517 | + if metas is | |
| 5518 | + { | |
| 5519 | + [] then [format(cinfo,http_equiv("content-type", | |
| 5520 | + "text/html; charset="+charset),is_https)], | |
| 5521 | + [h . t] then [format(cinfo,h,is_https) | |
| 5522 | + . format(cinfo,t,is_https,charset)] | |
| 5523 | + }. | |
| 5524 | + | |
| 5525 | + define List(HTML_Head_Tag) | |
| 5526 | + rebuild_html_head_tags | |
| 5527 | + ( | |
| 5528 | + List(HTML_Head_Tag) lwf, | |
| 5529 | + List(HTML_Head_Tag) so_far | |
| 5530 | + ) = | |
| 5531 | + if lwf is | |
| 5532 | + { | |
| 5533 | + [] then so_far, | |
| 5534 | + [h . t] then | |
| 5535 | + rebuild_html_head_tags(t, append_once(so_far, h)) | |
| 5536 | + }. | |
| 5537 | + | |
| 5538 | +define Printable_tree | |
| 5539 | + _format_html_head | |
| 5540 | + ( | |
| 5541 | + List(HTML_Head_Tag) lwf, | |
| 5542 | + Printable_tree so_far, | |
| 5543 | + Dictionary(String, Word32) js_dict | |
| 5544 | + ) | |
| 5545 | + = | |
| 5546 | + //with lwf_ = rebuild_html_head_tags(lwf, []), | |
| 5547 | + if lwf is | |
| 5548 | + { | |
| 5549 | + [] then reverse(so_far), | |
| 5550 | + [ h . t] then | |
| 5551 | + if h is | |
| 5552 | + { | |
| 5553 | + meta(meta) then | |
| 5554 | + [format(meta) . _format_html_head(t, so_far, js_dict)], | |
| 5555 | + title(title) then | |
| 5556 | + ["<title>"+title+"</title>\n" . _format_html_head(t, so_far, js_dict)], | |
| 5557 | + js(jsf) then | |
| 5558 | + since jsf is js_file(filename, _), | |
| 5559 | + if js_dict.get(filename) is | |
| 5560 | + { | |
| 5561 | + failure then | |
| 5562 | + forget(js_dict.insert(filename, 0)); | |
| 5563 | + [add_js_files([jsf]) . _format_html_head(t, so_far, js_dict)], | |
| 5564 | + | |
| 5565 | + success(_) then | |
| 5566 | + _format_html_head(t, so_far, js_dict), | |
| 5567 | + } | |
| 5568 | + js_inline(jsi) then | |
| 5569 | + if jsi is | |
| 5570 | + { | |
| 5571 | + script(type, _) then | |
| 5572 | + ["<script type=\"" + type + "\">"+content(jsi)+"</script>\n" . _format_html_head(t, so_far, js_dict)], | |
| 5573 | + } | |
| 5574 | + css(cssf) then | |
| 5575 | + since cssf is css_file(file_name, media), | |
| 5576 | + ["<link rel=\"stylesheet\" type=\"text/css\" href=\""+file_name+"\" media=\""+to_String(media)+"\" />\n" . _format_html_head(t, so_far, js_dict)], | |
| 5577 | + | |
| 5578 | + css_inline(cssi) then | |
| 5579 | + ["<style>"+cssi+"</style>\n" . _format_html_head(t, so_far, js_dict)] | |
| 5580 | + | |
| 5581 | + link(link_attrs) then | |
| 5582 | + ["<link " + to_String(link_attrs) + " />\n" . _format_html_head(t, so_far, js_dict)] | |
| 5583 | + } | |
| 5584 | + } | |
| 5585 | +. | |
| 5586 | + | |
| 5587 | +public define Printable_tree | |
| 5588 | + format_html_head | |
| 5589 | + ( | |
| 5590 | + List(HTML_Head_Tag) lwf, | |
| 5591 | + String charset | |
| 5592 | + ) | |
| 5593 | + = | |
| 5594 | + _format_html_head((List(HTML_Head_Tag))[ meta(http_equiv("content-type", "text/html; charset="+charset)) . lwf], [], make_dictionary((Word32)0, dictionaryComparerString)). | |
| 5595 | + | |
| 5596 | +public define Printable_tree | |
| 5597 | + format_html_head | |
| 5598 | + ( | |
| 5599 | + List(HTML_Head_Tag) lwf | |
| 5600 | + ) | |
| 5601 | + = | |
| 5602 | + _format_html_head(lwf, [], make_dictionary((Word32)0, dictionaryComparerString)). | |
| 5603 | + | |
| 5604 | + | |
| 5605 | +public type HTML_ajax_content: | |
| 5606 | + html_ajax_content( String html_body, String script, List(String) js_file, List(String) css_file). | |
| 5607 | + | |
| 5608 | +public define HTML_ajax_content | |
| 5609 | + sort_head_tag | |
| 5610 | + ( | |
| 5611 | + List(HTML_Head_Tag) lwf, | |
| 5612 | + String script, | |
| 5613 | + List(String) js_file, | |
| 5614 | + List(String) css_file | |
| 5615 | + )= | |
| 5616 | + if lwf is | |
| 5617 | + { | |
| 5618 | + [] then html_ajax_content("", script, reverse(js_file), reverse(css_file)), | |
| 5619 | + [ h . t ] then | |
| 5620 | + if h is | |
| 5621 | + { | |
| 5622 | + meta(meta) then sort_head_tag(t, script, js_file, css_file), | |
| 5623 | + title(title) then sort_head_tag(t, script, js_file, css_file), | |
| 5624 | + js(jsf) then /*println("sort_head_tag jsf["+jsf.file_name+"]");*/sort_head_tag(t, script, [file_name(jsf) . js_file], css_file), | |
| 5625 | + js_inline(jsi) then /*println("sort_head_tag jsi["+jsi.content+"]");*/sort_head_tag(t, script + content(jsi), js_file, css_file), | |
| 5626 | + css(cssf) then sort_head_tag(t, script, js_file, [file_name(cssf) . css_file]), | |
| 5627 | + css_inline(cssi) then sort_head_tag(t, script, js_file, css_file), | |
| 5628 | + link(_) then sort_head_tag(t, script, js_file, css_file), | |
| 5629 | + } | |
| 5630 | + }. | |
| 5631 | + | |
| 5632 | +public define HTML_ajax_content | |
| 5633 | + to_html_ajax_content | |
| 5634 | + ( | |
| 5635 | + HTML_Off_Form content_HTML, | |
| 5636 | + CommonInfo cinfo | |
| 5637 | + )= | |
| 5638 | + //println("to_html_ajax_content(content_HTML, cinfo)"); | |
| 5639 | + with p_content_head_tags = var((List(HTML_Head_Tag))[]), | |
| 5640 | + with content = format(cinfo, var((Int)0), content_HTML, false, var(0), p_content_head_tags), | |
| 5641 | + if sort_head_tag(*p_content_head_tags, "", [], []) is html_ajax_content(_, script, js_file, css_file) then | |
| 5642 | + html_ajax_content(to_String(content), script, js_file, css_file). | |
| 5643 | + | |
| 5644 | +public define String | |
| 5645 | + to_String | |
| 5646 | + ( | |
| 5647 | + HTML_Off_Form content_HTML, | |
| 5648 | + CommonInfo cinfo | |
| 5649 | + )= | |
| 5650 | + //println("to_html_ajax_content(content_HTML, cinfo)"); | |
| 5651 | + with p_content_head_tags = var((List(HTML_Head_Tag))[]), | |
| 5652 | + with content = format(cinfo, var((Int)0), content_HTML, false, var(0), p_content_head_tags), | |
| 5653 | + to_String(content) | |
| 5654 | +. | |
| 5655 | + | |
| 5656 | + | |
| 5657 | +public define JsonValue | |
| 5658 | + to_html_ajax_content | |
| 5659 | + ( | |
| 5660 | + HTML_Partial_Content content_HTML, | |
| 5661 | + CommonInfo cinfo, | |
| 5662 | + String additional_script | |
| 5663 | + )= | |
| 5664 | + //println("to_html_ajax_content(content_HTML, cinfo, additional_script)"); | |
| 5665 | + //println("additional_script"+additional_script); | |
| 5666 | + since to_html_ajax_content(partial(content_HTML), cinfo) is html_ajax_content(html, script, js_files, css_files), | |
| 5667 | + json_object([ | |
| 5668 | + json_member("html", json_string(html)), | |
| 5669 | + json_member("js_files", to_json_array(js_files)), | |
| 5670 | + json_member("css_files", to_json_array(css_files)), | |
| 5671 | + json_member("script", json_string(additional_script+script)), | |
| 5672 | + ]) | |
| 5673 | +. | |
| 5674 | + | |
| 5675 | +public define JsonValue | |
| 5676 | + to_html_ajax_content | |
| 5677 | + ( | |
| 5678 | + HTML_Partial_Content content_HTML, | |
| 5679 | + CommonInfo cinfo | |
| 5680 | + )= to_html_ajax_content(content_HTML, cinfo, ""). | |
| 5681 | + | |
| 5682 | +public define JsonValue | |
| 5683 | + to_html_ajax_content | |
| 5684 | + ( | |
| 5685 | + Printable_tree content_HTML, | |
| 5686 | + String additional_script | |
| 5687 | + )= | |
| 5688 | + //since to_html_ajax_content(partial(content_HTML), cinfo) is html_ajax_content(html, script, js_files, css_files), | |
| 5689 | + json_object([ | |
| 5690 | + json_member("html", json_string(to_String(content_HTML))), | |
| 5691 | + json_member("js_files", to_json_array([])), | |
| 5692 | + json_member("css_files", to_json_array([])), | |
| 5693 | + json_member("script", json_string(additional_script)), | |
| 5694 | + ]) | |
| 5695 | +. | |
| 5696 | + | |
| 5697 | +public define AWP_Handler_Answer //Printable_tree | |
| 5698 | + format | |
| 5699 | + ( | |
| 5700 | + CommonInfo cinfo, | |
| 5701 | + List(HTTP_header) additional_headers, | |
| 5702 | + HTTP_Answer page, | |
| 5703 | + Bool is_https, | |
| 5704 | + String charset | |
| 5705 | + )= | |
| 5706 | + if cinfo is info(common_name,http_port,https_port,site_directory,secret) then | |
| 5707 | + with ic_v = var((Int)0), | |
| 5708 | + p_content_head_tags = var((List(HTML_Head_Tag))[]), //list of heat_tags extracted from partial_content during format of body content | |
| 5709 | + if page is | |
| 5710 | + { | |
| 5711 | + html_page(status, head_tags, body) then | |
| 5712 | + if body is body(options,element) then | |
| 5713 | + if format(status) is (status_string, status_headers) then | |
| 5714 | + with | |
| 5715 | + answer_body_body = (Printable_tree) | |
| 5716 | + [ "<body ", format_attrs(options), ">", // format body options | |
| 5717 | + format(cinfo,ic_v,element,is_https, var(0), p_content_head_tags), | |
| 5718 | + "</body>\n", | |
| 5719 | + | |
| 5720 | + "</html>"], | |
| 5721 | + answer_body_header = | |
| 5722 | + [doctype_w3c_header, | |
| 5723 | + // html_header, | |
| 5724 | + | |
| 5725 | + "<head>\n", format_html_head(head_tags + *p_content_head_tags, charset),"</head>\n", | |
| 5726 | + ], | |
| 5727 | + printable_tree([ | |
| 5728 | + "HTTP/1.1 " + status_string, crlf, | |
| 5729 | + format_headers(standard_headers), | |
| 5730 | + format_headers(standard_headers_for("text/html", length(answer_body_header) + length(answer_body_body), success(charset))), | |
| 5731 | + format_headers(status_headers), | |
| 5732 | + format_headers(additional_headers), | |
| 5733 | + crlf, | |
| 5734 | + answer_body_header . | |
| 5735 | + answer_body_body | |
| 5736 | + ]), | |
| 5737 | + | |
| 5738 | + html_page(status, title, head_tags, css_styles, css_files, js_files, script, body) then | |
| 5739 | + if body is body(options,element) then | |
| 5740 | + if format(status) is (status_string, status_headers) then | |
| 5741 | + with | |
| 5742 | + answer_body_body = (Printable_tree) | |
| 5743 | + [ "<body ", format_attrs(options), ">", // format body options | |
| 5744 | + format(cinfo,ic_v,element,is_https, var(0), p_content_head_tags), | |
| 5745 | + "</body>\n", | |
| 5746 | + "</html>" | |
| 5747 | + ], | |
| 5748 | + answer_body_header = | |
| 5749 | + [ doctype_w3c_header, | |
| 5750 | + //html_header, | |
| 5751 | + "<head>\n", | |
| 5752 | + add_css_styles(css_styles), | |
| 5753 | + add_css_files(css_files), | |
| 5754 | + add_js_files(js_files), | |
| 5755 | + add_script(script), | |
| 5756 | + "<link rel=\"shortcut icon\" href=\"favicon.ico\" />\n", | |
| 5757 | + "<script type = \"text/javascript\" language=\"JavaScript\">", | |
| 5758 | + " function show_local_popup(divname,stvname) {", | |
| 5759 | + " if (document.layers) { var d = eval(document.divname); } else\n", | |
| 5760 | + " if (document.getElementById) { var d = eval(\"document.getElementById(divname)\"); } else\n", | |
| 5761 | + " if (document.all) { var d = eval(document.all.divname.style)};\n", | |
| 5762 | + // " alert(typeof(eval(stvname))); ", | |
| 5763 | + " var s = eval(stvname); ", | |
| 5764 | + " if (s[0]==0) ", | |
| 5765 | + " { s[0]=1; d.style.visibility = 'visible'; d.zIndex = 100; } else\n", | |
| 5766 | + " { s[0]=0; d.style.visibility = 'hidden'; }; }", | |
| 5767 | + "</script>\n", | |
| 5768 | + "<title>",title,"</title>\n", // put title | |
| 5769 | + //format(cinfo,metas,is_https,charset), // format the metas | |
| 5770 | + format_html_head(head_tags + *p_content_head_tags, charset), | |
| 5771 | + "</head>\n" | |
| 5772 | + ], | |
| 5773 | + printable_tree([ | |
| 5774 | + "HTTP/1.1 " + status_string, crlf, | |
| 5775 | + format_headers(standard_headers), | |
| 5776 | + format_headers(standard_headers_for("text/html", length(answer_body_header) + length(answer_body_body), success(charset))), | |
| 5777 | + format_headers(status_headers), | |
| 5778 | + format_headers(additional_headers), | |
| 5779 | + crlf, | |
| 5780 | + answer_body_header . | |
| 5781 | + answer_body_body | |
| 5782 | + ]), | |
| 5783 | + | |
| 5784 | + plain_text (HTTP_Status status, String text) then | |
| 5785 | + if format(status) is (status_string, status_headers) then | |
| 5786 | + printable_tree([ | |
| 5787 | + "HTTP/1.1 " + status_string, crlf, | |
| 5788 | + format_headers(standard_headers), | |
| 5789 | + format_headers(standard_headers_for("text/plain", length(text), success(charset))), | |
| 5790 | + format_headers(status_headers), | |
| 5791 | + format_headers(additional_headers), | |
| 5792 | + crlf, | |
| 5793 | + text . (Printable_tree)[] | |
| 5794 | + ]), | |
| 5795 | + | |
| 5796 | + custom_text(HTTP_Status status, mime_type, String content) then | |
| 5797 | + if format(status) is (status_string, status_headers) then | |
| 5798 | + printable_tree([ | |
| 5799 | + "HTTP/1.1 " + status_string, crlf, | |
| 5800 | + format_headers(standard_headers), | |
| 5801 | + format_headers(standard_headers_for(to_String(mime_type), length(content), success(charset))), | |
| 5802 | + format_headers(status_headers), | |
| 5803 | + format_headers(additional_headers), | |
| 5804 | + crlf, | |
| 5805 | + content . (Printable_tree)[] | |
| 5806 | + ]), | |
| 5807 | + | |
| 5808 | + custom_binary(HTTP_Status status, mime_type, ByteArray content, List(HTTP_header) other_headers) then | |
| 5809 | + if format(status) is (status_string, status_headers) then | |
| 5810 | + printable_tree([ | |
| 5811 | + "HTTP/1.1 " + status_string, crlf, | |
| 5812 | + format_headers(status_headers), | |
| 5813 | + format_headers(standard_headers_for(to_String(mime_type), length(content), failure)), | |
| 5814 | + format_headers(status_headers), | |
| 5815 | + format_headers(other_headers), | |
| 5816 | + format_headers(additional_headers), | |
| 5817 | + crlf, | |
| 5818 | + content . (Printable_tree)[] | |
| 5819 | + ]), | |
| 5820 | + | |
| 5821 | + custom_tree(HTTP_Status status, mime_type, Printable_tree content) then | |
| 5822 | + if format(status) is (status_string, status_headers) then | |
| 5823 | + printable_tree([ | |
| 5824 | + "HTTP/1.1 " + status_string, crlf, | |
| 5825 | + format_headers(standard_headers), | |
| 5826 | + format_headers(standard_headers_for(to_String(mime_type), length(content), success(charset))), | |
| 5827 | + format_headers(status_headers), | |
| 5828 | + format_headers(additional_headers), | |
| 5829 | + crlf . | |
| 5830 | + content | |
| 5831 | + ]), | |
| 5832 | + | |
| 5833 | + json(HTTP_Status status, JsonValue json_content) then | |
| 5834 | + //with start = unow, | |
| 5835 | + with content = (Printable_tree)format_json(json_content), | |
| 5836 | + //println(show_duration_string("HTTP json format json object ", start)); | |
| 5837 | + if format(status) is (status_string, status_headers) then | |
| 5838 | + printable_tree([ | |
| 5839 | + "HTTP/1.1 " + status_string, crlf, | |
| 5840 | + format_headers(standard_headers), | |
| 5841 | + format_headers(standard_headers_for(to_String(mime_application_json), length(content), success(charset))), | |
| 5842 | + format_headers(status_headers), | |
| 5843 | + format_headers(additional_headers), | |
| 5844 | + crlf . | |
| 5845 | + content | |
| 5846 | + ]) | |
| 5847 | + , | |
| 5848 | + send_file(file_path, c_disposition) then | |
| 5849 | + send_file(file_path, c_disposition), | |
| 5850 | + | |
| 5851 | + http_raw(Printable_tree content) then | |
| 5852 | + printable_tree(content), | |
| 5853 | + | |
| 5854 | + html_content(HTTP_Status status, HTML_Off_Form content_HTML) then | |
| 5855 | + if format(status) is (status_string, status_headers) then | |
| 5856 | + with content = format(cinfo, ic_v, content_HTML, is_https, var(0), p_content_head_tags), | |
| 5857 | + printable_tree([ | |
| 5858 | + "HTTP/1.1 " + status_string, crlf, | |
| 5859 | + format_headers(standard_headers), | |
| 5860 | + format_headers(standard_headers_for("text/html", length(content), success(charset))), | |
| 5861 | + format_headers(status_headers), | |
| 5862 | + format_headers(additional_headers), | |
| 5863 | + crlf . | |
| 5864 | + content | |
| 5865 | + ]), | |
| 5866 | + //HMTL content with some header | |
| 5867 | + html_partial_content(HTTP_Status status, HTML_Partial_Content p_content) then | |
| 5868 | + | |
| 5869 | + since p_content is partial_content(head_tags, html_content), | |
| 5870 | + since format(status) is (status_string, status_headers), | |
| 5871 | + with | |
| 5872 | + answer_body = (Printable_tree) | |
| 5873 | + [ | |
| 5874 | + format(cinfo, ic_v, html_content, is_https, var(0), p_content_head_tags), | |
| 5875 | + ], | |
| 5876 | + answer_header = (Printable_tree) | |
| 5877 | + [ | |
| 5878 | + // html_header, | |
| 5879 | + format_html_head(head_tags + *p_content_head_tags), | |
| 5880 | + ], | |
| 5881 | + printable_tree([ | |
| 5882 | + "HTTP/1.1 " + status_string, crlf, | |
| 5883 | + format_headers(standard_headers), | |
| 5884 | + format_headers(standard_headers_for("text/html", length(answer_header) + length(answer_body), success(charset))), | |
| 5885 | + format_headers(status_headers), | |
| 5886 | + format_headers(additional_headers), | |
| 5887 | + crlf, | |
| 5888 | + answer_header . | |
| 5889 | + answer_body | |
| 5890 | + ]), | |
| 5891 | + }. | |
| 5892 | + | ... | ... |
web/page_message.anubis
| ... | ... | @@ -150,19 +150,19 @@ define List(CoreAttrs) |
| 150 | 150 | right then [class(html_class), style("margin-left: auto;")] |
| 151 | 151 | }. |
| 152 | 152 | |
| 153 | -public define HTML_Off_Form hide_info_line_btn = div([event(onclick, "this.parentNode.style.display="none";"), style("width: 16px; height: 16px; background: transparent url(""+icn16_cross+"") no-repeat scroll center center; float: right; display: inline; cursor: pointer;")], literal("")). | |
| 153 | +public define HTML hide_info_line_btn = div([event(onclick, "this.parentNode.style.display="none";"), style("width: 16px; height: 16px; background: transparent url(""+icn16_cross+"") no-repeat scroll center center; float: right; display: inline; cursor: pointer;")], literal("")). | |
| 154 | 154 | |
| 155 | -public define HTML_In_Form | |
| 156 | - display_info_line | |
| 157 | - ( | |
| 158 | - String html_id, | |
| 159 | - String html_class, | |
| 160 | - String txt, | |
| 161 | - Alignment align | |
| 162 | - ) = | |
| 163 | - div(get_info_line_attrbs(html_class, align), [partial(partial_content(hide_info_line_btn)), partial(partial_content(literal(txt)))]). | |
| 155 | +//public define HTML_In_Form | |
| 156 | +// display_info_line | |
| 157 | +// ( | |
| 158 | +// String html_id, | |
| 159 | +// String html_class, | |
| 160 | +// String txt, | |
| 161 | +// Alignment align | |
| 162 | +// ) = | |
| 163 | +// div(get_info_line_attrbs(html_class, align), [partial(partial_content(hide_info_line_btn)), partial(partial_content(literal(txt)))]). | |
| 164 | 164 | |
| 165 | -public define HTML_Off_Form | |
| 165 | +public define HTML | |
| 166 | 166 | display_info_line |
| 167 | 167 | ( |
| 168 | 168 | String html_id, |
| ... | ... | @@ -170,9 +170,9 @@ public define HTML_Off_Form |
| 170 | 170 | String txt, |
| 171 | 171 | Alignment align |
| 172 | 172 | ) = |
| 173 | - div(get_info_line_attrbs(html_class, align), sequence([hide_info_line_btn, partial(partial_content(literal(txt)))])). | |
| 173 | + div(get_info_line_attrbs(html_class, align), sequence([hide_info_line_btn, text(txt)])). | |
| 174 | 174 | |
| 175 | -public define HTML_Off_Form | |
| 175 | +public define HTML | |
| 176 | 176 | display_main_info_line |
| 177 | 177 | ( |
| 178 | 178 | String html_class, |
| ... | ... | @@ -181,7 +181,7 @@ public define HTML_Off_Form |
| 181 | 181 | ) = |
| 182 | 182 | display_info_line("informations", html_class, txt, align). |
| 183 | 183 | |
| 184 | -public define HTML_Off_Form | |
| 184 | +public define HTML | |
| 185 | 185 | display_main_info_line |
| 186 | 186 | ( |
| 187 | 187 | String html_class, |
| ... | ... | @@ -189,7 +189,7 @@ public define HTML_Off_Form |
| 189 | 189 | ) = |
| 190 | 190 | display_info_line("informations", html_class, txt, left). |
| 191 | 191 | |
| 192 | -public define HTML_Off_Form | |
| 192 | +public define HTML | |
| 193 | 193 | show_page_message |
| 194 | 194 | ( |
| 195 | 195 | Page_Message page_message | ... | ... |
web/plugin/plugin.anubis
| ... | ... | @@ -23,7 +23,7 @@ public type WEB_Plugin: |
| 23 | 23 | String date, |
| 24 | 24 | //version |
| 25 | 25 | (SQLite3DataBase db, HK_Database hk_db, VTM _vtm, (LogLevel, String) -> One logger) -> List(WEB_Controller) get_controller, |
| 26 | - (SQLite3DataBase db, WEB_Session, String type) -> Maybe(HTML_Partial_Content) get_typed_content | |
| 26 | + (SQLite3DataBase db, WEB_Session, String type) -> Maybe(HTML) get_typed_content | |
| 27 | 27 | // (One dummy) -> Plugin_Left_Menu get_plugin_left_menu |
| 28 | 28 | // (One dummy) -> Message get_API, |
| 29 | 29 | // (Message message) -> Message call_API | ... | ... |
web/types/controllers_web_site.anubis
| ... | ... | @@ -40,7 +40,7 @@ public type WEB_Controller_Result: |
| 40 | 40 | ), |
| 41 | 41 | ajax( |
| 42 | 42 | Maybe(WEB_Session) mb_session, //modified session if success else failure |
| 43 | - HTML_Partial_Content content, | |
| 43 | + HTML content, | |
| 44 | 44 | String additional_script |
| 45 | 45 | ), |
| 46 | 46 | ajax( |
| ... | ... | @@ -56,12 +56,12 @@ public type WEB_Controller_Result: |
| 56 | 56 | Maybe(WEB_Session) mb_session, //modified session if success else failure |
| 57 | 57 | //String title, |
| 58 | 58 | //Left_Menu left_menu, |
| 59 | - HTML_Partial_Content content | |
| 59 | + HTML content | |
| 60 | 60 | ) |
| 61 | 61 | //redraw with the current renderer, the given content |
| 62 | 62 | // redraw( |
| 63 | 63 | // Maybe(WEB_Session) mb_session, //modified session if success else failure |
| 64 | -// HTML_Partial_Content content | |
| 64 | +// HTML content | |
| 65 | 65 | // ) |
| 66 | 66 | . |
| 67 | 67 | ... | ... |
web/types/making_a_web_site.anubis
| ... | ... | @@ -310,38 +310,11 @@ public define JS_File js_file(String file_name) = js_file(file_name, []). |
| 310 | 310 | public define CSS_File css_file(String file_name)= css_file(file_name, all). |
| 311 | 311 | |
| 312 | 312 | public type CoreAttrs:... |
| 313 | -public type HTML_Partial_Content:... | |
| 314 | 313 | public type HTML_Body:... |
| 315 | -public type HTML_Off_Form:... | |
| 314 | +public type HTML:... | |
| 316 | 315 | public type HTML_tooltip:... |
| 317 | 316 | public type HTTP_Answer:... |
| 318 | - | |
| 319 | - | |
| 320 | -public type Text_Option: | |
| 321 | - core_attrs(List(CoreAttrs)), | |
| 322 | - size(Int), // size of character font to use | |
| 323 | - font(String), // name of character font to use (such as "helvetica",...) | |
| 324 | - color(RGB), // color to be used for characters | |
| 325 | - italic, | |
| 326 | - oblique, | |
| 327 | - small_capitals, | |
| 328 | - bold, | |
| 329 | - underlined, | |
| 330 | - left_justified, | |
| 331 | - right_justified, | |
| 332 | - justified, // justified on both sides | |
| 333 | - line_through, | |
| 334 | - nowrap, | |
| 335 | - class(String), //CSS class | |
| 336 | - id(String), | |
| 337 | - style(String), | |
| 338 | - title(String), | |
| 339 | - attr(String, String). | |
| 340 | - | |
| 341 | -public type CSS_Style: | |
| 342 | - text_options(List(Text_Option)). | |
| 343 | - | |
| 344 | -// Following types are define to prohib any arguments order error | |
| 317 | +public type HTML_Head_Tag:... | |
| 345 | 318 | |
| 346 | 319 | /** |
| 347 | 320 | * String value for 'id' attribut |
| ... | ... | @@ -392,27 +365,6 @@ public type HTML_Label: |
| 392 | 365 | ) |
| 393 | 366 | . |
| 394 | 367 | |
| 395 | -public type InputAttrs: | |
| 396 | - id (String), | |
| 397 | - class (String), | |
| 398 | - style (String), | |
| 399 | - title (String), | |
| 400 | - lang (String), | |
| 401 | - dir (Reading_Way), | |
| 402 | - accesskey (Word8), | |
| 403 | - tabindex (Int), | |
| 404 | - attr (String, String), | |
| 405 | - event (HtmlEvents, String), | |
| 406 | - //HTML5 | |
| 407 | - data (String name, String value). | |
| 408 | - | |
| 409 | -public type TextAreaOption: | |
| 410 | - input_attrs(List(InputAttrs)), | |
| 411 | - disabled, | |
| 412 | - read_only, | |
| 413 | - wrap_lines | |
| 414 | -. | |
| 415 | - | |
| 416 | 368 | public type Actioner_Local_Action: |
| 417 | 369 | close_window. |
| 418 | 370 | |
| ... | ... | @@ -433,131 +385,16 @@ public type Actioner_Target: |
| 433 | 385 | other(String window_name, List(Other_Window_Option)). |
| 434 | 386 | |
| 435 | 387 | public type Actioner_Aspect: |
| 436 | - link (List(Text_Option), String text, Maybe(String) name),// hypertext link | |
| 388 | + link (List(CoreAttrs), String text, Maybe(String) name),// hypertext link | |
| 437 | 389 | img_link (List(CoreAttrs),String img_url, String alt_text), |
| 438 | 390 | push_button (List(CoreAttrs),String text), |
| 439 | 391 | button (String url_off, String url_on), // rollover button |
| 440 | 392 | button (String url_off, String url_on, Int w, Int h), // idem with size |
| 441 | 393 | submit (List(CoreAttrs),String text), |
| 442 | 394 | immediate_selector (List(CoreAttrs),WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, Maybe(InitialValue) selected, String onchange_fn), |
| 443 | - html (List(CoreAttrs), HTML_Off_Form). | |
| 444 | - | |
| 445 | -public define Actioner_Aspect html(HTML_Off_Form content) = html([], content). | |
| 446 | - | |
| 447 | -public type BackgroundOption: | |
| 448 | - repeat, // repeat the background in both directions | |
| 449 | - repeat_horizontal, // repeat the background only horizontally | |
| 450 | - repeat_vertical, // repeat the background only verticall | |
| 451 | - no_repeat, // don't repeat the background | |
| 452 | - center. | |
| 453 | - | |
| 454 | -public type Cell_Option: | |
| 455 | - core_attrs(List(CoreAttrs)), | |
| 456 | - left, // put the content of the cell on the left | |
| 457 | - h_center, // center the content of the cell horizontally | |
| 458 | - right, // put the content of the cell on the right | |
| 459 | - top, // put the content of the cell upwards | |
| 460 | - v_center, // center the content of tye cell vertically, | |
| 461 | - bottom, // put the content of the cell downwards | |
| 462 | - base_line, // align the content vertically according to base lines | |
| 463 | - background_color(RGB), | |
| 464 | - background_image(String url, BackgroundOption), | |
| 465 | - width(Int), // sets a minimal width for the cell | |
| 466 | - percentage_width(Int), | |
| 467 | - height(Int), // sets a minimal height for the cell | |
| 468 | - columns(Int), // lets the cell span over several columns | |
| 469 | - rows(Int), // lets the cell span over several rows | |
| 470 | - nowrap, // do not allow text wrapping within the cell | |
| 471 | - style(String), // in case nothing above is suitable | |
| 472 | - class(String class_name). | |
| 473 | - | |
| 474 | -public type HTML_Cell($T): | |
| 475 | - cell(List(Cell_Option) options, $T content). | |
| 476 | - | |
| 477 | -public type HTML_Footer_Row($T): | |
| 478 | - empty, | |
| 479 | - footer_row(List(Cell_Option) options, List(HTML_Cell($T)) cells). | |
| 480 | - | |
| 481 | -public type HTML_Row($T): | |
| 482 | - empty, | |
| 483 | - row(List(Cell_Option) options, List(HTML_Cell($T)) cells). | |
| 484 | - | |
| 485 | -public type HTML_Header_Cell($T): | |
| 486 | - header_cell(List(Cell_Option) options, $T content). | |
| 487 | - | |
| 488 | -public type HTML_Header_Row($T): | |
| 489 | - empty, | |
| 490 | - header_row(List(Cell_Option) options, List(HTML_Header_Cell($T)) cells). | |
| 491 | - | |
| 492 | - | |
| 493 | -public type Table_Option: | |
| 494 | - core_attrs(List(CoreAttrs)), | |
| 495 | - background_color(RGB), // applied to all cells in the table | |
| 496 | - background_image(String url), | |
| 497 | - border(Int width_of_outer_edge, // if not present, all values are 0 | |
| 498 | - Int width_of_top_of_relief, | |
| 499 | - Int width_of_inner_edge, | |
| 500 | - RGB border_color), | |
| 501 | - width(Int), // sets a minimal width for the table | |
| 502 | - percentage_width(Int), | |
| 503 | - attr(String name, String value), | |
| 504 | - class(String class_name). | |
| 505 | - | |
| 395 | + html (List(CoreAttrs), HTML). | |
| 506 | 396 | |
| 507 | -public type HTML_In_Form: | |
| 508 | - empty, | |
| 509 | - literal_pt (Printable_tree), | |
| 510 | - literal (String), | |
| 511 | - sequence (List(HTML_In_Form) items), | |
| 512 | - text (List(CoreAttrs), String the_text), | |
| 513 | - preformated (List(Text_Option), String), | |
| 514 | - paragraph (List(Text_Option), List(HTML_In_Form) content), | |
| 515 | - image (List(CoreAttrs), String url, String alternate), | |
| 516 | - image (List(CoreAttrs), String url, String alternate, Int width, Int height), | |
| 517 | - table (List(Table_Option), HTML_Header_Row(HTML_In_Form), List(HTML_Row(HTML_In_Form)), HTML_Footer_Row(HTML_In_Form)), | |
| 518 | - center (HTML_In_Form), | |
| 519 | - mail_to (String email, HTML_In_Form element), | |
| 520 | - scroller (Int width, Int height, | |
| 521 | - Int content_width, Int content_height, | |
| 522 | - HTML_In_Form content), | |
| 523 | - actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, | |
| 524 | - WEB_Action_Name action_name, List((String,String)) extra_ops, | |
| 525 | - List(Actioner_Local_Action)), | |
| 526 | - foreign_link_new (Actioner_Target, Actioner_Aspect, String url), | |
| 527 | - foreign_link (List(Text_Option), String url), | |
| 528 | - foreign_link (List(Text_Option), String url, String name), | |
| 529 | - private_download (String abs_path, String name, String extra_ext, | |
| 530 | - Maybe((String,List((String,String)))) action), | |
| 531 | - text_input (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), | |
| 532 | - text_input_ro (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), | |
| 533 | - password_input (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), | |
| 534 | - text_area (List(TextAreaOption), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width, Int height), | |
| 535 | - file_upload (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int width), | |
| 536 | - selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices), | |
| 537 | - selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices, InitialValue selected), | |
| 538 | - // List((String,String)) = List((code,name)) where : | |
| 539 | - // code is the web-arg value | |
| 540 | - // name appears in selector | |
| 541 | - selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices), | |
| 542 | - selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, InitialValue selected), | |
| 543 | - radio_button (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, WebArgValue value, Bool checked), | |
| 544 | - radio_button_r (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, WebArgValue value, Bool checked), | |
| 545 | - check_box (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Bool checked), | |
| 546 | - check_box_r (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Bool checked), | |
| 547 | - div (List(CoreAttrs), List(HTML_In_Form) content), | |
| 548 | - div_empty (List(CoreAttrs)), | |
| 549 | - hidden (HTML_Id id, WebArgName name, WebArgValue value), | |
| 550 | - partial (HTML_Partial_Content), | |
| 551 | - br, | |
| 552 | - progress (List(CoreAttrs), Int value, Int max), | |
| 553 | - ol (List(CoreAttrs), List(HTML_In_Form) content), | |
| 554 | - ul (List(CoreAttrs), List(HTML_In_Form) content), | |
| 555 | - li (List(CoreAttrs), List(HTML_In_Form) content), | |
| 556 | - button (List(CoreAttrs), List(HTML_In_Form) content), | |
| 557 | - i (List(CoreAttrs), String text), | |
| 558 | - span (List(CoreAttrs), String text), | |
| 559 | - hr (List(CoreAttrs)) | |
| 560 | -. | |
| 397 | +public define Actioner_Aspect html(HTML content) = html([], content). | |
| 561 | 398 | |
| 562 | 399 | public type HTML_Size: |
| 563 | 400 | absolute(Int), // in pixels |
| ... | ... | @@ -586,16 +423,14 @@ public type A_target: |
| 586 | 423 | . |
| 587 | 424 | |
| 588 | 425 | |
| 589 | -public type HTML_Off_Form: | |
| 590 | - a (List(CoreAttrs), A_href, A_target, List(HTML_Off_Form) content), | |
| 426 | +public type HTML: | |
| 427 | + a (List(CoreAttrs), A_href, A_target, List(HTML) content), | |
| 591 | 428 | empty, |
| 592 | 429 | literal_pt (Printable_tree), |
| 593 | 430 | literal (String), |
| 594 | - sequence (List(HTML_Off_Form) items), | |
| 431 | + sequence (List(HTML) items), | |
| 595 | 432 | text (List(CoreAttrs), String the_text), |
| 596 | 433 | |
| 597 | - table (List(Table_Option), HTML_Header_Row(HTML_Off_Form), List(HTML_Row(HTML_Off_Form)), HTML_Footer_Row(HTML_Off_Form)), | |
| 598 | - | |
| 599 | 434 | actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, |
| 600 | 435 | WEB_Action_Name action_name, List((String,String)) extra_ops, |
| 601 | 436 | List(Actioner_Local_Action)), |
| ... | ... | @@ -603,29 +438,21 @@ public type HTML_Off_Form: |
| 603 | 438 | WEB_Action_Name action_name, List((String,String)) extra_ops, |
| 604 | 439 | List(Actioner_Local_Action), String form_name), |
| 605 | 440 | foreign_link_new (Actioner_Target, Actioner_Aspect, String url), |
| 606 | - foreign_link (List(Text_Option), String url), | |
| 607 | - foreign_link (List(Text_Option), String url, String name), | |
| 441 | + //foreign_link (List(Text_Option), String url), | |
| 442 | + //foreign_link (List(CoreAttrs), String url, String name), | |
| 608 | 443 | private_download (String abs_path, String name, String extra_ext, |
| 609 | 444 | Maybe((String,List((String,String)))) action), |
| 610 | - //label (String name), | |
| 611 | - form (HTML_Id form_id, List(CoreAttrs), List(HTML_In_Form) content), | |
| 612 | - form (HTML_Id form_id, List(CoreAttrs), | |
| 613 | - WEB_Action_Name action, List((String,String)) extra_ops, | |
| 614 | - List(HTML_In_Form) content), | |
| 615 | - in_form (HTML_Id form_id, HTML_In_Form content), | |
| 616 | - div (List(CoreAttrs), List(HTML_Partial_Content) p_content), | |
| 617 | - iframe (List(CoreAttrs), | |
| 618 | - List(CSS_Style) /*styles*/, | |
| 619 | - List(CSS_File) /*css_files*/, | |
| 620 | - List(JS_File) /*js_files*/, | |
| 621 | - HTML_Body /*body*/), | |
| 622 | - partial (HTML_Partial_Content), | |
| 623 | - //progress (List(CoreAttrs), Int value, Int max), | |
| 624 | - //i (List(CoreAttrs), String text), | |
| 625 | - html_tag (String tag_name, List(CoreAttrs), List(HTML_Off_Form) content), | |
| 445 | + head_tags (List(HTML_Head_Tag) heads, List(HTML) content), | |
| 446 | + html_tag (String tag_name, List(CoreAttrs), List(HTML) content), | |
| 626 | 447 | html_void_tag (String tag_name, List(CoreAttrs)) |
| 627 | 448 | . |
| 628 | 449 | |
| 450 | +public define HTML head_tags(List(HTML_Head_Tag) heads, HTML content) = head_tags(heads, [content]). | |
| 451 | +public define HTML head_tags(HTML_Head_Tag head, List(HTML) contents) = head_tags([head], contents). | |
| 452 | +public define HTML head_tags(HTML_Head_Tag head, HTML content) = head_tags([head], [content]). | |
| 453 | +public define HTML head_tags(List(HTML_Head_Tag) heads) = head_tags(heads, []). | |
| 454 | +public define HTML head_tags(HTML_Head_Tag head) = head_tags([head], []). | |
| 455 | + | |
| 629 | 456 | |
| 630 | 457 | public type Rel_attr: |
| 631 | 458 | alternate, |
| ... | ... | @@ -737,22 +564,22 @@ public type HTML_Head_Tag: |
| 737 | 564 | link(List(Link_attr) link_attrs) |
| 738 | 565 | . |
| 739 | 566 | |
| 740 | -public type HTML_Partial_Content: | |
| 741 | - partial_content | |
| 742 | - ( | |
| 743 | - List(HTML_Head_Tag), | |
| 744 | - HTML_Off_Form | |
| 745 | - ) | |
| 746 | -. | |
| 567 | +//public type HTML: | |
| 568 | +// partial_content | |
| 569 | +// ( | |
| 570 | +// List(HTML_Head_Tag), | |
| 571 | +// HTML | |
| 572 | +// ) | |
| 573 | +//. | |
| 747 | 574 | |
| 748 | 575 | public type HTML_Body: |
| 749 | - body(List(CoreAttrs) attrs, List(HTML_Off_Form) content). | |
| 576 | + body(List(CoreAttrs) attrs, List(HTML) content). | |
| 750 | 577 | |
| 751 | 578 | public define HTML_Body |
| 752 | 579 | body |
| 753 | 580 | ( |
| 754 | 581 | List(CoreAttrs) attrs, |
| 755 | - HTML_Off_Form content | |
| 582 | + HTML content | |
| 756 | 583 | )= |
| 757 | 584 | body(attrs, [content]) |
| 758 | 585 | . |
| ... | ... | @@ -761,7 +588,7 @@ public define HTML_Body |
| 761 | 588 | body |
| 762 | 589 | ( |
| 763 | 590 | CoreAttrs attr, |
| 764 | - HTML_Off_Form content | |
| 591 | + HTML content | |
| 765 | 592 | )= |
| 766 | 593 | body([attr], [content]) |
| 767 | 594 | . |
| ... | ... | @@ -770,7 +597,7 @@ public define HTML_Body |
| 770 | 597 | body |
| 771 | 598 | ( |
| 772 | 599 | CoreAttrs attr, |
| 773 | - List(HTML_Off_Form) content | |
| 600 | + List(HTML) content | |
| 774 | 601 | )= |
| 775 | 602 | body([attr], content) |
| 776 | 603 | . |
| ... | ... | @@ -778,7 +605,7 @@ public define HTML_Body |
| 778 | 605 | public define HTML_Body |
| 779 | 606 | body |
| 780 | 607 | ( |
| 781 | - HTML_Off_Form content | |
| 608 | + HTML content | |
| 782 | 609 | )= |
| 783 | 610 | body([], [content]) |
| 784 | 611 | . |
| ... | ... | @@ -849,20 +676,15 @@ public type CoreAttrs: |
| 849 | 676 | |
| 850 | 677 | public define CoreAttrs colspan(Int value) = attr("colspan", to_String(value)). |
| 851 | 678 | public define CoreAttrs rowspan(Int value) = attr("rowspan", to_String(value)). |
| 679 | +public define CoreAttrs headers(String header_id) = attr("headers", header_id). | |
| 852 | 680 | public define CoreAttrs width(Int value) = attr("width", to_String(value)). |
| 853 | 681 | public define CoreAttrs height(Int value) = attr("height", to_String(value)). |
| 854 | 682 | public define CoreAttrs width_px(Int value) = attr("width", to_String(value)+"px"). |
| 855 | 683 | public define CoreAttrs height_px(Int value) = attr("height", to_String(value)+"px"). |
| 856 | 684 | public define CoreAttrs alt(String value) = attr("alt", value). |
| 857 | 685 | public define CoreAttrs size(Int value) = attr("size", to_String(value)). |
| 858 | - | |
| 859 | -public define CoreAttrs | |
| 860 | - boolean | |
| 861 | - ( | |
| 862 | - String name | |
| 863 | - )= | |
| 864 | - attr(name, name) | |
| 865 | -. | |
| 686 | +public define CoreAttrs aria(String key, String value) = attr("aria-"+key, value). | |
| 687 | +public define CoreAttrs boolean(String name) = attr(name, name). | |
| 866 | 688 | |
| 867 | 689 | public type HTTP_Answer: |
| 868 | 690 | html_page (HTTP_Status /*http_status*/, |
| ... | ... | @@ -871,7 +693,7 @@ public type HTTP_Answer: |
| 871 | 693 | html_page (HTTP_Status /*http_status*/, |
| 872 | 694 | String /*title*/, |
| 873 | 695 | List(HTML_Head_Tag) /*meta_tags*/, |
| 874 | - List(CSS_Style) /*styles*/, | |
| 696 | + //List(CSS_Style) /*styles*/, | |
| 875 | 697 | List(CSS_File) /*css_files*/, |
| 876 | 698 | List(JS_File) /*js_files*/, |
| 877 | 699 | List(Script) /*script*/, |
| ... | ... | @@ -894,9 +716,7 @@ public type HTTP_Answer: |
| 894 | 716 | Content_Disposition c_disposition), |
| 895 | 717 | http_raw (Printable_tree), |
| 896 | 718 | html_content (HTTP_Status /*http_status*/, |
| 897 | - HTML_Off_Form), | |
| 898 | - html_partial_content (HTTP_Status /*http_status*/, | |
| 899 | - HTML_Partial_Content) | |
| 719 | + HTML) | |
| 900 | 720 | . |
| 901 | 721 | |
| 902 | 722 | public define HTTP_Answer | ... | ... |
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: フランスのトトロ aka (David RENÉ) | |
| 4 | + * Date: 29/05/2019 | |
| 5 | + * Time: 18:41 | |
| 6 | + * © David RENÉ | |
| 7 | + */ | |
| 8 | +transmit xlib/web/types/web_action_name.anubis | |
| 9 | +transmit xlib/web/common.anubis | |
| 10 | + | |
| 11 | +transmit xlib/web/multihost_http_server.anubis | |
| 12 | +transmit xlib/web/json.anubis | |
| 13 | +transmit xlib/web/widgets/left_menu.anubis | |
| 14 | +read web/mime.anubis | |
| 15 | +read tools/printable_tree.anubis | |
| 16 | + | |
| 17 | +public type WEB_Action_Allowed_Protocol: | |
| 18 | + http, | |
| 19 | + https, | |
| 20 | + http_https | |
| 21 | +. | |
| 22 | + | |
| 23 | +public type Web_Action($State): | |
| 24 | + http_action (String name, // name of action | |
| 25 | + ($State) -> Bool allow, // true if action allowed | |
| 26 | + (HTTP_Info http_info, | |
| 27 | + List(Web_arg) web_args, // actually only 'operands' web arguments | |
| 28 | + $State state) -> $State do_it), | |
| 29 | + https_action (String name, // name of action | |
| 30 | + ($State) -> Bool allow, // true if action allowed | |
| 31 | + (HTTP_Info http_info, | |
| 32 | + List(Web_arg) web_args, // actually only 'operands' web arguments | |
| 33 | + $State state) -> $State do_it), | |
| 34 | + http_https_action (String name, | |
| 35 | + ($State) -> Bool allow, | |
| 36 | + (HTTP_Info http_info, | |
| 37 | + List(Web_arg) web_args, | |
| 38 | + $State state) -> $State do_it) | |
| 39 | +. | |
| 40 | + | |
| 41 | + This indicate the way of reading text. | |
| 42 | +public type Reading_Way: | |
| 43 | + ltr, //the text is readable from "Left To Right" like english | |
| 44 | + rtl //the text is readable from "Right To Left" like arabic | |
| 45 | +. | |
| 46 | + | |
| 47 | +public type CSS_File_Media: | |
| 48 | + screen, //Intended for non-paged computer screens. | |
| 49 | + tty, //Intended for media using a fixed-pitch character grid, such as teletypes, terminals, or portable devices with limited display capabilities. | |
| 50 | + tv, //Intended for television-type devices (low resolution, color, limited scrollability). | |
| 51 | + projection, //Intended for projectors. | |
| 52 | + handheld, //Intended for handheld devices (small screen, monochrome, bitmapped graphics, limited bandwidth). | |
| 53 | + print, //Intended for paged, opaque material and for documents viewed on screen in print preview mode. | |
| 54 | + braille, //Intended for braille tactile feedback devices. | |
| 55 | + aural, //Intended for speech synthesizers. | |
| 56 | + all. //Suitable for all devices. | |
| 57 | + | |
| 58 | +public type HtmlEvents: | |
| 59 | + // Window Event Attributes | |
| 60 | + onafterprint, //HTML5 Script to be run after the document is printed | |
| 61 | + onbeforeprint, //HTML5 Script to be run before the document is printed | |
| 62 | + onbeforeunload, //HTML5 Script to be run when the document is about to be unloaded | |
| 63 | + onerror, //HTML5 Script to be run when an error occurs | |
| 64 | + onhashchange, //HTML5 Script to be run when there has been changes to the anchor part of the a URL | |
| 65 | + onload, // Fires after the page is finished loading | |
| 66 | + onmessage, //HTML5 Script to be run when the message is triggered | |
| 67 | + onoffline, //HTML5 Script to be run when the browser starts to work offline | |
| 68 | + ononline, //HTML5 Script to be run when the browser starts to work online | |
| 69 | + onpagehide, //HTML5 Script to be run when a user navigates away from a page | |
| 70 | + onpageshow, //HTML5 Script to be run when a user navigates to a page | |
| 71 | + onpopstate, //HTML5 Script to be run when the window's history changes | |
| 72 | + onresize, //HTML5 Fires when the browser window is resized | |
| 73 | + onstorage, //HTML5 Script to be run when a Web Storage area is updated | |
| 74 | + onunload, // Fires once a page has unloaded (or the browser window has been closed) | |
| 75 | + // Form element events | |
| 76 | + onblur, // Fires the moment that the element loses focus | |
| 77 | + onchange, // Fires the moment when the value of the element is changed | |
| 78 | + oncontextmenu, //HTML5 Script to be run when a context menu is triggered | |
| 79 | + onfocus, // Fires the moment when the element gets focus | |
| 80 | + oninput, //HTML5 Script to be run when an element gets user input | |
| 81 | + oninvalid, //HTML5 Script to be run when an element is invalid | |
| 82 | + onreset, // Fires when the Reset button in a form is clicked | |
| 83 | + onsearch, // Fires when the user writes something in a search field (for <input="search">) | |
| 84 | + onselect, // Fires after some text has been selected in an element | |
| 85 | + onsubmit, // Fires when a form is submitted | |
| 86 | + // Keyboard events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) | |
| 87 | + onkeydown, // Fires when a user is pressing a key | |
| 88 | + onkeypress, // Fires when a user presses a key | |
| 89 | + onkeyup, // Fires when a user releases a key | |
| 90 | + // Mouse events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) | |
| 91 | + onclick, // Fires on a mouse click on the element | |
| 92 | + ondblclick, // Fires on a mouse double-click on the element | |
| 93 | + onmousedown, // Fires when a mouse button is pressed down on an element | |
| 94 | + onmousemove, // Fires when the mouse pointer is moving while it is over an element | |
| 95 | + onmouseout, // Fires when the mouse pointer moves out of an element | |
| 96 | + onmouseover, // Fires when the mouse pointer moves over an element | |
| 97 | + onmouseup, // Fires when a mouse button is released over an element | |
| 98 | + onwheel, //HTML5 Fires when the mouse wheel rolls up or down over an element | |
| 99 | + //Drag Events | |
| 100 | + ondrag, //HMTL5 Script to be run when an element is dragged | |
| 101 | + ondragend, //HTML5 Script to be run at the end of a drag operation | |
| 102 | + ondragenter, //HTML5 Script to be run when an element has been dragged to a valid drop target | |
| 103 | + ondragleave, //HTML5 Script to be run when an element leaves a valid drop target | |
| 104 | + ondragover, //HTML5 Script to be run when an element is being dragged over a valid drop target | |
| 105 | + ondragstart, //HTML5 Script to be run at the start of a drag operation | |
| 106 | + ondrop, //HTML5 Script to be run when dragged element is being dropped | |
| 107 | + onscroll, //HTML5 Script to be run when an element's scrollbar is being scrolled | |
| 108 | + //Clipboard Events | |
| 109 | + oncopy, //HTML5 Fires when the user copies the content of an element | |
| 110 | + oncut, //HTML5 Fires when the user cuts the content of an element | |
| 111 | + onpaste, //HTML5 Fires when the user pastes some content in an element | |
| 112 | + //Media Events | |
| 113 | + onabort, //HTML5 Script to be run on abort | |
| 114 | + oncanplay, //HTML5 Script to be run when a file is ready to start playing (when it has buffered enough to begin) | |
| 115 | + oncanplaythrough, //HTML5 Script to be run when a file can be played all the way to the end without pausing for buffering | |
| 116 | + oncuechange, //HTML5 Script to be run when the cue changes in a <track> element | |
| 117 | + ondurationchange, //HTML5 Script to be run when the length of the media changes | |
| 118 | + onemptied, //HTML5 Script to be run when something bad happens and the file is suddenly unavailable (like unexpectedly disconnects) | |
| 119 | + onended, //HTML5 Script to be run when the media has reach the end (a useful event for messages like "thanks for listening") | |
| 120 | + onerror, //HTML5 Script to be run when an error occurs when the file is being loaded | |
| 121 | + onloadeddata, //HTML5 Script to be run when media data is loaded | |
| 122 | + onloadedmetadata, //HTML5 Script to be run when meta data (like dimensions and duration) are loaded | |
| 123 | + onloadstart, //HTML5 Script to be run just as the file begins to load before anything is actually loaded | |
| 124 | + onpause, //HTML5 Script to be run when the media is paused either by the user or programmatically | |
| 125 | + onplay, //HTML5 Script to be run when the media is ready to start playing | |
| 126 | + onplaying, //HTML5 Script to be run when the media actually has started playing | |
| 127 | + onprogress, //HTML5 Script to be run when the browser is in the process of getting the media data | |
| 128 | + onratechange, //HTML5 Script to be run each time the playback rate changes (like when a user switches to a slow motion or fast forward mode) | |
| 129 | + onseeked, //HTML5 Script to be run when the seeking attribute is set to false indicating that seeking has ended | |
| 130 | + onseeking, //HTML5 Script to be run when the seeking attribute is set to true indicating that seeking is active | |
| 131 | + onstalled, //HTML5 Script to be run when the browser is unable to fetch the media data for whatever reason | |
| 132 | + onsuspend, //HTML5 Script to be run when fetching the media data is stopped before it is completely loaded for whatever reason | |
| 133 | + ontimeupdate, //HTML5 Script to be run when the playing position has changed (like when the user fast forwards to a different point in the media) | |
| 134 | + onvolumechange, //HTML5 Script to be run each time the volume is changed which (includes setting the volume to "mute") | |
| 135 | + onwaiting, //HTML5 Script to be run when the media has paused but is expected to resume (like when the media pauses to buffer more data) | |
| 136 | + //Misc Events | |
| 137 | + onshow, //HTML5 Fires when a <menu> element is shown as a context menu | |
| 138 | + ontoggle. //HTML5 Fires when the user opens or closes the <details> element | |
| 139 | + | |
| 140 | +public define String | |
| 141 | + to_String | |
| 142 | + ( | |
| 143 | + HtmlEvents e | |
| 144 | + ) = | |
| 145 | + if e is | |
| 146 | + { | |
| 147 | + onafterprint then "onafterprint", //HTML5 Script to be run after the document is printed | |
| 148 | + onbeforeprint then "onbeforeprint", //HTML5 Script to be run before the document is printed | |
| 149 | + onbeforeunload then "onbeforeunload", //HTML5 Script to be run when the document is about to be unloaded | |
| 150 | + onerror then "onerror", //HTML5 Script to be run when an error occurs | |
| 151 | + onhashchange then "onhashchange", //HTML5 Script to be run when there has been changes to the anchor part of the a URL | |
| 152 | + onload then "onload", // Fires after the page is finished loading | |
| 153 | + onmessage then "onmessage", //HTML5 Script to be run when the message is triggered | |
| 154 | + onoffline then "onoffline", //HTML5 Script to be run when the browser starts to work offline | |
| 155 | + ononline then "ononline", //HTML5 Script to be run when the browser starts to work online | |
| 156 | + onpagehide then "onpagehide", //HTML5 Script to be run when a user navigates away from a page | |
| 157 | + onpageshow then "onpageshow", //HTML5 Script to be run when a user navigates to a page | |
| 158 | + onpopstate then "onpopstate", //HTML5 Script to be run when the window's history changes | |
| 159 | + onresize then "onresize", //HTML5 Fires when the browser window is resized | |
| 160 | + onstorage then "onstorage", //HTML5 Script to be run when a Web Storage area is updated | |
| 161 | + onunload then "onunload", // Fires once a page has unloaded (or the browser window has been closed) | |
| 162 | + // Form element events | |
| 163 | + onblur then "onblur", // Fires the moment that the element loses focus | |
| 164 | + onchange then "onchange", // Fires the moment when the value of the element is changed | |
| 165 | + oncontextmenu then "oncontextmenu", //HTML5 Script to be run when a context menu is triggered | |
| 166 | + onfocus then "onfocus", // Fires the moment when the element gets focus | |
| 167 | + oninput then "oninput", //HTML5 Script to be run when an element gets user input | |
| 168 | + oninvalid then "oninvalid", //HTML5 Script to be run when an element is invalid | |
| 169 | + onreset then "onreset", // Fires when the Reset button in a form is clicked | |
| 170 | + onsearch then "onsearch", // Fires when the user writes something in a search field (for <input="search">) | |
| 171 | + onselect then "onselect", // Fires after some text has been selected in an element | |
| 172 | + onsubmit then "onsubmit", // Fires when a form is submitted | |
| 173 | + // Keyboard events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) | |
| 174 | + onkeydown then "onkeydown", // Fires when a user is pressing a key | |
| 175 | + onkeypress then "onkeypress", // Fires when a user presses a key | |
| 176 | + onkeyup then "onkeyup", // Fires when a user releases a key | |
| 177 | + // Mouse events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) | |
| 178 | + onclick then "onclick", // Fires on a mouse click on the element | |
| 179 | + ondblclick then "ondblclick", // Fires on a mouse double-click on the element | |
| 180 | + onmousedown then "onmousedown", // Fires when a mouse button is pressed down on an element | |
| 181 | + onmousemove then "onmousemove", // Fires when the mouse pointer is moving while it is over an element | |
| 182 | + onmouseout then "onmouseout", // Fires when the mouse pointer moves out of an element | |
| 183 | + onmouseover then "onmouseover", // Fires when the mouse pointer moves over an element | |
| 184 | + onmouseup then "onmouseup", // Fires when a mouse button is released over an element | |
| 185 | + onwheel then "onwheel", //HTML5 Fires when the mouse wheel rolls up or down over an element | |
| 186 | + //Drag Events | |
| 187 | + ondrag then "ondrag", //HMTL5 Script to be run when an element is dragged | |
| 188 | + ondragend then "ondragend", //HTML5 Script to be run at the end of a drag operation | |
| 189 | + ondragenter then "ondragenter", //HTML5 Script to be run when an element has been dragged to a valid drop target | |
| 190 | + ondragleave then "ondragleave", //HTML5 Script to be run when an element leaves a valid drop target | |
| 191 | + ondragover then "ondragover", //HTML5 Script to be run when an element is being dragged over a valid drop target | |
| 192 | + ondragstart then "ondragstart", //HTML5 Script to be run at the start of a drag operation | |
| 193 | + ondrop then "ondrop", //HTML5 Script to be run when dragged element is being dropped | |
| 194 | + onscroll then "onscroll", //HTML5 Script to be run when an element's scrollbar is being scrolled | |
| 195 | + //Clipboard Events | |
| 196 | + oncopy then "oncopy", //HTML5 Fires when the user copies the content of an element | |
| 197 | + oncut then "oncut", //HTML5 Fires when the user cuts the content of an element | |
| 198 | + onpaste then "onpaste", //HTML5 Fires when the user pastes some content in an element | |
| 199 | + //Media Events | |
| 200 | + onabort then "onabort", //HTML5 Script to be run on abort | |
| 201 | + oncanplay then "oncanplay", //HTML5 Script to be run when a file is ready to start playing (when it has buffered enough to begin) | |
| 202 | + oncanplaythrough then "oncanplaythrough", //HTML5 Script to be run when a file can be played all the way to the end without pausing for buffering | |
| 203 | + oncuechange then "oncuechange", //HTML5 Script to be run when the cue changes in a <track> element | |
| 204 | + ondurationchange then "ondurationchange", //HTML5 Script to be run when the length of the media changes | |
| 205 | + onemptied then "onemptied", //HTML5 Script to be run when something bad happens and the file is suddenly unavailable (like unexpectedly disconnects) | |
| 206 | + onended then "onended", //HTML5 Script to be run when the media has reach the end (a useful event for messages like "thanks for listening") | |
| 207 | + onerror then "onerror", //HTML5 Script to be run when an error occurs when the file is being loaded | |
| 208 | + onloadeddata then "onloadeddata", //HTML5 Script to be run when media data is loaded | |
| 209 | + onloadedmetadata then "onloadedmetadata", //HTML5 Script to be run when meta data (like dimensions and duration) are loaded | |
| 210 | + onloadstart then "onloadstart", //HTML5 Script to be run just as the file begins to load before anything is actually loaded | |
| 211 | + onpause then "onpause", //HTML5 Script to be run when the media is paused either by the user or programmatically | |
| 212 | + onplay then "onplay", //HTML5 Script to be run when the media is ready to start playing | |
| 213 | + onplaying then "onplaying", //HTML5 Script to be run when the media actually has started playing | |
| 214 | + onprogress then "onprogress", //HTML5 Script to be run when the browser is in the process of getting the media data | |
| 215 | + onratechange then "onratechange", //HTML5 Script to be run each time the playback rate changes (like when a user switches to a slow motion or fast forward mode) | |
| 216 | + onseeked then "onseeked", //HTML5 Script to be run when the seeking attribute is set to false indicating that seeking has ended | |
| 217 | + onseeking then "onseeking", //HTML5 Script to be run when the seeking attribute is set to true indicating that seeking is active | |
| 218 | + onstalled then "onstalled", //HTML5 Script to be run when the browser is unable to fetch the media data for whatever reason | |
| 219 | + onsuspend then "onsuspend", //HTML5 Script to be run when fetching the media data is stopped before it is completely loaded for whatever reason | |
| 220 | + ontimeupdate then "ontimeupdate", //HTML5 Script to be run when the playing position has changed (like when the user fast forwards to a different point in the media) | |
| 221 | + onvolumechange then "onvolumechange", //HTML5 Script to be run each time the volume is changed which (includes setting the volume to "mute") | |
| 222 | + onwaiting then "onwaiting", //HTML5 Script to be run when the media has paused but is expected to resume (like when the media pauses to buffer more data) | |
| 223 | + //Misc Events | |
| 224 | + onshow then "onshow", //HTML5 Fires when a <menu> element is shown as a context menu | |
| 225 | + ontoggle then "ontoggle" | |
| 226 | + }. | |
| 227 | + | |
| 228 | +public type Cross_origin: | |
| 229 | + anonymous, | |
| 230 | + use_credentials | |
| 231 | +. | |
| 232 | + | |
| 233 | +public define String | |
| 234 | + to_String | |
| 235 | + ( | |
| 236 | + Cross_origin c_origin | |
| 237 | + )= | |
| 238 | + if c_origin is | |
| 239 | + { | |
| 240 | + anonymous then "anonymous", | |
| 241 | + use_credentials then "use-credentials" | |
| 242 | + } | |
| 243 | +. | |
| 244 | + | |
| 245 | +public type Referrer_policy: | |
| 246 | + no_referrer, | |
| 247 | + no_referrer_when_downgrade, | |
| 248 | + origin, | |
| 249 | + origin_when_cross_origin, | |
| 250 | + unsafe_url | |
| 251 | +. | |
| 252 | + | |
| 253 | +public define String | |
| 254 | + to_String | |
| 255 | + ( | |
| 256 | + Referrer_policy r_policy | |
| 257 | + )= | |
| 258 | + if r_policy is | |
| 259 | + { | |
| 260 | + no_referrer then "no-referrer", | |
| 261 | + no_referrer_when_downgrade then "no-referrer-when-downgrade", | |
| 262 | + origin then "origin", | |
| 263 | + origin_when_cross_origin then "origin-when-cross-origin", | |
| 264 | + unsafe_url then "unsafe-url" | |
| 265 | + } | |
| 266 | +. | |
| 267 | + | |
| 268 | +public type CSS_File: | |
| 269 | + css_file(String file_name, CSS_File_Media). | |
| 270 | + | |
| 271 | +public type JS_Attribute: | |
| 272 | + async, | |
| 273 | + crossorigin(Cross_origin), //Specifies how the element handles cross-origin requests | |
| 274 | + defer, //Specifies the location of the linked document | |
| 275 | + integrity(String), | |
| 276 | + nomodule(Bool), | |
| 277 | + referrerpolicy(Referrer_policy), //Specifies which referrer to use when fetching the resource | |
| 278 | +// src(String), //Specifies on what device the linked document will be displayed | |
| 279 | + type(String), | |
| 280 | + attr(String, String). | |
| 281 | + | |
| 282 | +public define String | |
| 283 | + to_String | |
| 284 | + ( | |
| 285 | + JS_Attribute attr | |
| 286 | + )= | |
| 287 | + if attr is | |
| 288 | + { | |
| 289 | + async then "async", | |
| 290 | + crossorigin(c_org) then "crossorigin=\""+to_String(c_org)+"\"", //Specifies how the element handles cross-origin requests | |
| 291 | + defer then "defer", //Specifies the location of the linked document | |
| 292 | + integrity(filehash) then "integrity=\""+filehash+"\"", | |
| 293 | + nomodule(value) then "nomodule=\""+if value then "True\"" else "False\"", | |
| 294 | + referrerpolicy(r_pol) then "referrerpolicy=\""+ to_String(r_pol)+ "\"", //Specifies which referrer to use when fetching the resource | |
| 295 | + //src(url) then "src=\""+url+"\"", //Specifies on what device the linked document will be displayed | |
| 296 | + type(_type) then "type=\""+_type+"\"", | |
| 297 | + attr(key, value) then key+"=\""+value+"\"" | |
| 298 | + } | |
| 299 | +. | |
| 300 | + | |
| 301 | +public type JS_File: | |
| 302 | + js_file(String file_name, | |
| 303 | + List(JS_Attribute) attributes). | |
| 304 | + | |
| 305 | +public type Script: | |
| 306 | + script( String script_type, | |
| 307 | + String content). | |
| 308 | + | |
| 309 | +public define JS_File js_file(String file_name) = js_file(file_name, []). | |
| 310 | +public define CSS_File css_file(String file_name)= css_file(file_name, all). | |
| 311 | + | |
| 312 | +public type CoreAttrs:... | |
| 313 | +public type HTML_Partial_Content:... | |
| 314 | +public type HTML_Body:... | |
| 315 | +public type HTML_Off_Form:... | |
| 316 | +public type HTML_tooltip:... | |
| 317 | +public type HTTP_Answer:... | |
| 318 | + | |
| 319 | + | |
| 320 | +public type Text_Option: | |
| 321 | + core_attrs(List(CoreAttrs)), | |
| 322 | + size(Int), // size of character font to use | |
| 323 | + font(String), // name of character font to use (such as "helvetica",...) | |
| 324 | + color(RGB), // color to be used for characters | |
| 325 | + italic, | |
| 326 | + oblique, | |
| 327 | + small_capitals, | |
| 328 | + bold, | |
| 329 | + underlined, | |
| 330 | + left_justified, | |
| 331 | + right_justified, | |
| 332 | + justified, // justified on both sides | |
| 333 | + line_through, | |
| 334 | + nowrap, | |
| 335 | + class(String), //CSS class | |
| 336 | + id(String), | |
| 337 | + style(String), | |
| 338 | + title(String), | |
| 339 | + attr(String, String). | |
| 340 | + | |
| 341 | +public type CSS_Style: | |
| 342 | + text_options(List(Text_Option)). | |
| 343 | + | |
| 344 | +// Following types are define to prohib any arguments order error | |
| 345 | + | |
| 346 | +/** | |
| 347 | + * String value for 'id' attribut | |
| 348 | + */ | |
| 349 | +public type HTML_Id: | |
| 350 | + html_Id(String id). | |
| 351 | + | |
| 352 | +/** | |
| 353 | + * String value for 'class' attribut | |
| 354 | + */ | |
| 355 | +public type HtmlClass: | |
| 356 | + htmlClass(String class). | |
| 357 | + | |
| 358 | +/** | |
| 359 | + * Name used in arguments list when form is submitted. | |
| 360 | + */ | |
| 361 | +public type WebArgName: | |
| 362 | + wan(String name). | |
| 363 | + | |
| 364 | +/** | |
| 365 | + * Value passed to arguments list when form is submitted (for RadioButton and CheckBox). | |
| 366 | + */ | |
| 367 | +public type WebArgValue: | |
| 368 | + wav(String value). | |
| 369 | + | |
| 370 | +/** | |
| 371 | + * Initial value of an input field. | |
| 372 | + */ | |
| 373 | +public type InitialValue: | |
| 374 | + init(String value). | |
| 375 | + | |
| 376 | +public type HTML_Help_Position: | |
| 377 | + left, | |
| 378 | + right | |
| 379 | +. | |
| 380 | + | |
| 381 | +public type HTML_Help: | |
| 382 | + no_help, //no help text available | |
| 383 | + tooltip(HTML_tooltip, | |
| 384 | + HTML_Help_Position) | |
| 385 | +. | |
| 386 | + | |
| 387 | +public type HTML_Label: | |
| 388 | + no_label, | |
| 389 | + label( | |
| 390 | + String text, //label to show | |
| 391 | + HTML_Help help //HTML help (tooltip with ajax call or not) | |
| 392 | + ) | |
| 393 | +. | |
| 394 | + | |
| 395 | +public type InputAttrs: | |
| 396 | + id (String), | |
| 397 | + class (String), | |
| 398 | + style (String), | |
| 399 | + title (String), | |
| 400 | + lang (String), | |
| 401 | + dir (Reading_Way), | |
| 402 | + accesskey (Word8), | |
| 403 | + tabindex (Int), | |
| 404 | + attr (String, String), | |
| 405 | + event (HtmlEvents, String), | |
| 406 | + //HTML5 | |
| 407 | + data (String name, String value). | |
| 408 | + | |
| 409 | +public type TextAreaOption: | |
| 410 | + input_attrs(List(InputAttrs)), | |
| 411 | + disabled, | |
| 412 | + read_only, | |
| 413 | + wrap_lines | |
| 414 | +. | |
| 415 | + | |
| 416 | +public type Actioner_Local_Action: | |
| 417 | + close_window. | |
| 418 | + | |
| 419 | +public type Actioner_Connection: | |
| 420 | + same, // use same type of connection as current page | |
| 421 | + http, // use non secured connection | |
| 422 | + https. // use secured connection | |
| 423 | + | |
| 424 | +public type Other_Window_Option: | |
| 425 | + resizable, // the new window may be resized by the client | |
| 426 | + scrollbars, // the new window has scrollbars | |
| 427 | + width(Int), // the new window has the specified width | |
| 428 | + height(Int). // the new window has the specified height | |
| 429 | + | |
| 430 | +public type Actioner_Target: | |
| 431 | + same, | |
| 432 | + same (String label), | |
| 433 | + other(String window_name, List(Other_Window_Option)). | |
| 434 | + | |
| 435 | +public type Actioner_Aspect: | |
| 436 | + link (List(Text_Option), String text, Maybe(String) name),// hypertext link | |
| 437 | + img_link (List(CoreAttrs),String img_url, String alt_text), | |
| 438 | + push_button (List(CoreAttrs),String text), | |
| 439 | + button (String url_off, String url_on), // rollover button | |
| 440 | + button (String url_off, String url_on, Int w, Int h), // idem with size | |
| 441 | + submit (List(CoreAttrs),String text), | |
| 442 | + immediate_selector (List(CoreAttrs), String name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, Maybe(InitialValue) selected, String onchange_fn), | |
| 443 | + html (List(CoreAttrs), HTML_Off_Form). | |
| 444 | + | |
| 445 | +public define Actioner_Aspect html(HTML_Off_Form content) = html([], content). | |
| 446 | + | |
| 447 | +public type BackgroundOption: | |
| 448 | + repeat, // repeat the background in both directions | |
| 449 | + repeat_horizontal, // repeat the background only horizontally | |
| 450 | + repeat_vertical, // repeat the background only verticall | |
| 451 | + no_repeat, // don't repeat the background | |
| 452 | + center. | |
| 453 | + | |
| 454 | +public type Cell_Option: | |
| 455 | + core_attrs(List(CoreAttrs)), | |
| 456 | + left, // put the content of the cell on the left | |
| 457 | + h_center, // center the content of the cell horizontally | |
| 458 | + right, // put the content of the cell on the right | |
| 459 | + top, // put the content of the cell upwards | |
| 460 | + v_center, // center the content of tye cell vertically, | |
| 461 | + bottom, // put the content of the cell downwards | |
| 462 | + base_line, // align the content vertically according to base lines | |
| 463 | + background_color(RGB), | |
| 464 | + background_image(String url, BackgroundOption), | |
| 465 | + width(Int), // sets a minimal width for the cell | |
| 466 | + percentage_width(Int), | |
| 467 | + height(Int), // sets a minimal height for the cell | |
| 468 | + columns(Int), // lets the cell span over several columns | |
| 469 | + rows(Int), // lets the cell span over several rows | |
| 470 | + nowrap, // do not allow text wrapping within the cell | |
| 471 | + style(String), // in case nothing above is suitable | |
| 472 | + class(String class_name). | |
| 473 | + | |
| 474 | +public type HTML_Cell($T): | |
| 475 | + cell(List(Cell_Option) options, $T content). | |
| 476 | + | |
| 477 | +public type HTML_Footer_Row($T): | |
| 478 | + empty, | |
| 479 | + footer_row(List(Cell_Option) options, List(HTML_Cell($T)) cells). | |
| 480 | + | |
| 481 | +public type HTML_Row($T): | |
| 482 | + empty, | |
| 483 | + row(List(Cell_Option) options, List(HTML_Cell($T)) cells). | |
| 484 | + | |
| 485 | +public type HTML_Header_Cell($T): | |
| 486 | + header_cell(List(Cell_Option) options, $T content). | |
| 487 | + | |
| 488 | +public type HTML_Header_Row($T): | |
| 489 | + empty, | |
| 490 | + header_row(List(Cell_Option) options, List(HTML_Header_Cell($T)) cells). | |
| 491 | + | |
| 492 | + | |
| 493 | +public type Table_Option: | |
| 494 | + core_attrs(List(CoreAttrs)), | |
| 495 | + background_color(RGB), // applied to all cells in the table | |
| 496 | + background_image(String url), | |
| 497 | + border(Int width_of_outer_edge, // if not present, all values are 0 | |
| 498 | + Int width_of_top_of_relief, | |
| 499 | + Int width_of_inner_edge, | |
| 500 | + RGB border_color), | |
| 501 | + width(Int), // sets a minimal width for the table | |
| 502 | + percentage_width(Int), | |
| 503 | + attr(String name, String value), | |
| 504 | + class(String class_name). | |
| 505 | + | |
| 506 | + | |
| 507 | +public type HTML_In_Form: | |
| 508 | + empty, | |
| 509 | + literal_pt (Printable_tree), | |
| 510 | + literal (String), | |
| 511 | + sequence (List(HTML_In_Form) items), | |
| 512 | + text (List(CoreAttrs), String the_text), | |
| 513 | + preformated (List(Text_Option), String), | |
| 514 | + paragraph (List(Text_Option), List(HTML_In_Form) content), | |
| 515 | + image (List(CoreAttrs), String url, String alternate), | |
| 516 | + image (List(CoreAttrs), String url, String alternate, Int width, Int height), | |
| 517 | + table (List(Table_Option), HTML_Header_Row(HTML_In_Form), List(HTML_Row(HTML_In_Form)), HTML_Footer_Row(HTML_In_Form)), | |
| 518 | + center (HTML_In_Form), | |
| 519 | + mail_to (String email, HTML_In_Form element), | |
| 520 | + scroller (Int width, Int height, | |
| 521 | + Int content_width, Int content_height, | |
| 522 | + HTML_In_Form content), | |
| 523 | + actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, | |
| 524 | + WEB_Action_Name action_name, List((String,String)) extra_ops, | |
| 525 | + List(Actioner_Local_Action)), | |
| 526 | + foreign_link_new (Actioner_Target, Actioner_Aspect, String url), | |
| 527 | + foreign_link (List(Text_Option), String url), | |
| 528 | + foreign_link (List(Text_Option), String url, String name), | |
| 529 | + private_download (String abs_path, String name, String extra_ext, | |
| 530 | + Maybe((String,List((String,String)))) action), | |
| 531 | + text_input (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), | |
| 532 | + text_input_ro (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), | |
| 533 | + password_input (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), | |
| 534 | + text_area (List(TextAreaOption), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width, Int height), | |
| 535 | + file_upload (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int width), | |
| 536 | + selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices), | |
| 537 | + selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices, InitialValue selected), | |
| 538 | + // List((String,String)) = List((code,name)) where : | |
| 539 | + // code is the web-arg value | |
| 540 | + // name appears in selector | |
| 541 | + selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices), | |
| 542 | + selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, InitialValue selected), | |
| 543 | + radio_button (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, WebArgValue value, Bool checked), | |
| 544 | + radio_button_r (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, WebArgValue value, Bool checked), | |
| 545 | + check_box (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Bool checked), | |
| 546 | + check_box_r (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Bool checked), | |
| 547 | + div (List(CoreAttrs), List(HTML_In_Form) content), | |
| 548 | + div_empty (List(CoreAttrs)), | |
| 549 | + hidden (HTML_Id id, WebArgName name, WebArgValue value), | |
| 550 | + partial (HTML_Partial_Content), | |
| 551 | + br, | |
| 552 | + progress (List(CoreAttrs), Int value, Int max), | |
| 553 | + ol (List(CoreAttrs), List(HTML_In_Form) content), | |
| 554 | + ul (List(CoreAttrs), List(HTML_In_Form) content), | |
| 555 | + li (List(CoreAttrs), List(HTML_In_Form) content), | |
| 556 | + button (List(CoreAttrs), List(HTML_In_Form) content), | |
| 557 | + i (List(CoreAttrs), String text), | |
| 558 | + span (List(CoreAttrs), String text), | |
| 559 | + hr (List(CoreAttrs)) | |
| 560 | +. | |
| 561 | + | |
| 562 | +public type HTML_Size: | |
| 563 | + absolute(Int), // in pixels | |
| 564 | + percentage(Int). | |
| 565 | + | |
| 566 | +public type A_href: | |
| 567 | + href(String href), | |
| 568 | + href(WEB_Action_Name action, List((String,String)) extra_ops) | |
| 569 | +. | |
| 570 | + | |
| 571 | +public define A_href | |
| 572 | + href | |
| 573 | + ( | |
| 574 | + WEB_Action_Name action, | |
| 575 | + (String,String) extra_ops | |
| 576 | + )= | |
| 577 | + href(action, [extra_ops]) | |
| 578 | +. | |
| 579 | + | |
| 580 | +public type A_target: | |
| 581 | + _blank, | |
| 582 | + _self, | |
| 583 | + _parent, | |
| 584 | + _top, | |
| 585 | + framename(String name) | |
| 586 | +. | |
| 587 | + | |
| 588 | + | |
| 589 | +public type HTML_Off_Form: | |
| 590 | + a (List(CoreAttrs), A_href, A_target, List(HTML_Off_Form) content), | |
| 591 | + empty, | |
| 592 | + literal_pt (Printable_tree), | |
| 593 | + literal (String), | |
| 594 | + sequence (List(HTML_Off_Form) items), | |
| 595 | + text (List(CoreAttrs), String the_text), | |
| 596 | + | |
| 597 | + //table (List(Table_Option), HTML_Header_Row(HTML_Off_Form), List(HTML_Row(HTML_Off_Form)), HTML_Footer_Row(HTML_Off_Form)), | |
| 598 | + | |
| 599 | + actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, | |
| 600 | + WEB_Action_Name action_name, List((String,String)) extra_ops, | |
| 601 | + List(Actioner_Local_Action)), | |
| 602 | + actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, | |
| 603 | + WEB_Action_Name action_name, List((String,String)) extra_ops, | |
| 604 | + List(Actioner_Local_Action), String form_name), | |
| 605 | + foreign_link_new (Actioner_Target, Actioner_Aspect, String url), | |
| 606 | + //foreign_link (List(Text_Option), String url), | |
| 607 | + foreign_link (List(Text_Option), String url, String name), | |
| 608 | + private_download (String abs_path, String name, String extra_ext, | |
| 609 | + Maybe((String,List((String,String)))) action), | |
| 610 | + //label (String name), | |
| 611 | + //form (HTML_Id form_id, List(CoreAttrs), List(HTML_In_Form) content), | |
| 612 | +// form (HTML_Id form_id, List(CoreAttrs), | |
| 613 | +// WEB_Action_Name action, List((String,String)) extra_ops, | |
| 614 | +// List(HTML_In_Form) content), | |
| 615 | + //in_form (HTML_Id form_id, HTML_In_Form content), | |
| 616 | + div (List(CoreAttrs), List(HTML_Partial_Content) p_content), | |
| 617 | + iframe (List(CoreAttrs), | |
| 618 | + List(CSS_Style) /*styles*/, | |
| 619 | + List(CSS_File) /*css_files*/, | |
| 620 | + List(JS_File) /*js_files*/, | |
| 621 | + HTML_Body /*body*/), | |
| 622 | + partial (HTML_Partial_Content), | |
| 623 | + //progress (List(CoreAttrs), Int value, Int max), | |
| 624 | + //i (List(CoreAttrs), String text), | |
| 625 | + html_tag (String tag_name, List(CoreAttrs), List(HTML_Off_Form) content), | |
| 626 | + html_void_tag (String tag_name, List(CoreAttrs)) | |
| 627 | +. | |
| 628 | + | |
| 629 | + | |
| 630 | +public type Rel_attr: | |
| 631 | + alternate, | |
| 632 | + author, | |
| 633 | + dns_prefetch, | |
| 634 | + help, | |
| 635 | + icon, | |
| 636 | + license, | |
| 637 | + next, | |
| 638 | + pingback, | |
| 639 | + preconnect, | |
| 640 | + prefetch, | |
| 641 | + preload, | |
| 642 | + prerender, | |
| 643 | + prev, | |
| 644 | + search, | |
| 645 | + stylesheet | |
| 646 | +. | |
| 647 | + | |
| 648 | +public define String | |
| 649 | + to_String | |
| 650 | + ( | |
| 651 | + Rel_attr r_attr | |
| 652 | + )= | |
| 653 | + if r_attr is | |
| 654 | + { | |
| 655 | + alternate then "alternate", | |
| 656 | + author then "author", | |
| 657 | + dns_prefetch then "dns_prefetch", | |
| 658 | + help then "help", | |
| 659 | + icon then "icon", | |
| 660 | + license then "license", | |
| 661 | + next then "next", | |
| 662 | + pingback then "pingback", | |
| 663 | + preconnect then "preconnect", | |
| 664 | + prefetch then "prefetch", | |
| 665 | + preload then "preload", | |
| 666 | + prerender then "prerender", | |
| 667 | + prev then "prev", | |
| 668 | + search then "search", | |
| 669 | + stylesheet then "stylesheet" | |
| 670 | + } | |
| 671 | +. | |
| 672 | + | |
| 673 | +public type Link_attr: | |
| 674 | + crossorigin(Cross_origin), //Specifies how the element handles cross-origin requests | |
| 675 | + href(String), //Specifies the location of the linked document | |
| 676 | + media(String), //Specifies on what device the linked document will be displayed | |
| 677 | + referrerpolicy(Referrer_policy), //Specifies which referrer to use when fetching the resource | |
| 678 | + rel(Rel_attr), | |
| 679 | + sizes(String), | |
| 680 | + type(String), | |
| 681 | + as(String), | |
| 682 | + integrity(String), | |
| 683 | + event(HtmlEvents, String) | |
| 684 | +. | |
| 685 | + | |
| 686 | +public define String | |
| 687 | + to_String | |
| 688 | + ( | |
| 689 | + Link_attr attr | |
| 690 | + )= | |
| 691 | + if attr is | |
| 692 | + { | |
| 693 | + crossorigin(c_origin) then "crossorigin=\""+to_String(c_origin)+"\"", | |
| 694 | + href(url) then "href=\""+url+"\"", | |
| 695 | + media(media) then "media=\""+media+"\"", | |
| 696 | + referrerpolicy(r_policy) then "referrerpolicy=\""+to_String(r_policy)+"\"", | |
| 697 | + rel(rel_attr) then "rel=\""+to_String(rel_attr)+"\"", | |
| 698 | + sizes(_sizes) then "sizes=\""+_sizes+"\"", | |
| 699 | + type(_type) then "type=\""+_type+"\"", | |
| 700 | + as(_as) then "as=\""+_as+"\"", | |
| 701 | + integrity(_integrity) then "integrity=\""+_integrity+"\"", | |
| 702 | + event(_event, code) then to_String(_event)+"=\""+code+"\"", | |
| 703 | + } | |
| 704 | +. | |
| 705 | + | |
| 706 | +public define String | |
| 707 | + to_String | |
| 708 | + ( | |
| 709 | + List(Link_attr) attrs | |
| 710 | + )= | |
| 711 | + join(" ", map((Link_attr attr) |-> | |
| 712 | + to_String(attr), | |
| 713 | + attrs)) | |
| 714 | +. | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | +public type HTML_Meta: | |
| 719 | + keywords (List(String)), | |
| 720 | + refresh (Actioner_Connection connection, | |
| 721 | + Actioner_Target target, | |
| 722 | + WEB_Action_Name action, | |
| 723 | + Int delay), // in seconds | |
| 724 | + refresh (String url, Int delay), // in seconds | |
| 725 | + meta (String name, String content), | |
| 726 | + http_equiv (String name, String content), | |
| 727 | + generic_meta (List((String,String))), | |
| 728 | + literal (String). | |
| 729 | + | |
| 730 | +public type HTML_Head_Tag: | |
| 731 | + meta(HTML_Meta), | |
| 732 | + title(String), | |
| 733 | + js(JS_File), | |
| 734 | + js_inline(Script), | |
| 735 | + css(CSS_File), | |
| 736 | + css_inline(String css_styles), /* Note: <style> and </style> tags are not necessaries */ | |
| 737 | + link(List(Link_attr) link_attrs) | |
| 738 | +. | |
| 739 | + | |
| 740 | +public type HTML_Partial_Content: | |
| 741 | + partial_content | |
| 742 | + ( | |
| 743 | + List(HTML_Head_Tag), | |
| 744 | + HTML_Off_Form | |
| 745 | + ) | |
| 746 | +. | |
| 747 | + | |
| 748 | +public type HTML_Body: | |
| 749 | + body(List(CoreAttrs) attrs, List(HTML_Off_Form) content). | |
| 750 | + | |
| 751 | +public define HTML_Body | |
| 752 | + body | |
| 753 | + ( | |
| 754 | + List(CoreAttrs) attrs, | |
| 755 | + HTML_Off_Form content | |
| 756 | + )= | |
| 757 | + body(attrs, [content]) | |
| 758 | +. | |
| 759 | + | |
| 760 | +public define HTML_Body | |
| 761 | + body | |
| 762 | + ( | |
| 763 | + CoreAttrs attr, | |
| 764 | + HTML_Off_Form content | |
| 765 | + )= | |
| 766 | + body([attr], [content]) | |
| 767 | +. | |
| 768 | + | |
| 769 | +public define HTML_Body | |
| 770 | + body | |
| 771 | + ( | |
| 772 | + CoreAttrs attr, | |
| 773 | + List(HTML_Off_Form) content | |
| 774 | + )= | |
| 775 | + body([attr], content) | |
| 776 | +. | |
| 777 | + | |
| 778 | +public define HTML_Body | |
| 779 | + body | |
| 780 | + ( | |
| 781 | + HTML_Off_Form content | |
| 782 | + )= | |
| 783 | + body([], [content]) | |
| 784 | +. | |
| 785 | + | |
| 786 | + | |
| 787 | +public type HTML_tooltip: | |
| 788 | + html_tooltip | |
| 789 | + ( | |
| 790 | + String title, | |
| 791 | + String keyword, | |
| 792 | + Int width, | |
| 793 | + ), | |
| 794 | + html_tooltip_ext | |
| 795 | + ( | |
| 796 | + String title, | |
| 797 | + String extend_type, | |
| 798 | + String class_suffix, | |
| 799 | + List((String, String)) ext_args | |
| 800 | + ), | |
| 801 | + html_tooltip_ext //same without class suffix. This means we use awesome font | |
| 802 | + ( | |
| 803 | + String title, | |
| 804 | + String extend_type, | |
| 805 | + List((String, String)) ext_args | |
| 806 | + ), | |
| 807 | + html_tooltip | |
| 808 | + ( | |
| 809 | + String title, | |
| 810 | + WEB_Action_Name wan, | |
| 811 | + List((String, String)) ext_args | |
| 812 | + ). | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | +public type CoreAttrs: | |
| 817 | + empty, | |
| 818 | + id (String), //A unique identifier for the element. | |
| 819 | + //There must not be multiple elements in a document that have the same id value. | |
| 820 | + class (String), //A name of a classification, or list of names of classifications, to which the element belongs | |
| 821 | + style (String), //Specifies zero or more CSS declarations that apply to the element [CSS]. | |
| 822 | + title (String), //Advisory information associated with the element. | |
| 823 | + lang (String), //Specifies the primary language for the contents of the element and for any of the element’s attributes that contain text. | |
| 824 | + dir (Reading_Way), //Specifies the element’s text directionality. | |
| 825 | + accesskey (Word8), //A key label or list of key labels with which to associate the element; each key label represents | |
| 826 | + //a keyboard shortcut which UAs can use to activate the element or give focus to the element. | |
| 827 | + tabindex (Int), //Specifies whether the element represents an element that is is focusable (that is, an element which is part of the | |
| 828 | + //sequence of focusable elements in the document), and the relative order of the element in the sequence of focusable | |
| 829 | + //elements in the document. | |
| 830 | + //Anubis specific | |
| 831 | + attr (String, String), //intended to provide unknown attritute | |
| 832 | + bool_attr (Bool, String), //like checked in checkbox the attribute 'checked' is here if true else nothing | |
| 833 | + event (HtmlEvents, String), | |
| 834 | + tooltip (HTML_tooltip), | |
| 835 | + | |
| 836 | + //HTML5 | |
| 837 | + data (String name, String value), | |
| 838 | + contenteditable(Bool), //Specifies whether the contents of the element are editable | |
| 839 | + contextmenu(String), //Identifies a menu with which to associate the element as a context menu. | |
| 840 | + draggable(Bool), //Specifies whether the element is draggable. | |
| 841 | + enterkeyhint(String), //Specifies the text of the enter-key on a virtual keyboard | |
| 842 | + hidden(Bool), //Specifies that the element represents an element that is not yet, or is no longer, relevant. | |
| 843 | + inert, //Specifies that the browser should ignore this section | |
| 844 | + inputmode(String), //Specifies the mode of a virtual keyboard | |
| 845 | + popover, //Specifies a popover element | |
| 846 | + spellcheck(Bool), //Specifies whether the element represents an element whose contents are subject to spell checking and grammar checking. | |
| 847 | + translate(Bool) //Specifies whether the content of an element should be translated or not | |
| 848 | +. | |
| 849 | + | |
| 850 | +public define CoreAttrs colspan(Int value) = attr("colspan", to_String(value)). | |
| 851 | +public define CoreAttrs rowspan(Int value) = attr("rowspan", to_String(value)). | |
| 852 | +public define CoreAttrs headers(String header_id) = attr("headers", header_id). | |
| 853 | +public define CoreAttrs width(Int value) = attr("width", to_String(value)). | |
| 854 | +public define CoreAttrs height(Int value) = attr("height", to_String(value)). | |
| 855 | +public define CoreAttrs width_px(Int value) = attr("width", to_String(value)+"px"). | |
| 856 | +public define CoreAttrs height_px(Int value) = attr("height", to_String(value)+"px"). | |
| 857 | +public define CoreAttrs alt(String value) = attr("alt", value). | |
| 858 | +public define CoreAttrs size(Int value) = attr("size", to_String(value)). | |
| 859 | + | |
| 860 | +public define CoreAttrs boolean(String name) = attr(name, name). | |
| 861 | + | |
| 862 | +public type HTTP_Answer: | |
| 863 | + html_page (HTTP_Status /*http_status*/, | |
| 864 | + List(HTML_Head_Tag) /*html <head> tags*/, | |
| 865 | + HTML_Body /*body*/), | |
| 866 | + html_page (HTTP_Status /*http_status*/, | |
| 867 | + String /*title*/, | |
| 868 | + List(HTML_Head_Tag) /*meta_tags*/, | |
| 869 | + List(CSS_Style) /*styles*/, | |
| 870 | + List(CSS_File) /*css_files*/, | |
| 871 | + List(JS_File) /*js_files*/, | |
| 872 | + List(Script) /*script*/, | |
| 873 | + HTML_Body /*body*/), | |
| 874 | + plain_text (HTTP_Status /*http_status*/, | |
| 875 | + String /*text*/), | |
| 876 | + custom_text (HTTP_Status /*http_status*/, | |
| 877 | + MIME /*mime_type*/, | |
| 878 | + String /*content*/), | |
| 879 | + custom_binary(HTTP_Status /*http_status*/, | |
| 880 | + MIME /*mime_type*/, | |
| 881 | + ByteArray /*content*/, | |
| 882 | + List(HTTP_header)/*other headers*/), | |
| 883 | + custom_tree (HTTP_Status /*http_status*/, | |
| 884 | + MIME /*mime_type*/, | |
| 885 | + Printable_tree /*content*/), | |
| 886 | + json (HTTP_Status, /*http_status*/ | |
| 887 | + JsonValue), /*json value*/ | |
| 888 | + send_file ( String file_path, //file to send to client. //TODO add call back for before, during, after send | |
| 889 | + Content_Disposition c_disposition), | |
| 890 | + http_raw (Printable_tree), | |
| 891 | + html_content (HTTP_Status /*http_status*/, | |
| 892 | + HTML_Off_Form), | |
| 893 | + html_partial_content (HTTP_Status /*http_status*/, | |
| 894 | + HTML_Partial_Content) | |
| 895 | +. | |
| 896 | + | |
| 897 | +public define HTTP_Answer | |
| 898 | + no_content | |
| 899 | + = | |
| 900 | + plain_text(http_no_content, "") | |
| 901 | +. | |
| 902 | + | |
| 903 | + | ... | ... |
web/types/web_stepper.anubis
| ... | ... | @@ -71,8 +71,8 @@ public type WEB_Step: |
| 71 | 71 | String thread, //thread name like general, VoIP, etc. |
| 72 | 72 | List(WEB_Step) childs, |
| 73 | 73 | (WEB_Step_Session stp_session) -> WEB_Step_Status status, //return the step status |
| 74 | - (WEB_Step_Session stp_session, (String)->String _T) -> HTML_Partial_Content view, //return the view according to WEB_Step_Session | |
| 75 | - (WEB_Step_Session stp_session, (String)->String _T) -> HTML_Partial_Content buttons, | |
| 74 | + (WEB_Step_Session stp_session, (String)->String _T) -> HTML view, //return the view according to WEB_Step_Session | |
| 75 | + (WEB_Step_Session stp_session, (String)->String _T) -> HTML buttons, | |
| 76 | 76 | (WEB_Step_Session stp_session, WEB_Session web_session) -> WEB_Step_Session submit, |
| 77 | 77 | ) |
| 78 | 78 | . | ... | ... |
web/web_stepper.anubis
| ... | ... | @@ -85,7 +85,7 @@ public define Maybe(WEB_Step) |
| 85 | 85 | } |
| 86 | 86 | . |
| 87 | 87 | |
| 88 | -public define HTML_Partial_Content | |
| 88 | +public define HTML | |
| 89 | 89 | web_stepper_button |
| 90 | 90 | ( |
| 91 | 91 | WEB_Step _step, |
| ... | ... | @@ -97,7 +97,7 @@ public define HTML_Partial_Content |
| 97 | 97 | _step.buttons(stp_session, _T))) |
| 98 | 98 | . |
| 99 | 99 | |
| 100 | -public define HTML_Partial_Content | |
| 100 | +public define HTML | |
| 101 | 101 | web_stepper_main_view |
| 102 | 102 | ( |
| 103 | 103 | WEB_Step _step, |
| ... | ... | @@ -109,7 +109,7 @@ public define HTML_Partial_Content |
| 109 | 109 | _step.view(stp_session, _T))) |
| 110 | 110 | . |
| 111 | 111 | |
| 112 | -public define HTML_Partial_Content | |
| 112 | +public define HTML | |
| 113 | 113 | web_stepper_message |
| 114 | 114 | ( |
| 115 | 115 | WEB_Step_Session stp_session, |
| ... | ... | @@ -125,7 +125,7 @@ public define HTML_Partial_Content |
| 125 | 125 | show_page_message(page_msg))) |
| 126 | 126 | . |
| 127 | 127 | |
| 128 | -public define HTML_Partial_Content | |
| 128 | +public define HTML | |
| 129 | 129 | web_stepper_full_description |
| 130 | 130 | ( |
| 131 | 131 | WEB_Step current_step, |
| ... | ... | @@ -157,7 +157,7 @@ public define Bool |
| 157 | 157 | step.index < current_step.index |
| 158 | 158 | . |
| 159 | 159 | |
| 160 | -public define HTML_Partial_Content | |
| 160 | +public define HTML | |
| 161 | 161 | web_stepper_crumble |
| 162 | 162 | ( |
| 163 | 163 | WEB_Stepper _stepper, |
| ... | ... | @@ -196,7 +196,7 @@ public define HTML_Partial_Content |
| 196 | 196 | ) |
| 197 | 197 | . |
| 198 | 198 | |
| 199 | -public define HTML_Partial_Content | |
| 199 | +public define HTML | |
| 200 | 200 | web_stepper_view |
| 201 | 201 | ( |
| 202 | 202 | WEB_Stepper _stepper, |
| ... | ... | @@ -227,7 +227,7 @@ public define HTML_Partial_Content |
| 227 | 227 | |
| 228 | 228 | . |
| 229 | 229 | |
| 230 | -public define HTML_Partial_Content | |
| 230 | +public define HTML | |
| 231 | 231 | web_stepper_view |
| 232 | 232 | ( |
| 233 | 233 | WEB_Stepper stepper, |
| ... | ... | @@ -316,7 +316,7 @@ public define WEB_Controller_Result |
| 316 | 316 | } |
| 317 | 317 | . |
| 318 | 318 | |
| 319 | -public define HTML_Partial_Content | |
| 319 | +public define HTML | |
| 320 | 320 | stepper_submit_button |
| 321 | 321 | ( |
| 322 | 322 | String label, |
| ... | ... | @@ -328,7 +328,7 @@ public define HTML_Partial_Content |
| 328 | 328 | jquery_button(jquery_img_button(icn16_check, label, "", jQuery_actioner(same, jqscript("stepper_submit("+url+");")), left)) |
| 329 | 329 | . |
| 330 | 330 | |
| 331 | -public define HTML_Partial_Content | |
| 331 | +public define HTML | |
| 332 | 332 | stepper_submit_button |
| 333 | 333 | ( |
| 334 | 334 | String label, | ... | ... |
web/widgets.anubis
| ... | ... | @@ -11,7 +11,7 @@ read tools/basis.anubis |
| 11 | 11 | |
| 12 | 12 | read xlib/web/making_a_web_site.anubis |
| 13 | 13 | |
| 14 | -public define HTML_In_Form | |
| 14 | +public define HTML | |
| 15 | 15 | ip_input |
| 16 | 16 | ( |
| 17 | 17 | HTML_Id the_id, |
| ... | ... | @@ -36,7 +36,7 @@ public define HTML_In_Form |
| 36 | 36 | |
| 37 | 37 | // --------------------------------------------------------------------------- |
| 38 | 38 | |
| 39 | -public define HTML_In_Form | |
| 39 | +public define HTML | |
| 40 | 40 | partial_ip_input |
| 41 | 41 | ( |
| 42 | 42 | HTML_Id the_id, | ... | ... |
web/widgets/button.anubis
| ... | ... | @@ -18,7 +18,7 @@ read tools/printable_tree.anubis |
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | -public define HTML_Partial_Content | |
| 21 | +public define HTML | |
| 22 | 22 | img_button_flink |
| 23 | 23 | ( |
| 24 | 24 | String img_path, |
| ... | ... | @@ -26,9 +26,9 @@ public define HTML_Partial_Content |
| 26 | 26 | Actioner_Target target, |
| 27 | 27 | String url |
| 28 | 28 | )= |
| 29 | - partial_content(foreign_link_new(target, img_link(core_attrs, img_path, ""), url)). | |
| 29 | + foreign_link_new(target, img_link(core_attrs, img_path, ""), url). | |
| 30 | 30 | |
| 31 | -public define HTML_Partial_Content | |
| 31 | +public define HTML | |
| 32 | 32 | img_button_flink |
| 33 | 33 | ( |
| 34 | 34 | String img_path, |
| ... | ... | @@ -37,7 +37,7 @@ public define HTML_Partial_Content |
| 37 | 37 | )= |
| 38 | 38 | img_button_flink(img_path, [], target, url). |
| 39 | 39 | |
| 40 | -public define HTML_Partial_Content | |
| 40 | +public define HTML | |
| 41 | 41 | img_button_flink |
| 42 | 42 | ( |
| 43 | 43 | String img_path, |
| ... | ... | @@ -45,7 +45,7 @@ public define HTML_Partial_Content |
| 45 | 45 | )= |
| 46 | 46 | img_button_flink(img_path, [], same, url). |
| 47 | 47 | |
| 48 | -public define HTML_Partial_Content | |
| 48 | +public define HTML | |
| 49 | 49 | img_button |
| 50 | 50 | ( |
| 51 | 51 | String img_path, |
| ... | ... | @@ -54,10 +54,10 @@ public define HTML_Partial_Content |
| 54 | 54 | WEB_Action_Name url, |
| 55 | 55 | List((String, String)) extra_ops |
| 56 | 56 | )= |
| 57 | - partial_content(actioner(same, target, img_link(core_attrs+[style("cursor: pointer")], img_path, ""), url, extra_ops)). | |
| 57 | + actioner(same, target, img_link(core_attrs+[style("cursor: pointer")], img_path, ""), url, extra_ops). | |
| 58 | 58 | |
| 59 | 59 | |
| 60 | -public define HTML_Partial_Content | |
| 60 | +public define HTML | |
| 61 | 61 | img_button |
| 62 | 62 | ( |
| 63 | 63 | String img_path, |
| ... | ... | @@ -66,9 +66,9 @@ public define HTML_Partial_Content |
| 66 | 66 | String url, |
| 67 | 67 | List((String, String)) extra_ops |
| 68 | 68 | )= |
| 69 | - partial_content(actioner(same, target, img_link(core_attrs+[style("cursor: pointer")], img_path, ""), action_name(url), extra_ops)). | |
| 69 | + actioner(same, target, img_link(core_attrs+[style("cursor: pointer")], img_path, ""), action_name(url), extra_ops). | |
| 70 | 70 | |
| 71 | -public define HTML_Partial_Content | |
| 71 | +public define HTML | |
| 72 | 72 | img_button |
| 73 | 73 | ( |
| 74 | 74 | String img_path, |
| ... | ... | @@ -76,7 +76,7 @@ public define HTML_Partial_Content |
| 76 | 76 | )= |
| 77 | 77 | img_button(img_path, [], same, url, []). |
| 78 | 78 | |
| 79 | -public define HTML_Partial_Content | |
| 79 | +public define HTML | |
| 80 | 80 | img_button_ajax |
| 81 | 81 | ( |
| 82 | 82 | String img_path, |
| ... | ... | @@ -85,10 +85,10 @@ public define HTML_Partial_Content |
| 85 | 85 | )= |
| 86 | 86 | |
| 87 | 87 | with event_click = (CoreAttrs)event(onclick, "Xlib.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")"), |
| 88 | - partial_content(img([event_click, style("cursor: pointer")], img_path)) | |
| 88 | + img([event_click, style("cursor: pointer")], img_path) | |
| 89 | 89 | . |
| 90 | 90 | |
| 91 | -public define HTML_Partial_Content | |
| 91 | +public define HTML | |
| 92 | 92 | img_button_load_page |
| 93 | 93 | ( |
| 94 | 94 | String img_path, |
| ... | ... | @@ -96,13 +96,13 @@ public define HTML_Partial_Content |
| 96 | 96 | WEB_Action_Name web_action, |
| 97 | 97 | List((String, String)) extra_args |
| 98 | 98 | )= |
| 99 | - partial_content( | |
| 99 | + | |
| 100 | 100 | img([ event(onclick, load_page(web_action, extra_args)), |
| 101 | 101 | style("cursor: pointer") . core_attrs |
| 102 | - ], img_path)) | |
| 102 | + ], img_path) | |
| 103 | 103 | . |
| 104 | 104 | |
| 105 | -public define HTML_Partial_Content | |
| 105 | +public define HTML | |
| 106 | 106 | img_button_load_page |
| 107 | 107 | ( |
| 108 | 108 | String img_path, |
| ... | ... | @@ -112,7 +112,7 @@ public define HTML_Partial_Content |
| 112 | 112 | img_button_load_page(img_path, [], web_action, extra_args) |
| 113 | 113 | . |
| 114 | 114 | |
| 115 | -public define HTML_Partial_Content | |
| 115 | +public define HTML | |
| 116 | 116 | img_button_load_page |
| 117 | 117 | ( |
| 118 | 118 | String img_path, |
| ... | ... | @@ -122,7 +122,7 @@ public define HTML_Partial_Content |
| 122 | 122 | img_button_load_page(img_path, core_attrs, web_action, []) |
| 123 | 123 | . |
| 124 | 124 | |
| 125 | -public define HTML_Partial_Content | |
| 125 | +public define HTML | |
| 126 | 126 | img_button_load_page |
| 127 | 127 | ( |
| 128 | 128 | String img_path, |
| ... | ... | @@ -132,7 +132,7 @@ public define HTML_Partial_Content |
| 132 | 132 | . |
| 133 | 133 | |
| 134 | 134 | |
| 135 | -public define HTML_Partial_Content | |
| 135 | +public define HTML | |
| 136 | 136 | img_button |
| 137 | 137 | ( |
| 138 | 138 | String img_path, |
| ... | ... | @@ -143,13 +143,12 @@ public define HTML_Partial_Content |
| 143 | 143 | Bool replace, |
| 144 | 144 | Bool overlay |
| 145 | 145 | )= |
| 146 | - partial_content( | |
| 147 | 146 | img([ event(onclick, load_content(target, web_action, extra_args, replace, overlay)), |
| 148 | 147 | style("cursor: pointer") . core_attrs |
| 149 | - ], img_path)) | |
| 148 | + ], img_path) | |
| 150 | 149 | . |
| 151 | 150 | |
| 152 | -public define HTML_Partial_Content | |
| 151 | +public define HTML | |
| 153 | 152 | img_button |
| 154 | 153 | ( |
| 155 | 154 | String img_path, |
| ... | ... | @@ -161,7 +160,7 @@ public define HTML_Partial_Content |
| 161 | 160 | img_button(img_path, [], web_action, extra_args, target, replace, true) |
| 162 | 161 | . |
| 163 | 162 | |
| 164 | -public define HTML_Partial_Content | |
| 163 | +public define HTML | |
| 165 | 164 | img_button |
| 166 | 165 | ( |
| 167 | 166 | String img_path, |
| ... | ... | @@ -172,7 +171,7 @@ public define HTML_Partial_Content |
| 172 | 171 | img_button(img_path, [], web_action, extra_args, target, false, true) |
| 173 | 172 | . |
| 174 | 173 | |
| 175 | -public define HTML_Partial_Content | |
| 174 | +public define HTML | |
| 176 | 175 | img_button |
| 177 | 176 | ( |
| 178 | 177 | String img_path, |
| ... | ... | @@ -181,7 +180,7 @@ public define HTML_Partial_Content |
| 181 | 180 | )= |
| 182 | 181 | img_button(img_path, [], same, web_action, extra_ops). |
| 183 | 182 | |
| 184 | -public define HTML_Partial_Content | |
| 183 | +public define HTML | |
| 185 | 184 | img_button |
| 186 | 185 | ( |
| 187 | 186 | String img_path, |
| ... | ... | @@ -189,7 +188,7 @@ public define HTML_Partial_Content |
| 189 | 188 | )= |
| 190 | 189 | img_button(img_path, [], same, web_action, []). |
| 191 | 190 | |
| 192 | -public define HTML_Partial_Content | |
| 191 | +public define HTML | |
| 193 | 192 | img_button |
| 194 | 193 | ( |
| 195 | 194 | String img_path, |
| ... | ... | @@ -198,7 +197,7 @@ public define HTML_Partial_Content |
| 198 | 197 | )= |
| 199 | 198 | img_button(img_path, [], same, url, extra_ops). |
| 200 | 199 | |
| 201 | -public define HTML_Partial_Content | |
| 200 | +public define HTML | |
| 202 | 201 | img_button |
| 203 | 202 | ( |
| 204 | 203 | String img_path, |
| ... | ... | @@ -208,7 +207,7 @@ public define HTML_Partial_Content |
| 208 | 207 | )= |
| 209 | 208 | img_button(img_path, core_attrs, same, url, extra_ops). |
| 210 | 209 | |
| 211 | -public define HTML_Partial_Content | |
| 210 | +public define HTML | |
| 212 | 211 | img_button_load_dialog |
| 213 | 212 | ( |
| 214 | 213 | String img_path, |
| ... | ... | @@ -264,7 +263,7 @@ define List(CoreAttrs) |
| 264 | 263 | |
| 265 | 264 | core_attrs + [id(uid), style("cursor: pointer"), event(onclick, "Xlib.make_confirm_dialog(this, "+ ok_action +");")]. |
| 266 | 265 | |
| 267 | -public define HTML_Partial_Content | |
| 266 | +public define HTML | |
| 268 | 267 | img_button_confirm |
| 269 | 268 | ( |
| 270 | 269 | String img_path, |
| ... | ... | @@ -277,10 +276,10 @@ public define HTML_Partial_Content |
| 277 | 276 | )= |
| 278 | 277 | with uid = generate_random_string(20), |
| 279 | 278 | |
| 280 | - partial_content([js(js_file("xlib/js/xlib.js")), js_inline(jquery_ready(img_button_confirm_js(uid, dlg_title, dlg_text, dlg_ok, dlg_cancel)))], | |
| 279 | + head_tags([js(js_file("xlib/js/xlib.js")), js_inline(jquery_ready(img_button_confirm_js(uid, dlg_title, dlg_text, dlg_ok, dlg_cancel)))], | |
| 281 | 280 | img(img_button_confirm_image_attrs(core_attrs, uid, actioner), img_path)). |
| 282 | 281 | |
| 283 | -public define HTML_Partial_Content | |
| 282 | +public define HTML | |
| 284 | 283 | img_button_confirm |
| 285 | 284 | ( |
| 286 | 285 | String img_path, |
| ... | ... | @@ -293,7 +292,7 @@ public define HTML_Partial_Content |
| 293 | 292 | img_button_confirm(img_path, [], dlg_title, dlg_text, dlg_ok, dlg_cancel, actioner). |
| 294 | 293 | |
| 295 | 294 | public define String |
| 296 | - img_button_confirm | |
| 295 | + img_button_confirm_string | |
| 297 | 296 | ( |
| 298 | 297 | String img_path, |
| 299 | 298 | List(CoreAttrs) core_attrs, |
| ... | ... | @@ -309,7 +308,7 @@ public define String |
| 309 | 308 | "<img " + format_attrs(img_button_confirm_image_attrs(core_attrs, uid, actioner)) + " src=\"" + img_path + "\"></img>". |
| 310 | 309 | |
| 311 | 310 | public define String |
| 312 | - img_button_confirm | |
| 311 | + img_button_confirm_string | |
| 313 | 312 | ( |
| 314 | 313 | String img_path, |
| 315 | 314 | String inline_img_attrb, |
| ... | ... | @@ -324,7 +323,7 @@ public define String |
| 324 | 323 | "};});</script><img " + inline_img_attrb + " id=\"" + uid + "\" style=\"cursor:pointer\" onclick=\"Xlib.make_confirm_dialog(this," + dlg_ok_js_script + ");\" src=\"" + img_path + "\"></img>". |
| 325 | 324 | |
| 326 | 325 | public define String |
| 327 | - img_button_confirm | |
| 326 | + img_button_confirm_string | |
| 328 | 327 | ( |
| 329 | 328 | String img_path, |
| 330 | 329 | String dlg_title, |
| ... | ... | @@ -333,10 +332,10 @@ public define String |
| 333 | 332 | String dlg_cancel, |
| 334 | 333 | JQuery_Actioner actioner |
| 335 | 334 | )= |
| 336 | - img_button_confirm(img_path, [], dlg_title, dlg_text, dlg_ok, dlg_cancel, actioner). | |
| 335 | + img_button_confirm_string(img_path, [], dlg_title, dlg_text, dlg_ok, dlg_cancel, actioner). | |
| 337 | 336 | |
| 338 | 337 | |
| 339 | -public define HTML_Partial_Content | |
| 338 | +public define HTML | |
| 340 | 339 | img_button_confirm |
| 341 | 340 | ( |
| 342 | 341 | String img_path, |
| ... | ... | @@ -353,11 +352,11 @@ public define HTML_Partial_Content |
| 353 | 352 | with uid = generate_random_string(20), |
| 354 | 353 | //with event_click = (CoreAttrs)event(onclick, "Xlib.jq_query("+format_web_action_name_to_js(web_action, extra_ops)+")"), |
| 355 | 354 | |
| 356 | - partial_content([js(js_file("xlib/js/xlib.js")), js_inline(jquery_ready(img_button_confirm_js(uid, dlg_title, dlg_text, dlg_ok, dlg_cancel)))], | |
| 355 | + head_tags([js(js_file("xlib/js/xlib.js")), js_inline(jquery_ready(img_button_confirm_js(uid, dlg_title, dlg_text, dlg_ok, dlg_cancel)))], | |
| 357 | 356 | img(img_button_confirm_image_attrs(core_attrs, uid, web_action, extra_ops, load_content_target, call_back), img_path)) |
| 358 | 357 | . |
| 359 | 358 | |
| 360 | -public define HTML_Partial_Content | |
| 359 | +public define HTML | |
| 361 | 360 | img_button_confirm |
| 362 | 361 | ( |
| 363 | 362 | String img_path, | ... | ... |
web/widgets/css_helper.anubis
| ... | ... | @@ -13,132 +13,75 @@ read xlib/web/making_a_web_site.anubis |
| 13 | 13 | |
| 14 | 14 | /**** WAVE BOX ****/ |
| 15 | 15 | |
| 16 | -public define HTML_Partial_Content | |
| 16 | +public define HTML | |
| 17 | 17 | html_wave_box |
| 18 | 18 | ( |
| 19 | - List(CoreAttrs) attrs, | |
| 20 | - String legend, | |
| 21 | - List(HTML_Partial_Content) content | |
| 19 | + List(CoreAttrs) attrs, | |
| 20 | + String legend, | |
| 21 | + List(HTML) content | |
| 22 | 22 | )= |
| 23 | - partial_content( | |
| 23 | + | |
| 24 | 24 | div(attrs, [ |
| 25 | - text([class("frame_wave")], legend), //legend | |
| 26 | - div([class("frame_blk")], content) | |
| 27 | - ])) | |
| 28 | -. | |
| 29 | - | |
| 30 | -public define HTML_Partial_Content | |
| 31 | - html_wave_box | |
| 32 | - ( | |
| 33 | - List(CoreAttrs) attrs, | |
| 34 | - String legend, | |
| 35 | - List(HTML_Off_Form) content | |
| 36 | - )= | |
| 37 | - partial_content( | |
| 38 | - div(attrs, | |
| 39 | - [ | |
| 40 | - text([class("frame_wave")], legend), //legend | |
| 25 | + text(class("frame_wave"), legend), //legend | |
| 41 | 26 | div([class("frame_blk")], content) |
| 42 | - ])) | |
| 43 | -. | |
| 44 | - | |
| 45 | -public define HTML_Off_Form | |
| 46 | - html_wave_box | |
| 47 | - ( | |
| 48 | - List(CoreAttrs) attrs, | |
| 49 | - String legend, | |
| 50 | - List(HTML_Off_Form) content | |
| 51 | - )= | |
| 52 | - div(attrs, | |
| 53 | - [ | |
| 54 | - text([class("frame_wave")], legend), //legend | |
| 55 | - div([class("frame_blk")], content) | |
| 56 | - ]) | |
| 27 | + ]) | |
| 57 | 28 | . |
| 58 | 29 | |
| 59 | -public define HTML_Off_Form | |
| 30 | +public define HTML | |
| 60 | 31 | html_wave_box |
| 61 | 32 | ( |
| 62 | 33 | List(CoreAttrs) attrs, |
| 63 | 34 | String legend, |
| 64 | - HTML_Off_Form content | |
| 35 | + HTML content | |
| 65 | 36 | )= |
| 66 | 37 | html_wave_box(attrs, legend, [content]) |
| 67 | 38 | . |
| 68 | 39 | |
| 69 | 40 | |
| 70 | -public define HTML_Off_Form | |
| 41 | +public define HTML | |
| 71 | 42 | html_wave_box |
| 72 | 43 | ( |
| 73 | - String legend, | |
| 74 | - HTML_Off_Form content | |
| 44 | + String legend, | |
| 45 | + HTML content | |
| 75 | 46 | )= |
| 76 | 47 | html_wave_box([class("frame")], legend, content) |
| 77 | 48 | . |
| 78 | - | |
| 79 | -public define HTML_Partial_Content | |
| 80 | - html_wave_box | |
| 81 | - ( | |
| 82 | - String legend, | |
| 83 | - HTML_Partial_Content content | |
| 84 | - )= | |
| 85 | - html_wave_box([class("frame")], legend, [content]) | |
| 86 | -. | |
| 87 | - | |
| 88 | -public define HTML_Partial_Content | |
| 89 | - html_wave_box | |
| 90 | - ( | |
| 91 | - List(CoreAttrs) attrs, | |
| 92 | - String legend, | |
| 93 | - HTML_Partial_Content content | |
| 94 | - )= | |
| 95 | - html_wave_box([class("frame") . attrs] , legend, [content]) | |
| 96 | -. | |
| 97 | 49 | |
| 98 | -public define HTML_Partial_Content | |
| 99 | - html_wave_box | |
| 100 | - ( | |
| 101 | - String legend, | |
| 102 | - HTML_Off_Form content | |
| 103 | - )= | |
| 104 | - html_wave_box([class("frame")], legend, [content]) | |
| 105 | -. | |
| 106 | - | |
| 107 | -public define HTML_Off_Form | |
| 50 | +public define HTML | |
| 108 | 51 | html_wave_box_custom_size |
| 109 | 52 | ( |
| 110 | - Int size, | |
| 111 | - String legend, | |
| 112 | - List(HTML_Off_Form) content, | |
| 53 | + Int size, | |
| 54 | + String legend, | |
| 55 | + List(HTML) content, | |
| 113 | 56 | )= |
| 114 | - div([style("width: "+abs_to_decimal(size)+"px")], | |
| 57 | + div(style("width: "+abs_to_decimal(size)+"px"), | |
| 115 | 58 | [ |
| 116 | - text([class("frame_wave")], legend), //legend | |
| 117 | - div([class("frame_blk")], content) | |
| 59 | + text(class("frame_wave"), legend), //legend | |
| 60 | + div(class("frame_blk"), content) | |
| 118 | 61 | ]). |
| 119 | 62 | |
| 120 | -public define HTML_Off_Form | |
| 63 | +public define HTML | |
| 121 | 64 | html_wave_box_wide |
| 122 | 65 | ( |
| 123 | - String legend, | |
| 124 | - HTML_Off_Form content | |
| 66 | + String legend, | |
| 67 | + HTML content | |
| 125 | 68 | )= |
| 126 | 69 | html_wave_box([class("frame wide")], legend, [content]). |
| 127 | 70 | |
| 128 | -public define HTML_Partial_Content | |
| 71 | +public define HTML | |
| 129 | 72 | html_wave_box_wide |
| 130 | 73 | ( |
| 131 | - String legend, | |
| 132 | - HTML_Partial_Content content | |
| 74 | + String legend, | |
| 75 | + List(HTML) content | |
| 133 | 76 | )= |
| 134 | - html_wave_box([class("frame wide")], legend, content, ). | |
| 77 | + html_wave_box([class("frame wide")], legend, content). | |
| 135 | 78 | |
| 136 | 79 | /**** CHANGELIST ****/ |
| 137 | 80 | public type ChangeListItem: |
| 138 | 81 | change_list_item( |
| 139 | 82 | String icon, |
| 140 | 83 | String label, |
| 141 | - HTML_Off_Form value). | |
| 84 | + HTML value). | |
| 142 | 85 | |
| 143 | 86 | public define ChangeListItem |
| 144 | 87 | change_list_item |
| ... | ... | @@ -178,11 +121,11 @@ public define ChangeListItem |
| 178 | 121 | change_list_item |
| 179 | 122 | ( |
| 180 | 123 | String label, |
| 181 | - HTML_Off_Form value | |
| 124 | + HTML value | |
| 182 | 125 | )= |
| 183 | 126 | change_list_item("", label, value). |
| 184 | 127 | |
| 185 | -define HTML_Off_Form | |
| 128 | +define HTML | |
| 186 | 129 | make_tr |
| 187 | 130 | ( |
| 188 | 131 | ChangeListItem item, |
| ... | ... | @@ -203,11 +146,11 @@ define HTML_Off_Form |
| 203 | 146 | ) |
| 204 | 147 | . |
| 205 | 148 | |
| 206 | -define List(HTML_Off_Form) | |
| 149 | +define List(HTML) | |
| 207 | 150 | make_changelist_rows |
| 208 | 151 | ( |
| 209 | 152 | List(ChangeListItem) items, |
| 210 | - List(HTML_Off_Form) so_far, | |
| 153 | + List(HTML) so_far, | |
| 211 | 154 | Int odd |
| 212 | 155 | )= |
| 213 | 156 | if items is |
| ... | ... | @@ -217,17 +160,17 @@ define List(HTML_Off_Form) |
| 217 | 160 | make_changelist_rows(t, [ make_tr(h, odd) . so_far], 1 - odd) |
| 218 | 161 | }. |
| 219 | 162 | |
| 220 | -public define HTML_Partial_Content | |
| 163 | +public define HTML | |
| 221 | 164 | changelist_table |
| 222 | 165 | ( |
| 223 | 166 | List(ChangeListItem) items |
| 224 | 167 | )= |
| 225 | - partial_content([css(css_file("xlib/css/changelists.css"))], | |
| 168 | + head_tags([css(css_file("xlib/css/changelists.css"))], | |
| 226 | 169 | div(class("changelist"), |
| 227 | 170 | table([/*class("module"), */ attr("cellspacing","0")], make_changelist_rows(items, [], 1)))) |
| 228 | 171 | . |
| 229 | 172 | |
| 230 | - public define HTML_Off_Form | |
| 173 | + public define HTML | |
| 231 | 174 | html_tooltip |
| 232 | 175 | ( |
| 233 | 176 | String title, |
| ... | ... | @@ -237,32 +180,8 @@ public define HTML_Partial_Content |
| 237 | 180 | |
| 238 | 181 | actioner(same,same, link([id("help_" + keyword), class("jTip jTip_help"), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_id", keyword)], []). |
| 239 | 182 | |
| 240 | - public define HTML_Off_Form | |
| 241 | - html_tooltip | |
| 242 | - ( | |
| 243 | - String title, | |
| 244 | - String keyword, | |
| 245 | - Int width | |
| 246 | - ) = | |
| 247 | - a([id("help_"+keyword), class("jTipu jTip_help"), data("name",title)], data("href",format_web_action_name(action_name("ajax_show_tooltip"), [("tooltip_id",keyword),("width",to_String(width))]))). | |
| 248 | - | |
| 249 | -// literal("<a id=\"help_"+keyword+"\" class=\"jTipu jTip_help\" name=\""+title+"\" href=\"/?a=ajax_show_tooltip&tooltip_id="+keyword+"&width="+width+"\"></a>"). | |
| 250 | - | |
| 251 | - actioner(same,same, link([id("help_" + keyword), class("jTip jTip_help"), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_id", keyword), ("width", to_decimal(width))], []). | |
| 252 | - | |
| 253 | - public define HTML_In_Form | |
| 254 | - html_tooltip | |
| 255 | - ( | |
| 256 | - String title, | |
| 257 | - String keyword, | |
| 258 | - ) = | |
| 259 | - a([id("help_"+keyword), class("jTipu jTip_help"), attr("name",title)], href(action_name("ajax_show_tooltip"), [("tooltip_id",keyword)])). | |
| 260 | - | |
| 261 | - literal("<a id=\"help_"+keyword+"\" class=\"jTipu jTip_help\" name=\""+title+"\" href=\"/?a=ajax_show_tooltip&tooltip_id="+keyword+"\"></a>"). | |
| 262 | - | |
| 263 | - actioner(same,same, link([id("help_" + keyword), class("jTip jTip_help"), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_id", keyword)], []). | |
| 264 | 183 | |
| 265 | -public define HTML_In_Form | |
| 184 | +public define HTML | |
| 266 | 185 | html_tooltip |
| 267 | 186 | ( |
| 268 | 187 | String title, |
| ... | ... | @@ -273,7 +192,7 @@ public define HTML_In_Form |
| 273 | 192 | |
| 274 | 193 | actioner(same,same, link([id("help_" + keyword), class("jTip jTip_help"), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_id", keyword), ("width", to_decimal(width))], []). |
| 275 | 194 | |
| 276 | - public define HTML_Off_Form | |
| 195 | + public define HTML | |
| 277 | 196 | html_tooltip_ext |
| 278 | 197 | ( |
| 279 | 198 | String title, |
| ... | ... | @@ -282,7 +201,7 @@ public define HTML_In_Form |
| 282 | 201 | ) = |
| 283 | 202 | actioner(same,same, link([id("help_" + keyword), class("jTip jTip_"+class_suffix), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_ext", keyword)], []). |
| 284 | 203 | |
| 285 | -public define HTML_Off_Form | |
| 204 | +public define HTML | |
| 286 | 205 | html_tooltip_ext |
| 287 | 206 | ( |
| 288 | 207 | String title, |
| ... | ... | @@ -304,18 +223,7 @@ public define HTML_Off_Form |
| 304 | 223 | ) = |
| 305 | 224 | actioner(same,same, link([id("help_" + keyword), class("jTipu jTip_"+class_suffix), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_ext", keyword)], []). |
| 306 | 225 | |
| 307 | -public define HTML_In_Form | |
| 308 | - html_tooltip_ext | |
| 309 | - ( | |
| 310 | - String title, | |
| 311 | - String keyword, | |
| 312 | - String class_suffix, | |
| 313 | - List((String, String)) ext_args | |
| 314 | - ) = | |
| 315 | - with extra_args = format_extra_operands(ext_args), | |
| 316 | 226 | |
| 317 | - literal("<a id=\"help_"+keyword+"\" class=\"jTipu jTip_"+class_suffix+"\" data-name=\""+title+"\" data-href=\"/?a=ajax_show_tooltip&tooltip_ext="+keyword+extra_args+"\"></a>"). | |
| 318 | - | |
| 319 | 227 | |
| 320 | 228 | href=\"/?a=ajax_show_tooltip&tooltip_id="+keyword+"\" id=\"help_"+keyword+HELP_HMS_MODE" class="jTip jTip_help" target="_blank" name="Aide sur la fonctionnalité 'No Limit'"> </a>"). |
| 321 | 229 | ... | ... |
web/widgets/dashboard.anubis
| ... | ... | @@ -17,41 +17,45 @@ public type Dashboard_content: |
| 17 | 17 | none, |
| 18 | 18 | content(List(ChangeListItem) content, String title). |
| 19 | 19 | |
| 20 | -public define HTML_Off_Form | |
| 20 | +public define HTML | |
| 21 | 21 | dash_board |
| 22 | 22 | ( |
| 23 | 23 | Dashboard_content left, |
| 24 | 24 | Dashboard_content right |
| 25 | 25 | )= |
| 26 | - table([class("container")], | |
| 27 | - [ row( [ cell([class("module_col left_col")], | |
| 28 | - if left is | |
| 29 | - { | |
| 30 | - none then literal(""), | |
| 31 | - content(list, title) then partial(html_wave_box_wide(title, changelist_table(list))) | |
| 32 | - } | |
| 33 | - ), | |
| 34 | - cell([class("module_col right_col")], | |
| 35 | - if right is | |
| 36 | - { | |
| 37 | - none then literal(""), | |
| 38 | - content(list, title) then partial(html_wave_box_wide(title, changelist_table(list))) | |
| 39 | - } | |
| 40 | - ) | |
| 41 | - ]) | |
| 42 | - ]). | |
| 26 | + table(class("container"), | |
| 27 | + tr([ | |
| 28 | + td(class("module_col left_col"), | |
| 29 | + if left is | |
| 30 | + { | |
| 31 | + none then empty, | |
| 32 | + content(list, title) then html_wave_box_wide(title, changelist_table(list)) | |
| 33 | + } | |
| 34 | + ), | |
| 35 | + td(class("module_col right_col"), | |
| 36 | + if right is | |
| 37 | + { | |
| 38 | + none then empty, | |
| 39 | + content(list, title) then html_wave_box_wide(title, changelist_table(list)) | |
| 40 | + } | |
| 41 | + ) | |
| 42 | + ]) // </tr> | |
| 43 | + ) | |
| 44 | +. | |
| 43 | 45 | |
| 44 | -public define HTML_Off_Form | |
| 46 | +public define HTML | |
| 45 | 47 | dash_board |
| 46 | 48 | ( |
| 47 | 49 | Dashboard_content content |
| 48 | 50 | )= |
| 49 | - table([class("container")], | |
| 50 | - [ row( [ cell([class("module_col")], | |
| 51 | - if content is | |
| 52 | - { | |
| 53 | - none then literal(""), | |
| 54 | - content(list, title) then partial(html_wave_box_wide(title, changelist_table(list))) | |
| 55 | - } | |
| 56 | - )])]). | |
| 51 | + table(class("container"), | |
| 52 | + tr( | |
| 53 | + td(class("module_col"), | |
| 54 | + if content is | |
| 55 | + { | |
| 56 | + none then empty, | |
| 57 | + content(list, title) then html_wave_box_wide(title, changelist_table(list)) | |
| 58 | + } | |
| 59 | + ))) | |
| 60 | +. | |
| 57 | 61 | ... | ... |
web/widgets/fisheye_menu.anubis
| ... | ... | @@ -20,19 +20,19 @@ public type FisheyeEntry: |
| 20 | 20 | String help_text //Help text to show |
| 21 | 21 | ). |
| 22 | 22 | |
| 23 | -define List(HTML_Off_Form) | |
| 23 | +define List(HTML) | |
| 24 | 24 | make_fisheye_menu |
| 25 | 25 | ( |
| 26 | 26 | (String) -> String _T, //translator function |
| 27 | 27 | List(FisheyeEntry) entries, |
| 28 | - List(HTML_Off_Form) so_far, | |
| 28 | + List(HTML) so_far, | |
| 29 | 29 | String selected_space //id of the selected space |
| 30 | 30 | )= |
| 31 | 31 | if entries is |
| 32 | 32 | { |
| 33 | 33 | [] then reverse(so_far), //reverse to be in the right direction |
| 34 | 34 | [h . t] then |
| 35 | - with entry = (HTML_Off_Form)img( | |
| 35 | + with entry = (HTML)img( | |
| 36 | 36 | [ |
| 37 | 37 | id(h.id), |
| 38 | 38 | class("menu_item"+if h.id = selected_space then " menu_selected" else ""), |
| ... | ... | @@ -46,7 +46,7 @@ define List(HTML_Off_Form) |
| 46 | 46 | make_fisheye_menu(_T, t, [ entry . so_far], selected_space) |
| 47 | 47 | }. |
| 48 | 48 | |
| 49 | -public define HTML_Partial_Content | |
| 49 | +public define HTML | |
| 50 | 50 | make_fisheye_menu |
| 51 | 51 | ( |
| 52 | 52 | (String) -> String _T, //translator function | ... | ... |
web/widgets/icon.anubis
web/widgets/icons_set.anubis
| ... | ... | @@ -67,4 +67,4 @@ public define String icn64_mime(String mimetype) = "icons/64x64/mimetypes/"+mim |
| 67 | 67 | public define String icn64_mime(MIME mimetype) = "icons/64x64/mimetypes/"+mimetype.type+"-"+mimetype.subtype+".png". |
| 68 | 68 | |
| 69 | 69 | public define String to_Icon (Bool value) = if value then icn16_true else icn16_false. |
| 70 | -public define HTML_Off_Form bool_to_img (Bool value) = img(to_Icon(value)). | |
| 70 | +public define HTML bool_to_img (Bool value) = img(to_Icon(value)). | ... | ... |
web/widgets/left_menu_html.anubis
| ... | ... | @@ -11,13 +11,13 @@ read xlib/web/making_a_web_site.anubis |
| 11 | 11 | read xlib/web/web_action.anubis |
| 12 | 12 | read xlib/web/load_content.anubis |
| 13 | 13 | |
| 14 | -define List(HTML_Off_Form) | |
| 14 | +define List(HTML) | |
| 15 | 15 | make_left_menu |
| 16 | 16 | ( |
| 17 | 17 | (String) -> String _T, //translator function |
| 18 | 18 | List(Left_Menu_Entry) entries, |
| 19 | 19 | String selected, |
| 20 | - List(HTML_Off_Form) so_far | |
| 20 | + List(HTML) so_far | |
| 21 | 21 | )= |
| 22 | 22 | if entries is |
| 23 | 23 | { |
| ... | ... | @@ -48,7 +48,7 @@ define List(HTML_Off_Form) |
| 48 | 48 | make_left_menu(_T, t, selected, [ entry . so_far]) |
| 49 | 49 | }. |
| 50 | 50 | |
| 51 | -public define HTML_Partial_Content | |
| 51 | +public define HTML | |
| 52 | 52 | make_left_menu |
| 53 | 53 | ( |
| 54 | 54 | (String) -> String _T, //translator function |
| ... | ... | @@ -56,10 +56,10 @@ public define HTML_Partial_Content |
| 56 | 56 | )= |
| 57 | 57 | if l_menu is |
| 58 | 58 | { |
| 59 | - no_left_menu then partial_empty, | |
| 59 | + no_left_menu then empty, | |
| 60 | 60 | left_menu(entries, selected) then |
| 61 | - partial_content([css(css_file("/css/left_menu.css"))], | |
| 62 | - sequence(make_left_menu(_T, entries, selected, []))) | |
| 61 | + head_tags([css(css_file("/css/left_menu.css"))], | |
| 62 | + make_left_menu(_T, entries, selected, [])) | |
| 63 | 63 | }. |
| 64 | 64 | |
| 65 | 65 | ... | ... |
web/widgets/menu.anubis
| ... | ... | @@ -30,7 +30,7 @@ public type Menu_Item: |
| 30 | 30 | // List(String) classes //additional classes if need (change background color, font size, etc.) |
| 31 | 31 | // ), |
| 32 | 32 | menu_item_content( |
| 33 | - HTML_Partial_Content content | |
| 33 | + HTML content | |
| 34 | 34 | ), |
| 35 | 35 | menu_separator |
| 36 | 36 | . |
| ... | ... | @@ -130,12 +130,12 @@ public define Menu_Item |
| 130 | 130 | // )= |
| 131 | 131 | // menu_title(text, title_ids, []). |
| 132 | 132 | |
| 133 | -define List(HTML_Off_Form) | |
| 133 | +define List(HTML) | |
| 134 | 134 | generate_menu |
| 135 | 135 | ( |
| 136 | 136 | (String) -> String _T, //translator function |
| 137 | 137 | List(Menu_Item) items, |
| 138 | - List(HTML_Off_Form) so_far, | |
| 138 | + List(HTML) so_far, | |
| 139 | 139 | Int level |
| 140 | 140 | )= |
| 141 | 141 | if items is |
| ... | ... | @@ -150,9 +150,9 @@ define List(HTML_Off_Form) |
| 150 | 150 | with classes = join(" ",[(if level = 0 then "maintab" else ""), |
| 151 | 151 | (if is_empty(_sub_menu) then "" else "has_submenu") . |
| 152 | 152 | _classes]), |
| 153 | - with current_li = (HTML_Off_Form)li( [class(classes)], | |
| 153 | + with current_li = li(class(classes), | |
| 154 | 154 | //if _icon = "" then [] else [class(_icon+"_icon")], |
| 155 | - sequence([actioner(same, _target, | |
| 155 | + [actioner(same, _target, | |
| 156 | 156 | html(if level = 0 then [class("title")] else [], |
| 157 | 157 | sequence([ |
| 158 | 158 | //format the icon if need |
| ... | ... | @@ -168,17 +168,17 @@ define List(HTML_Off_Form) |
| 168 | 168 | if is_empty(_sub_menu) then |
| 169 | 169 | empty |
| 170 | 170 | else |
| 171 | - (HTML_Off_Form)ul([class("submenu")], generate_menu(_T, _sub_menu, [], level+1)) | |
| 172 | - ])), | |
| 171 | + (HTML)ul([class("submenu")], generate_menu(_T, _sub_menu, [], level+1)) | |
| 172 | + ]), | |
| 173 | 173 | generate_menu(_T, t, [current_li . so_far], level), |
| 174 | 174 | |
| 175 | 175 | // menu_title(text, _ids, _classes) then |
| 176 | 176 | menu_item_content(_content) then |
| 177 | -// with current_li = (HTML_Off_Form)li([class("item "+_class+"_icon")],actioner(same,same, link(_T(_text)),_action,_extra)), | |
| 178 | - with current_li = (HTML_Off_Form)li([],partial(_content)), | |
| 177 | +// with current_li = (HTML)li([class("item "+_class+"_icon")],actioner(same,same, link(_T(_text)),_action,_extra)), | |
| 178 | + with current_li = li(_content), | |
| 179 | 179 | generate_menu(_T, t, [current_li . so_far], level), |
| 180 | 180 | menu_separator then |
| 181 | - with current_li = (HTML_Off_Form)li([class("cxm_menu_sep")],text("--- SEPARATOR ---")), | |
| 181 | + with current_li = li(class("cxm_menu_sep"), text("--- SEPARATOR ---")), | |
| 182 | 182 | generate_menu(_T, t, [current_li . so_far], level) |
| 183 | 183 | |
| 184 | 184 | } |
| ... | ... | @@ -188,18 +188,18 @@ define List(HTML_Off_Form) |
| 188 | 188 | // |
| 189 | 189 | // hk_menu_list(_class, _action, _text, _extra, _entries) then |
| 190 | 190 | // with current_li = |
| 191 | -// (HTML_Off_Form)li([class(_class+"_icon")], | |
| 191 | +// (HTML)li([class(_class+"_icon")], | |
| 192 | 192 | // sequence([ |
| 193 | 193 | //// actioner(same,same, link(_T(_text)),_action,_extra), |
| 194 | 194 | // actioner(same,same, link(help_string(_text, _T)),_action,_extra), |
| 195 | 195 | // text([class(if level = 0 then "dropBottom" else "dropRight")], ""), |
| 196 | -// (HTML_Off_Form)ul([], sequence(generate_hk_menu(_T, _entries, [], level+1)))])), | |
| 196 | +// (HTML)ul([], sequence(generate_hk_menu(_T, _entries, [], level+1)))])), | |
| 197 | 197 | // generate_hk_menu(_T, t, [current_li . so_far], level) |
| 198 | 198 | // |
| 199 | 199 | // } |
| 200 | 200 | // }. |
| 201 | 201 | |
| 202 | -define HTML_Off_Form | |
| 202 | +define HTML | |
| 203 | 203 | make_menu |
| 204 | 204 | ( |
| 205 | 205 | (String) -> String _T, //translator function |
| ... | ... | @@ -212,7 +212,7 @@ define HTML_Off_Form |
| 212 | 212 | ]) |
| 213 | 213 | . |
| 214 | 214 | |
| 215 | -public define HTML_Partial_Content | |
| 215 | +public define HTML | |
| 216 | 216 | make_menu |
| 217 | 217 | ( |
| 218 | 218 | (String) -> String _T, //translator function |
| ... | ... | @@ -221,9 +221,9 @@ public define HTML_Partial_Content |
| 221 | 221 | )= |
| 222 | 222 | if _menu is |
| 223 | 223 | { |
| 224 | - no_menu then partial_content(empty), | |
| 224 | + no_menu then empty, | |
| 225 | 225 | menu(items) then |
| 226 | - partial_content([css(css_file("xlib/css/menu.css"))], | |
| 226 | + head_tags([css(css_file("xlib/css/menu.css"))], | |
| 227 | 227 | //partial_content([css(css_file("/css/admin_theme.css"))], |
| 228 | 228 | make_menu(_T, items, _direction)) |
| 229 | 229 | } | ... | ... |
web/widgets/pager.anubis
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | read xlib/web/making_a_web_site.anubis |
| 10 | 10 | read xlib/web/web_session.anubis |
| 11 | 11 | |
| 12 | -public define HTML_Partial_Content | |
| 12 | +public define HTML | |
| 13 | 13 | control_panel_pager |
| 14 | 14 | ( |
| 15 | 15 | String pager_id, |
| ... | ... | @@ -20,7 +20,7 @@ public define HTML_Partial_Content |
| 20 | 20 | String next |
| 21 | 21 | ) |
| 22 | 22 | = |
| 23 | - partial_content([js(js_file("xlib/js/pager.js"))], | |
| 23 | + head_tags([js(js_file("xlib/js/pager.js"))], | |
| 24 | 24 | div(id(pager_id), [ |
| 25 | 25 | text(class("o_pager_current_page"), current_page), |
| 26 | 26 | text("/"), |
| ... | ... | @@ -34,7 +34,7 @@ public define HTML_Partial_Content |
| 34 | 34 | ])) |
| 35 | 35 | . |
| 36 | 36 | |
| 37 | -public define HTML_Partial_Content | |
| 37 | +public define HTML | |
| 38 | 38 | control_panel_pager |
| 39 | 39 | ( |
| 40 | 40 | String pager_id, | ... | ... |
web/widgets/specialized_elements.anubis
| ... | ... | @@ -29,7 +29,7 @@ public define String |
| 29 | 29 | } |
| 30 | 30 | . |
| 31 | 31 | |
| 32 | -public define HTML_Off_Form | |
| 32 | +public define HTML | |
| 33 | 33 | phone_icon |
| 34 | 34 | ( |
| 35 | 35 | List(CoreAttrs) attrs, |
| ... | ... | @@ -66,7 +66,7 @@ public define HTML_Off_Form |
| 66 | 66 | ]) |
| 67 | 67 | . |
| 68 | 68 | |
| 69 | -public define HTML_Off_Form | |
| 69 | +public define HTML | |
| 70 | 70 | phone_icon |
| 71 | 71 | ( |
| 72 | 72 | List(CoreAttrs) attrs, |
| ... | ... | @@ -74,7 +74,7 @@ public define HTML_Off_Form |
| 74 | 74 | Bool click_to_dial |
| 75 | 75 | )= phone_icon(attrs, phone_number, generic, true, click_to_dial). |
| 76 | 76 | |
| 77 | -public define HTML_Off_Form | |
| 77 | +public define HTML | |
| 78 | 78 | phone_icon |
| 79 | 79 | ( |
| 80 | 80 | String phone_number, |
| ... | ... | @@ -83,7 +83,7 @@ public define HTML_Off_Form |
| 83 | 83 | phone_icon([], phone_number, generic, true, click_to_dial) |
| 84 | 84 | . |
| 85 | 85 | |
| 86 | -public define HTML_Off_Form | |
| 86 | +public define HTML | |
| 87 | 87 | phone_icon |
| 88 | 88 | ( |
| 89 | 89 | String phone_number, |
| ... | ... | @@ -94,7 +94,7 @@ public define HTML_Off_Form |
| 94 | 94 | phone_icon([], phone_number, phone_type, show_number, click_to_dial) |
| 95 | 95 | . |
| 96 | 96 | |
| 97 | -public define HTML_Off_Form | |
| 97 | +public define HTML | |
| 98 | 98 | phone_icon |
| 99 | 99 | ( |
| 100 | 100 | String phone_number, |
| ... | ... | @@ -105,7 +105,7 @@ public define HTML_Off_Form |
| 105 | 105 | . |
| 106 | 106 | |
| 107 | 107 | |
| 108 | -public define HTML_Off_Form | |
| 108 | +public define HTML | |
| 109 | 109 | email_icon |
| 110 | 110 | ( |
| 111 | 111 | List(CoreAttrs) attrs, |
| ... | ... | @@ -124,7 +124,7 @@ public define HTML_Off_Form |
| 124 | 124 | ]) |
| 125 | 125 | . |
| 126 | 126 | |
| 127 | -public define HTML_Off_Form | |
| 127 | +public define HTML | |
| 128 | 128 | email_icon |
| 129 | 129 | ( |
| 130 | 130 | String email_address, |
| ... | ... | @@ -133,7 +133,7 @@ public define HTML_Off_Form |
| 133 | 133 | email_icon([], email_address, show_text) |
| 134 | 134 | . |
| 135 | 135 | |
| 136 | -public define HTML_Off_Form | |
| 136 | +public define HTML | |
| 137 | 137 | email_icon |
| 138 | 138 | ( |
| 139 | 139 | String email_address |
| ... | ... | @@ -141,7 +141,7 @@ public define HTML_Off_Form |
| 141 | 141 | email_icon([], email_address, true) |
| 142 | 142 | . |
| 143 | 143 | |
| 144 | -public define HTML_Off_Form | |
| 144 | +public define HTML | |
| 145 | 145 | url_icon |
| 146 | 146 | ( |
| 147 | 147 | List(CoreAttrs) attrs, |
| ... | ... | @@ -160,7 +160,7 @@ public define HTML_Off_Form |
| 160 | 160 | ]) |
| 161 | 161 | . |
| 162 | 162 | |
| 163 | -public define HTML_Off_Form | |
| 163 | +public define HTML | |
| 164 | 164 | url_icon |
| 165 | 165 | ( |
| 166 | 166 | String url_string, //url to open |
| ... | ... | @@ -169,7 +169,7 @@ public define HTML_Off_Form |
| 169 | 169 | url_icon([], url_string, show_text) |
| 170 | 170 | . |
| 171 | 171 | |
| 172 | -public define HTML_Off_Form | |
| 172 | +public define HTML | |
| 173 | 173 | url_icon |
| 174 | 174 | ( |
| 175 | 175 | String url_string | ... | ... |
web_controllers/language/language_management.anubis
| ... | ... | @@ -153,7 +153,7 @@ public define List((List(CoreAttrs),WebArgValue, String)) |
| 153 | 153 | ) |
| 154 | 154 | . |
| 155 | 155 | |
| 156 | -define HTML_Off_Form | |
| 156 | +define HTML | |
| 157 | 157 | language_line |
| 158 | 158 | ( |
| 159 | 159 | String language_code, |
| ... | ... | @@ -163,7 +163,7 @@ define HTML_Off_Form |
| 163 | 163 | event(onclick, "language_changed('"+language_code+"');")], text(language)) |
| 164 | 164 | . |
| 165 | 165 | |
| 166 | -define HTML_Off_Form | |
| 166 | +define HTML | |
| 167 | 167 | language_line |
| 168 | 168 | ( |
| 169 | 169 | String language_code, |
| ... | ... | @@ -176,7 +176,7 @@ define HTML_Off_Form |
| 176 | 176 | ]) |
| 177 | 177 | . |
| 178 | 178 | |
| 179 | -public define HTML_Partial_Content | |
| 179 | +public define HTML | |
| 180 | 180 | flags_menu |
| 181 | 181 | ( |
| 182 | 182 | String dictionary_collection_name, |
| ... | ... | @@ -190,32 +190,31 @@ public define HTML_Partial_Content |
| 190 | 190 | empty |
| 191 | 191 | else |
| 192 | 192 | language_line(lang_code, self_name(lang_info)), |
| 193 | - partial_content([ | |
| 193 | + | |
| 194 | + head_tags([ | |
| 194 | 195 | css(css_file("/xlib/css/flags_menu.css")), |
| 195 | 196 | js(js_file("/xlib/js/xlib.js")) |
| 196 | - ], | |
| 197 | - [ | |
| 197 | + ], | |
| 198 | 198 | dl([ |
| 199 | 199 | //literal("<dt style=\"background-image: url(../flags/"+lang+".png);\" onmouseover=\"javascript:montre('drapo1');\" onmouseout=\"javascript:montre();\"> </dt>\n"), |
| 200 | 200 | //literal("<img src=\"/xlib/flags/24x24/"+lang+".png\" onmouseover=\"javascript:montre('drapo1');\" onmouseout=\"javascript:montre();\">"), |
| 201 | 201 | |
| 202 | 202 | img([event(onmouseover, "showObject('l3-flag');"), event(onmouseout, "hideObject('l3-flag');")], "/xlib/flags/lang/24/"+lang+".png" ), |
| 203 | 203 | dd([style("display: none"),id("l3-flag"), event(onmouseover, "showObject('l3-flag');"), event(onmouseout, "hideObject('l3-flag');")], |
| 204 | - ul( | |
| 205 | - map(make_line, l3_get_all_dicos(dictionary_collection_name))+ | |
| 206 | - [ | |
| 204 | + ul( | |
| 205 | + map(make_line, l3_get_all_dicos(dictionary_collection_name))+ | |
| 206 | + [ | |
| 207 | 207 | if show_symbolic then |
| 208 | 208 | language_line("symb", "symbolic") |
| 209 | 209 | else |
| 210 | 210 | empty |
| 211 | - ] | |
| 212 | - )), | |
| 211 | + ] | |
| 212 | + )), | |
| 213 | 213 | ]) //!dl |
| 214 | - ] | |
| 215 | - ) | |
| 214 | + ) | |
| 216 | 215 | . |
| 217 | 216 | |
| 218 | -public define HTML_Partial_Content | |
| 217 | +public define HTML | |
| 219 | 218 | flags_menu |
| 220 | 219 | ( |
| 221 | 220 | WEB_Session _session, |
| ... | ... | @@ -229,7 +228,7 @@ public define HTML_Partial_Content |
| 229 | 228 | . |
| 230 | 229 | |
| 231 | 230 | |
| 232 | -public define HTML_Partial_Content | |
| 231 | +public define HTML | |
| 233 | 232 | choose_lang_dialog |
| 234 | 233 | ( |
| 235 | 234 | String dictionary_collection_name, |
| ... | ... | @@ -246,7 +245,7 @@ public define HTML_Partial_Content |
| 246 | 245 | else |
| 247 | 246 | language_line(lang_code, self_name(lang_info), action), |
| 248 | 247 | |
| 249 | - partial_content([ | |
| 248 | + head_tags([ | |
| 250 | 249 | css(css_file("/xlib/css/flags_menu.css")), |
| 251 | 250 | js(js_file("/xlib/js/xlib.js")) |
| 252 | 251 | ], |
| ... | ... | @@ -268,7 +267,7 @@ public define HTML_Partial_Content |
| 268 | 267 | ) |
| 269 | 268 | . |
| 270 | 269 | |
| 271 | -public define HTML_Partial_Content | |
| 270 | +public define HTML | |
| 272 | 271 | choose_lang_dialog |
| 273 | 272 | ( |
| 274 | 273 | WEB_Session _session, |
| ... | ... | @@ -281,7 +280,7 @@ public define HTML_Partial_Content |
| 281 | 280 | choose_lang_dialog(app_dictionnary, action, show_symbolic, []) |
| 282 | 281 | . |
| 283 | 282 | |
| 284 | -public define HTML_Partial_Content | |
| 283 | +public define HTML | |
| 285 | 284 | choose_lang_dialog |
| 286 | 285 | ( |
| 287 | 286 | WEB_Session _session, |
| ... | ... | @@ -294,7 +293,7 @@ public define HTML_Partial_Content |
| 294 | 293 | choose_lang_dialog(app_dictionnary, action, false, exclude_lang) |
| 295 | 294 | . |
| 296 | 295 | |
| 297 | -public define HTML_Partial_Content | |
| 296 | +public define HTML | |
| 298 | 297 | choose_lang_dialog |
| 299 | 298 | ( |
| 300 | 299 | WEB_Session _session, |
| ... | ... | @@ -308,7 +307,7 @@ public define HTML_Partial_Content |
| 308 | 307 | |
| 309 | 308 | /* DROPDOWN part */ |
| 310 | 309 | |
| 311 | -define HTML_Off_Form | |
| 310 | +define HTML | |
| 312 | 311 | dd_language_line |
| 313 | 312 | ( |
| 314 | 313 | String language_code, |
| ... | ... | @@ -321,7 +320,7 @@ define HTML_Off_Form |
| 321 | 320 | ]) |
| 322 | 321 | . |
| 323 | 322 | |
| 324 | -public define HTML_Partial_Content | |
| 323 | +public define HTML | |
| 325 | 324 | choose_lang_dropdown |
| 326 | 325 | ( |
| 327 | 326 | String dictionary_collection_name, |
| ... | ... | @@ -341,7 +340,7 @@ public define HTML_Partial_Content |
| 341 | 340 | else |
| 342 | 341 | dd_language_line(lang_code, self_name(lang_info), action), |
| 343 | 342 | |
| 344 | - partial_content([ | |
| 343 | + head_tags([ | |
| 345 | 344 | css(css_file("/xlib/css/flags_menu.css")), |
| 346 | 345 | js(js_file("/xlib/js/xlib.js")) |
| 347 | 346 | ], |
| ... | ... | @@ -360,7 +359,7 @@ public define HTML_Partial_Content |
| 360 | 359 | ) |
| 361 | 360 | . |
| 362 | 361 | |
| 363 | -public define HTML_Partial_Content | |
| 362 | +public define HTML | |
| 364 | 363 | choose_lang_dropdown |
| 365 | 364 | ( |
| 366 | 365 | WEB_Session _session, |
| ... | ... | @@ -375,7 +374,7 @@ public define HTML_Partial_Content |
| 375 | 374 | choose_lang_dropdown(app_dictionnary, action, image, on_click, show_symbolic, []) |
| 376 | 375 | . |
| 377 | 376 | |
| 378 | -public define HTML_Partial_Content | |
| 377 | +public define HTML | |
| 379 | 378 | choose_lang_dropdown |
| 380 | 379 | ( |
| 381 | 380 | WEB_Session _session, |
| ... | ... | @@ -390,7 +389,7 @@ public define HTML_Partial_Content |
| 390 | 389 | choose_lang_dropdown(app_dictionnary, action, image, on_click, false, exclude_lang) |
| 391 | 390 | . |
| 392 | 391 | |
| 393 | -public define HTML_Partial_Content | |
| 392 | +public define HTML | |
| 394 | 393 | choose_lang_dropdown |
| 395 | 394 | ( |
| 396 | 395 | WEB_Session _session, // | ... | ... |