Project

General

Profile

« Previous | Next » 

Revision b5e773ef

Added by Andreas Kohlbecker almost 14 years ago

#392 CICHORIEAE display notes & #1483 references for distributions as footnotes

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
487 487
        case 'ReferenceBase':
488 488
            $ws_base_uri = CDM_WS_REFERENCE;
489 489
            break;
490
        case 'Distribution':
491
        case 'TextData':
492
        case 'TaxonInteraction':
493
        case 'QuantitativeData':
494
        case 'IndividualsAssociation':
495
        case 'Distribution':
496
        case 'CommonTaxonName':
497
        case 'CategoricalData':	
498
        	$ws_base_uri = CDM_WS_DESCRIPTIONELEMENT;
499
        	break;
490 500
        default:  trigger_error('Unsupported CDM Class - no annotations available for ' . $cdmBase->class, E_USER_ERROR);
491 501
            return;
492 502
    }
modules/cdm_dataportal/cdm_api/webservice_uris.php
32 32

  
33 33
define('CDM_WS_PORTAL_TAXON_NAMERELATIONS', 'portal/taxon/$0/nameRelationships');
34 34

  
35
define('CDM_WS_DESCRIPTIONELEMENT', 'descriptionelement/$0');
36

  
35 37

  
36 38
/**
37 39
 * @parameters $0 : the taxon uuid
modules/cdm_dataportal/cdm_dataportal.css
323 323
  font-style: italic;
324 324
}
325 325

  
326
.footnote-anchor {
327
  font-weight: bold;
328
}
329

  
326 330
.heterotypicSynonymyGroup li.footnotes, .homotypicSynonymyGroup li.footnotes{
327 331
	margin-top: 10px;
328 332
    margin-left: 6px;
modules/cdm_dataportal/js/footnotes.js
6 6
	  }
7 7
	  
8 8
	  function getFootnoteKeyClassName(object){
9
		  return '.'+$(object).attr('href').substr(1).replace(/-/gi, '-key-');
9
		  return '.'+$(object).attr('href').substr(1).replace(/-/gi, '-key-') + ' a';
10 10
	  }
11 11
	  
12
	  $('a.footnote-key').mouseover(function(e){
12
	  $('span.footnote-key a').mouseover(function(e){
13 13
		  var fnClassName = getFootnoteClassName(this);
14 14
		  var fnKeyClassName = getFootnoteKeyClassName(this); 
15 15
		  $('.footnote').css('background-color', 'transparent').css('background-color', 'transparent').removeClass('active');
16
		  $('a.footnote-key').css('background-color', 'transparent').css('background-color', 'transparent').removeClass('active');
16
		  $('span.footnote-key a').css('background-color', 'transparent').css('background-color', 'transparent').removeClass('active');
17 17
		  $(fnClassName).css('background-color', 'yellow');
18 18
		  $(fnKeyClassName).css('background-color', 'yellow');
19 19
	  	}
......
27 27
		  var fnClassName = getFootnoteClassName(this);
28 28
		  var fnKeyClassName = getFootnoteKeyClassName(this); 
29 29
		  $('.footnote').css('background-color', 'transparent').removeClass('active'); 
30
		  $('a.footnote-key').css('background-color', 'transparent').removeClass('active');
30
		  $('span.footnote-key a').css('background-color', 'transparent').removeClass('active');
31 31
		  $(fnClassName).css('background-color', 'yellow').addClass('active');
32 32
		  $(fnKeyClassName).css('background-color', 'yellow').addClass('active');
33 33
	  });
34 34
	  
35
  }));
35
  });
36 36
}
modules/cdm_dataportal/theme/cdm_dataportal.common.theme
109 109
 * TODO it should be configurable which objects can be annotated as this might differ in dataportals
110 110
 *
111 111
 */
112
function theme_cdm_annotations($cdmBase){
113
	
112
function theme_cdm_annotations_as_footnotekeys($cdmBase){
114 113
	
115 114
    $annotationUrl = cdm_compose_annotations_url($cdmBase);
116 115
    if($annotationUrl){
117 116
        $annotationPager = cdm_ws_get($annotationUrl, null, null, null, true);
118 117
        if($annotationPager->count > 0){
119 118
	        foreach($annotationPager->records as $annotation){
120
		        $footnoteKey = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), $annotation->text);
121
		        $out .= (isset($out)? ',' : '') . theme('cdm_footnote_key', $footnoteKey);
119
		        $footnoteKey = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey() . '-annotations', $annotation->text);
120
		        $out .=  theme('cdm_footnote_key', $footnoteKey, RenderHints::getFootnoteListKey() . '-annotations', (isset($out)? ',' : ''));
122 121
	        }   
123 122
        }
124 123
    }
125

  
126 124
	return $out;
125
}
127 126

  
128 127

  
128
function theme_cdm_annotation_footnotes($footnoteListKey, $enclosingTag = 'span'){
129
    return theme('cdm_footnotes', $footnoteListKey . '-annotations', $enclosingTag);
129 130
}
130 131

  
131 132
function theme_cdm_annotation_content($AnnotationTO){
......
173 174

  
174 175
/* ============================ footnotes ============================= */
175 176

  
176
function theme_cdm_footnote_key($footnoteKey, $highlightable=true){
177
  $out = '<a href="#footnote-'.$footnoteKey.'" class="footnote-key footnote-key-'.$footnoteKey.'">'.$footnoteKey.'</a>';
177
function theme_cdm_footnote_key($footnoteKey, $footnoteListKey, $separator = '', $highlightable=true){
178
  $out = '<span class="footnote-key footnote-key-'.$footnoteKey.' member-of-footnotes-'.$footnoteListKey.'">'.$separator
179
        .'<a href="#footnote-'.$footnoteKey.'">'.$footnoteKey.'</a>'
180
        .'</span>';
178 181
  return $out;
179 182
}
180 183

  
......
184 187
  return $out;
185 188
}
186 189

  
190

  
187 191
function theme_cdm_footnotes($footnoteListKey, $enclosingTag = 'span'){
188 192
	
189
	$out = '<'.$enclosingTag.' class="footnotes footnotes-'.$footnoteListKey.'">' . FootnoteManager::renderFootnoteList($footnoteListKey) . '</'.$enclosingTag.'>';
193
	$out = '<'.$enclosingTag.' class="footnotes footnotes-'.$footnoteListKey.' ">' . FootnoteManager::renderFootnoteList($footnoteListKey) . '</'.$enclosingTag.'>';
190 194
	return $out;
191 195
}
192 196

  
modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
42 42
	if(!$mergedTrees){
43 43
		return;
44 44
	}
45

  
46 45
	foreach($mergedTrees as &$mTree){
47 46
		//TODO diplay title and reference in case of multiple $mergedTrees -> theme
48 47
		$out .= theme('cdm_feature_nodes', $mTree->root->children, $taxon);
......
75 74

  
76 75
function theme_cdm_feature_nodes($featureNodes, $taxon){
77 76

  
77
	RenderHints::pushToRenderStack('feature_nodes');
78 78
	$gallery_settings = getGallerySettings(CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME);
79 79
	
80 80
	foreach($featureNodes as $node){
......
111 111
				if($node->feature->uuid == UUID_DISTRIBUTION){
112 112
					$out .= theme('cdm_descriptionElements_distribution', $taxon);
113 113
				}
114
				
115
			    $out .= theme('cdm_footnotes', $node->feature->uuid);
116
			    $out .= theme('cdm_annotation_footnotes', $node->feature->uuid);
114 117
			}
115 118
		}
116 119
		// theme
......
120 123
			$out .= '</div>';
121 124
		}
122 125
	}
126
	RenderHints::popFromRenderStack();
123 127
	return $out;
124 128
}
125 129

  
......
165 169
  if(strlen($sourceRefs) > 0){
166 170
    $sourceRefs = '<span class="sources">' . $sourceRefs . '</span>';
167 171
  }
168
/*  
169
          $out = l('<span class="reference">'.$reference.'</span>'
170
          , path_to_reference($descriptionElementSource->citation->uuid)
171
          , array("class"=>"reference")
172
          , NULL, NULL, FALSE ,TRUE);
173
*/  
172
 
174 173
  if ($source->nameUsedInSource->uuid){ //do a link to name page
175 174
    $name_used_in_source_link_to_show = l($source->nameUsedInSource->titleCache,
176 175
                                           path_to_name($source->nameUsedInSource->uuid), 
......
192 191
  }
193 192
  
194 193
  // add annotations as footnote key
195
  $out .= theme('cdm_annotations', $element);
194
  $out .= theme('cdm_annotations_as_footnotekeys', $element);
196 195
  return $out;
197 196
}
198 197

  
......
242 241
	$feature = $descriptionElement->feature;
243 242
	$out = theme('cdm_descriptionElementArray', $outArray, $feature, $glue, $sortOutArray, $enclosingHtml);
244 243
	
245
	$out .= '<div class="footnote_list">'. FootnoteManager::renderFootnoteList($featureUuid) . '</div>';
246
		
247 244
    RenderHints::popFromRenderStack();
248 245
    
249 246
	return $out;
......
257 254
function theme_cdm_descriptionElementDistribution($descriptionElements){
258 255

  
259 256
	$out = '';
260
	$separator = ', ';
261

  
257
	$separator = ',';
258
    RenderHints::pushToRenderStack('descriptionElementDistribution');
259
	RenderHints::setFootnoteListKey(UUID_DISTRIBUTION);
262 260
	foreach($descriptionElements as $descriptionElement){
263
		//$footnoteKey = FootnoteManager::addNewFootnote($descriptionElement->feature->uuid, $descriptionElement->area->representation_L10n);
264
//		$footnoteKeyList = '';
265
//		foreach($descriptionElement->sources as $source){
266
//			$footnoteKey = FootnoteManager::addNewFootnote($descriptionElement->feature->uuid, theme('cdm_DescriptionElementSource', $source));
267
//			$footnoteKeyList .= theme('cdm_footnode_key', $footnoteKey) . ' ';
268
//		}
269
	    $out .= $descriptionElement->area->representation_L10n . $footnoteKeyList . $separator;
261
		// annotations as footnotes
262
		$annotationFootnoteKeys = theme('cdm_annotations_as_footnotekeys', $descriptionElement);
263
		// source references as footnotes
264
		$sourcesFootnoteKeyList = '';
265
		foreach($descriptionElement->sources as $source){
266
			$_fkey = FootnoteManager::addNewFootnote(UUID_DISTRIBUTION, theme('cdm_DescriptionElementSource', $source, false));
267
			$sourcesFootnoteKeyList .= theme('cdm_footnote_key', $_fkey, UUID_DISTRIBUTION, ($sourcesFootnoteKeyList ? $separator : ''));
268
		}
269
		if($annotationFootnoteKeys && $sourcesFootnoteKeyList){
270
			$annotationFootnoteKeys .= $separator;
271
		}
272
	    $out .= $descriptionElement->area->representation_L10n . $annotationFootnoteKeys . $sourcesFootnoteKeyList . ' ';
270 273
	}
274
	
275
	
271 276
	$out = substr($out, 0, strlen($out)-strlen($separator) );
272 277
	
273 278
	$taxonTrees =  cdm_ws_get(CDM_WS_PORTAL_TAXONOMY);
......
278 283
		}
279 284
	}
280 285

  
281
//  $referenceCitation = l('<span class="reference">('.$reference->title.')</span>', path_to_reference($reference->uuid), array("class"=>"reference"), NULL, NULL, FALSE ,TRUE);
282
//	if($descriptions && strlen($descriptions) > 0 ){
283
//		$sourceRefs .= ' '.$referenceCitation;
284
//	}
285

  
286
    RenderHints::popFromRenderStack();
286 287
	return $out;
287 288

  
288 289
}
......
290 291

  
291 292
function theme_cdm_DescriptionElementSource($descriptionElementSource, $doLink = TRUE){
292 293

  
293
    $out = theme('cdm_reference', $descriptionElementSource->citation, $descriptionElementSource->citationMicroReference, TRUE);
294
      
294
    $out = theme('cdm_reference', $descriptionElementSource->citation, $descriptionElementSource->citationMicroReference, $doLink);
295
    
295 296
	// add annotations as footnote key
296
    $out .= theme('cdm_annotations', $descriptionElementSource->citation);
297
    $out .= theme('cdm_annotations_as_footnotekeys', $descriptionElementSource->citation);
297 298
    return $out;
298 299
}
299 300

  
modules/cdm_dataportal/theme/cdm_dataportal.name.theme
205 205
		$out .= theme('cdm_typedesignations', $typeDesignations);
206 206
	}
207 207

  
208
	$out .= theme('cdm_footnotes', $footnoteListKey, 'li');
208
	$out .= theme('cdm_annotation_footnotes', $footnoteListKey, 'li');
209 209
	$out .= '</ul>';
210 210
    
211 211
    
......
243 243
		$out .= theme('cdm_typedesignations', $typeDesignations);
244 244
	}
245 245

  
246
	$out .= theme('cdm_footnotes', $footnoteListKey, 'li');
246
	$out .= theme('cdm_annotation_footnotes', $footnoteListKey, 'li');
247 247
	$out .= '</ul>';
248 248
	
249 249
	RenderHints::popFromRenderStack();
......
251 251
}
252 252

  
253 253

  
254
function theme_cdm_taxonName($taxonName, $nameLink = NULL, $refenceLink = NULL){
254
function theme_cdm_taxonName($taxonName, $nameLink = NULL, $refenceLink = NULL, $showAnnotations = true){
255 255

  
256 256
  $renderTemplate = get_nameRenderTemplate(RenderHints::getRenderPath(), $nameLink, $refenceLink);
257 257
	$partDefinition = get_partDefinition($taxonName->class);
......
414 414
	}
415 415
    $out .= '</span>';
416 416
    
417
	// add annotations
418
	$out .= theme('cdm_annotations', $taxonName);
417
	$out .= theme('cdm_annotations_as_footnotekeys', $taxonName);
419 418
	
420 419
	return $out;
421 420
}
modules/cdm_dataportal/theme/cdm_dataportal.page.theme
22 22
	if(isset($taxon->name->nomenclaturalReference)){
23 23
		$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
24 24
	}
25
	$out = theme('cdm_taxonName', $taxon->name, null, $referenceUri);
25
	$out = theme('cdm_taxonName', $taxon->name, null, $referenceUri, false);
26 26
	RenderHints::popFromRenderStack();
27 27

  
28 28
	return '<span class="'.$taxon->class.'">'.$out.'</span>';
......
34 34
 * @return the formatted name title
35 35
 */
36 36
function theme_cdm_name_page_title($taxon_name){
37
  $renderPath = 'taxon_page_title';
37
  RenderHints::pushToRenderStack('taxon_page_title');
38 38
  if(isset($taxon_name->nomenclaturalReference)){
39 39
    $referenceUri = url(path_to_reference($taxon_name->nomenclaturalReference->uuid));
40 40
  }
41
  return '<span class="'.$taxon_name->class.'">'.theme('cdm_taxonName', $taxon_name, null, $referenceUri, $renderPath).'</span>';
41
  
42
  $out = '<span class="'.$taxon_name->class.'">'.theme('cdm_taxonName', $taxon_name, null, $referenceUri, false).'</span>';
43
  RenderHints::popFromRenderStack();
44
  return $out;
42 45
}
43 46

  
44 47
/**
......
190 193
			$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
191 194
		}
192 195
		$out .= theme('cdm_taxonName', $taxon->name, null, $referenceUri);
196
		$out .= theme('cdm_annotations_as_footnotekeys', $taxon);
193 197
	}
194 198

  
195 199
	if($addAcceptedTaxon && !isset($synomymie->homotypicSynonymsByHomotypicGroup[0])){
modules/cdm_dataportal/theme/cdm_dataportal.references.theme
56 56
    if(!empty($descriptionElementSource->citationMicroReference)){
57 57
        $out .= ': '. $descriptionElementSource->citationMicroReference;
58 58
     }
59
      
59
     
60
    return $out;
60 61
}
modules/cdm_dataportal/theme/cdm_dataportal.taxon.theme
103 103
	ksort($joinedAuthorTeams);
104 104
	foreach($joinedAuthorTeams as $authorteam=>$sensuCitation){
105 105
		$footnoteKey = FootnoteManager::addNewFootnote($footnoteListKey, $sensuCitation);
106
		$joinedAuthorTeams[$authorteam] = '<span class="sensu">sensu '.$authorteam. theme('cdm_footnote_key', $footnoteKey).'</span>';
106
		$joinedAuthorTeams[$authorteam] = '<span class="sensu">sensu '.$authorteam. theme('cdm_footnote_key', $footnoteKey, $footnoteListKey).'</span>';
107 107
	}
108 108

  
109 109
	// generate output
......
112 112
	foreach($misapplied as $misapplied_name){
113 113
		
114 114
		$out .= '<li class="synonym">'.$misapplied_name['out'] . " ";
115
		// fill authors the renderedFootnoteKey and sorting 'em
115
		// fill authors with the renderedFootnoteKey and sorting 'em
116 116
		foreach($misapplied_name['authorteam'] as $authorteam=>&$renderedFootnoteKey) {
117 117
		  $renderedFootnoteKey = $joinedAuthorTeams[$authorteam];
118 118
	    }
......
125 125
	}
126 126
	$out .= '</ul>';
127 127
	
128
	$out .= theme('cdm_footnotes', $footnoteListKey, 'div');
128 129
    RenderHints::popFromRenderStack();
129 130
	return $out;
130 131
}
......
144 145
				$referenceUri = url(path_to_reference($synonym->name->nomenclaturalReference->uuid));
145 146
			}
146 147
			$out .= theme('cdm_taxonName', $synonym->name, null, $referenceUri);
148
			$out .= theme('cdm_annotations_as_footnotekeys', $synonym);
147 149
			$out .= '</span>';
148 150
		}
149 151
	}
......
185 187
				$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
186 188
			}
187 189
			$out .= '<li class="Taxon">'.theme('cdm_taxonName', $taxon->name, $taxonUri, $referenceUri);
190
            $out .= theme('cdm_annotations_as_footnotekeys', $taxon);
191
            
188 192
			if($showMedia_taxa){
189 193
				$out .= theme('cdm_taxon_list_thumbnails', $taxon);
190 194
			}
195
			
191 196
			$out .= '</li>';
192 197
		} else {
193 198
			// its a synonym
......
200 205
					$referenceUri = url(path_to_reference($acceptedTaxon->name->nomenclaturalReference->uuid));
201 206
				}
202 207
				$out .= '<li class="Synonym">'.theme('cdm_taxonName', $taxon->name, $taxonUri, $referenceUri);
208
				$out .= theme('cdm_annotations_as_footnotekeys', $taxon);
203 209
				if($showMedia_synonyms){
204 210
					$out .= theme('cdm_taxon_list_thumbnails', $acceptedTaxon);
205 211
				}
......
207 213
			} else {
208 214
				//TODO avoid using Ajax in the cdm_dynabox
209 215
				//TODO add media
210
				$out .= theme('cdm_dynabox', theme('cdm_taxonName', $taxon->name, null, null), cdm_compose_url(CDM_WS_PORTAL_TAXON_ACCEPTED, array($taxon->uuid)), 'cdm_list_of_taxa');
216
				$out .= theme('cdm_dynabox', theme('cdm_taxonName', $taxon->name, null, null, false), cdm_compose_url(CDM_WS_PORTAL_TAXON_ACCEPTED, array($taxon->uuid)), 'cdm_list_of_taxa');
211 217
			}
212 218
		}
213 219
	}
......
247 253
		$referenceUri = url(path_to_reference($taxon->name->nomenclaturalReference->uuid));
248 254
	}
249 255
	$nameHtml = theme('cdm_taxonName', $taxon->name, $taxonUri, $referenceUri);
256
	$nameHtml .= theme('cdm_annotations_as_footnotekeys', $taxon);
250 257
	
251 258
	//later homonym or trated as later homonym
252 259
	$taxon_name_relations = cdm_ws_get(CDM_WS_PORTAL_TAXON_NAMERELATIONS, $taxon->uuid);
themes/diptera/template.php
8 8
  $sortOutArray = false;
9 9
  $enclosingHtml = 'ul';
10 10
  
11
  
12
   RenderHints::pushToRenderStack('cdm_descriptionElements');
13
    
14
  
11 15
  // only for diptera
12 16
  if(isset($descriptionElements[0]) && $descriptionElements[0]->feature->uuid == UUID_CITATION ) {
13 17
    foreach($descriptionElements as $element){
......
42 46
    }
43 47
  }
44 48

  
45
  return theme('cdm_descriptionElementArray', $outArray, $feature, $glue, $sortOutArray, $enclosingHtml);
49
      $out = theme('cdm_descriptionElementArray', $outArray, $feature, $glue, $sortOutArray, $enclosingHtml);
50
      RenderHints::popFromRenderStack();
51
      return  $out;
46 52
}
47 53

  
48 54
/**
themes/garland_cichorieae/template.php
14 14
 */
15 15
function garland_cichorieae_cdm_taxon_page_description($taxon, $mergedTrees, $media, $hideImages = false){
16 16

  
17
	RenderHints::pushToRenderStack('taxon_page_description');
17 18
  // description TOC
18 19
  $out = theme('cdm_featureTreeTOCs', $mergedTrees);
19 20

  
......
35 36

  
36 37
  // description
37 38
  $out .= theme('cdm_featureTrees', $mergedTrees, $taxon);
38

  
39
  RenderHints::popFromRenderStack();   
40
  
39 41
  return $out;
40 42
}
41 43

  
......
50 52
  return '<p class="descriptionText">' . $description . $referenceCitation.'</p>';
51 53
}
52 54

  
55

  
53 56
function garland_cichorieae_cdm_taxon_page_images($taxon, $media){
54 57

  
55 58
  $flashLink = isset($media[0]);
themes/palmweb_2/template.php
94 94

  
95 95
  $descriptions = '';
96 96
  $separator = ', ';
97

  
98
  foreach($descriptionElements as $descriptionElement){
99
    $descriptions .= $descriptionElement->area->representation_L10n . $separator;
100
  }
97
  
98
    RenderHints::pushToRenderStack('descriptionElementDistribution');
99
    RenderHints::setFootnoteListKey(UUID_DISTRIBUTION);
100
    foreach($descriptionElements as $descriptionElement){
101
        // annotations as footnotes
102
        $annotationFootnoteKeys = theme('cdm_annotations_as_footnotekeys', $descriptionElement);
103
//        // source references as footnotes
104
//        $sourcesFootnoteKeyList = '';
105
//        foreach($descriptionElement->sources as $source){
106
//            $_fkey = FootnoteManager::addNewFootnote(UUID_DISTRIBUTION, theme('cdm_DescriptionElementSource', $source, false));
107
//            $sourcesFootnoteKeyList .= theme('cdm_footnote_key', $_fkey, UUID_DISTRIBUTION, ($sourcesFootnoteKeyList ? $separator : ''));
108
//        }
109
        if($annotationFootnoteKeys && $sourcesFootnoteKeyList){
110
            $annotationFootnoteKeys .= $separator;
111
        }
112
        $out .= $descriptionElement->area->representation_L10n . $annotationFootnoteKeys . $sourcesFootnoteKeyList . ' ';
113
    }
114
  
101 115
  $descriptions = substr($descriptions, 0, strlen($descriptions)-2);
102 116
  $taxonTrees =  cdm_ws_get(CDM_WS_PORTAL_TAXONOMY);
103 117
  foreach($taxonTrees as $taxonTree){
......
117 131
  if(strlen($sourceRefs) > 0){
118 132
    $sourceRefs = '<span class="sources">' . $sourceRefs . '</span>';
119 133
  }
134
  
135
    RenderHints::popFromRenderStack();
120 136
  return $descriptions. $sourceRefs ;
121 137

  
122 138
}

Also available in: Unified diff