version 1.158, 2006/05/31 17:44:14
|
version 1.160, 2006/07/19 15:31:05
|
Line 287 sub portfolio_linked_path {
|
Line 287 sub portfolio_linked_path {
|
if ($group) { |
if ($group) { |
$start = "groups/$group/".$start; |
$start = "groups/$group/".$start; |
} |
} |
my $result = &Apache::portfolio::make_anchor($port_path,$start,'/', |
my $result = &Apache::portfolio::make_anchor($port_path,$start,'/'); |
undef,undef,undef,$group); |
|
|
|
my $fullpath = '/'; |
my $fullpath = '/'; |
my (undef,@tree) = split('/',$path); |
my (undef,@tree) = split('/',$path); |
Line 296 sub portfolio_linked_path {
|
Line 295 sub portfolio_linked_path {
|
foreach my $dir (@tree) { |
foreach my $dir (@tree) { |
$fullpath .= $dir.'/'; |
$fullpath .= $dir.'/'; |
$result .= '/'; |
$result .= '/'; |
$result .= &Apache::portfolio::make_anchor($port_path,$dir,$fullpath, |
$result .= &Apache::portfolio::make_anchor($port_path,$dir,$fullpath); |
undef,undef,undef,$group); |
|
} |
} |
$result .= "/$filename"; |
$result .= "/$filename"; |
return $result; |
return $result; |
Line 316 sub get_port_path_and_group {
|
Line 314 sub get_port_path_and_group {
|
} else { |
} else { |
$port_path = '/adm/portfolio'; |
$port_path = '/adm/portfolio'; |
} |
} |
|
if ($env{'form.group'} ne $group) { |
|
$env{'form.group'} = $group) { |
|
} |
return ($port_path,$group); |
return ($port_path,$group); |
} |
} |
|
|
Line 1247 ENDEDIT
|
Line 1248 ENDEDIT
|
'<>&"'). |
'<>&"'). |
'</'.$tag.'>'; |
'</'.$tag.'>'; |
} |
} |
if ($fn =~ m|/portfolio/|) { |
if ($fn =~ m|^$Apache::lonnet::perlvar{'lonDocRoot'}/userfiles/portfolio/|) { |
my ($path, $new_fn) = ($fn =~ m|/(portfolio.*)/([^/]*)$|); |
my ($path, $new_fn) = ($fn =~ m|/(portfolio.*)/([^/]*)$|); |
$env{'form.'.$formname}=$file_content."\n"; |
$r->print(&store_portfolio_metadata($formname,$file_content,$path, |
$env{'form.'.$formname.'.filename'}=$new_fn; |
$new_fn)); |
my $result =&Apache::lonnet::userfileupload($formname,'', |
} elsif ($fn =~ m|^$Apache::lonnet::perlvar{'lonDocRoot'}/userfiles/groups/\w+/portfolio/|) { |
$path); |
my ($path, $new_fn) = ($fn =~ m|/(groups/\w+/portfolio.*)/([^/]*)$|); |
|
$r->print(&store_portfolio_metadata($formname,$file_content,$path,$new_fn)); |
if ($result =~ /(error|notfound)/) { |
|
$r->print('<p><font color="red">'. |
|
&mt('Could not write metadata').', '. |
|
&mt('FAIL').'</font></p>'); |
|
} else { |
|
$r->print('<p><font color="blue">'.&mt('Wrote Metadata'). |
|
' '.&Apache::lonlocal::locallocaltime(time). |
|
'</font></p>'); |
|
} |
|
} else { |
} else { |
if (! ($mfh=Apache::File->new('>'.$fn))) { |
if (! ($mfh=Apache::File->new('>'.$fn))) { |
$r->print('<p><font color="red">'. |
$r->print('<p><font color="red">'. |
Line 1282 ENDEDIT
|
Line 1274 ENDEDIT
|
|
|
if ($file_type eq 'portfolio') { |
if ($file_type eq 'portfolio') { |
my ($port_path,$group) = &get_port_path_and_group($uri); |
my ($port_path,$group) = &get_port_path_and_group($uri); |
|
if ($group) { |
|
$r->print('<input type="hidden" name="group" value="'.$group.'" />'); |
|
} |
$r->print('</form> |
$r->print('</form> |
<br /><br /><form method="POST" action="'.$port_path.'">'. |
<br /><br /><form method="POST" action="'.$port_path.'">'. |
'<input type="hidden" name="group" value="'.$group.'" />'. |
'<input type="hidden" name="group" value="'.$group.'" />'. |
Line 1295 ENDEDIT
|
Line 1290 ENDEDIT
|
return; |
return; |
} |
} |
|
|
|
sub store_portfolio_metadata { |
|
my ($formname,$content,$path,$new_fn) = @_; |
|
$env{'form.'.$formname}=$content."\n"; |
|
$env{'form.'.$formname.'.filename'}=$new_fn; |
|
my $result =&Apache::lonnet::userfileupload($formname,'',$path); |
|
if ($result =~ /(error|notfound)/) { |
|
return '<p><font color="red">'. |
|
&mt('Could not write metadata').', '. |
|
&mt('FAIL').'</font></p>'; |
|
} else { |
|
return '<p><font color="blue">'.&mt('Wrote Metadata'). |
|
' '.&Apache::lonlocal::locallocaltime(time).'</font></p>'; |
|
} |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |
|
|
|
|