Moving oldaddress to simpleaddress and 1. part of refactoring.

git-svn-id: https://svn.libreccm.org/ccm/trunk@688 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2011-01-19 02:03:40 +00:00
parent 5379c45f03
commit 308e5745d7
32 changed files with 2129 additions and 0 deletions

View File

@ -0,0 +1 @@
build

View File

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-cms-types-oldaddress"
prettyName="Red Hat CCM Content Types"
version="6.6.0"
release="1"
webapp="ROOT">
<ccm:dependencies>
<ccm:requires name="ccm-core" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms" version="6.6.0" relation="ge"/>
</ccm:dependencies>
<ccm:directories>
<ccm:directory name="pdl"/>
<ccm:directory name="sql"/>
<ccm:directory name="src"/>
</ccm:directories>
<ccm:contacts>
<ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/>
<ccm:contact uri="mailto:rhea@redhat.com" type="support"/>
</ccm:contacts>
<ccm:description>
The old Address Content Type for the Red Hat CCM CMS.
</ccm:description>
</ccm:application>

View File

@ -0,0 +1,241 @@
This list states the country names (official short names in English) in alphabetical order as given in ISO 3166-1 and the corresponding ISO 3166-1-alpha-2 code elements. The list is updated whenever a change to the official code list in ISO 3166-1 is effected by the ISO 3166/MA. It lists 239 official short names and code elements. One line of text contains one entry. A country name and its code element are separated by a semicolon (;).
AFGHANISTAN;AF
ALBANIA;AL
ALGERIA;DZ
AMERICAN SAMOA;AS
ANDORRA;AD
ANGOLA;AO
ANGUILLA;AI
ANTARCTICA;AQ
ANTIGUA AND BARBUDA;AG
ARGENTINA;AR
ARMENIA;AM
ARUBA;AW
AUSTRALIA;AU
AUSTRIA;AT
AZERBAIJAN;AZ
BAHAMAS;BS
BAHRAIN;BH
BANGLADESH;BD
BARBADOS;BB
BELARUS;BY
BELGIUM;BE
BELIZE;BZ
BENIN;BJ
BERMUDA;BM
BHUTAN;BT
BOLIVIA;BO
BOSNIA AND HERZEGOVINA;BA
BOTSWANA;BW
BOUVET ISLAND;BV
BRAZIL;BR
BRITISH INDIAN OCEAN TERRITORY;IO
BRUNEI DARUSSALAM;BN
BULGARIA;BG
BURKINA FASO;BF
BURUNDI;BI
CAMBODIA;KH
CAMEROON;CM
CANADA;CA
CAPE VERDE;CV
CAYMAN ISLANDS;KY
CENTRAL AFRICAN REPUBLIC;CF
CHAD;TD
CHILE;CL
CHINA;CN
CHRISTMAS ISLAND;CX
COCOS (KEELING) ISLANDS;CC
COLOMBIA;CO
COMOROS;KM
CONGO;CG
CONGO, THE DEMOCRATIC REPUBLIC OF THE;CD
COOK ISLANDS;CK
COSTA RICA;CR
COTE D'IVOIRE;CI
CROATIA;HR
CUBA;CU
CYPRUS;CY
CZECH REPUBLIC;CZ
DENMARK;DK
DJIBOUTI;DJ
DOMINICA;DM
DOMINICAN REPUBLIC;DO
ECUADOR;EC
EGYPT;EG
EL SALVADOR;SV
EQUATORIAL GUINEA;GQ
ERITREA;ER
ESTONIA;EE
ETHIOPIA;ET
FALKLAND ISLANDS (MALVINAS);FK
FAROE ISLANDS;FO
FIJI;FJ
FINLAND;FI
FRANCE;FR
FRENCH GUIANA;GF
FRENCH POLYNESIA;PF
FRENCH SOUTHERN TERRITORIES;TF
GABON;GA
GAMBIA;GM
GEORGIA;GE
GERMANY;DE
GHANA;GH
GIBRALTAR;GI
GREECE;GR
GREENLAND;GL
GRENADA;GD
GUADELOUPE;GP
GUAM;GU
GUATEMALA;GT
GUINEA;GN
GUINEA-BISSAU;GW
GUYANA;GY
HAITI;HT
HEARD ISLAND AND MCDONALD ISLANDS;HM
HOLY SEE (VATICAN CITY STATE);VA
HONDURAS;HN
HONG KONG;HK
HUNGARY;HU
ICELAND;IS
INDIA;IN
INDONESIA;ID
IRAN, ISLAMIC REPUBLIC OF;IR
IRAQ;IQ
IRELAND;IE
ISRAEL;IL
ITALY;IT
JAMAICA;JM
JAPAN;JP
JORDAN;JO
KAZAKHSTAN;KZ
KENYA;KE
KIRIBATI;KI
KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF;KP
KOREA, REPUBLIC OF;KR
KUWAIT;KW
KYRGYZSTAN;KG
LAO PEOPLE'S DEMOCRATIC REPUBLIC;LA
LATVIA;LV
LEBANON;LB
LESOTHO;LS
LIBERIA;LR
LIBYAN ARAB JAMAHIRIYA;LY
LIECHTENSTEIN;LI
LITHUANIA;LT
LUXEMBOURG;LU
MACAO;MO
MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF;MK
MADAGASCAR;MG
MALAWI;MW
MALAYSIA;MY
MALDIVES;MV
MALI;ML
MALTA;MT
MARSHALL ISLANDS;MH
MARTINIQUE;MQ
MAURITANIA;MR
MAURITIUS;MU
MAYOTTE;YT
MEXICO;MX
MICRONESIA, FEDERATED STATES OF;FM
MOLDOVA, REPUBLIC OF;MD
MONACO;MC
MONGOLIA;MN
MONTSERRAT;MS
MOROCCO;MA
MOZAMBIQUE;MZ
MYANMAR;MM
NAMIBIA;NA
NAURU;NR
NEPAL;NP
NETHERLANDS;NL
NETHERLANDS ANTILLES;AN
NEW CALEDONIA;NC
NEW ZEALAND;NZ
NICARAGUA;NI
NIGER;NE
NIGERIA;NG
NIUE;NU
NORFOLK ISLAND;NF
NORTHERN MARIANA ISLANDS;MP
NORWAY;NO
OMAN;OM
PAKISTAN;PK
PALAU;PW
PALESTINIAN TERRITORY, OCCUPIED;PS
PANAMA;PA
PAPUA NEW GUINEA;PG
PARAGUAY;PY
PERU;PE
PHILIPPINES;PH
PITCAIRN;PN
POLAND;PL
PORTUGAL;PT
PUERTO RICO;PR
QATAR;QA
REUNION;RE
ROMANIA;RO
RUSSIAN FEDERATION;RU
RWANDA;RW
SAINT HELENA;SH
SAINT KITTS AND NEVIS;KN
SAINT LUCIA;LC
SAINT PIERRE AND MIQUELON;PM
SAINT VINCENT AND THE GRENADINES;VC
SAMOA;WS
SAN MARINO;SM
SAO TOME AND PRINCIPE;ST
SAUDI ARABIA;SA
SENEGAL;SN
SEYCHELLES;SC
SIERRA LEONE;SL
SINGAPORE;SG
SLOVAKIA;SK
SLOVENIA;SI
SOLOMON ISLANDS;SB
SOMALIA;SO
SOUTH AFRICA;ZA
SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS;GS
SPAIN;ES
SRI LANKA;LK
SUDAN;SD
SURINAME;SR
SVALBARD AND JAN MAYEN;SJ
SWAZILAND;SZ
SWEDEN;SE
SWITZERLAND;CH
SYRIAN ARAB REPUBLIC;SY
TAIWAN, PROVINCE OF CHINA;TW
TAJIKISTAN;TJ
TANZANIA, UNITED REPUBLIC OF;TZ
THAILAND;TH
TIMOR-LESTE;TL
TOGO;TG
TOKELAU;TK
TONGA;TO
TRINIDAD AND TOBAGO;TT
TUNISIA;TN
TURKEY;TR
TURKMENISTAN;TM
TURKS AND CAICOS ISLANDS;TC
TUVALU;TV
UGANDA;UG
UKRAINE;UA
UNITED ARAB EMIRATES;AE
UNITED KINGDOM;GB
UNITED STATES;US
UNITED STATES MINOR OUTLYING ISLANDS;UM
URUGUAY;UY
UZBEKISTAN;UZ
VANUATU;VU
VENEZUELA;VE
VIET NAM;VN
VIRGIN ISLANDS, BRITISH;VG
VIRGIN ISLANDS, U.S.;VI
WALLIS AND FUTUNA;WF
WESTERN SAHARA;EH
YEMEN;YE
YUGOSLAVIA;YU
ZAMBIA;ZM
ZIMBABWE;ZW

View File

@ -0,0 +1,18 @@
#!/usr/bin/perl -wT
print "-- Autogenerated by content-types/doc/make-insert.pl\n";
while (<STDIN>) {
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";

View File

@ -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);
}

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
<ctd:content-type
label="Simple Address"
description="A generic, non-country specific Address"
objectType="com.arsdigita.cms.contenttypes.SimpleAddress"
classname="com.arsdigita.cms.contenttypes.SimpleAddress">
<ctd:authoring-kit
createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step
labelKey="address.authoring.basic_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.SimpleAddressResources"
descriptionKey="address.authoring.basic_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.SimpleAddressResources"
component="com.arsdigita.cms.contenttypes.ui.SimpleAddressPropertiesStep"
ordering="1"/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
</ctd:authoring-kit>
</ctd:content-type>
</ctd:content-types>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<registry>
<config class="com.arsdigita.cms.contenttypes.SimpleAddressConfig"
storage="ccm-cms-types-simpleaddress/address.properties"/>
</registry>

View File

@ -0,0 +1,16 @@
<load>
<requires>
<table name="inits"/>
<table name="acs_objects"/>
<table name="cms_items"/>
<initializer class="com.arsdigita.cms.Initializer"/>
</requires>
<provides>
<table name="ct_simple_addresses"/>
<initializer class="com.arsdigita.cms.contenttypes.SimpleAddressInitializer"/>
</provides>
<scripts>
<schema directory="ccm-cms-types-simpleaddress"/>
<data class="com.arsdigita.cms.contenttypes.SimpleAddressLoader"/>
</scripts>
</load>

View File

@ -0,0 +1,5 @@
<upgrade>
<version from="6.6.0" to="6.6.1">
<script sql="ccm-cms-types-simpleaddress/upgrade/::database::-6.6.0-6.6.1.sql"/>
</version>
</upgrade>

View File

@ -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 <a href="mailto:dominik@redhat.com">Dominik Kacprzak</a>
* @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 <code>null</code> 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;
}
}

View File

@ -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;
/**
* <p><code>DomainObject</code> class to represent address <code>ContentType</code>
* objects.
* <br />
* 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.</p>
* <p>This class extends {@link com.arsdigita.cms.ContentPage content page} and
* adds extended attributes specific for an not country specific address:</p>
*
* @author <a href="mailto:dominik@redhat.com">Dominik Kacprzak</a>
* @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 <code>DataObject</code> is retrieved
* from the persistent storage mechanism with an <code>OID</code>
* specified by <i>id</i> and
* <code>SimpleAddress.BASE_DATA_OBJECT_TYPE</code>.
*
* @param id The <code>id</code> for the retrieved
* <code>DataObject</code>.
**/
public SimpleAddress(BigDecimal id) throws DataObjectNotFoundException {
this(new OID(BASE_DATA_OBJECT_TYPE, id));
}
/**
* Constructor. The contained <code>DataObject</code> is retrieved
* from the persistent storage mechanism with an <code>OID</code>
* specified by <i>id</i>.
*
* @param id The <code>OID</code> for the retrieved
* <code>DataObject</code>.
**/
public SimpleAddress(OID id) throws DataObjectNotFoundException {
super(id);
}
/**
* Constructor. Retrieves or creates a content item using the
* <code>DataObject</code> argument.
*
* @param obj The <code>DataObject</code> 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 <code>String</code> 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);
}
}

View File

@ -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]

View File

@ -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();
}
}

View File

@ -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 &lt;jross@redhat.com&gt;
* @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" };
}
}

View File

@ -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 &lt;jross@redhat.com&gt;
* @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;
}
}

View File

@ -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

View File

@ -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

View File

@ -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
* <code>com.arsdigita.ui.authoring.PageEdit</code> step for this type.
*
* @author <a href="mailto:dominik@redhat.com">Dominik Kacprzak</a>
* @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;
}
}

View File

@ -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 <code>SimpleAddressPropertiesStep</code> authoring kit step.
* <br />
* This form can be extended to create forms for SimpleAddress subclasses.
*
* @author <a href="mailto:dominik@redhat.com">Dominik Kacprzak</a>
* @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());
}
}
}

View File

@ -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;
/**
* <p>
* .
* Contains methods to simplify globalizing keys
* </p>
*
* @author <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @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);
}
}

View File

@ -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 <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
*
*/
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));
}
}

View File

@ -0,0 +1,111 @@
<!DOCTYPE stylesheet [
<!ENTITY nbsp "&#160;" ><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cms="http://www.arsdigita.com/cms/1.0"
version="1.0">
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.Address']" mode="cms:CT_graphics"
name="cms:CT_graphics_com_arsdigita_cms_contenttypes_Address">
<table width="435" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="contentTitle" align="left" valign="top">
<xsl:value-of select="./title"/>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<xsl:if test="./address">
<tr>
<th>Address:</th>
<td class="contentText" valign="top" align="left"><xsl:value-of select="./address"/></td>
</tr>
</xsl:if>
<xsl:if test="./postalCode">
<tr>
<th>Postal Code:</th>
<td class="contentText" valign="top" align="left"><xsl:value-of select="./postalCode"/></td>
</tr>
</xsl:if>
<xsl:if test="./isoCountryCode/countryName">
<tr>
<th>Country:</th>
<td class="contentText" valign="top" align="left"><xsl:value-of select="./isoCountryCode/countryName"/></td>
</tr>
</xsl:if>
<xsl:if test="./phone">
<tr>
<th>Phone:</th>
<td class="contentText" valign="top" align="left"><xsl:value-of select="./phone"/></td>
</tr>
</xsl:if>
<xsl:if test="./mobile">
<tr>
<th>Mobile:</th>
<td class="contentText" valign="top" align="left"><xsl:value-of select="./mobile"/></td>
</tr>
</xsl:if>
<xsl:if test="./fax">
<tr>
<th>Fax:</th>
<td class="contentText" valign="top" align="left"><xsl:value-of select="./fax"/></td>
</tr>
</xsl:if>
<xsl:if test="./email">
<tr>
<th>E-Mail:</th>
<td class="contentText" valign="top" align="left"><xsl:value-of select="./email"/></td>
</tr>
</xsl:if>
<xsl:if test="./notes">
<tr>
<th>Notes:</th>
<td class="contentText" valign="top" align="left"><xsl:value-of select="./notes"/></td>
</tr>
</xsl:if>
</table>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.Address']" mode="cms:CT_text"
name="cms:CT_text_com_arsdigita_cms_contenttypes_Address">
<h1 class="title"><xsl:value-of select="./title"/></h1>
<xsl:if test="./address">
<span class="subtitle">Address</span>
<span class="text"><xsl:value-of select="./address"/></span><br/>
</xsl:if>
<xsl:if test="./postalCode">
<span class="subtitle">Postal Code</span>
<span class="text"><xsl:value-of select="./postalCode"/></span><br/>
</xsl:if>
<xsl:if test="./isoCountryCode/countryName">
<span class="subtitle">Country</span>
<span class="text"><xsl:value-of select="./country"/></span><br/>
</xsl:if>
<xsl:if test="./phone">
<span class="subtitle">Phone</span>
<span class="text"><xsl:value-of select="./phone"/></span><br/>
</xsl:if>
<xsl:if test="./mobile">
<span class="subtitle">Mobile</span>
<span class="text"><xsl:value-of select="./mobile"/></span><br/>
</xsl:if>
<xsl:if test="./fax">
<span class="subtitle">Fax</span>
<span class="text"><xsl:value-of select="./fax"/></span><br/>
</xsl:if>
<xsl:if test="./email">
<span class="subtitle">E-Mail</span>
<span class="text"><xsl:value-of select="./email"/></span><br/>
</xsl:if>
<xsl:if test="./notes">
<span class="subtitle">Notes</span>
<span class="text"><xsl:value-of select="./notes"/></span><br/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>