Commit 8ac9630fb4fa0fe323288979cd40badd4b5c3787
1 parent
0fad9f5b
add get_Bool with Maybe(Bool)
add get_DB_id. Use in relation with database
Showing
1 changed file
with
26 additions
and
0 deletions
Show diff stats
web/CXM_web_arg_utils.anubis
| @@ -7,7 +7,21 @@ | @@ -7,7 +7,21 @@ | ||
| 7 | */ | 7 | */ |
| 8 | read tools/basis.anubis | 8 | read tools/basis.anubis |
| 9 | read calexium_lib/web/CXM_common.anubis | 9 | read calexium_lib/web/CXM_common.anubis |
| 10 | +read calexium_lib/database/db_types.anubis | ||
| 10 | 11 | ||
| 12 | +public define DB_id | ||
| 13 | + get_DB_id | ||
| 14 | + ( | ||
| 15 | + List(Web_arg) lwa, | ||
| 16 | + String arg_name | ||
| 17 | + ) = | ||
| 18 | + if web_arg_value(lwa, arg_name) is | ||
| 19 | + { | ||
| 20 | + not_found then none, | ||
| 21 | + found(value) then | ||
| 22 | + if value="none" then none else db_id(force_to_Int(value)) | ||
| 23 | + }. | ||
| 24 | + | ||
| 11 | public define Maybe(String) | 25 | public define Maybe(String) |
| 12 | get_String | 26 | get_String |
| 13 | ( | 27 | ( |
| @@ -45,6 +59,18 @@ public define Bool | @@ -45,6 +59,18 @@ public define Bool | ||
| 45 | found(_) then true | 59 | found(_) then true |
| 46 | }. | 60 | }. |
| 47 | 61 | ||
| 62 | +public define Maybe(Bool) | ||
| 63 | + get_Bool | ||
| 64 | + ( | ||
| 65 | + List(Web_arg) lwa, | ||
| 66 | + String arg_name | ||
| 67 | + ) = | ||
| 68 | + if web_arg_value(lwa, arg_name) is | ||
| 69 | + { | ||
| 70 | + not_found then success(false), | ||
| 71 | + found(_) then success(true) | ||
| 72 | + }. | ||
| 73 | + | ||
| 48 | public define Maybe(Int) | 74 | public define Maybe(Int) |
| 49 | get_Int | 75 | get_Int |
| 50 | ( | 76 | ( |