1 |
6657531f
|
Andreas Kohlbecker
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
* @file
|
4 |
|
|
* CDM Dataportal settings.
|
5 |
|
|
*/
|
6 |
|
|
|
7 |
b2b9e057
|
Andreas Kohlbecker
|
|
8 |
642b323b
|
Andreas Kohlbecker
|
// TODO Genus UUID.
|
9 |
|
|
|
10 |
aaa81689
|
Andreas Kohlbecker
|
define('TAXONTREE_RANKLIMIT', 'cdm_taxontree_ranklimit');
|
11 |
|
|
define('TAXONTREE_RANKLIMIT_DEFAULT', 0);
|
12 |
642b323b
|
Andreas Kohlbecker
|
define('CDM_TAXONOMICTREE_UUID', 'cdm_taxonomictree_uuid');
|
13 |
|
|
define('CDM_TAXONTREE_INCLUDES', 'taxontree_includes');
|
14 |
|
|
|
15 |
80d21b78
|
Andreas Kohlbecker
|
define('CDM_SUB_TREE_FILTER_UUID', 'cdm_sub_tree_filter_uuid');
|
16 |
|
|
|
17 |
642b323b
|
Andreas Kohlbecker
|
define('NO_SORT', -1);
|
18 |
|
|
define('SORT_HIERARCHICAL', 9);
|
19 |
|
|
|
20 |
|
|
define('CDM_DATAPORTAL_SEARCH_ITEMS_ON_PAGE', 25);
|
21 |
1d69a96c
|
Andreas Kohlbecker
|
|
22 |
|
|
define('SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX_DEFAULT', 1);
|
23 |
|
|
define('SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX', 'search_results_show_thumbnail_checkbox');
|
24 |
|
|
|
25 |
642b323b
|
Andreas Kohlbecker
|
define('CDM_DATAPORTAL_NOMREF_IN_TITLE', 1);
|
26 |
|
|
define('CDM_DATAPORTAL_COMPRESSED_SPECIMEN_DERIVATE_TABLE', 0);
|
27 |
2e82a602
|
Patrick Plitzner
|
define('CDM_DATAPORTAL_COMPRESSED_SPECIMEN_DERIVATE_TABLE_PAGE_SIZE', 50);
|
28 |
9e72b600
|
Patrick Plitzner
|
define('CDM_DATAPORTAL_COMPRESSED_SPECIMEN_DERIVATE_TABLE_SHOW_DETERMINED_AS', 0);
|
29 |
642b323b
|
Andreas Kohlbecker
|
define('CDM_DATAPORTAL_DISPLAY_IS_ACCEPTED_FOR', 0);
|
30 |
1cda248c
|
Andreas Kohlbecker
|
define('CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE', 'cdm_synonymy_accepted_taxon_sec_separate');
|
31 |
|
|
define('CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL', 'cdm_synonymy_accepted_taxon_sec_separate_label');
|
32 |
|
|
define('CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL_DEFAULT', 'Source');
|
33 |
642b323b
|
Andreas Kohlbecker
|
define('CDM_DATAPORTAL_ALL_FOOTNOTES', 0);
|
34 |
|
|
define('CDM_DATAPORTAL_ANNOTATIONS_FOOTNOTES', 0);
|
35 |
|
|
define('CDM_DATAPORTAL_LAST_VISITED_TAB_ARRAY_INDEX', 999);
|
36 |
276f39f6
|
Katja Luther
|
define('CDM_DATAPORTAL_SPECIMEN_DERIVATE_TREE', 0);
|
37 |
642b323b
|
Andreas Kohlbecker
|
|
38 |
2f30124c
|
Andreas Kohlbecker
|
define('CDM_SEARCH_BLAST_SERVICE_URI', 'http://127.0.0.1:9001/api/sequence');
|
39 |
|
|
define('CDM_SEARCH_BLAST_ENABLED', 0);
|
40 |
977bba78
|
Andreas Kohlbecker
|
define('CDM_REGISTRATION_PRESISTENT_IDENTIFIER_AS_LINK', 'cdm_registration_presistent_identifier_as_link');
|
41 |
|
|
|
42 |
642b323b
|
Andreas Kohlbecker
|
/* annotationTypeKeys */
|
43 |
7ca5ef1e
|
Andreas Kohlbecker
|
$annotationTypeKeys = array_keys(cdm_vocabulary_as_option(UUID_ANNOTATION_TYPE));
|
44 |
642b323b
|
Andreas Kohlbecker
|
if (in_array(UUID_ANNOTATION_TYPE_TECHNICAL, $annotationTypeKeys)) {
|
45 |
|
|
$annotationTypeKeys = array_flip($annotationTypeKeys);
|
46 |
|
|
|
47 |
|
|
// Technical annotation are off by default.
|
48 |
|
|
unset($annotationTypeKeys[UUID_ANNOTATION_TYPE_TECHNICAL]);
|
49 |
|
|
$annotationTypeKeys = array_flip($annotationTypeKeys);
|
50 |
|
|
// Additional value for the NULL case.
|
51 |
|
|
$annotationTypeKeys[] = 'NULL_VALUE';
|
52 |
|
|
}
|
53 |
7370f4f7
|
Andreas Kohlbecker
|
|
54 |
|
|
define('ANNOTATION_TYPES_VISIBLE', 'annotations_types_as_footnotes');
|
55 |
642b323b
|
Andreas Kohlbecker
|
define('ANNOTATIONS_TYPES_AS_FOOTNOTES_DEFAULT', serialize($annotationTypeKeys));
|
56 |
6657531f
|
Andreas Kohlbecker
|
|
57 |
642b323b
|
Andreas Kohlbecker
|
define('BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE', 'bibliography_for_original_source');
|
58 |
|
|
define('BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE_DEFAULT', serialize(array(
|
59 |
|
|
'enabled' => 0,
|
60 |
|
|
'key_format' => 'ALPHA'
|
61 |
|
|
)));
|
62 |
f19f47fa
|
Andreas Kohlbecker
|
|
63 |
642b323b
|
Andreas Kohlbecker
|
/* taxonRelationshipTypes */
|
64 |
f95ba88b
|
Andreas Kohlbecker
|
define('CDM_TAXON_RELATIONSHIP_TYPES_DEFAULT', serialize(
|
65 |
|
|
array(
|
66 |
eafb60f0
|
Andreas Kohlbecker
|
UUID_MISAPPLIED_NAME_FOR => UUID_MISAPPLIED_NAME_FOR,
|
67 |
|
|
UUID_PROPARTE_MISAPPLIEDNAME_FOR => UUID_PROPARTE_MISAPPLIEDNAME_FOR,
|
68 |
|
|
UUID_PARTIAL_MISAPPLIEDNAME_FOR => UUID_PARTIAL_MISAPPLIEDNAME_FOR,
|
69 |
|
|
UUID_PROPARTE_SYNONYM_FOR => UUID_PROPARTE_SYNONYM_FOR,
|
70 |
|
|
UUID_PARTIAL_SYNONYM_FOR => UUID_PARTIAL_SYNONYM_FOR,
|
71 |
|
|
UUID_INVALID_DESIGNATION_FOR => UUID_INVALID_DESIGNATION_FOR
|
72 |
f95ba88b
|
Andreas Kohlbecker
|
)
|
73 |
|
|
));
|
74 |
6657531f
|
Andreas Kohlbecker
|
|
75 |
6280e639
|
Andreas Kohlbecker
|
|
76 |
b92bf608
|
Andreas Kohlbecker
|
/* ---- MAP SETTING CONSTANTS ---- */
|
77 |
642b323b
|
Andreas Kohlbecker
|
/**
|
78 |
|
|
* @var array of URIs eg. http://edit.africamuseum.be"
|
79 |
|
|
* An options array
|
80 |
|
|
*/
|
81 |
|
|
define('EDIT_MAPSERVER_URI', serialize(
|
82 |
|
|
array(
|
83 |
a84e1925
|
Andreas Kohlbecker
|
'http://edit.africamuseum.be'=>'Primary (http://edit.africamuseum.be)'
|
84 |
642b323b
|
Andreas Kohlbecker
|
)
|
85 |
ba706bf0
|
Andreas Kohlbecker
|
)
|
86 |
642b323b
|
Andreas Kohlbecker
|
);
|
87 |
|
|
define('EDIT_MAPSERVER_PATH', '/edit_wp5');
|
88 |
|
|
/**
|
89 |
|
|
* @var array of versions eg. "v1.2"
|
90 |
|
|
* An options array
|
91 |
|
|
*/
|
92 |
|
|
define('EDIT_MAPSERVER_VERSION', serialize(
|
93 |
|
|
array(
|
94 |
fb9c2a03
|
Andreas Kohlbecker
|
// 'v1' => 'v1' , // no longer recommended
|
95 |
|
|
// 'v1.1' => 'v1.1', // no longer recommended
|
96 |
|
|
// 'v1.2_dev' => 'v1.2_dev',// no longer recommended
|
97 |
642b323b
|
Andreas Kohlbecker
|
'v1.2' => 'v1.2',
|
98 |
fb9c2a03
|
Andreas Kohlbecker
|
'v1.3_dev' => 'v1.3_dev (not recommended)',
|
99 |
|
|
'v1.4_dev' => 'v1.4_dev (experimental features)'
|
100 |
642b323b
|
Andreas Kohlbecker
|
)
|
101 |
f19f47fa
|
Andreas Kohlbecker
|
)
|
102 |
642b323b
|
Andreas Kohlbecker
|
);
|
103 |
|
|
define('EDIT_MAPSERVER_URI_DEFAULT', 'http://edit.africamuseum.be');
|
104 |
|
|
define('EDIT_MAPSERVER_VERSION_DEFAULT', 'v1.2');
|
105 |
6657531f
|
Andreas Kohlbecker
|
|
106 |
642b323b
|
Andreas Kohlbecker
|
// --- Taxon profile settings --- /
|
107 |
|
|
define('DISTRIBUTION_TEXTDATA_DISPLAY_ON_TOP', 'distribution_textdata_on_top');
|
108 |
|
|
define('CDM_TAXON_PROFILE_IMAGE', 'cdm_taxon_profile_image');
|
109 |
|
|
define('CDM_TAXON_PROFILE_IMAGE_DEFAULT', serialize(
|
110 |
|
|
array(
|
111 |
|
|
'show' => 0,
|
112 |
|
|
'maxextend' => 184,
|
113 |
|
|
'media_uri_query' => '',
|
114 |
ca47ea76
|
Andreas Kohlbecker
|
'custom_placeholder_enabled' => 1,
|
115 |
642b323b
|
Andreas Kohlbecker
|
'custom_placeholder_image_on' => 0,
|
116 |
|
|
'custom_placeholder_image_fid' => ''
|
117 |
|
|
)
|
118 |
9c92cd84
|
Andreas Kohlbecker
|
)
|
119 |
642b323b
|
Andreas Kohlbecker
|
);
|
120 |
ba706bf0
|
Andreas Kohlbecker
|
|
121 |
846c0606
|
Andreas Kohlbecker
|
|
122 |
|
|
define('FEATURE_BLOCK_SETTINGS', 'feature_block_settings');
|
123 |
|
|
|
124 |
|
|
define('DISTRIBUTION_CONDENSED', 'distribution_condensed');
|
125 |
|
|
define('DISTRIBUTION_CONDENSED_INFO_PATH', 'distribution_condensed_info_path');
|
126 |
|
|
define('DISTRIBUTION_CONDENSED_INFO_PATH_DEFAULT', 'cdm_dataportal/help/condensed_distribution');
|
127 |
|
|
define('DISTRIBUTION_CONDENSED_RECIPE', 'distribution_condensed_recipe');
|
128 |
|
|
define('DISTRIBUTION_CONDENSED_RECIPE_DEFAULT', 'EuroPlusMed');
|
129 |
|
|
|
130 |
|
|
define('DISTRIBUTION_STATUS_COLORS', 'distribution_status_colors');
|
131 |
|
|
define('DISTRIBUTION_ORDER_MODE', 'distribution_order_mode');
|
132 |
|
|
define('DISTRIBUTION_ORDER_MODE_DEFAULT', 'TREE');
|
133 |
|
|
define('DISTRIBUTION_TREE_OMIT_LEVELS', 'distribution_tree_omit_levels');
|
134 |
c6ee8193
|
Andreas Kohlbecker
|
|
135 |
22383f95
|
Andreas Kohlbecker
|
define('CDM_SYNONYMY_AS_TAB', 'cdm_synonymy_as_tab');
|
136 |
|
|
define('CDM_SYNONYMY_AS_TAB_DEFAULT', 1);
|
137 |
|
|
|
138 |
6657531f
|
Andreas Kohlbecker
|
/**
|
139 |
b54cbda1
|
Andreas Kohlbecker
|
* Returns the array of implemented taxon page tabs.
|
140 |
|
|
* The array has fixed integer keys which must not be changed.
|
141 |
6657531f
|
Andreas Kohlbecker
|
*/
|
142 |
|
|
function get_taxon_tabs_list() {
|
143 |
22383f95
|
Andreas Kohlbecker
|
$opts = array(
|
144 |
6657531f
|
Andreas Kohlbecker
|
0 => 'General',
|
145 |
|
|
1 => 'Synonymy',
|
146 |
|
|
2 => 'Images',
|
147 |
|
|
3 => 'Specimens',
|
148 |
|
|
4 => 'Keys',
|
149 |
7663cd0b
|
Andreas Kohlbecker
|
5 => 'Experts',
|
150 |
6657531f
|
Andreas Kohlbecker
|
);
|
151 |
22383f95
|
Andreas Kohlbecker
|
if(variable_get(CDM_SYNONYMY_AS_TAB, CDM_SYNONYMY_AS_TAB_DEFAULT) !== 1){
|
152 |
|
|
// skip the Synonymy if it is shown in the general tab
|
153 |
|
|
unset($opts[1]);
|
154 |
|
|
}
|
155 |
|
|
return $opts;
|
156 |
6657531f
|
Andreas Kohlbecker
|
}
|
157 |
|
|
|
158 |
4feeabc7
|
Andreas Kohlbecker
|
define('CDM_TAXONPAGE_TAB_WEIGHT', 'cdm_taxonpage_tab_weight');
|
159 |
b54cbda1
|
Andreas Kohlbecker
|
define('CDM_TAXONPAGE_TAB_WEIGHT_DEFAULT', serialize(
|
160 |
d9763fd3
|
Andreas Kohlbecker
|
array(
|
161 |
|
|
'general' => '-3',
|
162 |
|
|
'synonymy' => '-2',
|
163 |
|
|
'images' => '0',
|
164 |
|
|
'specimens' => '1',
|
165 |
|
|
'keys' => '3',
|
166 |
|
|
'experts' => '5',
|
167 |
|
|
)
|
168 |
b54cbda1
|
Andreas Kohlbecker
|
));
|
169 |
|
|
|
170 |
4feeabc7
|
Andreas Kohlbecker
|
|
171 |
|
|
// CDM_TAXONPAGE_TAB_LABELS_DEFAULT
|
172 |
|
|
define('CDM_TAXONPAGE_TAB_LABELS', 'cdm_taxonpage_tab_labels');
|
173 |
|
|
define('CDM_TAXONPAGE_TAB_LABELS_DEFAULT', serialize(
|
174 |
|
|
array(
|
175 |
|
|
'general' => null,
|
176 |
|
|
'synonymy' => null,
|
177 |
|
|
'images' => null,
|
178 |
|
|
'specimens' => null,
|
179 |
|
|
'keys' => null,
|
180 |
|
|
'experts' => null,
|
181 |
|
|
)
|
182 |
|
|
));
|
183 |
|
|
|
184 |
6657531f
|
Andreas Kohlbecker
|
$taxon_tab_options = get_taxon_tabs_list();
|
185 |
|
|
$taxon_tab_options[CDM_DATAPORTAL_LAST_VISITED_TAB_ARRAY_INDEX] = 'Last visited tab';
|
186 |
|
|
|
187 |
|
|
define('CDM_DATAPORTAL_DEFAULT_TAXON_TAB', serialize($taxon_tab_options));
|
188 |
|
|
|
189 |
|
|
/**
|
190 |
|
|
* @todo document this function.
|
191 |
|
|
*/
|
192 |
|
|
function get_taxon_options_list() {
|
193 |
|
|
$taxon_tab_options = array_flip(get_taxon_tabs_list());
|
194 |
|
|
foreach ($taxon_tab_options as $key => $value) {
|
195 |
7cc085da
|
Andreas Kohlbecker
|
$taxon_tab_options[$key] = t('@key', array('@key' => $key));
|
196 |
6657531f
|
Andreas Kohlbecker
|
}
|
197 |
|
|
return $taxon_tab_options;
|
198 |
|
|
|
199 |
|
|
}
|
200 |
|
|
|
201 |
0f5f1c12
|
Andreas Kohlbecker
|
define('CDM_PART_DEFINITIONS', 'cdm-part-definitions');
|
202 |
|
|
define('CDM_PART_DEFINITIONS_DEFAULT', serialize(
|
203 |
102f8c26
|
Andreas Kohlbecker
|
array(
|
204 |
f19f47fa
|
Andreas Kohlbecker
|
'ZoologicalName' => array(
|
205 |
501347df
|
Andreas Kohlbecker
|
'namePart' => array('name' => TRUE),
|
206 |
f19f47fa
|
Andreas Kohlbecker
|
'nameAuthorPart' => array('name' => TRUE),
|
207 |
|
|
'referencePart' => array('authors' => TRUE),
|
208 |
|
|
'microreferencePart' => array('microreference' => TRUE),
|
209 |
e24d373b
|
Andreas Kohlbecker
|
'secReferencePart' => array('secReference' => TRUE,),
|
210 |
f19f47fa
|
Andreas Kohlbecker
|
'statusPart' => array('status' => TRUE),
|
211 |
|
|
'descriptionPart' => array('description' => TRUE),
|
212 |
|
|
),
|
213 |
0f5f1c12
|
Andreas Kohlbecker
|
'BotanicalName'=> array(
|
214 |
|
|
'namePart' => array('name' => TRUE),
|
215 |
|
|
'nameAuthorPart' => array('name' => TRUE, 'authors' => TRUE),
|
216 |
|
|
'referencePart' => array('reference' => TRUE, 'microreference' => TRUE),
|
217 |
43998144
|
Andreas Kohlbecker
|
'secReferencePart' => array('secReference' => TRUE,),
|
218 |
51b04faf
|
Andreas Kohlbecker
|
'referenceYearPart' => array('reference.year' => TRUE),
|
219 |
0f5f1c12
|
Andreas Kohlbecker
|
'statusPart' => array('status' => TRUE),
|
220 |
|
|
'descriptionPart' => array('description' => TRUE),
|
221 |
f19f47fa
|
Andreas Kohlbecker
|
),
|
222 |
|
|
'#DEFAULT' => array(
|
223 |
|
|
'namePart' => array(
|
224 |
|
|
'name' => TRUE
|
225 |
501347df
|
Andreas Kohlbecker
|
),
|
226 |
|
|
'nameAuthorPart' => array(
|
227 |
|
|
'name' => TRUE,
|
228 |
|
|
'authors' => TRUE
|
229 |
f19f47fa
|
Andreas Kohlbecker
|
),
|
230 |
43998144
|
Andreas Kohlbecker
|
'referencePart' => array(
|
231 |
|
|
'reference' => TRUE
|
232 |
f19f47fa
|
Andreas Kohlbecker
|
),
|
233 |
43998144
|
Andreas Kohlbecker
|
'secReferencePart' => array(
|
234 |
|
|
'secReference' => TRUE,
|
235 |
|
|
),
|
236 |
|
|
'microreferencePart' => array(
|
237 |
|
|
'microreference' => TRUE,
|
238 |
f19f47fa
|
Andreas Kohlbecker
|
),
|
239 |
43998144
|
Andreas Kohlbecker
|
'statusPart' => array(
|
240 |
|
|
'status' => TRUE,
|
241 |
f19f47fa
|
Andreas Kohlbecker
|
),
|
242 |
43998144
|
Andreas Kohlbecker
|
'descriptionPart' => array(
|
243 |
|
|
'description' => TRUE,
|
244 |
f19f47fa
|
Andreas Kohlbecker
|
),
|
245 |
|
|
)
|
246 |
0f5f1c12
|
Andreas Kohlbecker
|
)
|
247 |
|
|
)
|
248 |
|
|
);
|
249 |
102f8c26
|
Andreas Kohlbecker
|
define('CDM_PART_DEFINITIONS_DEFAULT_PRE_380', serialize(
|
250 |
1a01f6dd
|
Andreas Kohlbecker
|
array(
|
251 |
|
|
'ZoologicalName' => array(
|
252 |
|
|
'namePart' => array('name' => TRUE),
|
253 |
|
|
'nameAuthorPart' => array('name' => TRUE),
|
254 |
|
|
'referencePart' => array('authors' => TRUE),
|
255 |
|
|
'microreferencePart' => array('microreference' => TRUE),
|
256 |
|
|
'statusPart' => array('status' => TRUE),
|
257 |
|
|
'descriptionPart' => array('description' => TRUE),
|
258 |
|
|
),
|
259 |
|
|
'BotanicalName'=> array(
|
260 |
|
|
'namePart' => array('name' => TRUE),
|
261 |
|
|
'nameAuthorPart' => array('name' => TRUE, 'authors' => TRUE),
|
262 |
|
|
'referencePart' => array('reference' => TRUE, 'microreference' => TRUE),
|
263 |
|
|
'referenceYearPart' => array('reference.year' => TRUE),
|
264 |
|
|
'statusPart' => array('status' => TRUE),
|
265 |
|
|
'descriptionPart' => array('description' => TRUE),
|
266 |
|
|
),
|
267 |
|
|
'#DEFAULT' => array(
|
268 |
|
|
'namePart' => array(
|
269 |
|
|
'name' => TRUE
|
270 |
|
|
),
|
271 |
|
|
'nameAuthorPart' => array(
|
272 |
|
|
'name' => TRUE,
|
273 |
|
|
'authors' => TRUE
|
274 |
|
|
),
|
275 |
|
|
'referencePart' => array(
|
276 |
|
|
'reference' => TRUE
|
277 |
|
|
),
|
278 |
|
|
'microreferencePart' => array(
|
279 |
|
|
'microreference' => TRUE,
|
280 |
|
|
),
|
281 |
|
|
'statusPart' => array(
|
282 |
|
|
'status' => TRUE,
|
283 |
|
|
),
|
284 |
|
|
'descriptionPart' => array(
|
285 |
|
|
'description' => TRUE,
|
286 |
|
|
),
|
287 |
|
|
)
|
288 |
|
|
)
|
289 |
|
|
)
|
290 |
|
|
);
|
291 |
|
|
|
292 |
f19f47fa
|
Andreas Kohlbecker
|
define('CDM_NAME_RENDER_TEMPLATES', 'cdm-name-render-templates');
|
293 |
0f5f1c12
|
Andreas Kohlbecker
|
define('CDM_NAME_RENDER_TEMPLATES_DEFAULT', serialize(
|
294 |
e24d373b
|
Andreas Kohlbecker
|
array (
|
295 |
|
|
'taxon_page_title,polytomousKey'=> array(
|
296 |
1a01f6dd
|
Andreas Kohlbecker
|
'namePart' => array('#uri' => TRUE),
|
297 |
|
|
),
|
298 |
e24d373b
|
Andreas Kohlbecker
|
'not_in_current_classification' => array(
|
299 |
|
|
'nameAuthorPart' => TRUE,
|
300 |
|
|
'referencePart' => TRUE,
|
301 |
|
|
'statusPart' => TRUE,
|
302 |
|
|
'secReferencePart' => TRUE,
|
303 |
|
|
),
|
304 |
a7560a18
|
Andreas Kohlbecker
|
'taxon_page_synonymy,accepted_taxon.taxon_page_synonymy,name_page,registration_page'=> array(
|
305 |
e24d373b
|
Andreas Kohlbecker
|
'nameAuthorPart' => array('#uri' => TRUE),
|
306 |
|
|
'referencePart' => TRUE,
|
307 |
|
|
'descriptionPart' => TRUE,
|
308 |
c266a8fe
|
Andreas Kohlbecker
|
'statusPart' => TRUE,
|
309 |
e24d373b
|
Andreas Kohlbecker
|
),
|
310 |
df6226aa
|
Andreas Kohlbecker
|
'related_taxon.other_taxon_relationship.taxon_relationships.taxon_page_synonymy'=> array(
|
311 |
e24d373b
|
Andreas Kohlbecker
|
'nameAuthorPart' => array('#uri' => TRUE),
|
312 |
|
|
'referencePart' => TRUE,
|
313 |
c266a8fe
|
Andreas Kohlbecker
|
'descriptionPart' => TRUE,
|
314 |
e24d373b
|
Andreas Kohlbecker
|
'statusPart' => TRUE,
|
315 |
|
|
'secReferencePart' => TRUE,
|
316 |
|
|
),
|
317 |
df6226aa
|
Andreas Kohlbecker
|
'related_taxon.misapplied_name_for.taxon_relationships.taxon_page_synonymy' => array(
|
318 |
|
|
'nameAuthorPart' => array('#uri' => TRUE),
|
319 |
|
|
'referencePart' => TRUE,
|
320 |
c266a8fe
|
Andreas Kohlbecker
|
'descriptionPart' => TRUE,
|
321 |
df6226aa
|
Andreas Kohlbecker
|
'statusPart' => TRUE,
|
322 |
|
|
/* no sec ref in this case, misapplied names are
|
323 |
|
|
* de-duplicated and the sec ref is shown as footnote */
|
324 |
|
|
),
|
325 |
e24d373b
|
Andreas Kohlbecker
|
'homonym'=> array(
|
326 |
1a01f6dd
|
Andreas Kohlbecker
|
'nameAuthorPart' => array('#uri' => TRUE),
|
327 |
|
|
'referenceYearPart' => TRUE,
|
328 |
c97cae85
|
Andreas Kohlbecker
|
'statusPart' => TRUE,
|
329 |
e24d373b
|
Andreas Kohlbecker
|
),
|
330 |
|
|
'acceptedFor,typedesignations,list_of_taxa' => array(
|
331 |
1a01f6dd
|
Andreas Kohlbecker
|
'nameAuthorPart' => array('#uri' => TRUE),
|
332 |
|
|
'referencePart' => TRUE,
|
333 |
|
|
),
|
334 |
e24d373b
|
Andreas Kohlbecker
|
'#DEFAULT' => array(
|
335 |
1a01f6dd
|
Andreas Kohlbecker
|
'nameAuthorPart' => array('#uri' => TRUE),
|
336 |
|
|
'referencePart' => TRUE,
|
337 |
e24d373b
|
Andreas Kohlbecker
|
)
|
338 |
|
|
)
|
339 |
|
|
));
|
340 |
|
|
define('CDM_NAME_RENDER_TEMPLATES_DEFAULT_PRE_380', serialize(
|
341 |
|
|
array (
|
342 |
|
|
'taxon_page_title,polytomousKey'=> array(
|
343 |
|
|
'namePart' => array('#uri' => TRUE),
|
344 |
|
|
),
|
345 |
|
|
'taxon_page_synonymy,related_taxon'=> array(
|
346 |
|
|
'nameAuthorPart' => array('#uri' => TRUE),
|
347 |
|
|
'referencePart' => TRUE,
|
348 |
|
|
'statusPart' => TRUE,
|
349 |
|
|
'descriptionPart' => TRUE,
|
350 |
|
|
),
|
351 |
|
|
'homonym'=> array(
|
352 |
|
|
'nameAuthorPart' => array('#uri' => TRUE),
|
353 |
|
|
'referenceYearPart' => TRUE,
|
354 |
|
|
),
|
355 |
|
|
'acceptedFor,typedesignations,list_of_taxa' => array(
|
356 |
|
|
'nameAuthorPart' => array('#uri' => TRUE),
|
357 |
|
|
'referencePart' => TRUE,
|
358 |
|
|
),
|
359 |
|
|
'#DEFAULT' => array(
|
360 |
|
|
'nameAuthorPart' => array('#uri' => TRUE),
|
361 |
|
|
'referencePart' => TRUE,
|
362 |
1a01f6dd
|
Andreas Kohlbecker
|
)
|
363 |
e24d373b
|
Andreas Kohlbecker
|
)
|
364 |
|
|
));
|
365 |
0f5f1c12
|
Andreas Kohlbecker
|
|
366 |
6280e639
|
Andreas Kohlbecker
|
define('CDM_SEARCH_TAXA_MODE','cdm_search_taxa_mode');
|
367 |
|
|
define('CDM_SEARCH_TAXA_MODE_DEFAULT', serialize(
|
368 |
|
|
// to unset a default enntry set the value to 0
|
369 |
|
|
array(
|
370 |
|
|
'doTaxa'=>'doTaxa',
|
371 |
|
|
'doSynonyms' => 'doSynonyms',
|
372 |
|
|
'doTaxaByCommonNames' => 'doTaxaByCommonNames',
|
373 |
|
|
'doMisappliedNames' => 'doMisappliedNames'
|
374 |
|
|
)
|
375 |
|
|
)
|
376 |
|
|
);
|
377 |
|
|
|
378 |
072122ee
|
Andreas Kohlbecker
|
define('CDM_SEARCH_AREA_FILTER_PRESET', 'cdm_search_area_filter_preset');
|
379 |
|
|
|
380 |
2d0d855a
|
Andreas Kohlbecker
|
define('SIMPLE_SEARCH_USE_LUCENE_BACKEND', 'simple_search_use_lucene_backend');
|
381 |
90a6166e
|
Andreas Kohlbecker
|
define('SIMPLE_SEARCH_IGNORE_CLASSIFICATION', 'simple_search_ignore_classification');
|
382 |
023c4a03
|
Patrick Plitzner
|
define('SIMPLE_SEARCH_AUTO_SUGGEST', 'cdm_search_taxa_auto_suggest');
|
383 |
2d0d855a
|
Andreas Kohlbecker
|
|
384 |
6280e639
|
Andreas Kohlbecker
|
/* Gallery variables. */
|
385 |
|
|
$gallery_settings = array(
|
386 |
|
|
"cdm_dataportal_show_taxon_thumbnails" => 1,
|
387 |
|
|
"cdm_dataportal_show_synonym_thumbnails" => 0,
|
388 |
|
|
"cdm_dataportal_show_thumbnail_captions" => 1,
|
389 |
|
|
"cdm_dataportal_media_maxextend" => 120,
|
390 |
|
|
"cdm_dataportal_media_cols" => 3,
|
391 |
|
|
"cdm_dataportal_media_maxRows" => 1,
|
392 |
|
|
);
|
393 |
|
|
|
394 |
6657531f
|
Andreas Kohlbecker
|
define('TAXONPAGE_VISIBILITY_OPTIONS_DEFAULT', serialize(get_taxon_options_list()));
|
395 |
|
|
define('CDM_DATAPORTAL_GALLERY_SETTINGS', serialize($gallery_settings));
|
396 |
|
|
define('CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME', 'specimen_gallery');
|
397 |
204e8173
|
Andreas Kohlbecker
|
define('CDM_DATAPORTAL_TYPE_SPECIMEN_GALLERY_NAME', 'type_specimen_gallery');
|
398 |
6657531f
|
Andreas Kohlbecker
|
define('CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME', "description_gallery");
|
399 |
|
|
define('CDM_DATAPORTAL_TAXON_MEDIA_GALLERY_NAME_TAB', "taxon_tab_media_gallery");
|
400 |
|
|
define('CDM_DATAPORTAL_SEARCH_GALLERY_NAME', "search_gallery");
|
401 |
|
|
define('CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS', 'cdm_dataportal_display_taxon_relationships');
|
402 |
|
|
define('CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS', 'cdm_dataportal_display_name_relations');
|
403 |
|
|
// define('CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS_2', array("default" => t('Display all')));
|
404 |
|
|
define('CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT', 1);
|
405 |
|
|
define('CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS_DEFAULT', 1);
|
406 |
6421984d
|
Andreas Kohlbecker
|
|
407 |
63d5030d
|
Andreas Kohlbecker
|
define('CDM_STANDARD_IMAGE_VIEWER', "cdm_standard_image_viewer");
|
408 |
|
|
define('CDM_STANDARD_IMAGE_VIEWER_DEFAULT', serialize(array(
|
409 |
|
|
'media_representation_details_enabled' => 0
|
410 |
|
|
)));
|
411 |
|
|
|
412 |
30f78c59
|
Andreas Kohlbecker
|
/**
|
413 |
|
|
* The drupal variable key for the array containing the uuids of the taxon relationship types to display in
|
414 |
|
|
* the snonymy.
|
415 |
|
|
*
|
416 |
|
|
* @var string
|
417 |
|
|
*/
|
418 |
6657531f
|
Andreas Kohlbecker
|
define('CDM_TAXON_RELATIONSHIP_TYPES', 'cdm_taxon_relationship_types');
|
419 |
6421984d
|
Andreas Kohlbecker
|
|
420 |
ef686dd8
|
Andreas Kohlbecker
|
define('CDM_NAME_RELATIONSHIP_INLINE_TYPES', 'cdm_name_relationship_types');
|
421 |
|
|
define('CDM_NAME_RELATIONSHIP_INLINE_TYPES_DEFAULT', serialize(
|
422 |
6421984d
|
Andreas Kohlbecker
|
array(
|
423 |
e4ccc0a0
|
Andreas Kohlbecker
|
UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM => UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM,
|
424 |
|
|
UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM => UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM,
|
425 |
|
|
UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR => UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR
|
426 |
6421984d
|
Andreas Kohlbecker
|
)
|
427 |
|
|
)
|
428 |
|
|
);
|
429 |
|
|
|
430 |
ef686dd8
|
Andreas Kohlbecker
|
define('CDM_NAME_RELATIONSHIP_LIST_TYPES', 'cdm_name_relationship_list_types');
|
431 |
|
|
define('CDM_NAME_RELATIONSHIP_LIST_TYPES_DEFAULT', serialize(
|
432 |
|
|
array(
|
433 |
|
|
UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM => UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM,
|
434 |
|
|
UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM => UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM,
|
435 |
|
|
UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR => UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR,
|
436 |
|
|
UUID_NAMERELATIONSHIPTYPE_BASIONYM => UUID_NAMERELATIONSHIPTYPE_BASIONYM,
|
437 |
|
|
UUID_NAMERELATIONSHIPTYPE_ORTHOGRAPHIC_VARIANT => UUID_NAMERELATIONSHIPTYPE_ORTHOGRAPHIC_VARIANT,
|
438 |
|
|
UUID_NAMERELATIONSHIPTYPE_VALIDATED_BY_NAME => UUID_NAMERELATIONSHIPTYPE_VALIDATED_BY_NAME,
|
439 |
|
|
UUID_NAMERELATIONSHIPTYPE_LATER_VALIDATED_BY_NAME => UUID_NAMERELATIONSHIPTYPE_LATER_VALIDATED_BY_NAME,
|
440 |
|
|
UUID_NAMERELATIONSHIPTYPE_REPLACED_SYNONYM => UUID_NAMERELATIONSHIPTYPE_REPLACED_SYNONYM
|
441 |
|
|
)
|
442 |
|
|
)
|
443 |
|
|
);
|
444 |
|
|
|
445 |
30f78c59
|
Andreas Kohlbecker
|
/**
|
446 |
|
|
* The drupal variable for the configuration of the information aggregation along
|
447 |
|
|
* the taxon relation ships. The mapped arrayis associative and holds two elements:
|
448 |
|
|
* - direct: the uuids of the taxon relationship types to take into account in invers
|
449 |
|
|
* direction.
|
450 |
|
|
* - invers: the uuids of the taxon relationship types to take into account in direct
|
451 |
|
|
* direction.
|
452 |
|
|
*
|
453 |
|
|
* @var String
|
454 |
|
|
*/
|
455 |
|
|
define('CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS', 'cdm_aggregate_by_taxon_relationships');
|
456 |
|
|
define('CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS_DEFAULT', serialize(
|
457 |
|
|
array(
|
458 |
|
|
'direct'=>array(),
|
459 |
|
|
'invers'=>array()
|
460 |
|
|
)
|
461 |
|
|
));
|
462 |
6657531f
|
Andreas Kohlbecker
|
define('CDM_PROFILE_FEATURETREE_UUID', 'cdm_dataportal_featuretree_uuid');
|
463 |
bfb2b81a
|
Andreas Kohlbecker
|
define('CDM_OCCURRENCE_FEATURETREE_UUID', 'cdm_occurrence_featuretree_uuid');
|
464 |
6657531f
|
Andreas Kohlbecker
|
define('CDM_DATAPORTAL_STRUCTURED_DESCRIPTION_FEATURETREE_UUID', 'cdm_dataportal_structdesc_featuretree_uuid');
|
465 |
|
|
|
466 |
aa63dfb4
|
Andreas Kohlbecker
|
define('CDM_DISTRIBUTION_FILTER', 'cdm_distribution_filter');
|
467 |
|
|
define('CDM_DISTRIBUTION_FILTER_DEFAULT', serialize(
|
468 |
|
|
array(
|
469 |
|
|
'filter_rules' => array(
|
470 |
|
|
'statusOrderPreference' => 0,
|
471 |
|
|
'subAreaPreference' => 0,
|
472 |
|
|
),
|
473 |
6fbf1bd3
|
Andreas Kohlbecker
|
'hiddenAreaMarkerType' => array()
|
474 |
aa63dfb4
|
Andreas Kohlbecker
|
)
|
475 |
|
|
));
|
476 |
|
|
|
477 |
38dd933d
|
Andreas Kohlbecker
|
define('DISTRIBUTION_HIERARCHY_STYLE', 'distribution_hierarchy_style');
|
478 |
|
|
define('DISTRIBUTION_HIERARCHY_STYLE_DEFAULT', serialize(array(
|
479 |
|
|
"level_0" => array(
|
480 |
|
|
'label_suffix' => ':',
|
481 |
3de12c0d
|
Andreas Kohlbecker
|
'status_glue' => '',
|
482 |
38dd933d
|
Andreas Kohlbecker
|
'item_glue' => ' ',
|
483 |
|
|
'item_group_prefix' => '',
|
484 |
|
|
'item_group_postfix' => ''
|
485 |
|
|
),
|
486 |
|
|
"level_1" => array(
|
487 |
3de12c0d
|
Andreas Kohlbecker
|
'label_suffix' => '',
|
488 |
|
|
'status_glue' => '‒ ', // '‒ '
|
489 |
38dd933d
|
Andreas Kohlbecker
|
'item_glue' => '; ',
|
490 |
|
|
'item_group_prefix' => ', ',
|
491 |
|
|
'item_group_postfix' => ''
|
492 |
|
|
),
|
493 |
|
|
"level_2" => array(
|
494 |
3de12c0d
|
Andreas Kohlbecker
|
'label_suffix' => '',
|
495 |
|
|
'status_glue' => '‒ ', // '‒ '
|
496 |
38dd933d
|
Andreas Kohlbecker
|
'item_glue' => ', ',
|
497 |
|
|
'item_group_prefix' => ' (',
|
498 |
|
|
'item_group_postfix' => ')'
|
499 |
|
|
)
|
500 |
|
|
)));
|
501 |
aa63dfb4
|
Andreas Kohlbecker
|
|
502 |
378bc1ce
|
Andreas Kohlbecker
|
/**
|
503 |
|
|
* Constant for the drupal variable key distribution_map_visibility
|
504 |
|
|
*
|
505 |
|
|
* possible values:
|
506 |
|
|
* - never
|
507 |
|
|
* - automatic
|
508 |
|
|
* - always
|
509 |
|
|
*/
|
510 |
|
|
define('DISTRIBUTION_MAP_VISIBILITY', 'distribution_map_visibility');
|
511 |
|
|
define('DISTRIBUTION_MAP_VISIBILITY_DEFAULT', 'automatic');
|
512 |
|
|
|
513 |
|
|
/**
|
514 |
|
|
* Constant for the drupal variable key specimen_map_visibility
|
515 |
|
|
*
|
516 |
|
|
* possible values:
|
517 |
|
|
* - never
|
518 |
|
|
* - automatic
|
519 |
|
|
* - always
|
520 |
|
|
*/
|
521 |
|
|
define('SPECIMEN_MAP_VISIBILITY', 'specimen_map_visibility');
|
522 |
|
|
define('SPECIMEN_MAP_VISIBILITY_DEFAULT', 'automatic');
|
523 |
|
|
|
524 |
a950f2f9
|
Andreas Kohlbecker
|
define('CDM_TAXON_MEDIA_FILTER', 'cdm_taxon_media_filter');
|
525 |
|
|
define('CDM_TAXON_MEDIA_FILTER_DEFAULT', serialize(
|
526 |
|
|
array(
|
527 |
|
|
'includeTaxonDescriptions' => 'includeTaxonDescriptions',
|
528 |
|
|
'includeOccurrences' => 0,
|
529 |
|
|
'includeTaxonNameDescriptions' => 0
|
530 |
|
|
)
|
531 |
|
|
));
|
532 |
|
|
|
533 |
cc3c9807
|
Andreas Kohlbecker
|
define('CDM_MAP_DISTRIBUTION', 'cdm_map_distribution');
|
534 |
|
|
define('CDM_MAP_DISTRIBUTION_DEFAULT', serialize(array(
|
535 |
|
|
// needs to be merged with user setting by drupal_array_merge_deep()
|
536 |
b4503332
|
Andreas Kohlbecker
|
// 'width' => 512, // optimum size for OSM layers is 512
|
537 |
|
|
// 'height' => 512 / 2, // optimum size for OSM layers 256
|
538 |
|
|
'aspect_ratio' => 2,
|
539 |
cc3c9807
|
Andreas Kohlbecker
|
'bbox' => '', // empty to allow automatic zooming to extend
|
540 |
46de7f4c
|
Andreas Kohlbecker
|
'maxZoom' => 15, // corresponds to the default in cdm_openlayers_map.defaults
|
541 |
cc3c9807
|
Andreas Kohlbecker
|
'show_labels' => FALSE,
|
542 |
|
|
'caption' => '',
|
543 |
|
|
'distribution_opacity' => '0.5',
|
544 |
|
|
'map_type' => 1, // 1 = 'openlayers', 0 = 'image'
|
545 |
|
|
'image_map' => array(
|
546 |
|
|
'base_layer' => '', // none, formerly this was cyprusdivs
|
547 |
|
|
'bg_color' => '1874CD',
|
548 |
|
|
'layer_style' => 'ffffff,606060,,',
|
549 |
|
|
),
|
550 |
|
|
'openlayers' => array(
|
551 |
|
|
'base_layers' => array(
|
552 |
|
|
// A layer MUST NOT BE SET in the defaults,
|
553 |
|
|
// otherwise it can not be overidden by the user settings:
|
554 |
5cef0b6d
|
Andreas Kohlbecker
|
// 'mapproxy_vmap0' => 'mapproxy_vmap0',
|
555 |
cc3c9807
|
Andreas Kohlbecker
|
// it is sufficient to define the preferred layer,
|
556 |
|
|
// since it will automatically be enabled:
|
557 |
5cef0b6d
|
Andreas Kohlbecker
|
'PREFERRED' => 'mapproxy_vmap0'),
|
558 |
fb9c2a03
|
Andreas Kohlbecker
|
'custom_wms_base_layer' => array(
|
559 |
|
|
'name' => NULL,
|
560 |
|
|
'url' => NULL,
|
561 |
|
|
'params' => NULL,
|
562 |
|
|
'projection' => NULL,
|
563 |
|
|
'proj4js_def' => NULL,
|
564 |
|
|
'max_extent' => NULL,
|
565 |
2dc774be
|
Andreas Kohlbecker
|
'units' => NULL,
|
566 |
|
|
'untiled' => FALSE
|
567 |
|
|
),
|
568 |
|
|
'wms_overlay_layer' => array(
|
569 |
|
|
'name' => NULL,
|
570 |
|
|
'url' => NULL,
|
571 |
|
|
'params' => NULL,
|
572 |
|
|
'untiled' => FALSE
|
573 |
fb9c2a03
|
Andreas Kohlbecker
|
),
|
574 |
2bbc28c8
|
Andreas Kohlbecker
|
'show_layer_switcher' => TRUE,
|
575 |
2b83cc8b
|
Andreas Kohlbecker
|
'display_outside_max_extent' => FALSE,
|
576 |
|
|
'google_maps_api_key' => NULL,
|
577 |
cc3c9807
|
Andreas Kohlbecker
|
),
|
578 |
|
|
'legend' => array(
|
579 |
|
|
'show' => TRUE,
|
580 |
|
|
'opacity' => '0.5',
|
581 |
|
|
'font_size' => 10,
|
582 |
|
|
'font_style' => FALSE,
|
583 |
|
|
'icon_width' => 35,
|
584 |
|
|
'icon_height' => 15
|
585 |
|
|
)
|
586 |
|
|
)));
|
587 |
|
|
|
588 |
|
|
/**
|
589 |
|
|
* Merges the named array variable with the array of defaults.
|
590 |
|
|
*
|
591 |
5611d467
|
Andreas Kohlbecker
|
* IMPORTANT: The array keys must be strings. When the keys are integers
|
592 |
|
|
* the merging will not take place for these entities. Number keyed entities
|
593 |
b54cbda1
|
Andreas Kohlbecker
|
* are just appended to the result array.
|
594 |
|
|
*
|
595 |
cc3c9807
|
Andreas Kohlbecker
|
* @param string $variable_name
|
596 |
|
|
* The variable name
|
597 |
|
|
* @param string | array $default
|
598 |
|
|
* The array containing the default values either as array or serialized as string.
|
599 |
5611d467
|
Andreas Kohlbecker
|
* Unserialization is cared for if necessary
|
600 |
cc3c9807
|
Andreas Kohlbecker
|
* @return array
|
601 |
5611d467
|
Andreas Kohlbecker
|
* The merged array as returned by drupal_array_merge_deep()
|
602 |
8c962983
|
Andreas Kohlbecker
|
*
|
603 |
0f7c9d15
|
Andreas Kohlbecker
|
* TODO compare with mixed_variable_get() duplicate functions? => result use this function instead of mixed_variable_get()
|
604 |
|
|
* TODO force $default being an array
|
605 |
cc3c9807
|
Andreas Kohlbecker
|
*/
|
606 |
|
|
function get_array_variable_merged($variable_name, $default){
|
607 |
|
|
|
608 |
|
|
// unserialize if nessecary
|
609 |
|
|
if(!is_array($default)){
|
610 |
|
|
$default = unserialize($default);
|
611 |
|
|
}
|
612 |
|
|
$variable = variable_get($variable_name, array());
|
613 |
b54cbda1
|
Andreas Kohlbecker
|
$result = drupal_array_merge_deep($default, $variable);
|
614 |
|
|
return $result;
|
615 |
cc3c9807
|
Andreas Kohlbecker
|
}
|
616 |
|
|
|
617 |
6657531f
|
Andreas Kohlbecker
|
/**
|
618 |
|
|
* @todo document this function.
|
619 |
|
|
*/
|
620 |
|
|
function getGallerySettings($gallery_config_form_name) {
|
621 |
cc3c9807
|
Andreas Kohlbecker
|
return get_array_variable_merged($gallery_config_form_name, CDM_DATAPORTAL_GALLERY_SETTINGS);
|
622 |
6657531f
|
Andreas Kohlbecker
|
}
|
623 |
|
|
|
624 |
|
|
/**
|
625 |
|
|
* Returns the string representation of the default tab.
|
626 |
|
|
*
|
627 |
|
|
* @param bool $returnTabIndex
|
628 |
|
|
* Defaults to FALSE, if set true this function will return the index number
|
629 |
|
|
* of the default tab. (used to supply default values to form elements).
|
630 |
|
|
*/
|
631 |
|
|
function get_default_taxon_tab($returnTabIndex = FALSE) {
|
632 |
|
|
|
633 |
|
|
global $user;
|
634 |
|
|
$values = unserialize(CDM_DATAPORTAL_DEFAULT_TAXON_TAB);
|
635 |
|
|
$user_tab_active = 'cdm_dataportal_' . $user->uid . '_default_tab_active';
|
636 |
|
|
$user_tab = 'cdm_dataportal_' . $user->uid . '_default_tab';
|
637 |
|
|
// Get the user value if the used has chosen to overwrite the system settings.
|
638 |
|
|
$user_tab_on = variable_get($user_tab_active, FALSE);
|
639 |
|
|
if ($user_tab_on) {
|
640 |
|
|
$user_value = variable_get($user_tab, 0);
|
641 |
|
|
$index_value = $user_value;
|
642 |
|
|
// Get the system value.
|
643 |
|
|
}
|
644 |
|
|
else {
|
645 |
|
|
$system_value = variable_get('cdm_dataportal_default_tab', 0);
|
646 |
|
|
$index_value = $system_value;
|
647 |
|
|
}
|
648 |
|
|
|
649 |
|
|
// Return the index value or the string representation.
|
650 |
|
|
if ($returnTabIndex) {
|
651 |
|
|
return $index_value;
|
652 |
|
|
}
|
653 |
|
|
else {
|
654 |
|
|
return ($values[$index_value]);
|
655 |
22f5e82d
|
Andreas Kohlbecker
|
}
|
656 |
6657531f
|
Andreas Kohlbecker
|
}
|
657 |
|
|
|
658 |
4407c9a7
|
Andreas Kohlbecker
|
/**
|
659 |
|
|
* Provides the feature block settings for a specific feature which matches the $feature_uuid parameter.
|
660 |
|
|
*
|
661 |
|
|
* In case specifically configured settings array, like these which are stored in the drupal variables, is missing
|
662 |
|
|
* one or more fields these fields are taken from the default. That is the specific settings are always merges
|
663 |
|
|
* with the default.
|
664 |
|
|
*
|
665 |
|
|
* Note: These settings only apply to feature blocks which do not have a special rendering
|
666 |
|
|
* the specially handled features (e.g.: Distribution, CommonNames) may make use of the
|
667 |
|
|
* 'special' element of the settings
|
668 |
|
|
*
|
669 |
|
|
* @param $feature_uuid
|
670 |
|
|
* The uuid string representation of the feature to return the settings for
|
671 |
|
|
*
|
672 |
|
|
* @return array
|
673 |
|
|
* an associative array of settings, with the following fields:
|
674 |
|
|
* - as_list: string
|
675 |
|
|
* this setting will be used in compose_feature_block_wrap_elements() as $enclosing_tag
|
676 |
|
|
* possible values are:
|
677 |
|
|
* div: not as list,
|
678 |
|
|
* ul: as bullet list,
|
679 |
|
|
* ol: as numbered list,
|
680 |
|
|
* dl: as definition list
|
681 |
|
|
* The tag used for the inner element, thus depends on the value of this field. The
|
682 |
|
|
* inner tag name can be retrieved by the function cdm_feature_block_element_tag_name()
|
683 |
|
|
* - link_to_reference: boolean,
|
684 |
|
|
* render the reference as link, ignored if the element is NOT a DescriptionElementSource
|
685 |
|
|
* - link_to_name_used_in_source": boolean
|
686 |
|
|
* whether to show name in source information as link which will point to the according name page
|
687 |
|
|
* - sources_as_content (boolean)
|
688 |
|
|
* TRUE (int: 1):
|
689 |
|
|
* 1. If element is of the CDM type TextData and the text is not empty the source references will be
|
690 |
|
|
* appended in brackets like "text (source references)". If the original source has name in source
|
691 |
|
|
* information it will be appended to the citation string,
|
692 |
|
|
* like : "(citation, as name in source; citation, as name in source)"
|
693 |
|
|
* 2. if the text of the TextData is empty, the original source citations are the only content
|
694 |
|
|
* (e.g. use case CITATION) and are not put into brackets. In this case the nameInSource is
|
695 |
|
|
* prepended to the citation string like: "name in source: citation"
|
696 |
|
|
* FALSE (int: 0):
|
697 |
|
|
* Original sources are put into the bibliography(=references) pseudo feature block. If the original source
|
698 |
|
|
* citations are the only content, the resulting feature block content would only consist of footnotes.
|
699 |
|
|
* In this case the display of the respective feature block is suppressed.
|
700 |
|
|
* TODO if the bibliography is not enabled the sources will be treated as footnotes like annotations,
|
701 |
|
|
* in future however they will in this case be shown in a separate references section for each
|
702 |
|
|
* feature block.
|
703 |
|
|
* - sources_as_content_to_bibliography (boolean)
|
704 |
|
|
* Only valid if sources_as_content == TRUE, will cause the sources to be also shown
|
705 |
|
|
* in the bibliography.
|
706 |
|
|
* - sort_elements
|
707 |
|
|
* whether and how to sort the elements
|
708 |
|
|
* possible values are the constants SORT_ASC, SORT_DESC, NULL,
|
709 |
|
|
* some feature types (Distribution) also support: SORT_HIERARCHICAL (
|
710 |
|
|
* TODO option to exclude levels, put in special?,
|
711 |
|
|
* TODO make use of this setting in compose_feature_block_wrap_elements())
|
712 |
|
|
* - element_tag
|
713 |
|
|
* specifies the tag to be used for creating the elements, only applies if "as_list" == 'div'
|
714 |
|
|
* possible values are span | div. the proper inner tag name can be retrieved by the function
|
715 |
|
|
* cdm_feature_block_element_tag_name()
|
716 |
|
|
* - special: array()
|
717 |
|
|
* an array with further settings, this field can be used for special
|
718 |
|
|
* settings for specialized rendering like for distributions
|
719 |
|
|
* }
|
720 |
|
|
*
|
721 |
|
|
*/
|
722 |
|
|
function get_feature_block_settings($feature_uuid = 'DEFAULT') {
|
723 |
|
|
// the default must conform to the default parameter values of
|
724 |
|
|
// compose_feature_block_wrap_elements() : $glue = '', $sort = FALSE, $enclosing_tag = 'ul'
|
725 |
|
|
// compose_description_element_text_data() : asListElement = NULL
|
726 |
22f5e82d
|
Andreas Kohlbecker
|
|
727 |
4407c9a7
|
Andreas Kohlbecker
|
// see #3257 (implement means to define the features to show up in the taxonprofile and in the specimen descriptions)
|
728 |
|
|
|
729 |
|
|
// ---- DEFAULTS settings
|
730 |
|
|
|
731 |
|
|
// only needed as final option, when the settings are not having a default
|
732 |
|
|
$default = array(
|
733 |
|
|
'DEFAULT' => array(
|
734 |
|
|
'as_list' => 'div',
|
735 |
|
|
'link_to_reference' => 0,
|
736 |
|
|
'link_to_name_used_in_source' => 1,
|
737 |
|
|
'sources_as_content' => 0,
|
738 |
|
|
'sources_as_content_to_bibliography' => 0,
|
739 |
|
|
'sort_elements' => NO_SORT,
|
740 |
|
|
'glue' => '',
|
741 |
|
|
'element_tag' => NULL
|
742 |
|
|
),
|
743 |
|
|
// settings for pseudo feature bibliography
|
744 |
|
|
// only hard coded here
|
745 |
|
|
'BIBLIOGRAPHY' => array(
|
746 |
|
|
'as_list' => 'div',
|
747 |
|
|
'link_to_reference' => 0,
|
748 |
|
|
'link_to_name_used_in_source' => 1,
|
749 |
|
|
'sources_as_content' => 0,
|
750 |
|
|
'sources_as_content_to_bibliography' => 0,
|
751 |
|
|
'sort_elements' => NO_SORT,
|
752 |
|
|
'glue' => '',
|
753 |
|
|
'element_tag' => NULL
|
754 |
|
|
)
|
755 |
|
|
);
|
756 |
f3a04cfa
|
Andreas Kohlbecker
|
|
757 |
4407c9a7
|
Andreas Kohlbecker
|
// will be used as preset in the settings
|
758 |
|
|
$other_themes_default = array(
|
759 |
|
|
'DEFAULT' => array(
|
760 |
|
|
'as_list' => 'div',
|
761 |
|
|
'link_to_reference' => 0,
|
762 |
|
|
'link_to_name_used_in_source' => 1,
|
763 |
|
|
'sources_as_content' => 0,
|
764 |
|
|
'sources_as_content_to_bibliography' => 0,
|
765 |
|
|
'sort_elements' => NO_SORT,
|
766 |
|
|
'glue' => '',
|
767 |
|
|
'element_tag' => NULL
|
768 |
|
|
),
|
769 |
|
|
UUID_CITATION => array(
|
770 |
|
|
'as_list' => 'div',
|
771 |
|
|
'link_to_reference' => 0,
|
772 |
|
|
'link_to_name_used_in_source' => 0,
|
773 |
|
|
'sources_as_content' => 1,
|
774 |
|
|
'sources_as_content_to_bibliography' => 0,
|
775 |
|
|
'sort_elements' => SORT_ASC,
|
776 |
|
|
'glue' => '',
|
777 |
|
|
'element_tag' => 'div'
|
778 |
|
|
),
|
779 |
|
|
UUID_DISTRIBUTION => array(
|
780 |
6776a5bc
|
Andreas Kohlbecker
|
'as_list' => 'div', // currently ignored
|
781 |
642b323b
|
Andreas Kohlbecker
|
'link_to_reference' => 0,
|
782 |
|
|
'link_to_name_used_in_source' => 0,
|
783 |
|
|
'sources_as_content' => 0,
|
784 |
|
|
'sources_as_content_to_bibliography' => 0,
|
785 |
|
|
'sort_elements' => NO_SORT, // will cause ...
|
786 |
4407c9a7
|
Andreas Kohlbecker
|
'glue' => '',
|
787 |
642b323b
|
Andreas Kohlbecker
|
'element_tag' => 'div',
|
788 |
|
|
'special' => array()
|
789 |
4407c9a7
|
Andreas Kohlbecker
|
),
|
790 |
|
|
UUID_COMMON_NAME => array(
|
791 |
|
|
'as_list' => 'div',
|
792 |
|
|
'link_to_reference' => 0,
|
793 |
|
|
'link_to_name_used_in_source' => 1,
|
794 |
|
|
'sources_as_content' => 0,
|
795 |
|
|
'sources_as_content_to_bibliography' => 0,
|
796 |
|
|
'sort_elements' => NO_SORT,
|
797 |
|
|
'glue' => '',
|
798 |
|
|
'element_tag' => 'span'
|
799 |
|
|
),
|
800 |
|
|
);
|
801 |
1b756c5f
|
Andreas Kohlbecker
|
|
802 |
4407c9a7
|
Andreas Kohlbecker
|
// ---- Special DEFAULTS for existing portals
|
803 |
|
|
// TODO:
|
804 |
|
|
// this can be removed once the feature block
|
805 |
|
|
// settings have been deployed for the first time to these portals
|
806 |
|
|
|
807 |
|
|
$cichorieae_default = array(
|
808 |
|
|
'DEFAULT' => array(
|
809 |
|
|
'as_list' => 'div',
|
810 |
|
|
'link_to_reference' => 1,
|
811 |
|
|
'link_to_name_used_in_source' => 1,
|
812 |
|
|
'sources_as_content' => 1,
|
813 |
|
|
'sources_as_content_to_bibliography' => 0,
|
814 |
|
|
'sort_elements' => NO_SORT,
|
815 |
|
|
'glue' => '',
|
816 |
|
|
'element_tag' => 'div'
|
817 |
|
|
),
|
818 |
|
|
UUID_CITATION => array(
|
819 |
|
|
'as_list' => 'div',
|
820 |
|
|
'link_to_reference' => 0,
|
821 |
|
|
'link_to_name_used_in_source' => 0,
|
822 |
|
|
'sources_as_content' => 1,
|
823 |
|
|
'sources_as_content_to_bibliography' => 0,
|
824 |
|
|
'sort_elements' => SORT_ASC,
|
825 |
|
|
'glue' => '',
|
826 |
|
|
'element_tag' => 'div'
|
827 |
|
|
),
|
828 |
|
|
UUID_CHROMOSOMES_NUMBERS => array(
|
829 |
|
|
'as_list' => 'ul',
|
830 |
|
|
'link_to_reference' => 1,
|
831 |
|
|
'link_to_name_used_in_source' => 1,
|
832 |
|
|
'sources_as_content' => 1,
|
833 |
|
|
'sources_as_content_to_bibliography' => 0,
|
834 |
|
|
'sort_elements' => NO_SORT,
|
835 |
|
|
'glue' => '',
|
836 |
|
|
'element_tag' => 'div'
|
837 |
|
|
),
|
838 |
|
|
UUID_CHROMOSOMES => array(
|
839 |
|
|
'as_list' => 'ul',
|
840 |
|
|
'link_to_reference' => 0,
|
841 |
|
|
'link_to_name_used_in_source' => 1,
|
842 |
|
|
'sources_as_content' => 1,
|
843 |
|
|
'sources_as_content_to_bibliography' => 0,
|
844 |
|
|
'sort_elements' => NO_SORT,
|
845 |
|
|
'glue' => '',
|
846 |
|
|
'element_tag' => 'div'
|
847 |
|
|
),
|
848 |
|
|
UUID_COMMON_NAME => array(
|
849 |
|
|
'as_list' => 'div',
|
850 |
|
|
'link_to_reference' => 0,
|
851 |
|
|
'link_to_name_used_in_source' => 1,
|
852 |
|
|
'sources_as_content' => 0,
|
853 |
|
|
'sources_as_content_to_bibliography' => 0,
|
854 |
|
|
'sort_elements' => NO_SORT,
|
855 |
|
|
'glue' => '',
|
856 |
|
|
'element_tag' => 'span'
|
857 |
|
|
),
|
858 |
|
|
);
|
859 |
c367b0ab
|
Andreas Kohlbecker
|
|
860 |
4407c9a7
|
Andreas Kohlbecker
|
$palmweb_default = array(
|
861 |
|
|
'DEFAULT' => array(
|
862 |
|
|
'as_list' => 'ul',
|
863 |
|
|
'link_to_reference' => 1,
|
864 |
|
|
'link_to_name_used_in_source' => 1,
|
865 |
|
|
'sources_as_content' => 1,
|
866 |
|
|
'sources_as_content_to_bibliography' => 1,
|
867 |
|
|
'sort_elements' => NO_SORT,
|
868 |
|
|
'glue' => '',
|
869 |
|
|
'element_tag' => NULL
|
870 |
|
|
),
|
871 |
|
|
UUID_CITATION => array(
|
872 |
|
|
'as_list' => 'ul',
|
873 |
|
|
'link_to_reference' => 1,
|
874 |
|
|
'link_to_name_used_in_source' => 1,
|
875 |
|
|
'sources_as_content' => 0,
|
876 |
|
|
'sources_as_content_to_bibliography' => 1,
|
877 |
|
|
'sort_elements' => SORT_ASC,
|
878 |
|
|
'glue' => '',
|
879 |
|
|
'element_tag' => 'div'
|
880 |
|
|
),
|
881 |
|
|
UUID_DISTRIBUTION => array(
|
882 |
|
|
'as_list' => 'div', // currently ignored
|
883 |
|
|
'link_to_reference' => 1,
|
884 |
|
|
'link_to_name_used_in_source' => 1,
|
885 |
|
|
'sources_as_content' => 1, // FIXME seems to have no effect see Acanthophoenix rousselii (palmae)
|
886 |
|
|
'sources_as_content_to_bibliography' => 1,
|
887 |
|
|
'sort_elements' => NO_SORT, // will cause ...
|
888 |
|
|
'glue' => ', ',
|
889 |
|
|
'element_tag' => 'span',
|
890 |
|
|
'special' => array()
|
891 |
|
|
),
|
892 |
|
|
);
|
893 |
642b323b
|
Andreas Kohlbecker
|
|
894 |
4407c9a7
|
Andreas Kohlbecker
|
$cyprus_default = $cichorieae_default;
|
895 |
|
|
$cyprus_default[UUID_DISTRIBUTION] = array(
|
896 |
|
|
'as_list' => 'div', // currently ignored
|
897 |
|
|
'link_to_reference' => 0,
|
898 |
|
|
'link_to_name_used_in_source' => 0,
|
899 |
|
|
'sources_as_content' => 0,
|
900 |
|
|
'sources_as_content_to_bibliography' => 0,
|
901 |
|
|
'sort_elements' => NO_SORT, // will cause ...
|
902 |
|
|
'glue' => ' ',
|
903 |
|
|
'element_tag' => 'div',
|
904 |
|
|
'special' => array()
|
905 |
|
|
);
|
906 |
642b323b
|
Andreas Kohlbecker
|
|
907 |
4407c9a7
|
Andreas Kohlbecker
|
$default_theme = variable_get('theme_default', NULL);
|
908 |
|
|
|
909 |
|
|
switch ($default_theme) {
|
910 |
|
|
case 'garland_cichorieae':
|
911 |
|
|
$settings_for_theme = $cichorieae_default;
|
912 |
|
|
break;
|
913 |
|
|
case 'cyprus':
|
914 |
|
|
// cyprus: no longer used in production,
|
915 |
|
|
// but is required for selenium tests see class eu.etaxonomy.dataportal.pages.PortalPage
|
916 |
|
|
$settings_for_theme = $cyprus_default;
|
917 |
|
|
break;
|
918 |
|
|
case 'flore_afrique_centrale':
|
919 |
|
|
case 'flora_malesiana':
|
920 |
|
|
case 'flore_gabon':
|
921 |
|
|
$settings_for_theme = $cichorieae_default;
|
922 |
|
|
$settings_for_theme[UUID_CITATION]['as_list'] = 'ul';
|
923 |
|
|
break;
|
924 |
|
|
case 'palmweb_2':
|
925 |
|
|
$settings_for_theme = $palmweb_default;
|
926 |
|
|
break;
|
927 |
|
|
default:
|
928 |
|
|
$settings_for_theme = $other_themes_default;
|
929 |
|
|
}
|
930 |
|
|
// add pseudo feature settings
|
931 |
|
|
$settings_for_theme['BIBLIOGRAPHY'] = $default['BIBLIOGRAPHY'];
|
932 |
642b323b
|
Andreas Kohlbecker
|
|
933 |
4407c9a7
|
Andreas Kohlbecker
|
// ---- END of DEFAULTS
|
934 |
|
|
|
935 |
|
|
$saved_settings = variable_get(FEATURE_BLOCK_SETTINGS, NULL);
|
936 |
|
|
|
937 |
|
|
$feature_block_setting = null;
|
938 |
|
|
|
939 |
|
|
if (isset($saved_settings[$feature_uuid])) {
|
940 |
|
|
$feature_block_setting = $saved_settings[$feature_uuid];
|
941 |
|
|
}
|
942 |
|
|
else if (isset($settings_for_theme[$feature_uuid])) {
|
943 |
|
|
$feature_block_setting = $settings_for_theme[$feature_uuid];
|
944 |
|
|
}
|
945 |
|
|
else if (isset($settings_for_theme['DEFAULT'])) {
|
946 |
|
|
$feature_block_setting = $settings_for_theme['DEFAULT'];
|
947 |
|
|
}
|
948 |
|
|
|
949 |
|
|
// now merge the default and specific settings
|
950 |
|
|
$settings_to_merge = array($default['DEFAULT']);
|
951 |
|
|
if(is_array($saved_settings)){
|
952 |
|
|
$settings_to_merge[] = $saved_settings['DEFAULT'];
|
953 |
|
|
}
|
954 |
|
|
if(isset($feature_block_setting)){
|
955 |
|
|
$settings_to_merge[] = $feature_block_setting;
|
956 |
|
|
}
|
957 |
|
|
$feature_block_setting = drupal_array_merge_deep_array($settings_to_merge);
|
958 |
642b323b
|
Andreas Kohlbecker
|
|
959 |
4407c9a7
|
Andreas Kohlbecker
|
return $feature_block_setting;
|
960 |
1ce9afb7
|
Patric Plitzner
|
}
|
961 |
1b756c5f
|
Andreas Kohlbecker
|
|
962 |
|
|
/**
|
963 |
5611d467
|
Andreas Kohlbecker
|
* returns the current setting for the original source bibliography
|
964 |
|
|
*
|
965 |
|
|
* Caches internally
|
966 |
|
|
*
|
967 |
|
|
* @return array
|
968 |
|
|
* the setting for the original source bibliography see BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE:
|
969 |
|
|
* - 'enabled': 1|0
|
970 |
|
|
* - 'key_format': one of 'latin', 'ROMAN', 'roman', 'ALPHA', 'alpha'
|
971 |
|
|
*/
|
972 |
800ff2b0
|
Andreas Kohlbecker
|
function get_bibliography_settings($clear_cache = false){
|
973 |
5611d467
|
Andreas Kohlbecker
|
static $bibliography_settings = null;
|
974 |
800ff2b0
|
Andreas Kohlbecker
|
if(!$bibliography_settings || $clear_cache){
|
975 |
f3a04cfa
|
Andreas Kohlbecker
|
$bibliography_settings = get_array_variable_merged(
|
976 |
|
|
BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE,
|
977 |
|
|
BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE_DEFAULT
|
978 |
|
|
);
|
979 |
5611d467
|
Andreas Kohlbecker
|
}
|
980 |
|
|
return $bibliography_settings;
|
981 |
|
|
}
|
982 |
|
|
|
983 |
6657531f
|
Andreas Kohlbecker
|
/**
|
984 |
|
|
* @todo Please document this function.
|
985 |
|
|
* @see http://drupal.org/node/1354
|
986 |
|
|
*/
|
987 |
|
|
function cdm_dataportal_menu_admin(&$items) {
|
988 |
|
|
// Display section on admin/config page.
|
989 |
|
|
$items['admin/config/cdm_dataportal'] = array(
|
990 |
|
|
'title' => 'CDM Dataportal',
|
991 |
|
|
'description' => 'Settings for the CDM DataPortal.',
|
992 |
|
|
'position' => 'right',
|
993 |
|
|
'weight' => 10,
|
994 |
|
|
'page callback' => 'system_admin_menu_block_page',
|
995 |
e014414c
|
Andreas Kohlbecker
|
'access arguments' => array('administer cdm_dataportal'),
|
996 |
6657531f
|
Andreas Kohlbecker
|
'file' => 'system.admin.inc',
|
997 |
|
|
'file path' => drupal_get_path('module', 'system'),
|
998 |
|
|
);
|
999 |
|
|
$items['admin/config/cdm_dataportal/settings'] = array(
|
1000 |
|
|
'title' => 'Settings',
|
1001 |
|
|
'description' => 'Settings for the CDM DataPortal.',
|
1002 |
|
|
'weight' => 0,
|
1003 |
|
|
'page callback' => 'drupal_get_form',
|
1004 |
|
|
'page arguments' => array('cdm_settings_general'),
|
1005 |
|
|
'access arguments' => array('administer cdm_dataportal'),
|
1006 |
|
|
'type' => MENU_NORMAL_ITEM,
|
1007 |
|
|
);
|
1008 |
|
|
$items['admin/config/cdm_dataportal/settings/general'] = array(
|
1009 |
|
|
'title' => 'General',
|
1010 |
|
|
'description' => 'General',
|
1011 |
|
|
'weight' => 0,
|
1012 |
|
|
'page callback' => 'drupal_get_form',
|
1013 |
|
|
'page arguments' => array('cdm_settings_general'),
|
1014 |
|
|
'access arguments' => array('administer cdm_dataportal'),
|
1015 |
|
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
1016 |
|
|
);
|
1017 |
|
|
|
1018 |
|
|
$items['admin/config/cdm_dataportal/settings/cachesite'] = array(
|
1019 |
|
|
'title' => 'Cache',
|
1020 |
|
|
'description' => 'Cache',
|
1021 |
|
|
'access arguments' => array('administer cdm_dataportal'),
|
1022 |
|
|
'page callback' => 'drupal_get_form',
|
1023 |
|
|
'page arguments' => array('cdm_settings_cache'),
|
1024 |
|
|
'weight' => 10,
|
1025 |
|
|
'type' => MENU_LOCAL_TASK,
|
1026 |
|
|
);
|
1027 |
|
|
|
1028 |
|
|
$items['admin/config/cdm_dataportal/settings/geo'] = array(
|
1029 |
|
|
'title' => 'Geo & Map',
|
1030 |
|
|
'description' => 'Geo & Map',
|
1031 |
|
|
'access arguments' => array('administer cdm_dataportal'),
|
1032 |
|
|
'page callback' => 'drupal_get_form',
|
1033 |
|
|
'page arguments' => array('cdm_settings_geo'),
|
1034 |
|
|
'weight' => 1,
|
1035 |
|
|
'type' => MENU_LOCAL_TASK,
|
1036 |
|
|
);
|
1037 |
|
|
|
1038 |
|
|
$items['admin/config/cdm_dataportal/settings/layout'] = array(
|
1039 |
|
|
'title' => 'Layout',
|
1040 |
|
|
'description' => 'Configure and adjust the layout of your DataPortal ',
|
1041 |
|
|
'access arguments' => array('administer cdm_dataportal'),
|
1042 |
|
|
'page callback' => 'drupal_get_form',
|
1043 |
|
|
'page arguments' => array('cdm_settings_layout'),
|
1044 |
|
|
'weight' => 2,
|
1045 |
|
|
'type' => MENU_LOCAL_TASK,
|
1046 |
|
|
);
|
1047 |
|
|
|
1048 |
|
|
$items['admin/config/cdm_dataportal/settings/layout/taxon'] = array(
|
1049 |
|
|
'title' => 'Taxon',
|
1050 |
|
|
'description' => 'Configure and adjust the layout of your DataPortal ',
|
1051 |
|
|
'access arguments' => array('administer cdm_dataportal'),
|
1052 |
|
|
'page callback' => 'drupal_get_form',
|
1053 |
|
|
'page arguments' => array('cdm_settings_layout_taxon'),
|
1054 |
|
|
'weight' => 1,
|
1055 |
|
|
'type' => MENU_LOCAL_TASK,
|
1056 |
|
|
);
|
1057 |
|
|
/*
|
1058 |
|
|
$items[] = array(
|
1059 |
|
|
'path' => 'admin/config/cdm_dataportal/layout/synonymy',
|
1060 |
|
|
'title' => t('Synonymy'),
|
1061 |
|
|
'description' => t('Configure and adjust the layout of your DataPortal '),
|
1062 |
|
|
'access' => user_access('administer cdm_dataportal'),
|
1063 |
|
|
'callback' => 'drupal_get_form',
|
1064 |
|
|
'callback arguments' => array('cdm_settings_layout_synonymy'),
|
1065 |
|
|
'weight' => 1,
|
1066 |
|
|
'type' => MENU_LOCAL_TASK,
|
1067 |
|
|
);
|
1068 |
|
|
|
1069 |
|
|
$items[] = array(
|
1070 |
|
|
'path' => 'admin/config/cdm_dataportal/layout/specimens',
|
1071 |
|
|
'title' => t('Specimens'),
|
1072 |
|
|
'description' => t('Configure and adjust the layout of your DataPortal '),
|
1073 |
|
|
'access' => user_access('administer cdm_dataportal'),
|
1074 |
|
|
'callback' => 'drupal_get_form',
|
1075 |
|
|
'callback arguments' => array('cdm_settings_layout_specimens'),
|
1076 |
|
|
'weight' => 1,
|
1077 |
|
|
'type' => MENU_LOCAL_TASK,
|
1078 |
|
|
);
|
1079 |
|
|
*/
|
1080 |
|
|
$items['admin/config/cdm_dataportal/settings/layout/search'] = array(
|
1081 |
|
|
'title' => 'Search',
|
1082 |
|
|
'description' => 'Configure and adjust the layout of your DataPortal ',
|
1083 |
|
|
'access arguments' => array('administer cdm_dataportal'),
|
1084 |
|
|
'page callback' => 'drupal_get_form',
|
1085 |
|
|
'page arguments' => array('cdm_settings_layout_search'),
|
1086 |
|
|
'weight' => 2,
|
1087 |
|
|
'type' => MENU_LOCAL_TASK,
|
1088 |
|
|
);
|
1089 |
|
|
|
1090 |
|
|
$items['admin/config/cdm_dataportal/settings/layout/media'] = array(
|
1091 |
|
|
'title' => 'Media',
|
1092 |
|
|
'description' => 'Configure and adjust the layout of your DataPortal ',
|
1093 |
|
|
'access arguments' => array('administer cdm_dataportal'),
|
1094 |
|
|
'page callback' => 'drupal_get_form',
|
1095 |
|
|
'page arguments' => array('cdm_settings_layout_media'),
|
1096 |
|
|
'weight' => 3,
|
1097 |
|
|
'type' => MENU_LOCAL_TASK,
|
1098 |
|
|
);
|
1099 |
947c6a8d
|
Andreas Kohlbecker
|
|
1100 |
6657531f
|
Andreas Kohlbecker
|
}
|
1101 |
|
|
|
1102 |
|
|
/**
|
1103 |
|
|
* @todo document this function.
|
1104 |
|
|
*/
|
1105 |
|
|
function cdm_help_general_cache() {
|
1106 |
|
|
$form = array();
|
1107 |
|
|
$form['cache_help'] = array(
|
1108 |
|
|
'#type' => 'fieldset',
|
1109 |
|
|
'#title' => t('Help'),
|
1110 |
|
|
'#collapsible' => TRUE,
|
1111 |
|
|
'#collapsed' => TRUE,
|
1112 |
|
|
);
|
1113 |
|
|
$form['cache_help']['test'] = array('#value' => t('probando'));
|
1114 |
|
|
return drupal_render($form);
|
1115 |
|
|
$res = array();
|
1116 |
|
|
$res['default'] = drupal_render($help);
|
1117 |
|
|
return $res;
|
1118 |
|
|
}
|
1119 |
|
|
|
1120 |
|
|
/**
|
1121 |
|
|
* Configures the settings form for the CDM-API module.
|
1122 |
|
|
*
|
1123 |
|
|
* @return array
|
1124 |
|
|
* Drupal settings form.
|
1125 |
|
|
*/
|
1126 |
|
|
function cdm_settings_general() {
|
1127 |
|
|
|
1128 |
|
|
$form['cdm_webservice'] = array(
|
1129 |
|
|
'#type' => 'fieldset',
|
1130 |
|
|
'#title' => t('CDM Server'),
|
1131 |
|
|
'#collapsible' => FALSE,
|
1132 |
|
|
'#collapsed' => FALSE,
|
1133 |
9438ad3a
|
Andreas Kohlbecker
|
'#description' => t('The <em>CDM Server</em> exposes data stored in a
|
1134 |
|
|
CDM data base to the web via RESTful web services and thus is the source of the data
|
1135 |
|
|
to be displayed by a CDM DataPotal.'),
|
1136 |
6657531f
|
Andreas Kohlbecker
|
);
|
1137 |
|
|
|
1138 |
|
|
$form['cdm_webservice']['cdm_webservice_url'] = array(
|
1139 |
|
|
'#type' => 'textfield',
|
1140 |
|
|
'#title' => t('CDM web service URL') . ':',
|
1141 |
|
|
'#description' => t('This is the URL to the CDM-Server exposing your data
|
1142 |
d1eb0a8c
|
Andreas Kohlbecker
|
e.g. <em>"http://myserver.net/cdmserver/myproject"</em>'),
|
1143 |
6657531f
|
Andreas Kohlbecker
|
'#default_value' => variable_get('cdm_webservice_url', NULL),
|
1144 |
|
|
);
|
1145 |
|
|
|
1146 |
|
|
$form['cdm_webservice']['cdm_webservice_debug'] = array(
|
1147 |
17c3d760
|
Andreas Kohlbecker
|
'#type' => 'markup',
|
1148 |
d1e3ac25
|
Andreas Kohlbecker
|
'#markup' => '<b>Debug CDM Web Service:</b> Debugging web services is possible via the ' . l('CDM web service debug block', 'admin/structure/block/manage/cdm_api/cdm_ws_debug/configure')
|
1149 |
|
|
. ' visible only for administrators',
|
1150 |
6657531f
|
Andreas Kohlbecker
|
);
|
1151 |
|
|
|
1152 |
|
|
$form['cdm_webservice']['freetext_index'] = array(
|
1153 |
|
|
'#type' => 'fieldset',
|
1154 |
|
|
'#title' => t('Freetext index'),
|
1155 |
|
|
'#collapsible' => FALSE,
|
1156 |
|
|
'#collapsed' => FALSE,
|
1157 |
|
|
);
|
1158 |
|
|
|
1159 |
|
|
// Check the cdmserver port number and display a waring if it is not port 80
|
1160 |
|
|
preg_match("#http[s]?://[0-9\p{L}\.]*:([0-9]*)/.*#u", variable_get('cdm_webservice_url', ''), $portNumberMatch, PREG_OFFSET_CAPTURE);
|
1161 |
|
|
if (isset($portNumberMatch[1]) && $portNumberMatch[1] != '80') {
|
1162 |
|
|
$form['cdm_webservice']['freetext_index']['message'] = array(
|
1163 |
|
|
'#markup' => "<div class=\"description\">"
|
1164 |
7cc085da
|
Andreas Kohlbecker
|
. t("The CDM web service URL contains a portnumber other than standart HTTP port 80: '!port'
|
1165 |
|
|
Due to this the reindex and purge fuctions may not be working if there is a firewall in between you and the CDM Server.
|
1166 |
|
|
You may want to contact the maintainer of the according CDM Server in order to solve this problem.",
|
1167 |
|
|
array('!port' => $portNumberMatch[1][0])
|
1168 |
|
|
)
|
1169 |
6657531f
|
Andreas Kohlbecker
|
. "</div>",
|
1170 |
|
|
);
|
1171 |
|
|
};
|
1172 |
|
|
|
1173 |
|
|
$frontentURL = urlencode(variable_get('cdm_webservice_url', ''));
|
1174 |
|
|
$trigger_link_options = array(
|
1175 |
|
|
'attributes' => array(
|
1176 |
c9b3fcf5
|
Andreas Kohlbecker
|
'class' => 'index-trigger'
|
1177 |
6657531f
|
Andreas Kohlbecker
|
),
|
1178 |
|
|
);
|
1179 |
|
|
$form['cdm_webservice']['freetext_index']['operations'] = array(
|
1180 |
|
|
'#markup' => "<div>" . t('Operations: !url1 !url2', array(
|
1181 |
|
|
'!url1' => l(t("Purge"), cdm_compose_url(CDM_WS_MANAGE_PURGE, NULL, 'frontendBaseUrl=' . $frontentURL), $trigger_link_options),
|
1182 |
|
|
'!url2' => l(t("Reindex"), cdm_compose_url(CDM_WS_MANAGE_REINDEX, NULL, 'frontendBaseUrl=' . $frontentURL), $trigger_link_options),
|
1183 |
|
|
))
|
1184 |
|
|
. '<div id="index-progress"></div></div>',
|
1185 |
|
|
);
|
1186 |
c9b3fcf5
|
Andreas Kohlbecker
|
|
1187 |
|
|
$form['cdm_webservice']['freetext_index']['cdm_login'] = array(
|
1188 |
|
|
// this must not be stored, it is only used by the _add_js_cdm_ws_progressbar
|
1189 |
|
|
'#type' => 'textfield',
|
1190 |
|
|
'#title' => t('Login'),
|
1191 |
|
|
'#description' => t('Your cdm user credentials in the following form: <code>user:password</code>')
|
1192 |
|
|
);
|
1193 |
|
|
drupal_add_js('
|
1194 |
|
|
jQuery(document).ready(function() {
|
1195 |
|
|
jQuery("#edit-cdm-login").change(function (e) {
|
1196 |
|
|
var login = jQuery(e.target).val();
|
1197 |
|
|
jQuery("#edit-freetext-index .index-trigger").each(function(index){
|
1198 |
|
|
var url = jQuery(this).attr("href");
|
1199 |
|
|
url = url.replace(/:\/\/[^@]+@|:\/\//, "://" + login + "@");
|
1200 |
|
|
jQuery(this).attr("href", url);
|
1201 |
|
|
});
|
1202 |
|
|
});
|
1203 |
|
|
});
|
1204 |
|
|
',
|
1205 |
|
|
array(
|
1206 |
|
|
'type' => 'inline',
|
1207 |
|
|
'scope' => 'footer'
|
1208 |
|
|
)
|
1209 |
|
|
);
|
1210 |
6657531f
|
Andreas Kohlbecker
|
_add_js_cdm_ws_progressbar(".index-trigger", "#index-progress");
|
1211 |
|
|
|
1212 |
|
|
$form['cdm_webservice']['proxy'] = array(
|
1213 |
|
|
'#type' => 'fieldset',
|
1214 |
|
|
'#title' => t('Proxy'),
|
1215 |
|
|
'#collapsible' => TRUE,
|
1216 |
|
|
'#collapsed' => TRUE,
|
1217 |
|
|
);
|
1218 |
|
|
|
1219 |
|
|
$form['cdm_webservice']['proxy']['cdm_webservice_proxy_url'] = array(
|
1220 |
|
|
'#type' => 'textfield',
|
1221 |
|
|
'#title' => t('Proxy URL') . ':',
|
1222 |
|
|
'#description' => t('If this proxy url is set the cdm api tries
|
1223 |
|
|
to connect the web service over the given proxy server.
|
1224 |
|
|
Otherwise proxy usage is deactivated.'),
|
1225 |
|
|
'#default_value' => variable_get('cdm_webservice_proxy_url', FALSE),
|
1226 |
|
|
);
|
1227 |
|
|
|
1228 |
|
|
$form['cdm_webservice']['proxy']['cdm_webservice_proxy_port'] = array(
|
1229 |
|
|
'#type' => 'textfield',
|
1230 |
|
|
'#title' => t('Proxy port') . ':',
|
1231 |
|
|
'#default_value' => variable_get('cdm_webservice_proxy_port', '80'),
|
1232 |
|
|
);
|
1233 |
|
|
|
1234 |
|
|
$form['cdm_webservice']['proxy']['cdm_webservice_proxy_usr'] = array(
|
1235 |
|
|
'#type' => 'textfield',
|
1236 |
|
|
'#title' => t('Login') . ':',
|
1237 |
|
|
'#default_value' => variable_get('cdm_webservice_proxy_usr', FALSE),
|
1238 |
|
|
);
|
1239 |
|
|
|
1240 |
|
|
$form['cdm_webservice']['proxy']['cdm_webservice_proxy_pwd'] = array(
|
1241 |
|
|
'#type' => 'textfield',
|
1242 |
|
|
'#title' => t('Password') . ':',
|
1243 |
|
|
'#default_value' => variable_get('cdm_webservice_proxy_pwd', FALSE),
|
1244 |
|
|
);
|
1245 |
|
|
|
1246 |
80d21b78
|
Andreas Kohlbecker
|
$form['sub_tree_filter'] = array(
|
1247 |
|
|
'#type' => 'fieldset',
|
1248 |
|
|
'#title' => t('Subtree filter'),
|
1249 |
|
|
'#collapsible' => FALSE,
|
1250 |
|
|
'#collapsed' => TRUE,
|
1251 |
|
|
'#description' => t('The Data Portal can be restricted to the taxa which belong to a specific classification subtree. Other taxa will not be shown or accessible otherwise.'),
|
1252 |
|
|
);
|
1253 |
|
|
|
1254 |
|
|
$sub_tree_filter_uuid_value = variable_get(CDM_SUB_TREE_FILTER_UUID, FALSE);
|
1255 |
|
|
$taxon_node_info = '';
|
1256 |
|
|
if($sub_tree_filter_uuid_value){
|
1257 |
|
|
$taxon_node_dto = cdm_ws_get(CDM_WS_TAXONNODE, array($sub_tree_filter_uuid_value));
|
1258 |
|
|
if($taxon_node_dto){
|
1259 |
|
|
$taxon_node_info = " Current taxon node: <strong>" . cdm_tagged_text_to_markup($taxon_node_dto->taggedTitle) . " [" . $taxon_node_dto->treeIndex . "]</strong>";
|
1260 |
|
|
}
|
1261 |
|
|
}
|
1262 |
|
|
$form['sub_tree_filter'][CDM_SUB_TREE_FILTER_UUID] = array(
|
1263 |
|
|
'#type' => 'textfield',
|
1264 |
|
|
'#title' => t('Taxon Node UUID') . ':',
|
1265 |
|
|
'#default_value' => variable_get(CDM_SUB_TREE_FILTER_UUID, FALSE),
|
1266 |
|
|
'#description' => "The uuid of the TaxonNode entity to be used as filter." . $taxon_node_info
|
1267 |
|
|
);
|
1268 |
|
|
|
1269 |
6657531f
|
Andreas Kohlbecker
|
// TODO: settings are still incomplete, compare with
|
1270 |
|
|
// trunk/dataportal/inc/config_default.php.inc.
|
1271 |
9438ad3a
|
Andreas Kohlbecker
|
$form['taxon_tree'] = array(
|
1272 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'fieldset',
|
1273 |
|
|
'#title' => t('Taxon Tree'),
|
1274 |
|
|
'#collapsible' => FALSE,
|
1275 |
|
|
'#collapsed' => TRUE,
|
1276 |
|
|
'#description' => t('<p>When you explore your collection, you can navigate
|
1277 |
|
|
it through a tree structure also called <em>Taxon Tree</em>.</p><p>To be
|
1278 |
|
|
able to navigate through your collection the
|
1279 |
|
|
<a href="http://drupal.org/handbook/blocks">drupal block</a>
|
1280 |
|
|
<em>CDM Taxon Tree</em> should be visible for users. Enable the block at
|
1281 |
|
|
<a href="./?q=admin/build/block">Administer->Site building->Blocks
|
1282 |
|
|
</a></p>'),
|
1283 |
|
|
);
|
1284 |
|
|
|
1285 |
9438ad3a
|
Andreas Kohlbecker
|
$form['taxon_tree'][CDM_TAXONOMICTREE_UUID] = array(
|
1286 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'select',
|
1287 |
fe1b1203
|
Andreas Kohlbecker
|
'#title' => t('Default classification') . ':',
|
1288 |
6657531f
|
Andreas Kohlbecker
|
'#default_value' => variable_get(CDM_TAXONOMICTREE_UUID, FALSE),
|
1289 |
|
|
'#options' => cdm_get_taxontrees_as_options(),
|
1290 |
fe1b1203
|
Andreas Kohlbecker
|
'#description' => t('The default taxa classification to be used in the whole portal.
|
1291 |
|
|
This affects most obviously the classification browser and the search in case is is restricted
|
1292 |
|
|
to a specific classification. See also <i>Included Classifications</i> below.'),
|
1293 |
6657531f
|
Andreas Kohlbecker
|
);
|
1294 |
|
|
|
1295 |
aaa81689
|
Andreas Kohlbecker
|
$form['taxon_tree'][TAXONTREE_RANKLIMIT] = array(
|
1296 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'select',
|
1297 |
|
|
'#title' => t('Rank of highest displayed taxon') . ':',
|
1298 |
|
|
// Before DEFAULT_TAXONTREE_RANKLIMIT_UUID.
|
1299 |
aaa81689
|
Andreas Kohlbecker
|
'#default_value' => variable_get(TAXONTREE_RANKLIMIT, TAXONTREE_RANKLIMIT_DEFAULT),
|
1300 |
2d3d6556
|
Andreas Kohlbecker
|
'#options' => cdm_vocabulary_as_option(UUID_RANK, null, true),
|
1301 |
6657531f
|
Andreas Kohlbecker
|
'#description' => t('This is the rank of the highest displayed taxon in the
|
1302 |
|
|
<em>taxon tree</em>. You can select here which rank should be at the top
|
1303 |
|
|
level of the tree structure.'),
|
1304 |
|
|
);
|
1305 |
|
|
|
1306 |
26fb3778
|
Andreas Kohlbecker
|
$classification_uuids = array_keys(cdm_get_taxontrees_as_options());
|
1307 |
|
|
$taxontree_includes_default = array_combine($classification_uuids, $classification_uuids);
|
1308 |
|
|
$form['taxon_tree'][CDM_TAXONTREE_INCLUDES] = array(
|
1309 |
|
|
'#type' => 'checkboxes',
|
1310 |
|
|
'#title' => t('Included Classifications') . ':',
|
1311 |
|
|
'#default_value' => variable_get(CDM_TAXONTREE_INCLUDES, $taxontree_includes_default),
|
1312 |
|
|
'#options' => cdm_get_taxontrees_as_options(),
|
1313 |
fe1b1203
|
Andreas Kohlbecker
|
'#description' => t('Only the checked classifications will be available in the classification chooser.'),
|
1314 |
26fb3778
|
Andreas Kohlbecker
|
);
|
1315 |
|
|
|
1316 |
aa63dfb4
|
Andreas Kohlbecker
|
$form['distribution'] = array(
|
1317 |
|
|
'#type' => 'fieldset',
|
1318 |
|
|
'#title' => t('Distributions'),
|
1319 |
|
|
'#collapsible' => FALSE,
|
1320 |
|
|
'#description' => 'This section covers general settings regarding distributions, map related settings are found in the '
|
1321 |
|
|
. l('geo & map tab', 'admin/config/cdm_dataportal/settings/geo') .
|
1322 |
562a6ac4
|
Andreas Kohlbecker
|
'. Further settings regarding the Distribution feature block can be found in the Layout/Taxon tab at two distinct places: '
|
1323 |
|
|
. l('Distribution appearance', 'admin/config/cdm_dataportal/settings/layout/taxon', array('fragment' => 'edit-distribution-layout')) .', '
|
1324 |
|
|
. l('Taxon profile feature block settings', 'admin/config/cdm_dataportal/settings/layout/taxon', array('fragment' => 'edit-feature-block-settings')) .
|
1325 |
aa63dfb4
|
Andreas Kohlbecker
|
'<p>
|
1326 |
|
|
</p>',
|
1327 |
|
|
);
|
1328 |
|
|
|
1329 |
|
|
$form['distribution'][CDM_DISTRIBUTION_FILTER] = array(
|
1330 |
|
|
'#type' => 'fieldset',
|
1331 |
|
|
'#title' => 'Distribution filter',
|
1332 |
|
|
'#collapsible' => FALSE,
|
1333 |
|
|
'#collapsed' => FALSE,
|
1334 |
|
|
'#tree' => TRUE,
|
1335 |
|
|
'#description' => 'The Distribution filter offers the following options
|
1336 |
|
|
<ul>
|
1337 |
0eef1621
|
Andreas Kohlbecker
|
<li><strong>Status order preference rule:</strong> In case of multiple distribution status (PresenceAbsenceTermBase) for
|
1338 |
|
|
the same area the status with the highest order is preferred, see OrderedTermBase.compareTo(OrderedTermBase).</li>
|
1339 |
|
|
<li><strong>Sub area preference rule:</strong>If there is an area with a direct sub area and both areas have the same
|
1340 |
|
|
computed status only the information on the sub area should be reported, whereas the super area should be ignored.</li>
|
1341 |
|
|
<li><strong>Marked area filter:</strong>Skip distributions for areas having a TRUE Marker with one of the specified MarkerTypes.
|
1342 |
|
|
Existing sub-areas of a marked area must also be marked with the same marker type, otherwise the marked
|
1343 |
|
|
area acts as a fallback area for the sub areas. An area is a <em>fallback area</em> if it is marked to
|
1344 |
|
|
be hidden and if it has at least one of sub area which is not marked to be hidden. The <em>fallback area</em>
|
1345 |
|
|
will be show if there is no Distribution for any of the non hidden sub-areas. For more detailed discussion on
|
1346 |
|
|
<em>fallback area</em> see https://dev.e-taxonomy.eu/trac/ticket/4408.</li>
|
1347 |
aa63dfb4
|
Andreas Kohlbecker
|
</ul>'
|
1348 |
|
|
);
|
1349 |
|
|
|
1350 |
|
|
$cdm_distribution_filter = get_array_variable_merged(CDM_DISTRIBUTION_FILTER, CDM_DISTRIBUTION_FILTER_DEFAULT);
|
1351 |
|
|
$form['distribution'][CDM_DISTRIBUTION_FILTER]['filter_rules'] = array(
|
1352 |
|
|
'#type' => 'checkboxes',
|
1353 |
|
|
'#title' => 'Filter rules',
|
1354 |
|
|
'#default_value' => $cdm_distribution_filter['filter_rules'],
|
1355 |
|
|
'#options' => array(
|
1356 |
|
|
'statusOrderPreference' => 'Status order preference rule',
|
1357 |
|
|
'subAreaPreference' => 'Sub area preference rule'
|
1358 |
|
|
),
|
1359 |
|
|
);
|
1360 |
|
|
|
1361 |
7ca5ef1e
|
Andreas Kohlbecker
|
$marker_type_options = cdm_terms_by_type_as_option('MarkerType');
|
1362 |
6fbf1bd3
|
Andreas Kohlbecker
|
$form['distribution'][CDM_DISTRIBUTION_FILTER]['hiddenAreaMarkerType'] = array(
|
1363 |
aa63dfb4
|
Andreas Kohlbecker
|
'#type' => 'checkboxes',
|
1364 |
|
|
'#title' => 'Hide marked area filter',
|
1365 |
6fbf1bd3
|
Andreas Kohlbecker
|
'#default_value' => $cdm_distribution_filter['hiddenAreaMarkerType'],
|
1366 |
aa63dfb4
|
Andreas Kohlbecker
|
'#options' => $marker_type_options,
|
1367 |
|
|
'#description' => 'Check one or more MarkerTypes to define the "hide marked area" filter .',
|
1368 |
|
|
);
|
1369 |
|
|
|
1370 |
f19f47fa
|
Andreas Kohlbecker
|
$form['aggregation'] = array(
|
1371 |
|
|
'#type' => 'fieldset',
|
1372 |
|
|
'#title' => t('Aggregation of data'),
|
1373 |
|
|
'#collapsible' => FALSE,
|
1374 |
aa63dfb4
|
Andreas Kohlbecker
|
'#description' => 'This section covers the different aspects of aggregating information.
|
1375 |
9438ad3a
|
Andreas Kohlbecker
|
<p>
|
1376 |
f19f47fa
|
Andreas Kohlbecker
|
</p>',
|
1377 |
9438ad3a
|
Andreas Kohlbecker
|
);
|
1378 |
|
|
|
1379 |
ccde8251
|
Andreas Kohlbecker
|
$form['aggregation'][CDM_TAXON_MEDIA_FILTER] = array(
|
1380 |
|
|
'#type' => 'checkboxes',
|
1381 |
|
|
'#title' => 'Taxon media filter',
|
1382 |
|
|
'#default_value' => variable_get(CDM_TAXON_MEDIA_FILTER, unserialize(CDM_TAXON_MEDIA_FILTER_DEFAULT)),
|
1383 |
|
|
'#options' => array(
|
1384 |
|
|
'includeTaxonDescriptions' => 'Media in taxon descriptions',
|
1385 |
|
|
'includeTaxonNameDescriptions' => 'Media in name descriptions',
|
1386 |
|
|
'includeOccurrences' => 'Media related to specimens and occurrences',
|
1387 |
|
|
),
|
1388 |
|
|
'#description' => 'This filter configures which images should be taken into account.',
|
1389 |
|
|
);
|
1390 |
|
|
|
1391 |
|
|
$form['aggregation']['notice'] = array(
|
1392 |
3a874294
|
Andreas Kohlbecker
|
'#markup' => '<strong>NOTICE:</strong> The below aggregation settings can slow down the data portal, so you may want to sensibly apply these setting and you may also
|
1393 |
ccde8251
|
Andreas Kohlbecker
|
want to make use of the caching capabilities of the dataportal.',
|
1394 |
|
|
);
|
1395 |
|
|
|
1396 |
f19f47fa
|
Andreas Kohlbecker
|
$form['aggregation']['media_aggregation'] = array(
|
1397 |
|
|
'#type' => 'fieldset',
|
1398 |
|
|
'#title' => t('Media aggregation'),
|
1399 |
|
|
'#collapsible' => FALSE,
|
1400 |
9438ad3a
|
Andreas Kohlbecker
|
'#collapsed' => TRUE,
|
1401 |
f19f47fa
|
Andreas Kohlbecker
|
'#description' => t("The media aggregation is also affected by the settigs in \"<strong>Aggregation via taxon relationsships</strong>\" below."),
|
1402 |
|
|
|
1403 |
9438ad3a
|
Andreas Kohlbecker
|
);
|
1404 |
f19f47fa
|
Andreas Kohlbecker
|
$form['aggregation']['media_aggregation']['cdm_images_include_children'] = array(
|
1405 |
|
|
'#type' => 'select',
|
1406 |
|
|
'#title' => t('Aggregation of taxon pictures') . ':',
|
1407 |
|
|
'#default_value' => variable_get('cdm_images_include_children', FALSE),
|
1408 |
|
|
'#options' => array(
|
1409 |
|
|
0 => "Show only pictures of the current taxon",
|
1410 |
|
|
1 => "Include pictures of taxonomic children",
|
1411 |
|
|
),
|
1412 |
|
|
'#description' => t("Choose whether to include the images of the taxonomic children. This will affect the <em>Images</em> tab and image tumbnails like in the search results."),
|
1413 |
9438ad3a
|
Andreas Kohlbecker
|
);
|
1414 |
|
|
|
1415 |
f19f47fa
|
Andreas Kohlbecker
|
$form['aggregation']['aggregate_by_taxon_relationships'][CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS] = array(
|
1416 |
30f78c59
|
Andreas Kohlbecker
|
'#type' => 'fieldset',
|
1417 |
38dd933d
|
Andreas Kohlbecker
|
'#attributes' => array('class' => array('clearfix')),
|
1418 |
9438ad3a
|
Andreas Kohlbecker
|
'#title' => t('Aggregation via taxon relationsships'),
|
1419 |
30f78c59
|
Andreas Kohlbecker
|
'#collapsible' => TRUE,
|
1420 |
|
|
'#collapsed' => TRUE,
|
1421 |
f19f47fa
|
Andreas Kohlbecker
|
'#tree' => TRUE,
|
1422 |
30f78c59
|
Andreas Kohlbecker
|
'#description' => t('Information on taxa will be aggregated along the below chosen
|
1423 |
|
|
taxon relation ships. This will affect images and occurrences (specimens).
|
1424 |
|
|
Taxon relation ships are directed and point form one taxon to another. The taxon
|
1425 |
|
|
relationships to be taken into accunt can therefore configured for the direct direction
|
1426 |
f19f47fa
|
Andreas Kohlbecker
|
and for the inverse.'),
|
1427 |
|
|
);
|
1428 |
|
|
|
1429 |
7ca5ef1e
|
Andreas Kohlbecker
|
$taxonRelationshipTypeOptions = cdm_vocabulary_as_option(UUID_TAXON_RELATIONSHIP_TYPE, '_cdm_relationship_type_term_label_callback');
|
1430 |
30f78c59
|
Andreas Kohlbecker
|
$aggregate_by_taxon_relationships = variable_get(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS, unserialize(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS_DEFAULT));
|
1431 |
f19f47fa
|
Andreas Kohlbecker
|
|
1432 |
|
|
$form['aggregation']['aggregate_by_taxon_relationships'][CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS]['direct'] = array(
|
1433 |
|
|
'#type' => 'checkboxes',
|
1434 |
|
|
'#title' => t('Direct'),
|
1435 |
|
|
'#options' => $taxonRelationshipTypeOptions,
|
1436 |
|
|
'#default_value' => $aggregate_by_taxon_relationships['direct'],
|
1437 |
30f78c59
|
Andreas Kohlbecker
|
);
|
1438 |
f19f47fa
|
Andreas Kohlbecker
|
$form['aggregation']['aggregate_by_taxon_relationships'][CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS]['invers'] = array(
|
1439 |
|
|
'#type' => 'checkboxes',
|
1440 |
|
|
'#title' => t('Invers'),
|
1441 |
|
|
'#options' => $taxonRelationshipTypeOptions,
|
1442 |
|
|
'#default_value' => $aggregate_by_taxon_relationships['invers'],
|
1443 |
30f78c59
|
Andreas Kohlbecker
|
);
|
1444 |
|
|
|
1445 |
06c2b3e2
|
Andreas Kohlbecker
|
$form['drupal_integration'] = array(
|
1446 |
|
|
'#type' => 'fieldset',
|
1447 |
38dd933d
|
Andreas Kohlbecker
|
'#attributes' => array('class'=> array('clearfix')),
|
1448 |
06c2b3e2
|
Andreas Kohlbecker
|
'#title' => t('Drupal integration'),
|
1449 |
|
|
'#collapsible' => FALSE,
|
1450 |
|
|
'#collapsed' => FALSE,
|
1451 |
|
|
'#tree' => FALSE
|
1452 |
|
|
);
|
1453 |
|
|
|
1454 |
|
|
$form['drupal_integration'][CDM_DRUPAL_NODE_CREATION] = array(
|
1455 |
|
|
'#type' => 'checkbox',
|
1456 |
|
|
'#title' => 'Create drupal nodes',
|
1457 |
|
|
'#default_value' => variable_get(CDM_DRUPAL_NODE_CREATION, FALSE),
|
1458 |
944d793a
|
Andreas Kohlbecker
|
'#description' => 'Content für cdm_dataportal pages is directly retrieved from the
|
1459 |
06c2b3e2
|
Andreas Kohlbecker
|
CDM webservice configured above. In order to use other drupal modules like the "Comments" module together with the
|
1460 |
|
|
cdm pages it is required that drupal nodes are created and stored in the database.'
|
1461 |
|
|
);
|
1462 |
|
|
|
1463 |
|
|
|
1464 |
|
|
|
1465 |
|
|
$form['drupal_integration']['drop_all_cdm_nodes_warning_pre'] = array(
|
1466 |
|
|
'#markup' => '<h6 style="color:red;">WARNING:</h6>
|
1467 |
|
|
<div class="description">Using this button, you will lose all content associated with the cdm drupal nodes which is stored in the drupal data base.</div>',
|
1468 |
|
|
);
|
1469 |
|
|
$form['drupal_integration']['drop_all_cdm_nodes'] = array(
|
1470 |
|
|
'#type' => 'submit',
|
1471 |
|
|
'#value' => t('Drop all cdm nodes'),
|
1472 |
|
|
'#submit' => array('drop_all_cdm_nodes_submit')
|
1473 |
|
|
);
|
1474 |
|
|
|
1475 |
|
|
$form['drupal_integration']['drop_all_cdm_nodes_warning_post'] = array(
|
1476 |
|
|
'#markup' => '<div class="description">All Drupal nodes created for cdm content can be deleted at once using this button.</div>',
|
1477 |
|
|
);
|
1478 |
|
|
|
1479 |
|
|
// ----------------------
|
1480 |
5ea8b301
|
Andreas Kohlbecker
|
$form['cdm_js_devel_mode'] = array(
|
1481 |
|
|
'#type' => 'checkbox',
|
1482 |
|
|
'#title' => 'Java-script developer mode',
|
1483 |
|
|
'#default_value' => variable_get('cdm_js_devel_mode', FALSE),
|
1484 |
|
|
'#description' => 'In production envirionments the java script libraries
|
1485 |
|
|
the cdm_dataportal is making use of are compressed and optimized. This
|
1486 |
|
|
is good for performance but a caveat if you need to debug java-script. When the
|
1487 |
|
|
java-script developer mode is enabled the uncompressed and commented developer
|
1488 |
|
|
versions of java-script libraries will be used where possible.
|
1489 |
|
|
<br/><strong>Do not use this option in production!</strong>'
|
1490 |
|
|
);
|
1491 |
2dd59bb5
|
Andreas Kohlbecker
|
// ----------------------
|
1492 |
|
|
$form['cdm_debug_mode'] = array(
|
1493 |
|
|
'#type' => 'checkbox',
|
1494 |
|
|
'#title' => 'CDM page debug mode',
|
1495 |
|
|
'#default_value' => variable_get('cdm_debug_mode', FALSE),
|
1496 |
|
|
'#description' => 'When CDM page debug mode enabled the start and end of cdm entity page
|
1497 |
b5deb531
|
Andreas Kohlbecker
|
creation is logged as well as any http request send via the cdm_api. The log is written to a file in the temporary
|
1498 |
|
|
folder configured in the' . l('File system settings', 'admin/config/media/file-system') .
|
1499 |
|
|
'. For this site the file is <code> ' . file_directory_temp() . '/drupal_debug.txt</code>
|
1500 |
2dd59bb5
|
Andreas Kohlbecker
|
The log is written by the drupal devel module function <code>dd()</code>.
|
1501 |
b5deb531
|
Andreas Kohlbecker
|
<br/><strong>Note:</strong> The start and end of the page creation is currently only logged for taxon pages only.'
|
1502 |
2dd59bb5
|
Andreas Kohlbecker
|
);
|
1503 |
5ea8b301
|
Andreas Kohlbecker
|
|
1504 |
6657531f
|
Andreas Kohlbecker
|
// Comment @WA: D7 form api does not support reset buttons,
|
1505 |
|
|
// so to mimic the D5 reset button we add one like this.
|
1506 |
|
|
$form['actions']['reset'] = array(
|
1507 |
|
|
'#markup' => '<input id="reset" type="reset" class="form-submit" value="' . t('Reset to defaults') . '" />',
|
1508 |
|
|
'#weight' => 1000,
|
1509 |
|
|
);
|
1510 |
|
|
|
1511 |
22eb20d7
|
Andreas Kohlbecker
|
$form['#submit'][] = 'cdm_settings_general_submit';
|
1512 |
|
|
|
1513 |
6657531f
|
Andreas Kohlbecker
|
return system_settings_form($form);
|
1514 |
|
|
}
|
1515 |
|
|
|
1516 |
06c2b3e2
|
Andreas Kohlbecker
|
/**
|
1517 |
|
|
* Submit callback; drops all cdm nodes.
|
1518 |
|
|
*
|
1519 |
|
|
* @ingroup forms
|
1520 |
|
|
*/
|
1521 |
|
|
function drop_all_cdm_nodes_submit($form, &$form_state) {
|
1522 |
|
|
cdm_delete_all_cdm_nodes();
|
1523 |
|
|
drupal_set_message(t('All cdm nodes dropped.'));
|
1524 |
|
|
}
|
1525 |
|
|
|
1526 |
6657531f
|
Andreas Kohlbecker
|
|
1527 |
|
|
/**
|
1528 |
|
|
* LAYOUT settings
|
1529 |
f264279e
|
Andreas Kohlbecker
|
*
|
1530 |
|
|
* @return array
|
1531 |
|
|
* The form structure.
|
1532 |
6657531f
|
Andreas Kohlbecker
|
*/
|
1533 |
|
|
function cdm_settings_layout() {
|
1534 |
|
|
|
1535 |
|
|
$form = array();
|
1536 |
0f5f1c12
|
Andreas Kohlbecker
|
|
1537 |
|
|
$form['about'] = array(
|
1538 |
|
|
'#markup' => '<h4>' . t('Portal Layout') . '</h4><p>' . t('This settings contains the general configurations
|
1539 |
6657531f
|
Andreas Kohlbecker
|
layout. If you want to configure the specific sites layout visit the
|
1540 |
0f5f1c12
|
Andreas Kohlbecker
|
respective configuration site for taxon, search or media.') . '</p>',
|
1541 |
6657531f
|
Andreas Kohlbecker
|
);
|
1542 |
|
|
|
1543 |
|
|
// ---- footnotes --- //
|
1544 |
0f5f1c12
|
Andreas Kohlbecker
|
$form['footnotes'] = array(
|
1545 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'fieldset',
|
1546 |
|
|
'#title' => t('Footnotes'),
|
1547 |
|
|
'#collapsible' => FALSE,
|
1548 |
|
|
'#collapsed' => FALSE,
|
1549 |
|
|
'#description' => t('Taxa data such authors, synonyms names, descriptions,
|
1550 |
|
|
media or distribution areas may have annotations or footnotes. When the
|
1551 |
|
|
footnotes are enabled they will be visible (if they exist).'),
|
1552 |
|
|
);
|
1553 |
|
|
|
1554 |
0f5f1c12
|
Andreas Kohlbecker
|
$form['footnotes']['cdm_dataportal_all_footnotes'] = array(
|
1555 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'checkbox',
|
1556 |
|
|
'#title' => t('Do not show footnotes'),
|
1557 |
|
|
'#default_value' => variable_get('cdm_dataportal_all_footnotes', CDM_DATAPORTAL_ALL_FOOTNOTES),
|
1558 |
|
|
'#description' => t('Check this if you do not want to show any footnotes'),
|
1559 |
|
|
);
|
1560 |
|
|
|
1561 |
0f5f1c12
|
Andreas Kohlbecker
|
$form['footnotes']['cdm_dataportal_annotations_footnotes'] = array(
|
1562 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'checkbox',
|
1563 |
10055120
|
Andreas Kohlbecker
|
'#title' => t('Do not show annotation footnotes'),
|
1564 |
6657531f
|
Andreas Kohlbecker
|
'#default_value' => variable_get('cdm_dataportal_annotations_footnotes', CDM_DATAPORTAL_ANNOTATIONS_FOOTNOTES),
|
1565 |
|
|
'#description' => t('Check this if you do not want to show annotation footnotes'),
|
1566 |
|
|
);
|
1567 |
|
|
|
1568 |
7370f4f7
|
Andreas Kohlbecker
|
$form['annotations'] = array(
|
1569 |
|
|
'#type' => 'fieldset',
|
1570 |
|
|
'#title' => t('Annotations'),
|
1571 |
|
|
'#collapsible' => FALSE,
|
1572 |
|
|
'#collapsed' => FALSE,
|
1573 |
|
|
'#description' => t('This sections allows configuring global settings regarding annotations and thus will affect annotations dispayed as footnote and others.'),
|
1574 |
|
|
);
|
1575 |
|
|
|
1576 |
7ca5ef1e
|
Andreas Kohlbecker
|
$annotationTypeOptions = cdm_terms_by_type_as_option('AnnotationType');
|
1577 |
6657531f
|
Andreas Kohlbecker
|
// Additional option for the NULL case.
|
1578 |
|
|
$annotationTypeOptions['NULL_VALUE'] = t('untyped');
|
1579 |
7370f4f7
|
Andreas Kohlbecker
|
$annotationsTypesAsFootnotes = variable_get(ANNOTATION_TYPES_VISIBLE, unserialize(ANNOTATIONS_TYPES_AS_FOOTNOTES_DEFAULT));
|
1580 |
|
|
$form['annotations'][ANNOTATION_TYPES_VISIBLE] = array(
|
1581 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'checkboxes',
|
1582 |
7370f4f7
|
Andreas Kohlbecker
|
'#title' => t('Visbility of annotation types'),
|
1583 |
|
|
'#description' => t("Only annotations of the selected type will be displayed. You may want to turn 'technical annotations' off."),
|
1584 |
6657531f
|
Andreas Kohlbecker
|
'#options' => $annotationTypeOptions,
|
1585 |
7370f4f7
|
Andreas Kohlbecker
|
'#default_value' => $annotationsTypesAsFootnotes
|
1586 |
6657531f
|
Andreas Kohlbecker
|
);
|
1587 |
7370f4f7
|
Andreas Kohlbecker
|
|
1588 |
6657531f
|
Andreas Kohlbecker
|
|
1589 |
5611d467
|
Andreas Kohlbecker
|
// ---- original source --- //
|
1590 |
|
|
$form[BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE] = array(
|
1591 |
|
|
'#type' => 'fieldset',
|
1592 |
|
|
'#tree' => TRUE,
|
1593 |
|
|
'#title' => t('Source Citations'),
|
1594 |
|
|
'#collapsible' => FALSE,
|
1595 |
|
|
'#collapsed' => FALSE,
|
1596 |
|
|
);
|
1597 |
f19f47fa
|
Andreas Kohlbecker
|
|
1598 |
800ff2b0
|
Andreas Kohlbecker
|
$bibliography_settings = get_bibliography_settings(true);
|
1599 |
5611d467
|
Andreas Kohlbecker
|
|
1600 |
800ff2b0
|
Andreas Kohlbecker
|
$form[BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE]['enabled'] = array(
|
1601 |
5611d467
|
Andreas Kohlbecker
|
'#type' => 'checkbox',
|
1602 |
|
|
'#title' => t('Original Source in bibliography'),
|
1603 |
|
|
'#default_value' => $bibliography_settings['enabled'],
|
1604 |
|
|
'#description' => t('Show original source citations in bibliography block, instead of rendering them with other
|
1605 |
31f0f2b8
|
Andreas Kohlbecker
|
annotations in each feature block.<br/><br/>Whether the Original Source reference of a Feature Block is actually put
|
1606 |
|
|
into the bibliography also depends on the settings in the ' .
|
1607 |
|
|
l("Taxon profile feature block settings", "settings/layout/taxon") .
|
1608 |
|
|
'. For more information please refer to the description on the settings "<em>Sources as content</em>" & "<em>Sources as content to bibliography</em>" in that settings page.'),
|
1609 |
5611d467
|
Andreas Kohlbecker
|
);
|
1610 |
|
|
|
1611 |
|
|
$form[BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE]['key_format'] = array(
|
1612 |
|
|
'#type' => 'select',
|
1613 |
|
|
'#title' => t('The format of the key numerals'),
|
1614 |
|
|
'#default_value' => $bibliography_settings['key_format'],
|
1615 |
|
|
'#options' => array('latin' => 'Latin',
|
1616 |
|
|
'ROMAN' => 'Roman (upper case)',
|
1617 |
|
|
'roman' => 'Roman (lower case)',
|
1618 |
|
|
'ALPHA'=> 'Alphabet (upper case)',
|
1619 |
|
|
'alpha' => 'Alphabet (lower case)')
|
1620 |
|
|
);
|
1621 |
f19f47fa
|
Andreas Kohlbecker
|
|
1622 |
|
|
// --- Advanced Search --- //
|
1623 |
|
|
$form['asearch'] = array(
|
1624 |
1ce9afb7
|
Patric Plitzner
|
'#type' => 'fieldset',
|
1625 |
|
|
'#title' => t('Advanced search'),
|
1626 |
|
|
'#collapsible' => FALSE,
|
1627 |
|
|
'#collapsed' => FALSE,
|
1628 |
f19f47fa
|
Andreas Kohlbecker
|
);
|
1629 |
|
|
$form['asearch']['cdm_dataportal_show_advanced_search'] = array(
|
1630 |
1ce9afb7
|
Patric Plitzner
|
'#type' => 'checkbox',
|
1631 |
|
|
'#title' => t('Show advanced search link'),
|
1632 |
|
|
'#default_value' => variable_get('cdm_dataportal_show_advanced_search', 1),
|
1633 |
|
|
'#description' => t('Check this box if the link to advanced search should be show below the search box.'),
|
1634 |
f19f47fa
|
Andreas Kohlbecker
|
);
|
1635 |
|
|
|
1636 |
977bba78
|
Andreas Kohlbecker
|
// --- Registrations --- //
|
1637 |
|
|
$form['registrations'] = array(
|
1638 |
|
|
'#type' => 'fieldset',
|
1639 |
|
|
'#title' => t('Registrations'),
|
1640 |
|
|
'#collapsible' => FALSE,
|
1641 |
|
|
'#collapsed' => FALSE,
|
1642 |
|
|
);
|
1643 |
|
|
$form['registrations']['cdm_registration_presistent_identifier_as_link'] = array(
|
1644 |
|
|
'#type' => 'checkbox',
|
1645 |
|
|
'#title' => t('Use the persistent http identifier as link'),
|
1646 |
|
|
'#default_value' => variable_get('cdm_registration_presistent_identifier_as_link', 0),
|
1647 |
|
|
'#description' => t('Switch the portal from using the drupal path <code>registration/{url encoded persistent http identifier}</code> to using the persistent http identifier directly as link.'),
|
1648 |
|
|
);
|
1649 |
|
|
|
1650 |
f19f47fa
|
Andreas Kohlbecker
|
// ---- Taxon Name Rendering --- //
|
1651 |
|
|
$form['taxon_name'] = array(
|
1652 |
|
|
'#type' => 'fieldset',
|
1653 |
|
|
'#title' => t('Taxon name display'),
|
1654 |
|
|
'#collapsible' => TRUE,
|
1655 |
|
|
'#collapsed' => TRUE,
|
1656 |
7cc085da
|
Andreas Kohlbecker
|
'#description' => t('The display of taxon names is configured by two parts.
|
1657 |
|
|
The <srong>name render templates</strong> define the parts of the name to be displayed in the different areas of the data portal pages.
|
1658 |
|
|
The name parts are defined in the <stong>part definitions</strong>'),
|
1659 |
0f5f1c12
|
Andreas Kohlbecker
|
);
|
1660 |
|
|
|
1661 |
78292e72
|
Andreas Kohlbecker
|
$default_part_definitions = unserialize(CDM_PART_DEFINITIONS_DEFAULT);
|
1662 |
b2b9e057
|
Andreas Kohlbecker
|
$default_part_definitions_pre_380_json = json_encode(unserialize(CDM_PART_DEFINITIONS_DEFAULT_PRE_380), JSON_PRETTY_PRINT);
|
1663 |
|
|
$default_part_definition_json = json_encode($default_part_definitions, JSON_PRETTY_PRINT);
|
1664 |
|
|
$current_part_definition_json = json_encode(variable_get(CDM_PART_DEFINITIONS, $default_part_definitions), JSON_PRETTY_PRINT);
|
1665 |
1a01f6dd
|
Andreas Kohlbecker
|
|
1666 |
b2b9e057
|
Andreas Kohlbecker
|
$is_custom_part_definition = $default_part_definition_json != $current_part_definition_json;
|
1667 |
2eaa13b4
|
Andreas Kohlbecker
|
if($default_part_definitions_pre_380_json == $current_part_definition_json){
|
1668 |
b2b9e057
|
Andreas Kohlbecker
|
$which_version_message = '(These are the old default part definition from before EDIT platform release 3.8.0, you may want to reset these by clearing the text area and and submitting the form.)';
|
1669 |
|
|
} else if($is_custom_part_definition){
|
1670 |
102f8c26
|
Andreas Kohlbecker
|
$which_version_message = '(This are custom part definitions, clearing the text area and and submitting the form will reset it to the default)';
|
1671 |
2eaa13b4
|
Andreas Kohlbecker
|
} else {
|
1672 |
1a01f6dd
|
Andreas Kohlbecker
|
$which_version_message = '(These are the default part definition.)';
|
1673 |
|
|
}
|
1674 |
|
|
|
1675 |
b2b9e057
|
Andreas Kohlbecker
|
$diff_viewer_markup = '';
|
1676 |
|
|
if($is_custom_part_definition){
|
1677 |
|
|
$diff_viewer_markup = diff_viewer($default_part_definition_json, $current_part_definition_json);
|
1678 |
|
|
}
|
1679 |
|
|
|
1680 |
|
|
$which_version_message = '<div style="color:#ff0000; font-weight: bold;">'
|
1681 |
|
|
. $which_version_message
|
1682 |
|
|
. '</div>'
|
1683 |
|
|
. $diff_viewer_markup;
|
1684 |
|
|
|
1685 |
0f5f1c12
|
Andreas Kohlbecker
|
$form['taxon_name'][CDM_PART_DEFINITIONS] = array(
|
1686 |
|
|
'#type' => 'textarea',
|
1687 |
|
|
'#title' => t('Part definitions'),
|
1688 |
|
|
'#element_validate' => array('form_element_validate_json'),
|
1689 |
43998144
|
Andreas Kohlbecker
|
'#default_value' => $current_part_definition_json,
|
1690 |
0f5f1c12
|
Andreas Kohlbecker
|
'#description' => '
|
1691 |
1a01f6dd
|
Andreas Kohlbecker
|
<p>' . $which_version_message . '</p>
|
1692 |
0f5f1c12
|
Andreas Kohlbecker
|
<p>
|
1693 |
|
|
The part definitions define the specific parts of which a rendered taxon name plus additional information will consist.
|
1694 |
|
|
</p>
|
1695 |
|
|
<p>
|
1696 |
|
|
A full taxon name plus additional information can consist of the following elements:
|
1697 |
|
|
<ul>
|
1698 |
|
|
<li>name: the taxon name inclugin rank nbut without author</li>
|
1699 |
|
|
<li>authors: The authors of a reference, also used in taxon names</li>
|
1700 |
|
|
<li>reference: the nomenclatural reference,</li>
|
1701 |
|
|
<li>microreference: Volume, page number etc.</li>
|
1702 |
|
|
<li>status: The nomenclatural status of a name</li>
|
1703 |
|
|
<li>description: name descriptions like protologues etc ...</li>
|
1704 |
|
|
</ul>
|
1705 |
|
|
</p>
|
1706 |
|
|
<p>
|
1707 |
|
|
These elements are combined in the part definitions array to from the specific parts to be rendered.
|
1708 |
|
|
(The taxon name "Lapsana communis L., Sp. Pl.: 811. 1753" shall be an example in the following)
|
1709 |
51b04faf
|
Andreas Kohlbecker
|
The following parts can be formed and are recognized by the system:
|
1710 |
0f5f1c12
|
Andreas Kohlbecker
|
<ul>
|
1711 |
51b04faf
|
Andreas Kohlbecker
|
<li>namePart: the name and rank (for example: "Lapsana communis")</li>
|
1712 |
|
|
<li>authorshipPart: the author (for example: "L.")</li>
|
1713 |
|
|
<li>nameAuthorPart: the combination of name and author part (for example: "Lapsana communis L.").</li>
|
1714 |
0f5f1c12
|
Andreas Kohlbecker
|
This is useful for zoological names where the authorshipPart belongs to the name and both should</li>
|
1715 |
|
|
be combined when a link to the taxon is rendered.</li>
|
1716 |
51b04faf
|
Andreas Kohlbecker
|
<li>referencePart: the nomencaltural reference (for example: "Sp. Pl. 1753")</li>
|
1717 |
|
|
<li>referenceYearPart: the publication year of the nomencaltural reference (for example: "1753")</li>
|
1718 |
|
|
<li>microreferencePart: usually the page number (for example ": 811.")</li>
|
1719 |
0f5f1c12
|
Andreas Kohlbecker
|
<li>statusPart: the nomenclatorical status</li>
|
1720 |
|
|
<li>descriptionPart: name descriptions like protologues etc ...</li>
|
1721 |
|
|
</ul>
|
1722 |
|
|
</p>
|
1723 |
|
|
<p>
|
1724 |
|
|
Each set of parts is dedicated to render a specific TaxonName type, the type names are used as keys for the
|
1725 |
|
|
specific parts part definitions:
|
1726 |
|
|
<ul>
|
1727 |
|
|
<li>BotanicalName</li>
|
1728 |
|
|
<li>ZoologicalName</li>
|
1729 |
|
|
<li>#DEFAULT: covers ViralNames and other NonViralNames
|
1730 |
|
|
</ul>
|
1731 |
|
|
An example:
|
1732 |
|
|
<pre>
|
1733 |
|
|
{
|
1734 |
|
|
"ZoologicalName": {
|
1735 |
|
|
"namePart": {
|
1736 |
|
|
"name": true
|
1737 |
|
|
},
|
1738 |
|
|
"referencePart": {
|
1739 |
b5519d3a
|
Andreas Kohlbecker
|
"authors": true
|
1740 |
0f5f1c12
|
Andreas Kohlbecker
|
},
|
1741 |
|
|
"microreferencePart": {
|
1742 |
|
|
"microreference": true
|
1743 |
|
|
},
|
1744 |
|
|
"statusPart": {
|
1745 |
|
|
"status": true
|
1746 |
|
|
},
|
1747 |
|
|
"descriptionPart": {
|
1748 |
|
|
"description": true
|
1749 |
|
|
}
|
1750 |
|
|
},
|
1751 |
|
|
"BotanicalName": {
|
1752 |
|
|
"namePart": {
|
1753 |
|
|
"name": true,
|
1754 |
|
|
"authors": true
|
1755 |
|
|
},
|
1756 |
|
|
"referencePart": {
|
1757 |
|
|
"reference": true,
|
1758 |
|
|
"microreference": true
|
1759 |
|
|
},
|
1760 |
43998144
|
Andreas Kohlbecker
|
"secReferencePart": {
|
1761 |
|
|
"secReference": true
|
1762 |
|
|
},
|
1763 |
0f5f1c12
|
Andreas Kohlbecker
|
"statusPart": {
|
1764 |
|
|
"status": true
|
1765 |
|
|
},
|
1766 |
|
|
"descriptionPart": {
|
1767 |
|
|
"description": true
|
1768 |
|
|
}
|
1769 |
|
|
}
|
1770 |
|
|
}
|
1771 |
|
|
</pre>',
|
1772 |
|
|
);
|
1773 |
|
|
|
1774 |
78292e72
|
Andreas Kohlbecker
|
$default_render_templates = unserialize(CDM_NAME_RENDER_TEMPLATES_DEFAULT);
|
1775 |
b2b9e057
|
Andreas Kohlbecker
|
$default_render_templates_pre_380_json = json_encode(unserialize(CDM_NAME_RENDER_TEMPLATES_DEFAULT_PRE_380), JSON_PRETTY_PRINT);
|
1776 |
|
|
$default_render_templates_json = json_encode($default_render_templates, JSON_PRETTY_PRINT);
|
1777 |
|
|
$current_render_templates_json = json_encode(variable_get(CDM_NAME_RENDER_TEMPLATES, $default_render_templates), JSON_PRETTY_PRINT);
|
1778 |
|
|
$is_custom_render_template = $default_render_templates_json != $current_render_templates_json;
|
1779 |
1a01f6dd
|
Andreas Kohlbecker
|
|
1780 |
2eaa13b4
|
Andreas Kohlbecker
|
if($default_render_templates_pre_380_json == $current_render_templates_json){
|
1781 |
b2b9e057
|
Andreas Kohlbecker
|
$which_version_message = '(These are the old default render templates from before EDIT platform release 3.8.0, you may want to reset these by clearing the text area and and submitting the form.)';
|
1782 |
|
|
} else if($is_custom_render_template){
|
1783 |
|
|
$which_version_message = '(These are custom render templates, clearing the text area and and submitting the form will reset it to the default)';
|
1784 |
1a01f6dd
|
Andreas Kohlbecker
|
} else {
|
1785 |
|
|
$which_version_message = '(These are the default render templates.)';
|
1786 |
|
|
}
|
1787 |
|
|
|
1788 |
b2b9e057
|
Andreas Kohlbecker
|
$diff_viewer_markup = '';
|
1789 |
|
|
if($is_custom_render_template){
|
1790 |
|
|
$diff_viewer_markup = diff_viewer($default_render_templates_json, $current_render_templates_json);
|
1791 |
|
|
}
|
1792 |
|
|
|
1793 |
|
|
$which_version_message = '<div style="color:#ff0000; font-weight: bold;">'
|
1794 |
|
|
. $which_version_message
|
1795 |
|
|
. '</div>'
|
1796 |
|
|
. $diff_viewer_markup;
|
1797 |
|
|
|
1798 |
f19f47fa
|
Andreas Kohlbecker
|
$form['taxon_name'][CDM_NAME_RENDER_TEMPLATES] = array(
|
1799 |
|
|
'#type' => 'textarea',
|
1800 |
0f5f1c12
|
Andreas Kohlbecker
|
'#title' => t('Name render templates'),
|
1801 |
f19f47fa
|
Andreas Kohlbecker
|
'#element_validate' => array('form_element_validate_json'),
|
1802 |
1a01f6dd
|
Andreas Kohlbecker
|
'#default_value' => $current_render_templates_json,
|
1803 |
0f5f1c12
|
Andreas Kohlbecker
|
'#description' => '
|
1804 |
1a01f6dd
|
Andreas Kohlbecker
|
<p>' . $which_version_message . '</p>
|
1805 |
0f5f1c12
|
Andreas Kohlbecker
|
<p>
|
1806 |
|
|
The render templates array contains one or more name render templates to be used within the page areas identified by the
|
1807 |
f695daf4
|
Andreas Kohlbecker
|
render path. The render path of taxon names can be made visible by adding the URI query parameter
|
1808 |
|
|
<strong><code>RENDER_PATH=1</code></strong> to the page request.<br />
|
1809 |
|
|
The render path is used as key of the array sub subelements whereas the name render template array is set as value.
|
1810 |
|
|
The following render Path keys are currently recognized:
|
1811 |
0f5f1c12
|
Andreas Kohlbecker
|
<ul>
|
1812 |
51b04faf
|
Andreas Kohlbecker
|
<li>list_of_taxa</li>
|
1813 |
|
|
<li>acceptedFor</li>
|
1814 |
|
|
<li>homonym</li>
|
1815 |
0f5f1c12
|
Andreas Kohlbecker
|
<li>taxon_page_synonymy</li>
|
1816 |
|
|
<li>typedesignations</li>
|
1817 |
|
|
<li>taxon_page_title</li>
|
1818 |
|
|
<li>polytomousKey</li>
|
1819 |
|
|
<li>na: name + authorship</li>
|
1820 |
|
|
<li>nar:name + authorship + reference</li>
|
1821 |
|
|
<li>#DEFAULT</li>
|
1822 |
|
|
</ul>
|
1823 |
|
|
A single render template can be used for multiple render paths. In this case the according key of the render templates
|
1824 |
|
|
array element should be a comma separated list of render paths, without any whitespace!.
|
1825 |
|
|
</p>
|
1826 |
|
|
<p>
|
1827 |
|
|
A render template is an associative array. The keys of this array are referring to the keys as defined in the part
|
1828 |
|
|
definitions array. See <a href="#edit-cdm-part-definitions">Part definitions</a> above for more information.
|
1829 |
|
|
<p>
|
1830 |
|
|
The value of the render template element must be set to TRUE in order to let this part being rendered.
|
1831 |
43998144
|
Andreas Kohlbecker
|
For some parts can <strong>links</strong> can be created which lead to the accoring intity page:</br>
|
1832 |
|
|
The <strong>namePart</strong>, <strong>nameAuthorPart</strong>, <strong>referencePart</strong> and <strong>secReferencePart</strong> can also hold an associative array with a single
|
1833 |
0f5f1c12
|
Andreas Kohlbecker
|
element: array(\'#uri\' => TRUE). The value of the #uri element will be replaced by the according
|
1834 |
|
|
links if the paramters $nameLink or $refenceLink are given to the name render function
|
1835 |
f19f47fa
|
Andreas Kohlbecker
|
(this is hard coded and cannot be configured here).',
|
1836 |
6657531f
|
Andreas Kohlbecker
|
);
|
1837 |
|
|
|
1838 |
|
|
// @WA: D7 form api does not support reset buttons,
|
1839 |
|
|
// so to mimic the D5 reset button we add one like this.
|
1840 |
|
|
$form['actions']['reset'] = array(
|
1841 |
|
|
'#markup' => '<input id="reset" type="reset" class="form-submit" value="' . t('Reset to defaults') . '" />',
|
1842 |
|
|
'#weight' => 1000,
|
1843 |
|
|
);
|
1844 |
f19f47fa
|
Andreas Kohlbecker
|
|
1845 |
0f5f1c12
|
Andreas Kohlbecker
|
$form['#submit'] = array('submit_json_as_php_array');
|
1846 |
|
|
// #json_elements especially defined for submit_json_as_php_array()
|
1847 |
|
|
$form['#json_elements'] = array(CDM_NAME_RENDER_TEMPLATES, CDM_PART_DEFINITIONS);
|
1848 |
6657531f
|
Andreas Kohlbecker
|
return system_settings_form($form);
|
1849 |
|
|
}
|
1850 |
|
|
|
1851 |
|
|
|
1852 |
045fb441
|
Andreas Kohlbecker
|
/**
|
1853 |
|
|
* @param $form_name
|
1854 |
|
|
* @param $form_title
|
1855 |
|
|
* @param $collapsed
|
1856 |
|
|
* @param string $form_description
|
1857 |
|
|
* The description for the fieldset of the gallery setting.
|
1858 |
|
|
* @return mixed
|
1859 |
6657531f
|
Andreas Kohlbecker
|
*/
|
1860 |
|
|
function cdm_dataportal_create_gallery_settings_form($form_name, $form_title, $collapsed, $form_description = '') {
|
1861 |
|
|
$form[$form_name] = array(
|
1862 |
|
|
'#type' => 'fieldset',
|
1863 |
7cc085da
|
Andreas Kohlbecker
|
'#title' => t('@form-title', array('@form-title' => $form_title)),
|
1864 |
6657531f
|
Andreas Kohlbecker
|
'#collapsible' => TRUE,
|
1865 |
|
|
'#collapsed' => $collapsed,
|
1866 |
|
|
'#tree' => TRUE,
|
1867 |
045fb441
|
Andreas Kohlbecker
|
'#description' => $form_description,
|
1868 |
6657531f
|
Andreas Kohlbecker
|
);
|
1869 |
|
|
|
1870 |
|
|
$default_values = unserialize(CDM_DATAPORTAL_GALLERY_SETTINGS);
|
1871 |
|
|
$gallery_settings = variable_get($form_name, $default_values);
|
1872 |
|
|
// $test = variable_get('cdm_dataportal_search_items_on_page', CDM_DATAPORTAL_SEARCH_ITEMS_ON_PAGE);
|
1873 |
|
|
if ($form_name == CDM_DATAPORTAL_SEARCH_GALLERY_NAME) {
|
1874 |
|
|
/*
|
1875 |
|
|
TODO: why cdm_dataportal_search_items_on_page does not save the value on $test???
|
1876 |
|
|
$form[$form_name]['cdm_dataportal_search_items_on_page'] = array(
|
1877 |
|
|
'#type' => 'textfield',
|
1878 |
|
|
'#title' => t('Search Page Size'),
|
1879 |
|
|
'#default_value' => $test,
|
1880 |
|
|
'#description' => t('Number of Names to display per page in search results.')
|
1881 |
|
|
);
|
1882 |
|
|
*/
|
1883 |
|
|
$form[$form_name]['cdm_dataportal_show_taxon_thumbnails'] = array(
|
1884 |
|
|
'#type' => 'checkbox',
|
1885 |
|
|
'#title' => t('Show media thumbnails for accepted taxa'),
|
1886 |
|
|
'#default_value' => $gallery_settings['cdm_dataportal_show_taxon_thumbnails'],
|
1887 |
|
|
);
|
1888 |
|
|
|
1889 |
|
|
$form[$form_name]['cdm_dataportal_show_synonym_thumbnails'] = array(
|
1890 |
|
|
'#type' => 'checkbox',
|
1891 |
|
|
'#title' => t('Show media thumbnails for synonyms'),
|
1892 |
|
|
'#default_value' => $gallery_settings['cdm_dataportal_show_synonym_thumbnails'],
|
1893 |
|
|
'#description' => '',
|
1894 |
|
|
);
|
1895 |
|
|
}
|
1896 |
|
|
|
1897 |
|
|
// $showCaption = variable_get('cdm_dataportal_findtaxa_show_thumbnail_captions', 0);
|
1898 |
|
|
$form[$form_name]['cdm_dataportal_show_thumbnail_captions'] = array(
|
1899 |
|
|
'#type' => 'checkbox',
|
1900 |
|
|
'#title' => t('Show captions under thumbnails'),
|
1901 |
|
|
'#default_value' => $gallery_settings['cdm_dataportal_show_thumbnail_captions'],
|
1902 |
|
|
'#description' => '',
|
1903 |
|
|
);
|
1904 |
|
|
|
1905 |
|
|
$form[$form_name]['cdm_dataportal_media_maxextend'] = array(
|
1906 |
|
|
'#type' => 'textfield',
|
1907 |
5358baff
|
Andreas Kohlbecker
|
'#title' => t('Thumbnail size (max of width or height)') . ':',
|
1908 |
6657531f
|
Andreas Kohlbecker
|
'#default_value' => $gallery_settings['cdm_dataportal_media_maxextend'],
|
1909 |
5358baff
|
Andreas Kohlbecker
|
'#description' => t('The maximum extend in either dimension, width or height, in pixels for the thumbnail images in the gallery.'),
|
1910 |
6657531f
|
Andreas Kohlbecker
|
);
|
1911 |
|
|
|
1912 |
63d5030d
|
Andreas Kohlbecker
|
$form[$form_name]['cdm_dataportal_media_cols'] = array(
|
1913 |
|
|
'#type' => 'textfield',
|
1914 |
|
|
'#title' => t('Number of columns') . ':',
|
1915 |
|
|
'#default_value' => $gallery_settings['cdm_dataportal_media_cols'],
|
1916 |
|
|
'#description' => t('Group the thumbnails in columns: select how many
|
1917 |
|
|
columns the gallery should display.'),
|
1918 |
|
|
);
|
1919 |
6657531f
|
Andreas Kohlbecker
|
|
1920 |
|
|
if ($form_name == CDM_DATAPORTAL_SEARCH_GALLERY_NAME) {
|
1921 |
|
|
$form[$form_name]['cdm_dataportal_media_maxRows'] = array(
|
1922 |
|
|
'#type' => 'textfield',
|
1923 |
|
|
'#title' => t('Maximum number of rows') . ':',
|
1924 |
|
|
'#default_value' => $gallery_settings['cdm_dataportal_media_maxRows'],
|
1925 |
|
|
'#description' => t('You can group the thumbnails in rows, select in how
|
1926 |
|
|
many rows should be the thumbnails grouped.<br/><strong>Note:</strong>
|
1927 |
|
|
If you want an unlimited number of rows please set to 0.'),
|
1928 |
|
|
);
|
1929 |
|
|
}
|
1930 |
|
|
|
1931 |
|
|
return $form;
|
1932 |
|
|
}
|
1933 |
|
|
|
1934 |
|
|
/**
|
1935 |
f264279e
|
Andreas Kohlbecker
|
* @return array
|
1936 |
|
|
* The form structure.
|
1937 |
6657531f
|
Andreas Kohlbecker
|
*/
|
1938 |
|
|
function cdm_settings_layout_taxon() {
|
1939 |
|
|
$collapsed = FALSE;
|
1940 |
|
|
$form = array();
|
1941 |
|
|
|
1942 |
7df1be04
|
Andreas Kohlbecker
|
$form['#submit'][] = 'cdm_settings_layout_taxon_submit';
|
1943 |
|
|
|
1944 |
6657531f
|
Andreas Kohlbecker
|
// --------- TABBED TAXON ------- //
|
1945 |
|
|
$form['taxon_tabs'] = array(
|
1946 |
|
|
'#type' => 'fieldset',
|
1947 |
|
|
'#title' => t('Taxon tabs'),
|
1948 |
|
|
'#collapsible' => TRUE,
|
1949 |
6421984d
|
Andreas Kohlbecker
|
'#collapsed' => TRUE,
|
1950 |
423f5e58
|
Andreas Kohlbecker
|
'#description' => 'A taxon page consists of various sections, that is content blocks, each displaying a different kind of information.'
|
1951 |
6657531f
|
Andreas Kohlbecker
|
);
|
1952 |
|
|
|
1953 |
|
|
$form['taxon_tabs']['cdm_dataportal_taxonpage_tabs'] = array(
|
1954 |
|
|
'#type' => 'checkbox',
|
1955 |
|
|
'#title' => t('Tabbed taxon page'),
|
1956 |
|
|
'#default_value' => variable_get('cdm_dataportal_taxonpage_tabs', 1),
|
1957 |
423f5e58
|
Andreas Kohlbecker
|
'#description' => t('If enabled the sections of a taxon page will be displayed as individual tabs'),
|
1958 |
22383f95
|
Andreas Kohlbecker
|
);
|
1959 |
|
|
|
1960 |
|
|
$form['taxon_tabs'][CDM_SYNONYMY_AS_TAB] = array(
|
1961 |
|
|
'#type' => 'checkbox',
|
1962 |
|
|
'#title' => t('Synonymy as tab'),
|
1963 |
|
|
'#default_value' => variable_get(CDM_SYNONYMY_AS_TAB, CDM_SYNONYMY_AS_TAB_DEFAULT),
|
1964 |
|
|
'#description' => t('The synonymy can be moved to its own tab. This is only applicable when the tabbed taxon page option is activated.'),
|
1965 |
|
|
'#disabled' => variable_get('cdm_dataportal_taxonpage_tabs', 1) !== 1
|
1966 |
6657531f
|
Andreas Kohlbecker
|
);
|
1967 |
|
|
|
1968 |
|
|
$form['taxon_tabs']['cdm_taxonpage_tabs_visibility'] = array(
|
1969 |
|
|
'#type' => 'checkboxes',
|
1970 |
423f5e58
|
Andreas Kohlbecker
|
'#title' => t('Section/Tab visibility') . ':',
|
1971 |
6657531f
|
Andreas Kohlbecker
|
'#default_value' => variable_get('cdm_taxonpage_tabs_visibility', get_taxon_options_list()),
|
1972 |
423f5e58
|
Andreas Kohlbecker
|
'#options' => get_taxon_options_list()
|
1973 |
6657531f
|
Andreas Kohlbecker
|
);
|
1974 |
|
|
|
1975 |
b54cbda1
|
Andreas Kohlbecker
|
// WEIGHT
|
1976 |
4feeabc7
|
Andreas Kohlbecker
|
$taxon_tabs_weights = get_array_variable_merged(CDM_TAXONPAGE_TAB_WEIGHT, CDM_TAXONPAGE_TAB_WEIGHT_DEFAULT);
|
1977 |
|
|
$form['taxon_tabs'][CDM_TAXONPAGE_TAB_WEIGHT] = array(
|
1978 |
423f5e58
|
Andreas Kohlbecker
|
'#title' => 'Section/Tab order',
|
1979 |
2a61a296
|
Andreas Kohlbecker
|
'#type' => 'fieldset',
|
1980 |
|
|
'#collapsible' => false,
|
1981 |
4feeabc7
|
Andreas Kohlbecker
|
'#tree' => true,
|
1982 |
423f5e58
|
Andreas Kohlbecker
|
'#description' => 'The weight value defines the order of the section/tab.'
|
1983 |
b54cbda1
|
Andreas Kohlbecker
|
);
|
1984 |
|
|
// Weights range from -delta to +delta, so delta should be at least half
|
1985 |
|
|
// of the amount of tabs present.
|
1986 |
|
|
$tab_weight_delta = round(count(get_taxon_tabs_list()) / 2) + 1;
|
1987 |
|
|
foreach (get_taxon_tabs_list() as $label) {
|
1988 |
|
|
$key = strtolower($label); // turn in to string, since we need to use strings as keys
|
1989 |
4feeabc7
|
Andreas Kohlbecker
|
$form['taxon_tabs'][CDM_TAXONPAGE_TAB_WEIGHT][$key] = array(
|
1990 |
b54cbda1
|
Andreas Kohlbecker
|
'#title' => $label,
|
1991 |
|
|
'#type' => 'weight',
|
1992 |
4feeabc7
|
Andreas Kohlbecker
|
'#default_value' => $taxon_tabs_weights[$key],
|
1993 |
b54cbda1
|
Andreas Kohlbecker
|
'#delta' => $tab_weight_delta
|
1994 |
|
|
);
|
1995 |
|
|
}
|
1996 |
|
|
|
1997 |
4feeabc7
|
Andreas Kohlbecker
|
$taxon_tabs_labels = get_array_variable_merged(CDM_TAXONPAGE_TAB_LABELS, CDM_TAXONPAGE_TAB_LABELS_DEFAULT);
|
1998 |
|
|
$form['taxon_tabs'][CDM_TAXONPAGE_TAB_LABELS] = array(
|
1999 |
423f5e58
|
Andreas Kohlbecker
|
'#title' => 'Section/Tab label override',
|
2000 |
2a61a296
|
Andreas Kohlbecker
|
'#type' => 'fieldset',
|
2001 |
|
|
'#collapsible' => false,
|
2002 |
4feeabc7
|
Andreas Kohlbecker
|
'#tree' => true,
|
2003 |
423f5e58
|
Andreas Kohlbecker
|
'#description' => 'Setting a label for a section/tab will override the default label.
|
2004 |
93115722
|
Andreas Kohlbecker
|
Please enter the label text in the default language of the portal.'
|
2005 |
4feeabc7
|
Andreas Kohlbecker
|
);
|
2006 |
|
|
foreach (get_taxon_tabs_list() as $label) {
|
2007 |
|
|
$key = strtolower($label); // turn in to string, since we need to use strings as keys
|
2008 |
|
|
$form['taxon_tabs'][CDM_TAXONPAGE_TAB_LABELS][$key] = array(
|
2009 |
|
|
'#title' => $label,
|
2010 |
|
|
'#type' => 'textfield',
|
2011 |
|
|
'#default_value' => $taxon_tabs_labels[$key]
|
2012 |
|
|
);
|
2013 |
|
|
}
|
2014 |
|
|
|
2015 |
6657531f
|
Andreas Kohlbecker
|
$form['taxon_tabs']['cdm_dataportal_default_tab'] = array(
|
2016 |
|
|
'#type' => 'select',
|
2017 |
|
|
'#title' => t('Default tab to display') . ':',
|
2018 |
|
|
'#default_value' => variable_get('cdm_dataportal_default_tab', 0),
|
2019 |
|
|
'#options' => unserialize(CDM_DATAPORTAL_DEFAULT_TAXON_TAB),
|
2020 |
|
|
'#description' => t('<p>Select the default tab to display when visiting a
|
2021 |
|
|
taxon page. Only available if Tabbed Taxon Page is enable.</p>
|
2022 |
|
|
<strong>Note:</strong> After performing a search and clicking in any
|
2023 |
|
|
synonym, the taxon tab to be rendered will be the synonymy of the accepted
|
2024 |
|
|
taxon and not the above selected tab.'),
|
2025 |
|
|
);
|
2026 |
|
|
|
2027 |
|
|
/* ====== TAXON_PROFILE ====== */
|
2028 |
|
|
$form['taxon_profile'] = array(
|
2029 |
|
|
'#type' => 'fieldset',
|
2030 |
|
|
'#title' => t('Taxon profile (tab)'),
|
2031 |
9438ad3a
|
Andreas Kohlbecker
|
'#description' => t('<p>This section covers the settings related to the taxon
|
2032 |
6657531f
|
Andreas Kohlbecker
|
profile tab, also known as the <strong>"General"</strong> tab.</p>'),
|
2033 |
|
|
'#collapsible' => TRUE,
|
2034 |
6421984d
|
Andreas Kohlbecker
|
'#collapsed' => TRUE,
|
2035 |
6657531f
|
Andreas Kohlbecker
|
);
|
2036 |
|
|
|
2037 |
|
|
// ---- PROFILE PICTURE ----//
|
2038 |
9c92cd84
|
Andreas Kohlbecker
|
|
2039 |
|
|
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE] = array(
|
2040 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'fieldset',
|
2041 |
9c92cd84
|
Andreas Kohlbecker
|
'#tree' => TRUE,
|
2042 |
9438ad3a
|
Andreas Kohlbecker
|
'#title' => t('Taxon profile picture'),
|
2043 |
6657531f
|
Andreas Kohlbecker
|
'#collapsible' => TRUE,
|
2044 |
|
|
'#collapsed' => FALSE,
|
2045 |
9438ad3a
|
Andreas Kohlbecker
|
'#description' => t('This sections allows configuring the display of the so called taxon profile image which is displayed in the taxon profile tab.'),
|
2046 |
6657531f
|
Andreas Kohlbecker
|
);
|
2047 |
|
|
|
2048 |
9c92cd84
|
Andreas Kohlbecker
|
//FIXME migrate variables:
|
2049 |
|
|
// cdm_dataportal_show_default_image ---> CDM_TAXON_PROFILE_IMAGE['show']
|
2050 |
|
|
// FIXME
|
2051 |
9aff46e4
|
Andreas Kohlbecker
|
// enable file module in profile and in update,(a.kohlbecker, 4.9.2014: is this still an open issue?)
|
2052 |
9c92cd84
|
Andreas Kohlbecker
|
|
2053 |
|
|
$taxon_profile_image_settings = variable_get(CDM_TAXON_PROFILE_IMAGE, unserialize(CDM_TAXON_PROFILE_IMAGE_DEFAULT));
|
2054 |
9506fd1f
|
Andreas Kohlbecker
|
|
2055 |
9c92cd84
|
Andreas Kohlbecker
|
/*
|
2056 |
|
|
* 'show' => 1,
|
2057 |
|
|
* 'maxextend' => 184,
|
2058 |
053a92ec
|
Andreas Kohlbecker
|
* 'media_uri_query' => ''
|
2059 |
9c92cd84
|
Andreas Kohlbecker
|
* 'custom_placeholder_image_on' => 1,
|
2060 |
|
|
* 'custom_placeholder_image_fid' => ''
|
2061 |
|
|
*/
|
2062 |
|
|
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['show'] = array(
|
2063 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'checkbox',
|
2064 |
6421984d
|
Andreas Kohlbecker
|
'#title' => t('Enable profile picture'),
|
2065 |
|
|
'#description' => t('Show the profile picture.'),
|
2066 |
9c92cd84
|
Andreas Kohlbecker
|
'#default_value' => $taxon_profile_image_settings['show'],
|
2067 |
6657531f
|
Andreas Kohlbecker
|
);
|
2068 |
|
|
|
2069 |
9c92cd84
|
Andreas Kohlbecker
|
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['maxextend'] = array(
|
2070 |
d9c55e6c
|
Andreas Kohlbecker
|
'#type' => 'textfield',
|
2071 |
|
|
'#tree' => TRUE,
|
2072 |
6421984d
|
Andreas Kohlbecker
|
'#title' => t('Profile picture maximum extend'),
|
2073 |
9c92cd84
|
Andreas Kohlbecker
|
'#default_value' => $taxon_profile_image_settings['maxextend'],
|
2074 |
d9c55e6c
|
Andreas Kohlbecker
|
'#field_suffix' => 'px',
|
2075 |
|
|
'#maxlength' => 4,
|
2076 |
|
|
'#size' => 4,
|
2077 |
7cc085da
|
Andreas Kohlbecker
|
'#description' => t('The maximum extend in either dimension, width or height, of the profile picture in pixels.')
|
2078 |
d9c55e6c
|
Andreas Kohlbecker
|
);
|
2079 |
|
|
|
2080 |
053a92ec
|
Andreas Kohlbecker
|
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['media_uri_query'] = array(
|
2081 |
|
|
'#type' => 'textfield',
|
2082 |
|
|
'#tree' => TRUE,
|
2083 |
|
|
'#title' => t('Additional URI query parameter'),
|
2084 |
|
|
'#default_value' => $taxon_profile_image_settings['media_uri_query'],
|
2085 |
|
|
'#maxlength' => 1024,
|
2086 |
|
|
'#size' => 60,
|
2087 |
7cc085da
|
Andreas Kohlbecker
|
'#description' => t('Additional query parameters to be used when requesting for the
|
2088 |
|
|
profile image. E.g.: <code>width=400&height=300&quality=95&format=jpeg</code>.
|
2089 |
|
|
The query parameters will be appended to the uri of the media representation part
|
2090 |
|
|
as stored in the cdm. The query parameter string must not start with a \'&\' or \'?\'')
|
2091 |
053a92ec
|
Andreas Kohlbecker
|
);
|
2092 |
|
|
|
2093 |
ca47ea76
|
Andreas Kohlbecker
|
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['custom_placeholder_enabled'] = array(
|
2094 |
|
|
'#type' => 'checkbox',
|
2095 |
|
|
'#title' => t('Show the placeholder image'),
|
2096 |
792a9d48
|
Andreas Kohlbecker
|
'#description' => t("A placeholder image will be shown if no taxon profile picture is available."),
|
2097 |
ca47ea76
|
Andreas Kohlbecker
|
'#default_value' => $taxon_profile_image_settings['custom_placeholder_enabled']
|
2098 |
|
|
);
|
2099 |
|
|
|
2100 |
9c92cd84
|
Andreas Kohlbecker
|
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['custom_placeholder_image_on'] = array(
|
2101 |
|
|
'#type' => 'checkbox',
|
2102 |
|
|
'#title' => t('Use a custom placeholder image'),
|
2103 |
7df1be04
|
Andreas Kohlbecker
|
'#description' => t("This image is shown as replacement if no image of the taxon is available."),
|
2104 |
9c92cd84
|
Andreas Kohlbecker
|
'#default_value' => $taxon_profile_image_settings['custom_placeholder_image_on']
|
2105 |
7df1be04
|
Andreas Kohlbecker
|
);
|
2106 |
|
|
|
2107 |
9c92cd84
|
Andreas Kohlbecker
|
if($taxon_profile_image_settings['custom_placeholder_image_on'] == 1){
|
2108 |
|
|
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['custom_placeholder_image_fid'] = array(
|
2109 |
|
|
'#type' => 'managed_file',
|
2110 |
|
|
'#title' => t('Custom placeholder image file'),
|
2111 |
|
|
'#progress_indicator' => 'bar',
|
2112 |
|
|
'#default_value' => $taxon_profile_image_settings['custom_placeholder_image_fid'],
|
2113 |
|
|
// '#name' => 'custom_placeholder_image',
|
2114 |
|
|
'#upload_location' => 'public://' . CDM_TAXON_PROFILE_IMAGE .'/'
|
2115 |
|
|
);
|
2116 |
|
|
|
2117 |
|
|
if($taxon_profile_image_settings['custom_placeholder_image_fid']){
|
2118 |
|
|
$profile_image_file = file_load($taxon_profile_image_settings['custom_placeholder_image_fid']);
|
2119 |
|
|
$url = file_create_url($profile_image_file->uri);
|
2120 |
|
|
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['preview'] = array(
|
2121 |
|
|
'#type' => 'item',
|
2122 |
|
|
'#markup' => '<div class="image-preview"><img src="' . $url . '"/></div>',
|
2123 |
|
|
);
|
2124 |
|
|
}
|
2125 |
|
|
} else {
|
2126 |
|
|
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['custom_placeholder_image_fid'] = array(
|
2127 |
642b323b
|
Andreas Kohlbecker
|
'#type' => 'hidden',
|
2128 |
|
|
'#default_value' => $taxon_profile_image_settings['custom_placeholder_image_fid']
|
2129 |
9c92cd84
|
Andreas Kohlbecker
|
);
|
2130 |
|
|
}
|
2131 |
|
|
|
2132 |
2d3d6556
|
Andreas Kohlbecker
|
$options = cdm_vocabulary_as_option(UUID_RANK, null, true);
|
2133 |
6657531f
|
Andreas Kohlbecker
|
array_unshift($options, '-- DISABLED --');
|
2134 |
|
|
$form['taxon_profile']['picture']['image_hide_rank'] = array(
|
2135 |
|
|
'#type' => 'select',
|
2136 |
9438ad3a
|
Andreas Kohlbecker
|
'#title' => t('Hide profile picture for higher ranks') . ':',
|
2137 |
6657531f
|
Andreas Kohlbecker
|
'#default_value' => variable_get('image_hide_rank', '0'),
|
2138 |
|
|
'#options' => $options,
|
2139 |
9438ad3a
|
Andreas Kohlbecker
|
'#description' => t('The taxon profile picture will not be shown for taxa with rank higher that the selected.'),
|
2140 |
6657531f
|
Andreas Kohlbecker
|
);
|
2141 |
|
|
|
2142 |
|
|
// -- MEDIA THUMBNAILS -- //
|
2143 |
|
|
$form_name = CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME;
|
2144 |
|
|
$form_title = 'Taxon Profile Images';
|
2145 |
5358baff
|
Andreas Kohlbecker
|
$form_description = '<p>The different sections in the taxon profile can have images associated with them. These images are displayed in a gallery of thumbnails wich can be configuered here:</p>';
|
2146 |
6657531f
|
Andreas Kohlbecker
|
$form['taxon_profile'][] = cdm_dataportal_create_gallery_settings_form($form_name, $form_title, $collapsed, $form_description);
|
2147 |
|
|
|
2148 |
642b323b
|
Andreas Kohlbecker
|
// ---- FEATURE TREE BLOCKS ---- //
|
2149 |
|
|
$form['taxon_profile']['feature_blocks'] = array(
|
2150 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'fieldset',
|
2151 |
642b323b
|
Andreas Kohlbecker
|
'#title' => t('Feature Blocks'),
|
2152 |
6657531f
|
Andreas Kohlbecker
|
'#collapsible' => TRUE,
|
2153 |
|
|
'#collapsed' => FALSE,
|
2154 |
|
|
'#description' => t("This section covers settings related to the taxon's
|
2155 |
|
|
<em>Feature Tree</em>. The <em>feature tree</em> are the taxon's
|
2156 |
642b323b
|
Andreas Kohlbecker
|
features such as description, distribution, common names"),
|
2157 |
6657531f
|
Andreas Kohlbecker
|
);
|
2158 |
|
|
$featureTrees = cdm_get_featureTrees_as_options(TRUE);
|
2159 |
642b323b
|
Andreas Kohlbecker
|
$profile_feature_tree = get_profile_feature_tree();
|
2160 |
|
|
$profile_feature_tree_uuid = $profile_feature_tree->uuid;
|
2161 |
|
|
if(!isset($featureTrees['options'][$profile_feature_tree_uuid])) {
|
2162 |
|
|
$profile_feature_tree_uuid = UUID_DEFAULT_FEATURETREE;
|
2163 |
854e1d99
|
Andreas Kohlbecker
|
}
|
2164 |
642b323b
|
Andreas Kohlbecker
|
$form['taxon_profile']['feature_blocks'][CDM_PROFILE_FEATURETREE_UUID] = array(
|
2165 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'radios',
|
2166 |
642b323b
|
Andreas Kohlbecker
|
'#title' => t('Taxon profile feature tree') . ':',
|
2167 |
|
|
'#default_value' => $profile_feature_tree_uuid,
|
2168 |
6657531f
|
Andreas Kohlbecker
|
'#options' => $featureTrees['options'],
|
2169 |
3f485c6d
|
Andreas Kohlbecker
|
'#pre_render' => array('form_pre_render_conditional_form_element', 'radios_prepare_options_suffix'),
|
2170 |
|
|
'#options_suffixes' => $featureTrees['treeRepresentations'],
|
2171 |
642b323b
|
Andreas Kohlbecker
|
'#description' => t('The Feature Tree selected here define the feature blocks which are visible in the taxon
|
2172 |
|
|
profile page.'
|
2173 |
6657531f
|
Andreas Kohlbecker
|
),
|
2174 |
|
|
);
|
2175 |
|
|
|
2176 |
642b323b
|
Andreas Kohlbecker
|
// ---- FEATURE TREE BLOCKS > LAYOUT PER FEATURE BLOCK ---- //
|
2177 |
|
|
$profile_feature_tree = get_profile_feature_tree();
|
2178 |
|
|
|
2179 |
|
|
if (isset($profile_feature_tree->root->childNodes)) {
|
2180 |
6657531f
|
Andreas Kohlbecker
|
|
2181 |
642b323b
|
Andreas Kohlbecker
|
$form_feature_block_layout = array(
|
2182 |
|
|
'#type' => 'fieldset',
|
2183 |
|
|
'#tree' => true,
|
2184 |
|
|
'#title' => t('Taxon profile feature block settings'),
|
2185 |
6657531f
|
Andreas Kohlbecker
|
'#collapsible' => TRUE,
|
2186 |
|
|
'#collapsed' => FALSE,
|
2187 |
642b323b
|
Andreas Kohlbecker
|
'#description' => 'This section let\'s you define how each of the feature blocks is displayed.
|
2188 |
cd4f8f20
|
Andreas Kohlbecker
|
A sub form for each of the the currently selected feature tree allows to configure each feature block individually.
|
2189 |
642b323b
|
Andreas Kohlbecker
|
The subforms have the following settings in common:<br />
|
2190 |
|
|
<h6>List type:</h6><div>Whether the description elements are displayed as list or not. Three different list types are available</div>
|
2191 |
|
|
<h6>Link to reference:</h6><div>Render the reference as link, ignored if the element is NOT a DescriptionElementSource</div>
|
2192 |
a2196313
|
Andreas Kohlbecker
|
<h6>Link to name used in source:</h6><div>Whether to show name in source information as link which will point to the according name page</div>
|
2193 |
642b323b
|
Andreas Kohlbecker
|
<h6>Sources as content:</h6><div><strong>If enabled:</strong><br />
|
2194 |
|
|
<ol>
|
2195 |
a2196313
|
Andreas Kohlbecker
|
<li>If the element is a CDM TextData instance and if the text is not empty the source references will be
|
2196 |
642b323b
|
Andreas Kohlbecker
|
appended in brackets like "text (source references)". If the original source has name in source
|
2197 |
|
|
information it will be appended to the citation string,
|
2198 |
a2196313
|
Andreas Kohlbecker
|
like : "(citation-A, as name-in-source-A; citation-B, as name-in-source-B)"</li>
|
2199 |
642b323b
|
Andreas Kohlbecker
|
<li>if the text of the TextData is empty, the original source citations are the only content
|
2200 |
|
|
(e.g. use case CITATION) and are not put into brackets. In this case the nameInSource is
|
2201 |
|
|
prepended to the citation string like: "name in source: citation"</li>
|
2202 |
|
|
</ol>
|
2203 |
|
|
<strong>If disabled:</strong><br />
|
2204 |
|
|
Original sources are put into the bibliography(=references) pseudo feature block. If the original source
|
2205 |
|
|
citations are the only content, the resulting feature block content would only consist of footnotes.
|
2206 |
|
|
In this case the display of the respective feature block is suppressed.</div>
|
2207 |
|
|
</dl>
|
2208 |
|
|
<h6>Sources as content to bibliography:</h6><div>Only valid if <em>Sources as content</em> is enabled, will cause the sources to be also shown
|
2209 |
0686f307
|
Andreas Kohlbecker
|
in the bibliography. For this to work the bibliography must be enabled the <em>' .l(
|
2210 |
|
|
'Layout Settings', 'admin/config/cdm_dataportal/settings/layout', array('fragment'=>'edit-bibliography-for-original-source'))
|
2211 |
|
|
. '</em></div>
|
2212 |
642b323b
|
Andreas Kohlbecker
|
<h6>Sort elements:</h6><div>Whether and how to sort the elements
|
2213 |
|
|
possible values are the constants SORT_ASC, SORT_DESC, NULL,
|
2214 |
|
|
some feature types (Distribution) also support: SORT_HIERARCHICAL</div>
|
2215 |
|
|
<h6>Element tag:</h6><div>The tag to be used for creating the elements, only applies if "List type" is set to <em>No list</em>
|
2216 |
|
|
possible values are span or div. Developers: The proper inner tag name can be retrieved by the function
|
2217 |
b9e9f59b
|
Andreas Kohlbecker
|
cdm_feature_block_element_tag_name()</div>
|
2218 |
|
|
<h6>Element glue:</h6><div>This string is used to concatenate individual items together. The glue is ignored when the items are displayed
|
2219 |
|
|
as list.<b>NOTE:</b>The glue is not yet fully implemented for all features and thus may not work as expected, see '
|
2220 |
|
|
. l('#6831', 'https://dev.e-taxonomy.eu/redmine/issues/6831') . '</div>',
|
2221 |
6657531f
|
Andreas Kohlbecker
|
);
|
2222 |
|
|
|
2223 |
642b323b
|
Andreas Kohlbecker
|
|
2224 |
|
|
$feature_list_layout_settings_disabled = FALSE;
|
2225 |
8c962983
|
Andreas Kohlbecker
|
|
2226 |
|
|
// creating helper object to retrieve the default settings
|
2227 |
|
|
$featureNode = new stdClass();
|
2228 |
b011743c
|
Andreas Kohlbecker
|
$featureNode->term = new stdClass();
|
2229 |
|
|
$featureNode->term->uuid="DEFAULT";
|
2230 |
|
|
$featureNode->term->representation_L10n = "Default";
|
2231 |
8c962983
|
Andreas Kohlbecker
|
array_unshift($profile_feature_tree->root->childNodes, $featureNode);
|
2232 |
|
|
|
2233 |
642b323b
|
Andreas Kohlbecker
|
foreach ($profile_feature_tree->root->childNodes as $featureNode) {
|
2234 |
6657531f
|
Andreas Kohlbecker
|
|
2235 |
b011743c
|
Andreas Kohlbecker
|
if (!$feature_list_layout_settings_disabled && isset($featureNode->term)) {
|
2236 |
6657531f
|
Andreas Kohlbecker
|
|
2237 |
642b323b
|
Andreas Kohlbecker
|
// $subform_id must not exceed 45 characters, a uuid has 36 characters
|
2238 |
b011743c
|
Andreas Kohlbecker
|
$subform_id = $featureNode->term->uuid;
|
2239 |
|
|
$feature_block_setting = get_feature_block_settings($featureNode->term->uuid);
|
2240 |
6657531f
|
Andreas Kohlbecker
|
|
2241 |
642b323b
|
Andreas Kohlbecker
|
// $settings = mixed_variable_get($subform_id, FEATURE_TREE_LAYOUT_DEFAULTS);
|
2242 |
|
|
|
2243 |
|
|
$form_feature_block_layout[$subform_id] = array(
|
2244 |
|
|
'#type' => 'fieldset',
|
2245 |
6657531f
|
Andreas Kohlbecker
|
'#tree' => TRUE,
|
2246 |
b011743c
|
Andreas Kohlbecker
|
'#title' => $featureNode->term->representation_L10n,
|
2247 |
6657531f
|
Andreas Kohlbecker
|
'#collapsible' => FALSE,
|
2248 |
|
|
'#collapsed' => FALSE,
|
2249 |
|
|
);
|
2250 |
b011743c
|
Andreas Kohlbecker
|
if($featureNode->term->uuid == "DEFAULT"){
|
2251 |
8c962983
|
Andreas Kohlbecker
|
$form_feature_block_layout[$subform_id]['#description']='These are the defaults which apply to
|
2252 |
|
|
all feature blocks for which no specific settings have been defined. for consistency enabling links for <em>source
|
2253 |
|
|
references</em> and <em>names in source</em> is only possible in the defaults';
|
2254 |
|
|
}
|
2255 |
6657531f
|
Andreas Kohlbecker
|
|
2256 |
642b323b
|
Andreas Kohlbecker
|
$form_feature_block_layout[$subform_id]['as_list'] = array(
|
2257 |
|
|
'#type' => 'select',
|
2258 |
|
|
'#title' => 'List type',
|
2259 |
|
|
'#default_value' => $feature_block_setting['as_list'],
|
2260 |
|
|
'#options' => array(
|
2261 |
|
|
'div' => 'not as list',
|
2262 |
|
|
'ul' => 'bullet list',
|
2263 |
|
|
'ol' => 'numbered list',
|
2264 |
|
|
'dl' => 'definition list'
|
2265 |
|
|
),
|
2266 |
|
|
);
|
2267 |
|
|
|
2268 |
b011743c
|
Andreas Kohlbecker
|
if($featureNode->term->uuid == "DEFAULT"){
|
2269 |
8c962983
|
Andreas Kohlbecker
|
$form_feature_block_layout[$subform_id]['link_to_reference'] = array(
|
2270 |
|
|
'#type' => 'checkbox',
|
2271 |
|
|
'#title' => t('Link to reference'),
|
2272 |
|
|
'#default_value' => $feature_block_setting['link_to_reference'],
|
2273 |
|
|
);
|
2274 |
642b323b
|
Andreas Kohlbecker
|
|
2275 |
8c962983
|
Andreas Kohlbecker
|
$form_feature_block_layout[$subform_id]['link_to_name_used_in_source'] = array(
|
2276 |
|
|
'#type' => 'checkbox',
|
2277 |
|
|
'#title' => 'Link to name used in source',
|
2278 |
|
|
'#default_value' => $feature_block_setting['link_to_name_used_in_source'],
|
2279 |
|
|
);
|
2280 |
|
|
}
|
2281 |
6657531f
|
Andreas Kohlbecker
|
|
2282 |
642b323b
|
Andreas Kohlbecker
|
$form_feature_block_layout[$subform_id]['sources_as_content'] = array(
|
2283 |
|
|
'#type' => 'checkbox',
|
2284 |
|
|
'#title' => 'Sources as content',
|
2285 |
|
|
'#default_value' => $feature_block_setting['sources_as_content'],
|
2286 |
6657531f
|
Andreas Kohlbecker
|
);
|
2287 |
|
|
|
2288 |
642b323b
|
Andreas Kohlbecker
|
$form_feature_block_layout[$subform_id]['sources_as_content_to_bibliography'] = array(
|
2289 |
|
|
'#type' => 'checkbox',
|
2290 |
8c962983
|
Andreas Kohlbecker
|
'#title' => 'Put sources also as content to bibliography',
|
2291 |
642b323b
|
Andreas Kohlbecker
|
'#default_value' => $feature_block_setting['sources_as_content_to_bibliography'],
|
2292 |
6657531f
|
Andreas Kohlbecker
|
);
|
2293 |
|
|
|
2294 |
642b323b
|
Andreas Kohlbecker
|
$form_feature_block_layout[$subform_id]['sort_elements'] = array(
|
2295 |
|
|
'#type' => 'select',
|
2296 |
|
|
'#title' => t('Sort elements'),
|
2297 |
|
|
'#default_value' => $feature_block_setting['sort_elements'],
|
2298 |
|
|
'#options' => array(
|
2299 |
|
|
NO_SORT => 'No sorting',
|
2300 |
|
|
SORT_ASC => 'Ascending',
|
2301 |
|
|
SORT_DESC => 'Descending',
|
2302 |
3eccfdb9
|
Andreas Kohlbecker
|
SORT_HIERARCHICAL => 'Hierarchical'
|
2303 |
642b323b
|
Andreas Kohlbecker
|
),
|
2304 |
3eccfdb9
|
Andreas Kohlbecker
|
'#description' => 'NOT YET FULLY USED! only in preparation (works partially for distributions)
|
2305 |
|
|
<dl>
|
2306 |
|
|
<dr><dt>No sorting</dt><dd>Sorting undefined</dd></dr>
|
2307 |
|
|
<dr><dt>Ascending</dt><dd>Alphabetically in ascending order</dd></dr>
|
2308 |
|
|
<dr><dt>Descending</dt><dd>Alphabetically in descending order</dd></dr>
|
2309 |
|
|
<dr><dt>Hierarchical</dt><dd>Use the order of items and their hierarchy. This is not possible for all feature and item types.</dd></dr>
|
2310 |
|
|
</dl>',
|
2311 |
6657531f
|
Andreas Kohlbecker
|
);
|
2312 |
|
|
|
2313 |
642b323b
|
Andreas Kohlbecker
|
$form_feature_block_layout[$subform_id]['element_tag'] = array(
|
2314 |
|
|
'#type' => 'select',
|
2315 |
|
|
'#title' => t('Element tag'),
|
2316 |
|
|
'#options' => array(
|
2317 |
|
|
'span' => 'span',
|
2318 |
29f63b48
|
Andreas Kohlbecker
|
'div' => 'div',
|
2319 |
|
|
'p' => 'p'
|
2320 |
642b323b
|
Andreas Kohlbecker
|
),
|
2321 |
|
|
'#default_value' => $feature_block_setting['element_tag'],
|
2322 |
|
|
);
|
2323 |
b9e9f59b
|
Andreas Kohlbecker
|
$form_feature_block_layout[$subform_id]['glue'] = array(
|
2324 |
|
|
'#type' => 'textfield',
|
2325 |
|
|
'#title' => t('Element glue'),
|
2326 |
|
|
'#default_value' => $feature_block_setting['glue'],
|
2327 |
|
|
'#size' => 10
|
2328 |
|
|
);
|
2329 |
|
|
|
2330 |
6657531f
|
Andreas Kohlbecker
|
}
|
2331 |
642b323b
|
Andreas Kohlbecker
|
$form['taxon_profile']['feature_blocks'][FEATURE_BLOCK_SETTINGS] = $form_feature_block_layout;
|
2332 |
6657531f
|
Andreas Kohlbecker
|
}
|
2333 |
|
|
}
|
2334 |
|
|
|
2335 |
642b323b
|
Andreas Kohlbecker
|
// ---- STRUCTURED DESCRIPTION FEATURE TREE ---- //
|
2336 |
|
|
$form['taxon_profile']['structured_description_featuretree'] = array(
|
2337 |
|
|
'#type' => 'fieldset',
|
2338 |
|
|
'#title' => t('Structured Description Feature Tree'),
|
2339 |
|
|
'#collapsible' => TRUE,
|
2340 |
|
|
'#collapsed' => FALSE,
|
2341 |
|
|
);
|
2342 |
|
|
$featureTrees = cdm_get_featureTrees_as_options();
|
2343 |
|
|
$profile_feature_tree_uuid = variable_get(CDM_DATAPORTAL_STRUCTURED_DESCRIPTION_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE);
|
2344 |
|
|
if(!isset($featureTrees['options'][$profile_feature_tree_uuid])) {
|
2345 |
|
|
$profile_feature_tree_uuid = NULL;
|
2346 |
|
|
}
|
2347 |
|
|
$form['taxon_profile']['structured_description_featuretree'][CDM_DATAPORTAL_STRUCTURED_DESCRIPTION_FEATURETREE_UUID] = array(
|
2348 |
|
|
'#type' => 'radios',
|
2349 |
|
|
'#title' => t('Natural language representation of structured descriptions') . ':',
|
2350 |
|
|
'#default_value' => $profile_feature_tree_uuid,
|
2351 |
|
|
'#options' => $featureTrees['options'],
|
2352 |
|
|
'#pre_render' => array('form_pre_render_conditional_form_element', 'radios_prepare_options_suffix'),
|
2353 |
|
|
'#options_suffixes' => $featureTrees['treeRepresentations'],
|
2354 |
|
|
'#description' => t('Taxon descriptions can be stored in a highly structured
|
2355 |
|
|
form. The feature tree selected here will be used to generate textual
|
2356 |
|
|
representation in natural language.'
|
2357 |
|
|
),
|
2358 |
|
|
);
|
2359 |
|
|
|
2360 |
|
|
|
2361 |
|
|
|
2362 |
6657531f
|
Andreas Kohlbecker
|
// ---- DISTRIBUTION LAYOUT ---- //
|
2363 |
|
|
$form['taxon_profile']['distribution_layout'] = array(
|
2364 |
|
|
'#title' => t('Distribution'),
|
2365 |
|
|
'#collapsible' => TRUE,
|
2366 |
|
|
'#collapsed' => FALSE,
|
2367 |
|
|
'#type' => 'fieldset',
|
2368 |
378bc1ce
|
Andreas Kohlbecker
|
'#description' => 'This section covers general settings regarding the textual representation of distributions and the visibility of the map.
|
2369 |
|
|
Map settings regarding the geometry, layers, etc are found in the '
|
2370 |
562a6ac4
|
Andreas Kohlbecker
|
. l('geo & map tab', 'admin/config/cdm_dataportal/settings/geo') .
|
2371 |
|
|
'. Further settings regarding the distribution feature block can be found in above in this tab at '
|
2372 |
|
|
. l(
|
2373 |
|
|
'Taxon profile feature block settings', 'admin/config/cdm_dataportal/settings/layout/taxon',
|
2374 |
|
|
array('fragment' => 'edit-feature-block-settings')
|
2375 |
|
|
)
|
2376 |
|
|
. ' More general settings regrading the filtering of Distributions are found at '
|
2377 |
|
|
. l('Distribution appearance', 'admin/config/cdm_dataportal/settings', array('fragment' => 'edit-distribution'))
|
2378 |
|
|
. '. (These settings here will be merged in future releases into the feature block settings)',
|
2379 |
|
|
|
2380 |
6657531f
|
Andreas Kohlbecker
|
);
|
2381 |
|
|
|
2382 |
378bc1ce
|
Andreas Kohlbecker
|
$form['taxon_profile']['distribution_layout'][DISTRIBUTION_MAP_VISIBILITY] = _cdm_map_visibility_setting('distribution');
|
2383 |
|
|
|
2384 |
bda17f32
|
Andreas Kohlbecker
|
$form['taxon_profile']['distribution_layout'][DISTRIBUTION_CONDENSED] = array(
|
2385 |
|
|
'#type' => 'checkbox',
|
2386 |
|
|
'#title' => t('Condensed distribution'),
|
2387 |
|
|
'#default_value' => variable_get(DISTRIBUTION_CONDENSED, 0),
|
2388 |
|
|
'#description' => 'This option enables the display of a very compact representation
|
2389 |
|
|
of the distribution which includes also information on the status.',
|
2390 |
|
|
);
|
2391 |
|
|
|
2392 |
846c0606
|
Andreas Kohlbecker
|
$form['taxon_profile']['distribution_layout'][DISTRIBUTION_CONDENSED_RECIPE] = array(
|
2393 |
|
|
'#type' => 'select',
|
2394 |
|
|
'#title' => t('Condensed distribution recipe'),
|
2395 |
|
|
'#default_value' => variable_get(DISTRIBUTION_CONDENSED_RECIPE, DISTRIBUTION_CONDENSED_RECIPE_DEFAULT),
|
2396 |
|
|
'#options' => array('EuroPlusMed' => 'Euro+Med', 'FloraCuba' => 'Flora of Cuba'),
|
2397 |
|
|
'#description' => 'Recipe for creating the condensed distribution.',
|
2398 |
|
|
);
|
2399 |
|
|
|
2400 |
6858b474
|
Andreas Kohlbecker
|
$form['taxon_profile']['distribution_layout'][DISTRIBUTION_CONDENSED_INFO_PATH] = array(
|
2401 |
|
|
'#type' => 'textfield',
|
2402 |
|
|
'#title' => t('Condensed distribution info path'),
|
2403 |
|
|
'#default_value' => variable_get(DISTRIBUTION_CONDENSED_INFO_PATH, DISTRIBUTION_CONDENSED_INFO_PATH_DEFAULT),
|
2404 |
|
|
'#description' => 'By default the help page ' .l(DISTRIBUTION_CONDENSED_INFO_PATH_DEFAULT, DISTRIBUTION_CONDENSED_INFO_PATH_DEFAULT)
|
2405 |
|
|
. ' is used as target for the info link which is shown at the end of the condensed distribution string.',
|
2406 |
|
|
);
|
2407 |
|
|
|
2408 |
bda17f32
|
Andreas Kohlbecker
|
|
2409 |
f5bc56a0
|
Andreas Kohlbecker
|
$form['taxon_profile']['distribution_layout'][DISTRIBUTION_ORDER_MODE] = array(
|
2410 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'radios',
|
2411 |
c359043a
|
Andreas Kohlbecker
|
'#title' => t('Display mode') . ':',
|
2412 |
97ac3d38
|
Andreas Kohlbecker
|
'#default_value' => variable_get(DISTRIBUTION_ORDER_MODE, DISTRIBUTION_ORDER_MODE_DEFAULT),
|
2413 |
6657531f
|
Andreas Kohlbecker
|
'#options' => array(
|
2414 |
f5bc56a0
|
Andreas Kohlbecker
|
'FLAT_ALPHA' => t('Flat list'),
|
2415 |
|
|
'TREE' => t('Hierarchically ordered'),
|
2416 |
6657531f
|
Andreas Kohlbecker
|
),
|
2417 |
0eef1621
|
Andreas Kohlbecker
|
'#description' => 'Taxon distribution information is displayed with
|
2418 |
f5bc56a0
|
Andreas Kohlbecker
|
focus on the area of the distribution. The list of areas can either be shown
|
2419 |
0eef1621
|
Andreas Kohlbecker
|
as flat list ordered alphabetically or in the hierarchical of the parent
|
2420 |
|
|
area and subarea relationship. Fall back areas areas with no Distribution data
|
2421 |
|
|
are hidden from the area hierarchy so that their sub areas will move one level up.
|
2422 |
|
|
See ' . l('Distribution appearance', 'admin/config/cdm_dataportal/settings', array('fragment' => 'edit-distribution')) .
|
2423 |
40420110
|
Andreas Kohlbecker
|
' for details on the <em>Marked area filter</em>.',
|
2424 |
6657531f
|
Andreas Kohlbecker
|
);
|
2425 |
|
|
|
2426 |
38dd933d
|
Andreas Kohlbecker
|
$form['taxon_profile']['distribution_layout'][DISTRIBUTION_HIERARCHY_STYLE] = array(
|
2427 |
|
|
'#type' => 'fieldset',
|
2428 |
|
|
'#tree' => true,
|
2429 |
|
|
'#title' => t('Distribution hierarchy style')
|
2430 |
|
|
);
|
2431 |
|
|
|
2432 |
|
|
$hierarchy_styles = get_array_variable_merged(DISTRIBUTION_HIERARCHY_STYLE, DISTRIBUTION_HIERARCHY_STYLE_DEFAULT);
|
2433 |
|
|
foreach(array_keys($hierarchy_styles) as $level) {
|
2434 |
|
|
$form['taxon_profile']['distribution_layout'][DISTRIBUTION_HIERARCHY_STYLE][$level] = array(
|
2435 |
|
|
'#type' => 'fieldset',
|
2436 |
|
|
'#tree' => true,
|
2437 |
7cc085da
|
Andreas Kohlbecker
|
'#title' => t('@area-level', array('@area-level' => drupal_ucfirst((str_replace('_', ' ', $level))))),
|
2438 |
38dd933d
|
Andreas Kohlbecker
|
'#attributes' => array('class' => array('fieldset-float'))
|
2439 |
|
|
);
|
2440 |
|
|
foreach ($hierarchy_styles[$level] as $key => $value) {
|
2441 |
|
|
$form['taxon_profile']['distribution_layout'][DISTRIBUTION_HIERARCHY_STYLE][$level][$key] = array(
|
2442 |
|
|
'#type' => 'textfield',
|
2443 |
7cc085da
|
Andreas Kohlbecker
|
'#title' => t('@area-level-style', array('@area-level-style' => drupal_ucfirst((str_replace('_', ' ', $key))))),
|
2444 |
38dd933d
|
Andreas Kohlbecker
|
'#default_value' => $hierarchy_styles[$level][$key],
|
2445 |
|
|
'#maxlength' => 4,
|
2446 |
|
|
'#size' => 4
|
2447 |
|
|
);
|
2448 |
|
|
}
|
2449 |
|
|
}
|
2450 |
|
|
|
2451 |
b3b63fc8
|
Andreas Kohlbecker
|
$level_options = cdm_vocabulary_as_option(UUID_NAMED_AREA_LEVEL, NULL, FALSE, NULL, CDM_ORDER_BY_ORDER_INDEX_ASC);
|
2452 |
f5bc56a0
|
Andreas Kohlbecker
|
$form['taxon_profile']['distribution_layout'][DISTRIBUTION_TREE_OMIT_LEVELS] = array(
|
2453 |
|
|
'#type' => 'checkboxes',
|
2454 |
|
|
'#title' => 'Omit area levels',
|
2455 |
|
|
'#options' => $level_options,
|
2456 |
|
|
'#default_value' => variable_get(DISTRIBUTION_TREE_OMIT_LEVELS, array()),
|
2457 |
284fb36d
|
Andreas Kohlbecker
|
'#description' => 'This option ins only applicable when distributions are hierachically orderd (see option above)!
|
2458 |
|
|
Areas which belong to the selected area levels will be hidden in the portal.',
|
2459 |
f5bc56a0
|
Andreas Kohlbecker
|
);
|
2460 |
|
|
|
2461 |
6657531f
|
Andreas Kohlbecker
|
$form['taxon_profile']['distribution_layout'][DISTRIBUTION_TEXTDATA_DISPLAY_ON_TOP] = array(
|
2462 |
|
|
'#type' => 'checkbox',
|
2463 |
|
|
'#title' => t('Show TextData elements on top of the map'),
|
2464 |
|
|
'#default_value' => variable_get(DISTRIBUTION_TEXTDATA_DISPLAY_ON_TOP, 0),
|
2465 |
|
|
'#description' => t('Check this if you want to appear all <code>TextData</code>
|
2466 |
|
|
elements on top of the map. Otherwise all <code>TextData</code>
|
2467 |
|
|
distribution elements will be listed below the other area elements.
|
2468 |
|
|
This option is useful if you need to have descriptive texts for each
|
2469 |
|
|
distribution map.'),
|
2470 |
|
|
);
|
2471 |
|
|
|
2472 |
c6ee8193
|
Andreas Kohlbecker
|
$form['taxon_profile'][DISTRIBUTION_STATUS_COLORS] = array(
|
2473 |
|
|
'#type' => 'textarea',
|
2474 |
|
|
'#title' => t('Custom status colors'),
|
2475 |
|
|
'#element_validate' => array('form_element_validate_json'),
|
2476 |
|
|
'#default_value' => variable_get(DISTRIBUTION_STATUS_COLORS, ''),
|
2477 |
|
|
'#description' => t('<strong>EXPERIMENTAL!</strong><br/>This may be changed in the next release without notification.
|
2478 |
|
|
A json map object with StatusTerm.idInVocabulary as key and a hex color as value. e.g: <code>{"n":"#ff0000","p":"#00ff00"}</code>.
|
2479 |
eb961cb9
|
Andreas Kohlbecker
|
reference list of the idInVocabulary values of absence and presence terms:
|
2480 |
c6ee8193
|
Andreas Kohlbecker
|
<pre>
|
2481 |
eb961cb9
|
Andreas Kohlbecker
|
Presence Term
|
2482 |
|
|
p present
|
2483 |
|
|
pd present: doubtfully present
|
2484 |
|
|
n native
|
2485 |
|
|
nq native: presence questionable
|
2486 |
|
|
nd native: doubtfully native
|
2487 |
|
|
c cultivated
|
2488 |
|
|
i introduced
|
2489 |
|
|
iq introduced: presence questionable
|
2490 |
|
|
id introduced: doubtfully introduced (perhaps cultivated only)
|
2491 |
|
|
ip introduced: uncertain degree of naturalisation
|
2492 |
|
|
ia introduced: adventitious (casual)
|
2493 |
|
|
in introduced: naturalized
|
2494 |
|
|
ic introduced: cultivated
|
2495 |
|
|
e endemic for the relevant area
|
2496 |
|
|
na naturalised
|
2497 |
|
|
iv invasive
|
2498 |
|
|
|
2499 |
|
|
AbsenceTerm
|
2500 |
|
|
a absent
|
2501 |
|
|
f reported in error
|
2502 |
|
|
nf native: reported in error
|
2503 |
|
|
if introduced: reported in error
|
2504 |
|
|
cf cultivated: reported in error
|
2505 |
|
|
ne native: formerly native
|
2506 |
|
|
ie introduced: formerly introduced
|
2507 |
|
|
|
2508 |
c6ee8193
|
Andreas Kohlbecker
|
</pre>'),
|
2509 |
|
|
);
|
2510 |
|
|
|
2511 |
6657531f
|
Andreas Kohlbecker
|
|
2512 |
|
|
/* ====== SYNONYMY ====== */
|
2513 |
|
|
$form['taxon_synonymy'] = array(
|
2514 |
|
|
'#type' => 'fieldset',
|
2515 |
|
|
'#title' => t('Taxon synonymy (tab)'),
|
2516 |
|
|
'#collapsible' => TRUE,
|
2517 |
|
|
'#collapsed' => TRUE,
|
2518 |
|
|
'#description' => t('This section covers the settings related to the taxon
|
2519 |
501347df
|
Andreas Kohlbecker
|
<strong>synonymy</strong> tab.'),
|
2520 |
6657531f
|
Andreas Kohlbecker
|
);
|
2521 |
|
|
|
2522 |
|
|
$form['taxon_synonymy']['cdm_dataportal_nomref_in_title'] = array(
|
2523 |
|
|
'#type' => 'checkbox',
|
2524 |
1cda248c
|
Andreas Kohlbecker
|
'#title' => t('Accepted taxon on top of the synonymy'),
|
2525 |
6657531f
|
Andreas Kohlbecker
|
'#default_value' => variable_get('cdm_dataportal_nomref_in_title', CDM_DATAPORTAL_NOMREF_IN_TITLE),
|
2526 |
|
|
'#description' => t('If checked, the first homotypic taxon is a repetition
|
2527 |
1cda248c
|
Andreas Kohlbecker
|
of the accepted taxon most likely with the full nomenclatural reference,
|
2528 |
|
|
depending on the ' . l('Name render templates', 'admin/config/cdm_dataportal/settings/layout') . '.'),
|
2529 |
6657531f
|
Andreas Kohlbecker
|
);
|
2530 |
|
|
|
2531 |
1cda248c
|
Andreas Kohlbecker
|
$form['taxon_synonymy'][CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE] = array(
|
2532 |
|
|
'#type' => 'checkbox',
|
2533 |
|
|
'#title' => t('Secundum referenence as separate line above the accepted taxon.'),
|
2534 |
|
|
'#default_value' => variable_get(CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE, 0),
|
2535 |
|
|
'#description' => t('You may want to remove the <code>"secReferencePart": true,</code> entry from <code>"accepted_taxon.taxon_page_synonymy"{</code> the in the '
|
2536 |
|
|
. l('Name render templates', 'admin/config/cdm_dataportal/settings/layout')
|
2537 |
|
|
. ' (Only applicable when the "Show accepted taxon on top of the synonymy" option above is enabled.)'),
|
2538 |
|
|
'#disabled' => !variable_get('cdm_dataportal_nomref_in_title', CDM_DATAPORTAL_NOMREF_IN_TITLE)
|
2539 |
|
|
);
|
2540 |
|
|
|
2541 |
|
|
$form['taxon_synonymy'][CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL] = array(
|
2542 |
|
|
'#type' => 'textfield',
|
2543 |
|
|
'#description' => 'Label for the secundum referenence.',
|
2544 |
|
|
'#default_value' => variable_get(CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL, CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL_DEFAULT),
|
2545 |
|
|
'#disabled' => !variable_get('cdm_dataportal_nomref_in_title', 0)
|
2546 |
|
|
);
|
2547 |
|
|
|
2548 |
6657531f
|
Andreas Kohlbecker
|
$form['taxon_synonymy']['cdm_dataportal_display_is_accepted_for'] = array(
|
2549 |
|
|
'#type' => 'checkbox',
|
2550 |
|
|
'#title' => t('Display <em>is accepted for ...</em> on taxon pages when
|
2551 |
|
|
coming from a synonym link.'),
|
2552 |
|
|
'#default_value' => variable_get('cdm_dataportal_display_is_accepted_for', CDM_DATAPORTAL_DISPLAY_IS_ACCEPTED_FOR),
|
2553 |
|
|
'#description' => t('Check this if after doing a search and clicking on a
|
2554 |
|
|
synonym you want to see the "accept of" text for the accepted synonym.'),
|
2555 |
|
|
);
|
2556 |
|
|
|
2557 |
6421984d
|
Andreas Kohlbecker
|
$form['taxon_synonymy']['taxon_relations'] = array(
|
2558 |
|
|
'#type' => 'fieldset',
|
2559 |
|
|
'#title' => t('Taxon relationships'),
|
2560 |
|
|
'#collapsible' => FALSE,
|
2561 |
|
|
'#collapsed' => FALSE
|
2562 |
|
|
);
|
2563 |
|
|
|
2564 |
|
|
$form['taxon_synonymy']['taxon_relations'][CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS] = array(
|
2565 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'checkbox',
|
2566 |
|
|
'#title' => t('Show taxon relations ships of accepted taxon'),
|
2567 |
|
|
'#default_value' => variable_get(CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT),
|
2568 |
|
|
'#description' => t('If this option is enabled the synonymy will show the
|
2569 |
|
|
below selected taxon relationships of accepted taxa.'),
|
2570 |
|
|
);
|
2571 |
|
|
|
2572 |
eafb60f0
|
Andreas Kohlbecker
|
$taxon_relationship_type_options = cdm_vocabulary_as_option(UUID_TAXON_RELATIONSHIP_TYPE, '_cdm_relationship_type_term_label_callback');
|
2573 |
|
|
$taxon_relationship_type_defaults = variable_get(CDM_TAXON_RELATIONSHIP_TYPES, unserialize(CDM_TAXON_RELATIONSHIP_TYPES_DEFAULT));
|
2574 |
6421984d
|
Andreas Kohlbecker
|
$form['taxon_synonymy']['taxon_relations'][CDM_TAXON_RELATIONSHIP_TYPES] = array(
|
2575 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'checkboxes',
|
2576 |
|
|
'#title' => t('Taxon relationship types') . ':',
|
2577 |
cd4f8f20
|
Andreas Kohlbecker
|
'#description' => 'Only taxon relationships of the selected type will be displayed',
|
2578 |
eafb60f0
|
Andreas Kohlbecker
|
'#options' => $taxon_relationship_type_options,
|
2579 |
|
|
'#default_value' => $taxon_relationship_type_defaults,
|
2580 |
6657531f
|
Andreas Kohlbecker
|
'#disabled' => !variable_get(CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT),
|
2581 |
|
|
);
|
2582 |
|
|
|
2583 |
6421984d
|
Andreas Kohlbecker
|
$form['taxon_synonymy']['name_relations'] = array(
|
2584 |
|
|
'#type' => 'fieldset',
|
2585 |
|
|
'#title' => t('Name relationships'),
|
2586 |
|
|
'#collapsible' => FALSE,
|
2587 |
|
|
'#collapsed' => FALSE
|
2588 |
|
|
);
|
2589 |
|
|
|
2590 |
cd4f8f20
|
Andreas Kohlbecker
|
$name_relationship_type_options = cdm_vocabulary_as_option(
|
2591 |
|
|
UUID_NAME_RELATIONSHIP_TYPE,
|
2592 |
1636cc86
|
Andreas Kohlbecker
|
'_cdm_relationship_type_term_label_callback',
|
2593 |
cd4f8f20
|
Andreas Kohlbecker
|
false,
|
2594 |
|
|
array('uuid' => '/' .UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM . '|'
|
2595 |
|
|
. UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM . '|'
|
2596 |
1636cc86
|
Andreas Kohlbecker
|
. UUID_NAMERELATIONSHIPTYPE_CONSERVED_AGAINST . '|'
|
2597 |
23a017dd
|
Andreas Kohlbecker
|
. UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR . '|'
|
2598 |
7efd13a9
|
Andreas Kohlbecker
|
. UUID_NAMERELATIONSHIPTYPE_MISSPELLING . '|'
|
2599 |
23a017dd
|
Andreas Kohlbecker
|
. UUID_NAMERELATIONSHIPTYPE_ORTHOGRAPHIC_VARIANT . '/' )
|
2600 |
cd4f8f20
|
Andreas Kohlbecker
|
);
|
2601 |
ef686dd8
|
Andreas Kohlbecker
|
$form['taxon_synonymy']['name_relations'][CDM_NAME_RELATIONSHIP_INLINE_TYPES] = array(
|
2602 |
6421984d
|
Andreas Kohlbecker
|
'#type' => 'checkboxes',
|
2603 |
|
|
'#title' => t('Name relationship types') . ':',
|
2604 |
cd4f8f20
|
Andreas Kohlbecker
|
'#description' => 'This setting only affects specific types of name relations which are displayed appended to scientific name.
|
2605 |
|
|
A full listing of all name relationships for a scientific name is provided by the taxon ' . l('name page', 'admin/config/cdm_dataportal/settings/layout/name-page') . '.',
|
2606 |
eafb60f0
|
Andreas Kohlbecker
|
'#options' => $name_relationship_type_options,
|
2607 |
ef686dd8
|
Andreas Kohlbecker
|
'#default_value' => variable_get(CDM_NAME_RELATIONSHIP_INLINE_TYPES, unserialize(CDM_NAME_RELATIONSHIP_INLINE_TYPES_DEFAULT)),
|
2608 |
6421984d
|
Andreas Kohlbecker
|
);
|
2609 |
|
|
|
2610 |
6657531f
|
Andreas Kohlbecker
|
// ====== SPECIMENS ====== //
|
2611 |
|
|
$form['taxon_specimens'] = array(
|
2612 |
|
|
'#type' => 'fieldset',
|
2613 |
|
|
'#title' => t('Taxon specimens (tab)'),
|
2614 |
|
|
'#collapsible' => TRUE,
|
2615 |
|
|
'#collapsed' => TRUE,
|
2616 |
|
|
'#description' => t('This section covers the settings related to the taxon
|
2617 |
|
|
<strong>specimens</strong> tab.'),
|
2618 |
|
|
);
|
2619 |
|
|
|
2620 |
378bc1ce
|
Andreas Kohlbecker
|
$form['taxon_specimens'][SPECIMEN_MAP_VISIBILITY] = _cdm_map_visibility_setting('specimen');
|
2621 |
|
|
|
2622 |
|
|
$form['taxon_specimens']['cdm_dataportal_compressed_specimen_derivate_table'] = array(
|
2623 |
|
|
'#type' => 'checkbox',
|
2624 |
|
|
'#title' => t('Show specimen derivatives in a compressed table'),
|
2625 |
|
|
'#default_value' => variable_get('cdm_dataportal_compressed_specimen_derivate_table', CDM_DATAPORTAL_COMPRESSED_SPECIMEN_DERIVATE_TABLE),
|
2626 |
|
|
'#description' => t('If checked, the specimen will be listed in a table. Every row represents
|
2627 |
|
|
a collection and it can be expanded to get an overview of the specimens and their derivates.'),
|
2628 |
|
|
);
|
2629 |
|
|
|
2630 |
09f028e2
|
Andreas Kohlbecker
|
$form['taxon_specimens']['cdm_dataportal_compressed_specimen_derivate_table_page_size'] = array(
|
2631 |
|
|
'#type' => 'textfield',
|
2632 |
|
|
'#title' => t('Number of records per page') . ':',
|
2633 |
|
|
'#default_value' => variable_get('cdm_dataportal_compressed_specimen_derivate_table_page_size', CDM_DATAPORTAL_COMPRESSED_SPECIMEN_DERIVATE_TABLE_PAGE_SIZE),
|
2634 |
378bc1ce
|
Andreas Kohlbecker
|
);
|
2635 |
1ce9afb7
|
Patric Plitzner
|
|
2636 |
276f39f6
|
Katja Luther
|
$form['taxon_specimens']['cdm_dataportal_specimen_derivate_tree'] = array(
|
2637 |
|
|
'#type' => 'checkbox',
|
2638 |
|
|
'#title' => t('Show specimen derivatives in a tree view'),
|
2639 |
|
|
'#default_value' => variable_get('cdm_dataportal_specimen_derivate_tree', CDM_DATAPORTAL_SPECIMEN_DERIVATE_TREE),
|
2640 |
|
|
'#description' => t('If checked, the specimen will be listed in a tree view.'),
|
2641 |
|
|
);
|
2642 |
|
|
|
2643 |
|
|
|
2644 |
|
|
$featureTrees = cdm_get_featureTrees_as_options(TRUE);
|
2645 |
642b323b
|
Andreas Kohlbecker
|
$profile_feature_tree_uuid = variable_get(CDM_OCCURRENCE_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE);
|
2646 |
|
|
if(!isset($featureTrees['options'][$profile_feature_tree_uuid])) {
|
2647 |
|
|
$profile_feature_tree_uuid = UUID_DEFAULT_FEATURETREE;
|
2648 |
f19f47fa
|
Andreas Kohlbecker
|
}
|
2649 |
|
|
$form['taxon_specimens']['feature_trees'][CDM_OCCURRENCE_FEATURETREE_UUID] = array(
|
2650 |
378bc1ce
|
Andreas Kohlbecker
|
'#type' => 'radios',
|
2651 |
|
|
'#title' => t('Specimen description feature tree') . ':',
|
2652 |
|
|
'#default_value' => $profile_feature_tree_uuid,
|
2653 |
|
|
'#options' => $featureTrees['options'],
|
2654 |
|
|
'#pre_render' => array('form_pre_render_conditional_form_element', 'radios_prepare_options_suffix'),
|
2655 |
|
|
'#options_suffixes' => $featureTrees['treeRepresentations'],
|
2656 |
|
|
'#description' => t('Select the feature tree to be used for displaying specimen descriptions. Click "Show Details" to see the Feature Tree elements.'
|
2657 |
|
|
),
|
2658 |
bfb2b81a
|
Andreas Kohlbecker
|
);
|
2659 |
|
|
|
2660 |
6657531f
|
Andreas Kohlbecker
|
$form_name = CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME;
|
2661 |
|
|
$form_title = t('Specimen media');
|
2662 |
|
|
$form_description = t('Specimens may have media which is displayed at the
|
2663 |
|
|
Specimen tab/section as a gallery. It is possible to configure the
|
2664 |
|
|
thumbnails gallery here, however for configuring how a single media should
|
2665 |
|
|
be displayed please go to !url.</p>',
|
2666 |
|
|
array(
|
2667 |
|
|
'!url' => l(t('Layout -> Media'), 'admin/config/cdm_dataportal/settings/layout/media'),
|
2668 |
|
|
));
|
2669 |
|
|
$form['taxon_specimens'][] = cdm_dataportal_create_gallery_settings_form($form_name, $form_title, FALSE, $form_description);
|
2670 |
|
|
|
2671 |
|
|
// --- MEDIA GALLERY ---- //
|
2672 |
|
|
$form_name = CDM_DATAPORTAL_TAXON_MEDIA_GALLERY_NAME_TAB;
|
2673 |
|
|
$form_title = 'Media gallery (tab)';
|
2674 |
43034365
|
Patrick Plitzner
|
$form_description = '<p>This section covers the settings related to the taxon <strong>images</strong> tab.
|
2675 |
|
|
Taxa may have media (usually images) and they are displayed as thumbnails. It is possible to configure
|
2676 |
6657531f
|
Andreas Kohlbecker
|
the thumbnails gallery here, however for configuring how a single media should be displayed please go to
|
2677 |
|
|
<a href="./?q=admin/settings/cdm_dataportal/layout/media">Layout -> Media</a></p>
|
2678 |
|
|
<p><strong>Note:</strong> These settings are only taken into account when the standard
|
2679 |
|
|
gallery viewer is selected at <a href="./?q=admin/settings/cdm_dataportal/layout/media">Layout -> Media</a>.</p>';
|
2680 |
|
|
$form['taxon_media'][] = cdm_dataportal_create_gallery_settings_form($form_name, $form_title, TRUE, $form_description);
|
2681 |
|
|
|
2682 |
|
|
// Comment @WA: D7 form api does not support reset buttons,
|
2683 |
|
|
// so to mimic the D5 reset button we add one like this.
|
2684 |
|
|
$form['actions']['reset'] = array(
|
2685 |
|
|
'#markup' => '<input id="reset" type="reset" class="form-submit" value="' . t('Reset to defaults') . '" />',
|
2686 |
|
|
'#weight' => 1000,
|
2687 |
|
|
);
|
2688 |
|
|
return system_settings_form($form);
|
2689 |
|
|
}
|
2690 |
|
|
|
2691 |
378bc1ce
|
Andreas Kohlbecker
|
/**
|
2692 |
|
|
* Creates a form element for the constants DISTRIBUTION_MAP_VISIBILITY, SPECIMEN_MAP_VISIBILITY.
|
2693 |
|
|
*
|
2694 |
|
|
* @param $map_id
|
2695 |
|
|
* @param $form
|
2696 |
|
|
* @return mixed
|
2697 |
|
|
*/
|
2698 |
|
|
function _cdm_map_visibility_setting($map_id)
|
2699 |
|
|
{
|
2700 |
|
|
return array(
|
2701 |
|
|
'#type' => 'select',
|
2702 |
|
|
'#title' => t(ucfirst($map_id) . ' map visibility'),
|
2703 |
|
|
'#default_value' => variable_get(constant(strtoupper($map_id) . '_MAP_VISIBILITY'), constant(strtoupper($map_id) . '_MAP_VISIBILITY_DEFAULT')),
|
2704 |
|
|
'#options' => array('always' => 'always', 'automatic' => 'automatic', 'never' => 'never'),
|
2705 |
|
|
'#description' => "The visibility of the map can managed <b>automatically</b> depending on whether there is data to show or not.
|
2706 |
|
|
The map also can forced to show up <b>always</b> or <b>never</b>."
|
2707 |
|
|
);
|
2708 |
|
|
}
|
2709 |
|
|
|
2710 |
6657531f
|
Andreas Kohlbecker
|
/**
|
2711 |
f264279e
|
Andreas Kohlbecker
|
* @return array
|
2712 |
|
|
* The form structure.
|
2713 |
6657531f
|
Andreas Kohlbecker
|
*/
|
2714 |
|
|
function cdm_settings_layout_search() {
|
2715 |
|
|
|
2716 |
|
|
$form = array();
|
2717 |
|
|
|
2718 |
c5ed6357
|
Andreas Kohlbecker
|
$form['#submit'][] = 'cdm_settings_layout_search_submit';
|
2719 |
|
|
|
2720 |
6657531f
|
Andreas Kohlbecker
|
$form['search_settings'] = array(
|
2721 |
|
|
'#type' => 'fieldset',
|
2722 |
|
|
'#title' => t('Taxa Search'),
|
2723 |
61b6ee11
|
Andreas Kohlbecker
|
'#collapsible' => FALSE,
|
2724 |
|
|
'#collapsed' => FALSE,
|
2725 |
6657531f
|
Andreas Kohlbecker
|
'#description' => t('<p>The data portal allows the users to perform searchs.</p><p>To perform searchs
|
2726 |
|
|
the block <em>CDM Taxon Search</em> should be enabled and visible for users
|
2727 |
|
|
where they can write the text to be searched. You can find Drupal block configuration
|
2728 |
|
|
site at <a href="./?q=admin/build/block">Administer->Site building->Blocks</a></p> '),
|
2729 |
|
|
);
|
2730 |
|
|
|
2731 |
90a6166e
|
Andreas Kohlbecker
|
$form['search_settings'][SIMPLE_SEARCH_IGNORE_CLASSIFICATION] = array(
|
2732 |
f19f47fa
|
Andreas Kohlbecker
|
'#type' => 'checkbox',
|
2733 |
|
|
'#title' => t('Ignore the chosen classification in simple search'),
|
2734 |
90a6166e
|
Andreas Kohlbecker
|
'#default_value' => variable_get(SIMPLE_SEARCH_IGNORE_CLASSIFICATION, 0),
|
2735 |
61b6ee11
|
Andreas Kohlbecker
|
'#description' => t('The simple search, which can be executed via the search block,
|
2736 |
90a6166e
|
Andreas Kohlbecker
|
will by default search on the classification selected in the classification browser
|
2737 |
|
|
selector. Set the tick if you want your portal to search on all classifications.'),
|
2738 |
61b6ee11
|
Andreas Kohlbecker
|
);
|
2739 |
|
|
|
2740 |
2d0d855a
|
Andreas Kohlbecker
|
$form['search_settings'][SIMPLE_SEARCH_USE_LUCENE_BACKEND] = array(
|
2741 |
|
|
'#type' => 'checkbox',
|
2742 |
|
|
'#title' => t('Run simple search with free-text search backend.'),
|
2743 |
90a6166e
|
Andreas Kohlbecker
|
'#default_value' => variable_get(SIMPLE_SEARCH_USE_LUCENE_BACKEND, 0),
|
2744 |
2d0d855a
|
Andreas Kohlbecker
|
'#description' => t('The simple search uses by default another search
|
2745 |
|
|
backend as the advances search. By checking this option the simple search can be
|
2746 |
|
|
configured to also use the free-text search backend.'),
|
2747 |
|
|
);
|
2748 |
|
|
|
2749 |
023c4a03
|
Patrick Plitzner
|
$form['search_settings'][SIMPLE_SEARCH_AUTO_SUGGEST] = array(
|
2750 |
|
|
'#type' => 'checkbox',
|
2751 |
|
|
'#title' => t('(EXPERIMENTAL) Enable auto-suggest for taxon search'),
|
2752 |
|
|
'#default_value' => variable_get(SIMPLE_SEARCH_AUTO_SUGGEST, 0),
|
2753 |
|
|
'#description' => t('If enabled, the taxon search field will suggest taxon names while typing in a search query.
|
2754 |
|
|
This function works on indexed taxon names. If you experience any delay maybe you have to reindex (see above).'),
|
2755 |
|
|
);
|
2756 |
|
|
|
2757 |
6657531f
|
Andreas Kohlbecker
|
$form['search_settings']['cdm_dataportal_search_items_on_page'] = array(
|
2758 |
|
|
'#type' => 'textfield',
|
2759 |
|
|
'#title' => t('Results per page') . ':',
|
2760 |
|
|
'#default_value' => variable_get('cdm_dataportal_search_items_on_page', CDM_DATAPORTAL_SEARCH_ITEMS_ON_PAGE),
|
2761 |
|
|
'#description' => t('Number of results to display per page.'),
|
2762 |
|
|
);
|
2763 |
276f39f6
|
Katja Luther
|
|
2764 |
1d69a96c
|
Andreas Kohlbecker
|
$form['search_settings'][SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX] = array(
|
2765 |
|
|
'#type' => 'checkbox',
|
2766 |
c278f2a0
|
Andreas Kohlbecker
|
'#title' => t('Show the') . ' <i>' . t('Display image thumbnails') . '</i>' . t('button') . ':',
|
2767 |
1d69a96c
|
Andreas Kohlbecker
|
'#default_value' => variable_get(SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX, SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX_DEFAULT),
|
2768 |
|
|
'#description' => t('The search results page will offer a button to toggle the display of image thumbnails.'),
|
2769 |
|
|
);
|
2770 |
|
|
|
2771 |
6280e639
|
Andreas Kohlbecker
|
$search_mode_default = get_array_variable_merged(CDM_SEARCH_TAXA_MODE, CDM_SEARCH_TAXA_MODE_DEFAULT);
|
2772 |
|
|
$form['search_settings']['cdm_search_taxa_mode'] = array(
|
2773 |
|
|
'#type' => 'checkboxes',
|
2774 |
|
|
'#title' => 'Search mode',
|
2775 |
|
|
'#description' => 'The taxon search can operate in different modes in order to find only taxa, synonyms,
|
2776 |
|
|
taxa by its common name and even taxa which have been used as misappied names. The settings made here will affect the default
|
2777 |
|
|
for the advance search form and the behaviour of the simple search form which always will behave according to the
|
2778 |
|
|
defaults set here.',
|
2779 |
|
|
'#options' => drupal_map_assoc(array_keys(unserialize(CDM_SEARCH_TAXA_MODE_DEFAULT))),
|
2780 |
|
|
'#default_value' => $search_mode_default
|
2781 |
|
|
);
|
2782 |
6657531f
|
Andreas Kohlbecker
|
|
2783 |
072122ee
|
Andreas Kohlbecker
|
$form['search_settings'][CDM_SEARCH_AREA_FILTER_PRESET] = array(
|
2784 |
f4cc620d
|
Andreas Kohlbecker
|
'#type' => 'textarea',
|
2785 |
072122ee
|
Andreas Kohlbecker
|
'#title' => t('area_filter_preset') . ':',
|
2786 |
|
|
'#default_value' => variable_get(CDM_SEARCH_AREA_FILTER_PRESET, ''), // '05b0dd06-30f8-477d-bf4c-30d9def56320' => Caucasia (Ab + Ar + Gg + Rf(CS)) (Cc)
|
2787 |
|
|
|
2788 |
|
|
'#description' => t('Area uuids, comma separated, no whitespace. EXPERIMENTAL!!!!'),
|
2789 |
|
|
);
|
2790 |
|
|
|
2791 |
6eaec849
|
Katja Luther
|
$form['blast_search_settings'] = array(
|
2792 |
|
|
'#type' => 'fieldset',
|
2793 |
|
|
'#title' => t('Blast Search'),
|
2794 |
|
|
'#collapsible' => TRUE,
|
2795 |
|
|
'#collapsed' => TRUE,
|
2796 |
|
|
'#description' => t('<p>To perform blast searchs
|
2797 |
|
|
the block <em>CDM Taxon Search</em> should be enabled and visible for users
|
2798 |
|
|
where they can write the text to be searched. You can find Drupal block configuration
|
2799 |
|
|
site at <a href="./?q=admin/build/block">Administer->Site building->Blocks</a></p>
|
2800 |
|
|
<p>To perform a blast search a blast database for the cdm instance is needed.</p> '),
|
2801 |
|
|
);
|
2802 |
|
|
|
2803 |
ef686dd8
|
Andreas Kohlbecker
|
$form['blast_search_settings'][CDM_SEARCH_BLAST_ENABLED] = array(
|
2804 |
6eaec849
|
Katja Luther
|
'#type' => 'checkbox',
|
2805 |
|
|
'#title' => t('Activate Blast search') . ':',
|
2806 |
ef686dd8
|
Andreas Kohlbecker
|
'#default_value' => variable_get(CDM_SEARCH_BLAST_ENABLED, 0), // '05b0dd06-30f8-477d-bf4c-30d9def56320' => Caucasia (Ab + Ar + Gg + Rf(CS)) (Cc)
|
2807 |
6eaec849
|
Katja Luther
|
|
2808 |
|
|
'#description' => t('Activate the blast search for this portal, this works only with an existing blast database!'),
|
2809 |
|
|
);
|
2810 |
ef686dd8
|
Andreas Kohlbecker
|
$form['blast_search_settings'][CDM_SEARCH_BLAST_SERVICE_URI] = array(
|
2811 |
6eaec849
|
Katja Luther
|
'#type' => 'textfield',
|
2812 |
|
|
'#title' => t('Webservice URL for blast search') . ':',
|
2813 |
ef686dd8
|
Andreas Kohlbecker
|
'#default_value' => variable_get(CDM_SEARCH_BLAST_SERVICE_URI, 'http://127.0.0.1:9001/api/sequence'), // '05b0dd06-30f8-477d-bf4c-30d9def56320' => Caucasia (Ab + Ar + Gg + Rf(CS)) (Cc)
|
2814 |
6eaec849
|
Katja Luther
|
|
2815 |
|
|
'#description' => t('Enter the webservice URL for blast search'),
|
2816 |
|
|
);
|
2817 |
|
|
|
2818 |
6657531f
|
Andreas Kohlbecker
|
// --- SEARCH TAXA GALLERY ---- //
|
2819 |
|
|
$items = variable_get('cdm_dataportal_search_items_on_page', CDM_DATAPORTAL_SEARCH_ITEMS_ON_PAGE);
|
2820 |
|
|
$collapsed = FALSE;
|
2821 |
|
|
$form_name = CDM_DATAPORTAL_SEARCH_GALLERY_NAME;
|
2822 |
|
|
$form_title = 'Taxa Search thumbnails';
|
2823 |
|
|
$form_description = 'Search results may show thumbnails. ';
|
2824 |
|
|
$form[] = cdm_dataportal_create_gallery_settings_form($form_name, $form_title, $collapsed, $form_description);
|
2825 |
|
|
|
2826 |
|
|
// Comment @WA: D7 form api does not support reset buttons,
|
2827 |
|
|
// so to mimic the D5 reset button we add one like this.
|
2828 |
|
|
$form['actions']['reset'] = array(
|
2829 |
|
|
'#markup' => '<input id="reset" type="reset" class="form-submit" value="' . t('Reset to defaults') . '" />',
|
2830 |
|
|
'#weight' => 1000,
|
2831 |
|
|
);
|
2832 |
|
|
return system_settings_form($form);
|
2833 |
|
|
}
|
2834 |
|
|
|
2835 |
|
|
/**
|
2836 |
f264279e
|
Andreas Kohlbecker
|
* @return array
|
2837 |
|
|
* The form structure.
|
2838 |
6657531f
|
Andreas Kohlbecker
|
*/
|
2839 |
|
|
function cdm_settings_layout_media() {
|
2840 |
|
|
|
2841 |
|
|
$form = array();
|
2842 |
|
|
|
2843 |
|
|
$form['media_settings'] = array(
|
2844 |
|
|
'#type' => 'fieldset',
|
2845 |
a950f2f9
|
Andreas Kohlbecker
|
'#title' => t('Media settings'),
|
2846 |
|
|
'#collapsible' => FALSE,
|
2847 |
6657531f
|
Andreas Kohlbecker
|
'#collapsed' => FALSE,
|
2848 |
ccde8251
|
Andreas Kohlbecker
|
'#description' => 'This section covers layout settings for media pages.'
|
2849 |
|
|
. 'Further media related settings may be found under the taxon layout settings and on the general settings.',
|
2850 |
6657531f
|
Andreas Kohlbecker
|
);
|
2851 |
|
|
|
2852 |
|
|
$form['media_settings']['image_gallery_viewer'] = array(
|
2853 |
|
|
'#type' => 'select',
|
2854 |
|
|
'#title' => t('Image viewer') . ':',
|
2855 |
|
|
'#default_value' => variable_get('image_gallery_viewer', 'default'),
|
2856 |
|
|
'#options' => array(
|
2857 |
|
|
'default' => t('Standard image viewer'),
|
2858 |
|
|
'fsi' => t('FSI viewer (requires FSI server!)'),
|
2859 |
|
|
),
|
2860 |
|
|
);
|
2861 |
|
|
|
2862 |
63d5030d
|
Andreas Kohlbecker
|
// --- STANDARD_IMAGE_VIEWER ---- //
|
2863 |
|
|
if(variable_get('image_gallery_viewer', 'default') == 'default') {
|
2864 |
|
|
$form['media_settings'][CDM_STANDARD_IMAGE_VIEWER] = array(
|
2865 |
|
|
'#type' => 'fieldset',
|
2866 |
|
|
'#tree' => true,
|
2867 |
|
|
'#title' => t('Standard image viewer settings'),
|
2868 |
|
|
'#collapsible' => FALSE,
|
2869 |
|
|
'#collapsed' => FALSE,
|
2870 |
|
|
);
|
2871 |
|
|
|
2872 |
|
|
$cdm_standard_image_viewer_settings = get_array_variable_merged(CDM_STANDARD_IMAGE_VIEWER, CDM_STANDARD_IMAGE_VIEWER_DEFAULT);
|
2873 |
|
|
$form['media_settings'][CDM_STANDARD_IMAGE_VIEWER]['media_representation_details_enabled'] = array (
|
2874 |
|
|
'#type' => 'checkbox',
|
2875 |
|
|
'#title' => 'Show media representations',
|
2876 |
|
|
'#default_value' => $cdm_standard_image_viewer_settings['media_representation_details_enabled']
|
2877 |
|
|
|
2878 |
|
|
);
|
2879 |
|
|
}
|
2880 |
|
|
|
2881 |
6657531f
|
Andreas Kohlbecker
|
|
2882 |
|
|
// @WA: D7 form api does not support reset buttons,
|
2883 |
|
|
// so to mimic the D5 reset button we add one like this.
|
2884 |
|
|
$form['actions']['reset'] = array(
|
2885 |
|
|
'#markup' => '<input id="reset" type="reset" class="form-submit" value="' . t('Reset to defaults') . '" />',
|
2886 |
|
|
'#weight' => 1000,
|
2887 |
|
|
);
|
2888 |
|
|
return system_settings_form($form);
|
2889 |
|
|
}
|
2890 |
|
|
|
2891 |
|
|
/**
|
2892 |
|
|
* GEOSERVICE and Map settings.
|
2893 |
f264279e
|
Andreas Kohlbecker
|
*
|
2894 |
|
|
* @return array
|
2895 |
|
|
* The form structure.
|
2896 |
6657531f
|
Andreas Kohlbecker
|
*/
|
2897 |
1d39ec64
|
w.addink
|
function cdm_settings_geo($form, &$form_state) {
|
2898 |
6657531f
|
Andreas Kohlbecker
|
|
2899 |
cc3c9807
|
Andreas Kohlbecker
|
$current_geoserver_settings = get_edit_map_service_settings();
|
2900 |
|
|
$map_distribution = get_array_variable_merged(CDM_MAP_DISTRIBUTION, CDM_MAP_DISTRIBUTION_DEFAULT);
|
2901 |
ff965d76
|
Andreas Kohlbecker
|
|
2902 |
cc3c9807
|
Andreas Kohlbecker
|
|
2903 |
6657531f
|
Andreas Kohlbecker
|
$form = array();
|
2904 |
|
|
|
2905 |
cc3c9807
|
Andreas Kohlbecker
|
$dummy_distribution_query = NULL;
|
2906 |
|
|
if($map_distribution['map_type'] != 1){
|
2907 |
ff965d76
|
Andreas Kohlbecker
|
// we need to apply a dummy query since the map service requires for image maps
|
2908 |
cc3c9807
|
Andreas Kohlbecker
|
// at least as and ad to be defined
|
2909 |
|
|
$dummy_distribution_query = "as=a:339966&ad=tdwg1:a:1,2,3,4,5,6,7,8,9";
|
2910 |
|
|
}
|
2911 |
087bb473
|
Andreas Kohlbecker
|
|
2912 |
d2fd2a4c
|
Andreas Kohlbecker
|
$form['map_preview'] = array(
|
2913 |
|
|
'#type' => 'fieldset',
|
2914 |
|
|
'#tree' => FALSE,
|
2915 |
|
|
'#title' => t('Map preview'),
|
2916 |
|
|
'#collapsible' => FALSE,
|
2917 |
cc3c9807
|
Andreas Kohlbecker
|
'#description' => 'The preview of the map'
|
2918 |
2bbc28c8
|
Andreas Kohlbecker
|
. ($dummy_distribution_query != null ?
|
2919 |
ff965d76
|
Andreas Kohlbecker
|
' may not be accurate in case of image maps, please check the map display in the taxon pages.':
|
2920 |
d5661a4c
|
Andreas Kohlbecker
|
'.<br/>Hold down Strg and drag with your mouse to select a bbox to zoom to. <br/>The bbox of the visible area of the map is always displayed below the map.')
|
2921 |
d2fd2a4c
|
Andreas Kohlbecker
|
);
|
2922 |
4c21ffdb
|
Andreas Kohlbecker
|
$form['map_preview']['openlayers_map'] = compose_map('settings-preview', NULL, $dummy_distribution_query, NULL, array(
|
2923 |
653e9c6b
|
Andreas Kohlbecker
|
'move' => "this.cdmOpenlayersMap.printInfo",
|
2924 |
|
|
'#execute' => "this.cdmOpenlayersMap.printInfo"
|
2925 |
|
|
), true // resizable
|
2926 |
d2fd2a4c
|
Andreas Kohlbecker
|
);
|
2927 |
087bb473
|
Andreas Kohlbecker
|
|
2928 |
6f718d1b
|
Andreas Kohlbecker
|
/*
|
2929 |
|
|
$form['map_preview']['map'] = compose_map(NULL, $dummy_distribution_query, NULL, array(), 0 // force image map
|
2930 |
|
|
);
|
2931 |
|
|
*/
|
2932 |
cc3c9807
|
Andreas Kohlbecker
|
|
2933 |
6657531f
|
Andreas Kohlbecker
|
/*
|
2934 |
d2fd2a4c
|
Andreas Kohlbecker
|
* GEO SERVER
|
2935 |
|
|
*/
|
2936 |
ba706bf0
|
Andreas Kohlbecker
|
$form['edit_map_server'] = array(
|
2937 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'fieldset',
|
2938 |
ba706bf0
|
Andreas Kohlbecker
|
'#tree' => true,
|
2939 |
|
|
'#title' => t('EDIT map service'),
|
2940 |
6657531f
|
Andreas Kohlbecker
|
'#collapsible' => TRUE,
|
2941 |
|
|
'#collapsed' => TRUE,
|
2942 |
|
|
'#description' => t('Configuration and selection of your geo server.
|
2943 |
|
|
The Geo Server is responsible for generating the maps.'),
|
2944 |
|
|
);
|
2945 |
|
|
|
2946 |
f19f47fa
|
Andreas Kohlbecker
|
$form['edit_map_server']['base_uri'] = array(
|
2947 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'select',
|
2948 |
ba706bf0
|
Andreas Kohlbecker
|
'#title' => t('EDIT map service') . ':',
|
2949 |
|
|
'#default_value' => $current_geoserver_settings['base_uri'],
|
2950 |
|
|
'#options' => unserialize(EDIT_MAPSERVER_URI),
|
2951 |
|
|
'#description' => t('Select the EDIT map server you want to use within your data portal.'),
|
2952 |
6657531f
|
Andreas Kohlbecker
|
);
|
2953 |
f19f47fa
|
Andreas Kohlbecker
|
$form['edit_map_server']['version'] = array(
|
2954 |
|
|
'#type' => 'select',
|
2955 |
|
|
'#title' => t('Version') . ':',
|
2956 |
|
|
'#default_value' => $current_geoserver_settings['version'],
|
2957 |
|
|
'#options' => unserialize(EDIT_MAPSERVER_VERSION),
|
2958 |
|
|
'#description' => t('The version of the EDIT map services'),
|
2959 |
6657531f
|
Andreas Kohlbecker
|
);
|
2960 |
|
|
|
2961 |
|
|
/*
|
2962 |
d2fd2a4c
|
Andreas Kohlbecker
|
* MAP SETTINGS
|
2963 |
|
|
*/
|
2964 |
cc3c9807
|
Andreas Kohlbecker
|
|
2965 |
|
|
$form[CDM_MAP_DISTRIBUTION] = array(
|
2966 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'fieldset',
|
2967 |
cc3c9807
|
Andreas Kohlbecker
|
'#tree' => TRUE,
|
2968 |
6657531f
|
Andreas Kohlbecker
|
'#title' => t('Maps settings'),
|
2969 |
|
|
'#collapsible' => TRUE,
|
2970 |
|
|
'#collapsed' => TRUE,
|
2971 |
|
|
'#description' => t('General configuration for all map types.'),
|
2972 |
|
|
);
|
2973 |
|
|
|
2974 |
6f718d1b
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['map_type'] = array(
|
2975 |
|
|
'#type' => 'radios',
|
2976 |
|
|
'#title' => 'Map types',
|
2977 |
|
|
'#options' => array(
|
2978 |
|
|
1 => "OpenLayers dynamic map viewer",
|
2979 |
|
|
0 => "Plain image",
|
2980 |
|
|
),
|
2981 |
|
|
'#default_value' => $map_distribution['map_type'],
|
2982 |
|
|
'#description' => 'Two different map types are available :
|
2983 |
|
|
<ul><li><em>OpenLayers</em>: Display the maps in an interactive viewer
|
2984 |
|
|
which allows zooming and panning. If enabled you can configure the default layer
|
2985 |
|
|
(background of your maps) below.</li>
|
2986 |
|
|
<li><em>Plain image</em>: The map will be static non interactive
|
2987 |
|
|
image.</li></ul>',
|
2988 |
|
|
);
|
2989 |
|
|
$open_layers_is_enabled = $map_distribution['map_type'] == 1;
|
2990 |
|
|
|
2991 |
cc3c9807
|
Andreas Kohlbecker
|
/*
|
2992 |
|
|
* settings for the distribution map are used also for specimens map!!!!
|
2993 |
|
|
*/
|
2994 |
|
|
|
2995 |
b4503332
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['aspect_ratio'] = array(
|
2996 |
cc3c9807
|
Andreas Kohlbecker
|
'#type' => 'textfield',
|
2997 |
b4503332
|
Andreas Kohlbecker
|
'#title' => 'Aspect ratio',
|
2998 |
|
|
'#default_value' => $map_distribution['aspect_ratio'],
|
2999 |
cc3c9807
|
Andreas Kohlbecker
|
'#maxlength' => 4,
|
3000 |
|
|
'#size' => 4,
|
3001 |
ff965d76
|
Andreas Kohlbecker
|
'#element_validate' => array('element_validate_number'),
|
3002 |
b4503332
|
Andreas Kohlbecker
|
'#description' => 'The ratio of width to height of the map. Instead of expressing the aspect ratio as usually as
|
3003 |
|
|
two numbers separated by a colon (x:y), this field requires a the value which is the result of the division of the
|
3004 |
|
|
width by the height:</br>
|
3005 |
|
|
<pre>aspect ratio = w / h</pre>
|
3006 |
|
|
For a landscape oriented map with an aspect ratio of 2:1 use <strong>2</strong> as value,</br>
|
3007 |
|
|
for a square map use <strong>1</strong>.',
|
3008 |
cc3c9807
|
Andreas Kohlbecker
|
);
|
3009 |
6657531f
|
Andreas Kohlbecker
|
|
3010 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['bbox'] = array(
|
3011 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'textfield',
|
3012 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Bounding box',
|
3013 |
|
|
'#default_value' => $map_distribution['bbox'],
|
3014 |
b4503332
|
Andreas Kohlbecker
|
'#description' => t('The bounding box (left, bottom, right, top) in degree defines the area to be initially displayed in maps.
|
3015 |
6657531f
|
Andreas Kohlbecker
|
Use "-180,-90,180,90" for the whole world. Leave <strong>empty</strong>
|
3016 |
2bbc28c8
|
Andreas Kohlbecker
|
to let the map <strong>automatically zoom</strong> to the bounds enclosing the shown data.</p>
|
3017 |
087bb473
|
Andreas Kohlbecker
|
<strong>TIP:</strong> You can use the map preview above to choose the <span class="map-extent-bbox"><strong>map extent bbox</strong> in <strong class="degree-value"">degree</strong></span> from the map.
|
3018 |
b4503332
|
Andreas Kohlbecker
|
(Maybe you need to change the map base layer to OpeLayers.)
|
3019 |
d5661a4c
|
Andreas Kohlbecker
|
Hold down Strg and drag with your mouse to select a bbox to zoom to. The bbox of the visible area of the map is always displayed
|
3020 |
2bbc28c8
|
Andreas Kohlbecker
|
below the map from where you can copy the bbox string.</p>'),
|
3021 |
6657531f
|
Andreas Kohlbecker
|
);
|
3022 |
|
|
|
3023 |
46de7f4c
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['maxZoom'] = array(
|
3024 |
|
|
'#type' => 'select',
|
3025 |
|
|
'#title' => 'Max zoom level',
|
3026 |
|
|
'#default_value' => $map_distribution['maxZoom'],
|
3027 |
|
|
'#options' => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
|
3028 |
|
|
);
|
3029 |
|
|
|
3030 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['show_labels'] = array(
|
3031 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'checkbox',
|
3032 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Display area labels',
|
3033 |
|
|
'#default_value' => $map_distribution['show_labels'],
|
3034 |
|
|
'#description' => t('The map will show name labels of the areas'),
|
3035 |
6657531f
|
Andreas Kohlbecker
|
);
|
3036 |
|
|
|
3037 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['caption'] = array(
|
3038 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'textfield',
|
3039 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Map caption',
|
3040 |
|
|
'#default_value' => $map_distribution['caption'],
|
3041 |
|
|
'#description' => t('The caption will be shown below the map.'),
|
3042 |
6657531f
|
Andreas Kohlbecker
|
);
|
3043 |
|
|
|
3044 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['distribution_opacity'] = array(
|
3045 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'textfield',
|
3046 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Distribution layer opacity',
|
3047 |
|
|
'#default_value' => $map_distribution['distribution_opacity'],
|
3048 |
b4503332
|
Andreas Kohlbecker
|
'#description' => t('Valid values range from 0.0 to 1.0. Value 1.0 means the distributions
|
3049 |
|
|
(the countries or regions) will fully visible, while a value near to 0.0 will be not much visible.'),
|
3050 |
6657531f
|
Andreas Kohlbecker
|
);
|
3051 |
|
|
|
3052 |
|
|
// --- Plain Image Settings --- //
|
3053 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['image_map'] = array(
|
3054 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'fieldset',
|
3055 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Plain image map settings',
|
3056 |
|
|
'#tree' => TRUE,
|
3057 |
6657531f
|
Andreas Kohlbecker
|
'#collapsible' => TRUE,
|
3058 |
cc3c9807
|
Andreas Kohlbecker
|
'#collapsed' => $open_layers_is_enabled,
|
3059 |
|
|
'#description' => 'The settings in this section are still expertimental
|
3060 |
|
|
and can only be used with the EDIT map service version 1.1 or above.',
|
3061 |
6657531f
|
Andreas Kohlbecker
|
);
|
3062 |
ba706bf0
|
Andreas Kohlbecker
|
$edit_mapserver_version = get_edit_map_service_version_number();
|
3063 |
6657531f
|
Andreas Kohlbecker
|
if ($edit_mapserver_version < 1.1) {
|
3064 |
7cc085da
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['image_map']['#description'] = '<div class="messages warning">'
|
3065 |
|
|
. t("The chosen EDIT map service version (@edit-mapserver-version) is too low, it must be at least 1.1",
|
3066 |
|
|
array('@edit_mapserver_version' => '$edit_mapserver_version')) . '</div>'
|
3067 |
cc3c9807
|
Andreas Kohlbecker
|
. $form[CDM_MAP_DISTRIBUTION]['image_map']['#description'];
|
3068 |
6657531f
|
Andreas Kohlbecker
|
}
|
3069 |
|
|
|
3070 |
b4503332
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['image_map']['width'] = array(
|
3071 |
|
|
'#type' => 'textfield',
|
3072 |
|
|
'#title' => 'Width',
|
3073 |
|
|
'#default_value' => $map_distribution['image_map']['width'],
|
3074 |
|
|
'#maxlength' => 4,
|
3075 |
|
|
'#size' => 4,
|
3076 |
50791e51
|
Andreas Kohlbecker
|
'#description' => 'Width of the map. The height is calculated from the <strong>Aspect ratio</strong> set in the section above. ',
|
3077 |
b4503332
|
Andreas Kohlbecker
|
);
|
3078 |
|
|
|
3079 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['image_map']['base_layer'] = array(
|
3080 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'textfield',
|
3081 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Background layer',
|
3082 |
|
|
'#default_value' => $map_distribution['image_map']['base_layer'],
|
3083 |
6657531f
|
Andreas Kohlbecker
|
'#description' => t('Background layer. For available layers inspect !url1 or !url2.', array(
|
3084 |
cc3c9807
|
Andreas Kohlbecker
|
'!url1' => l('deegree-csw', 'http://edit.africamuseum.be:8080/deegree-csw/md_search.jsp'),
|
3085 |
|
|
'!url2' => l('geoserver layers', 'http://edit.africamuseum.be/geoserver/web/'),
|
3086 |
6657531f
|
Andreas Kohlbecker
|
)),
|
3087 |
|
|
);
|
3088 |
|
|
|
3089 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['image_map']['bg_color'] = array(
|
3090 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'textfield',
|
3091 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Background color',
|
3092 |
|
|
'#default_value' => $map_distribution['image_map']['bg_color'],
|
3093 |
6657531f
|
Andreas Kohlbecker
|
);
|
3094 |
|
|
|
3095 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['image_map']['layer_style'] = array(
|
3096 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'textfield',
|
3097 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Background layer style',
|
3098 |
6657531f
|
Andreas Kohlbecker
|
// Only line color by now.
|
3099 |
cc3c9807
|
Andreas Kohlbecker
|
'#default_value' => $map_distribution['image_map']['layer_style'],
|
3100 |
|
|
'#description' => 'Syntax: {Area fill color},{Area stroke color},{Area stroke width},{Area stroke dash style}',
|
3101 |
6657531f
|
Andreas Kohlbecker
|
);
|
3102 |
|
|
|
3103 |
4bef194f
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['image_map']['projection'] = array(
|
3104 |
|
|
'#type' => 'textfield',
|
3105 |
|
|
'#title' => 'Projection',
|
3106 |
|
|
'#default_value' => drupal_array_get_nested_value($map_distribution, array('image_map', 'projection')),
|
3107 |
|
|
'#description' => 'Spatial Reference System (SRS) identifier ) optional ( Defines projections in WMS GetMap request.
|
3108 |
|
|
Using EPSG:4326 (WGS84 lat/long) is the default but can be changed
|
3109 |
|
|
on-the-fly to different UTM and much more zone specific. Examples: EPSG:4326, EPSG:900913, EPSG:3857, EPSG:7777777',
|
3110 |
|
|
);
|
3111 |
|
|
|
3112 |
6657531f
|
Andreas Kohlbecker
|
|
3113 |
|
|
// --- OpenLayers Settings --- //
|
3114 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['openlayers'] = array(
|
3115 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'fieldset',
|
3116 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'OpenLayers settings',
|
3117 |
|
|
'#tree' => TRUE,
|
3118 |
6657531f
|
Andreas Kohlbecker
|
'#collapsible' => TRUE,
|
3119 |
cc3c9807
|
Andreas Kohlbecker
|
'#collapsed' => !$open_layers_is_enabled,
|
3120 |
6657531f
|
Andreas Kohlbecker
|
'#description' => '',
|
3121 |
|
|
);
|
3122 |
|
|
|
3123 |
2bbc28c8
|
Andreas Kohlbecker
|
|
3124 |
|
|
$form[CDM_MAP_DISTRIBUTION]['openlayers']['display_outside_max_extent'] = array(
|
3125 |
|
|
'#type' => 'checkbox',
|
3126 |
|
|
'#title' => 'Display outside max extent',
|
3127 |
|
|
'#default_value' => $map_distribution['openlayers']['display_outside_max_extent'],
|
3128 |
|
|
'#description' => t('Allows the map to display parts of the layers which are outside
|
3129 |
|
|
the max extent if the aspect ratio of the map and of the baselayer
|
3130 |
|
|
are not equal.'),
|
3131 |
|
|
);
|
3132 |
|
|
|
3133 |
570f0e73
|
Andreas Kohlbecker
|
|
3134 |
2bbc28c8
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['openlayers']['show_layer_switcher'] = array(
|
3135 |
|
|
'#type' => 'checkbox',
|
3136 |
|
|
'#title' => 'Show Layer Switcher',
|
3137 |
|
|
'#default_value' => $map_distribution['openlayers']['show_layer_switcher'],
|
3138 |
|
|
'#description' => 'The Layer Switcher control displays a table of contents
|
3139 |
|
|
for the map. This allows the user interface to switch between
|
3140 |
|
|
base layers and to show or hide overlays. By default the switcher is
|
3141 |
|
|
shown minimized on the right edge of the map, the user may expand it
|
3142 |
|
|
by clicking on the handle.',
|
3143 |
|
|
);
|
3144 |
|
|
|
3145 |
cc3c9807
|
Andreas Kohlbecker
|
if (!$open_layers_is_enabled) {
|
3146 |
|
|
$form[CDM_MAP_DISTRIBUTION]['openlayers']['#description'] = '<div class="messages warning">'
|
3147 |
|
|
. 'The Openlayers viewer is currently not enabled! (see section Maps settings above )</div>'
|
3148 |
|
|
. $form[CDM_MAP_DISTRIBUTION]['openlayers']['#description'];
|
3149 |
6657531f
|
Andreas Kohlbecker
|
}
|
3150 |
|
|
|
3151 |
ff965d76
|
Andreas Kohlbecker
|
// The default layer must always be enabled
|
3152 |
|
|
$preferred_layer = $map_distribution['openlayers']['base_layers']['PREFERRED'];
|
3153 |
|
|
$map_distribution['openlayers']['base_layers'][$preferred_layer] = $preferred_layer;
|
3154 |
|
|
|
3155 |
6657531f
|
Andreas Kohlbecker
|
$baselayer_options = array(
|
3156 |
|
|
/*
|
3157 |
|
|
NOTICE: must correspond to the layers defined in
|
3158 |
|
|
js/openlayers_,ap.js#getLayersByName()
|
3159 |
|
|
*/
|
3160 |
1f3c62f9
|
Andreas Kohlbecker
|
'osgeo_vmap0' => "Metacarta Vmap0 (OSGeo server) - instable!", // EPSG:4326: EPSG:900913
|
3161 |
|
|
'metacarta_vmap0' => "Metacarta Vmap0 (MetaCarta Labs server) - instable!", // EPSG:4326, EPSG:900913
|
3162 |
|
|
'mapproxy_vmap0' => "Metacarta Vmap0 (OSGeo server) - via fast EDIT MapProxy",
|
3163 |
|
|
'mapproxy_etopo1' => "ETOPO1 Global Relief Model - via fast EDIT MapProxy",
|
3164 |
6657531f
|
Andreas Kohlbecker
|
'edit-etopo1' => "ETOPO1 Global Relief Model",
|
3165 |
1f3c62f9
|
Andreas Kohlbecker
|
// all others EPSG:900913
|
3166 |
4213b101
|
Andreas Kohlbecker
|
'mapnik' => 'OpenStreetMap (mapnik)',
|
3167 |
|
|
'stamen_terrain' => 'Stamen Terrain',
|
3168 |
|
|
'open_topomap' => 'OpenTopoMap',
|
3169 |
|
|
// map quest is no longer free. it is required to sign up for a test plan.
|
3170 |
|
|
// 'mapquest_open' => "MapQuest",
|
3171 |
|
|
// 'mapquest_sat' => "MapQuest Sattelite",
|
3172 |
2b83cc8b
|
Andreas Kohlbecker
|
'groadmap' => 'Google Roadmap',
|
3173 |
|
|
'gsatellite' => 'Google Satellite',
|
3174 |
f619ffbf
|
Andreas Kohlbecker
|
'ghybrid' => 'Google Hybrid',
|
3175 |
2b83cc8b
|
Andreas Kohlbecker
|
'gterrain' => 'Google Terrain',
|
3176 |
cc3c9807
|
Andreas Kohlbecker
|
// 'veroad' => 'Virtual Earth Roads',
|
3177 |
|
|
// 'veaer' => 'Virtual Earth Aerial',
|
3178 |
|
|
// 'vehyb' => 'Virtual Earth Hybrid',
|
3179 |
6657531f
|
Andreas Kohlbecker
|
// 'yahoo' => 'Yahoo Street',
|
3180 |
|
|
// 'yahoosat' => 'Yahoo Satellite',
|
3181 |
|
|
// 'yahoohyb' => 'Yahoo Hybrid',
|
3182 |
2bbc28c8
|
Andreas Kohlbecker
|
'custom_wms_base_layer_1' => 'Custom WMS base layer (needs to be manually configured below!)',
|
3183 |
6657531f
|
Andreas Kohlbecker
|
);
|
3184 |
|
|
|
3185 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['openlayers']['base_layers'] = array(
|
3186 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'checkboxes_preferred',
|
3187 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Base Layers',
|
3188 |
6657531f
|
Andreas Kohlbecker
|
'#options' => $baselayer_options,
|
3189 |
cc3c9807
|
Andreas Kohlbecker
|
'#default_value' => $map_distribution['openlayers']['base_layers'],
|
3190 |
|
|
'#description' => 'Choose the baselayer layer you prefer to use as map background in the OpenLayers dynamic mapviewer.',
|
3191 |
6657531f
|
Andreas Kohlbecker
|
);
|
3192 |
|
|
|
3193 |
2b83cc8b
|
Andreas Kohlbecker
|
$google_maps_api_key = null;
|
3194 |
|
|
if(isset($map_distribution['openlayers']['google_maps_api_key'])){
|
3195 |
|
|
$google_maps_api_key = $map_distribution['openlayers']['google_maps_api_key'];
|
3196 |
|
|
}
|
3197 |
|
|
$form[CDM_MAP_DISTRIBUTION]['openlayers']['google_maps_api_key'] = array(
|
3198 |
|
|
'#type' => 'textfield',
|
3199 |
|
|
'#title' => 'Google Maps API Key',
|
3200 |
|
|
'#default_value' => $google_maps_api_key,
|
3201 |
|
|
'#description' => 'In order to use any of the Google map layers you need to provide
|
3202 |
|
|
your <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">Google Maps API Key</a>. ',
|
3203 |
|
|
);
|
3204 |
|
|
|
3205 |
cb961f9d
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['openlayers']['custom_wms_base_layer'] = wms_layer_settings(
|
3206 |
|
|
$map_distribution['openlayers']['custom_wms_base_layer'],
|
3207 |
|
|
'Custom WMS base layer',
|
3208 |
|
|
'Here you an define a custom wms layer as additional base layer. You need to enable this layer in the base layers section above.',
|
3209 |
|
|
true // add projection settings
|
3210 |
|
|
);
|
3211 |
2bbc28c8
|
Andreas Kohlbecker
|
|
3212 |
cb961f9d
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['openlayers']['wms_overlay_layer'] = wms_layer_settings(
|
3213 |
|
|
$map_distribution['openlayers']['wms_overlay_layer'],
|
3214 |
|
|
'WMS overlay layer',
|
3215 |
|
|
'Here you an define a wms layer which will overlay all other layers in the map viewer.
|
3216 |
|
|
You can actually combine multiple layers for this overlay.
|
3217 |
|
|
For details please refer to the wms query parameter <code>Layers</code> .'
|
3218 |
2bbc28c8
|
Andreas Kohlbecker
|
);
|
3219 |
cb961f9d
|
Andreas Kohlbecker
|
|
3220 |
|
|
$form[CDM_MAP_DISTRIBUTION]['openlayers']['wms_overlay_layer']['is_enabled'] = array(
|
3221 |
|
|
'#type' => 'checkbox',
|
3222 |
|
|
'#title' => 'Enable overlay layer',
|
3223 |
|
|
'#weight' => -100,
|
3224 |
|
|
'#default_value' => $map_distribution['openlayers']['wms_overlay_layer']['is_enabled'] === 1 ? 1 : 0
|
3225 |
6657531f
|
Andreas Kohlbecker
|
);
|
3226 |
|
|
|
3227 |
cc3c9807
|
Andreas Kohlbecker
|
/*
|
3228 |
|
|
* Map Legend
|
3229 |
|
|
*/
|
3230 |
|
|
$form[CDM_MAP_DISTRIBUTION]['legend'] = array(
|
3231 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'fieldset',
|
3232 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Map legend',
|
3233 |
|
|
'#tree' => TRUE,
|
3234 |
6657531f
|
Andreas Kohlbecker
|
'#collapsible' => TRUE,
|
3235 |
|
|
'#collapsed' => TRUE,
|
3236 |
cc3c9807
|
Andreas Kohlbecker
|
'#description' => 'Configure the maps legend.',
|
3237 |
6657531f
|
Andreas Kohlbecker
|
);
|
3238 |
|
|
|
3239 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['legend']['show'] = array(
|
3240 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'checkbox',
|
3241 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Display a map legend',
|
3242 |
|
|
'#default_value' => $map_distribution['legend']['show'],
|
3243 |
|
|
'#description' => 'Check this if you like a legend to be displayed with the maps.',
|
3244 |
6657531f
|
Andreas Kohlbecker
|
);
|
3245 |
|
|
|
3246 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['legend']['opacity'] = array(
|
3247 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'textfield',
|
3248 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Legend opacity',
|
3249 |
|
|
'#default_value' => $map_distribution['legend']['opacity'],
|
3250 |
|
|
'#description' => 'Valid values range from 0.0 to 1.0. Value 1.0 means the legend will be fully visible, while a value near
|
3251 |
|
|
to 0.0 will be not much visible.',
|
3252 |
6657531f
|
Andreas Kohlbecker
|
);
|
3253 |
|
|
|
3254 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['legend']['font_size'] = array(
|
3255 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'textfield',
|
3256 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Font size',
|
3257 |
|
|
'#default_value' => $map_distribution['legend']['font_size'],
|
3258 |
|
|
'#description' => 'Font size in pixels.',
|
3259 |
6657531f
|
Andreas Kohlbecker
|
);
|
3260 |
|
|
|
3261 |
|
|
$fontStyles = array(
|
3262 |
|
|
0 => "plane",
|
3263 |
|
|
1 => "italic",
|
3264 |
|
|
);
|
3265 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['legend']['font_style'] = array(
|
3266 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'select',
|
3267 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Available font styles',
|
3268 |
|
|
'#default_value' => $map_distribution['legend']['font_style'],
|
3269 |
6657531f
|
Andreas Kohlbecker
|
'#options' => $fontStyles,
|
3270 |
cc3c9807
|
Andreas Kohlbecker
|
'#description' => 'Select a font style for the map legend.',
|
3271 |
6657531f
|
Andreas Kohlbecker
|
);
|
3272 |
|
|
|
3273 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['legend']['icon_width'] = array(
|
3274 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'textfield',
|
3275 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Icon width',
|
3276 |
|
|
'#default_value' => $map_distribution['legend']['icon_width'],
|
3277 |
|
|
'#description' => 'Legend icon width in pixels.',
|
3278 |
6657531f
|
Andreas Kohlbecker
|
);
|
3279 |
cc3c9807
|
Andreas Kohlbecker
|
$form[CDM_MAP_DISTRIBUTION]['legend']['icon_height'] = array(
|
3280 |
6657531f
|
Andreas Kohlbecker
|
'#type' => 'textfield',
|
3281 |
cc3c9807
|
Andreas Kohlbecker
|
'#title' => 'Icon height',
|
3282 |
|
|
'#default_value' => $map_distribution['legend']['icon_height'],
|
3283 |
|
|
'#description' => 'Legend icon height in pixels.',
|
3284 |
6657531f
|
Andreas Kohlbecker
|
);
|
3285 |
|
|
|
3286 |
|
|
// @WA: D7 form api does not support reset buttons,
|
3287 |
|
|
// so to mimic the D5 reset button we add one like this.
|
3288 |
|
|
$form['actions']['reset'] = array(
|
3289 |
|
|
'#markup' => '<input id="reset" type="reset" class="form-submit" value="' . t('Reset to defaults') . '" />',
|
3290 |
|
|
'#weight' => 1000,
|
3291 |
|
|
);
|
3292 |
1d39ec64
|
w.addink
|
|
3293 |
6657531f
|
Andreas Kohlbecker
|
return system_settings_form($form);
|
3294 |
|
|
}
|
3295 |
|
|
|
3296 |
cb961f9d
|
Andreas Kohlbecker
|
/**
|
3297 |
|
|
* @param $default_settings
|
3298 |
|
|
* @param $title
|
3299 |
|
|
* @param $description
|
3300 |
|
|
* @param bool $add_projection_settings
|
3301 |
|
|
* @return array
|
3302 |
|
|
*/
|
3303 |
|
|
function wms_layer_settings($default_settings, $title, $description, $add_projection_settings = false)
|
3304 |
|
|
{
|
3305 |
|
|
$form_elements = array(
|
3306 |
|
|
'#type' => 'fieldset',
|
3307 |
|
|
'#title' => $title,
|
3308 |
|
|
'#tree' => TRUE,
|
3309 |
|
|
'#collapsible' => FALSE,
|
3310 |
|
|
'#collapsed' => FALSE,
|
3311 |
|
|
'#description' => $description,
|
3312 |
|
|
);
|
3313 |
|
|
|
3314 |
|
|
$form_elements['name'] = array(
|
3315 |
|
|
'#type' => 'textfield',
|
3316 |
|
|
'#title' => 'Layer name',
|
3317 |
|
|
'#default_value' => $default_settings['name'],
|
3318 |
|
|
'#description' => 'A arbitrary name for the layer.',
|
3319 |
|
|
);
|
3320 |
|
|
$form_elements['url'] = array(
|
3321 |
|
|
'#type' => 'textfield',
|
3322 |
|
|
'#title' => 'WMS url',
|
3323 |
|
|
'#default_value' => $default_settings['url'],
|
3324 |
|
|
'#description' => 'Base url for the WMS (e.g. http://edit.africamuseum.be/geoserver/topp/wms, http://wms.jpl.nasa.gov/wms.cgi)'
|
3325 |
|
|
);
|
3326 |
2dc774be
|
Andreas Kohlbecker
|
$form_elements['untiled'] = array(
|
3327 |
|
|
'#type' => 'checkbox',
|
3328 |
|
|
'#title' => 'Untiled',
|
3329 |
|
|
'#default_value' => $default_settings['untiled'],
|
3330 |
|
|
'#description' => 'If the layer contains labels you may want to check this option to avoid label duplication or erratic invisibility.'
|
3331 |
|
|
);
|
3332 |
cb961f9d
|
Andreas Kohlbecker
|
$form_elements['params'] = array(
|
3333 |
|
|
'#type' => 'textarea',
|
3334 |
|
|
'#title' => 'WMS parameters',
|
3335 |
|
|
'#element_validate' => array('form_element_validate_json'),
|
3336 |
|
|
'#default_value' => $default_settings['params'],
|
3337 |
|
|
'#description' => 'An javasript object with key/value pairs representing the GetMap query string parameters and parameter values ('
|
3338 |
|
|
.l('Geoserver WMS parameter reference', 'http://docs.geoserver.org/stable/en/user/services/wms/reference.html#getmap' )
|
3339 |
|
|
. '), entered in valid JSON. For example:
|
3340 |
|
|
<pre> {
|
3341 |
|
|
"Layers": "topp:em_tiny_jan2003",
|
3342 |
|
|
"Format": "image/png",
|
3343 |
|
|
"BGCOLOR": "0xe0faff"
|
3344 |
|
|
}
|
3345 |
|
|
</pre>
|
3346 |
|
|
You can supply and web accessible SLD file by using the <code>sld</code> or <coded>sld_body</coded> parameters.'
|
3347 |
|
|
);
|
3348 |
|
|
|
3349 |
|
|
if($add_projection_settings){
|
3350 |
|
|
|
3351 |
|
|
$form_elements['projection'] = array(
|
3352 |
|
|
'#type' => 'textfield',
|
3353 |
|
|
'#title' => 'Projection',
|
3354 |
|
|
'#default_value' => $default_settings['projection'],
|
3355 |
|
|
'#description' => 'The desired projection for the layer (e.g. EPSG:4326, EPSG:900913, EPSG:3857)'
|
3356 |
|
|
);
|
3357 |
|
|
$form_elements['proj4js_def'] = array(
|
3358 |
|
|
'#type' => 'textfield',
|
3359 |
|
|
'#maxlength' => 256,
|
3360 |
|
|
'#title' => 'proj4js definition',
|
3361 |
|
|
'#default_value' => $default_settings['proj4js_def'],
|
3362 |
|
|
'#description' => 'The <a href="http://trac.osgeo.org/openlayers/wiki/Documentation/Dev/proj4js">proj4js definition</a> for the projection named above.
|
3363 |
|
|
The definitions for
|
3364 |
|
|
EPSG:102067, EPSG:102757, EPSG:102758, EPSG:21781, EPSG:26591, EPSG:26912, EPSG:27200, EPSG:27563, EPSG:3857,
|
3365 |
|
|
EPSG:41001, EPSG:4139, EPSG:4181, EPSG:42304, EPSG:4272, EPSG:4302, EPSG:900913
|
3366 |
|
|
are already predefined and must NOT be added here again. If your dont know the defintion of your desired projection,
|
3367 |
|
|
go to <a href="http://spatialreference.org/">http://spatialreference.org/</a>, search for your projection and
|
3368 |
|
|
choose to display the proj4js definition string.
|
3369 |
|
|
<h5>Quick Reference on the common proj4js definition parameters:</h5>
|
3370 |
|
|
<pre>
|
3371 |
|
|
+a Semimajor radius of the ellipsoid axis
|
3372 |
|
|
+alpha ? Used with Oblique Mercator and possibly a few others
|
3373 |
|
|
+axis Axis orientation (new in 4.8.0)
|
3374 |
|
|
+b Semiminor radius of the ellipsoid axis
|
3375 |
|
|
+datum Datum name (see `proj -ld`)
|
3376 |
|
|
+ellps Ellipsoid name (see `proj -le`)
|
3377 |
|
|
+k Scaling factor (old name)
|
3378 |
|
|
+k_0 Scaling factor (new name)
|
3379 |
|
|
+lat_0 Latitude of origin
|
3380 |
|
|
+lat_1 Latitude of first standard parallel
|
3381 |
|
|
+lat_2 Latitude of second standard parallel
|
3382 |
|
|
+lat_ts Latitude of true scale
|
3383 |
|
|
+lon_0 Central meridian
|
3384 |
|
|
+lonc ? Longitude used with Oblique Mercator and possibly a few others
|
3385 |
|
|
+lon_wrap Center longitude to use for wrapping (see below)
|
3386 |
|
|
+nadgrids Filename of NTv2 grid file to use for datum transforms (see below)
|
3387 |
|
|
+no_defs Don\'t use the /usr/share/proj/proj_def.dat defaults file
|
3388 |
|
|
+over Allow longitude output outside -180 to 180 range, disables wrapping (see below)
|
3389 |
|
|
+pm Alternate prime meridian (typically a city name, see below)
|
3390 |
|
|
+proj Projection name (see `proj -l`)
|
3391 |
|
|
+south Denotes southern hemisphere UTM zone
|
3392 |
|
|
+to_meter Multiplier to convert map units to 1.0m
|
3393 |
|
|
+towgs84 3 or 7 term datum transform parameters (see below)
|
3394 |
|
|
+units meters, US survey feet, etc.
|
3395 |
|
|
+vto_meter vertical conversion to meters.
|
3396 |
|
|
+vunits vertical units.
|
3397 |
|
|
+x_0 False easting
|
3398 |
|
|
+y_0 False northing
|
3399 |
|
|
+zone UTM zone
|
3400 |
|
|
</pre>
|
3401 |
|
|
For the full reference please refer to <a href="http://proj4.org/parameters.html">http://proj4.org/parameters.html</a>.'
|
3402 |
|
|
);
|
3403 |
|
|
$form_elements['max_extent'] = array(
|
3404 |
|
|
'#type' => 'textfield',
|
3405 |
|
|
'#title' => 'Maximum extent',
|
3406 |
|
|
'#default_value' => $default_settings['max_extent'],
|
3407 |
|
|
'#description' => 'The maximum extent of the map as bounding box (left, bottom, right, top) in the units of the map.'
|
3408 |
|
|
);
|
3409 |
|
|
$form_elements['units'] = array(
|
3410 |
|
|
'#type' => 'textfield',
|
3411 |
|
|
'#title' => 'Units',
|
3412 |
|
|
'#default_value' => $default_settings['units'],
|
3413 |
|
|
'#description' => 'The layer map units. Defaults to null. Possible values are ‘degrees’ (or ‘dd’), ‘m’, ‘ft’, ‘km’, ‘mi’, ‘inches’. Normally taken from the projection. Only required if both map and layers do not define a projection, or if they define a projection which does not define units.'
|
3414 |
|
|
);
|
3415 |
|
|
|
3416 |
|
|
}
|
3417 |
|
|
return $form_elements;
|
3418 |
|
|
}
|
3419 |
|
|
|
3420 |
ff965d76
|
Andreas Kohlbecker
|
|
3421 |
6657531f
|
Andreas Kohlbecker
|
/**
|
3422 |
f264279e
|
Andreas Kohlbecker
|
* @return array
|
3423 |
|
|
* The form structure.
|
3424 |
6657531f
|
Andreas Kohlbecker
|
*/
|
3425 |
|
|
function cdm_settings_cache() {
|
3426 |
|
|
|
3427 |
|
|
$form = array();
|
3428 |
|
|
|
3429 |
|
|
$form['cache_settings'] = array(
|
3430 |
|
|
'#type' => 'fieldset',
|
3431 |
|
|
'#title' => t('Cache Settings'),
|
3432 |
|
|
'#collapsible' => FALSE,
|
3433 |
|
|
'#collapsed' => FALSE,
|
3434 |
|
|
'#description' => t('<p>When caching is enabled all single taxon sites are
|
3435 |
|
|
stored in an internal drupal cache doing the portal response of taxa pages
|
3436 |
|
|
faster. This is possible because the sites are loaded from the cache and
|
3437 |
|
|
are not created from scratch.</p>'),
|
3438 |
|
|
);
|
3439 |
|
|
|
3440 |
|
|
$form['cache_settings']['cdm_webservice_cache'] = array(
|
3441 |
|
|
'#type' => 'checkbox',
|
3442 |
|
|
'#title' => t('<strong>Enable caching</strong>'),
|
3443 |
|
|
'#options' => cdm_help_general_cache(),
|
3444 |
|
|
'#default_value' => variable_get('cdm_webservice_cache', 1),
|
3445 |
|
|
'#description' => t('<p>Enable drupal to load taxa pages from the cache.</p>
|
3446 |
|
|
<p><strong>Note:</strong> If taxa are modified by the editor or any other
|
3447 |
|
|
application the changes will be not visible till the cache is erased.
|
3448 |
|
|
Therefore developers should deactived this feature when they are working
|
3449 |
|
|
on the CDM Dataportal Module.</p>'),
|
3450 |
|
|
);
|
3451 |
|
|
|
3452 |
|
|
$form['cache_settings']['cdm_run_cache'] = array(
|
3453 |
|
|
'#markup' => cdm_view_cache_site(),
|
3454 |
|
|
);
|
3455 |
|
|
|
3456 |
|
|
// @WA: D7 form api does not support reset buttons,
|
3457 |
|
|
// so to mimic the D5 reset button we add one like this.
|
3458 |
|
|
$form['actions']['reset'] = array(
|
3459 |
|
|
'#markup' => '<input id="reset" type="reset" class="form-submit" value="' . t('Reset to defaults') . '" />',
|
3460 |
|
|
'#weight' => 1000,
|
3461 |
|
|
);
|
3462 |
|
|
return system_settings_form($form);
|
3463 |
|
|
}
|
3464 |
|
|
|
3465 |
|
|
/**
|
3466 |
|
|
* Walk and cache all taxon pages.
|
3467 |
|
|
*/
|
3468 |
|
|
function cdm_view_cache_site() {
|
3469 |
|
|
|
3470 |
|
|
$out = '';
|
3471 |
|
|
|
3472 |
|
|
drupal_add_js(drupal_get_path('module', 'cdm_dataportal') . '/js/cache_all_taxa.js');
|
3473 |
|
|
|
3474 |
|
|
$request_params = array();
|
3475 |
7d828d59
|
Andreas Kohlbecker
|
$request_params['class'] = "Taxon";
|
3476 |
6657531f
|
Andreas Kohlbecker
|
|
3477 |
7d828d59
|
Andreas Kohlbecker
|
$cdm_ws_page_taxa_url = cdm_compose_url(CDM_WS_TAXON . ".json", NULL, queryString($request_params));
|
3478 |
|
|
$cdm_ws_page_taxa_url = uri_uriByProxy($cdm_ws_page_taxa_url);
|
3479 |
|
|
$cdm_ws_page_taxa_url = rtrim($cdm_ws_page_taxa_url, '/');
|
3480 |
6657531f
|
Andreas Kohlbecker
|
|
3481 |
|
|
$out .= t('<p><strong>Cache all taxon pages</strong></p>');
|
3482 |
|
|
$out .= '<p>When you launch the cache process the cache is filled and ready to be enabled.<br/>
|
3483 |
|
|
Remember that when you load the taxa from the cache last changes on taxa will be not visible till you erase
|
3484 |
|
|
the cache and fill it again.</p>';
|
3485 |
|
|
$out .= '<p>Before running the cache bot you have to empty the cache manually.</p>';
|
3486 |
|
|
|
3487 |
|
|
$out .= '<div>' . t('This caching process may take long time and could cause heavy load on your server') . '</div>';
|
3488 |
|
|
$out .= '<div id="progress"></div>';
|
3489 |
|
|
|
3490 |
|
|
// Comment @WA: A form within a form is not valid html and not needed here.
|
3491 |
|
|
// Also, it would be recommended just to include this part of the form in the
|
3492 |
|
|
// rest of the form array in cdm_settings_cache().
|
3493 |
|
|
// $out .= '<form id="cache_site">';
|
3494 |
0516e3d0
|
Andreas Kohlbecker
|
$out .= '<input type="hidden" name="pageTaxaUrl" value="' . $cdm_ws_page_taxa_url . '"/>';
|
3495 |
7d828d59
|
Andreas Kohlbecker
|
$out .= '<input type="hidden" name="taxonPageUrl" value="' . url('cdm_dataportal/taxon/') . '"/>';
|
3496 |
6657531f
|
Andreas Kohlbecker
|
$out .= '<input type="button" name="start" value="' . t('Start') . '"/>';
|
3497 |
|
|
$out .= '<input type="button" name="stop" value="' . t('Stop') . '"/>';
|
3498 |
|
|
// $out .= '</form>';
|
3499 |
|
|
$out .= '</div>';
|
3500 |
|
|
/*
|
3501 |
|
|
foreach($taxonPager->records as $taxon){
|
3502 |
|
|
cdm_dataportal_taxon_view($uuid);
|
3503 |
|
|
}
|
3504 |
|
|
*/
|
3505 |
|
|
return $out;
|
3506 |
|
|
}
|
3507 |
|
|
|
3508 |
7df1be04
|
Andreas Kohlbecker
|
|
3509 |
|
|
function cdm_settings_layout_taxon_submit($form, &$form_state){
|
3510 |
9c92cd84
|
Andreas Kohlbecker
|
if (isset($form_state['values'][CDM_TAXON_PROFILE_IMAGE]['custom_placeholder_image_fid'])) {
|
3511 |
|
|
$file = file_load($form_state['values'][CDM_TAXON_PROFILE_IMAGE]['custom_placeholder_image_fid']);
|
3512 |
|
|
if(is_object($file)){
|
3513 |
|
|
$file->status = FILE_STATUS_PERMANENT;
|
3514 |
|
|
file_save($file);
|
3515 |
|
|
file_usage_add($file, 'cdm_dataportal', CDM_TAXON_PROFILE_IMAGE, 0);
|
3516 |
|
|
}
|
3517 |
7df1be04
|
Andreas Kohlbecker
|
}
|
3518 |
93115722
|
Andreas Kohlbecker
|
// rebuild the menu if the specific tabs setting have changed, otherwise the change will not have a consistent effect
|
3519 |
|
|
$tab_lables_modified = serialize(get_array_variable_merged(CDM_TAXONPAGE_TAB_LABELS, CDM_TAXONPAGE_TAB_LABELS_DEFAULT)) != serialize($form_state['values'][CDM_TAXONPAGE_TAB_LABELS]);
|
3520 |
|
|
$tabs_enabled_modified = variable_get('cdm_dataportal_taxonpage_tabs', 1) != $form_state['values']['cdm_dataportal_taxonpage_tabs'];
|
3521 |
|
|
if($tab_lables_modified || $tabs_enabled_modified){
|
3522 |
d5403dc4
|
Andreas Kohlbecker
|
// we first need to set the variable to persist the changes setting
|
3523 |
|
|
variable_set('cdm_dataportal_taxonpage_tabs', $form_state['values']['cdm_dataportal_taxonpage_tabs']);
|
3524 |
93115722
|
Andreas Kohlbecker
|
variable_set(CDM_TAXONPAGE_TAB_LABELS, $form_state['values'][CDM_TAXONPAGE_TAB_LABELS]);
|
3525 |
d5403dc4
|
Andreas Kohlbecker
|
menu_rebuild();
|
3526 |
|
|
}
|
3527 |
7df1be04
|
Andreas Kohlbecker
|
}
|
3528 |
|
|
|
3529 |
c5ed6357
|
Andreas Kohlbecker
|
function cdm_settings_layout_search_submit($form, &$form_state){
|
3530 |
|
|
// the visibility of media thumbnails also affects the ui of the search results
|
3531 |
|
|
// so reset the according session variable
|
3532 |
|
|
// 1. in order to give the user immediate
|
3533 |
|
|
// feedback on potential setting changes
|
3534 |
|
|
// 2. let refresh the default if it has changed
|
3535 |
|
|
if (isset($_SESSION['pageoption']['searchtaxa']['showThumbnails'])) {
|
3536 |
|
|
unset($_SESSION['pageoption']['searchtaxa']['showThumbnails']);
|
3537 |
|
|
}
|
3538 |
|
|
}
|
3539 |
|
|
|
3540 |
6657531f
|
Andreas Kohlbecker
|
/**
|
3541 |
d1eb0a8c
|
Andreas Kohlbecker
|
* Form validation handler for cdm_settings_general
|
3542 |
6657531f
|
Andreas Kohlbecker
|
*
|
3543 |
22eb20d7
|
Andreas Kohlbecker
|
* @param $form
|
3544 |
|
|
* @param $form_state
|
3545 |
6657531f
|
Andreas Kohlbecker
|
*/
|
3546 |
d1eb0a8c
|
Andreas Kohlbecker
|
function cdm_settings_general_validate($form, &$form_state) {
|
3547 |
6657531f
|
Andreas Kohlbecker
|
|
3548 |
|
|
if (!str_endsWith($form_state['values']['cdm_webservice_url'], '/')) {
|
3549 |
|
|
$form_state['values']['cdm_webservice_url'] .= '/';
|
3550 |
|
|
}
|
3551 |
|
|
|
3552 |
d1eb0a8c
|
Andreas Kohlbecker
|
}
|
3553 |
|
|
|
3554 |
22eb20d7
|
Andreas Kohlbecker
|
/**
|
3555 |
|
|
* Form submit handler for settings general.
|
3556 |
|
|
*
|
3557 |
|
|
* tasks performed:
|
3558 |
|
|
* - clear the [cdm][taxonomictree_uuid] session variable since this taxonomictree_uuid might no longer bee valid
|
3559 |
|
|
*
|
3560 |
|
|
* @param $form
|
3561 |
|
|
* @param $form_state
|
3562 |
|
|
*/
|
3563 |
|
|
function cdm_settings_general_submit($form, &$form_state){
|
3564 |
|
|
// clear the [cdm][taxonomictree_uuid] session variable since this taxonomictree_uuid might no longer bee valid
|
3565 |
|
|
unset($_SESSION['cdm']['taxonomictree_uuid']);
|
3566 |
c9b3fcf5
|
Andreas Kohlbecker
|
unset($_SESSION['cdm_login']);
|
3567 |
22eb20d7
|
Andreas Kohlbecker
|
}
|
3568 |
|
|
|
3569 |
d1eb0a8c
|
Andreas Kohlbecker
|
/**
|
3570 |
|
|
* Form validation handler for cdm_settings_cache
|
3571 |
|
|
*/
|
3572 |
847bb49e
|
Andreas Kohlbecker
|
function cdm_settings_cache_validate($form, &$form_state) {
|
3573 |
6657531f
|
Andreas Kohlbecker
|
if ($form_state['values']['cdm_webservice_cache'] != variable_get('cdm_webservice_cache', 1)) {
|
3574 |
|
|
cache_clear_all(NULL, 'cache_cdm_ws');
|
3575 |
|
|
// Better clear secref_cache since I can not be sure if the cache has not
|
3576 |
|
|
// be used during this response.
|
3577 |
|
|
cdm_api_secref_cache_clear();
|
3578 |
|
|
}
|
3579 |
d1eb0a8c
|
Andreas Kohlbecker
|
|
3580 |
6657531f
|
Andreas Kohlbecker
|
}
|
3581 |
|
|
|
3582 |
|
|
/**
|
3583 |
ba706bf0
|
Andreas Kohlbecker
|
* Returns an associative array of the currently chosen settings for the EDIT map service or the defaults as
|
3584 |
|
|
* specified in EDIT_MAPSERVER_URI_DEFAULT and EDIT_MAPSERVER_VERSION_DEFAULT:
|
3585 |
|
|
* - base_uri: the protocol and host part , e.g.: http://edit.africamuseum.be
|
3586 |
|
|
* - version: the version, e.g.: v1.1
|
3587 |
|
|
*
|
3588 |
|
|
* @return array
|
3589 |
|
|
* An associative array of the currently chosen settings for the EDIT map service or the defaults.
|
3590 |
6657531f
|
Andreas Kohlbecker
|
*/
|
3591 |
ba706bf0
|
Andreas Kohlbecker
|
function get_edit_map_service_settings() {
|
3592 |
|
|
|
3593 |
|
|
$settings = variable_get('edit_map_server', array(
|
3594 |
|
|
'base_uri' => EDIT_MAPSERVER_URI_DEFAULT,
|
3595 |
|
|
'version' => EDIT_MAPSERVER_VERSION_DEFAULT
|
3596 |
|
|
)
|
3597 |
|
|
);
|
3598 |
6657531f
|
Andreas Kohlbecker
|
|
3599 |
ba706bf0
|
Andreas Kohlbecker
|
return $settings;
|
3600 |
6657531f
|
Andreas Kohlbecker
|
}
|
3601 |
|
|
|
3602 |
|
|
/**
|
3603 |
ba706bf0
|
Andreas Kohlbecker
|
* Returns the full edit map service URI e.g.: http://edit.africamuseum.be/edit_wp5/v1.1
|
3604 |
|
|
*
|
3605 |
|
|
* @return string
|
3606 |
|
|
* The full edit map service URI e.g.: http://edit.africamuseum.be/edit_wp5/v1.1
|
3607 |
|
|
*/
|
3608 |
|
|
function get_edit_map_service_full_uri() {
|
3609 |
|
|
$settings = get_edit_map_service_settings();
|
3610 |
|
|
return $settings['base_uri'] . EDIT_MAPSERVER_PATH . '/' . $settings['version'];
|
3611 |
|
|
}
|
3612 |
|
|
|
3613 |
|
|
|
3614 |
|
|
/**
|
3615 |
|
|
* Returns the version number of the currently selected edit mapserver as a float
|
3616 |
6657531f
|
Andreas Kohlbecker
|
*
|
3617 |
|
|
* @return float
|
3618 |
|
|
* The version number of the currently selected edit mapserver as a float.
|
3619 |
|
|
* Returns 0 on error.
|
3620 |
|
|
*/
|
3621 |
ba706bf0
|
Andreas Kohlbecker
|
function get_edit_map_service_version_number() {
|
3622 |
6657531f
|
Andreas Kohlbecker
|
|
3623 |
ba706bf0
|
Andreas Kohlbecker
|
$pattern = '/v([\d\.]+).*$/';
|
3624 |
6657531f
|
Andreas Kohlbecker
|
|
3625 |
ba706bf0
|
Andreas Kohlbecker
|
$settings = get_edit_map_service_settings();
|
3626 |
|
|
preg_match($pattern, $settings['version'], $matches, PREG_OFFSET_CAPTURE);
|
3627 |
6657531f
|
Andreas Kohlbecker
|
if (isset($matches[1])) {
|
3628 |
|
|
// Convert string to float.
|
3629 |
|
|
$version = 1 + $matches[1][0] - 1;
|
3630 |
|
|
return $version;
|
3631 |
|
|
}
|
3632 |
|
|
else {
|
3633 |
|
|
// Report error.
|
3634 |
ba706bf0
|
Andreas Kohlbecker
|
drupal_set_message(t(" Invalid EDIT map service version number: '!version'",
|
3635 |
|
|
array(
|
3636 |
|
|
'!version' => $settings['version'],
|
3637 |
|
|
'warning')
|
3638 |
|
|
)
|
3639 |
|
|
);
|
3640 |
6657531f
|
Andreas Kohlbecker
|
return 0;
|
3641 |
|
|
}
|
3642 |
|
|
}
|
3643 |
|
|
|
3644 |
30f78c59
|
Andreas Kohlbecker
|
/**
|
3645 |
ba706bf0
|
Andreas Kohlbecker
|
* Returns the array of selected items in a options array
|
3646 |
30f78c59
|
Andreas Kohlbecker
|
*
|
3647 |
|
|
* @param array $options
|
3648 |
|
|
* An options array as generated by a form element like checkoxes, select ...,
|
3649 |
|
|
*/
|
3650 |
|
|
function get_selection($options) {
|
3651 |
|
|
$selection = array();
|
3652 |
|
|
foreach ($options as $key=>$val) {
|
3653 |
|
|
if (!empty($val)) {
|
3654 |
|
|
$selection[] = $val;
|
3655 |
|
|
}
|
3656 |
|
|
}
|
3657 |
|
|
return $selection;
|
3658 |
|
|
}
|
3659 |
|
|
|
3660 |
bfb2b81a
|
Andreas Kohlbecker
|
|
3661 |
6657531f
|
Andreas Kohlbecker
|
/**
|
3662 |
|
|
* Implements hook_element_info().
|
3663 |
|
|
*
|
3664 |
14feebe9
|
Andreas Kohlbecker
|
* Allows modules to declare their own Form API element types and specify their default values.
|
3665 |
|
|
*
|
3666 |
|
|
* @see http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_element_info/7
|
3667 |
6657531f
|
Andreas Kohlbecker
|
*/
|
3668 |
|
|
function cdm_dataportal_element_info() {
|
3669 |
|
|
$type['checkboxes_preferred'] = array(
|
3670 |
|
|
'#input' => TRUE,
|
3671 |
14feebe9
|
Andreas Kohlbecker
|
'#process' => array('checkboxes_preferred_expand'),
|
3672 |
6657531f
|
Andreas Kohlbecker
|
'#after_build' => array('checkboxes_preferred_after_build'),
|
3673 |
|
|
'#theme' => array('checkboxes_preferred'),
|
3674 |
|
|
// '#theme_wrapper' => array('form_element'),
|
3675 |
|
|
);
|
3676 |
|
|
return $type;
|
3677 |
|
|
}
|
3678 |
|
|
|
3679 |
|
|
/**
|
3680 |
14feebe9
|
Andreas Kohlbecker
|
* #process callback function for the custom form element type 'checkbox_preferred'
|
3681 |
|
|
*
|
3682 |
|
|
*
|
3683 |
6657531f
|
Andreas Kohlbecker
|
*/
|
3684 |
14feebe9
|
Andreas Kohlbecker
|
function checkboxes_preferred_expand($element, &$form_state, $form) {
|
3685 |
|
|
|
3686 |
|
|
// First of all create checkboxes for each of the elements
|
3687 |
6657531f
|
Andreas Kohlbecker
|
$element = form_process_checkboxes($element);
|
3688 |
|
|
|
3689 |
cc3c9807
|
Andreas Kohlbecker
|
// compose the element name
|
3690 |
|
|
$parents = array();
|
3691 |
|
|
array_deep_copy($element['#parents'], $parents);
|
3692 |
|
|
$parents[count($parents) -1 ] .= '_preferred';
|
3693 |
|
|
$element_name = $parents[0];
|
3694 |
|
|
for ($i=1; $i < count($parents); $i++){
|
3695 |
|
|
$element_name .= '[' . $parents[$i] . ']';
|
3696 |
|
|
}
|
3697 |
|
|
|
3698 |
6657531f
|
Andreas Kohlbecker
|
$children = element_children($element);
|
3699 |
|
|
|
3700 |
|
|
$element['table_start'] = array(
|
3701 |
|
|
'#markup' => '<table class="checkboxes_preferred"><tr><th></th><th>' . t('Enabled') . '</th><th>' . t('Default') . '</th></tr>',
|
3702 |
|
|
'#weight' => -1,
|
3703 |
|
|
);
|
3704 |
|
|
|
3705 |
14feebe9
|
Andreas Kohlbecker
|
// prepare first part each of the table rows which contains the row label
|
3706 |
6657531f
|
Andreas Kohlbecker
|
$weight = 0;
|
3707 |
|
|
foreach ($children as $key) {
|
3708 |
|
|
$odd_even = $weight % 4 == 0 ? 'odd' : 'even';
|
3709 |
|
|
$element[$key]['#weight'] = $weight;
|
3710 |
7cc085da
|
Andreas Kohlbecker
|
$element[$key]['#prefix'] = '<tr class="' . $odd_even . '"><td>' . t('@row-label', array('@row-label' => $element['#options'][$key])) . '</td><td>';
|
3711 |
6657531f
|
Andreas Kohlbecker
|
$element[$key]['#suffix'] = '</td>';
|
3712 |
|
|
unset($element[$key]['#title']);
|
3713 |
|
|
$weight += 2;
|
3714 |
|
|
}
|
3715 |
|
|
$weight = 0;
|
3716 |
|
|
|
3717 |
14feebe9
|
Andreas Kohlbecker
|
// add a radio button to each of the checkboxes, the
|
3718 |
|
|
// check boxes have already been created at the beginning
|
3719 |
|
|
// of this function
|
3720 |
6657531f
|
Andreas Kohlbecker
|
if (count($element['#options']) > 0) {
|
3721 |
|
|
foreach ($element['#options'] as $key => $choice) {
|
3722 |
|
|
if (!isset($element[$key . '_preferred'])) {
|
3723 |
|
|
$element[$key . '_preferred'] = array(
|
3724 |
|
|
'#type' => 'radio',
|
3725 |
cc3c9807
|
Andreas Kohlbecker
|
'#name' => $element_name,
|
3726 |
6657531f
|
Andreas Kohlbecker
|
'#return_value' => check_plain($key),
|
3727 |
|
|
'#default_value' => empty($element['#default_value_2']) ? NULL : $element['#default_value_2'],
|
3728 |
|
|
'#attributes' => $element['#attributes'],
|
3729 |
1d39ec64
|
w.addink
|
'#parents' => $element['#parents'],
|
3730 |
6657531f
|
Andreas Kohlbecker
|
// '#spawned' => TRUE,
|
3731 |
|
|
'#weight' => $weight + 1,
|
3732 |
14feebe9
|
Andreas Kohlbecker
|
'#prefix' => '<td>', // add a prefix to start a new table cell
|
3733 |
|
|
'#suffix' => '</td></tr>', // add a prefix to close the tabel row
|
3734 |
6657531f
|
Andreas Kohlbecker
|
);
|
3735 |
|
|
}
|
3736 |
|
|
$weight += 2;
|
3737 |
|
|
}
|
3738 |
|
|
}
|
3739 |
|
|
|
3740 |
14feebe9
|
Andreas Kohlbecker
|
// end the table
|
3741 |
6657531f
|
Andreas Kohlbecker
|
$element['table_end'] = array(
|
3742 |
|
|
'#markup' => '</table>',
|
3743 |
|
|
'#weight' => $weight++,
|
3744 |
|
|
);
|
3745 |
|
|
|
3746 |
|
|
return $element;
|
3747 |
|
|
}
|
3748 |
|
|
|
3749 |
|
|
/**
|
3750 |
|
|
* Theme function for the custom form field 'checkboxes_preferred'.
|
3751 |
|
|
*/
|
3752 |
|
|
function theme_checkboxes_preferred($variables) {
|
3753 |
|
|
$element = $variables['element'];
|
3754 |
|
|
$out = '<div id="edit-baselayers-wrapper" class="form-item">';
|
3755 |
|
|
$out .= '<label for="edit-baselayers">' . $element['#title'] . '</label>';
|
3756 |
|
|
$out .= drupal_render_children($element);
|
3757 |
|
|
$out .= '<div class="description">' . $element['#description'] . '</div>';
|
3758 |
|
|
$out .= '</div>';
|
3759 |
|
|
return $out;
|
3760 |
|
|
}
|
3761 |
|
|
|
3762 |
|
|
/**
|
3763 |
14feebe9
|
Andreas Kohlbecker
|
* Callback for checkboxes preferred for widget which will
|
3764 |
|
|
* be called after the form or element is built. The call
|
3765 |
|
|
* back is configured in the form element by setting it as
|
3766 |
|
|
* #after_build parameter.
|
3767 |
|
|
*
|
3768 |
|
|
* @see http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#after_build
|
3769 |
|
|
*
|
3770 |
cc3c9807
|
Andreas Kohlbecker
|
* @param $element
|
3771 |
14feebe9
|
Andreas Kohlbecker
|
* Nested array of form elements that comprise the form.
|
3772 |
|
|
* @param $form_state
|
3773 |
|
|
* A keyed array containing the current state of the form.
|
3774 |
cc3c9807
|
Andreas Kohlbecker
|
* This includes the current persistent storage data for the form.
|
3775 |
|
|
* Additional information, like the sanitized $_POST data,
|
3776 |
|
|
* is also accumulated here in $form_state['input']
|
3777 |
14feebe9
|
Andreas Kohlbecker
|
*
|
3778 |
|
|
* @return the modified form array
|
3779 |
6657531f
|
Andreas Kohlbecker
|
*/
|
3780 |
cc3c9807
|
Andreas Kohlbecker
|
function checkboxes_preferred_after_build($element, &$form_state) {
|
3781 |
6657531f
|
Andreas Kohlbecker
|
|
3782 |
cc3c9807
|
Andreas Kohlbecker
|
$parent_id = $element['#parents'][count($element['#parents']) - 1];
|
3783 |
6657531f
|
Andreas Kohlbecker
|
|
3784 |
|
|
if ($_POST && count($_POST) > 0) {
|
3785 |
cc3c9807
|
Andreas Kohlbecker
|
// TODO use $form_state['input'] instead of POST !!!
|
3786 |
6657531f
|
Andreas Kohlbecker
|
// First pass of form processing.
|
3787 |
cc3c9807
|
Andreas Kohlbecker
|
$parents = array();
|
3788 |
|
|
array_deep_copy($element['#parents'], $parents);
|
3789 |
|
|
$parents[count($parents) - 1] .= '_preferred';
|
3790 |
|
|
$preferred_layer = drupal_array_get_nested_value($_POST, $parents);
|
3791 |
|
|
$element['#value']['PREFERRED'] = $preferred_layer;
|
3792 |
|
|
// $form_state[$parent_id] = $element['#value'];
|
3793 |
|
|
// $form_state['values']['baselayers'] = $element['#value'];
|
3794 |
|
|
$form_state_element_values = &drupal_array_get_nested_value($form_state['values'], $element['#parents']);
|
3795 |
|
|
$form_state_element_values = $element['#value'];
|
3796 |
6657531f
|
Andreas Kohlbecker
|
}
|
3797 |
|
|
else {
|
3798 |
|
|
// Second pass of form processing.
|
3799 |
cc3c9807
|
Andreas Kohlbecker
|
$preferred_layer = $element['#value']['PREFERRED'];
|
3800 |
6657531f
|
Andreas Kohlbecker
|
}
|
3801 |
|
|
|
3802 |
|
|
// Also set the chosen value (not sure if this is good Drupal style ....).
|
3803 |
cc3c9807
|
Andreas Kohlbecker
|
foreach ($children = element_children($element) as $key) {
|
3804 |
|
|
if (!empty($element[$key]['#type']) && $element[$key]['#type'] == 'radio') {
|
3805 |
|
|
$element[$key]['#value'] = $preferred_layer;
|
3806 |
6657531f
|
Andreas Kohlbecker
|
}
|
3807 |
|
|
}
|
3808 |
|
|
// The default layer must always be enabled.
|
3809 |
cc3c9807
|
Andreas Kohlbecker
|
$element[$preferred_layer]['#value'] = $preferred_layer;
|
3810 |
6657531f
|
Andreas Kohlbecker
|
|
3811 |
cc3c9807
|
Andreas Kohlbecker
|
return $element;
|
3812 |
6657531f
|
Andreas Kohlbecker
|
}
|
3813 |
0f5f1c12
|
Andreas Kohlbecker
|
|
3814 |
3f485c6d
|
Andreas Kohlbecker
|
function radios_prepare_options_suffix(&$elements){
|
3815 |
|
|
|
3816 |
|
|
$childrenKeys = element_children($elements);
|
3817 |
|
|
foreach($childrenKeys as $key){
|
3818 |
|
|
if(!is_array($elements[$key]['#theme_wrappers'])){
|
3819 |
|
|
$elements[$key]['#theme_wrappers'] = array();
|
3820 |
|
|
}
|
3821 |
|
|
if(isset($elements['#options_suffixes'][$key])){
|
3822 |
|
|
$elements[$key]['#theme_wrappers'][] = 'radio_options_suffix';
|
3823 |
|
|
$elements[$key]['#options_suffix'] = $elements['#options_suffixes'][$key];
|
3824 |
|
|
}
|
3825 |
|
|
}
|
3826 |
|
|
return $elements;
|
3827 |
|
|
|
3828 |
|
|
}
|
3829 |
|
|
|
3830 |
|
|
/**
|
3831 |
|
|
* TODO
|
3832 |
|
|
* @param unknown $variables
|
3833 |
|
|
*/
|
3834 |
|
|
function theme_radio_options_suffix($variables) {
|
3835 |
|
|
$element = $variables['element'];
|
3836 |
|
|
if(isset($element['#options_suffix'])) {
|
3837 |
|
|
$element['#children'] .= $element['#options_suffix'];
|
3838 |
|
|
}
|
3839 |
|
|
return $element['#children'];
|
3840 |
|
|
}
|
3841 |
|
|
|
3842 |
|
|
|
3843 |
0f5f1c12
|
Andreas Kohlbecker
|
/**
|
3844 |
|
|
* Element validate callback for text field and arrays containing json.
|
3845 |
|
|
*
|
3846 |
|
|
* @param $element
|
3847 |
|
|
* The form element to validate
|
3848 |
|
|
* @param $form_state
|
3849 |
|
|
* A keyed array containing the current state of the form.
|
3850 |
cc3c9807
|
Andreas Kohlbecker
|
* @param $form
|
3851 |
|
|
* Nested array of form elements that comprise the form.
|
3852 |
0f5f1c12
|
Andreas Kohlbecker
|
*/
|
3853 |
|
|
function form_element_validate_json($element, &$form_state, $form) {
|
3854 |
|
|
if (!empty($element['#value'])) {
|
3855 |
|
|
json_decode($element['#value']);
|
3856 |
|
|
if(json_last_error() != JSON_ERROR_NONE){
|
3857 |
7cc085da
|
Andreas Kohlbecker
|
form_error($element,
|
3858 |
|
|
t('The form element %title contains invalid JSON. You can check the syntax with ', array('%title' => $element['#title']))
|
3859 |
|
|
. l('JSONLint', 'http://jsonlint.com/')
|
3860 |
|
|
);
|
3861 |
0f5f1c12
|
Andreas Kohlbecker
|
}
|
3862 |
|
|
}
|
3863 |
|
|
}
|
3864 |
|
|
|
3865 |
|
|
/**
|
3866 |
|
|
* Form submission handler for textareas and textfields containing JSON.
|
3867 |
|
|
*
|
3868 |
|
|
* The contained JSON will be converted into an php array
|
3869 |
2bbc28c8
|
Andreas Kohlbecker
|
* or object and will be stored in the variables as such.
|
3870 |
0f5f1c12
|
Andreas Kohlbecker
|
*
|
3871 |
|
|
* @see http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#submit
|
3872 |
|
|
*
|
3873 |
|
|
* @param $form
|
3874 |
|
|
* Nested array of form elements that comprise the form.
|
3875 |
|
|
* @param $form_state
|
3876 |
|
|
* A keyed array containing the current state of the form.
|
3877 |
|
|
*
|
3878 |
|
|
*/
|
3879 |
|
|
function submit_json_as_php_array($form, &$form_state) {
|
3880 |
|
|
if (is_array($form['#json_elements'])) {
|
3881 |
|
|
foreach ($form['#json_elements'] as $element){
|
3882 |
80370786
|
Andreas Kohlbecker
|
if (trim($form_state['values'][$element])) {
|
3883 |
|
|
$form_state['values'][$element] = (array) json_decode($form_state['values'][$element]);
|
3884 |
|
|
} else {
|
3885 |
|
|
$form_state['values'][$element] = NULL;
|
3886 |
|
|
}
|
3887 |
0f5f1c12
|
Andreas Kohlbecker
|
}
|
3888 |
|
|
}
|
3889 |
|
|
}
|