Commit 2e8980a8e725b8cc5da5b371ef0171b7a8698876

Authored by David RENÉ
1 parent 8ccc5ad5

add get_List_DB_id, get_List_String

Showing 1 changed file with 35 additions and 5 deletions   Show diff stats
web/CXM_web_arg_utils.anubis
... ... @@ -162,7 +162,37 @@ public define DB_id
162 162 success(value) then value
163 163 }
164 164 .
165   -
  165 +
  166 +public define List(DB_id)
  167 + get_List_DB_id
  168 + (
  169 + List(Web_arg) l,
  170 + String name
  171 + ) =
  172 + if l is
  173 + {
  174 + [] then [],
  175 + [h . t] then
  176 + if h is web_arg(n, value) then
  177 + if n = name then
  178 + //Check if value is none which means no id provided
  179 + with result = if value="none" then
  180 + none
  181 + else
  182 + //Now try to convert the string into Int to get the id
  183 + if decimal_scan(value) is
  184 + {
  185 + failure then none,
  186 + success(_value) then db_id(_value)
  187 + },
  188 + [ result . get_List_DB_id(t, name)]
  189 + else
  190 + get_List_DB_id(t, name)
  191 + else
  192 + get_List_DB_id(t, name)
  193 + }
  194 +.
  195 +
166 196 public define Maybe(DB_date)
167 197 get_DB_date
168 198 (
... ... @@ -264,7 +294,7 @@ public define String
264 294 }.
265 295  
266 296 public define List(String)
267   - get_String_list
  297 + get_List_String
268 298 (
269 299 List(Web_arg) l,
270 300 String name
... ... @@ -275,11 +305,11 @@ public define List(String)
275 305 [h . t] then
276 306 if h is web_arg(n, v) then
277 307 if n = name then
278   - [ v . get_String_list(t, name)]
  308 + [ v . get_List_String(t, name)]
279 309 else
280   - get_String_list(t, name)
  310 + get_List_String(t, name)
281 311 else
282   - get_String_list(t, name)
  312 + get_List_String(t, name)
283 313 }
284 314 .
285 315  
... ...