File:  [LON-CAPA] / nsdl / harvestsmete / OAIvocabulary.pm
Revision 1.1: download - view: text, annotated - select for diffs
Thu May 8 16:37:31 2003 UTC (21 years ago) by www
Branches: MAIN
CVS tags: HEAD
SMETE side harvest code for LON-CAPA

    1: #!/usr/local/bin/perl -w
    2: 
    3: use strict;
    4: 
    5: sub OAIv_findPlatform {
    6: 	my $platform = shift @_;
    7: 	chomp $platform;
    8: 
    9: 	# Default Platform Type is 6-Other
   10: 	my $platformType = "6-Other";
   11: 
   12: 	# If multiple platforms match, it's cross platform
   13: 	my $isCrossPlatform;
   14: 	$isCrossPlatform=0;
   15: 
   16: 	if ( $platform =~ /^(.*)HTML Browser(.*)$/ ) {
   17: 		$platformType="5-WWW";
   18: 		$isCrossPlatform=$isCrossPlatform+1;
   19: 	}
   20: 	if ( $platform =~ /^(.*)Java Virtual Machine(.*)$/ ) {
   21: 		$platformType="8-Java";
   22: 		$isCrossPlatform=$isCrossPlatform+1;
   23: 	}
   24: 	if ( $platform =~ /^(.*)PC(.*)$/ ) {
   25: 		$platformType="3-PC";
   26: 		$isCrossPlatform=$isCrossPlatform+1;
   27: 	}
   28: 	if ( $platform =~ /^(.*)Sun Sparc(.*)$/ ) {
   29: 		$platformType="7-UNIX";
   30: 		$isCrossPlatform=$isCrossPlatform+1;
   31: 	}
   32: 	if ( $platform =~ /^(.*)SGI(.*)$/ ) {
   33: 		$platformType="7-UNIX";
   34: 		$isCrossPlatform=$isCrossPlatform+1;
   35: 	}
   36: 	if ( $platform =~ /^(.*)HP(.*)$/ ) {
   37: 		$platformType="7-UNIX";
   38: 		$isCrossPlatform=$isCrossPlatform+1;
   39: 	}
   40: 
   41: 	if ( $isCrossPlatform >= 2 ) {
   42: 		$platformType="1-Cross-Platform";
   43: 	}
   44: 
   45: 	return $platformType;
   46: }
   47: 
   48: sub OAIv_findLContext () {
   49: 	my @gradelevels;
   50: 	foreach my $grade (@_) {
   51: 		if ( $grade eq "Higher Education" ) {
   52: 			push(@gradelevels,"13","14","15","16");
   53: 		} elsif ( $grade eq "Secondary Education" ) {
   54: 			push(@gradelevels,"9","10","11","12");
   55: 		} else {
   56: 		}
   57: 	}
   58: 	return join(";", @gradelevels);
   59: }
   60: 
   61: sub OAIv_parseVcard () {
   62: # Sample
   63: #BEGIN:vCard
   64: #FN:Steve Hayes           
   65: #N:Hayes;Steve      
   66: #EMAIL;INTERNET:shayes@vt.edu  
   67: #ORG:Virginia Tech;Computer Science
   68: #END:vCard
   69: 	my $firstname;
   70: 	my $lastname;
   71: 	my $email;
   72: 	my $org;
   73: 	my @pdi;
   74: 
   75: 	my @vcard = split /\n/, shift(@_);
   76: 	foreach my $element (@vcard) {
   77: 		chomp $element;
   78: 		my ($property,$value) = split /:/, $element;
   79: 		next if ! defined $property;
   80: 		if ( $property eq "FN" ) {
   81: 			($firstname,$lastname) = split / /, $value;
   82: 		} elsif ( $property eq "EMAIL;INTERNET" ) {
   83: 			$email = $value;
   84: 		} elsif ( $property eq "ORG" ) {
   85: 			$org = $value;
   86: 		}
   87: 	}
   88: 
   89: 	push(@pdi,$lastname, $firstname, $email, $org);
   90: 	return @pdi;
   91: }
   92: 
   93: return 1;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>