css_helper.anubis 5.64 KB
/*
 * Created by PyramIDE.
 * User: フランスのトトロ 
 * Date: 06/05/2007
 * Time: 09:39
 * © David RENÉ
 */

read tools/basis.anubis

read xlib/web/common.anubis
read xlib/web/making_a_web_site.anubis

 /**** WAVE BOX ****/

public define HTML 
  html_wave_box
  (
    List(CoreAttrs)   attrs,
    String            legend,
    List(HTML)        content
  )=
  
  div(attrs, [
      text(class("frame_wave"), legend),   //legend
      div([class("frame_blk")], content)
  ])
.

public define HTML 
  html_wave_box
  (
    List(CoreAttrs)     attrs,
    String              legend,
    HTML                content
  )=
  html_wave_box(attrs, legend, [content])
.

  
public define HTML 
  html_wave_box
  (
    String  legend,
    HTML    content
  )=
  html_wave_box([class("frame")], legend, content)
.
  
public define HTML 
  html_wave_box_custom_size
  (
    Int         size,
    String      legend,
    List(HTML)  content,
  )=
  div(style("width: "+abs_to_decimal(size)+"px"),
    [
      text(class("frame_wave"), legend),   //legend
      div(class("frame_blk"),   content)
    ]).
    
public define HTML 
  html_wave_box_wide
  (
    String    legend,
    HTML      content
  )=
  html_wave_box([class("frame wide")], legend, [content]).
  
public define HTML 
  html_wave_box_wide
  (
    String      legend,
    List(HTML)  content
  )=
  html_wave_box([class("frame wide")], legend, content).

  /**** CHANGELIST ****/
public type ChangeListItem:
  change_list_item(
    String icon,
    String label,
    HTML value).

public define ChangeListItem
  change_list_item
  (
    String  icon,
    String  label,
    String  value
  )=
  change_list_item(icon, label, text(value)).

public define ChangeListItem
  change_list_item
  (
    String  icon,
    String  label,
    Int     value
  )=
  change_list_item(icon, label, text(value)).

public define ChangeListItem
  change_list_item
  (
    String  label,
    Int     value
  )=
  change_list_item("", label, text(value)).
  
public define ChangeListItem
  change_list_item
  (
    String  label,
    String  value
  )=
  change_list_item("", label, text(value)).

public define ChangeListItem
  change_list_item
  (
    String         label,
    HTML  value
  )=
  change_list_item("", label, value).
  
define HTML
  make_tr
  (
    ChangeListItem  item,
    Int             odd,
  )=
  if item is change_list_item(icon, label, value) then
  //with bg = (Cell_Option)   else core_attrs([class()]),
  tr([],
    if icon = "" then
        [ td(class("label"),text(label)),
          td(value)
        ]
    else
        [ td(class("icon "+icon),text("")),
          td(class("label"),text(label)),
          td(value)
        ]
     )
  .
  
define List(HTML)
  make_changelist_rows
  (
    List(ChangeListItem)  items,
    List(HTML)   so_far,
    Int                   odd
  )=
  if items is
  {
    []      then reverse(so_far),
    [h . t] then 
      make_changelist_rows(t, [ make_tr(h, odd) . so_far], 1 - odd)
  }.
  
public define HTML
  changelist_table
  (
    List(ChangeListItem) items
  )=
  partial_content([css(css_file("xlib/css/changelists.css"))],
  div(class("changelist"),
    table([/*class("module"), */ attr("cellspacing","0")], make_changelist_rows(items, [], 1))))
  .
  
 public define HTML
  html_tooltip
  (
    String title,
    String keyword,
  ) =
  literal("<a id=\"help_"+keyword+"\" class=\"jTipu jTip_help\" name=\""+title+"\" href=\"/?a=ajax_show_tooltip&amp;tooltip_id="+keyword+"\"></a>").
  
  actioner(same,same, link([id("help_" + keyword), class("jTip jTip_help"), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_id", keyword)], []).


public define HTML
  html_tooltip
  (
    String title,
    String keyword,
    Int  width,
  ) =
  literal("<a id=\"help_"+keyword+"\" class=\"jTipu jTip_help\" data-name=\""+title+"\" data-href=\"/?a=ajax_show_tooltip&tooltip_id="+keyword+"&width="+width+"\"></a>").

  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))], []).
  
 public define HTML
  html_tooltip_ext
  (
    String  title,
    String  keyword,
    String  class_suffix
  ) =
  actioner(same,same, link([id("help_" + keyword), class("jTip jTip_"+class_suffix), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_ext", keyword)], []).

public define HTML
  html_tooltip_ext
  (
    String  title,
    String  keyword,
    String  class_suffix,
    List((String, String)) ext_args
  ) =
  with extra_args = format_extra_operands(ext_args),
  literal("<a id=\"help_"+keyword+"\" class=\"jTipu jTip_"+class_suffix+"\" data-name=\""+title+"\" data-href=\"/?a=ajax_show_tooltip&amp;tooltip_ext="+keyword+extra_args+"\"></a>").

  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, []).

 public define HTML_In_Form
  html_tooltip_ext
  (
    String  title,
    String  keyword,
    String  class_suffix
  ) =
  actioner(same,same, link([id("help_" + keyword), class("jTipu jTip_"+class_suffix), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_ext", keyword)], []).


  
  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>").
  
  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, []).