0, 'key_format' => 'ALPHA' ))); /* taxonRelationshipTypes */ define('CDM_TAXON_RELATIONSHIP_TYPES_DEFAULT', serialize( array( UUID_MISAPPLIED_NAME_FOR => UUID_MISAPPLIED_NAME_FOR, UUID_PROPARTE_MISAPPLIEDNAME_FOR => UUID_PROPARTE_MISAPPLIEDNAME_FOR, UUID_PARTIAL_MISAPPLIEDNAME_FOR => UUID_PARTIAL_MISAPPLIEDNAME_FOR, UUID_PROPARTE_SYNONYM_FOR => UUID_PROPARTE_SYNONYM_FOR, UUID_PARTIAL_SYNONYM_FOR => UUID_PARTIAL_SYNONYM_FOR, UUID_INVALID_DESIGNATION_FOR => UUID_INVALID_DESIGNATION_FOR ) )); /* ---- MAP SETTING CONSTANTS ---- */ /** * @var array of URIs eg. http://edit.africamuseum.be" * An options array */ define('EDIT_MAPSERVER_URI', serialize( array( 'http://edit.africamuseum.be'=>'Primary (http://edit.africamuseum.be)' ) ) ); define('EDIT_MAPSERVER_PATH', '/edit_wp5'); /** * @var array of versions eg. "v1.2" * An options array */ define('EDIT_MAPSERVER_VERSION', serialize( array( // 'v1' => 'v1' , // no longer recommended // 'v1.1' => 'v1.1', // no longer recommended // 'v1.2_dev' => 'v1.2_dev',// no longer recommended 'v1.2' => 'v1.2', 'v1.3_dev' => 'v1.3_dev (not recommended)', 'v1.4_dev' => 'v1.4_dev (experimental features)' ) ) ); define('EDIT_MAPSERVER_URI_DEFAULT', 'http://edit.africamuseum.be'); define('EDIT_MAPSERVER_VERSION_DEFAULT', 'v1.2'); // --- Taxon profile settings --- / define('DISTRIBUTION_TEXTDATA_DISPLAY_ON_TOP', 'distribution_textdata_on_top'); define('CDM_TAXON_PROFILE_IMAGE', 'cdm_taxon_profile_image'); define('CDM_TAXON_PROFILE_IMAGE_DEFAULT', serialize( array( 'show' => 0, 'maxextend' => 184, 'media_uri_query' => '', 'custom_placeholder_enabled' => 1, 'custom_placeholder_image_on' => 0, 'custom_placeholder_image_fid' => '' ) ) ); define('FEATURE_BLOCK_SETTINGS', 'feature_block_settings'); define('DISTRIBUTION_CONDENSED', 'distribution_condensed'); define('DISTRIBUTION_CONDENSED_INFO_PATH', 'distribution_condensed_info_path'); define('DISTRIBUTION_CONDENSED_INFO_PATH_DEFAULT', 'cdm_dataportal/help/condensed_distribution'); define('DISTRIBUTION_CONDENSED_RECIPE', 'distribution_condensed_recipe'); define('DISTRIBUTION_CONDENSED_RECIPE_DEFAULT', 'EuroPlusMed'); define('DISTRIBUTION_STATUS_COLORS', 'distribution_status_colors'); define('DISTRIBUTION_ORDER_MODE', 'distribution_order_mode'); define('DISTRIBUTION_ORDER_MODE_DEFAULT', 'TREE'); define('DISTRIBUTION_TREE_OMIT_LEVELS', 'distribution_tree_omit_levels'); define('CDM_SYNONYMY_AS_TAB', 'cdm_synonymy_as_tab'); define('CDM_SYNONYMY_AS_TAB_DEFAULT', 1); /** * Returns the array of implemented taxon page tabs. * The array has fixed integer keys which must not be changed. */ function get_taxon_tabs_list() { $opts = array( 0 => 'General', 1 => 'Synonymy', 2 => 'Images', 3 => 'Specimens', 4 => 'Keys', 5 => 'Experts', ); if(variable_get(CDM_SYNONYMY_AS_TAB, CDM_SYNONYMY_AS_TAB_DEFAULT) !== 1){ // skip the Synonymy if it is shown in the general tab unset($opts[1]); } return $opts; } define('CDM_TAXONPAGE_TAB_WEIGHT', 'cdm_taxonpage_tab_weight'); define('CDM_TAXONPAGE_TAB_WEIGHT_DEFAULT', serialize( array( 'general' => '-3', 'synonymy' => '-2', 'images' => '0', 'specimens' => '1', 'keys' => '3', 'experts' => '5', ) )); // CDM_TAXONPAGE_TAB_LABELS_DEFAULT define('CDM_TAXONPAGE_TAB_LABELS', 'cdm_taxonpage_tab_labels'); define('CDM_TAXONPAGE_TAB_LABELS_DEFAULT', serialize( array( 'general' => null, 'synonymy' => null, 'images' => null, 'specimens' => null, 'keys' => null, 'experts' => null, ) )); $taxon_tab_options = get_taxon_tabs_list(); $taxon_tab_options[CDM_DATAPORTAL_LAST_VISITED_TAB_ARRAY_INDEX] = 'Last visited tab'; define('CDM_DATAPORTAL_DEFAULT_TAXON_TAB', serialize($taxon_tab_options)); /** * @todo document this function. */ function get_taxon_options_list() { $taxon_tab_options = array_flip(get_taxon_tabs_list()); foreach ($taxon_tab_options as $key => $value) { $taxon_tab_options[$key] = t('@key', array('@key' => $key)); } return $taxon_tab_options; } define('CDM_PART_DEFINITIONS', 'cdm-part-definitions'); define('CDM_PART_DEFINITIONS_DEFAULT', serialize( array( 'ZoologicalName' => array( 'namePart' => array('name' => TRUE), 'nameAuthorPart' => array('name' => TRUE), 'referencePart' => array('authors' => TRUE), 'microreferencePart' => array('microreference' => TRUE), 'secReferencePart' => array('secReference' => TRUE,), 'statusPart' => array('status' => TRUE), 'descriptionPart' => array('description' => TRUE), ), 'BotanicalName'=> array( 'namePart' => array('name' => TRUE), 'nameAuthorPart' => array('name' => TRUE, 'authors' => TRUE), 'referencePart' => array('reference' => TRUE, 'microreference' => TRUE), 'secReferencePart' => array('secReference' => TRUE,), 'referenceYearPart' => array('reference.year' => TRUE), 'statusPart' => array('status' => TRUE), 'descriptionPart' => array('description' => TRUE), ), '#DEFAULT' => array( 'namePart' => array( 'name' => TRUE ), 'nameAuthorPart' => array( 'name' => TRUE, 'authors' => TRUE ), 'referencePart' => array( 'reference' => TRUE ), 'secReferencePart' => array( 'secReference' => TRUE, ), 'microreferencePart' => array( 'microreference' => TRUE, ), 'statusPart' => array( 'status' => TRUE, ), 'descriptionPart' => array( 'description' => TRUE, ), ) ) ) ); define('CDM_PART_DEFINITIONS_DEFAULT_PRE_380', serialize( array( 'ZoologicalName' => array( 'namePart' => array('name' => TRUE), 'nameAuthorPart' => array('name' => TRUE), 'referencePart' => array('authors' => TRUE), 'microreferencePart' => array('microreference' => TRUE), 'statusPart' => array('status' => TRUE), 'descriptionPart' => array('description' => TRUE), ), 'BotanicalName'=> array( 'namePart' => array('name' => TRUE), 'nameAuthorPart' => array('name' => TRUE, 'authors' => TRUE), 'referencePart' => array('reference' => TRUE, 'microreference' => TRUE), 'referenceYearPart' => array('reference.year' => TRUE), 'statusPart' => array('status' => TRUE), 'descriptionPart' => array('description' => TRUE), ), '#DEFAULT' => array( 'namePart' => array( 'name' => TRUE ), 'nameAuthorPart' => array( 'name' => TRUE, 'authors' => TRUE ), 'referencePart' => array( 'reference' => TRUE ), 'microreferencePart' => array( 'microreference' => TRUE, ), 'statusPart' => array( 'status' => TRUE, ), 'descriptionPart' => array( 'description' => TRUE, ), ) ) ) ); define('CDM_NAME_RENDER_TEMPLATES', 'cdm-name-render-templates'); define('CDM_NAME_RENDER_TEMPLATES_DEFAULT', serialize( array ( 'taxon_page_title,polytomousKey'=> array( 'namePart' => array('#uri' => TRUE), ), 'not_in_current_classification' => array( 'nameAuthorPart' => TRUE, 'referencePart' => TRUE, 'statusPart' => TRUE, 'secReferencePart' => TRUE, ), 'taxon_page_synonymy,accepted_taxon.taxon_page_synonymy'=> array( 'nameAuthorPart' => array('#uri' => TRUE), 'referencePart' => TRUE, 'descriptionPart' => TRUE, 'statusPart' => TRUE, ), 'related_taxon.other_taxon_relationship.taxon_relationships.taxon_page_synonymy'=> array( 'nameAuthorPart' => array('#uri' => TRUE), 'referencePart' => TRUE, 'descriptionPart' => TRUE, 'statusPart' => TRUE, 'secReferencePart' => TRUE, ), 'related_taxon.misapplied_name_for.taxon_relationships.taxon_page_synonymy' => array( 'nameAuthorPart' => array('#uri' => TRUE), 'referencePart' => TRUE, 'descriptionPart' => TRUE, 'statusPart' => TRUE, /* no sec ref in this case, misapplied names are * de-duplicated and the sec ref is shown as footnote */ ), 'homonym'=> array( 'nameAuthorPart' => array('#uri' => TRUE), 'referenceYearPart' => TRUE, 'statusPart' => TRUE, ), 'acceptedFor,typedesignations,list_of_taxa' => array( 'nameAuthorPart' => array('#uri' => TRUE), 'referencePart' => TRUE, ), '#DEFAULT' => array( 'nameAuthorPart' => array('#uri' => TRUE), 'referencePart' => TRUE, ) ) )); define('CDM_NAME_RENDER_TEMPLATES_DEFAULT_PRE_380', serialize( array ( 'taxon_page_title,polytomousKey'=> array( 'namePart' => array('#uri' => TRUE), ), 'taxon_page_synonymy,related_taxon'=> array( 'nameAuthorPart' => array('#uri' => TRUE), 'referencePart' => TRUE, 'statusPart' => TRUE, 'descriptionPart' => TRUE, ), 'homonym'=> array( 'nameAuthorPart' => array('#uri' => TRUE), 'referenceYearPart' => TRUE, ), 'acceptedFor,typedesignations,list_of_taxa' => array( 'nameAuthorPart' => array('#uri' => TRUE), 'referencePart' => TRUE, ), '#DEFAULT' => array( 'nameAuthorPart' => array('#uri' => TRUE), 'referencePart' => TRUE, ) ) )); define('CDM_SEARCH_TAXA_MODE','cdm_search_taxa_mode'); define('CDM_SEARCH_TAXA_MODE_DEFAULT', serialize( // to unset a default enntry set the value to 0 array( 'doTaxa'=>'doTaxa', 'doSynonyms' => 'doSynonyms', 'doTaxaByCommonNames' => 'doTaxaByCommonNames', 'doMisappliedNames' => 'doMisappliedNames' ) ) ); define('CDM_SEARCH_AREA_FILTER_PRESET', 'cdm_search_area_filter_preset'); define('SIMPLE_SEARCH_USE_LUCENE_BACKEND', 'simple_search_use_lucene_backend'); define('SIMPLE_SEARCH_IGNORE_CLASSIFICATION', 'simple_search_ignore_classification'); define('SIMPLE_SEARCH_AUTO_SUGGEST', 'cdm_search_taxa_auto_suggest'); /* Gallery variables. */ $gallery_settings = array( "cdm_dataportal_show_taxon_thumbnails" => 1, "cdm_dataportal_show_synonym_thumbnails" => 0, "cdm_dataportal_show_thumbnail_captions" => 1, "cdm_dataportal_media_maxextend" => 120, "cdm_dataportal_media_cols" => 3, "cdm_dataportal_media_maxRows" => 1, ); define('TAXONPAGE_VISIBILITY_OPTIONS_DEFAULT', serialize(get_taxon_options_list())); define('CDM_DATAPORTAL_GALLERY_SETTINGS', serialize($gallery_settings)); define('CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME', 'specimen_gallery'); define('CDM_DATAPORTAL_TYPE_SPECIMEN_GALLERY_NAME', 'type_specimen_gallery'); define('CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME', "description_gallery"); define('CDM_DATAPORTAL_TAXON_MEDIA_GALLERY_NAME_TAB', "taxon_tab_media_gallery"); define('CDM_DATAPORTAL_SEARCH_GALLERY_NAME', "search_gallery"); define('CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS', 'cdm_dataportal_display_taxon_relationships'); define('CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS', 'cdm_dataportal_display_name_relations'); // define('CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS_2', array("default" => t('Display all'))); define('CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT', 1); define('CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS_DEFAULT', 1); define('CDM_STANDARD_IMAGE_VIEWER', "cdm_standard_image_viewer"); define('CDM_STANDARD_IMAGE_VIEWER_DEFAULT', serialize(array( 'media_representation_details_enabled' => 0 ))); /** * The drupal variable key for the array containing the uuids of the taxon relationship types to display in * the snonymy. * * @var string */ define('CDM_TAXON_RELATIONSHIP_TYPES', 'cdm_taxon_relationship_types'); define('CDM_NAME_RELATIONSHIP_TYPES', 'cdm_name_relationship_types'); define('CDM_NAME_RELATIONSHIP_TYPES_DEFAULT', serialize( array( UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM => UUID_NAMERELATIONSHIPTYPE_LATER_HOMONYM, UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM => UUID_NAMERELATIONSHIPTYPE_TREATED_AS_LATER_HOMONYM, UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR => UUID_NAMERELATIONSHIPTYPE_BLOCKING_NAME_FOR ) ) ); /** * The drupal variable for the configuration of the information aggregation along * the taxon relation ships. The mapped arrayis associative and holds two elements: * - direct: the uuids of the taxon relationship types to take into account in invers * direction. * - invers: the uuids of the taxon relationship types to take into account in direct * direction. * * @var String */ define('CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS', 'cdm_aggregate_by_taxon_relationships'); define('CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS_DEFAULT', serialize( array( 'direct'=>array(), 'invers'=>array() ) )); define('CDM_PROFILE_FEATURETREE_UUID', 'cdm_dataportal_featuretree_uuid'); define('CDM_OCCURRENCE_FEATURETREE_UUID', 'cdm_occurrence_featuretree_uuid'); define('CDM_DATAPORTAL_STRUCTURED_DESCRIPTION_FEATURETREE_UUID', 'cdm_dataportal_structdesc_featuretree_uuid'); define('CDM_DISTRIBUTION_FILTER', 'cdm_distribution_filter'); define('CDM_DISTRIBUTION_FILTER_DEFAULT', serialize( array( 'filter_rules' => array( 'statusOrderPreference' => 0, 'subAreaPreference' => 0, ), 'hiddenAreaMarkerType' => array() ) )); define('DISTRIBUTION_HIERARCHY_STYLE', 'distribution_hierarchy_style'); define('DISTRIBUTION_HIERARCHY_STYLE_DEFAULT', serialize(array( "level_0" => array( 'label_suffix' => ':', 'status_glue' => '', 'item_glue' => ' ', 'item_group_prefix' => '', 'item_group_postfix' => '' ), "level_1" => array( 'label_suffix' => '', 'status_glue' => '‒ ', // '‒ ' 'item_glue' => '; ', 'item_group_prefix' => ', ', 'item_group_postfix' => '' ), "level_2" => array( 'label_suffix' => '', 'status_glue' => '‒ ', // '‒ ' 'item_glue' => ', ', 'item_group_prefix' => ' (', 'item_group_postfix' => ')' ) ))); /** * Constant for the drupal variable key distribution_map_visibility * * possible values: * - never * - automatic * - always */ define('DISTRIBUTION_MAP_VISIBILITY', 'distribution_map_visibility'); define('DISTRIBUTION_MAP_VISIBILITY_DEFAULT', 'automatic'); /** * Constant for the drupal variable key specimen_map_visibility * * possible values: * - never * - automatic * - always */ define('SPECIMEN_MAP_VISIBILITY', 'specimen_map_visibility'); define('SPECIMEN_MAP_VISIBILITY_DEFAULT', 'automatic'); define('CDM_TAXON_MEDIA_FILTER', 'cdm_taxon_media_filter'); define('CDM_TAXON_MEDIA_FILTER_DEFAULT', serialize( array( 'includeTaxonDescriptions' => 'includeTaxonDescriptions', 'includeOccurrences' => 0, 'includeTaxonNameDescriptions' => 0 ) )); define('CDM_MAP_DISTRIBUTION', 'cdm_map_distribution'); define('CDM_MAP_DISTRIBUTION_DEFAULT', serialize(array( // needs to be merged with user setting by drupal_array_merge_deep() // 'width' => 512, // optimum size for OSM layers is 512 // 'height' => 512 / 2, // optimum size for OSM layers 256 'aspect_ratio' => 2, 'bbox' => '', // empty to allow automatic zooming to extend 'maxZoom' => 15, // corresponds to the default in cdm_openlayers_map.defaults 'show_labels' => FALSE, 'caption' => '', 'distribution_opacity' => '0.5', 'map_type' => 1, // 1 = 'openlayers', 0 = 'image' 'image_map' => array( 'base_layer' => '', // none, formerly this was cyprusdivs 'bg_color' => '1874CD', 'layer_style' => 'ffffff,606060,,', ), 'openlayers' => array( 'base_layers' => array( // A layer MUST NOT BE SET in the defaults, // otherwise it can not be overidden by the user settings: // 'mapproxy_vmap0' => 'mapproxy_vmap0', // it is sufficient to define the preferred layer, // since it will automatically be enabled: 'PREFERRED' => 'mapproxy_vmap0'), 'custom_wms_base_layer' => array( 'name' => NULL, 'url' => NULL, 'params' => NULL, 'projection' => NULL, 'proj4js_def' => NULL, 'max_extent' => NULL, 'units' => NULL, 'untiled' => FALSE ), 'wms_overlay_layer' => array( 'name' => NULL, 'url' => NULL, 'params' => NULL, 'untiled' => FALSE ), 'show_layer_switcher' => TRUE, 'display_outside_max_extent' => FALSE, 'google_maps_api_key' => NULL, ), 'legend' => array( 'show' => TRUE, 'opacity' => '0.5', 'font_size' => 10, 'font_style' => FALSE, 'icon_width' => 35, 'icon_height' => 15 ) ))); /** * Merges the named array variable with the array of defaults. * * IMPORTANT: The array keys must be strings. When the keys are integers * the merging will not take place for these entities. Number keyed entities * are just appended to the result array. * * @param string $variable_name * The variable name * @param string | array $default * The array containing the default values either as array or serialized as string. * Unserialization is cared for if necessary * @return array * The merged array as returned by drupal_array_merge_deep() * * TODO compare with mixed_variable_get() duplicate functions? => result use this function instead of mixed_variable_get() * TODO force $default being an array */ function get_array_variable_merged($variable_name, $default){ // unserialize if nessecary if(!is_array($default)){ $default = unserialize($default); } $variable = variable_get($variable_name, array()); $result = drupal_array_merge_deep($default, $variable); return $result; } /** * @todo document this function. */ function getGallerySettings($gallery_config_form_name) { return get_array_variable_merged($gallery_config_form_name, CDM_DATAPORTAL_GALLERY_SETTINGS); } /** * Returns the string representation of the default tab. * * @param bool $returnTabIndex * Defaults to FALSE, if set true this function will return the index number * of the default tab. (used to supply default values to form elements). */ function get_default_taxon_tab($returnTabIndex = FALSE) { global $user; $values = unserialize(CDM_DATAPORTAL_DEFAULT_TAXON_TAB); $user_tab_active = 'cdm_dataportal_' . $user->uid . '_default_tab_active'; $user_tab = 'cdm_dataportal_' . $user->uid . '_default_tab'; // Get the user value if the used has chosen to overwrite the system settings. $user_tab_on = variable_get($user_tab_active, FALSE); if ($user_tab_on) { $user_value = variable_get($user_tab, 0); $index_value = $user_value; // Get the system value. } else { $system_value = variable_get('cdm_dataportal_default_tab', 0); $index_value = $system_value; } // Return the index value or the string representation. if ($returnTabIndex) { return $index_value; } else { return ($values[$index_value]); } } /** * Provides the feature block settings for a specific feature which matches the $feature_uuid parameter. * * In case specifically configured settings array, like these which are stored in the drupal variables, is missing * one or more fields these fields are taken from the default. That is the specific settings are always merges * with the default. * * Note: These settings only apply to feature blocks which do not have a special rendering * the specially handled features (e.g.: Distribution, CommonNames) may make use of the * 'special' element of the settings * * @param $feature_uuid * The uuid string representation of the feature to return the settings for * * @return array * an associative array of settings, with the following fields: * - as_list: string * this setting will be used in compose_feature_block_wrap_elements() as $enclosing_tag * possible values are: * div: not as list, * ul: as bullet list, * ol: as numbered list, * dl: as definition list * The tag used for the inner element, thus depends on the value of this field. The * inner tag name can be retrieved by the function cdm_feature_block_element_tag_name() * - link_to_reference: boolean, * render the reference as link, ignored if the element is NOT a DescriptionElementSource * - link_to_name_used_in_source": boolean * whether to show name in source information as link which will point to the according name page * - sources_as_content (boolean) * TRUE (int: 1): * 1. If element is of the CDM type TextData and the text is not empty the source references will be * appended in brackets like "text (source references)". If the original source has name in source * information it will be appended to the citation string, * like : "(citation, as name in source; citation, as name in source)" * 2. if the text of the TextData is empty, the original source citations are the only content * (e.g. use case CITATION) and are not put into brackets. In this case the nameInSource is * prepended to the citation string like: "name in source: citation" * FALSE (int: 0): * Original sources are put into the bibliography(=references) pseudo feature block. If the original source * citations are the only content, the resulting feature block content would only consist of footnotes. * In this case the display of the respective feature block is suppressed. * TODO if the bibliography is not enabled the sources will be treated as footnotes like annotations, * in future however they will in this case be shown in a separate references section for each * feature block. * - sources_as_content_to_bibliography (boolean) * Only valid if sources_as_content == TRUE, will cause the sources to be also shown * in the bibliography. * - sort_elements * whether and how to sort the elements * possible values are the constants SORT_ASC, SORT_DESC, NULL, * some feature types (Distribution) also support: SORT_HIERARCHICAL ( * TODO option to exclude levels, put in special?, * TODO make use of this setting in compose_feature_block_wrap_elements()) * - element_tag * specifies the tag to be used for creating the elements, only applies if "as_list" == 'div' * possible values are span | div. the proper inner tag name can be retrieved by the function * cdm_feature_block_element_tag_name() * - special: array() * an array with further settings, this field can be used for special * settings for specialized rendering like for distributions * } * */ function get_feature_block_settings($feature_uuid = 'DEFAULT') { // the default must conform to the default parameter values of // compose_feature_block_wrap_elements() : $glue = '', $sort = FALSE, $enclosing_tag = 'ul' // compose_description_element_text_data() : asListElement = NULL // see #3257 (implement means to define the features to show up in the taxonprofile and in the specimen descriptions) // ---- DEFAULTS settings // only needed as final option, when the settings are not having a default $default = array( 'DEFAULT' => array( 'as_list' => 'div', 'link_to_reference' => 0, 'link_to_name_used_in_source' => 1, 'sources_as_content' => 0, 'sources_as_content_to_bibliography' => 0, 'sort_elements' => NO_SORT, 'glue' => '', 'element_tag' => NULL ), // settings for pseudo feature bibliography // only hard coded here 'BIBLIOGRAPHY' => array( 'as_list' => 'div', 'link_to_reference' => 0, 'link_to_name_used_in_source' => 1, 'sources_as_content' => 0, 'sources_as_content_to_bibliography' => 0, 'sort_elements' => NO_SORT, 'glue' => '', 'element_tag' => NULL ) ); // will be used as preset in the settings $other_themes_default = array( 'DEFAULT' => array( 'as_list' => 'div', 'link_to_reference' => 0, 'link_to_name_used_in_source' => 1, 'sources_as_content' => 0, 'sources_as_content_to_bibliography' => 0, 'sort_elements' => NO_SORT, 'glue' => '', 'element_tag' => NULL ), UUID_CITATION => array( 'as_list' => 'div', 'link_to_reference' => 0, 'link_to_name_used_in_source' => 0, 'sources_as_content' => 1, 'sources_as_content_to_bibliography' => 0, 'sort_elements' => SORT_ASC, 'glue' => '', 'element_tag' => 'div' ), UUID_DISTRIBUTION => array( 'as_list' => 'div', // currently ignored 'link_to_reference' => 0, 'link_to_name_used_in_source' => 0, 'sources_as_content' => 0, 'sources_as_content_to_bibliography' => 0, 'sort_elements' => NO_SORT, // will cause ... 'glue' => '', 'element_tag' => 'div', 'special' => array() ), UUID_COMMON_NAME => array( 'as_list' => 'div', 'link_to_reference' => 0, 'link_to_name_used_in_source' => 1, 'sources_as_content' => 0, 'sources_as_content_to_bibliography' => 0, 'sort_elements' => NO_SORT, 'glue' => '', 'element_tag' => 'span' ), ); // ---- Special DEFAULTS for existing portals // TODO: // this can be removed once the feature block // settings have been deployed for the first time to these portals $cichorieae_default = array( 'DEFAULT' => array( 'as_list' => 'div', 'link_to_reference' => 1, 'link_to_name_used_in_source' => 1, 'sources_as_content' => 1, 'sources_as_content_to_bibliography' => 0, 'sort_elements' => NO_SORT, 'glue' => '', 'element_tag' => 'div' ), UUID_CITATION => array( 'as_list' => 'div', 'link_to_reference' => 0, 'link_to_name_used_in_source' => 0, 'sources_as_content' => 1, 'sources_as_content_to_bibliography' => 0, 'sort_elements' => SORT_ASC, 'glue' => '', 'element_tag' => 'div' ), UUID_CHROMOSOMES_NUMBERS => array( 'as_list' => 'ul', 'link_to_reference' => 1, 'link_to_name_used_in_source' => 1, 'sources_as_content' => 1, 'sources_as_content_to_bibliography' => 0, 'sort_elements' => NO_SORT, 'glue' => '', 'element_tag' => 'div' ), UUID_CHROMOSOMES => array( 'as_list' => 'ul', 'link_to_reference' => 0, 'link_to_name_used_in_source' => 1, 'sources_as_content' => 1, 'sources_as_content_to_bibliography' => 0, 'sort_elements' => NO_SORT, 'glue' => '', 'element_tag' => 'div' ), UUID_COMMON_NAME => array( 'as_list' => 'div', 'link_to_reference' => 0, 'link_to_name_used_in_source' => 1, 'sources_as_content' => 0, 'sources_as_content_to_bibliography' => 0, 'sort_elements' => NO_SORT, 'glue' => '', 'element_tag' => 'span' ), ); $palmweb_default = array( 'DEFAULT' => array( 'as_list' => 'ul', 'link_to_reference' => 1, 'link_to_name_used_in_source' => 1, 'sources_as_content' => 1, 'sources_as_content_to_bibliography' => 1, 'sort_elements' => NO_SORT, 'glue' => '', 'element_tag' => NULL ), UUID_CITATION => array( 'as_list' => 'ul', 'link_to_reference' => 1, 'link_to_name_used_in_source' => 1, 'sources_as_content' => 0, 'sources_as_content_to_bibliography' => 1, 'sort_elements' => SORT_ASC, 'glue' => '', 'element_tag' => 'div' ), UUID_DISTRIBUTION => array( 'as_list' => 'div', // currently ignored 'link_to_reference' => 1, 'link_to_name_used_in_source' => 1, 'sources_as_content' => 1, // FIXME seems to have no effect see Acanthophoenix rousselii (palmae) 'sources_as_content_to_bibliography' => 1, 'sort_elements' => NO_SORT, // will cause ... 'glue' => ', ', 'element_tag' => 'span', 'special' => array() ), ); $cyprus_default = $cichorieae_default; $cyprus_default[UUID_DISTRIBUTION] = array( 'as_list' => 'div', // currently ignored 'link_to_reference' => 0, 'link_to_name_used_in_source' => 0, 'sources_as_content' => 0, 'sources_as_content_to_bibliography' => 0, 'sort_elements' => NO_SORT, // will cause ... 'glue' => ' ', 'element_tag' => 'div', 'special' => array() ); $default_theme = variable_get('theme_default', NULL); switch ($default_theme) { case 'garland_cichorieae': $settings_for_theme = $cichorieae_default; break; case 'cyprus': // cyprus: no longer used in production, // but is required for selenium tests see class eu.etaxonomy.dataportal.pages.PortalPage $settings_for_theme = $cyprus_default; break; case 'flore_afrique_centrale': case 'flora_malesiana': case 'flore_gabon': $settings_for_theme = $cichorieae_default; $settings_for_theme[UUID_CITATION]['as_list'] = 'ul'; break; case 'palmweb_2': $settings_for_theme = $palmweb_default; break; default: $settings_for_theme = $other_themes_default; } // add pseudo feature settings $settings_for_theme['BIBLIOGRAPHY'] = $default['BIBLIOGRAPHY']; // ---- END of DEFAULTS $saved_settings = variable_get(FEATURE_BLOCK_SETTINGS, NULL); $feature_block_setting = null; if (isset($saved_settings[$feature_uuid])) { $feature_block_setting = $saved_settings[$feature_uuid]; } else if (isset($settings_for_theme[$feature_uuid])) { $feature_block_setting = $settings_for_theme[$feature_uuid]; } else if (isset($settings_for_theme['DEFAULT'])) { $feature_block_setting = $settings_for_theme['DEFAULT']; } // now merge the default and specific settings $settings_to_merge = array($default['DEFAULT']); if(is_array($saved_settings)){ $settings_to_merge[] = $saved_settings['DEFAULT']; } if(isset($feature_block_setting)){ $settings_to_merge[] = $feature_block_setting; } $feature_block_setting = drupal_array_merge_deep_array($settings_to_merge); return $feature_block_setting; } /** * returns the current setting for the original source bibliography * * Caches internally * * @return array * the setting for the original source bibliography see BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE: * - 'enabled': 1|0 * - 'key_format': one of 'latin', 'ROMAN', 'roman', 'ALPHA', 'alpha' */ function get_bibliography_settings($clear_cache = false){ static $bibliography_settings = null; if(!$bibliography_settings || $clear_cache){ $bibliography_settings = get_array_variable_merged( BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE, BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE_DEFAULT ); } return $bibliography_settings; } /** * @todo Please document this function. * @see http://drupal.org/node/1354 */ function cdm_dataportal_menu_admin(&$items) { // Display section on admin/config page. $items['admin/config/cdm_dataportal'] = array( 'title' => 'CDM Dataportal', 'description' => 'Settings for the CDM DataPortal.', 'position' => 'right', 'weight' => 10, 'page callback' => 'system_admin_menu_block_page', 'access arguments' => array('administer cdm_dataportal'), 'file' => 'system.admin.inc', 'file path' => drupal_get_path('module', 'system'), ); $items['admin/config/cdm_dataportal/settings'] = array( 'title' => 'Settings', 'description' => 'Settings for the CDM DataPortal.', 'weight' => 0, 'page callback' => 'drupal_get_form', 'page arguments' => array('cdm_settings_general'), 'access arguments' => array('administer cdm_dataportal'), 'type' => MENU_NORMAL_ITEM, ); $items['admin/config/cdm_dataportal/settings/general'] = array( 'title' => 'General', 'description' => 'General', 'weight' => 0, 'page callback' => 'drupal_get_form', 'page arguments' => array('cdm_settings_general'), 'access arguments' => array('administer cdm_dataportal'), 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items['admin/config/cdm_dataportal/settings/cachesite'] = array( 'title' => 'Cache', 'description' => 'Cache', 'access arguments' => array('administer cdm_dataportal'), 'page callback' => 'drupal_get_form', 'page arguments' => array('cdm_settings_cache'), 'weight' => 10, 'type' => MENU_LOCAL_TASK, ); $items['admin/config/cdm_dataportal/settings/geo'] = array( 'title' => 'Geo & Map', 'description' => 'Geo & Map', 'access arguments' => array('administer cdm_dataportal'), 'page callback' => 'drupal_get_form', 'page arguments' => array('cdm_settings_geo'), 'weight' => 1, 'type' => MENU_LOCAL_TASK, ); $items['admin/config/cdm_dataportal/settings/layout'] = array( 'title' => 'Layout', 'description' => 'Configure and adjust the layout of your DataPortal ', 'access arguments' => array('administer cdm_dataportal'), 'page callback' => 'drupal_get_form', 'page arguments' => array('cdm_settings_layout'), 'weight' => 2, 'type' => MENU_LOCAL_TASK, ); $items['admin/config/cdm_dataportal/settings/layout/taxon'] = array( 'title' => 'Taxon', 'description' => 'Configure and adjust the layout of your DataPortal ', 'access arguments' => array('administer cdm_dataportal'), 'page callback' => 'drupal_get_form', 'page arguments' => array('cdm_settings_layout_taxon'), 'weight' => 1, 'type' => MENU_LOCAL_TASK, ); /* $items[] = array( 'path' => 'admin/config/cdm_dataportal/layout/synonymy', 'title' => t('Synonymy'), 'description' => t('Configure and adjust the layout of your DataPortal '), 'access' => user_access('administer cdm_dataportal'), 'callback' => 'drupal_get_form', 'callback arguments' => array('cdm_settings_layout_synonymy'), 'weight' => 1, 'type' => MENU_LOCAL_TASK, ); $items[] = array( 'path' => 'admin/config/cdm_dataportal/layout/specimens', 'title' => t('Specimens'), 'description' => t('Configure and adjust the layout of your DataPortal '), 'access' => user_access('administer cdm_dataportal'), 'callback' => 'drupal_get_form', 'callback arguments' => array('cdm_settings_layout_specimens'), 'weight' => 1, 'type' => MENU_LOCAL_TASK, ); */ $items['admin/config/cdm_dataportal/settings/layout/search'] = array( 'title' => 'Search', 'description' => 'Configure and adjust the layout of your DataPortal ', 'access arguments' => array('administer cdm_dataportal'), 'page callback' => 'drupal_get_form', 'page arguments' => array('cdm_settings_layout_search'), 'weight' => 2, 'type' => MENU_LOCAL_TASK, ); $items['admin/config/cdm_dataportal/settings/layout/media'] = array( 'title' => 'Media', 'description' => 'Configure and adjust the layout of your DataPortal ', 'access arguments' => array('administer cdm_dataportal'), 'page callback' => 'drupal_get_form', 'page arguments' => array('cdm_settings_layout_media'), 'weight' => 3, 'type' => MENU_LOCAL_TASK, ); } /** * @todo document this function. */ function cdm_help_general_cache() { $form = array(); $form['cache_help'] = array( '#type' => 'fieldset', '#title' => t('Help'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); $form['cache_help']['test'] = array('#value' => t('probando')); return drupal_render($form); $res = array(); $res['default'] = drupal_render($help); return $res; } /** * Configures the settings form for the CDM-API module. * * @return array * Drupal settings form. */ function cdm_settings_general() { $form['cdm_webservice'] = array( '#type' => 'fieldset', '#title' => t('CDM Server'), '#collapsible' => FALSE, '#collapsed' => FALSE, '#description' => t('The CDM Server exposes data stored in a CDM data base to the web via RESTful web services and thus is the source of the data to be displayed by a CDM DataPotal.'), ); $form['cdm_webservice']['cdm_webservice_url'] = array( '#type' => 'textfield', '#title' => t('CDM web service URL') . ':', '#description' => t('This is the URL to the CDM-Server exposing your data e.g. "http://myserver.net/cdmserver/myproject"'), '#default_value' => variable_get('cdm_webservice_url', NULL), ); $form['cdm_webservice']['cdm_webservice_debug'] = array( '#type' => 'markup', '#markup' => 'Debug CDM Web Service: Debugging web services is possible via the ' . l('CDM web service debug block', 'admin/structure/block/manage/cdm_api/cdm_ws_debug/configure') . ' visible only for administrators', ); $form['cdm_webservice']['freetext_index'] = array( '#type' => 'fieldset', '#title' => t('Freetext index'), '#collapsible' => FALSE, '#collapsed' => FALSE, ); // Check the cdmserver port number and display a waring if it is not port 80 preg_match("#http[s]?://[0-9\p{L}\.]*:([0-9]*)/.*#u", variable_get('cdm_webservice_url', ''), $portNumberMatch, PREG_OFFSET_CAPTURE); if (isset($portNumberMatch[1]) && $portNumberMatch[1] != '80') { $form['cdm_webservice']['freetext_index']['message'] = array( '#markup' => "
user:password
')
);
drupal_add_js('
jQuery(document).ready(function() {
jQuery("#edit-cdm-login").change(function (e) {
var login = jQuery(e.target).val();
jQuery("#edit-freetext-index .index-trigger").each(function(index){
var url = jQuery(this).attr("href");
url = url.replace(/:\/\/[^@]+@|:\/\//, "://" + login + "@");
jQuery(this).attr("href", url);
});
});
});
',
array(
'type' => 'inline',
'scope' => 'footer'
)
);
_add_js_cdm_ws_progressbar(".index-trigger", "#index-progress");
$form['cdm_webservice']['proxy'] = array(
'#type' => 'fieldset',
'#title' => t('Proxy'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['cdm_webservice']['proxy']['cdm_webservice_proxy_url'] = array(
'#type' => 'textfield',
'#title' => t('Proxy URL') . ':',
'#description' => t('If this proxy url is set the cdm api tries
to connect the web service over the given proxy server.
Otherwise proxy usage is deactivated.'),
'#default_value' => variable_get('cdm_webservice_proxy_url', FALSE),
);
$form['cdm_webservice']['proxy']['cdm_webservice_proxy_port'] = array(
'#type' => 'textfield',
'#title' => t('Proxy port') . ':',
'#default_value' => variable_get('cdm_webservice_proxy_port', '80'),
);
$form['cdm_webservice']['proxy']['cdm_webservice_proxy_usr'] = array(
'#type' => 'textfield',
'#title' => t('Login') . ':',
'#default_value' => variable_get('cdm_webservice_proxy_usr', FALSE),
);
$form['cdm_webservice']['proxy']['cdm_webservice_proxy_pwd'] = array(
'#type' => 'textfield',
'#title' => t('Password') . ':',
'#default_value' => variable_get('cdm_webservice_proxy_pwd', FALSE),
);
$form['sub_tree_filter'] = array(
'#type' => 'fieldset',
'#title' => t('Subtree filter'),
'#collapsible' => FALSE,
'#collapsed' => TRUE,
'#description' => t('The Data Portal can be restricted to the taxa which belong to a specific classification subtree. Other taxa will not be shown or accessible otherwise.'),
);
$sub_tree_filter_uuid_value = variable_get(CDM_SUB_TREE_FILTER_UUID, FALSE);
$taxon_node_info = '';
if($sub_tree_filter_uuid_value){
$taxon_node_dto = cdm_ws_get(CDM_WS_TAXONNODE, array($sub_tree_filter_uuid_value));
if($taxon_node_dto){
$taxon_node_info = " Current taxon node: " . cdm_tagged_text_to_markup($taxon_node_dto->taggedTitle) . " [" . $taxon_node_dto->treeIndex . "]";
}
}
$form['sub_tree_filter'][CDM_SUB_TREE_FILTER_UUID] = array(
'#type' => 'textfield',
'#title' => t('Taxon Node UUID') . ':',
'#default_value' => variable_get(CDM_SUB_TREE_FILTER_UUID, FALSE),
'#description' => "The uuid of the TaxonNode entity to be used as filter." . $taxon_node_info
);
// TODO: settings are still incomplete, compare with
// trunk/dataportal/inc/config_default.php.inc.
$form['taxon_tree'] = array(
'#type' => 'fieldset',
'#title' => t('Taxon Tree'),
'#collapsible' => FALSE,
'#collapsed' => TRUE,
'#description' => t('When you explore your collection, you can navigate it through a tree structure also called Taxon Tree.
To be able to navigate through your collection the drupal block CDM Taxon Tree should be visible for users. Enable the block at Administer->Site building->Blocks
'), ); $form['taxon_tree'][CDM_TAXONOMICTREE_UUID] = array( '#type' => 'select', '#title' => t('Default classification') . ':', '#default_value' => variable_get(CDM_TAXONOMICTREE_UUID, FALSE), '#options' => cdm_get_taxontrees_as_options(), '#description' => t('The default taxa classification to be used in the whole portal. This affects most obviously the classification browser and the search in case is is restricted to a specific classification. See also Included Classifications below.'), ); $form['taxon_tree'][TAXONTREE_RANKLIMIT] = array( '#type' => 'select', '#title' => t('Rank of highest displayed taxon') . ':', // Before DEFAULT_TAXONTREE_RANKLIMIT_UUID. '#default_value' => variable_get(TAXONTREE_RANKLIMIT, TAXONTREE_RANKLIMIT_DEFAULT), '#options' => cdm_vocabulary_as_option(UUID_RANK, null, true), '#description' => t('This is the rank of the highest displayed taxon in the taxon tree. You can select here which rank should be at the top level of the tree structure.'), ); $classification_uuids = array_keys(cdm_get_taxontrees_as_options()); $taxontree_includes_default = array_combine($classification_uuids, $classification_uuids); $form['taxon_tree'][CDM_TAXONTREE_INCLUDES] = array( '#type' => 'checkboxes', '#title' => t('Included Classifications') . ':', '#default_value' => variable_get(CDM_TAXONTREE_INCLUDES, $taxontree_includes_default), '#options' => cdm_get_taxontrees_as_options(), '#description' => t('Only the checked classifications will be available in the classification chooser.'), ); $form['distribution'] = array( '#type' => 'fieldset', '#title' => t('Distributions'), '#collapsible' => FALSE, '#description' => 'This section covers general settings regarding distributions, map related settings are found in the ' . l('geo & map tab', 'admin/config/cdm_dataportal/settings/geo') . '. Further settings regarding the Distribution feature block can be found in the Layout/Taxon tab at two distinct places: ' . l('Distribution appearance', 'admin/config/cdm_dataportal/settings/layout/taxon', array('fragment' => 'edit-distribution-layout')) .', ' . l('Taxon profile feature block settings', 'admin/config/cdm_dataportal/settings/layout/taxon', array('fragment' => 'edit-feature-block-settings')) . '', ); $form['distribution'][CDM_DISTRIBUTION_FILTER] = array( '#type' => 'fieldset', '#title' => 'Distribution filter', '#collapsible' => FALSE, '#collapsed' => FALSE, '#tree' => TRUE, '#description' => 'The Distribution filter offers the following options
', ); $form['aggregation'][CDM_TAXON_MEDIA_FILTER] = array( '#type' => 'checkboxes', '#title' => 'Taxon media filter', '#default_value' => variable_get(CDM_TAXON_MEDIA_FILTER, unserialize(CDM_TAXON_MEDIA_FILTER_DEFAULT)), '#options' => array( 'includeTaxonDescriptions' => 'Media in taxon descriptions', 'includeTaxonNameDescriptions' => 'Media in name descriptions', 'includeOccurrences' => 'Media related to specimens and occurrences', ), '#description' => 'This filter configures which images should be taken into account.', ); $form['aggregation']['notice'] = array( '#markup' => 'NOTICE: The below aggregation settings can slow down the data portal, so you may want to sensibly apply these setting and you may also want to make use of the caching capabilities of the dataportal.', ); $form['aggregation']['media_aggregation'] = array( '#type' => 'fieldset', '#title' => t('Media aggregation'), '#collapsible' => FALSE, '#collapsed' => TRUE, '#description' => t("The media aggregation is also affected by the settigs in \"Aggregation via taxon relationsships\" below."), ); $form['aggregation']['media_aggregation']['cdm_images_include_children'] = array( '#type' => 'select', '#title' => t('Aggregation of taxon pictures') . ':', '#default_value' => variable_get('cdm_images_include_children', FALSE), '#options' => array( 0 => "Show only pictures of the current taxon", 1 => "Include pictures of taxonomic children", ), '#description' => t("Choose whether to include the images of the taxonomic children. This will affect the Images tab and image tumbnails like in the search results."), ); $form['aggregation']['aggregate_by_taxon_relationships'][CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS] = array( '#type' => 'fieldset', '#attributes' => array('class' => array('clearfix')), '#title' => t('Aggregation via taxon relationsships'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#tree' => TRUE, '#description' => t('Information on taxa will be aggregated along the below chosen taxon relation ships. This will affect images and occurrences (specimens). Taxon relation ships are directed and point form one taxon to another. The taxon relationships to be taken into accunt can therefore configured for the direct direction and for the inverse.'), ); $taxonRelationshipTypeOptions = cdm_vocabulary_as_option(UUID_TAXON_RELATIONSHIP_TYPE, '_cdm_relationship_type_term_label_callback'); $aggregate_by_taxon_relationships = variable_get(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS, unserialize(CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS_DEFAULT)); $form['aggregation']['aggregate_by_taxon_relationships'][CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS]['direct'] = array( '#type' => 'checkboxes', '#title' => t('Direct'), '#options' => $taxonRelationshipTypeOptions, '#default_value' => $aggregate_by_taxon_relationships['direct'], ); $form['aggregation']['aggregate_by_taxon_relationships'][CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS]['invers'] = array( '#type' => 'checkboxes', '#title' => t('Invers'), '#options' => $taxonRelationshipTypeOptions, '#default_value' => $aggregate_by_taxon_relationships['invers'], ); $form['drupal_integration'] = array( '#type' => 'fieldset', '#attributes' => array('class'=> array('clearfix')), '#title' => t('Drupal integration'), '#collapsible' => FALSE, '#collapsed' => FALSE, '#tree' => FALSE ); $form['drupal_integration'][CDM_DRUPAL_NODE_CREATION] = array( '#type' => 'checkbox', '#title' => 'Create drupal nodes', '#default_value' => variable_get(CDM_DRUPAL_NODE_CREATION, FALSE), '#description' => 'Content für cdm_dataportal pages is directly retrieved from the CDM webservice configured above. In order to use other drupal modules like the "Comments" module together with the cdm pages it is required that drupal nodes are created and stored in the database.' ); $form['drupal_integration']['drop_all_cdm_nodes_warning_pre'] = array( '#markup' => '
' . file_directory_temp() . '/drupal_debug.txt
The log is written by the drupal devel module function dd()
.
' . t('This settings contains the general configurations layout. If you want to configure the specific sites layout visit the respective configuration site for taxon, search or media.') . '
', ); // ---- footnotes --- // $form['footnotes'] = array( '#type' => 'fieldset', '#title' => t('Footnotes'), '#collapsible' => FALSE, '#collapsed' => FALSE, '#description' => t('Taxa data such authors, synonyms names, descriptions, media or distribution areas may have annotations or footnotes. When the footnotes are enabled they will be visible (if they exist).'), ); $form['footnotes']['cdm_dataportal_all_footnotes'] = array( '#type' => 'checkbox', '#title' => t('Do not show footnotes'), '#default_value' => variable_get('cdm_dataportal_all_footnotes', CDM_DATAPORTAL_ALL_FOOTNOTES), '#description' => t('Check this if you do not want to show any footnotes'), ); $form['footnotes']['cdm_dataportal_annotations_footnotes'] = array( '#type' => 'checkbox', '#title' => t('Do not show annotation footnotes'), '#default_value' => variable_get('cdm_dataportal_annotations_footnotes', CDM_DATAPORTAL_ANNOTATIONS_FOOTNOTES), '#description' => t('Check this if you do not want to show annotation footnotes'), ); $form['annotations'] = array( '#type' => 'fieldset', '#title' => t('Annotations'), '#collapsible' => FALSE, '#collapsed' => FALSE, '#description' => t('This sections allows configuring global settings regarding annotations and thus will affect annotations dispayed as footnote and others.'), ); $annotationTypeOptions = cdm_terms_by_type_as_option('AnnotationType'); // Additional option for the NULL case. $annotationTypeOptions['NULL_VALUE'] = t('untyped'); $annotationsTypesAsFootnotes = variable_get(ANNOTATION_TYPES_VISIBLE, unserialize(ANNOTATIONS_TYPES_AS_FOOTNOTES_DEFAULT)); $form['annotations'][ANNOTATION_TYPES_VISIBLE] = array( '#type' => 'checkboxes', '#title' => t('Visbility of annotation types'), '#description' => t("Only annotations of the selected type will be displayed. You may want to turn 'technical annotations' off."), '#options' => $annotationTypeOptions, '#default_value' => $annotationsTypesAsFootnotes ); // ---- original source --- // $form[BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE] = array( '#type' => 'fieldset', '#tree' => TRUE, '#title' => t('Source Citations'), '#collapsible' => FALSE, '#collapsed' => FALSE, ); $bibliography_settings = get_bibliography_settings(true); $form[BIBLIOGRAPHY_FOR_ORIGINAL_SOURCE]['enabled'] = array( '#type' => 'checkbox', '#title' => t('Original Source in bibliography'), '#default_value' => $bibliography_settings['enabled'], '#description' => t('Show original source citations in bibliography block, instead of rendering them with other annotations in each feature block.registration/{url encoded persistent http identifier}
to using the persistent http identifier directly as link.'),
);
// ---- Taxon Name Rendering --- //
$form['taxon_name'] = array(
'#type' => 'fieldset',
'#title' => t('Taxon name display'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('The display of taxon names is configured by two parts.
The ' . $which_version_message . '
The part definitions define the specific parts of which a rendered taxon name plus additional information will consist.
A full taxon name plus additional information can consist of the following elements:
These elements are combined in the part definitions array to from the specific parts to be rendered. (The taxon name "Lapsana communis L., Sp. Pl.: 811. 1753" shall be an example in the following) The following parts can be formed and are recognized by the system:
Each set of parts is dedicated to render a specific TaxonName type, the type names are used as keys for the specific parts part definitions:
{ "ZoologicalName": { "namePart": { "name": true }, "referencePart": { "authors": true }, "microreferencePart": { "microreference": true }, "statusPart": { "status": true }, "descriptionPart": { "description": true } }, "BotanicalName": { "namePart": { "name": true, "authors": true }, "referencePart": { "reference": true, "microreference": true }, "secReferencePart": { "secReference": true }, "statusPart": { "status": true }, "descriptionPart": { "description": true } } }', ); $default_render_templates = unserialize(CDM_NAME_RENDER_TEMPLATES_DEFAULT); $default_render_templates_pre_380_json = json_encode(unserialize(CDM_NAME_RENDER_TEMPLATES_DEFAULT_PRE_380), JSON_PRETTY_PRINT); $default_render_templates_json = json_encode($default_render_templates, JSON_PRETTY_PRINT); $current_render_templates_json = json_encode(variable_get(CDM_NAME_RENDER_TEMPLATES, $default_render_templates), JSON_PRETTY_PRINT); $is_custom_render_template = $default_render_templates_json != $current_render_templates_json; if($default_render_templates_pre_380_json == $current_render_templates_json){ $which_version_message = '(These are the old default render templates from before EDIT platform release 3.8.0, you may want to reset these by clearing the text area and and submitting the form.)'; } else if($is_custom_render_template){ $which_version_message = '(These are custom render templates, clearing the text area and and submitting the form will reset it to the default)'; } else { $which_version_message = '(These are the default render templates.)'; } $diff_viewer_markup = ''; if($is_custom_render_template){ $diff_viewer_markup = diff_viewer($default_render_templates_json, $current_render_templates_json); } $which_version_message = '
' . $which_version_message . '
The render templates array contains one or more name render templates to be used within the page areas identified by the
render path. The render path of taxon names can be made visible by adding the URI query parameter
RENDER_PATH=1
to the page request.
The render path is used as key of the array sub subelements whereas the name render template array is set as value.
The following render Path keys are currently recognized:
A render template is an associative array. The keys of this array are referring to the keys as defined in the part definitions array. See Part definitions above for more information.
The value of the render template element must be set to TRUE in order to let this part being rendered.
For some parts can links can be created which lead to the accoring intity page:
The namePart, nameAuthorPart, referencePart and secReferencePart can also hold an associative array with a single
element: array(\'#uri\' => TRUE). The value of the #uri element will be replaced by the according
links if the paramters $nameLink or $refenceLink are given to the name render function
(this is hard coded and cannot be configured here).',
);
// @WA: D7 form api does not support reset buttons,
// so to mimic the D5 reset button we add one like this.
$form['actions']['reset'] = array(
'#markup' => '',
'#weight' => 1000,
);
$form['#submit'] = array('submit_json_as_php_array');
// #json_elements especially defined for submit_json_as_php_array()
$form['#json_elements'] = array(CDM_NAME_RENDER_TEMPLATES, CDM_PART_DEFINITIONS);
return system_settings_form($form);
}
/**
* @param $form_name
* @param $form_title
* @param $collapsed
* @param string $form_description
* The description for the fieldset of the gallery setting.
* @return mixed
*/
function cdm_dataportal_create_gallery_settings_form($form_name, $form_title, $collapsed, $form_description = '') {
$form[$form_name] = array(
'#type' => 'fieldset',
'#title' => t('@form-title', array('@form-title' => $form_title)),
'#collapsible' => TRUE,
'#collapsed' => $collapsed,
'#tree' => TRUE,
'#description' => $form_description,
);
$default_values = unserialize(CDM_DATAPORTAL_GALLERY_SETTINGS);
$gallery_settings = variable_get($form_name, $default_values);
// $test = variable_get('cdm_dataportal_search_items_on_page', CDM_DATAPORTAL_SEARCH_ITEMS_ON_PAGE);
if ($form_name == CDM_DATAPORTAL_SEARCH_GALLERY_NAME) {
/*
TODO: why cdm_dataportal_search_items_on_page does not save the value on $test???
$form[$form_name]['cdm_dataportal_search_items_on_page'] = array(
'#type' => 'textfield',
'#title' => t('Search Page Size'),
'#default_value' => $test,
'#description' => t('Number of Names to display per page in search results.')
);
*/
$form[$form_name]['cdm_dataportal_show_taxon_thumbnails'] = array(
'#type' => 'checkbox',
'#title' => t('Show media thumbnails for accepted taxa'),
'#default_value' => $gallery_settings['cdm_dataportal_show_taxon_thumbnails'],
);
$form[$form_name]['cdm_dataportal_show_synonym_thumbnails'] = array(
'#type' => 'checkbox',
'#title' => t('Show media thumbnails for synonyms'),
'#default_value' => $gallery_settings['cdm_dataportal_show_synonym_thumbnails'],
'#description' => '',
);
}
// $showCaption = variable_get('cdm_dataportal_findtaxa_show_thumbnail_captions', 0);
$form[$form_name]['cdm_dataportal_show_thumbnail_captions'] = array(
'#type' => 'checkbox',
'#title' => t('Show captions under thumbnails'),
'#default_value' => $gallery_settings['cdm_dataportal_show_thumbnail_captions'],
'#description' => '',
);
$form[$form_name]['cdm_dataportal_media_maxextend'] = array(
'#type' => 'textfield',
'#title' => t('Thumbnail size (max of width or height)') . ':',
'#default_value' => $gallery_settings['cdm_dataportal_media_maxextend'],
'#description' => t('The maximum extend in either dimension, width or height, in pixels for the thumbnail images in the gallery.'),
);
$form[$form_name]['cdm_dataportal_media_cols'] = array(
'#type' => 'textfield',
'#title' => t('Number of columns') . ':',
'#default_value' => $gallery_settings['cdm_dataportal_media_cols'],
'#description' => t('Group the thumbnails in columns: select how many
columns the gallery should display.'),
);
if ($form_name == CDM_DATAPORTAL_SEARCH_GALLERY_NAME) {
$form[$form_name]['cdm_dataportal_media_maxRows'] = array(
'#type' => 'textfield',
'#title' => t('Maximum number of rows') . ':',
'#default_value' => $gallery_settings['cdm_dataportal_media_maxRows'],
'#description' => t('You can group the thumbnails in rows, select in how
many rows should be the thumbnails grouped.
Note:
If you want an unlimited number of rows please set to 0.'),
);
}
return $form;
}
/**
* @todo document this function.
*/
function cdm_settings_layout_taxon() {
$collapsed = FALSE;
$form = array();
$form['#submit'][] = 'cdm_settings_layout_taxon_submit';
// --------- TABBED TAXON ------- //
$form['taxon_tabs'] = array(
'#type' => 'fieldset',
'#title' => t('Taxon tabs'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => 'A taxon page consists of various sections, that is content blocks, each displaying a different kind of information.'
);
$form['taxon_tabs']['cdm_dataportal_taxonpage_tabs'] = array(
'#type' => 'checkbox',
'#title' => t('Tabbed taxon page'),
'#default_value' => variable_get('cdm_dataportal_taxonpage_tabs', 1),
'#description' => t('If enabled the sections of a taxon page will be displayed as individual tabs'),
);
$form['taxon_tabs'][CDM_SYNONYMY_AS_TAB] = array(
'#type' => 'checkbox',
'#title' => t('Synonymy as tab'),
'#default_value' => variable_get(CDM_SYNONYMY_AS_TAB, CDM_SYNONYMY_AS_TAB_DEFAULT),
'#description' => t('The synonymy can be moved to its own tab. This is only applicable when the tabbed taxon page option is activated.'),
'#disabled' => variable_get('cdm_dataportal_taxonpage_tabs', 1) !== 1
);
$form['taxon_tabs']['cdm_taxonpage_tabs_visibility'] = array(
'#type' => 'checkboxes',
'#title' => t('Section/Tab visibility') . ':',
'#default_value' => variable_get('cdm_taxonpage_tabs_visibility', get_taxon_options_list()),
'#options' => get_taxon_options_list()
);
// WEIGHT
$taxon_tabs_weights = get_array_variable_merged(CDM_TAXONPAGE_TAB_WEIGHT, CDM_TAXONPAGE_TAB_WEIGHT_DEFAULT);
$form['taxon_tabs'][CDM_TAXONPAGE_TAB_WEIGHT] = array(
'#title' => 'Section/Tab order',
'#type' => 'fieldset',
'#collapsible' => false,
'#tree' => true,
'#description' => 'The weight value defines the order of the section/tab.'
);
// Weights range from -delta to +delta, so delta should be at least half
// of the amount of tabs present.
$tab_weight_delta = round(count(get_taxon_tabs_list()) / 2) + 1;
foreach (get_taxon_tabs_list() as $label) {
$key = strtolower($label); // turn in to string, since we need to use strings as keys
$form['taxon_tabs'][CDM_TAXONPAGE_TAB_WEIGHT][$key] = array(
'#title' => $label,
'#type' => 'weight',
'#default_value' => $taxon_tabs_weights[$key],
'#delta' => $tab_weight_delta
);
}
$taxon_tabs_labels = get_array_variable_merged(CDM_TAXONPAGE_TAB_LABELS, CDM_TAXONPAGE_TAB_LABELS_DEFAULT);
$form['taxon_tabs'][CDM_TAXONPAGE_TAB_LABELS] = array(
'#title' => 'Section/Tab label override',
'#type' => 'fieldset',
'#collapsible' => false,
'#tree' => true,
'#description' => 'Setting a label for a section/tab will override the default label.
Please enter the label text in the default language of the portal.'
);
foreach (get_taxon_tabs_list() as $label) {
$key = strtolower($label); // turn in to string, since we need to use strings as keys
$form['taxon_tabs'][CDM_TAXONPAGE_TAB_LABELS][$key] = array(
'#title' => $label,
'#type' => 'textfield',
'#default_value' => $taxon_tabs_labels[$key]
);
}
$form['taxon_tabs']['cdm_dataportal_default_tab'] = array(
'#type' => 'select',
'#title' => t('Default tab to display') . ':',
'#default_value' => variable_get('cdm_dataportal_default_tab', 0),
'#options' => unserialize(CDM_DATAPORTAL_DEFAULT_TAXON_TAB),
'#description' => t('
Select the default tab to display when visiting a taxon page. Only available if Tabbed Taxon Page is enable.
Note: After performing a search and clicking in any synonym, the taxon tab to be rendered will be the synonymy of the accepted taxon and not the above selected tab.'), ); /* ====== TAXON_PROFILE ====== */ $form['taxon_profile'] = array( '#type' => 'fieldset', '#title' => t('Taxon profile (tab)'), '#description' => t('This section covers the settings related to the taxon profile tab, also known as the "General" tab.
'), '#collapsible' => TRUE, '#collapsed' => TRUE, ); // ---- PROFILE PICTURE ----// $form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE] = array( '#type' => 'fieldset', '#tree' => TRUE, '#title' => t('Taxon profile picture'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#description' => t('This sections allows configuring the display of the so called taxon profile image which is displayed in the taxon profile tab.'), ); //FIXME migrate variables: // cdm_dataportal_show_default_image ---> CDM_TAXON_PROFILE_IMAGE['show'] // FIXME // enable file module in profile and in update,(a.kohlbecker, 4.9.2014: is this still an open issue?) $taxon_profile_image_settings = variable_get(CDM_TAXON_PROFILE_IMAGE, unserialize(CDM_TAXON_PROFILE_IMAGE_DEFAULT)); /* * 'show' => 1, * 'maxextend' => 184, * 'media_uri_query' => '' * 'custom_placeholder_image_on' => 1, * 'custom_placeholder_image_fid' => '' */ $form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['show'] = array( '#type' => 'checkbox', '#title' => t('Enable profile picture'), '#description' => t('Show the profile picture.'), '#default_value' => $taxon_profile_image_settings['show'], ); $form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['maxextend'] = array( '#type' => 'textfield', '#tree' => TRUE, '#title' => t('Profile picture maximum extend'), '#default_value' => $taxon_profile_image_settings['maxextend'], '#field_suffix' => 'px', '#maxlength' => 4, '#size' => 4, '#description' => t('The maximum extend in either dimension, width or height, of the profile picture in pixels.') ); $form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['media_uri_query'] = array( '#type' => 'textfield', '#tree' => TRUE, '#title' => t('Additional URI query parameter'), '#default_value' => $taxon_profile_image_settings['media_uri_query'], '#maxlength' => 1024, '#size' => 60, '#description' => t('Additional query parameters to be used when requesting for the profile image. E.g.:width=400&height=300&quality=95&format=jpeg
.
The query parameters will be appended to the uri of the media representation part
as stored in the cdm. The query parameter string must not start with a \'&\' or \'?\'')
);
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['custom_placeholder_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Show the placeholder image'),
'#description' => t("A placeholder image will be shown if no taxon profile picture is available."),
'#default_value' => $taxon_profile_image_settings['custom_placeholder_enabled']
);
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['custom_placeholder_image_on'] = array(
'#type' => 'checkbox',
'#title' => t('Use a custom placeholder image'),
'#description' => t("This image is shown as replacement if no image of the taxon is available."),
'#default_value' => $taxon_profile_image_settings['custom_placeholder_image_on']
);
if($taxon_profile_image_settings['custom_placeholder_image_on'] == 1){
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['custom_placeholder_image_fid'] = array(
'#type' => 'managed_file',
'#title' => t('Custom placeholder image file'),
'#progress_indicator' => 'bar',
'#default_value' => $taxon_profile_image_settings['custom_placeholder_image_fid'],
// '#name' => 'custom_placeholder_image',
'#upload_location' => 'public://' . CDM_TAXON_PROFILE_IMAGE .'/'
);
if($taxon_profile_image_settings['custom_placeholder_image_fid']){
$profile_image_file = file_load($taxon_profile_image_settings['custom_placeholder_image_fid']);
$url = file_create_url($profile_image_file->uri);
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['preview'] = array(
'#type' => 'item',
'#markup' => '',
);
}
} else {
$form['taxon_profile'][CDM_TAXON_PROFILE_IMAGE]['custom_placeholder_image_fid'] = array(
'#type' => 'hidden',
'#default_value' => $taxon_profile_image_settings['custom_placeholder_image_fid']
);
}
$options = cdm_vocabulary_as_option(UUID_RANK, null, true);
array_unshift($options, '-- DISABLED --');
$form['taxon_profile']['picture']['image_hide_rank'] = array(
'#type' => 'select',
'#title' => t('Hide profile picture for higher ranks') . ':',
'#default_value' => variable_get('image_hide_rank', '0'),
'#options' => $options,
'#description' => t('The taxon profile picture will not be shown for taxa with rank higher that the selected.'),
);
// -- MEDIA THUMBNAILS -- //
$form_name = CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME;
$form_title = 'Taxon Profile Images';
$form_description = 'The different sections in the taxon profile can have images associated with them. These images are displayed in a gallery of thumbnails wich can be configuered here:
'; $form['taxon_profile'][] = cdm_dataportal_create_gallery_settings_form($form_name, $form_title, $collapsed, $form_description); // ---- FEATURE TREE BLOCKS ---- // $form['taxon_profile']['feature_blocks'] = array( '#type' => 'fieldset', '#title' => t('Feature Blocks'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#description' => t("This section covers settings related to the taxon's Feature Tree. The feature tree are the taxon's features such as description, distribution, common names"), ); $featureTrees = cdm_get_featureTrees_as_options(TRUE); $profile_feature_tree = get_profile_feature_tree(); $profile_feature_tree_uuid = $profile_feature_tree->uuid; if(!isset($featureTrees['options'][$profile_feature_tree_uuid])) { $profile_feature_tree_uuid = UUID_DEFAULT_FEATURETREE; } $form['taxon_profile']['feature_blocks'][CDM_PROFILE_FEATURETREE_UUID] = array( '#type' => 'radios', '#title' => t('Taxon profile feature tree') . ':', '#default_value' => $profile_feature_tree_uuid, '#options' => $featureTrees['options'], '#pre_render' => array('form_pre_render_conditional_form_element', 'radios_prepare_options_suffix'), '#options_suffixes' => $featureTrees['treeRepresentations'], '#description' => t('The Feature Tree selected here define the feature blocks which are visible in the taxon profile page.' ), ); // ---- FEATURE TREE BLOCKS > LAYOUT PER FEATURE BLOCK ---- // $profile_feature_tree = get_profile_feature_tree(); if (isset($profile_feature_tree->root->childNodes)) { $form_feature_block_layout = array( '#type' => 'fieldset', '#tree' => true, '#title' => t('Taxon profile feature block settings'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#description' => 'This section let\'s you define how each of the feature blocks is displayed. A sub form is for each of the features of currently selected feature tree allows to configre each feature block individually. The subforms have the following settings in common:TextData
elements on top of the map. Otherwise all TextData
distribution elements will be listed below the other area elements.
This option is useful if you need to have descriptive texts for each
distribution map.'),
);
$form['taxon_profile'][DISTRIBUTION_STATUS_COLORS] = array(
'#type' => 'textarea',
'#title' => t('Custom status colors'),
'#element_validate' => array('form_element_validate_json'),
'#default_value' => variable_get(DISTRIBUTION_STATUS_COLORS, ''),
'#description' => t('EXPERIMENTAL!{"n":"#ff0000","p":"#00ff00"}
.
reference list of the idInVocabulary values of absence and presence terms:
Presence Term p present pd present: doubtfully present n native nq native: presence questionable nd native: doubtfully native c cultivated i introduced iq introduced: presence questionable id introduced: doubtfully introduced (perhaps cultivated only) ip introduced: uncertain degree of naturalisation ia introduced: adventitious (casual) in introduced: naturalized ic introduced: cultivated e endemic for the relevant area na naturalised iv invasive AbsenceTerm a absent f reported in error nf native: reported in error if introduced: reported in error cf cultivated: reported in error ne native: formerly native ie introduced: formerly introduced'), ); /* ====== SYNONYMY ====== */ $form['taxon_synonymy'] = array( '#type' => 'fieldset', '#title' => t('Taxon synonymy (tab)'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#description' => t('This section covers the settings related to the taxon synonymy tab.'), ); $form['taxon_synonymy']['cdm_dataportal_nomref_in_title'] = array( '#type' => 'checkbox', '#title' => t('Accepted taxon on top of the synonymy'), '#default_value' => variable_get('cdm_dataportal_nomref_in_title', CDM_DATAPORTAL_NOMREF_IN_TITLE), '#description' => t('If checked, the first homotypic taxon is a repetition of the accepted taxon most likely with the full nomenclatural reference, depending on the ' . l('Name render templates', 'admin/config/cdm_dataportal/settings/layout') . '.'), ); $form['taxon_synonymy'][CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE] = array( '#type' => 'checkbox', '#title' => t('Secundum referenence as separate line above the accepted taxon.'), '#default_value' => variable_get(CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE, 0), '#description' => t('You may want to remove the
"secReferencePart": true,
entry from "accepted_taxon.taxon_page_synonymy"{
the in the '
. l('Name render templates', 'admin/config/cdm_dataportal/settings/layout')
. ' (Only applicable when the "Show accepted taxon on top of the synonymy" option above is enabled.)'),
'#disabled' => !variable_get('cdm_dataportal_nomref_in_title', CDM_DATAPORTAL_NOMREF_IN_TITLE)
);
$form['taxon_synonymy'][CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL] = array(
'#type' => 'textfield',
'#description' => 'Label for the secundum referenence.',
'#default_value' => variable_get(CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL, CDM_SYNONYMY_ACCEPTED_TAXON_SEC_SEPARATE_LABEL_DEFAULT),
'#disabled' => !variable_get('cdm_dataportal_nomref_in_title', 0)
);
$form['taxon_synonymy']['cdm_dataportal_display_is_accepted_for'] = array(
'#type' => 'checkbox',
'#title' => t('Display is accepted for ... on taxon pages when
coming from a synonym link.'),
'#default_value' => variable_get('cdm_dataportal_display_is_accepted_for', CDM_DATAPORTAL_DISPLAY_IS_ACCEPTED_FOR),
'#description' => t('Check this if after doing a search and clicking on a
synonym you want to see the "accept of" text for the accepted synonym.'),
);
/* === currently unused ===
$nameRelationshipTypeOptions = cdm_vocabulary_as_option(UUID_NAME_RELATIONSHIP_TYPE);
$form['taxon_synonymy']['name_relationships']['name_relationships_to_show'] = array(
'#type' => 'checkboxes',
'#title' => t('Display name relationships') . ':',
'#default_value' => variable_get('name_relationships_to_show', 0),
'#options' => $nameRelationshipTypeOptions,
'#description' => t('Select the name relationships you want to show for the
accepted taxa.'),
);
*/
$form['taxon_synonymy']['taxon_relations'] = array(
'#type' => 'fieldset',
'#title' => t('Taxon relationships'),
'#collapsible' => FALSE,
'#collapsed' => FALSE
);
$form['taxon_synonymy']['taxon_relations'][CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS] = array(
'#type' => 'checkbox',
'#title' => t('Show taxon relations ships of accepted taxon'),
'#default_value' => variable_get(CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT),
'#description' => t('If this option is enabled the synonymy will show the
below selected taxon relationships of accepted taxa.'),
);
$taxon_relationship_type_options = cdm_vocabulary_as_option(UUID_TAXON_RELATIONSHIP_TYPE, '_cdm_relationship_type_term_label_callback');
$taxon_relationship_type_defaults = variable_get(CDM_TAXON_RELATIONSHIP_TYPES, unserialize(CDM_TAXON_RELATIONSHIP_TYPES_DEFAULT));
$form['taxon_synonymy']['taxon_relations'][CDM_TAXON_RELATIONSHIP_TYPES] = array(
'#type' => 'checkboxes',
'#title' => t('Taxon relationship types') . ':',
'#description' => t('Only taxon relationships of the selected type will be
displayed'),
'#options' => $taxon_relationship_type_options,
'#default_value' => $taxon_relationship_type_defaults,
'#disabled' => !variable_get(CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS, CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT),
);
$form['taxon_synonymy']['name_relations'] = array(
'#type' => 'fieldset',
'#title' => t('Name relationships'),
'#collapsible' => FALSE,
'#collapsed' => FALSE
);
$name_relationship_type_options = cdm_vocabulary_as_option(UUID_NAME_RELATIONSHIP_TYPE, '_cdm_relationship_type_term_label_callback');
$form['taxon_synonymy']['name_relations'][CDM_NAME_RELATIONSHIP_TYPES] = array(
'#type' => 'checkboxes',
'#title' => t('Name relationship types') . ':',
'#description' => t('Only name relationships of the selected type will be
displayed'),
'#options' => $name_relationship_type_options,
'#default_value' => variable_get(CDM_NAME_RELATIONSHIP_TYPES, unserialize(CDM_NAME_RELATIONSHIP_TYPES_DEFAULT)),
);
// ====== SPECIMENS ====== //
$form['taxon_specimens'] = array(
'#type' => 'fieldset',
'#title' => t('Taxon specimens (tab)'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('This section covers the settings related to the taxon
specimens tab.'),
);
$form['taxon_specimens'][SPECIMEN_MAP_VISIBILITY] = _cdm_map_visibility_setting('specimen');
$form['taxon_specimens']['cdm_dataportal_compressed_specimen_derivate_table'] = array(
'#type' => 'checkbox',
'#title' => t('Show specimen derivatives in a compressed table'),
'#default_value' => variable_get('cdm_dataportal_compressed_specimen_derivate_table', CDM_DATAPORTAL_COMPRESSED_SPECIMEN_DERIVATE_TABLE),
'#description' => t('If checked, the specimen will be listed in a table. Every row represents
a collection and it can be expanded to get an overview of the specimens and their derivates.'),
);
$form['taxon_specimens']['cdm_dataportal_compressed_specimen_derivate_table_page_size'] = array(
'#type' => 'textfield',
'#title' => t('Number of records per page') . ':',
'#default_value' => variable_get('cdm_dataportal_compressed_specimen_derivate_table_page_size', CDM_DATAPORTAL_COMPRESSED_SPECIMEN_DERIVATE_TABLE_PAGE_SIZE),
);
$form['taxon_specimens']['cdm_dataportal_specimen_derivate_tree'] = array(
'#type' => 'checkbox',
'#title' => t('Show specimen derivatives in a tree view'),
'#default_value' => variable_get('cdm_dataportal_specimen_derivate_tree', CDM_DATAPORTAL_SPECIMEN_DERIVATE_TREE),
'#description' => t('If checked, the specimen will be listed in a tree view.'),
);
$featureTrees = cdm_get_featureTrees_as_options(TRUE);
$profile_feature_tree_uuid = variable_get(CDM_OCCURRENCE_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE);
if(!isset($featureTrees['options'][$profile_feature_tree_uuid])) {
$profile_feature_tree_uuid = UUID_DEFAULT_FEATURETREE;
}
$form['taxon_specimens']['feature_trees'][CDM_OCCURRENCE_FEATURETREE_UUID] = array(
'#type' => 'radios',
'#title' => t('Specimen description feature tree') . ':',
'#default_value' => $profile_feature_tree_uuid,
'#options' => $featureTrees['options'],
'#pre_render' => array('form_pre_render_conditional_form_element', 'radios_prepare_options_suffix'),
'#options_suffixes' => $featureTrees['treeRepresentations'],
'#description' => t('Select the feature tree to be used for displaying specimen descriptions. Click "Show Details" to see the Feature Tree elements.'
),
);
$form_name = CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME;
$form_title = t('Specimen media');
$form_description = t('Specimens may have media which is displayed at the
Specimen tab/section as a gallery. It is possible to configure the
thumbnails gallery here, however for configuring how a single media should
be displayed please go to !url.',
array(
'!url' => l(t('Layout -> Media'), 'admin/config/cdm_dataportal/settings/layout/media'),
));
$form['taxon_specimens'][] = cdm_dataportal_create_gallery_settings_form($form_name, $form_title, FALSE, $form_description);
// --- MEDIA GALLERY ---- //
$form_name = CDM_DATAPORTAL_TAXON_MEDIA_GALLERY_NAME_TAB;
$form_title = 'Media gallery (tab)';
$form_description = 'This section covers the settings related to the taxon images tab. Taxa may have media (usually images) and they are displayed as thumbnails. It is possible to configure the thumbnails gallery here, however for configuring how a single media should be displayed please go to Layout -> Media
Note: These settings are only taken into account when the standard gallery viewer is selected at Layout -> Media.
'; $form['taxon_media'][] = cdm_dataportal_create_gallery_settings_form($form_name, $form_title, TRUE, $form_description); // Comment @WA: D7 form api does not support reset buttons, // so to mimic the D5 reset button we add one like this. $form['actions']['reset'] = array( '#markup' => '', '#weight' => 1000, ); return system_settings_form($form); } /** * Creates a form element for the constants DISTRIBUTION_MAP_VISIBILITY, SPECIMEN_MAP_VISIBILITY. * * @param $map_id * @param $form * @return mixed */ function _cdm_map_visibility_setting($map_id) { return array( '#type' => 'select', '#title' => t(ucfirst($map_id) . ' map visibility'), '#default_value' => variable_get(constant(strtoupper($map_id) . '_MAP_VISIBILITY'), constant(strtoupper($map_id) . '_MAP_VISIBILITY_DEFAULT')), '#options' => array('always' => 'always', 'automatic' => 'automatic', 'never' => 'never'), '#description' => "The visibility of the map can managed automatically depending on whether there is data to show or not. The map also can forced to show up always or never." ); } /** * @todo document this function. */ function cdm_settings_layout_search() { $form = array(); $form['#submit'][] = 'cdm_settings_layout_search_submit'; $form['search_settings'] = array( '#type' => 'fieldset', '#title' => t('Taxa Search'), '#collapsible' => FALSE, '#collapsed' => FALSE, '#description' => t('The data portal allows the users to perform searchs.
To perform searchs the block CDM Taxon Search should be enabled and visible for users where they can write the text to be searched. You can find Drupal block configuration site at Administer->Site building->Blocks
'), ); $form['search_settings'][SIMPLE_SEARCH_IGNORE_CLASSIFICATION] = array( '#type' => 'checkbox', '#title' => t('Ignore the chosen classification in simple search'), '#default_value' => variable_get(SIMPLE_SEARCH_IGNORE_CLASSIFICATION, 0), '#description' => t('The simple search, which can be executed via the search block, will by default search on the classification selected in the classification browser selector. Set the tick if you want your portal to search on all classifications.'), ); $form['search_settings'][SIMPLE_SEARCH_USE_LUCENE_BACKEND] = array( '#type' => 'checkbox', '#title' => t('Run simple search with free-text search backend.'), '#default_value' => variable_get(SIMPLE_SEARCH_USE_LUCENE_BACKEND, 0), '#description' => t('The simple search uses by default another search backend as the advances search. By checking this option the simple search can be configured to also use the free-text search backend.'), ); $form['search_settings'][SIMPLE_SEARCH_AUTO_SUGGEST] = array( '#type' => 'checkbox', '#title' => t('(EXPERIMENTAL) Enable auto-suggest for taxon search'), '#default_value' => variable_get(SIMPLE_SEARCH_AUTO_SUGGEST, 0), '#description' => t('If enabled, the taxon search field will suggest taxon names while typing in a search query. This function works on indexed taxon names. If you experience any delay maybe you have to reindex (see above).'), ); $form['search_settings']['cdm_dataportal_search_items_on_page'] = array( '#type' => 'textfield', '#title' => t('Results per page') . ':', '#default_value' => variable_get('cdm_dataportal_search_items_on_page', CDM_DATAPORTAL_SEARCH_ITEMS_ON_PAGE), '#description' => t('Number of results to display per page.'), ); $form['search_settings'][SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX] = array( '#type' => 'checkbox', '#title' => t('Show the') . ' ' . t('Display image thumbnails') . '' . t('button') . ':', '#default_value' => variable_get(SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX, SEARCH_RESULTS_SHOW_THUMBNAIL_CHECKBOX_DEFAULT), '#description' => t('The search results page will offer a button to toggle the display of image thumbnails.'), ); $search_mode_default = get_array_variable_merged(CDM_SEARCH_TAXA_MODE, CDM_SEARCH_TAXA_MODE_DEFAULT); $form['search_settings']['cdm_search_taxa_mode'] = array( '#type' => 'checkboxes', '#title' => 'Search mode', '#description' => 'The taxon search can operate in different modes in order to find only taxa, synonyms, taxa by its common name and even taxa which have been used as misappied names. The settings made here will affect the default for the advance search form and the behaviour of the simple search form which always will behave according to the defaults set here.', '#options' => drupal_map_assoc(array_keys(unserialize(CDM_SEARCH_TAXA_MODE_DEFAULT))), '#default_value' => $search_mode_default ); $form['search_settings'][CDM_SEARCH_AREA_FILTER_PRESET] = array( '#type' => 'textarea', '#title' => t('area_filter_preset') . ':', '#default_value' => variable_get(CDM_SEARCH_AREA_FILTER_PRESET, ''), // '05b0dd06-30f8-477d-bf4c-30d9def56320' => Caucasia (Ab + Ar + Gg + Rf(CS)) (Cc) '#description' => t('Area uuids, comma separated, no whitespace. EXPERIMENTAL!!!!'), ); // --- SEARCH TAXA GALLERY ---- // $items = variable_get('cdm_dataportal_search_items_on_page', CDM_DATAPORTAL_SEARCH_ITEMS_ON_PAGE); $collapsed = FALSE; $form_name = CDM_DATAPORTAL_SEARCH_GALLERY_NAME; $form_title = 'Taxa Search thumbnails'; $form_description = 'Search results may show thumbnails. '; $form[] = cdm_dataportal_create_gallery_settings_form($form_name, $form_title, $collapsed, $form_description); // Comment @WA: D7 form api does not support reset buttons, // so to mimic the D5 reset button we add one like this. $form['actions']['reset'] = array( '#markup' => '', '#weight' => 1000, ); return system_settings_form($form); } /** * @todo document this function. */ function cdm_settings_layout_media() { $form = array(); $form['media_settings'] = array( '#type' => 'fieldset', '#title' => t('Media settings'), '#collapsible' => FALSE, '#collapsed' => FALSE, '#description' => 'This section covers layout settings for media pages.' . 'Further media related settings may be found under the taxon layout settings and on the general settings.', ); $form['media_settings']['image_gallery_viewer'] = array( '#type' => 'select', '#title' => t('Image viewer') . ':', '#default_value' => variable_get('image_gallery_viewer', 'default'), '#options' => array( 'default' => t('Standard image viewer'), 'fsi' => t('FSI viewer (requires FSI server!)'), ), ); // --- STANDARD_IMAGE_VIEWER ---- // if(variable_get('image_gallery_viewer', 'default') == 'default') { $form['media_settings'][CDM_STANDARD_IMAGE_VIEWER] = array( '#type' => 'fieldset', '#tree' => true, '#title' => t('Standard image viewer settings'), '#collapsible' => FALSE, '#collapsed' => FALSE, ); $cdm_standard_image_viewer_settings = get_array_variable_merged(CDM_STANDARD_IMAGE_VIEWER, CDM_STANDARD_IMAGE_VIEWER_DEFAULT); $form['media_settings'][CDM_STANDARD_IMAGE_VIEWER]['media_representation_details_enabled'] = array ( '#type' => 'checkbox', '#title' => 'Show media representations', '#default_value' => $cdm_standard_image_viewer_settings['media_representation_details_enabled'] ); } // @WA: D7 form api does not support reset buttons, // so to mimic the D5 reset button we add one like this. $form['actions']['reset'] = array( '#markup' => '', '#weight' => 1000, ); return system_settings_form($form); } /** * GEOSERVICE and Map settings. */ function cdm_settings_geo($form, &$form_state) { $current_geoserver_settings = get_edit_map_service_settings(); $map_distribution = get_array_variable_merged(CDM_MAP_DISTRIBUTION, CDM_MAP_DISTRIBUTION_DEFAULT); $form = array(); $dummy_distribution_query = NULL; if($map_distribution['map_type'] != 1){ // we need to apply a dummy query since the map service requires for image maps // at least as and ad to be defined $dummy_distribution_query = "as=a:339966&ad=tdwg1:a:1,2,3,4,5,6,7,8,9"; } $form['map_preview'] = array( '#type' => 'fieldset', '#tree' => FALSE, '#title' => t('Map preview'), '#collapsible' => FALSE, '#description' => 'The preview of the map' . ($dummy_distribution_query != null ? ' may not be accurate in case of image maps, please check the map display in the taxon pages.': '.aspect ratio = w / hFor a landscape oriented map with an aspect ratio of 2:1 use 2 as value, for a square map use 1.', ); $form[CDM_MAP_DISTRIBUTION]['bbox'] = array( '#type' => 'textfield', '#title' => 'Bounding box', '#default_value' => $map_distribution['bbox'], '#description' => t('The bounding box (left, bottom, right, top) in degree defines the area to be initially displayed in maps. Use "-180,-90,180,90" for the whole world. Leave empty to let the map automatically zoom to the bounds enclosing the shown data. TIP: You can use the map preview above to choose the map extent bbox in degree from the map. (Maybe you need to change the map base layer to OpeLayers.) Hold down Strg and drag with your mouse to select a bbox to zoom to. The bbox of the visible area of the map is always displayed below the map from where you can copy the bbox string.'), ); $form[CDM_MAP_DISTRIBUTION]['maxZoom'] = array( '#type' => 'select', '#title' => 'Max zoom level', '#default_value' => $map_distribution['maxZoom'], '#options' => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) ); $form[CDM_MAP_DISTRIBUTION]['show_labels'] = array( '#type' => 'checkbox', '#title' => 'Display area labels', '#default_value' => $map_distribution['show_labels'], '#description' => t('The map will show name labels of the areas'), ); $form[CDM_MAP_DISTRIBUTION]['caption'] = array( '#type' => 'textfield', '#title' => 'Map caption', '#default_value' => $map_distribution['caption'], '#description' => t('The caption will be shown below the map.'), ); $form[CDM_MAP_DISTRIBUTION]['distribution_opacity'] = array( '#type' => 'textfield', '#title' => 'Distribution layer opacity', '#default_value' => $map_distribution['distribution_opacity'], '#description' => t('Valid values range from 0.0 to 1.0. Value 1.0 means the distributions (the countries or regions) will fully visible, while a value near to 0.0 will be not much visible.'), ); // --- Plain Image Settings --- // $form[CDM_MAP_DISTRIBUTION]['image_map'] = array( '#type' => 'fieldset', '#title' => 'Plain image map settings', '#tree' => TRUE, '#collapsible' => TRUE, '#collapsed' => $open_layers_is_enabled, '#description' => 'The settings in this section are still expertimental and can only be used with the EDIT map service version 1.1 or above.', ); $edit_mapserver_version = get_edit_map_service_version_number(); if ($edit_mapserver_version < 1.1) { $form[CDM_MAP_DISTRIBUTION]['image_map']['#description'] = ' ' . $form[CDM_MAP_DISTRIBUTION]['image_map']['#description']; } $form[CDM_MAP_DISTRIBUTION]['image_map']['width'] = array( '#type' => 'textfield', '#title' => 'Width', '#default_value' => $map_distribution['image_map']['width'], '#maxlength' => 4, '#size' => 4, '#description' => 'Width of the map. The height is calculated from the Aspect ratio set in the section above. ', ); $form[CDM_MAP_DISTRIBUTION]['image_map']['base_layer'] = array( '#type' => 'textfield', '#title' => 'Background layer', '#default_value' => $map_distribution['image_map']['base_layer'], '#description' => t('Background layer. For available layers inspect !url1 or !url2.', array( '!url1' => l('deegree-csw', 'http://edit.africamuseum.be:8080/deegree-csw/md_search.jsp'), '!url2' => l('geoserver layers', 'http://edit.africamuseum.be/geoserver/web/'), )), ); $form[CDM_MAP_DISTRIBUTION]['image_map']['bg_color'] = array( '#type' => 'textfield', '#title' => 'Background color', '#default_value' => $map_distribution['image_map']['bg_color'], ); $form[CDM_MAP_DISTRIBUTION]['image_map']['layer_style'] = array( '#type' => 'textfield', '#title' => 'Background layer style', // Only line color by now. '#default_value' => $map_distribution['image_map']['layer_style'], '#description' => 'Syntax: {Area fill color},{Area stroke color},{Area stroke width},{Area stroke dash style}', ); $form[CDM_MAP_DISTRIBUTION]['image_map']['projection'] = array( '#type' => 'textfield', '#title' => 'Projection', '#default_value' => drupal_array_get_nested_value($map_distribution, array('image_map', 'projection')), '#description' => 'Spatial Reference System (SRS) identifier ) optional ( Defines projections in WMS GetMap request. Using EPSG:4326 (WGS84 lat/long) is the default but can be changed on-the-fly to different UTM and much more zone specific. Examples: EPSG:4326, EPSG:900913, EPSG:3857, EPSG:7777777', ); // --- OpenLayers Settings --- // $form[CDM_MAP_DISTRIBUTION]['openlayers'] = array( '#type' => 'fieldset', '#title' => 'OpenLayers settings', '#tree' => TRUE, '#collapsible' => TRUE, '#collapsed' => !$open_layers_is_enabled, '#description' => '', ); $form[CDM_MAP_DISTRIBUTION]['openlayers']['display_outside_max_extent'] = array( '#type' => 'checkbox', '#title' => 'Display outside max extent', '#default_value' => $map_distribution['openlayers']['display_outside_max_extent'], '#description' => t('Allows the map to display parts of the layers which are outside the max extent if the aspect ratio of the map and of the baselayer are not equal.'), ); $form[CDM_MAP_DISTRIBUTION]['openlayers']['show_layer_switcher'] = array( '#type' => 'checkbox', '#title' => 'Show Layer Switcher', '#default_value' => $map_distribution['openlayers']['show_layer_switcher'], '#description' => 'The Layer Switcher control displays a table of contents for the map. This allows the user interface to switch between base layers and to show or hide overlays. By default the switcher is shown minimized on the right edge of the map, the user may expand it by clicking on the handle.', ); if (!$open_layers_is_enabled) { $form[CDM_MAP_DISTRIBUTION]['openlayers']['#description'] = ' ' . $form[CDM_MAP_DISTRIBUTION]['openlayers']['#description']; } // The default layer must always be enabled $preferred_layer = $map_distribution['openlayers']['base_layers']['PREFERRED']; $map_distribution['openlayers']['base_layers'][$preferred_layer] = $preferred_layer; $baselayer_options = array( /* NOTICE: must correspond to the layers defined in js/openlayers_,ap.js#getLayersByName() */ 'osgeo_vmap0' => "Metacarta Vmap0 (OSGeo server) - instable!", // EPSG:4326: EPSG:900913 'metacarta_vmap0' => "Metacarta Vmap0 (MetaCarta Labs server) - instable!", // EPSG:4326, EPSG:900913 'mapproxy_vmap0' => "Metacarta Vmap0 (OSGeo server) - via fast EDIT MapProxy", 'mapproxy_etopo1' => "ETOPO1 Global Relief Model - via fast EDIT MapProxy", 'edit-etopo1' => "ETOPO1 Global Relief Model", // all others EPSG:900913 'mapnik' => 'OpenStreetMap (mapnik)', 'stamen_terrain' => 'Stamen Terrain', 'open_topomap' => 'OpenTopoMap', // map quest is no longer free. it is required to sign up for a test plan. // 'mapquest_open' => "MapQuest", // 'mapquest_sat' => "MapQuest Sattelite", 'groadmap' => 'Google Roadmap', 'gsatellite' => 'Google Satellite', 'ghybrid' => 'Google Hybrid', 'gterrain' => 'Google Terrain', // 'veroad' => 'Virtual Earth Roads', // 'veaer' => 'Virtual Earth Aerial', // 'vehyb' => 'Virtual Earth Hybrid', // 'yahoo' => 'Yahoo Street', // 'yahoosat' => 'Yahoo Satellite', // 'yahoohyb' => 'Yahoo Hybrid', 'custom_wms_base_layer_1' => 'Custom WMS base layer (needs to be manually configured below!)', ); $form[CDM_MAP_DISTRIBUTION]['openlayers']['base_layers'] = array( '#type' => 'checkboxes_preferred', '#title' => 'Base Layers', '#options' => $baselayer_options, '#default_value' => $map_distribution['openlayers']['base_layers'], '#description' => 'Choose the baselayer layer you prefer to use as map background in the OpenLayers dynamic mapviewer.', ); $google_maps_api_key = null; if(isset($map_distribution['openlayers']['google_maps_api_key'])){ $google_maps_api_key = $map_distribution['openlayers']['google_maps_api_key']; } $form[CDM_MAP_DISTRIBUTION]['openlayers']['google_maps_api_key'] = array( '#type' => 'textfield', '#title' => 'Google Maps API Key', '#default_value' => $google_maps_api_key, '#description' => 'In order to use any of the Google map layers you need to provide your Google Maps API Key. ', ); $form[CDM_MAP_DISTRIBUTION]['openlayers']['custom_wms_base_layer'] = wms_layer_settings( $map_distribution['openlayers']['custom_wms_base_layer'], 'Custom WMS base layer', 'Here you an define a custom wms layer as additional base layer. You need to enable this layer in the base layers section above.', true // add projection settings ); $form[CDM_MAP_DISTRIBUTION]['openlayers']['wms_overlay_layer'] = wms_layer_settings( $map_distribution['openlayers']['wms_overlay_layer'], 'WMS overlay layer', 'Here you an define a wms layer which will overlay all other layers in the map viewer. You can actually combine multiple layers for this overlay. For details please refer to the wms query parameter
Layers
.'
);
$form[CDM_MAP_DISTRIBUTION]['openlayers']['wms_overlay_layer']['is_enabled'] = array(
'#type' => 'checkbox',
'#title' => 'Enable overlay layer',
'#weight' => -100,
'#default_value' => $map_distribution['openlayers']['wms_overlay_layer']['is_enabled'] === 1 ? 1 : 0
);
/*
* Map Legend
*/
$form[CDM_MAP_DISTRIBUTION]['legend'] = array(
'#type' => 'fieldset',
'#title' => 'Map legend',
'#tree' => TRUE,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => 'Configure the maps legend.',
);
$form[CDM_MAP_DISTRIBUTION]['legend']['show'] = array(
'#type' => 'checkbox',
'#title' => 'Display a map legend',
'#default_value' => $map_distribution['legend']['show'],
'#description' => 'Check this if you like a legend to be displayed with the maps.',
);
$form[CDM_MAP_DISTRIBUTION]['legend']['opacity'] = array(
'#type' => 'textfield',
'#title' => 'Legend opacity',
'#default_value' => $map_distribution['legend']['opacity'],
'#description' => 'Valid values range from 0.0 to 1.0. Value 1.0 means the legend will be fully visible, while a value near
to 0.0 will be not much visible.',
);
$form[CDM_MAP_DISTRIBUTION]['legend']['font_size'] = array(
'#type' => 'textfield',
'#title' => 'Font size',
'#default_value' => $map_distribution['legend']['font_size'],
'#description' => 'Font size in pixels.',
);
$fontStyles = array(
0 => "plane",
1 => "italic",
);
$form[CDM_MAP_DISTRIBUTION]['legend']['font_style'] = array(
'#type' => 'select',
'#title' => 'Available font styles',
'#default_value' => $map_distribution['legend']['font_style'],
'#options' => $fontStyles,
'#description' => 'Select a font style for the map legend.',
);
$form[CDM_MAP_DISTRIBUTION]['legend']['icon_width'] = array(
'#type' => 'textfield',
'#title' => 'Icon width',
'#default_value' => $map_distribution['legend']['icon_width'],
'#description' => 'Legend icon width in pixels.',
);
$form[CDM_MAP_DISTRIBUTION]['legend']['icon_height'] = array(
'#type' => 'textfield',
'#title' => 'Icon height',
'#default_value' => $map_distribution['legend']['icon_height'],
'#description' => 'Legend icon height in pixels.',
);
// @WA: D7 form api does not support reset buttons,
// so to mimic the D5 reset button we add one like this.
$form['actions']['reset'] = array(
'#markup' => '',
'#weight' => 1000,
);
return system_settings_form($form);
}
/**
* @param $default_settings
* @param $title
* @param $description
* @param bool $add_projection_settings
* @return array
*/
function wms_layer_settings($default_settings, $title, $description, $add_projection_settings = false)
{
$form_elements = array(
'#type' => 'fieldset',
'#title' => $title,
'#tree' => TRUE,
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'#description' => $description,
);
$form_elements['name'] = array(
'#type' => 'textfield',
'#title' => 'Layer name',
'#default_value' => $default_settings['name'],
'#description' => 'A arbitrary name for the layer.',
);
$form_elements['url'] = array(
'#type' => 'textfield',
'#title' => 'WMS url',
'#default_value' => $default_settings['url'],
'#description' => 'Base url for the WMS (e.g. http://edit.africamuseum.be/geoserver/topp/wms, http://wms.jpl.nasa.gov/wms.cgi)'
);
$form_elements['untiled'] = array(
'#type' => 'checkbox',
'#title' => 'Untiled',
'#default_value' => $default_settings['untiled'],
'#description' => 'If the layer contains labels you may want to check this option to avoid label duplication or erratic invisibility.'
);
$form_elements['params'] = array(
'#type' => 'textarea',
'#title' => 'WMS parameters',
'#element_validate' => array('form_element_validate_json'),
'#default_value' => $default_settings['params'],
'#description' => 'An javasript object with key/value pairs representing the GetMap query string parameters and parameter values ('
.l('Geoserver WMS parameter reference', 'http://docs.geoserver.org/stable/en/user/services/wms/reference.html#getmap' )
. '), entered in valid JSON. For example:
{ "Layers": "topp:em_tiny_jan2003", "Format": "image/png", "BGCOLOR": "0xe0faff" }You can supply and web accessible SLD file by using the
sld
or +a Semimajor radius of the ellipsoid axis +alpha ? Used with Oblique Mercator and possibly a few others +axis Axis orientation (new in 4.8.0) +b Semiminor radius of the ellipsoid axis +datum Datum name (see `proj -ld`) +ellps Ellipsoid name (see `proj -le`) +k Scaling factor (old name) +k_0 Scaling factor (new name) +lat_0 Latitude of origin +lat_1 Latitude of first standard parallel +lat_2 Latitude of second standard parallel +lat_ts Latitude of true scale +lon_0 Central meridian +lonc ? Longitude used with Oblique Mercator and possibly a few others +lon_wrap Center longitude to use for wrapping (see below) +nadgrids Filename of NTv2 grid file to use for datum transforms (see below) +no_defs Don\'t use the /usr/share/proj/proj_def.dat defaults file +over Allow longitude output outside -180 to 180 range, disables wrapping (see below) +pm Alternate prime meridian (typically a city name, see below) +proj Projection name (see `proj -l`) +south Denotes southern hemisphere UTM zone +to_meter Multiplier to convert map units to 1.0m +towgs84 3 or 7 term datum transform parameters (see below) +units meters, US survey feet, etc. +vto_meter vertical conversion to meters. +vunits vertical units. +x_0 False easting +y_0 False northing +zone UTM zoneFor the full reference please refer to http://proj4.org/parameters.html.' ); $form_elements['max_extent'] = array( '#type' => 'textfield', '#title' => 'Maximum extent', '#default_value' => $default_settings['max_extent'], '#description' => 'The maximum extent of the map as bounding box (left, bottom, right, top) in the units of the map.' ); $form_elements['units'] = array( '#type' => 'textfield', '#title' => 'Units', '#default_value' => $default_settings['units'], '#description' => 'The layer map units. Defaults to null. Possible values are ‘degrees’ (or ‘dd’), ‘m’, ‘ft’, ‘km’, ‘mi’, ‘inches’. Normally taken from the projection. Only required if both map and layers do not define a projection, or if they define a projection which does not define units.' ); } return $form_elements; } /** * @todo document this function. */ function cdm_settings_cache() { $form = array(); $form['cache_settings'] = array( '#type' => 'fieldset', '#title' => t('Cache Settings'), '#collapsible' => FALSE, '#collapsed' => FALSE, '#description' => t('
When caching is enabled all single taxon sites are stored in an internal drupal cache doing the portal response of taxa pages faster. This is possible because the sites are loaded from the cache and are not created from scratch.
'), ); $form['cache_settings']['cdm_webservice_cache'] = array( '#type' => 'checkbox', '#title' => t('Enable caching'), '#options' => cdm_help_general_cache(), '#default_value' => variable_get('cdm_webservice_cache', 1), '#description' => t('Enable drupal to load taxa pages from the cache.
Note: If taxa are modified by the editor or any other application the changes will be not visible till the cache is erased. Therefore developers should deactived this feature when they are working on the CDM Dataportal Module.
'), ); $form['cache_settings']['cdm_run_cache'] = array( '#markup' => cdm_view_cache_site(), ); // @WA: D7 form api does not support reset buttons, // so to mimic the D5 reset button we add one like this. $form['actions']['reset'] = array( '#markup' => '', '#weight' => 1000, ); return system_settings_form($form); } /** * Walk and cache all taxon pages. */ function cdm_view_cache_site() { $out = ''; drupal_add_js(drupal_get_path('module', 'cdm_dataportal') . '/js/cache_all_taxa.js'); $request_params = array(); $request_params['class'] = "Taxon"; $cdm_ws_page_taxa_url = cdm_compose_url(CDM_WS_TAXON . ".json", NULL, queryString($request_params)); $cdm_ws_page_taxa_url = uri_uriByProxy($cdm_ws_page_taxa_url); $cdm_ws_page_taxa_url = rtrim($cdm_ws_page_taxa_url, '/'); $out .= t('Cache all taxon pages
'); $out .= 'When you launch the cache process the cache is filled and ready to be enabled.
Remember that when you load the taxa from the cache last changes on taxa will be not visible till you erase
the cache and fill it again.
Before running the cache bot you have to empty the cache manually.
'; $out .= '' . t('Enabled') . ' | ' . t('Default') . ' | |
---|---|---|
' . t('@row-label', array('@row-label' => $element['#options'][$key])) . ' | '; $element[$key]['#suffix'] = ' | '; unset($element[$key]['#title']); $weight += 2; } $weight = 0; // add a radio button to each of the checkboxes, the // check boxes have already been created at the beginning // of this function if (count($element['#options']) > 0) { foreach ($element['#options'] as $key => $choice) { if (!isset($element[$key . '_preferred'])) { $element[$key . '_preferred'] = array( '#type' => 'radio', '#name' => $element_name, '#return_value' => check_plain($key), '#default_value' => empty($element['#default_value_2']) ? NULL : $element['#default_value_2'], '#attributes' => $element['#attributes'], '#parents' => $element['#parents'], // '#spawned' => TRUE, '#weight' => $weight + 1, '#prefix' => '', // add a prefix to start a new table cell '#suffix' => ' |