Project

General

Profile

« Previous | Next » 

Revision 54e498e3

Added by Andreas Kohlbecker over 11 years ago

fixing #2568 (CICHORIEAE: Multiple Citation enties should be shown in separate lines)

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
1103 1103
  $secref_cache = array();
1104 1104
}
1105 1105

  
1106
/**
1107
 * Validates if the given string is a uuid.
1108
 *
1109
 * @param unknown_type $str
1110
 */
1106 1111
function is_uuid($str){
1107 1112
  return is_string($str) && strlen($str) == 36 && strpos($str, '-');
1108 1113
}
1109 1114

  
1115
/**
1116
 * Checks if the given $object is a valid cdm entity. An object is consirered
1117
 * cdm entity if it has a string field $object->class with at least 3 characters and
1118
 * if it has a valid uuid in $object->uuid.
1119
 *
1120
 * @author a.kohlbecker
1121
 * @param unknown_type $object
1122
 */
1123
function is_cdm_entity($object){
1124
  return is_string($object->class) && strlen($object->class) > 2 && is_string($object->uuid) && is_uuid($object->uuid);
1125
}
1126

  
1110 1127
function _cdm_api_secref_cache_add($secUuidsStr){
1111 1128
  global $secref_cache;
1112 1129
  $ref = cdm_ws_get(CDM_WS_REFERENCE, $secUuidsStr);
......
1121 1138
  $secref_cache[$ref->uuid] = $ref;
1122 1139
}
1123 1140

  
1141
/**
1142
 * Checks if the given $uri starts with the cdm webservice url stored in the
1143
 * Drupal variable 'cdm_webservice_url'. The 'cdm_webservice_url' can be set in the
1144
 * admins section of the portal.
1145
 *
1146
 * @param $uri the URI to test
1147
 */
1124 1148
function _is_cdm_ws_uri($uri){
1125 1149
  return str_beginsWith($uri, variable_get('cdm_webservice_url', '#EMPTY#'));
1126 1150
}
modules/cdm_dataportal/cdm_dataportal.module
1228 1228
  return $result->Integer;
1229 1229
}
1230 1230

  
1231
/**
1232
 * Composes an HTML element class attribute value composed of
1233
 * the shortname of the cdm class and the uuid of the entity.
1234
 * This class attribute should be used whereever an cdm-entity is rendered.
1235
 *
1236
 * These according class selectors in css must be escaped, eg:
1237
 *    .cdm\:TextData
1238
 *
1239
 * @param $cdmEntity
1240
 */
1241
function html_class_atttibute_ref($cdmEntity){
1242

  
1243
  if(is_cdm_entity($cdmEntity)) {
1244
    return "cdm:".$cdmEntity->class." uuid:".$cdmEntity->uuid;
1245
  }
1246
}
1247

  
1231 1248
function theme_cdm_uri_to_synonym($synonymUuid, $acceptedUuid, $pagePart = null){
1232 1249
  $acceptedPath = path_to_taxon($acceptedUuid, true);
1233 1250
  return url($acceptedPath.($pagePart ? '/'.$pagePart : ''), 'highlite='.$synonymUuid.'&acceptedFor='.$synonymUuid, $synonymUuid);
modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
105 105
      if($node->feature->uuid != UUID_IMAGE) {
106 106

  
107 107
        $block->delta = generalizeString($featureRepresentation);
108
        $block->subject = '<span class="feature.uuid:'.$node->feature->uuid.'">' . theme('cdm_feature_name', $featureRepresentation) . '</span>';
108
        $block->subject = '<span class="'. html_class_atttibute_ref($node->feature) . '">' . theme('cdm_feature_name', $featureRepresentation) . '</span>';
109 109
        $block->module = "cdm_dataportal-feature";
110 110
        $block->content = '';
111 111

  
themes/garland_cichorieae/styleOverride.css
396 396
	margin-left: 45px;
397 397
	background-image: none;
398 398
}
399

  
400

  
401
#block-cdm_dataportal-feature-credits span.cdm\:TextData {
402
	display: block;
403
}
themes/garland_cichorieae/template.php
87 87
		$asListElement = false;
88 88
	}
89 89

  
90
	    //printing annotations footnotes
91
    $annotation_fkeys =  theme('cdm_annotations_as_footnotekeys', $element, $feature_uuid);
92

  
90 93
	if ($feature_uuid == UUID_NAME_USAGE || $feature_uuid == UUID_CHROMOSOMES){
91 94
		$no_links = true;
92 95
	}
......
132 135
				if ($name_used_in_source_link_to_show && ($description || $sourceRefs)){
133 136
					$out .= ': ';
134 137
				}
135
				$out .= $description . $sourceRefs .theme('cdm_annotations_as_footnotekeys', $element, $feature_uuid) . '</li>';
138
				$out .= $description . $sourceRefs .theme('cdm_annotations_as_footnotekeys', $element, $feature_uuid) . $annotation_fkeys . '</li>';
136 139
			}else if ($asListElement){
137 140
				$out = '<li class="descriptionText">' . $name_used_in_source_link_to_show;
138 141
				//adding ":" if necesary
139 142
				if ($name_used_in_source_link_to_show && ($description || $sourceRefs)){
140 143
					$out .= ': ';
141 144
				}
142
				$out .= $description . $sourceRefs . theme('cdm_annotations_as_footnotekeys', $element, $feature_uuid) . '</li>';
145
				$out .= $description . $sourceRefs . theme('cdm_annotations_as_footnotekeys', $element, $feature_uuid) . $annotation_fkeys . '</li>';
143 146
			//special handling for flora malesiana TODO: possible better way to implement this case?
144 147
			}else{
145 148
				if ($name_used_in_source_link_to_show){
146 149
					$name_used_in_source_link_to_show = ' (name in source: '. $name_used_in_source_link_to_show . ')';
147 150
				}
148
				$out = $description . $sourceRefs . $name_used_in_source_link_to_show;
151
				$out = '<span class="'. html_class_atttibute_ref($element) . '"> '. $description . $sourceRefs . $name_used_in_source_link_to_show . $annotation_fkeys. '</span>';
149 152
			}
150 153
		}
151 154
	}
152 155

  
153 156
    //if no sources, print the description
154 157
    if(!isset($out)) {
155
      $out = $description;
158
      $out = '<span class="'. html_class_atttibute_ref($element) . '"> ' . $description . $annotation_fkeys. '</span>';
156 159
    }
157
    //printing annotations footnotes
158
    $out .=  theme('cdm_annotations_as_footnotekeys', $element, $feature_uuid);
160

  
159 161
/*
160 162
	if ($feature_uuid == UUID_NAME_USAGE){
161 163
		foreach($element->sources as $source){

Also available in: Unified diff