Project

General

Profile

« Previous | Next » 

Revision 9169e636

Added by Andreas Kohlbecker almost 3 years ago

ref #9659 deleting old code file

View differences:

modules/cdm_dataportal/ext_links/ext_links.ORIG.module
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

  
248
  $ext_links[18] = array(
249
    'form' => 'fairchild',
250
    'form_title' => 'Fairchild Guide To Palms',
251
    'check_title' => 'Display Fairchild Guide To Palms link?',
252
    'link_title' => 'Fairchild Guide To Palms link',
253
    'link_description' => 'The link to Fairchild Guide To Palms without the taxon name.',
254
    'concat_default_value' => '+',
255
    'text_title' => 'Fairchild Guide To Palms text',
256
    'text_description' => 'The text of the link that is displayed..',
257
    'category' => 'Category',
258
    'disabled' => true // programatically disabled since this link does no longer exist.
259
  );
260

  
261
  $ext_links[19] = array(
262
    'form' => 'ggbn',
263
    'form_title' => 'Global Genome Biodiversity Network',
264
    'check_title' => 'Display Global Genome Biodiversity Network Link?',
265
    'link_title' => 'Global Genome Biodiversity Network link',
266
    'link_description' => 'The link to GGBN search without the taxon name.',
267
    'concat_default_value' => '+',
268
    'text_title' => 'Global Genome Biodiversity Network text',
269
    'text_description' => 'The text of the link that is displayed..',
270
    'category' => 'Category',
271
  );
272

  
273

  
274
  foreach (array_keys($ext_links) as $i) {
275
    if(isset($ext_links[$i]['disabled'])){
276
      continue;
277
    }
278
    $form[$ext_links[$i]['form']] = array(
279
      '#type' => 'fieldset',
280
      '#title' => t('@title', array('@title' => $ext_links[$i]['form_title'])),
281
      '#collapsible' => TRUE,
282
      '#collapsed' => TRUE,
283
    );
284
    $form[$ext_links[$i]['form']]['ext_links_' . $ext_links[$i]['form'] . '_check'] = array(
285
      '#type' => 'checkbox',
286
      '#title' => t('@title', array('@title' => $ext_links[$i]['check_title'])),
287
      '#default_value' => variable_get('ext_links_' . $ext_links[$i]['form'] . '_check', 1),
288
    );
289
    $form[$ext_links[$i]['form']]['ext_links_' . $ext_links[$i]['form'] . '_link'] = array(
290
      '#type' => 'textfield',
291
      '#title' => t('@title :', array('@title' => $ext_links[$i]['link_title'])),
292
      '#default_value' => variable_get('ext_links_' . $ext_links[$i]['form'] . '_link', $ext_links_default[$ext_links[$i]['form']]['link_default_value']),
293
      '#size' => 70,
294
      '#maxlength' => 255,
295
      '#description' => t('@description', array('@description' => $ext_links[$i]['link_description'])),
296
    );
297
    $form[$ext_links[$i]['form']]['ext_links_' . $ext_links[$i]['form'] . '_concat'] = array(
298
      '#type' => 'textfield',
299
      '#title' => t('Concatenate string') . ':',
300
      '#default_value' => variable_get('ext_links_' . $ext_links[$i]['form'] . '_concat', $ext_links[$i]['concat_default_value']),
301
      '#size' => 70,
302
      '#maxlength' => 255,
303
      '#description' => t('Concatenate string between genus and species'),
304
    );
305
    $form[$ext_links[$i]['form']]['ext_links_' . $ext_links[$i]['form'] . '_text'] = array(
306
      '#type' => 'textfield',
307
      '#title' => t('@title :', array('@title' => $ext_links[$i]['text_title'])),
308
      '#default_value' => variable_get('ext_links_' . $ext_links[$i]['form'] . '_text', $ext_links_default[$ext_links[$i]['form']]['text_default_value']),
309
      '#size' => 70,
310
      '#maxlength' => 255,
311
      '#description' => t('@description', array('@description' => $ext_links[$i]['text_description'])),
312
    );
313
    $form[$ext_links[$i]['form']]['ext_links_' . $ext_links[$i]['form'] . '_category'] = array(
314
      '#type' => 'textfield',
315
      '#title' => t('@title :', array('@title' => $ext_links[$i]['category'])),
316
      '#default_value' => variable_get('ext_links_' . $ext_links[$i]['form'] . '_category', $ext_links_default[$ext_links[$i]['form']]['category_default_value']),
317
      '#size' => 70,
318
      '#maxlength' => 255,
319
      '#description' => t('@description', array('@description' => $ext_links[$i]['category'])),
320
    );
321
  }
322
  $form['ext_links_options'] = array(
323
    '#type' => 'checkbox',
324
    '#title' => t('Enable sorted list with headings'),
325
    '#default_value' => variable_get('ext_links_options', 0),
326
    '#prefix' => "<div class = \"sorted_list_option\"",
327
    '#suffix' => "</div>",
328
  );
329
  // @WA: D7 form api does not support reset buttons,
330
  // so to mimic the D5 reset button we add one like this.
331
  $form['actions']['reset'] = array(
332
    '#markup' => '<input id="reset" type="reset" class="form-submit" value="' . t('Reset to defaults') . '" />',
333
    '#weight' => 1000,
334
  );
335

  
336
  return system_settings_form($form);
337
} // function ext_links_admin()
338

  
339

  
340
/**
341
 * Implements hook_menu().
342
 */
343
function ext_links_menu() {
344
  $items = array();
345

  
346
  $items['admin/config/cdm_dataportal/extlinks'] = array(
347
    'title' => 'External links',
348
    'description' => 'Description of your External links.',
349
    'page callback' => 'drupal_get_form',
350
    'page arguments' => array('ext_links_admin'),
351
    'access arguments' => array('access administration pages'),
352
    'type' => MENU_NORMAL_ITEM,
353
    'weight' =>30,
354
  );
355

  
356
  return $items;
357
} /* function ext_links_menu() */
358

  
359
/**
360
 * Returns the genus and the first epithet from the object taxon.
361
 */
362
function getSpeciesName($taxon) {
363
  $speciesName = array();
364
  $i = 0;
365
  while (isset($taxon->name->taggedName[$i]) && !isset($speciesName['species'])) {
366
    if ($taxon->name->taggedName[$i]->type == "name") {
367
      if (!isset($speciesName['genus'])) {
368
        $speciesName['genus'] = $taxon->name->taggedName[$i]->text;
369
      }
370
      else {
371
        $speciesName['species'] = $taxon->name->taggedName[$i]->text;
372
      }
373
    }
374
    $i++;
375
  }
376
  return $speciesName;
377
}
378

  
379
/**
380
 * Implements hook_block_info().
381
 */
382
function ext_links_block_info() {
383
  if (TRUE) {
384
    $block[0]["info"] = t("External Taxon Links");
385
    return $block;
386
  }
387
}
388

  
389
/**
390
 * Implements hook_block_view().
391
 */
392
function ext_links_block_view($delta) {
393
  // TODO Rename block deltas (e.g. '0') to readable strings.
394
  switch ($delta) {
395
    case '0':
396
      $block['subject'] = 'External links';
397

  
398
      $uuid = get_current_taxon_uuid();
399
      if ($uuid) {
400
        $taxon = cdm_ws_get(CDM_WS_PORTAL_TAXON, $uuid);
401

  
402
        // $taxon->titleCache;
403
        // var_export()
404
        if (!empty($taxon)) {
405
          drupal_add_js(drupal_get_path('module', 'ext_links') . '/ext_links.js');
406
          $speciesName = getSpeciesName($taxon);
407

  
408
          $genus = $taxon->name->taggedName[0]->text;
409
          $species = null;
410
          if(isset($taxon->name->taggedName[1])){
411
            $species = $taxon->name->taggedName[1]->text;
412
          }
413
          $block_content = '';
414
          $listOption = variable_get("ext_links_options", 0);
415
          if (isset($listOption)) {
416
            $block['content'] = theme('ext_links_list_grouped', array('speciesName' => $speciesName, 'genus' => $genus, 'species' => $species));
417
          }
418
          else {
419
            $block['content'] = theme('ext_links_list_plain', array('speciesName' => $speciesName, 'genus' => $genus, 'species' => $species ));
420
          }
421

  
422
          // if(variable_get('ext_links_gbif_check', TRUE)) {
423
          // $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 />';
424
          /*
425
           $block_content .=
426
           /* TODO
427
           Please manually fix the parameters on the l() or url() function on the next line.
428
           Typically, this was not changed because of a function call inside an array call like
429
           array('title' => t('View user profile.')).
430
           l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
431
           '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],
432
           array(), null, null, true);
433
           */
434
          /*}
435
           if(variable_get('ext_links_biocase_check', 1)) {
436
           $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 />';
437
           }
438
           if(variable_get('ext_links_nybg_check', 1)) {
439
           $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 />';
440
           }
441
           if(variable_get('ext_links_tropicos_check', 1)) {
442
           $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 />';
443
           }
444
           if(variable_get('ext_links_ncbi_check', 1)) {
445
           $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 />';
446
           }
447
           if(variable_get('ext_links_google_check', 1)) {
448
           $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 />';
449
           }
450
           if(variable_get('ext_links_flickr_check', 1)) {
451
           $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 />';
452
           }
453
           if(variable_get('ext_links_scholar_check', 1)) {
454
           $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 />';
455
           }
456
           if(variable_get('ext_links_bhl_check', 1)) {
457
           $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 />';
458
           }
459

  
460
           $block['content'] = $block_content;
461
           $block['content'] = theme('ext_links_list_plain');
462

  
463
           }
464

  
465
           }*/
466
          // if taxon
467
        }
468
      }
469
      // If path.
470
      return $block;
471
  } /* switch */
472

  
473
}
474

  
475
/**
476
 * @todo Please document this function.
477
 * @see http://drupal.org/node/1354
478
 */
479
function theme_ext_links_list_grouped($variables) {
480
  // comment @WA: perhaps this function could be merged with ext_list_plain
481
  // into one function?
482
  $speciesName = $variables['speciesName'];
483
  if(!isset($speciesName['genus'])) {
484
    $speciesName['genus'] = '';
485
  }
486
  if(!isset($speciesName['species'])) {
487
    $speciesName['species'] = '';
488
  }
489
  $genus = $variables['genus'];
490
  $species = $variables['species'];
491
  $block_content = '';
492
  $categories = NULL;
493
  $ext_links_default = ext_links_get_default();
494

  
495

  
496
  /*
497
  foreach ($ext_links_default as $ext_link) {
498

  
499
   //$block_content .= $ext_link['ext_links_bhl_category'];
500
   $category[] = variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
501
   $block_content .= variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
502
   }
503
   */
504

  
505
  // Images section.
506
  if (variable_get('ext_links_google_check', 1)) {
507
    $categoryTitles[] = variable_get('ext_links_google_category', $ext_links_default['google']['category_default_value']);
508
    $categories['google']['title'] = variable_get('ext_links_google_category', $ext_links_default['google']['category_default_value']);
509
    $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 />';
510

  
511
  }
512
  if (variable_get('ext_links_flickr_check', 1)) {
513
    $categoryTitles[] = variable_get('ext_links_flickr_category', $ext_links_default['flickr']['category_default_value']);
514
    $categories['flickr']['title'] = variable_get('ext_links_flickr_category', $ext_links_default['flickr']['category_default_value']);
515
    $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 />';
516
  }
517

  
518
  // Specimen/occurences section.
519
  if (variable_get('ext_links_gbif_check', TRUE)) {
520
    $categoryTitles[] = variable_get('ext_links_gbif_category', $ext_links_default['gbif']['category_default_value']);
521
    $categories['gbif']['title'] = variable_get('ext_links_gbif_category', $ext_links_default['gbif']['category_default_value']);
522
    $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 />';
523
  }
524
  if (variable_get('ext_links_biocase_check', 1)) {
525
    $categoryTitles[] = variable_get('ext_links_biocase_category', $ext_links_default['biocase']['category_default_value']);
526
    $categories['biocase']['title'] = variable_get('ext_links_biocase_category', $ext_links_default['biocase']['category_default_value']);
527
    $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 />';
528
  }
529
  if (variable_get('ext_links_nybg_check', 1)) {
530
    $query = '';
531
    $genusQuery = '';
532
    $speciesQuery = '';
533
    if ($speciesName['genus'] != NULL) {
534
      $query .= 'DetFiledAsGenusLocal+%3D+\%27'. $speciesName['genus']. '\%27';
535
    }
536
    if ($speciesName['species'] != NULL) {
537
      $query .= variable_get('ext_links_nybg_concat', '+AND+'). 'DetFiledAsSpeciesLocal+%3D+\%27'. $speciesName['species'] . '\%27';
538
    }
539
    $categoryTitles[] = variable_get('ext_links_nybg_category', $ext_links_default['nybg']['category_default_value']);
540
    $categories['nybg']['title'] = variable_get('ext_links_nybg_category', $ext_links_default['nybg']['category_default_value']);
541
    $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 />';
542
  }
543
  if (variable_get('ext_links_tropicos_check', 1)) {
544
    $categoryTitles[] = variable_get('ext_links_tropicos_category', $ext_links_default['tropicos']['category_default_value']);
545
    $categories['tropicos']['title'] = variable_get('ext_links_tropicos_category', $ext_links_default['tropicos']['category_default_value']);
546
    $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 />';
547
  }
548

  
549
  // Literature.
550
  if (variable_get('ext_links_scholar_check', 1)) {
551
    $categoryTitles[] = variable_get('ext_links_scholar_category', $ext_links_default['scholar']['category_default_value']);
552
    $categories['scholar']['title'] = variable_get('ext_links_scholar_category', $ext_links_default['scholar']['category_default_value']);
553
    $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 />';
554
  }
555
  if (variable_get('ext_links_bhl_check', 1)) {
556
    $categoryTitles[] = variable_get('ext_links_bhl_category', $ext_links_default['bhl']['category_default_value']);
557
    $categories['bhl']['title'] = variable_get('ext_links_bhl_category', $ext_links_default['bhl']['category_default_value']);
558
    $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 />';
559
  }
560

  
561
  // Molecular resources.
562
  if (variable_get('ext_links_ncbi_check', 1)) {
563
    $categoryTitles[] = variable_get('ext_links_ncbi_category', $ext_links_default['ncbi']['category_default_value']);
564
    $categories['ncbi']['title'] = variable_get('ext_links_ncbi_category', $ext_links_default['ncbi']['category_default_value']);
565
    $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 />';
566
  }
567
  if (variable_get('ext_links_arkive_check', 1)) {
568
    $postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
569
    $categoryTitles[] = variable_get('ext_links_arkive_category', $ext_links_default['arkive']['category_default_value']);
570
    $categories['arkive']['title'] = variable_get('ext_links_arkive_category', $ext_links_default['arkive']['category_default_value']);
571
    $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 />';
572
  }
573
  if (variable_get('ext_links_herbcat_check', 1)) {
574
    $postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
575
    $categoryTitles[] = variable_get('ext_links_herbcat_category', $ext_links_default['herbcat']['category_default_value']);
576
    $categories['herbcat']['title'] = variable_get('ext_links_herbcat_category', $ext_links_default['herbcat']['category_default_value']);
577
    $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 />';
578
  }
579
  if (variable_get('ext_links_iucn_check', 1)) {
580
    $categoryTitles[] = variable_get('ext_links_iucn_category', $ext_links_default['iucn']['category_default_value']);
581
    $categories['iucn']['title'] = variable_get('ext_links_iucn_category', $ext_links_default['iucn']['category_default_value']);
582
    $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 />';
583
  }
584
  if (variable_get('ext_links_ipni_check', 1)) {
585
    $genusQuery = 'find_genus=' . $speciesName['genus'];
586
    $speciesQuery = 'find_species=' . $speciesName['species'];
587
    $categoryTitles[] = variable_get('ext_links_ipni_category', $ext_links_default['ipni']['category_default_value']);
588
    $categories['ipni']['title'] = variable_get('ext_links_ipni_category', $ext_links_default['ipni']['category_default_value']);
589
    $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 />';
590
  }
591
  if (variable_get('ext_links_wcsp_check', 1)) {
592
    $categoryTitles[] = variable_get('ext_links_wcsp_category', $ext_links_default['wcsp']['category_default_value']);
593
    $categories['wcsp']['title'] = variable_get('ext_links_wcsp_category', $ext_links_default['wcsp']['category_default_value']);
594
    $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 />';
595
  }
596
  if (variable_get('ext_links_tpl_check', 1)) {
597
    $categoryTitles[] = variable_get('ext_links_tpl_category', $ext_links_default['tpl']['category_default_value']);
598
    $categories['tpl']['title'] = variable_get('ext_links_tpl_category', $ext_links_default['tpl']['category_default_value']);
599
    $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 />';
600
  }
601
  if (variable_get('ext_links_eol_check', 1)) {
602
    $categoryTitles[] = variable_get('ext_links_eol_category', $ext_links_default['eol']['category_default_value']);
603
    $categories['eol']['title'] = variable_get('ext_links_eol_category', $ext_links_default['eol']['category_default_value']);
604
    $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 />';
605
  }
606
  if (variable_get('ext_links_jstor_check', 1)) {
607
    $categoryTitles[] = variable_get('ext_links_jstor_category', $ext_links_default['jstor']['category_default_value']);
608
    $categories['jstor']['title'] = variable_get('ext_links_jstor_category', $ext_links_default['jstor']['category_default_value']);
609
    $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 />';
610
  }
611
  if (variable_get('ext_links_epic_check', 1)) {
612
    $postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
613
    $categoryTitles[] = variable_get('ext_links_epic_category', $ext_links_default['epic']['category_default_value']);
614
    $categories['epic']['title'] = variable_get('ext_links_epic_category', $ext_links_default['epic']['category_default_value']);
615
    $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 />';
616
  }
617
//  if (variable_get('ext_links_fairchild_check', 1)) {
618
//    $categoryTitles[] = variable_get('ext_links_fairchild_category', $ext_links_default['fairchild']['category_default_value']);
619
//    $categories['fairchild']['title'] = variable_get('ext_links_fairchild_category', $ext_links_default['fairchild']['category_default_value']);
620
//    $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 />';
621
//  }
622
  if (variable_get('ext_links_ggbn_check', 1)) {
623
    $categoryTitles[] = variable_get('ext_links_ggbn_category', $ext_links_default['ggbn']['category_default_value']);
624
    $categories['ggbn']['title'] = variable_get('ext_links_ggnb_category', $ext_links_default['ggbn']['category_default_value']);
625
    $categories['ggbn']['content'] = '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_ggbn_link', $ext_links_default['ggbn']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_ggbn_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_ggbn_text', $ext_links_default['ggbn']['text_default_value']) . '</a><br />';
626
  }
627

  
628
  $categoryTitles = array_unique($categoryTitles);
629
  foreach ($categoryTitles as $categoryTitle) {
630
    // $block_content .= "specName" . $speciesName;
631
    $block_content .= "<div class=\"category\"><h5>" . $categoryTitle . "</h5>";
632
    foreach ($categories as $category) {
633
      if ($category['title'] == $categoryTitle) {
634
        $block_content .= $category['content'];
635
      }
636
    }
637
    $block_content .= "</div>";
638
  }
639

  
640

  
641
  return $block_content;
642
}
643

  
644
/**
645
 * @todo Please document this function.
646
 * @see http://drupal.org/node/1354
647
 */
648
function theme_ext_links_list_plain($variables) {
649
  $speciesName = $variables['speciesName'];
650
  if (!isset($speciesName['genus'])) {
651
    $speciesName['genus'] = '';
652
  }
653
  if (!isset($speciesName['species'])) {
654
    $speciesName['species'] = '';
655
  }
656
  $genus = $variables['genus'];
657
  $species = $variables['species'];
658
  $ext_links_default = ext_links_get_default();
659
  $block_content = '';
660
  if (variable_get('ext_links_gbif_check', TRUE)) {
661
    $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 />';
662
    /*
663
     $block_content .= /* TODO
664
     Please manually fix the parameters on the l() or url() function on the next line.
665
     Typically, this was not changed because of a function call inside an array call like
666
     array('title' => t('View user profile.')).*/
667
    /*
668
     l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
669
     '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],
670
     array(), null, null, true);
671
     */
672
  }
673
  if (variable_get('ext_links_biocase_check', 1)) {
674
    $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 />';
675
  }
676
  if (variable_get('ext_links_nybg_check', 1)) {
677
    // $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 />';
678
    $genusQuery = '';
679
    $speciesQuery = '';
680
    if ($speciesName['genus'] != NULL) {
681
      $genusQuery = 'DetFiledAsGenusLocal+%3D+\%27' . $speciesName['genus'] . '\%27';
682
    }
683
    if ($speciesName['species'] != NULL) {
684
      $speciesQuery = 'DetFiledAsSpeciesLocal+%3D+\%27' . $speciesName['species'] . '\%27';
685
    }
686
    $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 />';
687
  }
688
  if (variable_get('ext_links_tropicos_check', 1)) {
689
    $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 />';
690
  }
691
  if (variable_get('ext_links_ncbi_check', 1)) {
692
    $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 />';
693
  }
694
  if (variable_get('ext_links_google_check', 1)) {
695
    $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 />';
696
  }
697
  if (variable_get('ext_links_flickr_check', 1)) {
698
    $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 />';
699
  }
700
  if (variable_get('ext_links_scholar_check', 1)) {
701
    $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 />';
702
  }
703
  if (variable_get('ext_links_bhl_check', 1)) {
704
    $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 />';
705
  }
706
//  if (variable_get('ext_links_fairchild_check', 1)) {
707
//    $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 />';
708
//  }
709
  if (variable_get('ext_links_ggbn_check', 1)) {
710
    $block_content .= '<a href="JavaScript:popupExternalLinks(\'' . variable_get('ext_links_ggbn_link', $ext_links_default['ggbn']['link_default_value']) . str_replace('"', '%22', $speciesName['genus']) . variable_get('ext_links_ggbn_concat', ' ') . str_replace('"', '%22', $speciesName['species']) . '\')">' . variable_get('ext_links_ggbn_text', $ext_links_default['ggbn']['text_default_value']) . '</a><br />';
711
  }
712
  if (variable_get('ext_links_arkive_check', 1)) {
713
    $postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
714
    $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 />';
715
  }
716
  if (variable_get('ext_links_herbcat_check', 1)) {
717
    $postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
718
    $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 />';
719
  }
720
  if (variable_get('ext_links_iucn_check', 1)) {
721
    $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 />';
722

  
723
  }
724
  if (variable_get('ext_links_ipni_check', 1)) {
725
    $genusQuery = 'find_genus=' . $speciesName['genus'];
726
    $speciesQuery = 'find_species=' . $speciesName['species'];
727
    $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 />';
728
  }
729
  if (variable_get('ext_links_wcsp_check', 1)) {
730
    $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 />';
731

  
732
  }
733
  if (variable_get('ext_links_tpl_check', 1)) {
734
    $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 />';
735
  }
736
  if (variable_get('ext_links_eol_check', 1)) {
737
    $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 />';
738
  }
739
  if (variable_get('ext_links_jstor_check', 1)) {
740
    $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 />';
741
  }
742
  if (variable_get('ext_links_epic_check', 1)) {
743
    $postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
744
    $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 />';
745
  }
746

  
747
  return $block_content;
748
}
749

  
750
// Include the admin form if we really want it to use.
751
/*
752
if (arg(0) === 'admin' AND arg(1) === 'user' AND arg(2) === 'ext_link') {
753
  module_load_include('inc', 'ext_links', 'xt_link_admin');
754
}
755
*/
756

  
757
/**
758
 * @todo Please document this function.
759
 * @see http://drupal.org/node/1354
760
 */
761
function ext_links_theme() {
762
  return array(
763
    'ext_links_list_grouped' => array('variables' => array(
764
      'speciesName' => NULL,
765
      'genus' => NULL,
766
      'species' => NULL,
767
      )),
768
    'ext_links_list_plain' => array('variables' => array(
769
      'speciesName' => NULL,
770
      'genus' => NULL,
771
      'species' => NULL,
772
      )),
773
  );
774
}
775

  
776
/**
777
 * Get the default external links.
778
 *
779
 * @return array
780
 *   Returns an array with default external links values.
781
 */
782
function ext_links_get_default() {
783
  $ext_links_default["gbif"] = array(
784
    'link_default_value' => 'http://www.gbif.org/species/search?q=',
785
    'text_default_value' => 'Search GBIF...',
786
    'category_default_value' => 'Specimens/Occurrences',
787
  );
788
  $ext_links_default["biocase"] = array(
789
    'link_default_value' => 'http://search.biocase.org/edit/search/units/simpleSearch/query1?unitName=',
790
    'text_default_value' => 'Search BioCASE...',
791
    'category_default_value' => 'Specimens/Occurrences',
792
  );
793
  $ext_links_default["nybg"] = array(
794
    'link_default_value' => 'http://sweetgum.nybg.org/science/vh/specimen_list.php?SummaryData=',
795
    'text_default_value' => 'Search NYBG...',
796
    'category_default_value' => 'Specimens/Occurrences',
797
  );
798
  $ext_links_default["tropicos"] = array(
799
    'link_default_value' => 'http://www.tropicos.org/NameSearch.aspx?name=',
800
    'text_default_value' => 'Search Tropicos...',
801
    'category_default_value' => 'Specimens/Occurrences',
802
  );
803
  $ext_links_default["ncbi"] = array(
804
    'link_default_value' => 'http://www.ncbi.nlm.nih.gov/gquery/gquery.fcgi?term=',
805
    'text_default_value' => 'Search NCBI...',
806
    'category_default_value' => 'Molecular Resources',
807
  );
808
  $ext_links_default["google"] = array(
809
    'link_default_value' => 'http://images.google.com/images?q=',
810
    'text_default_value' => 'Search Google Images...',
811
    'category_default_value' => 'Images',
812
  );
813
  $ext_links_default["flickr"] = array(
814
    'link_default_value' => 'http://www.flickr.com/search/?w=all&q=',
815
    'text_default_value' => 'Search flickr...',
816
    'category_default_value' => 'Images',
817
  );
818
  $ext_links_default["scholar"] = array(
819
    'link_default_value' => 'http://scholar.google.de/scholar?hl=de&btnG=Suche&lr=&as_ylo=&as_vis=0&q=',
820
    'text_default_value' => 'Search Google scholar...',
821
    'category_default_value' => 'Literature',
822
  );
823
  $ext_links_default["bhl"] = array(
824
    'link_default_value' => 'http://www.biodiversitylibrary.org/Search.aspx?searchCat=&searchTerm=',
825
    'text_default_value' => 'Search BHL...',
826
    'category_default_value' => 'Literature',
827
  );
828
  $ext_links_default["arkive"] = array(
829
    'link_default_value' => 'http://www.arkive.org/search.html?q=',
830
    'text_default_value' => 'Search ARKive...',
831
    'category_default_value' => 'Images',
832
  );
833
  $ext_links_default["herbcat"] = array(
834
    'link_default_value' => 'http://apps.kew.org/herbcat/getHomePageResults.do?homePageSearchText=',
835
    'text_default_value' => 'Search Kew Herbarium Catalogue...',
836
    'category_default_value' => 'Specimens/Occurrences',
837
  );
838
  $ext_links_default["iucn"] = array(
839
    'link_default_value' => 'http://www.iucnredlist.org/',
840
    'text_default_value' => 'Go to IUCN Red List...',
841
    'category_default_value' => 'Conservation',
842
  );
843
  $ext_links_default["ipni"] = array(
844
    'link_default_value' => 'http://www.ipni.org/ipni/advPlantNameSearch.do?',
845
    'text_default_value' => 'Search IPNI...',
846
    'category_default_value' => 'Classification',
847
  );
848
  $ext_links_default["wcsp"] = array(
849
    'link_default_value' => 'http://wcsp.science.kew.org/qsearch.do?plantName=',
850
    'text_default_value' => 'Search World Checklist Monocots...',
851
    'category_default_value' => 'Classification',
852
  );
853
  $ext_links_default["tpl"] = array(
854
    'link_default_value' => 'http://www.theplantlist.org/tpl/search?q=',
855
    'text_default_value' => 'Search The Plant List...',
856
    'category_default_value' => 'Classification',
857
  );
858
  $ext_links_default["eol"] = array(
859
    'link_default_value' => 'http://eol.org/search/?q=',
860
    'text_default_value' => 'Search Encyclopaedia of Life...',
861
    'category_default_value' => 'General',
862
  );
863
  $ext_links_default["jstor"] = array(
864
    'link_default_value' => 'https://plants.jstor.org/search?filter=name&so=ps_group_by_genus_species+asc&Query=',
865
    'text_default_value' => 'Search JSTOR Plant Science...',
866
    'category_default_value' => 'General',
867
  );
868
  $ext_links_default["epic"] = array(
869
    'link_default_value' => 'http://epic.kew.org/searchepic/summaryquery.do?scientificName=',
870
    'text_default_value' => 'Search ePIC...',
871
    'category_default_value' => 'General',
872
  );
873
  /*
874
   * hidden since Fairchild Guide To Palms seems to be down
875
  $ext_links_default["fairchild"] = array(
876
    'link_default_value' => 'http://palmguide.org/palmsearch.php?query=',
877
    'text_default_value' => 'Search Fairchild Guide To Palms...',
878
    'category_default_value' => 'Specimens/Occurrences',
879
  );
880
  */
881
  $ext_links_default["ggbn"] = array(
882
    'link_default_value' => 'http://www.ggbn.org/ggbn_portal/search/result?fullScientificName=',
883
    'text_default_value' => 'Search GGBN...',
884
    'category_default_value' => 'Molecular Resources',
885
  );
886
  //
887
  return $ext_links_default;
888
}

Also available in: Unified diff