Commit d384a763bcf58c0bd944454bdee4c031012fea4a
1 parent
d17b1121
Cleanup HTML code to be more W3C compliant.
Showing
3 changed files
with
2465 additions
and
2459 deletions
Show diff stats
calexium_lib/web/CXM_html.anubis
| 1 | - | |
| 2 | - *Project* The Anubis Project | |
| 3 | - *Title* Producing HTML/Javascript code. | |
| 4 | - | |
| 5 | - *Copyright* Copyright (c) Alain Prouté 2001. | |
| 6 | - | |
| 7 | -read tools/basis.anubis | |
| 8 | - | |
| 9 | - | |
| 10 | - | |
| 11 | - | |
| 12 | - *** Managing Web Arguments. | |
| 13 | - | |
| 14 | - When a client submits a form, he sends informations to the server. This information is | |
| 15 | - transformed by the server into a list of data of type 'Web_arg'. This is the reason why | |
| 16 | - a 'web page' operation always has a unique argument of type 'List(Web_arg)'. | |
| 17 | - | |
| 18 | - The type 'Web_arg' is defined in 'web/common.anubis' as follows: | |
| 19 | - | |
| 20 | - public type Web_arg: | |
| 21 | - web_arg(String name, | |
| 22 | - String value), | |
| 23 | - upload (String name, | |
| 24 | - String value, | |
| 25 | - String temp_file_path). | |
| 26 | - | |
| 27 | -read web/CXM_common.anubis | |
| 28 | - | |
| 29 | - In other words, a 'web argument' is just a pair made of the name of the argument, and | |
| 30 | - the value of the argument, and both are character strings. 'upload' will be explained | |
| 31 | - later. | |
| 32 | - | |
| 33 | - | |
| 34 | - The next variable is a multipurpose counter (used to generate unique names). | |
| 35 | - | |
| 36 | -variable Int32 web_count = 0. | |
| 37 | - | |
| 38 | -define Int32 | |
| 39 | - new_web_count | |
| 40 | - = | |
| 41 | - web_count <- *web_count+1; | |
| 42 | - *web_count. | |
| 43 | - | |
| 44 | - | |
| 45 | - Names for Web colors. | |
| 46 | - | |
| 47 | -public type Web_color_name: | |
| 48 | - aliceblue, | |
| 49 | - antiquewhite1, | |
| 50 | - antiquewhite2, | |
| 51 | - antiquewhite3, | |
| 52 | - antiquewhite4, | |
| 53 | - aquamarine1, | |
| 54 | - aquamarine2, | |
| 55 | - aquamarine3, | |
| 56 | - aquamarine4, | |
| 57 | - azure1, | |
| 58 | - azure2, | |
| 59 | - azure3, | |
| 60 | - azure4, | |
| 61 | - yellow. | |
| 62 | - | |
| 63 | - | |
| 64 | - and so on ... (see below why I did not do more). | |
| 65 | - | |
| 66 | - | |
| 67 | - | |
| 68 | - Web colors. | |
| 69 | - | |
| 70 | -public type Web_color: | |
| 71 | - rgb(Int32,Int32,Int32), /* give the color by its components */ | |
| 72 | - _(Web_color_name). /* or by its name */ | |
| 73 | - | |
| 74 | - | |
| 75 | - | |
| 76 | - | |
| 77 | - The following produces '<meta>' tags, which are put in the head of the document. | |
| 78 | - | |
| 79 | -public type WebMeta: | |
| 80 | - keywords(List(String)), | |
| 81 | - refresh(String url, Int32 delay), // in seconds | |
| 82 | - meta(String name, String content), | |
| 83 | - http_equiv(String name, String content). | |
| 84 | - | |
| 85 | - | |
| 86 | - | |
| 87 | - | |
| 88 | - | |
| 89 | - ******************************************************* | |
| 90 | - * Web items * | |
| 91 | - * (the many kinds of things one may put in a page) * | |
| 92 | - ******************************************************* | |
| 93 | - | |
| 94 | - | |
| 95 | -public type Web_item: | |
| 96 | - [ ], /* empty (invisible) item */ | |
| 97 | - ... this is a cross recursive type. | |
| 98 | - | |
| 99 | - | |
| 100 | - | |
| 101 | - | |
| 102 | - Options for web page body. | |
| 103 | - | |
| 104 | -public type LayerDisposition: | |
| 105 | - horizontal, | |
| 106 | - vertical. | |
| 107 | - | |
| 108 | -public type FollowPathCommand: // this type is used by the Web_body_option 'follow_path'. | |
| 109 | - pos(Int32 x, // x coordinate of position | |
| 110 | - Int32 y, // y coordinate of position | |
| 111 | - Int32 image_number, // the image to display at that position | |
| 112 | - Int32 delay). // wait that milliseconds before leaving this position | |
| 113 | - | |
| 114 | -public type Web_body_option: | |
| 115 | - background_color(Web_color), /* color for the background */ | |
| 116 | - // | |
| 117 | - // 'psychedelic_background' produces a background color which is continuously changing. | |
| 118 | - // 'average' is the average luminosity of the color. 'amplitude' is the maximal variation | |
| 119 | - // the luminosity around the average. 'delay' is the number of milliseconds between two | |
| 120 | - // color changes. For example, you may try 'psychedelic_background(200,50,1000)', which | |
| 121 | - // produces a background whose color changes very slowly (this is not tiring) among rather | |
| 122 | - // light pastel colors. | |
| 123 | - // | |
| 124 | - psychedelic_background(Int32 average, /* average light (0 to 255) */ | |
| 125 | - Int32 amplitude, /* amplitude of variation of light */ | |
| 126 | - Int32 delay), /* in milliseconds */ | |
| 127 | - background_image(String file_name), /* name of image file for the background */ | |
| 128 | - // | |
| 129 | - // 'scrolling_layer' produces a layer above the page which is scrolling continuously either | |
| 130 | - // vertically or horizontally. The 'content' is indefinitly repeated. | |
| 131 | - // | |
| 132 | - scrolling_layer(LayerDisposition, | |
| 133 | - Int32 steps, /* number of pixels of each move */ | |
| 134 | - Int32 margin, /* measured from left or top in pixels */ | |
| 135 | - Int32 delay, /* milliseconds for one move */ | |
| 136 | - Web_item content, /* content of layer (will be repeated) */ | |
| 137 | - Int32 period), /* number of pixels between two instances of 'content' */ | |
| 138 | - // | |
| 139 | - // 'bounce' shows its content above the page and let it move and bounce on the edges of a rectangle. | |
| 140 | - // The rectangle is determined by the last 4 arguments. | |
| 141 | - // | |
| 142 | - bounce(Web_item content, | |
| 143 | - Int32 left, | |
| 144 | - Int32 right, | |
| 145 | - Int32 top, | |
| 146 | - Int32 bottom), | |
| 147 | - // | |
| 148 | - // put something over the page in any position you want: | |
| 149 | - // | |
| 150 | - over(Web_item content, | |
| 151 | - Int32 left, | |
| 152 | - Int32 top), | |
| 153 | - // | |
| 154 | - // follow_path: let a changing image follow a path on the screen. This gadget shows | |
| 155 | - // an image following a polygonal path on the screen. The image may change at regular | |
| 156 | - // intervals, thus providing extra animation. The images are displayed in the order | |
| 157 | - // they are given in the first argument. When the last image has been displayed, the | |
| 158 | - // first image is displayed again, and so on. The path is a sequence of absolute positions | |
| 159 | - // on screen (actually in the browser's window or frame), which is followed in the | |
| 160 | - // order given in the 'path' argument. If 'loop' is true, the path is followed again and again. | |
| 161 | - // Otherwise, it is followed only once. If you want to make a closed loop, the last | |
| 162 | - // position must be the same as the first one. 'steps' is the number of pixels of distance | |
| 163 | - // between two successive positions of the image, and 'delay' the number of milliseconds | |
| 164 | - // between two successive positions. 'change_every' is the number of steps (a 'step' is | |
| 165 | - // passing from one position to the next one) after which the displayed image is replaced | |
| 166 | - // by the next image. | |
| 167 | - // | |
| 168 | - // Each position 'pos(x,y,i,d)' has 4 parameters. 'x' and 'y' are the coordinates of the | |
| 169 | - // position in the browser's window or frame. 'i' is the number of the image to display | |
| 170 | - // at this position (i.e. the rank of the image in the list 'filename'. The first one has | |
| 171 | - // rank 0). 'd' is the delay in milliseconds to wait before leaving that position. | |
| 172 | - // | |
| 173 | - follow_path(List(String) filenames, /* the changing images which follows the path */ | |
| 174 | - Int32 change_every, /* number of steps betwen two changes */ | |
| 175 | - List(FollowPathCommand) path, /* the polygonal path and commands */ | |
| 176 | - Bool loop, /* if true do it repeatedly, otherwise only once */ | |
| 177 | - Int32 steps, /* approximative distance (in pixels) between two | |
| 178 | - successive positions */ | |
| 179 | - Int32 delay), /* milliseconds between two successive positions */ | |
| 180 | - | |
| 181 | - load_image(String name), /* load an image (for next page), which is not displayed */ | |
| 182 | - left_margin(Int32), /* left margin for document */ | |
| 183 | - top_margin(Int32), /* top margin for document */ | |
| 184 | - margin_width(Int32), | |
| 185 | - margin_height(Int32), | |
| 186 | - reload_frame(String name, /* name of target frame */ | |
| 187 | - String url), /* url to load in this frame */ | |
| 188 | - onload(String function_name). /* nom de la fonction javascript (sans les '()') */ | |
| 189 | - | |
| 190 | -public type BodyOnload: | |
| 191 | - reload_frame(String name, String url). | |
| 192 | - | |
| 193 | -variable List(BodyOnload) body_onloads = [ ]. | |
| 194 | - | |
| 195 | -define One | |
| 196 | - add_body_onload | |
| 197 | - ( | |
| 198 | - BodyOnload item | |
| 199 | - ) = | |
| 200 | - body_onloads <- [item . *body_onloads]. | |
| 201 | - | |
| 202 | -define Printable_tree | |
| 203 | - format | |
| 204 | - ( | |
| 205 | - BodyOnload item | |
| 206 | - ) = | |
| 207 | - if item is | |
| 208 | - { | |
| 209 | - reload_frame(name,url) then (Printable_tree) | |
| 210 | - [ " window.open('",url,"','",name,"');" ] | |
| 211 | - }. | |
| 212 | - | |
| 213 | -define Printable_tree | |
| 214 | - format | |
| 215 | - ( | |
| 216 | - List(BodyOnload) l | |
| 217 | - ) = | |
| 218 | - if l is | |
| 219 | - { | |
| 220 | - [ ] then (Printable_tree)[ ], | |
| 221 | - [h . t] then (Printable_tree) | |
| 222 | - [format(h) . format(t)] | |
| 223 | - }. | |
| 224 | - | |
| 225 | - | |
| 226 | ----- Body of a web page. -------------------------------------------- | |
| 227 | -public type Page_body: | |
| 228 | - body(List(Web_body_option), /* list of body options */ | |
| 229 | - Web_item content). /* the content of the page */ | |
| 230 | - | |
| 231 | - | |
| 232 | -public type VFrame: | |
| 233 | - frame(Int32 height, | |
| 234 | - Printable_tree url, | |
| 235 | - String name). | |
| 236 | - | |
| 237 | ----- Web pages. ----------------------------------------------------- | |
| 238 | -public type Web_page: | |
| 239 | - web_page(String title, /* title appearing on top of browser */ | |
| 240 | - List(WebMeta) meta_tags, | |
| 241 | - Printable_tree head_scripts, /* scripts à placer dans la balise head */ | |
| 242 | - Page_body body), /* body of page */ | |
| 243 | - standard_frameset(String title, | |
| 244 | - List(WebMeta) meta_tags, | |
| 245 | - Int32 height, /* height of 'top menu' (pixels) */ | |
| 246 | - Int32 width, /* width of 'left menu' (pixels) */ | |
| 247 | - Printable_tree main). /* url for main */ | |
| 248 | - | |
| 249 | - +---------+--------------------------+ | |
| 250 | - | | ^ | | |
| 251 | - |<-width->| top height | | |
| 252 | - | | v | | |
| 253 | - | left +--------------------------+ | |
| 254 | - | | | | |
| 255 | - | | main | | |
| 256 | - | | | | |
| 257 | - | | | | |
| 258 | - | | | | |
| 259 | - +---------+--------------------------+ | |
| 260 | - | |
| 261 | - Note: top and left frames must be loaded through the Web_body_option 'reload_frame'. | |
| 262 | - | |
| 263 | - | |
| 264 | -public define Web_page | |
| 265 | - web_page | |
| 266 | - ( | |
| 267 | - String title, | |
| 268 | - Page_body body | |
| 269 | - ) = | |
| 270 | - web_page(title,[],[], body). | |
| 271 | - | |
| 272 | -public define Web_page | |
| 273 | - web_page | |
| 274 | - ( | |
| 275 | - String title, | |
| 276 | - List(WebMeta) meta_tags, | |
| 277 | - Page_body body | |
| 278 | - ) = | |
| 279 | - | |
| 280 | - web_page(title, meta_tags, [], body). | |
| 281 | - | |
| 282 | - public define Web_page | |
| 283 | -web_page | |
| 284 | - ( | |
| 285 | - String title, | |
| 286 | - Printable_tree head_scripts, | |
| 287 | - Page_body body | |
| 288 | - ) = | |
| 289 | - | |
| 290 | - web_page(title, [], head_scripts, body). | |
| 291 | - | |
| 292 | -public define Web_page | |
| 293 | -standard_frameset | |
| 294 | - ( | |
| 295 | - String title, | |
| 296 | - Int32 height, | |
| 297 | - Int32 width, | |
| 298 | - Printable_tree main | |
| 299 | - ) = | |
| 300 | - | |
| 301 | - standard_frameset(title, [], height, width, main). | |
| 302 | - | |
| 303 | - | |
| 304 | -variable Printable_tree scripts = []. | |
| 305 | - | |
| 306 | -define One | |
| 307 | - add_script | |
| 308 | - ( | |
| 309 | - Printable_tree script | |
| 310 | - ) = | |
| 311 | - scripts <- [*scripts . script]. | |
| 312 | - | |
| 313 | - | |
| 314 | - | |
| 315 | - ---- Non empty web items. ------------------------------------------- | |
| 316 | - | |
| 317 | - We have already seen the empty web item. Together with the following one, it enables to | |
| 318 | - make (pseudo-)lists of web items, which will be presented one after the other (from | |
| 319 | - left to right) in the browser's window. | |
| 320 | - | |
| 321 | -public type Web_item: | |
| 322 | - [Web_item . Web_item],... | |
| 323 | - | |
| 324 | - | |
| 325 | - A web item may be a simple string or a simple integer: | |
| 326 | - | |
| 327 | -public type Web_item: | |
| 328 | - text(String), | |
| 329 | - text_pt(Printable_tree), | |
| 330 | - text_nowrap(String), | |
| 331 | - text_nowrap_pt(Printable_tree), | |
| 332 | - par(String), | |
| 333 | - preformated_text(String text), | |
| 334 | - integer(Int32), | |
| 335 | - float(Float,Int32),... | |
| 336 | - | |
| 337 | - | |
| 338 | - You may want to center a web item in a page. Just enclose it into | |
| 339 | - 'center(...)': | |
| 340 | - | |
| 341 | -public type Web_item: | |
| 342 | - center(Web_item),... | |
| 343 | - | |
| 344 | - | |
| 345 | - You may want to write characters of a given item with a big font: | |
| 346 | - | |
| 347 | -public type Web_item: | |
| 348 | - bigger(Int32,Web_item), | |
| 349 | - smaller(Int32,Web_item), | |
| 350 | - bold(Web_item), | |
| 351 | - italic(Web_item), | |
| 352 | - big(Web_item), | |
| 353 | - very_big(Web_item),... | |
| 354 | - | |
| 355 | - | |
| 356 | - Most of the previous are subsumed by 'style': | |
| 357 | - | |
| 358 | -public type WebStyle: | |
| 359 | - background_image(String file_name), | |
| 360 | - background_color(Web_color color), | |
| 361 | - background_transparent, | |
| 362 | - background_repeat_horizontal, // repeat the background image only horizontally | |
| 363 | - background_repeat_vertical, | |
| 364 | - background_no_repeat, | |
| 365 | - color(Web_color color), | |
| 366 | - float_to_left, // the web item will float to the left and text will wrap around | |
| 367 | - float_to_right, | |
| 368 | - font_family(String font_name), // "verdana" "helvetica" "times" etc... | |
| 369 | - font_size(Int32 size), | |
| 370 | - italic, | |
| 371 | - oblique, | |
| 372 | - small_capitals, | |
| 373 | - bold, | |
| 374 | - bolder, | |
| 375 | - lighter, | |
| 376 | - line_height(Int32 height), | |
| 377 | - text_center, | |
| 378 | - text_left, | |
| 379 | - text_right, | |
| 380 | - text_justify, | |
| 381 | - text_underline, | |
| 382 | - text_blink, | |
| 383 | - text_line_through, | |
| 384 | - width(Int32 n). | |
| 385 | - | |
| 386 | - | |
| 387 | - | |
| 388 | -public type Web_item: | |
| 389 | - style(List(WebStyle) styles, Web_item content),... | |
| 390 | - | |
| 391 | - | |
| 392 | -public type Web_item: | |
| 393 | - spacer(Int32 width, Int32 height), | |
| 394 | - image(String file_name), /* image */ | |
| 395 | - image_d(String file_name, String description), | |
| 396 | - image_pt(Printable_tree file_name), | |
| 397 | - on_image(String file_name, Web_item content), | |
| 398 | - turning_images(NonEmptyList(String) filenames, Int32 millisecs),... | |
| 399 | - | |
| 400 | - | |
| 401 | - | |
| 402 | - A 'rollover' has the same role as a submit button or link, but it is prettier. It is | |
| 403 | - made of two images. The first one 'image_on' determines the aspect of the button when | |
| 404 | - the mouse cursor is on it. The other one 'image_off' determines the aspect of the | |
| 405 | - button when the mouse cursor is anywhere else. The two images should be of the same | |
| 406 | - size, otherwise bad effects may occur. The last operand 'description' is a small text | |
| 407 | - which describes the role of the button. It appears in a bubble in the browser's window. | |
| 408 | - | |
| 409 | -public type Web_item: | |
| 410 | - rollover(List(String) preload_images, // images to preload before the rollover is effective | |
| 411 | - String url, // URL with possible web arguments | |
| 412 | - String target, | |
| 413 | - String image_on, // file name of 'highlighted' image | |
| 414 | - String image_off, // file name of 'non highlighted' image | |
| 415 | - String description), // short behavior description | |
| 416 | - rollover(List(String) preload_images, | |
| 417 | - String url, | |
| 418 | - String target, | |
| 419 | - String image_on, | |
| 420 | - String image_off, | |
| 421 | - Int32 width, | |
| 422 | - Int32 height, | |
| 423 | - String description), ... | |
| 424 | - | |
| 425 | - | |
| 426 | - Mouse sensitive images are images with predefined zones which are clickable. When | |
| 427 | - clicking in a zone, the specified corresponding URL is loaded by the browser. If two | |
| 428 | - zones overlap, the first one (in the order they are defined) is selected. | |
| 429 | - | |
| 430 | - Zones are of 3 sorts: rectangles, circles and polygons. Point's coordinates are | |
| 431 | - specified as pairs of integers (of anonymous agglomeration type (Int32,Int32)). The | |
| 432 | - first coordinate counts pixels from the left of the image. The second coordinate counts | |
| 433 | - pixels from the top of the image. With polygons, you can construct zones which are | |
| 434 | - almost as complicated as you want. You may also construct a zone as the overlapping of | |
| 435 | - several zones with the same URL. | |
| 436 | - | |
| 437 | -public type Mouse_Sensitive_Zone: | |
| 438 | - rectangle | |
| 439 | - ( | |
| 440 | - (Int32,Int32) left_top, | |
| 441 | - (Int32,Int32) right_bottom, | |
| 442 | - String url | |
| 443 | - ), | |
| 444 | - circle | |
| 445 | - ( | |
| 446 | - (Int32,Int32) center, | |
| 447 | - Int32 radius, | |
| 448 | - String url | |
| 449 | - ), | |
| 450 | - polygon | |
| 451 | - ( | |
| 452 | - List((Int32,Int32)) vertices, | |
| 453 | - String url | |
| 454 | - ). | |
| 455 | - | |
| 456 | -public type Web_item: | |
| 457 | - mouse_sensitive_image(String image_file_name, // the image itself | |
| 458 | - List(Mouse_Sensitive_Zone) zones),... | |
| 459 | - | |
| 460 | - | |
| 461 | - In project: mouse sensitive images, whose zones behave like submission buttons (to be | |
| 462 | - used within a form). | |
| 463 | - | |
| 464 | - | |
| 465 | -public type Web_item: | |
| 466 | - background_sound(String sound_file_name, | |
| 467 | - Bool loop),... | |
| 468 | - | |
| 469 | - | |
| 470 | - | |
| 471 | - ************************* | |
| 472 | - * FORMS * | |
| 473 | - ************************* | |
| 474 | - | |
| 475 | - | |
| 476 | - Use 'forms' in order to get informations back from the client. The constructor 'form' | |
| 477 | - take 2 arguments: | |
| 478 | - | |
| 479 | - - the name of the form, which must be the name of an Anubis web | |
| 480 | - page. Indeed, when the user will submit the form, this page will | |
| 481 | - be sent to him. | |
| 482 | - - the content of the form, which may be any web item, but which | |
| 483 | - normally (amongh other things) contains input fields and a | |
| 484 | - submit button. | |
| 485 | - | |
| 486 | -public type Web_item: | |
| 487 | - form(Printable_tree name, | |
| 488 | - Web_item content), | |
| 489 | - form_target(Printable_tree name, | |
| 490 | - Web_item content, | |
| 491 | - String target), | |
| 492 | - form(Printable_tree name, | |
| 493 | - String label_name, | |
| 494 | - Web_item content), | |
| 495 | - form_name(String form_name, // option name de form | |
| 496 | - Web_item content),... | |
| 497 | - | |
| 498 | - public define Web_item | |
| 499 | -form | |
| 500 | - ( | |
| 501 | - Printable_tree name, | |
| 502 | - Web_item content | |
| 503 | - ) = | |
| 504 | - | |
| 505 | - form("", name, content). | |
| 506 | - | |
| 507 | - Within a form, you may put 'text input fields', that the client may | |
| 508 | - edit. The constructor 'text_input' has the following arguments: | |
| 509 | - | |
| 510 | - - name of input field. This will be the name of the correponding | |
| 511 | - web argument in the Anubis web page referred to by the form. | |
| 512 | - - size of field (as it appears on client screen), | |
| 513 | - - initial value of field (the text that appears in the field, when | |
| 514 | - the client downloads the page). | |
| 515 | - | |
| 516 | - | |
| 517 | - public type Text_Input_Option | |
| 518 | - | |
| 519 | -public type Web_item: | |
| 520 | - text_input(String name, /* text field to be documented by user */ | |
| 521 | - Int32 size, | |
| 522 | - String initial_value),... | |
| 523 | - | |
| 524 | - public define Web_item | |
| 525 | - text_input | |
| 526 | - ( | |
| 527 | - String name, | |
| 528 | - Int32 size, | |
| 529 | - String initial_value | |
| 530 | - ) = | |
| 531 | - | |
| 532 | - | |
| 533 | - text_input( (List(Text_Input_Option)) [], name, size, initial_value). | |
| 534 | - | |
| 535 | - | |
| 536 | -public type Web_item: | |
| 537 | - password_input(String name, | |
| 538 | - Int32 size), | |
| 539 | - text_area(String name, | |
| 540 | - Int32 columns, | |
| 541 | - Int32 rows, | |
| 542 | - String initial_text), | |
| 543 | - upload(String name, Int32 size),... | |
| 544 | - | |
| 545 | - | |
| 546 | - | |
| 547 | - | |
| 548 | -public type Web_item: | |
| 549 | - submit(String button_text), /* submit button with text on it */ | |
| 550 | - submit_pt(Printable_tree button_text), | |
| 551 | - submit(String name, String text), | |
| 552 | - submit_close(String name, String text), | |
| 553 | - submit_pt2(String name, Printable_tree text), | |
| 554 | - image_submit(String name, String image_file_name), | |
| 555 | - image_submit(String name, String value, String image_file, Web_item content), | |
| 556 | - hl_image_submit(String action_name, | |
| 557 | - String value, | |
| 558 | - String image_name, | |
| 559 | - String image_file, | |
| 560 | - String hl_image_file), | |
| 561 | - text_submit(String name, String value, String text), | |
| 562 | - web_submit(String web_args, Web_item content), | |
| 563 | - button(String name, String text, String on_click_fonction, Int32 width, Int32 height),... | |
| 564 | - | |
| 565 | - | |
| 566 | -public type Web_item: /* mark the form with an information */ | |
| 567 | - mark(String name, String value), | |
| 568 | - mark_pt(String name, Printable_tree value),... | |
| 569 | - | |
| 570 | -public type Web_item: | |
| 571 | - close_button, /* button that closes the window */ | |
| 572 | - close_button(String image_file_name), ... | |
| 573 | - | |
| 574 | - | |
| 575 | - | |
| 576 | - ********************************* | |
| 577 | - * LABELS * | |
| 578 | - ********************************* | |
| 579 | - | |
| 580 | - | |
| 581 | - A 'label' is just a name that you may give to a position in a document. Use the | |
| 582 | - following invisible Web_item 'label' to this end. Now, you can also create links in | |
| 583 | - the same document, which, when clicked by the user, scroll the document, so that the | |
| 584 | - position whose name is the given label is shown just at the top of the browser's | |
| 585 | - window. | |
| 586 | - | |
| 587 | -public type Web_item: | |
| 588 | - label(String label_name), /* give a name to a position in the page */ | |
| 589 | - go_to_label(String label_name, /* a link for jumping to a label */ | |
| 590 | - Web_item content),... | |
| 591 | - | |
| 592 | - | |
| 593 | - | |
| 594 | - ******************************** | |
| 595 | - * TABLES * | |
| 596 | - ******************************** | |
| 597 | - | |
| 598 | - | |
| 599 | - A web item may be a table. A table is produced by the constructor | |
| 600 | - 'table' from the type 'Web_item'. This constructor takes 2 | |
| 601 | - arguments: | |
| 602 | - | |
| 603 | - - a list of 'table options', | |
| 604 | - - a list of 'table rows'. | |
| 605 | - | |
| 606 | - Of course, you use as many options as you want, including | |
| 607 | - none (if you do not want any option, put the empty list '[ ]' as | |
| 608 | - this argument). Some options have precedence over others. For example | |
| 609 | - a background image will hide the background color. | |
| 610 | - | |
| 611 | - Table options are defined below: | |
| 612 | - | |
| 613 | -public type Table_option: | |
| 614 | - | |
| 615 | - /* use a color as a background for the table, if you want it to | |
| 616 | - be different from the background of the page */ | |
| 617 | - background_color(Web_color), | |
| 618 | - | |
| 619 | - /* or use an image as the background of the table */ | |
| 620 | - background_image(String file_name), | |
| 621 | - | |
| 622 | - /* draw a border line around the table (and around each cell in | |
| 623 | - the table). You may also specify a geometry (in pixels) for the | |
| 624 | - border. This makes the 'in relief' part of the border appear | |
| 625 | - more or less wide. You may also specify a color for the border. */ | |
| 626 | - border, | |
| 627 | - nude, /* equivalent to 'border(0,0,0)' (below) */ | |
| 628 | - border(Int32, /* width of exterior (pixels) */ | |
| 629 | - Int32, /* width of top */ | |
| 630 | - Int32), /* width of interior */ | |
| 631 | - border_color(Web_color), | |
| 632 | - absolute_width(Int32). | |
| 633 | - | |
| 634 | - | |
| 635 | - | |
| 636 | - A 'table row' is made of a list of 'row options', and a list of | |
| 637 | - 'cells'. A 'cell' itself has a list of 'cell options', and a web item, | |
| 638 | - which is its content. We begin by the description of options. | |
| 639 | - | |
| 640 | - | |
| 641 | -public type Row_option: | |
| 642 | - /* following concerns the horizontal positions of items within the | |
| 643 | - cells of the row */ | |
| 644 | - left, | |
| 645 | - h_center, | |
| 646 | - right, | |
| 647 | - /* the following concerns the vertical positions of items, within | |
| 648 | - the cells of the row */ | |
| 649 | - top, | |
| 650 | - v_center, | |
| 651 | - bottom, | |
| 652 | - absolute_height(Int32), | |
| 653 | - base_line, | |
| 654 | - /* set the background color of all cells in the row */ | |
| 655 | - background_color(Web_color). | |
| 656 | - | |
| 657 | - | |
| 658 | - | |
| 659 | -public type Cell_option: | |
| 660 | - /* all row options are available for individual cells, and apply | |
| 661 | - here only to one cell. */ | |
| 662 | - left, | |
| 663 | - h_center, | |
| 664 | - right, | |
| 665 | - top, | |
| 666 | - v_center, | |
| 667 | - bottom, | |
| 668 | - base_line, | |
| 669 | - background_color(Web_color), | |
| 670 | - /* you can set the width of the cell either absolutely (in pixels) | |
| 671 | - or as a percentage of the width of the table. */ | |
| 672 | - background_image(String file_name), | |
| 673 | - absolute_width(Int32), | |
| 674 | - relative_width(Int32), | |
| 675 | - absolute_height(Int32), | |
| 676 | - relative_height(Int32), | |
| 677 | - /* a cell may span over several columns or rows in the table */ | |
| 678 | - columns(Int32), | |
| 679 | - rows(Int32), | |
| 680 | - nowrap. | |
| 681 | - | |
| 682 | - | |
| 683 | -public type Cell: | |
| 684 | - cell(List(Cell_option), | |
| 685 | - Web_item). | |
| 686 | - | |
| 687 | -public type Table_row: | |
| 688 | - row(List(Row_option), | |
| 689 | - List(Cell)). | |
| 690 | - | |
| 691 | -public define Table_row row(Web_item i) = row([],[cell([],i)]). | |
| 692 | -public define Table_row row(Cell c) = row([],[c]). | |
| 693 | -public define Table_row row(List(Cell) l) = row([],l). | |
| 694 | - | |
| 695 | - | |
| 696 | -public type Web_item: | |
| 697 | - table(List(Table_option), | |
| 698 | - List(Table_row)),... | |
| 699 | - | |
| 700 | -public type Web_item: | |
| 701 | - list(List(Web_item)),... | |
| 702 | - | |
| 703 | -public type Web_item: | |
| 704 | - link(String name, Web_item), | |
| 705 | - link(String name, String target, Web_item),... | |
| 706 | - | |
| 707 | -public type Web_item: | |
| 708 | - link_for_download(String filename, Web_item),... // the filename is relative to the public directory | |
| 709 | - | |
| 710 | -public type Web_item: | |
| 711 | - mail_to(String addr, Web_item),... | |
| 712 | - | |
| 713 | - | |
| 714 | -public type Web_item: | |
| 715 | - select(String name, | |
| 716 | - Int32 size, | |
| 717 | - List(String) choices), | |
| 718 | - select(String name, | |
| 719 | - Int32 size, | |
| 720 | - List(String) choices, | |
| 721 | - String selected), | |
| 722 | - immediate_select(String name, // selection will immediately submit the form | |
| 723 | - Int32 size, | |
| 724 | - List(String) choices),... | |
| 725 | - | |
| 726 | - | |
| 727 | -public type Web_item: | |
| 728 | - radio_button (Printable_tree name, String value), | |
| 729 | - checked_radio_button (Printable_tree name, String value), | |
| 730 | - check_box (Printable_tree name, String value), | |
| 731 | - checked_box (Printable_tree name, String value),... | |
| 732 | - | |
| 733 | - | |
| 734 | -public type Web_item: | |
| 735 | - link_to_window(Printable_tree name, Web_item), | |
| 736 | - link_to_window(Printable_tree name, String window_name, Web_item), | |
| 737 | - link_to_window_with_ticket(String name, | |
| 738 | - String web_args, | |
| 739 | - String window_name, | |
| 740 | - Web_item content, | |
| 741 | - Int32 width, | |
| 742 | - Int32 height), | |
| 743 | - link_to_window_with_ticket_and_scroll | |
| 744 | - (String name, | |
| 745 | - String web_args, | |
| 746 | - String window_name, | |
| 747 | - Web_item content, | |
| 748 | - Int32 width, | |
| 749 | - Int32 height), | |
| 750 | - link_to_window_with_ticket_and_scroll | |
| 751 | - (String name, | |
| 752 | - String label_name, | |
| 753 | - String web_args, | |
| 754 | - String window_name, | |
| 755 | - Web_item content, | |
| 756 | - Int32 width, | |
| 757 | - Int32 height), | |
| 758 | - link_to_frame (Printable_tree name, String frame_name, Web_item). | |
| 759 | - | |
| 760 | - | |
| 761 | - | |
| 762 | ----- Formating operations (Anubis --> HTML/Javascript) --------------------------- | |
| 763 | - | |
| 764 | - Stupid operation formating a web color name. | |
| 765 | - | |
| 766 | -public define String | |
| 767 | - format | |
| 768 | - ( | |
| 769 | - Web_color_name n | |
| 770 | - ) = | |
| 771 | - if n is | |
| 772 | - { | |
| 773 | - aliceblue then "aliceblue", | |
| 774 | - antiquewhite1 then "antiquewhite1", | |
| 775 | - antiquewhite2 then "antiquewhite2", | |
| 776 | - antiquewhite3 then "antiquewhite3", | |
| 777 | - antiquewhite4 then "antiquewhite4", | |
| 778 | - aquamarine1 then "aquamarine1", | |
| 779 | - aquamarine2 then "aquamarine2", | |
| 780 | - aquamarine3 then "aquamarine3", | |
| 781 | - aquamarine4 then "aquamarine4", | |
| 782 | - azure1 then "azure1", | |
| 783 | - azure2 then "azure2", | |
| 784 | - azure3 then "azure3", | |
| 785 | - azure4 then "azure4", | |
| 786 | - yellow then "yellow", | |
| 787 | - }. | |
| 788 | - | |
| 789 | - Anubis really needs some system of 'macros' to avoid this... | |
| 790 | - | |
| 791 | - | |
| 792 | - Formating a web color. | |
| 793 | - | |
| 794 | -public define String | |
| 795 | - format | |
| 796 | - ( | |
| 797 | - Web_color wc | |
| 798 | - ) = | |
| 799 | - if wc is | |
| 800 | - { | |
| 801 | - rgb(r,g,b) then "\"#" + hexadecimal(r,2) + hexadecimal(g,2) + hexadecimal(b,2) + "\"", | |
| 802 | - _(c) then format(c) | |
| 803 | - }. | |
| 804 | - | |
| 805 | -public define String | |
| 806 | - format_without_quotes | |
| 807 | - ( | |
| 808 | - Web_color wc | |
| 809 | - ) = | |
| 810 | - if wc is | |
| 811 | - { | |
| 812 | - rgb(r,g,b) then "#" + hexadecimal(r,2) + hexadecimal(g,2) + hexadecimal(b,2) + "", | |
| 813 | - _(c) then format(c) | |
| 814 | - }. | |
| 815 | - | |
| 816 | -define Printable_tree | |
| 817 | - format | |
| 818 | - ( | |
| 819 | - Web_color c | |
| 820 | - ) = [(String)format(c)]. | |
| 821 | - | |
| 822 | -public define String | |
| 823 | - format_without_sharp | |
| 824 | - ( | |
| 825 | - Web_color wc | |
| 826 | - ) = | |
| 827 | - if wc is | |
| 828 | - { | |
| 829 | - rgb(r,g,b) then "" + hexadecimal(r,2) + hexadecimal(g,2) + hexadecimal(b,2) + "", | |
| 830 | - _(c) then format(c) | |
| 831 | - }. | |
| 832 | - | |
| 833 | -define Printable_tree | |
| 834 | - format_without_sharp | |
| 835 | - ( | |
| 836 | - Web_color c | |
| 837 | - ) = [(String)format_without_sharp(c)]. | |
| 838 | - | |
| 839 | - | |
| 840 | - | |
| 841 | -define Printable_tree | |
| 842 | - psychedelic_bg | |
| 843 | - ( | |
| 844 | - Int32 average, | |
| 845 | - Int32 amplitude, | |
| 846 | - Int32 delay | |
| 847 | - ) = | |
| 848 | - with ampl = if amplitude >= 120 then 120 else | |
| 849 | - if amplitude =< 1 then 1 else amplitude, | |
| 850 | - with aver = if average+ampl >= 254 then 254-ampl | |
| 851 | - else if average-ampl =< 1 then 1+ampl else average, | |
| 852 | - [ "<script>", | |
| 853 | - " var psy_t = 0;", | |
| 854 | - " function do_psy_bg() { psy_t += 0.05;", | |
| 855 | - " document.bgColor = '#' + ", | |
| 856 | - " (Math.round(",aver,"+",ampl,"*Math.cos(psy_t))).toString(16) + ", | |
| 857 | - " (Math.round(",aver,"+",ampl,"*Math.sin(psy_t))).toString(16) + ", | |
| 858 | - " (Math.round(",aver,"-",ampl,"*Math.cos(2*psy_t))).toString(16); ", | |
| 859 | - " setTimeout(\"do_psy_bg()\",",delay,"); }", | |
| 860 | - " setTimeout(\"do_psy_bg()\",1000);", | |
| 861 | - "</script>"]. | |
| 862 | - | |
| 863 | - | |
| 864 | -define List(Web_body_option) | |
| 865 | - replace_background_init | |
| 866 | - ( | |
| 867 | - List(Web_body_option) l, | |
| 868 | - Int32 average, | |
| 869 | - Int32 amplitude, | |
| 870 | - Int32 delay | |
| 871 | - ) = | |
| 872 | - if l is | |
| 873 | - { | |
| 874 | - [ ] then [ ], | |
| 875 | - [h . t] then | |
| 876 | - if h is background_color(_) | |
| 877 | - then [background_color(rgb(average+amplitude, | |
| 878 | - average, | |
| 879 | - average-amplitude)) | |
| 880 | - . replace_background_init(t,average,amplitude,delay)] | |
| 881 | - else [h . replace_background_init(t,average,amplitude,delay)] | |
| 882 | - }. | |
| 883 | - | |
| 884 | -define Maybe((Int32,Int32,Int32)) | |
| 885 | - get_psy | |
| 886 | - ( | |
| 887 | - List(Web_body_option) l | |
| 888 | - ) = | |
| 889 | - if l is | |
| 890 | - { | |
| 891 | - [ ] then failure, | |
| 892 | - [h . t] then | |
| 893 | - if h is psychedelic_background(a,f,d) | |
| 894 | - then success((a,f,d)) | |
| 895 | - else get_psy(t) | |
| 896 | - }. | |
| 897 | - | |
| 898 | -define List(Web_body_option) | |
| 899 | - prepare | |
| 900 | - ( | |
| 901 | - List(Web_body_option) l | |
| 902 | - ) = | |
| 903 | - if get_psy(l) is | |
| 904 | - { | |
| 905 | - failure then l, | |
| 906 | - success(op) then if op is (a,f,d) then | |
| 907 | - replace_background_init(l,a,f,d) | |
| 908 | - }. | |
| 909 | - | |
| 910 | - | |
| 911 | -public define Printable_tree | |
| 912 | - format | |
| 913 | - ( | |
| 914 | - String c_ticket, | |
| 915 | - String s_ticket, | |
| 916 | - Web_item i | |
| 917 | - ). | |
| 918 | - | |
| 919 | -define Printable_tree | |
| 920 | - move_layer_command | |
| 921 | - ( | |
| 922 | - String property, | |
| 923 | - Int32 n, | |
| 924 | - Int32 num, | |
| 925 | - Int32 i, | |
| 926 | - Int32 period | |
| 927 | - ) = | |
| 928 | - if i >= num then [ ] else | |
| 929 | - [" if (document.layers)", | |
| 930 | - " { document.nslay",n,"_",i,".",property,"=layp",n,"+(",((i-1)),"); } ", | |
| 931 | - " else ", | |
| 932 | - " { ielay",n,"_",i,".style.",property,"=layp",n,"+(",(i-1)*period,"); } " | |
| 933 | - . move_layer_command(property,n,num,i+1,period)]. | |
| 934 | - | |
| 935 | -define Printable_tree | |
| 936 | - format_layers | |
| 937 | - ( | |
| 938 | - LayerDisposition disp, | |
| 939 | - Int32 margin, | |
| 940 | - Web_item content, | |
| 941 | - Int32 n, | |
| 942 | - Int32 num, | |
| 943 | - Int32 i, | |
| 944 | - Int32 period | |
| 945 | - ) = | |
| 946 | - if i >= num then [ ] else | |
| 947 | - ["<layer name=\"nslay",n,"_",i,"\" top=0", | |
| 948 | - " left=0", ">", | |
| 949 | - "<div id=ielay",n,"_",i," style=\"position:absolute;top:", | |
| 950 | - if disp is vertical then (i-1)*period else margin, | |
| 951 | - "px;left:", | |
| 952 | - if disp is vertical then margin else (i-1)*period, | |
| 953 | - "px\">", | |
| 954 | - format("","",content), | |
| 955 | - "</div></layer>" . format_layers(disp,margin,content,n,num,i+1,period)]. | |
| 956 | - | |
| 957 | -define Printable_tree | |
| 958 | - s_layer | |
| 959 | - ( | |
| 960 | - LayerDisposition disp, | |
| 961 | - Int32 steps, | |
| 962 | - Int32 margin, | |
| 963 | - Int32 delay, | |
| 964 | - Web_item content, | |
| 965 | - Int32 period, | |
| 966 | - Int32 num | |
| 967 | - ) = | |
| 968 | - with n = new_web_count, | |
| 969 | - [ "<script>", | |
| 970 | - " var layp",n," = 0;", | |
| 971 | - " function scroll_layer",n,"() {", | |
| 972 | - " layp",n,"+=(",steps,"); if (layp",n," ",if steps > 0 then ">" else "<", | |
| 973 | - "= ",if steps > 0 then period else 0, | |
| 974 | - ") layp",n," = ",if steps > 0 then 0 else period,";", | |
| 975 | - move_layer_command(if disp is vertical then "top" else "left",n,num,0,period), | |
| 976 | - " setTimeout(\"scroll_layer",n,"()\",",delay,");", | |
| 977 | - " }", | |
| 978 | - " setTimeout(\"scroll_layer",n,"()\",1000);", | |
| 979 | - "</script>", | |
| 980 | - format_layers(disp,margin,content,n,num,0,period), | |
| 981 | - ]. | |
| 982 | - | |
| 983 | - | |
| 984 | -define Printable_tree | |
| 985 | - over | |
| 986 | - ( | |
| 987 | - Web_item i, | |
| 988 | - Int32 left, | |
| 989 | - Int32 top | |
| 990 | - ) = | |
| 991 | - with n = new_web_count, | |
| 992 | - [ "<layer name=\"nslay",n,"\" top=",top," left=",left,">", | |
| 993 | - " <div id=\"ielay",n,"\" style=\"position:absolute;top=",top,"px;left=",left,"px\">", | |
| 994 | - format("","",i), | |
| 995 | - "</div></layer>" | |
| 996 | - ]. | |
| 997 | - | |
| 998 | -define Printable_tree | |
| 999 | - bnce | |
| 1000 | - ( | |
| 1001 | - Web_item i, | |
| 1002 | - Int32 left, | |
| 1003 | - Int32 right, | |
| 1004 | - Int32 top, | |
| 1005 | - Int32 bottom | |
| 1006 | - ) = | |
| 1007 | - with n = new_web_count, | |
| 1008 | - [ "<script>", | |
| 1009 | - " var bncx",n," = ",left,"; var bncy",n," = ",top,"; var bncdx",n," = 1; var bncdy",n," = 1;", | |
| 1010 | - " function do_bnc",n,"() {", | |
| 1011 | - " if (bncx",n," >= (",right,") || bncx",n," < ",left,") bncdx",n," = -bncdx",n,";", | |
| 1012 | - " if (bncy",n," >= (",bottom,") || bncy",n," < ",top,") bncdy",n," = -bncdy",n,";", | |
| 1013 | - " bncx",n," += bncdx",n,"; bncy",n," += bncdy",n,";", | |
| 1014 | - " if (document.layers)", | |
| 1015 | - " { document.nslay",n,".left = bncx",n,"; document.nslay",n,".top = bncy",n,"; } else", | |
| 1016 | - " { ielay",n,".style.left = bncx",n,"; ielay",n,".style.top = bncy",n,"; }", | |
| 1017 | - " setTimeout(\"do_bnc",n,"()\",40); }", | |
| 1018 | - " setTimeout(\"do_bnc",n,"()\",1000);", | |
| 1019 | - "</script>", | |
| 1020 | - "<layer name=\"nslay",n,"\" top=",top," left=",left,">", | |
| 1021 | - " <div id=\"ielay",n,"\" style=\"position:absolute;top=",top,"px;left=",left,"px\">", | |
| 1022 | - format("","",i), | |
| 1023 | - "</div></layer>" | |
| 1024 | - ]. | |
| 1025 | - | |
| 1026 | - | |
| 1027 | -define Printable_tree | |
| 1028 | - folp_switch | |
| 1029 | - ( | |
| 1030 | - Int32 n, | |
| 1031 | - Int32 i, | |
| 1032 | - List(FollowPathCommand) path, | |
| 1033 | - Bool loop, | |
| 1034 | - Int32 steps | |
| 1035 | - ) = | |
| 1036 | - if path is | |
| 1037 | - { | |
| 1038 | - [ ] then [ ], | |
| 1039 | - [p0 . t0] then if p0 is pos(x0,y0,i0,d0) then | |
| 1040 | - if t0 is | |
| 1041 | - { | |
| 1042 | - [ ] then if loop | |
| 1043 | - then [" default: ", | |
| 1044 | - " folpx",n,"=",x0,"; folpy",n,"=",y0,"; ", | |
| 1045 | - " folpseg",n,"=0; ", | |
| 1046 | - " folpwait",n,"=",d0,";", | |
| 1047 | - " if(document.layers)", | |
| 1048 | - " document.nslay",n,".document.folpim",n,".src=folpimages",n,"[",i0,"].src;", | |
| 1049 | - " else document.folpim",n,".src=folpimages",n,"[",i0,"].src;", | |
| 1050 | - " folpstpmax",n," = 0;", | |
| 1051 | - " folpstp",n,"=0;", | |
| 1052 | - " folpdx",n,"=0; ", | |
| 1053 | - " folpdy",n,"=0; ", | |
| 1054 | - " break;"] | |
| 1055 | - else [" default: folpend",n,"=1; break; "], | |
| 1056 | - [p1 . t1] then if p1 is pos(x1,y1,i1,d1) then | |
| 1057 | - [ " case ",i,": ", | |
| 1058 | - " folpx",n,"=",x0,"; folpy",n,"=",y0,"; ", | |
| 1059 | - " folpseg",n,"=",i+1,"; ", | |
| 1060 | - " folpwait",n,"=",d0,";", | |
| 1061 | - " if(document.layers)", | |
| 1062 | - " document.nslay",n,".document.folpim",n,".src=folpimages",n,"[",i0,"].src;", | |
| 1063 | - " else document.folpim",n,".src=folpimages",n,"[",i0,"].src;", | |
| 1064 | - " folpstpmax",n," = ", | |
| 1065 | - "Math.round(Math.sqrt(Math.pow(",x1,"-",x0,",2)+Math.pow(",y1,"-",y0,",2))/",steps,");", | |
| 1066 | - " folpstp",n,"=0;", | |
| 1067 | - " folpdx",n,"=((",x1,"-",x0,")/folpstpmax",n,"); ", | |
| 1068 | - " folpdy",n,"=((",y1,"-",y0,")/folpstpmax",n,"); ", | |
| 1069 | - " break; " | |
| 1070 | - . folp_switch(n,i+1,t0,loop,steps) ] | |
| 1071 | - }}. | |
| 1072 | - | |
| 1073 | -define Printable_tree | |
| 1074 | - set_folpimages | |
| 1075 | - ( | |
| 1076 | - Int32 n, | |
| 1077 | - List(String) filenames, | |
| 1078 | - Int32 i, | |
| 1079 | - ) = | |
| 1080 | - if filenames is | |
| 1081 | - { | |
| 1082 | - [ ] then [ ], | |
| 1083 | - [h . t] then | |
| 1084 | - [ " folpimages",n,"[",i,"].src=\"",h,"\";" | |
| 1085 | - . set_folpimages(n,t,i+1)] | |
| 1086 | - }. | |
| 1087 | - | |
| 1088 | -define Printable_tree | |
| 1089 | - follow_path | |
| 1090 | - ( | |
| 1091 | - List(String) filenames, | |
| 1092 | - Int32 change_every, | |
| 1093 | - List(FollowPathCommand) path, | |
| 1094 | - Bool loop, | |
| 1095 | - Int32 steps, | |
| 1096 | - Int32 delay | |
| 1097 | - ) = | |
| 1098 | - if filenames is | |
| 1099 | - { | |
| 1100 | - [ ] then (print("Error in usage of 'follow_path': 'filenames' must be non empty."); []), | |
| 1101 | - [im1 . other_ims] then | |
| 1102 | - if steps < 1 then (print("Error in usage of 'follow_path': 'step' must be >= 1."); [ ]) else | |
| 1103 | - if path is | |
| 1104 | - { | |
| 1105 | - [ ] then [ ], | |
| 1106 | - [p0 . t0] then if p0 is pos(x0,y0,i0,d0) then | |
| 1107 | - if t0 is | |
| 1108 | - { | |
| 1109 | - [ ] then | |
| 1110 | - (print("Error in usage of 'follow_path': 'path' must have at least 2 positions."); []), | |
| 1111 | - [p1 . t1] then if p1 is pos(x1,y1,i1,d1) then | |
| 1112 | - with n = new_web_count, | |
| 1113 | - [ | |
| 1114 | - "<layer name=\"nslay",n,"\" top=",y0," left=",x0,">", | |
| 1115 | - "<div id=\"ielay",n,"\" style=\"position:absolute;top=",y0,"px;left=",x0,"px\">", | |
| 1116 | - "<img src=\"",im1,"\" name=\"folpim",n,"\" border=0>", | |
| 1117 | - "</div></layer>", | |
| 1118 | - "<script>", | |
| 1119 | - " var folpimages",n,"=new Array(",length(filenames),");", | |
| 1120 | - " var folpcurim",n,"=0;", | |
| 1121 | - " var folpx",n," = ",x0,";", | |
| 1122 | - " var folpy",n," = ",y0,";", | |
| 1123 | - " var folpseg",n," = 1;", | |
| 1124 | - " var folpstpmax",n," = ", | |
| 1125 | - "Math.round(Math.sqrt(Math.pow(",x1,"-",x0,",2)+Math.pow(",y1,"-",y0,",2))/",steps,");", | |
| 1126 | - " var folpdx",n,"=((",x1,"-",x0,")/folpstpmax",n,"); ", | |
| 1127 | - " var folpdy",n,"=((",y1,"-",y0,")/folpstpmax",n,"); ", | |
| 1128 | - " var folpstp",n," = 0;", | |
| 1129 | - " var folpchgcnt",n," = 0;", | |
| 1130 | - " var folpwait",n,"=",d0,";", | |
| 1131 | - " var folpend",n,"=0;", | |
| 1132 | - " for(var i = 0; i<",length(filenames),"; i++) {", | |
| 1133 | - " folpimages",n,"[i]=new Image(); }", | |
| 1134 | - set_folpimages(n,filenames,0), | |
| 1135 | - " function dofolp",n,"() {", | |
| 1136 | - " if (folpstp",n," >= folpstpmax",n,")", | |
| 1137 | - " { switch(folpseg",n,") {", | |
| 1138 | - folp_switch(n,0,path,loop,steps), | |
| 1139 | - " }} else { folpstp",n,"++; folpx",n," += folpdx",n,"; folpy",n," += folpdy",n,"; };", | |
| 1140 | - " if (document.layers)", | |
| 1141 | - " { document.nslay",n,".left=folpx",n,"; document.nslay",n,".top=folpy",n,"; } else", | |
| 1142 | - " { ielay",n,".style.left=folpx",n,"; ielay",n,".style.top=folpy",n,"; };", | |
| 1143 | - | |
| 1144 | - //--- change image if needed: | |
| 1145 | - if change_every = 0 then [ ] else | |
| 1146 | - if length(filenames) =< 1 then [ ] else | |
| 1147 | - [" if (folpchgcnt",n,"==",change_every,") ", | |
| 1148 | - " { ", | |
| 1149 | - " folpchgcnt",n,"=0;", | |
| 1150 | - " folpcurim",n,"++;", | |
| 1151 | - " if (folpcurim",n,"==",length(filenames),") folpcurim",n,"=0;", | |
| 1152 | - " if (document.layers) ", | |
| 1153 | - " document.nslay",n,".document.folpim",n,".src=folpimages",n,"[folpcurim",n,"].src;", | |
| 1154 | - " else document.folpim",n,".src=folpimages",n,"[folpcurim",n,"].src;", | |
| 1155 | - " }", | |
| 1156 | - " else { folpchgcnt",n,"++; };"], | |
| 1157 | - | |
| 1158 | - " if (!folpend",n,")", | |
| 1159 | - " if (folpstp",n,") setTimeout(\"dofolp",n,"()\",",delay,"); ", | |
| 1160 | - " else setTimeout(\"dofolp",n,"()\",",delay,"+folpwait",n,"); ", | |
| 1161 | - " }", | |
| 1162 | - " setTimeout(\"dofolp",n,"()\",1000);", | |
| 1163 | - "</script>", | |
| 1164 | - ] | |
| 1165 | - }}}. | |
| 1166 | - | |
| 1167 | - | |
| 1168 | -public type ImageToLoad: | |
| 1169 | - simple(String image_name), | |
| 1170 | - with_rollover(String image_name, | |
| 1171 | - String rollover_name). | |
| 1172 | - | |
| 1173 | -variable List(ImageToLoad) images_to_load = []. | |
| 1174 | - | |
| 1175 | -public define Printable_tree | |
| 1176 | - format | |
| 1177 | - ( | |
| 1178 | - Web_body_option o | |
| 1179 | - ) = | |
| 1180 | - if o is | |
| 1181 | - { | |
| 1182 | - background_color(c) then [" bgcolor=" , (String)format(c)], | |
| 1183 | - psychedelic_background(a,f,d) then add_script(psychedelic_bg(a,f,d)); [ ], | |
| 1184 | - background_image(n) then [" background=", n], | |
| 1185 | - scrolling_layer(disp,st,m,t,c,p) then add_script(s_layer(disp,st,m,t,c,p,2000/p)); [ ], | |
| 1186 | - bounce(i,l,r,t,b) then add_script(bnce(i,l,r,t,b)); [ ], | |
| 1187 | - over(i,l,t) then add_script(over(i,l,t)); [ ], | |
| 1188 | - follow_path(li,ns,p,l,s,d) then add_script(follow_path(li,ns,p,l,s,d)); [ ], | |
| 1189 | - load_image(n) then images_to_load <- [simple(n) . *images_to_load]; [ ], | |
| 1190 | - left_margin(n) then [" leftmargin=", n], | |
| 1191 | - top_margin(n) then [" topmargin=", n], | |
| 1192 | - margin_width(n) then [" marginwidth=", n], | |
| 1193 | - margin_height(n) then [" marginheight=", n], | |
| 1194 | - reload_frame(n,url) then add_body_onload(reload_frame(n,url)); [ ], | |
| 1195 | - onload(n) then [" onLoad=\"", n, "()\""] | |
| 1196 | - }. | |
| 1197 | - | |
| 1198 | -define Printable_tree | |
| 1199 | - preload_list | |
| 1200 | - ( | |
| 1201 | - List(ImageToLoad) images, | |
| 1202 | - Int32 n, | |
| 1203 | - ) = | |
| 1204 | - if images is | |
| 1205 | - { | |
| 1206 | - [ ] then [ ], | |
| 1207 | - [h . t] then | |
| 1208 | - [" preloaded_images[",n,"].src = '",image_name(h),"';", | |
| 1209 | - if h is | |
| 1210 | - { | |
| 1211 | - simple(_) then [], | |
| 1212 | - with_rollover(n1,r) then | |
| 1213 | - [" preloaded_images[",n1,"].onload = 'allow_rollover(\"",r,"\")';"] | |
| 1214 | - } | |
| 1215 | - . preload_list(t,n-1)] | |
| 1216 | - }. | |
| 1217 | - | |
| 1218 | -define Printable_tree | |
| 1219 | - load_image_script | |
| 1220 | - ( | |
| 1221 | - List(ImageToLoad) images | |
| 1222 | - ) = | |
| 1223 | - if images is | |
| 1224 | - { | |
| 1225 | - [ ] then [ ], | |
| 1226 | - [_ . _] then | |
| 1227 | - [ | |
| 1228 | - "<script>", | |
| 1229 | - " var preloaded_images = new Array(",length(images),");", | |
| 1230 | - " var pi_i = 0;", | |
| 1231 | - " for(pi_i = 0; pi_i < ",length(images),"; pi_i++) {", | |
| 1232 | - " preloaded_images[pi_i] = new Image(); }", | |
| 1233 | - " function preload_images() {", | |
| 1234 | - preload_list(images,length(images)-1), | |
| 1235 | - " }</script>" | |
| 1236 | - ] | |
| 1237 | - }. | |
| 1238 | - | |
| 1239 | - | |
| 1240 | -public define Printable_tree format(String c_ticket, | |
| 1241 | - String s_ticket, | |
| 1242 | - Web_item i). | |
| 1243 | - | |
| 1244 | - | |
| 1245 | -public define Printable_tree | |
| 1246 | - format(List(Table_option) l) = | |
| 1247 | - if l is | |
| 1248 | - { | |
| 1249 | - [ ] then [ ], | |
| 1250 | - [h . t] then [if h is | |
| 1251 | - { | |
| 1252 | - background_color(c) then [" bgcolor=", (String)format(c)], | |
| 1253 | - background_image(f) then [" background=",f], | |
| 1254 | - border then [" border"], | |
| 1255 | - nude then [" border=\"0\" cellspacing=\"0\" cellpadding=\"0\""], | |
| 1256 | - border(e,top,i) then [" border=",e," cellspacing=",top," cellpadding=",i], | |
| 1257 | - border_color(c) then [" bordercolor=", (String)format(c)], | |
| 1258 | - absolute_width(n) then [" width=",n] | |
| 1259 | - }, format(t)] | |
| 1260 | - }. | |
| 1261 | - | |
| 1262 | - | |
| 1263 | - | |
| 1264 | -public define Printable_tree | |
| 1265 | - format(List(Row_option) l) = | |
| 1266 | - if l is | |
| 1267 | - { | |
| 1268 | - [ ] then [ ], | |
| 1269 | - [first . others] then [if first is | |
| 1270 | - { | |
| 1271 | - left then [" align=left"], | |
| 1272 | - h_center then [" align=center"], | |
| 1273 | - right then [" align=right"], | |
| 1274 | - top then [" valign=top"], | |
| 1275 | - v_center then [" valign=center"], | |
| 1276 | - bottom then [" valign=bottom"], | |
| 1277 | - absolute_height(n) then [" height=\"",n,"\""], | |
| 1278 | - base_line then [" valign=baseline"], | |
| 1279 | - background_color(c) then [" bgcolor=",(String)format(c)] | |
| 1280 | - }, | |
| 1281 | - format(others)] | |
| 1282 | - }. | |
| 1283 | - | |
| 1284 | - | |
| 1285 | - | |
| 1286 | - | |
| 1287 | -public define Int32 | |
| 1288 | - percentage(Int32 n) = | |
| 1289 | - if n < 0 then 0 | |
| 1290 | - else if n > 100 then 100 | |
| 1291 | - else n. | |
| 1292 | - | |
| 1293 | - public define Int32 percentage(Int32 n) = n. | |
| 1294 | - | |
| 1295 | - | |
| 1296 | - | |
| 1297 | - | |
| 1298 | -public define Printable_tree | |
| 1299 | - format | |
| 1300 | - ( | |
| 1301 | - List(Web_body_option) l | |
| 1302 | - ) = | |
| 1303 | - if l is | |
| 1304 | - { | |
| 1305 | - [ ] then [ ], | |
| 1306 | - [h . t] then [format(h) . format(t)] | |
| 1307 | - }. | |
| 1308 | - | |
| 1309 | - | |
| 1310 | - | |
| 1311 | - | |
| 1312 | -public define Printable_tree | |
| 1313 | - format(List(Cell_option) l) = | |
| 1314 | - if l is | |
| 1315 | - { | |
| 1316 | - [ ] then [ ], | |
| 1317 | - [first . others] then | |
| 1318 | - [if first is | |
| 1319 | - { | |
| 1320 | - left then (Printable_tree)[" align=left"], | |
| 1321 | - h_center then (Printable_tree)[" align=center"], | |
| 1322 | - right then (Printable_tree)[" align=right"], | |
| 1323 | - top then (Printable_tree)[" valign=top"], | |
| 1324 | - v_center then (Printable_tree)[" valign=center"], | |
| 1325 | - bottom then (Printable_tree)[" valign=bottom"], | |
| 1326 | - base_line then (Printable_tree)[" valign=baseline"], | |
| 1327 | - background_color(c) then (Printable_tree)[" bgcolor=",(String)format(c)], | |
| 1328 | - background_image(n) then (Printable_tree)[" style=\"background: url(",n,")\""], | |
| 1329 | - absolute_width(w) then (Printable_tree)[" width=",w], | |
| 1330 | - relative_width(r) then (Printable_tree)[" width=",percentage(r),""], | |
| 1331 | - absolute_height(h) then (Printable_tree)[" height=",h], | |
| 1332 | - relative_height(r) then (Printable_tree)[" height=",percentage(r),""], | |
| 1333 | - columns(n) then (Printable_tree)[" colspan=",n], | |
| 1334 | - rows(n) then (Printable_tree)[" rowspan=",n], | |
| 1335 | - nowrap then (Printable_tree)[" nowrap"] | |
| 1336 | - } | |
| 1337 | - . format(others)] | |
| 1338 | - }. | |
| 1339 | - | |
| 1340 | - | |
| 1341 | - | |
| 1342 | -public define Printable_tree | |
| 1343 | - format | |
| 1344 | - ( | |
| 1345 | - String c_ticket, | |
| 1346 | - String s_ticket, | |
| 1347 | - List(Cell) l | |
| 1348 | - ) = | |
| 1349 | - if l is | |
| 1350 | - { | |
| 1351 | - [ ] then [ ], | |
| 1352 | - [first . others] then | |
| 1353 | - [if first is cell(options,item) then | |
| 1354 | - ["<td",format(options),">", | |
| 1355 | - format(c_ticket,s_ticket,item),"</td>"], | |
| 1356 | - format(c_ticket,s_ticket,others)] | |
| 1357 | - }. | |
| 1358 | - | |
| 1359 | - | |
| 1360 | -public define Printable_tree | |
| 1361 | - format | |
| 1362 | - ( | |
| 1363 | - String c_ticket, | |
| 1364 | - String s_ticket, | |
| 1365 | - List(Table_row) l | |
| 1366 | - ) = | |
| 1367 | - if l is | |
| 1368 | - { | |
| 1369 | - [ ] then [ ], | |
| 1370 | - [first_row . other_rows] | |
| 1371 | - then [if first_row is | |
| 1372 | - { | |
| 1373 | - row(options,cells) then | |
| 1374 | - [ "<tr",format(options),">", | |
| 1375 | - format(c_ticket,s_ticket,cells),"</tr>"] | |
| 1376 | - }, | |
| 1377 | - format(c_ticket,s_ticket,other_rows)] | |
| 1378 | - }. | |
| 1379 | - | |
| 1380 | - | |
| 1381 | -public define Printable_tree | |
| 1382 | - format_choices | |
| 1383 | - ( | |
| 1384 | - List(String) l | |
| 1385 | - ) = | |
| 1386 | - if l is | |
| 1387 | - { | |
| 1388 | - [ ] then [ ], | |
| 1389 | - [h . t] then ["<option>",h . format_choices(t)] | |
| 1390 | - }. | |
| 1391 | - | |
| 1392 | - | |
| 1393 | -public define Printable_tree | |
| 1394 | - format_choices | |
| 1395 | - ( | |
| 1396 | - List(String) l, | |
| 1397 | - String selected | |
| 1398 | - ) = | |
| 1399 | - if l is | |
| 1400 | - { | |
| 1401 | - [ ] then [ ], | |
| 1402 | - [h . t] then if h = selected | |
| 1403 | - then ["<option selected>",h . format_choices(t)] | |
| 1404 | - else ["<option>",h . format_choices(t,selected)] | |
| 1405 | - }. | |
| 1406 | - | |
| 1407 | - | |
| 1408 | -public define Printable_tree | |
| 1409 | - format_list | |
| 1410 | - ( | |
| 1411 | - String c_ticket, | |
| 1412 | - String s_ticket, | |
| 1413 | - List(Web_item) l | |
| 1414 | - ) = | |
| 1415 | - if l is | |
| 1416 | - { | |
| 1417 | - [ ] then [ ], | |
| 1418 | - [h . t] then ["<li>",format(c_ticket,s_ticket,h), | |
| 1419 | - format_list(c_ticket,s_ticket,t)] | |
| 1420 | - }. | |
| 1421 | - | |
| 1422 | - | |
| 1423 | -public define String | |
| 1424 | - format | |
| 1425 | - ( | |
| 1426 | - WebStyle ws | |
| 1427 | - ) = | |
| 1428 | - if ws is | |
| 1429 | - { | |
| 1430 | - background_image(fn) then "background: url("+fn+")", | |
| 1431 | - background_color(c) then "background: "+format(c), | |
| 1432 | - background_transparent then "background: transparent", | |
| 1433 | - background_repeat_horizontal then "background: repeat-x", | |
| 1434 | - background_repeat_vertical then "background: repeat-y", | |
| 1435 | - background_no_repeat then "background: no-repeat", | |
| 1436 | - color(wc) then if wc is | |
| 1437 | - { | |
| 1438 | - rgb(r,g,b) then "color: rgb("+r+","+g+","+b+")", | |
| 1439 | - _(c) then "color: "+format(c) | |
| 1440 | - }, | |
| 1441 | - float_to_left then "float: left", | |
| 1442 | - float_to_right then "float: right", | |
| 1443 | - font_family(n) then "font-family: "+n, | |
| 1444 | - font_size(n) then "font-size: "+integer_to_string(n)+"pt", | |
| 1445 | - italic then "font-style: italic", | |
| 1446 | - oblique then "font-style: oblique", | |
| 1447 | - small_capitals then "font-variant: small-caps", | |
| 1448 | - bold then "font-weight: bold", | |
| 1449 | - bolder then "font-weight: bolder", | |
| 1450 | - lighter then "font-weight: lighter", | |
| 1451 | - line_height(h) then "line-height: "+integer_to_string(h), | |
| 1452 | - text_center then "text-align: center", | |
| 1453 | - text_left then "text-align: left", | |
| 1454 | - text_right then "text-align: right", | |
| 1455 | - text_justify then "text-align: justify", | |
| 1456 | - text_underline then "text-decoration: underline", | |
| 1457 | - text_blink then "text-decoration: blink", | |
| 1458 | - text_line_through then "text-decoration: line-through", | |
| 1459 | - width(n) then "width: "+integer_to_string(n), | |
| 1460 | - }. | |
| 1461 | - | |
| 1462 | - | |
| 1463 | -public define Printable_tree | |
| 1464 | - format | |
| 1465 | - ( | |
| 1466 | - List(WebStyle) l | |
| 1467 | - ) = | |
| 1468 | - if l is | |
| 1469 | - { | |
| 1470 | - [ ] then [ ], | |
| 1471 | - [h . t] then | |
| 1472 | - if t is | |
| 1473 | - { | |
| 1474 | - [ ] then [format(h)], | |
| 1475 | - [_ . _] then [format(h), "; " . format(t)] | |
| 1476 | - } | |
| 1477 | - }. | |
| 1478 | - | |
| 1479 | - | |
| 1480 | -define Printable_tree | |
| 1481 | - format_polygon_coordinates | |
| 1482 | - ( | |
| 1483 | - List((Int32,Int32)) vertices | |
| 1484 | - ) = | |
| 1485 | - if vertices is | |
| 1486 | - { | |
| 1487 | - [ ] then [ ], | |
| 1488 | - [h . t] then | |
| 1489 | - if h is (x,y) then | |
| 1490 | - if t is [] | |
| 1491 | - then [ x,",",y ] | |
| 1492 | - else [ x,",",y,"," . format_polygon_coordinates(t)] | |
| 1493 | - }. | |
| 1494 | - | |
| 1495 | - define Printable_tree | |
| 1496 | - format | |
| 1497 | - ( | |
| 1498 | - List(Mouse_Sensitive_Zone) zones | |
| 1499 | - ) = | |
| 1500 | - if zones is | |
| 1501 | - { | |
| 1502 | - [ ] then [ ], | |
| 1503 | - [h . t] then | |
| 1504 | - [ | |
| 1505 | - if h is | |
| 1506 | - { | |
| 1507 | - rectangle(lt,rb,url) then | |
| 1508 | - if lt is (left,top) then | |
| 1509 | - if rb is (right,bottom) then | |
| 1510 | - [ "<area shape=rect coords=\"",left,",",top,",",right,",",bottom, | |
| 1511 | - "\" href=\"",url,"\">" ], | |
| 1512 | - circle(c,r,url) then | |
| 1513 | - if c is (x,y) then | |
| 1514 | - [ "<area shape=circle coords=\"",x,",",y,",",r, | |
| 1515 | - "\" href=\"",url,"\">" ], | |
| 1516 | - polygon(vs,url) then | |
| 1517 | - [ "<area shape=poly coords=\"",format_polygon_coordinates(vs), | |
| 1518 | - "\" href=\"",url,"\">" ] | |
| 1519 | - } | |
| 1520 | - . format(t)] | |
| 1521 | - }. | |
| 1522 | - | |
| 1523 | -define Printable_tree | |
| 1524 | - format | |
| 1525 | - ( | |
| 1526 | - List(Mouse_Sensitive_Zone) zones, | |
| 1527 | - String c_ticket, | |
| 1528 | - String s_ticket, | |
| 1529 | - ) = | |
| 1530 | - if zones is | |
| 1531 | - { | |
| 1532 | - [ ] then [ ], | |
| 1533 | - [h . t] then | |
| 1534 | - [ | |
| 1535 | - if h is | |
| 1536 | - { | |
| 1537 | - rectangle(lt,rb,url) then | |
| 1538 | - if lt is (left,top) then | |
| 1539 | - if rb is (right,bottom) then | |
| 1540 | - [ "<area shape=rect coords=\"",left,",",top,",",right,",",bottom, | |
| 1541 | - "\" href=\"", url + "&c_ticket=" + c_ticket + "&s_ticket=" + s_ticket,"\">" ], | |
| 1542 | - circle(c,r,url) then | |
| 1543 | - if c is (x,y) then | |
| 1544 | - [ "<area shape=circle coords=\"",x,",",y,",",r, | |
| 1545 | - "\" href=\"", url + "&c_ticket=" + c_ticket + "&s_ticket=" + s_ticket,"\">" ], | |
| 1546 | - polygon(vs,url) then | |
| 1547 | - [ "<area shape=poly coords=\"",format_polygon_coordinates(vs), | |
| 1548 | - "\" href=\"", url + "&c_ticket=" + c_ticket + "&s_ticket=" + s_ticket,"\">" ] | |
| 1549 | - } | |
| 1550 | - . format(t, c_ticket, s_ticket)] | |
| 1551 | - }. | |
| 1552 | - | |
| 1553 | -variable Int32 map_number = 0. | |
| 1554 | - | |
| 1555 | -define Printable_tree | |
| 1556 | - format_mouse_sensitive_image | |
| 1557 | - ( | |
| 1558 | - String image_file_name, | |
| 1559 | - List(Mouse_Sensitive_Zone) zones, | |
| 1560 | - String c_ticket, | |
| 1561 | - String s_ticket, | |
| 1562 | - ) = | |
| 1563 | - map_number <- (*map_number)+1; | |
| 1564 | - [ | |
| 1565 | - "<img src=\"",image_file_name,"\" usemap=\"#imsensmap",*map_number,"\" border=0>", | |
| 1566 | - "<map name=\"imsensmap",*map_number,"\">", | |
| 1567 | - format(zones, c_ticket, s_ticket), | |
| 1568 | - "</map>" | |
| 1569 | - ]. | |
| 1570 | - | |
| 1571 | - | |
| 1572 | - Find an 'upload' in a web item. | |
| 1573 | - | |
| 1574 | -define Bool | |
| 1575 | - find_upload | |
| 1576 | - ( | |
| 1577 | - Web_item i | |
| 1578 | - ). | |
| 1579 | - | |
| 1580 | -define Bool | |
| 1581 | - find_upload | |
| 1582 | - ( | |
| 1583 | - List(Web_item) li | |
| 1584 | - ) = | |
| 1585 | - if li is | |
| 1586 | - { | |
| 1587 | - [ ] then false, | |
| 1588 | - [h . t] then if find_upload(h) then true else find_upload(t) | |
| 1589 | - }. | |
| 1590 | - | |
| 1591 | -define Bool | |
| 1592 | - find_upload | |
| 1593 | - ( | |
| 1594 | - Cell c | |
| 1595 | - ) = | |
| 1596 | - if c is cell(lo,wi) then find_upload(wi). | |
| 1597 | - | |
| 1598 | -define Bool | |
| 1599 | - find_upload | |
| 1600 | - ( | |
| 1601 | - List(Cell) lc | |
| 1602 | - ) = | |
| 1603 | - if lc is | |
| 1604 | - { | |
| 1605 | - [ ] then false, | |
| 1606 | - [h . t] then if find_upload(h) then true else find_upload(t) | |
| 1607 | - }. | |
| 1608 | - | |
| 1609 | - | |
| 1610 | - | |
| 1611 | -define Bool | |
| 1612 | - find_upload | |
| 1613 | - ( | |
| 1614 | - Table_row tr | |
| 1615 | - ) = | |
| 1616 | - if tr is | |
| 1617 | - { | |
| 1618 | - row(lo,lc) then find_upload(lc) | |
| 1619 | - }. | |
| 1620 | - | |
| 1621 | -define Bool | |
| 1622 | - find_upload | |
| 1623 | - ( | |
| 1624 | - List(Table_row) l | |
| 1625 | - ) = | |
| 1626 | - if l is | |
| 1627 | - { | |
| 1628 | - [ ] then false, | |
| 1629 | - [h . t] then | |
| 1630 | - if find_upload(h) then true else find_upload(t) | |
| 1631 | - }. | |
| 1632 | - | |
| 1633 | -define Bool | |
| 1634 | - find_upload | |
| 1635 | - ( | |
| 1636 | - Web_item wi | |
| 1637 | - ) = | |
| 1638 | - if wi is | |
| 1639 | - { | |
| 1640 | - [ ] then (Bool)false, | |
| 1641 | - [a . b] then (Bool)if find_upload(a) then true else find_upload(b), | |
| 1642 | - text(_) then (Bool)false, | |
| 1643 | - text_pt(_) then (Bool)false, | |
| 1644 | - text_nowrap(_) then (Bool)false, | |
| 1645 | - text_nowrap_pt(_) then (Bool)false, | |
| 1646 | - par(_) then (Bool)false, | |
| 1647 | - preformated_text(_) then (Bool)false, | |
| 1648 | - integer(_) then (Bool)false, | |
| 1649 | - float(_,_) then (Bool)false, | |
| 1650 | - center(i) then (Bool)find_upload(i), | |
| 1651 | - bigger(n,i) then (Bool)find_upload(i), | |
| 1652 | - smaller(n,i) then (Bool)find_upload(i), | |
| 1653 | - bold(i) then (Bool)find_upload(i), | |
| 1654 | - italic(i) then (Bool)find_upload(i), | |
| 1655 | - big(i) then (Bool)find_upload(i), | |
| 1656 | - very_big(i) then (Bool)find_upload(i), | |
| 1657 | - style(_,i) then (Bool)find_upload(i), | |
| 1658 | - spacer(_,_) then (Bool)false, | |
| 1659 | - image(_) then (Bool)false, | |
| 1660 | - image_d(_,_) then (Bool)false, | |
| 1661 | - image_pt(_) then (Bool)false, | |
| 1662 | - on_image(_,_) then (Bool)false, | |
| 1663 | - turning_images(_,_) then (Bool)false, | |
| 1664 | - rollover(_,_,_,_,_,_) then (Bool)false, | |
| 1665 | - rollover(_,_,_,_,_,_,_,_) then (Bool)false, | |
| 1666 | - mouse_sensitive_image(_,_) then (Bool)false, | |
| 1667 | - background_sound(_,_) then (Bool)false, | |
| 1668 | - form(_,c) then (Bool)find_upload(c), | |
| 1669 | - form_target(_,c,_) then (Bool)find_upload(c), | |
| 1670 | - form(_,_,c) then (Bool)find_upload(c), | |
| 1671 | - form_name(_,c) then (Bool)find_upload(c), | |
| 1672 | - text_input(_,_,_) then (Bool)false, | |
| 1673 | - password_input(_,_) then (Bool)false, | |
| 1674 | - text_area(_,_,_,_) then (Bool)false, | |
| 1675 | - upload(_,_) then (Bool)true, | |
| 1676 | - submit(_) then (Bool)false, | |
| 1677 | - submit_pt(_) then (Bool)false, | |
| 1678 | - submit(_,_) then (Bool)false, | |
| 1679 | - submit_close(_,_) then (Bool)false, | |
| 1680 | - submit_pt2(_,_) then (Bool)false, | |
| 1681 | - image_submit(_,_) then (Bool)false, | |
| 1682 | - image_submit(_,_,_,_) then (Bool)false, | |
| 1683 | - hl_image_submit(_,_,_,_,_) then (Bool)false, | |
| 1684 | - text_submit(_,_,_) then (Bool)false, | |
| 1685 | - web_submit(_,c) then (Bool)find_upload(c), | |
| 1686 | - button(_,_,_,_,_) then (Bool)false, | |
| 1687 | - mark(_,_) then (Bool)false, | |
| 1688 | - mark_pt(_,_) then (Bool)false, | |
| 1689 | - close_button then (Bool)false, | |
| 1690 | - close_button(_) then (Bool)false, | |
| 1691 | - label(_) then (Bool)false, | |
| 1692 | - go_to_label(_,i) then (Bool)find_upload(i), | |
| 1693 | - table(_,rows) then (Bool)find_upload(rows), | |
| 1694 | - list(l) then (Bool)find_upload(l), | |
| 1695 | - link(_,i) then (Bool)find_upload(i), | |
| 1696 | - link(_,_,i) then (Bool)find_upload(i), | |
| 1697 | - link_for_download(n,i) then (Bool)find_upload(i), | |
| 1698 | - mail_to(_,i) then (Bool)find_upload(i), | |
| 1699 | - select(_,_,_) then (Bool)false, | |
| 1700 | - select(_,_,_,_) then (Bool)false, | |
| 1701 | - immediate_select(_,_,_) then (Bool)false, | |
| 1702 | - radio_button(_,_) then (Bool)false, | |
| 1703 | - checked_radio_button(_,_) then (Bool)false, | |
| 1704 | - check_box(_,_) then (Bool)false, | |
| 1705 | - checked_box(_,_) then (Bool)false, | |
| 1706 | - link_to_window(_,i) then (Bool)find_upload(i), | |
| 1707 | - link_to_window(_,_,i) then (Bool)find_upload(i), | |
| 1708 | - link_to_window_with_ticket(_,_,_,i,_,_) then (Bool)find_upload(i), | |
| 1709 | - link_to_window_with_ticket_and_scroll(_,_,_,i,_,_) then (Bool)find_upload(i), | |
| 1710 | - link_to_window_with_ticket_and_scroll(_,_,_,_,i,_,_) then (Bool)find_upload(i), | |
| 1711 | - link_to_frame(_,_,i) then (Bool)find_upload(i), | |
| 1712 | - }. | |
| 1713 | - | |
| 1714 | - | |
| 1715 | - The next function generates "enctype=multipart/form-data" or "", depending on the presence of | |
| 1716 | - an 'upload' in form-content. | |
| 1717 | - | |
| 1718 | -define String | |
| 1719 | - enctype | |
| 1720 | - ( | |
| 1721 | - Web_item form_content | |
| 1722 | - ) = | |
| 1723 | - if find_upload(form_content) | |
| 1724 | - then "enctype=multipart/form-data" | |
| 1725 | - else "". | |
| 1726 | - | |
| 1727 | -define Printable_tree | |
| 1728 | - set_turning_images_sources | |
| 1729 | - ( | |
| 1730 | - Int32 i, | |
| 1731 | - String name, | |
| 1732 | - List(String) filenames | |
| 1733 | - ) = | |
| 1734 | - if filenames is | |
| 1735 | - { | |
| 1736 | - [ ] then [ ], | |
| 1737 | - [h . t] then | |
| 1738 | - [" i",name,"[",i,"].src=\"",h,"\";" | |
| 1739 | - . set_turning_images_sources(i+1,name,t)] | |
| 1740 | - }. | |
| 1741 | - | |
| 1742 | -public define Printable_tree | |
| 1743 | - format | |
| 1744 | - ( | |
| 1745 | - String c_ticket, | |
| 1746 | - String s_ticket, | |
| 1747 | - Web_item wi | |
| 1748 | - ) = | |
| 1749 | - if wi is | |
| 1750 | - { | |
| 1751 | - [ ] then (Printable_tree)[ ], | |
| 1752 | - | |
| 1753 | - [a . b] then (Printable_tree)[format(c_ticket,s_ticket,a), " ", | |
| 1754 | - format(c_ticket,s_ticket,b)], | |
| 1755 | - | |
| 1756 | - text(String s) then (Printable_tree)[s], | |
| 1757 | - | |
| 1758 | - text_pt(Printable_tree s) then (Printable_tree)s, | |
| 1759 | - | |
| 1760 | - text_nowrap(String s) then (Printable_tree)["<table><tr><td nowrap>",s,"</td></tr></table>"], | |
| 1761 | - | |
| 1762 | - text_nowrap_pt(Printable_tree s) then | |
| 1763 | - (Printable_tree)["<table><tr><td nowrap>",s,"</td></tr></table>"], | |
| 1764 | - | |
| 1765 | - par(s) then (Printable_tree) | |
| 1766 | - [ "<p align=justify>", s, " </p>"], | |
| 1767 | - | |
| 1768 | - preformated_text(t) then (Printable_tree) ["<pre>",t,"</pre>"], | |
| 1769 | - | |
| 1770 | - integer(n) then (Printable_tree)[n], | |
| 1771 | - | |
| 1772 | - float(f,p) then (Printable_tree)[float_to_string(f,p)], | |
| 1773 | - | |
| 1774 | - center(item) then (Printable_tree)["<center>", format(c_ticket,s_ticket,item),"</center>"], | |
| 1775 | - | |
| 1776 | - bigger(n,item) then (Printable_tree)["<font size=+",n,">",format(c_ticket,s_ticket,item),"</font>"], | |
| 1777 | - | |
| 1778 | - smaller(n,item) then (Printable_tree)["<font size=-",n,">",format(c_ticket,s_ticket,item),"</font>"], | |
| 1779 | - | |
| 1780 | - bold(item) then | |
| 1781 | - (Printable_tree)["<font style=\"font-weight: bold\">",format(c_ticket,s_ticket,item),"</font>"], | |
| 1782 | - | |
| 1783 | - italic(item) then | |
| 1784 | - (Printable_tree)["<font style=\"font-style: italic\">",format(c_ticket,s_ticket,item),"</font>"], | |
| 1785 | - | |
| 1786 | - big(item) then (Printable_tree)["<font size=+1>",format(c_ticket,s_ticket,item),"</font>"], | |
| 1787 | - | |
| 1788 | - very_big(item) then (Printable_tree)["<h1>",format(c_ticket,s_ticket,item),"</h1>"], | |
| 1789 | - | |
| 1790 | - style(l,i) then | |
| 1791 | - (Printable_tree)["<span style=\"", format(l), "\">", format(c_ticket,s_ticket,i), "</span>"], | |
| 1792 | - | |
| 1793 | - spacer(w,h) then (Printable_tree) | |
| 1794 | - ["<img src=\"spacer.gif\" width=\"",w,"\" height=\"",h,"\" border=\"0\">"], | |
| 1795 | - | |
| 1796 | - image(String f) then (Printable_tree)["<img src=\"", f,"\" border=0>"], | |
| 1797 | - | |
| 1798 | - image_d(fn,desc) then (Printable_tree)["<img src=\"", fn,"\" alt=\"",desc,"\" border=0>"], | |
| 1799 | - | |
| 1800 | - image_pt(Printable_tree l) then (Printable_tree)["<img src=\"", l,"\" border=0>"], | |
| 1801 | - | |
| 1802 | - on_image(fn,x) then (Printable_tree) | |
| 1803 | - ["<span style=\"background: url(",fn,")\">",format(c_ticket,s_ticket,x),"</span>"], | |
| 1804 | - | |
| 1805 | - turning_images(fns,msec) then if fns is [im0 . imo] then | |
| 1806 | - with name = "trni"+integer_to_string(new_web_count), n = 1+length(imo), (Printable_tree) | |
| 1807 | - ["<script>", | |
| 1808 | - "var i",name,"=new Array(",n,");", | |
| 1809 | - "var n",name,"=0;", | |
| 1810 | - "for(var i=0; i<",n,"; i++) {", | |
| 1811 | - " i",name,"[i]=new Image(); }", | |
| 1812 | - set_turning_images_sources(0,name,(List(String))[im0 . imo]), | |
| 1813 | - | |
| 1814 | - "function a",name,"() {", | |
| 1815 | - "if (i",name,"[(n",name,"+1)%",n,"].complete)", | |
| 1816 | - "{n",name,"=(n",name,"+1)%",n,";", | |
| 1817 | - "document.",name,".src=i",name,"[n",name,"].src; }", | |
| 1818 | - "setTimeout(\"a",name,"()\",",msec,"); }", | |
| 1819 | - | |
| 1820 | - "setTimeout(\"a",name,"()\",",msec,");", | |
| 1821 | - "</script>", | |
| 1822 | - "<img src=\"",im0,"\" name=",name," border = 0>"], | |
| 1823 | - | |
| 1824 | - rollover(prlim,url,target,ion,ioff,descr) then (Printable_tree) | |
| 1825 | - (images_to_load <- [simple(ion) . *images_to_load]; | |
| 1826 | - with name = "ron_"+integer_to_string(new_web_count), | |
| 1827 | - ["<a target=\"",target,"\" href=\"",url, | |
| 1828 | - (if (c_ticket = "" & s_ticket = "") then "" else (if member('?',url) then "&" else "?")), | |
| 1829 | - (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), | |
| 1830 | - (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 1831 | - "\" onMouseOut=\"",name,".src='",ioff, | |
| 1832 | - "';\" onMouseOver=\"",name,".src='",ion,"';\"><img src=\"",ioff, | |
| 1833 | - "\" name=\"",name,"\" alt=\"",descr,"\" border=0></a>"]), | |
| 1834 | - | |
| 1835 | - rollover(prlim,url,target,ion,ioff,w,h,descr) then (Printable_tree) | |
| 1836 | - (images_to_load <- [simple(ion) . *images_to_load]; | |
| 1837 | - with name = "ron_"+integer_to_string(new_web_count), | |
| 1838 | - ["<a target=\"",target,"\" href=\"",url, | |
| 1839 | - (if (c_ticket = "" & s_ticket = "") then "" else (if member('?',url) then "&" else "?")), | |
| 1840 | - (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), | |
| 1841 | - (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 1842 | - "\" onMouseOut=\"",name,".src='",ioff, | |
| 1843 | - "';\" onMouseOver=\"",name,".src='",ion,"';\"><img src=\"",ioff, | |
| 1844 | - "\" name=\"",name,"\" width=\"",w,"\" height=\"",h,"\" alt=\"",descr,"\" border=0></a>"]), | |
| 1845 | - | |
| 1846 | - mouse_sensitive_image(fn,lz) then (Printable_tree) | |
| 1847 | - format_mouse_sensitive_image(fn,lz, c_ticket, s_ticket), | |
| 1848 | - | |
| 1849 | - background_sound(sfn,loop) then (Printable_tree) | |
| 1850 | - ["<embed src=\"", sfn, "\" autostart=true loop=", if loop then "true>" else "false>"], | |
| 1851 | - | |
| 1852 | - form(n,c) then (Printable_tree) | |
| 1853 | - ["<form ",enctype(c)," method=POST action=\"", n, "\">", | |
| 1854 | - "<input type=hidden name=s_ticket value=\"",s_ticket,"\">", | |
| 1855 | - "<input type=hidden name=c_ticket value=\"",c_ticket,"\">", | |
| 1856 | - format(c_ticket,s_ticket,c),"</form>"], | |
| 1857 | - | |
| 1858 | - form_target(n,c,t) then (Printable_tree) | |
| 1859 | - ["<form ",enctype(c)," method=POST action=\"", n, "\" target=\"", t, "\">", | |
| 1860 | - "<input type=hidden name=s_ticket value=\"",s_ticket,"\">", | |
| 1861 | - "<input type=hidden name=c_ticket value=\"",c_ticket,"\">", | |
| 1862 | - format(c_ticket,s_ticket,c),"</form>"], | |
| 1863 | - | |
| 1864 | - form(n,l,c) then (Printable_tree) | |
| 1865 | - ["<form ",enctype(c)," method=POST action=\"", n,"#", l, "\">", | |
| 1866 | - "<input type=hidden name=s_ticket value=\"",s_ticket,"\">", | |
| 1867 | - "<input type=hidden name=c_ticket value=\"",c_ticket,"\">", | |
| 1868 | - format(c_ticket,s_ticket,c),"</form>"], | |
| 1869 | - | |
| 1870 | - form_name(fn,c) then (Printable_tree) | |
| 1871 | - [ | |
| 1872 | - // "<form ",enctype(c), "\" name=\"", fn, "\">", | |
| 1873 | - "<form name=\"", fn, "\">", | |
| 1874 | - "<input type=hidden name=s_ticket value=\"",s_ticket,"\">", | |
| 1875 | - "<input type=hidden name=c_ticket value=\"",c_ticket,"\">", | |
| 1876 | - format(c_ticket,s_ticket,c),"</form>"], | |
| 1877 | - | |
| 1878 | - text_input(n,s,v) then (Printable_tree) | |
| 1879 | - [" <input type=text name=\"", n, "\" size=", s, " value=\"", v,"\">"], | |
| 1880 | - | |
| 1881 | - password_input(n,s) then (Printable_tree) | |
| 1882 | - [" <input type=password name=\"", n, "\" size=", s,">"], | |
| 1883 | - | |
| 1884 | - text_area(name,c,r,i) then (Printable_tree) | |
| 1885 | - ["<textarea name=",name," cols=",c," rows=",r," wrap=physical>",i,"</textarea>"], | |
| 1886 | - | |
| 1887 | - upload(n,size) then (Printable_tree) | |
| 1888 | - ["<input type=file size=",size," multiple name=",n,">"], | |
| 1889 | - | |
| 1890 | - submit(String t) then (Printable_tree)["<input type=submit value=\"",t,"\">"], | |
| 1891 | - | |
| 1892 | - submit_pt(Printable_tree t) then (Printable_tree)["<input type=submit value=\"",t,"\">"], | |
| 1893 | - | |
| 1894 | - submit(n, String t) then (Printable_tree) | |
| 1895 | - ["<input type=submit name=",n," value=\"",t,"\">"], | |
| 1896 | - | |
| 1897 | - submit_close(n, String t) then (Printable_tree) | |
| 1898 | - ["<input type=submit name=",n," value=\"",t,"\" onclick=\"window.top.close();\">"], | |
| 1899 | - | |
| 1900 | - submit_pt2(n, Printable_tree t) then (Printable_tree) | |
| 1901 | - ["<input type=submit name=",n," value=\"",t,"\">"], | |
| 1902 | - | |
| 1903 | - image_submit(n,ifn) then (Printable_tree) | |
| 1904 | - ["<input type=image name=",n," src=\"",ifn,"\" border=0>"], | |
| 1905 | - | |
| 1906 | - image_submit(n,v,ifn,c) then (Printable_tree) | |
| 1907 | - ["<img src=\"",ifn,"\" onmousedown=\"document.forms[0].action='", | |
| 1908 | - n,"=",v,"'; document.forms[0].submit();\">"], | |
| 1909 | - | |
| 1910 | - hl_image_submit(n,v,in,ifn,hlifn) then (Printable_tree) | |
| 1911 | - ["<img src=\"",ifn,"\"", | |
| 1912 | - //" name=\"",in,"\"", | |
| 1913 | - " onMouseOver=\"this.src='",hlifn,"'\"", | |
| 1914 | - " onMouseOut=\"this.src='",ifn,"'\"", | |
| 1915 | - " onMouseDown=\"document.forms[0].action='", | |
| 1916 | - n,"=",v,"'; document.forms[0].submit();\">"], | |
| 1917 | - | |
| 1918 | - text_submit(n,v,t) then (Printable_tree) | |
| 1919 | - ["<a href=\"",n, | |
| 1920 | - (if (s_ticket = "" & c_ticket = "" & v = "") then "" else "?"), | |
| 1921 | - (if s_ticket = "" then [ ] else ["s_ticket=",s_ticket,"&"]), | |
| 1922 | - (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), | |
| 1923 | - v,"\">",t,"</a>"], | |
| 1924 | - | |
| 1925 | - | |
| 1926 | - web_submit(wa,i) then (Printable_tree) | |
| 1927 | - ["<a href=\"javascript:document.forms[0].action='", | |
| 1928 | - wa,"'; document.forms[0].submit();\">",format(c_ticket,s_ticket,i),"</a>"], | |
| 1929 | - | |
| 1930 | - button(n, String t, String o, Int32 w, Int32 h) then (Printable_tree) | |
| 1931 | - ["<input type=button name=",n," value=\"",t, | |
| 1932 | - "\"style=\"width=",w, ";height=", h, "\" ", "\" onclick=\"", o, "\";\">"], | |
| 1933 | - | |
| 1934 | - mark(n, String v) then (Printable_tree) | |
| 1935 | - ["<input type=hidden name=",n," value=\"",v,"\">"], | |
| 1936 | - | |
| 1937 | - mark_pt(n, Printable_tree v) then (Printable_tree) | |
| 1938 | - ["<input type=hidden name=",n," value=\"",v,"\">"], | |
| 1939 | - | |
| 1940 | - close_button then (Printable_tree) | |
| 1941 | - ["<form><input type=button value=\" Fermer \" onclick=\"window.top.close();\"></form>"], | |
| 1942 | - | |
| 1943 | - close_button(ifn) then (Printable_tree) | |
| 1944 | - ["<form><input type=image name=close src=\"", ifn, | |
| 1945 | - "\" onclick=\"window.top.close();\"></form>"], | |
| 1946 | - | |
| 1947 | -/* | |
| 1948 | - close_button(ifn) then (Printable_tree) | |
| 1949 | - ["<form><input type=button name=close src=\"", ifn, | |
| 1950 | - "\" onclick=\"window.top.close();\"></form>"], | |
| 1951 | -*/ | |
| 1952 | - label(name) then (Printable_tree)["<a name=\"",name,"\">"], | |
| 1953 | - | |
| 1954 | - go_to_label(name,content) then (Printable_tree)["<a href=#",name,">", | |
| 1955 | - format(c_ticket,s_ticket,content),"</a>"], | |
| 1956 | - | |
| 1957 | - table(ops,rows) then (Printable_tree)["<table ", | |
| 1958 | - format(ops), ">",format(c_ticket,s_ticket,rows),"</table>"], | |
| 1959 | - | |
| 1960 | - list(l) then (Printable_tree)["<ul>",format_list(c_ticket,s_ticket,l),"</ul>"], | |
| 1961 | - | |
| 1962 | - link(name,i) then (Printable_tree)["<a href=\"",name, | |
| 1963 | - (if (c_ticket = "" & s_ticket = "") then "" else (if member('?',name) then "&" else "?")), | |
| 1964 | - (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), | |
| 1965 | - (if s_ticket = "" then [ ] else [if c_ticket = "" then "" else "&","s_ticket=",s_ticket]), | |
| 1966 | - "\">",format(c_ticket,s_ticket,i),"</a>"], | |
| 1967 | - | |
| 1968 | - link(name,target,i) then (Printable_tree)["<a target=\"",target,"\" href=\"",name, | |
| 1969 | - (if (c_ticket = "" & s_ticket = "") then "" else (if member('?',name) then "&" else "?")), | |
| 1970 | - (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), | |
| 1971 | - (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 1972 | - "\">",format(c_ticket,s_ticket,i),"</a>"], | |
| 1973 | - | |
| 1974 | - link_for_download(fname,i) then (Printable_tree) | |
| 1975 | - ["<a href=\"",fname,"?download\">",format(c_ticket,s_ticket,i),"</a>"], | |
| 1976 | - | |
| 1977 | - mail_to(addr,i) then (Printable_tree)["<a href=\"mailto:",addr,"\">", | |
| 1978 | - format(c_ticket,s_ticket,i),"</a>"], | |
| 1979 | - | |
| 1980 | - select(name,size,choices) then (Printable_tree) | |
| 1981 | - ["<select name=",name," size=",size,">",format_choices(choices),"</select>" ], | |
| 1982 | - | |
| 1983 | - select(name,size,choices,selected) then (Printable_tree) | |
| 1984 | - ["<select name=",name," size=",size,">",format_choices(choices,selected),"</select>" ], | |
| 1985 | - | |
| 1986 | - immediate_select(name,size,choices) then (Printable_tree) | |
| 1987 | - ["<select name=",name," size=",size," onchange=\"submit();\">", | |
| 1988 | - format_choices(choices),"</select>" ], | |
| 1989 | - | |
| 1990 | - radio_button(n,v) then (Printable_tree) | |
| 1991 | - ["<input type=radio name=", n, " value=\"", v, "\">"], | |
| 1992 | - | |
| 1993 | - checked_radio_button(n,v) then (Printable_tree) | |
| 1994 | - ["<input type=radio checked name=", n, " value=\"", v, "\">"], | |
| 1995 | - | |
| 1996 | - check_box(n,v) then (Printable_tree) | |
| 1997 | - ["<input type=checkbox name=", n, " value=\"", v, "\">"], | |
| 1998 | - | |
| 1999 | - checked_box(n,v) then (Printable_tree) | |
| 2000 | - ["<input type=checkbox checked name=", n, " value=\"", v, "\">"], | |
| 2001 | - | |
| 2002 | - link_to_window(n,i) then (Printable_tree) | |
| 2003 | - ["<a href=\"javascript:void window.open('",n,"','default','resizable,scrollbars');\">", | |
| 2004 | - format(c_ticket,s_ticket,i),"</a>"], | |
| 2005 | - | |
| 2006 | - link_to_window(n,wn,i) then (Printable_tree) | |
| 2007 | - ["<a href=\"javascript:void window.open('",n,"','",wn,"','resizable,scrollbars');\">", | |
| 2008 | - format(c_ticket,s_ticket,i),"</a>"], | |
| 2009 | - | |
| 2010 | - link_to_window_with_ticket(n,args,wn,i,w,h) then (Printable_tree) | |
| 2011 | - ["<a href=\"javascript:void window.open('",n,"?c_ticket=",c_ticket, | |
| 2012 | - (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 2013 | - "&target=",wn, | |
| 2014 | - if args="" then "" else "&", | |
| 2015 | - args,"','", | |
| 2016 | - wn,"','width=",w,",height=",h,"');\">", | |
| 2017 | - format(c_ticket,s_ticket,i),"</a>"], | |
| 2018 | - | |
| 2019 | - link_to_window_with_ticket_and_scroll(n,args,wn,i,w,h) then (Printable_tree) | |
| 2020 | - ["<a href=\"javascript:void window.open('",n,"?c_ticket=",c_ticket, | |
| 2021 | - (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 2022 | - "&target=",wn, | |
| 2023 | - if args="" then "" else "&", | |
| 2024 | - args,"','", | |
| 2025 | - wn,"','width=",w,",height=",h,", resizable,scrollbars');\">", | |
| 2026 | - format(c_ticket,s_ticket,i),"</a>"], | |
| 2027 | - | |
| 2028 | - link_to_window_with_ticket_and_scroll(n,lab,args,wn,i,w,h) then (Printable_tree) | |
| 2029 | - ["<a href=\"javascript:void window.open('",n,"?c_ticket=",c_ticket, | |
| 2030 | - (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 2031 | - "&target=",wn, | |
| 2032 | - if args="" then "" else "&", | |
| 2033 | - args,"&#",lab, "','", | |
| 2034 | - wn,"','width=",w,",height=",h,", resizable,scrollbars');\">", | |
| 2035 | - format(c_ticket,s_ticket,i),"</a>"], | |
| 2036 | - | |
| 2037 | - link_to_frame(n,fn,i) then ["<a href=\"",n, | |
| 2038 | - (if member('?',n) then "&" else "?"), | |
| 2039 | - (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), | |
| 2040 | - (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 2041 | - "\" target=\"",fn,"\">", | |
| 2042 | - format(c_ticket,s_ticket,i),"</a>"] | |
| 2043 | - | |
| 2044 | - }. | |
| 2045 | - | |
| 2046 | - | |
| 2047 | - | |
| 2048 | -define Printable_tree | |
| 2049 | - add_tickets | |
| 2050 | - ( | |
| 2051 | - String c_ticket, | |
| 2052 | - String s_ticket, | |
| 2053 | - String url | |
| 2054 | - ) = | |
| 2055 | - if member('?',url) | |
| 2056 | - then [url , "&c_ticket=", c_ticket, "&s_ticket=", s_ticket ] | |
| 2057 | - else [url , "?c_ticket=", c_ticket, "&s_ticket=", s_ticket ]. | |
| 2058 | - | |
| 2059 | -define Printable_tree | |
| 2060 | - add_tickets | |
| 2061 | - ( | |
| 2062 | - String c_ticket, | |
| 2063 | - String s_ticket, | |
| 2064 | - Printable_tree url | |
| 2065 | - ) = | |
| 2066 | - if member('?',url) | |
| 2067 | - then [url , "&c_ticket=", c_ticket, "&s_ticket=", s_ticket ] | |
| 2068 | - else [url , "?c_ticket=", c_ticket, "&s_ticket=", s_ticket ]. | |
| 2069 | - | |
| 2070 | - | |
| 2071 | -define Printable_tree | |
| 2072 | - format | |
| 2073 | - ( | |
| 2074 | - List(VFrame) frames, | |
| 2075 | - String c_ticket, | |
| 2076 | - String s_ticket | |
| 2077 | - ) = | |
| 2078 | - if frames is | |
| 2079 | - { | |
| 2080 | - [ ] then [ ], | |
| 2081 | - [h . t] then | |
| 2082 | - if h is frame(height,url,name) then | |
| 2083 | - [ | |
| 2084 | - "<frame src=\"",add_tickets(c_ticket,s_ticket,url), "\" name=\"",name,"\" frameborder=no>" | |
| 2085 | - . format(t,c_ticket,s_ticket)] | |
| 2086 | - }. | |
| 2087 | - | |
| 2088 | - | |
| 2089 | -define String | |
| 2090 | - frame_size | |
| 2091 | - ( | |
| 2092 | - Int32 s | |
| 2093 | - ) = | |
| 2094 | - if s =< 0 then "*" else integer_to_string(s). | |
| 2095 | - | |
| 2096 | -define String | |
| 2097 | - frame_stack_rows | |
| 2098 | - ( | |
| 2099 | - List(VFrame) frames | |
| 2100 | - ) = | |
| 2101 | - if frames is | |
| 2102 | - { | |
| 2103 | - [ ] then "", | |
| 2104 | - [h . t] then if h is frame (height,url,name) then | |
| 2105 | - frame_size(height)+ | |
| 2106 | - if t is | |
| 2107 | - { | |
| 2108 | - [ ] then "", | |
| 2109 | - [_ . _] then "," | |
| 2110 | - }+frame_stack_rows(t) | |
| 2111 | - }. | |
| 2112 | - | |
| 2113 | - | |
| 2114 | - | |
| 2115 | - 'crlf' is defined in 'basis.anubis'. | |
| 2116 | - | |
| 2117 | - | |
| 2118 | - | |
| 2119 | -define Printable_tree | |
| 2120 | - standard_headers | |
| 2121 | - ( | |
| 2122 | - Int32 size | |
| 2123 | - ) = | |
| 2124 | - [ | |
| 2125 | - "HTTP/1.0 200 OK" + crlf + | |
| 2126 | - "Server: Anubis" + crlf + | |
| 2127 | - "Content-Type: text/html" + crlf + | |
| 2128 | - "Content-Length: "+integer_to_string(size)+crlf+ | |
| 2129 | - crlf | |
| 2130 | - ]. | |
| 2131 | - | |
| 2132 | - define Printable_tree | |
| 2133 | - download_headers | |
| 2134 | - = | |
| 2135 | - [ | |
| 2136 | - "HTTP/1.0 200 OK" + crlf + | |
| 2137 | - "Content-Type: application/octet-stream" + crlf + | |
| 2138 | - crlf | |
| 2139 | - ]. | |
| 2140 | - | |
| 2141 | -define Printable_tree | |
| 2142 | - apache_headers | |
| 2143 | - = | |
| 2144 | - [ | |
| 2145 | - "Content-type: text/html" + crlf + | |
| 2146 | - crlf | |
| 2147 | - ]. | |
| 2148 | - | |
| 2149 | - | |
| 2150 | -define String | |
| 2151 | - empty_javascript_source | |
| 2152 | - = | |
| 2153 | - "javascript:'<html><head></head><body></body></html>';". | |
| 2154 | - | |
| 2155 | -public type HeaderSort: | |
| 2156 | - empty, | |
| 2157 | - anubis, | |
| 2158 | - apache. | |
| 2159 | - | |
| 2160 | - | |
| 2161 | -define Printable_tree | |
| 2162 | - format_keywords | |
| 2163 | - ( | |
| 2164 | - List(String) l | |
| 2165 | - ) = | |
| 2166 | - if l is | |
| 2167 | - { | |
| 2168 | - [ ] then [ ], | |
| 2169 | - [h . t] then if t is [ ] | |
| 2170 | - then [h] | |
| 2171 | - else [h , ", " . format_keywords(t)] | |
| 2172 | - }. | |
| 2173 | - | |
| 2174 | -define Printable_tree | |
| 2175 | - format | |
| 2176 | - ( | |
| 2177 | - WebMeta m | |
| 2178 | - ) = | |
| 2179 | - if m is | |
| 2180 | - { | |
| 2181 | - keywords(l) then ["<meta name=\"keywords\" content=\"",format_keywords(l),"\">"], | |
| 2182 | - refresh(url,delay) then ["<meta http-equiv=\"Refresh\" content=\"",delay,"; URL=",url,"\">"], | |
| 2183 | - meta(n,c) then ["<meta name=\"",n,"\" content=\"",c,"\">"], | |
| 2184 | - http_equiv(n,c) then ["<meta http-equiv=\"",n,"\" content=\"",c,"\">"] | |
| 2185 | - }. | |
| 2186 | - | |
| 2187 | -define Printable_tree | |
| 2188 | - format | |
| 2189 | - ( | |
| 2190 | - List(WebMeta) metas | |
| 2191 | - ) = | |
| 2192 | - if metas is | |
| 2193 | - { | |
| 2194 | - [ ] then [ ], | |
| 2195 | - [h . t] then [format(h) . format(t)] | |
| 2196 | - }. | |
| 2197 | - | |
| 2198 | - | |
| 2199 | - | |
| 2200 | - | |
| 2201 | - | |
| 2202 | - | |
| 2203 | -public define Printable_tree | |
| 2204 | - format | |
| 2205 | - ( | |
| 2206 | - HeaderSort hs, | |
| 2207 | - String c_ticket, | |
| 2208 | - String s_ticket, | |
| 2209 | - Web_page p | |
| 2210 | - ) = | |
| 2211 | - if p is | |
| 2212 | - { | |
| 2213 | - web_page(title,metas,head_scripts,body) then | |
| 2214 | - with body = | |
| 2215 | - [ | |
| 2216 | - "<html>", | |
| 2217 | - "<head>", | |
| 2218 | - "<title>", title, "</title>", | |
| 2219 | - format(metas), | |
| 2220 | - head_scripts, | |
| 2221 | - "</head>", | |
| 2222 | - "<body ", | |
| 2223 | - if body is body(options,item) then | |
| 2224 | - with b_options = format(prepare(options)), | |
| 2225 | - [b_options, " onLoad='body_onloads();", | |
| 2226 | - if *images_to_load is [] then "" else " preload_images();", | |
| 2227 | - "'>", | |
| 2228 | - load_image_script(*images_to_load), | |
| 2229 | - reverse(*scripts), | |
| 2230 | - "<script>", | |
| 2231 | - " function body_onloads() {", | |
| 2232 | - format(*body_onloads), | |
| 2233 | - "}</script>", | |
| 2234 | - format(c_ticket,s_ticket,item) | |
| 2235 | - ], | |
| 2236 | - "</body>", | |
| 2237 | - "</html>" | |
| 2238 | - ], | |
| 2239 | - [ | |
| 2240 | - if hs is | |
| 2241 | - { | |
| 2242 | - empty then [ ], | |
| 2243 | - anubis then standard_headers(length(body)), | |
| 2244 | - apache then apache_headers | |
| 2245 | - } | |
| 2246 | - . body | |
| 2247 | - ], | |
| 2248 | - standard_frameset(title,metas,height,width,main) then | |
| 2249 | - with body = | |
| 2250 | - [ | |
| 2251 | - "<html>", | |
| 2252 | - "<head>", | |
| 2253 | - "<title>", title, "</title>", | |
| 2254 | - format(metas), | |
| 2255 | - "</head>", | |
| 2256 | - "<frameset frameborder=no border=0 framespacing=0", | |
| 2257 | - " marginwidth=0 marginheight=0 cols=\"",width,",*\" rows=\"*\">", | |
| 2258 | - " <frame src=\"",empty_javascript_source,"\" name=\"left\" frameborder=no", | |
| 2259 | - " marginwidth=0 marginheight=0 scrolling=no>", | |
| 2260 | - " <frameset frameborder=no border=0 framespacing=0 rows=\"",height,",*\" cols=\"*\">", | |
| 2261 | - " <frame src=\"",empty_javascript_source,"\" name=\"top\"", | |
| 2262 | - " marginwidth=0 marginheight=0 frameborder=no scrolling=no>", | |
| 2263 | - " <frame src =\"", add_tickets(c_ticket,s_ticket,main), | |
| 2264 | - "\" name=\"main\" marginwidth=0 marginheight=0 frameborder=no>", | |
| 2265 | - " </frameset>", | |
| 2266 | - "</frameset>", | |
| 2267 | - "</html>" | |
| 2268 | - ], | |
| 2269 | - [ | |
| 2270 | - if hs is | |
| 2271 | - { | |
| 2272 | - empty then [ ], | |
| 2273 | - anubis then standard_headers(length(body)), | |
| 2274 | - apache then apache_headers | |
| 2275 | - } | |
| 2276 | - . body | |
| 2277 | - ] | |
| 2278 | - }. | |
| 2279 | - | |
| 2280 | - | |
| 2281 | -public define Bool | |
| 2282 | ||
| 2283 | - ( | |
| 2284 | - String c_ticket, | |
| 2285 | - String s_ticket, | |
| 2286 | - Web_page p | |
| 2287 | - ) = | |
| 2288 | - print(format(anubis,c_ticket,s_ticket,p)). | |
| 2289 | - | |
| 2290 | -public define Bool | |
| 2291 | - print_with_headers | |
| 2292 | - ( | |
| 2293 | - HeaderSort hs, | |
| 2294 | - String c_ticket, | |
| 2295 | - String s_ticket, | |
| 2296 | - Web_page p | |
| 2297 | - ) = | |
| 2298 | - print(format(hs,c_ticket,s_ticket,p)). | |
| 2299 | - | |
| 2300 | -public define Bool | |
| 2301 | ||
| 2302 | - ( | |
| 2303 | - Web_page p | |
| 2304 | - ) = | |
| 2305 | - print(format(anubis,"","",p)). | |
| 2306 | - | |
| 2307 | - | |
| 2308 | - | |
| 2309 | - | |
| 2310 | -public define Bool | |
| 2311 | - print_with_headers | |
| 2312 | - ( | |
| 2313 | - HeaderSort hs, | |
| 2314 | - Web_page p | |
| 2315 | - ) = | |
| 2316 | - print(format(hs,"","",p)). | |
| 2317 | - | |
| 2318 | - | |
| 2319 | -public define Cell | |
| 2320 | - h_spacer | |
| 2321 | - ( | |
| 2322 | - Int32 n | |
| 2323 | - ) = | |
| 2324 | - cell([absolute_width(n)],text(" ")). | |
| 2325 | - | |
| 2326 | -public define Cell | |
| 2327 | - v_spacer | |
| 2328 | - ( | |
| 2329 | - Int32 n | |
| 2330 | - ) = | |
| 2331 | - cell([absolute_height(n)],text(" ")). | |
| 2332 | - | |
| 2333 | -public define Cell | |
| 2334 | - empty = cell([],text(" ")). | |
| 2335 | - | |
| 2336 | - | |
| 2337 | - | |
| 2338 | - *** Below is a simple gadget for counting visitors. It increments a counter (in a file) | |
| 2339 | - at each call. The argument is the name of the file (relative to the directory of the | |
| 2340 | - server), and the file is created automatically. It returns the number of the visitor. | |
| 2341 | - | |
| 2342 | -public define Int32 | |
| 2343 | - get_visitor_number | |
| 2344 | - ( | |
| 2345 | - String counter_file_name, | |
| 2346 | - ) = | |
| 2347 | - protect | |
| 2348 | - if (RetrieveResult(Int32))retrieve(counter_file_name) is | |
| 2349 | - { | |
| 2350 | - cannot_find_file then | |
| 2351 | - // | |
| 2352 | - // It's time to create the file. | |
| 2353 | - // | |
| 2354 | - if save((Int32)1,counter_file_name) is | |
| 2355 | - { | |
| 2356 | - cannot_open_file then 0, | |
| 2357 | - write_error then 0, | |
| 2358 | - ok then 1 | |
| 2359 | - }, | |
| 2360 | - read_error then 0, | |
| 2361 | - type_error then 0, | |
| 2362 | - ok(n) then | |
| 2363 | - // | |
| 2364 | - // Increment the counter | |
| 2365 | - // | |
| 2366 | - if save(n+1,counter_file_name) is | |
| 2367 | - { | |
| 2368 | - cannot_open_file then n, | |
| 2369 | - write_error then n, | |
| 2370 | - ok then n+1 | |
| 2371 | - } | |
| 2372 | - }. | |
| 2373 | - | |
| 2374 | - | |
| 2375 | - | |
| 2376 | - | |
| 1 | + | |
| 2 | + *Project* The Anubis Project | |
| 3 | + *Title* Producing HTML/Javascript code. | |
| 4 | + | |
| 5 | + *Copyright* Copyright (c) Alain Prouté 2001. | |
| 6 | + | |
| 7 | +read tools/basis.anubis | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + *** Managing Web Arguments. | |
| 13 | + | |
| 14 | + When a client submits a form, he sends informations to the server. This information is | |
| 15 | + transformed by the server into a list of data of type 'Web_arg'. This is the reason why | |
| 16 | + a 'web page' operation always has a unique argument of type 'List(Web_arg)'. | |
| 17 | + | |
| 18 | + The type 'Web_arg' is defined in 'web/common.anubis' as follows: | |
| 19 | + | |
| 20 | + public type Web_arg: | |
| 21 | + web_arg(String name, | |
| 22 | + String value), | |
| 23 | + upload (String name, | |
| 24 | + String value, | |
| 25 | + String temp_file_path). | |
| 26 | + | |
| 27 | +read web/CXM_common.anubis | |
| 28 | + | |
| 29 | + In other words, a 'web argument' is just a pair made of the name of the argument, and | |
| 30 | + the value of the argument, and both are character strings. 'upload' will be explained | |
| 31 | + later. | |
| 32 | + | |
| 33 | + | |
| 34 | + The next variable is a multipurpose counter (used to generate unique names). | |
| 35 | + | |
| 36 | +variable Int32 web_count = 0. | |
| 37 | + | |
| 38 | +define Int32 | |
| 39 | + new_web_count | |
| 40 | + = | |
| 41 | + web_count <- *web_count+1; | |
| 42 | + *web_count. | |
| 43 | + | |
| 44 | + | |
| 45 | + Names for Web colors. | |
| 46 | + | |
| 47 | +public type Web_color_name: | |
| 48 | + aliceblue, | |
| 49 | + antiquewhite1, | |
| 50 | + antiquewhite2, | |
| 51 | + antiquewhite3, | |
| 52 | + antiquewhite4, | |
| 53 | + aquamarine1, | |
| 54 | + aquamarine2, | |
| 55 | + aquamarine3, | |
| 56 | + aquamarine4, | |
| 57 | + azure1, | |
| 58 | + azure2, | |
| 59 | + azure3, | |
| 60 | + azure4, | |
| 61 | + yellow. | |
| 62 | + | |
| 63 | + | |
| 64 | + and so on ... (see below why I did not do more). | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + Web colors. | |
| 69 | + | |
| 70 | +public type Web_color: | |
| 71 | + rgb(Int32,Int32,Int32), /* give the color by its components */ | |
| 72 | + _(Web_color_name). /* or by its name */ | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + The following produces '<meta>' tags, which are put in the head of the document. | |
| 78 | + | |
| 79 | +public type WebMeta: | |
| 80 | + keywords(List(String)), | |
| 81 | + refresh(String url, Int32 delay), // in seconds | |
| 82 | + meta(String name, String content), | |
| 83 | + http_equiv(String name, String content). | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + ******************************************************* | |
| 90 | + * Web items * | |
| 91 | + * (the many kinds of things one may put in a page) * | |
| 92 | + ******************************************************* | |
| 93 | + | |
| 94 | + | |
| 95 | +public type Web_item: | |
| 96 | + [ ], /* empty (invisible) item */ | |
| 97 | + ... this is a cross recursive type. | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + Options for web page body. | |
| 103 | + | |
| 104 | +public type LayerDisposition: | |
| 105 | + horizontal, | |
| 106 | + vertical. | |
| 107 | + | |
| 108 | +public type FollowPathCommand: // this type is used by the Web_body_option 'follow_path'. | |
| 109 | + pos(Int32 x, // x coordinate of position | |
| 110 | + Int32 y, // y coordinate of position | |
| 111 | + Int32 image_number, // the image to display at that position | |
| 112 | + Int32 delay). // wait that milliseconds before leaving this position | |
| 113 | + | |
| 114 | +public type Web_body_option: | |
| 115 | + background_color(Web_color), /* color for the background */ | |
| 116 | + // | |
| 117 | + // 'psychedelic_background' produces a background color which is continuously changing. | |
| 118 | + // 'average' is the average luminosity of the color. 'amplitude' is the maximal variation | |
| 119 | + // the luminosity around the average. 'delay' is the number of milliseconds between two | |
| 120 | + // color changes. For example, you may try 'psychedelic_background(200,50,1000)', which | |
| 121 | + // produces a background whose color changes very slowly (this is not tiring) among rather | |
| 122 | + // light pastel colors. | |
| 123 | + // | |
| 124 | + psychedelic_background(Int32 average, /* average light (0 to 255) */ | |
| 125 | + Int32 amplitude, /* amplitude of variation of light */ | |
| 126 | + Int32 delay), /* in milliseconds */ | |
| 127 | + background_image(String file_name), /* name of image file for the background */ | |
| 128 | + // | |
| 129 | + // 'scrolling_layer' produces a layer above the page which is scrolling continuously either | |
| 130 | + // vertically or horizontally. The 'content' is indefinitly repeated. | |
| 131 | + // | |
| 132 | + scrolling_layer(LayerDisposition, | |
| 133 | + Int32 steps, /* number of pixels of each move */ | |
| 134 | + Int32 margin, /* measured from left or top in pixels */ | |
| 135 | + Int32 delay, /* milliseconds for one move */ | |
| 136 | + Web_item content, /* content of layer (will be repeated) */ | |
| 137 | + Int32 period), /* number of pixels between two instances of 'content' */ | |
| 138 | + // | |
| 139 | + // 'bounce' shows its content above the page and let it move and bounce on the edges of a rectangle. | |
| 140 | + // The rectangle is determined by the last 4 arguments. | |
| 141 | + // | |
| 142 | + bounce(Web_item content, | |
| 143 | + Int32 left, | |
| 144 | + Int32 right, | |
| 145 | + Int32 top, | |
| 146 | + Int32 bottom), | |
| 147 | + // | |
| 148 | + // put something over the page in any position you want: | |
| 149 | + // | |
| 150 | + over(Web_item content, | |
| 151 | + Int32 left, | |
| 152 | + Int32 top), | |
| 153 | + // | |
| 154 | + // follow_path: let a changing image follow a path on the screen. This gadget shows | |
| 155 | + // an image following a polygonal path on the screen. The image may change at regular | |
| 156 | + // intervals, thus providing extra animation. The images are displayed in the order | |
| 157 | + // they are given in the first argument. When the last image has been displayed, the | |
| 158 | + // first image is displayed again, and so on. The path is a sequence of absolute positions | |
| 159 | + // on screen (actually in the browser's window or frame), which is followed in the | |
| 160 | + // order given in the 'path' argument. If 'loop' is true, the path is followed again and again. | |
| 161 | + // Otherwise, it is followed only once. If you want to make a closed loop, the last | |
| 162 | + // position must be the same as the first one. 'steps' is the number of pixels of distance | |
| 163 | + // between two successive positions of the image, and 'delay' the number of milliseconds | |
| 164 | + // between two successive positions. 'change_every' is the number of steps (a 'step' is | |
| 165 | + // passing from one position to the next one) after which the displayed image is replaced | |
| 166 | + // by the next image. | |
| 167 | + // | |
| 168 | + // Each position 'pos(x,y,i,d)' has 4 parameters. 'x' and 'y' are the coordinates of the | |
| 169 | + // position in the browser's window or frame. 'i' is the number of the image to display | |
| 170 | + // at this position (i.e. the rank of the image in the list 'filename'. The first one has | |
| 171 | + // rank 0). 'd' is the delay in milliseconds to wait before leaving that position. | |
| 172 | + // | |
| 173 | + follow_path(List(String) filenames, /* the changing images which follows the path */ | |
| 174 | + Int32 change_every, /* number of steps betwen two changes */ | |
| 175 | + List(FollowPathCommand) path, /* the polygonal path and commands */ | |
| 176 | + Bool loop, /* if true do it repeatedly, otherwise only once */ | |
| 177 | + Int32 steps, /* approximative distance (in pixels) between two | |
| 178 | + successive positions */ | |
| 179 | + Int32 delay), /* milliseconds between two successive positions */ | |
| 180 | + | |
| 181 | + load_image(String name), /* load an image (for next page), which is not displayed */ | |
| 182 | + left_margin(Int32), /* left margin for document */ | |
| 183 | + top_margin(Int32), /* top margin for document */ | |
| 184 | + margin_width(Int32), | |
| 185 | + margin_height(Int32), | |
| 186 | + reload_frame(String name, /* name of target frame */ | |
| 187 | + String url), /* url to load in this frame */ | |
| 188 | + onload(String function_name). /* nom de la fonction javascript (sans les '()') */ | |
| 189 | + | |
| 190 | +public type BodyOnload: | |
| 191 | + reload_frame(String name, String url). | |
| 192 | + | |
| 193 | +variable List(BodyOnload) body_onloads = [ ]. | |
| 194 | + | |
| 195 | +define One | |
| 196 | + add_body_onload | |
| 197 | + ( | |
| 198 | + BodyOnload item | |
| 199 | + ) = | |
| 200 | + body_onloads <- [item . *body_onloads]. | |
| 201 | + | |
| 202 | +define Printable_tree | |
| 203 | + format | |
| 204 | + ( | |
| 205 | + BodyOnload item | |
| 206 | + ) = | |
| 207 | + if item is | |
| 208 | + { | |
| 209 | + reload_frame(name,url) then (Printable_tree) | |
| 210 | + [ " window.open('",url,"','",name,"');" ] | |
| 211 | + }. | |
| 212 | + | |
| 213 | +define Printable_tree | |
| 214 | + format | |
| 215 | + ( | |
| 216 | + List(BodyOnload) l | |
| 217 | + ) = | |
| 218 | + if l is | |
| 219 | + { | |
| 220 | + [ ] then (Printable_tree)[ ], | |
| 221 | + [h . t] then (Printable_tree) | |
| 222 | + [format(h) . format(t)] | |
| 223 | + }. | |
| 224 | + | |
| 225 | + | |
| 226 | +---- Body of a web page. -------------------------------------------- | |
| 227 | +public type Page_body: | |
| 228 | + body(List(Web_body_option), /* list of body options */ | |
| 229 | + Web_item content). /* the content of the page */ | |
| 230 | + | |
| 231 | + | |
| 232 | +public type VFrame: | |
| 233 | + frame(Int32 height, | |
| 234 | + Printable_tree url, | |
| 235 | + String name). | |
| 236 | + | |
| 237 | +---- Web pages. ----------------------------------------------------- | |
| 238 | +public type Web_page: | |
| 239 | + web_page(String title, /* title appearing on top of browser */ | |
| 240 | + List(WebMeta) meta_tags, | |
| 241 | + Printable_tree head_scripts, /* scripts à placer dans la balise head */ | |
| 242 | + Page_body body), /* body of page */ | |
| 243 | + standard_frameset(String title, | |
| 244 | + List(WebMeta) meta_tags, | |
| 245 | + Int32 height, /* height of 'top menu' (pixels) */ | |
| 246 | + Int32 width, /* width of 'left menu' (pixels) */ | |
| 247 | + Printable_tree main). /* url for main */ | |
| 248 | + | |
| 249 | + +---------+--------------------------+ | |
| 250 | + | | ^ | | |
| 251 | + |<-width->| top height | | |
| 252 | + | | v | | |
| 253 | + | left +--------------------------+ | |
| 254 | + | | | | |
| 255 | + | | main | | |
| 256 | + | | | | |
| 257 | + | | | | |
| 258 | + | | | | |
| 259 | + +---------+--------------------------+ | |
| 260 | + | |
| 261 | + Note: top and left frames must be loaded through the Web_body_option 'reload_frame'. | |
| 262 | + | |
| 263 | + | |
| 264 | +public define Web_page | |
| 265 | + web_page | |
| 266 | + ( | |
| 267 | + String title, | |
| 268 | + Page_body body | |
| 269 | + ) = | |
| 270 | + web_page(title,[],[], body). | |
| 271 | + | |
| 272 | +public define Web_page | |
| 273 | + web_page | |
| 274 | + ( | |
| 275 | + String title, | |
| 276 | + List(WebMeta) meta_tags, | |
| 277 | + Page_body body | |
| 278 | + ) = | |
| 279 | + | |
| 280 | + web_page(title, meta_tags, [], body). | |
| 281 | + | |
| 282 | + public define Web_page | |
| 283 | +web_page | |
| 284 | + ( | |
| 285 | + String title, | |
| 286 | + Printable_tree head_scripts, | |
| 287 | + Page_body body | |
| 288 | + ) = | |
| 289 | + | |
| 290 | + web_page(title, [], head_scripts, body). | |
| 291 | + | |
| 292 | +public define Web_page | |
| 293 | +standard_frameset | |
| 294 | + ( | |
| 295 | + String title, | |
| 296 | + Int32 height, | |
| 297 | + Int32 width, | |
| 298 | + Printable_tree main | |
| 299 | + ) = | |
| 300 | + | |
| 301 | + standard_frameset(title, [], height, width, main). | |
| 302 | + | |
| 303 | + | |
| 304 | +variable Printable_tree scripts = []. | |
| 305 | + | |
| 306 | +define One | |
| 307 | + add_script | |
| 308 | + ( | |
| 309 | + Printable_tree script | |
| 310 | + ) = | |
| 311 | + scripts <- [*scripts . script]. | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + ---- Non empty web items. ------------------------------------------- | |
| 316 | + | |
| 317 | + We have already seen the empty web item. Together with the following one, it enables to | |
| 318 | + make (pseudo-)lists of web items, which will be presented one after the other (from | |
| 319 | + left to right) in the browser's window. | |
| 320 | + | |
| 321 | +public type Web_item: | |
| 322 | + [Web_item . Web_item],... | |
| 323 | + | |
| 324 | + | |
| 325 | + A web item may be a simple string or a simple integer: | |
| 326 | + | |
| 327 | +public type Web_item: | |
| 328 | + text(String), | |
| 329 | + text_pt(Printable_tree), | |
| 330 | + text_nowrap(String), | |
| 331 | + text_nowrap_pt(Printable_tree), | |
| 332 | + par(String), | |
| 333 | + preformated_text(String text), | |
| 334 | + integer(Int32), | |
| 335 | + float(Float,Int32),... | |
| 336 | + | |
| 337 | + | |
| 338 | + You may want to center a web item in a page. Just enclose it into | |
| 339 | + 'center(...)': | |
| 340 | + | |
| 341 | +public type Web_item: | |
| 342 | + center(Web_item),... | |
| 343 | + | |
| 344 | + | |
| 345 | + You may want to write characters of a given item with a big font: | |
| 346 | + | |
| 347 | +public type Web_item: | |
| 348 | + bigger(Int32,Web_item), | |
| 349 | + smaller(Int32,Web_item), | |
| 350 | + bold(Web_item), | |
| 351 | + italic(Web_item), | |
| 352 | + big(Web_item), | |
| 353 | + very_big(Web_item),... | |
| 354 | + | |
| 355 | + | |
| 356 | + Most of the previous are subsumed by 'style': | |
| 357 | + | |
| 358 | +public type WebStyle: | |
| 359 | + background_image(String file_name), | |
| 360 | + background_color(Web_color color), | |
| 361 | + background_transparent, | |
| 362 | + background_repeat_horizontal, // repeat the background image only horizontally | |
| 363 | + background_repeat_vertical, | |
| 364 | + background_no_repeat, | |
| 365 | + color(Web_color color), | |
| 366 | + float_to_left, // the web item will float to the left and text will wrap around | |
| 367 | + float_to_right, | |
| 368 | + font_family(String font_name), // "verdana" "helvetica" "times" etc... | |
| 369 | + font_size(Int32 size), | |
| 370 | + italic, | |
| 371 | + oblique, | |
| 372 | + small_capitals, | |
| 373 | + bold, | |
| 374 | + bolder, | |
| 375 | + lighter, | |
| 376 | + line_height(Int32 height), | |
| 377 | + text_center, | |
| 378 | + text_left, | |
| 379 | + text_right, | |
| 380 | + text_justify, | |
| 381 | + text_underline, | |
| 382 | + text_blink, | |
| 383 | + text_line_through, | |
| 384 | + width(Int32 n). | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | +public type Web_item: | |
| 389 | + style(List(WebStyle) styles, Web_item content),... | |
| 390 | + | |
| 391 | + | |
| 392 | +public type Web_item: | |
| 393 | + spacer(Int32 width, Int32 height), | |
| 394 | + image(String file_name), /* image */ | |
| 395 | + image_d(String file_name, String description), | |
| 396 | + image_pt(Printable_tree file_name), | |
| 397 | + on_image(String file_name, Web_item content), | |
| 398 | + turning_images(NonEmptyList(String) filenames, Int32 millisecs),... | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + A 'rollover' has the same role as a submit button or link, but it is prettier. It is | |
| 403 | + made of two images. The first one 'image_on' determines the aspect of the button when | |
| 404 | + the mouse cursor is on it. The other one 'image_off' determines the aspect of the | |
| 405 | + button when the mouse cursor is anywhere else. The two images should be of the same | |
| 406 | + size, otherwise bad effects may occur. The last operand 'description' is a small text | |
| 407 | + which describes the role of the button. It appears in a bubble in the browser's window. | |
| 408 | + | |
| 409 | +public type Web_item: | |
| 410 | + rollover(List(String) preload_images, // images to preload before the rollover is effective | |
| 411 | + String url, // URL with possible web arguments | |
| 412 | + String target, | |
| 413 | + String image_on, // file name of 'highlighted' image | |
| 414 | + String image_off, // file name of 'non highlighted' image | |
| 415 | + String description), // short behavior description | |
| 416 | + rollover(List(String) preload_images, | |
| 417 | + String url, | |
| 418 | + String target, | |
| 419 | + String image_on, | |
| 420 | + String image_off, | |
| 421 | + Int32 width, | |
| 422 | + Int32 height, | |
| 423 | + String description), ... | |
| 424 | + | |
| 425 | + | |
| 426 | + Mouse sensitive images are images with predefined zones which are clickable. When | |
| 427 | + clicking in a zone, the specified corresponding URL is loaded by the browser. If two | |
| 428 | + zones overlap, the first one (in the order they are defined) is selected. | |
| 429 | + | |
| 430 | + Zones are of 3 sorts: rectangles, circles and polygons. Point's coordinates are | |
| 431 | + specified as pairs of integers (of anonymous agglomeration type (Int32,Int32)). The | |
| 432 | + first coordinate counts pixels from the left of the image. The second coordinate counts | |
| 433 | + pixels from the top of the image. With polygons, you can construct zones which are | |
| 434 | + almost as complicated as you want. You may also construct a zone as the overlapping of | |
| 435 | + several zones with the same URL. | |
| 436 | + | |
| 437 | +public type Mouse_Sensitive_Zone: | |
| 438 | + rectangle | |
| 439 | + ( | |
| 440 | + (Int32,Int32) left_top, | |
| 441 | + (Int32,Int32) right_bottom, | |
| 442 | + String url | |
| 443 | + ), | |
| 444 | + circle | |
| 445 | + ( | |
| 446 | + (Int32,Int32) center, | |
| 447 | + Int32 radius, | |
| 448 | + String url | |
| 449 | + ), | |
| 450 | + polygon | |
| 451 | + ( | |
| 452 | + List((Int32,Int32)) vertices, | |
| 453 | + String url | |
| 454 | + ). | |
| 455 | + | |
| 456 | +public type Web_item: | |
| 457 | + mouse_sensitive_image(String image_file_name, // the image itself | |
| 458 | + List(Mouse_Sensitive_Zone) zones),... | |
| 459 | + | |
| 460 | + | |
| 461 | + In project: mouse sensitive images, whose zones behave like submission buttons (to be | |
| 462 | + used within a form). | |
| 463 | + | |
| 464 | + | |
| 465 | +public type Web_item: | |
| 466 | + background_sound(String sound_file_name, | |
| 467 | + Bool loop),... | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + ************************* | |
| 472 | + * FORMS * | |
| 473 | + ************************* | |
| 474 | + | |
| 475 | + | |
| 476 | + Use 'forms' in order to get informations back from the client. The constructor 'form' | |
| 477 | + take 2 arguments: | |
| 478 | + | |
| 479 | + - the name of the form, which must be the name of an Anubis web | |
| 480 | + page. Indeed, when the user will submit the form, this page will | |
| 481 | + be sent to him. | |
| 482 | + - the content of the form, which may be any web item, but which | |
| 483 | + normally (amongh other things) contains input fields and a | |
| 484 | + submit button. | |
| 485 | + | |
| 486 | +public type Web_item: | |
| 487 | + form(Printable_tree name, | |
| 488 | + Web_item content), | |
| 489 | + form_target(Printable_tree name, | |
| 490 | + Web_item content, | |
| 491 | + String target), | |
| 492 | + form(Printable_tree name, | |
| 493 | + String label_name, | |
| 494 | + Web_item content), | |
| 495 | + form_name(String form_name, // option name de form | |
| 496 | + Web_item content),... | |
| 497 | + | |
| 498 | + public define Web_item | |
| 499 | +form | |
| 500 | + ( | |
| 501 | + Printable_tree name, | |
| 502 | + Web_item content | |
| 503 | + ) = | |
| 504 | + | |
| 505 | + form("", name, content). | |
| 506 | + | |
| 507 | + Within a form, you may put 'text input fields', that the client may | |
| 508 | + edit. The constructor 'text_input' has the following arguments: | |
| 509 | + | |
| 510 | + - name of input field. This will be the name of the correponding | |
| 511 | + web argument in the Anubis web page referred to by the form. | |
| 512 | + - size of field (as it appears on client screen), | |
| 513 | + - initial value of field (the text that appears in the field, when | |
| 514 | + the client downloads the page). | |
| 515 | + | |
| 516 | + | |
| 517 | + public type Text_Input_Option | |
| 518 | + | |
| 519 | +public type Web_item: | |
| 520 | + text_input(String name, /* text field to be documented by user */ | |
| 521 | + Int32 size, | |
| 522 | + String initial_value),... | |
| 523 | + | |
| 524 | + public define Web_item | |
| 525 | + text_input | |
| 526 | + ( | |
| 527 | + String name, | |
| 528 | + Int32 size, | |
| 529 | + String initial_value | |
| 530 | + ) = | |
| 531 | + | |
| 532 | + | |
| 533 | + text_input( (List(Text_Input_Option)) [], name, size, initial_value). | |
| 534 | + | |
| 535 | + | |
| 536 | +public type Web_item: | |
| 537 | + password_input(String name, | |
| 538 | + Int32 size), | |
| 539 | + text_area(String name, | |
| 540 | + Int32 columns, | |
| 541 | + Int32 rows, | |
| 542 | + String initial_text), | |
| 543 | + upload(String name, Int32 size),... | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | +public type Web_item: | |
| 549 | + submit(String button_text), /* submit button with text on it */ | |
| 550 | + submit_pt(Printable_tree button_text), | |
| 551 | + submit(String name, String text), | |
| 552 | + submit_close(String name, String text), | |
| 553 | + submit_pt2(String name, Printable_tree text), | |
| 554 | + image_submit(String name, String image_file_name), | |
| 555 | + image_submit(String name, String value, String image_file, Web_item content), | |
| 556 | + hl_image_submit(String action_name, | |
| 557 | + String value, | |
| 558 | + String image_name, | |
| 559 | + String image_file, | |
| 560 | + String hl_image_file), | |
| 561 | + text_submit(String name, String value, String text), | |
| 562 | + web_submit(String web_args, Web_item content), | |
| 563 | + button(String name, String text, String on_click_fonction, Int32 width, Int32 height),... | |
| 564 | + | |
| 565 | + | |
| 566 | +public type Web_item: /* mark the form with an information */ | |
| 567 | + mark(String name, String value), | |
| 568 | + mark_pt(String name, Printable_tree value),... | |
| 569 | + | |
| 570 | +public type Web_item: | |
| 571 | + close_button, /* button that closes the window */ | |
| 572 | + close_button(String image_file_name), ... | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + ********************************* | |
| 577 | + * LABELS * | |
| 578 | + ********************************* | |
| 579 | + | |
| 580 | + | |
| 581 | + A 'label' is just a name that you may give to a position in a document. Use the | |
| 582 | + following invisible Web_item 'label' to this end. Now, you can also create links in | |
| 583 | + the same document, which, when clicked by the user, scroll the document, so that the | |
| 584 | + position whose name is the given label is shown just at the top of the browser's | |
| 585 | + window. | |
| 586 | + | |
| 587 | +public type Web_item: | |
| 588 | + label(String label_name), /* give a name to a position in the page */ | |
| 589 | + go_to_label(String label_name, /* a link for jumping to a label */ | |
| 590 | + Web_item content),... | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + ******************************** | |
| 595 | + * TABLES * | |
| 596 | + ******************************** | |
| 597 | + | |
| 598 | + | |
| 599 | + A web item may be a table. A table is produced by the constructor | |
| 600 | + 'table' from the type 'Web_item'. This constructor takes 2 | |
| 601 | + arguments: | |
| 602 | + | |
| 603 | + - a list of 'table options', | |
| 604 | + - a list of 'table rows'. | |
| 605 | + | |
| 606 | + Of course, you use as many options as you want, including | |
| 607 | + none (if you do not want any option, put the empty list '[ ]' as | |
| 608 | + this argument). Some options have precedence over others. For example | |
| 609 | + a background image will hide the background color. | |
| 610 | + | |
| 611 | + Table options are defined below: | |
| 612 | + | |
| 613 | +public type Table_option: | |
| 614 | + | |
| 615 | + /* use a color as a background for the table, if you want it to | |
| 616 | + be different from the background of the page */ | |
| 617 | + background_color(Web_color), | |
| 618 | + | |
| 619 | + /* or use an image as the background of the table */ | |
| 620 | + background_image(String file_name), | |
| 621 | + | |
| 622 | + /* draw a border line around the table (and around each cell in | |
| 623 | + the table). You may also specify a geometry (in pixels) for the | |
| 624 | + border. This makes the 'in relief' part of the border appear | |
| 625 | + more or less wide. You may also specify a color for the border. */ | |
| 626 | + border, | |
| 627 | + nude, /* equivalent to 'border(0,0,0)' (below) */ | |
| 628 | + border(Int32, /* width of exterior (pixels) */ | |
| 629 | + Int32, /* width of top */ | |
| 630 | + Int32), /* width of interior */ | |
| 631 | + border_color(Web_color), | |
| 632 | + absolute_width(Int32). | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + A 'table row' is made of a list of 'row options', and a list of | |
| 637 | + 'cells'. A 'cell' itself has a list of 'cell options', and a web item, | |
| 638 | + which is its content. We begin by the description of options. | |
| 639 | + | |
| 640 | + | |
| 641 | +public type Row_option: | |
| 642 | + /* following concerns the horizontal positions of items within the | |
| 643 | + cells of the row */ | |
| 644 | + left, | |
| 645 | + h_center, | |
| 646 | + right, | |
| 647 | + /* the following concerns the vertical positions of items, within | |
| 648 | + the cells of the row */ | |
| 649 | + top, | |
| 650 | + v_center, | |
| 651 | + bottom, | |
| 652 | + absolute_height(Int32), | |
| 653 | + base_line, | |
| 654 | + /* set the background color of all cells in the row */ | |
| 655 | + background_color(Web_color). | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | +public type Cell_option: | |
| 660 | + /* all row options are available for individual cells, and apply | |
| 661 | + here only to one cell. */ | |
| 662 | + left, | |
| 663 | + h_center, | |
| 664 | + right, | |
| 665 | + top, | |
| 666 | + v_center, | |
| 667 | + bottom, | |
| 668 | + base_line, | |
| 669 | + background_color(Web_color), | |
| 670 | + /* you can set the width of the cell either absolutely (in pixels) | |
| 671 | + or as a percentage of the width of the table. */ | |
| 672 | + background_image(String file_name), | |
| 673 | + absolute_width(Int32), | |
| 674 | + relative_width(Int32), | |
| 675 | + absolute_height(Int32), | |
| 676 | + relative_height(Int32), | |
| 677 | + /* a cell may span over several columns or rows in the table */ | |
| 678 | + columns(Int32), | |
| 679 | + rows(Int32), | |
| 680 | + nowrap. | |
| 681 | + | |
| 682 | + | |
| 683 | +public type Cell: | |
| 684 | + cell(List(Cell_option), | |
| 685 | + Web_item). | |
| 686 | + | |
| 687 | +public type Table_row: | |
| 688 | + row(List(Row_option), | |
| 689 | + List(Cell)). | |
| 690 | + | |
| 691 | +public define Table_row row(Web_item i) = row([],[cell([],i)]). | |
| 692 | +public define Table_row row(Cell c) = row([],[c]). | |
| 693 | +public define Table_row row(List(Cell) l) = row([],l). | |
| 694 | + | |
| 695 | + | |
| 696 | +public type Web_item: | |
| 697 | + table(List(Table_option), | |
| 698 | + List(Table_row)),... | |
| 699 | + | |
| 700 | +public type Web_item: | |
| 701 | + list(List(Web_item)),... | |
| 702 | + | |
| 703 | +public type Web_item: | |
| 704 | + link(String name, Web_item), | |
| 705 | + link(String name, String target, Web_item),... | |
| 706 | + | |
| 707 | +public type Web_item: | |
| 708 | + link_for_download(String filename, Web_item),... // the filename is relative to the public directory | |
| 709 | + | |
| 710 | +public type Web_item: | |
| 711 | + mail_to(String addr, Web_item),... | |
| 712 | + | |
| 713 | + | |
| 714 | +public type Web_item: | |
| 715 | + select(String name, | |
| 716 | + Int32 size, | |
| 717 | + List(String) choices), | |
| 718 | + select(String name, | |
| 719 | + Int32 size, | |
| 720 | + List(String) choices, | |
| 721 | + String selected), | |
| 722 | + immediate_select(String name, // selection will immediately submit the form | |
| 723 | + Int32 size, | |
| 724 | + List(String) choices),... | |
| 725 | + | |
| 726 | + | |
| 727 | +public type Web_item: | |
| 728 | + radio_button (Printable_tree name, String value), | |
| 729 | + checked_radio_button (Printable_tree name, String value), | |
| 730 | + check_box (Printable_tree name, String value), | |
| 731 | + checked_box (Printable_tree name, String value),... | |
| 732 | + | |
| 733 | + | |
| 734 | +public type Web_item: | |
| 735 | + link_to_window(Printable_tree name, Web_item), | |
| 736 | + link_to_window(Printable_tree name, String window_name, Web_item), | |
| 737 | + link_to_window_with_ticket(String name, | |
| 738 | + String web_args, | |
| 739 | + String window_name, | |
| 740 | + Web_item content, | |
| 741 | + Int32 width, | |
| 742 | + Int32 height), | |
| 743 | + link_to_window_with_ticket_and_scroll | |
| 744 | + (String name, | |
| 745 | + String web_args, | |
| 746 | + String window_name, | |
| 747 | + Web_item content, | |
| 748 | + Int32 width, | |
| 749 | + Int32 height), | |
| 750 | + link_to_window_with_ticket_and_scroll | |
| 751 | + (String name, | |
| 752 | + String label_name, | |
| 753 | + String web_args, | |
| 754 | + String window_name, | |
| 755 | + Web_item content, | |
| 756 | + Int32 width, | |
| 757 | + Int32 height), | |
| 758 | + link_to_frame (Printable_tree name, String frame_name, Web_item). | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | +---- Formating operations (Anubis --> HTML/Javascript) --------------------------- | |
| 763 | + | |
| 764 | + Stupid operation formating a web color name. | |
| 765 | + | |
| 766 | +public define String | |
| 767 | + format | |
| 768 | + ( | |
| 769 | + Web_color_name n | |
| 770 | + ) = | |
| 771 | + if n is | |
| 772 | + { | |
| 773 | + aliceblue then "aliceblue", | |
| 774 | + antiquewhite1 then "antiquewhite1", | |
| 775 | + antiquewhite2 then "antiquewhite2", | |
| 776 | + antiquewhite3 then "antiquewhite3", | |
| 777 | + antiquewhite4 then "antiquewhite4", | |
| 778 | + aquamarine1 then "aquamarine1", | |
| 779 | + aquamarine2 then "aquamarine2", | |
| 780 | + aquamarine3 then "aquamarine3", | |
| 781 | + aquamarine4 then "aquamarine4", | |
| 782 | + azure1 then "azure1", | |
| 783 | + azure2 then "azure2", | |
| 784 | + azure3 then "azure3", | |
| 785 | + azure4 then "azure4", | |
| 786 | + yellow then "yellow", | |
| 787 | + }. | |
| 788 | + | |
| 789 | + Anubis really needs some system of 'macros' to avoid this... | |
| 790 | + | |
| 791 | + | |
| 792 | + Formating a web color. | |
| 793 | + | |
| 794 | +public define String | |
| 795 | + format | |
| 796 | + ( | |
| 797 | + Web_color wc | |
| 798 | + ) = | |
| 799 | + if wc is | |
| 800 | + { | |
| 801 | + rgb(r,g,b) then "\"#" + hexadecimal(r,2) + hexadecimal(g,2) + hexadecimal(b,2) + "\"", | |
| 802 | + _(c) then format(c) | |
| 803 | + }. | |
| 804 | + | |
| 805 | +public define String | |
| 806 | + format_without_quotes | |
| 807 | + ( | |
| 808 | + Web_color wc | |
| 809 | + ) = | |
| 810 | + if wc is | |
| 811 | + { | |
| 812 | + rgb(r,g,b) then "#" + hexadecimal(r,2) + hexadecimal(g,2) + hexadecimal(b,2) + "", | |
| 813 | + _(c) then format(c) | |
| 814 | + }. | |
| 815 | + | |
| 816 | +define Printable_tree | |
| 817 | + format | |
| 818 | + ( | |
| 819 | + Web_color c | |
| 820 | + ) = [(String)format(c)]. | |
| 821 | + | |
| 822 | +public define String | |
| 823 | + format_without_sharp | |
| 824 | + ( | |
| 825 | + Web_color wc | |
| 826 | + ) = | |
| 827 | + if wc is | |
| 828 | + { | |
| 829 | + rgb(r,g,b) then "" + hexadecimal(r,2) + hexadecimal(g,2) + hexadecimal(b,2) + "", | |
| 830 | + _(c) then format(c) | |
| 831 | + }. | |
| 832 | + | |
| 833 | +define Printable_tree | |
| 834 | + format_without_sharp | |
| 835 | + ( | |
| 836 | + Web_color c | |
| 837 | + ) = [(String)format_without_sharp(c)]. | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | +define Printable_tree | |
| 842 | + psychedelic_bg | |
| 843 | + ( | |
| 844 | + Int32 average, | |
| 845 | + Int32 amplitude, | |
| 846 | + Int32 delay | |
| 847 | + ) = | |
| 848 | + with ampl = if amplitude >= 120 then 120 else | |
| 849 | + if amplitude =< 1 then 1 else amplitude, | |
| 850 | + with aver = if average+ampl >= 254 then 254-ampl | |
| 851 | + else if average-ampl =< 1 then 1+ampl else average, | |
| 852 | + [ "<script>", | |
| 853 | + " var psy_t = 0;", | |
| 854 | + " function do_psy_bg() { psy_t += 0.05;", | |
| 855 | + " document.bgColor = '#' + ", | |
| 856 | + " (Math.round(",aver,"+",ampl,"*Math.cos(psy_t))).toString(16) + ", | |
| 857 | + " (Math.round(",aver,"+",ampl,"*Math.sin(psy_t))).toString(16) + ", | |
| 858 | + " (Math.round(",aver,"-",ampl,"*Math.cos(2*psy_t))).toString(16); ", | |
| 859 | + " setTimeout(\"do_psy_bg()\",",delay,"); }", | |
| 860 | + " setTimeout(\"do_psy_bg()\",1000);", | |
| 861 | + "</script>"]. | |
| 862 | + | |
| 863 | + | |
| 864 | +define List(Web_body_option) | |
| 865 | + replace_background_init | |
| 866 | + ( | |
| 867 | + List(Web_body_option) l, | |
| 868 | + Int32 average, | |
| 869 | + Int32 amplitude, | |
| 870 | + Int32 delay | |
| 871 | + ) = | |
| 872 | + if l is | |
| 873 | + { | |
| 874 | + [ ] then [ ], | |
| 875 | + [h . t] then | |
| 876 | + if h is background_color(_) | |
| 877 | + then [background_color(rgb(average+amplitude, | |
| 878 | + average, | |
| 879 | + average-amplitude)) | |
| 880 | + . replace_background_init(t,average,amplitude,delay)] | |
| 881 | + else [h . replace_background_init(t,average,amplitude,delay)] | |
| 882 | + }. | |
| 883 | + | |
| 884 | +define Maybe((Int32,Int32,Int32)) | |
| 885 | + get_psy | |
| 886 | + ( | |
| 887 | + List(Web_body_option) l | |
| 888 | + ) = | |
| 889 | + if l is | |
| 890 | + { | |
| 891 | + [ ] then failure, | |
| 892 | + [h . t] then | |
| 893 | + if h is psychedelic_background(a,f,d) | |
| 894 | + then success((a,f,d)) | |
| 895 | + else get_psy(t) | |
| 896 | + }. | |
| 897 | + | |
| 898 | +define List(Web_body_option) | |
| 899 | + prepare | |
| 900 | + ( | |
| 901 | + List(Web_body_option) l | |
| 902 | + ) = | |
| 903 | + if get_psy(l) is | |
| 904 | + { | |
| 905 | + failure then l, | |
| 906 | + success(op) then if op is (a,f,d) then | |
| 907 | + replace_background_init(l,a,f,d) | |
| 908 | + }. | |
| 909 | + | |
| 910 | + | |
| 911 | +public define Printable_tree | |
| 912 | + format | |
| 913 | + ( | |
| 914 | + String c_ticket, | |
| 915 | + String s_ticket, | |
| 916 | + Web_item i | |
| 917 | + ). | |
| 918 | + | |
| 919 | +define Printable_tree | |
| 920 | + move_layer_command | |
| 921 | + ( | |
| 922 | + String property, | |
| 923 | + Int32 n, | |
| 924 | + Int32 num, | |
| 925 | + Int32 i, | |
| 926 | + Int32 period | |
| 927 | + ) = | |
| 928 | + if i >= num then [ ] else | |
| 929 | + [" if (document.layers)", | |
| 930 | + " { document.nslay",n,"_",i,".",property,"=layp",n,"+(",((i-1)),"); } ", | |
| 931 | + " else ", | |
| 932 | + " { ielay",n,"_",i,".style.",property,"=layp",n,"+(",(i-1)*period,"); } " | |
| 933 | + . move_layer_command(property,n,num,i+1,period)]. | |
| 934 | + | |
| 935 | +define Printable_tree | |
| 936 | + format_layers | |
| 937 | + ( | |
| 938 | + LayerDisposition disp, | |
| 939 | + Int32 margin, | |
| 940 | + Web_item content, | |
| 941 | + Int32 n, | |
| 942 | + Int32 num, | |
| 943 | + Int32 i, | |
| 944 | + Int32 period | |
| 945 | + ) = | |
| 946 | + if i >= num then [ ] else | |
| 947 | + ["<layer name=\"nslay",n,"_",i,"\" top=0", | |
| 948 | + " left=0", ">", | |
| 949 | + "<div id=ielay",n,"_",i," style=\"position:absolute;top:", | |
| 950 | + if disp is vertical then (i-1)*period else margin, | |
| 951 | + "px;left:", | |
| 952 | + if disp is vertical then margin else (i-1)*period, | |
| 953 | + "px\">", | |
| 954 | + format("","",content), | |
| 955 | + "</div></layer>" . format_layers(disp,margin,content,n,num,i+1,period)]. | |
| 956 | + | |
| 957 | +define Printable_tree | |
| 958 | + s_layer | |
| 959 | + ( | |
| 960 | + LayerDisposition disp, | |
| 961 | + Int32 steps, | |
| 962 | + Int32 margin, | |
| 963 | + Int32 delay, | |
| 964 | + Web_item content, | |
| 965 | + Int32 period, | |
| 966 | + Int32 num | |
| 967 | + ) = | |
| 968 | + with n = new_web_count, | |
| 969 | + [ "<script>", | |
| 970 | + " var layp",n," = 0;", | |
| 971 | + " function scroll_layer",n,"() {", | |
| 972 | + " layp",n,"+=(",steps,"); if (layp",n," ",if steps > 0 then ">" else "<", | |
| 973 | + "= ",if steps > 0 then period else 0, | |
| 974 | + ") layp",n," = ",if steps > 0 then 0 else period,";", | |
| 975 | + move_layer_command(if disp is vertical then "top" else "left",n,num,0,period), | |
| 976 | + " setTimeout(\"scroll_layer",n,"()\",",delay,");", | |
| 977 | + " }", | |
| 978 | + " setTimeout(\"scroll_layer",n,"()\",1000);", | |
| 979 | + "</script>", | |
| 980 | + format_layers(disp,margin,content,n,num,0,period), | |
| 981 | + ]. | |
| 982 | + | |
| 983 | + | |
| 984 | +define Printable_tree | |
| 985 | + over | |
| 986 | + ( | |
| 987 | + Web_item i, | |
| 988 | + Int32 left, | |
| 989 | + Int32 top | |
| 990 | + ) = | |
| 991 | + with n = new_web_count, | |
| 992 | + [ "<layer name=\"nslay",n,"\" top=",top," left=",left,">", | |
| 993 | + " <div id=\"ielay",n,"\" style=\"position:absolute;top=",top,"px;left=",left,"px\">", | |
| 994 | + format("","",i), | |
| 995 | + "</div></layer>" | |
| 996 | + ]. | |
| 997 | + | |
| 998 | +define Printable_tree | |
| 999 | + bnce | |
| 1000 | + ( | |
| 1001 | + Web_item i, | |
| 1002 | + Int32 left, | |
| 1003 | + Int32 right, | |
| 1004 | + Int32 top, | |
| 1005 | + Int32 bottom | |
| 1006 | + ) = | |
| 1007 | + with n = new_web_count, | |
| 1008 | + [ "<script>", | |
| 1009 | + " var bncx",n," = ",left,"; var bncy",n," = ",top,"; var bncdx",n," = 1; var bncdy",n," = 1;", | |
| 1010 | + " function do_bnc",n,"() {", | |
| 1011 | + " if (bncx",n," >= (",right,") || bncx",n," < ",left,") bncdx",n," = -bncdx",n,";", | |
| 1012 | + " if (bncy",n," >= (",bottom,") || bncy",n," < ",top,") bncdy",n," = -bncdy",n,";", | |
| 1013 | + " bncx",n," += bncdx",n,"; bncy",n," += bncdy",n,";", | |
| 1014 | + " if (document.layers)", | |
| 1015 | + " { document.nslay",n,".left = bncx",n,"; document.nslay",n,".top = bncy",n,"; } else", | |
| 1016 | + " { ielay",n,".style.left = bncx",n,"; ielay",n,".style.top = bncy",n,"; }", | |
| 1017 | + " setTimeout(\"do_bnc",n,"()\",40); }", | |
| 1018 | + " setTimeout(\"do_bnc",n,"()\",1000);", | |
| 1019 | + "</script>", | |
| 1020 | + "<layer name=\"nslay",n,"\" top=",top," left=",left,">", | |
| 1021 | + " <div id=\"ielay",n,"\" style=\"position:absolute;top=",top,"px;left=",left,"px\">", | |
| 1022 | + format("","",i), | |
| 1023 | + "</div></layer>" | |
| 1024 | + ]. | |
| 1025 | + | |
| 1026 | + | |
| 1027 | +define Printable_tree | |
| 1028 | + folp_switch | |
| 1029 | + ( | |
| 1030 | + Int32 n, | |
| 1031 | + Int32 i, | |
| 1032 | + List(FollowPathCommand) path, | |
| 1033 | + Bool loop, | |
| 1034 | + Int32 steps | |
| 1035 | + ) = | |
| 1036 | + if path is | |
| 1037 | + { | |
| 1038 | + [ ] then [ ], | |
| 1039 | + [p0 . t0] then if p0 is pos(x0,y0,i0,d0) then | |
| 1040 | + if t0 is | |
| 1041 | + { | |
| 1042 | + [ ] then if loop | |
| 1043 | + then [" default: ", | |
| 1044 | + " folpx",n,"=",x0,"; folpy",n,"=",y0,"; ", | |
| 1045 | + " folpseg",n,"=0; ", | |
| 1046 | + " folpwait",n,"=",d0,";", | |
| 1047 | + " if(document.layers)", | |
| 1048 | + " document.nslay",n,".document.folpim",n,".src=folpimages",n,"[",i0,"].src;", | |
| 1049 | + " else document.folpim",n,".src=folpimages",n,"[",i0,"].src;", | |
| 1050 | + " folpstpmax",n," = 0;", | |
| 1051 | + " folpstp",n,"=0;", | |
| 1052 | + " folpdx",n,"=0; ", | |
| 1053 | + " folpdy",n,"=0; ", | |
| 1054 | + " break;"] | |
| 1055 | + else [" default: folpend",n,"=1; break; "], | |
| 1056 | + [p1 . t1] then if p1 is pos(x1,y1,i1,d1) then | |
| 1057 | + [ " case ",i,": ", | |
| 1058 | + " folpx",n,"=",x0,"; folpy",n,"=",y0,"; ", | |
| 1059 | + " folpseg",n,"=",i+1,"; ", | |
| 1060 | + " folpwait",n,"=",d0,";", | |
| 1061 | + " if(document.layers)", | |
| 1062 | + " document.nslay",n,".document.folpim",n,".src=folpimages",n,"[",i0,"].src;", | |
| 1063 | + " else document.folpim",n,".src=folpimages",n,"[",i0,"].src;", | |
| 1064 | + " folpstpmax",n," = ", | |
| 1065 | + "Math.round(Math.sqrt(Math.pow(",x1,"-",x0,",2)+Math.pow(",y1,"-",y0,",2))/",steps,");", | |
| 1066 | + " folpstp",n,"=0;", | |
| 1067 | + " folpdx",n,"=((",x1,"-",x0,")/folpstpmax",n,"); ", | |
| 1068 | + " folpdy",n,"=((",y1,"-",y0,")/folpstpmax",n,"); ", | |
| 1069 | + " break; " | |
| 1070 | + . folp_switch(n,i+1,t0,loop,steps) ] | |
| 1071 | + }}. | |
| 1072 | + | |
| 1073 | +define Printable_tree | |
| 1074 | + set_folpimages | |
| 1075 | + ( | |
| 1076 | + Int32 n, | |
| 1077 | + List(String) filenames, | |
| 1078 | + Int32 i, | |
| 1079 | + ) = | |
| 1080 | + if filenames is | |
| 1081 | + { | |
| 1082 | + [ ] then [ ], | |
| 1083 | + [h . t] then | |
| 1084 | + [ " folpimages",n,"[",i,"].src=\"",h,"\";" | |
| 1085 | + . set_folpimages(n,t,i+1)] | |
| 1086 | + }. | |
| 1087 | + | |
| 1088 | +define Printable_tree | |
| 1089 | + follow_path | |
| 1090 | + ( | |
| 1091 | + List(String) filenames, | |
| 1092 | + Int32 change_every, | |
| 1093 | + List(FollowPathCommand) path, | |
| 1094 | + Bool loop, | |
| 1095 | + Int32 steps, | |
| 1096 | + Int32 delay | |
| 1097 | + ) = | |
| 1098 | + if filenames is | |
| 1099 | + { | |
| 1100 | + [ ] then (print("Error in usage of 'follow_path': 'filenames' must be non empty."); []), | |
| 1101 | + [im1 . other_ims] then | |
| 1102 | + if steps < 1 then (print("Error in usage of 'follow_path': 'step' must be >= 1."); [ ]) else | |
| 1103 | + if path is | |
| 1104 | + { | |
| 1105 | + [ ] then [ ], | |
| 1106 | + [p0 . t0] then if p0 is pos(x0,y0,i0,d0) then | |
| 1107 | + if t0 is | |
| 1108 | + { | |
| 1109 | + [ ] then | |
| 1110 | + (print("Error in usage of 'follow_path': 'path' must have at least 2 positions."); []), | |
| 1111 | + [p1 . t1] then if p1 is pos(x1,y1,i1,d1) then | |
| 1112 | + with n = new_web_count, | |
| 1113 | + [ | |
| 1114 | + "<layer name=\"nslay",n,"\" top=",y0," left=",x0,">", | |
| 1115 | + "<div id=\"ielay",n,"\" style=\"position:absolute;top=",y0,"px;left=",x0,"px\">", | |
| 1116 | + "<img src=\"",im1,"\" name=\"folpim",n,"\" border=0>", | |
| 1117 | + "</div></layer>", | |
| 1118 | + "<script>", | |
| 1119 | + " var folpimages",n,"=new Array(",length(filenames),");", | |
| 1120 | + " var folpcurim",n,"=0;", | |
| 1121 | + " var folpx",n," = ",x0,";", | |
| 1122 | + " var folpy",n," = ",y0,";", | |
| 1123 | + " var folpseg",n," = 1;", | |
| 1124 | + " var folpstpmax",n," = ", | |
| 1125 | + "Math.round(Math.sqrt(Math.pow(",x1,"-",x0,",2)+Math.pow(",y1,"-",y0,",2))/",steps,");", | |
| 1126 | + " var folpdx",n,"=((",x1,"-",x0,")/folpstpmax",n,"); ", | |
| 1127 | + " var folpdy",n,"=((",y1,"-",y0,")/folpstpmax",n,"); ", | |
| 1128 | + " var folpstp",n," = 0;", | |
| 1129 | + " var folpchgcnt",n," = 0;", | |
| 1130 | + " var folpwait",n,"=",d0,";", | |
| 1131 | + " var folpend",n,"=0;", | |
| 1132 | + " for(var i = 0; i<",length(filenames),"; i++) {", | |
| 1133 | + " folpimages",n,"[i]=new Image(); }", | |
| 1134 | + set_folpimages(n,filenames,0), | |
| 1135 | + " function dofolp",n,"() {", | |
| 1136 | + " if (folpstp",n," >= folpstpmax",n,")", | |
| 1137 | + " { switch(folpseg",n,") {", | |
| 1138 | + folp_switch(n,0,path,loop,steps), | |
| 1139 | + " }} else { folpstp",n,"++; folpx",n," += folpdx",n,"; folpy",n," += folpdy",n,"; };", | |
| 1140 | + " if (document.layers)", | |
| 1141 | + " { document.nslay",n,".left=folpx",n,"; document.nslay",n,".top=folpy",n,"; } else", | |
| 1142 | + " { ielay",n,".style.left=folpx",n,"; ielay",n,".style.top=folpy",n,"; };", | |
| 1143 | + | |
| 1144 | + //--- change image if needed: | |
| 1145 | + if change_every = 0 then [ ] else | |
| 1146 | + if length(filenames) =< 1 then [ ] else | |
| 1147 | + [" if (folpchgcnt",n,"==",change_every,") ", | |
| 1148 | + " { ", | |
| 1149 | + " folpchgcnt",n,"=0;", | |
| 1150 | + " folpcurim",n,"++;", | |
| 1151 | + " if (folpcurim",n,"==",length(filenames),") folpcurim",n,"=0;", | |
| 1152 | + " if (document.layers) ", | |
| 1153 | + " document.nslay",n,".document.folpim",n,".src=folpimages",n,"[folpcurim",n,"].src;", | |
| 1154 | + " else document.folpim",n,".src=folpimages",n,"[folpcurim",n,"].src;", | |
| 1155 | + " }", | |
| 1156 | + " else { folpchgcnt",n,"++; };"], | |
| 1157 | + | |
| 1158 | + " if (!folpend",n,")", | |
| 1159 | + " if (folpstp",n,") setTimeout(\"dofolp",n,"()\",",delay,"); ", | |
| 1160 | + " else setTimeout(\"dofolp",n,"()\",",delay,"+folpwait",n,"); ", | |
| 1161 | + " }", | |
| 1162 | + " setTimeout(\"dofolp",n,"()\",1000);", | |
| 1163 | + "</script>", | |
| 1164 | + ] | |
| 1165 | + }}}. | |
| 1166 | + | |
| 1167 | + | |
| 1168 | +public type ImageToLoad: | |
| 1169 | + simple(String image_name), | |
| 1170 | + with_rollover(String image_name, | |
| 1171 | + String rollover_name). | |
| 1172 | + | |
| 1173 | +variable List(ImageToLoad) images_to_load = []. | |
| 1174 | + | |
| 1175 | +public define Printable_tree | |
| 1176 | + format | |
| 1177 | + ( | |
| 1178 | + Web_body_option o | |
| 1179 | + ) = | |
| 1180 | + if o is | |
| 1181 | + { | |
| 1182 | + background_color(c) then [" bgcolor=" , (String)format(c)], | |
| 1183 | + psychedelic_background(a,f,d) then add_script(psychedelic_bg(a,f,d)); [ ], | |
| 1184 | + background_image(n) then [" background=", n], | |
| 1185 | + scrolling_layer(disp,st,m,t,c,p) then add_script(s_layer(disp,st,m,t,c,p,2000/p)); [ ], | |
| 1186 | + bounce(i,l,r,t,b) then add_script(bnce(i,l,r,t,b)); [ ], | |
| 1187 | + over(i,l,t) then add_script(over(i,l,t)); [ ], | |
| 1188 | + follow_path(li,ns,p,l,s,d) then add_script(follow_path(li,ns,p,l,s,d)); [ ], | |
| 1189 | + load_image(n) then images_to_load <- [simple(n) . *images_to_load]; [ ], | |
| 1190 | + left_margin(n) then [" leftmargin=", n], | |
| 1191 | + top_margin(n) then [" topmargin=", n], | |
| 1192 | + margin_width(n) then [" marginwidth=", n], | |
| 1193 | + margin_height(n) then [" marginheight=", n], | |
| 1194 | + reload_frame(n,url) then add_body_onload(reload_frame(n,url)); [ ], | |
| 1195 | + onload(n) then [" onLoad=\"", n, "()\""] | |
| 1196 | + }. | |
| 1197 | + | |
| 1198 | +define Printable_tree | |
| 1199 | + preload_list | |
| 1200 | + ( | |
| 1201 | + List(ImageToLoad) images, | |
| 1202 | + Int32 n, | |
| 1203 | + ) = | |
| 1204 | + if images is | |
| 1205 | + { | |
| 1206 | + [ ] then [ ], | |
| 1207 | + [h . t] then | |
| 1208 | + [" preloaded_images[",n,"].src = '",image_name(h),"';", | |
| 1209 | + if h is | |
| 1210 | + { | |
| 1211 | + simple(_) then [], | |
| 1212 | + with_rollover(n1,r) then | |
| 1213 | + [" preloaded_images[",n1,"].onload = 'allow_rollover(\"",r,"\")';"] | |
| 1214 | + } | |
| 1215 | + . preload_list(t,n-1)] | |
| 1216 | + }. | |
| 1217 | + | |
| 1218 | +define Printable_tree | |
| 1219 | + load_image_script | |
| 1220 | + ( | |
| 1221 | + List(ImageToLoad) images | |
| 1222 | + ) = | |
| 1223 | + if images is | |
| 1224 | + { | |
| 1225 | + [ ] then [ ], | |
| 1226 | + [_ . _] then | |
| 1227 | + [ | |
| 1228 | + "<script>", | |
| 1229 | + " var preloaded_images = new Array(",length(images),");", | |
| 1230 | + " var pi_i = 0;", | |
| 1231 | + " for(pi_i = 0; pi_i < ",length(images),"; pi_i++) {", | |
| 1232 | + " preloaded_images[pi_i] = new Image(); }", | |
| 1233 | + " function preload_images() {", | |
| 1234 | + preload_list(images,length(images)-1), | |
| 1235 | + " }</script>" | |
| 1236 | + ] | |
| 1237 | + }. | |
| 1238 | + | |
| 1239 | + | |
| 1240 | +public define Printable_tree format(String c_ticket, | |
| 1241 | + String s_ticket, | |
| 1242 | + Web_item i). | |
| 1243 | + | |
| 1244 | + | |
| 1245 | +public define Printable_tree | |
| 1246 | + format(List(Table_option) l) = | |
| 1247 | + if l is | |
| 1248 | + { | |
| 1249 | + [ ] then [ ], | |
| 1250 | + [h . t] then [if h is | |
| 1251 | + { | |
| 1252 | + background_color(c) then [" bgcolor=", (String)format(c)], | |
| 1253 | + background_image(f) then [" background=",f], | |
| 1254 | + border then [" border"], | |
| 1255 | + nude then [" border=\"0\" cellspacing=\"0\" cellpadding=\"0\""], | |
| 1256 | + border(e,top,i) then [" border=",e," cellspacing=",top," cellpadding=",i], | |
| 1257 | + border_color(c) then [" bordercolor=", (String)format(c)], | |
| 1258 | + absolute_width(n) then [" width=",n] | |
| 1259 | + }, format(t)] | |
| 1260 | + }. | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | +public define Printable_tree | |
| 1265 | + format(List(Row_option) l) = | |
| 1266 | + if l is | |
| 1267 | + { | |
| 1268 | + [ ] then [ ], | |
| 1269 | + [first . others] then [if first is | |
| 1270 | + { | |
| 1271 | + left then [" align=left"], | |
| 1272 | + h_center then [" align=center"], | |
| 1273 | + right then [" align=right"], | |
| 1274 | + top then [" valign=top"], | |
| 1275 | + v_center then [" valign=center"], | |
| 1276 | + bottom then [" valign=bottom"], | |
| 1277 | + absolute_height(n) then [" height=\"",n,"\""], | |
| 1278 | + base_line then [" valign=baseline"], | |
| 1279 | + background_color(c) then [" bgcolor=",(String)format(c)] | |
| 1280 | + }, | |
| 1281 | + format(others)] | |
| 1282 | + }. | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | +public define Int32 | |
| 1288 | + percentage(Int32 n) = | |
| 1289 | + if n < 0 then 0 | |
| 1290 | + else if n > 100 then 100 | |
| 1291 | + else n. | |
| 1292 | + | |
| 1293 | + public define Int32 percentage(Int32 n) = n. | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | +public define Printable_tree | |
| 1299 | + format | |
| 1300 | + ( | |
| 1301 | + List(Web_body_option) l | |
| 1302 | + ) = | |
| 1303 | + if l is | |
| 1304 | + { | |
| 1305 | + [ ] then [ ], | |
| 1306 | + [h . t] then [format(h) . format(t)] | |
| 1307 | + }. | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | +public define Printable_tree | |
| 1313 | + format(List(Cell_option) l) = | |
| 1314 | + if l is | |
| 1315 | + { | |
| 1316 | + [ ] then [ ], | |
| 1317 | + [first . others] then | |
| 1318 | + [if first is | |
| 1319 | + { | |
| 1320 | + left then (Printable_tree)[" align=left"], | |
| 1321 | + h_center then (Printable_tree)[" align=center"], | |
| 1322 | + right then (Printable_tree)[" align=right"], | |
| 1323 | + top then (Printable_tree)[" valign=top"], | |
| 1324 | + v_center then (Printable_tree)[" valign=center"], | |
| 1325 | + bottom then (Printable_tree)[" valign=bottom"], | |
| 1326 | + base_line then (Printable_tree)[" valign=baseline"], | |
| 1327 | + background_color(c) then (Printable_tree)[" bgcolor=",(String)format(c)], | |
| 1328 | + background_image(n) then (Printable_tree)[" style=\"background: url(",n,")\""], | |
| 1329 | + absolute_width(w) then (Printable_tree)[" width=",w], | |
| 1330 | + relative_width(r) then (Printable_tree)[" width=",percentage(r),""], | |
| 1331 | + absolute_height(h) then (Printable_tree)[" height=",h], | |
| 1332 | + relative_height(r) then (Printable_tree)[" height=",percentage(r),""], | |
| 1333 | + columns(n) then (Printable_tree)[" colspan=",n], | |
| 1334 | + rows(n) then (Printable_tree)[" rowspan=",n], | |
| 1335 | + nowrap then (Printable_tree)[" nowrap"] | |
| 1336 | + } | |
| 1337 | + . format(others)] | |
| 1338 | + }. | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | +public define Printable_tree | |
| 1343 | + format | |
| 1344 | + ( | |
| 1345 | + String c_ticket, | |
| 1346 | + String s_ticket, | |
| 1347 | + List(Cell) l | |
| 1348 | + ) = | |
| 1349 | + if l is | |
| 1350 | + { | |
| 1351 | + [ ] then [ ], | |
| 1352 | + [first . others] then | |
| 1353 | + [if first is cell(options,item) then | |
| 1354 | + ["<td",format(options),">", | |
| 1355 | + format(c_ticket,s_ticket,item),"</td>"], | |
| 1356 | + format(c_ticket,s_ticket,others)] | |
| 1357 | + }. | |
| 1358 | + | |
| 1359 | + | |
| 1360 | +public define Printable_tree | |
| 1361 | + format | |
| 1362 | + ( | |
| 1363 | + String c_ticket, | |
| 1364 | + String s_ticket, | |
| 1365 | + List(Table_row) l | |
| 1366 | + ) = | |
| 1367 | + if l is | |
| 1368 | + { | |
| 1369 | + [ ] then [ ], | |
| 1370 | + [first_row . other_rows] | |
| 1371 | + then [if first_row is | |
| 1372 | + { | |
| 1373 | + row(options,cells) then | |
| 1374 | + [ "<tr",format(options),">", | |
| 1375 | + format(c_ticket,s_ticket,cells),"</tr>"] | |
| 1376 | + }, | |
| 1377 | + format(c_ticket,s_ticket,other_rows)] | |
| 1378 | + }. | |
| 1379 | + | |
| 1380 | + | |
| 1381 | +public define Printable_tree | |
| 1382 | + format_choices | |
| 1383 | + ( | |
| 1384 | + List(String) l | |
| 1385 | + ) = | |
| 1386 | + if l is | |
| 1387 | + { | |
| 1388 | + [ ] then [ ], | |
| 1389 | + [h . t] then ["<option>",h . format_choices(t)] | |
| 1390 | + }. | |
| 1391 | + | |
| 1392 | + | |
| 1393 | +public define Printable_tree | |
| 1394 | + format_choices | |
| 1395 | + ( | |
| 1396 | + List(String) l, | |
| 1397 | + String selected | |
| 1398 | + ) = | |
| 1399 | + if l is | |
| 1400 | + { | |
| 1401 | + [ ] then [ ], | |
| 1402 | + [h . t] then if h = selected | |
| 1403 | + then ["<option selected>",h . format_choices(t)] | |
| 1404 | + else ["<option>",h . format_choices(t,selected)] | |
| 1405 | + }. | |
| 1406 | + | |
| 1407 | + | |
| 1408 | +public define Printable_tree | |
| 1409 | + format_list | |
| 1410 | + ( | |
| 1411 | + String c_ticket, | |
| 1412 | + String s_ticket, | |
| 1413 | + List(Web_item) l | |
| 1414 | + ) = | |
| 1415 | + if l is | |
| 1416 | + { | |
| 1417 | + [ ] then [ ], | |
| 1418 | + [h . t] then ["<li>",format(c_ticket,s_ticket,h), | |
| 1419 | + format_list(c_ticket,s_ticket,t)] | |
| 1420 | + }. | |
| 1421 | + | |
| 1422 | + | |
| 1423 | +public define String | |
| 1424 | + format | |
| 1425 | + ( | |
| 1426 | + WebStyle ws | |
| 1427 | + ) = | |
| 1428 | + if ws is | |
| 1429 | + { | |
| 1430 | + background_image(fn) then "background: url("+fn+")", | |
| 1431 | + background_color(c) then "background: "+format(c), | |
| 1432 | + background_transparent then "background: transparent", | |
| 1433 | + background_repeat_horizontal then "background: repeat-x", | |
| 1434 | + background_repeat_vertical then "background: repeat-y", | |
| 1435 | + background_no_repeat then "background: no-repeat", | |
| 1436 | + color(wc) then if wc is | |
| 1437 | + { | |
| 1438 | + rgb(r,g,b) then "color: rgb("+r+","+g+","+b+")", | |
| 1439 | + _(c) then "color: "+format(c) | |
| 1440 | + }, | |
| 1441 | + float_to_left then "float: left", | |
| 1442 | + float_to_right then "float: right", | |
| 1443 | + font_family(n) then "font-family: "+n, | |
| 1444 | + font_size(n) then "font-size: "+integer_to_string(n)+"pt", | |
| 1445 | + italic then "font-style: italic", | |
| 1446 | + oblique then "font-style: oblique", | |
| 1447 | + small_capitals then "font-variant: small-caps", | |
| 1448 | + bold then "font-weight: bold", | |
| 1449 | + bolder then "font-weight: bolder", | |
| 1450 | + lighter then "font-weight: lighter", | |
| 1451 | + line_height(h) then "line-height: "+integer_to_string(h), | |
| 1452 | + text_center then "text-align: center", | |
| 1453 | + text_left then "text-align: left", | |
| 1454 | + text_right then "text-align: right", | |
| 1455 | + text_justify then "text-align: justify", | |
| 1456 | + text_underline then "text-decoration: underline", | |
| 1457 | + text_blink then "text-decoration: blink", | |
| 1458 | + text_line_through then "text-decoration: line-through", | |
| 1459 | + width(n) then "width: "+integer_to_string(n), | |
| 1460 | + }. | |
| 1461 | + | |
| 1462 | + | |
| 1463 | +public define Printable_tree | |
| 1464 | + format | |
| 1465 | + ( | |
| 1466 | + List(WebStyle) l | |
| 1467 | + ) = | |
| 1468 | + if l is | |
| 1469 | + { | |
| 1470 | + [ ] then [ ], | |
| 1471 | + [h . t] then | |
| 1472 | + if t is | |
| 1473 | + { | |
| 1474 | + [ ] then [format(h)], | |
| 1475 | + [_ . _] then [format(h), "; " . format(t)] | |
| 1476 | + } | |
| 1477 | + }. | |
| 1478 | + | |
| 1479 | + | |
| 1480 | +define Printable_tree | |
| 1481 | + format_polygon_coordinates | |
| 1482 | + ( | |
| 1483 | + List((Int32,Int32)) vertices | |
| 1484 | + ) = | |
| 1485 | + if vertices is | |
| 1486 | + { | |
| 1487 | + [ ] then [ ], | |
| 1488 | + [h . t] then | |
| 1489 | + if h is (x,y) then | |
| 1490 | + if t is [] | |
| 1491 | + then [ x,",",y ] | |
| 1492 | + else [ x,",",y,"," . format_polygon_coordinates(t)] | |
| 1493 | + }. | |
| 1494 | + | |
| 1495 | + define Printable_tree | |
| 1496 | + format | |
| 1497 | + ( | |
| 1498 | + List(Mouse_Sensitive_Zone) zones | |
| 1499 | + ) = | |
| 1500 | + if zones is | |
| 1501 | + { | |
| 1502 | + [ ] then [ ], | |
| 1503 | + [h . t] then | |
| 1504 | + [ | |
| 1505 | + if h is | |
| 1506 | + { | |
| 1507 | + rectangle(lt,rb,url) then | |
| 1508 | + if lt is (left,top) then | |
| 1509 | + if rb is (right,bottom) then | |
| 1510 | + [ "<area shape=rect coords=\"",left,",",top,",",right,",",bottom, | |
| 1511 | + "\" href=\"",url,"\">" ], | |
| 1512 | + circle(c,r,url) then | |
| 1513 | + if c is (x,y) then | |
| 1514 | + [ "<area shape=circle coords=\"",x,",",y,",",r, | |
| 1515 | + "\" href=\"",url,"\">" ], | |
| 1516 | + polygon(vs,url) then | |
| 1517 | + [ "<area shape=poly coords=\"",format_polygon_coordinates(vs), | |
| 1518 | + "\" href=\"",url,"\">" ] | |
| 1519 | + } | |
| 1520 | + . format(t)] | |
| 1521 | + }. | |
| 1522 | + | |
| 1523 | +define Printable_tree | |
| 1524 | + format | |
| 1525 | + ( | |
| 1526 | + List(Mouse_Sensitive_Zone) zones, | |
| 1527 | + String c_ticket, | |
| 1528 | + String s_ticket, | |
| 1529 | + ) = | |
| 1530 | + if zones is | |
| 1531 | + { | |
| 1532 | + [ ] then [ ], | |
| 1533 | + [h . t] then | |
| 1534 | + [ | |
| 1535 | + if h is | |
| 1536 | + { | |
| 1537 | + rectangle(lt,rb,url) then | |
| 1538 | + if lt is (left,top) then | |
| 1539 | + if rb is (right,bottom) then | |
| 1540 | + [ "<area shape=rect coords=\"",left,",",top,",",right,",",bottom, | |
| 1541 | + "\" href=\"", url + "&c_ticket=" + c_ticket + "&s_ticket=" + s_ticket,"\">" ], | |
| 1542 | + circle(c,r,url) then | |
| 1543 | + if c is (x,y) then | |
| 1544 | + [ "<area shape=circle coords=\"",x,",",y,",",r, | |
| 1545 | + "\" href=\"", url + "&c_ticket=" + c_ticket + "&s_ticket=" + s_ticket,"\">" ], | |
| 1546 | + polygon(vs,url) then | |
| 1547 | + [ "<area shape=poly coords=\"",format_polygon_coordinates(vs), | |
| 1548 | + "\" href=\"", url + "&c_ticket=" + c_ticket + "&s_ticket=" + s_ticket,"\">" ] | |
| 1549 | + } | |
| 1550 | + . format(t, c_ticket, s_ticket)] | |
| 1551 | + }. | |
| 1552 | + | |
| 1553 | +variable Int32 map_number = 0. | |
| 1554 | + | |
| 1555 | +define Printable_tree | |
| 1556 | + format_mouse_sensitive_image | |
| 1557 | + ( | |
| 1558 | + String image_file_name, | |
| 1559 | + List(Mouse_Sensitive_Zone) zones, | |
| 1560 | + String c_ticket, | |
| 1561 | + String s_ticket, | |
| 1562 | + ) = | |
| 1563 | + map_number <- (*map_number)+1; | |
| 1564 | + [ | |
| 1565 | + "<img src=\"",image_file_name,"\" usemap=\"#imsensmap",*map_number,"\" border=0>", | |
| 1566 | + "<map name=\"imsensmap",*map_number,"\">", | |
| 1567 | + format(zones, c_ticket, s_ticket), | |
| 1568 | + "</map>" | |
| 1569 | + ]. | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + Find an 'upload' in a web item. | |
| 1573 | + | |
| 1574 | +define Bool | |
| 1575 | + find_upload | |
| 1576 | + ( | |
| 1577 | + Web_item i | |
| 1578 | + ). | |
| 1579 | + | |
| 1580 | +define Bool | |
| 1581 | + find_upload | |
| 1582 | + ( | |
| 1583 | + List(Web_item) li | |
| 1584 | + ) = | |
| 1585 | + if li is | |
| 1586 | + { | |
| 1587 | + [ ] then false, | |
| 1588 | + [h . t] then if find_upload(h) then true else find_upload(t) | |
| 1589 | + }. | |
| 1590 | + | |
| 1591 | +define Bool | |
| 1592 | + find_upload | |
| 1593 | + ( | |
| 1594 | + Cell c | |
| 1595 | + ) = | |
| 1596 | + if c is cell(lo,wi) then find_upload(wi). | |
| 1597 | + | |
| 1598 | +define Bool | |
| 1599 | + find_upload | |
| 1600 | + ( | |
| 1601 | + List(Cell) lc | |
| 1602 | + ) = | |
| 1603 | + if lc is | |
| 1604 | + { | |
| 1605 | + [ ] then false, | |
| 1606 | + [h . t] then if find_upload(h) then true else find_upload(t) | |
| 1607 | + }. | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | +define Bool | |
| 1612 | + find_upload | |
| 1613 | + ( | |
| 1614 | + Table_row tr | |
| 1615 | + ) = | |
| 1616 | + if tr is | |
| 1617 | + { | |
| 1618 | + row(lo,lc) then find_upload(lc) | |
| 1619 | + }. | |
| 1620 | + | |
| 1621 | +define Bool | |
| 1622 | + find_upload | |
| 1623 | + ( | |
| 1624 | + List(Table_row) l | |
| 1625 | + ) = | |
| 1626 | + if l is | |
| 1627 | + { | |
| 1628 | + [ ] then false, | |
| 1629 | + [h . t] then | |
| 1630 | + if find_upload(h) then true else find_upload(t) | |
| 1631 | + }. | |
| 1632 | + | |
| 1633 | +define Bool | |
| 1634 | + find_upload | |
| 1635 | + ( | |
| 1636 | + Web_item wi | |
| 1637 | + ) = | |
| 1638 | + if wi is | |
| 1639 | + { | |
| 1640 | + [ ] then (Bool)false, | |
| 1641 | + [a . b] then (Bool)if find_upload(a) then true else find_upload(b), | |
| 1642 | + text(_) then (Bool)false, | |
| 1643 | + text_pt(_) then (Bool)false, | |
| 1644 | + text_nowrap(_) then (Bool)false, | |
| 1645 | + text_nowrap_pt(_) then (Bool)false, | |
| 1646 | + par(_) then (Bool)false, | |
| 1647 | + preformated_text(_) then (Bool)false, | |
| 1648 | + integer(_) then (Bool)false, | |
| 1649 | + float(_,_) then (Bool)false, | |
| 1650 | + center(i) then (Bool)find_upload(i), | |
| 1651 | + bigger(n,i) then (Bool)find_upload(i), | |
| 1652 | + smaller(n,i) then (Bool)find_upload(i), | |
| 1653 | + bold(i) then (Bool)find_upload(i), | |
| 1654 | + italic(i) then (Bool)find_upload(i), | |
| 1655 | + big(i) then (Bool)find_upload(i), | |
| 1656 | + very_big(i) then (Bool)find_upload(i), | |
| 1657 | + style(_,i) then (Bool)find_upload(i), | |
| 1658 | + spacer(_,_) then (Bool)false, | |
| 1659 | + image(_) then (Bool)false, | |
| 1660 | + image_d(_,_) then (Bool)false, | |
| 1661 | + image_pt(_) then (Bool)false, | |
| 1662 | + on_image(_,_) then (Bool)false, | |
| 1663 | + turning_images(_,_) then (Bool)false, | |
| 1664 | + rollover(_,_,_,_,_,_) then (Bool)false, | |
| 1665 | + rollover(_,_,_,_,_,_,_,_) then (Bool)false, | |
| 1666 | + mouse_sensitive_image(_,_) then (Bool)false, | |
| 1667 | + background_sound(_,_) then (Bool)false, | |
| 1668 | + form(_,c) then (Bool)find_upload(c), | |
| 1669 | + form_target(_,c,_) then (Bool)find_upload(c), | |
| 1670 | + form(_,_,c) then (Bool)find_upload(c), | |
| 1671 | + form_name(_,c) then (Bool)find_upload(c), | |
| 1672 | + text_input(_,_,_) then (Bool)false, | |
| 1673 | + password_input(_,_) then (Bool)false, | |
| 1674 | + text_area(_,_,_,_) then (Bool)false, | |
| 1675 | + upload(_,_) then (Bool)true, | |
| 1676 | + submit(_) then (Bool)false, | |
| 1677 | + submit_pt(_) then (Bool)false, | |
| 1678 | + submit(_,_) then (Bool)false, | |
| 1679 | + submit_close(_,_) then (Bool)false, | |
| 1680 | + submit_pt2(_,_) then (Bool)false, | |
| 1681 | + image_submit(_,_) then (Bool)false, | |
| 1682 | + image_submit(_,_,_,_) then (Bool)false, | |
| 1683 | + hl_image_submit(_,_,_,_,_) then (Bool)false, | |
| 1684 | + text_submit(_,_,_) then (Bool)false, | |
| 1685 | + web_submit(_,c) then (Bool)find_upload(c), | |
| 1686 | + button(_,_,_,_,_) then (Bool)false, | |
| 1687 | + mark(_,_) then (Bool)false, | |
| 1688 | + mark_pt(_,_) then (Bool)false, | |
| 1689 | + close_button then (Bool)false, | |
| 1690 | + close_button(_) then (Bool)false, | |
| 1691 | + label(_) then (Bool)false, | |
| 1692 | + go_to_label(_,i) then (Bool)find_upload(i), | |
| 1693 | + table(_,rows) then (Bool)find_upload(rows), | |
| 1694 | + list(l) then (Bool)find_upload(l), | |
| 1695 | + link(_,i) then (Bool)find_upload(i), | |
| 1696 | + link(_,_,i) then (Bool)find_upload(i), | |
| 1697 | + link_for_download(n,i) then (Bool)find_upload(i), | |
| 1698 | + mail_to(_,i) then (Bool)find_upload(i), | |
| 1699 | + select(_,_,_) then (Bool)false, | |
| 1700 | + select(_,_,_,_) then (Bool)false, | |
| 1701 | + immediate_select(_,_,_) then (Bool)false, | |
| 1702 | + radio_button(_,_) then (Bool)false, | |
| 1703 | + checked_radio_button(_,_) then (Bool)false, | |
| 1704 | + check_box(_,_) then (Bool)false, | |
| 1705 | + checked_box(_,_) then (Bool)false, | |
| 1706 | + link_to_window(_,i) then (Bool)find_upload(i), | |
| 1707 | + link_to_window(_,_,i) then (Bool)find_upload(i), | |
| 1708 | + link_to_window_with_ticket(_,_,_,i,_,_) then (Bool)find_upload(i), | |
| 1709 | + link_to_window_with_ticket_and_scroll(_,_,_,i,_,_) then (Bool)find_upload(i), | |
| 1710 | + link_to_window_with_ticket_and_scroll(_,_,_,_,i,_,_) then (Bool)find_upload(i), | |
| 1711 | + link_to_frame(_,_,i) then (Bool)find_upload(i), | |
| 1712 | + }. | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + The next function generates "enctype=multipart/form-data" or "", depending on the presence of | |
| 1716 | + an 'upload' in form-content. | |
| 1717 | + | |
| 1718 | +define String | |
| 1719 | + enctype | |
| 1720 | + ( | |
| 1721 | + Web_item form_content | |
| 1722 | + ) = | |
| 1723 | + if find_upload(form_content) | |
| 1724 | + then "enctype=multipart/form-data" | |
| 1725 | + else "". | |
| 1726 | + | |
| 1727 | +define Printable_tree | |
| 1728 | + set_turning_images_sources | |
| 1729 | + ( | |
| 1730 | + Int32 i, | |
| 1731 | + String name, | |
| 1732 | + List(String) filenames | |
| 1733 | + ) = | |
| 1734 | + if filenames is | |
| 1735 | + { | |
| 1736 | + [ ] then [ ], | |
| 1737 | + [h . t] then | |
| 1738 | + [" i",name,"[",i,"].src=\"",h,"\";" | |
| 1739 | + . set_turning_images_sources(i+1,name,t)] | |
| 1740 | + }. | |
| 1741 | + | |
| 1742 | +public define Printable_tree | |
| 1743 | + format | |
| 1744 | + ( | |
| 1745 | + String c_ticket, | |
| 1746 | + String s_ticket, | |
| 1747 | + Web_item wi | |
| 1748 | + ) = | |
| 1749 | + if wi is | |
| 1750 | + { | |
| 1751 | + [ ] then (Printable_tree)[ ], | |
| 1752 | + | |
| 1753 | + [a . b] then (Printable_tree)[format(c_ticket,s_ticket,a), " ", | |
| 1754 | + format(c_ticket,s_ticket,b)], | |
| 1755 | + | |
| 1756 | + text(String s) then (Printable_tree)[s], | |
| 1757 | + | |
| 1758 | + text_pt(Printable_tree s) then (Printable_tree)s, | |
| 1759 | + | |
| 1760 | + text_nowrap(String s) then (Printable_tree)["<table><tr><td nowrap=\"nowrap>",s,"</td></tr></table>"], | |
| 1761 | + | |
| 1762 | + text_nowrap_pt(Printable_tree s) then | |
| 1763 | + (Printable_tree)["<table><tr><td \"nowrap\">",s,"</td></tr></table>"], | |
| 1764 | + | |
| 1765 | + par(s) then (Printable_tree) | |
| 1766 | + [ "<p align=\"justify\">", s, " </p>"], | |
| 1767 | + | |
| 1768 | + preformated_text(t) then (Printable_tree) ["<pre>",t,"</pre>"], | |
| 1769 | + | |
| 1770 | + integer(n) then (Printable_tree)[n], | |
| 1771 | + | |
| 1772 | + float(f,p) then (Printable_tree)[float_to_string(f,p)], | |
| 1773 | + | |
| 1774 | + center(item) then (Printable_tree)["<center>", format(c_ticket,s_ticket,item),"</center>"], | |
| 1775 | + | |
| 1776 | + bigger(n,item) then (Printable_tree)["<font size=\"+",n,"\">",format(c_ticket,s_ticket,item),"</font>"], | |
| 1777 | + | |
| 1778 | + smaller(n,item) then (Printable_tree)["<font size=\"-",n,"\">",format(c_ticket,s_ticket,item),"</font>"], | |
| 1779 | + | |
| 1780 | + bold(item) then | |
| 1781 | + (Printable_tree)["<font style=\"font-weight: bold\">",format(c_ticket,s_ticket,item),"</font>"], | |
| 1782 | + | |
| 1783 | + italic(item) then | |
| 1784 | + (Printable_tree)["<font style=\"font-style: italic\">",format(c_ticket,s_ticket,item),"</font>"], | |
| 1785 | + | |
| 1786 | + big(item) then (Printable_tree)["<font size=\"+1\">",format(c_ticket,s_ticket,item),"</font>"], | |
| 1787 | + | |
| 1788 | + very_big(item) then (Printable_tree)["<h1>",format(c_ticket,s_ticket,item),"</h1>"], | |
| 1789 | + | |
| 1790 | + style(l,i) then | |
| 1791 | + (Printable_tree)["<span style=\"", format(l), "\">", format(c_ticket,s_ticket,i), "</span>"], | |
| 1792 | + | |
| 1793 | + spacer(w,h) then (Printable_tree) | |
| 1794 | + ["<img src=\"spacer.gif\" width=\"",w,"\" height=\"",h,"\" border=\"0\">"], | |
| 1795 | + | |
| 1796 | + image(String f) then (Printable_tree)["<img src=\"", f,"\" border=\"0\">"], | |
| 1797 | + | |
| 1798 | + image_d(fn,desc) then (Printable_tree)["<img src=\"", fn,"\" alt=\"",desc,"\" border=\"0\">"], | |
| 1799 | + | |
| 1800 | + image_pt(Printable_tree l) then (Printable_tree)["<img src=\"", l,"\" border=\"0\">"], | |
| 1801 | + | |
| 1802 | + on_image(fn,x) then (Printable_tree) | |
| 1803 | + ["<span style=\"background: url(",fn,")\">",format(c_ticket,s_ticket,x),"</span>"], | |
| 1804 | + | |
| 1805 | + turning_images(fns,msec) then if fns is [im0 . imo] then | |
| 1806 | + with name = "trni"+integer_to_string(new_web_count), n = 1+length(imo), (Printable_tree) | |
| 1807 | + ["<script>", | |
| 1808 | + "var i",name,"=new Array(",n,");", | |
| 1809 | + "var n",name,"=0;", | |
| 1810 | + "for(var i=0; i<",n,"; i++) {", | |
| 1811 | + " i",name,"[i]=new Image(); }", | |
| 1812 | + set_turning_images_sources(0,name,(List(String))[im0 . imo]), | |
| 1813 | + | |
| 1814 | + "function a",name,"() {", | |
| 1815 | + "if (i",name,"[(n",name,"+1)%",n,"].complete)", | |
| 1816 | + "{n",name,"=(n",name,"+1)%",n,";", | |
| 1817 | + "document.",name,".src=i",name,"[n",name,"].src; }", | |
| 1818 | + "setTimeout(\"a",name,"()\",",msec,"); }", | |
| 1819 | + | |
| 1820 | + "setTimeout(\"a",name,"()\",",msec,");", | |
| 1821 | + "</script>", | |
| 1822 | + "<img src=\"",im0,"\" name=\"",name,"\" border=\"0\">"], | |
| 1823 | + | |
| 1824 | + rollover(prlim,url,target,ion,ioff,descr) then (Printable_tree) | |
| 1825 | + (images_to_load <- [simple(ion) . *images_to_load]; | |
| 1826 | + with name = "ron_"+integer_to_string(new_web_count), | |
| 1827 | + ["<a target=\"",target,"\" href=\"",url, | |
| 1828 | + (if (c_ticket = "" & s_ticket = "") then "" else (if member('?',url) then "&" else "?")), | |
| 1829 | + (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), | |
| 1830 | + (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 1831 | + "\" onmouseout=\"",name,".src='",ioff, | |
| 1832 | + "';\" onmouseover=\"",name,".src='",ion,"';\"><img src=\"",ioff, | |
| 1833 | + "\" name=\"",name,"\" alt=\"",descr,"\" border=\"0\"></a>"]), | |
| 1834 | + | |
| 1835 | + rollover(prlim,url,target,ion,ioff,w,h,descr) then (Printable_tree) | |
| 1836 | + (images_to_load <- [simple(ion) . *images_to_load]; | |
| 1837 | + with name = "ron_"+integer_to_string(new_web_count), | |
| 1838 | + ["<a target=\"",target,"\" href=\"",url, | |
| 1839 | + (if (c_ticket = "" & s_ticket = "") then "" else (if member('?',url) then "&" else "?")), | |
| 1840 | + (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), | |
| 1841 | + (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 1842 | + "\" onmouseout=\"",name,".src='",ioff, | |
| 1843 | + "';\" onmouseover=\"",name,".src='",ion,"';\"><img src=\"",ioff, | |
| 1844 | + "\" name=\"",name,"\" width=\"",w,"\" height=\"",h,"\" alt=\"",descr,"\" border=\"0\"></a>"]), | |
| 1845 | + | |
| 1846 | + mouse_sensitive_image(fn,lz) then (Printable_tree) | |
| 1847 | + format_mouse_sensitive_image(fn,lz, c_ticket, s_ticket), | |
| 1848 | + | |
| 1849 | + background_sound(sfn,loop) then (Printable_tree) | |
| 1850 | + ["<embed src=\"", sfn, "\" autostart=\"true\" loop=\"", if loop then "true\">" else "false\">"], | |
| 1851 | + | |
| 1852 | + form(n,c) then (Printable_tree) | |
| 1853 | + ["<form ",enctype(c)," method=\"post\" action=\"", n, "\">", | |
| 1854 | + "<input type=\"hidden\" name=\"s_ticket\" value=\"",s_ticket,"\" />", | |
| 1855 | + "<input type=\"hidden\" name=\"c_ticket\" value=\"",c_ticket,"\" />", | |
| 1856 | + format(c_ticket,s_ticket,c),"</form>"], | |
| 1857 | + | |
| 1858 | + form_target(n,c,t) then (Printable_tree) | |
| 1859 | + ["<form ",enctype(c)," method=\"post\" action=\"", n, "\" target=\"", t, "\">", | |
| 1860 | + "<input type=\"hidden\" name=\"s_ticket\" value=\"",s_ticket,"\" />", | |
| 1861 | + "<input type=\"hidden\" name=\"c_ticket\" value=\"",c_ticket,"\" />", | |
| 1862 | + format(c_ticket,s_ticket,c),"</form>"], | |
| 1863 | + | |
| 1864 | + form(n,l,c) then (Printable_tree) | |
| 1865 | + ["<form ",enctype(c)," method=\"post\" action=\"", n,"#", l, "\">", | |
| 1866 | + "<input type=\"hidden\" name=\"s_ticket\" value=\"",s_ticket,"\" />", | |
| 1867 | + "<input type=\"hidden\" name=\"c_ticket\" value=\"",c_ticket,"\" />", | |
| 1868 | + format(c_ticket,s_ticket,c),"</form>"], | |
| 1869 | + | |
| 1870 | + form_name(fn,c) then (Printable_tree) | |
| 1871 | + [ | |
| 1872 | + // "<form ",enctype(c), "\" name=\"", fn, "\">", | |
| 1873 | + "<form name=\"", fn, "\">", | |
| 1874 | + "<input type=\"hidden\" name=\"s_ticket\" value=\"",s_ticket,"\" />", | |
| 1875 | + "<input type=\"hidden\" name=\"c_ticket\" value=\"",c_ticket,"\" />", | |
| 1876 | + format(c_ticket,s_ticket,c),"</form>"], | |
| 1877 | + | |
| 1878 | + text_input(n,s,v) then (Printable_tree) | |
| 1879 | + [" <input type=\"text\" name=\"", n, "\" size=\"", s, "\" value=\"", v,"\" />"], | |
| 1880 | + | |
| 1881 | + password_input(n,s) then (Printable_tree) | |
| 1882 | + [" <input type=\"password\" name=\"", n, "\" size=\"", s,"\" />"], | |
| 1883 | + | |
| 1884 | + text_area(name,c,r,i) then (Printable_tree) | |
| 1885 | + ["<textarea name=\"",name,"\" cols=\"",c,"\" rows=\"",r,"\" wrap=\"physical\">",i,"</textarea>"], | |
| 1886 | + | |
| 1887 | + upload(n,size) then (Printable_tree) | |
| 1888 | + ["<input type=\"file\" size=\"",size,"\" multiple=\"multiple\" name=\"",n,"\" />"], | |
| 1889 | + | |
| 1890 | + submit(String t) then (Printable_tree)["<input type=\"submit\" value=\"",t,"\" />"], | |
| 1891 | + | |
| 1892 | + submit_pt(Printable_tree t) then (Printable_tree)["<input type=\"submit\" value=\"",t,"\" />"], | |
| 1893 | + | |
| 1894 | + submit(n, String t) then (Printable_tree) | |
| 1895 | + ["<input type=\"submit\" name=\"",n,"\" value=\"",t,"\">"], | |
| 1896 | + | |
| 1897 | + submit_close(n, String t) then (Printable_tree) | |
| 1898 | + ["<input type=\"submit\" name=\"",n,"\" value=\"",t,"\" onclick=\"window.top.close();\" />"], | |
| 1899 | + | |
| 1900 | + submit_pt2(n, Printable_tree t) then (Printable_tree) | |
| 1901 | + ["<input type=\"submit\" name=\"",n,"\" value=\"",t,"\" />"], | |
| 1902 | + | |
| 1903 | + image_submit(n,ifn) then (Printable_tree) | |
| 1904 | + ["<input type=\"image\" name=\"",n,"\" src=\"",ifn,"\" border=\"0\" />"], | |
| 1905 | + | |
| 1906 | + image_submit(n,v,ifn,c) then (Printable_tree) | |
| 1907 | + ["<img src=\"",ifn,"\" onmousedown=\"document.forms[0].action='", | |
| 1908 | + n,"=",v,"'; document.forms[0].submit();\" />"], | |
| 1909 | + | |
| 1910 | + hl_image_submit(n,v,in,ifn,hlifn) then (Printable_tree) | |
| 1911 | + ["<img src=\"",ifn,"\"", | |
| 1912 | + //" name=\"",in,"\"", | |
| 1913 | + " onmouseover=\"this.src='",hlifn,"'\"", | |
| 1914 | + " onmouseout=\"this.src='",ifn,"'\"", | |
| 1915 | + " onmousedown=\"document.forms[0].action='", | |
| 1916 | + n,"=",v,"'; document.forms[0].submit();\" />"], | |
| 1917 | + | |
| 1918 | + text_submit(n,v,t) then (Printable_tree) | |
| 1919 | + ["<a href=\"",n, | |
| 1920 | + (if (s_ticket = "" & c_ticket = "" & v = "") then "" else "?"), | |
| 1921 | + (if s_ticket = "" then [ ] else ["s_ticket=",s_ticket,"&"]), | |
| 1922 | + (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), | |
| 1923 | + v,"\">",t,"</a>"], | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + web_submit(wa,i) then (Printable_tree) | |
| 1927 | + ["<a href=\"javascript:document.forms[0].action='", | |
| 1928 | + wa,"'; document.forms[0].submit();\">",format(c_ticket,s_ticket,i),"</a>"], | |
| 1929 | + | |
| 1930 | + button(n, String t, String o, Int32 w, Int32 h) then (Printable_tree) | |
| 1931 | + ["<input type=button name=",n," value=\"",t, | |
| 1932 | + "\"style=\"width=",w, ";height=", h, "\" ", "\" onclick=\"", o, "\";\" />"], | |
| 1933 | + | |
| 1934 | + mark(n, String v) then (Printable_tree) | |
| 1935 | + ["<input type=\"hidden\" name=\"",n,"\" value=\"",v,"\" />"], | |
| 1936 | + | |
| 1937 | + mark_pt(n, Printable_tree v) then (Printable_tree) | |
| 1938 | + ["<input type=\"hidden\" name=\"",n,"\" value=\"",v,"\" />"], | |
| 1939 | + | |
| 1940 | + close_button then (Printable_tree) | |
| 1941 | + ["<form><input type=\"button\" value=\" Fermer \" onclick=\"window.top.close();\"></form>"], | |
| 1942 | + | |
| 1943 | + close_button(ifn) then (Printable_tree) | |
| 1944 | + ["<form><input type=\"image\" name=\"close\" src=\"", ifn, | |
| 1945 | + "\" onclick=\"window.top.close();\" /></form>"], | |
| 1946 | + | |
| 1947 | +/* | |
| 1948 | + close_button(ifn) then (Printable_tree) | |
| 1949 | + ["<form><input type=\"button\" name=\"close\" src=\"", ifn, | |
| 1950 | + "\" onclick=\"window.top.close();\"></form>"], | |
| 1951 | +*/ | |
| 1952 | + label(name) then (Printable_tree)["<a name=\"",name,"\" />"], | |
| 1953 | + | |
| 1954 | + go_to_label(name,content) then (Printable_tree)["<a href=#",name,">", | |
| 1955 | + format(c_ticket,s_ticket,content),"</a>"], | |
| 1956 | + | |
| 1957 | + table(ops,rows) then (Printable_tree)["<table ", | |
| 1958 | + format(ops), ">",format(c_ticket,s_ticket,rows),"</table>"], | |
| 1959 | + | |
| 1960 | + list(l) then (Printable_tree)["<ul>",format_list(c_ticket,s_ticket,l),"</ul>"], | |
| 1961 | + | |
| 1962 | + link(name,i) then (Printable_tree)["<a href=\"",name, | |
| 1963 | + (if (c_ticket = "" & s_ticket = "") then "" else (if member('?',name) then "&" else "?")), | |
| 1964 | + (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), | |
| 1965 | + (if s_ticket = "" then [ ] else [if c_ticket = "" then "" else "&","s_ticket=",s_ticket]), | |
| 1966 | + "\">",format(c_ticket,s_ticket,i),"</a>"], | |
| 1967 | + | |
| 1968 | + link(name,target,i) then (Printable_tree)["<a target=\"",target,"\" href=\"",name, | |
| 1969 | + (if (c_ticket = "" & s_ticket = "") then "" else (if member('?',name) then "&" else "?")), | |
| 1970 | + (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), | |
| 1971 | + (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 1972 | + "\">",format(c_ticket,s_ticket,i),"</a>"], | |
| 1973 | + | |
| 1974 | + link_for_download(fname,i) then (Printable_tree) | |
| 1975 | + ["<a href=\"",fname,"?download\">",format(c_ticket,s_ticket,i),"</a>"], | |
| 1976 | + | |
| 1977 | + mail_to(addr,i) then (Printable_tree)["<a href=\"mailto:",addr,"\">", | |
| 1978 | + format(c_ticket,s_ticket,i),"</a>"], | |
| 1979 | + | |
| 1980 | + select(name,size,choices) then (Printable_tree) | |
| 1981 | + ["<select name=\"",name,"\" size=\"",size,"\">",format_choices(choices),"</select>" ], | |
| 1982 | + | |
| 1983 | + select(name,size,choices,selected) then (Printable_tree) | |
| 1984 | + ["<select name=\"",name,"\" size=\"",size,"\">",format_choices(choices,selected),"</select>" ], | |
| 1985 | + | |
| 1986 | + immediate_select(name,size,choices) then (Printable_tree) | |
| 1987 | + ["<select name=\"",name,"\" size=\"",size,"\" onchange=\"submit();\">", | |
| 1988 | + format_choices(choices),"</select>" ], | |
| 1989 | + | |
| 1990 | + radio_button(n,v) then (Printable_tree) | |
| 1991 | + ["<input type=\"radio\" name=\"", n, "\" value=\"", v, "\" />"], | |
| 1992 | + | |
| 1993 | + checked_radio_button(n,v) then (Printable_tree) | |
| 1994 | + ["<input type=\"radio\" checked=\"checked\" name=\"", n, "\" value=\"", v, "\" />"], | |
| 1995 | + | |
| 1996 | + check_box(n,v) then (Printable_tree) | |
| 1997 | + ["<input type=\"checkbox\" name=\"", n, "\" value=\"", v, "\" />"], | |
| 1998 | + | |
| 1999 | + checked_box(n,v) then (Printable_tree) | |
| 2000 | + ["<input type=\"checkbox\" checked=\"checked\" name=\"", n, "\" value=\"", v, "\" />"], | |
| 2001 | + | |
| 2002 | + link_to_window(n,i) then (Printable_tree) | |
| 2003 | + ["<a href=\"javascript:void window.open('",n,"','default','resizable,scrollbars');\">", | |
| 2004 | + format(c_ticket,s_ticket,i),"</a>"], | |
| 2005 | + | |
| 2006 | + link_to_window(n,wn,i) then (Printable_tree) | |
| 2007 | + ["<a href=\"javascript:void window.open('",n,"','",wn,"','resizable,scrollbars');\" />", | |
| 2008 | + format(c_ticket,s_ticket,i),"</a>"], | |
| 2009 | + | |
| 2010 | + link_to_window_with_ticket(n,args,wn,i,w,h) then (Printable_tree) | |
| 2011 | + ["<a href=\"javascript:void window.open('",n,"?c_ticket=",c_ticket, | |
| 2012 | + (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 2013 | + "&target=",wn, | |
| 2014 | + if args="" then "" else "&", | |
| 2015 | + args,"','", | |
| 2016 | + wn,"','width=",w,",height=",h,"');\">", | |
| 2017 | + format(c_ticket,s_ticket,i),"</a>"], | |
| 2018 | + | |
| 2019 | + link_to_window_with_ticket_and_scroll(n,args,wn,i,w,h) then (Printable_tree) | |
| 2020 | + ["<a href=\"javascript:void window.open('",n,"?c_ticket=",c_ticket, | |
| 2021 | + (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 2022 | + "&target=",wn, | |
| 2023 | + if args="" then "" else "&", | |
| 2024 | + args,"','", | |
| 2025 | + wn,"','width=",w,",height=",h,", resizable,scrollbars');\">", | |
| 2026 | + format(c_ticket,s_ticket,i),"</a>"], | |
| 2027 | + | |
| 2028 | + link_to_window_with_ticket_and_scroll(n,lab,args,wn,i,w,h) then (Printable_tree) | |
| 2029 | + ["<a href=\"javascript:void window.open('",n,"?c_ticket=",c_ticket, | |
| 2030 | + (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 2031 | + "&target=",wn, | |
| 2032 | + if args="" then "" else "&", | |
| 2033 | + args,"&#",lab, "','", | |
| 2034 | + wn,"','width=",w,",height=",h,", resizable,scrollbars');\">", | |
| 2035 | + format(c_ticket,s_ticket,i),"</a>"], | |
| 2036 | + | |
| 2037 | + link_to_frame(n,fn,i) then ["<a href=\"",n, | |
| 2038 | + (if member('?',n) then "&" else "?"), | |
| 2039 | + (if c_ticket = "" then [ ] else ["c_ticket=",c_ticket]), | |
| 2040 | + (if s_ticket = "" then [ ] else ["&s_ticket=",s_ticket]), | |
| 2041 | + "\" target=\"",fn,"\">", | |
| 2042 | + format(c_ticket,s_ticket,i),"</a>"] | |
| 2043 | + | |
| 2044 | + }. | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | +define Printable_tree | |
| 2049 | + add_tickets | |
| 2050 | + ( | |
| 2051 | + String c_ticket, | |
| 2052 | + String s_ticket, | |
| 2053 | + String url | |
| 2054 | + ) = | |
| 2055 | + if member('?',url) | |
| 2056 | + then [url , "&c_ticket=", c_ticket, "&s_ticket=", s_ticket ] | |
| 2057 | + else [url , "?c_ticket=", c_ticket, "&s_ticket=", s_ticket ]. | |
| 2058 | + | |
| 2059 | +define Printable_tree | |
| 2060 | + add_tickets | |
| 2061 | + ( | |
| 2062 | + String c_ticket, | |
| 2063 | + String s_ticket, | |
| 2064 | + Printable_tree url | |
| 2065 | + ) = | |
| 2066 | + if member('?',url) | |
| 2067 | + then [url , "&c_ticket=", c_ticket, "&s_ticket=", s_ticket ] | |
| 2068 | + else [url , "?c_ticket=", c_ticket, "&s_ticket=", s_ticket ]. | |
| 2069 | + | |
| 2070 | + | |
| 2071 | +define Printable_tree | |
| 2072 | + format | |
| 2073 | + ( | |
| 2074 | + List(VFrame) frames, | |
| 2075 | + String c_ticket, | |
| 2076 | + String s_ticket | |
| 2077 | + ) = | |
| 2078 | + if frames is | |
| 2079 | + { | |
| 2080 | + [ ] then [ ], | |
| 2081 | + [h . t] then | |
| 2082 | + if h is frame(height,url,name) then | |
| 2083 | + [ | |
| 2084 | + "<frame src=\"",add_tickets(c_ticket,s_ticket,url), "\" name=\"",name,"\" frameborder=\"no\" />" | |
| 2085 | + . format(t,c_ticket,s_ticket)] | |
| 2086 | + }. | |
| 2087 | + | |
| 2088 | + | |
| 2089 | +define String | |
| 2090 | + frame_size | |
| 2091 | + ( | |
| 2092 | + Int32 s | |
| 2093 | + ) = | |
| 2094 | + if s =< 0 then "*" else integer_to_string(s). | |
| 2095 | + | |
| 2096 | +define String | |
| 2097 | + frame_stack_rows | |
| 2098 | + ( | |
| 2099 | + List(VFrame) frames | |
| 2100 | + ) = | |
| 2101 | + if frames is | |
| 2102 | + { | |
| 2103 | + [ ] then "", | |
| 2104 | + [h . t] then if h is frame (height,url,name) then | |
| 2105 | + frame_size(height)+ | |
| 2106 | + if t is | |
| 2107 | + { | |
| 2108 | + [ ] then "", | |
| 2109 | + [_ . _] then "," | |
| 2110 | + }+frame_stack_rows(t) | |
| 2111 | + }. | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + 'crlf' is defined in 'basis.anubis'. | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | +define Printable_tree | |
| 2120 | + standard_headers | |
| 2121 | + ( | |
| 2122 | + Int32 size | |
| 2123 | + ) = | |
| 2124 | + [ | |
| 2125 | + "HTTP/1.0 200 OK" + crlf + | |
| 2126 | + "Server: Anubis" + crlf + | |
| 2127 | + "Content-Type: text/html" + crlf + | |
| 2128 | + "Content-Length: "+integer_to_string(size)+crlf+ | |
| 2129 | + crlf | |
| 2130 | + ]. | |
| 2131 | + | |
| 2132 | + define Printable_tree | |
| 2133 | + download_headers | |
| 2134 | + = | |
| 2135 | + [ | |
| 2136 | + "HTTP/1.0 200 OK" + crlf + | |
| 2137 | + "Content-Type: application/octet-stream" + crlf + | |
| 2138 | + crlf | |
| 2139 | + ]. | |
| 2140 | + | |
| 2141 | +define Printable_tree | |
| 2142 | + apache_headers | |
| 2143 | + = | |
| 2144 | + [ | |
| 2145 | + "Content-type: text/html" + crlf + | |
| 2146 | + crlf | |
| 2147 | + ]. | |
| 2148 | + | |
| 2149 | + | |
| 2150 | +define String | |
| 2151 | + empty_javascript_source | |
| 2152 | + = | |
| 2153 | + "javascript:'<html><head></head><body></body></html>';". | |
| 2154 | + | |
| 2155 | +public type HeaderSort: | |
| 2156 | + empty, | |
| 2157 | + anubis, | |
| 2158 | + apache. | |
| 2159 | + | |
| 2160 | + | |
| 2161 | +define Printable_tree | |
| 2162 | + format_keywords | |
| 2163 | + ( | |
| 2164 | + List(String) l | |
| 2165 | + ) = | |
| 2166 | + if l is | |
| 2167 | + { | |
| 2168 | + [ ] then [ ], | |
| 2169 | + [h . t] then if t is [ ] | |
| 2170 | + then [h] | |
| 2171 | + else [h , ", " . format_keywords(t)] | |
| 2172 | + }. | |
| 2173 | + | |
| 2174 | +define Printable_tree | |
| 2175 | + format | |
| 2176 | + ( | |
| 2177 | + WebMeta m | |
| 2178 | + ) = | |
| 2179 | + if m is | |
| 2180 | + { | |
| 2181 | + keywords(l) then ["<meta name=\"keywords\" content=\"",format_keywords(l),"\">"], | |
| 2182 | + refresh(url,delay) then ["<meta http-equiv=\"Refresh\" content=\"",delay,"; URL=",url,"\">"], | |
| 2183 | + meta(n,c) then ["<meta name=\"",n,"\" content=\"",c,"\">"], | |
| 2184 | + http_equiv(n,c) then ["<meta http-equiv=\"",n,"\" content=\"",c,"\">"] | |
| 2185 | + }. | |
| 2186 | + | |
| 2187 | +define Printable_tree | |
| 2188 | + format | |
| 2189 | + ( | |
| 2190 | + List(WebMeta) metas | |
| 2191 | + ) = | |
| 2192 | + if metas is | |
| 2193 | + { | |
| 2194 | + [ ] then [ ], | |
| 2195 | + [h . t] then [format(h) . format(t)] | |
| 2196 | + }. | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | +public define Printable_tree | |
| 2204 | + format | |
| 2205 | + ( | |
| 2206 | + HeaderSort hs, | |
| 2207 | + String c_ticket, | |
| 2208 | + String s_ticket, | |
| 2209 | + Web_page p | |
| 2210 | + ) = | |
| 2211 | + if p is | |
| 2212 | + { | |
| 2213 | + web_page(title,metas,head_scripts,body) then | |
| 2214 | + with body = | |
| 2215 | + [ | |
| 2216 | + "<html>", | |
| 2217 | + "<head>", | |
| 2218 | + "<title>", title, "</title>", | |
| 2219 | + format(metas), | |
| 2220 | + head_scripts, | |
| 2221 | + "</head>", | |
| 2222 | + "<body ", | |
| 2223 | + if body is body(options,item) then | |
| 2224 | + with b_options = format(prepare(options)), | |
| 2225 | + [b_options, " onload='body_onloads();", | |
| 2226 | + if *images_to_load is [] then "" else " preload_images();", | |
| 2227 | + "'>", | |
| 2228 | + load_image_script(*images_to_load), | |
| 2229 | + reverse(*scripts), | |
| 2230 | + "<script>", | |
| 2231 | + " function body_onloads() {", | |
| 2232 | + format(*body_onloads), | |
| 2233 | + "}</script>", | |
| 2234 | + format(c_ticket,s_ticket,item) | |
| 2235 | + ], | |
| 2236 | + "</body>", | |
| 2237 | + "</html>" | |
| 2238 | + ], | |
| 2239 | + [ | |
| 2240 | + if hs is | |
| 2241 | + { | |
| 2242 | + empty then [ ], | |
| 2243 | + anubis then standard_headers(length(body)), | |
| 2244 | + apache then apache_headers | |
| 2245 | + } | |
| 2246 | + . body | |
| 2247 | + ], | |
| 2248 | + standard_frameset(title,metas,height,width,main) then | |
| 2249 | + with body = | |
| 2250 | + [ | |
| 2251 | + "<html>", | |
| 2252 | + "<head>", | |
| 2253 | + "<title>", title, "</title>", | |
| 2254 | + format(metas), | |
| 2255 | + "</head>", | |
| 2256 | + "<frameset frameborder=\"no\" border=\"0\" framespacing=\"0\"", | |
| 2257 | + " marginwidth=\"0\" marginheight=\"0\" cols=\"",width,",*\" rows=\"*\">", | |
| 2258 | + " <frame src=\"",empty_javascript_source,"\" name=\"left\" frameborder=\"no\"", | |
| 2259 | + " marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\">", | |
| 2260 | + " <frameset frameborder=\"no\" border=\"0\" framespacing=\"0\" rows=\"",height,",*\" cols=\"*\">", | |
| 2261 | + " <frame src=\"",empty_javascript_source,"\" name=\"top\"", | |
| 2262 | + " marginwidth=\"0\" marginheight=\"0\" frameborder=\"no\" scrolling=\"no\">", | |
| 2263 | + " <frame src =\"", add_tickets(c_ticket,s_ticket,main), | |
| 2264 | + "\" name=\"main\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"no\">", | |
| 2265 | + " </frameset>", | |
| 2266 | + "</frameset>", | |
| 2267 | + "</html>" | |
| 2268 | + ], | |
| 2269 | + [ | |
| 2270 | + if hs is | |
| 2271 | + { | |
| 2272 | + empty then [ ], | |
| 2273 | + anubis then standard_headers(length(body)), | |
| 2274 | + apache then apache_headers | |
| 2275 | + } | |
| 2276 | + . body | |
| 2277 | + ] | |
| 2278 | + }. | |
| 2279 | + | |
| 2280 | + | |
| 2281 | +public define Bool | |
| 2282 | ||
| 2283 | + ( | |
| 2284 | + String c_ticket, | |
| 2285 | + String s_ticket, | |
| 2286 | + Web_page p | |
| 2287 | + ) = | |
| 2288 | + print(format(anubis,c_ticket,s_ticket,p)). | |
| 2289 | + | |
| 2290 | +public define Bool | |
| 2291 | + print_with_headers | |
| 2292 | + ( | |
| 2293 | + HeaderSort hs, | |
| 2294 | + String c_ticket, | |
| 2295 | + String s_ticket, | |
| 2296 | + Web_page p | |
| 2297 | + ) = | |
| 2298 | + print(format(hs,c_ticket,s_ticket,p)). | |
| 2299 | + | |
| 2300 | +public define Bool | |
| 2301 | ||
| 2302 | + ( | |
| 2303 | + Web_page p | |
| 2304 | + ) = | |
| 2305 | + print(format(anubis,"","",p)). | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | +public define Bool | |
| 2311 | + print_with_headers | |
| 2312 | + ( | |
| 2313 | + HeaderSort hs, | |
| 2314 | + Web_page p | |
| 2315 | + ) = | |
| 2316 | + print(format(hs,"","",p)). | |
| 2317 | + | |
| 2318 | + | |
| 2319 | +public define Cell | |
| 2320 | + h_spacer | |
| 2321 | + ( | |
| 2322 | + Int32 n | |
| 2323 | + ) = | |
| 2324 | + cell([absolute_width(n)],literal(" ")). | |
| 2325 | + | |
| 2326 | +public define Cell | |
| 2327 | + v_spacer | |
| 2328 | + ( | |
| 2329 | + Int32 n | |
| 2330 | + ) = | |
| 2331 | + cell([absolute_height(n)],literal(" ")). | |
| 2332 | + | |
| 2333 | +public define Cell | |
| 2334 | + empty = cell([],literal(" ")). | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + *** Below is a simple gadget for counting visitors. It increments a counter (in a file) | |
| 2339 | + at each call. The argument is the name of the file (relative to the directory of the | |
| 2340 | + server), and the file is created automatically. It returns the number of the visitor. | |
| 2341 | + | |
| 2342 | +public define Int32 | |
| 2343 | + get_visitor_number | |
| 2344 | + ( | |
| 2345 | + String counter_file_name, | |
| 2346 | + ) = | |
| 2347 | + protect | |
| 2348 | + if (RetrieveResult(Int32))retrieve(counter_file_name) is | |
| 2349 | + { | |
| 2350 | + cannot_find_file then | |
| 2351 | + // | |
| 2352 | + // It's time to create the file. | |
| 2353 | + // | |
| 2354 | + if save((Int32)1,counter_file_name) is | |
| 2355 | + { | |
| 2356 | + cannot_open_file then 0, | |
| 2357 | + write_error then 0, | |
| 2358 | + ok then 1 | |
| 2359 | + }, | |
| 2360 | + read_error then 0, | |
| 2361 | + type_error then 0, | |
| 2362 | + ok(n) then | |
| 2363 | + // | |
| 2364 | + // Increment the counter | |
| 2365 | + // | |
| 2366 | + if save(n+1,counter_file_name) is | |
| 2367 | + { | |
| 2368 | + cannot_open_file then n, | |
| 2369 | + write_error then n, | |
| 2370 | + ok then n+1 | |
| 2371 | + } | |
| 2372 | + }. | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | ... | ... |
calexium_lib/web/CXM_making_a_web_site.anubis
| ... | ... | @@ -1825,9 +1825,9 @@ define String |
| 1825 | 1825 | { |
| 1826 | 1826 | absolute(w) then ["width=\"",w-25], |
| 1827 | 1827 | percentage(w) then ["width=\"95%\""] |
| 1828 | - },"\"><tr><td align=right>", | |
| 1828 | + },"\"><tbody><tr><td align=right>", | |
| 1829 | 1829 | format_element(content), |
| 1830 | - "</td></tr></table></body></html>" | |
| 1830 | + "</td></tr></tbody></table></body></html>" | |
| 1831 | 1831 | ], |
| 1832 | 1832 | file_name = "sd"+hash+".html", |
| 1833 | 1833 | file_path = private_download_directory+"/"+file_name, |
| ... | ... | @@ -2105,7 +2105,7 @@ define Printable_tree |
| 2105 | 2105 | ) = |
| 2106 | 2106 | [ doctype_w3c_header, |
| 2107 | 2107 | "<html><head>", |
| 2108 | - "<meta http-equiv=\"Refresh\" content=\"0; URL=javascript:void window.open('/?t=','_top')\">", | |
| 2108 | + "<meta http-equiv=\"Refresh\" content=\"0; URL=javascript:void window.open('/?t=','_top')\" />", | |
| 2109 | 2109 | "</head><body></body></html>" |
| 2110 | 2110 | ]. |
| 2111 | 2111 | |
| ... | ... | @@ -2831,7 +2831,7 @@ define List(Text_Option) |
| 2831 | 2831 | /** |
| 2832 | 2832 | * Extract the CSS class list from the list of Text_Option |
| 2833 | 2833 | */ |
| 2834 | -define List(Text_Option) | |
| 2834 | +define List(CoreAttrs) | |
| 2835 | 2835 | get_css_class |
| 2836 | 2836 | ( |
| 2837 | 2837 | List(Text_Option) l |
| ... | ... | @@ -2843,34 +2843,14 @@ define List(Text_Option) |
| 2843 | 2843 | [h . t ] then |
| 2844 | 2844 | |
| 2845 | 2845 | |
| 2846 | - if h is class(_) then | |
| 2847 | - [ h . get_css_class(t) ] | |
| 2848 | - else if h is id(_) then | |
| 2849 | - [ h . get_css_class(t) ] | |
| 2846 | + if h is class(name) then | |
| 2847 | + [ class(name) . get_css_class(t) ] | |
| 2848 | + else if h is id(name) then | |
| 2849 | + [ id(name) . get_css_class(t) ] | |
| 2850 | 2850 | else |
| 2851 | 2851 | get_css_class(t) |
| 2852 | 2852 | } |
| 2853 | 2853 | . |
| 2854 | - | |
| 2855 | -define String | |
| 2856 | - format_text_options | |
| 2857 | - ( | |
| 2858 | - List(Text_Option) l | |
| 2859 | - ) | |
| 2860 | - = | |
| 2861 | - with text_options = get_text_options(l), | |
| 2862 | - css_classes = get_css_class(l), | |
| 2863 | - if text_options is | |
| 2864 | - { | |
| 2865 | - [] then "", | |
| 2866 | - [_._] then " style=\"" + format(text_options) + "\" " | |
| 2867 | - } | |
| 2868 | - + | |
| 2869 | - if css_classes is | |
| 2870 | - { | |
| 2871 | - [] then "", | |
| 2872 | - [_._] then format(css_classes) | |
| 2873 | - }. | |
| 2874 | 2854 | |
| 2875 | 2855 | define Printable_tree |
| 2876 | 2856 | format |
| ... | ... | @@ -2973,6 +2953,26 @@ define String |
| 2973 | 2953 | current + format_attrs(t) |
| 2974 | 2954 | }. |
| 2975 | 2955 | |
| 2956 | +define String | |
| 2957 | + format_text_options | |
| 2958 | + ( | |
| 2959 | + List(Text_Option) l | |
| 2960 | + ) | |
| 2961 | + = | |
| 2962 | + with text_options = get_text_options(l), | |
| 2963 | + css_classes = get_css_class(l), | |
| 2964 | + if text_options is | |
| 2965 | + { | |
| 2966 | + [] then "", | |
| 2967 | + [_._] then " style=\"" + format(text_options) + "\" " | |
| 2968 | + } | |
| 2969 | + + | |
| 2970 | + if css_classes is | |
| 2971 | + { | |
| 2972 | + [] then "", | |
| 2973 | + [_._] then format_attrs(css_classes) | |
| 2974 | + }. | |
| 2975 | + | |
| 2976 | 2976 | //define String |
| 2977 | 2977 | // _format |
| 2978 | 2978 | // ( |
| ... | ... | @@ -3089,7 +3089,7 @@ define Printable_tree |
| 3089 | 3089 | text, "</a>" |
| 3090 | 3090 | ], |
| 3091 | 3091 | javascript(s,h) then |
| 3092 | - [s,"<INPUT TYPE =\"button\" Value=\"",text,"\"", format_attrs(options), " onClick=\"",h,"\">"] | |
| 3092 | + [s,"<input type=\"button\" value=\"",text,"\"", format_attrs(options), " onclick=\"",h,"\" />"] | |
| 3093 | 3093 | } |
| 3094 | 3094 | ], |
| 3095 | 3095 | submit(options, text) then |
| ... | ... | @@ -3100,7 +3100,7 @@ define Printable_tree |
| 3100 | 3100 | text, "</a>" |
| 3101 | 3101 | ], |
| 3102 | 3102 | javascript(s,h) then |
| 3103 | - [s,"<INPUT TYPE =\"submit\" Value=\"",text,"\"", format_attrs(options), " onClick=\"",h,"\">"] | |
| 3103 | + [s,"<input type=\"submit\" value=\"",text,"\"", format_attrs(options), " onclick=\"",h,"\" />"] | |
| 3104 | 3104 | } |
| 3105 | 3105 | ], |
| 3106 | 3106 | |
| ... | ... | @@ -3108,12 +3108,12 @@ define Printable_tree |
| 3108 | 3108 | [ if action is |
| 3109 | 3109 | { |
| 3110 | 3110 | url(u) then ["<a href=\"",u], |
| 3111 | - javascript(s,h) then [s,"<a onMouseDown=\"",h] | |
| 3111 | + javascript(s,h) then [s,"<a onmousedown=\"",h] | |
| 3112 | 3112 | }, |
| 3113 | 3113 | "\" style=\"text-decoration:none\">", |
| 3114 | - "<img alt=\"",url_off,"\" src=\"",url_off,"\" border=0", | |
| 3115 | - " onMouseOver=\"this.src='",url_on,"'\" ", | |
| 3116 | - " onMouseOut=\"this.src='",url_off,"'\">", | |
| 3114 | + "<img alt=\"",url_off,"\" src=\"",url_off,"\" border=\"0\"", | |
| 3115 | + " onmouseover=\"this.src='",url_on,"'\" ", | |
| 3116 | + " onmouseout=\"this.src='",url_off,"'\">", | |
| 3117 | 3117 | "</a>" |
| 3118 | 3118 | ], |
| 3119 | 3119 | |
| ... | ... | @@ -3121,12 +3121,12 @@ define Printable_tree |
| 3121 | 3121 | [ if action is |
| 3122 | 3122 | { |
| 3123 | 3123 | url(u) then ["<a href=\"",u], |
| 3124 | - javascript(s,h) then [s,"<a onMouseDown=\"",h] | |
| 3124 | + javascript(s,h) then [s,"<a onmousedown=\"",h] | |
| 3125 | 3125 | }, |
| 3126 | 3126 | "\" style=\"text-decoration:none\">", |
| 3127 | - "<img width=",w," height=",h," alt=\"",url_off,"\" src=\"",url_off,"\" border=0", | |
| 3128 | - " onMouseOver=\"this.src='",url_on,"'\" ", | |
| 3129 | - " onMouseOut=\"this.src='",url_off,"'\">", | |
| 3127 | + "<img width=\"",w,"\" height=\"",h,"\" alt=\"",url_off,"\" src=\"",url_off,"\" border=\"0\"", | |
| 3128 | + " onmouseover=\"this.src='",url_on,"'\" ", | |
| 3129 | + " onmouseout=\"this.src='",url_off,"'\">", | |
| 3130 | 3130 | "</a>" |
| 3131 | 3131 | ], |
| 3132 | 3132 | |
| ... | ... | @@ -3136,7 +3136,7 @@ define Printable_tree |
| 3136 | 3136 | url(u) then ["<select href=\"",u] |
| 3137 | 3137 | javascript(s,h) then [s,"<select onchange=\"",h] |
| 3138 | 3138 | }, |
| 3139 | - "\" name=o",name," size=",size,">", | |
| 3139 | + "\" name=\"o",name,"\" size=\"",size,"\">", | |
| 3140 | 3140 | format_choices(choices),"</select>" |
| 3141 | 3141 | ], |
| 3142 | 3142 | immediate_selector(name,size,choices,selected) then |
| ... | ... | @@ -3145,7 +3145,7 @@ define Printable_tree |
| 3145 | 3145 | url(u) then ["<select href=\"",u] |
| 3146 | 3146 | javascript(s,h) then [s,"<select onchange=\"",h] |
| 3147 | 3147 | }, |
| 3148 | - "\" name=o",name," size=",size,">", | |
| 3148 | + "\" name=\"o",name,"\" size=\"",size,"\">", | |
| 3149 | 3149 | format_choices(choices, selected),"</select>" |
| 3150 | 3150 | ], |
| 3151 | 3151 | }. |
| ... | ... | @@ -3285,20 +3285,20 @@ define String |
| 3285 | 3285 | if h is |
| 3286 | 3286 | { |
| 3287 | 3287 | core_attrs(core_attr_list) then format_attrs(core_attr_list), |
| 3288 | - left then " align=left", | |
| 3289 | - h_center then " align=center", | |
| 3290 | - right then " align=right", | |
| 3291 | - top then " valign=top", | |
| 3292 | - v_center then " valign=middle", | |
| 3293 | - bottom then " valign=bottom", | |
| 3294 | - base_line then " valign=baseline", | |
| 3288 | + left then " align=\"left\"", | |
| 3289 | + h_center then " align=\"center\"", | |
| 3290 | + right then " align=\"right\"", | |
| 3291 | + top then " valign=\"top\"", | |
| 3292 | + v_center then " valign=\"middle\"", | |
| 3293 | + bottom then " valign=\"bottom\"", | |
| 3294 | + base_line then " valign=\"baseline\"", | |
| 3295 | 3295 | background_color(c) then " bgcolor=\""+html_format(c)+"\"", |
| 3296 | 3296 | background_image(n,o) then " style=\"background: url("+n+")"+format(o)+"\"", |
| 3297 | 3297 | width(w) then " width=\""+w+"\"", |
| 3298 | 3298 | percentage_width(n) then " width=\""+percent(n)+"%\"", |
| 3299 | - height(h) then " height="+h, | |
| 3300 | - columns(n) then " colspan="+n, | |
| 3301 | - rows(n) then " rowspan="+n, | |
| 3299 | + height(h) then " height=\""+h+"\"", | |
| 3300 | + columns(n) then " colspan=\""+n+"\"", | |
| 3301 | + rows(n) then " rowspan=\""+n+"\"", | |
| 3302 | 3302 | nowrap then " nowrap" |
| 3303 | 3303 | } |
| 3304 | 3304 | + format(t) |
| ... | ... | @@ -3473,12 +3473,12 @@ define String |
| 3473 | 3473 | ) = |
| 3474 | 3474 | if l is |
| 3475 | 3475 | { |
| 3476 | - [ ] then if border_seen then "" else " border=0 cellspacing=0 cellpadding=0", | |
| 3476 | + [ ] then if border_seen then "" else " border=\"0\" cellspacing=\"0\" cellpadding=\"0\"", | |
| 3477 | 3477 | [h . t] then if h is |
| 3478 | 3478 | { |
| 3479 | 3479 | background_color(c) then " bgcolor=\""+html_format(c)+"\""+format(t,border_seen), |
| 3480 | 3480 | background_image(url) then " background="+url+format(t,border_seen), |
| 3481 | - border(o,top,i,c) then " border="+o+" cellspacing="+top+" cellpadding="+i+ | |
| 3481 | + border(o,top,i,c) then " border=\""+o+"\" cellspacing=\""+top+"\" cellpadding=\""+i+"\""+ | |
| 3482 | 3482 | //" bordercolor="+format(c)+ |
| 3483 | 3483 | format(t,true), |
| 3484 | 3484 | width(w) then " width=\""+w+"\""+format(t,border_seen), |
| ... | ... | @@ -3520,6 +3520,7 @@ define Printable_tree |
| 3520 | 3520 | " }\n", |
| 3521 | 3521 | "</script>", |
| 3522 | 3522 | "<table>", |
| 3523 | + "<tbody>", | |
| 3523 | 3524 | "<tr>", |
| 3524 | 3525 | "<td align=left valign=top", |
| 3525 | 3526 | " width=",width, |
| ... | ... | @@ -3534,10 +3535,12 @@ define Printable_tree |
| 3534 | 3535 | "</td>", |
| 3535 | 3536 | "<td valign=bottom>", |
| 3536 | 3537 | "<table>", |
| 3537 | - "<tr><td><img alt=\"sroll up\" src=\"scrollup.gif\" onMouseDown=\"doscroll_", | |
| 3538 | + "<tbody>", | |
| 3539 | + "<tr><td><img alt=\"sroll up\" src=\"scrollup.gif\" onmousedown=\"doscroll_", | |
| 3538 | 3540 | idnum,"(0,20);\"></td></tr>", |
| 3539 | - "<tr><td><img alt=\"scroll down\" src=\"scrolldown.gif\" onMouseDown=\"doscroll_", | |
| 3541 | + "<tr><td><img alt=\"scroll down\" src=\"scrolldown.gif\" onmousedown=\"doscroll_", | |
| 3540 | 3542 | idnum,"(0,-20);\"></td></tr>", |
| 3543 | + "</tbody>", | |
| 3541 | 3544 | "</table>", |
| 3542 | 3545 | "</td>", |
| 3543 | 3546 | "</tr>", |
| ... | ... | @@ -3546,16 +3549,19 @@ define Printable_tree |
| 3546 | 3549 | "<tr>", |
| 3547 | 3550 | "<td align=right>", |
| 3548 | 3551 | "<table>", |
| 3552 | + "<tbody>", | |
| 3549 | 3553 | "<tr>", |
| 3550 | - "<td><img alt=\"scroll left\" src=\"scrollleft.gif\" onMouseDown=\"doscroll_", | |
| 3554 | + "<td><img alt=\"scroll left\" src=\"scrollleft.gif\" onmousedown=\"doscroll_", | |
| 3551 | 3555 | idnum,"(20,0);\"></td>", |
| 3552 | - "<td><img alt=\"scroll right\" src=\"scrollright.gif\" onMouseDown=\"doscroll_", | |
| 3556 | + "<td><img alt=\"scroll right\" src=\"scrollright.gif\" onmousedown=\"doscroll_", | |
| 3553 | 3557 | idnum,"(-20,0);\"></td>", |
| 3554 | 3558 | "</tr>", |
| 3559 | + "</tbody>", | |
| 3555 | 3560 | "</table>", |
| 3556 | 3561 | "</td>", |
| 3557 | 3562 | "</tr>", |
| 3558 | 3563 | ] else [ ]), |
| 3564 | + "</tbody>", | |
| 3559 | 3565 | "</table>" |
| 3560 | 3566 | ]. |
| 3561 | 3567 | |
| ... | ... | @@ -3643,11 +3649,11 @@ define Printable_tree |
| 3643 | 3649 | any_image(url) then |
| 3644 | 3650 | ["<img alt=\"",url,"\" src=\"",url,"\">"], |
| 3645 | 3651 | any_image(url,w,h) then |
| 3646 | - ["<img alt=\"",url,"\" src=\"",url,"\" width=",w," height=",h,">"], | |
| 3652 | + ["<img alt=\"",url,"\" src=\"",url,"\" width=",w," height=",h," />"], | |
| 3647 | 3653 | any_table(opts,h_row, rows) then |
| 3648 | 3654 | ["<table ",format(reverse(opts),false),">", |
| 3649 | 3655 | format(h_row,format_element), |
| 3650 | - format(rows,format_element),"</table>\n"], | |
| 3656 | + "<tbody>",format(rows,format_element),"</tbody></table>\n"], | |
| 3651 | 3657 | any_center(e) then |
| 3652 | 3658 | ["<center>",format_element(e),"</center>"], |
| 3653 | 3659 | any_mail_to(email,elem) then |
| ... | ... | @@ -3656,13 +3662,13 @@ define Printable_tree |
| 3656 | 3662 | format_scroller(sn,w,h,cw,ch,new_idnum(ic_v),c,format_element), |
| 3657 | 3663 | any_fixed_size(w,h,c) then |
| 3658 | 3664 | with url = create_secondary_document(site_directory,secret,sn,format_element,c,w), |
| 3659 | - ["<object data=\"",url,"\" type=\"text/html\" width=",format(w)," height=",format(h)," >", | |
| 3665 | + ["<object data=\"",url,"\" type=\"text/html\" width=\"",format(w),"\" height=\"",format(h),"\" >", | |
| 3660 | 3666 | "secondary document", |
| 3661 | 3667 | "</object>"], |
| 3662 | 3668 | any_fixed_size_2(w,h,fn) then |
| 3663 | 3669 | with url = fn+"?zauth="+make_authorization(site_directory,secret, |
| 3664 | 3670 | fn), |
| 3665 | - ["<object data=\"",url,"\" type=\"text/html\" width=",format(w)," height=",format(h)," >", | |
| 3671 | + ["<object data=\"",url,"\" type=\"text/html\" width=\"",format(w),"\" height=\"",format(h),"\" >", | |
| 3666 | 3672 | "secondary document", |
| 3667 | 3673 | "</object>"], |
| 3668 | 3674 | any_actioner(c,t,a,an,eo,ja,fn) then |
| ... | ... | @@ -3735,49 +3741,49 @@ define Printable_tree |
| 3735 | 3741 | format(cinfo,sn,ic_v,any_private_download(url,name,extra,action),format_element,is_https), |
| 3736 | 3742 | text_input(options, label_text, id, name, i, w) then |
| 3737 | 3743 | [ "<label for=\"",id,"\">",label_text,"</label>", |
| 3738 | - "<input type=text name=o",name," id=",id," size=",w," value=\"",i,"\"",format_attrs(options),">"], | |
| 3744 | + "<input type=\"text\" name=\"o",name,"\" id=\"",id,"\" size=\"",w,"\" value=\"",i,"\"",format_attrs(options)," />"], | |
| 3739 | 3745 | text_input_ro(options, label_text, id, name,i,w) then |
| 3740 | 3746 | [ "<label for=\"",id,"\">",label_text,"</label>", |
| 3741 | - "<input readonly=\"readonly\" type=text name=o",name," id=",id," size=",w," value=\"",i,"\"",format_attrs(options),">"], | |
| 3747 | + "<input readonly=\"readonly\" type=\"text\" name=\"o",name,"\" id=\"",id,"\" size=\"",w,"\" value=\"",i,"\"",format_attrs(options)," />"], | |
| 3742 | 3748 | password_input(options, label_text, id, name,i,w) then |
| 3743 | 3749 | [ "<label for=\"",id,"\">",label_text,"</label>", |
| 3744 | - "<input type=password name=p",name," id=",id," size=",w," value=\"",i,"\"",format_attrs(options),">"], | |
| 3750 | + "<input type=\"password\" name=\"p",name,"\" id=\"",id,"\" size=\"",w,"\" value=\"",i,"\"",format_attrs(options)," />"], | |
| 3745 | 3751 | text_area(opts,n,i,w,h) then |
| 3746 | - ["<textarea ",format(opts)," name=o",n," cols=",w," rows=",h,">",i,"</textarea>"], | |
| 3752 | + ["<textarea ",format(opts)," name=\"o",n,"\" cols=\"",w,"\" rows=\"",h,"\">",i,"</textarea>"], | |
| 3747 | 3753 | file_upload(label, id, n, w) then |
| 3748 | 3754 | ["<label for=\"",id,"\">",label,"</label>", |
| 3749 | - "<input type=file id=",id," size=",w," name=o",n,">"], | |
| 3755 | + "<input type=\"file\" id=\"",id,"\" size=\"",w,"\" name=\"o",n,"\" />"], | |
| 3750 | 3756 | selector(opts, label, id, n,s,cs) then |
| 3751 | 3757 | ["<label for=\"",id,"\">",label,"</label>", |
| 3752 | - "<select name=o",n," size=",s,format_attrs(opts),">",format_choices(cs),"</select>"], | |
| 3758 | + "<select name=\"o",n,"\" size=\"",s,"\" ",format_attrs(opts),">",format_choices(cs),"</select>"], | |
| 3753 | 3759 | selector(opts, label, id, n,s,cs,sd) then |
| 3754 | 3760 | ["<label for=\"",id,"\">",label,"</label>", |
| 3755 | - "<select name=o",n," size=",s,format_attrs(opts),">",format_choices(cs,sd),"</select>"], | |
| 3761 | + "<select name=\"o",n,"\" size=\"",s,"\" ",format_attrs(opts),">",format_choices(cs,sd),"</select>"], | |
| 3756 | 3762 | selector_c(opts, label, id, n,s,cs) then |
| 3757 | 3763 | ["<label for=\"",id,"\">",label,"</label>", |
| 3758 | - "<select name=o",n," size=",s,format_attrs(opts),">",format_choices(cs),"</select>"], | |
| 3764 | + "<select name=\"o",n,"\" size=\"",s,"\" ",format_attrs(opts),">",format_choices(cs),"</select>"], | |
| 3759 | 3765 | selector_c(opts, label, id, n,s,cs,sd) then |
| 3760 | 3766 | ["<label for=\"",id,"\">",label,"</label>", |
| 3761 | - "<select name=o",n," size=",s,format_attrs(opts),">",format_choices(cs,sd),"</select>"], | |
| 3767 | + "<select name=\"o",n,"\" size=\"",s,"\" ",format_attrs(opts),">",format_choices(cs,sd),"</select>"], | |
| 3762 | 3768 | |
| 3763 | 3769 | radio_button(options, label_text, id, n, v, c) then |
| 3764 | 3770 | [ "<label for=\"",id,"\">",label_text,"</label>", |
| 3765 | - "<input type=radio name=\"o",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\"" else ""),format_attrs(options),">"], | |
| 3771 | + "<input type=\"radio\" name=\"o",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\"" else ""),format_attrs(options)," />"], | |
| 3766 | 3772 | radio_button_r(options, label_text, id, n, v, c) then |
| 3767 | - [ "<input type=radio name=\"o",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\"" else ""),format_attrs(options),">", | |
| 3773 | + [ "<input type=\"radio\" name=\"o",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\"" else ""),format_attrs(options)," />", | |
| 3768 | 3774 | "<label for=\"",id,"\">",label_text,"</label>"], |
| 3769 | 3775 | check_box(options, label_text, id, n, v, c) then |
| 3770 | 3776 | [ if length(label_text) > 0 then ["<label for=\"",id,"\">",label_text,"</label>"] else [""], |
| 3771 | - "<input type=checkbox name=o",n," id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\" " else ""),format_attrs(options),">"] | |
| 3777 | + "<input type=\"checkbox\" name=\"o",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\" " else ""),format_attrs(options)," />"] | |
| 3772 | 3778 | check_box_r(options, label_text, id, n, v, c) then |
| 3773 | - [ "<input type=checkbox name=o",n," id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\" " else ""),format_attrs(options),">", | |
| 3779 | + [ "<input type=\"checkbox\" name=\"o",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\" " else ""),format_attrs(options)," />", | |
| 3774 | 3780 | if length(label_text) > 0 then ["<label for=\"",id,"\">",label_text,"</label>"] else [""] ] |
| 3775 | 3781 | div(options, e) then |
| 3776 | 3782 | format(cinfo,sn,ic_v,any_div(options, e),format_element,is_https), |
| 3777 | 3783 | div_empty(options) then |
| 3778 | 3784 | format(cinfo,sn,ic_v,any_div_empty(options),format_element,is_https), |
| 3779 | 3785 | hidden(name, value) then |
| 3780 | - ["<input type=hidden name=o",name," value=\"",value,"\">"], | |
| 3786 | + ["<input type=\"hidden\" name=\"o",name,"\" value=\"",value,"\" />"], | |
| 3781 | 3787 | |
| 3782 | 3788 | }. |
| 3783 | 3789 | |
| ... | ... | @@ -3911,7 +3917,7 @@ define Printable_tree |
| 3911 | 3917 | [ |
| 3912 | 3918 | "<form name=\"f",fn,"\"", |
| 3913 | 3919 | format(cinfo,sn,ic_v,any_coreattrs(attributs),format_element,is_https), |
| 3914 | - " method=POST", | |
| 3920 | + " method=\"post\"", | |
| 3915 | 3921 | enctype(c), |
| 3916 | 3922 | " action=\"http", |
| 3917 | 3923 | if is_https then "s" else "", |
| ... | ... | @@ -3957,16 +3963,16 @@ define Printable_tree |
| 3957 | 3963 | ) = |
| 3958 | 3964 | if m is |
| 3959 | 3965 | { |
| 3960 | - keywords(l) then ["<meta name=\"keywords\" content=\"",format_keywords(l),"\">\n"], | |
| 3966 | + keywords(l) then ["<meta name=\"keywords\" content=\"",format_keywords(l),"\" />\n"], | |
| 3961 | 3967 | refresh(co,ta,an,delay) then |
| 3962 | 3968 | ["<meta http-equiv=\"Refresh\" content=\"",delay,"; URL=", |
| 3963 | - make_actioner_url(cinfo,co,ta,state_name,an,[],is_https),"\">\n"], | |
| 3964 | - meta(n,c) then ["<meta name=\"",n,"\" content=\"",c,"\">\n"], | |
| 3965 | - http_equiv(n,c) then ["<meta http-equiv=\"",n,"\" content=\"",c,"\">\n"], | |
| 3969 | + make_actioner_url(cinfo,co,ta,state_name,an,[],is_https),"\" />\n"], | |
| 3970 | + meta(n,c) then ["<meta name=\"",n,"\" content=\"",c,"\" />\n"], | |
| 3971 | + http_equiv(n,c) then ["<meta http-equiv=\"",n,"\" content=\"",c,"\" />\n"], | |
| 3966 | 3972 | generic_meta(l) then ["<meta ", |
| 3967 | 3973 | flat(map(((String,String) p) |-> if p is (n,v) then [n,"=\"",v,"\" "], |
| 3968 | 3974 | l)), |
| 3969 | - ">\n"], | |
| 3975 | + " />\n"], | |
| 3970 | 3976 | literal(s) then [s] |
| 3971 | 3977 | }. |
| 3972 | 3978 | |
| ... | ... | @@ -4024,7 +4030,7 @@ define Printable_tree |
| 4024 | 4030 | { |
| 4025 | 4031 | [ ] then [ ], |
| 4026 | 4032 | [h . t] then |
| 4027 | - [ ["<link rel=\"stylesheet\" type=\"text/css\" href=\"" + file_name(h) + "\">\n" ] | |
| 4033 | + [ ["<link rel=\"stylesheet\" type=\"text/css\" href=\"" + file_name(h) + "\" />\n" ] | |
| 4028 | 4034 | . add_css_files(t)] |
| 4029 | 4035 | }. |
| 4030 | 4036 | |
| ... | ... | @@ -4077,7 +4083,7 @@ define Printable_tree |
| 4077 | 4083 | add_css_styles(css_styles), |
| 4078 | 4084 | add_css_files(css_files), |
| 4079 | 4085 | add_js_files(js_files), |
| 4080 | - "<link rel=\"shortcut icon\" href=\"favicon.ico\">\n", | |
| 4086 | + "<link rel=\"shortcut icon\" href=\"favicon.ico\" />\n", | |
| 4081 | 4087 | "<script type = \"text/javascript\" language=\"JavaScript\">", |
| 4082 | 4088 | " function show_local_popup(divname,stvname) {", |
| 4083 | 4089 | " if (document.layers) { var d = eval(document.divname); } else\n", | ... | ... |
calexium_lib/web/CXM_multihost_http_server.anubis
| ... | ... | @@ -1454,7 +1454,7 @@ define List(Web_arg) |
| 1454 | 1454 | *** [4.7] Reading the request line. |
| 1455 | 1455 | |
| 1456 | 1456 | 'read_request_line' reads three words and a new line from the connection. It tries to |
| 1457 | - recognize "GET" or "POST" in the first word, separates the URI from the query string in | |
| 1457 | + recognize "get" or "post" in the first word, separates the URI from the query string in | |
| 1458 | 1458 | the second word, transforms the query string into a list of 'Web_arg', and finally |
| 1459 | 1459 | returns a datum of type 'HTTP_RequestLine' if no error arose. |
| 1460 | 1460 | ... | ... |