68 |
68 |
'weight' => 1,
|
69 |
69 |
'file' => 'ext_links.admin.inc',
|
70 |
70 |
];
|
|
71 |
$items['admin/config/cdm_dataportal/ext_links/appearance'] = [
|
|
72 |
'title' => 'Appearance',
|
|
73 |
'page callback' => 'drupal_get_form',
|
|
74 |
'page arguments' => ['ext_links_admin_appearance_page'],
|
|
75 |
'access arguments' => ['access administration pages'],
|
|
76 |
'type' => MENU_LOCAL_TASK,
|
|
77 |
'weight' => 2,
|
|
78 |
'file' => 'ext_links.admin.inc',
|
|
79 |
];
|
71 |
80 |
$items['admin/config/cdm_dataportal/ext_links/%ext_links'] = [ // %ext_links refers to ext_links_load
|
72 |
81 |
'title' => 'Edit external link',
|
73 |
82 |
'page callback' => 'ext_links_admin_link_template_page',
|
... | ... | |
93 |
102 |
*
|
94 |
103 |
* @see ext_links_template_defaults()
|
95 |
104 |
*
|
|
105 |
* @param $enabled_only boolean
|
|
106 |
* When TRUE external link templates with status != null are excluded from the list.
|
96 |
107 |
* @return array
|
97 |
108 |
* An array of external link template objects, keyed by the format ID and ordered by
|
98 |
109 |
* weight.
|
99 |
110 |
*
|
100 |
111 |
*/
|
101 |
|
function ext_links_templates() {
|
|
112 |
function ext_links_templates($enabled_only = FALSE) {
|
102 |
113 |
global $language;
|
103 |
114 |
$link_templates = &drupal_static(__FUNCTION__, array());
|
104 |
115 |
|
... | ... | |
117 |
128 |
$link_templates[] = (object)$a;
|
118 |
129 |
}
|
119 |
130 |
} else {
|
120 |
|
$link_templates = db_select('ext_links', 'elt')
|
|
131 |
$query = db_select('ext_links', 'elt')
|
121 |
132 |
->addTag('translatable')
|
122 |
|
->fields('elt')
|
123 |
|
->orderBy('category')
|
|
133 |
->fields('elt');
|
|
134 |
if($enabled_only){
|
|
135 |
$query = $query->condition('status', '1');
|
|
136 |
}
|
|
137 |
$link_templates =
|
|
138 |
$query->orderBy('category')
|
124 |
139 |
->orderBy('weight')
|
125 |
140 |
->execute()
|
126 |
141 |
->fetchAllAssoc('id');
|
... | ... | |
279 |
294 |
*/
|
280 |
295 |
function ext_links_block_info() {
|
281 |
296 |
if (TRUE) {
|
282 |
|
$block[0]["info"] = t("External Taxon Links");
|
|
297 |
$block[0]["info"] = t("CDM - External Links");
|
283 |
298 |
return $block;
|
284 |
299 |
}
|
285 |
300 |
}
|
... | ... | |
309 |
324 |
$species = $taxon->name->taggedName[1]->text;
|
310 |
325 |
}
|
311 |
326 |
$block_content = '';
|
312 |
|
$listOption = variable_get("ext_links_options", 0);
|
313 |
|
if (isset($listOption)) {
|
|
327 |
$grouped = variable_get('ext_links_appearance_grouped', 1);
|
|
328 |
if ($grouped) {
|
314 |
329 |
$block['content'] = theme('ext_links_list_grouped', array('speciesName' => $speciesName, 'genus' => $genus, 'species' => $species));
|
315 |
330 |
}
|
316 |
331 |
else {
|
... | ... | |
370 |
385 |
|
371 |
386 |
}
|
372 |
387 |
|
|
388 |
/**
|
|
389 |
* Applies the name tokens to the external link templates.
|
|
390 |
*
|
|
391 |
* @param $ext_link
|
|
392 |
* @param $species_name
|
|
393 |
*
|
|
394 |
* @return array
|
|
395 |
* Array with the keys:
|
|
396 |
* - title: the title of the link
|
|
397 |
* - url: the url of the link
|
|
398 |
*/
|
|
399 |
function make_ext_link($ext_link, $species_name) {
|
|
400 |
switch ($ext_link->id) {
|
|
401 |
case 'nybg':
|
|
402 |
if ($species_name['genus'] != NULL) {
|
|
403 |
$query = 'DetFiledAsGenusLocal+%3D+\%27' . $species_name['genus'] . '\%27';
|
|
404 |
}
|
|
405 |
if ($species_name['species'] != NULL) {
|
|
406 |
$query .= $ext_link->glue . 'DetFiledAsSpeciesLocal+%3D+\%27' . $species_name['species'] . '\%27';
|
|
407 |
}
|
|
408 |
break;
|
|
409 |
case 'arkive':
|
|
410 |
$postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
|
|
411 |
$query = str_replace('"', '%22', $species_name['genus']) . variable_get('ext_links_arkive_concat', '+') . str_replace('"', '%22', $species_name['species']) . $postURL;
|
|
412 |
break;
|
|
413 |
case 'herbcat':
|
|
414 |
$postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
|
|
415 |
$query = str_replace('"', '%22', $species_name['genus']) . variable_get('ext_links_herbcat_concat', '+') . str_replace('"', '%22', $species_name['species']) . $postURL;
|
|
416 |
break;
|
|
417 |
case 'iucn':
|
|
418 |
case 'wcsp':
|
|
419 |
// apparently no search api, thus plain link without genus and species
|
|
420 |
$query = '';
|
|
421 |
break;
|
|
422 |
case 'ipni':
|
|
423 |
$query = 'find_genus=' . $species_name['genus'] . '&find_species=' . $species_name['species'];
|
|
424 |
break;
|
|
425 |
default:
|
|
426 |
$query = str_replace('"', '%22', $species_name['genus']) . $ext_link->glue . str_replace('"', '%22', $species_name['species']);
|
|
427 |
}
|
|
428 |
$ext_link_array = [
|
|
429 |
'title' => $ext_link->title,
|
|
430 |
'url' => $ext_link->link . $query
|
|
431 |
];
|
|
432 |
return $ext_link_array;
|
|
433 |
}
|
|
434 |
|
373 |
435 |
/**
|
374 |
436 |
* @todo Please document this function.
|
375 |
437 |
* @see http://drupal.org/node/1354
|
376 |
438 |
*/
|
377 |
439 |
function theme_ext_links_list_grouped($variables) {
|
378 |
|
// comment @WA: perhaps this function could be merged with ext_list_plain
|
379 |
|
// into one function?
|
380 |
|
$speciesName = $variables['speciesName'];
|
381 |
|
if(!isset($speciesName['genus'])) {
|
382 |
|
$speciesName['genus'] = '';
|
383 |
|
}
|
384 |
|
if(!isset($speciesName['species'])) {
|
385 |
|
$speciesName['species'] = '';
|
386 |
|
}
|
387 |
|
$genus = $variables['genus'];
|
388 |
|
$species = $variables['species'];
|
389 |
|
$block_content = '';
|
390 |
|
$categories = NULL;
|
391 |
|
$ext_links_default = ext_links_templates();
|
392 |
|
|
393 |
|
|
394 |
|
/*
|
395 |
|
foreach ($ext_links_default as $ext_link) {
|
396 |
|
|
397 |
|
//$block_content .= $ext_link['ext_links_bhl_category'];
|
398 |
|
$category[] = variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
|
399 |
|
$block_content .= variable_get('ext_links_bhl_category', $ext_links_default[][text_default_value]);
|
400 |
|
}
|
401 |
|
*/
|
402 |
|
|
403 |
|
// Images section.
|
404 |
|
if (variable_get('ext_links_google_check', 1)) {
|
405 |
|
$categoryTitles[] = variable_get('ext_links_google_category', $ext_links_default['google']['category_default_value']);
|
406 |
|
$categories['google']['title'] = variable_get('ext_links_google_category', $ext_links_default['google']['category_default_value']);
|
407 |
|
$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 />';
|
408 |
440 |
|
|
441 |
$species_name = $variables['speciesName'];
|
|
442 |
if(!isset($species_name['genus'])) {
|
|
443 |
$species_name['genus'] = '';
|
409 |
444 |
}
|
410 |
|
if (variable_get('ext_links_flickr_check', 1)) {
|
411 |
|
$categoryTitles[] = variable_get('ext_links_flickr_category', $ext_links_default['flickr']['category_default_value']);
|
412 |
|
$categories['flickr']['title'] = variable_get('ext_links_flickr_category', $ext_links_default['flickr']['category_default_value']);
|
413 |
|
$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 />';
|
|
445 |
if(!isset($species_name['species'])) {
|
|
446 |
$species_name['species'] = '';
|
414 |
447 |
}
|
415 |
448 |
|
416 |
|
// Specimen/occurences section.
|
417 |
|
if (variable_get('ext_links_gbif_check', TRUE)) {
|
418 |
|
$categoryTitles[] = variable_get('ext_links_gbif_category', $ext_links_default['gbif']['category_default_value']);
|
419 |
|
$categories['gbif']['title'] = variable_get('ext_links_gbif_category', $ext_links_default['gbif']['category_default_value']);
|
420 |
|
$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 />';
|
421 |
|
}
|
422 |
|
if (variable_get('ext_links_biocase_check', 1)) {
|
423 |
|
$categoryTitles[] = variable_get('ext_links_biocase_category', $ext_links_default['biocase']['category_default_value']);
|
424 |
|
$categories['biocase']['title'] = variable_get('ext_links_biocase_category', $ext_links_default['biocase']['category_default_value']);
|
425 |
|
$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 />';
|
426 |
|
}
|
427 |
|
if (variable_get('ext_links_nybg_check', 1)) {
|
428 |
|
$query = '';
|
429 |
|
$genusQuery = '';
|
430 |
|
$speciesQuery = '';
|
431 |
|
if ($speciesName['genus'] != NULL) {
|
432 |
|
$query .= 'DetFiledAsGenusLocal+%3D+\%27'. $speciesName['genus']. '\%27';
|
433 |
|
}
|
434 |
|
if ($speciesName['species'] != NULL) {
|
435 |
|
$query .= variable_get('ext_links_nybg_concat', '+AND+'). 'DetFiledAsSpeciesLocal+%3D+\%27'. $speciesName['species'] . '\%27';
|
436 |
|
}
|
437 |
|
$categoryTitles[] = variable_get('ext_links_nybg_category', $ext_links_default['nybg']['category_default_value']);
|
438 |
|
$categories['nybg']['title'] = variable_get('ext_links_nybg_category', $ext_links_default['nybg']['category_default_value']);
|
439 |
|
$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 />';
|
440 |
|
}
|
441 |
|
if (variable_get('ext_links_tropicos_check', 1)) {
|
442 |
|
$categoryTitles[] = variable_get('ext_links_tropicos_category', $ext_links_default['tropicos']['category_default_value']);
|
443 |
|
$categories['tropicos']['title'] = variable_get('ext_links_tropicos_category', $ext_links_default['tropicos']['category_default_value']);
|
444 |
|
$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 />';
|
445 |
|
}
|
|
449 |
$ext_links = ext_links_templates(true);
|
446 |
450 |
|
447 |
|
// Literature.
|
448 |
|
if (variable_get('ext_links_scholar_check', 1)) {
|
449 |
|
$categoryTitles[] = variable_get('ext_links_scholar_category', $ext_links_default['scholar']['category_default_value']);
|
450 |
|
$categories['scholar']['title'] = variable_get('ext_links_scholar_category', $ext_links_default['scholar']['category_default_value']);
|
451 |
|
$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 />';
|
452 |
|
}
|
453 |
|
if (variable_get('ext_links_bhl_check', 1)) {
|
454 |
|
$categoryTitles[] = variable_get('ext_links_bhl_category', $ext_links_default['bhl']['category_default_value']);
|
455 |
|
$categories['bhl']['title'] = variable_get('ext_links_bhl_category', $ext_links_default['bhl']['category_default_value']);
|
456 |
|
$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 />';
|
457 |
|
}
|
|
451 |
$ext_links_by_category = [];
|
458 |
452 |
|
459 |
|
// Molecular resources.
|
460 |
|
if (variable_get('ext_links_ncbi_check', 1)) {
|
461 |
|
$categoryTitles[] = variable_get('ext_links_ncbi_category', $ext_links_default['ncbi']['category_default_value']);
|
462 |
|
$categories['ncbi']['title'] = variable_get('ext_links_ncbi_category', $ext_links_default['ncbi']['category_default_value']);
|
463 |
|
$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 />';
|
464 |
|
}
|
465 |
|
if (variable_get('ext_links_arkive_check', 1)) {
|
466 |
|
$postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
|
467 |
|
$categoryTitles[] = variable_get('ext_links_arkive_category', $ext_links_default['arkive']['category_default_value']);
|
468 |
|
$categories['arkive']['title'] = variable_get('ext_links_arkive_category', $ext_links_default['arkive']['category_default_value']);
|
469 |
|
$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 />';
|
470 |
|
}
|
471 |
|
if (variable_get('ext_links_herbcat_check', 1)) {
|
472 |
|
$postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
|
473 |
|
$categoryTitles[] = variable_get('ext_links_herbcat_category', $ext_links_default['herbcat']['category_default_value']);
|
474 |
|
$categories['herbcat']['title'] = variable_get('ext_links_herbcat_category', $ext_links_default['herbcat']['category_default_value']);
|
475 |
|
$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 />';
|
476 |
|
}
|
477 |
|
if (variable_get('ext_links_iucn_check', 1)) {
|
478 |
|
$categoryTitles[] = variable_get('ext_links_iucn_category', $ext_links_default['iucn']['category_default_value']);
|
479 |
|
$categories['iucn']['title'] = variable_get('ext_links_iucn_category', $ext_links_default['iucn']['category_default_value']);
|
480 |
|
$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 />';
|
481 |
|
}
|
482 |
|
if (variable_get('ext_links_ipni_check', 1)) {
|
483 |
|
$genusQuery = 'find_genus=' . $speciesName['genus'];
|
484 |
|
$speciesQuery = 'find_species=' . $speciesName['species'];
|
485 |
|
$categoryTitles[] = variable_get('ext_links_ipni_category', $ext_links_default['ipni']['category_default_value']);
|
486 |
|
$categories['ipni']['title'] = variable_get('ext_links_ipni_category', $ext_links_default['ipni']['category_default_value']);
|
487 |
|
$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 />';
|
488 |
|
}
|
489 |
|
if (variable_get('ext_links_wcsp_check', 1)) {
|
490 |
|
$categoryTitles[] = variable_get('ext_links_wcsp_category', $ext_links_default['wcsp']['category_default_value']);
|
491 |
|
$categories['wcsp']['title'] = variable_get('ext_links_wcsp_category', $ext_links_default['wcsp']['category_default_value']);
|
492 |
|
$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 />';
|
493 |
|
}
|
494 |
|
if (variable_get('ext_links_tpl_check', 1)) {
|
495 |
|
$categoryTitles[] = variable_get('ext_links_tpl_category', $ext_links_default['tpl']['category_default_value']);
|
496 |
|
$categories['tpl']['title'] = variable_get('ext_links_tpl_category', $ext_links_default['tpl']['category_default_value']);
|
497 |
|
$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 />';
|
498 |
|
}
|
499 |
|
if (variable_get('ext_links_eol_check', 1)) {
|
500 |
|
$categoryTitles[] = variable_get('ext_links_eol_category', $ext_links_default['eol']['category_default_value']);
|
501 |
|
$categories['eol']['title'] = variable_get('ext_links_eol_category', $ext_links_default['eol']['category_default_value']);
|
502 |
|
$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 />';
|
503 |
|
}
|
504 |
|
if (variable_get('ext_links_jstor_check', 1)) {
|
505 |
|
$categoryTitles[] = variable_get('ext_links_jstor_category', $ext_links_default['jstor']['category_default_value']);
|
506 |
|
$categories['jstor']['title'] = variable_get('ext_links_jstor_category', $ext_links_default['jstor']['category_default_value']);
|
507 |
|
$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 />';
|
508 |
|
}
|
509 |
|
if (variable_get('ext_links_epic_check', 1)) {
|
510 |
|
$postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
|
511 |
|
$categoryTitles[] = variable_get('ext_links_epic_category', $ext_links_default['epic']['category_default_value']);
|
512 |
|
$categories['epic']['title'] = variable_get('ext_links_epic_category', $ext_links_default['epic']['category_default_value']);
|
513 |
|
$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 />';
|
514 |
|
}
|
515 |
|
// if (variable_get('ext_links_fairchild_check', 1)) {
|
516 |
|
// $categoryTitles[] = variable_get('ext_links_fairchild_category', $ext_links_default['fairchild']['category_default_value']);
|
517 |
|
// $categories['fairchild']['title'] = variable_get('ext_links_fairchild_category', $ext_links_default['fairchild']['category_default_value']);
|
518 |
|
// $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 />';
|
519 |
|
// }
|
520 |
|
if (variable_get('ext_links_ggbn_check', 1)) {
|
521 |
|
$categoryTitles[] = variable_get('ext_links_ggbn_category', $ext_links_default['ggbn']['category_default_value']);
|
522 |
|
$categories['ggbn']['title'] = variable_get('ext_links_ggnb_category', $ext_links_default['ggbn']['category_default_value']);
|
523 |
|
$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 />';
|
|
453 |
foreach ($ext_links as $ext_link) {
|
|
454 |
if(!array_key_exists($ext_link->category, $ext_links_by_category)){
|
|
455 |
$ext_links_by_category[$ext_link->category] = [];
|
|
456 |
}
|
|
457 |
$ext_link_render_array = make_ext_link($ext_link, $species_name);
|
|
458 |
$ext_links_by_category[$ext_link->category][] = $ext_link_render_array;
|
524 |
459 |
}
|
525 |
460 |
|
526 |
|
$categoryTitles = array_unique($categoryTitles);
|
527 |
|
foreach ($categoryTitles as $categoryTitle) {
|
528 |
|
// $block_content .= "specName" . $speciesName;
|
529 |
|
$block_content .= "<div class=\"category\"><h5>" . $categoryTitle . "</h5>";
|
530 |
|
foreach ($categories as $category) {
|
531 |
|
if ($category['title'] == $categoryTitle) {
|
532 |
|
$block_content .= $category['content'];
|
533 |
|
}
|
|
461 |
$block_content = '';
|
|
462 |
foreach ($ext_links_by_category as $categoryTitle => $ext_links) {
|
|
463 |
$block_content .= "<div class=\"category\"><h5>" . $categoryTitle . "</h5>\n";
|
|
464 |
foreach($ext_links as $ext_link){
|
|
465 |
$block_content .= l($ext_link['title'], 'JavaScript:popupExternalLinks(\'' . $ext_link['url'] . '\')', ['external' => TRUE]) .'<br />';
|
534 |
466 |
}
|
535 |
467 |
$block_content .= "</div>";
|
536 |
468 |
}
|
537 |
469 |
|
538 |
|
|
539 |
470 |
return $block_content;
|
540 |
471 |
}
|
541 |
472 |
|
... | ... | |
551 |
482 |
if (!isset($speciesName['species'])) {
|
552 |
483 |
$speciesName['species'] = '';
|
553 |
484 |
}
|
554 |
|
$genus = $variables['genus'];
|
555 |
|
$species = $variables['species'];
|
556 |
|
$ext_links_default = ext_links_get_default();
|
557 |
|
$block_content = '';
|
558 |
|
if (variable_get('ext_links_gbif_check', TRUE)) {
|
559 |
|
$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 />';
|
560 |
|
/*
|
561 |
|
$block_content .= /* TODO
|
562 |
|
Please manually fix the parameters on the l() or url() function on the next line.
|
563 |
|
Typically, this was not changed because of a function call inside an array call like
|
564 |
|
array('title' => t('View user profile.')).*/
|
565 |
|
/*
|
566 |
|
l(variable_get('ext_links_gbif_text', $ext_links_default[gbif][text_default_value]),
|
567 |
|
'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],
|
568 |
|
array(), null, null, true);
|
569 |
|
*/
|
570 |
|
}
|
571 |
|
if (variable_get('ext_links_biocase_check', 1)) {
|
572 |
|
$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 />';
|
573 |
|
}
|
574 |
|
if (variable_get('ext_links_nybg_check', 1)) {
|
575 |
|
// $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 />';
|
576 |
|
$genusQuery = '';
|
577 |
|
$speciesQuery = '';
|
578 |
|
if ($speciesName['genus'] != NULL) {
|
579 |
|
$genusQuery = 'DetFiledAsGenusLocal+%3D+\%27' . $speciesName['genus'] . '\%27';
|
580 |
|
}
|
581 |
|
if ($speciesName['species'] != NULL) {
|
582 |
|
$speciesQuery = 'DetFiledAsSpeciesLocal+%3D+\%27' . $speciesName['species'] . '\%27';
|
583 |
|
}
|
584 |
|
$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 />';
|
585 |
|
}
|
586 |
|
if (variable_get('ext_links_tropicos_check', 1)) {
|
587 |
|
$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 />';
|
588 |
|
}
|
589 |
|
if (variable_get('ext_links_ncbi_check', 1)) {
|
590 |
|
$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 />';
|
591 |
|
}
|
592 |
|
if (variable_get('ext_links_google_check', 1)) {
|
593 |
|
$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 />';
|
594 |
|
}
|
595 |
|
if (variable_get('ext_links_flickr_check', 1)) {
|
596 |
|
$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 />';
|
597 |
|
}
|
598 |
|
if (variable_get('ext_links_scholar_check', 1)) {
|
599 |
|
$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 />';
|
600 |
|
}
|
601 |
|
if (variable_get('ext_links_bhl_check', 1)) {
|
602 |
|
$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 />';
|
603 |
|
}
|
604 |
|
// if (variable_get('ext_links_fairchild_check', 1)) {
|
605 |
|
// $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 />';
|
606 |
|
// }
|
607 |
|
if (variable_get('ext_links_ggbn_check', 1)) {
|
608 |
|
$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 />';
|
609 |
|
}
|
610 |
|
if (variable_get('ext_links_arkive_check', 1)) {
|
611 |
|
$postURL = '&output=xml_no_dtd&client=arkive-images&site=arkive-images&ie=utf8&oe=utf8&num=20&proxystylesheet=tng-search&filter=0&getfields=*';
|
612 |
|
$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 />';
|
613 |
|
}
|
614 |
|
|
615 |
|
//--------------------
|
616 |
|
$ext_link_id = 'herbcat';
|
617 |
|
if (variable_get("ext_links_${ext_link_id}_check", 1)) {
|
618 |
|
$postURL = '&x=11&y=13&homePageSearchOption=scientific_name&nameOfSearchPage=home_page';
|
619 |
|
$block_content .= '<a href="JavaScript:popupExternalLinks(\'' .
|
620 |
|
variable_get("ext_links_${ext_link_id}_link", $ext_links_default[$ext_link_id]['link_default_value']) .
|
621 |
|
str_replace('"', '%22', $speciesName['genus']) .
|
622 |
|
variable_get("ext_links_${ext_link_id}_concat", '+') .
|
623 |
|
str_replace('"', '%22', $speciesName['species']) . $postURL . '\')">' .
|
624 |
|
variable_get("ext_links_${ext_link_id}_text", $ext_links_default[$ext_link_id]['text_default_value']) .
|
625 |
|
'</a><br />';
|
626 |
|
}
|
627 |
|
//--------------------
|
628 |
|
if (variable_get('ext_links_iucn_check', 1)) {
|
629 |
|
$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 />';
|
630 |
|
|
631 |
|
}
|
632 |
|
if (variable_get('ext_links_ipni_check', 1)) {
|
633 |
|
$genusQuery = 'find_genus=' . $speciesName['genus'];
|
634 |
|
$speciesQuery = 'find_species=' . $speciesName['species'];
|
635 |
|
$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 />';
|
636 |
|
}
|
637 |
|
if (variable_get('ext_links_wcsp_check', 1)) {
|
638 |
|
$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 />';
|
639 |
485 |
|
|
486 |
$ext_links_templates = ext_links_templates(true);
|
|
487 |
$block_content = '';
|
|
488 |
foreach ($ext_links_templates as $ext_link) {
|
|
489 |
$ext_link = make_ext_link($ext_link, $speciesName);
|
|
490 |
$block_content .= l($ext_link['title'], 'JavaScript:popupExternalLinks(\'' . $ext_link['url'] . '\')', ['external' => TRUE]) .'<br />';
|
640 |
491 |
}
|
641 |
|
if (variable_get('ext_links_tpl_check', 1)) {
|
642 |
|
$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 />';
|
643 |
|
}
|
644 |
|
if (variable_get('ext_links_eol_check', 1)) {
|
645 |
|
$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 />';
|
646 |
|
}
|
647 |
|
if (variable_get('ext_links_jstor_check', 1)) {
|
648 |
|
$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 />';
|
649 |
|
}
|
650 |
|
if (variable_get('ext_links_epic_check', 1)) {
|
651 |
|
$postURL = '&searchAll=true&categories=names&categories=bibl&categories=colln&categories=taxon&categories=flora&Submit.x=0&Submit.y=0';
|
652 |
|
$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 />';
|
653 |
|
}
|
654 |
|
|
655 |
492 |
return $block_content;
|
656 |
493 |
}
|
657 |
494 |
|
658 |
|
// Include the admin form if we really want it to use.
|
659 |
|
/*
|
660 |
|
if (arg(0) === 'admin' AND arg(1) === 'user' AND arg(2) === 'ext_link') {
|
661 |
|
module_load_include('inc', 'ext_links', 'xt_link_admin');
|
662 |
|
}
|
663 |
|
*/
|
664 |
|
|
665 |
495 |
/**
|
666 |
496 |
* @todo Please document this function.
|
667 |
497 |
* @see http://drupal.org/node/1354
|
... | ... | |
784 |
614 |
'title' => 'Search ARKive...',
|
785 |
615 |
'glue' => '+',
|
786 |
616 |
'weight' => 0,
|
787 |
|
'status' => 1,
|
|
617 |
'status' => 0,
|
788 |
618 |
'category' => 'Images',
|
789 |
619 |
);
|
790 |
620 |
$ext_links_default["herbcat"] = array(
|
ref #9659 ext_links appaearance option