Project

General

Profile

« Previous | Next » 

Revision 2644

Added by sgarg about 19 years ago

Fix for bug 2220. And check the cfg file if the eml documents generated should be publically readable or not.

View differences:

src/perl/register-dataset.cgi
84 84
$config->define("hasMethod", { DEFAULT => 'true'} );
85 85
$config->define("temporalRequired", { DEFAULT => 'true'} );
86 86
$config->define("spatialRequired", { DEFAULT => 'true'} );
87
$config->define("publicReadable", { DEFAULT => 'true'} );
87 88
$config->define("mailhost");
88 89
$config->define("sender");
89 90
$config->define("recipient");
......
141 142
my $hasMethod = $config->hasMethod();
142 143
my $temporalRequired = $config->temporalRequired();
143 144
my $spatialRequired = $config->spatialRequired();
145
my $publicReadable = $config->publicReadable();
144 146
my $mailhost = $config->mailhost();
145 147
my $sender = $config->sender();
146 148
my $recipient = $config->recipient();
......
599 601
    push(@invalidParams, "Geographic description is missing.")
600 602
        unless (hasContent($FORM::geogdesc) || $FORM::spatialRequired ne 'true');
601 603

  
602
    if($FORM::beginningMonth eq "00"){
603
	if (hasContent($FORM::beginningYear)){
604
	    $FORM::beginningMonth = "01";
605
	} else {
604
    if($FORM::beginningMonth eq "MM"){
605
	#if (hasContent($FORM::beginningYear)){
606
	#    $FORM::beginningMonth = "01";
607
	#} else {
606 608
	    $FORM::beginningMonth = "";
607
	}
609
	#}
608 610
    }
609
    if($FORM::beginningDay eq "00"){
610
	if (hasContent($FORM::beginningYear)){
611
	    $FORM::beginningDay = "01";
612
	} else {
611
    if($FORM::beginningDay eq "DD"){
612
	#if (hasContent($FORM::beginningYear)){
613
	#    $FORM::beginningDay = "01";
614
	#} else {
613 615
	    $FORM::beginningDay = "";
614
	}
616
	#}
615 617
    }
616
    if($FORM::endingMonth eq "00"){
617
	if (hasContent($FORM::endingYear)){
618
	    $FORM::endingMonth = "01";
619
	} else {
618
    if($FORM::endingMonth eq "MM"){
619
	#if (hasContent($FORM::endingYear)){
620
	#    $FORM::endingMonth = "01";
621
	#} else {
620 622
	    $FORM::endingMonth = "";
621
	}
623
	#}
622 624
    }    
623
    if($FORM::endingDay eq "00"){
624
	if (hasContent($FORM::endingYear)){
625
	    $FORM::endingDay = "01";
626
	} else {
625
    if($FORM::endingDay eq "DD"){
626
	#if (hasContent($FORM::endingYear)){
627
	#    $FORM::endingDay = "01";
628
	#} else {
627 629
	    $FORM::endingDay = "";
628
	}
630
	#}
629 631
    }
630 632

  
631 633
    if (hasContent($FORM::beginningYear) && !($FORM::beginningYear =~ /[0-9][0-9][0-9][0-9]/)){
......
1217 1219
	    my $month = ("JAN","FEB","MAR","APR","MAY","JUN",
1218 1220
			 "JUL","AUG","SEP","OCT","NOV","DEC")
1219 1221
		[$FORM::beginningMonth - 1];
1220
	    $cov .= "<beginDate>\n";
1221
	    $cov .= "<calendarDate>";
1222
	    $cov .= normalize($FORM::beginningYear)."-".normalize($FORM::beginningMonth)."-".normalize($FORM::beginningDay);
1223
	    $cov .= "</calendarDate>\n";
1224
	    $cov .= "</beginDate>\n";
1222
	    if (hasContent($FORM::beginningDay)) {
1223
	    	$cov .= "<beginDate>\n";
1224
	    	$cov .= "<calendarDate>";
1225
	    	$cov .= normalize($FORM::beginningYear)."-".normalize($FORM::beginningMonth)."-".normalize($FORM::beginningDay);
1226
	    	$cov .= "</calendarDate>\n";
1227
	    	$cov .= "</beginDate>\n";
1228
	    } else {
1229
	    	$cov .= "<beginDate>\n";
1230
	    	$cov .= "<calendarDate>";
1231
	    	$cov .= normalize($FORM::beginningYear)."-".normalize($FORM::beginningMonth)."-01";
1232
	    	$cov .= "</calendarDate>\n";
1233
	    	$cov .= "</beginDate>\n";
1234
	    }
1225 1235
	} else {
1226 1236
	    $cov .= "<beginDate>\n";
1227 1237
	    $cov .= "<calendarDate>";
......
1234 1244
	    my $month = ("JAN","FEB","MAR","APR","MAY","JUN",
1235 1245
			 "JUL","AUG","SEP","OCT","NOV","DEC")
1236 1246
		[$FORM::endingMonth - 1];
1237
	    $cov .= "<endDate>\n";
1238
	    $cov .= "<calendarDate>";
1239
	    $cov .= normalize($FORM::endingYear)."-".normalize($FORM::endingMonth)."-".normalize($FORM::endingDay);
1240
	    $cov .= "</calendarDate>\n";
1241
	    $cov .= "</endDate>\n";
1247
	
1248
	    if (hasContent($FORM::endingDay)) {
1249
	    	$cov .= "<endDate>\n";
1250
	    	$cov .= "<calendarDate>";
1251
	    	$cov .= normalize($FORM::endingYear)."-".normalize($FORM::endingMonth)."-".normalize($FORM::endingDay);
1252
	    	$cov .= "</calendarDate>\n";
1253
	    	$cov .= "</endDate>\n";
1254
	    } else {
1255
	    	$cov .= "<endDate>\n";
1256
	    	$cov .= "<calendarDate>";
1257
	    	$cov .= normalize($FORM::endingYear)."-".normalize($FORM::endingMonth)."-01";
1258
	    	$cov .= "</calendarDate>\n";
1259
	    	$cov .= "</endDate>\n";
1260
	    }
1242 1261
	} else {
1243 1262
	    $cov .= "<endDate>\n";
1244 1263
	    $cov .= "<calendarDate>";
......
1256 1275
		my $month = ("JAN","FEB","MAR","APR","MAY","JUN",
1257 1276
			     "JUL","AUG","SEP","OCT","NOV","DEC")
1258 1277
		    [$FORM::beginningMonth - 1];
1259
		$cov .= "<calendarDate>";
1260
		$cov .= normalize($FORM::beginningYear)."-".normalize($FORM::beginningMonth)."-".normalize($FORM::beginningDay);
1261
		$cov .= "</calendarDate>\n";
1278
		
1279
	    	if (hasContent($FORM::beginningDay)) {
1280
		   $cov .= "<calendarDate>";
1281
		   $cov .= normalize($FORM::beginningYear)."-".normalize($FORM::beginningMonth)."-".normalize($FORM::beginningDay);
1282
		   $cov .= "</calendarDate>\n";
1283
		} else {
1284
		   $cov .= "<calendarDate>";
1285
		   $cov .= normalize($FORM::beginningYear)."-".normalize($FORM::beginningMonth)."-01";
1286
		   $cov .= "</calendarDate>\n";
1287
		}
1262 1288
	    } else {
1263 1289
		$cov .= "<calendarDate>";
1264 1290
		$cov .= normalize($FORM::beginningYear);
......
1399 1425
    $doc .= "<principal>uid=$FORM::username,o=$FORM::organization,dc=ecoinformatics,dc=org</principal>\n";
1400 1426
    $doc .= "<permission>all</permission>\n";
1401 1427
    $doc .= "</allow>\n";
1402
    $doc .= "<allow>\n";
1403
    $doc .= "<principal>public</principal>\n";
1404
    $doc .= "<permission>read</permission>\n";
1405
    $doc .= "</allow>\n";
1428
    if($publicReadable eq "true"){
1429
    	$doc .= "<allow>\n";
1430
    	$doc .= "<principal>public</principal>\n";
1431
    	$doc .= "<permission>read</permission>\n";
1432
    	$doc .= "</allow>\n";
1433
    }
1406 1434
    $doc .= "</access>\n";
1407 1435
    
1408 1436
    $doc .= "</dataset>\n</eml:eml>\n";

Also available in: Unified diff