version 1.136, 2005/12/09 23:49:45
|
version 1.137, 2005/12/13 11:52:37
|
Line 291 sub fieldnames {
|
Line 291 sub fieldnames {
|
} |
} |
|
|
sub select_course { |
sub select_course { |
my ($r)=@_; |
|
my %courses; |
my %courses; |
|
my $output; |
foreach my $key (keys (%env)) { |
foreach my $key (keys (%env)) { |
if ($key =~ m/\.metadata\./) { |
if ($key =~ m/\.metadata\./) { |
$key =~ m/^course\.(.+)(\.metadata.+$)/; |
$key =~ m/^course\.(.+)(\.metadata.+$)/; |
Line 302 sub select_course {
|
Line 302 sub select_course {
|
$courses{$coursekey} = $value; |
$courses{$coursekey} = $value; |
} |
} |
} |
} |
$r->print('<h3>Associate resource with a course</h3><br />'); |
$output = '<h3>Associate resource with a course</h3><br />'; |
$r->print('<form action="" method="post">'); |
$output .= '<form action="" method="post">'; |
$r->print('Select course <br />'); |
$output .= 'Select course <br />'; |
$r->print('<select name="metacourse" >'); |
$output .= '<select name="metacourse" >'; |
my $meta_not_found = 1; |
my $meta_not_found = 1; |
foreach my $key (keys (%courses)) { |
foreach my $key (keys (%courses)) { |
if ($meta_not_found) { |
if ($meta_not_found) { |
undef($meta_not_found); |
undef($meta_not_found); |
$r->print('<h3>Portfolio Meta-Data</h3><br />'); |
$output .= '<h3>Portfolio Meta-Data</h3><br />'; |
$r->print('<form action="" method="post">'); |
$output .= '<form action="" method="post">'; |
$r->print('Select your course<br />'); |
$output .= 'Select your course<br />'; |
$r->print('<select name="metacourse" >'); |
$output .= '<select name="metacourse" >'; |
} |
} |
$key =~ m/(^.+)\.description$/; |
$key =~ m/(^.+)\.description$/; |
$r->print('<option value="'.$1.'">'); |
$output .= '<option value="'.$1.'">'; |
$r->print($courses{$key}); |
$output .= $courses{$key}; |
$r->print('</option>'); |
$output .= '</option>'; |
} |
} |
unless ($meta_not_found) { |
unless ($meta_not_found) { |
$r->print('</select><br />'); |
$output .= '</select><br />'; |
$r->print('<input type="submit" value="Associate" />'); |
$output .= '<input type="submit" value="Associate" />'; |
$r->print('</form>'); |
$output .= '</form>'; |
} |
} |
return 'ok'; |
return ($output); |
} |
} |
# Pretty printing of metadata field |
# Pretty printing of metadata field |
|
|
Line 653 sub handler {
|
Line 653 sub handler {
|
$r->print(&Apache::loncommon::bodytag |
$r->print(&Apache::loncommon::bodytag |
('Edit Portfolio File Information','','','',$resdomain)); |
('Edit Portfolio File Information','','','',$resdomain)); |
&present_editable_metadata($r,$uri,'portfolio'); |
&present_editable_metadata($r,$uri,'portfolio'); |
&select_course($r); |
|
} elsif ($uri=~/^\/\~/) { |
} elsif ($uri=~/^\/\~/) { |
# Construction space |
# Construction space |
$r->print(&Apache::loncommon::bodytag |
$r->print(&Apache::loncommon::bodytag |
Line 1003 sub present_editable_metadata {
|
Line 1002 sub present_editable_metadata {
|
# Header |
# Header |
my $disuri=$uri; |
my $disuri=$uri; |
my $fn=&Apache::lonnet::filelocation('',$uri); |
my $fn=&Apache::lonnet::filelocation('',$uri); |
|
my $metacourse; |
$disuri=~s/^\/\~/\/priv\//; |
$disuri=~s/^\/\~/\/priv\//; |
$disuri=~s/\.meta$//; |
$disuri=~s/\.meta$//; |
$disuri=~s|^/editupload||; |
$disuri=~s|^/editupload||; |
Line 1083 ENDEDIT
|
Line 1083 ENDEDIT
|
'lowestgradelevel','highestgradelevel','sourceavail','sourcerights', |
'lowestgradelevel','highestgradelevel','sourceavail','sourcerights', |
'obsolete','obsoletereplacement'); |
'obsolete','obsoletereplacement'); |
} |
} |
my $metacourse; |
|
if ($env{'form.metacourse'} ) { |
if ($env{'form.metacourse'} ) { |
$Apache::lonpublisher::metadatafields{'courserestricted'} = $env{'form.metacourse'}; |
$Apache::lonpublisher::metadatafields{'courserestricted'} = $env{'form.metacourse'}; |
$metacourse = $env{'form.metacourse'}; |
$metacourse = $env{'form.metacourse'}; |
Line 1101 ENDEDIT
|
Line 1100 ENDEDIT
|
'default'; |
'default'; |
} |
} |
if ($metacourse ne 'none') { |
if ($metacourse ne 'none') { |
$r->print('Using: <strong> '.$env{$metacourse.".description"}."</strong> metadata framework<br />"); |
$r->print('Using: <strong> '.$env{$metacourse.".description"}. |
|
"</strong> metadata framework<br />"); |
|
} else { |
|
$r->print("This resources is not associated with a metadata framework<br />"); |
} |
} |
foreach my $field_name(@fields) { |
foreach my $field_name(@fields) { |
|
|
Line 1135 ENDEDIT
|
Line 1137 ENDEDIT
|
} |
} |
} |
} |
} |
} |
|
|
if ($env{'form.store'}) { |
if ($env{'form.store'}) { |
my $mfh; |
my $mfh; |
my $formname='store'; |
my $formname='store'; |
Line 1196 ENDEDIT
|
Line 1199 ENDEDIT
|
} |
} |
} |
} |
} |
} |
$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').'">'); |
|
|
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
|
if ($metacourse eq 'none') { |
|
$r->print(&select_course()); |
|
} |
return; |
return; |
} |
} |
|
|