Commit 3fc48444afb42b06d0563307a075222274e85720

Authored by David RENE
1 parent 19dca671

Now able to add list of javascript file in html page

Showing 1 changed file with 20 additions and 9 deletions   Show diff stats
calexium_lib/web/CXM_making_a_web_site.anubis
... ... @@ -1007,6 +1007,10 @@ public type JS_File:
1007 1007 js_file(String file_name,
1008 1008 List(JS_Attribute) attributes).
1009 1009  
  1010 +public type Script:
  1011 + script( String script_type,
  1012 + String content).
  1013 +
1010 1014 public define JS_File
1011 1015 js_file
1012 1016 (
... ... @@ -1497,6 +1501,7 @@ public type HTTP_Answer:
1497 1501 List(CSS_Style) /*styles*/,
1498 1502 List(CSS_File) /*css_files*/,
1499 1503 List(JS_File) /*js_files*/,
  1504 + List(Script) /*script*/,
1500 1505 HTML_Body /*body*/),
1501 1506 plain_text (HTTP_Status /*http_status*/,
1502 1507 String /*text*/),
... ... @@ -1522,7 +1527,7 @@ public define HTTP_Answer
1522 1527 List(HTML_Meta) metas,
1523 1528 HTML_Body body
1524 1529 ) =
1525   - html_page(http_ok, title,metas,[],[],[],body).
  1530 + html_page(http_ok, title,metas,[],[],[],[],body).
1526 1531  
1527 1532 public define HTTP_Answer
1528 1533 html_page
... ... @@ -1532,7 +1537,7 @@ public define HTTP_Answer
1532 1537 List(CSS_Style) styles,
1533 1538 HTML_Body body
1534 1539 ) =
1535   - html_page(http_ok, title, metas, styles, [], [], body).
  1540 + html_page(http_ok, title, metas, styles, [], [], [], body).
1536 1541  
1537 1542 'HTTP_Answer' represents the final product of the construction of a web page.
1538 1543  
... ... @@ -2861,12 +2866,6 @@ define String
2861 2866 if connection is
2862 2867 {
2863 2868 same then "/",
2864   - /*
2865   - same then if is_https
2866   - then "https://"+common_name+":"+https_port+"/"
2867   - else "http://"+common_name+":"+https_port+"/",
2868   - */
2869   -
2870 2869 http then "http://"+common_name+":"+http_port+"/",
2871 2870 https then "https://"+common_name+":"+https_port+"/",
2872 2871 } +
... ... @@ -3825,6 +3824,17 @@ define Printable_tree
3825 3824 }.
3826 3825  
3827 3826 define Printable_tree
  3827 + add_script
  3828 + (
  3829 + List(Script) l
  3830 + ) =
  3831 + if l is
  3832 + {
  3833 + [ ] then [ ],
  3834 + [h . t] then [ "<script type=\""+ script_type(h) +"\">\n"+ content(h) + "\n</script>\n" . add_script(t) ]
  3835 + }.
  3836 +
  3837 +define Printable_tree
3828 3838 add_css_styles
3829 3839 (
3830 3840 List(CSS_Style) css_styles
... ... @@ -4295,7 +4305,7 @@ define Printable_tree
4295 4305 with ic_v = var((Int)0),
4296 4306 if page is
4297 4307 {
4298   - html_page(status, title, metas, css_styles, css_files, js_files, body) then
  4308 + html_page(status, title, metas, css_styles, css_files, js_files, script, body) then
4299 4309 if body is body(options,element) then
4300 4310 if format(status) is (status_string, status_headers) then
4301 4311 with answer_body =
... ... @@ -4305,6 +4315,7 @@ define Printable_tree
4305 4315 add_css_styles(css_styles),
4306 4316 add_css_files(css_files),
4307 4317 add_js_files(js_files),
  4318 + add_script(script),
4308 4319 "<link rel=\"shortcut icon\" href=\"favicon.ico\" />\n",
4309 4320 "<script type = \"text/javascript\" language=\"JavaScript\">",
4310 4321 " function show_local_popup(divname,stvname) {",
... ...