Project

General

Profile

« Previous | Next » 

Revision 48650990

Added by Andreas Kohlbecker almost 14 years ago

more footnotes

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
484 484
        case 'Media':
485 485
            $ws_base_uri = CDM_WS_MEDIA;
486 486
            break;
487
        default: 
488
            trigger_error('Unsupported CDM Class - no annotations available', E_USER_ERROR);
487
        case 'ReferenceBase':
488
            $ws_base_uri = CDM_WS_REFERENCE;
489
            break;
490
        default:  trigger_error('Unsupported CDM Class - no annotations available for ' . $cdmBase->class, E_USER_ERROR);
489 491
            return;
490 492
    }
491 493
    return  cdm_compose_url($ws_base_uri, array($cdmBase->uuid, 'annotation'));
......
598 600

  
599 601
  if(!$featureTree){
600 602
    drupal_set_message('No \'FeatureTree\' has been set so far. '
601
    .'In order to display descriptive data of your taxa, please select a \'FeatureTree\' in the '.l('CDM Dataportal Ssettings', 'admin/settings/cdm_dataportal/general'), 'warning');
603
    .'In order to see the species profiles of your taxa, please select a \'FeatureTree\' in the '.l('CDM Dataportal Settings', 'admin/settings/cdm_dataportal/general'), 'warning');
602 604
    return false;
603 605
  }
604 606

  
modules/cdm_dataportal/cdm_api/webservice_uris.php
79 79
 */
80 80
define('CDM_WS_FEATURETREE', 'featuretree/$0');
81 81

  
82
//define('CDM_WS_FEATURETREE_CHILDREN', 'featuretree/$0/children');
83

  
82 84
define('CDM_WS_FEATURETREES', 'featuretree');
83 85

  
84 86
define('CDM_WS_GEOSERVICE_DISTRIBUTIONMAP', 'geo/map/distribution/$0');
modules/cdm_dataportal/cdm_dataportal.module
48 48
define('CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS', 'cdm_dataportal_display_name_relations');
49 49
define('CDM_DATAPORTAL_DISPLAY_TAXON_RELATIONSHIPS_DEFAULT', 1);
50 50
define('CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS_DEFAULT', 1);
51
define(CDM_DATAPORTAL_FEATURETREE_UUID, CDM_DATAPORTAL_FEATURETREE_UUID);
51 52

  
52 53

  
53 54

  
......
695 696
    '#collapsed' => TRUE,
696 697
	);
697 698

  
698
	$form['cdm_dataportal']['feature_tree']['cdm_dataportal_featuretree_uuid'] = array(
699
	$form['cdm_dataportal']['feature_tree'][CDM_DATAPORTAL_FEATURETREE_UUID] = array(
699 700
    '#type' => 'select',
700 701
    '#title'         => t('Available FeatureTrees'),
701
    '#default_value' => variable_get('cdm_dataportal_featuretree_uuid', UUID_DEFAULT_FEATURETREE),
702
    '#default_value' => variable_get(CDM_DATAPORTAL_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE),
702 703
	  '#options' => _get_feature_trees(),
703 704
    '#description'   => t('Select a FeatureTree for this webservice.'
704 705
    //.' If there is no applicable FeatureTree you can create a new one using the <a href="">FeatureTreeManager</a>'
modules/cdm_dataportal/classes/footnotemanager.php
58 58
     * @param $themeArguments
59 59
     * @return unknown_type
60 60
     */
61
    public static function addNewFootnote($footnoteListKey, $object, $theme = NULL, $themeArguments = array()){
61
    public static function addNewFootnote($footnoteListKey, $object = null, $theme = NULL, $themeArguments = array()){
62 62

  
63
      if(!$object){
64
      	return false;
65
      }
66
    	
63 67
      if(!array_key_exists($footnoteListKey, self::$fnstore)){
64 68
          self::$fnstore[$footnoteListKey] = array();
65 69
      }
modules/cdm_dataportal/js/footnotes.js
1 1
if (Drupal.jsEnabled) {
2
  $(document).ready($(document).ready(function() {
2
  $(document).ready(function() {
3 3
	  
4 4
	  function getFootnoteClassName(object){
5 5
		  return '.'+$(object).attr('href').substr(1);
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_annotation($cdmBase){
112
function theme_cdm_annotations($cdmBase){
113
	
113 114
	
114
//    $annotationUrl = cdm_compose_annotations_url($cdmBase);
115
//
116
//	if($annotationUrl){
117
//		drupal_add_js(drupal_get_path('module', 'cdm_dataportal').'/js/cdm_annotations.js');
118
//		drupal_add_js(drupal_get_path('module', 'cdm_dataportal').'/js/jquery.form.js');
119
//		$annotationProxyUrl = url('cdm_api/proxy/'. urlencode($annotationUrl).'/cdm_annotation_content');
120
//	
121
//		$out = ' <span class="annotation">';
122
//		$out .= '<span class="annotation_toggle" rel="'.$annotationProxyUrl.'">+</span>';
123
//			
124
//	
125
//		$out .= '<div class="annotation_box"></div>';
126
//		$out .= '</span>';
127
//	}
128 115
    $annotationUrl = cdm_compose_annotations_url($cdmBase);
129 116
    if($annotationUrl){
130 117
        $annotationPager = cdm_ws_get($annotationUrl, null, null, null, true);
131
        foreach($annotationPager->records as $annotation){
132
	        $footnoteKey = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), $annotation->text);
133
	        $out .= (isset($out)? ',' : '') . theme('cdm_footnote_key', $footnoteKey);
118
        if($annotationPager->count > 0){
119
	        foreach($annotationPager->records as $annotation){
120
		        $footnoteKey = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), $annotation->text);
121
		        $out .= (isset($out)? ',' : '') . theme('cdm_footnote_key', $footnoteKey);
122
	        }   
134 123
        }
135 124
    }
136 125

  
modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
150 150
  $description = str_replace("\n", "<br/>", $element->multilanguageText_L10n->text);
151 151
  $sourceRefs = '';
152 152
  $result = array();
153
  $res_text;
153
  $out;
154 154
  $res_author;
155 155
  $res_date;
156 156
   
......
181 181
  }
182 182
  
183 183
  if ($asListElement){
184
    $res_text = '<li class="descriptionText">' . $name_used_in_source_link_to_show;
184
    $out = '<li class="descriptionText">' . $name_used_in_source_link_to_show;
185 185
    //adding ":" if necesary 
186 186
    if ($name_used_in_source_link_to_show && ($description || $sourceRefs)){
187
    	$res_text .= ': ';
187
    	$out .= ': ';
188 188
    }
189
     $res_text .= $description . $sourceRefs . '</li>';
189
     $out .= $description . $sourceRefs . '</li>';
190 190
  }else{
191
    $res_text = $description . $sourceRefs . ' (name in source: '. $name_used_in_source_link_to_show . ')';
191
    $out = $description . $sourceRefs . ' (name in source: '. $name_used_in_source_link_to_show . ')';
192 192
  }
193
  return $res_text;
193
  
194
  // add annotations as footnote key
195
  $out .= theme('cdm_annotations', $element);
196
  return $out;
194 197
}
195 198

  
196 199

  
......
206 209
	$enclosingHtml = 'ul';
207 210
	$distributionElements = array();
208 211
	
212
	RenderHints::pushToRenderStack('cdm_descriptionElements');
213
	
209 214
	foreach($descriptionElements as $descriptionElement){
210 215
		
211 216
		if($descriptionElement->feature->uuid == UUID_DISTRIBUTION){
......
233 238

  
234 239
	$outArray[] = theme('cdm_descriptionElementDistribution', $distributionElements);
235 240
	
236
	
237 241
	// take the feature of the last $descriptionElement
238 242
	$feature = $descriptionElement->feature;
239 243
	$out = theme('cdm_descriptionElementArray', $outArray, $feature, $glue, $sortOutArray, $enclosingHtml);
244
	
240 245
	$out .= '<div class="footnote_list">'. FootnoteManager::renderFootnoteList($featureUuid) . '</div>';
246
		
247
    RenderHints::popFromRenderStack();
248
    
241 249
	return $out;
242 250
}
243 251

  
......
253 261

  
254 262
	foreach($descriptionElements as $descriptionElement){
255 263
		//$footnoteKey = FootnoteManager::addNewFootnote($descriptionElement->feature->uuid, $descriptionElement->area->representation_L10n);
256
	$footnoteKeyList = '';
257
	foreach($descriptionElement->sources as $source){
258
		break;
259
		$footnoteKey = FootnoteManager::addNewFootnote($descriptionElement->feature->uuid, $source, 'cdm_DescriptionElementSource');
260
		$footnoteKeyList .= theme('cdm_footnode_key', $footnoteKey) . ' ';
261
	}
262
    $out .= $descriptionElement->area->representation_L10n . $footnoteKeyList . $separator;
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;
263 270
	}
264 271
	$out = substr($out, 0, strlen($out)-strlen($separator) );
265 272
	
......
283 290

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

  
286
    //ev. delegate to theme_cdm_ReferencedEntityBase
287
    $out = '';
288
    if($descriptionElementSource->citation){
289
      $reference = $descriptionElementSource->citation->titleCache;    
290
      if($doLink){
291
        $out = l('<span class="reference">'.$reference.'</span>'
292
          , path_to_reference($descriptionElementSource->citation->uuid)
293
          , array("class"=>"reference")
294
          , NULL, NULL, FALSE ,TRUE);
295
      } else {
296
       $out = $reference;
297
      }
298
      if($descriptionElementSource->citationMicroReference){
299
        $out .= ': '. $descriptionElementSource->citationMicroReference;
300
      }
301
    }
293
    $out = theme('cdm_reference', $descriptionElementSource->citation, $descriptionElementSource->citationMicroReference, TRUE);
294
      
295
	// add annotations as footnote key
296
    $out .= theme('cdm_annotations', $descriptionElementSource->citation);
302 297
    return $out;
303 298
}
304 299

  
modules/cdm_dataportal/theme/cdm_dataportal.name.theme
64 64
			  $shortCitation = $author_team->titleCache;
65 65
				$shortCitation .= (strlen($shortCitation) > 0 ? ' ' : '' ). partialToYear($std->citation->datePublished->start);
66 66
				if(strlen($shortCitation) == 0){
67
					$shortCitation = theme('cdm_reference',$std->citation );
67
					$shortCitation = theme('cdm_reference', $std->citation);
68 68
					$missingShortCitation = true;
69 69
				}
70 70
				$typeReference .= '&nbsp;(' . t('designated by');
......
413 413
    $out .= '</span>';
414 414
    
415 415
	// add annotations
416
	$out .= theme('cdm_annotation', $taxonName);
416
	$out .= theme('cdm_annotations', $taxonName);
417 417
	
418 418
	return $out;
419 419
}
modules/cdm_dataportal/theme/cdm_dataportal.page.theme
109 109
  // --- DESCRIPTION --- //
110 110
  if($page_part == 'description' || $page_part == 'all'){
111 111

  
112
  	$featureTree = cdm_ws_get(CDM_WS_FEATURETREE, variable_get('cdm_dataportal_featuretree_uuid', false));
112
  	$featureTree = cdm_ws_get(CDM_WS_FEATURETREE, variable_get(CDM_DATAPORTAL_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE));
113 113
  	$taxonDescriptions = cdm_ws_get(CDM_WS_PORTAL_TAXON_DESCRIPTIONS, $taxon->uuid);
114 114
  	$mergedTrees = cdm_ws_descriptions_by_featuretree($featureTree, $taxonDescriptions, variable_get('cdm_dataportal_descriptions_separated', FALSE));
115 115

  
......
197 197
		$typeDesignations = cdm_ws_get(CDM_WS_PORTAL_TAXON_NAMETYPEDESIGNATIONS, $taxon->uuid);
198 198
		if($typeDesignations){
199 199
			$out .= theme('cdm_typedesignations', $typeDesignations);
200
			//$out .= l('test', path_to_name($typeDesignations[0]->typeName->uuid), array(), NULL, NULL, FALSE, TRUE);
201 200
		}
202 201
	} else {
203 202
		// reder the homotypicSynonymyGroup including the type information
204 203
		$out .= theme('cdm_homotypicSynonymyGroup', $synomymie->homotypicSynonymsByHomotypicGroup);
205 204
	}
205
	
206 206
	if($synomymie->heterotypicSynonymyGroups) {
207 207
		foreach($synomymie->heterotypicSynonymyGroups as $homotypicalGroup){
208 208
			$out .= theme('cdm_heterotypicSynonymyGroup', $homotypicalGroup);
modules/cdm_dataportal/theme/cdm_dataportal.references.theme
17 17
		$out .= '<ul>';
18 18
		foreach($referencePager->records as $reference){
19 19
			$reference->fullCitation = $reference->titleCache; //FIXME remove hack for matching cdm entity to STO
20
			$out .= '<li>'.theme('cdm_reference', $reference, TRUE).'</li>';
20
			$out .= '<li>'.theme('cdm_reference', $reference, null, TRUE).'</li>';
21 21
		}
22 22
		$out .= '</ul>';
23 23
		$out .= theme('cdm_pager', $referencePager,  $path, $parameters);
......
29 29

  
30 30

  
31 31
/**
32
 * @deprecated ??
32
 * used by 
33
 *  - theme_cdm_typedesignations
34
 *  - theme_cdm_reference_pager
35
 *  - theme_cdm_taxonRelationships
36
 *  
33 37
 */
34
function theme_cdm_reference($reference, $linkToReference = FALSE, $style = NULL ){
38
function theme_cdm_reference($reference, $microReference = null, $doLink = FALSE, $referenceStyle = NULL ){
35 39

  
36 40
	$author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->uuid);
37
	if($style == "ZoologicalName"){
41
	if($style == "zoology"){
38 42
		$year = partialToYear($reference->datePublished->start);
39
		//$citation = $reference->authorTeam->titleCache.($year ? ', '.$year : '');
40 43
		$citation = $author_team->titleCache . ($year ? ', '.$year : '');
41 44
	} else {
42
		//$citation = $reference->titleCache;
43
		$citation = $author_team->titleCache;
45
		$citation = $reference->titleCache;
44 46
	}
45
	if($linkToReference){
46
		return l('<span class="reference">'.$citation.'</span>', "/cdm_dataportal/reference/".$reference->uuid, array("class"=>"reference"), NULL, NULL, FALSE ,TRUE);
47
	} else {
48
		return '<span class="reference">'.$citation.'</span>';
47
	if($doLink){
48
		$out = l('<span class="reference">'.$citation.'</span>'
49
          , path_to_reference($reference->uuid)
50
          , array("class"=>"reference")
51
          , NULL, NULL, FALSE ,TRUE);
52
    } else {
53
		$out = '<span class="reference">'.$citation.'</span>';
49 54
	}
55
    if(!empty($descriptionElementSource->citationMicroReference)){
56
        $out .= ': '. $descriptionElementSource->citationMicroReference;
57
     }
58
      
50 59
}
modules/cdm_dataportal/theme/cdm_dataportal.taxon.theme
124 124
	}
125 125
	$out .= '</ul>';
126 126
	
127
	$out .= theme('cdm_footnotes', $footnoteListKey, 'div');
128 127
    RenderHints::popFromRenderStack();
129 128
	return $out;
130 129
}

Also available in: Unified diff