'.join("\n",map {
my $url = &Apache::lonnet::clutter($_);
my $title = &Apache::lonnet::gettitle($url);
if ($title eq '') {
@@ -406,18 +508,19 @@ sub prettyprint {
# List of courses
if ($type=~/\_list/) {
my @Courses = split(/\s*\,\s*/,$value);
- my $Str;
+ my $Str='
';
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'}.'';
}
- return $Str;
+ return $Str.'
';
}
# No pretty print found
return $value;
@@ -461,10 +564,72 @@ sub relatedfield {
sub prettyinput {
my ($type,$value,$fieldname,$formname,
- $relatedsearchflag,$relatedsep,$relatedvalue,$size)=@_;
+ $relatedsearchflag,$relatedsep,$relatedvalue,$size,$course_key)=@_;
if (! defined($size)) {
$size = 80;
}
+ my $output;
+ if (defined($course_key)
+ && exists($env{$course_key.'.metadata.'.$type.'.options'})) {
+ my $stu_add;
+ my $only_one;
+ my %meta_options;
+ my @cur_values_inst;
+ my $cur_values_stu;
+ my $values = $env{$course_key.'.metadata.'.$type.'.values'};
+ if ($env{$course_key.'.metadata.'.$type.'.options'} =~ m/stuadd/) {
+ $stu_add = 'true';
+ }
+ if ($env{$course_key.'.metadata.'.$type.'.options'} =~ m/onlyone/) {
+ $only_one = 'true';
+ }
+ # need to take instructor values out of list where instructor and student
+ # values may be mixed.
+ if ($values) {
+ foreach my $item (split(/,/,$values)) {
+ $item =~ s/^\s+//;
+ $meta_options{$item} = $item;
+ }
+ foreach my $item (split(/,/,$value)) {
+ $item =~ s/^\s+//;
+ if ($meta_options{$item}) {
+ push(@cur_values_inst,$item);
+ } else {
+ $cur_values_stu .= $item.',';
+ }
+ }
+ } else {
+ $cur_values_stu = $value;
+ }
+ if ($type eq 'courserestricted') {
+ return (&select_course());
+ # return ('');
+ }
+ if (($type eq 'keywords') || ($type eq 'subject')
+ || ($type eq 'author')||($type eq 'notes')
+ || ($type eq 'abstract')|| ($type eq 'title')|| ($type eq 'standards')) {
+ if ($values) {
+ if ($only_one) {
+ $output .= (&Apache::loncommon::select_form($cur_values_inst[0],'new_'.$type,%meta_options));
+ } else {
+ $output .= (&Apache::loncommon::multiple_select_form('new_'.$type,\@cur_values_inst,undef,\%meta_options));
+ }
+ }
+ if ($stu_add) {
+ $output .= ''.
+ &relatedfield(1,$relatedsearchflag,$relatedsep,$fieldname,
+ $relatedvalue);
+ }
+ return ($output);
+ }
+ if (($type eq 'lowestgradelevel') ||
+ ($type eq 'highestgradelevel')) {
+ return &Apache::loncommon::select_level_form($value,$fieldname).
+ &relatedfield(0,$relatedsearchflag,$relatedsep);
+ }
+ return();
+ }
# Language
if ($type eq 'language') {
return &selectbox($fieldname,
@@ -525,6 +690,11 @@ sub prettyinput {
",'rights')\">".&mt('Select').''.
&relatedfield(0,$relatedsearchflag,$relatedsep);
}
+ if ($type eq 'courserestricted') {
+ return (&select_course());
+ #return ('');
+ }
+
# Dates
if (($type eq 'creationdate') ||
($type eq 'lastrevisiondate')) {
@@ -554,34 +724,41 @@ sub handler {
&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'.
- '');
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\//) {
- $r->print(&Apache::loncommon::bodytag
- ('Edit Portfolio File Information','','','',$resdomain));
- &present_editable_metadata($r,$uri,'portfolio');
- &select_course($r);
-
- } elsif ($uri=~/^\/\~/) {
+ } elsif ($uri=~m|^/editupload/[^/]+/[^/]+/portfolio/|) {
+ ($resdomain,$resuser)=
+ (&Apache::lonnet::declutter($uri)=~m|^(\w+)/(\w+)/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 {
+ &pre_select_course($r,$uri);
+ }
+ } 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,'portfolio');
+ } 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('