Commit 228502569ce21c09630057afe9516682ae7602a1

Authored by totoro
1 parent 3e2e9b57

[!] Update CXM_form according to MailFountain form

[+] Add img_submit_button
Showing 2 changed files with 47 additions and 25 deletions   Show diff stats
web/CXM_form.anubis
... ... @@ -113,7 +113,8 @@ public type CXM_FormField:
113 113 WebArgName web_arg_name,
114 114 WebArgValue web_arg_value,
115 115 Bool checked,
116   - Mandatory mandatory),
  116 + Mandatory mandatory),
  117 +
117 118 // the same one, but with the tag on the right of the checkbox
118 119 checkboxr (List(InputAttrs) options,
119 120 String label,
... ... @@ -121,8 +122,16 @@ public type CXM_FormField:
121 122 WebArgName web_arg_name,
122 123 WebArgValue web_arg_value,
123 124 Bool checked,
124   - Mandatory mandatory),
125   -
  125 + Mandatory mandatory),
  126 +
  127 + //checkbox_hide_show
  128 + checkbox_hide_show( List(InputAttrs) options,
  129 + String label,
  130 + WebArgName web_arg_name,
  131 + WebArgValue web_arg_value,
  132 + Bool checked,
  133 + List(CXM_FormField) fields),
  134 +
126 135 //--- radio-button field --------------------------------------------------------------
127 136 radio_button (List(InputAttrs) options,
128 137 String label,
... ... @@ -163,24 +172,25 @@ public type CXM_FormField:
163 172 // preview (String html_text),
164 173  
165 174 //--- upload field -------------------------------------------------------------------
166   - upload (List(InputAttrs) options,
  175 + upload (List(InputAttrs) options,
167 176 String label,
168 177 HtmlId id,
169 178 WebArgName name,
170 179 Width width,
171 180 Mandatory mandatory),
172 181  
173   - raw_in_form (HTML_In_Form html),
174   - raw_in_form (String label,
  182 + raw_in_form (HTML_In_Form html),
  183 + raw_in_form (String label,
175 184 HtmlId id,
176 185 HTML_In_Form input),
177   - partial (HTML_Partial_Content p_content),
178   - input_with_help (CXM_FormField field,
  186 + div (List(CoreAttrs), HTML_In_Form content),
  187 + partial (HTML_Partial_Content p_content),
  188 + input_with_help (CXM_FormField field,
179 189 Maybe(String) help_title,
180 190 String help_text,
181 191 Int width),
182 192  
183   - sub_fieldset (HTML_In_Form fieldset),
  193 + sub_fieldset (HTML_In_Form fieldset),
184 194  
185 195 blank_space,
186 196 blank_space (HtmlClass class),
... ... @@ -391,7 +401,14 @@ public define HTML_In_Form
391 401  
392 402 checkboxr(options, label, id, name, val, checked, mand) then
393 403 check_box_r(options, label + star(mand), id, name, val, checked),
394   -
  404 +
  405 + checkbox_hide_show(options, label, name, val, checked, fields) then
  406 + with div_id = generate_random_string(15),
  407 + sequence([
  408 + check_box([event(onclick, "checkbox_hide_show_element('"+div_id+"', this);")], label, htmlId(""), name, val, checked),
  409 + div([id(div_id), style("display:"+if checked then "block" else "none")], sequence(map((CXM_FormField ff2) |-> div([class("form_field")], cxm_format_form_field(ff2)),fields)))
  410 + ]),
  411 +
395 412 radio_button(options, label, id, name, val, checked, mand) then
396 413 radio_button(options, label + star(mand), id, name, val, checked),
397 414  
... ... @@ -417,29 +434,26 @@ public define HTML_In_Form
417 434 table([nude],[row([],
418 435 map((CXM_FormField ff2) |-> cell([],cxm_format_form_field(ff2)),fields))])
419 436 ,
420   -
421 437  
422 438 upload(options, label, id, name, w, mand) then
423 439 file_upload(options, label + star(mand), id, name, pixels(w)),
424 440  
425   - raw_in_form(html) then
426   - html,
  441 + raw_in_form(html) then html,
427 442 // div([class("in")], html),
428 443 raw_in_form(label, id, input) then
429 444 sequence([
430 445 if id is htmlId(id) then
431 446 literal("<label for=\"" + id + "\">" + label + "</label>"),
432 447 input]),
433   - partial(p_content) then
434   - partial(p_content),
  448 + div(options, e) then div(options, e),
  449 + partial(p_content) then partial(p_content),
435 450 input_with_help(input, help_title, help_text, width) then
436 451 sequence([
437 452 cxm_format_form_field(input),
438 453 html_tooltip(force_String(help_title), help_text, width),
439 454 ]),
440 455  
441   - sub_fieldset(fieldset) then
442   - fieldset,
  456 + sub_fieldset(fieldset) then fieldset,
443 457  
444 458 blank_space then
445 459 div([class("blank_space")], literal("&nbsp")),
... ... @@ -478,7 +492,7 @@ public define HTML_In_Form
478 492 cxm_fieldset
479 493 (
480 494 HtmlId fieldSetId,
481   - List(CXM_FormField) fields
  495 + List(CXM_FormField) fields
482 496 ) =
483 497 cxm_fieldset([id(fieldSetId.id), class("aligned")], "", fields).
484 498  
... ... @@ -517,11 +531,12 @@ public define HTML_Off_Form
517 531 public define HTML_Off_Form
518 532 cxm_form
519 533 (
520   - String form_name,
521   - List(CoreAttrs) options,
522   - String action_name,
  534 + String form_name,
  535 + List(CoreAttrs) options,
  536 + HtmlId fieldSetId,
  537 + String action_name,
523 538 List((String,String)) extra_ops,
524   - HtmlId fieldSetId,
  539 +
525 540 List(CXM_FormField) fields
526 541 ) =
527 542 cxm_form(form_name, options, action_name, extra_ops,
... ... @@ -535,7 +550,7 @@ public define HTML_Off_Form
535 550 String form_name,
536 551 List(CoreAttrs) options,
537 552 HtmlId fieldSetId,
538   - List(CXM_FormField) fields
  553 + List(CXM_FormField) fields
539 554 ) =
540 555 cxm_form(form_name, options,
541 556 [
... ... @@ -546,7 +561,7 @@ public define HTML_Off_Form
546 561 cxm_form
547 562 (
548 563 String form_name,
549   - List(HTML_In_Form) fieldSets
  564 + List(HTML_In_Form) fieldSets
550 565 ) =
551 566 cxm_form(form_name, [], fieldSets).
552 567  
... ... @@ -555,7 +570,7 @@ public define HTML_Off_Form
555 570 (
556 571 String form_name,
557 572 HtmlId fieldSetId,
558   - List(CXM_FormField) fields
  573 + List(CXM_FormField) fields
559 574 ) =
560 575 cxm_form(form_name, [], fieldSetId, fields).
561 576  
... ...
web/jQuery/CXM_jquery_button.anubis
... ... @@ -353,3 +353,10 @@ public define HTML_Partial_Content
353 353 )=
354 354 jq_button_confirm(button_label, dlg_title, dlg_text, dlg_ok, dlg_cancel, url, []).
355 355  
  356 +public define HTML_Partial_Content
  357 + img_submit_button
  358 + (
  359 + String label, //translated label of the button
  360 + String form_id //
  361 + )=
  362 + jquery_button(jquery_img_button("icons/16x16/check.png", label, "", jQuery_actioner(same, jqform, form_id), left)).
... ...