version 1.162, 2006/08/04 19:42:55
|
version 1.169, 2006/08/16 18:02:01
|
Line 170 sub authordisplay {
|
Line 170 sub authordisplay {
|
my ($aname,$adom)=@_; |
my ($aname,$adom)=@_; |
return &Apache::loncommon::aboutmewrapper |
return &Apache::loncommon::aboutmewrapper |
(&Apache::loncommon::plainname($aname,$adom), |
(&Apache::loncommon::plainname($aname,$adom), |
$aname,$adom,'preview').' <tt>['.$aname.'@'.$adom.']</tt>'; |
$aname,$adom,'preview').' <tt>['.$aname.':'.$adom.']</tt>'; |
} |
} |
|
|
# Pretty display |
# Pretty display |
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 %anchor_fields = ( |
|
'selectfile' => $start, |
|
'currentpath' => '/' |
|
); |
|
my $result = &Apache::portfolio::make_anchor($port_path,\%anchor_fields,$start); |
my $fullpath = '/'; |
my $fullpath = '/'; |
my (undef,@tree) = split('/',$path); |
my (undef,@tree) = split('/',$path); |
my $filename = pop(@tree); |
my $filename = pop(@tree); |
foreach my $dir (@tree) { |
foreach my $dir (@tree) { |
$fullpath .= $dir.'/'; |
$fullpath .= $dir.'/'; |
$result .= '/'; |
$result .= '/'; |
$result .= &Apache::portfolio::make_anchor($port_path,$dir,$fullpath); |
my %anchor_fields = ( |
|
'selectfile' => $dir, |
|
'currentpath' => $fullpath |
|
); |
|
$result .= &Apache::portfolio::make_anchor($port_path,\%anchor_fields,$dir); |
} |
} |
$result .= "/$filename"; |
$result .= "/$filename"; |
return $result; |
return $result; |
Line 358 sub pre_select_course {
|
Line 365 sub pre_select_course {
|
$r->print('<p>'.&mt('If you would like to associate this resource ([_1]) with a current or previous course, please select one from the list below, otherwise select, \'None\'','<tt>'.$res_uri.'</tt>').'</p>'); |
$r->print('<p>'.&mt('If you would like to associate this resource ([_1]) with a current or previous course, please select one from the list below, otherwise select, \'None\'','<tt>'.$res_uri.'</tt>').'</p>'); |
$output = &select_course(); |
$output = &select_course(); |
$r->print($output.'<br /><input type="submit" name="store" value="'. |
$r->print($output.'<br /><input type="submit" name="store" value="'. |
&mt('Associate Resource With Selected Course').'">'); |
&mt('Associate Resource With Selected Course').'" />'); |
|
$r->print('<input type="hidden" name="currentpath" value="'.$env{'form.currentpath'}.'" />'); |
|
$r->print('<input type="hidden" name="associate" value="true" />'); |
$r->print('</form>'); |
$r->print('</form>'); |
|
|
my ($port_path,$group) = &get_port_path_and_group($uri); |
my ($port_path,$group) = &get_port_path_and_group($uri); |
$r->print('<br /><br /><form method="POST" action="'.$port_path.'">'. |
my $group_input; |
|
if ($group) { |
|
$group_input = '<input type="hidden" name="group" value="'.$group.'" />'; |
|
} |
|
$r->print('<br /><br /><form method="post" action="'.$port_path.'">'. |
'<input type="hidden" name="currentpath" value="'.$path.'" />'. |
'<input type="hidden" name="currentpath" value="'.$path.'" />'. |
'<input type="hidden" name="group" value="'.$group.'" />'. |
$group_input. |
'<input type="submit" name="cancel" value="'.&mt('Cancel').'">'. |
'<input type="submit" name="cancel" value="'.&mt('Cancel').'" />'. |
'</form>'); |
'</form>'); |
|
|
return; |
return; |
Line 707 sub prettyinput {
|
Line 720 sub prettyinput {
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
# |
# |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['currentpath']); |
my $uri=$r->uri; |
my $uri=$r->uri; |
# |
# |
# Set document type |
# Set document type |
Line 841 sub present_uneditable_metadata {
|
Line 856 sub present_uneditable_metadata {
|
if (! defined($title)) { |
if (! defined($title)) { |
$title = 'Untitled Resource'; |
$title = 'Untitled Resource'; |
} |
} |
foreach ('title', |
my @fields; |
'author', |
if ($uploaded) { |
'subject', |
@fields = ('title','author','subject','keywords','notes','abstract', |
'keywords', |
'lowestgradelevel','highestgradelevel','standards','mime', |
'notes', |
'owner'); |
'abstract', |
} else { |
'lowestgradelevel', |
@fields = ('title', |
'highestgradelevel', |
'author', |
'standards', |
'subject', |
'mime', |
'keywords', |
'language', |
'notes', |
'creationdate', |
'abstract', |
'lastrevisiondate', |
'lowestgradelevel', |
'owner', |
'highestgradelevel', |
'copyright', |
'standards', |
'customdistributionfile', |
'mime', |
'sourceavail', |
'language', |
'sourcerights', |
'creationdate', |
'obsolete', |
'lastrevisiondate', |
'obsoletereplacement') { |
'owner', |
$table.='<tr><td bgcolor="#AAAAAA">'.$lt{$_}. |
'copyright', |
|
'customdistributionfile', |
|
'sourceavail', |
|
'sourcerights', |
|
'obsolete', |
|
'obsoletereplacement'); |
|
} |
|
foreach my $field (@fields) { |
|
$table.='<tr><td bgcolor="#AAAAAA">'.$lt{$field}. |
'</td><td bgcolor="#CCCCCC">'. |
'</td><td bgcolor="#CCCCCC">'. |
&prettyprint($_,$content{$_}).'</td></tr>'; |
&prettyprint($field,$content{$field}).'</td></tr>'; |
delete $content{$_}; |
delete($content{$field}); |
} |
} |
# |
# |
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
Line 1124 sub present_editable_metadata {
|
Line 1147 sub present_editable_metadata {
|
my $goback=&mt('Back to Source File'); |
my $goback=&mt('Back to Source File'); |
$r->print(<<ENDBOMBS); |
$r->print(<<ENDBOMBS); |
<h1>$disuri</h1> |
<h1>$disuri</h1> |
<form method="post" name="defaultmeta"> |
<form method="post" action="" name="defaultmeta"> |
ENDBOMBS |
ENDBOMBS |
if ($showdel) { |
if ($showdel) { |
$r->print(<<ENDDEL); |
$r->print(<<ENDDEL); |
Line 1154 ENDDEL
|
Line 1177 ENDDEL
|
} |
} |
$r->print(<<ENDEDIT); |
$r->print(<<ENDEDIT); |
<h1>$displayfile</h1> |
<h1>$displayfile</h1> |
<form method="post" name="defaultmeta"> |
<form method="post" action="" name="defaultmeta"> |
ENDEDIT |
ENDEDIT |
$r->print('<script language="JavaScript">'. |
$r->print('<script type="JavaScript">'. |
&Apache::loncommon::browser_and_searcher_javascript(). |
&Apache::loncommon::browser_and_searcher_javascript(). |
'</script>'); |
'</script>'); |
my %lt=&fieldnames($file_type); |
my %lt=&fieldnames($file_type); |
my $output; |
my $output; |
my @fields; |
my @fields; |
if ($file_type eq 'portfolio') { |
if ($file_type eq 'portfolio') { |
@fields = ('author','title','subject','keywords','abstract','notes','lowestgradelevel', |
@fields = ('author','title','subject','keywords','abstract', |
|
'notes','lowestgradelevel', |
'highestgradelevel','standards'); |
'highestgradelevel','standards'); |
} else { |
} else { |
@fields = ('author','title','subject','keywords','abstract','notes', |
@fields = ('author','title','subject','keywords','abstract','notes', |
Line 1182 ENDEDIT
|
Line 1206 ENDEDIT
|
} |
} |
if (! $Apache::lonpublisher::metadatafields{'copyright'}) { |
if (! $Apache::lonpublisher::metadatafields{'copyright'}) { |
$Apache::lonpublisher::metadatafields{'copyright'}= |
$Apache::lonpublisher::metadatafields{'copyright'}= |
'default'; |
'default'; |
} |
} |
if ($file_type eq 'portfolio') { |
if ($file_type eq 'portfolio') { |
|
if (! $Apache::lonpublisher::metadatafields{'mime'}) { |
|
($Apache::lonpublisher::metadatafields{'mime'}) = |
|
( $target=~/\.(\w+)$/ ); |
|
} |
|
if (! $Apache::lonpublisher::metadatafields{'owner'}) { |
|
$Apache::lonpublisher::metadatafields{'owner'} = |
|
$env{'user.name'}.':'.$env{'user.domain'}; |
|
} |
|
|
if ($Apache::lonpublisher::metadatafields{'courserestricted'} ne 'none') { |
if ($Apache::lonpublisher::metadatafields{'courserestricted'} ne 'none') { |
$r->print(&mt('Associated with course [_1]','<strong>'.$env{$Apache::lonpublisher::metadatafields{'courserestricted'}.".description"}. |
$r->print(&mt('Associated with course [_1]','<strong>'.$env{$Apache::lonpublisher::metadatafields{'courserestricted'}.".description"}. |
'</strong>').'<br />'); |
'</strong>').'<br />'); |
Line 1253 ENDEDIT
|
Line 1286 ENDEDIT
|
if ($fn =~ m|^$Apache::lonnet::perlvar{'lonDocRoot'}/userfiles/portfolio/|) { |
if ($fn =~ m|^$Apache::lonnet::perlvar{'lonDocRoot'}/userfiles/portfolio/|) { |
my ($path, $new_fn) = ($fn =~ m|/(portfolio.*)/([^/]*)$|); |
my ($path, $new_fn) = ($fn =~ m|/(portfolio.*)/([^/]*)$|); |
$r->print(&store_portfolio_metadata($formname,$file_content,$path, |
$r->print(&store_portfolio_metadata($formname,$file_content,$path, |
$new_fn)); |
$new_fn)); |
|
unless ($env{'form.associate'}) { |
|
$r->print(&Apache::portfolio::done("return",'/adm/portfolio')); |
|
return; |
|
} |
} elsif ($fn =~ m|^$Apache::lonnet::perlvar{'lonDocRoot'}/userfiles/groups/\w+/portfolio/|) { |
} elsif ($fn =~ m|^$Apache::lonnet::perlvar{'lonDocRoot'}/userfiles/groups/\w+/portfolio/|) { |
my ($path, $new_fn) = ($fn =~ m|/(groups/\w+/portfolio.*)/([^/]*)$|); |
my ($path, $new_fn) = ($fn =~ m|/(groups/\w+/portfolio.*)/([^/]*)$|); |
$r->print(&store_portfolio_metadata($formname,$file_content,$path,$new_fn)); |
$r->print(&store_portfolio_metadata($formname,$file_content,$path,$new_fn)); |
|
unless ($env{'form.associate'}) { |
|
$r->print(&Apache::portfolio::done("return",'/adm/portfolio')); |
|
return; |
|
} |
} 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 1268 ENDEDIT
|
Line 1309 ENDEDIT
|
' '.&Apache::lonlocal::locallocaltime(time). |
' '.&Apache::lonlocal::locallocaltime(time). |
'</font></p>'); |
'</font></p>'); |
} |
} |
|
unless ($env{'form.associate'}) { |
|
$r->print(&Apache::portfolio::done("return",'/adm/portfolio')); |
|
return; |
|
} |
} |
} |
} |
} |
|
|
$r->print($output.'<br /><input type="submit" name="store" value="'. |
$r->print($output.'<br /><input type="submit" name="store" value="'. |
&mt('Store Catalog Information').'">'); |
&mt('Store Catalog Information').'" />'); |
|
|
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) { |
if ($group) { |
$r->print('<input type="hidden" name="group" value="'.$group.'" />'); |
$r->print('<input type="hidden" name="group" value="'.$group.'" />'); |
} |
} |
|
$r->print('<input type="hidden" name="currentpath" value="'.$env{'form.currentpath'}.'" />'); |
$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.'" />'. |
'<input type="hidden" name="currentpath" value="'.$path.'" />'. |
'<input type="hidden" name="currentpath" value="'.$path.'" />'. |
'<input type="submit" name="cancel" value="'.&mt('Discard Edits and Return to Portfolio').'">'); |
'<input type="submit" name="cancel" value="'.&mt('Discard Edits and Return to Portfolio').'" />'); |
} |
} |
} |
} |
|
|