FINAL suepr merge step : added all modules to this super repos

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-19 16:46:59 +02:00
7585 changed files with 1723356 additions and 18 deletions

View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -0,0 +1,298 @@
AT NULL Feldkirch NULL 6800 Pater Grimm Weg 20
AU NULL Melbourne NULL
AU NULL Sydney NULL
AU 04 NULL NORMANBY NULL 4059 30 Normanby Terrace
BD NULL Dhaka NULL 1205 23, Subal Das Road, Chowdhury Bazar, Lalbagh
BD NULL Dhaka NULL 1207 R-1,H-19,Kallaynpur,Mirpur,Dhaka
BD NULL Dhaka NULL 1207 World Bank Office Dhaka, Plot E 32, Agargaon, Sher-E-Bangla Nagar
BD NULL Dhaka NULL 1209 House# 66B, Flat# B2 Zigatola
BD NULL Dhaka NULL 1219 390 West Rampura Dhaka
BD NULL Dhaka NULL 1230 Uttara
BD 81 NULL Dhaka NULL 1000 Institute of Water and Flood Management
BD 81 NULL Dhaka NULL 1203 84/a maniknagar
BD 81 NULL Dhaka NULL 1205 Dhaka Bangladesh
BD 81 NULL Dhaka NULL 1207 BetterStories Limited 17 West Panthopath
BD 81 NULL Dhaka NULL 1216 Mirpur, Dhaka
BD 81 NULL Dhaka NULL 1230 830, Prembagan, Dhakshin Khan
BD 82 NULL khulna NULL 9203
BD NULL NULL Dhaka NULL 1000 Institute of Water and Flood Management
BD NULL NULL Dhaka NULL 1207 World Bank Office Dhaka, Plot E 32, Agargaon, Sher-E-Bangla Nagar
BE NULL Brussels NULL
BE NULL Watermael-Boitsfort NULL 1170 Avenue des Staphylins
BH NULL Manama NULL 00973 Manama Bahrain Manama Bahrain
BR NULL Porto Alegre NULL
BR NULL Recife NULL
BR RJ NULL Rio de Janeiro NULL
BW NULL Francistown NULL NULL
BW NULL NULL Francistown NULL NULL
CA NULL Montreal NULL
CA NULL Toronto NULL
CA BC NULL Vancouver NULL
CA ON NULL Kitchener NULL
CA ON NULL wterloo NULL n2l3g1 200 University Avenue West
CH NULL Geneva NULL 1202 15, chemin Louis-Dunant
CH 25 NULL Zurich NULL 8098 UBS Optimus Foundation Augustinerhof 1
DE NULL Berlin NULL
DE 05 NULL Frankfurt am Main NULL 60386 Johanna-Tesch-Platz 7
DK NULL Aarhus NULL
ES NULL Bilbao NULL
ET 44 NULL ADDIS ABABA NULL 11945 ADDIS ABABA,P.O.BOX 11945
FI NULL Espoo NULL 02130 Mahlarinne 3B
FI NULL Helsinki NULL 00580 Hermannin rantatie 2 A Hermannin rantatie 2 A
FI NULL Tampere NULL 33101 Tampere Univerity of Technology
FI 13 NULL Espoo NULL 02150 Aalto Venture Garage Betonimiehenkuja 3
GB NULL Exeter NULL
GB NULL London NULL
GB NULL London NULL N4 2DP 2 Myddleton Ave
GB NULL London NULL N7 0AH 104 St Georges Avenue
GB NULL London NULL SE16 3UL 25 Blue Anchor Lane
GB NULL London NULL SW18 5SP Flat 1 150 Merton road
GB NULL London NULL W1T 4BQ 13 Fitzroy Street
GB NULL Oxford NULL
GB NULL Southampton NULL
GB C3 NULL NULL cb244qg 32 market street swavesey
GB E7 NULL London NULL SE3 7TP
GB F3 NULL Wood Green NULL N22 5RU 6 Cedar House
GB H1 NULL London NULL SE11 5JD 47-49 Durham Street
GB H6 NULL London NULL SE8 4DD 8 Harton St Deptford
GB K2 NULL Oxford NULL OX2 6QY 3 The Villas, Rutherway
GH 05 NULL NSAWAM NULL NULL P.O.BOX 455
GH NULL NULL Accra NULL NULL
ID NULL Bandung NULL 40134 Jalan Sadang Hegar 1 No. 12 RT04 RW13 Sadang Serang
ID NULL Bekasi NULL 17411 Jl.Binadharma 1 No.62. Jatiwaringin
ID NULL Jakarta NULL
ID NULL Jakarta NULL 12440 Jl. H. Niin 7 Lebak Bulus, Cilandak
ID NULL Jakarta NULL 13330 Otista
ID NULL Jakarta selatan NULL 12000 jl. rawa jati timur 6 no. 10
ID NULL Jakarta Timur NULL Jl.Mulia No.15B Kel.Bidara Cina, Kec.Jatinegara, Jakarta Timur
ID NULL Pematang Siantar NULL 51511 Jl. Durian I 30
ID 04 NULL Bogor NULL 16165
ID 04 NULL jakarta NULL otista
ID 04 NULL Jakarta NULL 12520 Jl. Pertanian Raya III No.42 Jakarta Selatan Pasar Minggu
ID 04 NULL Jakarta NULL 13330 Jakarta
ID 04 NULL Jakarta NULL 13330 Jl Sensus IIC Bidaracina Jaktim
ID 04 NULL Jakarta NULL 13330 Jl. Bonasut 2 no.22
ID 04 NULL Jakarta NULL 13330 Otista 64c
ID 04 NULL jakarta NULL 13330 Otista jaktim
ID 04 NULL Jakarta Timur NULL 13330 Kebon Sayur I no. 1 RT 10/15
ID 04 NULL Jakarta Timur NULL 13460 Jl. Pondok Kopi Blok G4/5 RT. 005/08 Jakarta Timur
ID 04 NULL Jakarta Timur NULL 13810 Jl. Raya Pondok Gede Rt03 Rw08 no.35 , Lubang Buaya, Jakarta Timur Jl. Raya Pondok Gede Rt03 Rw08 no.35 , Lubang Buaya, Jakarta Timur
ID 07 NULL Brebes NULL 54321 Jl Kersem Blok D14 Perum Taman Indo Kaligangsa Wetan Brebes
ID 07 NULL Semarang NULL 50143 Puspowarno Tengah 2/2
ID 08 NULL Lumajang NULL 67373 Desa Tumpeng Kecamatan Candipuro Lumajang
ID 30 NULL Bandung NULL 55241 Jl Pelesiran No 55A/56
ID 30 NULL Bekasi NULL 17510 bekasi West Java Indonesia
ID 30 NULL Depok NULL 16245 Jalan juragan sinda 2 no 10
ID 30 NULL Depok NULL 16424 Jalan Margonda RayaJalan Kober Gang Mawar
ID 30 NULL Depok NULL 16424 Jl. Haji Yahya Nuih no.24, Pondok Cina
ID 30 NULL Depok NULL 16425 Kukusan Kelurahan
ID 30 NULL Depok NULL 16518 Jl. Salak No.1/C.88 Durenseribu Bojongsari
ID 30 NULL Depok NULL 16952 Jl. Merak No.34 -36 Rt.004/014 Jl. Merak No. 34 -36 Rt. 004/014
ID 36 NULL biak numfor NULL 98111 jl. s. mamberamo no 6782 biak numfor
IL NULL Tel Aviv NULL
IN NULL Bangalore NULL
IN NULL India NULL
IN NULL new delhi NULL 110003 55 lodi estate
IN 07 NULL NEW DELHI NULL 110018 15/11 A 1ST FLOOR TILAK NAGAR
IN 07 NULL New Delhu NULL 110075 B 54 Hilansh Apartments Plot No 1, Sector 10, Dwarka
IN 10 NULL Gurgaon NULL D- 201 Ivy Apartments Sushant Lok 1 Gurgaon Haryana
IN 13 NULL Trivandrum NULL 695010 TC 9/1615, SRMH Road, Sasthamangalam, Trivandrum
IN 16 NULL Mumbai NULL 400020 Bharat Mahal, Flat#55 Marine Drive
IN 16 NULL Mumbai NULL 400028 303,Shree Parvati Co-Op Housing Society, D.L.Vaidya Road,Dadar
IN 16 NULL Pune NULL
IN 16 NULL Pune NULL Infosys Campus Hinjewadi Phase 2
IN 16 NULL Pune NULL 400705 #22 Iris Garden Gokhale Road
IN 16 NULL PUNE NULL 411043
IN 16 NULL Pune NULL 411051
IN 16 NULL Pune NULL 411057 Infosys Ltd. Rajiv gandhi infostech park Hinjewadi phase 2
IN 16 NULL Pune NULL 412108 Pune Maharatshtra
IN 16 NULL Pune NULL 433011 502 utkarsh vihar golande state pune
IN 19 NULL Bangalore NULL 560080 Indian Institute for Human Settlements IIHS Bangalore City Campus, Sadashivanagar,
IN 19 NULL Bangalore NULL 560100 electronic city
IN 19 NULL Bhalki NULL 585411 bhalki,bidar ,karnataka karnataka
IN 24 NULL Jaipur NULL 302011 Institute of Health Management Research 1, Prabhu Dayal Marg
IR 26 NULL Tehran NULL 1118844454 Baharestan sq. mostafa khomeini str., javahery Ave., no. 11,
IT NULL Trento NULL
JM 08 NULL Kingston NULL Kgn 7 MOna Campus UWI
KE NULL Nairobi NULL
KE 05 NULL Nairobi NULL 30300 212,kapsabet
KH NULL NULL Phnom Penh NULL
LR NULL Monrovia NULL 00000
NG 11 NULL Abuja NULL 930001 17 Bechar street Wuse zone 2
PE 15 NULL Lima NULL 18 Lima Lima
PE 15 NULL Lima NULL Lima 18 123 Miraflores
PE NULL NULL Lima NULL 03 Calle Granada 104
PE NULL NULL Lima NULL 18 Lima Lima
PH NULL Manila NULL Globe Telepark 111 Valero Street
PH NULL Quezon Coty NULL 1109 86 Harvard Street, Cubao, Quezon City, Philippines 84 Harvard Street, Cubao, Quezon City,hilippines
PH 20 NULL Silang NULL 4118 370 Bayungan Kaong Silang Cavite
PH 57 NULL Kidapawan NULL 9400 Kidapawan City Kidapawan City
PH 66 NULL zamboanga NULL 7000 29-tripplet rd san jose 29-tripplet rd san jose
PH D9 NULL Pasig City NULL World Bank Office Manila, 20/F Taipan Place F. Ortigas Jr. Road, Ortigas Center
PK NULL Lahore NULL 54000 17-R Model Town Lahore
PK NULL Lahore NULL 54000 53- chamber lane road Lahore
PK NULL Lahore NULL 54000 85 E block Model Town
PK NULL Lahore NULL 54000 House no 227, street no 5, Imamia Colony Shahadra Lahore
PK NULL LAHORE NULL 54000 room no.6 khalid bim waleed hall, near New Anarkali, LAHORE room no.6 khalid bim waleed hall, near New Anarkali, LAHORE
PK NULL Lahore NULL pk097 LUMS, Lahore,
PK NULL Sheikhupura NULL 03935 D.H.Q.Hospital Sheikhupura House number 08. Room no 109 Khalid bin waleed haal, punjab University lahore old campus.
PK 02 NULL Quetta NULL 87000 Postal Address 87000, Kuchlak, Quetta, Balochistan. H#24 Peer Abul Khair road Quetta, Balochistan.
PK 02 NULL Quetta NULL 87300 block no-1 falt no. 7 New Crime Branch Abbas Ali Road Cantt
PK 02 NULL Quetta NULL 87300 Flat no. 3 Shafeen Centre Jinnah Town ,Near I.T university , Quetta
PK 02 NULL Quetta NULL 87300 H-no. C-220 Zarghoonabad Phase-2 , Nawa Killi ,Quetta
PK 04 NULL burewala NULL 60101 Fatima Fayyaz Hazrat Sakina hall girls hostel number 9 Punjab university Lahore Pakistan Sardar Wajid Azim Azeem abad Burewala dist Vehari Pakistan
PK 04 NULL Faisalabad NULL 38000 P 101/1, Green Town, Millat Road, Faisalabad
PK 04 NULL Islamabad NULL 44000 P.O Tarlai kalan chappar Islamabad
PK 04 NULL lahore NULL
PK 04 NULL Lahore NULL 54000
PK 04 NULL lahore NULL 54000 Street No.63 House 36/A Al-madad Pak Colony Ravi Road, Lahore. Street No.63 House 36/A Al-madad Pak Colony Ravi Road, Lahore.
PK 04 NULL Lahore NULL 54000 1149-1-D2 Green Town Lahore
PK 04 NULL Lahore NULL 54000 124, street# 2, karim block Allama Iqbal Town lahore. 124, street# 2, karim block Allama Iqbal Town lahore.
PK 04 NULL Lahore NULL 54000 150 A Qila Lachman Singh Ravi Road lahore
PK 04 NULL Lahore NULL 54000 166/1L DHA Lahore
PK 04 NULL Lahore NULL 54000 172 A2 Township Lahore
PK 04 NULL Lahore NULL 54000 183,S/Block, Model Town, Lhr
PK 04 NULL lahore NULL 54000 19- A block ,Eden Lane Villas Raiwind Road ,Lahore
PK 04 NULL lahore NULL 54000 3-c kaliyar road opposite kids lyceum, rustam park near mor samnabad
PK 04 NULL Lahore NULL 54000 31 Saeed Block, Canal Bank Scheme
PK 04 NULL Lahore NULL 54000 31c DHA Lahore
PK 04 NULL Lahore NULL 54000 387 E1 wapda town, Lahore
PK 04 NULL Lahore NULL 54000 45-D dha eme sector multan road,lahore
PK 04 NULL Lahore NULL 54000 5 Zafar Ali Road
PK 04 NULL Lahore NULL 54000 54-R PGECHS
PK 04 NULL lahore NULL 54000 566 E-1 johar town lahore 566 E-1 johar town lahore
PK 04 NULL Lahore NULL 54000 82/1 Z Block, Phase 3 DHA
PK 04 NULL Lahore NULL 54000 A-1 VRI Zarrar shaheed road lahore cantt A-1 VRI Zarrar shaheed road lahore cantt
PK 04 NULL lahore NULL 54000 e5/39D street 6 zaman colony cavalry ground ext
PK 04 NULL Lahore NULL 54000 Ho # 61, Block G3, Johar Town Lahore
PK 04 NULL LAhore NULL 54000 House #19-A street #5 Usman nagr Ghaziabad Lahore
PK 04 NULL lahore NULL 54000 House no 692 street no 67 sadar bazar
PK 04 NULL Lahore NULL 54000 Khosa Law Chamber 1 Turner Road
PK 04 NULL Lahore NULL 54000 Lahore,Pakistan Lahore,Pakistan
PK 04 NULL Lahore NULL 54000 room no 69, khalid bin waleed hall, anarkali
PK 04 NULL Lahore NULL 54000 Suite # 8, Al-Hafeez Suites, Gulberg II
PK 04 NULL Lahore NULL 54085 199 Shadman 2
PK 04 NULL Lahore NULL 54300 Mughalpura Lahore Pakistan
PK 04 NULL Lahore NULL 54660 SD 69 falcon complex gulberg III lahore
PK 04 NULL lahore NULL 54800 764-G4 johar town ,lahore
PK 04 NULL Rawalpindi NULL 44000 House 522, F-Block Sattellite Town, Rawalpindi
PK 04 NULL Rawalpindi NULL 46000 1950/c, Indusroad 2, Tariqabad, Rawalpindi Cantt
PK 04 NULL Rawalpindi NULL 46000 House 54-E Lane 9 Sector 4, AECHS Chaklala Rawalpindi
PK 04 NULL Rawalpindi NULL 46000 House B-1343, Sattellite town Rawalpindi
PK 04 NULL Rawalpindi NULL 46000 House CB-299F, Street 1, Lane 4 Peshawar Road Rawalpindi
PK 04 NULL Rawalpindi NULL 46300 House No 1518 Umer Block phase 8 BehriaTown
PK 04 NULL sialkot NULL 51310 The National Model School, Ismaiealabad, Pacca Garah Sialkot
PK 08 NULL Islamabad NULL CIomsats Institute of Information Technology Islamabad
PK 08 NULL Islamabad NULL 38700 COMSATS tarlai boys hostel Islamabad. COMSATS tarlai boys hostel Islamabad (Room 30)
PK 08 NULL Islamabad NULL 44000
PK 08 NULL Islamabad NULL 44000 House # 256, Street # 9, Shahzad Town, Islamabad.
PK 08 NULL Islamabad NULL 44000 Islamabad , Comsats University Islamabd ,Pakistan
PK 08 NULL Islamabad NULL 44000 World Bank Building Sector G 5
PK 08 NULL lahore NULL 54000 3c zafar ali road gulburg 5 3c zafar ali road gulburg 5
PK 08 NULL lahore NULL 54000 49-a bilal park, chaburgy 49-a bilal park, chaburgy
PK NULL NULL Lahore NULL 54000
PK NULL NULL Lahore NULL 54000 85 E block Model Town
SN 01 NULL NULL ouakam cité comico en face 217
SN 01 NULL Dakar NULL
SN 01 NULL Dakar NULL IDEV-ic Patte d'oie Builder's Villa B11
SN 01 NULL Dakar NULL liberte 6/ dakar
SN 01 NULL Dakar NULL ngor
SN 01 NULL Dakar NULL 4027 ZAC Mbao Cité Fadia
SN NULL NULL Dakar NULL IDEV-ic Patte d'oie Builder's Villa B11
TZ NULL Dar es Salaam NULL NULL
TZ NULL Dar es salaam NULL NULL 76021 Dar es salaam 1507 Morogoro
TZ NULL Dar es salaam NULL NULL dar es salaam nassoro.ahmedy@yahoo.com
TZ NULL DAR ES SALAAM NULL NULL dar es salaam UDSM
TZ NULL Dar es salaam NULL NULL NA
TZ NULL DAR ES SALAAM NULL NULL P O BOX 23409
TZ NULL dar es salaam NULL NULL p. o. box 104994
TZ NULL Dar es Salaam NULL NULL P.o. BOX 71415 Dar es Salaam
TZ NULL Dar es Salaam NULL NULL P.O.BOx 66675 DSM
TZ NULL Dar es salaam NULL NULL Tz Tz
TZ NULL dsm NULL NULL
TZ 02 NULL Bagamoyo NULL NULL PO.Box 393
TZ 02 NULL Dar es salaam NULL NULL 22548
TZ 03 NULL Dar-es-salaam NULL NULL Dodoma Municipal Kimara, Dar-es-salaa,
TZ 23 NULL Dar es Salaam NULL NULL
TZ 23 NULL dar es salaam NULL NULL 35074
TZ 23 NULL dar es salaam NULL NULL 67389
TZ 23 NULL Dar es Salaam NULL NULL COSTECH, Dar es Salaam, Tanzania
TZ 23 NULL Dar es salaam NULL NULL na
TZ 23 NULL dar es salaam NULL NULL p o box 60164
TZ 23 NULL dar es salaam NULL NULL P. O. Box 77588
TZ 23 NULL dar es salaam NULL NULL P.O BOX 78144
TZ 23 NULL Dar es Salaam NULL NULL P.O.BOX 78373
TZ 23 NULL Dar es salaam NULL NULL UDSM Dar es Salaam
TZ 23 NULL Dar es salaam NULL NULL udsm udsm
TZ 23 NULL Temeke NULL NULL P.O. Box 50127
TZ NULL NULL Dar es Salaam NULL NULL
TZ NULL NULL Dar es Salaam NULL NULL Kigoma
TZ NULL NULL Dar es Salaam NULL NULL Mwanza
UG NULL Kampala NULL NULL
UG NULL Kampala NULL NULL Kampala Uganda East Africa
US NULL London NULL SE1 8RT Capital Tower 91 Waterloo Road
US CA NULL Los Angeles NULL
US CA NULL Pleasanton NULL 94588 3412 Pickens Lane
US CA NULL Sacramento NULL
US CA NULL San Francisco NULL
US CA NULL seattle NULL 98113 1234 1st st
US CO NULL Denver NULL 80235 6666 West Quincy Ave
US CT NULL Greenwich NULL 06830 140 Milbank
US CT NULL Hartford NULL 06106 Center for Urban and Global Studies at Trinity College, 70 Vernon Street
US DC NULL Washington NULL
US DC NULL Washington NULL 20007 World Bank Headquarters 1818 H Street NW
US DC NULL Washington NULL 20010
US DC NULL Washington NULL 20036
US DC NULL Washington NULL 20405 1889 F St NW
US DC NULL Washington NULL 20433
US DC NULL Washington NULL 20433 1818 H Street NW
US DC NULL Washington NULL 20433 1818H St
US DC NULL Washington NULL 20433 1818 H Street NW
US DC NULL Washington DC NULL 20005 1424, K Street, NW Suite 600
US DC NULL Washington DC NULL 20010 1818 H Street, NW
US DC NULL Washington, DC NULL 20003 1818 H Street NW
US DE NULL Virgin Islands|Charlotte Amalie,Cruz Bay,Christiansted NULL Morocco|Tafraout,Rabat,Tangier,Tetouan,Casablanca,Marrakesh,Fez,Oujda,Meknes,Agadir United Arab Emirates|Garhoud,Dubai,Bur Dubai,Ras al Khaymah,Abu Dhabi,Ajman,Al Fujayrah,Sharjah
US FL NULL Falmouth NULL Falmouth Falmouth
US FL NULL Lilongwe NULL Lilongwe Lilongwe
US GA NULL Atlanta NULL
US GU NULL Herndon NULL 15642 Ht USA
US GU NULL Miami NULL Miami Miami
US MD NULL Gaithersburg NULL 20877 554 N Frederick Avenue Suite 216
US MD NULL Potomac NULL 20854 14 Sandalfoot Court
US MD NULL Silver Spring NULL 20901 9202 Whitney St.
US MI NULL Traverse City NULL 49685 PO Box 792
US ND NULL Pirassununga NULL Pirassununga Pirassununga
US NJ NULL Princeton NULL
US NY NULL Brooklyn NULL 11206-1980 25 Montrose Ave. Apt 304
US NY NULL Brooklyn NULL 11225 975 washington ave 2d
US NY NULL Brooklyn NULL 11217 150 4TH AVE APT 9E
US NY NULL New York NULL
US NY NULL New York NULL 10013 148 Lafayette St. PH
US NY NULL New York NULL 10017 UNICEF 3 UN Plaza
US NY NULL New York NULL 10019 25 Columbus Circle Suite 52E
US NY NULL New York NULL 10024 65 West 85th Street 3A
US NY NULL New York NULL 10027 606 W. 116th Street #22
US NY NULL New York NULL 10037
US NY NULL Rochester NULL
US NY NULL Scarsdale NULL 10583-1423 54 Walworth Avenue
US OR NULL Portland NULL
US PA NULL Philadelphia NULL
US PA NULL Philadelphia NULL
US PR NULL Colonel Hill NULL Colonel Hill Colonel Hill
US SD NULL Banjul NULL Banjul Banjul
US SD NULL London NULL London London
US TX NULL Aledo NULL 76008 1588 Hunterglenn Dr
US TX NULL Keller NULL 76248 810 Placid View Ct.
US WA NULL Seattle NULL
ZA NULL Cape Town NULL
ZA NULL Cape Town NULL 7945 Alexander Road Muizenberg
ZA NULL Pretoria NULL
ZA 11 NULL Cape Town NULL
ZA 11 NULL Cape Town NULL 7435 PostNet Suite #57, Private Bag X18 Milnerton
ZA 11 NULL Cape town NULL 7508 24 Solyet Court, Lansdowne Road Claremont
ZA 11 NULL Cape Town NULL 7701
ZA 11 NULL Cape Town NULL 7785 10 Nyamakazi Road Luzuko Park Phillipi East
ZA 11 NULL Cape Town NULL 7915 66 Albert Rd
ZA 11 NULL Cape Town NULL 8001 210 Long Street
ZM NULL Lusaka NULL
ZM 09 NULL LUSAKA NULL 10101 P.O. BOX FW 174

View File

@@ -0,0 +1,10 @@
.addressfield-container-inline > div.form-item {
float: right;
margin-right: 0;
margin-left: 1em;
}
.addressfield-container-inline.country-GB > div.form-item {
margin-left: auto;
margin-right: 0;
}

View File

@@ -0,0 +1,48 @@
<?php
/**
* @file
* API documentation for Addressfield.
*/
/**
* Format generation callback.
*
* @param $format
* The address format being generated.
* @param $address
* The address this format is generated for.
* @param $context
* An associative array of context information pertaining to how the address
* format should be generated. If no mode is given, it will initialize to the
* default value. The remaining context keys should only be present when the
* address format is being generated for a field:
* - mode: either 'form' or 'render'; defaults to 'render'.
* - field: the field info array.
* - instance: the field instance array.
* - langcode: the langcode of the language the field is being rendered in.
* - delta: the delta value of the given address.
*
* @ingroup addressfield_format
*/
function CALLBACK_addressfield_format_callback(&$format, $address, $context = array()) {
// No example.
}
/**
* Allows modules to add arbitrary AJAX commands to the array returned from the
* standard address field widget refresh.
*
* @param &$commands
* The array of AJAX commands used to refresh the address field widget.
* @param $form
* The rebuilt form array.
* @param $form_state
* The form state array from the form.
*
* @see addressfield_standard_widget_refresh()
*/
function hook_addressfield_standard_widget_refresh_alter(&$commands, $form, $form_state) {
// Display an alert message.
$commands[] = ajax_command_alert(t('The address field widget has been updated.'));
}

View File

@@ -0,0 +1,26 @@
div.addressfield-container-inline > div.form-item {
float: left; /* LTR */
margin-right: 1em; /* LTR */
}
div.addressfield-container-inline.country-GB > div.form-item {
float: none;
margin-right: auto; /* LTR */
}
/* Clear-fix markup for the inline container */
div.addressfield-container-inline:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
/* IE6 */
* html div.addressfield-container-inline {
height: 1%;
}
/* IE7 */
*:first-child + html div.addressfield-container-inline {
min-height: 1%;
}

View File

@@ -0,0 +1,65 @@
<?php
/*
* @file
* Devel Generate for addressfield module
*
*/
/*
* Implements hook_devel_generate();
*/
function addressfield_devel_generate($object, $field, $instance, $bundle) {
if (field_behaviors_widget('multiple values', $instance) == FIELD_BEHAVIOR_CUSTOM) {
return devel_generate_multiple('_addressfield_devel_generate', $object, $field, $instance, $bundle);
}
else {
return _addressfield_devel_generate($object, $field, $instance, $bundle);
}
}
/*
* Helper function to generate a greeky US-based address
*/
function _addressfield_devel_generate($object, $field, $instance, $bundle) {
// Set default value
$object_field = addressfield_default_values();
$addresses = _addressfield_sample_addresses();
$object_field = array_merge($object_field, $addresses[array_rand($addresses)]);
unset($object_field['data']);
return $object_field;
}
/**
* Returns an array of sample addresses.
*
* @return
* An array of addressfield arrays
*/
function _addressfield_sample_addresses() {
$fields = &drupal_static(__FUNCTION__);
if (!isset($fields)) {
$filepath = DRUPAL_ROOT . '/' . drupal_get_path('module', 'addressfield');
$fields = array();
if ($handle = @fopen("$filepath/addresses.txt",'r')) {
if (is_resource($handle)) {
$addresses = array();
while (($buffer = fgets($handle)) !== false) {
list($country, $administrative_area, $sub_administrative_area, $locality, $dependent_locality, $postal_code, $thoroughfare, $premise) = explode("\t", $buffer);
$fields[] = array(
'country' => ($country == 'NULL') ? NULL : trim($country),
'administrative_area' => ($administrative_area == 'NULL') ? NULL : trim($administrative_area),
'sub_administrative_area' => ($sub_administrative_area == 'NULL') ? NULL : trim($sub_administrative_area),
'locality' => ($locality == 'NULL') ? NULL : trim($locality),
'dependent_locality' => ($dependent_locality == 'NULL') ? NULL : trim($dependent_locality),
'postal_code' => ($postal_code == 'NULL') ? NULL : trim($postal_code),
'thoroughfare' => ($thoroughfare == 'NULL') ? NULL : trim($thoroughfare),
'premise' => ($premise == 'NULL') ? NULL : trim($premise),
);
}
}
fclose($handle);
}
}
return $fields;
}

View File

@@ -0,0 +1,59 @@
<?php
/**
* @file
* Integration with the Feeds module.
*/
/**
* Implements hook_feeds_node_processor_targets_alter().
*/
function addressfield_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance) {
$info = field_info_field($name);
if ($info['type'] == 'addressfield') {
foreach ($info['columns'] as $sub_field => $schema_info) {
$name_label = $instance['label'] . ': ' . drupal_ucfirst(str_replace('_', ' ', $sub_field));
$targets[$name . ':' . $sub_field] = array(
'name' => $name_label,
'callback' => 'addressfield_set_target',
'real_target' => $info['field_name'],
'description' => $schema_info['description'],
);
}
}
}
}
/**
* Callback for hook_feeds_processor_targets_alter().
*
* @param $source
* Field mapper source settings.
* @param $entity
* An entity object, for instance a node object.
* @param $target
* A string identifying the target on the node.
* @param $value
* The value to populate the target with.
*/
function addressfield_set_target($source, $entity, $target, $values) {
list($field_name, $sub_field) = explode(':', $target, 2);
// Convert the values into an array if it isn't one already to correspond to
// Drupal's handling of field value arrays.
if (!is_array($values)) {
$values = array($values);
}
// If the field is already set on the given entity, update the existing value
// array. Otherwise start with a fresh field value array.
$field = isset($entity->$field_name) ? $entity->$field_name : array();
// Loop over the field values array...
foreach ($values as $delta => $value) {
$field[LANGUAGE_NONE][$delta][$sub_field] = $value;
}
$entity->$field_name = $field;
}

View File

@@ -0,0 +1,15 @@
name = Address Field
description = Manage a flexible address field, implementing the xNAL standard.
core = 7.x
package = Fields
dependencies[] = ctools
files[] = views/addressfield_views_handler_filter_country.inc
; Information added by drupal.org packaging script on 2013-05-07
version = "7.x-1.0-beta4"
core = "7.x"
project = "addressfield"
datestamp = "1367945112"

View File

@@ -0,0 +1,186 @@
<?php
/**
* Implements hook_field_schema()
*/
function addressfield_field_schema() {
$columns = array(
'country' => array(
'description' => 'Two letter ISO country code of this address.',
'type' => 'varchar',
'length' => 2,
'not null' => FALSE,
'default' => '',
),
'administrative_area' => array(
'description' => 'The administrative area of this address. (i.e. State/Province)',
'type' => 'varchar',
'length' => 255,
'default' => '',
'not null' => FALSE,
),
'sub_administrative_area' => array(
'description' => 'The sub administrative area of this address.',
'type' => 'varchar',
'length' => 255,
'default' => '',
'not null' => FALSE,
),
'locality' => array(
'description' => 'The locality of this address. (i.e. City)',
'type' => 'varchar',
'length' => 255,
'default' => '',
'not null' => FALSE,
),
'dependent_locality' => array(
'description' => 'The dependent locality of this address.',
'type' => 'varchar',
'length' => 255,
'default' => '',
'not null' => FALSE,
),
'postal_code' => array(
'description' => 'The postal code of this address.',
'type' => 'varchar',
'length' => 255,
'default' => '',
'not null' => FALSE,
),
'thoroughfare' => array(
'description' => 'The thoroughfare of this address. (i.e. Street address)',
'type' => 'varchar',
'length' => 255,
'default' => '',
'not null' => FALSE,
),
'premise' => array(
'description' => 'The premise of this address. (i.e. Apartment / Suite number)',
'type' => 'varchar',
'length' => 255,
'default' => '',
'not null' => FALSE,
),
'sub_premise' => array(
'description' => 'The sub_premise of this address.',
'type' => 'varchar',
'length' => 255,
'default' => '',
'not null' => FALSE,
),
'organisation_name' => array(
'description' => 'Contents of a primary OrganisationName element in the xNL XML.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'default' => '',
),
'name_line' => array(
'description' => 'Contents of a primary NameLine element in the xNL XML.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'default' => '',
),
'first_name' => array(
'description' => 'Contents of the FirstName element of a primary PersonName element in the xNL XML.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'default' => '',
),
'last_name' => array(
'description' => 'Contents of the LastName element of a primary PersonName element in the xNL XML.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'default' => '',
),
'data' => array(
'description' => 'Additional data for this address.',
'type' => 'text',
'size' => 'big',
'not null' => FALSE,
'serialize' => TRUE,
),
);
return array(
'columns' => $columns,
// TODO Add indexes.
);
}
/**
* Update the field configuration to the new plugin structure.
*/
function addressfield_update_7000() {
// Enable ctools.
if (!module_enable(array('ctools'))) {
throw new Exception('This version of addressfield requires ctools, but it could not be enabled.');
}
// Get the list of fields of type 'addressfield'.
$address_fields = array();
foreach (field_info_fields() as $field_name => $field_info) {
if ($field_info['type'] == 'addressfield') {
$address_fields[$field_name] = $field_name;
}
}
foreach (field_info_instances() as $entity_type => $bundles) {
foreach ($bundles as $bundle_name => $instances) {
foreach (array_intersect_key($instances, $address_fields) as $field_name => $instance) {
$widget_settings = &$instance['widget']['settings'];
if ($instance['widget']['type'] == 'addressfield_standard') {
// Default to use the country-based address widget.
$format_handlers = array('address');
// Map the old 'name_format' setting to the name and organization widgets.
if (in_array($widget_settings['name_format'], array('name_line_organisation', 'first_last_organisation'))) {
$format_handlers[] = 'organisation';
}
if (in_array($widget_settings['name_format'], array('name_line', 'name_line_organisation'))) {
$format_handlers[] = 'name-oneline';
}
else {
$format_handlers[] = 'name-full';
}
unset($widget_settings['name_format']);
$widget_settings['format_handlers'] = $format_handlers;
}
// Update displays.
foreach ($instance['display'] as $view_mode => &$view_mode_info) {
$display_settings = &$view_mode_info['settings'];
if ($view_mode_info['type'] == 'addressfield_default') {
if (isset($widget_settings['format_handlers'])) {
$display_settings['use_widget_handlers'] = 1;
}
else {
// If the widget is non-standard, just use a sane default.
$display_settings['use_widget_handlers'] = 0;
$display_settings['format_handlers'] = array('address', 'name-oneline');
}
}
else if ($view_mode_info['type'] == 'addressfield_name') {
// Migrate the 'addressfield_name' formatter to the new framework.
$view_mode_info['type'] = 'addressfield_default';
// Start from the widget configuration.
$display_settings['use_widget_handlers'] = 0;
$display_settings['format_handlers'] = isset($widget_settings['format_handlers']) ? $widget_settings['format_handlers'] : array('address', 'name-oneline');
if (empty($display_settings['organisation'])) {
$display_settings['format_handlers'] = array_diff( $display_settings['format_handlers'], array('organisation'));
}
unset($display_settings['organisation']);
}
}
field_update_instance($instance);
}
}
}
}

View File

@@ -0,0 +1,784 @@
<?php
/**
* @file
* Defines a field for attaching country-specific addresses to entities.
*/
/**
* Implements hook_ctools_plugin_directory().
*/
function addressfield_ctools_plugin_directory($module, $plugin) {
if ($module == 'addressfield') {
return 'plugins/' . $plugin;
}
}
/**
* Implements hook_ctools_plugin_type().
*/
function addressfield_ctools_plugin_type() {
$plugins['format'] = array(
'load themes' => TRUE,
);
return $plugins;
}
/**
* Implements hook_views_api().
*/
function addressfield_views_api() {
return array(
'api' => 3,
'path' => drupal_get_path('module', 'addressfield') . '/views',
);
}
/**
* Get the list of format plugins.
*/
function addressfield_format_plugins() {
ctools_include('plugins');
$plugins = ctools_get_plugins('addressfield', 'format');
uasort($plugins, 'ctools_plugin_sort');
return $plugins;
}
/**
* Get the list of format plugins in a format suitable for #options.
*/
function addressfield_format_plugins_options() {
$options = array();
foreach (addressfield_format_plugins() as $widget => $info) {
$options[$widget] = check_plain($info['title']);
}
return $options;
}
/**
* @defgroup addressfield_format Address format API
* @{
* API for generating address forms and display formats.
*
* Addresses forms and display formats are collaboratively generated by one or
* more format handler plugins. An address with a name and a company, for example,
* will be generated by three handlers:
* - 'address' that will generate the country, locality, street blocks
* - 'organisation' that will add the organisation block to the address
* - 'name-full' that will add a first name and last name block to the address
*
* A format handler is a CTools plugin of type 'addressfield' / 'format'. Each
* handler is passed the format in turn, and can add to or modify the format.
*
* The format itself is a renderable array stub. This stub will be transformed
* into either a Form API array suitable for use as part of a form or into a
* renderable array suitable for use with drupal_render(). The following
* modifications are done:
* - when rendering as a form, every element which name (its key in the array)
* is a valid addressfield column (see addressfield_field_schema()), will
* be transformed into a form element, either using a type explicitly
* defined in '#widget_type' or using 'select' if '#options' is set or
* 'textfield' if it is not. In addition, the '#default_value' of every
* field will be populated from the address being edited.
* - when rendering as a formatter, every element which name (its key in the array)
* is a valid addressfield column (see addressfield_field_schema()), will
* be transformed into a renderable element, either using a type explicitly
* defined in '#render_type' or else using 'addressfield_container'. When
* the type is 'addressfield_container' the element will be rendered as
* an HTML element set by '#tag' (default: span).
*/
/**
* Generate a format for a given address.
*
* @param $address
* The address format being generated.
* @param $handlers
* The format handlers to use to generate the format.
* @param $context
* An associative array of context information pertaining to how the address
* format should be generated. If no mode is given, it will initialize to the
* default value. The remaining context keys should only be present when the
* address format is being generated for a field:
* - mode: either 'form' or 'render'; defaults to 'render'.
* - field: the field info array.
* - instance: the field instance array.
* - langcode: the langcode of the language the field is being rendered in.
* - delta: the delta value of the given address.
*
* @return
* A renderable array suitable for use as part of a form (if 'mode' is 'form')
* or for formatted address output when passed to drupal_render().
*/
function addressfield_generate($address, array $handlers, array $context = array()) {
// If no mode is given in the context array, default it to 'render'.
if (empty($context['mode'])) {
$context['mode'] = 'render';
}
ctools_include('plugins');
$format = array();
$format['#handlers'] = $handlers;
foreach ($format['#handlers'] as $handler) {
if ($callback = ctools_plugin_load_function('addressfield', 'format', $handler, 'format callback')) {
$callback($format, $address, $context);
}
}
// Store the address in the format, for processing.
$format['#address'] = $address;
// Post-process the format stub, depending on the rendering mode.
if ($context['mode'] == 'form') {
$format['#addressfield'] = TRUE;
$format['#process'][] = 'addressfield_process_format_form';
$format['#required'] = FALSE;
}
elseif ($context['mode'] == 'render') {
$format['#pre_render'][] = 'addressfield_render_address';
}
return $format;
}
/**
* Generate a full-fledged form from a format snippet, as returned by addressfield_formats().
*/
function addressfield_process_format_form($format, &$form_state, $complete_form) {
// Make sure to load all the plugins that participated in this format.
ctools_include('plugins');
foreach ($format['#handlers'] as $handler) {
ctools_plugin_load_function('addressfield', 'format', $handler, 'format callback');
}
_addressfield_process_format_form($format, $format['#address'], $format['#required']);
return $format;
}
function _addressfield_process_format_form(&$format, $address, $required) {
foreach (element_children($format) as $key) {
$child = &$format[$key];
// Automatically expand elements that matches one of the field of the
// address structure.
if (in_array($key, array('name_line', 'first_name', 'last_name', 'organisation_name', 'country', 'administrative_area', 'sub_administrative_area', 'locality', 'dependent_locality', 'postal_code', 'thoroughfare', 'premise', 'sub_premise'))) {
// Set the type.
if (isset($child['#widget_type'])) {
$child['#type'] = $child['#widget_type'];
}
else {
if (isset($child['#options'])) {
$child['#type'] = 'select';
$child['#size'] = 0;
}
else {
$child['#type'] = 'textfield';
}
}
if (!$required) {
unset($child['#required']);
}
$child['#default_value'] = $address[$key];
}
// Recurse through the child.
_addressfield_process_format_form($child, $address, $required);
}
}
/**
* Render an address in a given format.
*/
function addressfield_render_address($format) {
_addressfield_render_address($format, $format['#address']);
return $format;
}
function _addressfield_render_address(&$format, $address) {
foreach (element_children($format) as $key) {
$child = &$format[$key];
// Automatically expand elements that matches one of the field of the
// address structure.
if (in_array($key, array('name_line', 'first_name', 'last_name', 'organisation_name', 'country', 'administrative_area', 'sub_administrative_area', 'locality', 'dependent_locality', 'postal_code', 'thoroughfare', 'premise', 'sub_premise'), TRUE)) {
if (isset($child['#render_type'])) {
$child['#type'] = $child['#render_type'];
}
else {
$child['#type'] = 'addressfield_container';
if (!isset($child['#tag'])) {
$child['#tag'] = 'span';
}
}
// If the element instructs us to render the option value instead of the
// raw address element value and its #options array has a matching key,
// swap it out for the option value now.
if (!empty($child['#render_option_value']) && isset($child['#options'][$address[$key]])) {
$child['#children'] = check_plain($child['#options'][$address[$key]]);
}
else {
$child['#children'] = check_plain($address[$key]);
}
// Skip empty elements.
if ((string) $child['#children'] === '') {
$child['#access'] = FALSE;
}
// Add #field_prefix and #field_suffix to the prefixes and suffixes.
if (isset($child['#field_prefix'])) {
$child['#prefix'] = (isset($child['#prefix']) ? $child['#prefix'] : '') . $child['#field_prefix'];
}
if (isset($child['#field_suffix'])) {
$child['#suffix'] = (isset($child['#suffix']) ? $child['#suffix'] : '') . $child['#field_suffix'];
}
}
// Recurse through the child.
_addressfield_render_address($child, $address);
}
}
/**
* @} End of "ingroup addressfield_format"
*/
/**
* Implementation of hook_theme().
*/
function addressfield_theme() {
$hooks['addressfield_container'] = array(
'render element' => 'element',
);
return $hooks;
}
/**
* Render a container for a set of address fields.
*/
function theme_addressfield_container($variables) {
$element = $variables['element'];
$element['#children'] = trim($element['#children']);
if (strlen($element['#children']) > 0) {
$output = '<' . $element['#tag'] . drupal_attributes($element['#attributes']) . '>';
$output .= $element['#children'];
$output .= '</' . $element['#tag'] . ">";
return $output;
}
else {
return '';
}
}
/**
* Implementation of hook_element_info().
*/
function addressfield_element_info() {
$types['addressfield_container'] = array(
'#theme_wrappers' => array('addressfield_container'),
'#process' => array('addressfield_widget_process'),
'#attributes' => array(),
'#tag' => 'div',
);
return $types;
}
/**
* Form API process function: set the #parents of the children of this element so they appear at the same level as the parent.
*/
function addressfield_widget_process($element) {
foreach (element_children($element) as $key) {
$element[$key]['#parents'] = $element['#parents'];
$element[$key]['#parents'][count($element[$key]['#parents']) - 1] = $key;
}
return $element;
}
/**
* Implements hook_field_info()
*/
function addressfield_field_info() {
$fields = array();
$fields['addressfield'] = array(
'label' => t('Postal address'),
'description' => t('A field type used for storing postal addresses according the xNAL standard.'),
'settings' => array(),
'instance_settings' => array(),
'default_widget' => 'addressfield_standard',
'default_formatter' => 'addressfield_default',
'property_type' => 'addressfield',
'property_callbacks' => array('addressfield_property_info_callback'),
);
return $fields;
}
/**
* Returns an array of default values for the addressfield form elements.
*/
function addressfield_default_values($available_countries = NULL) {
if (!isset($available_countries)) {
$available_countries = _addressfield_country_options_list();
}
// Use the default country of the site if possible.
$default_country = variable_get('site_default_country', NULL);
// If the default country is undefined or not in the list of available countries,
// just fallback to the first country in the list.
if (!$default_country || !isset($available_countries[$default_country])) {
$default_country = key($available_countries);
}
return array(
'country' => $default_country,
'name_line' => '',
'first_name' => '',
'last_name' => '',
'organisation_name' => '',
'administrative_area' => '',
'sub_administrative_area' => '',
'locality' => '',
'dependent_locality' => '',
'postal_code' => '',
'thoroughfare' => '',
'premise' => '',
'sub_premise' => '',
'data' => '',
);
}
/**
* Implements hook_field_is_empty().
*/
function addressfield_field_is_empty($item, $field) {
// Every address field must have at least a country value or it is considered
// empty, even if it has name information.
return empty($item['country']);
}
/**
* Implements hook_field_widget_info()
*/
function addressfield_field_widget_info() {
$widgets = array();
$widgets['addressfield_standard'] = array(
'label' => t('Dynamic address form'),
'field types' => array('addressfield'),
'settings' => array(
'available_countries' => array(),
'format_handlers' => array('address'),
),
);
return $widgets;
}
/**
* Implements hook_field_widget_settings_form()
*/
function addressfield_field_widget_settings_form($field, $instance) {
$widget = $instance['widget'];
$defaults = field_info_widget_settings($widget['type']);
$settings = array_merge($defaults, $widget['settings']);
$form = array();
if ($widget['type'] == 'addressfield_standard') {
$form['available_countries'] = array(
'#type' => 'select',
'#multiple' => TRUE,
'#title' => t('Available countries'),
'#description' => t('If no countries are selected, all countries will be available.'),
'#options' => _addressfield_country_options_list(),
'#default_value' => $settings['available_countries'],
);
$form['format_handlers'] = array(
'#type' => 'checkboxes',
'#title' => t('Format handlers'),
'#options' => addressfield_format_plugins_options(),
'#default_value' => $settings['format_handlers'],
);
}
return $form;
}
/**
* Implements hook_field_widget_form()
*/
function addressfield_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
$settings = $instance['widget']['settings'];
// Generate a specific key used to identify this element to restore a default
// value upon AJAX submission regardless of where this element is in the
// $form array.
$element_key = implode('|', array($element['#entity_type'], $element['#bundle'], $element['#field_name'], $element['#language'], $element['#delta']));
// Store the key in the element array as a value so it can be easily retrieved
// in context in the $form_state['values'] array in the element validator.
$element['element_key'] = array(
'#type' => 'value',
'#value' => $element_key,
);
// Get the default address used to build the widget form elements, looking
// first in the form state, then in the stored value for the field, and then
// in the default values of the instance.
$address = array();
if (!empty($form_state['addressfield'][$element_key])) {
// Use the value from the form_state if available.
$address = $form_state['addressfield'][$element_key];
}
elseif (!empty($items[$delta]['country'])) {
// Else use the saved value for the field.
$address = $items[$delta];
}
else {
// Otherwise use the instance default.
$address = (array) $instance['default_value'][0];
}
// Determine the list of available countries, and if the currently selected
// country is not in it, unset it so it can be reset to the default country.
$countries = _addressfield_country_options_list($field, $instance);
if (!empty($address['country']) && !isset($countries[$address['country']])) {
unset($address['country']);
}
// Merge in default values to provide a value for every expected array key.
$address += addressfield_default_values($countries);
// Add the form elements for the standard widget, which includes a country
// select list at the top that reloads the available address elements when the
// country is changed.
if ($instance['widget']['type'] == 'addressfield_standard') {
// Wrap everything in a fieldset. This is not the best looking element,
// but it's the only wrapper available in Drupal we can properly use
// in that context, and it is overridable if necessary.
$element['#type'] = 'fieldset';
// Generate the address form.
$context = array(
'mode' => 'form',
'field' => $field,
'instance' => $instance,
'langcode' => $langcode,
'delta' => $delta,
);
$element += addressfield_generate($address, $settings['format_handlers'], $context);
// Mark the form element as required if necessary.
$element['#required'] = $delta == 0 && $instance['required'];
}
return $element;
}
/**
* Element validate callback: rebuilds the form on country change and stores the
* current address value in the $form_state for retrieval on rebuild.
*/
function addressfield_standard_country_validate($element, &$form_state) {
// If the country was changed, rebuild the form.
if ($element['#default_value'] != $element['#value']) {
$form_state['rebuild'] = TRUE;
}
$parents = $element['#parents'];
array_pop($parents);
// Search through the form values to find the current address.
$address = drupal_array_get_nested_value($form_state['values'], $parents);
// Store the present address values in the form state for retrieval by the
// widget form regardless of where the widget sits in the $form array.
$form_state['addressfield'][$address['element_key']] = array_diff_key($address, array('element_key' => ''));
}
/**
* Ajax callback in response to a change of country in an address field.
*
* The only thing we have to do is to find the proper element to render.
*/
function addressfield_standard_widget_refresh($form, $form_state) {
// The target element is one element below the triggering country selector.
$array_parents = $form_state['triggering_element']['#array_parents'];
array_pop($array_parents);
// Iterate over the form parents to find the element.
$element = $form;
foreach ($array_parents as $name) {
$element = &$element[$name];
if (!empty($element['#addressfield'])) {
break;
}
}
// Return the address block, but remove the '_weight' element inserted
// by the field API.
unset($element['_weight']);
// Replace the address field widget with the updated widget and focus on the
// new country select list.
$commands[] = ajax_command_replace(NULL, render($element));
$commands[] = ajax_command_invoke('#' . $element['country']['#id'], 'focus');
// Allow other modules to add arbitrary AJAX commands on the refresh.
drupal_alter('addressfield_standard_widget_refresh', $commands, $form, $form_state);
return array('#type' => 'ajax', '#commands' => $commands);
}
/**
* Implements hook_field_formatter_info().
*/
function addressfield_field_formatter_info() {
return array(
'addressfield_default' => array(
'label' => t('Default'),
'field types' => array('addressfield'),
'settings' => array(
'use_widget_handlers' => 1,
'format_handlers' => array('address'),
),
),
);
}
/**
* Implements hook_field_formatter_settings_form().
*/
function addressfield_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$element['use_widget_handlers'] = array(
'#type' => 'checkbox',
'#title' => t('Use the same configuration as the widget.'),
'#default_value' => !empty($settings['use_widget_handlers']),
);
$element['format_handlers'] = array(
'#type' => 'checkboxes',
'#title' => t('Format handlers'),
'#options' => addressfield_format_plugins_options(),
'#default_value' => $settings['format_handlers'],
'#process' => array('form_process_checkboxes', '_addressfield_field_formatter_settings_form_process_add_state'),
'#element_validate' => array('_addressfield_field_formatter_settings_form_validate')
);
return $element;
}
/**
* Helper function: set the proper #states to the use widget handlers checkbox.
*/
function _addressfield_field_formatter_settings_form_process_add_state($element, $form_state) {
// Build a #parents based on the current checkbox.
$target_parents = array_slice($element['#parents'], 0, -1);
$target_parents[] = 'use_widget_handlers';
$target_parents = array_shift($target_parents) . ($target_parents ? '[' . implode('][', $target_parents) . ']' : '');
$element['#states']['visible'] = array(
':input[name="' . $target_parents . '"]' => array('checked' => FALSE),
);
return $element;
}
/**
* Helper function: filter the results of the checkboxes form element.
*/
function _addressfield_field_formatter_settings_form_validate($element, &$element_state) {
form_set_value($element, array_filter($element['#value']), $element_state);
}
/**
* Implements hook_field_formatter_settings_summary().
*/
function addressfield_field_formatter_settings_summary($field, $instance, $view_mode) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$summary = '';
if ($settings['use_widget_handlers']) {
return t('Use widget configuration');
}
else {
$summary = array();
$plugins = addressfield_format_plugins();
foreach ($settings['format_handlers'] as $handler) {
$summary[] = $plugins[$handler]['title'];
}
return $summary ? implode(', ', $summary) : t('No handler');
}
}
/**
* Implements hook_field_formatter_view().
*/
function addressfield_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$settings = $display['settings'];
$element = array();
switch ($display['type']) {
case 'addressfield_default':
if (!empty($settings['use_widget_handlers'])) {
$handlers = $instance['widget']['settings']['format_handlers'];
}
else {
$handlers = $settings['format_handlers'];
}
foreach ($items as $delta => $address) {
// Generate the address format.
$context = array(
'mode' => 'render',
'field' => $field,
'instance' => $instance,
'langcode' => $langcode,
'delta' => $delta,
);
$element[$delta] = addressfield_generate($address, $handlers, $context);
}
break;
}
return $element;
}
/**
* Callback to alter the property info of address fields.
*
* @see addressfield_field_info().
*/
function addressfield_property_info_callback(&$info, $entity_type, $field, $instance, $field_type) {
$name = $field['field_name'];
$property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$name];
$property['type'] = ($field['cardinality'] != 1) ? 'list<addressfield>' : 'addressfield';
$property['getter callback'] = 'entity_metadata_field_verbatim_get';
$property['setter callback'] = 'entity_metadata_field_verbatim_set';
$property['auto creation'] = 'addressfield_auto_creation';
$property['property info'] = addressfield_data_property_info();
unset($property['query callback']);
}
/**
* Auto creation callback for an addressfield value array.
*
* @see addressfield_property_info_callback()
*/
function addressfield_auto_creation() {
// We can't call addressfield_default_values() directly, because it has an
// optional array argument that will receive an invalid value when Entity API
// tries to call it directly with its usual $property_name and $context
// arguments.
return addressfield_default_values();
}
/**
* Defines info for the properties of the address field data structure.
*/
function addressfield_data_property_info($name = NULL) {
// Build an array of basic property information for the address field.
$properties = array(
'country' => array(
'label' => t('Country'),
'options list' => '_addressfield_country_options_list',
),
'name_line' => array(
'label' => t('Full name'),
),
'first_name' => array(
'label' => t('First name'),
),
'last_name' => array(
'label' => t('Last name'),
),
'organisation_name' => array(
'label' => t('Company'),
),
'administrative_area' => array(
'label' => t('Administrative area (i.e. State / Province)'),
),
'sub_administrative_area' => array(
'label' => t('Sub administrative area'),
),
'locality' => array(
'label' => t('Locality (i.e. City)'),
),
'dependent_locality' => array(
'label' => t('Dependent locality'),
),
'postal_code' => array(
'label' => t('Postal code'),
),
'thoroughfare' => array(
'label' => t('Thoroughfare (i.e. Street address)'),
),
'premise' => array(
'label' => t('Premise (i.e. Apartment / Suite number)'),
),
);
// Add the default values for each of the address field properties.
foreach ($properties as $key => &$value) {
$value += array(
'description' => !empty($name) ? t('!label of field %name', array('!label' => $value['label'], '%name' => $name)) : '',
'type' => 'text',
'getter callback' => 'entity_property_verbatim_get',
'setter callback' => 'entity_property_verbatim_set',
);
}
return $properties;
}
/**
* Wraps country_get_list() for use as an Entity API options list.
*/
function _addressfield_country_options_list($field = NULL, $instance = NULL) {
// Necessary for country_get_list().
require_once DRUPAL_ROOT . '/includes/locale.inc';
$countries = country_get_list();
if (isset($field)) {
// If the instance is not specified, loop against all the instances of the field.
if (!isset($instance)) {
$instances = array();
foreach ($field['bundles'] as $entity_type => $bundles) {
foreach ($bundles as $bundle_name) {
$instances[] = field_info_instance($entity_type, $field['field_name'], $bundle_name);
}
}
}
else {
$instances = array($instance);
}
foreach ($instances as $instance) {
if (!empty($instance['widget']['settings']['available_countries'])) {
$countries = array_intersect_key($countries, $instance['widget']['settings']['available_countries']);
}
else {
// This instance allow all the countries.
$countries = country_get_list();
break;
}
}
}
return $countries;
}

View File

@@ -0,0 +1,15 @@
name = Address Field Example
description = Example module for how to implement an addressfield format handler.
core = 7.x
package = Fields
hidden = TRUE
dependencies[] = ctools
dependencies[] = addressfield
; Information added by drupal.org packaging script on 2013-05-07
version = "7.x-1.0-beta4"
core = "7.x"
project = "addressfield"
datestamp = "1367945112"

View File

@@ -0,0 +1,10 @@
<?php
/**
* Implements hook_ctools_plugin_directory().
*/
function addressfield_example_ctools_plugin_directory($module, $plugin) {
if ($module == 'addressfield') {
return 'plugins/' . $plugin;
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* @file
* Hide the country when only one country is available.
*/
$plugin = array(
'title' => t('Hide the country when only one is available'),
'format callback' => 'addressfield_format_address_hide_country',
'type' => 'address',
'weight' => -80,
);
/**
* Format callback.
*
* @see CALLBACK_addressfield_format_callback()
*/
function addressfield_format_address_hide_country(&$format, $address, $context = array()) {
// When building the format for a form, we expect the country element to have
// an #options list. If it does, and there is only one option, hide the field
// by setting #access to FALSE.
if ($context['mode'] == 'form') {
if (!empty($format['country']['#options']) && count($format['country']['#options']) == 1) {
$format['country']['#access'] = FALSE;
}
}
elseif ($context['mode'] == 'render') {
// However, in render mode, the element does not have an #options list, so
// we look instead in the field instance settings if given. If we find a
// single country option and it matches the country of the current address,
// go ahead and hide it.
if (!empty($context['instance']['widget']['settings']['available_countries']) &&
count($context['instance']['widget']['settings']['available_countries']) == 1) {
if (isset($context['instance']['widget']['settings']['available_countries'][$address['country']])) {
$format['country']['#access'] = FALSE;
}
}
}
}

View File

@@ -0,0 +1,471 @@
<?php
/**
* @file
* The default format for adresses.
*/
$plugin = array(
'title' => t('Address form (country-specific)'),
'format callback' => 'addressfield_format_address_generate',
'type' => 'address',
'weight' => -100,
);
/**
* Format callback.
*
* @see CALLBACK_addressfield_format_callback()
*/
function addressfield_format_address_generate(&$format, $address, $context = array()) {
// We start with a reasonable default: a simple block format suitable
// for international shipping. We extend it with country-specific heuristics
// below.
// The street block.
$format['street_block'] = array(
'#type' => 'addressfield_container',
'#attributes' => array('class' => array('street-block')),
'#weight' => 0,
);
$format['street_block']['thoroughfare'] = array(
'#title' => t('Address 1'),
'#tag' => 'div',
'#attributes' => array('class' => array('thoroughfare')),
'#size' => 30,
// The #required will be automatically set to FALSE when processing.
'#required' => TRUE,
);
$format['street_block']['premise'] = array(
'#title' => t('Address 2'),
'#tag' => 'div',
'#attributes' => array('class' => array('premise')),
'#size' => 30,
);
$format['locality_block'] = array(
'#type' => 'addressfield_container',
'#attributes' => array('class' => array('addressfield-container-inline', 'locality-block', 'country-' . $address['country'])),
'#weight' => 50,
);
$format['locality_block']['#attached']['css'][] = drupal_get_path('module', 'addressfield') . '/addressfield.css';
$format['locality_block']['postal_code'] = array(
'#title' => t('Postal code'),
'#size' => 10,
'#required' => TRUE,
'#attributes' => array('class' => array('postal-code')),
);
$format['locality_block']['locality'] = array(
'#title' => t('City'),
'#size' => 30,
'#required' => TRUE,
'#prefix' => ' ',
'#attributes' => array('class' => array('locality')),
);
$format['country'] = array(
'#title' => t('Country'),
'#options' => _addressfield_country_options_list(),
'#render_option_value' => TRUE,
'#required' => TRUE,
'#attributes' => array('class' => array('country')),
'#weight' => 100,
);
// Those countries do not seem to have a relevant postal code.
static $countries_no_postal_code = array('AF', 'AG', 'AL', 'AO', 'BB', 'BI', 'BJ', 'BO', 'BS', 'BW', 'BZ', 'CF', 'CG', 'CM', 'CO', 'DJ', 'DM', 'EG', 'ER', 'FJ', 'GD', 'GH', 'GM', 'GQ', 'GY', 'HK', 'IE', 'KI', 'KM', 'KP', 'KY', 'LC', 'LY', 'ML', 'MR', 'NA', 'NR', 'RW', 'SB', 'SC', 'SL', 'SR', 'ST', 'TD', 'TG', 'TL', 'TO', 'TT', 'TV', 'TZ', 'UG', 'VC', 'VU', 'WS', 'ZW');
if (in_array($address['country'], $countries_no_postal_code)) {
unset($format['locality_block']['postal_code']);
// Remove the prefix from the first widget of the block.
$element_children = element_children($format['locality_block']);
$first_child = reset($element_children);
unset($format['locality_block'][$first_child]['#prefix']);
}
// Those countries generally use the administrative area in postal addresses.
static $countries_administrative_area = array('AR', 'AU', 'BR', 'BS', 'BY', 'BZ', 'CA', 'CN', 'DO', 'EG', 'ES', 'FJ', 'FM', 'GB', 'HN', 'ID', 'IE', 'IN', 'IT', 'JO', 'JP', 'KI', 'KN', 'KR', 'KW', 'KY', 'KZ', 'MX', 'MY', 'MZ', 'NG', 'NI', 'NR', 'NZ', 'OM', 'PA', 'PF', 'PG', 'PH', 'PR', 'PW', 'RU', 'SM', 'SO', 'SR', 'SV', 'TH', 'TW', 'UA', 'US', 'UY', 'VE', 'VI', 'VN', 'YU', 'ZA');
if (in_array($address['country'], $countries_administrative_area)) {
$format['locality_block']['administrative_area'] = array(
'#title' => t('State', array(), array('context' => 'addressfield')),
'#size' => 10,
'#required' => TRUE,
'#prefix' => ' ',
'#attributes' => array('class' => array('state')),
);
}
// A few countries have a well-known list of administrative divisions.
if ($address['country'] == 'US') {
$format['locality_block']['administrative_area']['#options'] = array(
'' => t('--'),
'AL' => t('Alabama'),
'AK' => t('Alaska'),
'AZ' => t('Arizona'),
'AR' => t('Arkansas'),
'CA' => t('California'),
'CO' => t('Colorado'),
'CT' => t('Connecticut'),
'DE' => t('Delaware'),
'DC' => t('District Of Columbia'),
'FL' => t('Florida'),
'GA' => t('Georgia'),
'HI' => t('Hawaii'),
'ID' => t('Idaho'),
'IL' => t('Illinois'),
'IN' => t('Indiana'),
'IA' => t('Iowa'),
'KS' => t('Kansas'),
'KY' => t('Kentucky'),
'LA' => t('Louisiana'),
'ME' => t('Maine'),
'MD' => t('Maryland'),
'MA' => t('Massachusetts'),
'MI' => t('Michigan'),
'MN' => t('Minnesota'),
'MS' => t('Mississippi'),
'MO' => t('Missouri'),
'MT' => t('Montana'),
'NE' => t('Nebraska'),
'NV' => t('Nevada'),
'NH' => t('New Hampshire'),
'NJ' => t('New Jersey'),
'NM' => t('New Mexico'),
'NY' => t('New York'),
'NC' => t('North Carolina'),
'ND' => t('North Dakota'),
'OH' => t('Ohio'),
'OK' => t('Oklahoma'),
'OR' => t('Oregon'),
'PA' => t('Pennsylvania'),
'RI' => t('Rhode Island'),
'SC' => t('South Carolina'),
'SD' => t('South Dakota'),
'TN' => t('Tennessee'),
'TX' => t('Texas'),
'UT' => t('Utah'),
'VT' => t('Vermont'),
'VA' => t('Virginia'),
'WA' => t('Washington'),
'WV' => t('West Virginia'),
'WI' => t('Wisconsin'),
'WY' => t('Wyoming'),
' ' => t('--'),
'AA' => t('Armed Forces (Americas)'),
'AE' => t('Armed Forces (Europe, Canada, Middle East, Africa)'),
'AP' => t('Armed Forces (Pacific)'),
'AS' => t('American Samoa'),
'FM' => t('Federated States of Micronesia'),
'GU' => t('Guam'),
'MH' => t('Marshall Islands'),
'MP' => t('Northern Mariana Islands'),
'PW' => t('Palau'),
'PR' => t('Puerto Rico'),
'VI' => t('Virgin Islands'),
);
$format['locality_block']['postal_code']['#title'] = t('ZIP Code');
if ($context['mode'] == 'render') {
$format['locality_block']['locality']['#suffix'] = ',';
}
}
else if ($address['country'] == 'IT') {
$format['locality_block']['administrative_area']['#options'] = array(
'' => t('--'),
'AG' => t('Agrigento'),
'AL' => t('Alessandria'),
'AN' => t('Ancona'),
'AO' => t("Valle d'Aosta/Vallée d'Aoste"),
'AP' => t('Ascoli Piceno'),
'AQ' => t("L'Aquila"),
'AR' => t('Arezzo'),
'AT' => t('Asti'),
'AV' => t('Avellino'),
'BA' => t('Bari'),
'BG' => t('Bergamo'),
'BI' => t('Biella'),
'BL' => t('Belluno'),
'BN' => t('Benevento'),
'BO' => t('Bologna'),
'BR' => t('Brindisi'),
'BS' => t('Brescia'),
'BT' => t('Barletta-Andria-Trani'),
'BZ' => t('Bolzano/Bozen'),
'CA' => t('Cagliari'),
'CB' => t('Campobasso'),
'CE' => t('Caserta'),
'CH' => t('Chieti'),
'CI' => t('Carbonia-Iglesias'),
'CL' => t('Caltanissetta'),
'CN' => t('Cuneo'),
'CO' => t('Como'),
'CR' => t('Cremona'),
'CS' => t('Cosenza'),
'CT' => t('Catania'),
'CZ' => t('Catanzaro'),
'EN' => t('Enna'),
'FC' => t('Forlì-Cesena'),
'FE' => t('Ferrara'),
'FG' => t('Foggia'),
'FI' => t('Firenze'),
'FM' => t('Fermo'),
'FR' => t('Frosinone'),
'GE' => t('Genova'),
'GO' => t('Gorizia'),
'GR' => t('Grosseto'),
'IM' => t('Imperia'),
'IS' => t('Isernia'),
'KR' => t('Crotone'),
'LC' => t('Lecco'),
'LE' => t('Lecce'),
'LI' => t('Livorno'),
'LO' => t('Lodi'),
'LT' => t('Latina'),
'LU' => t('Lucca'),
'MB' => t('Monza e Brianza'),
'MC' => t('Macerata'),
'ME' => t('Messina'),
'MI' => t('Milano'),
'MN' => t('Mantova'),
'MO' => t('Modena'),
'MS' => t('Massa-Carrara'),
'MT' => t('Matera'),
'NA' => t('Napoli'),
'NO' => t('Novara'),
'NU' => t('Nuoro'),
'OG' => t('Ogliastra'),
'OR' => t('Oristano'),
'OT' => t('Olbia-Tempio'),
'PA' => t('Palermo'),
'PC' => t('Piacenza'),
'PD' => t('Padova'),
'PE' => t('Pescara'),
'PG' => t('Perugia'),
'PI' => t('Pisa'),
'PN' => t('Pordenone'),
'PO' => t('Prato'),
'PR' => t('Parma'),
'PT' => t('Pistoia'),
'PU' => t('Pesaro e Urbino'),
'PV' => t('Pavia'),
'PZ' => t('Potenza'),
'RA' => t('Ravenna'),
'RC' => t('Reggio di Calabria'),
'RE' => t("Reggio nell'Emilia"),
'RG' => t('Ragusa'),
'RI' => t('Rieti'),
'RM' => t('Roma'),
'RN' => t('Rimini'),
'RO' => t('Rovigo'),
'SA' => t('Salerno'),
'SI' => t('Siena'),
'SO' => t('Sondrio'),
'SP' => t('La Spezia'),
'SR' => t('Siracusa'),
'SS' => t('Sassari'),
'SV' => t('Savona'),
'TA' => t('Taranto'),
'TE' => t('Teramo'),
'TN' => t('Trento'),
'TO' => t('Torino'),
'TP' => t('Trapani'),
'TR' => t('Terni'),
'TS' => t('Trieste'),
'TV' => t('Treviso'),
'UD' => t('Udine'),
'VA' => t('Varese'),
'VB' => t('Verbano-Cusio-Ossola'),
'VC' => t('Vercelli'),
'VE' => t('Venezia'),
'VI' => t('Vicenza'),
'VR' => t('Verona'),
'VS' => t('Medio Campidano'),
'VT' => t('Viterbo'),
'VV' => t('Vibo Valentia'),
);
$format['locality_block']['administrative_area']['#title'] = t('Province');
}
else if ($address['country'] == 'BR') {
$format['locality_block']['administrative_area']['#render_option_value'] = TRUE;
$format['locality_block']['administrative_area']['#options'] = array(
'' => t('--'),
'AC' => t('Acre'),
'AL' => t('Alagoas'),
'AM' => t('Amazonas'),
'AP' => t('Amapá'),
'BA' => t('Bahia'),
'CE' => t('Ceará'),
'DF' => t('Distrito Federal'),
'ES' => t('Espírito Santo'),
'GO' => t('Goiás'),
'MA' => t('Maranhão'),
'MG' => t('Minas Gerais'),
'MS' => t('Mato Grosso do Sul'),
'MT' => t('Mato Grosso'),
'PA' => t('Pará'),
'PB' => t('Paraíba'),
'PE' => t('Pernambuco'),
'PI' => t('Piauí'),
'PR' => t('Paraná'),
'RJ' => t('Rio de Janeiro'),
'RN' => t('Rio Grande do Norte'),
'RO' => t('Rondônia'),
'RR' => t('Roraima'),
'RS' => t('Rio Grande do Sul'),
'SC' => t('Santa Catarina'),
'SE' => t('Sergipe'),
'SP' => t('São Paulo'),
'TO' => t('Tocantins'),
);
}
else if ($address['country'] == 'CA') {
$format['locality_block']['administrative_area']['#options'] = array(
'' => t('--'),
'AB' => t('Alberta'),
'BC' => t('British Columbia'),
'MB' => t('Manitoba'),
'NB' => t('New Brunswick'),
'NL' => t('Newfoundland and Labrador'),
'NT' => t('Northwest Territories'),
'NS' => t('Nova Scotia'),
'NU' => t('Nunavut'),
'ON' => t('Ontario'),
'PE' => t('Prince Edward Island'),
'QC' => t('Quebec'),
'SK' => t('Saskatchewan'),
'YT' => t('Yukon Territory'),
);
$format['locality_block']['administrative_area']['#title'] = t('Province');
if ($context['mode'] == 'render') {
$format['locality_block']['locality']['#suffix'] = ',';
}
}
else if ($address['country'] == 'AU') {
$format['locality_block']['administrative_area']['#options'] = array(
'' => t('--'),
'ACT' => t('Australian Capital Territory'),
'NSW' => t('New South Wales'),
'NT' => t('Northern Territory'),
'QLD' => t('Queensland'),
'SA' => t('South Australia'),
'TAS' => t('Tasmania'),
'VIC' => t('Victoria'),
'WA' => t('Western Australia'),
);
}
else if ($address['country'] == 'NZ') {
$format['locality_block']['locality']['#title'] = ('Town/City');
$format['locality_block']['postal_code']['#title'] = t('Postcode');
$format['locality_block']['administrative_area']['#render_option_value'] = TRUE;
$format['locality_block']['administrative_area']['#title'] = t('Region');
$format['locality_block']['administrative_area']['#required'] = FALSE;
$format['locality_block']['administrative_area']['#options'] = array(
'' => t('--'),
'AUK' => t('Auckland'),
'BOP' => t('Bay of Plenty'),
'CAN' => t('Canterbury'),
'HKB' => t("Hawke's Bay"),
'MWT' => t('Manawatu-Wanganui'),
'NTL' => t('Northland'),
'OTA' => t('Otago'),
'STL' => t('Southland'),
'TKI' => t('Taranaki'),
'WKO' => t('Waikato'),
'WGN' => t('Wellington'),
'WTC' => t('West Coast'),
'GIS' => t('Gisborne District'),
'MBH' => t('Marlborough District'),
'NSN' => t('Nelson City'),
'TAS' => t('Tasman District'),
'CIT' => t('Chatham Islands Territory'),
);
}
// Those countries tend to put the postal code after the locality.
static $countries_postal_code_after_locality = array('AU', 'BD', 'BF', 'BH', 'BM', 'BN', 'BT', 'CA', 'FM', 'GB', 'ID', 'IN', 'JM', 'JO', 'KH', 'LB', 'LS', 'LV', 'MM', 'MN', 'MV', 'MW', 'NG', 'NP', 'NZ', 'PE', 'PK', 'PR', 'PW', 'SA', 'SG', 'SO', 'TH', 'US', 'VI', 'VG', 'VN');
if (in_array($address['country'], $countries_postal_code_after_locality)) {
// Take the widget out of the array.
$postal_code_widget = $format['locality_block']['postal_code'];
$postal_code_widget['#prefix'] = ' ';
unset($format['locality_block']['postal_code']);
// Add it back.
$format['locality_block']['postal_code'] = $postal_code_widget;
// Remove the prefix from the first widget of the block.
$element_children = element_children($format['locality_block']);
$first_child = reset($element_children);
unset($format['locality_block'][$first_child]['#prefix']);
}
// GB-specific tweaks
if ($address['country'] == 'GB') {
// Locality
$format['locality_block']['locality'] = array_merge(
$format['locality_block']['locality'],
array(
'#title' => t('Town/City'),
'#weight' => 40,
'#prefix' => '',
'#tag' => 'div',
)
);
// Administrative
$format['locality_block']['administrative_area'] = array_merge(
$format['locality_block']['administrative_area'],
array(
'#title' => t('County'),
'#required' => FALSE,
'#weight' => 50,
'#size' => 30,
'#prefix' => '',
'#tag' => 'div',
)
);
// Postal code
$format['locality_block']['postal_code'] = array_merge(
$format['locality_block']['postal_code'],
array(
'#title' => t('Postcode'),
'#weight' => 60,
'#prefix' => '',
'#tag' => 'div',
)
);
}
if ($context['mode'] == 'form') {
// Provide a wrapper ID for AJAX replacement based on country selection.
if (!isset($format['#wrapper_id'])) {
$format['#wrapper_id'] = drupal_html_id('addressfield-wrapper');
$format['#prefix'] = '<div id="' . $format['#wrapper_id'] . '">';
$format['#suffix'] = '</div>';
}
// Form mode, move the country selector to the top of the form.
$format['country']['#weight'] = -10;
// Limit it to the countries supported by the widget.
if (isset($context['field'])) {
$format['country']['#options'] = _addressfield_country_options_list($context['field'], $context['instance']);
}
// AJAX enable it.
$format['country']['#ajax'] = array(
'callback' => 'addressfield_standard_widget_refresh',
'wrapper' => $format['#wrapper_id'],
);
$format['country']['#element_validate'] = array('addressfield_standard_country_validate');
// Don't validate any element when the country is changed.
$format['country']['#limit_validation_errors'] = array();
if (isset($context['delta']) && $context['delta'] > 0) {
// On subsequent elements of a field, we make the country field non
// required and add a ' - None - ' option to it, so as to allow the
// user to remove the address by clearing the country field.
$format['country']['#required'] = FALSE;
$format['country']['#empty_value'] = '';
}
}
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* @file
* Generates a first name + last name format.
*/
$plugin = array(
'title' => t('Name (First name, Last name)'),
'format callback' => 'addressfield_format_name_full_generate',
'type' => 'name',
'weight' => 0,
);
/**
* Format callback.
*
* @see CALLBACK_addressfield_format_callback()
*/
function addressfield_format_name_full_generate(&$format, $address) {
$format['name_block'] = array(
'#type' => 'addressfield_container',
'#attributes' => array('class' => array('addressfield-container-inline', 'name-block')),
'#weight' => -100,
);
$format['name_block']['first_name'] = array(
'#title' => t('First name'),
'#size' => 30,
'#required' => TRUE,
'#attributes' => array('class' => array('first-name')),
);
$format['name_block']['last_name'] = array(
'#title' => t('Last name'),
'#size' => 30,
'#required' => TRUE,
'#prefix' => ' ',
'#attributes' => array('class' => array('last-name')),
);
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* @file
* Generates a first name + last name format.
*/
$plugin = array(
'title' => t('Name (single line)'),
'format callback' => 'addressfield_format_name_oneline_generate',
'type' => 'name',
'weight' => 0,
);
/**
* Format callback.
*
* @see CALLBACK_addressfield_format_callback()
*/
function addressfield_format_name_oneline_generate(&$format, $address) {
$format['name_block'] = array(
'#type' => 'addressfield_container',
'#attributes' => array('class' => array('addressfield-container-inline', 'name-block')),
'#weight' => -100,
);
$format['name_block']['name_line'] = array(
'#title' => t('Full name'),
'#tag' => 'div',
'#attributes' => array('class' => array('name-block')),
'#size' => 30,
'#required' => TRUE,
);
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* @file
* Generates a first name + last name format.
*/
$plugin = array(
'title' => t('Organisation (single line)'),
'format callback' => 'addressfield_format_organisation_generate',
'type' => 'organisation',
'weight' => -10,
);
/**
* Format callback.
*
* @see CALLBACK_addressfield_format_callback()
*/
function addressfield_format_organisation_generate(&$format, $address) {
$format['organisation_block'] = array(
'#type' => 'addressfield_container',
'#attributes' => array('class' => array('addressfield-container-inline', 'name-block')),
'#weight' => -50,
);
$format['organisation_block']['organisation_name'] = array(
'#title' => t('Company'),
'#size' => 30,
'#attributes' => array('class' => array('organisation-name')),
);
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* Implements hook_field_views_data().
*/
function addressfield_field_views_data($field) {
$data = field_views_field_default_views_data($field);
// Add a handler for countries.
foreach ($field['storage']['details']['sql'] as $type => $tables) {
foreach ($tables as $table_name => $columns) {
if (!isset($columns['country'])) {
continue;
}
$column_real_name = $columns['country'];
if (!isset($data[$table_name][$column_real_name]['filter'])) {
continue;
}
$data[$table_name][$column_real_name]['filter']['handler'] = 'addressfield_views_handler_filter_country';
}
}
return $data;
}

View File

@@ -0,0 +1,9 @@
<?php
class addressfield_views_handler_filter_country extends views_handler_filter_in_operator {
function get_value_options() {
$this->value_title = t('Country');
$field = field_info_field($this->definition['field_name']);
$this->value_options = _addressfield_country_options_list($field);
}
}