Hi,
we got some help on this one - a javascript wizard scripted a species selector for us!
The Code in distribution_map_1.php looks like this now, starting in row 134:
// setup the map options
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
if (!$args['show_all_species']) {
inserted here: !isset($_GET['taxon']) &&
if (!isset($_GET['taxon']) && isset($args['taxon_identifier']) && !empty($args['taxon_identifier']))
// This page is for a predefined species map
$taxonIdentifier = $args['taxon_identifier'];
else {
if (isset($_GET['taxon']))
$taxonIdentifier = $_GET['taxon'];
else
return lang::get("The distribution map cannot be displayed without a taxon identifier");
}
followed by:
// select box for taxons
$fetchOpts = array(
'table' => 'occurrence',
'extraParams' => $readAuth + array('view'=>'detail','deleted'=>'f'),
'nocache' => true,
'fieldname' => 'taxon',
'id' => 'select_taxon',
'captionField' => 'taxon',
'valueField' => 'taxon_meaning_id',
'default' => $taxonIdentifier
);
$r .= data_entry_helper::select($fetchOpts);
$r .= <<<EOT
<script type='text/javascript'>
$('#select_taxon').change(function() {
var selectedTaxonId = $(this).val();
var re = new RegExp('(?:&|\\\\?)taxon=([^&]*)');
var result = location.search.match(re);
if (result == null) {
location.search += '&taxon=' + selectedTaxonId;
}
else {
var newTaxonParam = result[0].replace(result[1], selectedTaxonId);
location.search = location.search.replace(result[0], newTaxonParam);
}
});
</script>
EOT;