Project

General

Profile

« Previous | Next » 

Revision 8e5c42d1

Added by Lorna Morris about 12 years ago

tidies up meta.xml and Views. Added views for all the different types.

View differences:

7.x/modules/dwca_export/dwca_export.module
151 151
				$description_map = $dwca_export_archive_descriptor_file_map[$description_key];
152 152
				//if (array_key_exists($key, $dwca_export_archive_descriptor_file_map['description'])) {
153 153
				if (array_key_exists($key, $description_map)) {
154
					drupal_set_message(t('The ooKEY is... ') . $key . t('The ooVALUE is... ') . $value);
154
					//drupal_set_message(t('The ooKEY is... ') . $key . t('The ooVALUE is... ') . $value);
155 155
					$dwca_export_archive_descriptor_file_map[$description_key][$key]['view_name'] = $value;
156 156
				}
157 157
			}
......
232 232

  
233 233
	if($file_name && $out_file_url){
234 234
		
235
		if (($file_name == 'general') || ($file_name == 'morphology')) {
236
			$file_map['description'][$file_name]['out_file_url'] = $out_file_url;
237
			//$file_map[$file_name]['morphology']['out_file_url'] = $out_file_url;
235
		//TODO: Change this - it's not very generic and will not work if we add new types to FILE_MAP
236
		if (($file_name == 'classification') || ($file_name == 'typesandspecimen') ||
237
				 ($file_name == 'reference') || ($file_name == 'image')) {
238
			
239
			$file_map[$file_name]['out_file_url'] = $out_file_url;
240
			
238 241
		} else {
239 242
		
240
		$file_map[$file_name]['out_file_url'] = $out_file_url;
243
			$file_map['description'][$file_name]['out_file_url'] = $out_file_url;
241 244
		}
242 245
	}
243 246

  
......
350 353
	$desc_file = fopen(drupal_realpath($desc_file_name), "w");
351 354

  
352 355
	$first_desc_file = true;
356
	drupal_set_message('CALLED _dwca_export_concatenate_description_files... ');
357
	
358
	
353 359
	foreach($view_data as $type=>$view_data_inner){
354 360

  
355 361
		$view_temp_file = $view_data_inner['out_file_url'];
356 362

  
357
		$theFile = fopen($view_temp_file, "r");
363
		$descTypeFile = fopen($view_temp_file, "r");
358 364

  
359 365
		//print column names from first file
360
		if ($first_desc_file) {
361
			$lineOfText = fgets($theFile);
362
			fputs($desc_file, $lineOfText);
366
		if ($first_desc_file === true) {
367
			$lineOfText = fgets($descTypeFile, 4096);
368
			fwrite($desc_file, $lineOfText);
363 369
			$first_desc_file = false;
370
			//drupal_set_message(t('FIRST desc file is true... '));
371
			//drupal_set_message(t('Setting desc file type to false... '));
364 372
		} else {
365
			fgets($theFile);
373
			fgets($descTypeFile, 4096);
366 374
		}
375
				
367 376

  
368
		while(!feof($theFile)){
369
			$lineOfText = fgets($theFile);
370
			print "$lineOfText<br />";
377
		while(!feof($descTypeFile)){
378
			$lineOfText = fgets($descTypeFile, 4096);
371 379

  
372 380
			$items = explode(',', $lineOfText);
373 381

  
374
			if (!empty($items[2])) {
382
			//don't include empty descriptions or lines at the end of the view which start with the field name id
383
			//if ($items[2]=="\"\""  || (!$items[0]=="\"id\"")) { //doesn't work - produces empty files
384
			if (!empty($items[2])  || (!$items[0]=="id")) {
375 385

  
376
				fputs($desc_file, $lineOfText);
377
				//add an end of line if there isn't one
386
				// fix conflict with files that have an EOL that differs from the server EOL
387
				$lineOfText = rtrim($lineOfText, "\r\n") . PHP_EOL;
388
				fwrite($desc_file, $lineOfText);
389
				
390
				//TODO: Fix - some descriptions are missing the closing "
378 391
				//if (!stripos(strrev($lineOfText), '"') === 0) {
379 392
				//fputs($desc_file, '"' . PHP_EOL);
380
				fputs($desc_file, PHP_EOL);
381
				//}
393
				
382 394
			} else {
383
				fgets($theFile);
395
				fgets($descTypeFile, 4096);
384 396
			}
385 397

  
386 398
		}
387 399

  
388
		fclose($theFile);
400
		fclose($descTypeFile);
389 401

  
390 402
		//currently also adding each individual desc type to archive
391 403
		_dwca_export_add_files_to_zip($view_temp_file, $type, $zip);

Also available in: Unified diff