| 1 |
|
============== |
| 2 |
|
CMFGeographics |
| 3 |
|
============== |
| 4 |
|
|
| 5 |
|
:Author: Tom von Schwerdtner |
| 6 |
|
:Contact: tvon@etria.com |
| 7 |
|
:Revision: $Revision$ |
| 8 |
|
:Date: $Date$ |
| 9 |
|
:Copyright: This document has been placed in the public domain. |
| 10 |
|
|
| 11 |
|
A utility product meant to maintain a list of useful geographic properties. |
| 12 |
|
Currently this means Countries and US States. In the future it could mean |
| 13 |
|
counties for US States or similiar for the internatinal community...this of |
| 14 |
|
course depends on contributions :) |
| 15 |
|
|
| 16 |
|
Basic example of fetching US States and Countries:: |
| 17 |
|
|
| 18 |
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" |
| 19 |
|
metal:use-macro="here/main_template/macros/master" |
| 20 |
|
i18n:domain="plone"> |
| 21 |
|
<body> |
| 22 |
|
|
| 23 |
|
<div metal:fill-slot="main"> |
| 24 |
|
|
| 25 |
|
<div class="row"> |
| 26 |
|
US State: |
| 27 |
|
<select name="us_state"> |
| 28 |
|
<div tal:repeat="us_state python:here.geographic_properties.getProperty('us_states')" |
| 29 |
|
tal:omit-tag=""> |
| 30 |
|
<option tal:define="values python:us_state.split('|')" |
| 31 |
|
value="" |
| 32 |
|
tal:attributes="value python:values[0]; |
| 33 |
|
selected python:test(us_state==values[0], 'selected', '')" |
| 34 |
|
tal:content="python:values[1]"></option> |
| 35 |
|
</div> |
| 36 |
|
</select> |
| 37 |
|
|
| 38 |
|
</div> |
| 39 |
|
<div class="row"> |
| 40 |
|
Country: |
| 41 |
|
<select name="country"> |
| 42 |
|
<div tal:repeat="country python:here.geographic_properties.getProperty('countries')" |
| 43 |
|
tal:omit-tag=""> |
| 44 |
|
<option tal:define="values python:country.split('|')" |
| 45 |
|
value="" |
| 46 |
|
tal:attributes="value python:values[0]; |
| 47 |
|
selected python:test(country==values[0], 'selected', '')" |
| 48 |
|
tal:content="python:values[1]"></option> |
| 49 |
|
</div> |
| 50 |
|
</select> |
| 51 |
|
|
| 52 |
Example: |
</div> |
|
|
|
|
######################################## |
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" |
|
|
metal:use-macro="here/main_template/macros/master" |
|
|
i18n:domain="plone"> |
|
|
<body> |
|
|
|
|
|
<div metal:fill-slot="main"> |
|
|
|
|
|
<div class="row"> |
|
|
US State: |
|
|
<select name="us_state"> |
|
|
<div tal:repeat="us_state python:here.geographic_properties.getProperty('us_states')" |
|
|
tal:omit-tag=""> |
|
|
<option tal:define="values python:us_state.split('|')" |
|
|
value="" |
|
|
tal:attributes="value python:values[0]; |
|
|
selected python:test(us_state==values[0], 'selected', '')" |
|
|
tal:content="python:values[1]"></option> |
|
|
</div> |
|
|
</select> |
|
|
|
|
|
</div> |
|
|
<div class="row"> |
|
|
Country: |
|
|
<select name="country"> |
|
|
<div tal:repeat="country python:here.geographic_properties.getProperty('countries')" |
|
|
tal:omit-tag=""> |
|
|
<option tal:define="values python:country.split('|')" |
|
|
value="" |
|
|
tal:attributes="value python:values[0]; |
|
|
selected python:test(country==values[0], 'selected', '')" |
|
|
tal:content="python:values[1]"></option> |
|
|
</div> |
|
|
</select> |
|
|
|
|
| 53 |
</div> |
</div> |
|
</div> |
|
| 54 |
|
|
| 55 |
</body> |
</body> |
| 56 |
</html> |
</html> |
|
######################################## |
|