version 1.169, 2004/05/21 20:17:56
|
version 1.172, 2004/06/11 20:11:06
|
Line 801 sub store_metadata {
|
Line 801 sub store_metadata {
|
&Apache::lonnet::logthis($error); |
&Apache::lonnet::logthis($error); |
return ($error,undef); |
return ($error,undef); |
} |
} |
|
my $dbh = &Apache::lonmysql::get_dbh(); |
if (($metadata{'obsolete'}) || ($metadata{'copyright'} eq 'priv') || |
if (($metadata{'obsolete'}) || ($metadata{'copyright'} eq 'priv') || |
($metadata{'copyright'} eq 'custom')) { |
($metadata{'copyright'} eq 'custom')) { |
# remove this entry |
# remove this entry |
$status=&Apache::lonmysql::remove_from_table |
$status=&LONCAPA::lonmetadata::delete_metadata($dbh,undef, |
('metadata','url',$metadata{'url'}); |
$metadata{'url'}); |
} else { |
} else { |
# store new data |
$status = &LONCAPA::lonmetadata::update_metadata($dbh,undef, |
# adjust some values to metadatadatabase (e.g., "usage" is a reserved word) |
\%metadata); |
$metadata{'creationdate'}= |
|
&Apache::lonmysql::sqltime($metadata{'creationdate'}); |
|
$metadata{'lastrevisiondate'}= |
|
&Apache::lonmysql::sqltime($metadata{'lastrevisiondate'}); |
|
$metadata{'sequsage'}=$metadata{'usage'}; |
|
$metadata{'sequsage_list'}=$metadata{'usage_list'}; |
|
my %newmetadata=(); |
|
# see if we have old entries |
|
my @oldmeta=&Apache::lonmysql::get_rows('metadata', |
|
"url LIKE BINARY '". |
|
$metadata{'url'}."'"); |
|
if ($#oldmeta==0) { |
|
# yes, there is one old entry, transfer to newmetadata |
|
%newmetadata=&LONCAPA::lonmetadata::metadata_col_to_hash(@{$oldmeta[0]}); |
|
# remove old entry |
|
$status=&Apache::lonmysql::remove_from_table |
|
('metadata','url',$metadata{'url'}); |
|
} elsif ($#oldmeta>0) { |
|
# more than one entry fit - how did that happen? |
|
$error='<font color="red">Error occured retrieving old values in '. |
|
'metadata table in LON-CAPA database: '.$#oldmeta. |
|
' matches</font>'; |
|
&Apache::lonnet::logthis($error); |
|
return ($error,undef); |
|
} |
|
# store new data on top of it |
|
foreach (keys %metadata) { |
|
$newmetadata{$_}=$metadata{$_}; |
|
} |
|
$status = &Apache::lonmysql::store_row('metadata',\%newmetadata); |
|
} |
} |
if (! defined($status)) { |
if (defined($status) && $status ne '') { |
$error='<font color="red">Error occured storing new values in '. |
$error='<font color="red">Error occured storing new values in '. |
'metadata table in LON-CAPA database</font>'; |
'metadata table in LON-CAPA database</font>'; |
&Apache::lonnet::logthis($error); |
&Apache::lonnet::logthis($error); |
|
&Apache::lonnet::logthis($status); |
return ($error,undef); |
return ($error,undef); |
} |
} |
return (undef,$status); |
return (undef,$status); |
Line 1259 END
|
Line 1231 END
|
$intr_scrout.=&textfield('Custom Distribution File','customdistributionfile', |
$intr_scrout.=&textfield('Custom Distribution File','customdistributionfile', |
$metadatafields{'customdistributionfile'}). |
$metadatafields{'customdistributionfile'}). |
$copyright_help; |
$copyright_help; |
|
$intr_scrout.=&selectbox('Source Distribution','sourceavail', |
|
$defaultoption, |
|
\&Apache::loncommon::source_copyrightdescription, |
|
(&Apache::loncommon::source_copyrightids)); |
|
$intr_scrout.=&textfield('Source Custom Distribution File','sourcerights', |
|
$metadatafields{'sourcerights'}); |
my $uctitle=&mt('Obsolete'); |
my $uctitle=&mt('Obsolete'); |
$intr_scrout.= |
$intr_scrout.= |
"\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:". |
"\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:". |
Line 1362 sub phasetwo {
|
Line 1340 sub phasetwo {
|
$metadatafields{'highestgradelevel'}=$ENV{'form.highestgradelevel'}; |
$metadatafields{'highestgradelevel'}=$ENV{'form.highestgradelevel'}; |
$metadatafields{'customdistributionfile'}= |
$metadatafields{'customdistributionfile'}= |
$ENV{'form.customdistributionfile'}; |
$ENV{'form.customdistributionfile'}; |
|
$metadatafields{'sourceavail'}=$ENV{'form.sourceavail'}; |
$metadatafields{'obsolete'}=$ENV{'form.obsolete'}; |
$metadatafields{'obsolete'}=$ENV{'form.obsolete'}; |
$metadatafields{'obsoletereplacement'}= |
$metadatafields{'obsoletereplacement'}= |
$ENV{'form.obsoletereplacement'}; |
$ENV{'form.obsoletereplacement'}; |
Line 1379 sub phasetwo {
|
Line 1358 sub phasetwo {
|
} |
} |
} |
} |
$allkeywords=~s/[\"\']//g; |
$allkeywords=~s/[\"\']//g; |
$allkeywords=~s/\s*[\;\,]\s*/\,/; |
$allkeywords=~s/\s*[\;\,]\s*/\,/g; |
$allkeywords=~s/\s+/ /g; |
$allkeywords=~s/\s+/ /g; |
$allkeywords=~s/^[ \,]//; |
$allkeywords=~s/^[ \,]//; |
$allkeywords=~s/[ \,]$//; |
$allkeywords=~s/[ \,]$//; |