Commit 7c959086d777e79a0b1322da2770651b44529f75
1 parent
40b8697c
deleting the obsolete file 'web/to_html.anubis' (still containing 'Int32')
Showing
1 changed file
with
0 additions
and
2113 deletions
Show diff stats
anubis_dev/library/web/to_html.anubis deleted
| 1 | - | |
| 2 | - | |
| 3 | - | |
| 4 | - | |
| 5 | - | |
| 6 | - The Anubis project. | |
| 7 | - | |
| 8 | - Producing HTML/Javascript code. | |
| 9 | - | |
| 10 | - Copyright (c) Alain Prouté 2004. | |
| 11 | - | |
| 12 | - | |
| 13 | - | |
| 14 | - | |
| 15 | - | |
| 16 | - | |
| 17 | - *** 1. Managing Web Arguments. | |
| 18 | - *** 2. HTML Structure | |
| 19 | - *** 2.1 Body of a HTML page | |
| 20 | - *** 2.2 HTML pages | |
| 21 | - *** 2.2.1 Definition of HTML_Page | |
| 22 | - *** 2.2.2 Convenience fuctions | |
| 23 | - *** 2.3 HTML_Element & HTML_Form | |
| 24 | - *** 3. Convenience functions | |
| 25 | - *** 3.1 for HTML_Element & HTML Form | |
| 26 | - *** 3.2 for HTML_Form | |
| 27 | - *** 3.4 Empty cells & empty rows | |
| 28 | - *** 3.5 Spacers | |
| 29 | - | |
| 30 | - | |
| 31 | -read tools/basis.anubis | |
| 32 | - | |
| 33 | - | |
| 34 | - *** 1. Managing Web Arguments. | |
| 35 | - ****************************** | |
| 36 | - | |
| 37 | - | |
| 38 | - When a client submits a form, he sends informations to the server. This information is | |
| 39 | - transformed by the server into a list of data of type 'Web_arg'. This is the reason why | |
| 40 | - a 'web page' operation always has a unique argument of type 'List(Web_arg)'. | |
| 41 | - | |
| 42 | - The type 'Web_arg' is defined in 'web/common.anubis' as follows: | |
| 43 | - | |
| 44 | - public type Web_arg: | |
| 45 | - web_arg(String name, | |
| 46 | - String value), | |
| 47 | - upload (String name, | |
| 48 | - String value, | |
| 49 | - String temp_file_path). | |
| 50 | - | |
| 51 | -read web/common.anubis | |
| 52 | - | |
| 53 | - In other words, a 'web argument' is just a pair made of the name of the argument, and | |
| 54 | - the value of the argument, and both are character strings. 'upload' will be explained | |
| 55 | - later. | |
| 56 | - | |
| 57 | - Of course, within the body of a 'web page' operation, you may want to recover the value | |
| 58 | - of a particular web argument. To that end, use the operation 'web_arg_value', which | |
| 59 | - takes 2 argument: | |
| 60 | - | |
| 61 | - - the list of all web arguments (the operand of the web page operation), | |
| 62 | - - the name of the argument whose value is wanted. | |
| 63 | - | |
| 64 | - This operation has the following return type: | |
| 65 | - | |
| 66 | - public type Web_arg_value: | |
| 67 | - not_found, | |
| 68 | - found(String value). | |
| 69 | - | |
| 70 | - If the requested argument name is not found in the list, 'not_found' is | |
| 71 | - returned. Otherwise, the value returned by 'web_arg_value' has the form 'found(v)', | |
| 72 | - where 'v' is the value of the argument. | |
| 73 | - | |
| 74 | - The operation 'web_arg_value' is defined below. | |
| 75 | - | |
| 76 | -public define Web_arg_value | |
| 77 | - web_arg_value | |
| 78 | - ( | |
| 79 | - List(Web_arg) l, | |
| 80 | - String name | |
| 81 | - ). | |
| 82 | - | |
| 83 | - | |
| 84 | - | |
| 85 | - | |
| 86 | - *** 2. HTML Structure | |
| 87 | - ********************* | |
| 88 | - | |
| 89 | - HTML_Element are all elements ou can find in an HTML page : text, table, image,form, | |
| 90 | - link,... execept input and submit elements which are reserved for HTML_Form. | |
| 91 | - | |
| 92 | - HTML_Form has also as alternatives text, table,image,... | |
| 93 | - | |
| 94 | - Seperate those two kinds element gives the opportunity to avoid to have several 'form' | |
| 95 | - in one HTML_Element, links into form,... all kinds of things that could disturb | |
| 96 | - browsers mind. | |
| 97 | - | |
| 98 | - | |
| 99 | -public type HTML_Item: | |
| 100 | - HTML_Item & HTML_Item,... | |
| 101 | - | |
| 102 | -public type HTML_Element: | |
| 103 | - HTML_Element & HTML_Element,... | |
| 104 | - | |
| 105 | -public type HTML_Form: | |
| 106 | - HTML_Form & HTML_Form,... | |
| 107 | - | |
| 108 | - | |
| 109 | - *** 2.1 Body of a HTML page | |
| 110 | - *************************** | |
| 111 | - | |
| 112 | -public type Body_Option: | |
| 113 | - background_color /* color for the background */ | |
| 114 | - ( | |
| 115 | - RGB | |
| 116 | - ), | |
| 117 | - background_image /* name of image file for the background */ | |
| 118 | - ( | |
| 119 | - String file_name | |
| 120 | - ), | |
| 121 | - load_image /* load an image (for next page), which is not displayed */ | |
| 122 | - ( | |
| 123 | - String name, | |
| 124 | - ), | |
| 125 | - left_margin /* left margin for document */ | |
| 126 | - ( | |
| 127 | - Int32 | |
| 128 | - ), | |
| 129 | - top_margin /* top margin for document */ | |
| 130 | - ( | |
| 131 | - Int32 | |
| 132 | - ), | |
| 133 | - margin_width | |
| 134 | - ( | |
| 135 | - Int32 | |
| 136 | - ), | |
| 137 | - margin_height | |
| 138 | - ( | |
| 139 | - Int32 | |
| 140 | - ), | |
| 141 | - reload_frame | |
| 142 | - ( | |
| 143 | - String name, /* name of target frame */ | |
| 144 | - String url /* url to load in this frame */ | |
| 145 | - ), | |
| 146 | - onload | |
| 147 | - ( | |
| 148 | - String function_name /* nom de la fonction javascript (sans les '()') */ | |
| 149 | - ). | |
| 150 | - | |
| 151 | -public type HTML_Body: | |
| 152 | - body | |
| 153 | - ( | |
| 154 | - List(Body_Option), /* list of body options */ | |
| 155 | - HTML_Item /* the content of the page */ | |
| 156 | - ). | |
| 157 | - | |
| 158 | - | |
| 159 | - | |
| 160 | - *** 2.2 HTML pages | |
| 161 | - ****************** | |
| 162 | - | |
| 163 | - *** 2.2.1 Definition of HTML_Page | |
| 164 | - ********************************* | |
| 165 | - | |
| 166 | - The following produces '<meta>' tags, which are put in the head of the document. | |
| 167 | - | |
| 168 | -public type HTML_Meta: | |
| 169 | - keywords | |
| 170 | - ( | |
| 171 | - List(String) | |
| 172 | - ), | |
| 173 | - refresh | |
| 174 | - ( | |
| 175 | - String url, | |
| 176 | - Int32 delay // in seconds | |
| 177 | - ), | |
| 178 | - meta | |
| 179 | - ( | |
| 180 | - String name, | |
| 181 | - String content | |
| 182 | - ), | |
| 183 | - http_equiv | |
| 184 | - ( | |
| 185 | - String name, | |
| 186 | - String content | |
| 187 | - ). | |
| 188 | - | |
| 189 | - | |
| 190 | -public type HTML_Page: | |
| 191 | - html_page | |
| 192 | - ( | |
| 193 | - String title, /* title appearing on top of browser */ | |
| 194 | - List(HTML_Meta) meta_tags, | |
| 195 | - Printable_tree head_scripts, /* scripts à placer dans la balise head */ | |
| 196 | - HTML_Body body /* body of page */ | |
| 197 | - ), | |
| 198 | - standard_frameset | |
| 199 | - ( | |
| 200 | - String title, | |
| 201 | - List(HTML_Meta) meta_tags, | |
| 202 | - Int32 height, /* height of 'top menu' (pixels) */ | |
| 203 | - Int32 width, /* width of 'left menu' (pixels) */ | |
| 204 | - Printable_tree main /* url for main */ | |
| 205 | - ). | |
| 206 | - | |
| 207 | - +---------+--------------------------+ | |
| 208 | - | | ^ | | |
| 209 | - |<-width->| top height | | |
| 210 | - | | v | | |
| 211 | - | left +--------------------------+ | |
| 212 | - | | | | |
| 213 | - | | main | | |
| 214 | - | | | | |
| 215 | - | | | | |
| 216 | - | | | | |
| 217 | - +---------+--------------------------+ | |
| 218 | - | |
| 219 | - Note: top and left frames must be loaded through the Web_body_option 'reload_frame'. | |
| 220 | - | |
| 221 | - | |
| 222 | - *** 2.2.2 Convenience fuctions | |
| 223 | - ****************************** | |
| 224 | - | |
| 225 | -public define HTML_Page | |
| 226 | - html_page | |
| 227 | - ( | |
| 228 | - String title, | |
| 229 | - HTML_Body body | |
| 230 | - ) = | |
| 231 | - html_page(title,[],[], body). | |
| 232 | - | |
| 233 | -public define HTML_Page | |
| 234 | - html_page | |
| 235 | - ( | |
| 236 | - String title, | |
| 237 | - List(HTML_Meta) meta_tags, | |
| 238 | - HTML_Body body | |
| 239 | - ) = | |
| 240 | - html_page(title, meta_tags, [], body). | |
| 241 | - | |
| 242 | - | |
| 243 | -public define HTML_Page | |
| 244 | - standard_frameset | |
| 245 | - ( | |
| 246 | - String title, | |
| 247 | - Int32 height, | |
| 248 | - Int32 width, | |
| 249 | - Printable_tree main | |
| 250 | - ) = | |
| 251 | - standard_frameset(title, [], height, width, main). | |
| 252 | - | |
| 253 | - | |
| 254 | - | |
| 255 | - | |
| 256 | - | |
| 257 | - *** 2.3 HTML_Element & HTML_Form | |
| 258 | - ******************************** | |
| 259 | - | |
| 260 | -public type HTML_Element: | |
| 261 | - text(Printable_tree), | |
| 262 | - par(String),... | |
| 263 | - | |
| 264 | -public type HTML_Form: | |
| 265 | - text(Printable_tree), | |
| 266 | - par(String),... | |
| 267 | - | |
| 268 | - | |
| 269 | - You may want to center a web standard in a page. Just enclose it into 'center(...)': | |
| 270 | - | |
| 271 | -public type HTML_Item: | |
| 272 | - center(HTML_Item),... | |
| 273 | - | |
| 274 | -public type HTML_Element: | |
| 275 | - center(HTML_Element),... | |
| 276 | - | |
| 277 | -public type HTML_Form: | |
| 278 | - center(HTML_Form),... | |
| 279 | - | |
| 280 | -public type WebStyle: | |
| 281 | - background_image(String file_name), | |
| 282 | - background_color(RGB color), | |
| 283 | - background_transparent, | |
| 284 | - background_repeat_horizontal, // repeat the background image only horizontally | |
| 285 | - background_repeat_vertical, | |
| 286 | - background_no_repeat, | |
| 287 | - color(RGB color), | |
| 288 | - float_to_left, // the web item will float to the left and text will wrap around | |
| 289 | - float_to_right, | |
| 290 | - font_family(String font_name), // "verdana" "helvetica" "times" etc... | |
| 291 | - font_size(Int32 size), | |
| 292 | - italic, | |
| 293 | - oblique, | |
| 294 | - small_capitals, | |
| 295 | - bold, | |
| 296 | - bolder, | |
| 297 | - lighter, | |
| 298 | - line_height(Int32 height), | |
| 299 | - text_center, | |
| 300 | - text_left, | |
| 301 | - text_right, | |
| 302 | - text_justify, | |
| 303 | - text_underline, | |
| 304 | - text_blink, | |
| 305 | - text_line_through, | |
| 306 | - width(Int32 n). | |
| 307 | - | |
| 308 | - | |
| 309 | - | |
| 310 | -public type HTML_Element: | |
| 311 | - style(List(WebStyle) styles, HTML_Element content),... | |
| 312 | - | |
| 313 | -public type HTML_Form: | |
| 314 | - style(List(WebStyle) styles, HTML_Form content),... | |
| 315 | - | |
| 316 | - | |
| 317 | -public type HTML_Element: | |
| 318 | - image | |
| 319 | - ( | |
| 320 | - String file_name, | |
| 321 | - String description | |
| 322 | - ),... | |
| 323 | - | |
| 324 | -public type HTML_Form: | |
| 325 | - image | |
| 326 | - ( | |
| 327 | - String file_name, | |
| 328 | - String description | |
| 329 | - ),... | |
| 330 | - | |
| 331 | - | |
| 332 | - | |
| 333 | - A HTML_Element and HTML_Form may be a table. A table is produced by the constructor | |
| 334 | - 'table' from the type 'Web_item'. This constructor takes 2 arguments: | |
| 335 | - | |
| 336 | - - a list of 'table options', | |
| 337 | - - a list of 'rows'. | |
| 338 | - | |
| 339 | - Of course, you use as many options as you want, including none (if you do not want any | |
| 340 | - option, put the empty list '[ ]' as this argument). Some options have precedence over | |
| 341 | - others. For example a background image will hide the background color. | |
| 342 | - | |
| 343 | - Table options are defined below: | |
| 344 | - | |
| 345 | -public type Table_Option: | |
| 346 | - | |
| 347 | - /* use a color as a background for the table, if you want it to | |
| 348 | - be different from the background of the page */ | |
| 349 | - background_color(RGB), | |
| 350 | - | |
| 351 | - /* or use an image as the background of the table */ | |
| 352 | - background_image(String file_name), | |
| 353 | - | |
| 354 | - /* draw a border line around the table (and around each cell in | |
| 355 | - the table). You may also specify a geometry (in pixels) for the | |
| 356 | - border. This makes the 'in relief' part of the border appear | |
| 357 | - more or less wide. You may also specify a color for the border. */ | |
| 358 | - border(Int32, /* width of exterior (pixels) */ | |
| 359 | - Int32, /* width of top */ | |
| 360 | - Int32), /* width of interior */ | |
| 361 | - border_color(RGB), | |
| 362 | - absolute_width(Int32). | |
| 363 | - | |
| 364 | - | |
| 365 | - | |
| 366 | -public define Table_Option nude = border(0,0,0). | |
| 367 | - | |
| 368 | - | |
| 369 | - A 'table row' is made of a list of 'row options', and a list of 'cells'. A 'cell' | |
| 370 | - itself has a list of 'cell options', and a web item, which is its content. We begin by | |
| 371 | - the description of options. | |
| 372 | - | |
| 373 | -public type Row_Option: | |
| 374 | - /* following concerns the horizontal positions of items within the | |
| 375 | - cells of the row */ | |
| 376 | - left, | |
| 377 | - h_center, | |
| 378 | - right, | |
| 379 | - /* the following concerns the vertical positions of items, within | |
| 380 | - the cells of the row */ | |
| 381 | - top, | |
| 382 | - v_center, | |
| 383 | - bottom, | |
| 384 | - absolute_height(Int32), | |
| 385 | - base_line, | |
| 386 | - /* set the background color of all cells in the row */ | |
| 387 | - background_color(RGB). | |
| 388 | - | |
| 389 | - | |
| 390 | - | |
| 391 | -public type Cell_Option: | |
| 392 | - /* all row options are available for individual cells, and apply | |
| 393 | - here only to one cell. */ | |
| 394 | - left, | |
| 395 | - h_center, | |
| 396 | - right, | |
| 397 | - top, | |
| 398 | - v_center, | |
| 399 | - bottom, | |
| 400 | - base_line, | |
| 401 | - background_color(RGB), | |
| 402 | - /* you can set the width of the cell either absolutely (in pixels) | |
| 403 | - or as a percentage of the width of the table. */ | |
| 404 | - background_image(String file_name), | |
| 405 | - absolute_width(Int32), | |
| 406 | - relative_width(Int32), | |
| 407 | - absolute_height(Int32), | |
| 408 | - relative_height(Int32), | |
| 409 | - /* a cell may span over several columns or rows in the table */ | |
| 410 | - columns(Int32), | |
| 411 | - rows(Int32), | |
| 412 | - nowrap. | |
| 413 | - | |
| 414 | - | |
| 415 | -public type Element_Cell: | |
| 416 | - cell | |
| 417 | - ( | |
| 418 | - List(Cell_Option), | |
| 419 | - HTML_Element | |
| 420 | - ). | |
| 421 | - | |
| 422 | -public type Form_Cell: | |
| 423 | - cell | |
| 424 | - ( | |
| 425 | - List(Cell_Option), | |
| 426 | - HTML_Form | |
| 427 | - ). | |
| 428 | - | |
| 429 | -public type Item_Cell: | |
| 430 | - cell | |
| 431 | - ( | |
| 432 | - List(Cell_Option), | |
| 433 | - HTML_Item | |
| 434 | - ). | |
| 435 | - | |
| 436 | -public type Element_Row: | |
| 437 | - row | |
| 438 | - ( | |
| 439 | - List(Row_Option), | |
| 440 | - List(Element_Cell) | |
| 441 | - ). | |
| 442 | - | |
| 443 | -public type Form_Row: | |
| 444 | - row | |
| 445 | - ( | |
| 446 | - List(Row_Option), | |
| 447 | - List(Form_Cell) | |
| 448 | - ). | |
| 449 | - | |
| 450 | -public type Item_Row: | |
| 451 | - row | |
| 452 | - ( | |
| 453 | - List(Row_Option), | |
| 454 | - List(Item_Cell) | |
| 455 | - ). | |
| 456 | - row | |
| 457 | - ( | |
| 458 | - List(Row_Option), | |
| 459 | - List(Form_Cell) | |
| 460 | - ). | |
| 461 | - | |
| 462 | -public type HTML_Element: | |
| 463 | - table | |
| 464 | - ( | |
| 465 | - List(Table_Option), | |
| 466 | - List(Element_Row) | |
| 467 | - ),... | |
| 468 | - | |
| 469 | -public type HTML_Form: | |
| 470 | - table | |
| 471 | - ( | |
| 472 | - List(Table_Option), | |
| 473 | - List(Form_Row) | |
| 474 | - ),... | |
| 475 | - | |
| 476 | -public type HTML_Item: | |
| 477 | - table | |
| 478 | - ( | |
| 479 | - List(Table_Option), | |
| 480 | - List(Item_Row) | |
| 481 | - ),... | |
| 482 | - | |
| 483 | - | |
| 484 | - Special link for jumping to a label | |
| 485 | - | |
| 486 | -public type HTML_Element: | |
| 487 | - label | |
| 488 | - ( | |
| 489 | - String lable_name | |
| 490 | - ),... | |
| 491 | - | |
| 492 | -public type HTML_Element: | |
| 493 | - go_to_label | |
| 494 | - ( | |
| 495 | - String label_name, | |
| 496 | - HTML_Element content | |
| 497 | - ). | |
| 498 | - | |
| 499 | - | |
| 500 | -public type HTML_Form: | |
| 501 | - label | |
| 502 | - ( | |
| 503 | - String lable_name | |
| 504 | - ),... | |
| 505 | - | |
| 506 | -public type HTML_Form: | |
| 507 | - go_to_label | |
| 508 | - ( | |
| 509 | - String label_name, | |
| 510 | - HTML_Form content | |
| 511 | - ), | |
| 512 | - vscroller | |
| 513 | - ( | |
| 514 | - Int32 height, | |
| 515 | - HTML_Form content | |
| 516 | - ),... | |
| 517 | - | |
| 518 | - | |
| 519 | - | |
| 520 | - A form could contain a link. But the content of a link will be only a text or an image. | |
| 521 | - | |
| 522 | -public type HTML_Link: | |
| 523 | - text(Printable_tree), | |
| 524 | - image | |
| 525 | - ( | |
| 526 | - String file_name, | |
| 527 | - String description | |
| 528 | - ), | |
| 529 | - style(List(WebStyle) styles, HTML_Link content). | |
| 530 | - | |
| 531 | - | |
| 532 | -public type HTML_Form: | |
| 533 | - text_input | |
| 534 | - ( | |
| 535 | - String name, /* text field to be documented by user */ | |
| 536 | - Int32 size, | |
| 537 | - String initial_value | |
| 538 | - ), | |
| 539 | - password_input | |
| 540 | - ( | |
| 541 | - String name, | |
| 542 | - Int32 size | |
| 543 | - ), | |
| 544 | - upload | |
| 545 | - ( | |
| 546 | - String name, | |
| 547 | - Int32 size | |
| 548 | - ), | |
| 549 | - submit | |
| 550 | - ( | |
| 551 | - String name, | |
| 552 | - String text | |
| 553 | - ), | |
| 554 | - image_submit | |
| 555 | - ( | |
| 556 | - String name, | |
| 557 | - String image_file_name, | |
| 558 | - String description | |
| 559 | - ), | |
| 560 | - rollover_submit | |
| 561 | - ( | |
| 562 | - String name, | |
| 563 | - String image_on, | |
| 564 | - String image_off | |
| 565 | - ), | |
| 566 | - link_to_window | |
| 567 | - ( | |
| 568 | - String name, | |
| 569 | - String label_name, | |
| 570 | - String web_args, | |
| 571 | - String window_name, | |
| 572 | - HTML_Link content, | |
| 573 | - Int32 width, | |
| 574 | - Int32 height | |
| 575 | - ), | |
| 576 | - radio_button | |
| 577 | - ( | |
| 578 | - Printable_tree name, | |
| 579 | - String value | |
| 580 | - ), | |
| 581 | - checked_radio_button | |
| 582 | - ( | |
| 583 | - Printable_tree name, | |
| 584 | - String value | |
| 585 | - ), | |
| 586 | - check_box | |
| 587 | - ( | |
| 588 | - Printable_tree name, | |
| 589 | - String value | |
| 590 | - ), | |
| 591 | - checked_box | |
| 592 | - ( | |
| 593 | - Printable_tree name, | |
| 594 | - String value | |
| 595 | - ). | |
| 596 | - | |
| 597 | - | |
| 598 | - | |
| 599 | -public type HTML_Item: | |
| 600 | - element | |
| 601 | - ( | |
| 602 | - HTML_Element | |
| 603 | - ), | |
| 604 | - form | |
| 605 | - ( | |
| 606 | - Printable_tree name, // actually the URI | |
| 607 | - String label_name, | |
| 608 | - HTML_Form form | |
| 609 | - ), | |
| 610 | - named_form | |
| 611 | - ( | |
| 612 | - Printable_tree name, | |
| 613 | - String form_name, | |
| 614 | - String label_name, | |
| 615 | - HTML_Form form | |
| 616 | - ), | |
| 617 | - link_to_window | |
| 618 | - ( | |
| 619 | - String name, | |
| 620 | - String label_name, | |
| 621 | - String web_args, | |
| 622 | - String window_name, | |
| 623 | - HTML_Element content, | |
| 624 | - Int32 width, | |
| 625 | - Int32 height | |
| 626 | - ),... | |
| 627 | - | |
| 628 | - | |
| 629 | - | |
| 630 | - | |
| 631 | - | |
| 632 | - A 'rollover' has the same role as a submit button or link, but it is prettier. It is | |
| 633 | - made of two images. The first one 'image_on' determines the aspect of the button when | |
| 634 | - the mouse cursor is on it. The other one 'image_off' determines the aspect of the | |
| 635 | - button when the mouse cursor is anywhere else. The two images should be of the same | |
| 636 | - size, otherwise bad effects may occur. The last operand 'description' is a small text | |
| 637 | - which describes the role of the button. It appears in a bubble in the browser's window. | |
| 638 | - | |
| 639 | -public type HTML_Item: | |
| 640 | - rollover | |
| 641 | - ( | |
| 642 | - List(String) preload_images, | |
| 643 | - String url, | |
| 644 | - String target, | |
| 645 | - String image_on, | |
| 646 | - String image_off, | |
| 647 | - String description | |
| 648 | - ),... | |
| 649 | - | |
| 650 | - | |
| 651 | - Special link to email : | |
| 652 | - | |
| 653 | -public type HTML_Item: | |
| 654 | - mail_to | |
| 655 | - ( | |
| 656 | - String addr, | |
| 657 | - HTML_Element content | |
| 658 | - ). | |
| 659 | - | |
| 660 | - | |
| 661 | - *** 3. Convenience functions | |
| 662 | - **************************** | |
| 663 | - | |
| 664 | - *** 3.1 for HTML_Element & HTML Form | |
| 665 | - ************************************* | |
| 666 | - | |
| 667 | -public define HTML_Element | |
| 668 | - text | |
| 669 | - ( | |
| 670 | - String s | |
| 671 | - ) = | |
| 672 | - text([s]). | |
| 673 | - | |
| 674 | -public define HTML_Form | |
| 675 | - text | |
| 676 | - ( | |
| 677 | - String s | |
| 678 | - ) = | |
| 679 | - text([s]). | |
| 680 | - | |
| 681 | -public define HTML_Link | |
| 682 | - text | |
| 683 | - ( | |
| 684 | - String s | |
| 685 | - ) = | |
| 686 | - text([s]). | |
| 687 | - | |
| 688 | - | |
| 689 | -public define HTML_Element | |
| 690 | - integer | |
| 691 | - ( | |
| 692 | - Int32 n | |
| 693 | - ) = | |
| 694 | - text([integer_to_string(n)]). | |
| 695 | - | |
| 696 | -public define HTML_Form | |
| 697 | - integer | |
| 698 | - ( | |
| 699 | - Int32 n | |
| 700 | - ) = | |
| 701 | - text([integer_to_string(n)]). | |
| 702 | - | |
| 703 | - | |
| 704 | -public define HTML_Element | |
| 705 | - float | |
| 706 | - ( | |
| 707 | - Float f, | |
| 708 | - Int32 n | |
| 709 | - ) = | |
| 710 | - text([float_to_string(f,n)]). | |
| 711 | - | |
| 712 | -public define HTML_Form | |
| 713 | - float | |
| 714 | - ( | |
| 715 | - Float f, | |
| 716 | - Int32 n | |
| 717 | - ) = | |
| 718 | - text([float_to_string(f,n)]). | |
| 719 | - | |
| 720 | - | |
| 721 | -public define HTML_Element | |
| 722 | - image | |
| 723 | - ( | |
| 724 | - String file_name | |
| 725 | - ) = | |
| 726 | - image(file_name,""). | |
| 727 | - | |
| 728 | -public define HTML_Form | |
| 729 | - image | |
| 730 | - ( | |
| 731 | - String file_name | |
| 732 | - ) = | |
| 733 | - image(file_name,""). | |
| 734 | - | |
| 735 | -public define HTML_Link | |
| 736 | - image | |
| 737 | - ( | |
| 738 | - String file_name | |
| 739 | - ) = | |
| 740 | - image(file_name,""). | |
| 741 | - | |
| 742 | - | |
| 743 | - *** 3.2 for HTML_Form | |
| 744 | - ********************* | |
| 745 | - | |
| 746 | -public define HTML_Form | |
| 747 | - submit | |
| 748 | - ( | |
| 749 | - String text | |
| 750 | - ) = | |
| 751 | - submit("sub",text). | |
| 752 | - | |
| 753 | - | |
| 754 | -public define HTML_Form | |
| 755 | - image_submit | |
| 756 | - ( | |
| 757 | - String name, | |
| 758 | - String image_file_name | |
| 759 | - ) = | |
| 760 | - image_submit(name,image_file_name,""). | |
| 761 | - | |
| 762 | - | |
| 763 | -public define HTML_Form | |
| 764 | - image_submit | |
| 765 | - ( | |
| 766 | - String image_file_name | |
| 767 | - ) = | |
| 768 | - image_submit("sub",image_file_name,""). | |
| 769 | - | |
| 770 | -public define HTML_Form | |
| 771 | - link_to_window | |
| 772 | - ( | |
| 773 | - String name, | |
| 774 | - String web_args, | |
| 775 | - String window_name, | |
| 776 | - HTML_Link content, | |
| 777 | - Int32 width, | |
| 778 | - Int32 height | |
| 779 | - ) = | |
| 780 | - link_to_window(name,"",web_args,window_name,content,width,height). | |
| 781 | - | |
| 782 | - *** 3.3 For HTML_Item (-> element) | |
| 783 | - ********************************** | |
| 784 | - | |
| 785 | -public define HTML_Item | |
| 786 | - text | |
| 787 | - ( | |
| 788 | - String s | |
| 789 | - ) = | |
| 790 | - element(text([s])). | |
| 791 | - | |
| 792 | -public define HTML_Item | |
| 793 | - par | |
| 794 | - ( | |
| 795 | - String s | |
| 796 | - ) = | |
| 797 | - element(par(s)). | |
| 798 | - | |
| 799 | - | |
| 800 | -public define HTML_Item | |
| 801 | - center | |
| 802 | - ( | |
| 803 | - HTML_Element he | |
| 804 | - ) = | |
| 805 | - element(center(he)). | |
| 806 | - | |
| 807 | -public define HTML_Item | |
| 808 | - style | |
| 809 | - ( | |
| 810 | - List(WebStyle) lws, | |
| 811 | - HTML_Element he | |
| 812 | - ) = | |
| 813 | - element(style(lws,he)). | |
| 814 | - | |
| 815 | - | |
| 816 | - | |
| 817 | -public define HTML_Item | |
| 818 | - link_to_window | |
| 819 | - ( | |
| 820 | - String name, | |
| 821 | - String web_args, | |
| 822 | - String window_name, | |
| 823 | - HTML_Element content, | |
| 824 | - Int32 width, | |
| 825 | - Int32 height | |
| 826 | - ) = | |
| 827 | - link_to_window(name,"",web_args,window_name,content,width,height). | |
| 828 | - | |
| 829 | - | |
| 830 | -define Item_Cell | |
| 831 | - cell | |
| 832 | - ( | |
| 833 | - List(Cell_Option) lco, | |
| 834 | - HTML_Element he | |
| 835 | - ) = | |
| 836 | - cell([],element(he)). | |
| 837 | - | |
| 838 | - | |
| 839 | - public define HTML_Item | |
| 840 | - table | |
| 841 | - ( | |
| 842 | - List(Table_Option) lto, | |
| 843 | - List(Element_Row) rows | |
| 844 | - ) = | |
| 845 | - element(table(lto,rows)). | |
| 846 | - | |
| 847 | - | |
| 848 | - | |
| 849 | - | |
| 850 | -public define HTML_Item | |
| 851 | - label | |
| 852 | - ( | |
| 853 | - String label_name | |
| 854 | - ) = | |
| 855 | - element(label(label_name)). | |
| 856 | - | |
| 857 | -public define HTML_Item | |
| 858 | - go_to_label | |
| 859 | - ( | |
| 860 | - String label_name, | |
| 861 | - HTML_Element he | |
| 862 | - ) = | |
| 863 | - element(go_to_label(label_name,he)). | |
| 864 | - | |
| 865 | - | |
| 866 | -public define HTML_Item | |
| 867 | - integer | |
| 868 | - ( | |
| 869 | - Int32 n | |
| 870 | - ) = | |
| 871 | - element(text([integer_to_string(n)])). | |
| 872 | - | |
| 873 | -public define HTML_Item | |
| 874 | - float | |
| 875 | - ( | |
| 876 | - Float f, | |
| 877 | - Int32 n | |
| 878 | - ) = | |
| 879 | - element(text([float_to_string(f,n)])). | |
| 880 | - | |
| 881 | -public define HTML_Item | |
| 882 | - image | |
| 883 | - ( | |
| 884 | - String file_name | |
| 885 | - ) = | |
| 886 | - element(image(file_name,"")). | |
| 887 | - | |
| 888 | - | |
| 889 | -public define HTML_Item | |
| 890 | - form | |
| 891 | - ( | |
| 892 | - Printable_tree name, | |
| 893 | - HTML_Form f | |
| 894 | - ) = | |
| 895 | - form(name,"",f). | |
| 896 | - | |
| 897 | -public define HTML_Item | |
| 898 | - named_form | |
| 899 | - ( | |
| 900 | - Printable_tree name, | |
| 901 | - String form_name, | |
| 902 | - HTML_Form f | |
| 903 | - ) = | |
| 904 | - named_form(name,form_name,"",f). | |
| 905 | - | |
| 906 | - | |
| 907 | - | |
| 908 | -public define HTML_Item empty_item = element(text((Printable_tree)[])). | |
| 909 | - | |
| 910 | - *** 3.4 Empty cells & empty rows | |
| 911 | - ******************************** | |
| 912 | - | |
| 913 | -public define Element_Cell | |
| 914 | - empty_cell = | |
| 915 | - cell([],text([])). | |
| 916 | - | |
| 917 | - public define Element_row | |
| 918 | - empty_row = | |
| 919 | - | |
| 920 | - | |
| 921 | -public define Form_Cell | |
| 922 | - empty_cell = | |
| 923 | - cell([],text([])). | |
| 924 | - | |
| 925 | -public define Item_Cell | |
| 926 | - empty_cell = | |
| 927 | - cell([],element(text([]))). | |
| 928 | - | |
| 929 | -public define Item_Row | |
| 930 | - empty_row = | |
| 931 | - row([],(List(Item_Cell))[]). | |
| 932 | - | |
| 933 | - | |
| 934 | - | |
| 935 | - *** 3.5 Spacers | |
| 936 | - *************** | |
| 937 | - | |
| 938 | - public define HTML_Element spacer = image(anubis_directory+"/library/web/spacer.gif"). | |
| 939 | - public define HTML_Form spacer = image(anubis_directory+"/library/web/spacer.gif"). | |
| 940 | - | |
| 941 | -public define HTML_Element spacer = image("spacer.gif"). | |
| 942 | -public define HTML_Form spacer = image("spacer.gif"). | |
| 943 | - | |
| 944 | -public define Element_Cell | |
| 945 | - h_spacer | |
| 946 | - ( | |
| 947 | - Int32 n | |
| 948 | - ) = | |
| 949 | - cell([absolute_width(n)],spacer). | |
| 950 | - | |
| 951 | -public define Element_Row | |
| 952 | - h_spacer | |
| 953 | - ( | |
| 954 | - Int32 n | |
| 955 | - ) = | |
| 956 | - row([],[h_spacer(n)]). | |
| 957 | - | |
| 958 | -public define Form_Cell | |
| 959 | - h_spacer | |
| 960 | - ( | |
| 961 | - Int32 n | |
| 962 | - ) = | |
| 963 | - cell([absolute_width(n)],spacer). | |
| 964 | - | |
| 965 | -public define Form_Row | |
| 966 | - h_spacer | |
| 967 | - ( | |
| 968 | - Int32 n | |
| 969 | - ) = | |
| 970 | - row([],[h_spacer(n)]). | |
| 971 | - | |
| 972 | -public define Item_Cell | |
| 973 | - h_spacer | |
| 974 | - ( | |
| 975 | - Int32 n | |
| 976 | - ) = | |
| 977 | - cell([absolute_width(n)],spacer). | |
| 978 | - | |
| 979 | -public define Item_Row | |
| 980 | - h_spacer | |
| 981 | - ( | |
| 982 | - Int32 n | |
| 983 | - ) = | |
| 984 | - row([],(List(Item_Cell))[h_spacer(n)]). | |
| 985 | - | |
| 986 | -public define Element_Row | |
| 987 | - v_spacer | |
| 988 | - ( | |
| 989 | - Int32 n | |
| 990 | - ) = | |
| 991 | - row([absolute_height(n)],[cell([],spacer)]). | |
| 992 | - | |
| 993 | -public define Form_Row | |
| 994 | - v_spacer | |
| 995 | - ( | |
| 996 | - Int32 n | |
| 997 | - ) = | |
| 998 | - row([absolute_height(n)],[cell([],spacer)]). | |
| 999 | - | |
| 1000 | -public define Item_Row | |
| 1001 | - v_spacer | |
| 1002 | - ( | |
| 1003 | - Int32 n | |
| 1004 | - ) = | |
| 1005 | - row([absolute_height(n)],(List(Item_Cell)) [cell([],spacer)]). | |
| 1006 | - | |
| 1007 | - | |
| 1008 | - | |
| 1009 | -public define HTML_Element | |
| 1010 | - spacer | |
| 1011 | - ( | |
| 1012 | - Int32 w, | |
| 1013 | - Int32 h | |
| 1014 | - ) = | |
| 1015 | - table([],[row([absolute_height(h)],[cell([absolute_width(w)],spacer)])]). | |
| 1016 | - | |
| 1017 | -public define HTML_Form | |
| 1018 | - spacer | |
| 1019 | - ( | |
| 1020 | - Int32 w, | |
| 1021 | - Int32 h | |
| 1022 | - ) = | |
| 1023 | - table([],[row([absolute_height(h)],[cell([absolute_width(w)],spacer)])]) | |
| 1024 | - . | |
| 1025 | -public define HTML_Item | |
| 1026 | - spacer | |
| 1027 | - ( | |
| 1028 | - Int32 w, | |
| 1029 | - Int32 h | |
| 1030 | - ) = | |
| 1031 | - element(table([],[row([absolute_height(h)],[cell([absolute_width(w)],spacer)])])). | |
| 1032 | - | |
| 1033 | - | |
| 1034 | - | |
| 1035 | - --- That's all for the public part ! -------------------------------------------------- | |
| 1036 | - | |
| 1037 | - | |
| 1038 | - | |
| 1039 | - *** 1. Managing Web Arguments. | |
| 1040 | - *** 2. Formating operations (Anubis --> HTML/Javascript) | |
| 1041 | - *** 2.1 Formating a rgb color. | |
| 1042 | - *** 2.2 Formating body options | |
| 1043 | - *** 2.3 Formating table options | |
| 1044 | - *** 2.4 Formating row options | |
| 1045 | - *** 2.5 Formating cell options | |
| 1046 | - *** 2.6 Formating cells | |
| 1047 | - *** 2.7 Formating rows | |
| 1048 | - *** 2.8 Formating selector | |
| 1049 | - *** 2.9 Formating web-styles | |
| 1050 | - *** 2.10 Formating common alternatives from HTML_Form et HTML_Element | |
| 1051 | - *** 2.11 Formating HTML_Form | |
| 1052 | - *** 2.12 Formating HTML_Element | |
| 1053 | - *** 2.13 Formating HTML_Item | |
| 1054 | - *** 3. Printing the HTML_Page | |
| 1055 | - | |
| 1056 | - | |
| 1057 | - | |
| 1058 | -variable Printable_tree scripts = [ ]. | |
| 1059 | - | |
| 1060 | -define One | |
| 1061 | - add_script | |
| 1062 | - ( | |
| 1063 | - Printable_tree script | |
| 1064 | - ) = | |
| 1065 | - scripts <- [*scripts . script]. | |
| 1066 | - | |
| 1067 | - | |
| 1068 | -define Printable_tree | |
| 1069 | - format | |
| 1070 | - ( | |
| 1071 | - String c_ticket, | |
| 1072 | - String s_ticket, | |
| 1073 | - HTML_Element e | |
| 1074 | - ). | |
| 1075 | - | |
| 1076 | -define Printable_tree | |
| 1077 | - format | |
| 1078 | - ( | |
| 1079 | - String c_ticket, | |
| 1080 | - String s_ticket, | |
| 1081 | - HTML_Form f | |
| 1082 | - ). | |
| 1083 | - | |
| 1084 | -define Printable_tree | |
| 1085 | - format | |
| 1086 | - ( | |
| 1087 | - String c_ticket, | |
| 1088 | - String s_ticket, | |
| 1089 | - HTML_Item i | |
| 1090 | - ). | |
| 1091 | - | |
| 1092 | - | |
| 1093 | - *** 1. Managing Web Arguments. | |
| 1094 | - ****************************** | |
| 1095 | - | |
| 1096 | - public define Web_arg_value | |
| 1097 | - web_arg_value | |
| 1098 | - ( | |
| 1099 | - List(Web_arg) l, | |
| 1100 | - String name | |
| 1101 | - ) = | |
| 1102 | - if l is | |
| 1103 | - { | |
| 1104 | - [ ] then not_found, | |
| 1105 | - [h . t] then if h is | |
| 1106 | - { | |
| 1107 | - web_arg(n,v) then | |
| 1108 | - if name=n | |
| 1109 | - then found(v) | |
| 1110 | - else web_arg_value(t,name), | |
| 1111 | - | |
| 1112 | - upload(n,v,tfn) then | |
| 1113 | - if name=n | |
| 1114 | - then found(v) | |
| 1115 | - else web_arg_value(t,name) | |
| 1116 | - } | |
| 1117 | - }. | |
| 1118 | - | |
| 1119 | - | |
| 1120 | - *** 2. Formating operations (Anubis --> HTML/Javascript) | |
| 1121 | - ******************************************************** | |
| 1122 | - | |
| 1123 | - *** 2.1 Formating a rgb color. | |
| 1124 | - ****************************** | |
| 1125 | - | |
| 1126 | -define String | |
| 1127 | - format | |
| 1128 | - ( | |
| 1129 | - RGB color | |
| 1130 | - ) = | |
| 1131 | - if color is rgb(r,g,b) then | |
| 1132 | - "#" + hexadecimal(word8_to_Word32(r),2) | |
| 1133 | - + hexadecimal(word8_to_Word32(g),2) | |
| 1134 | - + hexadecimal(word8_to_Word32(b),2) | |
| 1135 | - + "". | |
| 1136 | - | |
| 1137 | - | |
| 1138 | - *** 2.2 Formating body options | |
| 1139 | - ****************************** | |
| 1140 | - | |
| 1141 | -type BodyOnload: | |
| 1142 | - reload_frame(String name, String url). | |
| 1143 | - | |
| 1144 | -variable List(BodyOnload) body_onloads = [ ]. | |
| 1145 | - | |
| 1146 | - | |
| 1147 | -define One | |
| 1148 | - add_body_onload | |
| 1149 | - ( | |
| 1150 | - BodyOnload item | |
| 1151 | - ) = | |
| 1152 | - body_onloads <- [item . *body_onloads]. | |
| 1153 | - | |
| 1154 | -define Printable_tree | |
| 1155 | - format | |
| 1156 | - ( | |
| 1157 | - BodyOnload item | |
| 1158 | - ) = | |
| 1159 | - if item is | |
| 1160 | - { | |
| 1161 | - reload_frame(name,url) then (Printable_tree) | |
| 1162 | - [ " window.open('",url,"','",name,"');" ] | |
| 1163 | - }. | |
| 1164 | - | |
| 1165 | -define Printable_tree | |
| 1166 | - format | |
| 1167 | - ( | |
| 1168 | - List(BodyOnload) l | |
| 1169 | - ) = | |
| 1170 | - if l is | |
| 1171 | - { | |
| 1172 | - [ ] then (Printable_tree)[ ], | |
| 1173 | - [h . t] then (Printable_tree) | |
| 1174 | - [format(h) . format(t)] | |
| 1175 | - }. | |
| 1176 | - | |
| 1177 | - | |
| 1178 | -type ImageToLoad: | |
| 1179 | - simple | |
| 1180 | - ( | |
| 1181 | - String image_name | |
| 1182 | - ), | |
| 1183 | - with_rollover | |
| 1184 | - ( | |
| 1185 | - String image_name, | |
| 1186 | - String rollover_name | |
| 1187 | - ). | |
| 1188 | - | |
| 1189 | -variable List(ImageToLoad) images_to_load = []. | |
| 1190 | - | |
| 1191 | - | |
| 1192 | -define Printable_tree | |
| 1193 | - preload_list | |
| 1194 | - ( | |
| 1195 | - List(ImageToLoad) images, | |
| 1196 | - Int32 n, | |
| 1197 | - ) = | |
| 1198 | - if images is | |
| 1199 | - { | |
| 1200 | - [ ] then [ ], | |
| 1201 | - [h . t] then | |
| 1202 | - [" preloaded_images[",n,"].src = '",image_name(h),"';", | |
| 1203 | - if h is | |
| 1204 | - { | |
| 1205 | - simple(_) then [], | |
| 1206 | - with_rollover(n1,r) then | |
| 1207 | - [" preloaded_images[",n1,"].onload = 'allow_rollover(\"",r,"\")';"] | |
| 1208 | - } | |
| 1209 | - . preload_list(t,n-1)] | |
| 1210 | - }. | |
| 1211 | - | |
| 1212 | -define Printable_tree | |
| 1213 | - load_image_script | |
| 1214 | - ( | |
| 1215 | - List(ImageToLoad) images | |
| 1216 | - ) = | |
| 1217 | - if images is | |
| 1218 | - { | |
| 1219 | - [ ] then [ ], | |
| 1220 | - [_ . _] then | |
| 1221 | - [ | |
| 1222 | - "<script>", | |
| 1223 | - " var preloaded_images = new Array(",length(images),");", | |
| 1224 | - " var pi_i = 0;", | |
| 1225 | - " for(pi_i = 0; pi_i < ",length(images),"; pi_i++) {", | |
| 1226 | - " preloaded_images[pi_i] = new Image(); }", | |
| 1227 | - " function preload_images() {", | |
| 1228 | - preload_list(images,length(images)-1), | |
| 1229 | - " }</script>" | |
| 1230 | - ] | |
| 1231 | - }. | |
| 1232 | - | |
| 1233 | - | |
| 1234 | - | |
| 1235 | -define Printable_tree | |
| 1236 | - format | |
| 1237 | - ( | |
| 1238 | - Body_Option o | |
| 1239 | - ) = | |
| 1240 | - if o is | |
| 1241 | - { | |
| 1242 | - background_color(c) then [" bgcolor=" , (String)format(c)], | |
| 1243 | - background_image(n) then [" background=", n], | |
| 1244 | - load_image(n) then images_to_load <- [simple(n) . *images_to_load]; [ ], | |
| 1245 | - left_margin(n) then [" leftmargin=", n], | |
| 1246 | - top_margin(n) then [" topmargin=", n], | |
| 1247 | - margin_width(n) then [" marginwidth=", n], | |
| 1248 | - margin_height(n) then [" marginheight=", n], | |
| 1249 | - reload_frame(n,url) then add_body_onload(reload_frame(n,url)); [ ], | |
| 1250 | - onload(n) then [" onLoad=\"", n, "()\""] | |
| 1251 | - }. | |
| 1252 | - | |
| 1253 | -define Printable_tree | |
| 1254 | - format | |
| 1255 | - ( | |
| 1256 | - List(Body_Option) l | |
| 1257 | - ) = | |
| 1258 | - if l is | |
| 1259 | - { | |
| 1260 | - [ ] then [ ], | |
| 1261 | - [h . t] then [format(h) . format(t)] | |
| 1262 | - }. | |
| 1263 | - | |
| 1264 | - | |
| 1265 | - *** 2.3 Formating table options | |
| 1266 | - ******************************* | |
| 1267 | - | |
| 1268 | -define Printable_tree | |
| 1269 | - format | |
| 1270 | - ( | |
| 1271 | - List(Table_Option) l | |
| 1272 | - ) = | |
| 1273 | - if l is | |
| 1274 | - { | |
| 1275 | - [ ] then [ ], | |
| 1276 | - [h . t] then | |
| 1277 | - [if h is | |
| 1278 | - { | |
| 1279 | - background_color(c) then [" bgcolor=", (String)format(c)], | |
| 1280 | - background_image(f) then [" background=",f], | |
| 1281 | - border(e,top,i) then [" border=",e," cellspacing=",top," cellpadding=",i], | |
| 1282 | - border_color(c) then [" bordercolor=", (String)format(c)], | |
| 1283 | - absolute_width(n) then [" width=",n] | |
| 1284 | - }, format(t)] | |
| 1285 | - }. | |
| 1286 | - | |
| 1287 | - | |
| 1288 | - | |
| 1289 | - | |
| 1290 | - *** 2.4 Formating row options | |
| 1291 | - ***************************** | |
| 1292 | - | |
| 1293 | -define Printable_tree | |
| 1294 | - format | |
| 1295 | - ( | |
| 1296 | - List(Row_Option) l | |
| 1297 | - ) = | |
| 1298 | - if l is | |
| 1299 | - { | |
| 1300 | - [ ] then [ ], | |
| 1301 | - [first . others] then | |
| 1302 | - [if first is | |
| 1303 | - { | |
| 1304 | - left then [" align=left"], | |
| 1305 | - h_center then [" align=center"], | |
| 1306 | - right then [" align=right"], | |
| 1307 | - top then [" valign=top"], | |
| 1308 | - v_center then [" valign=center"], | |
| 1309 | - bottom then [" valign=bottom"], | |
| 1310 | - absolute_height(n) then [" height=\"",n,"\""], | |
| 1311 | - base_line then [" valign=baseline"], | |
| 1312 | - background_color(c) then [" bgcolor=",(String)format(c)] | |
| 1313 | - }, | |
| 1314 | - format(others)] | |
| 1315 | - }. | |
| 1316 | - | |
| 1317 | - | |
| 1318 | - *** 2.5 Formating cell options | |
| 1319 | - ****************************** | |
| 1320 | - | |
| 1321 | -define Int32 | |
| 1322 | - percentage | |
| 1323 | - ( | |
| 1324 | - Int32 n | |
| 1325 | - ) = | |
| 1326 | - if n < 0 then 0 | |
| 1327 | - else if n > 100 then 100 | |
| 1328 | - else n. | |
| 1329 | - | |
| 1330 | -define Printable_tree | |
| 1331 | - format | |
| 1332 | - ( | |
| 1333 | - List(Cell_Option) l | |
| 1334 | - ) = | |
| 1335 | - if l is | |
| 1336 | - { | |
| 1337 | - [ ] then [ ], | |
| 1338 | - [first . others] then | |
| 1339 | - [if first is | |
| 1340 | - { | |
| 1341 | - left then (Printable_tree)[" align=left"], | |
| 1342 | - h_center then (Printable_tree)[" align=center"], | |
| 1343 | - right then (Printable_tree)[" align=right"], | |
| 1344 | - top then (Printable_tree)[" valign=top"], | |
| 1345 | - v_center then (Printable_tree)[" valign=center"], | |
| 1346 | - bottom then (Printable_tree)[" valign=bottom"], | |
| 1347 | - base_line then (Printable_tree)[" valign=baseline"], | |
| 1348 | - background_color(c) then (Printable_tree)[" bgcolor=",(String)format(c)], | |
| 1349 | - background_image(n) then (Printable_tree)[" style=\"background: url(",n,")\""], | |
| 1350 | - absolute_width(w) then (Printable_tree)[" width=",w], | |
| 1351 | - relative_width(r) then (Printable_tree)[" width=",percentage(r),""], | |
| 1352 | - absolute_height(h) then (Printable_tree)[" height=",h], | |
| 1353 | - relative_height(r) then (Printable_tree)[" height=",percentage(r),""], | |
| 1354 | - columns(n) then (Printable_tree)[" colspan=",n], | |
| 1355 | - rows(n) then (Printable_tree)[" rowspan=",n], | |
| 1356 | - nowrap then (Printable_tree)[" nowrap"] | |
| 1357 | - } | |
| 1358 | - . format(others)] | |
| 1359 | - }. | |
| 1360 | - | |
| 1361 | - | |
| 1362 | - | |
| 1363 | - *** 2.6 Formating cells | |
| 1364 | - *********************** | |
| 1365 | - | |
| 1366 | -define Printable_tree | |
| 1367 | - format | |
| 1368 | - ( | |
| 1369 | - String c_ticket, | |
| 1370 | - String s_ticket, | |
| 1371 | - List(Element_Cell) l | |
| 1372 | - ) = | |
| 1373 | - if l is | |
| 1374 | - { | |
| 1375 | - [ ] then [ ], | |
| 1376 | - [first . others] then | |
| 1377 | - [ | |
| 1378 | - if first is cell(options,e) then | |
| 1379 | - [ | |
| 1380 | - "<td",format(options),">", | |
| 1381 | - format(c_ticket,s_ticket,e),"</td>" | |
| 1382 | - ], | |
| 1383 | - format(c_ticket,s_ticket,others) | |
| 1384 | - ] | |
| 1385 | - }. | |
| 1386 | - | |
| 1387 | -define Printable_tree | |
| 1388 | - format | |
| 1389 | - ( | |
| 1390 | - String c_ticket, | |
| 1391 | - String s_ticket, | |
| 1392 | - List(Form_Cell) l | |
| 1393 | - ) = | |
| 1394 | - if l is | |
| 1395 | - { | |
| 1396 | - [ ] then [ ], | |
| 1397 | - [first . others] then | |
| 1398 | - [ | |
| 1399 | - if first is cell(options,e) then | |
| 1400 | - [ | |
| 1401 | - "<td",format(options),">", | |
| 1402 | - format(c_ticket,s_ticket,e),"</td>" | |
| 1403 | - ], | |
| 1404 | - format(c_ticket,s_ticket,others) | |
| 1405 | - ] | |
| 1406 | - }. | |
| 1407 | - | |
| 1408 | -define Printable_tree | |
| 1409 | - format | |
| 1410 | - ( | |
| 1411 | - String c_ticket, | |
| 1412 | - String s_ticket, | |
| 1413 | - List(Item_Cell) l | |
| 1414 | - ) = | |
| 1415 | - if l is | |
| 1416 | - { | |
| 1417 | - [ ] then [ ], | |
| 1418 | - [first . others] then | |
| 1419 | - [ | |
| 1420 | - if first is cell(options,e) then | |
| 1421 | - [ | |
| 1422 | - "<td",format(options),">", | |
| 1423 | - format(c_ticket,s_ticket,e),"</td>" | |
| 1424 | - ], | |
| 1425 | - format(c_ticket,s_ticket,others) | |
| 1426 | - ] | |
| 1427 | - }. | |
| 1428 | - | |
| 1429 | - | |
| 1430 | - | |
| 1431 | - *** 2.7 Formating rows | |
| 1432 | - ********************** | |
| 1433 | - | |
| 1434 | -define Printable_tree | |
| 1435 | - format | |
| 1436 | - ( | |
| 1437 | - String c_ticket, | |
| 1438 | - String s_ticket, | |
| 1439 | - Element_Row er | |
| 1440 | - ) = | |
| 1441 | - if er is row(options,cells) then | |
| 1442 | - [ "<tr",format(options),">", | |
| 1443 | - format(c_ticket,s_ticket,cells),"</tr>" | |
| 1444 | - ]. | |
| 1445 | - | |
| 1446 | -define Printable_tree | |
| 1447 | - format | |
| 1448 | - ( | |
| 1449 | - String c_ticket, | |
| 1450 | - String s_ticket, | |
| 1451 | - List(Element_Row) l | |
| 1452 | - ) = | |
| 1453 | - if l is | |
| 1454 | - { | |
| 1455 | - [ ] then [ ], | |
| 1456 | - [first_row . other_rows] then (Printable_tree) | |
| 1457 | - [format(c_ticket,s_ticket,first_row), format(c_ticket,s_ticket,other_rows)] | |
| 1458 | - }. | |
| 1459 | - | |
| 1460 | -define Printable_tree | |
| 1461 | - format | |
| 1462 | - ( | |
| 1463 | - String c_ticket, | |
| 1464 | - String s_ticket, | |
| 1465 | - Form_Row fr | |
| 1466 | - ) = | |
| 1467 | - if fr is row(options,cells) then | |
| 1468 | - [ "<tr",format(options),">", | |
| 1469 | - format(c_ticket,s_ticket,cells),"</tr>" | |
| 1470 | - ]. | |
| 1471 | - | |
| 1472 | -define Printable_tree | |
| 1473 | - format | |
| 1474 | - ( | |
| 1475 | - String c_ticket, | |
| 1476 | - String s_ticket, | |
| 1477 | - List(Form_Row) l | |
| 1478 | - ) = | |
| 1479 | - if l is | |
| 1480 | - { | |
| 1481 | - [ ] then [ ], | |
| 1482 | - [first_row . other_rows] then (Printable_tree) | |
| 1483 | - [format(c_ticket,s_ticket,first_row), format(c_ticket,s_ticket,other_rows)] | |
| 1484 | - }. | |
| 1485 | - | |
| 1486 | -define Printable_tree | |
| 1487 | - format | |
| 1488 | - ( | |
| 1489 | - String c_ticket, | |
| 1490 | - String s_ticket, | |
| 1491 | - List(Item_Row) rows | |
| 1492 | - ) = | |
| 1493 | - if rows is | |
| 1494 | - { | |
| 1495 | - [] then [], | |
| 1496 | - [h . t] then | |
| 1497 | - if h is row(options,cells) then | |
| 1498 | - [ "<tr",format(options),">", | |
| 1499 | - format(c_ticket,s_ticket,cells),"</tr>", | |
| 1500 | - format(c_ticket,s_ticket,t) | |
| 1501 | - ] | |
| 1502 | - }. | |
| 1503 | - if rows is | |
| 1504 | - { | |
| 1505 | - a & b then (Printable_tree)[format(c_ticket,s_ticket,a),format(c_ticket,s_ticket,b)], | |
| 1506 | - ir & er then (Printable_tree)[format(c_ticket,s_ticket,ir),format(c_ticket,s_ticket,er)], | |
| 1507 | - er & ir then (Printable_tree)[format(c_ticket,s_ticket,er),format(c_ticket,s_ticket,ir)], | |
| 1508 | - ir & fr then (Printable_tree)[format(c_ticket,s_ticket,ir),format(c_ticket,s_ticket,fr)], | |
| 1509 | - row(options,cells) then (Printable_tree) | |
| 1510 | - [ "<tr",format(options),">", | |
| 1511 | - format(c_ticket,s_ticket,cells),"</tr>" | |
| 1512 | - ], | |
| 1513 | - }. | |
| 1514 | - | |
| 1515 | - | |
| 1516 | - *** 2.8 Formating selector | |
| 1517 | - ************************** | |
| 1518 | - | |
| 1519 | -define Printable_tree | |
| 1520 | - format_choices | |
| 1521 | - ( | |
| 1522 | - List(String) l | |
| 1523 | - ) = | |
| 1524 | - if l is | |
| 1525 | - { | |
| 1526 | - [ ] then [ ], | |
| 1527 | - [h . t] then ["<option>",h . format_choices(t)] | |
| 1528 | - }. | |
| 1529 | - | |
| 1530 | - | |
| 1531 | -define Printable_tree | |
| 1532 | - format_choices | |
| 1533 | - ( | |
| 1534 | - List(String) l, | |
| 1535 | - String selected | |
| 1536 | - ) = | |
| 1537 | - if l is | |
| 1538 | - { | |
| 1539 | - [ ] then [ ], | |
| 1540 | - [h . t] then if h = selected | |
| 1541 | - then ["<option selected>",h . format_choices(t)] | |
| 1542 | - else ["<option>",h . format_choices(t,selected)] | |
| 1543 | - }. | |
| 1544 | - | |
| 1545 | - | |
| 1546 | - *** 2.9 Formating web-styles | |
| 1547 | - **************************** | |
| 1548 | - | |
| 1549 | -define String | |
| 1550 | - format | |
| 1551 | - ( | |
| 1552 | - WebStyle ws | |
| 1553 | - ) = | |
| 1554 | - if ws is | |
| 1555 | - { | |
| 1556 | - background_image(fn) then "background: url("+fn+")", | |
| 1557 | - background_color(c) then "background: "+format(c), | |
| 1558 | - background_transparent then "background: transparent", | |
| 1559 | - background_repeat_horizontal then "background: repeat-x", | |
| 1560 | - background_repeat_vertical then "background: repeat-y", | |
| 1561 | - background_no_repeat then "background: no-repeat", | |
| 1562 | - color(c) then "color: "+format(c), | |
| 1563 | - float_to_left then "float: left", | |
| 1564 | - float_to_right then "float: right", | |
| 1565 | - font_family(n) then "font-family: "+n, | |
| 1566 | - font_size(n) then "font-size: "+integer_to_string(n)+"pt", | |
| 1567 | - italic then "font-style: italic", | |
| 1568 | - oblique then "font-style: oblique", | |
| 1569 | - small_capitals then "font-variant: small-caps", | |
| 1570 | - bold then "font-weight: bold", | |
| 1571 | - bolder then "font-weight: bolder", | |
| 1572 | - lighter then "font-weight: lighter", | |
| 1573 | - line_height(h) then "line-height: "+integer_to_string(h), | |
| 1574 | - text_center then "text-align: center", | |
| 1575 | - text_left then "text-align: left", | |
| 1576 | - text_right then "text-align: right", | |
| 1577 | - text_justify then "text-align: justify", | |
| 1578 | - text_underline then "text-decoration: underline", | |
| 1579 | - text_blink then "text-decoration: blink", | |
| 1580 | - text_line_through then "text-decoration: line-through", | |
| 1581 | - width(n) then "width: "+integer_to_string(n), | |
| 1582 | - }. | |
| 1583 | - | |
| 1584 | - | |
| 1585 | -define Printable_tree | |
| 1586 | - format | |
| 1587 | - ( | |
| 1588 | - List(WebStyle) l | |
| 1589 | - ) = | |
| 1590 | - if l is | |
| 1591 | - { | |
| 1592 | - [ ] then [ ], | |
| 1593 | - [h . t] then | |
| 1594 | - if t is | |
| 1595 | - { | |
| 1596 | - [ ] then [format(h)], | |
| 1597 | - [_ . _] then [format(h), "; " . format(t)] | |
| 1598 | - } | |
| 1599 | - }. | |
| 1600 | - | |
| 1601 | - | |
| 1602 | - *** 2.10 Formating common alternatives from HTML_Form et HTML_Element | |
| 1603 | - ********************************************************************* | |
| 1604 | - | |
| 1605 | -define Printable_tree | |
| 1606 | - format_par | |
| 1607 | - ( | |
| 1608 | - String s | |
| 1609 | - ) = | |
| 1610 | - ["<p align=justify>", s, " </p>"]. | |
| 1611 | - | |
| 1612 | -define Printable_tree | |
| 1613 | - format_image | |
| 1614 | - ( | |
| 1615 | - String fn, | |
| 1616 | - String desc, | |
| 1617 | - ) = | |
| 1618 | - ["<img src=\"", fn, (if desc="" then [] else ["\" alt=\"",desc]), "\" border=0>"]. | |
| 1619 | - | |
| 1620 | - | |
| 1621 | - *** 2.11 Formating HTML_Form | |
| 1622 | - **************************** | |
| 1623 | - | |
| 1624 | -define Printable_tree | |
| 1625 | - format | |
| 1626 | - ( | |
| 1627 | - String c_ticket, | |
| 1628 | - String s_ticket, | |
| 1629 | - HTML_Link hl | |
| 1630 | - ) = | |
| 1631 | - if hl is | |
| 1632 | - { | |
| 1633 | - text(Printable_tree p) then (Printable_tree)p, | |
| 1634 | - image(fn,desc) then (Printable_tree)format_image(fn,desc), | |
| 1635 | - style(l,lk) then | |
| 1636 | - (Printable_tree)["<span style=\"", format(l), "\">", format(c_ticket,s_ticket,lk), "</span>"], | |
| 1637 | - }. | |
| 1638 | - | |
| 1639 | -define Printable_tree | |
| 1640 | - format | |
| 1641 | - ( | |
| 1642 | - String c_ticket, | |
| 1643 | - String s_ticket, | |
| 1644 | - HTML_Form f | |
| 1645 | - ) = | |
| 1646 | - if f is | |
| 1647 | - { | |
| 1648 | - a & b then (Printable_tree)[format(c_ticket,s_ticket,a), " ", | |
| 1649 | - format(c_ticket,s_ticket,b)], | |
| 1650 | - | |
| 1651 | - text(Printable_tree p) then (Printable_tree)p, | |
| 1652 | - | |
| 1653 | - par(s) then (Printable_tree)format_par(s), | |
| 1654 | - | |
| 1655 | - center(elm) then (Printable_tree)["<center>", format(c_ticket,s_ticket,elm),"</center>"], | |
| 1656 | - | |
| 1657 | - style(l,elm) then | |
| 1658 | - (Printable_tree)["<span style=\"", format(l), "\">", format(c_ticket,s_ticket,elm), "</span>"], | |
| 1659 | - | |
| 1660 | - | |
| 1661 | - image(fn,desc) then (Printable_tree)format_image(fn,desc), | |
| 1662 | - | |
| 1663 | - table(ops,rows) then (Printable_tree) | |
| 1664 | - ["<table ",format(ops), ">",format(c_ticket,s_ticket,rows),"</table>"], | |
| 1665 | - | |
| 1666 | - | |
| 1667 | - label(name) then (Printable_tree)["<a name=\"",name,"\">"], | |
| 1668 | - | |
| 1669 | - go_to_label(name,content) then (Printable_tree)["<a href=#",name,">", | |
| 1670 | - format(c_ticket,s_ticket,content),"</a>"], | |
| 1671 | - | |
| 1672 | - | |
| 1673 | - vscroller(height,content) then (Printable_tree) | |
| 1674 | - [ | |
| 1675 | - "<script language=\"JavaScript\">", | |
| 1676 | - "var up = true;\n", | |
| 1677 | - "function myscroll() {\n", | |
| 1678 | - "if (document.layers) { var myobj = eval(document.zozoza); } else\n", | |
| 1679 | - "if (document.getElementById) { var myobj = eval(\"document.getElementById('zozoza').style\"); } else\n", | |
| 1680 | - "if (document.all) { var myobj = eval(document.all.zozoza.style); };\n", | |
| 1681 | - "var i = 0;\n", | |
| 1682 | - "for (i = 0; i < document.anchors.length; i++) {\n", | |
| 1683 | - "if (document.anchors[i].name == \"gluglu\") { var ch = document.anchors[i].y; }}\n", | |
| 1684 | - "var y_pos = parseInt(myobj.top);\n", | |
| 1685 | - // "var glupos = gluobj.y;\n", | |
| 1686 | - // "var ch = glupos;\n", | |
| 1687 | -// "var zizi = typeof(glupos);\n", | |
| 1688 | -// "var zizo = glupos.toString();\n", | |
| 1689 | -// "alert(\"type of glupos = \"+zizi+\" val: \"+zizo); return; \n", | |
| 1690 | - " if (up) { myobj.top = (y_pos - (2)); } else { myobj.top = (y_pos + (2)); };\n", | |
| 1691 | - " if (y_pos < ",height," - ch) { up=false; };\n", | |
| 1692 | - " if (y_pos > 0) {up = true;};\n", | |
| 1693 | - "setTimeout(\"myscroll()\",100)}\n", | |
| 1694 | - "</script>", | |
| 1695 | - "<div id=\"tagada\" style=\"position:absolute; width:500px; height:",height, | |
| 1696 | - "px; clip: rect(0px 500px ",height,"px 0px)\">", | |
| 1697 | - "<div id=\"zozoza\" style=\"position:absolute; width:500px; z-index:1; top:0px\">", | |
| 1698 | - "<table><tr><td>\n", | |
| 1699 | - format(c_ticket,s_ticket,content), | |
| 1700 | - "</td></tr><tr><td>", | |
| 1701 | - "<a name=\"gluglu\"> a </a></td></tr></table></div>\n", | |
| 1702 | - "</div>", | |
| 1703 | - format(c_ticket,s_ticket,(HTML_Element)s pacer(500,height)), | |
| 1704 | - ], | |
| 1705 | - | |
| 1706 | - | |
| 1707 | - text_input(n,s,v) then (Printable_tree) | |
| 1708 | - [" <input type=text name=\"", n, "\" size=", s, " value=\"", v,"\">"], | |
| 1709 | - | |
| 1710 | - password_input(n,s) then (Printable_tree) | |
| 1711 | - [" <input type=password name=\"", n, "\" size=", s,">"], | |
| 1712 | - | |
| 1713 | - upload(n,size) then (Printable_tree) | |
| 1714 | - ["<input type=file size=",size," multiple name=",n,">"], | |
| 1715 | - | |
| 1716 | - submit(n,t) then (Printable_tree)["<input type=submit name=",n," value=\"",t,"\">"], | |
| 1717 | - | |
| 1718 | - image_submit(n,fn,desc) then (Printable_tree) | |
| 1719 | - ["<input type=image name=",n," src=\"",fn,"\"alt=\"",desc,"\" border=0>"], | |
| 1720 | - | |
| 1721 | - rollover_submit(n,ion,ioff) then (Printable_tree) | |
| 1722 | - ["<input type=image name=",n," src=\"",ioff,"\" border=0", | |
| 1723 | - " onMouseOver=\"this.src='",ion,"'\"", | |
| 1724 | - " onMouseOut=\"this.src='",ioff,"';\"",">"], | |
| 1725 | - | |
| 1726 | - link_to_window(n,lab,args,wn,e,w,h) then (Printable_tree) | |
| 1727 | - ["<a href=\"javascript:void window.open('",n, | |
| 1728 | - (if member('?',n) then "&" else "?"), | |
| 1729 | - "c_ticket=",c_ticket, | |
| 1730 | - (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 1731 | - "&target=",wn, | |
| 1732 | - if args="" then "" else "&",args, | |
| 1733 | - (if lab="" then [] else ["&#",lab]), "','", | |
| 1734 | - wn,"','width=",w,",height=",h,", resizable,scrollbars');\">", | |
| 1735 | - format(c_ticket,s_ticket,e),"</a>"], | |
| 1736 | - | |
| 1737 | - radio_button(n,v) then (Printable_tree) | |
| 1738 | - ["<input type=radio name=", n, " value=\"", v, "\">"], | |
| 1739 | - | |
| 1740 | - checked_radio_button(n,v) then (Printable_tree) | |
| 1741 | - ["<input type=radio checked name=", n, " value=\"", v, "\">"], | |
| 1742 | - | |
| 1743 | - check_box(n,v) then (Printable_tree) | |
| 1744 | - ["<input type=checkbox name=", n, " value=\"", v, "\">"], | |
| 1745 | - | |
| 1746 | - checked_box(n,v) then (Printable_tree) | |
| 1747 | - ["<input type=checkbox checked name=", n, " value=\"", v, "\">"] | |
| 1748 | - }. | |
| 1749 | - | |
| 1750 | - | |
| 1751 | - | |
| 1752 | - *** 2.12 Formating HTML_Element | |
| 1753 | - ******************************* | |
| 1754 | - | |
| 1755 | -define Printable_tree | |
| 1756 | - format | |
| 1757 | - ( | |
| 1758 | - String c_ticket, | |
| 1759 | - String s_ticket, | |
| 1760 | - HTML_Element e | |
| 1761 | - ) = | |
| 1762 | - if e is | |
| 1763 | - { | |
| 1764 | - a & b then (Printable_tree)[format(c_ticket,s_ticket,a), " ", | |
| 1765 | - format(c_ticket,s_ticket,b)], | |
| 1766 | - | |
| 1767 | - text(Printable_tree p) then (Printable_tree)p, | |
| 1768 | - | |
| 1769 | - par(s) then (Printable_tree)format_par(s), | |
| 1770 | - | |
| 1771 | - center(elm) then (Printable_tree)["<center>", format(c_ticket,s_ticket,elm),"</center>"], | |
| 1772 | - | |
| 1773 | - style(l,elm) then | |
| 1774 | - (Printable_tree)["<span style=\"", format(l), "\">", format(c_ticket,s_ticket,elm), "</span>"], | |
| 1775 | - | |
| 1776 | - | |
| 1777 | - image(fn,desc) then (Printable_tree)format_image(fn,desc), | |
| 1778 | - | |
| 1779 | - table(ops,rows) then (Printable_tree) | |
| 1780 | - ["<table ",format(ops), ">",format(c_ticket,s_ticket,rows),"</table>"], | |
| 1781 | - | |
| 1782 | - | |
| 1783 | - label(name) then (Printable_tree)["<a name=\"",name,"\">"], | |
| 1784 | - | |
| 1785 | - go_to_label(name,content) then (Printable_tree)["<a href=#",name,">", | |
| 1786 | - format(c_ticket,s_ticket,content),"</a>"] | |
| 1787 | - }. | |
| 1788 | - | |
| 1789 | - | |
| 1790 | - | |
| 1791 | - *** 2.13 Formating HTML_Item | |
| 1792 | - **************************** | |
| 1793 | - | |
| 1794 | - | |
| 1795 | - The next variable is a multipurpose counter (used to generate unique names). | |
| 1796 | - | |
| 1797 | -variable Int32 web_count = 0. | |
| 1798 | - | |
| 1799 | -define Int32 | |
| 1800 | - new_web_count | |
| 1801 | - = | |
| 1802 | - web_count <- *web_count+1; | |
| 1803 | - *web_count. | |
| 1804 | - | |
| 1805 | - | |
| 1806 | - | |
| 1807 | -define Bool find_upload(HTML_Form f). | |
| 1808 | - | |
| 1809 | -define Bool | |
| 1810 | - find_upload | |
| 1811 | - ( | |
| 1812 | - List(Form_Cell) l | |
| 1813 | - ) = | |
| 1814 | - if l is | |
| 1815 | - { | |
| 1816 | - [] then false, | |
| 1817 | - [h . t] then if h is cell(_,f) then if find_upload(f) then true else find_upload(t) | |
| 1818 | - }. | |
| 1819 | - | |
| 1820 | -define Bool | |
| 1821 | - find_upload | |
| 1822 | - ( | |
| 1823 | - List(Form_Row) l | |
| 1824 | - ) = | |
| 1825 | - if l is | |
| 1826 | - { | |
| 1827 | - [] then false, | |
| 1828 | - [h . t] then | |
| 1829 | - if h is row(_,lfc) then | |
| 1830 | - if find_upload(lfc) then true else find_upload(t) | |
| 1831 | - }. | |
| 1832 | - | |
| 1833 | -define Bool | |
| 1834 | - find_upload | |
| 1835 | - ( | |
| 1836 | - HTML_Form f | |
| 1837 | - ) = | |
| 1838 | - if f is | |
| 1839 | - { | |
| 1840 | - a & b then (Bool)if find_upload(a) then true else find_upload(b), | |
| 1841 | - text(_) then (Bool)false, | |
| 1842 | - par(_) then (Bool)true, | |
| 1843 | - center(hf) then (Bool)find_upload(hf), | |
| 1844 | - style(_,hf) then (Bool)find_upload(hf), | |
| 1845 | - image(_,_) then (Bool)false, | |
| 1846 | - table(_,fr) then (Bool)find_upload(fr), | |
| 1847 | - label(_) then (Bool)false, | |
| 1848 | - go_to_label(_,hf) then (Bool)find_upload(hf), | |
| 1849 | - vscroller(h,c) then (Bool)find_upload(c), | |
| 1850 | - text_input(_,_,_) then (Bool)false, | |
| 1851 | - password_input(_,_) then (Bool)false, | |
| 1852 | - upload(_,_) then (Bool)true, | |
| 1853 | - submit(_,_) then (Bool)false, | |
| 1854 | - image_submit(_,_,_) then (Bool)false, | |
| 1855 | - rollover_submit(_,_,_) then (Bool)false, | |
| 1856 | - link_to_window(_,_,_,_,_,_,_) then (Bool)false, | |
| 1857 | - radio_button(_,_) then (Bool)false, | |
| 1858 | - checked_radio_button(_,_) then (Bool)false, | |
| 1859 | - check_box(_,_) then (Bool)false, | |
| 1860 | - checked_box(_,_) then (Bool)false | |
| 1861 | - }. | |
| 1862 | - | |
| 1863 | -define String | |
| 1864 | - enctype | |
| 1865 | - ( | |
| 1866 | - HTML_Form f | |
| 1867 | - ) = | |
| 1868 | - if find_upload(f) | |
| 1869 | - then "enctype=multipart/form-data" | |
| 1870 | - else "". | |
| 1871 | - | |
| 1872 | - | |
| 1873 | - | |
| 1874 | -define Printable_tree | |
| 1875 | - format | |
| 1876 | - ( | |
| 1877 | - String c_ticket, | |
| 1878 | - String s_ticket, | |
| 1879 | - HTML_Item i | |
| 1880 | - ) = | |
| 1881 | - if i is | |
| 1882 | - { | |
| 1883 | - a & b then (Printable_tree) [format(c_ticket,s_ticket,a),format(c_ticket,s_ticket,b)], | |
| 1884 | - | |
| 1885 | - center(hi) then (Printable_tree) ["<center>",format(c_ticket,s_ticket,hi),"</center>"], | |
| 1886 | - | |
| 1887 | - table(ops,rows) then (Printable_tree) | |
| 1888 | - ["<table ",format(ops), ">",format(c_ticket,s_ticket,rows),"</table>"], | |
| 1889 | - | |
| 1890 | - element(e) then (Printable_tree) format(c_ticket,s_ticket,e), | |
| 1891 | - | |
| 1892 | - form(n,lab,f) then (Printable_tree) | |
| 1893 | - ["<form ",enctype(f)," method=POST action=\"", n, | |
| 1894 | - (if lab="" then [] else ["#", lab]), "\">", | |
| 1895 | - "<input type=hidden name=s_ticket value=\"",s_ticket,"\">", | |
| 1896 | - "<input type=hidden name=c_ticket value=\"",c_ticket,"\">", | |
| 1897 | - format(c_ticket,s_ticket,f),"</form>"], | |
| 1898 | - | |
| 1899 | - named_form(n,fn,lab,f) then (Printable_tree) | |
| 1900 | - ["<form ",enctype(f)," name=\"",fn,"\" method=POST action=\"", n, | |
| 1901 | - (if lab="" then [] else ["#", lab]), "\">", | |
| 1902 | - "<input type=hidden name=s_ticket value=\"",s_ticket,"\">", | |
| 1903 | - "<input type=hidden name=c_ticket value=\"",c_ticket,"\">", | |
| 1904 | - format(c_ticket,s_ticket,f),"</form>"], | |
| 1905 | - | |
| 1906 | - link_to_window(n,lab,args,wn,e,w,h) then (Printable_tree) | |
| 1907 | - ["<a href=\"javascript:void window.open('",n, | |
| 1908 | - (if member('?',n) then "&" else "?"), | |
| 1909 | - "c_ticket=",c_ticket, | |
| 1910 | - (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 1911 | - "&target=",wn, | |
| 1912 | - if args="" then "" else "&", args, | |
| 1913 | - (if lab="" then [] else ["&#",lab]), "','", | |
| 1914 | - wn,"','width=",w,",height=",h,", resizable,scrollbars');\">", | |
| 1915 | - format(c_ticket,s_ticket,e),"</a>"], | |
| 1916 | - | |
| 1917 | - rollover(prlim,url,target,ion,ioff,descr) then (Printable_tree) | |
| 1918 | - (images_to_load <- [simple(ion) . *images_to_load]; | |
| 1919 | - with name = "ron_"+integer_to_string(new_web_count), | |
| 1920 | - ["<a target=\"",target,"\" href=\"",url, | |
| 1921 | - (if (c_ticket = "" & s_ticket = "") then "" else (if member('?',url) then "&" else "?")), | |
| 1922 | - (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), | |
| 1923 | - (if s_ticket = "" then [ ] else [(if c_ticket="" then "" else "&")+"s_ticket=",s_ticket]), | |
| 1924 | - "\" onMouseOut=\"",name,".src='",ioff, | |
| 1925 | - "';\" onMouseOver=\"",name,".src='",ion,"';\"> | |
| 1926 | - <img src=\"",ioff, "\" name=\"",name,"\" alt=\"",descr,"\" border=0></a>"]), | |
| 1927 | - | |
| 1928 | - mail_to(adr,f) then (Printable_tree) ["<a href=#",adr,">",format(c_ticket,s_ticket,f),"</a>"] | |
| 1929 | - }. | |
| 1930 | - | |
| 1931 | - | |
| 1932 | - | |
| 1933 | - *** 3. Printing the HTML_Page | |
| 1934 | - ***************************** | |
| 1935 | - | |
| 1936 | - | |
| 1937 | -public type HeaderSort: | |
| 1938 | - empty, | |
| 1939 | - anubis, | |
| 1940 | - apache. | |
| 1941 | - | |
| 1942 | - | |
| 1943 | -define Printable_tree | |
| 1944 | - format_keywords | |
| 1945 | - ( | |
| 1946 | - List(String) l | |
| 1947 | - ) = | |
| 1948 | - if l is | |
| 1949 | - { | |
| 1950 | - [] then [ ], | |
| 1951 | - [h . t] then if t is [] | |
| 1952 | - then [h] | |
| 1953 | - else [h , ", " . format_keywords(t)] | |
| 1954 | - }. | |
| 1955 | - | |
| 1956 | -define Printable_tree | |
| 1957 | - format | |
| 1958 | - ( | |
| 1959 | - HTML_Meta m | |
| 1960 | - ) = | |
| 1961 | - if m is | |
| 1962 | - { | |
| 1963 | - keywords(l) then ["<meta name=\"keywords\" content=\"",format_keywords(l),"\">"], | |
| 1964 | - refresh(url,delay) then ["<meta http-equiv=\"Refresh\" content=\"",delay,"; URL=",url,"\">"], | |
| 1965 | - meta(n,c) then ["<meta name=\"",n,"\" content=\"",c,"\">"], | |
| 1966 | - http_equiv(n,c) then ["<meta http-equiv=\"",n,"\" content=\"",c,"\">"] | |
| 1967 | - }. | |
| 1968 | - | |
| 1969 | -define Printable_tree | |
| 1970 | - format | |
| 1971 | - ( | |
| 1972 | - List(HTML_Meta) metas | |
| 1973 | - ) = | |
| 1974 | - if metas is | |
| 1975 | - { | |
| 1976 | - [] then [], | |
| 1977 | - [h . t] then [format(h) . format(t)] | |
| 1978 | - }. | |
| 1979 | - | |
| 1980 | - | |
| 1981 | -define Printable_tree | |
| 1982 | - standard_headers | |
| 1983 | - ( | |
| 1984 | - Int32 size | |
| 1985 | - ) = | |
| 1986 | - [ | |
| 1987 | - "HTTP/1.0 200 OK" + crlf + | |
| 1988 | - "Server: Anubis" + crlf + | |
| 1989 | - "Content-Type: text/html" + crlf + | |
| 1990 | - "Content-Length: "+integer_to_string(size)+crlf+ | |
| 1991 | - crlf | |
| 1992 | - ]. | |
| 1993 | - | |
| 1994 | -define Printable_tree | |
| 1995 | - apache_headers | |
| 1996 | - = | |
| 1997 | - [ | |
| 1998 | - "Content-type: text/html" + crlf + | |
| 1999 | - crlf | |
| 2000 | - ]. | |
| 2001 | - | |
| 2002 | -define String | |
| 2003 | - empty_javascript_source | |
| 2004 | - = | |
| 2005 | - "javascript:'<html><head></head><body></body></html>';". | |
| 2006 | - | |
| 2007 | - | |
| 2008 | - (for frames) | |
| 2009 | -define Printable_tree | |
| 2010 | - add_tickets | |
| 2011 | - ( | |
| 2012 | - String c_ticket, | |
| 2013 | - String s_ticket, | |
| 2014 | - Printable_tree url | |
| 2015 | - ) = | |
| 2016 | - if member('?',url) | |
| 2017 | - then [url , "&c_ticket=", c_ticket, "&s_ticket=", s_ticket ] | |
| 2018 | - else [url , "?c_ticket=", c_ticket, "&s_ticket=", s_ticket ]. | |
| 2019 | - | |
| 2020 | - | |
| 2021 | - | |
| 2022 | -public define Printable_tree | |
| 2023 | - format | |
| 2024 | - ( | |
| 2025 | - HeaderSort hs, | |
| 2026 | - String c_ticket, | |
| 2027 | - String s_ticket, | |
| 2028 | - HTML_Page p | |
| 2029 | - ) = | |
| 2030 | - if p is | |
| 2031 | - { | |
| 2032 | - html_page(title,metas,head_scripts,body) then | |
| 2033 | - with body = | |
| 2034 | - [ | |
| 2035 | - "<html>", | |
| 2036 | - "<head>", | |
| 2037 | - "<title>", title, "</title>", | |
| 2038 | - format(metas), | |
| 2039 | - head_scripts, | |
| 2040 | - "</head>", | |
| 2041 | - "<body ", | |
| 2042 | - if body is body(options,item) then | |
| 2043 | - with b_options = format(options), // layers : format(prepare(options)), | |
| 2044 | - [b_options, " onLoad='body_onloads(); myscroll();", | |
| 2045 | - if *images_to_load is [] then "" else " preload_images();", | |
| 2046 | - "'>", | |
| 2047 | - load_image_script(*images_to_load), | |
| 2048 | - "<script language=\"JavaScript\">", | |
| 2049 | - (*scripts), | |
| 2050 | - " function body_onloads() {", | |
| 2051 | - format(*body_onloads), | |
| 2052 | - "}</script>", | |
| 2053 | - format(c_ticket,s_ticket,item) | |
| 2054 | - ], | |
| 2055 | - "</body>", | |
| 2056 | - "</html>" | |
| 2057 | - ], | |
| 2058 | - [ | |
| 2059 | - if hs is | |
| 2060 | - { | |
| 2061 | - empty then [ ], | |
| 2062 | - anubis then standard_headers(length(body)), | |
| 2063 | - apache then apache_headers | |
| 2064 | - } | |
| 2065 | - . body | |
| 2066 | - ], | |
| 2067 | - standard_frameset(title,metas,height,width,main) then | |
| 2068 | - with body = | |
| 2069 | - [ | |
| 2070 | - "<html>", | |
| 2071 | - "<head>", | |
| 2072 | - "<title>", title, "</title>", | |
| 2073 | - format(metas), | |
| 2074 | - "</head>", | |
| 2075 | - "<frameset frameborder=no border=0 framespacing=0", | |
| 2076 | - " marginwidth=0 marginheight=0 cols=\"",width,",*\" rows=\"*\">", | |
| 2077 | - " <frame src=\"",empty_javascript_source,"\" name=\"left\" frameborder=no", | |
| 2078 | - " marginwidth=0 marginheight=0 scrolling=no>", | |
| 2079 | - " <frameset frameborder=no border=0 framespacing=0 rows=\"",height,",*\" cols=\"*\">", | |
| 2080 | - " <frame src=\"",empty_javascript_source,"\" name=\"top\"", | |
| 2081 | - " marginwidth=0 marginheight=0 frameborder=no scrolling=no>", | |
| 2082 | - " <frame src =\"", add_tickets(c_ticket,s_ticket,main), | |
| 2083 | - "\" name=\"main\" marginwidth=0 marginheight=0 frameborder=no>", | |
| 2084 | - " </frameset>", | |
| 2085 | - "</frameset>", | |
| 2086 | - "</html>" | |
| 2087 | - ], | |
| 2088 | - [ | |
| 2089 | - if hs is | |
| 2090 | - { | |
| 2091 | - empty then [ ], | |
| 2092 | - anubis then standard_headers(length(body)), | |
| 2093 | - apache then apache_headers | |
| 2094 | - } | |
| 2095 | - . body | |
| 2096 | - ] | |
| 2097 | - | |
| 2098 | - }. | |
| 2099 | - | |
| 2100 | - | |
| 2101 | - | |
| 2102 | - | |
| 2103 | - *** for kernel.anubis | |
| 2104 | - | |
| 2105 | -public define Bool | |
| 2106 | - print_with_headers | |
| 2107 | - ( | |
| 2108 | - HeaderSort hs, | |
| 2109 | - String c_ticket, | |
| 2110 | - String s_ticket, | |
| 2111 | - HTML_Page p | |
| 2112 | - ) = | |
| 2113 | - print(format(hs,c_ticket,s_ticket,p)). |