| 45 | | == Configuring a CAP Profile == |
| 46 | | |
| 47 | | [[http://www.youtube.com/watch?v=nfW4vs7j5Kw | Watch the Video]] |
| 48 | | |
| 49 | | CAP profiles can be configured using the deployment settings. |
| 50 | | |
| 51 | | The following settings can be set as follows |
| 52 | | |
| 53 | | {{{ |
| 54 | | settings.cap.identifier_prefix = "prefix" # string |
| 55 | | settings.cap.identifier_suffix = "suffix" # string |
| 56 | | settings.cap.codes = [...] # key-value pairs |
| 57 | | settings.cap.parameters = [...] # key-value pairs |
| 58 | | settings.cap.geocodes = [...] # key-value pairs |
| 59 | | settings.cap.base64 = False # boolean |
| 60 | | settings.cap.languages = OrderedDict([ |
| 61 | | ("en-US", "English"), |
| 62 | | ("fr", "Français") |
| 63 | | ...]) |
| 64 | | settings.cap.priorities = OrderedDict([ |
| 65 | | ("<value>, "<Translated title>", <urgency>, <severity>, <certainty>, <color>), |
| 66 | | ... |
| 67 | | ]) |
| 68 | | |
| 69 | | }}} |
| 70 | | |
| 71 | | Key-value pairs above are python lists containing many dictionaries detailing the behavior and parameters for the key-value pair. |
| 72 | | It should take the following form |
| 73 | | |
| 74 | | {{{ |
| 75 | | kvpairs = [ |
| 76 | | dict(key="<key>", value="<value>", comment="<help text>", immutable=<immutable>, options=[("<value>", "<Value title>"), ...]), |
| 77 | | ... |
| 78 | | ] |
| 79 | | |
| 80 | | }}} |
| 81 | | |
| 82 | | * Here the comment and options dictionary values are optional. |
| 83 | | * The options argument is a list of ("<value>", "<value title>") pairs and provides a drop-down to pick the value for the key from. |
| 84 | | * The mutable argument is a bit-map saying whether to lock the key field or the value field or both in the key-value user interface. (by locking we mean disabling.) You can use it like so: |
| 85 | | {{{ |
| 86 | | KEY_MUTABLE = 1 |
| 87 | | VALUE_MUTABLE = 2 |
| 88 | | |
| 89 | | immutable = KEY_IMMUTABLE # only key is immutable |
| 90 | | immutable = VALUE_IMMUTABLE # only value is immutable |
| 91 | | immutable = KEY_IMMUTABLE | VALUE_MUTABLE # both immutable |
| 92 | | immutable = 0 # both immutable |
| 93 | | }}} |
| 94 | | |