Commit a2431db277eaf86bd8c03ea6ee8f233ca0d3b6eb
1 parent
3032f641
add get_tristate from web_arg. This let use the jquery.tristate.js. get_tristate…
… return a Maybe(Bool) which the following values are: success(true) = checked, success(false) = unchecked, failure = intermediate.
Showing
1 changed file
with
20 additions
and
0 deletions
Show diff stats
web/web_arg_utils.anubis
| @@ -360,6 +360,26 @@ public define Maybe(Bool) | @@ -360,6 +360,26 @@ public define Maybe(Bool) | ||
| 360 | // println("value = '"+value+"' result = "+to_String(return_v)+" success("+to_String(return_v)+")"); | 360 | // println("value = '"+value+"' result = "+to_String(return_v)+" success("+to_String(return_v)+")"); |
| 361 | success(return_v) | 361 | success(return_v) |
| 362 | }. | 362 | }. |
| 363 | + | ||
| 364 | +public define Maybe(Bool) | ||
| 365 | + get_tristate | ||
| 366 | + ( | ||
| 367 | + List(Web_arg) lwa, | ||
| 368 | + String arg_name | ||
| 369 | + ) = | ||
| 370 | +// println("get_mb_Bool "+arg_name); | ||
| 371 | + if web_arg_value(lwa, arg_name) is | ||
| 372 | + { | ||
| 373 | + not_found then failure | ||
| 374 | + found(value) then | ||
| 375 | + if value = "checked" then success(true) | ||
| 376 | + else if value = "unchecked" then success(false) | ||
| 377 | + else if value = "intermediate" then failure | ||
| 378 | + else failure, | ||
| 379 | +// println("value = '"+value+"' result = "+to_String(return_v)+" success("+to_String(return_v)+")"); | ||
| 380 | + | ||
| 381 | + } | ||
| 382 | +. | ||
| 363 | 383 | ||
| 364 | public define Bool | 384 | public define Bool |
| 365 | get_Bool | 385 | get_Bool |