Project

General

Profile

Download (47.9 KB) Statistics
| Branch: | Tag: | Revision:
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
  switch ($path) {
33
    case 'admin/help#ext_links':
34
      $output = '<p>' . t("Link to external sources like ## for taxa.") . '</p>';
35
      return $output;
36
    case 'admin/config/cdm_dataportal/ext_links':
37
      $output = '<p>' . t('The external links module allows to configure URL templates for links to external data sources.');
38
      return $output;
39
    case 'admin/config/cdm_dataportal/ext_links/%':
40
      $output = '<p>' . t('An external link template.');
41
      return $output;
42
  }
43
}
44

    
45
/**
46
 * Implements hook_menu().
47
 */
48
function ext_links_menu() {
49
  $items = [];
50

    
51
  $items['admin/config/cdm_dataportal/ext_links'] = [
52
    'title' => 'External links',
53
    'description' => 'Configure external links templates.',
54
    'page callback' => 'drupal_get_form',
55
    'page arguments' => ['ext_links_admin_overview'],
56
    'access arguments' => ['access administration pages'],
57
    'file' => 'ext_links.admin.inc'
58
  ];
59
  $items['admin/config/cdm_dataportal/ext_links/list'] = [
60
    'title' => 'List',
61
    'type' => MENU_DEFAULT_LOCAL_TASK,
62
  ];
63
  $items['admin/config/cdm_dataportal/ext_links/add'] = [
64
    'title' => 'Add external link',
65
    'page callback' => 'ext_links_admin_link_template_page',
66
    'access arguments' => ['access administration pages'],
67
    'type' => MENU_LOCAL_ACTION,
68
    'weight' => 1,
69
    'file' => 'ext_links.admin.inc',
70
  ];
71
  $items['admin/config/cdm_dataportal/ext_links/%ext_links'] = [ // %ext_links refers to ext_links_load
72
    'title' => 'Edit external link',
73
    'page callback' => 'ext_links_admin_link_template_page',
74
    'page arguments' => [4],
75
    'access arguments' => ['access administration pages'],
76
    'file' => 'ext_links.admin.inc',
77
  ];
78
//  $items['admin/config/cdm_dataportal/ext_links/%link_template/status/%value'] = [
79
//    'title' => 'Disable external link',
80
//    'page callback' => 'drupal_get_form',
81
//    'page arguments' => ['ext_links_admin_disable', 4],
82
//    'access arguments' => ['access administration pages'],
83
//    'file' => 'ext_links.admin.inc',
84
//  ];
85
  return $items;
86
}
87

    
88

    
89
/**
90
 * Retrieves a list of External Link templates, ordered by weight.
91
 *
92
 * @return
93
 *   An array of external link template objects, keyed by the format ID and ordered by
94
 *   weight.
95
 *
96
 */
97
function ext_links_templates() {
98
  global $language;
99
  $link_templates = &drupal_static(__FUNCTION__, array());
100

    
101
  // cache_clear_all("ext_links_templates:{$language->language}");
102
  // All available link_templates are cached for performance.
103
  if (!is_array($link_templates) || !count($link_templates)) {
104
    if ($cache = cache_get("ext_links_templates:{$language->language}")) {
105
      $link_templates = $cache->data;
106
    }
107
    else {
108
      $test = true;
109
      if($test){
110
        $link_templates = [];
111
        $link_templates_arrays = ext_links_template_defaults();
112
        foreach($link_templates_arrays as $a){
113
          $link_templates[] = (object)$a;
114
        }
115
      } else {
116
        $link_templates = db_select('ext_links', 'elt')
117
          ->addTag('translatable')
118
          ->fields('elt')
119
          ->condition('status', 1)
120
          ->orderBy('weight')
121
          ->execute();
122
      }
123
      // cache_set("ext_links_templates:{$language->language}", $link_templates);
124
    }
125
  }
126
  return $link_templates;
127
}
128

    
129
/**
130
 * Resets the text format caches.
131
 *
132
 * @see filter_formats()
133
 */
134
function ext_links_templates_reset() {
135
  cache_clear_all('ext_links_templates', 'cache', TRUE);
136
  drupal_static_reset('ext_links_templates');
137
}
138

    
139
/**
140
 * Loads a text format object from the database.
141
 *
142
 * @param $extlink_id
143
 *   The external link ID. ($link->id)
144
 *
145
 * @return
146
 *   A fully-populated text format object, if the requested format exists and
147
 *   is enabled. If the format does not exist, or exists in the database but
148
 *   has been marked as disabled, FALSE is returned.
149
 *
150
 * @see ext_links_exists()
151
 */
152
function ext_links_load($extlink_id) {
153
  $test = TRUE;
154
  if($test) {
155
    $defaults = ext_links_template_defaults();
156
    return isset($defaults[$extlink_id]) ? (object)$defaults[$extlink_id] : FALSE;
157
  }
158
  else {
159
   $formats = ext_links_templates();
160
    return isset($formats[$extlink_id]) ? $formats[$extlink_id] : FALSE;
161
  }
162
}
163

    
164
/**
165
 * Saves a text format object to the database.
166
 *
167
 * @param $link_template
168
 *   A link template object having the properties:
169
 *   - id: The machine name of the external link. If this corresponds
170
 *     to an existing external link, this one will be updated;
171
 *     otherwise, a new external link will be created.
172
 *   - title: The link title
173
 *   - link: The link url template.
174
 *   - glue: The string to concatenate name parts in the URL query string.
175
 *   - status: (optional) An integer indicating whether the ext link is
176
 *     enabled (1) or not (0). Defaults to 1.
177
 *   - weight: (optional) The weight of the external link, which controls its
178
 *     placement in external link block. If omitted, the weight is set to 0.
179
 *     Defaults to NULL.
180
 *
181
 * @return
182
 *   SAVED_NEW or SAVED_UPDATED.
183
 */
184
function ext_links_save($link_template) {
185
  $link_template->title = trim($link_template->title);
186
  $link_template->cache = true;
187
  if (!isset($link_template->status)) {
188
    $link_template->status = 1;
189
  }
190
  if (!isset($link_template->weight)) {
191
    $link_template->weight = 0;
192
  }
193

    
194
  // Insert or update the text format.
195
  $return = db_merge('ext_links')
196
    ->key(array('format' => $link_template->title))
197
    ->fields(array(
198
      'id' => $link_template->id,
199
      'title' => $link_template->title,
200
      'link' => $link_template->link,
201
      'glue' => $link_template->glue,
202
      'status' => (int) $link_template->status,
203
      'weight' => (int) $link_template->weight,
204
    ))
205
    ->execute();
206

    
207
  if ($return != SAVED_NEW) {
208
    // Clear the filter cache whenever an external link is updated.
209
    cache_clear_all($link_template->format . ':', 'cache_filter', TRUE);
210
  }
211
  ext_links_templates_reset();
212
  return $return;
213
}
214

    
215
/**
216
 * Determines if a external link exists.
217
 *
218
 * @param $ext_link_name
219
 *   The ID of the external link to check.
220
 *
221
 * @return
222
 *   TRUE if the external link exists, FALSE otherwise.
223
 *
224
 * @see ext_links_load()
225
 */
226
function ext_links_exists($ext_link_name) {
227
  return (bool) db_query_range('SELECT 1 FROM {ext_links} WHERE name = :name', 0, 1, array(':name' => $ext_link_name))->fetchField();
228
}
229

    
230

    
231
/**
232
 * Returns the genus and the first epithet from the object taxon.
233
 *
234
 * @param $taxon
235
 *   A CDM Taxon instance object
236
 * @return array
237
 *  An associate array with two elements:
238
 *     - genus: the uninomial
239
 *     - species: the species epithet
240
 */
241
function ext_link_species_name($taxon) {
242
  $speciesName = array();
243
  $i = 0;
244
  while (isset($taxon->name->taggedName[$i]) && !isset($speciesName['species'])) {
245
    if ($taxon->name->taggedName[$i]->type == "name") {
246
      if (!isset($speciesName['genus'])) {
247
        $speciesName['genus'] = $taxon->name->taggedName[$i]->text;
248
      }
249
      else {
250
        $speciesName['species'] = $taxon->name->taggedName[$i]->text;
251
      }
252
    }
253
    $i++;
254
  }
255
  return $speciesName;
256
}
257

    
258
/**
259
 * Implements hook_block_info().
260
 */
261
function ext_links_block_info() {
262
  if (TRUE) {
263
    $block[0]["info"] = t("External Taxon Links");
264
    return $block;
265
  }
266
}
267

    
268
/**
269
 * Implements hook_block_view().
270
 */
271
function ext_links_block_view($delta) {
272
  // TODO Rename block deltas (e.g. '0') to readable strings.
273
  switch ($delta) {
274
    case '0':
275
      $block['subject'] = 'External links';
276

    
277
      $uuid = get_current_taxon_uuid();
278
      if ($uuid) {
279
        $taxon = cdm_ws_get(CDM_WS_PORTAL_TAXON, $uuid);
280

    
281
        // $taxon->titleCache;
282
        // var_export()
283
        if (!empty($taxon)) {
284
          drupal_add_js(drupal_get_path('module', 'ext_links') . '/ext_links.js');
285
          $speciesName = ext_link_species_name($taxon);
286

    
287
          $genus = $taxon->name->taggedName[0]->text;
288
          $species = null;
289
          if(isset($taxon->name->taggedName[1])){
290
            $species = $taxon->name->taggedName[1]->text;
291
          }
292
          $block_content = '';
293
          $listOption = variable_get("ext_links_options", 0);
294
          if (isset($listOption)) {
295
            $block['content'] = theme('ext_links_list_grouped', array('speciesName' => $speciesName, 'genus' => $genus, 'species' => $species));
296
          }
297
          else {
298
            $block['content'] = theme('ext_links_list_plain', array('speciesName' => $speciesName, 'genus' => $genus, 'species' => $species ));
299
          }
300

    
301
          // if(variable_get('ext_links_gbif_check', TRUE)) {
302
          // $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 />';
303
          /*
304
           $block_content .=
305
           /* TODO
306
           Please manually fix the parameters on the l() or url() function on the next line.
307
           Typically, this was not changed because of a function call inside an array call like
308
           array('title' => t('View user profile.')).
309
           l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
310
           '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],
311
           array(), null, null, true);
312
           */
313
          /*}
314
           if(variable_get('ext_links_biocase_check', 1)) {
315
           $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 />';
316
           }
317
           if(variable_get('ext_links_nybg_check', 1)) {
318
           $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 />';
319
           }
320
           if(variable_get('ext_links_tropicos_check', 1)) {
321
           $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 />';
322
           }
323
           if(variable_get('ext_links_ncbi_check', 1)) {
324
           $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 />';
325
           }
326
           if(variable_get('ext_links_google_check', 1)) {
327
           $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 />';
328
           }
329
           if(variable_get('ext_links_flickr_check', 1)) {
330
           $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 />';
331
           }
332
           if(variable_get('ext_links_scholar_check', 1)) {
333
           $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 />';
334
           }
335
           if(variable_get('ext_links_bhl_check', 1)) {
336
           $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 />';
337
           }
338

    
339
           $block['content'] = $block_content;
340
           $block['content'] = theme('ext_links_list_plain');
341

    
342
           }
343

    
344
           }*/
345
          // if taxon
346
        }
347
      }
348
      // If path.
349
      return $block;
350
  } /* switch */
351

    
352
}
353

    
354
/**
355
 * @todo Please document this function.
356
 * @see http://drupal.org/node/1354
357
 */
358
function theme_ext_links_list_grouped($variables) {
359
  // comment @WA: perhaps this function could be merged with ext_list_plain
360
  // into one function?
361
  $speciesName = $variables['speciesName'];
362
  if(!isset($speciesName['genus'])) {
363
    $speciesName['genus'] = '';
364
  }
365
  if(!isset($speciesName['species'])) {
366
    $speciesName['species'] = '';
367
  }
368
  $genus = $variables['genus'];
369
  $species = $variables['species'];
370
  $block_content = '';
371
  $categories = NULL;
372
  $ext_links_default = ext_links_templates();
373

    
374

    
375
  /*
376
  foreach ($ext_links_default as $ext_link) {
377

    
378
   //$block_content .= $ext_link['ext_links_bhl_category'];
379
   $category[] = variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
380
   $block_content .= variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
381
   }
382
   */
383

    
384
  // Images section.
385
  if (variable_get('ext_links_google_check', 1)) {
386
    $categoryTitles[] = variable_get('ext_links_google_category', $ext_links_default['google']['category_default_value']);
387
    $categories['google']['title'] = variable_get('ext_links_google_category', $ext_links_default['google']['category_default_value']);
388
    $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 />';
389

    
390
  }
391
  if (variable_get('ext_links_flickr_check', 1)) {
392
    $categoryTitles[] = variable_get('ext_links_flickr_category', $ext_links_default['flickr']['category_default_value']);
393
    $categories['flickr']['title'] = variable_get('ext_links_flickr_category', $ext_links_default['flickr']['category_default_value']);
394
    $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 />';
395
  }
396

    
397
  // Specimen/occurences section.
398
  if (variable_get('ext_links_gbif_check', TRUE)) {
399
    $categoryTitles[] = variable_get('ext_links_gbif_category', $ext_links_default['gbif']['category_default_value']);
400
    $categories['gbif']['title'] = variable_get('ext_links_gbif_category', $ext_links_default['gbif']['category_default_value']);
401
    $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 />';
402
  }
403
  if (variable_get('ext_links_biocase_check', 1)) {
404
    $categoryTitles[] = variable_get('ext_links_biocase_category', $ext_links_default['biocase']['category_default_value']);
405
    $categories['biocase']['title'] = variable_get('ext_links_biocase_category', $ext_links_default['biocase']['category_default_value']);
406
    $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 />';
407
  }
408
  if (variable_get('ext_links_nybg_check', 1)) {
409
    $query = '';
410
    $genusQuery = '';
411
    $speciesQuery = '';
412
    if ($speciesName['genus'] != NULL) {
413
      $query .= 'DetFiledAsGenusLocal+%3D+\%27'. $speciesName['genus']. '\%27';
414
    }
415
    if ($speciesName['species'] != NULL) {
416
      $query .= variable_get('ext_links_nybg_concat', '+AND+'). 'DetFiledAsSpeciesLocal+%3D+\%27'. $speciesName['species'] . '\%27';
417
    }
418
    $categoryTitles[] = variable_get('ext_links_nybg_category', $ext_links_default['nybg']['category_default_value']);
419
    $categories['nybg']['title'] = variable_get('ext_links_nybg_category', $ext_links_default['nybg']['category_default_value']);
420
    $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 />';
421
  }
422
  if (variable_get('ext_links_tropicos_check', 1)) {
423
    $categoryTitles[] = variable_get('ext_links_tropicos_category', $ext_links_default['tropicos']['category_default_value']);
424
    $categories['tropicos']['title'] = variable_get('ext_links_tropicos_category', $ext_links_default['tropicos']['category_default_value']);
425
    $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 />';
426
  }
427

    
428
  // Literature.
429
  if (variable_get('ext_links_scholar_check', 1)) {
430
    $categoryTitles[] = variable_get('ext_links_scholar_category', $ext_links_default['scholar']['category_default_value']);
431
    $categories['scholar']['title'] = variable_get('ext_links_scholar_category', $ext_links_default['scholar']['category_default_value']);
432
    $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 />';
433
  }
434
  if (variable_get('ext_links_bhl_check', 1)) {
435
    $categoryTitles[] = variable_get('ext_links_bhl_category', $ext_links_default['bhl']['category_default_value']);
436
    $categories['bhl']['title'] = variable_get('ext_links_bhl_category', $ext_links_default['bhl']['category_default_value']);
437
    $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 />';
438
  }
439

    
440
  // Molecular resources.
441
  if (variable_get('ext_links_ncbi_check', 1)) {
442
    $categoryTitles[] = variable_get('ext_links_ncbi_category', $ext_links_default['ncbi']['category_default_value']);
443
    $categories['ncbi']['title'] = variable_get('ext_links_ncbi_category', $ext_links_default['ncbi']['category_default_value']);
444
    $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 />';
445
  }
446
  if (variable_get('ext_links_arkive_check', 1)) {
447
    $postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
448
    $categoryTitles[] = variable_get('ext_links_arkive_category', $ext_links_default['arkive']['category_default_value']);
449
    $categories['arkive']['title'] = variable_get('ext_links_arkive_category', $ext_links_default['arkive']['category_default_value']);
450
    $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 />';
451
  }
452
  if (variable_get('ext_links_herbcat_check', 1)) {
453
    $postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
454
    $categoryTitles[] = variable_get('ext_links_herbcat_category', $ext_links_default['herbcat']['category_default_value']);
455
    $categories['herbcat']['title'] = variable_get('ext_links_herbcat_category', $ext_links_default['herbcat']['category_default_value']);
456
    $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 />';
457
  }
458
  if (variable_get('ext_links_iucn_check', 1)) {
459
    $categoryTitles[] = variable_get('ext_links_iucn_category', $ext_links_default['iucn']['category_default_value']);
460
    $categories['iucn']['title'] = variable_get('ext_links_iucn_category', $ext_links_default['iucn']['category_default_value']);
461
    $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 />';
462
  }
463
  if (variable_get('ext_links_ipni_check', 1)) {
464
    $genusQuery = 'find_genus=' . $speciesName['genus'];
465
    $speciesQuery = 'find_species=' . $speciesName['species'];
466
    $categoryTitles[] = variable_get('ext_links_ipni_category', $ext_links_default['ipni']['category_default_value']);
467
    $categories['ipni']['title'] = variable_get('ext_links_ipni_category', $ext_links_default['ipni']['category_default_value']);
468
    $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 />';
469
  }
470
  if (variable_get('ext_links_wcsp_check', 1)) {
471
    $categoryTitles[] = variable_get('ext_links_wcsp_category', $ext_links_default['wcsp']['category_default_value']);
472
    $categories['wcsp']['title'] = variable_get('ext_links_wcsp_category', $ext_links_default['wcsp']['category_default_value']);
473
    $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 />';
474
  }
475
  if (variable_get('ext_links_tpl_check', 1)) {
476
    $categoryTitles[] = variable_get('ext_links_tpl_category', $ext_links_default['tpl']['category_default_value']);
477
    $categories['tpl']['title'] = variable_get('ext_links_tpl_category', $ext_links_default['tpl']['category_default_value']);
478
    $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 />';
479
  }
480
  if (variable_get('ext_links_eol_check', 1)) {
481
    $categoryTitles[] = variable_get('ext_links_eol_category', $ext_links_default['eol']['category_default_value']);
482
    $categories['eol']['title'] = variable_get('ext_links_eol_category', $ext_links_default['eol']['category_default_value']);
483
    $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 />';
484
  }
485
  if (variable_get('ext_links_jstor_check', 1)) {
486
    $categoryTitles[] = variable_get('ext_links_jstor_category', $ext_links_default['jstor']['category_default_value']);
487
    $categories['jstor']['title'] = variable_get('ext_links_jstor_category', $ext_links_default['jstor']['category_default_value']);
488
    $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 />';
489
  }
490
  if (variable_get('ext_links_epic_check', 1)) {
491
    $postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
492
    $categoryTitles[] = variable_get('ext_links_epic_category', $ext_links_default['epic']['category_default_value']);
493
    $categories['epic']['title'] = variable_get('ext_links_epic_category', $ext_links_default['epic']['category_default_value']);
494
    $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 />';
495
  }
496
//  if (variable_get('ext_links_fairchild_check', 1)) {
497
//    $categoryTitles[] = variable_get('ext_links_fairchild_category', $ext_links_default['fairchild']['category_default_value']);
498
//    $categories['fairchild']['title'] = variable_get('ext_links_fairchild_category', $ext_links_default['fairchild']['category_default_value']);
499
//    $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 />';
500
//  }
501
  if (variable_get('ext_links_ggbn_check', 1)) {
502
    $categoryTitles[] = variable_get('ext_links_ggbn_category', $ext_links_default['ggbn']['category_default_value']);
503
    $categories['ggbn']['title'] = variable_get('ext_links_ggnb_category', $ext_links_default['ggbn']['category_default_value']);
504
    $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 />';
505
  }
506

    
507
  $categoryTitles = array_unique($categoryTitles);
508
  foreach ($categoryTitles as $categoryTitle) {
509
    // $block_content .= "specName" . $speciesName;
510
    $block_content .= "<div class=\"category\"><h5>" . $categoryTitle . "</h5>";
511
    foreach ($categories as $category) {
512
      if ($category['title'] == $categoryTitle) {
513
        $block_content .= $category['content'];
514
      }
515
    }
516
    $block_content .= "</div>";
517
  }
518

    
519

    
520
  return $block_content;
521
}
522

    
523
/**
524
 * @todo Please document this function.
525
 * @see http://drupal.org/node/1354
526
 */
527
function theme_ext_links_list_plain($variables) {
528
  $speciesName = $variables['speciesName'];
529
  if (!isset($speciesName['genus'])) {
530
    $speciesName['genus'] = '';
531
  }
532
  if (!isset($speciesName['species'])) {
533
    $speciesName['species'] = '';
534
  }
535
  $genus = $variables['genus'];
536
  $species = $variables['species'];
537
  $ext_links_default = ext_links_get_default();
538
  $block_content = '';
539
  if (variable_get('ext_links_gbif_check', TRUE)) {
540
    $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 />';
541
    /*
542
     $block_content .= /* TODO
543
     Please manually fix the parameters on the l() or url() function on the next line.
544
     Typically, this was not changed because of a function call inside an array call like
545
     array('title' => t('View user profile.')).*/
546
    /*
547
     l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
548
     '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],
549
     array(), null, null, true);
550
     */
551
  }
552
  if (variable_get('ext_links_biocase_check', 1)) {
553
    $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 />';
554
  }
555
  if (variable_get('ext_links_nybg_check', 1)) {
556
    // $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 />';
557
    $genusQuery = '';
558
    $speciesQuery = '';
559
    if ($speciesName['genus'] != NULL) {
560
      $genusQuery = 'DetFiledAsGenusLocal+%3D+\%27' . $speciesName['genus'] . '\%27';
561
    }
562
    if ($speciesName['species'] != NULL) {
563
      $speciesQuery = 'DetFiledAsSpeciesLocal+%3D+\%27' . $speciesName['species'] . '\%27';
564
    }
565
    $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 />';
566
  }
567
  if (variable_get('ext_links_tropicos_check', 1)) {
568
    $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 />';
569
  }
570
  if (variable_get('ext_links_ncbi_check', 1)) {
571
    $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 />';
572
  }
573
  if (variable_get('ext_links_google_check', 1)) {
574
    $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 />';
575
  }
576
  if (variable_get('ext_links_flickr_check', 1)) {
577
    $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 />';
578
  }
579
  if (variable_get('ext_links_scholar_check', 1)) {
580
    $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 />';
581
  }
582
  if (variable_get('ext_links_bhl_check', 1)) {
583
    $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 />';
584
  }
585
//  if (variable_get('ext_links_fairchild_check', 1)) {
586
//    $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 />';
587
//  }
588
  if (variable_get('ext_links_ggbn_check', 1)) {
589
    $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 />';
590
  }
591
  if (variable_get('ext_links_arkive_check', 1)) {
592
    $postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
593
    $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 />';
594
  }
595
  if (variable_get('ext_links_herbcat_check', 1)) {
596
    $postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
597
    $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 />';
598
  }
599
  if (variable_get('ext_links_iucn_check', 1)) {
600
    $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 />';
601

    
602
  }
603
  if (variable_get('ext_links_ipni_check', 1)) {
604
    $genusQuery = 'find_genus=' . $speciesName['genus'];
605
    $speciesQuery = 'find_species=' . $speciesName['species'];
606
    $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 />';
607
  }
608
  if (variable_get('ext_links_wcsp_check', 1)) {
609
    $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 />';
610

    
611
  }
612
  if (variable_get('ext_links_tpl_check', 1)) {
613
    $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 />';
614
  }
615
  if (variable_get('ext_links_eol_check', 1)) {
616
    $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 />';
617
  }
618
  if (variable_get('ext_links_jstor_check', 1)) {
619
    $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 />';
620
  }
621
  if (variable_get('ext_links_epic_check', 1)) {
622
    $postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
623
    $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 />';
624
  }
625

    
626
  return $block_content;
627
}
628

    
629
// Include the admin form if we really want it to use.
630
/*
631
if (arg(0) === 'admin' AND arg(1) === 'user' AND arg(2) === 'ext_link') {
632
  module_load_include('inc', 'ext_links', 'xt_link_admin');
633
}
634
*/
635

    
636
/**
637
 * @todo Please document this function.
638
 * @see http://drupal.org/node/1354
639
 */
640
function ext_links_theme() {
641
  return array(
642
    'ext_links_list_grouped' => array('variables' => array(
643
      'speciesName' => NULL,
644
      'genus' => NULL,
645
      'species' => NULL,
646
      )),
647
    'ext_links_list_plain' => array('variables' => array(
648
      'speciesName' => NULL,
649
      'genus' => NULL,
650
      'species' => NULL,
651
      )),
652
    // theme_ext_links_admin_overview
653
    'ext_links_admin_overview' => array(
654
      'render element' => 'form',
655
      'file' => 'ext_links.admin.inc',
656
    ),
657
//    'ext_links_link_template_filter_order' => array(
658
//      'render element' => 'element',
659
//      'file' => 'ext_links.admin.inc',
660
//    ),
661
  );
662
}
663

    
664
/**
665
 * Get the default external links.
666
 *
667
 * @return array
668
 *   Returns an array with default external links values.
669
 */
670
function ext_links_template_defaults() {
671
  $ext_links_default["gbif"] = array(
672
    'id' => "gbif",
673
    'link' => 'http://www.gbif.org/species/search?q=',
674
    'title' => 'Search GBIF...',
675
    'glue' => ' ',
676
    'weight' => 0,
677
    'status' => 1,
678
    'category' => 'Specimens/Occurrences',
679
  );
680
  $ext_links_default["biocase"] = array(
681
    'id' => "biocase",
682
    'link' => 'http://search.biocase.org/edit/search/units/simpleSearch/query1?unitName=',
683
    'title' => 'Search BioCASE...',
684
    'glue' => ' ',
685
    'weight' => 0,
686
    'status' => 1,
687
    'category' => 'Specimens/Occurrences',
688
  );
689
  $ext_links_default["nybg"] = array(
690
    'id' => "nybg",
691
    'link' => 'http://sweetgum.nybg.org/science/vh/specimen_list.php?SummaryData=',
692
    'title' => 'Search NYBG...',
693
    'glue' => '+AND+',
694
    'weight' => 0,
695
    'status' => 1,
696
    'category' => 'Specimens/Occurrences',
697
  );
698
  $ext_links_default["tropicos"] = array(
699
    'id' => "tropicos",
700
    'link' => 'http://www.tropicos.org/NameSearch.aspx?name=',
701
    'title' => 'Search Tropicos...',
702
    'glue' => '+',
703
    'weight' => 0,
704
    'status' => 1,
705
    'category' => 'Specimens/Occurrences',
706
  );
707
  $ext_links_default["ncbi"] = array(
708
    'id' => "ncbi",
709
    'link' => 'http://www.ncbi.nlm.nih.gov/gquery/gquery.fcgi?term=',
710
    'title' => 'Search NCBI...',
711
    'glue' => '+AND+',
712
    'weight' => 0,
713
    'status' => 1,
714
    'category' => 'Molecular Resources',
715
  );
716
  $ext_links_default["google"] = array(
717
    'id' => "google",
718
    'link' => 'http://images.google.com/images?q=',
719
    'title' => 'Search Google Images...',
720
    'glue' => '+',
721
    'weight' => 0,
722
    'status' => 1,
723
    'category' => 'Images',
724
  );
725
  $ext_links_default["flickr"] = array(
726
    'id' => "flickr",
727
    'link' => 'http://www.flickr.com/search/?w=all&q=',
728
    'title' => 'Search flickr...',
729
    'glue' => '+',
730
    'weight' => 0,
731
    'status' => 1,
732
    'category' => 'Images',
733
  );
734
  $ext_links_default["scholar"] = array(
735
    'id' => "scholar",
736
    'link' => 'http://scholar.google.de/scholar?hl=de&btnG=Suche&lr=&as_ylo=&as_vis=0&q=',
737
    'title' => 'Search Google scholar...',
738
    'glue' => '+',
739
    'weight' => 0,
740
    'status' => 1,
741
    'category' => 'Literature',
742
  );
743
  $ext_links_default["bhl"] = array(
744
    'id' => "bhl",
745
    'link' => 'http://www.biodiversitylibrary.org/Search.aspx?searchCat=&searchTerm=',
746
    'title' => 'Search BHL...',
747
    'glue' => ' ',
748
    'weight' => 0,
749
    'status' => 1,
750
    'category' => 'Literature',
751
  );
752
  $ext_links_default["arkive"] = array(
753
    'id' => "arkive",
754
    'link' => 'http://www.arkive.org/search.html?q=',
755
    'title' => 'Search ARKive...',
756
    'glue' => '+',
757
    'weight' => 0,
758
    'status' => 1,
759
    'category' => 'Images',
760
  );
761
  $ext_links_default["herbcat"] = array(
762
    'id' => "herbcat",
763
    'link' => 'http://apps.kew.org/herbcat/getHomePageResults.do?homePageSearchText=',
764
    'title' => 'Search Kew Herbarium Catalogue...',
765
    'glue' => '+',
766
    'weight' => 0,
767
    'status' => 1,
768
    'category' => 'Specimens/Occurrences',
769
  );
770
  $ext_links_default["iucn"] = array(
771
    'id' => "iucn",
772
    'link' => 'http://www.iucnredlist.org/',
773
    'title' => 'Go to IUCN Red List...',
774
    'glue' => ' ',
775
    'weight' => 0,
776
    'status' => 1,
777
    'category' => 'Conservation',
778
  );
779
  $ext_links_default["ipni"] = array(
780
    'id' => "ipni",
781
    'link' => 'http://www.ipni.org/ipni/advPlantNameSearch.do?',
782
    'title' => 'Search IPNI...',
783
    'glue' => '&',
784
    'weight' => 0,
785
    'status' => 1,
786
    'category' => 'Classification',
787
  );
788
  $ext_links_default["wcsp"] = array(
789
    'id' => "wcsp",
790
    'link' => 'http://wcsp.science.kew.org/qsearch.do?plantName=',
791
    'title' => 'Search World Checklist Monocots...',
792
    'glue' => ' ',
793
    'weight' => 0,
794
    'status' => 1,
795
    'category' => 'Classification',
796
  );
797
  $ext_links_default["tpl"] = array(
798
    'id' => "tpl",
799
    'link' => 'http://www.theplantlist.org/tpl/search?q=',
800
    'title' => 'Search The Plant List...',
801
    'glue' => '+',
802
    'weight' => 0,
803
    'status' => 1,
804
    'category' => 'Classification',
805
  );
806
  $ext_links_default["eol"] = array(
807
    'id' => "eol",
808
    'link' => 'http://eol.org/search/?q=',
809
    'title' => 'Search Encyclopaedia of Life...',
810
    'glue' => '+',
811
    'weight' => 0,
812
    'status' => 1,
813
    'category' => 'General',
814
  );
815
  $ext_links_default["jstor"] = array(
816
    'id' => "jstor",
817
    'link' => 'https://plants.jstor.org/search?filter=name&so=ps_group_by_genus_species+asc&Query=',
818
    'title' => 'Search JSTOR Plant Science...',
819
    'glue' => ' ',
820
    'weight' => 0,
821
    'status' => 1,
822
    'category' => 'General',
823
  );
824
  $ext_links_default["epic"] = array(
825
    'id' => "epic",
826
    'link' => 'http://epic.kew.org/searchepic/summaryquery.do?scientificName=',
827
    'title' => 'Search ePIC...',
828
    'glue' => '+',
829
    'weight' => 0,
830
    'status' => 1,
831
    'category' => 'General',
832
  );
833
  $ext_links_default["fairchild"] = array(
834
    'id' => "fairchild",
835
    'link' => 'http://palmguide.org/palmsearch.php?query=',
836
    'title' => 'Search Fairchild Guide To Palms...',
837
    'glue' => '+',
838
    'weight' => 0,
839
    'status' => 0, //disabled since Fairchild Guide To Palms seems to be down
840
    'category' => 'Specimens/Occurrences',
841
  );
842
  $ext_links_default["ggbn"] = array(
843
    'id' => "ggbn",
844
    'link' => 'http://www.ggbn.org/ggbn_portal/search/result?fullScientificName=',
845
    'title' => 'Search GGBN...',
846
    'glue' => '+',
847
    'weight' => 0,
848
    'status' => 1,
849
    'category' => 'Molecular Resources',
850
  );
851
  return $ext_links_default;
852
}
(6-6/6)