Commit 0f97a53e954d365d416021a78dad323610d54da5

Authored by totoro
1 parent 7e1c7db6

generate all types with densaku instead manually. With that auto generation it's…

… faster to make evolution in core.
ds_files/ds_types.anubis 0 → 100644
  1 +/*
  2 + * Created by PyramIDE.
  3 + * User: フランスのトトロ aka (David RENÉ)
  4 + * Date: 14/03/2017
  5 + * Time: 22:50
  6 + * © Calexium
  7 + */
  8 +
  9 +
  10 +read densaku_lib/types/densaku.anubis
  11 +
  12 +define String model_types = "hayamiki_lib/model/types/".
  13 +
  14 +public define List(DS_Type) hayamiki_lib_types_description =
  15 + [
  16 + ds_type("HK_Database", [
  17 + alternative("hk_database", [
  18 + component(string, "name", comment("name of the database")),
  19 + component(list, extern_type("HK_App", model_types+"hk_app.anubis"), "apps", comment("list of applications"))
  20 + ])
  21 + ]),
  22 +
  23 + ds_type("HK_App", [
  24 + alternative("hk_app", [
  25 + component(string, "app_name"),
  26 + component(extern_type("HK_Icon", model_types+"hk_icon.anubis"), "icon"),
  27 + component(extern_type("HK_Help_Text", model_types+"hk_help_text.anubis"), "help"),
  28 + component(list, extern_type("HK_Table", model_types+"hk_table.anubis"), "hk_tables")
  29 + ])
  30 + ]),
  31 +
  32 + ds_type("HK_Icon", [
  33 + enum("no_icon"),
  34 + alternative("icon16", [
  35 + component(string, "name")
  36 + ])
  37 + ]),
  38 +
  39 + ds_type("HK_Help_Text", [
  40 + enum("no_help_text", comment("no help text available")),
  41 + alternative("help_text_TAG", [
  42 + component(string, "h_text_tag", comment("TAG use with Anubis translation tool /locale/L3.anubis"))
  43 + ]),
  44 + alternative("help_text", [
  45 + component(string, "h_text", comment("pure text to show"))
  46 + ])
  47 + ]),
  48 +
  49 + ds_type("HK_Table", [
  50 + alternative("hk_table", [
  51 + component(string, "name", comment("name of the table")),
  52 + component(string, "short_name", comment("table name without app_name in prefix")),
  53 + component(extern_type("HK_Model", model_types+"hk_model.anubis"), "model"),
  54 + component(extern_type("HK_Display", model_types+"hk_display.anubis"), "display")
  55 + ])
  56 + ]),
  57 +
  58 + ds_type("HK_Model", [
  59 + alternative("hk_model", [
  60 + component(list, extern_type("HK_Model_Column", model_types+"hk_model_column.anubis"), "columns", comment("columns other than the primary key column (if any)")),
  61 + component(string, "show_string")
  62 + ])
  63 + ]),
  64 +
  65 + ds_type("HK_Model_Column", [
  66 + alternative("hk_column", [
  67 + component( string, "name", comment("name of ordinary column (i.e. all but 'id')")),
  68 + component( extern_type("HK_Model_Field", model_types+"hk_model_field.anubis"), "type"),
  69 + component(list, extern_type("HK_Model_Attr", model_types+"hk_model_attr.anubis"), "attributes"),
  70 + component( extern_type("HK_Help_Text", model_types+"hk_help_text.anubis"), "help")
  71 + ])
  72 + ]),
  73 +
  74 + ds_type("HK_Model_Field", [
  75 + enum("p_key"),
  76 + enum("boolean_field", comment("true or false")),
  77 + alternative("date_field", [
  78 + component(extern_type("HK_Datetime_Field_Attr", model_types+"hk_datetime_field_attr.anubis"), "hk_dt_f_attr", comment("date with the precision of the day")),
  79 + ]),
  80 + alternative("time_field", [
  81 + component(extern_type("HK_Datetime_Field_Attr", model_types+"hk_datetime_field_attr.anubis"), "hk_dt_f_attr", comment("time with the precision of the second")),
  82 + ]),
  83 + alternative("datetime_field", [
  84 + component(extern_type("HK_Datetime_Field_Attr", model_types+"hk_datetime_field_attr.anubis"), "hk_dt_f_attr", comment("datetime with the precision of the second")),
  85 + ]),
  86 + alternative("foreign_key", comment("foreign key to 'id' in another (or same) table and column_name for choice selector)"),
  87 + [
  88 + component(extern_type("HK_App_Name", model_types+"hk_app_name.anubis"), "app_name"),
  89 + component(string, "table_name"),
  90 + ]),
  91 + alternative("integer_field", [
  92 + component(extern_type("HK_Int_Choices", model_types+"hk_int_choices.anubis"), "choices", comment("integer of arbitrary size ")),
  93 + ]),
  94 + enum("float_field"),
  95 + alternative("char_field", [
  96 + component(extern_type("HK_Text_Choices", model_types+"hk_text_choices.anubis"), "choices"),
  97 + component(int, "size", comment("text of maximal size 'size' (number of characters)")),
  98 + ]),
  99 + alternative("password_field", [
  100 + component(int, "min_size", comment("the password field doesn't show the password string or store it in hashed version into database")),
  101 + ]),
  102 + alternative("text_field", comment("text of variable size"),
  103 + [
  104 + component(extern_type("HK_Text_Field_Attr", model_types+"hk_text_field_attr.anubis"), "hk_text_field_attr"),
  105 + ])
  106 + ]),
  107 +
  108 + //
  109 + ds_type("HK_Text_Field_Attr", [
  110 + enum("none", comment("Nothing special, normal behaviour")),
  111 + enum("rich_editor", comment("Use richt text editor for that area"))
  112 + ]),
  113 +
  114 + ds_type("HK_Int_Choices", [
  115 + enum("no_choice", comment("No list choice is available. Hence the user must enter the value")),
  116 + alternative("int_choices", [
  117 + component(list, extern_type("HK_Int_Choice", model_types+"hk_int_choice.anubis"), "hk_int_choice", comment("List of possible choices"))
  118 + ])
  119 + ]),
  120 +
  121 + ds_type("HK_Int_Choice", [
  122 + alternative("hk_int_choice", [
  123 + component(int, "value", comment("value to set in database corresponding to description below")),
  124 + component(string, "visible", comment("visible string which help the user to choose teh correct choice"))
  125 + ])
  126 + ]),
  127 +
  128 + ds_type("HK_Text_Choices", [
  129 + enum("no_choice"),
  130 + alternative("text_choices", [
  131 + component(list, extern_type("HK_Text_Choice", model_types+"hk_text_choice.anubis"), "hk_text_choice")
  132 + ])
  133 + ]),
  134 +
  135 + ds_type("HK_Text_Choice", [
  136 + alternative("hk_text_choice", [
  137 + component(string, "value"),
  138 + component(string, "visible")
  139 + ])
  140 + ]),
  141 +
  142 + ds_type("HK_App_Name", [
  143 + enum("this"),
  144 + alternative("app_name", [
  145 + component(string, "name"),
  146 + ]),
  147 + enum("none"),
  148 + ]),
  149 +
  150 + ds_type("HK_Datetime_Field_Attr", [
  151 + enum("none", comment("Nothing special, normal behaviour")),
  152 + enum("auto_now", comment("Always update datetime at SQL update")),
  153 + enum("auto_now_add", comment("Set current datetime when row is created and can't be edited anymore"))
  154 + ]),
  155 +
  156 + ds_type("HK_Model_Attr", [
  157 + enum("unique", comment("by default, the values in a column are not required to be all different ")),
  158 + alternative("default", [
  159 + component(string, "default_str", comment("default value (used in case of creation of a NON NULL column in a table which already contains some rows)")),
  160 + ]),
  161 + enum("not_null"),
  162 + ]),
  163 +
  164 + ds_type("HK_Model_Column", [
  165 + alternative("hk_column", [
  166 + component(string, "name", comment("name of ordinary column (i.e. all but 'id')")),
  167 + component(extern_type("HK_Model_Field", model_types+"hk_model_field.anubis"), "type"),
  168 + component(list, extern_type("HK_Model_Attr", model_types+"hk_model_attr.anubis"), "attributes"),
  169 + component(extern_type("HK_Help_Text", model_types+"hk_help_text.anubis"), "help")
  170 + ])
  171 + ]),
  172 +
  173 + //HK_DISPLAY
  174 + ds_type("HK_Display", [
  175 + alternative("hk_display", [
  176 + component(list, extern_type("HK_List_View", model_types+"hk_list_view.anubis"), "list_views"),
  177 + component(list, extern_type("HK_Edit_View", model_types+"hk_edit_view.anubis"), "list_edits"),
  178 + ])
  179 + ]),
  180 +
  181 + ds_type("HK_List_View", [
  182 + enum("list_view_all"),
  183 + alternative("list_view", [
  184 + component(string, "view_name"),
  185 + component(list, string, "columns"),
  186 + component(extern_type("WEB_Action_Name", "calexium_lib/web/types/web_action_name.anubis"), "link_id_action")
  187 + ])
  188 + ]),
  189 +
  190 + ds_type("HK_Edit_View", [
  191 + enum("edit_view_all"),
  192 + alternative("edit_view", [
  193 + component(string, "view_name"),
  194 + component(list, string, "columns")
  195 + ])
  196 + ]),
  197 +
  198 + ]
  199 +.
... ...
types/model/app.anubis renamed to model/app.anubis
... ... @@ -13,14 +13,7 @@ transmit icons.anubis
13 13 read tools/basis.anubis
14 14 transmit system/muscle.anubis
15 15 transmit calexium_lib/web/CXM_json.anubis
16   -
17   -public type HK_App:
18   - hk_app(
19   - String app_name,
20   - HK_Icon icon,
21   - HK_Help_Text help,
22   - List(HK_Table) hk_tables
23   - ).
  16 +transmit hayamiki_lib/model/types/hk_app.anubis
24 17  
25 18 /* Default constructor for HK_App*/
26 19 public define HK_App
... ... @@ -67,20 +60,6 @@ public define HK_App
67 60 | "icon" | Message | Icon description, contained in message id _HK_ICON
68 61 | "help" | Message | Help string, contained in message id _HK_HELP_TEXT
69 62 | "tables" | List(Message) | List of tables of that application contained in message id _HK_TABLE
70   -
71   -public define Message
72   - to_Message
73   - (
74   - HK_App app
75   - )=
76   - with hk_app_message = message(_HK_APP),
77   - forget(add_string(hk_app_message, "name", app.app_name));
78   - forget(add_message(hk_app_message, "icon", to_Message(app.icon)));
79   - forget(add_message(hk_app_message, "help", to_Message(app.help)));
80   - map_forget((HK_Table table) |-> add_message(hk_app_message, "tables", to_Message(table)), app.hk_tables);
81   - //print_to_stream(hk_app_message);
82   - hk_app_message
83   - .
84 63  
85 64 public define JsonValue
86 65 to_JSON
... ... @@ -94,25 +73,3 @@ public define JsonValue
94 73 json_member("help", to_JSON(app.help)),
95 74 json_member("tables", json_array(map((HK_Table table) |-> to_JSON(table), app.hk_tables)))
96 75 ]).
97   -
98   -
99   -public define Maybe(HK_App)
100   - from_Message
101   - (
102   - Message hk_app_message
103   - )=
104   - if *hk_app_message.what = _HK_APP then
105   - if find_string(hk_app_message, "name") is {failure then failure, success(name) then
106   - if find_message(hk_app_message, "icon") is {failure then failure, success(icon_msg) then
107   - if (Maybe(HK_Icon))from_Message(icon_msg) is {failure then failure, success(icon) then
108   - if find_message(hk_app_message, "help") is {failure then failure, success(help_msg) then
109   - if (Maybe(HK_Help_Text))from_Message(help_msg) is {failure then failure, success(help) then
110   -
111   - with tables = map_escape((Message msg_app) |-> (Maybe(HK_Table))from_Message(msg_app), find_messages(hk_app_message, "tables")),
112   - if tables is {failure then failure, success(table_list) then
113   - //return the application
114   - success(hk_app(name, icon, help, table_list))
115   - }}}}}}
116   - else
117   - failure
118   - .
... ...
types/model/columns.anubis renamed to model/columns.anubis
... ... @@ -11,29 +11,9 @@ read tools/basis.anubis
11 11 transmit help.anubis
12 12 transmit fields.anubis
13 13 transmit calexium_lib/web/CXM_json.anubis
14   -
15   -public type HK_Model_Attr:
16   - unique, // by default, the values in a column are not required to be all different
17   - default(String), // default value (used in case of creation of a NON NULL column
18   - // in a table which already contains some rows)
19   - not_null.
20   -
21   -public define Message
22   - to_Message
23   - (
24   - HK_Model_Attr hk_model_attr
25   - )=
26   - with hk_model_attr_message = message(_HK_COLUMN_ATTRIBUTES),
27   - if hk_model_attr is
28   - {
29   - unique then forget(add_string(hk_model_attr_message, "hk_column_attr", "unique")),
30   -// indexed then forget(add_string(hk_model_attr_message, "hk_column_attr", "indexed")),
31   - default(value) then forget(add_string(hk_model_attr_message, "hk_column_attr", "default"));
32   - forget(add_string(hk_model_attr_message, "value", value)),
33   - not_null then forget(add_string(hk_model_attr_message, "hk_column_attr", "not_null"))
34   - };
35   - hk_model_attr_message
36   - .
  14 +transmit hayamiki_lib/model/types/hk_model_column.anubis
  15 +transmit hayamiki_lib/model/types/hk_model_attr.anubis
  16 +transmit hayamiki_lib/model/types/hk_help_text.anubis
37 17  
38 18 public define JsonValue
39 19 to_JSON
... ... @@ -56,36 +36,10 @@ public define JsonValue
56 36  
57 37 json_object("_HK_COLUMN_ATTRIBUTES", members).
58 38  
59   -public define Maybe(HK_Model_Attr)
60   - from_Message
61   - (
62   - Message hk_model_attr_message
63   - )=
64   - if *hk_model_attr_message.what = _HK_COLUMN_ATTRIBUTES then
65   - if find_string(hk_model_attr_message, "hk_column_attr") is {failure then failure, success(col_attr) then
66   - if col_attr = "unique" then success(unique)
67   -// else if col_attr = "indexed" then success(indexed)
68   - else if col_attr = "default" then
69   - if find_string(hk_model_attr_message, "value") is {failure then failure, success(value) then
70   - success(default(value))
71   - }
72   - else if col_attr = "not_null" then success(not_null)
73   - else failure
74   - }
75   - else
76   - failure
77   - .
78   -
79 39 'HK_Model_Column' (describing a column in a table).
80 40 Description of a column:
81 41  
82   -public type HK_Model_Column:
83   - hk_column (String name, // name of ordinary column (i.e. all but 'id')
84   - HK_Model_Field type,
85   - List(HK_Model_Attr) attributes,
86   - HK_Help_Text help
87   - ).
88   -
  42 +
89 43 /****** DEFAULT CONSTRUCTOR HELPER - part *******/
90 44  
91 45 public define HK_Model_Column
... ... @@ -120,20 +74,7 @@ public define HK_Model_Column
120 74 | "attributes" | List(Message) | List of attributes of the table Message id is _HK_COLUMN_ATTRIBUTES
121 75 | "text" | Message | help text to use during edit screen
122 76  
123   -public define Message
124   - to_Message
125   - (
126   - HK_Model_Column hk_column
127   - )=
128   - with hk_model_column = message(_HK_COLUMN),
129   - forget(add_string(hk_model_column, "name", hk_column.name));
130   - forget(add_message(hk_model_column, "field_type", to_Message(hk_column.type)));
131   - map_forget((HK_Model_Attr attribute) |-> add_message(hk_model_column, "attributes", to_Message(attribute)), hk_column.attributes);
132   - forget(add_message(hk_model_column, "text", to_Message(hk_column.help)));
133   -
134   - //print_to_stream(hk_model_column);
135   - hk_model_column
136   - .
  77 +
137 78  
138 79 public define JsonValue
139 80 to_JSON
... ... @@ -147,25 +88,3 @@ public define JsonValue
147 88 json_member("attributes", json_array(map((HK_Model_Attr attribute) |-> to_JSON(attribute), hk_column.attributes))),
148 89 json_member("text", to_JSON(hk_column.help))
149 90 ]).
150   -
151   -
152   -public define Maybe(HK_Model_Column)
153   - from_Message
154   - (
155   - Message msg_hk_column
156   - )=
157   - if *msg_hk_column.what = _HK_COLUMN then
158   - if find_string(msg_hk_column, "name") is {failure then failure, success(name) then
159   - if find_message(msg_hk_column, "field_type") is {failure then failure, success(field_type_msg) then
160   - if (Maybe(HK_Model_Field))from_Message(field_type_msg) is {failure then failure, success(field_type) then
161   - if find_message(msg_hk_column, "text") is {failure then failure, success(help_msg) then
162   - if (Maybe(HK_Help_Text))from_Message(help_msg) is {failure then failure, success(help) then
163   -
164   - with mb_attribs = map_escape((Message msg_col) |-> (Maybe(HK_Model_Attr))from_Message(msg_col), find_messages(msg_hk_column, "attributes")),
165   - if mb_attribs is {failure then failure, success(attributes_list) then
166   - //return the application
167   - success(hk_column(name, field_type, attributes_list, help))
168   - }}}}}}
169   - else
170   - failure
171   - .
... ...
types/model/database.anubis renamed to model/database.anubis
... ... @@ -12,12 +12,9 @@ transmit tools/basis.anubis
12 12 transmit system/muscle.anubis
13 13 transmit calexium_lib/CXM_message_constants.anubis
14 14 transmit calexium_lib/web/CXM_json.anubis
  15 +transmit hayamiki_lib/model/types/hk_database.anubis
15 16  
16 17  
17   -public type HK_Database:
18   - hk_database (String name, // name of the database
19   - List(HK_App) apps //list of applications
20   - ).
21 18  
22 19  
23 20 _HK_DATABASE message format:
... ... @@ -29,18 +26,7 @@ public type HK_Database:
29 26 | "name" | String | Name of the database
30 27 | "apps" | List(Message) | List of Application of the database the application Message id is _HK_APP
31 28  
32   -public define Message
33   - to_Message
34   - (
35   - HK_Database hk_db
36   - )=
37   - with hk_db_message = message(_HK_DATABASE),
38   - forget(add_string(hk_db_message, "name", hk_db.name));
39   - map_forget((HK_App app) |-> add_message(hk_db_message, "apps", to_Message(app)), hk_db.apps);
40 29  
41   - //print_to_stream(hk_db_message);
42   - hk_db_message
43   - .
44 30  
45 31 _HK_DATABASE JSON format:
46 32 =========================
... ... @@ -68,24 +54,4 @@ public define JsonValue
68 54 json_member("apps", json_array(map((HK_App app) |-> to_JSON(app), hk_db.apps)))
69 55 ]).
70 56  
71   -public define Maybe(HK_Database)
72   - from_Message
73   - (
74   - Message hk_db_message
75   - )=
76   - if *hk_db_message.what = _HK_DATABASE then
77   - if find_string(hk_db_message, "name") is
78   - {
79   - failure then failure,
80   - success(name) then
81   - with app_list = map_escape((Message msg_app) |-> (Maybe(HK_App))from_Message(msg_app), find_messages(hk_db_message, "apps")),
82   - if app_list is
83   - {
84   - failure then failure,
85   - success(apps) then success(hk_database(name, apps))
86   - }
87   - }
88   - else
89   - failure
90   - .
91   -
  57 +
... ...
model/display.anubis 0 → 100644
  1 +/*
  2 + * Created by PyramIDE.
  3 + * User: フランスのトトロ aka (David RENÉ)
  4 + * Date: 13/02/2016
  5 + * Time: 10:36
  6 + * © Calexium
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit tools/basis.anubis
  11 +transmit calexium_lib/CXM_message_constants.anubis
  12 +transmit calexium_lib/web/CXM_json.anubis
  13 +
  14 +transmit hayamiki_lib/model/types/hk_display.anubis
  15 +transmit hayamiki_lib/model/types/hk_list_view.anubis
  16 +transmit hayamiki_lib/model/types/hk_edit_view.anubis
  17 +transmit hayamiki_lib/model/types/hk_icon.anubis
  18 +
  19 +public define HK_List_View
  20 + list_view
  21 + (
  22 + String view_name,
  23 + List(String) columns
  24 + )=
  25 + list_view(view_name, columns, no_action).
  26 +
  27 +
  28 + public define JsonValue
  29 + to_JSON
  30 + (
  31 + HK_List_View list_view
  32 + )=
  33 + with members =
  34 + if list_view is
  35 + {
  36 + list_view_all then
  37 + [ json_member("type", json_string("list_view_all")) ],
  38 +
  39 + list_view(name, columns, link_id_action) then
  40 + [ json_member("type", json_string("list_view")),
  41 + json_member("view_name", json_string(name)),
  42 + json_member("link_id_action", json_string(link_id_action)),
  43 + json_member("columns", json_array(map((String column) |-> json_string(column), columns)))
  44 + ]
  45 + },
  46 +
  47 + json_object("_HK_LIST_VIEW", members).
  48 +
  49 +
  50 +
  51 + _HK_MODEL_DISPLAY message format:
  52 + =========================
  53 + The message string name is "hk_display"
  54 + +--------------+---------------+--------------------------------
  55 + | name | type | description
  56 + +--------------+---------------+--------------------------------
  57 + | "list_edits" | List(Message) | List of (edit list) the Message id is _HK_EDIT_VIEW
  58 + | "list_views" | List(Message) | List of (view list) the Message id is _HK_LIST_VIEW
  59 +
  60 +
  61 +
  62 +
  63 +
  64 +
  65 +public define JsonValue
  66 + to_JSON
  67 + (
  68 + HK_Display display
  69 + )=
  70 + since display is hk_display(list_views, list_edits),
  71 + json_object("_HK_MODEL_DISPLAY",
  72 + [ //json_member("list_views", json_array(map((HK_List_View _view) |-> to_JSON(_view), list_views))),
  73 + //json_member("list_edits", json_array(map((HK_Edit_View _edit) |-> to_JSON(_edit), list_edits)))
  74 + ]
  75 + ).
  76 +
... ...
types/model/fields.anubis renamed to model/fields.anubis
... ... @@ -11,7 +11,13 @@ transmit system/convert.anubis
11 11 transmit system/muscle.anubis
12 12 transmit calexium_lib/CXM_message_constants.anubis
13 13 transmit calexium_lib/web/CXM_json.anubis
14   -
  14 +transmit hayamiki_lib/model/types/hk_model_field.anubis
  15 +transmit hayamiki_lib/model/types/hk_app_name.anubis
  16 +transmit hayamiki_lib/model/types/hk_text_field_attr.anubis
  17 +transmit hayamiki_lib/model/types/hk_datetime_field_attr.anubis
  18 +transmit hayamiki_lib/model/types/hk_int_choices.anubis
  19 +transmit hayamiki_lib/model/types/hk_text_choices.anubis
  20 +
15 21 *** 'HK_Model_Field' (data types of table columns).
16 22  
17 23 From the point of view of your Anubis program, these data will be of types:
... ... @@ -31,26 +37,6 @@ transmit calexium_lib/web/CXM_json.anubis
31 37 text_field | String | arbitrary size text
32 38  
33 39  
34   -public type HK_App_Name:
35   - this,
36   - app_name(String name),
37   - none.
38   -
39   -public define Message
40   - to_Message
41   - (
42   - HK_App_Name hk_app_name
43   - )=
44   - with hk_app_name_message = message(_HK_APP_NAME),
45   - if hk_app_name is
46   - {
47   - this then forget(add_string(hk_app_name_message, "type", "this")),
48   - app_name(name)then forget(add_string(hk_app_name_message, "type", "app_name"));
49   - forget(add_string(hk_app_name_message, "name", name)),
50   - none then forget(add_string(hk_app_name_message, "type", "none"))
51   - };
52   - hk_app_name_message
53   - .
54 40  
55 41 public define JsonValue
56 42 to_JSON
... ... @@ -71,46 +57,6 @@ public define JsonValue
71 57  
72 58 json_object("_HK_APP_NAME", members).
73 59  
74   -public define Maybe(HK_App_Name)
75   - from_Message
76   - (
77   - Message hk_app_name_message
78   - )=
79   - if *hk_app_name_message.what = _HK_APP_NAME then
80   - if find_string(hk_app_name_message, "type") is {failure then failure, success(type) then
81   - if type = "this" then success(this)
82   - else if type = "app_name" then
83   - if find_string(hk_app_name_message, "name") is {failure then failure, success(name) then
84   - success(app_name(name))
85   - }
86   - else if type = "none" then success(none)
87   - else failure
88   - }
89   - else
90   - failure
91   - .
92   -
93   -public type HK_Text_Choice:
94   - hk_text_choice(String value, String visible).
95   -
96   -public type HK_Text_Choices:
97   - no_choice,
98   - text_choices(List(HK_Text_Choice)).
99   -
100   -public type HK_Int_Choice:
101   - hk_int_choice(
102   - Int value, //value to set in database corresponding to description below
103   - String visible //visible string which help the user to choose teh correct choice
104   - ).
105   -
106   -public type HK_Int_Choices:
107   - no_choice, //No list choice is available. Hence the user must enter the value
108   - int_choices(List(HK_Int_Choice)). //List of possible choices
109   -
110   -public type HK_Text_Field_Attr:
111   - none, //Nothing special, normal behaviour
112   - rich_editor. //Use richt text editor for that area
113   -
114 60 define String
115 61 to_String
116 62 (
... ... @@ -151,10 +97,7 @@ define HK_Text_Field_Attr
151 97 success(text_attrib) then to_HK_Text_Field_Attr(text_attrib)
152 98 }.
153 99  
154   -public type HK_Datetime_Field_Attr:
155   - none, //Nothing special, normal behaviour
156   - auto_now, //Always update datetime at SQL update
157   - auto_now_add. //Set current datetime when row is created and can't be edited anymore
  100 +
158 101  
159 102 define String
160 103 to_String
... ... @@ -189,18 +132,6 @@ define HK_Datetime_Field_Attr
189 132 success(dt_attrib) then to_HK_Datetime_Field_Attr(dt_attrib)
190 133 }.
191 134  
192   -public type HK_Model_Field:
193   - p_key,
194   - boolean_field, // true or false
195   - date_field (HK_Datetime_Field_Attr), // date with the precision of the day
196   - time_field (HK_Datetime_Field_Attr), // time with the precision of the second
197   - datetime_field(HK_Datetime_Field_Attr), // datetime with the precision of the second
198   - foreign_key (HK_App_Name app_name, String table_name), // foreign key to 'id' in another (or same) table and column_name for choice selector.
199   - integer_field (HK_Int_Choices choices), // integer of arbitrary size
200   - float_field ,
201   - char_field (HK_Text_Choices choices, Int size), // text of maximal size 'size' (number of characters)
202   - password_field(Int min_size), // the password field doesn't show the password string or store it in hashed version into database
203   - text_field (HK_Text_Field_Attr). // text of variable size
204 135  
205 136 //default initialization
206 137 public define HK_Model_Field
... ... @@ -255,7 +186,7 @@ public define HK_Model_Field
255 186  
256 187 */
257 188  
258   -public define Message
  189 + public define Message
259 190 to_Message
260 191 (
261 192 HK_Model_Field hk_model_field
... ... @@ -371,7 +302,7 @@ public define JsonValue
371 302  
372 303 json_object("_HK_FIELD", members).
373 304  
374   -define Maybe(HK_Model_Field)
  305 + define Maybe(HK_Model_Field)
375 306 get_field
376 307 (
377 308 Message hk_model_field_message,
... ... @@ -400,7 +331,7 @@ define Maybe(HK_Model_Field)
400 331 else failure
401 332 .
402 333  
403   -public define Maybe(HK_Model_Field)
  334 + public define Maybe(HK_Model_Field)
404 335 from_Message
405 336 (
406 337 Message hk_model_field_message
... ...
types/model/help.anubis renamed to model/help.anubis
... ... @@ -10,11 +10,8 @@ transmit tools/basis.anubis
10 10 transmit system/muscle.anubis
11 11 transmit calexium_lib/CXM_message_constants.anubis
12 12 transmit calexium_lib/web/CXM_json.anubis
  13 +transmit hayamiki_lib/model/types/hk_help_text.anubis
13 14  
14   -public type HK_Help_Text:
15   - no_help_text, //no help text available
16   - help_text_TAG(String), //TAG use with Anubis translation tool /locale/L3.anubis
17   - help_text(String). //pure text to show
18 15  
19 16 public define String
20 17 /* Return the Anubis source of the type component
... ... @@ -50,22 +47,7 @@ public define String
50 47  
51 48 */
52 49  
53   -public define Message
54   - to_Message
55   - (
56   - HK_Help_Text hk_help
57   - )=
58   - with hk_help_message = message(_HK_HELP_TEXT),
59   - if hk_help is
60   - {
61   - no_help_text then forget(add_string(hk_help_message, "hk_help_text", "no_help")),
62   - help_text_TAG(tag) then forget(add_string(hk_help_message, "hk_help_text", "TAG"));
63   - forget(add_string(hk_help_message, "value", tag)),
64   - help_text(value) then forget(add_string(hk_help_message, "hk_help_text", "text"));
65   - forget(add_string(hk_help_message, "value", value))
66   - };
67   - hk_help_message
68   - .
  50 +
69 51  
70 52 public define JsonValue
71 53 to_JSON
... ... @@ -86,25 +68,4 @@ public define JsonValue
86 68 },
87 69 json_object("_HK_HELP_TEXT", members).
88 70  
89   -public define Maybe(HK_Help_Text)
90   - from_Message
91   - (
92   - Message hk_help_message
93   - )=
94   - if *hk_help_message.what = _HK_HELP_TEXT then
95   - if find_string(hk_help_message, "hk_help_text") is {failure then failure, success(help_type) then
96   - if help_type = "no_help" then success(no_help_text)
97   - else if help_type = "TAG" then
98   - if find_string(hk_help_message, "value") is {failure then failure, success(value) then
99   - success(help_text_TAG(value))
100   - }
101   - else if help_type = "text" then
102   - if find_string(hk_help_message, "value") is {failure then failure, success(value) then
103   - success(help_text(value))
104   - }
105   - else failure
106   - }
107   - else
108   - failure
109   - .
110 71  
... ...
types/model/icons.anubis renamed to model/icons.anubis
... ... @@ -11,9 +11,7 @@ transmit system/muscle.anubis
11 11 transmit calexium_lib/CXM_message_constants.anubis
12 12 transmit calexium_lib/web/CXM_json.anubis
13 13  
14   -public type HK_Icon:
15   - no_icon,
16   - icon16(String name).
  14 +transmit hayamiki_lib/model/types/hk_icon.anubis
17 15  
18 16 public define String
19 17 /* Return the Anubis source of the type component
... ... @@ -60,20 +58,7 @@ public define String
60 58  
61 59 */
62 60  
63   -public define Message
64   - to_Message
65   - (
66   - HK_Icon hk_icon
67   - )=
68   - with hk_icon_message = message(_HK_ICON),
69   - if hk_icon is
70   - {
71   - no_icon then forget(add_string(hk_icon_message, "hk_icon", "no_icon"));
72   - hk_icon_message,
73   - icon16(icn_str) then forget(add_string(hk_icon_message, "hk_icon", "icon_16"));
74   - forget(add_string(hk_icon_message, "icn_str", icn_str));
75   - hk_icon_message
76   - }.
  61 +
77 62  
78 63 public define JsonValue
79 64 to_JSON
... ... @@ -93,21 +78,3 @@ public define JsonValue
93 78  
94 79 json_object("_HK_ICON", members).
95 80  
96   -public define Maybe(HK_Icon)
97   - from_Message
98   - (
99   - Message hk_icon_message
100   - )=
101   - if *hk_icon_message.what = _HK_ICON then
102   - if find_string(hk_icon_message, "hk_icon") is {failure then failure, success(hk_icon) then
103   - if hk_icon = "no_icon" then success(no_icon)
104   - else if hk_icon = "icon_16" then
105   - if find_string(hk_icon_message, "icn_str") is {failure then failure, success(icn_str) then
106   - success(icon16(icn_str))
107   - }
108   - else failure
109   - }
110   - else
111   - failure
112   - .
113   -
... ...
types/model/model.anubis renamed to model/model.anubis
... ... @@ -9,10 +9,8 @@
9 9 transmit tools/basis.anubis
10 10 transmit columns.anubis
11 11 transmit calexium_lib/web/CXM_json.anubis
  12 +transmit hayamiki_lib/model/types/hk_model.anubis
12 13  
13   -public type HK_Model:
14   - hk_model( List(HK_Model_Column) columns, // columns other than the primary key column (if any)
15   - String show_string).
16 14  
17 15 _HK_MODEL message format:
18 16 ========================
... ... @@ -23,20 +21,6 @@ public type HK_Model:
23 21 | "columns" | List(Message) | List of columns of the table Message id is _HK_COLUMN
24 22 | "show_str" | String | computation String to be shown to summarize row content. This string is Anubis source code
25 23 where the row content is in datum, named "obj".
26   -
27   -
28   -public define Message
29   - to_Message
30   - (
31   - HK_Model hk_model
32   - )=
33   - with hk_model_message = message(_HK_MODEL),
34   - map_forget((HK_Model_Column column) |-> add_message(hk_model_message, "columns", to_Message(column)), hk_model.columns);
35   - forget(add_string(hk_model_message, "show_str", hk_model.show_string));
36   -
37   - //print_to_stream(hk_model_message);
38   - hk_model_message
39   - .
40 24  
41 25 public define JsonValue
42 26 to_JSON
... ... @@ -49,18 +33,3 @@ public define JsonValue
49 33 json_member("show_str", json_string(hk_model.show_string))
50 34 ]).
51 35  
52   -public define Maybe(HK_Model)
53   - from_Message
54   - (
55   - Message hk_model_msg
56   - )=
57   - if *hk_model_msg.what = _HK_MODEL then
58   - if find_string(hk_model_msg, "show_str") is {failure then failure, success(show_str) then
59   - with mb_columns = map_escape((Message column_msg) |-> (Maybe(HK_Model_Column))from_Message(column_msg), find_messages(hk_model_msg, "columns")),
60   - if mb_columns is {failure then failure, success(columns_list) then
61   - //return the model
62   - success(hk_model(columns_list, show_str))
63   - }}
64   - else
65   - failure
66   - .
... ...
types/model/tables.anubis renamed to model/tables.anubis
... ... @@ -11,11 +11,7 @@ transmit display.anubis
11 11 transmit model.anubis
12 12 transmit calexium_lib/web/CXM_json.anubis
13 13  
14   -public type HK_Table:
15   - hk_table ( String name, //name of the table
16   - String short_name, //table name without app_name in prefix
17   - HK_Model model,
18   - HK_Display display).
  14 +transmit hayamiki_lib/model/types/hk_table.anubis
19 15  
20 16 public define HK_Table
21 17 hk_table
... ... @@ -26,31 +22,6 @@ public define HK_Table
26 22 )=
27 23 hk_table(name, "", model, display).
28 24  
29   -
30   - _HK_TABLE message format:
31   - =========================
32   - +--------------+-----------+--------------------------
33   - | name | type | description
34   - +--------------+-----------+--------------------------------
35   - | "name" | String | Name of the table
36   - | "short_name" | String | Name of the table without app_name prefix
37   - | "model" | Message | Model description, contained in message id _HK_MODEL
38   - | "hk_display" | Message | Help string, contained in message id _HK_MODEL_DISPLAY
39   -
40   -
41   -public define Message
42   - to_Message
43   - (
44   - HK_Table table
45   - )=
46   - with hk_table_message = message(_HK_TABLE),
47   - forget(add_string(hk_table_message, "name", table.name));
48   - forget(add_string(hk_table_message, "short_name", table.name));
49   - forget(add_message(hk_table_message, "model", to_Message(table.model)));
50   - forget(add_message(hk_table_message, "hk_display", to_Message(table.display)));
51   - //print_to_stream(hk_table_message);
52   - hk_table_message.
53   -
54 25 public define JsonValue
55 26 to_JSON
56 27 (
... ... @@ -58,27 +29,9 @@ public define JsonValue
58 29 )=
59 30 json_object("_HK_TABLE",
60 31 [ json_member("name", json_string(table.name)),
61   - json_member("short_name", json_string(table.name)),
  32 + json_member("short_name", json_string(table.short_name)),
62 33 json_member("model", to_JSON(table.model)),
63 34 json_member("hk_display", to_JSON(table.display))
64 35 ]
65 36 ).
66 37  
67   -public define Maybe(HK_Table)
68   - from_Message
69   - (
70   - Message table_message
71   - )=
72   - if *table_message.what = _HK_TABLE then
73   - if find_string(table_message, "name") is {failure then failure, success(name) then
74   - if find_string(table_message, "short_name") is {failure then failure, success(short_name) then
75   - if find_message(table_message, "model") is {failure then failure, success(model_msg) then
76   - if (Maybe(HK_Model))from_Message(model_msg) is {failure then failure, success(model) then
77   - if get_hk_display(table_message) is {failure then failure, success(display) then
78   - //return the table
79   - success(hk_table(name, "", model, display))
80   - }}}}}
81   - else
82   - failure
83   - .
84   -
... ...
model/types/hk_app.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:19
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +transmit hayamiki_lib/model/types/hk_table.anubis
  14 +transmit hayamiki_lib/model/types/hk_help_text.anubis
  15 +transmit hayamiki_lib/model/types/hk_icon.anubis
  16 +
  17 +public type HK_App:
  18 + hk_app(
  19 + String app_name,
  20 + HK_Icon icon,
  21 + HK_Help_Text help,
  22 + List(HK_Table) hk_tables
  23 + )
  24 +.
  25 +
  26 + HK_App message format
  27 + =====================
  28 +
  29 +
  30 +public define Message
  31 + to_Message
  32 + (
  33 + HK_App _hk_app
  34 + )=
  35 + with _hk_app_message = message((Word32)0), //
  36 + forget(add_string(_hk_app_message, "__TYPE__", "HK_App"));
  37 + if _hk_app is
  38 + {
  39 + //Alternative hk_app
  40 + hk_app(_app_name, _icon, _help, __hk_tables) then
  41 + forget(add_string(_hk_app_message, "__TYPE_ALT__", "hk_app"));
  42 + // [type = String] hk_app.app_name
  43 + forget(add_string(_hk_app_message, "app_name", _app_name));
  44 + // [type = HK_Icon] hk_app.icon
  45 + forget(add_message(_hk_app_message, "icon", to_Message(_icon)));
  46 + // [type = HK_Help_Text] hk_app.help
  47 + forget(add_message(_hk_app_message, "help", to_Message(_help)));
  48 + // [type = List(HK_Table)] hk_app.hk_tables
  49 + map_forget((HK_Table _hk_tables) |-> add_message(_hk_app_message, "hk_tables", to_Message(_hk_tables)), __hk_tables),
  50 +
  51 + };
  52 + _hk_app_message
  53 +.
  54 +
  55 +public define Maybe(HK_App)
  56 + from_Message
  57 + (
  58 + Message _hk_app_message
  59 + )=
  60 + if find_string(_hk_app_message, "__TYPE__") is {failure then failure, success(__type__) then
  61 + if find_string(_hk_app_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  62 + if __type__ = "HK_App" then
  63 + //Alternative hk_app
  64 + if __type_alt__ = "hk_app" then //Alternative hk_app
  65 + // [type = String] hk_app.app_name
  66 + if find_string(_hk_app_message, "app_name") is {failure then failure, success(app_name) then
  67 + // [type = HK_Icon] hk_app.icon
  68 + if find_message(_hk_app_message, "icon") is {failure then failure, success(icon_msg) then
  69 + if (Maybe(HK_Icon))from_Message(icon_msg) is {failure then failure, success(icon) then
  70 + // [type = HK_Help_Text] hk_app.help
  71 + if find_message(_hk_app_message, "help") is {failure then failure, success(help_msg) then
  72 + if (Maybe(HK_Help_Text))from_Message(help_msg) is {failure then failure, success(help) then
  73 + // [type = List(HK_Table)] hk_app.hk_tables
  74 + with mb_hk_tables = map_escape(( Message msg ) |-> (Maybe(HK_Table)) from_Message(msg), find_messages(_hk_app_message, "hk_tables")),
  75 + if mb_hk_tables is {failure then failure, success(hk_tables) then
  76 +
  77 + success(hk_app(app_name, icon, help, hk_tables))
  78 + }}}}}}
  79 + else
  80 + failure //No valid Alternative found !
  81 + else
  82 + failure //Type not found in message !
  83 + }}
  84 +.
  85 +
... ...
model/types/hk_app_name.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:20
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +
  14 +public type HK_App_Name:
  15 + this,
  16 + app_name(
  17 + String name
  18 + ),
  19 + none
  20 +.
  21 +
  22 + HK_App_Name message format
  23 + ==========================
  24 +
  25 +
  26 +public define Message
  27 + to_Message
  28 + (
  29 + HK_App_Name _hk_app_name
  30 + )=
  31 + with _hk_app_name_message = message((Word32)0), //
  32 + forget(add_string(_hk_app_name_message, "__TYPE__", "HK_App_Name"));
  33 + if _hk_app_name is
  34 + {
  35 + //Alternative this (NO TYPE)
  36 + this then
  37 + forget(add_string(_hk_app_name_message, "__TYPE_ALT__", "this")),
  38 +
  39 + //Alternative app_name
  40 + app_name(_name) then
  41 + forget(add_string(_hk_app_name_message, "__TYPE_ALT__", "app_name"));
  42 + // [type = String] app_name.name
  43 + forget(add_string(_hk_app_name_message, "name", _name)),
  44 +
  45 + //Alternative none (NO TYPE)
  46 + none then
  47 + forget(add_string(_hk_app_name_message, "__TYPE_ALT__", "none")),
  48 +
  49 + };
  50 + _hk_app_name_message
  51 +.
  52 +
  53 +public define Maybe(HK_App_Name)
  54 + from_Message
  55 + (
  56 + Message _hk_app_name_message
  57 + )=
  58 + if find_string(_hk_app_name_message, "__TYPE__") is {failure then failure, success(__type__) then
  59 + if find_string(_hk_app_name_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  60 + if __type__ = "HK_App_Name" then
  61 + //Alternative this (NO TYPE)
  62 + if __type_alt__ = "this" then
  63 + success(this)
  64 + else //Alternative app_name
  65 + if __type_alt__ = "app_name" then //Alternative app_name
  66 + // [type = String] app_name.name
  67 + if find_string(_hk_app_name_message, "name") is {failure then failure, success(name) then
  68 +
  69 + success(app_name(name))
  70 + }
  71 + else //Alternative none (NO TYPE)
  72 + if __type_alt__ = "none" then
  73 + success(none)
  74 + else
  75 + failure //No valid Alternative found !
  76 + else
  77 + failure //Type not found in message !
  78 + }}
  79 +.
  80 +
... ...
model/types/hk_database.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:19
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +transmit hayamiki_lib/model/types/hk_app.anubis
  14 +
  15 +public type HK_Database:
  16 + hk_database(
  17 + String name, //name of the database
  18 + List(HK_App) apps //list of applications
  19 + )
  20 +.
  21 +
  22 + HK_Database message format
  23 + ==========================
  24 +
  25 +
  26 +public define Message
  27 + to_Message
  28 + (
  29 + HK_Database _hk_database
  30 + )=
  31 + with _hk_database_message = message((Word32)0), //
  32 + forget(add_string(_hk_database_message, "__TYPE__", "HK_Database"));
  33 + if _hk_database is
  34 + {
  35 + //Alternative hk_database
  36 + hk_database(_name, __apps) then
  37 + forget(add_string(_hk_database_message, "__TYPE_ALT__", "hk_database"));
  38 + // [type = String] hk_database.name
  39 + forget(add_string(_hk_database_message, "name", _name));
  40 + // [type = List(HK_App)] hk_database.apps
  41 + map_forget((HK_App _apps) |-> add_message(_hk_database_message, "apps", to_Message(_apps)), __apps),
  42 +
  43 + };
  44 + _hk_database_message
  45 +.
  46 +
  47 +public define Maybe(HK_Database)
  48 + from_Message
  49 + (
  50 + Message _hk_database_message
  51 + )=
  52 + if find_string(_hk_database_message, "__TYPE__") is {failure then failure, success(__type__) then
  53 + if find_string(_hk_database_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  54 + if __type__ = "HK_Database" then
  55 + //Alternative hk_database
  56 + if __type_alt__ = "hk_database" then //Alternative hk_database
  57 + // [type = String] hk_database.name
  58 + if find_string(_hk_database_message, "name") is {failure then failure, success(name) then
  59 + // [type = List(HK_App)] hk_database.apps
  60 + with mb_apps = map_escape(( Message msg ) |-> (Maybe(HK_App)) from_Message(msg), find_messages(_hk_database_message, "apps")),
  61 + if mb_apps is {failure then failure, success(apps) then
  62 +
  63 + success(hk_database(name, apps))
  64 + }}
  65 + else
  66 + failure //No valid Alternative found !
  67 + else
  68 + failure //Type not found in message !
  69 + }}
  70 +.
  71 +
... ...
model/types/hk_datetime_field_attr.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:20
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +
  14 +public type HK_Datetime_Field_Attr:
  15 + none, //Nothing special, normal behaviour
  16 + auto_now, //Always update datetime at SQL update
  17 + auto_now_add //Set current datetime when row is created and can't be edited anymore
  18 +.
  19 +
  20 + HK_Datetime_Field_Attr message format
  21 + =====================================
  22 +
  23 +
  24 +public define Message
  25 + to_Message
  26 + (
  27 + HK_Datetime_Field_Attr _hk_datetime_field_attr
  28 + )=
  29 + with _hk_datetime_field_attr_message = message((Word32)0), //
  30 + forget(add_string(_hk_datetime_field_attr_message, "__TYPE__", "HK_Datetime_Field_Attr"));
  31 + if _hk_datetime_field_attr is
  32 + {
  33 + //Alternative none (NO TYPE)
  34 + none then
  35 + forget(add_string(_hk_datetime_field_attr_message, "__TYPE_ALT__", "none")),
  36 +
  37 + //Alternative auto_now (NO TYPE)
  38 + auto_now then
  39 + forget(add_string(_hk_datetime_field_attr_message, "__TYPE_ALT__", "auto_now")),
  40 +
  41 + //Alternative auto_now_add (NO TYPE)
  42 + auto_now_add then
  43 + forget(add_string(_hk_datetime_field_attr_message, "__TYPE_ALT__", "auto_now_add")),
  44 +
  45 + };
  46 + _hk_datetime_field_attr_message
  47 +.
  48 +
  49 +public define Maybe(HK_Datetime_Field_Attr)
  50 + from_Message
  51 + (
  52 + Message _hk_datetime_field_attr_message
  53 + )=
  54 + if find_string(_hk_datetime_field_attr_message, "__TYPE__") is {failure then failure, success(__type__) then
  55 + if find_string(_hk_datetime_field_attr_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  56 + if __type__ = "HK_Datetime_Field_Attr" then
  57 + //Alternative none (NO TYPE)
  58 + if __type_alt__ = "none" then
  59 + success(none)
  60 + else //Alternative auto_now (NO TYPE)
  61 + if __type_alt__ = "auto_now" then
  62 + success(auto_now)
  63 + else //Alternative auto_now_add (NO TYPE)
  64 + if __type_alt__ = "auto_now_add" then
  65 + success(auto_now_add)
  66 + else
  67 + failure //No valid Alternative found !
  68 + else
  69 + failure //Type not found in message !
  70 + }}
  71 +.
  72 +
... ...
model/types/hk_display.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:20
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +transmit hayamiki_lib/model/types/hk_edit_view.anubis
  14 +transmit hayamiki_lib/model/types/hk_list_view.anubis
  15 +
  16 +public type HK_Display:
  17 + hk_display(
  18 + List(HK_List_View) list_views,
  19 + List(HK_Edit_View) list_edits
  20 + )
  21 +.
  22 +
  23 + HK_Display message format
  24 + =========================
  25 +
  26 +
  27 +public define Message
  28 + to_Message
  29 + (
  30 + HK_Display _hk_display
  31 + )=
  32 + with _hk_display_message = message((Word32)0), //
  33 + forget(add_string(_hk_display_message, "__TYPE__", "HK_Display"));
  34 + if _hk_display is
  35 + {
  36 + //Alternative hk_display
  37 + hk_display(__list_views, __list_edits) then
  38 + forget(add_string(_hk_display_message, "__TYPE_ALT__", "hk_display"));
  39 + // [type = List(HK_List_View)] hk_display.list_views
  40 + map_forget((HK_List_View _list_views) |-> add_message(_hk_display_message, "list_views", to_Message(_list_views)), __list_views);
  41 + // [type = List(HK_Edit_View)] hk_display.list_edits
  42 + map_forget((HK_Edit_View _list_edits) |-> add_message(_hk_display_message, "list_edits", to_Message(_list_edits)), __list_edits),
  43 +
  44 + };
  45 + _hk_display_message
  46 +.
  47 +
  48 +public define Maybe(HK_Display)
  49 + from_Message
  50 + (
  51 + Message _hk_display_message
  52 + )=
  53 + if find_string(_hk_display_message, "__TYPE__") is {failure then failure, success(__type__) then
  54 + if find_string(_hk_display_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  55 + if __type__ = "HK_Display" then
  56 + //Alternative hk_display
  57 + if __type_alt__ = "hk_display" then //Alternative hk_display
  58 + // [type = List(HK_List_View)] hk_display.list_views
  59 + with mb_list_views = map_escape(( Message msg ) |-> (Maybe(HK_List_View)) from_Message(msg), find_messages(_hk_display_message, "list_views")),
  60 + if mb_list_views is {failure then failure, success(list_views) then
  61 + // [type = List(HK_Edit_View)] hk_display.list_edits
  62 + with mb_list_edits = map_escape(( Message msg ) |-> (Maybe(HK_Edit_View)) from_Message(msg), find_messages(_hk_display_message, "list_edits")),
  63 + if mb_list_edits is {failure then failure, success(list_edits) then
  64 +
  65 + success(hk_display(list_views, list_edits))
  66 + }}
  67 + else
  68 + failure //No valid Alternative found !
  69 + else
  70 + failure //Type not found in message !
  71 + }}
  72 +.
  73 +
... ...
model/types/hk_edit_view.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:20
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +
  14 +public type HK_Edit_View:
  15 + edit_view_all,
  16 + edit_view(
  17 + String view_name,
  18 + List(String) columns
  19 + )
  20 +.
  21 +
  22 + HK_Edit_View message format
  23 + ===========================
  24 +
  25 +
  26 +public define Message
  27 + to_Message
  28 + (
  29 + HK_Edit_View _hk_edit_view
  30 + )=
  31 + with _hk_edit_view_message = message((Word32)0), //
  32 + forget(add_string(_hk_edit_view_message, "__TYPE__", "HK_Edit_View"));
  33 + if _hk_edit_view is
  34 + {
  35 + //Alternative edit_view_all (NO TYPE)
  36 + edit_view_all then
  37 + forget(add_string(_hk_edit_view_message, "__TYPE_ALT__", "edit_view_all")),
  38 +
  39 + //Alternative edit_view
  40 + edit_view(_view_name, __columns) then
  41 + forget(add_string(_hk_edit_view_message, "__TYPE_ALT__", "edit_view"));
  42 + // [type = String] edit_view.view_name
  43 + forget(add_string(_hk_edit_view_message, "view_name", _view_name));
  44 + // [type = List(String)] edit_view.columns
  45 + map_forget((String _columns) |-> add_string(_hk_edit_view_message, "columns", _columns), __columns),
  46 +
  47 + };
  48 + _hk_edit_view_message
  49 +.
  50 +
  51 +public define Maybe(HK_Edit_View)
  52 + from_Message
  53 + (
  54 + Message _hk_edit_view_message
  55 + )=
  56 + if find_string(_hk_edit_view_message, "__TYPE__") is {failure then failure, success(__type__) then
  57 + if find_string(_hk_edit_view_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  58 + if __type__ = "HK_Edit_View" then
  59 + //Alternative edit_view_all (NO TYPE)
  60 + if __type_alt__ = "edit_view_all" then
  61 + success(edit_view_all)
  62 + else //Alternative edit_view
  63 + if __type_alt__ = "edit_view" then //Alternative edit_view
  64 + // [type = String] edit_view.view_name
  65 + if find_string(_hk_edit_view_message, "view_name") is {failure then failure, success(view_name) then
  66 + // [type = List(String)] edit_view.columns
  67 + with columns = find_string_list(_hk_edit_view_message, "columns"),
  68 +
  69 + success(edit_view(view_name, columns))
  70 + }
  71 + else
  72 + failure //No valid Alternative found !
  73 + else
  74 + failure //Type not found in message !
  75 + }}
  76 +.
  77 +
... ...
model/types/hk_help_text.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:19
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +
  14 +public type HK_Help_Text:
  15 + no_help_text, //no help text available
  16 + help_text_TAG(
  17 + String h_text_tag //TAG use with Anubis translation tool /locale/L3.anubis
  18 + ),
  19 + help_text(
  20 + String h_text //pure text to show
  21 + )
  22 +.
  23 +
  24 + HK_Help_Text message format
  25 + ===========================
  26 +
  27 +
  28 +public define Message
  29 + to_Message
  30 + (
  31 + HK_Help_Text _hk_help_text
  32 + )=
  33 + with _hk_help_text_message = message((Word32)0), //
  34 + forget(add_string(_hk_help_text_message, "__TYPE__", "HK_Help_Text"));
  35 + if _hk_help_text is
  36 + {
  37 + //Alternative no_help_text (NO TYPE)
  38 + no_help_text then
  39 + forget(add_string(_hk_help_text_message, "__TYPE_ALT__", "no_help_text")),
  40 +
  41 + //Alternative help_text_TAG
  42 + help_text_TAG(_h_text_tag) then
  43 + forget(add_string(_hk_help_text_message, "__TYPE_ALT__", "help_text_TAG"));
  44 + // [type = String] help_text_TAG.h_text_tag
  45 + forget(add_string(_hk_help_text_message, "h_text_tag", _h_text_tag)),
  46 +
  47 + //Alternative help_text
  48 + help_text(_h_text) then
  49 + forget(add_string(_hk_help_text_message, "__TYPE_ALT__", "help_text"));
  50 + // [type = String] help_text.h_text
  51 + forget(add_string(_hk_help_text_message, "h_text", _h_text)),
  52 +
  53 + };
  54 + _hk_help_text_message
  55 +.
  56 +
  57 +public define Maybe(HK_Help_Text)
  58 + from_Message
  59 + (
  60 + Message _hk_help_text_message
  61 + )=
  62 + if find_string(_hk_help_text_message, "__TYPE__") is {failure then failure, success(__type__) then
  63 + if find_string(_hk_help_text_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  64 + if __type__ = "HK_Help_Text" then
  65 + //Alternative no_help_text (NO TYPE)
  66 + if __type_alt__ = "no_help_text" then
  67 + success(no_help_text)
  68 + else //Alternative help_text_TAG
  69 + if __type_alt__ = "help_text_TAG" then //Alternative help_text_TAG
  70 + // [type = String] help_text_TAG.h_text_tag
  71 + if find_string(_hk_help_text_message, "h_text_tag") is {failure then failure, success(h_text_tag) then
  72 +
  73 + success(help_text_TAG(h_text_tag))
  74 + }
  75 + else //Alternative help_text
  76 + if __type_alt__ = "help_text" then //Alternative help_text
  77 + // [type = String] help_text.h_text
  78 + if find_string(_hk_help_text_message, "h_text") is {failure then failure, success(h_text) then
  79 +
  80 + success(help_text(h_text))
  81 + }
  82 + else
  83 + failure //No valid Alternative found !
  84 + else
  85 + failure //Type not found in message !
  86 + }}
  87 +.
  88 +
... ...
model/types/hk_icon.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:19
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +
  14 +public type HK_Icon:
  15 + no_icon,
  16 + icon16(
  17 + String name
  18 + )
  19 +.
  20 +
  21 + HK_Icon message format
  22 + ======================
  23 +
  24 +
  25 +public define Message
  26 + to_Message
  27 + (
  28 + HK_Icon _hk_icon
  29 + )=
  30 + with _hk_icon_message = message((Word32)0), //
  31 + forget(add_string(_hk_icon_message, "__TYPE__", "HK_Icon"));
  32 + if _hk_icon is
  33 + {
  34 + //Alternative no_icon (NO TYPE)
  35 + no_icon then
  36 + forget(add_string(_hk_icon_message, "__TYPE_ALT__", "no_icon")),
  37 +
  38 + //Alternative icon16
  39 + icon16(_name) then
  40 + forget(add_string(_hk_icon_message, "__TYPE_ALT__", "icon16"));
  41 + // [type = String] icon16.name
  42 + forget(add_string(_hk_icon_message, "name", _name)),
  43 +
  44 + };
  45 + _hk_icon_message
  46 +.
  47 +
  48 +public define Maybe(HK_Icon)
  49 + from_Message
  50 + (
  51 + Message _hk_icon_message
  52 + )=
  53 + if find_string(_hk_icon_message, "__TYPE__") is {failure then failure, success(__type__) then
  54 + if find_string(_hk_icon_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  55 + if __type__ = "HK_Icon" then
  56 + //Alternative no_icon (NO TYPE)
  57 + if __type_alt__ = "no_icon" then
  58 + success(no_icon)
  59 + else //Alternative icon16
  60 + if __type_alt__ = "icon16" then //Alternative icon16
  61 + // [type = String] icon16.name
  62 + if find_string(_hk_icon_message, "name") is {failure then failure, success(name) then
  63 +
  64 + success(icon16(name))
  65 + }
  66 + else
  67 + failure //No valid Alternative found !
  68 + else
  69 + failure //Type not found in message !
  70 + }}
  71 +.
  72 +
... ...
model/types/hk_int_choice.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:20
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +
  14 +public type HK_Int_Choice:
  15 + hk_int_choice(
  16 + Int value, //value to set in database corresponding to description below
  17 + String visible //visible string which help the user to choose teh correct choice
  18 + )
  19 +.
  20 +
  21 + HK_Int_Choice message format
  22 + ============================
  23 +
  24 +
  25 +public define Message
  26 + to_Message
  27 + (
  28 + HK_Int_Choice _hk_int_choice
  29 + )=
  30 + with _hk_int_choice_message = message((Word32)0), //
  31 + forget(add_string(_hk_int_choice_message, "__TYPE__", "HK_Int_Choice"));
  32 + if _hk_int_choice is
  33 + {
  34 + //Alternative hk_int_choice
  35 + hk_int_choice(_value, _visible) then
  36 + forget(add_string(_hk_int_choice_message, "__TYPE_ALT__", "hk_int_choice"));
  37 + // [type = Int] hk_int_choice.value
  38 + forget(add_string(_hk_int_choice_message, "value", to_String(_value)));
  39 + // [type = String] hk_int_choice.visible
  40 + forget(add_string(_hk_int_choice_message, "visible", _visible)),
  41 +
  42 + };
  43 + _hk_int_choice_message
  44 +.
  45 +
  46 +public define Maybe(HK_Int_Choice)
  47 + from_Message
  48 + (
  49 + Message _hk_int_choice_message
  50 + )=
  51 + if find_string(_hk_int_choice_message, "__TYPE__") is {failure then failure, success(__type__) then
  52 + if find_string(_hk_int_choice_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  53 + if __type__ = "HK_Int_Choice" then
  54 + //Alternative hk_int_choice
  55 + if __type_alt__ = "hk_int_choice" then //Alternative hk_int_choice
  56 + // [type = Int] hk_int_choice.value
  57 + if find_string(_hk_int_choice_message, "value") is {failure then failure, success(_value) then
  58 + if decimal_scan(_value) is { failure then failure, success(value) then
  59 + // [type = String] hk_int_choice.visible
  60 + if find_string(_hk_int_choice_message, "visible") is {failure then failure, success(visible) then
  61 +
  62 + success(hk_int_choice(value, visible))
  63 + }}}
  64 + else
  65 + failure //No valid Alternative found !
  66 + else
  67 + failure //Type not found in message !
  68 + }}
  69 +.
  70 +
... ...
model/types/hk_int_choices.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:20
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +transmit hayamiki_lib/model/types/hk_int_choice.anubis
  14 +
  15 +public type HK_Int_Choices:
  16 + no_choice, //No list choice is available. Hence the user must enter the value
  17 + int_choices(
  18 + List(HK_Int_Choice) hk_int_choice //List of possible choices
  19 + )
  20 +.
  21 +
  22 + HK_Int_Choices message format
  23 + =============================
  24 +
  25 +
  26 +public define Message
  27 + to_Message
  28 + (
  29 + HK_Int_Choices _hk_int_choices
  30 + )=
  31 + with _hk_int_choices_message = message((Word32)0), //
  32 + forget(add_string(_hk_int_choices_message, "__TYPE__", "HK_Int_Choices"));
  33 + if _hk_int_choices is
  34 + {
  35 + //Alternative no_choice (NO TYPE)
  36 + no_choice then
  37 + forget(add_string(_hk_int_choices_message, "__TYPE_ALT__", "no_choice")),
  38 +
  39 + //Alternative int_choices
  40 + int_choices(__hk_int_choice) then
  41 + forget(add_string(_hk_int_choices_message, "__TYPE_ALT__", "int_choices"));
  42 + // [type = List(HK_Int_Choice)] int_choices.hk_int_choice
  43 + map_forget((HK_Int_Choice _hk_int_choice) |-> add_message(_hk_int_choices_message, "hk_int_choice", to_Message(_hk_int_choice)), __hk_int_choice),
  44 +
  45 + };
  46 + _hk_int_choices_message
  47 +.
  48 +
  49 +public define Maybe(HK_Int_Choices)
  50 + from_Message
  51 + (
  52 + Message _hk_int_choices_message
  53 + )=
  54 + if find_string(_hk_int_choices_message, "__TYPE__") is {failure then failure, success(__type__) then
  55 + if find_string(_hk_int_choices_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  56 + if __type__ = "HK_Int_Choices" then
  57 + //Alternative no_choice (NO TYPE)
  58 + if __type_alt__ = "no_choice" then
  59 + success(no_choice)
  60 + else //Alternative int_choices
  61 + if __type_alt__ = "int_choices" then //Alternative int_choices
  62 + // [type = List(HK_Int_Choice)] int_choices.hk_int_choice
  63 + with mb_hk_int_choice = map_escape(( Message msg ) |-> (Maybe(HK_Int_Choice)) from_Message(msg), find_messages(_hk_int_choices_message, "hk_int_choice")),
  64 + if mb_hk_int_choice is {failure then failure, success(hk_int_choice) then
  65 +
  66 + success(int_choices(hk_int_choice))
  67 + }
  68 + else
  69 + failure //No valid Alternative found !
  70 + else
  71 + failure //Type not found in message !
  72 + }}
  73 +.
  74 +
... ...
model/types/hk_list_view.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:20
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +transmit calexium_lib/web/types/web_action_name.anubis
  14 +
  15 +public type HK_List_View:
  16 + list_view_all,
  17 + list_view(
  18 + String view_name,
  19 + List(String) columns,
  20 + WEB_Action_Name link_id_action
  21 + )
  22 +.
  23 +
  24 + HK_List_View message format
  25 + ===========================
  26 +
  27 +
  28 +public define Message
  29 + to_Message
  30 + (
  31 + HK_List_View _hk_list_view
  32 + )=
  33 + with _hk_list_view_message = message((Word32)0), //
  34 + forget(add_string(_hk_list_view_message, "__TYPE__", "HK_List_View"));
  35 + if _hk_list_view is
  36 + {
  37 + //Alternative list_view_all (NO TYPE)
  38 + list_view_all then
  39 + forget(add_string(_hk_list_view_message, "__TYPE_ALT__", "list_view_all")),
  40 +
  41 + //Alternative list_view
  42 + list_view(_view_name, __columns, _link_id_action) then
  43 + forget(add_string(_hk_list_view_message, "__TYPE_ALT__", "list_view"));
  44 + // [type = String] list_view.view_name
  45 + forget(add_string(_hk_list_view_message, "view_name", _view_name));
  46 + // [type = List(String)] list_view.columns
  47 + map_forget((String _columns) |-> add_string(_hk_list_view_message, "columns", _columns), __columns);
  48 + // [type = WEB_Action_Name] list_view.link_id_action
  49 + forget(add_message(_hk_list_view_message, "link_id_action", to_Message(_link_id_action))),
  50 +
  51 + };
  52 + _hk_list_view_message
  53 +.
  54 +
  55 +public define Maybe(HK_List_View)
  56 + from_Message
  57 + (
  58 + Message _hk_list_view_message
  59 + )=
  60 + if find_string(_hk_list_view_message, "__TYPE__") is {failure then failure, success(__type__) then
  61 + if find_string(_hk_list_view_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  62 + if __type__ = "HK_List_View" then
  63 + //Alternative list_view_all (NO TYPE)
  64 + if __type_alt__ = "list_view_all" then
  65 + success(list_view_all)
  66 + else //Alternative list_view
  67 + if __type_alt__ = "list_view" then //Alternative list_view
  68 + // [type = String] list_view.view_name
  69 + if find_string(_hk_list_view_message, "view_name") is {failure then failure, success(view_name) then
  70 + // [type = List(String)] list_view.columns
  71 + with columns = find_string_list(_hk_list_view_message, "columns"),
  72 + // [type = WEB_Action_Name] list_view.link_id_action
  73 + if find_message(_hk_list_view_message, "link_id_action") is {failure then failure, success(link_id_action_msg) then
  74 + if (Maybe(WEB_Action_Name))from_Message(link_id_action_msg) is {failure then failure, success(link_id_action) then
  75 +
  76 + success(list_view(view_name, columns, link_id_action))
  77 + }}}
  78 + else
  79 + failure //No valid Alternative found !
  80 + else
  81 + failure //Type not found in message !
  82 + }}
  83 +.
  84 +
... ...
model/types/hk_model.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:19
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +transmit hayamiki_lib/model/types/hk_model_column.anubis
  14 +
  15 +public type HK_Model:
  16 + hk_model(
  17 + List(HK_Model_Column) columns, //columns other than the primary key column (if any)
  18 + String show_string
  19 + )
  20 +.
  21 +
  22 + HK_Model message format
  23 + =======================
  24 +
  25 +
  26 +public define Message
  27 + to_Message
  28 + (
  29 + HK_Model _hk_model
  30 + )=
  31 + with _hk_model_message = message((Word32)0), //
  32 + forget(add_string(_hk_model_message, "__TYPE__", "HK_Model"));
  33 + if _hk_model is
  34 + {
  35 + //Alternative hk_model
  36 + hk_model(__columns, _show_string) then
  37 + forget(add_string(_hk_model_message, "__TYPE_ALT__", "hk_model"));
  38 + // [type = List(HK_Model_Column)] hk_model.columns
  39 + map_forget((HK_Model_Column _columns) |-> add_message(_hk_model_message, "columns", to_Message(_columns)), __columns);
  40 + // [type = String] hk_model.show_string
  41 + forget(add_string(_hk_model_message, "show_string", _show_string)),
  42 +
  43 + };
  44 + _hk_model_message
  45 +.
  46 +
  47 +public define Maybe(HK_Model)
  48 + from_Message
  49 + (
  50 + Message _hk_model_message
  51 + )=
  52 + if find_string(_hk_model_message, "__TYPE__") is {failure then failure, success(__type__) then
  53 + if find_string(_hk_model_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  54 + if __type__ = "HK_Model" then
  55 + //Alternative hk_model
  56 + if __type_alt__ = "hk_model" then //Alternative hk_model
  57 + // [type = List(HK_Model_Column)] hk_model.columns
  58 + with mb_columns = map_escape(( Message msg ) |-> (Maybe(HK_Model_Column)) from_Message(msg), find_messages(_hk_model_message, "columns")),
  59 + if mb_columns is {failure then failure, success(columns) then
  60 + // [type = String] hk_model.show_string
  61 + if find_string(_hk_model_message, "show_string") is {failure then failure, success(show_string) then
  62 +
  63 + success(hk_model(columns, show_string))
  64 + }}
  65 + else
  66 + failure //No valid Alternative found !
  67 + else
  68 + failure //Type not found in message !
  69 + }}
  70 +.
  71 +
... ...
model/types/hk_model_attr.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:20
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +
  14 +public type HK_Model_Attr:
  15 + unique, //by default, the values in a column are not required to be all different
  16 + default(
  17 + String default_str //default value (used in case of creation of a NON NULL column in a table which already contains some rows)
  18 + ),
  19 + not_null
  20 +.
  21 +
  22 + HK_Model_Attr message format
  23 + ============================
  24 +
  25 +
  26 +public define Message
  27 + to_Message
  28 + (
  29 + HK_Model_Attr _hk_model_attr
  30 + )=
  31 + with _hk_model_attr_message = message((Word32)0), //
  32 + forget(add_string(_hk_model_attr_message, "__TYPE__", "HK_Model_Attr"));
  33 + if _hk_model_attr is
  34 + {
  35 + //Alternative unique (NO TYPE)
  36 + unique then
  37 + forget(add_string(_hk_model_attr_message, "__TYPE_ALT__", "unique")),
  38 +
  39 + //Alternative default
  40 + default(_default_str) then
  41 + forget(add_string(_hk_model_attr_message, "__TYPE_ALT__", "default"));
  42 + // [type = String] default.default_str
  43 + forget(add_string(_hk_model_attr_message, "default_str", _default_str)),
  44 +
  45 + //Alternative not_null (NO TYPE)
  46 + not_null then
  47 + forget(add_string(_hk_model_attr_message, "__TYPE_ALT__", "not_null")),
  48 +
  49 + };
  50 + _hk_model_attr_message
  51 +.
  52 +
  53 +public define Maybe(HK_Model_Attr)
  54 + from_Message
  55 + (
  56 + Message _hk_model_attr_message
  57 + )=
  58 + if find_string(_hk_model_attr_message, "__TYPE__") is {failure then failure, success(__type__) then
  59 + if find_string(_hk_model_attr_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  60 + if __type__ = "HK_Model_Attr" then
  61 + //Alternative unique (NO TYPE)
  62 + if __type_alt__ = "unique" then
  63 + success(unique)
  64 + else //Alternative default
  65 + if __type_alt__ = "default" then //Alternative default
  66 + // [type = String] default.default_str
  67 + if find_string(_hk_model_attr_message, "default_str") is {failure then failure, success(default_str) then
  68 +
  69 + success(default(default_str))
  70 + }
  71 + else //Alternative not_null (NO TYPE)
  72 + if __type_alt__ = "not_null" then
  73 + success(not_null)
  74 + else
  75 + failure //No valid Alternative found !
  76 + else
  77 + failure //Type not found in message !
  78 + }}
  79 +.
  80 +
... ...
model/types/hk_model_column.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:20
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +transmit hayamiki_lib/model/types/hk_help_text.anubis
  14 +transmit hayamiki_lib/model/types/hk_model_attr.anubis
  15 +transmit hayamiki_lib/model/types/hk_model_field.anubis
  16 +
  17 +public type HK_Model_Column:
  18 + hk_column(
  19 + String name, //name of ordinary column (i.e. all but 'id')
  20 + HK_Model_Field type,
  21 + List(HK_Model_Attr) attributes,
  22 + HK_Help_Text help
  23 + )
  24 +.
  25 +
  26 + HK_Model_Column message format
  27 + ==============================
  28 +
  29 +
  30 +public define Message
  31 + to_Message
  32 + (
  33 + HK_Model_Column _hk_model_column
  34 + )=
  35 + with _hk_model_column_message = message((Word32)0), //
  36 + forget(add_string(_hk_model_column_message, "__TYPE__", "HK_Model_Column"));
  37 + if _hk_model_column is
  38 + {
  39 + //Alternative hk_column
  40 + hk_column(_name, _type, __attributes, _help) then
  41 + forget(add_string(_hk_model_column_message, "__TYPE_ALT__", "hk_column"));
  42 + // [type = String] hk_column.name
  43 + forget(add_string(_hk_model_column_message, "name", _name));
  44 + // [type = HK_Model_Field] hk_column.type
  45 + forget(add_message(_hk_model_column_message, "type", to_Message(_type)));
  46 + // [type = List(HK_Model_Attr)] hk_column.attributes
  47 + map_forget((HK_Model_Attr _attributes) |-> add_message(_hk_model_column_message, "attributes", to_Message(_attributes)), __attributes);
  48 + // [type = HK_Help_Text] hk_column.help
  49 + forget(add_message(_hk_model_column_message, "help", to_Message(_help))),
  50 +
  51 + };
  52 + _hk_model_column_message
  53 +.
  54 +
  55 +public define Maybe(HK_Model_Column)
  56 + from_Message
  57 + (
  58 + Message _hk_model_column_message
  59 + )=
  60 + if find_string(_hk_model_column_message, "__TYPE__") is {failure then failure, success(__type__) then
  61 + if find_string(_hk_model_column_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  62 + if __type__ = "HK_Model_Column" then
  63 + //Alternative hk_column
  64 + if __type_alt__ = "hk_column" then //Alternative hk_column
  65 + // [type = String] hk_column.name
  66 + if find_string(_hk_model_column_message, "name") is {failure then failure, success(name) then
  67 + // [type = HK_Model_Field] hk_column.type
  68 + if find_message(_hk_model_column_message, "type") is {failure then failure, success(type_msg) then
  69 + if (Maybe(HK_Model_Field))from_Message(type_msg) is {failure then failure, success(type) then
  70 + // [type = List(HK_Model_Attr)] hk_column.attributes
  71 + with mb_attributes = map_escape(( Message msg ) |-> (Maybe(HK_Model_Attr)) from_Message(msg), find_messages(_hk_model_column_message, "attributes")),
  72 + if mb_attributes is {failure then failure, success(attributes) then
  73 + // [type = HK_Help_Text] hk_column.help
  74 + if find_message(_hk_model_column_message, "help") is {failure then failure, success(help_msg) then
  75 + if (Maybe(HK_Help_Text))from_Message(help_msg) is {failure then failure, success(help) then
  76 +
  77 + success(hk_column(name, type, attributes, help))
  78 + }}}}}}
  79 + else
  80 + failure //No valid Alternative found !
  81 + else
  82 + failure //Type not found in message !
  83 + }}
  84 +.
  85 +
... ...
model/types/hk_model_field.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:19
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +transmit hayamiki_lib/model/types/hk_text_field_attr.anubis
  14 +transmit hayamiki_lib/model/types/hk_text_choices.anubis
  15 +transmit hayamiki_lib/model/types/hk_int_choices.anubis
  16 +transmit hayamiki_lib/model/types/hk_app_name.anubis
  17 +transmit hayamiki_lib/model/types/hk_datetime_field_attr.anubis
  18 +
  19 +public type HK_Model_Field:
  20 + p_key,
  21 + boolean_field, //true or false
  22 + date_field(
  23 + HK_Datetime_Field_Attr hk_dt_f_attr //date with the precision of the day
  24 + ),
  25 + time_field(
  26 + HK_Datetime_Field_Attr hk_dt_f_attr //time with the precision of the second
  27 + ),
  28 + datetime_field(
  29 + HK_Datetime_Field_Attr hk_dt_f_attr //datetime with the precision of the second
  30 + ),
  31 + //foreign key to 'id' in another (or same) table and column_name for choice selector)
  32 +
  33 + foreign_key(
  34 + HK_App_Name app_name,
  35 + String table_name
  36 + ),
  37 + integer_field(
  38 + HK_Int_Choices choices //integer of arbitrary size
  39 + ),
  40 + float_field,
  41 + char_field(
  42 + HK_Text_Choices choices,
  43 + Int size //text of maximal size 'size' (number of characters)
  44 + ),
  45 + password_field(
  46 + Int min_size //the password field doesn't show the password string or store it in hashed version into database
  47 + ),
  48 + //text of variable size
  49 +
  50 + text_field(
  51 + HK_Text_Field_Attr hk_text_field_attr
  52 + )
  53 +.
  54 +
  55 + HK_Model_Field message format
  56 + =============================
  57 +
  58 +
  59 +public define Message
  60 + to_Message
  61 + (
  62 + HK_Model_Field _hk_model_field
  63 + )=
  64 + with _hk_model_field_message = message((Word32)0), //
  65 + forget(add_string(_hk_model_field_message, "__TYPE__", "HK_Model_Field"));
  66 + if _hk_model_field is
  67 + {
  68 + //Alternative p_key (NO TYPE)
  69 + p_key then
  70 + forget(add_string(_hk_model_field_message, "__TYPE_ALT__", "p_key")),
  71 +
  72 + //Alternative boolean_field (NO TYPE)
  73 + boolean_field then
  74 + forget(add_string(_hk_model_field_message, "__TYPE_ALT__", "boolean_field")),
  75 +
  76 + //Alternative date_field
  77 + date_field(_hk_dt_f_attr) then
  78 + forget(add_string(_hk_model_field_message, "__TYPE_ALT__", "date_field"));
  79 + // [type = HK_Datetime_Field_Attr] date_field.hk_dt_f_attr
  80 + forget(add_message(_hk_model_field_message, "hk_dt_f_attr", to_Message(_hk_dt_f_attr))),
  81 +
  82 + //Alternative time_field
  83 + time_field(_hk_dt_f_attr) then
  84 + forget(add_string(_hk_model_field_message, "__TYPE_ALT__", "time_field"));
  85 + // [type = HK_Datetime_Field_Attr] time_field.hk_dt_f_attr
  86 + forget(add_message(_hk_model_field_message, "hk_dt_f_attr", to_Message(_hk_dt_f_attr))),
  87 +
  88 + //Alternative datetime_field
  89 + datetime_field(_hk_dt_f_attr) then
  90 + forget(add_string(_hk_model_field_message, "__TYPE_ALT__", "datetime_field"));
  91 + // [type = HK_Datetime_Field_Attr] datetime_field.hk_dt_f_attr
  92 + forget(add_message(_hk_model_field_message, "hk_dt_f_attr", to_Message(_hk_dt_f_attr))),
  93 +
  94 + //Alternative foreign_key
  95 + //foreign key to 'id' in another (or same) table and column_name for choice selector)
  96 + foreign_key(_app_name, _table_name) then
  97 + forget(add_string(_hk_model_field_message, "__TYPE_ALT__", "foreign_key"));
  98 + // [type = HK_App_Name] foreign_key.app_name
  99 + forget(add_message(_hk_model_field_message, "app_name", to_Message(_app_name)));
  100 + // [type = String] foreign_key.table_name
  101 + forget(add_string(_hk_model_field_message, "table_name", _table_name)),
  102 +
  103 + //Alternative integer_field
  104 + integer_field(_choices) then
  105 + forget(add_string(_hk_model_field_message, "__TYPE_ALT__", "integer_field"));
  106 + // [type = HK_Int_Choices] integer_field.choices
  107 + forget(add_message(_hk_model_field_message, "choices", to_Message(_choices))),
  108 +
  109 + //Alternative float_field (NO TYPE)
  110 + float_field then
  111 + forget(add_string(_hk_model_field_message, "__TYPE_ALT__", "float_field")),
  112 +
  113 + //Alternative char_field
  114 + char_field(_choices, _size) then
  115 + forget(add_string(_hk_model_field_message, "__TYPE_ALT__", "char_field"));
  116 + // [type = HK_Text_Choices] char_field.choices
  117 + forget(add_message(_hk_model_field_message, "choices", to_Message(_choices)));
  118 + // [type = Int] char_field.size
  119 + forget(add_string(_hk_model_field_message, "size", to_String(_size))),
  120 +
  121 + //Alternative password_field
  122 + password_field(_min_size) then
  123 + forget(add_string(_hk_model_field_message, "__TYPE_ALT__", "password_field"));
  124 + // [type = Int] password_field.min_size
  125 + forget(add_string(_hk_model_field_message, "min_size", to_String(_min_size))),
  126 +
  127 + //Alternative text_field
  128 + //text of variable size
  129 + text_field(_hk_text_field_attr) then
  130 + forget(add_string(_hk_model_field_message, "__TYPE_ALT__", "text_field"));
  131 + // [type = HK_Text_Field_Attr] text_field.hk_text_field_attr
  132 + forget(add_message(_hk_model_field_message, "hk_text_field_attr", to_Message(_hk_text_field_attr))),
  133 +
  134 + };
  135 + _hk_model_field_message
  136 +.
  137 +
  138 +public define Maybe(HK_Model_Field)
  139 + from_Message
  140 + (
  141 + Message _hk_model_field_message
  142 + )=
  143 + if find_string(_hk_model_field_message, "__TYPE__") is {failure then failure, success(__type__) then
  144 + if find_string(_hk_model_field_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  145 + if __type__ = "HK_Model_Field" then
  146 + //Alternative p_key (NO TYPE)
  147 + if __type_alt__ = "p_key" then
  148 + success(p_key)
  149 + else //Alternative boolean_field (NO TYPE)
  150 + if __type_alt__ = "boolean_field" then
  151 + success(boolean_field)
  152 + else //Alternative date_field
  153 + if __type_alt__ = "date_field" then //Alternative date_field
  154 + // [type = HK_Datetime_Field_Attr] date_field.hk_dt_f_attr
  155 + if find_message(_hk_model_field_message, "hk_dt_f_attr") is {failure then failure, success(hk_dt_f_attr_msg) then
  156 + if (Maybe(HK_Datetime_Field_Attr))from_Message(hk_dt_f_attr_msg) is {failure then failure, success(hk_dt_f_attr) then
  157 +
  158 + success(date_field(hk_dt_f_attr))
  159 + }}
  160 + else //Alternative time_field
  161 + if __type_alt__ = "time_field" then //Alternative time_field
  162 + // [type = HK_Datetime_Field_Attr] time_field.hk_dt_f_attr
  163 + if find_message(_hk_model_field_message, "hk_dt_f_attr") is {failure then failure, success(hk_dt_f_attr_msg) then
  164 + if (Maybe(HK_Datetime_Field_Attr))from_Message(hk_dt_f_attr_msg) is {failure then failure, success(hk_dt_f_attr) then
  165 +
  166 + success(time_field(hk_dt_f_attr))
  167 + }}
  168 + else //Alternative datetime_field
  169 + if __type_alt__ = "datetime_field" then //Alternative datetime_field
  170 + // [type = HK_Datetime_Field_Attr] datetime_field.hk_dt_f_attr
  171 + if find_message(_hk_model_field_message, "hk_dt_f_attr") is {failure then failure, success(hk_dt_f_attr_msg) then
  172 + if (Maybe(HK_Datetime_Field_Attr))from_Message(hk_dt_f_attr_msg) is {failure then failure, success(hk_dt_f_attr) then
  173 +
  174 + success(datetime_field(hk_dt_f_attr))
  175 + }}
  176 + else //Alternative foreign_key
  177 + //foreign key to 'id' in another (or same) table and column_name for choice selector)
  178 + if __type_alt__ = "foreign_key" then //Alternative foreign_key
  179 + // [type = HK_App_Name] foreign_key.app_name
  180 + if find_message(_hk_model_field_message, "app_name") is {failure then failure, success(app_name_msg) then
  181 + if (Maybe(HK_App_Name))from_Message(app_name_msg) is {failure then failure, success(app_name) then
  182 + // [type = String] foreign_key.table_name
  183 + if find_string(_hk_model_field_message, "table_name") is {failure then failure, success(table_name) then
  184 +
  185 + success(foreign_key(app_name, table_name))
  186 + }}}
  187 + else //Alternative integer_field
  188 + if __type_alt__ = "integer_field" then //Alternative integer_field
  189 + // [type = HK_Int_Choices] integer_field.choices
  190 + if find_message(_hk_model_field_message, "choices") is {failure then failure, success(choices_msg) then
  191 + if (Maybe(HK_Int_Choices))from_Message(choices_msg) is {failure then failure, success(choices) then
  192 +
  193 + success(integer_field(choices))
  194 + }}
  195 + else //Alternative float_field (NO TYPE)
  196 + if __type_alt__ = "float_field" then
  197 + success(float_field)
  198 + else //Alternative char_field
  199 + if __type_alt__ = "char_field" then //Alternative char_field
  200 + // [type = HK_Text_Choices] char_field.choices
  201 + if find_message(_hk_model_field_message, "choices") is {failure then failure, success(choices_msg) then
  202 + if (Maybe(HK_Text_Choices))from_Message(choices_msg) is {failure then failure, success(choices) then
  203 + // [type = Int] char_field.size
  204 + if find_string(_hk_model_field_message, "size") is {failure then failure, success(_size) then
  205 + if decimal_scan(_size) is { failure then failure, success(size) then
  206 +
  207 + success(char_field(choices, size))
  208 + }}}}
  209 + else //Alternative password_field
  210 + if __type_alt__ = "password_field" then //Alternative password_field
  211 + // [type = Int] password_field.min_size
  212 + if find_string(_hk_model_field_message, "min_size") is {failure then failure, success(_min_size) then
  213 + if decimal_scan(_min_size) is { failure then failure, success(min_size) then
  214 +
  215 + success(password_field(min_size))
  216 + }}
  217 + else //Alternative text_field
  218 + //text of variable size
  219 + if __type_alt__ = "text_field" then //Alternative text_field
  220 + // [type = HK_Text_Field_Attr] text_field.hk_text_field_attr
  221 + if find_message(_hk_model_field_message, "hk_text_field_attr") is {failure then failure, success(hk_text_field_attr_msg) then
  222 + if (Maybe(HK_Text_Field_Attr))from_Message(hk_text_field_attr_msg) is {failure then failure, success(hk_text_field_attr) then
  223 +
  224 + success(text_field(hk_text_field_attr))
  225 + }}
  226 + else
  227 + failure //No valid Alternative found !
  228 + else
  229 + failure //Type not found in message !
  230 + }}
  231 +.
  232 +
... ...
model/types/hk_table.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:19
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +transmit hayamiki_lib/model/types/hk_display.anubis
  14 +transmit hayamiki_lib/model/types/hk_model.anubis
  15 +
  16 +public type HK_Table:
  17 + hk_table(
  18 + String name, //name of the table
  19 + String short_name, //table name without app_name in prefix
  20 + HK_Model model,
  21 + HK_Display display
  22 + )
  23 +.
  24 +
  25 + HK_Table message format
  26 + =======================
  27 +
  28 +
  29 +public define Message
  30 + to_Message
  31 + (
  32 + HK_Table _hk_table
  33 + )=
  34 + with _hk_table_message = message((Word32)0), //
  35 + forget(add_string(_hk_table_message, "__TYPE__", "HK_Table"));
  36 + if _hk_table is
  37 + {
  38 + //Alternative hk_table
  39 + hk_table(_name, _short_name, _model, _display) then
  40 + forget(add_string(_hk_table_message, "__TYPE_ALT__", "hk_table"));
  41 + // [type = String] hk_table.name
  42 + forget(add_string(_hk_table_message, "name", _name));
  43 + // [type = String] hk_table.short_name
  44 + forget(add_string(_hk_table_message, "short_name", _short_name));
  45 + // [type = HK_Model] hk_table.model
  46 + forget(add_message(_hk_table_message, "model", to_Message(_model)));
  47 + // [type = HK_Display] hk_table.display
  48 + forget(add_message(_hk_table_message, "display", to_Message(_display))),
  49 +
  50 + };
  51 + _hk_table_message
  52 +.
  53 +
  54 +public define Maybe(HK_Table)
  55 + from_Message
  56 + (
  57 + Message _hk_table_message
  58 + )=
  59 + if find_string(_hk_table_message, "__TYPE__") is {failure then failure, success(__type__) then
  60 + if find_string(_hk_table_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  61 + if __type__ = "HK_Table" then
  62 + //Alternative hk_table
  63 + if __type_alt__ = "hk_table" then //Alternative hk_table
  64 + // [type = String] hk_table.name
  65 + if find_string(_hk_table_message, "name") is {failure then failure, success(name) then
  66 + // [type = String] hk_table.short_name
  67 + if find_string(_hk_table_message, "short_name") is {failure then failure, success(short_name) then
  68 + // [type = HK_Model] hk_table.model
  69 + if find_message(_hk_table_message, "model") is {failure then failure, success(model_msg) then
  70 + if (Maybe(HK_Model))from_Message(model_msg) is {failure then failure, success(model) then
  71 + // [type = HK_Display] hk_table.display
  72 + if find_message(_hk_table_message, "display") is {failure then failure, success(display_msg) then
  73 + if (Maybe(HK_Display))from_Message(display_msg) is {failure then failure, success(display) then
  74 +
  75 + success(hk_table(name, short_name, model, display))
  76 + }}}}}}
  77 + else
  78 + failure //No valid Alternative found !
  79 + else
  80 + failure //Type not found in message !
  81 + }}
  82 +.
  83 +
... ...
model/types/hk_text_choice.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:20
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +
  14 +public type HK_Text_Choice:
  15 + hk_text_choice(
  16 + String value,
  17 + String visible
  18 + )
  19 +.
  20 +
  21 + HK_Text_Choice message format
  22 + =============================
  23 +
  24 +
  25 +public define Message
  26 + to_Message
  27 + (
  28 + HK_Text_Choice _hk_text_choice
  29 + )=
  30 + with _hk_text_choice_message = message((Word32)0), //
  31 + forget(add_string(_hk_text_choice_message, "__TYPE__", "HK_Text_Choice"));
  32 + if _hk_text_choice is
  33 + {
  34 + //Alternative hk_text_choice
  35 + hk_text_choice(_value, _visible) then
  36 + forget(add_string(_hk_text_choice_message, "__TYPE_ALT__", "hk_text_choice"));
  37 + // [type = String] hk_text_choice.value
  38 + forget(add_string(_hk_text_choice_message, "value", _value));
  39 + // [type = String] hk_text_choice.visible
  40 + forget(add_string(_hk_text_choice_message, "visible", _visible)),
  41 +
  42 + };
  43 + _hk_text_choice_message
  44 +.
  45 +
  46 +public define Maybe(HK_Text_Choice)
  47 + from_Message
  48 + (
  49 + Message _hk_text_choice_message
  50 + )=
  51 + if find_string(_hk_text_choice_message, "__TYPE__") is {failure then failure, success(__type__) then
  52 + if find_string(_hk_text_choice_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  53 + if __type__ = "HK_Text_Choice" then
  54 + //Alternative hk_text_choice
  55 + if __type_alt__ = "hk_text_choice" then //Alternative hk_text_choice
  56 + // [type = String] hk_text_choice.value
  57 + if find_string(_hk_text_choice_message, "value") is {failure then failure, success(value) then
  58 + // [type = String] hk_text_choice.visible
  59 + if find_string(_hk_text_choice_message, "visible") is {failure then failure, success(visible) then
  60 +
  61 + success(hk_text_choice(value, visible))
  62 + }}
  63 + else
  64 + failure //No valid Alternative found !
  65 + else
  66 + failure //Type not found in message !
  67 + }}
  68 +.
  69 +
... ...
model/types/hk_text_choices.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:20
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +transmit hayamiki_lib/model/types/hk_text_choice.anubis
  14 +
  15 +public type HK_Text_Choices:
  16 + no_choice,
  17 + text_choices(
  18 + List(HK_Text_Choice) hk_text_choice
  19 + )
  20 +.
  21 +
  22 + HK_Text_Choices message format
  23 + ==============================
  24 +
  25 +
  26 +public define Message
  27 + to_Message
  28 + (
  29 + HK_Text_Choices _hk_text_choices
  30 + )=
  31 + with _hk_text_choices_message = message((Word32)0), //
  32 + forget(add_string(_hk_text_choices_message, "__TYPE__", "HK_Text_Choices"));
  33 + if _hk_text_choices is
  34 + {
  35 + //Alternative no_choice (NO TYPE)
  36 + no_choice then
  37 + forget(add_string(_hk_text_choices_message, "__TYPE_ALT__", "no_choice")),
  38 +
  39 + //Alternative text_choices
  40 + text_choices(__hk_text_choice) then
  41 + forget(add_string(_hk_text_choices_message, "__TYPE_ALT__", "text_choices"));
  42 + // [type = List(HK_Text_Choice)] text_choices.hk_text_choice
  43 + map_forget((HK_Text_Choice _hk_text_choice) |-> add_message(_hk_text_choices_message, "hk_text_choice", to_Message(_hk_text_choice)), __hk_text_choice),
  44 +
  45 + };
  46 + _hk_text_choices_message
  47 +.
  48 +
  49 +public define Maybe(HK_Text_Choices)
  50 + from_Message
  51 + (
  52 + Message _hk_text_choices_message
  53 + )=
  54 + if find_string(_hk_text_choices_message, "__TYPE__") is {failure then failure, success(__type__) then
  55 + if find_string(_hk_text_choices_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  56 + if __type__ = "HK_Text_Choices" then
  57 + //Alternative no_choice (NO TYPE)
  58 + if __type_alt__ = "no_choice" then
  59 + success(no_choice)
  60 + else //Alternative text_choices
  61 + if __type_alt__ = "text_choices" then //Alternative text_choices
  62 + // [type = List(HK_Text_Choice)] text_choices.hk_text_choice
  63 + with mb_hk_text_choice = map_escape(( Message msg ) |-> (Maybe(HK_Text_Choice)) from_Message(msg), find_messages(_hk_text_choices_message, "hk_text_choice")),
  64 + if mb_hk_text_choice is {failure then failure, success(hk_text_choice) then
  65 +
  66 + success(text_choices(hk_text_choice))
  67 + }
  68 + else
  69 + failure //No valid Alternative found !
  70 + else
  71 + failure //Type not found in message !
  72 + }}
  73 +.
  74 +
... ...
model/types/hk_text_field_attr.anubis 0 → 100644
  1 +/*
  2 + * Created by 伝作 (Densaku).
  3 + * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
  4 + * Date: 2017-03-15
  5 + * Time: 02:24:20
  6 + *
  7 + */
  8 +
  9 +transmit system/muscle.anubis
  10 +transmit system/convert.anubis
  11 +transmit tools/basis.anubis
  12 +
  13 +
  14 +public type HK_Text_Field_Attr:
  15 + none, //Nothing special, normal behaviour
  16 + rich_editor //Use richt text editor for that area
  17 +.
  18 +
  19 + HK_Text_Field_Attr message format
  20 + =================================
  21 +
  22 +
  23 +public define Message
  24 + to_Message
  25 + (
  26 + HK_Text_Field_Attr _hk_text_field_attr
  27 + )=
  28 + with _hk_text_field_attr_message = message((Word32)0), //
  29 + forget(add_string(_hk_text_field_attr_message, "__TYPE__", "HK_Text_Field_Attr"));
  30 + if _hk_text_field_attr is
  31 + {
  32 + //Alternative none (NO TYPE)
  33 + none then
  34 + forget(add_string(_hk_text_field_attr_message, "__TYPE_ALT__", "none")),
  35 +
  36 + //Alternative rich_editor (NO TYPE)
  37 + rich_editor then
  38 + forget(add_string(_hk_text_field_attr_message, "__TYPE_ALT__", "rich_editor")),
  39 +
  40 + };
  41 + _hk_text_field_attr_message
  42 +.
  43 +
  44 +public define Maybe(HK_Text_Field_Attr)
  45 + from_Message
  46 + (
  47 + Message _hk_text_field_attr_message
  48 + )=
  49 + if find_string(_hk_text_field_attr_message, "__TYPE__") is {failure then failure, success(__type__) then
  50 + if find_string(_hk_text_field_attr_message, "__TYPE_ALT__") is {failure then failure, success(__type_alt__) then
  51 + if __type__ = "HK_Text_Field_Attr" then
  52 + //Alternative none (NO TYPE)
  53 + if __type_alt__ = "none" then
  54 + success(none)
  55 + else //Alternative rich_editor (NO TYPE)
  56 + if __type_alt__ = "rich_editor" then
  57 + success(rich_editor)
  58 + else
  59 + failure //No valid Alternative found !
  60 + else
  61 + failure //Type not found in message !
  62 + }}
  63 +.
  64 +
... ...
types/hayamiki.anubis
... ... @@ -7,6 +7,6 @@
7 7 */
8 8  
9 9  
10   -transmit model/fields.anubis
11   -transmit model/database.anubis
12   -transmit model/columns.anubis
  10 +transmit hayamiki_lib/model/fields.anubis
  11 +transmit hayamiki_lib/model/database.anubis
  12 +transmit hayamiki_lib/model/columns.anubis
... ...
types/model/display.anubis deleted
1   -/*
2   - * Created by PyramIDE.
3   - * User: フランスのトトロ aka (David RENÉ)
4   - * Date: 13/02/2016
5   - * Time: 10:36
6   - * © Calexium
7   - */
8   -
9   -transmit system/muscle.anubis
10   -transmit tools/basis.anubis
11   -transmit calexium_lib/CXM_message_constants.anubis
12   -transmit calexium_lib/web/CXM_json.anubis
13   -
14   -public type HK_List_View:
15   - list_view_all,
16   - list_view(String view_name, List(String) columns, String link_id_action).
17   -
18   -public define HK_List_View
19   - list_view
20   - (
21   - String view_name,
22   - List(String) columns
23   - )=
24   - list_view(view_name, columns, "").
25   -
26   -public define Message
27   - to_Message
28   - (
29   - HK_List_View list_view
30   - )=
31   - with _msg = message(_HK_LIST_VIEW),
32   - if list_view is
33   - {
34   - list_view_all then forget(add_string(_msg, "type", "list_view_all")),
35   - list_view(name, columns, link_id_action) then
36   - forget(add_string(_msg, "type", "list_view"));
37   - forget(add_string(_msg, "view_name", name));
38   - forget(add_string(_msg, "link_id_action", link_id_action));
39   - map_forget((String column) |-> forget(add_string(_msg, "columns", column)), columns)
40   - };
41   - _msg
42   - .
43   -
44   -
45   -public define JsonValue
46   - to_JSON
47   - (
48   - HK_List_View list_view
49   - )=
50   - with members =
51   - if list_view is
52   - {
53   - list_view_all then
54   - [ json_member("type", json_string("list_view_all")) ],
55   -
56   - list_view(name, columns, link_id_action) then
57   - [ json_member("type", json_string("list_view")),
58   - json_member("view_name", json_string(name)),
59   - json_member("link_id_action", json_string(link_id_action)),
60   - json_member("columns", json_array(map((String column) |-> json_string(column), columns)))
61   - ]
62   - },
63   -
64   - json_object("_HK_LIST_VIEW", members).
65   -
66   -public define Maybe(HK_List_View)
67   - from_Message
68   - (
69   - Message msg
70   - )=
71   - if *msg.what = _HK_LIST_VIEW then
72   - if find_string(msg, "type") is {failure then failure, success(type) then
73   - if type = "list_view_all" then success(list_view_all) else
74   - if type = "list_view" then
75   - if find_string(msg, "view_name") is {failure then failure, success(view_name) then
76   - with columns = find_strings(msg, "columns"),
77   - success(list_view(view_name, columns))}
78   - else
79   - failure
80   - }
81   - else
82   - failure
83   - .
84   -
85   -public type HK_Edit_View:
86   - edit_view_all,
87   - edit_view(String view_name, List(String) columns).
88   -
89   -public define Message
90   - to_Message
91   - (
92   - HK_Edit_View edit_view
93   - )=
94   - with _msg = message(_HK_EDIT_VIEW),
95   - if edit_view is
96   - {
97   - edit_view_all then forget(add_string(_msg, "type", "edit_view_all")),
98   - edit_view(name, columns) then
99   - forget(add_string(_msg, "type", "edit_view"));
100   - forget(add_string(_msg, "view_name", name));
101   - map_forget((String column) |-> forget(add_string(_msg, "columns", column)), columns)
102   - };
103   - _msg
104   - .
105   -
106   -public define JsonValue
107   - to_JSON
108   - (
109   - HK_Edit_View edit_view
110   - )=
111   - with members =
112   - if edit_view is
113   - {
114   - edit_view_all then
115   - [ json_member("type", json_string("edit_view_all")) ],
116   -
117   - edit_view(name, columns) then
118   - [ json_member("type", json_string("edit_view")),
119   - json_member("view_name", json_string(name)),
120   - json_member("columns", json_array(map((String column) |-> json_string(column), columns)))
121   - ]
122   - },
123   -
124   - json_object("_HK_EDIT_VIEW", members).
125   -
126   -public define Maybe(HK_Edit_View)
127   - from_Message
128   - (
129   - Message msg
130   - )=
131   - if *msg.what = _HK_EDIT_VIEW then
132   - if find_string(msg, "type") is {failure then failure, success(type) then
133   - if type = "edit_view_all" then success(edit_view_all) else
134   - if type = "edit_view" then
135   - if find_string(msg, "view_name") is {failure then failure, success(view_name) then
136   - with columns = find_strings(msg, "columns"),
137   - success(edit_view(view_name, columns))}
138   - else
139   - failure
140   - }
141   - else
142   - failure
143   - .
144   -
145   - _HK_MODEL_DISPLAY message format:
146   - =========================
147   - The message string name is "hk_display"
148   - +--------------+---------------+--------------------------------
149   - | name | type | description
150   - +--------------+---------------+--------------------------------
151   - | "list_edits" | List(Message) | List of (edit list) the Message id is _HK_EDIT_VIEW
152   - | "list_views" | List(Message) | List of (view list) the Message id is _HK_LIST_VIEW
153   -
154   -
155   -public type HK_Display:
156   - hk_display(List(HK_List_View) list_views,
157   - List(HK_Edit_View) list_edits
158   - //List(String)
159   - ).
160   -
161   -public define Message
162   - to_Message
163   - (
164   - HK_Display display
165   - )=
166   - with hk_display_msg = message(_HK_MODEL_DISPLAY),
167   - since display is hk_display(list_views, list_edits),
168   - map_forget((HK_List_View _view) |-> add_message(hk_display_msg, "list_views", to_Message(_view)), list_views);
169   - map_forget((HK_Edit_View _edit) |-> add_message(hk_display_msg, "list_edits", to_Message(_edit)), list_edits);
170   -// map_forget((String _str) |-> add_string(hk_display_msg, "edits", _str), list_edit);
171   - hk_display_msg
172   - .
173   -
174   -public define JsonValue
175   - to_JSON
176   - (
177   - HK_Display display
178   - )=
179   - since display is hk_display(list_views, list_edits),
180   - json_object("_HK_MODEL_DISPLAY",
181   - [ json_member("list_views", json_array(map((HK_List_View _view) |-> to_JSON(_view), list_views))),
182   - json_member("list_edits", json_array(map((HK_Edit_View _edit) |-> to_JSON(_edit), list_edits)))
183   - ]
184   - ).
185   -
186   -public define Maybe(HK_Display)
187   - get_hk_display
188   - (
189   - Message msg
190   - )=
191   - if find_message(msg, "hk_display") is { failure then failure, success(msg_hk_display) then
192   - if *msg_hk_display.what = _HK_MODEL_DISPLAY then
193   - with view_list = map_escape((Message _msg) |-> (Maybe(HK_List_View))from_Message(_msg), find_messages(msg_hk_display, "list_views")),
194   - with edit_list = map_escape((Message _msg) |-> (Maybe(HK_Edit_View))from_Message(_msg), find_messages(msg_hk_display, "list_edits")),
195   - if view_list is
196   - {
197   - failure then failure,
198   - success(list_views) then
199   - if edit_list is
200   - {
201   - failure then failure,
202   - success(list_edits) then
203   - success(hk_display(list_views, list_edits))
204   - }
205   - }
206   - else
207   - failure
208   - }.
209   -
view/view_table_types.anubis
... ... @@ -45,7 +45,7 @@ public type VT_edit:
45 45 public type VT_view_entry:
46 46 text(String text),
47 47 link(String id, String text),
48   - link_id_action(String id, String text, String link_id_action),
  48 + link_id_action(String id, String text, WEB_Action_Name link_id_action),
49 49 icon(String icon_path).
50 50  
51 51 public type VT_view_row_header:
... ...