webmcp
annotate framework/env/ui_deprecated/field.lua @ 11:d76a8857ba62
Added ui.partial and other functions, which allow partial content replacement using XMLHttpRequests; Image support for ui.link
Also includes following changes:
- Fix for rocketcgi library to accept POST data content-types, which contain additional charset information.
- Support arrays passed as params to encode.url (only for keys ending with "[]")
- Version information changed to "1.0.7"
Documentation for added functions is not yet complete.
Also includes following changes:
- Fix for rocketcgi library to accept POST data content-types, which contain additional charset information.
- Support arrays passed as params to encode.url (only for keys ending with "[]")
- Version information changed to "1.0.7"
Documentation for added functions is not yet complete.
author | jbe/bsw |
---|---|
date | Fri Feb 12 18:40:22 2010 +0100 (2010-02-12) |
parents | 9fdfb27f8e67 |
children |
rev | line source |
---|---|
jbe/bsw@0 | 1 -- |
jbe/bsw@0 | 2 -- Creates an output field |
jbe/bsw@0 | 3 -- |
jbe/bsw@0 | 4 -- label (string) The label of the field |
jbe/bsw@0 | 5 -- value (atom) The value to put out |
jbe/bsw@0 | 6 -- field_type (string) The type of the field (default: 'string') |
jbe/bsw@0 | 7 -- |
jbe/bsw@0 | 8 -- Example: |
jbe/bsw@0 | 9 -- |
jbe/bsw@0 | 10 -- ui_deprecated.field({ |
jbe/bsw@0 | 11 -- label = _'Id', |
jbe/bsw@0 | 12 -- value = myobject.id, |
jbe/bsw@0 | 13 -- field_type = 'integer' |
jbe/bsw@0 | 14 -- }) |
jbe/bsw@0 | 15 -- |
jbe/bsw@0 | 16 |
jbe/bsw@0 | 17 function ui_deprecated.field(args) |
jbe/bsw@0 | 18 local value_type = args.value_type or atom.string |
jbe/bsw@0 | 19 slot.put( |
jbe/bsw@0 | 20 '<div class="ui_field ui_field_', value_type.name, '">', |
jbe/bsw@0 | 21 '<div class="label">', |
jbe/bsw@0 | 22 encode.html(args.label or ''), |
jbe/bsw@0 | 23 '</div>', |
jbe/bsw@0 | 24 '<div class="value">') |
jbe/bsw@0 | 25 if args.value then |
jbe/bsw@0 | 26 slot.put(encode.html(convert.to_human(args.value, value_type))) |
jbe/bsw@0 | 27 elseif args.link then |
jbe/bsw@0 | 28 ui_deprecated.link(args.link) |
jbe/bsw@0 | 29 end |
jbe/bsw@0 | 30 slot.put( |
jbe/bsw@0 | 31 '</div>', |
jbe/bsw@0 | 32 '</div>\n' |
jbe/bsw@0 | 33 ) |
jbe/bsw@0 | 34 end |