Commit e64143ab009397998faf650348cc534f35053a7f

Authored by totoro
1 parent db16493a

create CXM_form.anubis based on long time use MailFountain forms

create CXM_html_tooltip based on MF tooltip which use jTip
create CXM_widgets which is collection of useful HMTL "object". The first is IP input which show 4 frames to enter IP address
web/CXM_form.anubis 0 → 100644
  1 +/*
  2 + * Created by PyramIDE.
  3 + * User: フランスのトトロ
  4 + * Date: 07/12/2014
  5 + * Time: 16:49
  6 + * © Calexium
  7 + */
  8 +
  9 +// *************************************************************************************
  10 +// *** Generic form
  11 +// *************************************************************************************
  12 +read tools/basis.anubis
  13 +read system/string.anubis
  14 +read calexium_lib/web/CXM_common.anubis
  15 +read calexium_lib/web/CXM_making_a_web_site.anubis
  16 +read calexium_lib/web/CXM_html_tooltip.anubis
  17 +read calexium_lib/web/CXM_widgets.anubis
  18 +
  19 +public type Mandatory: // used to mark fields as mandatory.
  20 + mandatory,
  21 + non_mandatory.
  22 +
  23 +public type Width:
  24 + small,
  25 + narrow,
  26 + wide,
  27 + custom(Int).
  28 +
  29 +public type FormFieldWidth:
  30 + auto,
  31 + custom(Int).
  32 +
  33 +public type CXM_FormTooltip:
  34 + tooltip(String title, String content, Int width).
  35 +
  36 +public type CXM_FormField:
  37 + no_field, // empty field
  38 +
  39 + //--- title field ---------------------------------------------------------------------
  40 + title (String text),
  41 +// title (Int text_size,
  42 +// String text),
  43 +// title_f (List(Text_Option) -> HTML_In_Form),
  44 +
  45 + //--- message field -------------------------------------------------------------------
  46 + message (String text),
  47 +
  48 + //--- text input field ----------------------------------------------------------------
  49 + input (List(InputAttrs) options,
  50 + String label,
  51 + HtmlId id,
  52 + WebArgName web_arg_name,
  53 + InitialValue init_value,
  54 + Width width,
  55 + Mandatory mandatory),
  56 + input_readonly (List(InputAttrs) options,
  57 + String label,
  58 + HtmlId id,
  59 + WebArgName web_arg_name,
  60 + InitialValue init_value,
  61 + Width width),
  62 +
  63 + //--- text area field -----------------------------------------------------------------
  64 + text_area (List(TextAreaOption) options,
  65 + String label,
  66 + HtmlId id,
  67 + WebArgName web_arg_name,
  68 + InitialValue init_value,
  69 + Width width,
  70 + Int height,
  71 + Mandatory mandatory),
  72 +
  73 + //--- password input field ------------------------------------------------------------
  74 + password_input (List(InputAttrs) options,
  75 + String label,
  76 + HtmlId id,
  77 + WebArgName web_arg_name,
  78 + InitialValue init_value,
  79 + Width width,
  80 + Mandatory mandatory),
  81 +
  82 + //--- hidden field ------------------------------------------------------------
  83 + hidden (HtmlId id,
  84 + WebArgName web_arg_name,
  85 + InitialValue init_value),
  86 + //--- explanation field ---------------------------------------------------------------
  87 + explain (String text),
  88 +
  89 + //--- selector field ------------------------------------------------------------------
  90 + selector (List(InputAttrs) options,
  91 + String label,
  92 + HtmlId id,
  93 + WebArgName web_arg_name,
  94 + Int size,
  95 + List(String) items,
  96 + Maybe(InitialValue) selected,
  97 + Mandatory mandatory),
  98 + selector_c (List(InputAttrs) options,
  99 + String label,
  100 + HtmlId id,
  101 + WebArgName web_arg_name,
  102 + Int size,
  103 + List((List(CoreAttrs),WebArgValue,String)) items,
  104 + Maybe(InitialValue) selected,
  105 + Mandatory mandatory),
  106 +
  107 +
  108 +
  109 + //--- checkbox field ------------------------------------------------------------------
  110 + checkbox (List(InputAttrs) options,
  111 + String label,
  112 + HtmlId id,
  113 + WebArgName web_arg_name,
  114 + WebArgValue web_arg_value,
  115 + Bool checked,
  116 + Mandatory mandatory),
  117 + // the same one, but with the tag on the right of the checkbox
  118 + checkboxr (List(InputAttrs) options,
  119 + String label,
  120 + HtmlId id,
  121 + WebArgName web_arg_name,
  122 + WebArgValue web_arg_value,
  123 + Bool checked,
  124 + Mandatory mandatory),
  125 +
  126 + //--- radio-button field --------------------------------------------------------------
  127 + radio_button (List(InputAttrs) options,
  128 + String label,
  129 + HtmlId id,
  130 + WebArgName web_arg_name,
  131 + WebArgValue web_arg_value,
  132 + Bool checked,
  133 + Mandatory mandatory),
  134 + // the same one, but with the tag on the right of the radio_button
  135 + radio_buttonr (List(InputAttrs) options,
  136 + String label,
  137 + HtmlId id,
  138 + WebArgName web_arg_name,
  139 + WebArgValue web_arg_value,
  140 + Bool checked,
  141 + Mandatory mandatory),
  142 +
  143 + radio_button_list (List(InputAttrs) options,
  144 + String label,
  145 + HtmlId id,
  146 + WebArgName web_arg_name,
  147 + List((WebArgValue, String)) web_arg_value,
  148 + Maybe(InitialValue) selected,
  149 + Mandatory mandatory,
  150 + Bool is_wide),
  151 +
  152 +// //--- fields table --------------------------------------------------------------------
  153 +// fields_table (String tag,
  154 +// List(FormField) fields),
  155 +//
  156 +// //--- fields line ---------------------------------------------------------------------
  157 +// fields_line (String tag,
  158 +// List(FormField) fields),
  159 + one_line_fields (List(CXM_FormField) fields),
  160 +
  161 +//
  162 +// //--- preview field -------------------------------------------------------------------
  163 +// preview (String html_text),
  164 +
  165 + //--- upload field -------------------------------------------------------------------
  166 + upload (List(InputAttrs) options,
  167 + String label,
  168 + HtmlId id,
  169 + WebArgName name,
  170 + Width width,
  171 + Mandatory mandatory),
  172 +
  173 + raw_in_form (HTML_In_Form html),
  174 + raw_in_form (String label,
  175 + HtmlId id,
  176 + HTML_In_Form input),
  177 + partial (HTML_Partial_Content p_content),
  178 + input_with_help (CXM_FormField field,
  179 + Maybe(String) help_title,
  180 + String help_text,
  181 + Int width),
  182 +
  183 + sub_fieldset (HTML_In_Form fieldset),
  184 +
  185 + blank_space,
  186 + blank_space (HtmlClass class),
  187 +
  188 + //--- submit button -------------------------------------------------------------------
  189 + submit (List(CoreAttrs) options,
  190 + HtmlClass class,
  191 + String action_name,
  192 + Maybe(String) label,
  193 + String button_text,
  194 + List((String,String)) extra_operands),
  195 + empty.
  196 +
  197 +// //////////////////////////////////////////////
  198 +// Alternative constructors:
  199 +
  200 +public define CXM_FormField
  201 + input(WebArgName n, InitialValue init_value, Width width)
  202 + = input([], "", htmlId(n.name), n, init_value, width, non_mandatory).
  203 +
  204 +public define CXM_FormField
  205 + input(String label, WebArgName n, InitialValue init_value, Width width)
  206 + = input([], label, htmlId(n.name), n, init_value, width, non_mandatory).
  207 +
  208 +public define CXM_FormField
  209 + input(String label, WebArgName n, InitialValue init_value, Width width, Mandatory mand)
  210 + = input([], label, htmlId(n.name), n, init_value, width, mand).
  211 +
  212 +public define CXM_FormField
  213 + input_readonly(String label, WebArgName n, InitialValue init_value, Width width)
  214 + = input_readonly([], label, htmlId(n.name), n, init_value, width).
  215 +
  216 +public define CXM_FormField
  217 + password_input(String label, WebArgName n, InitialValue init_value, Width width, Mandatory mand)
  218 + = password_input([], label, htmlId(n.name), n, init_value, width, mand).
  219 +
  220 +public define CXM_FormField
  221 + checkbox(String label, WebArgName n, WebArgValue value, Bool checked, Mandatory mand)
  222 + = checkbox([], label, htmlId(n.name), n, value, checked, mand).
  223 +
  224 +public define CXM_FormField
  225 + checkboxr(String label, WebArgName n, WebArgValue value, Bool checked, Mandatory mand)
  226 + = checkboxr([], label, htmlId(n.name), n, value, checked, mand).
  227 +
  228 +public define CXM_FormField
  229 + radio_button(String label, WebArgName n, WebArgValue value, Bool checked, Mandatory mand)
  230 + = radio_button([], label, htmlId(n.name), n, value, checked, mand).
  231 +
  232 +public define CXM_FormField
  233 + radio_buttonr(String label, WebArgName n, WebArgValue value, Bool checked, Mandatory mand)
  234 + = radio_buttonr([], label, htmlId(n.name), n, value, checked, mand).
  235 +
  236 +public define CXM_FormField
  237 + submit(String action_name, HtmlClass class, Maybe(String) label, String button_text, List((String,String)) extra_operands)
  238 + = submit([], class, action_name, label, button_text, extra_operands).
  239 +
  240 +public define CXM_FormField
  241 + submit(String action_name, Maybe(String) label, String button_text, List((String,String)) extra_operands)
  242 + = submit([], htmlClass(""), action_name, label, button_text, extra_operands).
  243 +
  244 +public define CXM_FormField
  245 + upload(String label, HtmlId id, WebArgName name, Width width)
  246 + = upload([], label, id, name, width, non_mandatory).
  247 +
  248 +public define CXM_FormField
  249 + upload(String label, HtmlId id, WebArgName name, Width width, Mandatory mand)
  250 + = upload([], label, id, name, width, mand).
  251 +
  252 +public define CXM_FormField
  253 + input_with_help (CXM_FormField field, String help_text)
  254 + = input_with_help (field, failure, help_text, 250).
  255 +
  256 +public define CXM_FormField
  257 + input_with_help (CXM_FormField field, String help_text, Int width)
  258 + = input_with_help (field, failure, help_text, width).
  259 +
  260 +public define CXM_FormField
  261 + ip_input
  262 + (
  263 + String label,
  264 + HtmlId id,
  265 + WebArgName wan_prefix,
  266 + String ip
  267 + )=
  268 + raw_in_form(
  269 + label,
  270 + id,
  271 + ip_input(id, wan_prefix, ip)
  272 + ).
  273 +
  274 +
  275 +public define CXM_FormField
  276 + partial_ip_input
  277 + (
  278 + String label,
  279 + HtmlId id,
  280 + WebArgName wan_prefix,
  281 + List(String) ip_fixed_part,
  282 + String ip
  283 + )=
  284 + raw_in_form(
  285 + label,
  286 + id,
  287 + partial_ip_input(id, wan_prefix, ip_fixed_part, ip)
  288 + ).
  289 +
  290 +public define CXM_FormField
  291 + hidden
  292 + (
  293 + WebArgName web_arg_name,
  294 + InitialValue init_value
  295 + )=
  296 + if web_arg_name is wan(name) then
  297 + hidden(htmlId(name), web_arg_name, init_value).
  298 +
  299 +
  300 + //--- explanation field ---------------------
  301 +
  302 +// //////////////////////////////////////////////////////////
  303 +
  304 +public define HTML_In_Form
  305 + cxm_format_form_field
  306 + (
  307 + CXM_FormField ff
  308 + ) =
  309 + with star = (Mandatory m) |-> (String)
  310 + if m is
  311 + {
  312 + mandatory then "<span>*</span>",
  313 + non_mandatory then ""
  314 + },
  315 + pixels = (Width width) |->
  316 + if width is
  317 + {
  318 + small then 10,
  319 + narrow then 50,
  320 + wide then 70,
  321 + custom(n) then n
  322 + },
  323 + // special case out of the div("inputable") tag.
  324 +// if ff is submit(attrs, action_name, mb_label, button_text, extra_operands) then
  325 +// mf_format_form_field_inside_inputable(ff, star, pixels)
  326 +// else if ff is hidden(name, init) then
  327 +// mf_format_form_field_inside_inputable(ff, star, pixels)
  328 +// else if ff is sub_fieldset(fieldset) then
  329 +// mf_format_form_field_inside_inputable(ff, star, pixels)
  330 +// else
  331 +// div([class("inputable")],
  332 +// mf_format_form_field_inside_inputable(ff, star, pixels))
  333 +
  334 +// sequence([
  335 +// literal(" <tr class=\"form_row\">\n"),
  336 +// mf_format_form_field_inside_inputable(ff, star, pixels, failure),
  337 +// literal(" </tr>\n"),
  338 +// ])
  339 +
  340 + if ff is
  341 + {
  342 + no_field then
  343 + literal(""),
  344 +
  345 + title(t) then
  346 + literal("<h2>" + t + "</h2>"),
  347 +
  348 +// title(s,t) then
  349 +// text([h_center, size(s),bold,color(rgb(0,0,0))], t),
  350 +//
  351 +// title_f(t) then
  352 +// t([h_center, size(16),bold,color(rgb(0,0,0))]),
  353 +
  354 + message(t) then
  355 + literal(t),
  356 +
  357 + input(options, label, id, name, init, w, mand) then
  358 + text_input([class("in") . options], label + star(mand), id, name, init, pixels(w)),
  359 +
  360 + input_readonly(options, label, id, name, init, w) then
  361 + text_input_ro([class("in") . options], label, id, name, init, pixels(w)),
  362 +
  363 + text_area(options, label, id, name, init, w, height, mand) then
  364 + text_area([input_attrs([class("in")]) . options], label + star(mand), id, name, init, pixels(w), height),
  365 +
  366 + password_input(options, label, id, name, init, w, mand) then
  367 + password_input([class("in") . options], label + star(mand), id, name, init, pixels(w)),
  368 +
  369 + hidden(id, name, init) then
  370 + hidden(id, name, init),
  371 +
  372 + explain(t) then
  373 + div([class("sub")], literal(t)),
  374 +
  375 + selector(options, label, id, wan, size, items, selected, mand) then
  376 + if selected is
  377 + {
  378 + failure then selector(options, label + star(mand), id, wan, size, items),
  379 + success(init) then selector(options, label + star(mand), id, wan, size, items, init),
  380 + },
  381 +
  382 + selector_c(options, label, id, wan, size, items, selected, mand) then
  383 + if selected is
  384 + {
  385 + failure then selector_c(options, label + star(mand), id, wan, size, items),
  386 + success(init) then selector_c(options, label + star(mand), id, wan, size, items, init),
  387 + },
  388 +
  389 + checkbox(options, label, id, name, val, checked, mand) then
  390 + check_box(options, label + star(mand), id, name, val, checked),
  391 +
  392 + checkboxr(options, label, id, name, val, checked, mand) then
  393 + check_box_r(options, label + star(mand), id, name, val, checked),
  394 +
  395 + radio_button(options, label, id, name, val, checked, mand) then
  396 + radio_button(options, label + star(mand), id, name, val, checked),
  397 +
  398 + radio_buttonr(options, label, id, name, val, checked, mand) then
  399 + radio_button_r(options, label + star(mand), id, name, val, checked),
  400 +
  401 + radio_button_list (options, label, id, wan, items, selected, mand, wide) then
  402 + sequence([
  403 + literal("<label for=\"" + wan.name + "\">" + label + star(mand) + "</label>"),
  404 + div( [class("radiolist")], sequence(
  405 + with i = var((Int)-1),
  406 + itemclass = if wide then "radiolistitem_wide" else "radiolistitem",
  407 + map( ((WebArgValue, String) item) |->
  408 + i <- *i + 1;
  409 + if item is (wav, item_label) then
  410 + with id = if id is htmlId(the_id) then htmlId(the_id + "_radio_" + *i),
  411 + div([class(itemclass)], radio_button_r(options, item_label, id, wan, wav,
  412 + if selected is success(v) then wav.value = v.value else false)),
  413 + items))
  414 + ),
  415 + ]),
  416 + one_line_fields(fields) then
  417 + table([nude],[row([],
  418 + map((CXM_FormField ff2) |-> cell([],cxm_format_form_field(ff2)),fields))])
  419 + ,
  420 +
  421 +
  422 + upload(options, label, id, name, w, mand) then
  423 + file_upload(options, label + star(mand), id, name, pixels(w)),
  424 +
  425 + raw_in_form(html) then
  426 + html,
  427 +// div([class("in")], html),
  428 + raw_in_form(label, id, input) then
  429 + sequence([
  430 + if id is htmlId(id) then
  431 + literal("<label for=\"" + id + "\">" + label + "</label>"),
  432 + input]),
  433 + partial(p_content) then
  434 + partial(p_content),
  435 + input_with_help(input, help_title, help_text, width) then
  436 + sequence([
  437 + cxm_format_form_field(input),
  438 + html_tooltip(force_String(help_title), help_text, width),
  439 + ]),
  440 +
  441 + sub_fieldset(fieldset) then
  442 + fieldset,
  443 +
  444 + blank_space then
  445 + div([class("blank_space")], literal("&nbsp")),
  446 +
  447 + blank_space(htmlClass) then
  448 + div([class(htmlClass.class)], literal("&nbsp")),
  449 +
  450 + submit(attrs, htmlClass, action_name, mb_label, button_text, extra_operands) then
  451 + actioner( same, // TODO change this to allow external URL
  452 + if mb_label is
  453 + {
  454 + failure then same,
  455 + success(n) then same(n)
  456 + },
  457 + submit(attrs + [class(htmlClass.class)], button_text),
  458 + action_name,
  459 + extra_operands
  460 + ),
  461 + empty then literal("")
  462 + }.
  463 +
  464 +public define HTML_In_Form
  465 + cxm_fieldset
  466 + (
  467 + List(CoreAttrs) options,
  468 + String legend,
  469 + List(CXM_FormField) fields
  470 + ) =
  471 + sequence([
  472 + literal("<fieldset" + format_attrs(options) + ">"),
  473 + literal(if length(legend) > 0 then "<legend>" + legend + "</legend>" else ""),
  474 + sequence( map((CXM_FormField ff) |-> div([class("form_field")], cxm_format_form_field(ff)), fields) ),
  475 + literal("</fieldset>")]).
  476 +
  477 +public define HTML_In_Form
  478 + cxm_fieldset
  479 + (
  480 + HtmlId fieldSetId,
  481 + List(CXM_FormField) fields
  482 + ) =
  483 + cxm_fieldset([id(fieldSetId.id), class("aligned")], "", fields).
  484 +
  485 +public define HTML_Off_Form
  486 + cxm_form
  487 + (
  488 + String form_name,
  489 + List(CoreAttrs) options,
  490 + String action_name,
  491 + List((String,String)) extra_ops,
  492 + List(HTML_In_Form) fieldSets
  493 + ) =
  494 + //div([class("formulaire")],
  495 + form( form_name,
  496 + [class("formulaire") . options],
  497 + action_name,
  498 + extra_ops,
  499 + sequence( fieldSets )
  500 + // )
  501 + ).
  502 +
  503 +public define HTML_Off_Form
  504 + cxm_form
  505 + (
  506 + String form_name,
  507 + List(CoreAttrs) options,
  508 + List(HTML_In_Form) fieldSets
  509 + ) =
  510 + //div([class("formulaire")],
  511 + form( form_name,
  512 + [class("formulaire") . options],
  513 + sequence( fieldSets )
  514 + // )
  515 + ).
  516 +
  517 +public define HTML_Off_Form
  518 + cxm_form
  519 + (
  520 + String form_name,
  521 + List(CoreAttrs) options,
  522 + String action_name,
  523 + List((String,String)) extra_ops,
  524 + HtmlId fieldSetId,
  525 + List(CXM_FormField) fields
  526 + ) =
  527 + cxm_form(form_name, options, action_name, extra_ops,
  528 + [
  529 + cxm_fieldset([id(fieldSetId.id), class("aligned")], "", fields)
  530 + ]).
  531 +
  532 +public define HTML_Off_Form
  533 + cxm_form
  534 + (
  535 + String form_name,
  536 + List(CoreAttrs) options,
  537 + HtmlId fieldSetId,
  538 + List(CXM_FormField) fields
  539 + ) =
  540 + cxm_form(form_name, options,
  541 + [
  542 + cxm_fieldset([id(fieldSetId.id), class("aligned")], "", fields)
  543 + ]).
  544 +
  545 +public define HTML_Off_Form
  546 + cxm_form
  547 + (
  548 + String form_name,
  549 + List(HTML_In_Form) fieldSets
  550 + ) =
  551 + cxm_form(form_name, [], fieldSets).
  552 +
  553 +public define HTML_Off_Form
  554 + cxm_form
  555 + (
  556 + String form_name,
  557 + HtmlId fieldSetId,
  558 + List(CXM_FormField) fields
  559 + ) =
  560 + cxm_form(form_name, [], fieldSetId, fields).
  561 +
web/CXM_html_tooltip.anubis 0 → 100644
  1 +/*
  2 + * Created by PyramIDE.
  3 + * User: フランスのトトロ
  4 + * Date: 07/12/2014
  5 + * Time: 17:12
  6 + * © Calexium
  7 + */
  8 +
  9 +read tools/basis.anubis
  10 +
  11 +read calexium_lib/web/CXM_common.anubis
  12 +read calexium_lib/web/CXM_making_a_web_site.anubis
  13 +
  14 +public define HTML_Off_Form
  15 + html_tooltip
  16 + (
  17 + String title,
  18 + String keyword,
  19 + ) =
  20 + literal("<a id=\"help_"+keyword+"\" class=\"jTipu jTip_help\" name=\""+title+"\" href=\"/?a=ajax_show_tooltip&amp;tooltip_id="+keyword+"\"></a>").
  21 +
  22 + actioner(same,same, link([id("help_" + keyword), class("jTip jTip_help"), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_id", keyword)], []).
  23 +
  24 +public define HTML_Off_Form
  25 + html_tooltip
  26 + (
  27 + String title,
  28 + String keyword,
  29 + Int width,
  30 + ) =
  31 + literal("<a id=\"help_"+keyword+"\" class=\"jTipu jTip_help\" name=\""+title+"\" href=\"/?a=ajax_show_tooltip&amp;tooltip_id="+keyword+"&width="+width+"\"></a>").
  32 +
  33 + actioner(same,same, link([id("help_" + keyword), class("jTip jTip_help"), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_id", keyword), ("width", to_decimal(width))], []).
  34 +
  35 +public define HTML_In_Form
  36 + html_tooltip
  37 + (
  38 + String title,
  39 + String keyword,
  40 + ) =
  41 + literal("<a id=\"help_"+keyword+"\" class=\"jTipu jTip_help\" name=\""+title+"\" href=\"/?a=ajax_show_tooltip&amp;tooltip_id="+keyword+"\"></a>").
  42 +
  43 + actioner(same,same, link([id("help_" + keyword), class("jTip jTip_help"), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_id", keyword)], []).
  44 +
  45 +public define HTML_In_Form
  46 + html_tooltip
  47 + (
  48 + String title,
  49 + String keyword,
  50 + Int width,
  51 + ) =
  52 + literal("<a id=\"help_"+keyword+"\" class=\"jTipu jTip_help\" name=\""+title+"\" href=\"/?a=ajax_show_tooltip&amp;tooltip_id="+keyword+"&width="+width+"\"></a>").
  53 +
  54 + actioner(same,same, link([id("help_" + keyword), class("jTip jTip_help"), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_id", keyword), ("width", to_decimal(width))], []).
  55 +
  56 + public define HTML_Off_Form
  57 + html_tooltip_ext
  58 + (
  59 + String title,
  60 + String keyword,
  61 + String class_suffix
  62 + ) =
  63 + actioner(same,same, link([id("help_" + keyword), class("jTip jTip_"+class_suffix), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_ext", keyword)], []).
  64 +
  65 +public define HTML_Off_Form
  66 + html_tooltip_ext
  67 + (
  68 + String title,
  69 + String keyword,
  70 + String class_suffix,
  71 + List((String, String)) ext_args
  72 + ) =
  73 + with extra_args = format_extra_operands(ext_args),
  74 + literal("<a id=\"help_"+keyword+"\" class=\"jTipu jTip_"+class_suffix+"\" name=\""+title+"\" href=\"/?a=ajax_show_tooltip&amp;tooltip_ext="+keyword+extra_args+"\"></a>").
  75 +
  76 + actioner(same,same, link([id("help_" + keyword), class("jTip jTip_"+class_suffix), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_ext", keyword)] + ext_args, []).
  77 +
  78 + public define HTML_In_Form
  79 + html_tooltip_ext
  80 + (
  81 + String title,
  82 + String keyword,
  83 + String class_suffix
  84 + ) =
  85 + actioner(same,same, link([id("help_" + keyword), class("jTipu jTip_"+class_suffix), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_ext", keyword)], []).
  86 +
  87 +public define HTML_In_Form
  88 + html_tooltip_ext
  89 + (
  90 + String title,
  91 + String keyword,
  92 + String class_suffix,
  93 + List((String, String)) ext_args
  94 + ) =
  95 + with extra_args = format_extra_operands(ext_args),
  96 + literal("<a id=\"help_"+keyword+"\" class=\"jTipu jTip_"+class_suffix+"\" name=\""+title+"\" href=\"/?a=ajax_show_tooltip&amp;tooltip_ext="+keyword+extra_args+"\"></a>").
  97 +
  98 +
  99 + href=\"/?a=ajax_show_tooltip&amp;tooltip_id="+keyword+"\" id=\"help_"+keyword+HELP_HMS_MODE" class="jTip jTip_help" target="_blank" name="Aide sur la fonctionnalité 'No Limit'"> </a>").
  100 +
  101 + actioner(same,same, link([id("help_" + keyword), class("jTip jTip_"+class_suffix), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_ext", keyword)] + ext_args, []).
web/CXM_widgets.anubis 0 → 100644
  1 +/*
  2 + * Created by PyramIDE.
  3 + * User: フランスのトトロ
  4 + * Date: 07/12/2014
  5 + * Time: 18:10
  6 + * © Calexium
  7 + */
  8 +
  9 +read system/string.anubis
  10 +read tools/basis.anubis
  11 +
  12 +read calexium_lib/web/CXM_making_a_web_site.anubis
  13 +
  14 +public define HTML_In_Form
  15 + ip_input
  16 + (
  17 + HtmlId the_id,
  18 + WebArgName wan_prefix,
  19 + String ip
  20 + )=
  21 + with ip_fields = split(ip, '.'),
  22 + if the_id is htmlId(id_str) then
  23 + if wan_prefix is wan(field_prefix) then
  24 + div([id(id_str)],
  25 + sequence(
  26 + [
  27 + text_input([class("ip_input")], "", htmlId(""), wan(field_prefix+"_0"), init(force_nth(0,ip_fields,"")), 3),
  28 + text("."),
  29 + text_input([class("ip_input")], "", htmlId(""), wan(field_prefix+"_1"), init(force_nth(1,ip_fields,"")), 3),
  30 + text("."),
  31 + text_input([class("ip_input")], "", htmlId(""), wan(field_prefix+"_2"), init(force_nth(2,ip_fields,"")), 3),
  32 + text("."),
  33 + text_input([class("ip_input")], "", htmlId(""), wan(field_prefix+"_3"), init(force_nth(3,ip_fields,"")), 3),
  34 + ]))
  35 + .
  36 +
  37 +// ---------------------------------------------------------------------------
  38 +
  39 +public define HTML_In_Form
  40 + partial_ip_input
  41 + (
  42 + HtmlId the_id,
  43 + WebArgName wan_prefix,
  44 + List(String) ip_fixed_part,
  45 + String ip
  46 + )=
  47 + with ip_fields = split(ip, '.'),
  48 + if the_id is htmlId(id_str) then
  49 + if wan_prefix is wan(field_prefix) then
  50 + with make_field = (Int index)
  51 + |-> if index < length(ip_fixed_part) then
  52 + text([], force_nth(index, ip_fixed_part, ""))
  53 + else
  54 + text_input([class("ip_input")],
  55 + "",
  56 + htmlId(""),
  57 + wan(field_prefix + "_" + index),
  58 + init(force_nth(index, ip_fields, "")),
  59 + 3),
  60 + div([id(id_str)],
  61 + sequence(
  62 + [
  63 + make_field(0),
  64 + text("."),
  65 + make_field(1),
  66 + text("."),
  67 + make_field(2),
  68 + text("."),
  69 + make_field(3),
  70 + ]))
  71 + .