Commit 1a7e534076a378ac618740027e3f6040532e0fe6
1 parent
07f1bbce
add db_get_mb_integer of the first entry of table cursor. Maybe is we are not su…
…re that the first entry is an integer add html_tooltip with WEB_Action_Name move the formatting the web_action_name and his extra argument in CXM_web_action.anubis instead of mega file CXM_making_a_web_site.anubis Add new parameter JQuery_dialog_size in jquery_dialog creation
Showing
5 changed files
with
142 additions
and
47 deletions
Show diff stats
database/db_utils.anubis
| ... | ... | @@ -262,10 +262,22 @@ public define Int |
| 262 | 262 | if table_cursor(unique) is |
| 263 | 263 | { |
| 264 | 264 | error(sql_error) then logError("DB", db_error(sql_error, "db_get_integer")); 0, |
| 265 | - no_more_row then 0, //can't find the symbol in the table, because the row is empty | |
| 265 | + no_more_row then 0, | |
| 266 | 266 | row(explorer) then (Int)db_integer(explorer)(0) |
| 267 | 267 | }. |
| 268 | 268 | |
| 269 | +public define Maybe(Int) | |
| 270 | + db_get_mb_integer | |
| 271 | + ( | |
| 272 | + One -> SQLite3Row table_cursor | |
| 273 | + ) = | |
| 274 | + if table_cursor(unique) is | |
| 275 | + { | |
| 276 | + error(sql_error) then logError("DB", db_error(sql_error, "db_get_mb_integer")); failure, | |
| 277 | + no_more_row then failure, | |
| 278 | + row(explorer) then db_integer(explorer)(0) | |
| 279 | + }. | |
| 280 | + | |
| 269 | 281 | // sqlite3 API |
| 270 | 282 | public define List(Int) |
| 271 | 283 | db_get_integer_list | ... | ... |
web/CXM_making_a_web_site.anubis
| ... | ... | @@ -1331,7 +1331,14 @@ public type HTML_tooltip: |
| 1331 | 1331 | String title, |
| 1332 | 1332 | String extend_type, |
| 1333 | 1333 | List((String, String)) ext_args |
| 1334 | + ), | |
| 1335 | + html_tooltip | |
| 1336 | + ( | |
| 1337 | + String title, | |
| 1338 | + WEB_Action_Name wan, | |
| 1339 | + List((String, String)) ext_args | |
| 1334 | 1340 | ). |
| 1341 | + | |
| 1335 | 1342 | |
| 1336 | 1343 | public define HTML_tooltip |
| 1337 | 1344 | html_tooltip |
| ... | ... | @@ -3401,7 +3408,7 @@ define WEB_Controller_Result |
| 3401 | 3408 | //println("apply_action "); |
| 3402 | 3409 | if actions_list is |
| 3403 | 3410 | { |
| 3404 | - [] then http_answer(error_page(http_not_found, "No action found", _session)), | |
| 3411 | + [] then http_answer(error_page(http_not_found, "["+requested_action_name+"] Action not found in all controllers", _session)), | |
| 3405 | 3412 | [h . t] then |
| 3406 | 3413 | if h.name = no_action then |
| 3407 | 3414 | http_answer( _session, html_content(http_no_content, empty)) |
| ... | ... | @@ -3974,18 +3981,18 @@ public define String |
| 3974 | 3981 | List(CoreAttrs) attributs |
| 3975 | 3982 | ). |
| 3976 | 3983 | |
| 3977 | -public define String | |
| 3978 | - format_extra_operands | |
| 3979 | - ( | |
| 3980 | - List((String,String)) l | |
| 3981 | - ) = | |
| 3982 | - if l is | |
| 3983 | - { | |
| 3984 | - [ ] then "", | |
| 3985 | - [h . t] then if h is (n,v) then | |
| 3986 | - "&"+n+"="+v+format_extra_operands(t) | |
| 3987 | - } | |
| 3988 | -. | |
| 3984 | +//public define String | |
| 3985 | +// format_extra_operands | |
| 3986 | +// ( | |
| 3987 | +// List((String,String)) l | |
| 3988 | +// ) = | |
| 3989 | +// if l is | |
| 3990 | +// { | |
| 3991 | +// [ ] then "", | |
| 3992 | +// [h . t] then if h is (n,v) then | |
| 3993 | +// "&"+n+"="+v+format_extra_operands(t) | |
| 3994 | +// } | |
| 3995 | +//. | |
| 3989 | 3996 | |
| 3990 | 3997 | |
| 3991 | 3998 | It seams that the standard requires "&" instead of "&" ! |
| ... | ... | @@ -4088,30 +4095,30 @@ define Int |
| 4088 | 4095 | The next function composes the URL. It is a JavaScript URL when the target is another |
| 4089 | 4096 | window. |
| 4090 | 4097 | |
| 4091 | -public define String | |
| 4092 | - format_web_action_name | |
| 4093 | - ( | |
| 4094 | - WEB_Action_Name action | |
| 4095 | - )= | |
| 4096 | - if action is | |
| 4097 | - { | |
| 4098 | - no_action then "", | |
| 4099 | - controller_action(controller, action_name) then "?aws_controller="+controller+"&aws_action="+action_name, | |
| 4100 | - action_name(action_name) then "?aws_action="+action_name, | |
| 4101 | - url(url) then url | |
| 4102 | - } | |
| 4103 | -. | |
| 4104 | - | |
| 4105 | -public define String | |
| 4106 | - format_web_action_name | |
| 4107 | - ( | |
| 4108 | - WEB_Action_Name action, | |
| 4109 | - List((String,String)) extra_ops, | |
| 4110 | - )= | |
| 4111 | - format_web_action_name(action) | |
| 4112 | - + | |
| 4113 | - format_extra_operands(extra_ops) | |
| 4114 | -. | |
| 4098 | +//public define String | |
| 4099 | +// format_web_action_name | |
| 4100 | +// ( | |
| 4101 | +// WEB_Action_Name action | |
| 4102 | +// )= | |
| 4103 | +// if action is | |
| 4104 | +// { | |
| 4105 | +// no_action then "", | |
| 4106 | +// controller_action(controller, action_name) then "?aws_controller="+controller+"&aws_action="+action_name, | |
| 4107 | +// action_name(action_name) then "?aws_action="+action_name, | |
| 4108 | +// url(url) then url | |
| 4109 | +// } | |
| 4110 | +//. | |
| 4111 | +// | |
| 4112 | +//public define String | |
| 4113 | +// format_web_action_name | |
| 4114 | +// ( | |
| 4115 | +// WEB_Action_Name action, | |
| 4116 | +// List((String,String)) extra_ops, | |
| 4117 | +// )= | |
| 4118 | +// format_web_action_name(action) | |
| 4119 | +// + | |
| 4120 | +// format_extra_operands(extra_ops) | |
| 4121 | +//. | |
| 4115 | 4122 | |
| 4116 | 4123 | define String |
| 4117 | 4124 | make_actioner_url |
| ... | ... | @@ -5391,12 +5398,30 @@ public define Printable_tree |
| 5391 | 5398 | |
| 5392 | 5399 | html_tooltip_ext(title, extend_type, ext_args) then |
| 5393 | 5400 | with extra_args = format_extra_operands(ext_args), |
| 5394 | - ["<a id=\"jTip\" class=\"jTipu \" name=\"",title,"\" href=\"/?a=ajax_show_tooltip&tooltip_ext=",extend_type+extra_args,"\"><i class=\"fa fa-info\" aria-hidden=\"true\" style=\"color:#2e6da4\"></i></a>"] | |
| 5401 | + ["<a id=\"jTip\" class=\"jTipu \" name=\"",title,"\" href=\"/?a=ajax_show_tooltip&tooltip_ext=",extend_type+extra_args,"\"><i class=\"fa fa-info\" aria-hidden=\"true\" style=\"color:#2e6da4\"></i></a>"], | |
| 5402 | + html_tooltip(title, web_action, extra_args) then | |
| 5403 | + ["<a id=\"jTip\" class=\"jTipu \" name=\"",title,"\" href=\"/", format_web_action_name(web_action, extra_args) ,"\"><i class=\"fa fa-info\" aria-hidden=\"true\" style=\"color:#2e6da4\"></i></a>"], | |
| 5404 | + | |
| 5395 | 5405 | }. |
| 5396 | 5406 | |
| 5397 | 5407 | public define HTML_Off_Form |
| 5398 | 5408 | html_tooltip |
| 5399 | 5409 | ( |
| 5410 | + String title, | |
| 5411 | + WEB_Action_Name web_action, | |
| 5412 | + List((String,String)) extra_args, | |
| 5413 | + HTML_Off_Form html_element, | |
| 5414 | + )= | |
| 5415 | + sequence([ | |
| 5416 | + literal_pt(["<a id=\"jTip\" class=\"jTipu \" name=\"",title,"\" href=\"/", format_web_action_name(web_action, extra_args) ,"\">"]), | |
| 5417 | + html_element, | |
| 5418 | + literal_pt(["</a>"]) | |
| 5419 | + ]) | |
| 5420 | +. | |
| 5421 | + | |
| 5422 | +public define HTML_Off_Form | |
| 5423 | + html_tooltip | |
| 5424 | + ( | |
| 5400 | 5425 | String title, |
| 5401 | 5426 | String keyword, |
| 5402 | 5427 | ) = | ... | ... |
web/CXM_web_action.anubis
| ... | ... | @@ -6,6 +6,8 @@ |
| 6 | 6 | * © Calexium |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | +read system/string.anubis | |
| 10 | + | |
| 9 | 11 | transmit calexium_lib/web/types/web_action_name.anubis |
| 10 | 12 | //public type WEB_Action_Name: |
| 11 | 13 | // controller_action( |
| ... | ... | @@ -21,6 +23,14 @@ transmit calexium_lib/web/types/web_action_name.anubis |
| 21 | 23 | // ) |
| 22 | 24 | //. |
| 23 | 25 | |
| 26 | +public define String | |
| 27 | + format_extra_operands | |
| 28 | + ( | |
| 29 | + List((String,String)) l_args | |
| 30 | + ) = | |
| 31 | + join("&", map(((String, String) arg) |-> since arg is (name, value), name+"="+value, l_args)) | |
| 32 | +. | |
| 33 | + | |
| 24 | 34 | public define String |
| 25 | 35 | to_Anubis_Source |
| 26 | 36 | ( |
| ... | ... | @@ -34,3 +44,32 @@ public define String |
| 34 | 44 | url(url_name) then "url(\""+url_name+"\")" |
| 35 | 45 | } |
| 36 | 46 | . |
| 47 | + | |
| 48 | +public define String | |
| 49 | + format_web_action_name | |
| 50 | + ( | |
| 51 | + WEB_Action_Name action | |
| 52 | + )= | |
| 53 | + | |
| 54 | + if action is | |
| 55 | + { | |
| 56 | + no_action then "", | |
| 57 | + controller_action(controller, action_name) then "?aws_controller="+controller+"&aws_action="+action_name, | |
| 58 | + action_name(action_name) then "?aws_action="+action_name, | |
| 59 | + url(url) then url | |
| 60 | + } | |
| 61 | +. | |
| 62 | + | |
| 63 | +public define String | |
| 64 | + format_web_action_name | |
| 65 | + ( | |
| 66 | + WEB_Action_Name action, | |
| 67 | + List((String,String)) extra_ops, | |
| 68 | + )= | |
| 69 | + format_web_action_name(action) | |
| 70 | + + | |
| 71 | + if length(extra_ops) = 0 then | |
| 72 | + "" | |
| 73 | + else | |
| 74 | + "&"+format_extra_operands(extra_ops) | |
| 75 | +. | ... | ... |
web/CXM_web_session.anubis
| ... | ... | @@ -16,9 +16,9 @@ read CXM_web_dump.anubis |
| 16 | 16 | public type WEB_Session_Field_Datum: |
| 17 | 17 | string(String), //fully implented |
| 18 | 18 | bool(Bool), //fully implented |
| 19 | - int(Int), //fully implented | |
| 19 | + int(Int), //fully implemented | |
| 20 | 20 | db_id(DB_id), |
| 21 | - message(Message), //fully implented | |
| 21 | + message(Message), //fully implemented | |
| 22 | 22 | byte_array(ByteArray), |
| 23 | 23 | float(Float), |
| 24 | 24 | word128(Word128), |
| ... | ... | @@ -27,6 +27,7 @@ public type WEB_Session_Field_Datum: |
| 27 | 27 | word16(Word16), |
| 28 | 28 | word8(Word8), |
| 29 | 29 | word4(Word4) |
| 30 | + //WEB_Request | |
| 30 | 31 | . |
| 31 | 32 | |
| 32 | 33 | public type WEB_Session_Field_Type: | ... | ... |
web/jQuery/CXM_jquery_dialog.anubis
| ... | ... | @@ -19,13 +19,27 @@ public type JQuery_dialog: |
| 19 | 19 | ajax(WEB_Action_Name url). |
| 20 | 20 | |
| 21 | 21 | public define JQuery_dialog ajax(String url) = ajax(action_name(url)). |
| 22 | + | |
| 23 | +public type JQuery_dialog_size: | |
| 24 | + auto, | |
| 25 | + percent(Float w, Float h) | |
| 26 | +. | |
| 27 | + | |
| 28 | +public define JQuery_dialog_size | |
| 29 | + percent | |
| 30 | + ( | |
| 31 | + Float all | |
| 32 | + )= | |
| 33 | + percent(all, all). | |
| 22 | 34 | |
| 35 | + | |
| 23 | 36 | public define HTML_Partial_Content |
| 24 | 37 | jq_dialog_create |
| 25 | 38 | ( |
| 26 | 39 | JQuery_dialog_id dial_id, |
| 27 | 40 | JQuery_dialog content, |
| 28 | 41 | Bool autoOpen, |
| 42 | + JQuery_dialog_size size, | |
| 29 | 43 | String extra_param |
| 30 | 44 | )= |
| 31 | 45 | with dlg_id = id(dial_id), |
| ... | ... | @@ -34,9 +48,13 @@ public define HTML_Partial_Content |
| 34 | 48 | $( \"#"+dlg_id+"\" ).dialog({ |
| 35 | 49 | autoOpen: "+to_String(autoOpen)+", |
| 36 | 50 | modal: true, |
| 37 | - height: 'auto', | |
| 38 | - width: 'auto', | |
| 39 | - "+extra_param+" | |
| 51 | +"+ | |
| 52 | + if size is | |
| 53 | + { | |
| 54 | + auto then "height: 'auto', width: 'auto',", | |
| 55 | + percent(w, h) then "width: $(window).width() * "+w+", height: $(window).height() * "+h+"," | |
| 56 | + } | |
| 57 | + +extra_param+" | |
| 40 | 58 | Cancel: function() { |
| 41 | 59 | $( this ).dialog( 'close' ); |
| 42 | 60 | } |
| ... | ... | @@ -64,7 +82,7 @@ public define HTML_Partial_Content |
| 64 | 82 | JQuery_dialog content, |
| 65 | 83 | String extra_param |
| 66 | 84 | )= |
| 67 | - jq_dialog_create(dial_id, content, false, extra_param). | |
| 85 | + jq_dialog_create(dial_id, content, false, auto, extra_param). | |
| 68 | 86 | |
| 69 | 87 | public define HTML_Partial_Content |
| 70 | 88 | jq_dialog_create |
| ... | ... | @@ -72,7 +90,7 @@ public define HTML_Partial_Content |
| 72 | 90 | JQuery_dialog_id dial_id, |
| 73 | 91 | JQuery_dialog content |
| 74 | 92 | )= |
| 75 | - jq_dialog_create(dial_id, content, false, ""). | |
| 93 | + jq_dialog_create(dial_id, content, false, auto, ""). | |
| 76 | 94 | |
| 77 | 95 | public define HTML_Partial_Content |
| 78 | 96 | jq_dialog_create |
| ... | ... | @@ -81,7 +99,7 @@ public define HTML_Partial_Content |
| 81 | 99 | JQuery_dialog content, |
| 82 | 100 | Bool autoOpen |
| 83 | 101 | )= |
| 84 | - jq_dialog_create(dial_id, content, autoOpen, ""). | |
| 102 | + jq_dialog_create(dial_id, content, autoOpen, auto, ""). | |
| 85 | 103 | |
| 86 | 104 | define String |
| 87 | 105 | _jq_dialog_open | ... | ... |