Index: trunk/extensions/EducationProgram/EducationProgram.settings.php |
— | — | @@ -33,6 +33,7 @@ |
34 | 34 | 'wikimedia.org' |
35 | 35 | ), |
36 | 36 | 'ambassadorCommonsUrl' => 'https://commons.wikimedia.org/wiki/Special:UploadWizard', |
| 37 | + 'citylessCountries' => array( 'BT', 'BV', 'IO', 'VG', 'TD', 'CX', 'CC', 'KM', 'DJ', 'GQ', 'FK', 'FX', 'TF', 'GW', 'HM', 'KI', 'YT', 'MS', 'NR', 'NU', 'NF', 'PN', 'SH', 'PM', 'WS', 'SC', 'GS', 'SJ', 'TK', 'TP', 'TV', 'UM', 'VU', 'EH' ), |
37 | 38 | ); |
38 | 39 | } |
39 | 40 | |
Index: trunk/extensions/EducationProgram/actions/EditOrgAction.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Constructor. |
20 | | - * |
| 20 | + *Re |
21 | 21 | * @since 0.1 |
22 | 22 | * |
23 | 23 | * @param Page $page |
— | — | @@ -71,12 +71,15 @@ |
72 | 72 | $fields['city'] = array ( |
73 | 73 | 'type' => 'text', |
74 | 74 | 'label-message' => 'educationprogram-org-edit-city', |
75 | | - 'required' => true, |
76 | 75 | 'validation-callback' => function ( $value, array $alldata = null ) { |
77 | | - return strlen( $value ) < 2 ? wfMsg( 'educationprogram-org-invalid-city' ) : true; |
| 76 | + return $value !== '' && strlen( $value ) < 2 ? wfMsg( 'educationprogram-org-invalid-city' ) : true; |
78 | 77 | } , |
79 | 78 | ); |
80 | 79 | |
| 80 | + if ( !in_array( $this->getRequest()->getText( 'wpitem-country', '' ), EPSettings::get( 'citylessCountries' ) ) ) { |
| 81 | + $fields['city']['required'] = true; |
| 82 | + } |
| 83 | + |
81 | 84 | $fields['country'] = array ( |
82 | 85 | 'type' => 'select', |
83 | 86 | 'label-message' => 'educationprogram-org-edit-country', |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -372,6 +372,10 @@ |
373 | 373 | 'orgpage-edit-undelete-revisions' => 'This institution has been deleted. You can $1.', |
374 | 374 | 'orgpage-edit-undelete-link' => 'restore $1 {{PLURAL:$1|revision|revisions}}', |
375 | 375 | |
| 376 | + 'educationprogram-org-invalid-name' => 'The name needs to be at least contain $1 {{PLURAL:$1|character|characters}}.', |
| 377 | + 'educationprogram-org-invalid-city' => 'The city name needs to be at least contain $1 {{PLURAL:$1|character|characters}}.', |
| 378 | + 'educationprogram-org-invalid-country' => 'This is not a valid country.', |
| 379 | + |
376 | 380 | // Course editing |
377 | 381 | 'orgpage-edit-legend-add' => 'Add course', |
378 | 382 | 'orgpage-edit-legend-edit' => 'Edit course', |