version 1.25, 2007/12/07 22:31:08
|
version 1.31, 2011/05/29 19:10:10
|
Line 356 sub create_metadata_storage {
|
Line 356 sub create_metadata_storage {
|
$col_des.="(".$coldata->{'size'}.")"; |
$col_des.="(".$coldata->{'size'}.")"; |
} |
} |
} |
} |
|
if (($tablename =~ /allusers/) && ($column eq 'username')) { |
|
$col_des .= ' CHARACTER SET latin1 COLLATE latin1_general_cs'; |
|
} |
# Modifiers |
# Modifiers |
if (exists($coldata->{'restrictions'})){ |
if (exists($coldata->{'restrictions'})){ |
$col_des.=" ".$coldata->{'restrictions'}; |
$col_des.=" ".$coldata->{'restrictions'}; |
Line 935 sub process_dynamic_metadata {
|
Line 938 sub process_dynamic_metadata {
|
} |
} |
# |
# |
# put together comments |
# put together comments |
my $comments = '<div class="LCevalcomments">'; |
my $comments = ''; |
foreach my $evaluator (keys(%{$resdata->{'evaluation'}->{'comments'}})){ |
foreach my $evaluator (keys(%{$resdata->{'evaluation'}->{'comments'}})){ |
$comments .= |
$comments .= |
'<p>'. |
'<p>'. |
'<b>'.$evaluator.'</b>:'. |
'<b>'.$evaluator.'</b>: '. |
$resdata->{'evaluation'}->{'comments'}->{$evaluator}. |
$resdata->{'evaluation'}->{'comments'}->{$evaluator}. |
'</p>'; |
'</p>'; |
} |
} |
$comments .= '</div>'; |
if ($comments) { |
$data{'comments'} = $comments; |
$comments = '<div class="LCevalcomments">' |
|
.$comments |
|
.'</div>'; |
|
$data{'comments'} = $comments; |
|
} |
# |
# |
if (exists($resdata->{'stats'})) { |
if (exists($resdata->{'stats'})) { |
$data{'stats'} = $resdata->{'stats'}; |
$data{'stats'} = $resdata->{'stats'}; |
Line 1076 sub process_portfolio_access_data {
|
Line 1083 sub process_portfolio_access_data {
|
($key =~ /^([^:]+):([a-z]+)_(\d*)_?(\d*)$/); |
($key =~ /^([^:]+):([a-z]+)_(\d*)_?(\d*)$/); |
next if (($scope ne 'public') && ($scope ne 'guest')); |
next if (($scope ne 'public') && ($scope ne 'guest')); |
$acc_data->{scope} = $scope; |
$acc_data->{scope} = $scope; |
|
my $sqltime_error; |
if ($end != 0) { |
if ($end != 0) { |
$acc_data->{end} = &sqltime($end); |
$acc_data->{end} = &sqltime($end,\$sqltime_error); |
|
} |
|
$acc_data->{start} = &sqltime($start,\$sqltime_error); |
|
if ($sqltime_error) { |
|
$loghash{$key}{'err'} = $sqltime_error; |
} |
} |
$acc_data->{start} = &sqltime($start); |
|
if (! $simulate) { |
if (! $simulate) { |
my ($count,$err) = |
my ($count,$err) = |
&store_metadata($dbh,$newnames->{'access'}, |
&store_metadata($dbh,$newnames->{'access'}, |
Line 1123 sub process_portfolio_metadata {
|
Line 1134 sub process_portfolio_metadata {
|
if (-e $fullpath) { |
if (-e $fullpath) { |
my ($ref,$crs,$addedfields) = &portfolio_metadata($fullpath,$dom,$uname, |
my ($ref,$crs,$addedfields) = &portfolio_metadata($fullpath,$dom,$uname, |
$group); |
$group); |
&getfiledates($ref,$fullpath); |
my $sqltime_error; |
|
&getfiledates($ref,$fullpath,\$sqltime_error); |
if ($is_course) { |
if ($is_course) { |
$ref->{'groupname'} = $group; |
$ref->{'groupname'} = $group; |
} |
} |
Line 1138 sub process_portfolio_metadata {
|
Line 1150 sub process_portfolio_metadata {
|
); |
); |
my %loghash; |
my %loghash; |
if (! $simulate) { |
if (! $simulate) { |
|
if ($sqltime_error) { |
|
$loghash{'metadata'."\0"}{'err'} = $sqltime_error; |
|
} |
my ($count,$err) = |
my ($count,$err) = |
&store_metadata($dbh,$newnames->{'portfolio'},'portfolio_metadata', |
&store_metadata($dbh,$newnames->{'portfolio'},'portfolio_metadata', |
\%Data); |
\%Data); |
Line 1229 sub getfile {
|
Line 1244 sub getfile {
|
} |
} |
|
|
## |
## |
## &getfiledates() |
## &getfiledates($ref,$target,$sqltime_error) |
## Converts creationdate and modifieddates to SQL format |
## Converts creationdate and modifieddates to SQL format |
## Applies stat() to file to retrieve dates if missing |
## Applies stat() to file to retrieve dates if missing |
sub getfiledates { |
sub getfiledates { |
my ($ref,$target) = @_; |
my ($ref,$target,$sqltime_error) = @_; |
if (! defined($ref->{'creationdate'}) || |
if (! defined($ref->{'creationdate'}) || |
$ref->{'creationdate'} =~ /^\s*$/) { |
$ref->{'creationdate'} =~ /^\s*$/) { |
$ref->{'creationdate'} = (stat($target))[9]; |
$ref->{'creationdate'} = (stat($target))[9]; |
Line 1242 sub getfiledates {
|
Line 1257 sub getfiledates {
|
$ref->{'lastrevisiondate'} =~ /^\s*$/) { |
$ref->{'lastrevisiondate'} =~ /^\s*$/) { |
$ref->{'lastrevisiondate'} = (stat($target))[9]; |
$ref->{'lastrevisiondate'} = (stat($target))[9]; |
} |
} |
$ref->{'creationdate'} = &sqltime($ref->{'creationdate'}); |
$ref->{'creationdate'} = &sqltime($ref->{'creationdate'},$sqltime_error); |
$ref->{'lastrevisiondate'} = &sqltime($ref->{'lastrevisiondate'}); |
$ref->{'lastrevisiondate'} = &sqltime($ref->{'lastrevisiondate'},$sqltime_error); |
} |
} |
|
|
## |
## |
## &sqltime($timestamp) |
## &sqltime($timestamp,$sqltime_error) |
## |
## |
## Convert perl $timestamp to MySQL time. MySQL expects YYYY-MM-DD HH:MM:SS |
## Convert perl $timestamp to MySQL time. MySQL expects YYYY-MM-DD HH:MM:SS |
## |
## |
sub sqltime { |
sub sqltime { |
my ($time) = @_; |
my ($time,$sqltime_error) = @_; |
my $mysqltime; |
my $mysqltime; |
if ($time =~ |
if ($time =~ |
/(\d+)-(\d+)-(\d+) # YYYY-MM-DD |
/(\d+)-(\d+)-(\d+) # YYYY-MM-DD |
Line 1275 sub sqltime {
|
Line 1290 sub sqltime {
|
} elsif (! defined($time) || $time == 0) { |
} elsif (! defined($time) || $time == 0) { |
$mysqltime = 0; |
$mysqltime = 0; |
} else { |
} else { |
&log(0," sqltime:Unable to decode time ".$time); |
if (ref($sqltime_error) eq 'SCALAR') { |
|
$$sqltime_error = "sqltime:Unable to decode time ".$time; |
|
} |
$mysqltime = 0; |
$mysqltime = 0; |
} |
} |
return $mysqltime; |
return $mysqltime; |