Commit 045c7412fb0c12d67b57a143bc855b010b13cd85
1 parent
18a39e9d
add new type in session which is also session
Showing
5 changed files
with
213 additions
and
31 deletions
Show diff stats
generic/session.anubis
| @@ -25,7 +25,7 @@ public define Session_Field | @@ -25,7 +25,7 @@ public define Session_Field | ||
| 25 | public define Var(List(Session_Field)) | 25 | public define Var(List(Session_Field)) |
| 26 | to_Session_Field | 26 | to_Session_Field |
| 27 | ( | 27 | ( |
| 28 | - List(Session_Field_No_Var) fields | 28 | + List(Session_Field_No_Var) _fields |
| 29 | )= | 29 | )= |
| 30 | var(map((Session_Field_No_Var field) |-> | 30 | var(map((Session_Field_No_Var field) |-> |
| 31 | with datum = if field.field_datum is{ | 31 | with datum = if field.field_datum is{ |
| @@ -42,11 +42,12 @@ public define Var(List(Session_Field)) | @@ -42,11 +42,12 @@ public define Var(List(Session_Field)) | ||
| 42 | word16(v) then word16(v), | 42 | word16(v) then word16(v), |
| 43 | word8(v) then word8(v), | 43 | word8(v) then word8(v), |
| 44 | word4(v) then word4(v), | 44 | word4(v) then word4(v), |
| 45 | - fields_set(v) then fields_set(to_Session_Field(v)) | 45 | + fields_set(v) then fields_set(to_Session_Field(v)), |
| 46 | + session(v) then session(session(v.session_id, to_Session_Field(v.fields))), | ||
| 46 | }, | 47 | }, |
| 47 | session_field(field.field_name, field.field_type, var(datum)) | 48 | session_field(field.field_name, field.field_type, var(datum)) |
| 48 | , | 49 | , |
| 49 | - fields) | 50 | + _fields) |
| 50 | ) | 51 | ) |
| 51 | . | 52 | . |
| 52 | 53 | ||
| @@ -54,7 +55,7 @@ public define Var(List(Session_Field)) | @@ -54,7 +55,7 @@ public define Var(List(Session_Field)) | ||
| 54 | public define List(Session_Field_No_Var) | 55 | public define List(Session_Field_No_Var) |
| 55 | to_Session_Field_No_Var | 56 | to_Session_Field_No_Var |
| 56 | ( | 57 | ( |
| 57 | - List(Session_Field) fields | 58 | + List(Session_Field) _fields |
| 58 | )= | 59 | )= |
| 59 | map((Session_Field field) |-> | 60 | map((Session_Field field) |-> |
| 60 | with datum = if *field.field_datum is{ | 61 | with datum = if *field.field_datum is{ |
| @@ -72,8 +73,12 @@ public define List(Session_Field_No_Var) | @@ -72,8 +73,12 @@ public define List(Session_Field_No_Var) | ||
| 72 | word8(v) then word8(v), | 73 | word8(v) then word8(v), |
| 73 | word4(v) then word4(v), | 74 | word4(v) then word4(v), |
| 74 | fields_set(v) then fields_set(to_Session_Field_No_Var(*v)) | 75 | fields_set(v) then fields_set(to_Session_Field_No_Var(*v)) |
| 76 | + session(v) then session(session(v.session_id, to_Session_Field_No_Var(*v.fields))) | ||
| 75 | }, | 77 | }, |
| 76 | - session_field(field.field_name, field.field_type, datum), fields) | 78 | + session_field(field.field_name, field.field_type, datum) |
| 79 | + , | ||
| 80 | + _fields | ||
| 81 | + ) | ||
| 77 | . | 82 | . |
| 78 | 83 | ||
| 79 | 84 | ||
| @@ -997,8 +1002,8 @@ public define One | @@ -997,8 +1002,8 @@ public define One | ||
| 997 | 1002 | ||
| 998 | /*************** Fields_set *****************/ | 1003 | /*************** Fields_set *****************/ |
| 999 | 1004 | ||
| 1000 | - Maybe(Word4) get_Word4(fields, _field_name) | ||
| 1001 | - Word4 get_Word4(fields, _field_name, default_value) | 1005 | + Maybe(Var(List(Session_Field))) get_Fields_set(fields, _field_name) |
| 1006 | + Var(List(Session_Field)) get_Fields_set(fields, _field_name, default_value) | ||
| 1002 | 1007 | ||
| 1003 | public define Maybe(Var(List(Session_Field))) | 1008 | public define Maybe(Var(List(Session_Field))) |
| 1004 | get_Fields_set | 1009 | get_Fields_set |
| @@ -1060,6 +1065,71 @@ public define One | @@ -1060,6 +1065,71 @@ public define One | ||
| 1060 | remove_any(_fields, fields_set_t, _field_name) | 1065 | remove_any(_fields, fields_set_t, _field_name) |
| 1061 | . | 1066 | . |
| 1062 | 1067 | ||
| 1068 | + /*************** Session *****************/ | ||
| 1069 | + | ||
| 1070 | + Maybe(Session) get_Session(fields, _field_name) | ||
| 1071 | + Session get_Session(fields, _field_name, default_value) | ||
| 1072 | + | ||
| 1073 | +public define Maybe(Session) | ||
| 1074 | + get_Session | ||
| 1075 | + ( | ||
| 1076 | + Var(List(Session_Field)) fields, | ||
| 1077 | + String _field_name, | ||
| 1078 | + ) = | ||
| 1079 | + if get_field(*fields, session_t, _field_name) is | ||
| 1080 | + { | ||
| 1081 | + failure then failure, | ||
| 1082 | + success(datum) then | ||
| 1083 | + if datum is session(value) then | ||
| 1084 | + success(value) | ||
| 1085 | + else | ||
| 1086 | + failure | ||
| 1087 | + } | ||
| 1088 | +. | ||
| 1089 | + | ||
| 1090 | +public define Session | ||
| 1091 | + get_Session | ||
| 1092 | + ( | ||
| 1093 | + Var(List(Session_Field)) fields, | ||
| 1094 | + String _field_name, | ||
| 1095 | + Session default_value | ||
| 1096 | + ) = | ||
| 1097 | + if get_Session(fields, _field_name) is | ||
| 1098 | + { | ||
| 1099 | + failure then default_value | ||
| 1100 | + success(value) then value | ||
| 1101 | + }. | ||
| 1102 | + | ||
| 1103 | + | ||
| 1104 | +public define One | ||
| 1105 | + put_Session | ||
| 1106 | + ( | ||
| 1107 | + Var(List(Session_Field)) _fields, | ||
| 1108 | + String _field_name, | ||
| 1109 | + Session _field_value | ||
| 1110 | + )= | ||
| 1111 | + _fields <- [session_field(_field_name, session_t, var(session(_field_value))) . *_fields] | ||
| 1112 | +. | ||
| 1113 | + | ||
| 1114 | +public define One | ||
| 1115 | + replace_Session | ||
| 1116 | + ( | ||
| 1117 | + Var(List(Session_Field)) _fields, | ||
| 1118 | + String _field_name, | ||
| 1119 | + Session _field_value | ||
| 1120 | + )= | ||
| 1121 | + replace_any(_fields, session_t, _field_name, session(_field_value)) | ||
| 1122 | +. | ||
| 1123 | + | ||
| 1124 | +public define One | ||
| 1125 | + remove_Session | ||
| 1126 | + ( | ||
| 1127 | + Var(List(Session_Field)) _fields, | ||
| 1128 | + String _field_name | ||
| 1129 | + )= | ||
| 1130 | + remove_any(_fields, session_t, _field_name) | ||
| 1131 | +. | ||
| 1132 | + | ||
| 1063 | /*************** Serialized Type *****************/ | 1133 | /*************** Serialized Type *****************/ |
| 1064 | 1134 | ||
| 1065 | public define One | 1135 | public define One |
| @@ -1151,7 +1221,8 @@ public define String | @@ -1151,7 +1221,8 @@ public define String | ||
| 1151 | word16(_word16) then name+", Type = Word16, Value = ["+to_decimal(_word16)+"]", | 1221 | word16(_word16) then name+", Type = Word16, Value = ["+to_decimal(_word16)+"]", |
| 1152 | word8(_word8) then name+", Type = Word8, Value = ["+to_decimal(_word8)+"]", | 1222 | word8(_word8) then name+", Type = Word8, Value = ["+to_decimal(_word8)+"]", |
| 1153 | word4(_word4) then name+", Type = Word4, Value = ["+to_decimal(_word4)+"]", | 1223 | word4(_word4) then name+", Type = Word4, Value = ["+to_decimal(_word4)+"]", |
| 1154 | - fields_set(_fields) then name+", Type = Fields_set, \n"+dump_Session_Field_list(*_fields, indent+" ") | 1224 | + fields_set(_fields) then name+", Type = Fields_set, \n"+dump_Session_Field_list(*_fields, indent+" "), |
| 1225 | + session(_session) then name+", Type = Session, session id = ["+_session.session_id+"]\n"+dump_Session_Field_list(*_session.fields, indent+" "), | ||
| 1155 | } | 1226 | } |
| 1156 | . | 1227 | . |
| 1157 | 1228 |
generic/types/session.anubis
| @@ -11,6 +11,8 @@ transmit xlib/database/db_types.anubis | @@ -11,6 +11,8 @@ transmit xlib/database/db_types.anubis | ||
| 11 | 11 | ||
| 12 | public type Session_Field:... | 12 | public type Session_Field:... |
| 13 | public type Session_Field_No_Var:... | 13 | public type Session_Field_No_Var:... |
| 14 | +public type Session:... | ||
| 15 | +public type Session_No_Var:... | ||
| 14 | 16 | ||
| 15 | public type Session_Field_Datum: | 17 | public type Session_Field_Datum: |
| 16 | string(String), //fully implented | 18 | string(String), //fully implented |
| @@ -26,7 +28,8 @@ public type Session_Field_Datum: | @@ -26,7 +28,8 @@ public type Session_Field_Datum: | ||
| 26 | word16(Word16), | 28 | word16(Word16), |
| 27 | word8(Word8), | 29 | word8(Word8), |
| 28 | word4(Word4), | 30 | word4(Word4), |
| 29 | - fields_set(Var(List(Session_Field))) | 31 | + fields_set(Var(List(Session_Field))), |
| 32 | + session(Session) | ||
| 30 | //WEB_Request | 33 | //WEB_Request |
| 31 | . | 34 | . |
| 32 | 35 | ||
| @@ -44,7 +47,8 @@ public type Session_Field_Datum_No_Var: | @@ -44,7 +47,8 @@ public type Session_Field_Datum_No_Var: | ||
| 44 | word16(Word16), | 47 | word16(Word16), |
| 45 | word8(Word8), | 48 | word8(Word8), |
| 46 | word4(Word4), | 49 | word4(Word4), |
| 47 | - fields_set(List(Session_Field_No_Var)) | 50 | + fields_set(List(Session_Field_No_Var)), |
| 51 | + session(Session_No_Var) | ||
| 48 | //WEB_Request | 52 | //WEB_Request |
| 49 | . | 53 | . |
| 50 | 54 | ||
| @@ -62,7 +66,8 @@ public type Session_Field_Type: | @@ -62,7 +66,8 @@ public type Session_Field_Type: | ||
| 62 | word16_t, | 66 | word16_t, |
| 63 | word8_t, | 67 | word8_t, |
| 64 | word4_t, | 68 | word4_t, |
| 65 | - fields_set_t | 69 | + fields_set_t, |
| 70 | + session_t | ||
| 66 | . | 71 | . |
| 67 | 72 | ||
| 68 | public type Session_Field: | 73 | public type Session_Field: |
| @@ -80,3 +85,17 @@ public type Session_Field_No_Var: | @@ -80,3 +85,17 @@ public type Session_Field_No_Var: | ||
| 80 | Session_Field_Datum_No_Var field_datum //Var because it can be replaced | 85 | Session_Field_Datum_No_Var field_datum //Var because it can be replaced |
| 81 | ) | 86 | ) |
| 82 | . | 87 | . |
| 88 | + | ||
| 89 | +public type Session: | ||
| 90 | + session( | ||
| 91 | + String session_id, | ||
| 92 | + Var(List(Session_Field)) fields | ||
| 93 | + ) | ||
| 94 | +. | ||
| 95 | + | ||
| 96 | +public type Session_No_Var: | ||
| 97 | + session( | ||
| 98 | + String session_id, | ||
| 99 | + List(Session_Field_No_Var) fields | ||
| 100 | + ) | ||
| 101 | +. |
web/CXM_web_session.anubis
| @@ -68,6 +68,8 @@ public define WEB_Session_No_Var | @@ -68,6 +68,8 @@ public define WEB_Session_No_Var | ||
| 68 | ) | 68 | ) |
| 69 | . | 69 | . |
| 70 | 70 | ||
| 71 | +public define One replace_String(WEB_Session s, String n, String v) = replace_String(s.fields, n, v). | ||
| 72 | + | ||
| 71 | /************************************************/ | 73 | /************************************************/ |
| 72 | "AWS_CURRENT_PAGE_TITLE" String current web page title | 74 | "AWS_CURRENT_PAGE_TITLE" String current web page title |
| 73 | "AWS_CURRENT_PAGE" String current web page | 75 | "AWS_CURRENT_PAGE" String current web page |
| @@ -77,32 +79,32 @@ public define WEB_Session_No_Var | @@ -77,32 +79,32 @@ public define WEB_Session_No_Var | ||
| 77 | "AWS_CURRENT_PAGE_RENDERER" String current page renderer | 79 | "AWS_CURRENT_PAGE_RENDERER" String current page renderer |
| 78 | 80 | ||
| 79 | 81 | ||
| 80 | -public define One set_web_site_directory(WEB_Session s, String n) = replace_String(s.fields, "AWS_WEB_SITE_DIR", n). | ||
| 81 | -public define One set_web_site_directory(Var(List(Session_Field)) fields, String n) = replace_String(fields, "AWS_WEB_SITE_DIR", n). | 82 | +public define One set_web_site_directory(WEB_Session s, String v) = replace_String(s.fields, "AWS_WEB_SITE_DIR", v). |
| 83 | +public define One set_web_site_directory(Var(List(Session_Field)) fields, String v) = replace_String(fields, "AWS_WEB_SITE_DIR", v). | ||
| 82 | public define String get_web_site_directory(WEB_Session s) = get_String (s.fields, "AWS_WEB_SITE_DIR", ""). | 84 | public define String get_web_site_directory(WEB_Session s) = get_String (s.fields, "AWS_WEB_SITE_DIR", ""). |
| 83 | 85 | ||
| 84 | -public define One set_web_app(WEB_Session s, String n) = replace_String(s.fields, "AWS_CURRENT_APP", n). | ||
| 85 | -public define One set_web_app(Var(List(Session_Field)) fields, String n) = replace_String(fields, "AWS_CURRENT_APP", n). | 86 | +public define One set_web_app(WEB_Session s, String v) = replace_String(s.fields, "AWS_CURRENT_APP", v). |
| 87 | +public define One set_web_app(Var(List(Session_Field)) fields, String v) = replace_String(fields, "AWS_CURRENT_APP", v). | ||
| 86 | public define String get_web_app(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_APP", ""). | 88 | public define String get_web_app(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_APP", ""). |
| 87 | 89 | ||
| 88 | -public define One set_web_space(WEB_Session s, String n)= replace_String(s.fields, "AWS_CURRENT_SPACE", n). | ||
| 89 | -public define One set_web_space(Var(List(Session_Field)) fields, String n)= replace_String(fields, "AWS_CURRENT_SPACE", n). | 90 | +public define One set_web_space(WEB_Session s, String v)= replace_String(s.fields, "AWS_CURRENT_SPACE", v). |
| 91 | +public define One set_web_space(Var(List(Session_Field)) fields, String v)= replace_String(fields, "AWS_CURRENT_SPACE", v). | ||
| 90 | public define String get_web_space(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_SPACE", ""). | 92 | public define String get_web_space(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_SPACE", ""). |
| 91 | 93 | ||
| 92 | -public define One set_web_content(WEB_Session s, String n)= replace_String(s.fields, "AWS_CURRENT_CONTENT", n). | ||
| 93 | -public define One set_web_content(Var(List(Session_Field)) fields, String n)= replace_String(fields, "AWS_CURRENT_CONTENT", n). | 94 | +public define One set_web_content(WEB_Session s, String v)= replace_String(s.fields, "AWS_CURRENT_CONTENT", v). |
| 95 | +public define One set_web_content(Var(List(Session_Field)) fields, String v)= replace_String(fields, "AWS_CURRENT_CONTENT", v). | ||
| 94 | public define String get_web_content(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_CONTENT", ""). | 96 | public define String get_web_content(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_CONTENT", ""). |
| 95 | 97 | ||
| 96 | -public define One set_page(WEB_Session s, String n)= replace_String(s.fields, "AWS_CURRENT_PAGE", n). | ||
| 97 | -public define One set_page(Var(List(Session_Field)) fields, String n)= replace_String(fields, "AWS_CURRENT_PAGE", n). | 98 | +public define One set_page(WEB_Session s, String v)= replace_String(s.fields, "AWS_CURRENT_PAGE", v). |
| 99 | +public define One set_page(Var(List(Session_Field)) fields, String v)= replace_String(fields, "AWS_CURRENT_PAGE", v). | ||
| 98 | public define String get_page(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_PAGE", ""). | 100 | public define String get_page(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_PAGE", ""). |
| 99 | 101 | ||
| 100 | -public define One set_page_title(WEB_Session s, String n) = replace_String(s.fields, "AWS_CURRENT_PAGE_TITLE", n). | ||
| 101 | -public define One set_page_title(Var(List(Session_Field)) fields, String n) = replace_String(fields, "AWS_CURRENT_PAGE_TITLE", n). | 102 | +public define One set_page_title(WEB_Session s, String v) = replace_String(s.fields, "AWS_CURRENT_PAGE_TITLE", v). |
| 103 | +public define One set_page_title(Var(List(Session_Field)) fields, String v) = replace_String(fields, "AWS_CURRENT_PAGE_TITLE", v). | ||
| 102 | public define String get_page_title(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_PAGE_TITLE", ""). | 104 | public define String get_page_title(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_PAGE_TITLE", ""). |
| 103 | 105 | ||
| 104 | -public define One set_renderer(WEB_Session s, String n) = replace_String(s.fields, "AWS_CURRENT_PAGE_RENDERER", n). | ||
| 105 | -public define One set_renderer(Var(List(Session_Field)) fields, String n) = replace_String(fields, "AWS_CURRENT_PAGE_RENDERER", n). | 106 | +public define One set_renderer(WEB_Session s, String v) = replace_String(s.fields, "AWS_CURRENT_PAGE_RENDERER", v). |
| 107 | +public define One set_renderer(Var(List(Session_Field)) fields, String v) = replace_String(fields, "AWS_CURRENT_PAGE_RENDERER", v). | ||
| 106 | public define String get_renderer(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_PAGE_RENDERER", ""). | 108 | public define String get_renderer(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_PAGE_RENDERER", ""). |
| 107 | 109 | ||
| 108 | public define One put_Serialized_type(WEB_Session s, String n, $T type) = put_Serialized_type(s.fields, n, type). | 110 | public define One put_Serialized_type(WEB_Session s, String n, $T type) = put_Serialized_type(s.fields, n, type). |
| @@ -127,12 +129,28 @@ public define String | @@ -127,12 +129,28 @@ public define String | ||
| 127 | public define String | 129 | public define String |
| 128 | dump_WEB_Session_Fields | 130 | dump_WEB_Session_Fields |
| 129 | ( | 131 | ( |
| 132 | + List(Session_Field) _fields | ||
| 133 | + )= | ||
| 134 | + dump_WEB_Session_Fields(_fields, "") | ||
| 135 | +. | ||
| 136 | + | ||
| 137 | +public define String | ||
| 138 | + dump_WEB_Session_Fields | ||
| 139 | + ( | ||
| 130 | Var(List(Session_Field)) _fields, | 140 | Var(List(Session_Field)) _fields, |
| 131 | String indent | 141 | String indent |
| 132 | )= | 142 | )= |
| 133 | dump_WEB_Session_Fields(*_fields, indent) | 143 | dump_WEB_Session_Fields(*_fields, indent) |
| 134 | . | 144 | . |
| 135 | 145 | ||
| 146 | +public define String | ||
| 147 | + dump_WEB_Session_Fields | ||
| 148 | + ( | ||
| 149 | + Var(List(Session_Field)) _fields | ||
| 150 | + )= | ||
| 151 | + dump_WEB_Session_Fields(*_fields, "") | ||
| 152 | +. | ||
| 153 | + | ||
| 136 | *---------------------- DUMP ------------------* | 154 | *---------------------- DUMP ------------------* |
| 137 | 155 | ||
| 138 | String language, | 156 | String language, |
web/plugin/plugin.anubis
| @@ -10,7 +10,7 @@ read system/logger.anubis | @@ -10,7 +10,7 @@ read system/logger.anubis | ||
| 10 | //read app/app_constants.anubis | 10 | //read app/app_constants.anubis |
| 11 | read xlib/web/widgets/left_menu.anubis | 11 | read xlib/web/widgets/left_menu.anubis |
| 12 | transmit xlib/web/types/making_a_web_site.anubis | 12 | transmit xlib/web/types/making_a_web_site.anubis |
| 13 | -read xlib/web/types/controllers_web_site.anubis | 13 | +transmit xlib/web/types/controllers_web_site.anubis |
| 14 | read xlib/web/widgets/menu.anubis | 14 | read xlib/web/widgets/menu.anubis |
| 15 | read hayamiki_lib/model/database.anubis | 15 | read hayamiki_lib/model/database.anubis |
| 16 | read hayamiki_lib/view/view_table_manager_types.anubis | 16 | read hayamiki_lib/view/view_table_manager_types.anubis |
web_controllers/language/language_management.anubis
| @@ -12,21 +12,23 @@ read locale/L3LanguageInfo.anubis | @@ -12,21 +12,23 @@ read locale/L3LanguageInfo.anubis | ||
| 12 | read xlib/web/types/controllers_web_site.anubis | 12 | read xlib/web/types/controllers_web_site.anubis |
| 13 | read xlib/web/CXM_web_session.anubis | 13 | read xlib/web/CXM_web_session.anubis |
| 14 | 14 | ||
| 15 | +public define One set_dictionary(WEB_Session s, String n) = replace_String(s.fields, "AWS_CURRENT_DICTIONARY", n). | ||
| 16 | +public define One set_dictionary(Var(List(Session_Field)) fields, String n) = replace_String(fields, "AWS_CURRENT_DICTIONARY", n). | ||
| 17 | +public define String get_dictionary(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_DICTIONARY", ""). | ||
| 15 | 18 | ||
| 16 | public define String default_language = "en". | 19 | public define String default_language = "en". |
| 17 | 20 | ||
| 18 | public define (String symbolic_name) -> String | 21 | public define (String symbolic_name) -> String |
| 19 | make_translate_function | 22 | make_translate_function |
| 20 | ( | 23 | ( |
| 21 | - WEB_Session _session, | 24 | + String dictionary_collection_name, |
| 25 | + String lang, | ||
| 22 | (LogLevel, String) -> One logger | 26 | (LogLevel, String) -> One logger |
| 23 | ) = | 27 | ) = |
| 24 | - with lang = _session.language, | ||
| 25 | - app_dictionnary = get_String(_session.fields, "AWS_CURRENT_DICTIONARY", ""), | ||
| 26 | - if l3_load_base(app_dictionnary) is | 28 | + if l3_load_base(dictionary_collection_name) is |
| 27 | { | 29 | { |
| 28 | failure then | 30 | failure then |
| 29 | - logger(logError, "Can't load translation dictionnary for '"+app_dictionnary+"'"); | 31 | + logger(logError, "Can't load translation dictionnary for '"+dictionary_collection_name+"'"); |
| 30 | (String symbolic_name) |-> "<" + symbolic_name + ">", | 32 | (String symbolic_name) |-> "<" + symbolic_name + ">", |
| 31 | 33 | ||
| 32 | success(L3 local) then | 34 | success(L3 local) then |
| @@ -39,6 +41,17 @@ public define (String symbolic_name) -> String | @@ -39,6 +41,17 @@ public define (String symbolic_name) -> String | ||
| 39 | (String symbolic_name) |-> l3_get_text(l3_object, symbolic_name) | 41 | (String symbolic_name) |-> l3_get_text(l3_object, symbolic_name) |
| 40 | } | 42 | } |
| 41 | . | 43 | . |
| 44 | +public define (String symbolic_name) -> String | ||
| 45 | + make_translate_function | ||
| 46 | + ( | ||
| 47 | + WEB_Session _session, | ||
| 48 | + (LogLevel, String) -> One logger | ||
| 49 | + ) = | ||
| 50 | + with lang = _session.language, | ||
| 51 | + app_dictionnary = get_String(_session.fields, "AWS_CURRENT_DICTIONARY", ""), | ||
| 52 | + | ||
| 53 | + make_translate_function(app_dictionnary, lang, logger) | ||
| 54 | +. | ||
| 42 | 55 | ||
| 43 | public define (String symbolic_name) -> String | 56 | public define (String symbolic_name) -> String |
| 44 | make_translate_function | 57 | make_translate_function |
| @@ -64,3 +77,64 @@ public define List((List(CoreAttrs),WebArgValue, String)) | @@ -64,3 +77,64 @@ public define List((List(CoreAttrs),WebArgValue, String)) | ||
| 64 | l3_get_all_dicos(dictionary_collection_name) | 77 | l3_get_all_dicos(dictionary_collection_name) |
| 65 | ) | 78 | ) |
| 66 | . | 79 | . |
| 80 | + | ||
| 81 | +define HTML_Off_Form | ||
| 82 | + language_line | ||
| 83 | + ( | ||
| 84 | + String language_code, | ||
| 85 | + String language | ||
| 86 | + )= | ||
| 87 | + li([style("background-image: url(../flags/"+language_code+".png);"), | ||
| 88 | + event(onclick, "language_changed('"+language_code+"');")], text(language)) | ||
| 89 | +. | ||
| 90 | + | ||
| 91 | +public define HTML_Partial_Content | ||
| 92 | + flags_menu | ||
| 93 | + ( | ||
| 94 | + String dictionary_collection_name, | ||
| 95 | + String lang, | ||
| 96 | + Bool show_symbolic, | ||
| 97 | + (LogLevel, String) -> One logger | ||
| 98 | + ) = | ||
| 99 | + with make_line = (L3LangDicProperty dico_prop) |-> | ||
| 100 | + if dico_prop is l3LangDicProperty( _, sha1, lang_code, user_def, creat, update) then | ||
| 101 | + with lang_info = l3_get_language_info(lang_code), | ||
| 102 | + if lang_code = lang then | ||
| 103 | + empty | ||
| 104 | + else | ||
| 105 | + language_line(lang_code, self_name(lang_info)), | ||
| 106 | + partial_content([ | ||
| 107 | + css(css_file("css/flags_menu.css")), | ||
| 108 | + js(js_file("js/cxm/cxm.js")) | ||
| 109 | + ], | ||
| 110 | + [ | ||
| 111 | + dl([ | ||
| 112 | + //literal("<dt style=\"background-image: url(../flags/"+lang+".png);\" onmouseover=\"javascript:montre('drapo1');\" onmouseout=\"javascript:montre();\"> </dt>\n"), | ||
| 113 | + literal("<img src=\"../flags/"+lang+".png\" onmouseover=\"javascript:montre('drapo1');\" onmouseout=\"javascript:montre();\">"), | ||
| 114 | + dd([style("display: none"),id("drapo1"), event(onmouseover, "montre('drapo1');"), event(onmouseout, "montre();")], | ||
| 115 | + ul( | ||
| 116 | + map(make_line, l3_get_all_dicos(dictionary_collection_name))+ | ||
| 117 | + [ | ||
| 118 | + if show_symbolic then | ||
| 119 | + language_line("symb", "symbolic") | ||
| 120 | + else | ||
| 121 | + empty | ||
| 122 | + ] | ||
| 123 | + )), | ||
| 124 | + ]) //!dl | ||
| 125 | + ] | ||
| 126 | + ) | ||
| 127 | +. | ||
| 128 | + | ||
| 129 | +public define HTML_Partial_Content | ||
| 130 | + flags_menu | ||
| 131 | + ( | ||
| 132 | + WEB_Session _session, | ||
| 133 | + Bool show_symbolic, | ||
| 134 | + (LogLevel, String) -> One logger | ||
| 135 | + ) = | ||
| 136 | + with lang = _session.language, | ||
| 137 | + app_dictionnary = get_dictionary(_session), | ||
| 138 | + | ||
| 139 | + flags_menu(app_dictionnary, lang, show_symbolic, logger) | ||
| 140 | +. |