Project

General

Profile

« Previous | Next » 

Revision 15f11e83

Added by Francisco Revilla almost 14 years ago

solving bug with taxon name page (related with drupal_go_to and synonyms/acceptedtaxon)

View differences:

modules/cdm_dataportal/cdm_dataportal.module
249 249
      'path' => 'cdm_dataportal/name/'.arg(2),
250 250
      //'callback' => 'cdm_dataportal_view_name',
251 251
		  'callback' => 'cdm_dataportal_name_page_view',
252
      'callback arguments' => array(arg(2)),
252
      'callback arguments' => array(arg(2), arg(3)),
253 253
      'access' => true,
254 254
      'type' => MENU_CALLBACK,
255 255
    );
......
1232 1232
 * @param $taxon_name_uuid A taxon name uuid
1233 1233
 * @return The formatted name page as node
1234 1234
 */
1235
function cdm_dataportal_name_page_view($taxon_name_uuid){
1236
  $taxonname_page = cdm_dataportal_name_view($taxon_name_uuid);
1235
function cdm_dataportal_name_page_view($taxon_name_uuid, $taxon_to_hide_uuid){
1236
  $taxonname_page = cdm_dataportal_name_view($taxon_name_uuid, $taxon_to_hide_uuid);
1237 1237
  return cdm_node_show(NODETYPE_NAME, $taxon_name_uuid, $taxonname_page->title , $taxonname_page->content);
1238 1238
}
1239 1239

  
......
1243 1243
 * @param $taxon_name_uuid
1244 1244
 * @return the object with the page content and title  
1245 1245
 */
1246
function cdm_dataportal_name_view($taxon_name_uuid){
1246
function cdm_dataportal_name_view($taxon_name_uuid, $taxon_to_hide_uuid){
1247 1247
	//getting the full taxonname object from the server  
1248 1248
  $taxon_name = cdm_ws_get(CDM_WS_NAME, array($taxon_name_uuid));
1249 1249
  if(!$taxon_name){
......
1259 1259
  $request_params['doSynonyms'] = 1;
1260 1260
  $request_params['doTaxaByCommonNames'] = 0;
1261 1261
  $request_params['matchMode'] = "EXACT";
1262
  //$taxon_pager = cdm_ws_get(CDM_WS_FIND_TAXA, null, queryString($request_params));
1263 1262
  $taxon_pager = cdm_ws_get(CDM_WS_PORTAL_TAXON_FIND, null, queryString($request_params));
1264 1263
  
1265
  if (sizeof($taxon_pager->records) == 1){
1266
  	drupal_goto('cdm_dataportal/taxon/' . $taxon_pager->records[0]->uuid);
1267
  }else{
1264
  //removing the name where we come from and 
1265
  foreach($taxon_pager->records as $k=>&$taxon){
1266
  	if($taxon->uuid == $taxon_to_hide_uuid){
1267
  		unset($taxon_pager->records[$k]);
1268
  	}
1269
  }
1270
 
1271
  //show the taxa list or go to the singular taxon
1272
  if (sizeof($taxon_pager->records) == 1){ //sigle taxon case
1273
  	reset($taxon_pager->records);
1274
  	$first_key = key($taxon_pager->records);
1275
    if($taxon_pager->records[$first_key]->class != "Taxon"){
1276
        $taxon = cdm_ws_get(CDM_WS_PORTAL_TAXON_ACCEPTED, $taxon_pager->records[$first_key]->uuid);
1277
        drupal_goto('cdm_dataportal/taxon/' . $taxon[0]->uuid);
1278
    }else{
1279
  	   drupal_goto('cdm_dataportal/taxon/' . $taxon_pager->records[$first_key]->uuid);
1280
    }
1281
  }else{ //more than one taxa case
1268 1282
    $taxon_name_page->title = theme('cdm_name_page_title', $taxon_name);
1269 1283
    if($taxon_pager->records){
1270 1284
      $taxon_name_page->content = theme_cdm_list_of_taxa($taxon_pager->records, false);
......
1273 1287
    }
1274 1288
    return $taxon_name_page; 
1275 1289
  }
1276
  
1277
  //_cdm_dataportal_set_currentSecUuid($taxon->sec->uuid);
1278
  
1279
  //generating the returned object
1280

  
1281 1290
}
1282 1291

  
1283 1292
function cdm_dataportal_view_search_advanced(){
modules/cdm_dataportal/theme/cdm_dataportal.name.theme
60 60
			$showCitation = isset($std->typeStatus) && ($std->typeStatus->uuid == UUID_NEOTYPE || $std->typeStatus->uuid == UUID_LECTOTYPE);
61 61
			if($showCitation && !empty($std->citation)){
62 62
				//$shortCitation = $std->citation->authorTeam->titleCache;
63
			  $author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $std->citation->uuid);
64
			  $shortCitation = $author_team->titleCache;
63

  
64
			     $author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $std->citation->uuid);
65
			     $shortCitation = $author_team->titleCache;
66

  
65 67
				$shortCitation .= (strlen($shortCitation) > 0 ? ' ' : '' ). partialToYear($std->citation->datePublished->start);
66 68
				if(strlen($shortCitation) == 0){
67 69
					$shortCitation = theme('cdm_reference', $std->citation);
modules/cdm_dataportal/theme/cdm_dataportal.references.theme
37 37
 */
38 38
function theme_cdm_reference($reference, $microReference = null, $doLink = FALSE, $referenceStyle = NULL ){
39 39

  
40
	$author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->uuid);
40
  $author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $reference->uuid);
41

  
41 42
	if($style == "zoology"){
42 43
		$year = partialToYear($reference->datePublished->start);
43 44
		$citation = $author_team->titleCache . ($year ? ', '.$year : '');
modules/cdm_dataportal/theme/cdm_dataportal.taxon.theme
82 82
		if(true || $taxonRelation->type->uuid == UUID_MISAPPLIED_NAME_FOR || $taxonRelation->type->uuid == UUID_INVALID_DESIGNATION_FOR ){
83 83

  
84 84
			$name = $taxonRelation->fromTaxon->name->titleCache;
85

  
85 86
			$author_team = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $taxonRelation->fromTaxon->sec->uuid);
86 87
			$authorteam = $author_team->titleCache;
87 88

  
......
253 254
    switch ($element->type->representation_L10n){
254 255
      case 'later homonym for':
255 256
        $later_homonym = ' [non ' . l($element->fromName->titleCache . ']', 
256
                                     'cdm_dataportal/name/' . $element->fromName->uuid);
257
                                     'cdm_dataportal/name/' . $element->fromName->uuid . '/' . $taxon->uuid);
257 258
        break;
258 259
    case 'treated as later homonym for':
259 260
        $later_homonym = ' [non ' . l($element->fromName->titleCache . ']', 

Also available in: Unified diff