From ceed0d51eed1f2ac4cd90c23462415b71bcc8402 Mon Sep 17 00:00:00 2001 From: totoro Date: Sat, 11 Apr 2015 01:05:17 +0200 Subject: [PATCH] add some useful widgets used in almost all Calexium projects --- web/widgets/css_helper.anubis | 248 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ web/widgets/dashboard.anubis | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 292 insertions(+), 0 deletions(-) create mode 100644 web/widgets/css_helper.anubis create mode 100644 web/widgets/dashboard.anubis diff --git a/web/widgets/css_helper.anubis b/web/widgets/css_helper.anubis new file mode 100644 index 0000000..e3a9532 --- /dev/null +++ b/web/widgets/css_helper.anubis @@ -0,0 +1,248 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ + * Date: 06/05/2007 + * Time: 09:39 + * © Calexium + */ + +read tools/basis.anubis + +read calexium_lib/web/CXM_common.anubis +read calexium_lib/web/CXM_making_a_web_site.anubis + + /**** WAVE BOX ****/ + +public define HTML_Partial_Content + html_wave_box + ( + String legend, + HTML_Partial_Content content, + String class_id + )= + partial_content([], + div([class(class_id)], + sequence( + [ + text([class("frame_wave")], legend), //legend + div([class("frame_blk")], partial(content)) + ]))). + +public define HTML_Partial_Content + html_wave_box + ( + String legend, + HTML_Off_Form content, + String class_id + )= + partial_content([], + div([class(class_id)], + sequence( + [ + text([class("frame_wave")], legend), //legend + div([class("frame_blk")], content) + ]))). + +public define HTML_Off_Form + html_wave_box + ( + String legend, + HTML_Off_Form content, + String class_id + )= + div([class(class_id)], + sequence( + [ + text([class("frame_wave")], legend), //legend + div([class("frame_blk")], content) + ])). + +public define HTML_Off_Form + html_wave_box + ( + String legend, + HTML_Off_Form content + )= + html_wave_box(legend, content, "frame"). + +public define HTML_Partial_Content + html_wave_box + ( + String legend, + HTML_Partial_Content content + )= + html_wave_box(legend, content, "frame"). + +public define HTML_Partial_Content + html_wave_box + ( + String legend, + HTML_Off_Form content + )= + html_wave_box(legend, content, "frame"). + +public define HTML_Off_Form + html_wave_box_custom_size + ( + Int size, + String legend, + HTML_Off_Form content, + )= + div([style("width: "+abs_to_decimal(size)+"px")], + sequence( + [ + text([class("frame_wave")], legend), //legend + div([class("frame_blk")], content) + ])). + +public define HTML_Off_Form + html_wave_box_wide + ( + String legend, + HTML_Off_Form content + )= + html_wave_box(legend, content, "frame wide"). + +public define HTML_Partial_Content + html_wave_box_wide + ( + String legend, + HTML_Partial_Content content + )= + html_wave_box(legend, content, "frame wide"). + + /**** CHANGELIST ****/ +public type ChangeListItem: + change_list_item( + String icon, + String label, + String value). + +define HTML_Row(HTML_Off_Form) + make_row + ( + ChangeListItem item, + Int odd, + )= + if item is change_list_item(icon, label, value) then + //with bg = (Cell_Option) else core_attrs([class()]), + row([], + [ + cell([core_attrs([class("icon "+icon)])],text("")), + cell([core_attrs([class("label")])],text(label)), + cell(text(value)) + ] + ) + . + +define List(HTML_Row(HTML_Off_Form)) + make_changelist_rows + ( + List(ChangeListItem) items, + List(HTML_Row(HTML_Off_Form)) so_far, + Int odd + )= + if items is + { + [] then reverse(so_far), + [h . t] then + make_changelist_rows(t, [ make_row(h, odd) . so_far], 1 - odd) + }. + +public define HTML_Off_Form + process_changelist + ( + List(ChangeListItem) items + )= + div([class("changelist")], + table([class("module"), attr("cellspacing","0")], make_changelist_rows(items, [], 1))) + . + +public define HTML_Off_Form + html_tooltip + ( + String title, + String keyword, + ) = + literal(""). + + 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_Off_Form + html_tooltip + ( + String title, + String keyword, + Int width, + ) = + literal(""). + + 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_In_Form + html_tooltip + ( + String title, + String keyword, + ) = + literal(""). + + 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_In_Form + html_tooltip + ( + String title, + String keyword, + Int width, + ) = + literal(""). + + 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_Off_Form + 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_Off_Form + html_tooltip_ext + ( + String title, + String keyword, + String class_suffix, + List((String, String)) ext_args + ) = + with extra_args = format_extra_operands(ext_args), + literal(""). + + 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)], []). + +public define HTML_In_Form + html_tooltip_ext + ( + String title, + String keyword, + String class_suffix, + List((String, String)) ext_args + ) = + with extra_args = format_extra_operands(ext_args), + literal(""). + + + href=\"/?a=ajax_show_tooltip&tooltip_id="+keyword+"\" id=\"help_"+keyword+HELP_HMS_MODE" class="jTip jTip_help" target="_blank" name="Aide sur la fonctionnalité 'No Limit'"> "). + + 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, []). diff --git a/web/widgets/dashboard.anubis b/web/widgets/dashboard.anubis new file mode 100644 index 0000000..7b616f2 --- /dev/null +++ b/web/widgets/dashboard.anubis @@ -0,0 +1,44 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ + * Date: 10/04/2015 + * Time: 22:22 + * © Calexium + */ + +read tools/basis.anubis + +read calexium_lib/web/CXM_common.anubis +read calexium_lib/web/CXM_making_a_web_site.anubis + +read css_helper.anubis + +public type Dashboard_content: + none, + content(List(ChangeListItem) content, String title). + +public define HTML_Off_Form + dash_board + ( + Dashboard_content left, + Dashboard_content right + )= + table([class("container")], + [ row( [ cell([class("module_col left_col")], + if left is + { + none then literal(""), + content(list, title) then html_wave_box_wide(title, sequence([process_changelist(list)])) + } + ), + cell([class("module_col right_col")], + if right is + { + none then literal(""), + content(list, title) then html_wave_box_wide(title, sequence([process_changelist(list)])) + } + ) + ]) + ]). + + -- libgit2 0.21.4