) {
+ if (/(.*);(\w\w)/) {
+ my $code = $2;
+ my $name = lc($1);
+ $name =~ s/\b(\w)/uc($1)/gex;
+ $name =~ s/The/the/gx;
+ $name =~ s/Of/of/gx;
+ $name =~ s/And/and/gx;
+ $name =~ s/'/''/gx;
+ print "insert into iso_countries (iso_code, country_name) values ('$code', '$name');\n";
+ }
+}
+
+print "-- End\n";
diff --git a/ccm-cms-types-simpleaddress/pdl/com/arsdigita/content-types/Address.pdl b/ccm-cms-types-simpleaddress/pdl/com/arsdigita/content-types/Address.pdl
new file mode 100755
index 000000000..dde037e42
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/pdl/com/arsdigita/content-types/Address.pdl
@@ -0,0 +1,57 @@
+//
+// Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation; either version 2.1 of
+// the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// $Id: Address.pdl 1597 2007-07-10 16:27:26Z p_boy $
+// $DateTime: 2004/08/17 23:15:09 $
+model com.arsdigita.cms.contenttypes;
+
+import com.arsdigita.cms.ContentPage;
+
+// mapping table for mapping iso country code to country name
+object type IsoCountry {
+ // The country iso code
+ String[1..1] isoCode = iso_countries.iso_code CHAR(2);
+ // The country name
+ String[1..1] countryName = iso_countries.country_name VARCHAR(100);
+
+ object key (isoCode);
+}
+
+// a simple content type to hold generic address information
+object type Address extends ContentPage {
+ // The street address, flexible enough to handle different formats
+ String[0..1] address = ct_addresses.address VARCHAR(1000);
+ // The country iso code
+ IsoCountry[0..1] isoCountryCode = join ct_addresses.iso_country_code
+ to iso_countries.iso_code;
+ // The postal code
+ String[0..1] postalCode = ct_addresses.postal_code VARCHAR(20);
+ // The phone number
+ String[0..1] phone = ct_addresses.phone VARCHAR(20);
+ // The mobile phone number
+ String[0..1] mobile = ct_addresses.mobile VARCHAR(20);
+ // The fax phone number
+ String[0..1] fax = ct_addresses.fax VARCHAR(20);
+ // The email address
+ String[0..1] email = ct_addresses.email VARCHAR(75);
+ // Notes about the address and address owner
+ String[0..1] notes = ct_addresses.notes CLOB;
+ // URI for the address
+ String[0..1] uri = ct_addresses.uri VARCHAR(250);
+
+ reference key (ct_addresses.address_id);
+}
diff --git a/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/default/insert-iso-countries.sql b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/default/insert-iso-countries.sql
new file mode 100755
index 000000000..c9489f749
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/default/insert-iso-countries.sql
@@ -0,0 +1,259 @@
+--
+-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public License
+-- as published by the Free Software Foundation; either version 2.1 of
+-- the License, or (at your option) any later version.
+--
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this library; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+--
+-- $Id: insert-iso-countries.sql 1597 2007-07-10 16:27:26Z p_boy $
+-- $DateTime: 2004/08/17 23:15:09 $
+insert into iso_countries (iso_code, country_name) values ('AF', 'Afghanistan');
+insert into iso_countries (iso_code, country_name) values ('AL', 'Albania');
+insert into iso_countries (iso_code, country_name) values ('DZ', 'Algeria');
+insert into iso_countries (iso_code, country_name) values ('AS', 'American Samoa');
+insert into iso_countries (iso_code, country_name) values ('AD', 'andorra');
+insert into iso_countries (iso_code, country_name) values ('AO', 'Angola');
+insert into iso_countries (iso_code, country_name) values ('AI', 'Anguilla');
+insert into iso_countries (iso_code, country_name) values ('AQ', 'Antarctica');
+insert into iso_countries (iso_code, country_name) values ('AG', 'Antigua and Barbuda');
+insert into iso_countries (iso_code, country_name) values ('AR', 'Argentina');
+insert into iso_countries (iso_code, country_name) values ('AM', 'Armenia');
+insert into iso_countries (iso_code, country_name) values ('AW', 'Aruba');
+insert into iso_countries (iso_code, country_name) values ('AU', 'Australia');
+insert into iso_countries (iso_code, country_name) values ('AT', 'Austria');
+insert into iso_countries (iso_code, country_name) values ('AZ', 'Azerbaijan');
+insert into iso_countries (iso_code, country_name) values ('BS', 'Bahamas');
+insert into iso_countries (iso_code, country_name) values ('BH', 'Bahrain');
+insert into iso_countries (iso_code, country_name) values ('BD', 'Bangladesh');
+insert into iso_countries (iso_code, country_name) values ('BB', 'Barbados');
+insert into iso_countries (iso_code, country_name) values ('BY', 'Belarus');
+insert into iso_countries (iso_code, country_name) values ('BE', 'Belgium');
+insert into iso_countries (iso_code, country_name) values ('BZ', 'Belize');
+insert into iso_countries (iso_code, country_name) values ('BJ', 'Benin');
+insert into iso_countries (iso_code, country_name) values ('BM', 'Bermuda');
+insert into iso_countries (iso_code, country_name) values ('BT', 'Bhutan');
+insert into iso_countries (iso_code, country_name) values ('BO', 'Bolivia');
+insert into iso_countries (iso_code, country_name) values ('BA', 'Bosnia and Herzegovina');
+insert into iso_countries (iso_code, country_name) values ('BW', 'Botswana');
+insert into iso_countries (iso_code, country_name) values ('BV', 'Bouvet Island');
+insert into iso_countries (iso_code, country_name) values ('BR', 'Brazil');
+insert into iso_countries (iso_code, country_name) values ('IO', 'British Indian Ocean Territory');
+insert into iso_countries (iso_code, country_name) values ('BN', 'Brunei Darussalam');
+insert into iso_countries (iso_code, country_name) values ('BG', 'Bulgaria');
+insert into iso_countries (iso_code, country_name) values ('BF', 'Burkina Faso');
+insert into iso_countries (iso_code, country_name) values ('BI', 'Burundi');
+insert into iso_countries (iso_code, country_name) values ('KH', 'Cambodia');
+insert into iso_countries (iso_code, country_name) values ('CM', 'Cameroon');
+insert into iso_countries (iso_code, country_name) values ('CA', 'Canada');
+insert into iso_countries (iso_code, country_name) values ('CV', 'Cape Verde');
+insert into iso_countries (iso_code, country_name) values ('KY', 'Cayman Islands');
+insert into iso_countries (iso_code, country_name) values ('CF', 'Central African Republic');
+insert into iso_countries (iso_code, country_name) values ('TD', 'Chad');
+insert into iso_countries (iso_code, country_name) values ('CL', 'Chile');
+insert into iso_countries (iso_code, country_name) values ('CN', 'China');
+insert into iso_countries (iso_code, country_name) values ('CX', 'Christmas Island');
+insert into iso_countries (iso_code, country_name) values ('CC', 'Cocos (Keeling) Islands');
+insert into iso_countries (iso_code, country_name) values ('CO', 'Colombia');
+insert into iso_countries (iso_code, country_name) values ('KM', 'Comoros');
+insert into iso_countries (iso_code, country_name) values ('CG', 'Congo');
+insert into iso_countries (iso_code, country_name) values ('CD', 'Congo, the Democratic Republic of the');
+insert into iso_countries (iso_code, country_name) values ('CK', 'Cook Islands');
+insert into iso_countries (iso_code, country_name) values ('CR', 'Costa Rica');
+insert into iso_countries (iso_code, country_name) values ('CI', 'Cote D''Ivoire');
+insert into iso_countries (iso_code, country_name) values ('HR', 'Croatia');
+insert into iso_countries (iso_code, country_name) values ('CU', 'Cuba');
+insert into iso_countries (iso_code, country_name) values ('CY', 'Cyprus');
+insert into iso_countries (iso_code, country_name) values ('CZ', 'Czech Republic');
+insert into iso_countries (iso_code, country_name) values ('DK', 'Denmark');
+insert into iso_countries (iso_code, country_name) values ('DJ', 'Djibouti');
+insert into iso_countries (iso_code, country_name) values ('DM', 'Dominica');
+insert into iso_countries (iso_code, country_name) values ('DO', 'Dominican Republic');
+insert into iso_countries (iso_code, country_name) values ('EC', 'Ecuador');
+insert into iso_countries (iso_code, country_name) values ('EG', 'Egypt');
+insert into iso_countries (iso_code, country_name) values ('SV', 'El Salvador');
+insert into iso_countries (iso_code, country_name) values ('GQ', 'Equatorial Guinea');
+insert into iso_countries (iso_code, country_name) values ('ER', 'Eritrea');
+insert into iso_countries (iso_code, country_name) values ('EE', 'Estonia');
+insert into iso_countries (iso_code, country_name) values ('ET', 'Ethiopia');
+insert into iso_countries (iso_code, country_name) values ('FK', 'Falkland Islands (Malvinas)');
+insert into iso_countries (iso_code, country_name) values ('FO', 'Faroe Islands');
+insert into iso_countries (iso_code, country_name) values ('FJ', 'Fiji');
+insert into iso_countries (iso_code, country_name) values ('FI', 'Finland');
+insert into iso_countries (iso_code, country_name) values ('FR', 'France');
+insert into iso_countries (iso_code, country_name) values ('GF', 'French Guiana');
+insert into iso_countries (iso_code, country_name) values ('PF', 'French Polynesia');
+insert into iso_countries (iso_code, country_name) values ('TF', 'French Southern Territories');
+insert into iso_countries (iso_code, country_name) values ('GA', 'Gabon');
+insert into iso_countries (iso_code, country_name) values ('GM', 'Gambia');
+insert into iso_countries (iso_code, country_name) values ('GE', 'Georgia');
+insert into iso_countries (iso_code, country_name) values ('DE', 'Germany');
+insert into iso_countries (iso_code, country_name) values ('GH', 'Ghana');
+insert into iso_countries (iso_code, country_name) values ('GI', 'Gibraltar');
+insert into iso_countries (iso_code, country_name) values ('GR', 'Greece');
+insert into iso_countries (iso_code, country_name) values ('GL', 'Greenland');
+insert into iso_countries (iso_code, country_name) values ('GD', 'Grenada');
+insert into iso_countries (iso_code, country_name) values ('GP', 'Guadeloupe');
+insert into iso_countries (iso_code, country_name) values ('GU', 'Guam');
+insert into iso_countries (iso_code, country_name) values ('GT', 'Guatemala');
+insert into iso_countries (iso_code, country_name) values ('GN', 'Guinea');
+insert into iso_countries (iso_code, country_name) values ('GW', 'Guinea-Bissau');
+insert into iso_countries (iso_code, country_name) values ('GY', 'Guyana');
+insert into iso_countries (iso_code, country_name) values ('HT', 'Haiti');
+insert into iso_countries (iso_code, country_name) values ('HM', 'Heard Island and Mcdonald Islands');
+insert into iso_countries (iso_code, country_name) values ('VA', 'Holy See (Vatican City State)');
+insert into iso_countries (iso_code, country_name) values ('HN', 'Honduras');
+insert into iso_countries (iso_code, country_name) values ('HK', 'Hong Kong');
+insert into iso_countries (iso_code, country_name) values ('HU', 'Hungary');
+insert into iso_countries (iso_code, country_name) values ('IS', 'Iceland');
+insert into iso_countries (iso_code, country_name) values ('IN', 'India');
+insert into iso_countries (iso_code, country_name) values ('ID', 'Indonesia');
+insert into iso_countries (iso_code, country_name) values ('IR', 'Iran, Islamic Republic of');
+insert into iso_countries (iso_code, country_name) values ('IQ', 'Iraq');
+insert into iso_countries (iso_code, country_name) values ('IE', 'Ireland');
+insert into iso_countries (iso_code, country_name) values ('IL', 'Israel');
+insert into iso_countries (iso_code, country_name) values ('IT', 'Italy');
+insert into iso_countries (iso_code, country_name) values ('JM', 'Jamaica');
+insert into iso_countries (iso_code, country_name) values ('JP', 'Japan');
+insert into iso_countries (iso_code, country_name) values ('JO', 'Jordan');
+insert into iso_countries (iso_code, country_name) values ('KZ', 'Kazakhstan');
+insert into iso_countries (iso_code, country_name) values ('KE', 'Kenya');
+insert into iso_countries (iso_code, country_name) values ('KI', 'Kiribati');
+insert into iso_countries (iso_code, country_name) values ('KP', 'Korea, Democratic People''S Republic of');
+insert into iso_countries (iso_code, country_name) values ('KR', 'Korea, Republic of');
+insert into iso_countries (iso_code, country_name) values ('KW', 'Kuwait');
+insert into iso_countries (iso_code, country_name) values ('KG', 'Kyrgyzstan');
+insert into iso_countries (iso_code, country_name) values ('LA', 'Lao People''S Democratic Republic');
+insert into iso_countries (iso_code, country_name) values ('LV', 'Latvia');
+insert into iso_countries (iso_code, country_name) values ('LB', 'Lebanon');
+insert into iso_countries (iso_code, country_name) values ('LS', 'Lesotho');
+insert into iso_countries (iso_code, country_name) values ('LR', 'Liberia');
+insert into iso_countries (iso_code, country_name) values ('LY', 'Libyan Arab Jamahiriya');
+insert into iso_countries (iso_code, country_name) values ('LI', 'Liechtenstein');
+insert into iso_countries (iso_code, country_name) values ('LT', 'Lithuania');
+insert into iso_countries (iso_code, country_name) values ('LU', 'Luxembourg');
+insert into iso_countries (iso_code, country_name) values ('MO', 'Macao');
+insert into iso_countries (iso_code, country_name) values ('MK', 'Macedonia, the Former Yugoslav Republic of');
+insert into iso_countries (iso_code, country_name) values ('MG', 'Madagascar');
+insert into iso_countries (iso_code, country_name) values ('MW', 'Malawi');
+insert into iso_countries (iso_code, country_name) values ('MY', 'Malaysia');
+insert into iso_countries (iso_code, country_name) values ('MV', 'Maldives');
+insert into iso_countries (iso_code, country_name) values ('ML', 'Mali');
+insert into iso_countries (iso_code, country_name) values ('MT', 'Malta');
+insert into iso_countries (iso_code, country_name) values ('MH', 'Marshall Islands');
+insert into iso_countries (iso_code, country_name) values ('MQ', 'Martinique');
+insert into iso_countries (iso_code, country_name) values ('MR', 'Mauritania');
+insert into iso_countries (iso_code, country_name) values ('MU', 'Mauritius');
+insert into iso_countries (iso_code, country_name) values ('YT', 'Mayotte');
+insert into iso_countries (iso_code, country_name) values ('MX', 'Mexico');
+insert into iso_countries (iso_code, country_name) values ('FM', 'Micronesia, Federated States of');
+insert into iso_countries (iso_code, country_name) values ('MD', 'Moldova, Republic of');
+insert into iso_countries (iso_code, country_name) values ('MC', 'Monaco');
+insert into iso_countries (iso_code, country_name) values ('MN', 'Mongolia');
+insert into iso_countries (iso_code, country_name) values ('MS', 'Montserrat');
+insert into iso_countries (iso_code, country_name) values ('MA', 'Morocco');
+insert into iso_countries (iso_code, country_name) values ('MZ', 'Mozambique');
+insert into iso_countries (iso_code, country_name) values ('MM', 'Myanmar');
+insert into iso_countries (iso_code, country_name) values ('NA', 'Namibia');
+insert into iso_countries (iso_code, country_name) values ('NR', 'Nauru');
+insert into iso_countries (iso_code, country_name) values ('NP', 'Nepal');
+insert into iso_countries (iso_code, country_name) values ('NL', 'Netherlands');
+insert into iso_countries (iso_code, country_name) values ('AN', 'Netherlands Antilles');
+insert into iso_countries (iso_code, country_name) values ('NC', 'New Caledonia');
+insert into iso_countries (iso_code, country_name) values ('NZ', 'New Zealand');
+insert into iso_countries (iso_code, country_name) values ('NI', 'Nicaragua');
+insert into iso_countries (iso_code, country_name) values ('NE', 'Niger');
+insert into iso_countries (iso_code, country_name) values ('NG', 'Nigeria');
+insert into iso_countries (iso_code, country_name) values ('NU', 'Niue');
+insert into iso_countries (iso_code, country_name) values ('NF', 'Norfolk Island');
+insert into iso_countries (iso_code, country_name) values ('MP', 'Northern Mariana Islands');
+insert into iso_countries (iso_code, country_name) values ('NO', 'Norway');
+insert into iso_countries (iso_code, country_name) values ('OM', 'Oman');
+insert into iso_countries (iso_code, country_name) values ('PK', 'Pakistan');
+insert into iso_countries (iso_code, country_name) values ('PW', 'Palau');
+insert into iso_countries (iso_code, country_name) values ('PS', 'Palestinian Territory, Occupied');
+insert into iso_countries (iso_code, country_name) values ('PA', 'Panama');
+insert into iso_countries (iso_code, country_name) values ('PG', 'Papua New Guinea');
+insert into iso_countries (iso_code, country_name) values ('PY', 'Paraguay');
+insert into iso_countries (iso_code, country_name) values ('PE', 'Peru');
+insert into iso_countries (iso_code, country_name) values ('PH', 'Philippines');
+insert into iso_countries (iso_code, country_name) values ('PN', 'Pitcairn');
+insert into iso_countries (iso_code, country_name) values ('PL', 'Poland');
+insert into iso_countries (iso_code, country_name) values ('PT', 'Portugal');
+insert into iso_countries (iso_code, country_name) values ('PR', 'Puerto Rico');
+insert into iso_countries (iso_code, country_name) values ('QA', 'Qatar');
+insert into iso_countries (iso_code, country_name) values ('RE', 'Reunion');
+insert into iso_countries (iso_code, country_name) values ('RO', 'Romania');
+insert into iso_countries (iso_code, country_name) values ('RU', 'Russian Federation');
+insert into iso_countries (iso_code, country_name) values ('RW', 'Rwanda');
+insert into iso_countries (iso_code, country_name) values ('SH', 'Saint Helena');
+insert into iso_countries (iso_code, country_name) values ('KN', 'Saint Kitts and Nevis');
+insert into iso_countries (iso_code, country_name) values ('LC', 'Saint Lucia');
+insert into iso_countries (iso_code, country_name) values ('PM', 'Saint Pierre and Miquelon');
+insert into iso_countries (iso_code, country_name) values ('VC', 'Saint Vincent and the Grenadines');
+insert into iso_countries (iso_code, country_name) values ('WS', 'Samoa');
+insert into iso_countries (iso_code, country_name) values ('SM', 'San Marino');
+insert into iso_countries (iso_code, country_name) values ('ST', 'Sao Tome and Principe');
+insert into iso_countries (iso_code, country_name) values ('SA', 'Saudi Arabia');
+insert into iso_countries (iso_code, country_name) values ('SN', 'Senegal');
+insert into iso_countries (iso_code, country_name) values ('SC', 'Seychelles');
+insert into iso_countries (iso_code, country_name) values ('SL', 'Sierra Leone');
+insert into iso_countries (iso_code, country_name) values ('SG', 'Singapore');
+insert into iso_countries (iso_code, country_name) values ('SK', 'Slovakia');
+insert into iso_countries (iso_code, country_name) values ('SI', 'Slovenia');
+insert into iso_countries (iso_code, country_name) values ('SB', 'Solomon Islands');
+insert into iso_countries (iso_code, country_name) values ('SO', 'Somalia');
+insert into iso_countries (iso_code, country_name) values ('ZA', 'South Africa');
+insert into iso_countries (iso_code, country_name) values ('GS', 'South Georgia and the South Sandwich Islands');
+insert into iso_countries (iso_code, country_name) values ('ES', 'Spain');
+insert into iso_countries (iso_code, country_name) values ('LK', 'Sri Lanka');
+insert into iso_countries (iso_code, country_name) values ('SD', 'Sudan');
+insert into iso_countries (iso_code, country_name) values ('SR', 'Suriname');
+insert into iso_countries (iso_code, country_name) values ('SJ', 'Svalbard and Jan Mayen');
+insert into iso_countries (iso_code, country_name) values ('SZ', 'Swaziland');
+insert into iso_countries (iso_code, country_name) values ('SE', 'Sweden');
+insert into iso_countries (iso_code, country_name) values ('CH', 'Switzerland');
+insert into iso_countries (iso_code, country_name) values ('SY', 'Syrian Arab Republic');
+insert into iso_countries (iso_code, country_name) values ('TW', 'Taiwan, Province of China');
+insert into iso_countries (iso_code, country_name) values ('TJ', 'Tajikistan');
+insert into iso_countries (iso_code, country_name) values ('TZ', 'Tanzania, United Republic of');
+insert into iso_countries (iso_code, country_name) values ('TH', 'Thailand');
+insert into iso_countries (iso_code, country_name) values ('TL', 'Timor-Leste');
+insert into iso_countries (iso_code, country_name) values ('TG', 'Togo');
+insert into iso_countries (iso_code, country_name) values ('TK', 'Tokelau');
+insert into iso_countries (iso_code, country_name) values ('TO', 'Tonga');
+insert into iso_countries (iso_code, country_name) values ('TT', 'Trinidad and Tobago');
+insert into iso_countries (iso_code, country_name) values ('TN', 'Tunisia');
+insert into iso_countries (iso_code, country_name) values ('TR', 'Turkey');
+insert into iso_countries (iso_code, country_name) values ('TM', 'Turkmenistan');
+insert into iso_countries (iso_code, country_name) values ('TC', 'Turks and Caicos Islands');
+insert into iso_countries (iso_code, country_name) values ('TV', 'Tuvalu');
+insert into iso_countries (iso_code, country_name) values ('UG', 'Uganda');
+insert into iso_countries (iso_code, country_name) values ('UA', 'Ukraine');
+insert into iso_countries (iso_code, country_name) values ('AE', 'United Arab Emirates');
+insert into iso_countries (iso_code, country_name) values ('GB', 'United Kingdom');
+insert into iso_countries (iso_code, country_name) values ('US', 'United States');
+insert into iso_countries (iso_code, country_name) values ('UM', 'United States Minor Outlying Islands');
+insert into iso_countries (iso_code, country_name) values ('UY', 'Uruguay');
+insert into iso_countries (iso_code, country_name) values ('UZ', 'Uzbekistan');
+insert into iso_countries (iso_code, country_name) values ('VU', 'Vanuatu');
+insert into iso_countries (iso_code, country_name) values ('VE', 'Venezuela');
+insert into iso_countries (iso_code, country_name) values ('VN', 'Viet Nam');
+insert into iso_countries (iso_code, country_name) values ('VG', 'Virgin Islands, British');
+insert into iso_countries (iso_code, country_name) values ('VI', 'Virgin Islands, U.S.');
+insert into iso_countries (iso_code, country_name) values ('WF', 'Wallis and Futuna');
+insert into iso_countries (iso_code, country_name) values ('EH', 'Western Sahara');
+insert into iso_countries (iso_code, country_name) values ('YE', 'Yemen');
+insert into iso_countries (iso_code, country_name) values ('YU', 'Yugoslavia');
+insert into iso_countries (iso_code, country_name) values ('ZM', 'Zambia');
+insert into iso_countries (iso_code, country_name) values ('ZW', 'Zimbabwe');
+-- End
diff --git a/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/default/upgrade/address-upgrade-1.sql b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/default/upgrade/address-upgrade-1.sql
new file mode 100755
index 000000000..111f85480
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/default/upgrade/address-upgrade-1.sql
@@ -0,0 +1,17 @@
+--
+-- Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public License
+-- as published by the Free Software Foundation; either version 2.1 of
+-- the License, or (at your option) any later version.
+--
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this library; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+alter table ct_addresses add uri VARCHAR(250);
diff --git a/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/oracle-se-create.sql b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/oracle-se-create.sql
new file mode 100755
index 000000000..e21b5b304
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/oracle-se-create.sql
@@ -0,0 +1,22 @@
+--
+-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public License
+-- as published by the Free Software Foundation; either version 2.1 of
+-- the License, or (at your option) any later version.
+--
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this library; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+--
+-- $Id: oracle-se-create.sql 1597 2007-07-10 16:27:26Z p_boy $
+-- $DateTime: 2004/08/17 23:15:09 $
+@ ddl/oracle-se/create.sql
+@ ddl/oracle-se/deferred.sql
+@ default/insert-iso-countries.sql
diff --git a/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/oracle-se/upgrade/address-upgrade-2.sql b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/oracle-se/upgrade/address-upgrade-2.sql
new file mode 100755
index 000000000..e572d4160
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/oracle-se/upgrade/address-upgrade-2.sql
@@ -0,0 +1,24 @@
+--
+-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public License
+-- as published by the Free Software Foundation; either version 2.1 of
+-- the License, or (at your option) any later version.
+--
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this library; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+--
+-- $Id: address-upgrade-2.sql 1597 2007-07-10 16:27:26Z p_boy $
+-- $DateTime: 2004/08/17 23:15:09 $
+
+alter table ct_addresses modify email varchar(75);
+alter table ct_addresses drop column notes;
+alter table ct_addresses add notes clob;
+
diff --git a/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/postgres-create.sql b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/postgres-create.sql
new file mode 100755
index 000000000..c8628d5e6
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/postgres-create.sql
@@ -0,0 +1,24 @@
+--
+-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public License
+-- as published by the Free Software Foundation; either version 2.1 of
+-- the License, or (at your option) any later version.
+--
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this library; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+--
+-- $Id: postgres-create.sql 1597 2007-07-10 16:27:26Z p_boy $
+-- $DateTime: 2004/08/17 23:15:09 $
+begin;
+\i ddl/postgres/create.sql
+\i ddl/postgres/deferred.sql
+\i default/insert-iso-countries.sql
+end;
diff --git a/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/postgres/upgrade/address-upgrade-2.sql b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/postgres/upgrade/address-upgrade-2.sql
new file mode 100755
index 000000000..a461a9572
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/postgres/upgrade/address-upgrade-2.sql
@@ -0,0 +1,50 @@
+--
+-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public License
+-- as published by the Free Software Foundation; either version 2.1 of
+-- the License, or (at your option) any later version.
+--
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this library; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+--
+-- $Id: address-upgrade-2.sql 1597 2007-07-10 16:27:26Z p_boy $
+-- $DateTime: 2004/08/17 23:15:09 $
+
+create table temp as select * from ct_addresses;
+drop table ct_addresses;
+
+create table ct_addresses (
+ address_id INTEGER not null
+ constraint ct_addresse_address_id_p_y1u3b
+ primary key,
+ -- referential constraint for address_id deferred due to circular dependencies
+ address VARCHAR(1000),
+ email VARCHAR(75),
+ fax VARCHAR(20),
+ iso_country_code CHAR(2),
+ -- referential constraint for iso_country_code deferred due to circular dependencies
+ mobile VARCHAR(20),
+ notes TEXT,
+ phone VARCHAR(20),
+ postal_code VARCHAR(20),
+ uri VARCHAR(250)
+);
+alter table ct_addresses add
+ constraint ct_addre_iso_coun_code_f_o8h8a foreign key (iso_country_code)
+ references iso_countries(iso_code);
+alter table ct_addresses add
+ constraint ct_addresse_address_id_f__qv8u foreign key (address_id)
+ references cms_pages(item_id) on delete cascade;
+
+insert into ct_addresses (address_id, address, email, fax, iso_country_code, mobile, notes, phone, postal_code, uri)
+ select address_id, address, email, fax, iso_country_code, mobile, encode(notes, 'escape'), phone, postal_code, uri
+ from temp;
+drop table temp;
diff --git a/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/upgrade/oracle-se-1.sql b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/upgrade/oracle-se-1.sql
new file mode 100755
index 000000000..d0c1de781
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/upgrade/oracle-se-1.sql
@@ -0,0 +1,20 @@
+--
+-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public License
+-- as published by the Free Software Foundation; either version 2.1 of
+-- the License, or (at your option) any later version.
+--
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this library; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+--
+-- $Id: oracle-se-1.sql 1597 2007-07-10 16:27:26Z p_boy $
+-- $DateTime: 2004/08/17 23:15:09 $
+@@ ../default/upgrade/address-upgrade-1.sql
diff --git a/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/upgrade/oracle-se-2.sql b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/upgrade/oracle-se-2.sql
new file mode 100755
index 000000000..48ef0aaa6
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/upgrade/oracle-se-2.sql
@@ -0,0 +1,20 @@
+--
+-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public License
+-- as published by the Free Software Foundation; either version 2.1 of
+-- the License, or (at your option) any later version.
+--
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this library; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+--
+-- $Id: oracle-se-2.sql 1597 2007-07-10 16:27:26Z p_boy $
+-- $DateTime: 2004/08/17 23:15:09 $
+@@ ../oracle-se/upgrade/address-upgrade-2.sql
diff --git a/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/upgrade/postgres-1.sql b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/upgrade/postgres-1.sql
new file mode 100755
index 000000000..cc0cab5a0
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/upgrade/postgres-1.sql
@@ -0,0 +1,22 @@
+--
+-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public License
+-- as published by the Free Software Foundation; either version 2.1 of
+-- the License, or (at your option) any later version.
+--
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this library; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+--
+-- $Id: postgres-1.sql 1597 2007-07-10 16:27:26Z p_boy $
+-- $DateTime: 2004/08/17 23:15:09 $
+begin;
+\i ../default/upgrade/address-upgrade-1.sql
+end;
diff --git a/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/upgrade/postgres-2.sql b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/upgrade/postgres-2.sql
new file mode 100755
index 000000000..23d2600e3
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/sql/ccm-cms-types-oldaddress/upgrade/postgres-2.sql
@@ -0,0 +1,22 @@
+--
+-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public License
+-- as published by the Free Software Foundation; either version 2.1 of
+-- the License, or (at your option) any later version.
+--
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this library; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+--
+-- $Id: postgres-2.sql 1597 2007-07-10 16:27:26Z p_boy $
+-- $DateTime: 2004/08/17 23:15:09 $
+begin;
+\i ../postgres/upgrade/address-upgrade-2.sql
+end;
diff --git a/ccm-cms-types-simpleaddress/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SimpleAddress.xml b/ccm-cms-types-simpleaddress/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SimpleAddress.xml
new file mode 100755
index 000000000..72958ef1b
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SimpleAddress.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ccm-cms-types-simpleaddress/src/ccm-cms-types-simpleaddress.config b/ccm-cms-types-simpleaddress/src/ccm-cms-types-simpleaddress.config
new file mode 100755
index 000000000..ea39e9eec
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/ccm-cms-types-simpleaddress.config
@@ -0,0 +1,5 @@
+
+
+
+
diff --git a/ccm-cms-types-simpleaddress/src/ccm-cms-types-simpleaddress.load b/ccm-cms-types-simpleaddress/src/ccm-cms-types-simpleaddress.load
new file mode 100755
index 000000000..1c3f0604b
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/ccm-cms-types-simpleaddress.load
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ccm-cms-types-simpleaddress/src/ccm-cms-types-simpleaddress.upgrade b/ccm-cms-types-simpleaddress/src/ccm-cms-types-simpleaddress.upgrade
new file mode 100644
index 000000000..e11b21887
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/ccm-cms-types-simpleaddress.upgrade
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/IsoCountry.java b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/IsoCountry.java
new file mode 100755
index 000000000..98c36807c
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/IsoCountry.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes;
+
+import com.arsdigita.domain.DataObjectNotFoundException;
+import com.arsdigita.domain.DomainObject;
+import com.arsdigita.domain.DomainCollection;
+import com.arsdigita.persistence.DataCollection;
+import com.arsdigita.persistence.DataObject;
+import com.arsdigita.persistence.OID;
+import com.arsdigita.persistence.SessionManager;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+/**
+ * This class represents country information, iso code and name. The country
+ * information is being used by {@link com.arsdigita.cms.contenttypes.Address}.
+ *
+ * @author Dominik Kacprzak
+ * @version $Revision: #4 $ $Date: 2004/08/17 $
+ **/
+public class IsoCountry extends DomainObject {
+
+ /** Data object type for this domain object */
+ public static final String BASE_DATA_OBJECT_TYPE
+ = "com.arsdigita.cms.contenttypes.IsoCountry";
+
+ /** PDL property name for country iso code */
+ public static final String ISO_CODE = "isoCode";
+ /** PDL property name for country name */
+ public static final String COUNTRY_NAME = "countryName";
+
+ public IsoCountry( ) {
+ super( BASE_DATA_OBJECT_TYPE );
+ }
+
+ public IsoCountry( OID oid ) throws DataObjectNotFoundException {
+ super( oid );
+ }
+
+ public IsoCountry( DataObject obj ) {
+ super(obj);
+ }
+
+ public String getIsoCode( ) {
+ return ( String ) get( ISO_CODE );
+ }
+
+ public void setIsoCode( String isoCode ) {
+ set( ISO_CODE, isoCode );
+ }
+
+ /**
+ *
+ */
+ public String getCountryName( ) {
+ return ( String ) get( COUNTRY_NAME );
+ }
+
+ /**
+ * Sets country name
+ *
+ * @param countryName
+ */
+ public void setCountryName( String countryName ) {
+ set( COUNTRY_NAME, countryName );
+ }
+
+ public static DomainCollection retrieveAll() {
+ DataCollection isoCodes = SessionManager.getSession()
+ .retrieve( IsoCountry.BASE_DATA_OBJECT_TYPE );
+ isoCodes.addOrder(COUNTRY_NAME);
+ return new DomainCollection(isoCodes) {};
+ }
+
+ /**
+ * Returns iterator of all available iso country codes as strings.
+ *
+ * @return iterator or null if there is no country codes
+ * available
+ */
+ public static Iterator getIsoCodes( ) {
+ LinkedList list = new LinkedList();
+ // get all iso codes
+ DataCollection isoCodes = SessionManager.getSession()
+ .retrieve( IsoCountry.BASE_DATA_OBJECT_TYPE );
+ while ( isoCodes.next() ) {
+ IsoCountry country = new IsoCountry( isoCodes.getDataObject( ) );
+ list.addLast( country.getIsoCode() );
+ }
+ if ( list.size() != 0 ) {
+ return list.iterator();
+ }
+ return null;
+ }
+}
diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddress.java b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddress.java
new file mode 100755
index 000000000..502975fe4
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddress.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes;
+
+
+import com.arsdigita.cms.ContentType;
+import com.arsdigita.cms.ContentPage;
+import com.arsdigita.domain.DataObjectNotFoundException;
+import com.arsdigita.persistence.DataObject;
+import com.arsdigita.persistence.OID;
+import com.arsdigita.util.Assert;
+import java.math.BigDecimal;
+
+/**
+ * DomainObject class to represent address ContentType
+ * objects.
+ *
+ * This content type represents a generic address which is not country specific.
+ * It provides methods for creating new address objects, retrieving existing
+ * objects from the persistent storage and retrieving and setting is properties.
+ * This class extends {@link com.arsdigita.cms.ContentPage content page} and
+ * adds extended attributes specific for an not country specific address:
+ *
+ * @author Dominik Kacprzak
+ * @version $Revision: #6 $ $Date: 2004/08/17 $
+ **/
+public class SimpleAddress extends ContentPage {
+
+ /** PDL property name for address */
+ public static final String ADDRESS = "address";
+ /** PDL property name for country iso code */
+ public static final String ISO_COUNTRY_CODE = "isoCountryCode";
+ /** PDL property name for postal code */
+ public static final String POSTAL_CODE = "postalCode";
+ /** PDL property name for phone number */
+ public static final String PHONE = "phone";
+ /** PDL property name for mobile phone number */
+ public static final String MOBILE = "mobile";
+ /** PDL property name for fax number */
+ public static final String FAX = "fax";
+ /** PDL property name for email address */
+ public static final String EMAIL = "email";
+ /** PDL property name for notes */
+ public static final String NOTES = "notes";
+ /** PDL property name for URI*/
+ public static final String URI = "uri";
+
+ /** Data object type for this domain object */
+ public static final String BASE_DATA_OBJECT_TYPE
+ = "com.arsdigita.cms.contenttypes.Address";
+
+ private static final SimpleAddressConfig s_config = new SimpleAddressConfig();
+ static {
+ s_config.load();
+ }
+ public static final SimpleAddressConfig getConfig()
+ {
+ return s_config;
+ }
+
+ /**
+ * Default constructor. This creates a new (empty) SimpleAddress.
+ **/
+ public SimpleAddress() {
+ this(BASE_DATA_OBJECT_TYPE);
+ }
+
+ /**
+ * Constructor. The contained DataObject is retrieved
+ * from the persistent storage mechanism with an OID
+ * specified by id and
+ * SimpleAddress.BASE_DATA_OBJECT_TYPE.
+ *
+ * @param id The id for the retrieved
+ * DataObject.
+ **/
+ public SimpleAddress(BigDecimal id) throws DataObjectNotFoundException {
+ this(new OID(BASE_DATA_OBJECT_TYPE, id));
+ }
+
+ /**
+ * Constructor. The contained DataObject is retrieved
+ * from the persistent storage mechanism with an OID
+ * specified by id.
+ *
+ * @param id The OID for the retrieved
+ * DataObject.
+ **/
+ public SimpleAddress(OID id) throws DataObjectNotFoundException {
+ super(id);
+ }
+
+ /**
+ * Constructor. Retrieves or creates a content item using the
+ * DataObject argument.
+ *
+ * @param obj The DataObject with which to create or
+ * load a content item
+ */
+ public SimpleAddress(DataObject obj) {
+ super(obj);
+ }
+
+ /**
+ * Constructor. Creates a new content item using the given data
+ * object type. Such items are created as draft versions.
+ *
+ * @param type The String data object type of the
+ * item to create
+ */
+ public SimpleAddress(String type) {
+ super(type);
+ }
+
+ /**
+ * For new content items, sets the associated content type if it
+ * has not been already set.
+ */
+ public void beforeSave() {
+ super.beforeSave();
+
+ Assert.exists(getContentType(), ContentType.class);
+ }
+
+ /* accessors *****************************************************/
+ public String getAddress( ) {
+ return ( String ) get( ADDRESS );
+ }
+
+ public void setAddress( String address ) {
+ set( ADDRESS, address );
+ }
+
+ public String getCountryIsoCode( ) {
+ DataObject obj = ( DataObject ) get( ISO_COUNTRY_CODE );
+ if ( obj != null ) {
+ IsoCountry country = new IsoCountry( obj );
+ return country.getIsoCode( );
+ }
+ return null;
+ }
+
+ public void setCountryIsoCode( String isoCode ) {
+ IsoCountry assn = null;
+ try {
+ OID oid = new OID( IsoCountry.BASE_DATA_OBJECT_TYPE );
+ oid.set( IsoCountry.ISO_CODE, isoCode );
+
+ assn = new IsoCountry( oid );
+ } catch (DataObjectNotFoundException e) {
+ assn = new IsoCountry( );
+ assn.setIsoCode( isoCode );
+ assn.save();
+ }
+ setAssociation( ISO_COUNTRY_CODE, assn );
+ }
+
+ public String getPostalCode( ) {
+ return ( String ) get( POSTAL_CODE );
+ }
+
+ public void setPostalCode( String postalCode ) {
+ set( POSTAL_CODE, postalCode );
+ }
+
+ public String getPhone( ) {
+ return ( String ) get( PHONE );
+ }
+
+ public void setPhone( String phone ) {
+ set( PHONE, phone );
+ }
+
+ public String getMobile( ) {
+ return ( String ) get( MOBILE );
+ }
+
+ public void setMobile( String mobile ) {
+ set( MOBILE, mobile );
+ }
+
+ public String getFax( ) {
+ return ( String ) get( FAX );
+ }
+
+ public void setFax( String fax ) {
+ set( FAX, fax );
+ }
+
+ public String getEmail( ) {
+ return ( String ) get( EMAIL );
+ }
+
+ public void setEmail( String email ) {
+ set( EMAIL, email );
+ }
+
+ public String getNotes( ) {
+ return ( String ) get( NOTES );
+ }
+
+ public void setNotes( String notes ) {
+ set( NOTES, notes );
+ }
+
+ public void setURI( String uri) {
+ set(URI, uri);
+ }
+
+ public String getURI() {
+ return (String)get(URI);
+ }
+
+}
diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressAddressConfig_parameter.properties b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressAddressConfig_parameter.properties
new file mode 100755
index 000000000..62d3e7fdf
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressAddressConfig_parameter.properties
@@ -0,0 +1,9 @@
+com.arsdigita.cms.contenttypes.address.hide_country_code_selection.title=Hide ISO Country Code
+com.arsdigita.cms.contenttypes.address.hide_country_code_selection.purpose=Hide the ISO country code selection box
+com.arsdigita.cms.contenttypes.address.hide_country_code_selection.example=false
+com.arsdigita.cms.contenttypes.address.hide_country_code_selection.format=[boolean]
+
+com.arsdigita.cms.contenttypes.address.hide_postal_code.title=Hide Postal Code
+com.arsdigita.cms.contenttypes.address.hide_postal_code.purpose=Hide the the postal code entry field
+com.arsdigita.cms.contenttypes.address.hide_postal_code.example=false
+com.arsdigita.cms.contenttypes.address.hide_postal_code.format=[boolean]
diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressConfig.java b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressConfig.java
new file mode 100755
index 000000000..a26cf55f0
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressConfig.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2004 Red Hat Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes;
+
+import com.arsdigita.runtime.AbstractConfig;
+import com.arsdigita.util.parameter.Parameter;
+import com.arsdigita.util.parameter.BooleanParameter;
+
+public class SimpleAddressConfig extends AbstractConfig {
+
+ private final Parameter m_hideCountryCodeSelection;
+ private final Parameter m_hidePostalCode;
+
+ public SimpleAddressConfig() {
+ m_hideCountryCodeSelection = new BooleanParameter(
+ "com.arsdigita.cms.contenttypes.address.hide_country_code_selection",
+ Parameter.REQUIRED,
+ new Boolean(false));
+
+ m_hidePostalCode = new BooleanParameter(
+ "com.arsdigita.cms.contenttypes.address.hide_postal_code",
+ Parameter.REQUIRED,
+ new Boolean(false));
+
+
+ register(m_hideCountryCodeSelection);
+ register(m_hidePostalCode);
+
+ loadInfo();
+ }
+
+ public final boolean getHideCountryCodeSelection() {
+ return ((Boolean) get(m_hideCountryCodeSelection)).booleanValue();
+ }
+ public final boolean getHidePostalCode() {
+ return ((Boolean) get(m_hidePostalCode)).booleanValue();
+ }
+}
+
diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressInitializer.java b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressInitializer.java
new file mode 100755
index 000000000..541339ef2
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressInitializer.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes;
+
+import com.arsdigita.domain.DomainObject;
+import com.arsdigita.domain.DomainObjectFactory;
+import com.arsdigita.domain.DomainObjectInstantiator;
+import com.arsdigita.persistence.DataObject;
+import com.arsdigita.runtime.DomainInitEvent;
+import org.apache.log4j.Logger;
+
+/**
+ * Initializes the SimpleAddress content type.
+ *
+ * @author Justin Ross <jross@redhat.com>
+ * @version $Id: SimpleAddressInitializer.java 1597 2007-07-10 16:27:26Z p_boy $
+ */
+public class SimpleAddressInitializer extends ContentTypeInitializer {
+
+ private static final Logger s_log = Logger.getLogger(SimpleAddressInitializer.class);
+
+ /**
+ * Constructor
+ */
+ public SimpleAddressInitializer() {
+ super("ccm-cms-types-oldaddress.pdl.mf",
+ SimpleAddress.BASE_DATA_OBJECT_TYPE);
+ }
+
+ /**
+ * Initializer
+ * @param evt
+ */
+ public void init(DomainInitEvent evt) {
+ super.init(evt);
+
+ // register the DomainObjectInstantiator from ISO Country
+ DomainObjectInstantiator instIsocountry =
+ new DomainObjectInstantiator() {
+ public DomainObject doNewInstance(DataObject dataObject) {
+ return new IsoCountry(dataObject);
+ }
+ public DomainObjectInstantiator resolveInstantiator(DataObject obj) {
+ return this;
+ }
+ };
+ DomainObjectFactory.registerInstantiator(
+ IsoCountry.BASE_DATA_OBJECT_TYPE,
+ instIsocountry
+ );
+ }
+
+ /**
+ * Provides location of the stylesheets assoziated with this content type.
+ * @return
+ */
+ public String[] getStylesheets() {
+ return new String[] {
+ "/static/content-types/com/arsdigita/cms/contenttypes/Address.xsl" };
+ }
+}
diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressLoader.java b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressLoader.java
new file mode 100755
index 000000000..9564ef590
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressLoader.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes;
+
+
+import com.arsdigita.cms.contenttypes.AbstractContentTypeLoader;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Loader.
+ *
+ * @author Justin Ross <jross@redhat.com>
+ * @version $Id: SimpleAddressLoader.java 1597 2007-07-10 16:27:26Z p_boy $
+ */
+public class SimpleAddressLoader extends AbstractContentTypeLoader {
+
+ private static final Logger s_log = Logger.getLogger(SimpleAddressLoader.class);
+
+ private static final String[] TYPES = {
+ "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Address.xml"
+ };
+
+ public String[] getTypes() {
+ return TYPES;
+ }
+}
diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressResources.properties b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressResources.properties
new file mode 100755
index 000000000..c0c197c76
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressResources.properties
@@ -0,0 +1,18 @@
+address.authoring.basic_properties.title=Address Properties
+address.authoring.basic_properties.description=Edit the basic address properties
+address.authoring.categories.title=Assign categories
+address.authoring.categories.description=Assign categories
+cms.contenttypes.ui.address.address=Address
+cms.contenttypes.ui.address.email=Email
+cms.contenttypes.ui.address.fax=Fax
+cms.contenttypes.ui.address.iso_country_code=Country
+cms.contenttypes.ui.address.mobile=Mobile
+cms.contenttypes.ui.address.phone=Phone
+cms.contenttypes.ui.address.postal_code=Postal Code
+cms.contenttypes.ui.address.email_desc=Means of contacting someone at this address
+cms.contenttypes.ui.address.email_hint=Means of contacting someone at this address
+cms.contenttypes.ui.address.notes=Notes
+cms.contenttypes.ui.address.uri=URL
+cms.contenttypes.ui.address.uri_desc=A URL to find more information about this Address
+cms.contenttypes.ui.address.uri_hint=A URL to find more information about this Address
+cms.contenttypes.ui.address.error_iso_country=You must select a country
diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressResources_de.properties b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressResources_de.properties
new file mode 100755
index 000000000..506aace00
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/SimpleAddressResources_de.properties
@@ -0,0 +1,22 @@
+# AddressResources_de.properties
+# Alle deutschem Umlaute muessen als UTF-8 eingetragen werden:
+# ä = \u00c4 ü = \u00fc
+# ö = \u00f6
+address.authoring.basic_properties.title=Eigenschaften von Adressen
+address.authoring.basic_properties.description=Bearbeiten der Basisangaben
+address.authoring.categories.title=Kategorien zuordnen
+address.authoring.categories.description=Kategorien zuordnen
+cms.contenttypes.ui.address.address=Adresse:
+cms.contenttypes.ui.address.email=Email:
+cms.contenttypes.ui.address.fax=Fax:
+cms.contenttypes.ui.address.iso_country_code=Landescode:
+cms.contenttypes.ui.address.mobile=Mobil:
+cms.contenttypes.ui.address.phone=Tel.:
+cms.contenttypes.ui.address.postal_code=Postleitzahl
+cms.contenttypes.ui.address.email_desc=Weg, den Betreffenden zu kontaktieren
+cms.contenttypes.ui.address.email_hint=Weg, den Betreffenden zu kontaktieren
+cms.contenttypes.ui.address.notes=Notizen
+cms.contenttypes.ui.address.uri=URL
+cms.contenttypes.ui.address.uri_desc=URL, um weitere Informationen zu erhalten
+cms.contenttypes.ui.address.uri_hint=URL, um weitere Informationen zu erhalten
+cms.contenttypes.ui.address.error_iso_country=Es muss ein Land ausgew\u00c4hlt werden
diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/ui/SimpleAddressPropertiesStep.java b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/ui/SimpleAddressPropertiesStep.java
new file mode 100755
index 000000000..c34e55a98
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/ui/SimpleAddressPropertiesStep.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.cms.ContentPage;
+import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.SimpleAddress;
+import com.arsdigita.domain.DomainObject;
+import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
+import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
+import com.arsdigita.cms.ui.authoring.BasicPageForm;
+import com.arsdigita.cms.ui.authoring.SimpleEditStep;
+import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
+import com.arsdigita.cms.contenttypes.util.SimpleAddressGlobalizationUtil;
+
+import java.text.DateFormat;
+
+/**
+ * Authoring step to edit the simple attributes of the SimpleAddress content type (and
+ * its subclasses). This authoring step replaces the
+ * com.arsdigita.ui.authoring.PageEdit step for this type.
+ *
+ * @author Dominik Kacprzak
+ * @version $Revision: #6 $ $Date: 2004/08/17 $
+ *
+ **/
+public class SimpleAddressPropertiesStep extends SimpleEditStep {
+
+ /** The name of the editing sheet added to this step */
+ public static final String EDIT_SHEET_NAME = "edit";
+
+ public SimpleAddressPropertiesStep(ItemSelectionModel itemModel,
+ AuthoringKitWizard parent ) {
+ super(itemModel, parent );
+
+ setDefaultEditKey(EDIT_SHEET_NAME);
+ BasicPageForm editSheet;
+
+ editSheet = new SimpleAddressPropertyForm(itemModel, this);
+ add(EDIT_SHEET_NAME, "Edit",
+ new WorkflowLockedComponentAccess(editSheet, itemModel),
+ editSheet.getSaveCancelSection().getCancelButton() );
+
+ setDisplayComponent(getAddressPropertySheet(itemModel));
+ }
+
+ /**
+ * Returns a component that displays the properties of the SimpleAddress specified
+ * by the ItemSelectionModel passed in.
+ *
+ * @param itemModel The ItemSelectionModel to use
+ * @pre itemModel != null
+ * @return A component to display the state of the basic properties
+ * of the address content type.
+ **/
+ public static Component getAddressPropertySheet(ItemSelectionModel
+ itemModel ) {
+ DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
+
+ sheet.add( (String) SimpleAddressGlobalizationUtil.globalize
+ ("cms.contenttypes.ui.name").localize(),
+ SimpleAddress.NAME );
+ sheet.add( (String) SimpleAddressGlobalizationUtil.globalize
+ ("cms.contenttypes.ui.title").localize(),
+ SimpleAddress.TITLE);
+ if (!ContentSection.getConfig().getHideLaunchDate()) {
+ sheet.add( (String) SimpleAddressGlobalizationUtil.globalize
+ ("cms.ui.authoring.page_launch_date").localize(),
+ ContentPage.LAUNCH_DATE,
+ new DomainObjectPropertySheet.AttributeFormatter() {
+ public String format(DomainObject item,
+ String attribute,
+ PageState state) {
+ ContentPage page = (ContentPage) item;
+ if (page.getLaunchDate() != null) {
+ return DateFormat.getDateInstance(DateFormat.LONG)
+ .format(page.getLaunchDate());
+ } else {
+ return (String)SimpleAddressGlobalizationUtil.globalize
+ ("cms.ui.unknown").localize();
+ }
+ }
+ });
+ }
+ sheet.add( (String) SimpleAddressGlobalizationUtil.globalize
+ ("cms.contenttypes.ui.address.address").localize(),
+ SimpleAddress.ADDRESS);
+ if (!SimpleAddress.getConfig().getHideCountryCodeSelection()) {
+ sheet.add( (String) SimpleAddressGlobalizationUtil.globalize
+ ("cms.contenttypes.ui.address.iso_country_code").localize(),
+ SimpleAddress.ISO_COUNTRY_CODE,
+ new DomainObjectPropertySheet.AttributeFormatter() {
+ public String format( DomainObject item,
+ String attribute,
+ PageState state ) {
+ SimpleAddress address = ( SimpleAddress ) item;
+ if ( address.getCountryIsoCode() != null ) {
+ return address.getCountryIsoCode();
+ } else {
+ return (String)SimpleAddressGlobalizationUtil.globalize
+ ("cms.ui.unknown").localize();
+ }
+ }
+ });
+ }
+ if (!SimpleAddress.getConfig().getHidePostalCode()) {
+ sheet.add( (String) SimpleAddressGlobalizationUtil.globalize
+ ("cms.contenttypes.ui.address.postal_code").localize(),
+ SimpleAddress.POSTAL_CODE);
+ }
+ sheet.add((String) SimpleAddressGlobalizationUtil
+ .globalize("cms.contenttypes.ui.address.phone").localize(),
+ SimpleAddress.PHONE);
+ sheet.add((String) SimpleAddressGlobalizationUtil.globalize
+ ("cms.contenttypes.ui.address.mobile").localize(),
+ SimpleAddress.MOBILE);
+ sheet.add((String) SimpleAddressGlobalizationUtil.globalize
+ ("cms.contenttypes.ui.address.fax").localize(),
+ SimpleAddress.FAX);
+ sheet.add((String) SimpleAddressGlobalizationUtil.globalize
+ ("cms.contenttypes.ui.address.email").localize(),
+ SimpleAddress.EMAIL);
+
+ sheet.add((String) SimpleAddressGlobalizationUtil.globalize
+ ("cms.contenttypes.ui.address.uri").localize(),
+ SimpleAddress.URI);
+
+ sheet.add((String) SimpleAddressGlobalizationUtil.globalize
+ ("cms.contenttypes.ui.address.notes").localize(),
+ SimpleAddress.NOTES);
+
+ return sheet;
+ }
+}
diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/ui/SimpleAddressPropertyForm.java b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/ui/SimpleAddressPropertyForm.java
new file mode 100755
index 000000000..c5afbf2f7
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/ui/SimpleAddressPropertyForm.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.bebop.FormData;
+import com.arsdigita.bebop.FormProcessException;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.event.FormInitListener;
+import com.arsdigita.bebop.event.FormProcessListener;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.bebop.event.FormSubmissionListener;
+import com.arsdigita.bebop.event.ParameterEvent;
+import com.arsdigita.bebop.event.ParameterListener;
+// import com.arsdigita.bebop.event.ParameterListener;
+import com.arsdigita.bebop.form.Option;
+import com.arsdigita.bebop.form.SingleSelect;
+import com.arsdigita.bebop.form.TextArea;
+import com.arsdigita.bebop.form.TextField;
+import com.arsdigita.bebop.parameters.NotNullValidationListener;
+import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
+import com.arsdigita.bebop.parameters.ParameterModel;
+import com.arsdigita.bebop.parameters.StringParameter;
+import com.arsdigita.bebop.parameters.URLValidationListener;
+import com.arsdigita.bebop.parameters.ParameterData;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.SimpleAddress;
+import com.arsdigita.cms.contenttypes.util.SimpleAddressGlobalizationUtil;
+import com.arsdigita.cms.contenttypes.IsoCountry;
+import com.arsdigita.cms.ui.authoring.BasicPageForm;
+import com.arsdigita.domain.DomainCollection;
+import org.apache.log4j.Logger;
+
+/**
+ * Form to edit the basic properties of an address. These are address body,
+ * country, postal code, phone, mobile phone, fax, email address, and notes.
+ * Used by SimpleAddressPropertiesStep authoring kit step.
+ *
+ * This form can be extended to create forms for SimpleAddress subclasses.
+ *
+ * @author Dominik Kacprzak
+ * @version $Revision: $ $Date: $
+ **/
+public class SimpleAddressPropertyForm extends BasicPageForm
+ implements FormProcessListener, FormInitListener, FormSubmissionListener {
+
+ private static final Logger s_log = Logger.getLogger(SimpleAddressPropertyForm.class);
+
+ private SimpleAddressPropertiesStep m_step;
+
+ /** SimpleAddress body parameter name */
+ public static final String ADDRESS = SimpleAddress.ADDRESS;
+ /** Country iso code parameter name */
+ public static final String ISO_COUNTRY_CODE = SimpleAddress.ISO_COUNTRY_CODE;
+ /** Postal code parameter name */
+ public static final String POSTAL_CODE = SimpleAddress.POSTAL_CODE;
+ /** Phone number parameter name */
+ public static final String PHONE = SimpleAddress.PHONE;
+ /** Mobile phone number parameter name */
+ public static final String MOBILE = SimpleAddress.MOBILE;
+ /** Fax number parameter name */
+ public static final String FAX = SimpleAddress.FAX;
+ /** Email address parameter name */
+ public static final String EMAIL = SimpleAddress.EMAIL;
+ /** SimpleAddress notes parameter name */
+ public static final String NOTES = SimpleAddress.NOTES;
+ /** SimpleAddress URI parameter name*/
+ public static final String URI = SimpleAddress.URI;
+
+ /** Name of this form */
+ public static final String ID = "Address_edit";
+
+ /**
+ * Creates a new form to edit the SimpleAddress object specified by the item
+ * selection model passed in.
+ *
+ * @param itemModel The ItemSelectionModel to use to obtain the SimpleAddress to
+ * work on
+ **/
+ public SimpleAddressPropertyForm( ItemSelectionModel itemModel ) {
+ this(itemModel,null);
+ }
+ /**
+ * Creates a new form to edit the SimpleAddress object specified by the item
+ * selection model passed in.
+ *
+ * @param itemModel The ItemSelectionModel to use to obtain the SimpleAddress to
+ * work on
+ * @param step The SimpleAddressPropertiesStep which controls this form.
+ **/
+ public SimpleAddressPropertyForm( ItemSelectionModel itemModel, SimpleAddressPropertiesStep step ) {
+ super( ID, itemModel );
+ m_step = step;
+ addSubmissionListener(this);
+ }
+
+ /**
+ * Adds widgets to the form.
+ **/
+ protected void addWidgets() {
+ super.addWidgets();
+
+ add( new Label( (String)SimpleAddressGlobalizationUtil.globalize
+ ( "cms.contenttypes.ui.address.address" ).localize() ) );
+ ParameterModel addressBodyParam = new StringParameter( ADDRESS );
+ addressBodyParam.addParameterListener( new NotNullValidationListener( ) );
+ addressBodyParam.addParameterListener( new StringInRangeValidationListener(0, 1000) );
+ TextArea addressBody = new TextArea( addressBodyParam );
+ addressBody.setRows(5);
+ addressBody.setCols(30);
+ add( addressBody );
+
+ if (!SimpleAddress.getConfig().getHideCountryCodeSelection()) {
+ add( new Label( (String)SimpleAddressGlobalizationUtil.globalize
+ ( "cms.contenttypes.ui.address.iso_country_code" ).localize() ) );
+ ParameterModel isoCountryCodeParam = new StringParameter( ISO_COUNTRY_CODE );
+ //isoCountryCodeParam.addParameterListener( new NotNullValidationListener( ) );
+ // Don't assume submission via drop-down menu isoCountryCode
+ isoCountryCodeParam.addParameterListener( new StringInRangeValidationListener(0, 2) );
+ SingleSelect isoCountryCode = new SingleSelect( isoCountryCodeParam );
+
+ isoCountryCode.addOption( new Option( "",
+ new Label( (String)SimpleAddressGlobalizationUtil.globalize
+ ("cms.ui.select_one" ).localize() ) ) );
+
+
+ // retrieve country iso codes
+ DomainCollection countries = IsoCountry.retrieveAll();
+ while (countries.next()) {
+ IsoCountry country = (IsoCountry)countries.getDomainObject();
+ isoCountryCode.addOption( new Option( country.getIsoCode(),
+ country.getCountryName()));
+ }
+
+ isoCountryCode.addValidationListener(
+ new ParameterListener() {
+ public void validate(ParameterEvent e) throws FormProcessException {
+ // the --select one-- option is not allowed
+ ParameterData data = e.getParameterData();
+ String isoCode = (String) data.getValue() ;
+ s_log.debug("ISO code is : " + isoCode);
+ if (isoCode == null || isoCode.length() == 0) {
+ data.addError(
+ (String)SimpleAddressGlobalizationUtil.globalize(
+ "cms.contenttypes.ui.address.error_iso_country").localize());
+ }
+ }});
+
+ add( isoCountryCode );
+ }
+
+ if (!SimpleAddress.getConfig().getHidePostalCode()) {
+ add( new Label( (String)SimpleAddressGlobalizationUtil.globalize
+ ( "cms.contenttypes.ui.address.postal_code" ).localize() ) );
+ ParameterModel postalCodeParam = new StringParameter( POSTAL_CODE );
+ // postalCodeParam.addParameterListener( new NotNullValidationListener( ) );
+ postalCodeParam.addParameterListener( new StringInRangeValidationListener(0, 20) );
+ TextField postalCode = new TextField( postalCodeParam );
+ postalCode.setMaxLength( 20 );
+ add( postalCode );
+ }
+
+ add( new Label( SimpleAddressGlobalizationUtil.globalize( "cms.contenttypes.ui.address.phone" ) ) );
+ ParameterModel phoneParam = new StringParameter( PHONE );
+ phoneParam.addParameterListener( new StringInRangeValidationListener(0, 20) );
+ TextField phone = new TextField( phoneParam );
+ phone.setSize(20);
+ phone.setMaxLength( 20 );
+ add( phone );
+
+ add( new Label( (String)SimpleAddressGlobalizationUtil.globalize
+ ( "cms.contenttypes.ui.address.mobile" ).localize() ) );
+ ParameterModel mobileParam = new StringParameter( MOBILE );
+ mobileParam.addParameterListener( new StringInRangeValidationListener(0, 20) );
+ TextField mobile = new TextField( mobileParam );
+ mobile.setSize(20);
+ mobile.setMaxLength( 20 );
+ add( mobile );
+
+ add( new Label( (String)SimpleAddressGlobalizationUtil.globalize
+ ( "cms.contenttypes.ui.address.fax" ).localize() ) );
+ ParameterModel faxParam = new StringParameter( FAX );
+ faxParam.addParameterListener( new StringInRangeValidationListener(0, 20) );
+ TextField fax = new TextField( faxParam );
+ fax.setSize(20);
+ fax.setMaxLength( 20 );
+ add( fax );
+
+ add( new Label( (String)SimpleAddressGlobalizationUtil.globalize
+ ( "cms.contenttypes.ui.address.email" ).localize() ) );
+ ParameterModel emailParam = new StringParameter( EMAIL );
+ emailParam.addParameterListener( new StringInRangeValidationListener(0, 75) );
+ TextField email = new TextField( emailParam );
+ email.setSize(25);
+ email.setMaxLength( 75 );
+ email.setHint(SimpleAddressGlobalizationUtil.globalize
+ ( "cms.contenttypes.ui.address.email_hint").localize().toString());
+ add( email );
+ add(new Label(""));
+ add(new Label( (String)SimpleAddressGlobalizationUtil.globalize
+ ( "cms.contenttypes.ui.address.email_desc" ).localize() ) );
+
+ add( new Label( (String)SimpleAddressGlobalizationUtil.globalize
+ ( "cms.contenttypes.ui.address.uri" ).localize() ) );
+ ParameterModel uriParam = new StringParameter( URI );
+ uriParam.addParameterListener( new StringInRangeValidationListener(0, 250) );
+ TextField uri = new TextField( uriParam );
+ uri.addValidationListener(new URLValidationListener(){
+ public void validate(ParameterEvent e)throws FormProcessException{
+ ParameterData d = e.getParameterData();
+ String value = (String)d.getValue();
+ if(value.indexOf("http")<0)
+ value = "http://" + value;
+ d.setValue(value);
+ super.validate(e);
+ }
+ });
+ uri.setSize(30);
+ uri.setMaxLength( 250 );
+ uri.setHint(SimpleAddressGlobalizationUtil.globalize
+ ( "cms.contenttypes.ui.address.uri_hint").localize().toString());
+ add( uri );
+ add(new Label(""));
+ add(new Label((String)SimpleAddressGlobalizationUtil.globalize
+ ( "cms.contenttypes.ui.address.uri_desc" ).localize() ) );
+
+ add( new Label( (String)SimpleAddressGlobalizationUtil.globalize
+ ( "cms.contenttypes.ui.address.notes" ).localize() ) );
+ ParameterModel notesParam = new StringParameter( NOTES );
+ TextArea notes = new TextArea( notesParam );
+ notes.setRows(8);
+ notes.setCols(30);
+ add( notes );
+ }
+
+ /**
+ * Form initialization hook. Fills widgets with data.
+ **/
+ public void init(FormSectionEvent fse) {
+ FormData data = fse.getFormData();
+ SimpleAddress address = ( SimpleAddress ) super.initBasicWidgets(fse);
+
+ //remind the user to prefix the URI with "http://"
+ String uri = address.getURI();
+ if(uri != null){
+ // this will accept https
+ if(uri.toLowerCase().indexOf("http") < 0)
+ address.setURI("http://" + uri);
+ } else {
+ address.setURI("http://");
+ }
+
+ data.put( ADDRESS, address.getAddress() );
+ if (!SimpleAddress.getConfig().getHideCountryCodeSelection()) {
+ data.put( ISO_COUNTRY_CODE, address.getCountryIsoCode() );
+ }
+ if (!SimpleAddress.getConfig().getHidePostalCode() ) {
+ data.put( POSTAL_CODE, address.getPostalCode() );
+ }
+ data.put( PHONE, address.getPhone() );
+ data.put( MOBILE, address.getMobile() );
+ data.put( FAX, address.getFax() );
+ data.put( EMAIL, address.getEmail() );
+ data.put( URI, address.getURI() );
+ data.put( NOTES, address.getNotes() );
+
+ }
+
+ /** Cancels streamlined editing. */
+ public void submitted( FormSectionEvent fse ) {
+ if (m_step != null &&
+ getSaveCancelSection().getCancelButton()
+ .isSelected( fse.getPageState())) {
+ m_step.cancelStreamlinedCreation(fse.getPageState());
+ }
+ }
+
+ /**
+ * Form processing hook. Saves SimpleAddress object.
+ **/
+ public void process(FormSectionEvent fse) {
+ FormData data = fse.getFormData();
+
+ SimpleAddress address = ( SimpleAddress ) super.processBasicWidgets( fse );
+
+ // save only if save button was pressed
+ if ( address != null &&
+ getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
+
+ address.setAddress( ( String ) data.get( ADDRESS ) );
+ if (!SimpleAddress.getConfig().getHideCountryCodeSelection()) {
+ address.setCountryIsoCode( ( String ) data.get( ISO_COUNTRY_CODE ) );
+ }
+ // if (!SimpleAddress.getConfig().getHidePostalCode()) {
+ // address.setPostalCode( ( String ) data.get( POSTAL_CODE ) );
+ // }
+ address.setPostalCode( !SimpleAddress.getConfig().getHidePostalCode() ?
+ ( String ) data.get( POSTAL_CODE ) :
+ ( String ) "" );
+ address.setPhone( ( String ) data.get( PHONE ) );
+ address.setMobile( ( String ) data.get( MOBILE ) );
+ address.setFax( ( String ) data.get( FAX ) );
+ address.setEmail( ( String ) data.get( EMAIL ) );
+ address.setURI( ( String ) data.get( URI ) );
+ address.setNotes( ( String ) data.get( NOTES ) );
+ // address.setNotes( data.get( NOTES )!= "" ? ( String )data.get( NOTES ) : ( String )"dummy" );
+ address.save();
+ }
+ if (m_step != null) {
+ m_step.maybeForwardToNextStep(fse.getPageState());
+ }
+ }
+}
diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/util/SimpleAddressGlobalizationUtil.java b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/util/SimpleAddressGlobalizationUtil.java
new file mode 100755
index 000000000..e342c5ea0
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/util/SimpleAddressGlobalizationUtil.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2004 Red Hat Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes.util;
+
+import com.arsdigita.globalization.GlobalizedMessage;
+
+/**
+ *
+ * .
+ * Contains methods to simplify globalizing keys
+ *
+ *
+ * @author randyg@arsdigita.com
+ * @version $Revision: #4 $ $Date: 2004/08/17 $
+ */
+
+public class SimpleAddressGlobalizationUtil {
+
+ final public static String BUNDLE_NAME =
+ "com.arsdigita.cms.contenttypes.util.AddressResourceBundle";
+
+ /**
+ * This returns a globalized message using the type specific bundle,
+ * BUNDLE_NAME
+ */
+ public static GlobalizedMessage globalize(String key) {
+ return new GlobalizedMessage(key, BUNDLE_NAME);
+ }
+
+ /**
+ * This returns a globalized message using the type specific bundle,
+ * BUNDLE_NAME
+ */
+ public static GlobalizedMessage globalize(String key, Object[] args) {
+ return new GlobalizedMessage(key, BUNDLE_NAME, args);
+ }
+}
diff --git a/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/util/SimpleAddressResourceBundle.java b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/util/SimpleAddressResourceBundle.java
new file mode 100755
index 000000000..7da4b5d27
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/src/com/arsdigita/cms/contenttypes/util/SimpleAddressResourceBundle.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2004 Red Hat Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes.util;
+
+import java.util.PropertyResourceBundle;
+import com.arsdigita.globalization.ChainedResourceBundle;
+import com.arsdigita.cms.CMSGlobalized;
+
+/**
+ * Resource Bundle used in UI for Address ContentType.
+ *
+ * @author Shashin Shinde sshinde@redhat.com
+ *
+ */
+public class SimpleAddressResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
+
+ public final static String ADDRESS_BUNDLE_NAME =
+ "com.arsdigita.cms.contenttypes.AddressResources";
+
+ public SimpleAddressResourceBundle() {
+ super();
+ addBundle((PropertyResourceBundle)getBundle(ADDRESS_BUNDLE_NAME));
+ addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
+ }
+}
diff --git a/ccm-cms-types-simpleaddress/web/static/content-types/com/arsdigita/cms/contenttypes/Address.xsl b/ccm-cms-types-simpleaddress/web/static/content-types/com/arsdigita/cms/contenttypes/Address.xsl
new file mode 100755
index 000000000..6044c0417
--- /dev/null
+++ b/ccm-cms-types-simpleaddress/web/static/content-types/com/arsdigita/cms/contenttypes/Address.xsl
@@ -0,0 +1,111 @@
+
+]>
+
+
+
+
+
+
+ |
+
+ |
+
+
+
+
+
+
+ | Address: |
+ |
+
+
+
+
+ | Postal Code: |
+ |
+
+
+
+
+ | Country: |
+ |
+
+
+
+
+ | Phone: |
+ |
+
+
+
+
+ | Mobile: |
+ |
+
+
+
+
+ | Fax: |
+ |
+
+
+
+
+ | E-Mail: |
+ |
+
+
+
+
+ | Notes: |
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+ Address
+
+
+
+ Postal Code
+
+
+
+ Country
+
+
+
+ Phone
+
+
+
+ Mobile
+
+
+
+ Fax
+
+
+
+ E-Mail
+
+
+
+ Notes
+
+
+
+
+
\ No newline at end of file