1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Provides external links for sources to taxa information.
|
5
|
*
|
6
|
* @copyright
|
7
|
* (C) 2007-2012 EDIT
|
8
|
* European Distributed Institute of Taxonomy
|
9
|
* http://www.e-taxonomy.eu
|
10
|
*
|
11
|
* The contents of this module are subject to the Mozilla
|
12
|
* Public License Version 1.1.
|
13
|
* @see http://www.mozilla.org/MPL/MPL-1.1.html
|
14
|
*
|
15
|
* @author
|
16
|
* - Andreas Kohlbecker <a.kohlbecker@BGBM.org>
|
17
|
* - Wouter Addink <w.addink@eti.uva.nl> (migration from Drupal 5 to Drupal7)
|
18
|
*/
|
19
|
|
20
|
/**
|
21
|
* Display help and module information.
|
22
|
*
|
23
|
* @param string $path
|
24
|
* For which path of the site we're displaying help.
|
25
|
* @param array $arg
|
26
|
* Array that holds the current path as would be returned from arg() function.
|
27
|
*
|
28
|
* @return string
|
29
|
* Help text for the path.
|
30
|
*/
|
31
|
function ext_links_help($path, $arg) {
|
32
|
$output = '';
|
33
|
switch ($path) {
|
34
|
case 'admin/help#ext_links':
|
35
|
// TODO.
|
36
|
$output = '<p>' . t("Link to external sources like ## for taxa.") . '</p>';
|
37
|
break;
|
38
|
}
|
39
|
return $output;
|
40
|
} // function ext_links_help
|
41
|
|
42
|
/**
|
43
|
* Generate the HTML text for the ext_link login block.
|
44
|
*/
|
45
|
function ext_links_admin($form, &$form_state) {
|
46
|
// Default values for the external links.
|
47
|
$ext_links_default = ext_links_get_default();
|
48
|
|
49
|
$ext_links[0] = array(
|
50
|
'form' => 'gbif',
|
51
|
'form_title' => 'GBIF',
|
52
|
'check_title' => 'GBIF',
|
53
|
'link_title' => 'GBIF link',
|
54
|
'link_description' => 'The link to GBIF without the taxon name.',
|
55
|
'concat_default_value' => ' ',
|
56
|
'text_title' => 'GBIF text',
|
57
|
'text_description' => 'The text of the link that is displayed..',
|
58
|
'category' => 'Category',
|
59
|
);
|
60
|
$ext_links[1] = array(
|
61
|
'form' => 'biocase',
|
62
|
'form_title' => 'BioCASE',
|
63
|
'check_title' => 'Display BioCASE link?',
|
64
|
'link_title' => 'BioCASE link',
|
65
|
'link_description' => 'The link to BioCASE without the taxon name.',
|
66
|
'concat_default_value' => ' ',
|
67
|
'text_title' => 'BioCASE text',
|
68
|
'text_description' => 'The text of the link that is displayed..',
|
69
|
'category' => 'Category',
|
70
|
);
|
71
|
$ext_links[2] = array(
|
72
|
'form' => 'nybg',
|
73
|
'form_title' => 'The New York Botanical Garden',
|
74
|
'check_title' => 'Display NYBG link?',
|
75
|
'link_title' => 'NYBG link',
|
76
|
'link_description' => 'The link to NCBI without the taxon name.',
|
77
|
'concat_default_value' => '+AND+',
|
78
|
'text_title' => 'NYBG text',
|
79
|
'text_description' => 'The text of the link that is displayed..',
|
80
|
'category' => 'Category',
|
81
|
);
|
82
|
$ext_links[3] = array(
|
83
|
'form' => 'tropicos',
|
84
|
'form_title' => 'Tropicos',
|
85
|
'check_title' => 'Display Tropicos link?',
|
86
|
'link_title' => 'Tropicos link',
|
87
|
'link_description' => 'The link to Tropicos without the taxon name.',
|
88
|
'concat_default_value' => '+',
|
89
|
'text_title' => 'Tropicos text',
|
90
|
'text_description' => 'The text of the link that is displayed..',
|
91
|
'category' => 'Category',
|
92
|
);
|
93
|
$ext_links[4] = array(
|
94
|
'form' => 'ncbi',
|
95
|
'form_title' => 'NCBI',
|
96
|
'check_title' => 'Display NCBI link?',
|
97
|
'link_title' => 'NCBI link',
|
98
|
'link_description' => 'The link to NCBI without the taxon name.',
|
99
|
'concat_default_value' => '+AND+',
|
100
|
'text_title' => 'NCBI text',
|
101
|
'text_description' => 'The text of the link that is displayed..',
|
102
|
'category' => 'Category',
|
103
|
);
|
104
|
$ext_links[5] = array(
|
105
|
'form' => 'google',
|
106
|
'form_title' => 'Google Images',
|
107
|
'check_title' => 'Display Google Images link?',
|
108
|
'link_title' => 'Google Images link',
|
109
|
'link_description' => 'The link to Google Images without the taxon name.',
|
110
|
'concat_default_value' => '+',
|
111
|
'text_title' => 'Google Images text',
|
112
|
'text_description' => 'The text of the link that is displayed..',
|
113
|
'category' => 'Category',
|
114
|
);
|
115
|
$ext_links[6] = array(
|
116
|
'form' => 'flickr',
|
117
|
'form_title' => 'flickr',
|
118
|
'check_title' => 'Display flickr link?',
|
119
|
'link_title' => 'flickr link',
|
120
|
'link_description' => 'The link to flickr without the taxon name.',
|
121
|
'concat_default_value' => '+',
|
122
|
'text_title' => 'flickr text',
|
123
|
'text_description' => 'The text of the link that is displayed..',
|
124
|
'category' => 'Category',
|
125
|
);
|
126
|
$ext_links[7] = array(
|
127
|
'form' => 'scholar',
|
128
|
'form_title' => 'Google scholar',
|
129
|
'check_title' => 'Display Google scholar link?',
|
130
|
'link_title' => 'Google scholar link',
|
131
|
'link_description' => 'The link to Google scholar without the taxon name.',
|
132
|
'concat_default_value' => '+',
|
133
|
'text_title' => 'Google scholar text',
|
134
|
'text_description' => 'The text of the link that is displayed..',
|
135
|
'category' => 'Category',
|
136
|
);
|
137
|
$ext_links[8] = array(
|
138
|
'form' => 'bhl',
|
139
|
'form_title' => 'Biodiversity Heritage Library (BHL)',
|
140
|
'check_title' => 'Display BHL link?',
|
141
|
'link_title' => 'BHL link',
|
142
|
'link_description' => 'The link to BHL without the taxon name.',
|
143
|
'concat_default_value' => ' ',
|
144
|
'text_title' => 'BHL text',
|
145
|
'text_description' => 'The text of the link that is displayed..',
|
146
|
'category' => 'Category',
|
147
|
);
|
148
|
$ext_links[9] = array(
|
149
|
'form' => 'arkive',
|
150
|
'form_title' => 'ARKive',
|
151
|
'check_title' => 'Display ARKive link?',
|
152
|
'link_title' => 'ARKive link',
|
153
|
'link_description' => 'The link to ARKive without the taxon name.',
|
154
|
'concat_default_value' => '+',
|
155
|
'text_title' => 'ARKive text',
|
156
|
'text_description' => 'The text of the link that is displayed..',
|
157
|
'category' => 'Category',
|
158
|
);
|
159
|
$ext_links[10] = array(
|
160
|
'form' => 'herbcat',
|
161
|
'form_title' => 'Kew Herbarium Catalogue',
|
162
|
'check_title' => 'Display Kew Herbarium Catalogue link?',
|
163
|
'link_title' => 'Kew Herbarium Catalogue link',
|
164
|
'link_description' => 'The link to Kew Herbarium Catalogue without the taxon name.',
|
165
|
'concat_default_value' => '+',
|
166
|
'text_title' => 'Kew Herbarium Catalogue text',
|
167
|
'text_description' => 'The text of the link that is displayed..',
|
168
|
'category' => 'Category',
|
169
|
);
|
170
|
$ext_links[11] = array(
|
171
|
'form' => 'iucn',
|
172
|
'form_title' => 'IUCN Red List',
|
173
|
'check_title' => 'Display IUCN Red List link?',
|
174
|
'link_title' => 'IUCN Red List link',
|
175
|
'link_description' => 'The link to IUCN Red List without the taxon name.',
|
176
|
'concat_default_value' => ' ',
|
177
|
'text_title' => 'IUCN Red List text',
|
178
|
'text_description' => 'The text of the link that is displayed..',
|
179
|
'category' => 'Category',
|
180
|
);
|
181
|
$ext_links[12] = array(
|
182
|
'form' => 'ipni',
|
183
|
'form_title' => 'IPNI',
|
184
|
'check_title' => 'Display IPNI link?',
|
185
|
'link_title' => 'IPNI link',
|
186
|
'link_description' => 'The link to IPNI without the taxon name.',
|
187
|
'concat_default_value' => '&',
|
188
|
'text_title' => 'IPNI text',
|
189
|
'text_description' => 'The text of the link that is displayed..',
|
190
|
'category' => 'Category',
|
191
|
);
|
192
|
$ext_links[13] = array(
|
193
|
'form' => 'wcsp',
|
194
|
'form_title' => 'World Checklist of Monocots',
|
195
|
'check_title' => 'Display World Checklist of Monocots link?',
|
196
|
'link_title' => 'World Checklist of Monocots link',
|
197
|
'link_description' => 'The link to World Checklist of Monocots without the taxon name.',
|
198
|
'concat_default_value' => ' ',
|
199
|
'text_title' => 'World Checklist of Monocots text',
|
200
|
'text_description' => 'The text of the link that is displayed..',
|
201
|
'category' => 'Category',
|
202
|
);
|
203
|
$ext_links[14] = array(
|
204
|
'form' => 'tpl',
|
205
|
'form_title' => 'The Plant List',
|
206
|
'check_title' => 'Display The Plant List link?',
|
207
|
'link_title' => 'The Plant List link',
|
208
|
'link_description' => 'The link to The Plant List without the taxon name.',
|
209
|
'concat_default_value' => '+',
|
210
|
'text_title' => 'The Plant List text',
|
211
|
'text_description' => 'The text of the link that is displayed..',
|
212
|
'category' => 'Category',
|
213
|
);
|
214
|
$ext_links[15] = array(
|
215
|
'form' => 'eol',
|
216
|
'form_title' => 'Encyclopaedia of Life',
|
217
|
'check_title' => 'Display Encyclopaedia of Life link?',
|
218
|
'link_title' => 'Encyclopaedia of Life link',
|
219
|
'link_description' => 'The link to Encyclopaedia of Life without the taxon name.',
|
220
|
'concat_default_value' => '+',
|
221
|
'text_title' => 'Encyclopaedia of Life text',
|
222
|
'text_description' => 'The text of the link that is displayed..',
|
223
|
'category' => 'Category',
|
224
|
);
|
225
|
$ext_links[16] = array(
|
226
|
'form' => 'jstor',
|
227
|
'form_title' => 'JSTOR Plant Science',
|
228
|
'check_title' => 'Display JSTOR Plant Science link?',
|
229
|
'link_title' => 'JSTOR Plant Science link',
|
230
|
'link_description' => 'The link to JSTOR Plant Science without the taxon name.',
|
231
|
'concat_default_value' => ' ',
|
232
|
'text_title' => 'JSTOR Plant Science text',
|
233
|
'text_description' => 'The text of the link that is displayed..',
|
234
|
'category' => 'Category',
|
235
|
);
|
236
|
$ext_links[17] = array(
|
237
|
'form' => 'epic',
|
238
|
'form_title' => 'ePIC',
|
239
|
'check_title' => 'Display ePIC link?',
|
240
|
'link_title' => 'ePIC link',
|
241
|
'link_description' => 'The link to ePIC without the taxon name.',
|
242
|
'concat_default_value' => '+',
|
243
|
'text_title' => 'ePIC text',
|
244
|
'text_description' => 'The text of the link that is displayed..',
|
245
|
'category' => 'Category',
|
246
|
);
|
247
|
$ext_links[18] = array(
|
248
|
'form' => 'fairchild',
|
249
|
'form_title' => 'Fairchild Guide To Palms',
|
250
|
'check_title' => 'Display Fairchild Guide To Palms link?',
|
251
|
'link_title' => 'Fairchild Guide To Palms link',
|
252
|
'link_description' => 'The link to Fairchild Guide To Palms without the taxon name.',
|
253
|
'concat_default_value' => '+',
|
254
|
'text_title' => 'Fairchild Guide To Palms text',
|
255
|
'text_description' => 'The text of the link that is displayed..',
|
256
|
'category' => 'Category',
|
257
|
);
|
258
|
|
259
|
|
260
|
for ($i = 0; $i < sizeof($ext_links); $i++) {
|
261
|
$form[$ext_links[$i]['form']] = array(
|
262
|
'#type' => 'fieldset',
|
263
|
'#title' => t('@title', array('@title' => $ext_links[$i]['form_title'])),
|
264
|
'#collapsible' => TRUE,
|
265
|
'#collapsed' => TRUE,
|
266
|
);
|
267
|
$form[$ext_links[$i]['form']]['ext_links_' . $ext_links[$i]['form'] . '_check'] = array(
|
268
|
'#type' => 'checkbox',
|
269
|
'#title' => t('@title', array('@title' => $ext_links[$i]['check_title'])),
|
270
|
'#default_value' => variable_get('ext_links_' . $ext_links[$i]['form'] . '_check', 1),
|
271
|
);
|
272
|
$form[$ext_links[$i]['form']]['ext_links_' . $ext_links[$i]['form'] . '_link'] = array(
|
273
|
'#type' => 'textfield',
|
274
|
'#title' => t('@title :', array('@title' => $ext_links[$i]['link_title'])),
|
275
|
'#default_value' => variable_get('ext_links_' . $ext_links[$i]['form'] . '_link', $ext_links_default[$ext_links[$i]['form']]['link_default_value']),
|
276
|
'#size' => 70,
|
277
|
'#maxlength' => 255,
|
278
|
'#description' => t('@description', array('@description' => $ext_links[$i]['link_description'])),
|
279
|
);
|
280
|
$form[$ext_links[$i]['form']]['ext_links_' . $ext_links[$i]['form'] . '_concat'] = array(
|
281
|
'#type' => 'textfield',
|
282
|
'#title' => t('Concatenate string') . ':',
|
283
|
'#default_value' => variable_get('ext_links_' . $ext_links[$i]['form'] . '_concat', $ext_links[$i]['concat_default_value']),
|
284
|
'#size' => 70,
|
285
|
'#maxlength' => 255,
|
286
|
'#description' => t('Concatenate string between genus and species'),
|
287
|
);
|
288
|
$form[$ext_links[$i]['form']]['ext_links_' . $ext_links[$i]['form'] . '_text'] = array(
|
289
|
'#type' => 'textfield',
|
290
|
'#title' => t('@title :', array('@title' => $ext_links[$i]['text_title'])),
|
291
|
'#default_value' => variable_get('ext_links_' . $ext_links[$i]['form'] . '_text', $ext_links_default[$ext_links[$i]['form']]['text_default_value']),
|
292
|
'#size' => 70,
|
293
|
'#maxlength' => 255,
|
294
|
'#description' => t('@description', array('@description' => $ext_links[$i]['text_description'])),
|
295
|
);
|
296
|
$form[$ext_links[$i]['form']]['ext_links_' . $ext_links[$i]['form'] . '_category'] = array(
|
297
|
'#type' => 'textfield',
|
298
|
'#title' => t('@title :', array('@title' => $ext_links[$i]['category'])),
|
299
|
'#default_value' => variable_get('ext_links_' . $ext_links[$i]['form'] . '_category', $ext_links_default[$ext_links[$i]['form']]['category_default_value']),
|
300
|
'#size' => 70,
|
301
|
'#maxlength' => 255,
|
302
|
'#description' => t('@description', array('@description' => $ext_links[$i]['category'])),
|
303
|
);
|
304
|
}
|
305
|
$form['ext_links_options'] = array(
|
306
|
'#type' => 'checkbox',
|
307
|
'#title' => t('Enable sorted list with headings'),
|
308
|
'#default_value' => variable_get('ext_links_options', 0),
|
309
|
'#prefix' => "<div class = \"sorted_list_option\"",
|
310
|
'#suffix' => "</div>",
|
311
|
);
|
312
|
// @WA: D7 form api does not support reset buttons,
|
313
|
// so to mimic the D5 reset button we add one like this.
|
314
|
$form['actions']['reset'] = array(
|
315
|
'#markup' => '<input id="reset" type="reset" class="form-submit" value="' . t('Reset to defaults') . '" />',
|
316
|
'#weight' => 1000,
|
317
|
);
|
318
|
|
319
|
return system_settings_form($form);
|
320
|
} // function ext_links_admin()
|
321
|
|
322
|
|
323
|
/**
|
324
|
* Implements hook_menu().
|
325
|
*/
|
326
|
function ext_links_menu() {
|
327
|
$items = array();
|
328
|
|
329
|
$items['admin/config/cdm_dataportal/extlinks'] = array(
|
330
|
'title' => 'External links',
|
331
|
'description' => 'Description of your External links.',
|
332
|
'page callback' => 'drupal_get_form',
|
333
|
'page arguments' => array('ext_links_admin'),
|
334
|
'access arguments' => array('access administration pages'),
|
335
|
'type' => MENU_NORMAL_ITEM,
|
336
|
'weight' =>30,
|
337
|
);
|
338
|
|
339
|
return $items;
|
340
|
} /* function ext_links_menu() */
|
341
|
|
342
|
/**
|
343
|
* Returns the genus and the first epithet from the object taxon.
|
344
|
*/
|
345
|
function getSpeciesName($taxon) {
|
346
|
$speciesName = array();
|
347
|
$i = 0;
|
348
|
while (isset($taxon->name->taggedName[$i]) && !isset($speciesName['species'])) {
|
349
|
if ($taxon->name->taggedName[$i]->type == "name") {
|
350
|
if (!isset($speciesName['genus'])) {
|
351
|
$speciesName['genus'] = $taxon->name->taggedName[$i]->text;
|
352
|
}
|
353
|
else {
|
354
|
$speciesName['species'] = $taxon->name->taggedName[$i]->text;
|
355
|
}
|
356
|
}
|
357
|
$i++;
|
358
|
}
|
359
|
return $speciesName;
|
360
|
}
|
361
|
|
362
|
/**
|
363
|
* Implements hook_block_info().
|
364
|
*/
|
365
|
function ext_links_block_info() {
|
366
|
if (TRUE) {
|
367
|
$block[0]["info"] = t("External Taxon Links");
|
368
|
return $block;
|
369
|
}
|
370
|
}
|
371
|
|
372
|
/**
|
373
|
* Implements hook_block_view().
|
374
|
*/
|
375
|
function ext_links_block_view($delta) {
|
376
|
// TODO Rename block deltas (e.g. '0') to readable strings.
|
377
|
switch ($delta) {
|
378
|
case '0':
|
379
|
$block['subject'] = 'External links';
|
380
|
|
381
|
$uuid = get_current_taxon_uuid();
|
382
|
if ($uuid) {
|
383
|
$taxon = cdm_ws_get(CDM_WS_PORTAL_TAXON, $uuid);
|
384
|
|
385
|
// $taxon->titleCache;
|
386
|
// var_export()
|
387
|
if (!empty($taxon)) {
|
388
|
drupal_add_js(drupal_get_path('module', 'ext_links') . '/ext_links.js');
|
389
|
$speciesName = getSpeciesName($taxon);
|
390
|
|
391
|
$genus = $taxon->name->taggedName[0]->text;
|
392
|
$species = $taxon->name->taggedName[1]->text;
|
393
|
$block_content = '';
|
394
|
$listOption = variable_get("ext_links_options", 0);
|
395
|
if (isset($listOption)) {
|
396
|
$block['content'] = theme('ext_links_list_grouped', array('speciesName' => $speciesName, 'genus' => $genus, 'species' => $species));
|
397
|
}
|
398
|
else {
|
399
|
$block['content'] = theme('ext_links_list_plain', array('speciesName' => $speciesName, 'genus' => $genus, 'species' => $species ));
|
400
|
}
|
401
|
|
402
|
// if(variable_get('ext_links_gbif_check', TRUE)) {
|
403
|
// $block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_gbif_link', $ext_links_default[gbif][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_gbif_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]).'</a><br />';
|
404
|
/*
|
405
|
$block_content .=
|
406
|
/* TODO
|
407
|
Please manually fix the parameters on the l() or url() function on the next line.
|
408
|
Typically, this was not changed because of a function call inside an array call like
|
409
|
array('title' => t('View user profile.')).
|
410
|
l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
|
411
|
'JavaScript:popupExternalLinks('.variable_get('ext_links_gbif_link', $ext_links_default[gbif][link_default_value]).$speciesName[genus].variable_get('ext_links_gbif_concat', ' ').$speciesName[species],
|
412
|
array(), null, null, true);
|
413
|
*/
|
414
|
/*}
|
415
|
if(variable_get('ext_links_biocase_check', 1)) {
|
416
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_biocase_link', $ext_links_default[biocase][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_biocase_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_biocase_text', $ext_links_default[biocase][text_default_value]).'</a><br />';
|
417
|
}
|
418
|
if(variable_get('ext_links_nybg_check', 1)) {
|
419
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_nybg_link', $ext_links_default[nybg][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_nybg_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_nybg_text', $ext_links_default[nybg][text_default_value]).'</a><br />';
|
420
|
}
|
421
|
if(variable_get('ext_links_tropicos_check', 1)) {
|
422
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_tropicos_link', $ext_links_default[tropicos][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_tropicos_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_tropicos_text', $ext_links_default[tropicos][text_default_value]).'</a><br />';
|
423
|
}
|
424
|
if(variable_get('ext_links_ncbi_check', 1)) {
|
425
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_ncbi_link', $ext_links_default[ncbi][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_ncbi_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_ncbi_text', $ext_links_default[ncbi][text_default_value]).'</a><br />';
|
426
|
}
|
427
|
if(variable_get('ext_links_google_check', 1)) {
|
428
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_google_link', $ext_links_default[google][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_google_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_google_text', $ext_links_default[google][text_default_value]).'</a><br />';
|
429
|
}
|
430
|
if(variable_get('ext_links_flickr_check', 1)) {
|
431
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_flickr_link', $ext_links_default[flickr][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_flickr_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_flickr_text', $ext_links_default[flickr][text_default_value]).'</a><br />';
|
432
|
}
|
433
|
if(variable_get('ext_links_scholar_check', 1)) {
|
434
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_scholar_link', $ext_links_default[scholar][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_scholar_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_scholar_text', $ext_links_default[scholar][text_default_value]).'</a><br />';
|
435
|
}
|
436
|
if(variable_get('ext_links_bhl_check', 1)) {
|
437
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_bhl_link', $ext_links_default[bhl][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_bhl_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_bhl_text', $ext_links_default[bhl][text_default_value]).'</a><br />';
|
438
|
}
|
439
|
|
440
|
$block['content'] = $block_content;
|
441
|
$block['content'] = theme('ext_links_list_plain');
|
442
|
|
443
|
}
|
444
|
|
445
|
}*/
|
446
|
// if taxon
|
447
|
}
|
448
|
}
|
449
|
// If path.
|
450
|
return $block;
|
451
|
} /* switch */
|
452
|
|
453
|
}
|
454
|
|
455
|
/**
|
456
|
* @todo Please document this function.
|
457
|
* @see http://drupal.org/node/1354
|
458
|
*/
|
459
|
function theme_ext_links_list_grouped($variables) {
|
460
|
// comment @WA: perhaps this function could be merged with ext_list_plain
|
461
|
// into one function?
|
462
|
$speciesName = $variables['speciesName'];
|
463
|
if(!isset($speciesName['genus'])) {
|
464
|
$speciesName['genus'] = '';
|
465
|
}
|
466
|
if(!isset($speciesName['species'])) {
|
467
|
$speciesName['species'] = '';
|
468
|
}
|
469
|
$genus = $variables['genus'];
|
470
|
$species = $variables['species'];
|
471
|
$block_content = '';
|
472
|
$categories = NULL;
|
473
|
$ext_links_default = ext_links_get_default();
|
474
|
|
475
|
|
476
|
/*
|
477
|
foreach ($ext_links_default as $ext_link) {
|
478
|
|
479
|
//$block_content .= $ext_link['ext_links_bhl_category'];
|
480
|
$category[] = variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
|
481
|
$block_content .= variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
|
482
|
}
|
483
|
*/
|
484
|
|
485
|
// Images section.
|
486
|
if (variable_get('ext_links_google_check', 1)) {
|
487
|
$categoryTitles[] = variable_get('ext_links_google_category', $ext_links_default['google']['category_default_value']);
|
488
|
$categories['google']['title'] = variable_get('ext_links_google_category', $ext_links_default['google']['category_default_value']);
|
489
|
$categories['google']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_google_link', $ext_links_default['google']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_google_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_google_text', $ext_links_default['google']['text_default_value']) . '</a><br />';
|
490
|
|
491
|
}
|
492
|
if (variable_get('ext_links_flickr_check', 1)) {
|
493
|
$categoryTitles[] = variable_get('ext_links_flickr_category', $ext_links_default['flickr']['category_default_value']);
|
494
|
$categories['flickr']['title'] = variable_get('ext_links_flickr_category', $ext_links_default['flickr']['category_default_value']);
|
495
|
$categories['flickr']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_flickr_link', $ext_links_default['flickr']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_flickr_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_flickr_text', $ext_links_default['flickr']['text_default_value']) . '</a><br />';
|
496
|
}
|
497
|
|
498
|
// Specimen/occurences section.
|
499
|
if (variable_get('ext_links_gbif_check', TRUE)) {
|
500
|
$categoryTitles[] = variable_get('ext_links_gbif_category', $ext_links_default['gbif']['category_default_value']);
|
501
|
$categories['gbif']['title'] = variable_get('ext_links_gbif_category', $ext_links_default['gbif']['category_default_value']);
|
502
|
$categories['gbif']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_gbif_link', $ext_links_default['gbif']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_gbif_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_gbif_text', $ext_links_default['gbif']['text_default_value']) . '</a><br />';
|
503
|
}
|
504
|
if (variable_get('ext_links_biocase_check', 1)) {
|
505
|
$categoryTitles[] = variable_get('ext_links_biocase_category', $ext_links_default['biocase']['category_default_value']);
|
506
|
$categories['biocase']['title'] = variable_get('ext_links_biocase_category', $ext_links_default['biocase']['category_default_value']);
|
507
|
$categories['biocase']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_biocase_link', $ext_links_default['biocase']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_biocase_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_biocase_text', $ext_links_default['biocase']['text_default_value']) . '</a><br />';
|
508
|
}
|
509
|
if (variable_get('ext_links_nybg_check', 1)) {
|
510
|
$query = '';
|
511
|
$genusQuery = '';
|
512
|
$speciesQuery = '';
|
513
|
if ($speciesName['genus'] != NULL) {
|
514
|
$query .= 'DetFiledAsGenusLocal+%3D+\%27'. $speciesName['genus']. '\%27';
|
515
|
}
|
516
|
if ($speciesName['species'] != NULL) {
|
517
|
$query .= variable_get('ext_links_nybg_concat', '+AND+'). 'DetFiledAsSpeciesLocal+%3D+\%27'. $speciesName['species'] . '\%27';
|
518
|
}
|
519
|
$categoryTitles[] = variable_get('ext_links_nybg_category', $ext_links_default['nybg']['category_default_value']);
|
520
|
$categories['nybg']['title'] = variable_get('ext_links_nybg_category', $ext_links_default['nybg']['category_default_value']);
|
521
|
$categories['nybg']['content'] = '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_nybg_link', $ext_links_default['nybg']['link_default_value']).$query.'\')">'.variable_get('ext_links_nybg_text', $ext_links_default['nybg']['text_default_value']).'</a><br />';
|
522
|
}
|
523
|
if (variable_get('ext_links_tropicos_check', 1)) {
|
524
|
$categoryTitles[] = variable_get('ext_links_tropicos_category', $ext_links_default['tropicos']['category_default_value']);
|
525
|
$categories['tropicos']['title'] = variable_get('ext_links_tropicos_category', $ext_links_default['tropicos']['category_default_value']);
|
526
|
$categories['tropicos']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_tropicos_link', $ext_links_default['tropicos']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_tropicos_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_tropicos_text', $ext_links_default['tropicos']['text_default_value']) . '</a><br />';
|
527
|
}
|
528
|
|
529
|
// Literature.
|
530
|
if (variable_get('ext_links_scholar_check', 1)) {
|
531
|
$categoryTitles[] = variable_get('ext_links_scholar_category', $ext_links_default['scholar']['category_default_value']);
|
532
|
$categories['scholar']['title'] = variable_get('ext_links_scholar_category', $ext_links_default['scholar']['category_default_value']);
|
533
|
$categories['scholar']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_scholar_link', $ext_links_default['scholar']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_scholar_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_scholar_text', $ext_links_default['scholar']['text_default_value']) . '</a><br />';
|
534
|
}
|
535
|
if (variable_get('ext_links_bhl_check', 1)) {
|
536
|
$categoryTitles[] = variable_get('ext_links_bhl_category', $ext_links_default['bhl']['category_default_value']);
|
537
|
$categories['bhl']['title'] = variable_get('ext_links_bhl_category', $ext_links_default['bhl']['category_default_value']);
|
538
|
$categories['bhl']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_bhl_link', $ext_links_default['bhl']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_bhl_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_bhl_text', $ext_links_default['bhl']['text_default_value']) . '</a><br />';
|
539
|
}
|
540
|
|
541
|
// Molecular resources.
|
542
|
if (variable_get('ext_links_ncbi_check', 1)) {
|
543
|
$categoryTitles[] = variable_get('ext_links_ncbi_category', $ext_links_default['ncbi']['category_default_value']);
|
544
|
$categories['ncbi']['title'] = variable_get('ext_links_ncbi_category', $ext_links_default['ncbi']['category_default_value']);
|
545
|
$categories['ncbi']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_ncbi_link', $ext_links_default['ncbi']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_ncbi_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_ncbi_text', $ext_links_default['ncbi']['text_default_value']) . '</a><br />';
|
546
|
}
|
547
|
if (variable_get('ext_links_arkive_check', 1)) {
|
548
|
$postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
|
549
|
$categoryTitles[] = variable_get('ext_links_arkive_category', $ext_links_default['arkive']['category_default_value']);
|
550
|
$categories['arkive']['title'] = variable_get('ext_links_arkive_category', $ext_links_default['arkive']['category_default_value']);
|
551
|
$categories['arkive']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_arkive_link', $ext_links_default['arkive']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_arkive_concat', '+') . str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' . variable_get('ext_links_arkive_text', $ext_links_default['arkive']['text_default_value']) . '</a><br />';
|
552
|
}
|
553
|
if (variable_get('ext_links_herbcat_check', 1)) {
|
554
|
$postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
|
555
|
$categoryTitles[] = variable_get('ext_links_herbcat_category', $ext_links_default['herbcat']['category_default_value']);
|
556
|
$categories['herbcat']['title'] = variable_get('ext_links_herbcat_category', $ext_links_default['herbcat']['category_default_value']);
|
557
|
$categories['herbcat']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_herbcat_link', $ext_links_default['herbcat']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_herbcat_concat', '+') . str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' . variable_get('ext_links_herbcat_text', $ext_links_default['herbcat']['text_default_value']) . '</a><br />';
|
558
|
}
|
559
|
if (variable_get('ext_links_iucn_check', 1)) {
|
560
|
$categoryTitles[] = variable_get('ext_links_iucn_category', $ext_links_default['iucn']['category_default_value']);
|
561
|
$categories['iucn']['title'] = variable_get('ext_links_iucn_category', $ext_links_default['iucn']['category_default_value']);
|
562
|
$categories['iucn']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_iucn_link', $ext_links_default['iucn']['link_default_value']) . '\')">' . variable_get('ext_links_iucn_text', $ext_links_default['iucn']['text_default_value']) . '</a><br />';
|
563
|
}
|
564
|
if (variable_get('ext_links_ipni_check', 1)) {
|
565
|
$genusQuery = 'find_genus=' . $speciesName['genus'];
|
566
|
$speciesQuery = 'find_species=' . $speciesName['species'];
|
567
|
$categoryTitles[] = variable_get('ext_links_ipni_category', $ext_links_default['ipni']['category_default_value']);
|
568
|
$categories['ipni']['title'] = variable_get('ext_links_ipni_category', $ext_links_default['ipni']['category_default_value']);
|
569
|
$categories['ipni']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_ipni_link', $ext_links_default['ipni']['link_default_value']) . $genusQuery . variable_get('ext_links_ipni_concat', '&') . $speciesQuery . '\')">' . variable_get('ext_links_ipni_text', $ext_links_default['ipni']['text_default_value']) . '</a><br />';
|
570
|
}
|
571
|
if (variable_get('ext_links_wcsp_check', 1)) {
|
572
|
$categoryTitles[] = variable_get('ext_links_wcsp_category', $ext_links_default['wcsp']['category_default_value']);
|
573
|
$categories['wcsp']['title'] = variable_get('ext_links_wcsp_category', $ext_links_default['wcsp']['category_default_value']);
|
574
|
$categories['wcsp']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_wcsp_link', $ext_links_default['wcsp']['link_default_value']) . '\')">' . variable_get('ext_links_wcsp_text', $ext_links_default['wcsp']['text_default_value']) . '</a><br />';
|
575
|
}
|
576
|
if (variable_get('ext_links_tpl_check', 1)) {
|
577
|
$categoryTitles[] = variable_get('ext_links_tpl_category', $ext_links_default['tpl']['category_default_value']);
|
578
|
$categories['tpl']['title'] = variable_get('ext_links_tpl_category', $ext_links_default['tpl']['category_default_value']);
|
579
|
$categories['tpl']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_tpl_link', $ext_links_default['tpl']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_tpl_concat', '+') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_tpl_text', $ext_links_default['tpl']['text_default_value']) . '</a><br />';
|
580
|
}
|
581
|
if (variable_get('ext_links_eol_check', 1)) {
|
582
|
$categoryTitles[] = variable_get('ext_links_eol_category', $ext_links_default['eol']['category_default_value']);
|
583
|
$categories['eol']['title'] = variable_get('ext_links_eol_category', $ext_links_default['eol']['category_default_value']);
|
584
|
$categories['eol']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_eol_link', $ext_links_default['eol']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_eol_concat', '+') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_eol_text', $ext_links_default['eol']['text_default_value']) . '</a><br />';
|
585
|
}
|
586
|
if (variable_get('ext_links_jstor_check', 1)) {
|
587
|
$categoryTitles[] = variable_get('ext_links_jstor_category', $ext_links_default['jstor']['category_default_value']);
|
588
|
$categories['jstor']['title'] = variable_get('ext_links_jstor_category', $ext_links_default['jstor']['category_default_value']);
|
589
|
$categories['jstor']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_jstor_link', $ext_links_default['jstor']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_jstor_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_jstor_text', $ext_links_default['jstor']['text_default_value']) . '</a><br />';
|
590
|
}
|
591
|
if (variable_get('ext_links_epic_check', 1)) {
|
592
|
$postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
|
593
|
$categoryTitles[] = variable_get('ext_links_epic_category', $ext_links_default['epic']['category_default_value']);
|
594
|
$categories['epic']['title'] = variable_get('ext_links_epic_category', $ext_links_default['epic']['category_default_value']);
|
595
|
$categories['epic']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_epic_link', $ext_links_default['epic']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_epic_concat', '+') . str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' . variable_get('ext_links_epic_text', $ext_links_default['epic']['text_default_value']) . '</a><br />';
|
596
|
}
|
597
|
if (variable_get('ext_links_fairchild_check', 1)) {
|
598
|
$categoryTitles[] = variable_get('ext_links_fairchild_category', $ext_links_default['fairchild']['category_default_value']);
|
599
|
$categories['fairchild']['title'] = variable_get('ext_links_fairchild_category', $ext_links_default['fairchild']['category_default_value']);
|
600
|
$categories['fairchild']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_fairchild_link', $ext_links_default['fairchild']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_fairchild_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_fairchild_text', $ext_links_default['fairchild']['text_default_value']) . '</a><br />';
|
601
|
|
602
|
}
|
603
|
|
604
|
$categoryTitles = array_unique($categoryTitles);
|
605
|
foreach ($categoryTitles as $categoryTitle) {
|
606
|
// $block_content .= "specName" . $speciesName;
|
607
|
$block_content .= "<div class=\"category\"><h5>" . $categoryTitle . "</h5>";
|
608
|
foreach ($categories as $category) {
|
609
|
if ($category['title'] == $categoryTitle) {
|
610
|
$block_content .= $category['content'];
|
611
|
}
|
612
|
}
|
613
|
$block_content .= "</div>";
|
614
|
}
|
615
|
|
616
|
|
617
|
return $block_content;
|
618
|
}
|
619
|
|
620
|
/**
|
621
|
* @todo Please document this function.
|
622
|
* @see http://drupal.org/node/1354
|
623
|
*/
|
624
|
function theme_ext_links_list_plain($variables) {
|
625
|
$speciesName = $variables['speciesName'];
|
626
|
if (!isset($speciesName['genus'])) {
|
627
|
$speciesName['genus'] = '';
|
628
|
}
|
629
|
if (!isset($speciesName['species'])) {
|
630
|
$speciesName['species'] = '';
|
631
|
}
|
632
|
$genus = $variables['genus'];
|
633
|
$species = $variables['species'];
|
634
|
$ext_links_default = ext_links_get_default();
|
635
|
$block_content = '';
|
636
|
if (variable_get('ext_links_gbif_check', TRUE)) {
|
637
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_gbif_link', $ext_links_default['gbif']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_gbif_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_gbif_text', $ext_links_default['gbif']['text_default_value']) . '</a><br />';
|
638
|
/*
|
639
|
$block_content .= /* TODO
|
640
|
Please manually fix the parameters on the l() or url() function on the next line.
|
641
|
Typically, this was not changed because of a function call inside an array call like
|
642
|
array('title' => t('View user profile.')).*/
|
643
|
/*
|
644
|
l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
|
645
|
'JavaScript:popupExternalLinks('.variable_get('ext_links_gbif_link', $ext_links_default[gbif][link_default_value]).$speciesName[genus].variable_get('ext_links_gbif_concat', ' ').$speciesName[species],
|
646
|
array(), null, null, true);
|
647
|
*/
|
648
|
}
|
649
|
if (variable_get('ext_links_biocase_check', 1)) {
|
650
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_biocase_link', $ext_links_default['biocase']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_biocase_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_biocase_text', $ext_links_default['biocase']['text_default_value']) . '</a><br />';
|
651
|
}
|
652
|
if (variable_get('ext_links_nybg_check', 1)) {
|
653
|
// $block_content .= '<a href="JavaScript:popupExternalLinks(\''.variable_get('ext_links_nybg_link', $ext_links_default[nybg][link_default_value]).str_replace('"','%22',$speciesName[genus]).variable_get('ext_links_nybg_concat', ' ').str_replace('"','%22',$speciesName[species]).'\')">'.variable_get('ext_links_nybg_text', $ext_links_default[nybg][text_default_value]).'</a><br />';
|
654
|
$genusQuery = '';
|
655
|
$speciesQuery = '';
|
656
|
if ($speciesName['genus'] != NULL) {
|
657
|
$genusQuery = 'DetFiledAsGenusLocal+%3D+\%27' . $speciesName['genus'] . '\%27';
|
658
|
}
|
659
|
if ($speciesName['species'] != NULL) {
|
660
|
$speciesQuery = 'DetFiledAsSpeciesLocal+%3D+\%27' . $speciesName['species'] . '\%27';
|
661
|
}
|
662
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_nybg_link', $ext_links_default['nybg']['link_default_value']) . $genusQuery . variable_get('ext_links_nybg_concat', '+AND+') . $speciesQuery . '\')">' . variable_get('ext_links_nybg_text', $ext_links_default['nybg']['text_default_value']) . '</a><br />';
|
663
|
}
|
664
|
if (variable_get('ext_links_tropicos_check', 1)) {
|
665
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_tropicos_link', $ext_links_default['tropicos']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_tropicos_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_tropicos_text', $ext_links_default['tropicos']['text_default_value']) . '</a><br />';
|
666
|
}
|
667
|
if (variable_get('ext_links_ncbi_check', 1)) {
|
668
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_ncbi_link', $ext_links_default['ncbi']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_ncbi_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_ncbi_text', $ext_links_default['ncbi']['text_default_value']) . '</a><br />';
|
669
|
}
|
670
|
if (variable_get('ext_links_google_check', 1)) {
|
671
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_google_link', $ext_links_default['google']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_google_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_google_text', $ext_links_default['google']['text_default_value']) . '</a><br />';
|
672
|
}
|
673
|
if (variable_get('ext_links_flickr_check', 1)) {
|
674
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_flickr_link', $ext_links_default['flickr']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_flickr_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_flickr_text', $ext_links_default['flickr']['text_default_value']) . '</a><br />';
|
675
|
}
|
676
|
if (variable_get('ext_links_scholar_check', 1)) {
|
677
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_scholar_link', $ext_links_default['scholar']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_scholar_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_scholar_text', $ext_links_default['scholar']['text_default_value']) . '</a><br />';
|
678
|
}
|
679
|
if (variable_get('ext_links_bhl_check', 1)) {
|
680
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_bhl_link', $ext_links_default['bhl']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_bhl_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_bhl_text', $ext_links_default['bhl']['text_default_value']) . '</a><br />';
|
681
|
}
|
682
|
if (variable_get('ext_links_fairchild_check', 1)) {
|
683
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_fairchild_link', $ext_links_default['fairchild']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_fairchild_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_fairchild_text', $ext_links_default['fairchild']['text_default_value']) . '</a><br />';
|
684
|
}
|
685
|
if (variable_get('ext_links_arkive_check', 1)) {
|
686
|
$postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
|
687
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_arkive_link', $ext_links_default['arkive']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_arkive_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' . variable_get('ext_links_arkive_text', $ext_links_default['arkive']['text_default_value']) . '</a><br />';
|
688
|
}
|
689
|
if (variable_get('ext_links_herbcat_check', 1)) {
|
690
|
$postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
|
691
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_herbcat_link', $ext_links_default['herbcat']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_herbcat_concat', '+') . str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' . variable_get('ext_links_herbcat_text', $ext_links_default['herbcat']['text_default_value']) . '</a><br />';
|
692
|
}
|
693
|
if (variable_get('ext_links_iucn_check', 1)) {
|
694
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_iucn_link', $ext_links_default['iucn']['link_default_value']) . '\')">' . variable_get('ext_links_iucn_text', $ext_links_default['iucn']['text_default_value']) . '</a><br />';
|
695
|
|
696
|
}
|
697
|
if (variable_get('ext_links_ipni_check', 1)) {
|
698
|
$genusQuery = 'find_genus=' . $speciesName['genus'];
|
699
|
$speciesQuery = 'find_species=' . $speciesName['species'];
|
700
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_ipni_link', $ext_links_default['ipni']['link_default_value']) . $genusQuery . variable_get('ext_links_ipni_concat', '&') . $speciesQuery . '\')">' . variable_get('ext_links_ipni_text', $ext_links_default['ipni']['text_default_value']) . '</a><br />';
|
701
|
}
|
702
|
if (variable_get('ext_links_wcsp_check', 1)) {
|
703
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_wcsp_link', $ext_links_default['wcsp']['link_default_value']) . '\')">' . variable_get('ext_links_wcsp_text', $ext_links_default['wcsp']['text_default_value']) . '</a><br />';
|
704
|
|
705
|
}
|
706
|
if (variable_get('ext_links_tpl_check', 1)) {
|
707
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_tpl_link', $ext_links_default['tpl']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_tpl_concat', '+') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_tpl_text', $ext_links_default['tpl']['text_default_value']) . '</a><br />';
|
708
|
}
|
709
|
if (variable_get('ext_links_eol_check', 1)) {
|
710
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_eol_link', $ext_links_default['eol']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_eol_concat', '+') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_eol_text', $ext_links_default['eol']['text_default_value']) . '</a><br />';
|
711
|
}
|
712
|
if (variable_get('ext_links_jstor_check', 1)) {
|
713
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_jstor_link', $ext_links_default['jstor']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_jstor_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_jstor_text', $ext_links_default['jstor']['text_default_value']) . '</a><br />';
|
714
|
}
|
715
|
if (variable_get('ext_links_epic_check', 1)) {
|
716
|
$postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
|
717
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_epic_link', $ext_links_default['epic']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_epic_concat', '+') . str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' . variable_get('ext_links_epic_text', $ext_links_default['epic']['text_default_value']) . '</a><br />';
|
718
|
}
|
719
|
|
720
|
return $block_content;
|
721
|
}
|
722
|
|
723
|
// Include the admin form if we really want it to use.
|
724
|
/*
|
725
|
if (arg(0) === 'admin' AND arg(1) === 'user' AND arg(2) === 'ext_link') {
|
726
|
module_load_include('inc', 'ext_links', 'xt_link_admin');
|
727
|
}
|
728
|
*/
|
729
|
|
730
|
/**
|
731
|
* @todo Please document this function.
|
732
|
* @see http://drupal.org/node/1354
|
733
|
*/
|
734
|
function ext_links_theme() {
|
735
|
return array(
|
736
|
'ext_links_list_grouped' => array('variables' => array(
|
737
|
'speciesName' => NULL,
|
738
|
'genus' => NULL,
|
739
|
'species' => NULL,
|
740
|
)),
|
741
|
'ext_links_list_plain' => array('variables' => array(
|
742
|
'speciesName' => NULL,
|
743
|
'genus' => NULL,
|
744
|
'species' => NULL,
|
745
|
)),
|
746
|
);
|
747
|
}
|
748
|
|
749
|
/**
|
750
|
* Get the default external links.
|
751
|
*
|
752
|
* @return array
|
753
|
* Returns an array with default external links values.
|
754
|
*/
|
755
|
function ext_links_get_default() {
|
756
|
$ext_links_default["gbif"] = array(
|
757
|
'link_default_value' => 'http://www.gbif.org/species/search?q=',
|
758
|
'text_default_value' => 'Search GBIF...',
|
759
|
'category_default_value' => 'Specimens/Occurrences',
|
760
|
);
|
761
|
$ext_links_default["biocase"] = array(
|
762
|
'link_default_value' => 'http://search.biocase.org/edit/search/units/simpleSearch/query1?unitName=',
|
763
|
'text_default_value' => 'Search BioCASE...',
|
764
|
'category_default_value' => 'Specimens/Occurrences',
|
765
|
);
|
766
|
$ext_links_default["nybg"] = array(
|
767
|
'link_default_value' => 'http://sweetgum.nybg.org/vh/specimen_list.php?Where=',
|
768
|
'text_default_value' => 'Search NYBG...',
|
769
|
'category_default_value' => 'Specimens/Occurrences',
|
770
|
);
|
771
|
$ext_links_default["tropicos"] = array(
|
772
|
'link_default_value' => 'http://www.tropicos.org/NameSearch.aspx?name=',
|
773
|
'text_default_value' => 'Search Tropicos...',
|
774
|
'category_default_value' => 'Specimens/Occurrences',
|
775
|
);
|
776
|
$ext_links_default["ncbi"] = array(
|
777
|
'link_default_value' => 'http://www.ncbi.nlm.nih.gov/gquery/gquery.fcgi?term=',
|
778
|
'text_default_value' => 'Search NCBI...',
|
779
|
'category_default_value' => 'Molecular Resources',
|
780
|
);
|
781
|
$ext_links_default["google"] = array(
|
782
|
'link_default_value' => 'http://images.google.com/images?q=',
|
783
|
'text_default_value' => 'Search Google Images...',
|
784
|
'category_default_value' => 'Images',
|
785
|
);
|
786
|
$ext_links_default["flickr"] = array(
|
787
|
'link_default_value' => 'http://www.flickr.com/search/?w=all&q=',
|
788
|
'text_default_value' => 'Search flickr...',
|
789
|
'category_default_value' => 'Images',
|
790
|
);
|
791
|
$ext_links_default["scholar"] = array(
|
792
|
'link_default_value' => 'http://scholar.google.de/scholar?hl=de&btnG=Suche&lr=&as_ylo=&as_vis=0&q=',
|
793
|
'text_default_value' => 'Search Google scholar...',
|
794
|
'category_default_value' => 'Literature',
|
795
|
);
|
796
|
$ext_links_default["bhl"] = array(
|
797
|
'link_default_value' => 'http://www.biodiversitylibrary.org/Search.aspx?searchCat=&searchTerm=',
|
798
|
'text_default_value' => 'Search BHL...',
|
799
|
'category_default_value' => 'Literature',
|
800
|
);
|
801
|
$ext_links_default["arkive"] = array(
|
802
|
'link_default_value' => 'http://www.arkive.org/search.html?q=',
|
803
|
'text_default_value' => 'Search ARKive...',
|
804
|
'category_default_value' => 'Images',
|
805
|
);
|
806
|
$ext_links_default["herbcat"] = array(
|
807
|
'link_default_value' => 'http://apps.kew.org/herbcat/getHomePageResults.do?homePageSearchText=',
|
808
|
'text_default_value' => 'Search Kew Herbarium Catalogue...',
|
809
|
'category_default_value' => 'Specimens/Occurrences',
|
810
|
);
|
811
|
$ext_links_default["iucn"] = array(
|
812
|
'link_default_value' => 'http://www.iucnredlist.org/',
|
813
|
'text_default_value' => 'Go to IUCN Red List...',
|
814
|
'category_default_value' => 'Conservation',
|
815
|
);
|
816
|
$ext_links_default["ipni"] = array(
|
817
|
'link_default_value' => 'http://www.ipni.org/ipni/advPlantNameSearch.do?',
|
818
|
'text_default_value' => 'Search IPNI...',
|
819
|
'category_default_value' => 'Classification',
|
820
|
);
|
821
|
$ext_links_default["wcsp"] = array(
|
822
|
'link_default_value' => 'http://apps.kew.org/wcsp/prepareChecklist.do?checklist=monocots%40%40150290520121019541',
|
823
|
'text_default_value' => 'Search World Checklist Monocots...',
|
824
|
'category_default_value' => 'Classification',
|
825
|
);
|
826
|
$ext_links_default["tpl"] = array(
|
827
|
'link_default_value' => 'http://www.theplantlist.org/tpl/search?q=',
|
828
|
'text_default_value' => 'Search The Plant List...',
|
829
|
'category_default_value' => 'Classification',
|
830
|
);
|
831
|
$ext_links_default["eol"] = array(
|
832
|
'link_default_value' => 'http://eol.org/search/?q=',
|
833
|
'text_default_value' => 'Search Encyclopaedia of Life...',
|
834
|
'category_default_value' => 'General',
|
835
|
);
|
836
|
$ext_links_default["jstor"] = array(
|
837
|
'link_default_value' => 'http://plants.jstor.org/search?searchText=',
|
838
|
'text_default_value' => 'Search JSTOR Plant Science...',
|
839
|
'category_default_value' => 'General',
|
840
|
);
|
841
|
$ext_links_default["epic"] = array(
|
842
|
'link_default_value' => 'http://epic.kew.org/searchepic/summaryquery.do?scientificName=',
|
843
|
'text_default_value' => 'Search ePIC...',
|
844
|
'category_default_value' => 'General',
|
845
|
);
|
846
|
$ext_links_default["fairchild"] = array(
|
847
|
'link_default_value' => 'http://palmguide.org/palmsearch.php?query=',
|
848
|
'text_default_value' => 'Search Fairchild Guide To Palms...',
|
849
|
'category_default_value' => 'Specimens/Occurrences',
|
850
|
);
|
851
|
return $ext_links_default;
|
852
|
}
|