Commit 5f98667f7388f11de28a3b4f7bc842e41677f48c

Authored by totoro
1 parent 2f39d220

add to_html_ajax_content into maiking a web site which allow to format an HTML c…

…ontent directly into JSON format ready to be sent through AJAX call
add call_back as argument to jq_form_submit_and_close. This call back is fired just after the closing dialog. This can call refresh function or anything else.
web/CXM_making_a_web_site.anubis
... ... @@ -5905,6 +5905,37 @@ public define HTML_ajax_content
5905 5905 CommonInfo cinfo
5906 5906 )= to_html_ajax_content(partial(content_HTML), cinfo).
5907 5907  
  5908 +public define JsonValue
  5909 + to_html_ajax_content
  5910 + (
  5911 + HTML_Partial_Content content_HTML,
  5912 + CommonInfo cinfo,
  5913 + String additional_script
  5914 + )=
  5915 + since to_html_ajax_content(partial(content_HTML), cinfo) is html_ajax_content(html, script, js_files, css_files),
  5916 + json_object([
  5917 + json_member("html", json_string(html)),
  5918 + json_member("js_files", to_json_array(js_files)),
  5919 + json_member("css_files", to_json_array(css_files)),
  5920 + json_member("script", json_string(additional_script+script)),
  5921 + ])
  5922 +.
  5923 +
  5924 +public define JsonValue
  5925 + to_html_ajax_content
  5926 + (
  5927 + Printable_tree content_HTML,
  5928 + String additional_script
  5929 + )=
  5930 + //since to_html_ajax_content(partial(content_HTML), cinfo) is html_ajax_content(html, script, js_files, css_files),
  5931 + json_object([
  5932 + json_member("html", json_string(to_String(content_HTML))),
  5933 + json_member("js_files", to_json_array([])),
  5934 + json_member("css_files", to_json_array([])),
  5935 + json_member("script", json_string(additional_script)),
  5936 + ])
  5937 +.
  5938 +
5908 5939 public define Printable_tree
5909 5940 format
5910 5941 (
... ...
web/jQuery/CXM_jq_form.anubis
... ... @@ -28,10 +28,11 @@ public define String
28 28 String dialog_id,
29 29 String form_id, //id of the form ID handled by this function
30 30 WEB_Action_Name action,
31   - List((String,String)) extra_ops
32   -
  31 + List((String,String)) extra_ops,
  32 + String call_back //call to execute after
33 33 )=
34 34 with dialog_id_str = if length(dialog_id) > 0 then ", '" + dialog_id + "'" else "",
  35 + with call_back_str = if length(call_back) > 0 then ", "+call_back else "",
35 36 with url = format_web_action_name(action, extra_ops),
36   - "CalexiumToolBox.jq_form_submit_and_close('" + form_id + "', '" + url + "'"+dialog_id_str+");"
  37 + "CalexiumToolBox.jq_form_submit_and_close('" + form_id + "', '" + url + "'"+dialog_id_str+call_back_str+");"
37 38 .
... ...
web/jQuery/ui-addon/datetimepicker.anubis
... ... @@ -28,7 +28,7 @@ public define String
28 28 (
29 29 String lang,
30 30 Bool add_icon
31   - ) = "// Datetimepicker\n
  31 + ) = "
32 32 $.datetimepicker.setLocale('"+lang+"');
33 33 $('.datepicker').datetimepicker({timepicker:false,format:'Y-m-d'});
34 34 $('.datetimepicker').datetimepicker({format:'Y-m-d H:i'});
... ...