Project

General

Profile

« Previous | Next » 

Revision 2264b60d

Added by Andreas Kohlbecker about 13 years ago

displaying polytomous keys (fixes #2152)

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
317 317
 */
318 318
function cdm_compose_url($uri_pattern, $pathParameters = array(), $query = NULL ){
319 319

  
320
	if(!isset($pathParameters)){
321
		$pathParameters = array();
322
	}
323

  
320 324
  $request_params = '';
321 325
  $path_params = '';
322 326

  
......
332 336

  
333 337
  $i = 0;
334 338
  while(strpos($uri_pattern, "$".$i) !== FALSE){
335
    if(count($pathParameters) <= $i && user_access('administer')){
336
      drupal_set_message('cdm_compose_url(): missing pathParameters', 'debug');
339
    if(count($pathParameters) <= $i){
340
    	if(user_access('administer')){
341
        drupal_set_message('cdm_compose_url(): missing pathParameters', 'debug');
342
    	}
343
      break;
337 344
    }
338 345
    $uri_pattern = str_replace("$".$i, rawurlencode($pathParameters[$i]), $uri_pattern);
339 346
    ++$i;
......
494 501
        case 'CategoricalData':
495 502
        	$ws_base_uri = CDM_WS_DESCRIPTIONELEMENT;
496 503
        	break;
504
        case 'PolytomousKey':
505
        case 'MediaKey':
506
        case 'MultiAccessKey':
507
          $ws_base_uri = CDM_WS_IDENTIFICATIONKEY;
508
          break;
497 509
        default:  trigger_error('Unsupported CDM Class - no annotations available for ' . $cdmBase->class, E_USER_ERROR);
498 510
            return;
499 511
    }
......
727 739
  $is_cdm_ws_uri = _is_cdm_ws_uri($uri);
728 740
  $use_cacheL2 = variable_get('cdm_webservice_cache', 1);
729 741

  
730
  $cacheL1_obj = $cacheL1[$uri];
742
  if(array_key_exists($uri, $cacheL1)){
743
    $cacheL1_obj = $cacheL1[$uri];
744
  }
731 745
  //print $cacheL1_obj;
732 746
  $set_cacheL1 = false;
733 747
  if($is_cdm_ws_uri && !$cacheL1_obj){
......
835 849

  
836 850
function cdm_load_obj($datastr){
837 851

  
838
  // NOTICE: the cdm dataportal currently does not support xml so the line below are commented out
839
  /*
840
   // if the web service delivers XML convert it into json
841
   if(variable_get('cdm_webservice_type', 'json') == 'xml'){
842
   $datastr = xml2json::transformXmlStringToJson($datastr);
843
   }
844
   */
845

  
846 852
  $obj = json_decode($datastr);
847 853

  
848 854
  if(!(is_object($obj) || is_array($obj)) ){
......
869 875
  static $acceptLanguage = null;
870 876

  
871 877
  if(!$acceptLanguage) {
872
  	$headers = getallheaders();
873
  	if($headers['Accept-Language']){
874
  		$acceptLanguage = $headers['Accept-Language'];
875
  	} else {
878
  	if(function_exists('apache_request_headers')){
879
  		$headers = apache_request_headers();
880
	  	if($headers['Accept-Language']){
881
	  		$acceptLanguage = $headers['Accept-Language'];
882
	  	}
883
  	}
884
  	if( !$acceptLanguage ) {
876 885
  		$acceptLanguage = "en"; // DEFAULT TODO make configurable
877 886
  	}
878 887
  }

Also available in: Unified diff