'.join("\n",map {
- my $url = &Apache::lonnet::clutter($_);
+ return '
'.join("\n",map {
+ my $url = &Apache::lonnet::clutter_with_no_wrapper($_);
my $title = &Apache::lonnet::gettitle($url);
if ($title eq '') {
$title = 'Untitled';
@@ -422,18 +504,26 @@ sub prettyprint {
# List of courses
if ($type=~/\_list/) {
my @Courses = split(/\s*\,\s*/,$value);
- my $Str;
+ my $Str='
';
+ my %descriptions;
foreach my $course (@Courses) {
- my %courseinfo = &Apache::lonnet::coursedescription($course);
+ my %courseinfo =
+ &Apache::lonnet::coursedescription($course,
+ {'one_time' => 1});
if (! exists($courseinfo{'num'}) || $courseinfo{'num'} eq '') {
next;
}
- if ($Str ne '') { $Str .= ' '; }
- $Str .= ''.
- $courseinfo{'description'}.'';
+ $courseinfo{'description'}.' ('.$courseinfo{'domain'}.
+ ')';
}
- return $Str;
+ foreach my $course (sort {lc($a) cmp lc($b)} (keys(%descriptions))) {
+ $Str .= $descriptions{$course};
+ }
+
+ return $Str.'
';
}
# No pretty print found
return $value;
@@ -482,7 +572,8 @@ sub prettyinput {
$size = 80;
}
my $output;
- if (defined($course_key)) {
+ if (defined($course_key)
+ && exists($env{$course_key.'.metadata.'.$type.'.options'})) {
my $stu_add;
my $only_one;
my %meta_options;
@@ -507,9 +598,15 @@ sub prettyinput {
if ($meta_options{$item}) {
push(@cur_values_inst,$item);
} else {
- $cur_values_stu .= $item.',';
+ if ($item ne 'Not Specified') {
+ $cur_values_stu .= $item.',';
+ }
}
}
+ my @key_order = sort(keys(%meta_options));
+ unshift (@key_order,'Not Specified');
+ $meta_options{'Not Specified'} = 'Not Specified';
+ $meta_options{'select_form_order'} = \@key_order;
} else {
$cur_values_stu = $value;
}
@@ -517,9 +614,12 @@ sub prettyinput {
return (&select_course());
# return ('');
}
+ my $course = $env{'request.course.id'};
if (($type eq 'keywords') || ($type eq 'subject')
|| ($type eq 'author')||($type eq 'notes')
- || ($type eq 'abstract')|| ($type eq 'title')|| ($type eq 'standards')) {
+ || ($type eq 'abstract')|| ($type eq 'title')|| ($type eq 'standards')
+ || (exists($env{'course.'.$env{'request.course.id'}.'.metadata.'.$type.'.added'}))) {
+
if ($values) {
if ($only_one) {
$output .= (&Apache::loncommon::select_form($cur_values_inst[0],'new_'.$type,%meta_options));
@@ -534,7 +634,7 @@ sub prettyinput {
$relatedvalue);
}
return ($output);
- }
+ }
if (($type eq 'lowestgradelevel') ||
($type eq 'highestgradelevel')) {
return &Apache::loncommon::select_level_form($value,$fieldname).
@@ -629,41 +729,59 @@ sub prettyinput {
# Main Handler
sub handler {
my $r=shift;
- #
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+ ['currentpath','changecourse']);
my $uri=$r->uri;
#
# Set document type
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
return OK if $r->header_only;
- #
my ($resdomain,$resuser)=
- (&Apache::lonnet::declutter($uri)=~/^(\w+)\/(\w+)\//);
- my $html=&Apache::lonxml::xmlbegin();
- $r->print($html.''.
- 'Catalog Information'.
- '');
+ (&Apache::lonnet::declutter($uri)=~/^($match_domain)\/($match_username)\//);
if ($uri=~m:/adm/bombs/(.*)$:) {
- $r->print(&Apache::loncommon::bodytag('Error Messages'));
+ $r->print(&Apache::loncommon::start_page('Error Messages'));
# Looking for all bombs?
&report_bombs($r,$uri);
- } elsif ($uri=~/\/portfolio\//) {
- ($resdomain,$resuser)=
- (&Apache::lonnet::declutter($uri)=~m|^(\w+)/(\w+)/portfolio|);
- $r->print(&Apache::loncommon::bodytag
- ('Edit Portfolio File Information','','','',$resdomain));
- &present_editable_metadata($r,$uri,'portfolio');
- } elsif ($uri=~/^\/\~/) {
+ } elsif ($uri=~m|^/editupload/[^/]+/[^/]+/portfolio/|) {
+ ($resdomain,$resuser)=
+ (&Apache::lonnet::declutter($uri)=~m|^($match_domain)/($match_name)/portfolio|);
+ $r->print(&Apache::loncommon::start_page('Edit Portfolio File Catalog Information',
+ undef,
+ {'domain' => $resdomain,}));
+ if ($env{'form.store'}) {
+ &present_editable_metadata($r,$uri,'portfolio');
+ } else {
+ my $fn=&Apache::lonnet::filelocation('',$uri);
+ %Apache::lonpublisher::metadatafields=();
+ %Apache::lonpublisher::metadatakeys=();
+ my $result=&Apache::lonnet::getfile($fn);
+ &Apache::lonpublisher::metaeval($result);
+ if ((!$Apache::lonpublisher::metadatafields{'courserestricted'}) ||
+ ($env{'form.changecourse'} eq 'true')) {
+ &pre_select_course($r,$uri);
+ } else {
+ &present_editable_metadata($r,$uri,'portfolio');
+ }
+ }
+ } elsif ($uri=~m|^/editupload/[^/]+/[^/]+/groups/|) {
+ $r->print(&Apache::loncommon::start_page('Edit Group Portfolio File Catalog Information',
+ undef,
+ {'domain' => $resdomain,}));
+ &present_editable_metadata($r,$uri,'groups');
+ } elsif ($uri=~m|^/~|) {
# Construction space
- $r->print(&Apache::loncommon::bodytag
- ('Edit Catalog Information','','','',$resdomain));
+ $r->print(&Apache::loncommon::start_page('Edit Catalog nformation',
+ undef,
+ {'domain' => $resdomain,}));
&present_editable_metadata($r,$uri);
} else {
- $r->print(&Apache::loncommon::bodytag
- ('Catalog Information','','','',$resdomain));
+ $r->print(&Apache::loncommon::start_page('Catalog Information',
+ undef,
+ {'domain' => $resdomain,}));
&present_uneditable_metadata($r,$uri);
}
- $r->print('