vocabulaies with name and value
This commit is contained in:
parent
4e7c5c78c1
commit
ff33ec501f
|
@ -5,6 +5,7 @@ import java.util.Arrays;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import eu.dnetlib.organizations.model.utils.VocabularyTerm;
|
||||
import eu.dnetlib.organizations.model.view.UserView;
|
||||
import eu.dnetlib.organizations.repository.UserRepository;
|
||||
import eu.dnetlib.organizations.repository.readonly.UserViewRepository;
|
||||
|
@ -55,7 +57,10 @@ public class UserController {
|
|||
|
||||
// IMPORTANT: a national admin can manage ONLY the users where ALL the countries are under his control
|
||||
final List<UserView> res = new ArrayList<>();
|
||||
final List<String> myCountries = dbUtils.listCountriesForUser(authentication.getName());
|
||||
final List<String> myCountries = dbUtils.listCountriesForUser(authentication.getName())
|
||||
.stream()
|
||||
.map(VocabularyTerm::getValue)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (final UserView uw : userViewRepository.findAll()) {
|
||||
if (uw.getCountries() != null && uw.getCountries().length > 0 && myCountries.containsAll(Arrays.asList(uw.getCountries()))) {
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.springframework.security.core.Authentication;
|
|||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import eu.dnetlib.organizations.model.utils.VocabularyTerm;
|
||||
import eu.dnetlib.organizations.utils.DatabaseUtils;
|
||||
import eu.dnetlib.organizations.utils.DatabaseUtils.VocabularyTable;
|
||||
import eu.dnetlib.organizations.utils.RelationType;
|
||||
|
@ -24,28 +25,34 @@ public class VocabulariesController {
|
|||
private DatabaseUtils databaseUtils;
|
||||
|
||||
@GetMapping("/api/vocabularies")
|
||||
public Map<String, List<String>> ListVocabularies(final Authentication authentication) {
|
||||
final Map<String, List<String>> vocs = new HashMap<>();
|
||||
public Map<String, List<VocabularyTerm>> ListVocabularies(final Authentication authentication) {
|
||||
final Map<String, List<VocabularyTerm>> vocs = new HashMap<>();
|
||||
vocs.put("orgTypes", databaseUtils.listValuesOfVocabularyTable(VocabularyTable.org_types));
|
||||
vocs.put("idTypes", databaseUtils.listValuesOfVocabularyTable(VocabularyTable.id_types));
|
||||
vocs.put("languages", databaseUtils.listValuesOfVocabularyTable(VocabularyTable.languages));
|
||||
|
||||
vocs.put("relTypes", Arrays.stream(RelationType.values()).map(Object::toString).collect(Collectors.toList()));
|
||||
vocs.put("similaritiesType", Arrays.stream(SimilarityType.values()).map(Object::toString).collect(Collectors.toList()));
|
||||
vocs.put("relTypes", Arrays.stream(RelationType.values())
|
||||
.map(t -> new VocabularyTerm(t.toString(), t.toString()))
|
||||
.collect(Collectors.toList()));
|
||||
vocs.put("similaritiesType", Arrays.stream(SimilarityType.values())
|
||||
.map(t -> new VocabularyTerm(t.toString(), t.toString()))
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
if (UserInfo.isSimpleUser(authentication) || UserInfo.isNationalAdmin(authentication)) {
|
||||
vocs.put("countries", databaseUtils.listCountriesForUser(authentication.getName()));
|
||||
} else if (UserInfo.isSuperAdmin(authentication)) {
|
||||
vocs.put("countries", databaseUtils.listValuesOfVocabularyTable(VocabularyTable.countries));
|
||||
} else {
|
||||
vocs.put("countries", new ArrayList<String>());
|
||||
vocs.put("countries", new ArrayList<VocabularyTerm>());
|
||||
}
|
||||
|
||||
return vocs;
|
||||
}
|
||||
|
||||
@GetMapping({ "/api/voc/allCountries", "/registration_api/voc/allCountries" })
|
||||
public List<String> allCountries() {
|
||||
@GetMapping({
|
||||
"/api/voc/allCountries", "/registration_api/voc/allCountries"
|
||||
})
|
||||
public List<VocabularyTerm> allCountries() {
|
||||
return databaseUtils.listValuesOfVocabularyTable(VocabularyTable.countries);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ public class BrowseEntry implements Serializable {
|
|||
private static final long serialVersionUID = 8854955977257064470L;
|
||||
|
||||
private String value;
|
||||
private String name;
|
||||
private int approved;
|
||||
private int pending;
|
||||
|
||||
|
@ -21,6 +22,14 @@ public class BrowseEntry implements Serializable {
|
|||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getApproved() {
|
||||
return approved;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package eu.dnetlib.organizations.model.utils;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class VocabularyTerm implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -524482434889131310L;
|
||||
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public VocabularyTerm() {}
|
||||
|
||||
public VocabularyTerm(final String name, final String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(final String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
|
@ -39,6 +39,7 @@ import eu.dnetlib.organizations.model.User;
|
|||
import eu.dnetlib.organizations.model.UserCountry;
|
||||
import eu.dnetlib.organizations.model.utils.BrowseEntry;
|
||||
import eu.dnetlib.organizations.model.utils.OrganizationConflict;
|
||||
import eu.dnetlib.organizations.model.utils.VocabularyTerm;
|
||||
import eu.dnetlib.organizations.model.view.OrganizationView;
|
||||
import eu.dnetlib.organizations.model.view.UserView;
|
||||
import eu.dnetlib.organizations.repository.AcronymRepository;
|
||||
|
@ -159,13 +160,16 @@ public class DatabaseUtils {
|
|||
}
|
||||
|
||||
@Cacheable("vocs")
|
||||
public List<String> listValuesOfVocabularyTable(final VocabularyTable table) {
|
||||
return jdbcTemplate.queryForList("select val from " + table, String.class);
|
||||
public List<VocabularyTerm> listValuesOfVocabularyTable(final VocabularyTable table) {
|
||||
final String sql = "select val as value, name as name from " + table;
|
||||
return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(VocabularyTerm.class));
|
||||
}
|
||||
|
||||
@Cacheable("countries_for_user")
|
||||
public List<String> listCountriesForUser(final String name) {
|
||||
return jdbcTemplate.queryForList("select country from user_countries where email = ?", String.class, name);
|
||||
public List<VocabularyTerm> listCountriesForUser(final String name) {
|
||||
final String sql =
|
||||
"select uc.country as value, c.name as name from user_countries uc left outer join countries c on (c.val = uc.country) where uc.email = ?";
|
||||
return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(VocabularyTerm.class), name);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
@ -276,27 +280,27 @@ public class DatabaseUtils {
|
|||
// BROWSE BY COUNTRY
|
||||
public List<BrowseEntry> browseCountries() {
|
||||
final String sql =
|
||||
"select country as value, sum(case when status='approved' then 1 else 0 end) as approved, sum(case when status='pending' then 1 else 0 end) as pending from organizations group by country order by approved desc";
|
||||
"select o.country as value, c.name as name, sum(case when status='approved' then 1 else 0 end) as approved, sum(case when status='pending' then 1 else 0 end) as pending from organizations o left outer join countries c on (o.country = c.val) group by o.country, c.name order by approved desc";
|
||||
return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BrowseEntry.class));
|
||||
}
|
||||
|
||||
// BROWSE BY COUNTRY FOR USER
|
||||
public List<BrowseEntry> browseCountriesForUser(final String email) {
|
||||
final String sql =
|
||||
"select o.country as value, sum(case when status='approved' then 1 else 0 end) as approved, sum(case when status='pending' then 1 else 0 end) as pending from user_countries uc left outer join organizations o on (uc.country = o.country) where uc.email=? group by o.country order by approved desc";
|
||||
"select o.country as value, c.name as name, sum(case when status='approved' then 1 else 0 end) as approved, sum(case when status='pending' then 1 else 0 end) as pending from user_countries uc left outer join organizations o on (uc.country = o.country) left outer join countries c on (o.country = c.val) where uc.email=? group by o.country, c.name order by approved desc";
|
||||
return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BrowseEntry.class), email);
|
||||
}
|
||||
|
||||
// BROWSE BY ORG TYPE
|
||||
public List<BrowseEntry> browseTypes() {
|
||||
final String sql =
|
||||
"select type as value, sum(case when status='approved' then 1 else 0 end) as approved, sum(case when status='pending' then 1 else 0 end) as pending from organizations group by type order by approved desc";
|
||||
"select type as value, type as name, sum(case when status='approved' then 1 else 0 end) as approved, sum(case when status='pending' then 1 else 0 end) as pending from organizations group by type order by approved desc";
|
||||
return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BrowseEntry.class));
|
||||
}
|
||||
|
||||
// BROWSE BY ORG TYPE FOR USER
|
||||
public List<BrowseEntry> browseTypesForUser(final String email) {
|
||||
final String sql = "select o.type as value, "
|
||||
final String sql = "select o.type as value, o.type as name,"
|
||||
+ "sum(case when status='approved' then 1 else 0 end) as approved, "
|
||||
+ "sum(case when status='pending' then 1 else 0 end) as pending "
|
||||
+ "from organizations o "
|
||||
|
|
|
@ -26,32 +26,285 @@ DROP TABLE IF EXISTS languages;
|
|||
|
||||
DROP SEQUENCE IF EXISTS organizations_id_seq;
|
||||
|
||||
CREATE TABLE org_types (val text PRIMARY KEY);
|
||||
INSERT INTO org_types VALUES ('Archive'), ('Company'), ('Education'), ('Facility'), ('Government'), ('Healthcare'), ('Nonprofit'), ('Other'), ('UNKNOWN');
|
||||
CREATE TABLE org_types (val text PRIMARY KEY, name text);
|
||||
INSERT INTO org_types(val) VALUES ('Archive'), ('Company'), ('Education'), ('Facility'), ('Government'), ('Healthcare'), ('Nonprofit'), ('Other'), ('UNKNOWN');
|
||||
UPDATE org_types SET name = val;
|
||||
|
||||
CREATE TABLE id_types (val text PRIMARY KEY);
|
||||
INSERT INTO id_types VALUES ('CNRS'), ('FundRef'), ('HESA'), ('ISNI'), ('LinkedIn'), ('OrgRef'), ('UCAS'), ('UKPRN'), ('Wikidata'), ('GRID'), ('ROR');
|
||||
CREATE TABLE id_types (val text PRIMARY KEY, name text);
|
||||
INSERT INTO id_types(val) VALUES ('CNRS'), ('FundRef'), ('HESA'), ('ISNI'), ('LinkedIn'), ('OrgRef'), ('UCAS'), ('UKPRN'), ('Wikidata'), ('GRID'), ('ROR');
|
||||
UPDATE id_types SET name = val;
|
||||
|
||||
CREATE TABLE languages (val text PRIMARY KEY);
|
||||
INSERT INTO languages VALUES ('UNKNOWN'),
|
||||
CREATE TABLE languages (val text PRIMARY KEY, name text);
|
||||
INSERT INTO languages(val) VALUES ('UNKNOWN'),
|
||||
('aa'),('af'),('am'),('ar'),('as'),('az'),('ba'),('be'),('bg'),('bn'),('br'),('bs'),('ca'),('ch'),('co'),('cs'),('cy'),('da'),('de'),('dv'),
|
||||
('dz'),('el'),('en'),('eo'),('es'),('et'),('eu'),('fa'),('fi'),('fo'),('fr'),('fy'),('ga'),('gd'),('gl'),('gu'),('he'),('hi'),('hr'),('ht'),
|
||||
('hu'),('hy'),('id'),('is'),('it'),('iu'),('ja'),('jv'),('ka'),('kk'),('kl'),('km'),('kn'),('ko'),('ku'),('ky'),('la'),('lb'),('lo'),('lt'),
|
||||
('lv'),('mg'),('mi'),('mk'),('ml'),('mn'),('mr'),('ms'),('mt'),('my'),('nb'),('ne'),('nl'),('no'),('oc'),('om'),('or'),('pa'),('pl'),('ps'),
|
||||
('pt'),('rm'),('ro'),('ru'),('rw'),('sa'),('sd'),('si'),('sk'),('sl'),('sm'),('so'),('sq'),('sr'),('sv'),('sw'),('ta'),('te'),('tg'),('th'),
|
||||
('tk'),('tl'),('tr'),('tt'),('ug'),('uk'),('ur'),('uz'),('vi'),('xh'),('yo'),('zh'),('zu');
|
||||
UPDATE languages SET name = val;
|
||||
|
||||
CREATE TABLE countries (val text PRIMARY KEY, name text);
|
||||
INSERT INTO countries(val, name) VALUES
|
||||
('AD', 'Andorra'),
|
||||
('AE', 'United Arab Emirates'),
|
||||
('AF', 'Afghanistan'),
|
||||
('AG', 'Antigua and Barbuda'),
|
||||
('AI', 'Anguilla'),
|
||||
('AL', 'Albania'),
|
||||
('AM', 'Armenia'),
|
||||
('AN', 'Netherlands Antilles'),
|
||||
('AO', 'Angola'),
|
||||
('AQ', 'Antarctica'),
|
||||
('AR', 'Argentina'),
|
||||
('AS', 'American Samoa'),
|
||||
('AT', 'Austria'),
|
||||
('AU', 'Australia'),
|
||||
('AW', 'Aruba'),
|
||||
('AX', 'Åland Islands'),
|
||||
('AZ', 'Azerbaijan'),
|
||||
('BA', 'Bosnia and Herzegovina'),
|
||||
('BB', 'Barbados'),
|
||||
('BD', 'Bangladesh'),
|
||||
('BE', 'Belgium'),
|
||||
('BF', 'Burkina Faso'),
|
||||
('BG', 'Bulgaria'),
|
||||
('BH', 'Bahrain'),
|
||||
('BI', 'Burundi'),
|
||||
('BJ', 'Benin'),
|
||||
('BL', 'Saint-Barthélemy'),
|
||||
('BM', 'Bermuda'),
|
||||
('BN', 'Brunei Darussalam'),
|
||||
('BO', 'Bolivia'),
|
||||
('BQ', 'Bonaire, Sint Eustatius and Saba'),
|
||||
('BR', 'Brazil'),
|
||||
('BS', 'Bahamas'),
|
||||
('BT', 'Bhutan'),
|
||||
('BV', 'Bouvet Island'),
|
||||
('BW', 'Botswana'),
|
||||
('BY', 'Belarus'),
|
||||
('BZ', 'Belize'),
|
||||
('CA', 'Canada'),
|
||||
('CC', 'Cocos (Keeling) Islands'),
|
||||
('CD', 'Congo (Democratic Republic of)'),
|
||||
('CF', 'Central African Republic'),
|
||||
('CG', 'Congo'),
|
||||
('CH', 'Switzerland'),
|
||||
('CI', 'Cote d''Ivoire'),
|
||||
('CK', 'Cook Islands'),
|
||||
('CL', 'Chile'),
|
||||
('CM', 'Cameroon'),
|
||||
('CN', 'China (People''s Republic of)'),
|
||||
('CO', 'Colombia'),
|
||||
('CR', 'Costa Rica'),
|
||||
('CS', 'Serbia and Montenegro'),
|
||||
('CU', 'Cuba'),
|
||||
('CV', 'Cape Verde'),
|
||||
('CW', 'Curaçao'),
|
||||
('CX', 'Christmas Island'),
|
||||
('CY', 'Cyprus'),
|
||||
('CZ', 'Czech Republic'),
|
||||
('DE', 'Germany'),
|
||||
('DJ', 'Djibouti'),
|
||||
('DK', 'Denmark'),
|
||||
('DM', 'Dominica'),
|
||||
('DO', 'Dominican Republic'),
|
||||
('DZ', 'Algeria'),
|
||||
('EC', 'Ecuador'),
|
||||
('EE', 'Estonia'),
|
||||
('EG', 'Egypt'),
|
||||
('EH', 'Western Sahara'),
|
||||
('ER', 'Eritrea'),
|
||||
('ES', 'Spain'),
|
||||
('ET', 'Ethiopia'),
|
||||
('EU', 'European Union'),
|
||||
('FI', 'Finland'),
|
||||
('FJ', 'Fiji'),
|
||||
('FK', 'Falkland Islands (Malvinas)'),
|
||||
('FM', 'Micronesia, Federated States of'),
|
||||
('FO', 'Faroe Islands'),
|
||||
('FR', 'France'),
|
||||
('GA', 'Gabon'),
|
||||
('GB', 'United Kingdom'),
|
||||
('GD', 'Grenada'),
|
||||
('GE', 'Georgia'),
|
||||
('GF', 'French Guiana'),
|
||||
('GG', 'Guernsey'),
|
||||
('GH', 'Ghana'),
|
||||
('GI', 'Gibraltar'),
|
||||
('GL', 'Greenland'),
|
||||
('GM', 'Gambia'),
|
||||
('GN', 'Guinea'),
|
||||
('GP', 'Guadeloupe'),
|
||||
('GQ', 'Equatorial Guinea'),
|
||||
('GR', 'Greece'),
|
||||
('GS', 'South Georgia and the South Sandwich Islands'),
|
||||
('GT', 'Guatemala'),
|
||||
('GU', 'Guam'),
|
||||
('GW', 'Guinea-Bissau'),
|
||||
('GY', 'Guyana'),
|
||||
('HK', 'Hong Kong'),
|
||||
('HM', 'Heard Island and McDonald Islands'),
|
||||
('HN', 'Honduras'),
|
||||
('HR', 'Croatia'),
|
||||
('HT', 'Haiti'),
|
||||
('HU', 'Hungary'),
|
||||
('ID', 'Indonesia'),
|
||||
('IE', 'Ireland'),
|
||||
('IL', 'Israel'),
|
||||
('IM', 'Isle of Man'),
|
||||
('IN', 'India'),
|
||||
('IO', 'British Indian Ocean Territory'),
|
||||
('IQ', 'Iraq'),
|
||||
('IR', 'Iran (Islamic Republic of)'),
|
||||
('IS', 'Iceland'),
|
||||
('IT', 'Italy'),
|
||||
('JE', 'Jersey'),
|
||||
('JM', 'Jamaica'),
|
||||
('JO', 'Jordan'),
|
||||
('JP', 'Japan'),
|
||||
('KE', 'Kenya'),
|
||||
('KG', 'Kyrgyzstan'),
|
||||
('KH', 'Cambodia'),
|
||||
('KI', 'Kiribati'),
|
||||
('KM', 'Comoros'),
|
||||
('KN', 'Saint Kitts and Nevis'),
|
||||
('KO', 'Kosovo * UN resolution'),
|
||||
('KP', 'Korea, Democatric People''s Republic of'),
|
||||
('KR', 'Korea (Republic of)'),
|
||||
('KW', 'Kuwait'),
|
||||
('KY', 'Cayman Islands'),
|
||||
('KZ', 'Kazakhstan'),
|
||||
('LA', 'Lao (People''s Democratic Republic)'),
|
||||
('LB', 'Lebanon'),
|
||||
('LC', 'Saint Lucia'),
|
||||
('LI', 'Liechtenstein'),
|
||||
('LK', 'Sri Lanka'),
|
||||
('LR', 'Liberia'),
|
||||
('LS', 'Lesotho'),
|
||||
('LT', 'Lithuania'),
|
||||
('LU', 'Luxembourg'),
|
||||
('LV', 'Latvia'),
|
||||
('LY', 'Libyan Arab Jamahiriya'),
|
||||
('MA', 'Morocco'),
|
||||
('MC', 'Monaco'),
|
||||
('MD', 'Moldova (Republic of)'),
|
||||
('ME', 'Montenegro'),
|
||||
('MF', 'Saint Martin (French Part)'),
|
||||
('MG', 'Madagascar'),
|
||||
('MH', 'Marshall Islands'),
|
||||
('MK', 'Former Yugoslav Republic of Macedonia'),
|
||||
('ML', 'Mali'),
|
||||
('MM', 'Myanmar'),
|
||||
('MN', 'Mongolia'),
|
||||
('MO', 'Macao'),
|
||||
('MP', 'Northern Mariana Islands'),
|
||||
('MQ', 'Martinique'),
|
||||
('MR', 'Mauritania'),
|
||||
('MS', 'Montserrat'),
|
||||
('MT', 'Malta'),
|
||||
('MU', 'Mauritius'),
|
||||
('MV', 'Maldives'),
|
||||
('MW', 'Malawi'),
|
||||
('MX', 'Mexico'),
|
||||
('MY', 'Malaysia'),
|
||||
('MZ', 'Mozambique'),
|
||||
('NA', 'Namibia'),
|
||||
('NC', 'New Caledonia'),
|
||||
('NE', 'Niger'),
|
||||
('NF', 'Norfolk Island'),
|
||||
('NG', 'Nigeria'),
|
||||
('NI', 'Nicaragua'),
|
||||
('NL', 'Netherlands'),
|
||||
('NO', 'Norway'),
|
||||
('NP', 'Nepal'),
|
||||
('NR', 'Nauru'),
|
||||
('NU', 'Niue'),
|
||||
('NZ', 'New Zealand'),
|
||||
('OC', 'Oceania'),
|
||||
('OM', 'Oman'),
|
||||
('PA', 'Panama'),
|
||||
('PE', 'Peru'),
|
||||
('PF', 'French Polynesia'),
|
||||
('PG', 'Papua New Guinea'),
|
||||
('PH', 'Philippines'),
|
||||
('PK', 'Pakistan'),
|
||||
('PL', 'Poland'),
|
||||
('PM', 'Saint Pierre and Miquelon'),
|
||||
('PN', 'Pitcairn'),
|
||||
('PR', 'Puerto Rico'),
|
||||
('PS', 'Palestinian-administered areas'),
|
||||
('PT', 'Portugal'),
|
||||
('PW', 'Palau'),
|
||||
('PY', 'Paraguay'),
|
||||
('QA', 'Qatar'),
|
||||
('RE', 'Réunion'),
|
||||
('RO', 'Romania'),
|
||||
('RS', 'Serbia'),
|
||||
('RU', 'Russian Federation'),
|
||||
('RW', 'Rwanda'),
|
||||
('SA', 'Saudi Arabia'),
|
||||
('SB', 'Solomon Islands'),
|
||||
('SC', 'Seychelles'),
|
||||
('SD', 'Sudan'),
|
||||
('SE', 'Sweden'),
|
||||
('SG', 'Singapore'),
|
||||
('SH', 'Saint Helena, Ascension and Tristan da Cunha'),
|
||||
('SI', 'Slovenia'),
|
||||
('SJ', 'Svalbard and Jan Mayen'),
|
||||
('SK', 'Slovakia'),
|
||||
('SL', 'Sierra Leone'),
|
||||
('SM', 'San Marino'),
|
||||
('SN', 'Senegal'),
|
||||
('SO', 'Somalia'),
|
||||
('SR', 'Suriname'),
|
||||
('SS', 'South Sudan'),
|
||||
('ST', 'São Tomé and Príncipe'),
|
||||
('SV', 'El Salvador'),
|
||||
('SX', 'Sint Maarten (Dutch Part)'),
|
||||
('SY', 'Syrian Arab Republic'),
|
||||
('SZ', 'Swaziland'),
|
||||
('TC', 'Turks and Caicos Islands'),
|
||||
('TD', 'Chad'),
|
||||
('TF', 'French Southern Territories'),
|
||||
('TG', 'Togo'),
|
||||
('TH', 'Thailand'),
|
||||
('TJ', 'Tajikistan'),
|
||||
('TK', 'Tokelau'),
|
||||
('TL', 'Timor-Leste'),
|
||||
('TM', 'Turkmenistan'),
|
||||
('TN', 'Tunisia'),
|
||||
('TO', 'Tonga'),
|
||||
('TR', 'Turkey'),
|
||||
('TT', 'Trinidad and Tobago'),
|
||||
('TV', 'Tuvalu'),
|
||||
('TW', 'Taiwan'),
|
||||
('TZ', 'Tanzania (United Republic of)'),
|
||||
('UA', 'Ukraine'),
|
||||
('UG', 'Uganda'),
|
||||
('UK', 'United Kingdom'),
|
||||
('UM', 'United States Minor Outlying Islands'),
|
||||
('UNKNOWN', 'UNKNOWN'),
|
||||
('US', 'United States'),
|
||||
('UY', 'Uruguay'),
|
||||
('UZ', 'Uzbekistan'),
|
||||
('VA', 'Holy See (Vatican City State)'),
|
||||
('VC', 'Saint Vincent and the Grenadines'),
|
||||
('VE', 'Venezuela'),
|
||||
('VG', 'Virgin Islands (British)'),
|
||||
('VI', 'Virgin Islands, U.S.'),
|
||||
('VN', 'Viet Nam'),
|
||||
('VU', 'Vanuatu'),
|
||||
('WF', 'Wallis and Futuna'),
|
||||
('WS', 'Samoa'),
|
||||
('XK', 'Kosovo * UN resolution'),
|
||||
('YE', 'Yemen'),
|
||||
('YT', 'Mayotte'),
|
||||
('YU', 'Yugoslavia'),
|
||||
('ZA', 'South Africa'),
|
||||
('ZM', 'Zambia'),
|
||||
('ZW', 'Zimbabwe');
|
||||
|
||||
CREATE TABLE countries (val text PRIMARY KEY);
|
||||
INSERT INTO countries VALUES ('UNKNOWN'), ('AD'), ('AE'), ('AF'), ('AG'), ('AL'), ('AM'), ('AO'), ('AR'), ('AT'), ('AU'), ('AW'), ('AX'), ('AZ'), ('BA'), ('BB'), ('BD'), ('BE'), ('BF'), ('BG'), ('BH'), ('BI'),
|
||||
('BJ'), ('BM'), ('BN'), ('BO'), ('BQ'), ('BR'), ('BS'), ('BT'), ('BW'), ('BY'), ('BZ'), ('CA'), ('CD'), ('CF'), ('CG'), ('CH'), ('CI'), ('CL'), ('CM'), ('CN'), ('CO'), ('CR'),
|
||||
('CU'), ('CV'), ('CW'), ('CY'), ('CZ'), ('DE'), ('DJ'), ('DK'), ('DM'), ('DO'), ('DZ'), ('EC'), ('EE'), ('EG'), ('EH'), ('ER'), ('ES'), ('ET'), ('FI'), ('FJ'), ('FM'), ('FO'),
|
||||
('FR'), ('GA'), ('GB'), ('GD'), ('GE'), ('GF'), ('GH'), ('GI'), ('GL'), ('GM'), ('GN'), ('GP'), ('GQ'), ('GR'), ('GT'), ('GW'), ('GY'), ('HN'), ('HR'), ('HT'), ('HU'), ('ID'),
|
||||
('IE'), ('IL'), ('IM'), ('IN'), ('IQ'), ('IR'), ('IS'), ('IT'), ('JE'), ('JM'), ('JO'), ('JP'), ('KE'), ('KG'), ('KH'), ('KN'), ('KP'), ('KR'), ('KW'), ('KY'), ('KZ'), ('LA'),
|
||||
('LB'), ('LC'), ('LI'), ('LK'), ('LR'), ('LS'), ('LT'), ('LU'), ('LV'), ('LY'), ('MA'), ('MC'), ('MD'), ('ME'), ('MG'), ('MK'), ('ML'), ('MM'), ('MN'), ('MO'), ('MQ'), ('MR'),
|
||||
('MS'), ('MT'), ('MU'), ('MV'), ('MW'), ('MX'), ('MY'), ('MZ'), ('NA'), ('NC'), ('NE'), ('NG'), ('NI'), ('NL'), ('NO'), ('NP'), ('NU'), ('NZ'), ('OM'), ('PA'), ('PE'), ('PF'),
|
||||
('PG'), ('PH'), ('PK'), ('PL'), ('PS'), ('PT'), ('PW'), ('PY'), ('QA'), ('RE'), ('RO'), ('RS'), ('RU'), ('RW'), ('SA'), ('SB'), ('SC'), ('SD'), ('SE'), ('SG'), ('SI'), ('SJ'),
|
||||
('SK'), ('SL'), ('SM'), ('SN'), ('SO'), ('SR'), ('SS'), ('ST'), ('SV'), ('SX'), ('SY'), ('SZ'), ('TC'), ('TD'), ('TG'), ('TH'), ('TJ'), ('TL'), ('TM'), ('TN'), ('TO'), ('TR'),
|
||||
('TT'), ('TV'), ('TW'), ('TZ'), ('UA'), ('UG'), ('US'), ('UY'), ('UZ'), ('VA'), ('VC'), ('VE'), ('VG'), ('VN'), ('WS'), ('XK'), ('YE'), ('ZA'), ('ZM'), ('ZW');
|
||||
|
||||
CREATE TABLE user_roles(role text PRIMARY KEY);
|
||||
INSERT INTO user_roles VALUES ('ADMIN'), ('NATIONAL_ADMIN'), ('USER'), ('PENDING'), ('NOT_AUTHORIZED');
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<table class="table table-sm table-hover col-lg-3">
|
||||
<table class="table table-sm table-hover col-lg-5">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>{{field}}</th>
|
||||
<th class="text-right"># approved</th>
|
||||
<th class="text-right"># pending</th>
|
||||
<th class="text-right text-nowrap"># approved</th>
|
||||
<th class="text-right text-nowrap"># pending</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="e in entries">
|
||||
<td><a href="#!{{resultsBasePath}}/0/50/{{e.value}}">{{e.value}}</a></td>
|
||||
<td><a href="#!{{resultsBasePath}}/0/50/{{e.value}}">{{e.name}}<span ng-if="e.value != e.name"> ({{e.value}})</span></a></td>
|
||||
<td class="text-right">{{e.approved}}</td>
|
||||
<td class="text-right">{{e.pending}}</td>
|
||||
</tr>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
required="required"
|
||||
ng-class="{'is-invalid' : organizationForm.org_tp.$error.required}">
|
||||
<option disabled="disabled" value='' ng-if="!org.type">type...</option>
|
||||
<option ng-repeat="t in vocabularies.orgTypes">{{t}}</option>
|
||||
<option ng-repeat="t in vocabularies.orgTypes" value="{{t.value}}">{{t.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -47,7 +47,7 @@
|
|||
required="required"
|
||||
ng-class="{'is-invalid' : organizationForm.org_cntr.$error.required}">
|
||||
<option disabled="disabled" value='' ng-if="!org.country">country...</option>
|
||||
<option ng-repeat="c in vocabularies.countries">{{c}}</option>
|
||||
<option ng-repeat="c in vocabularies.countries"value="{{c.value}}">{{c.name}}</option>
|
||||
</select>
|
||||
<div class="input-group-append input-group-prepend">
|
||||
<div class="input-group-text text-white" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">lat</div>
|
||||
|
@ -131,7 +131,7 @@
|
|||
<td><select class="custom-select custom-select-sm"
|
||||
ng-model="newLang">
|
||||
<option disabled="disabled" value=''>language...</option>
|
||||
<option ng-repeat="l in vocabularies.languages">{{l}}</option>
|
||||
<option ng-repeat="l in vocabularies.languages" value="{{l.value}}">{{l.name}}</option>
|
||||
</select></td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-success"
|
||||
|
@ -178,7 +178,7 @@
|
|||
<td><select class="custom-select custom-select-sm"
|
||||
ng-model="newIdType">
|
||||
<option disabled="disabled" value=''>type...</option>
|
||||
<option ng-repeat="t in vocabularies.idTypes">{{t}}</option>
|
||||
<option ng-repeat="t in vocabularies.idTypes" value="{{t.value}}">{{t.name}}</option>
|
||||
</select></td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-success"
|
||||
|
@ -266,7 +266,7 @@
|
|||
<td>
|
||||
<select class="custom-select custom-select-sm" ng-model="newRelType">
|
||||
<option disabled="disabled" value=''>rel type...</option>
|
||||
<option ng-repeat="t in vocabularies.relTypes">{{t}}</option>
|
||||
<option ng-repeat="t in vocabularies.relTypes" value="{{t.value}}">{{t.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
|
|
|
@ -91,10 +91,10 @@
|
|||
<div class="card-header bg-primary text-white py-1">Countries</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group row">
|
||||
<div class="col-xs-6 col-sm-3 col-md-2 col-lg-1" ng-repeat="c in vocabularies.countries">
|
||||
<div class="col-xs-12 col-md-6 col-lg-4" ng-repeat="c in vocabularies.countries">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" checklist-model="currentUser.countries" checklist-value="c"/>
|
||||
<label class="form-check-label">{{c}}</label>
|
||||
<input class="form-check-input" type="checkbox" checklist-model="currentUser.countries" checklist-value="c.value"/>
|
||||
<label class="form-check-label">{{c.name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -44,10 +44,10 @@
|
|||
|
||||
<div class="card-body">
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-2" ng-repeat="c in vocCountries">
|
||||
<div class="col-xs-12 col-md-6 col-lg-4" ng-repeat="c in vocCountries">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" checklist-model="countries" checklist-value="c"/>
|
||||
<label class="form-check-label">{{c}}</label>
|
||||
<input class="form-check-input" type="checkbox" checklist-model="countries" checklist-value="c.value"/>
|
||||
<label class="form-check-label">{{c.name}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue