--- loncom/interface/lonparmset.pm 2005/07/19 16:42:02 1.239 +++ loncom/interface/lonparmset.pm 2005/08/27 00:03:32 1.242 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.239 2005/07/19 16:42:02 raeburn Exp $ +# $Id: lonparmset.pm,v 1.242 2005/08/27 00:03:32 banghart Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2677,6 +2677,10 @@ ENDMAINFORMHEAD action => 'crsenv', permission => $parm_permission, }, + { text => 'Set Instructor Defined Metadata', + action => 'setinstmeta', + permission => $parm_permission, + }, { text => 'Set/Modify Resource Parameters - Helper Mode', url => '/adm/helper/parameter.helper', permission => $parm_permission, @@ -2720,8 +2724,59 @@ ENDMAINFORMHEAD $r->print($menu_html); return; } - - +### Set instructor defined metadata +sub setinstmeta { + my ($r)=@_; + my $next_meta; + if ($env{'form.nextmeta'}) { + $next_meta = $env{'form.nextmeta'}; + } else { + $next_meta = 1; + } + $r->print(&Apache::lonxml::xmlbegin()); + $r->print(' + LON-CAPA Set Instructor Metadata + '); + $r->print(&Apache::loncommon::bodytag('Set Instructor Metadata')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, + 'Set Instructor Metadata')); + my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; + if ($env{'form.state'}eq 'add') { + $r->print('Compose a new metadata item:
'); + $r->print('
'); + $r->print ('Title of item: '.&Apache::lonhtmlcommon::textbox("title",undef,undef,undef).'
'); + $r->print ('List if items (comma separated): '.&Apache::lonhtmlcommon::textbox("values",undef,undef,undef).'
'); + $r->print ('Select one:
'); + $r->print ('Select many:
'); + $r->print(''); + $r->print(''); + $r->print(''); + $r->print(''); + $r->print('
'); + } elsif ($env{'form.state'}eq 'save') { + $r->print('Here we save the metadata'); + } else { + foreach my $key (sort keys %env) { + my $found_one = 0; + if ($key=~m/^course\.$env{'request.course.id'}\.metadata\.title/) { + unless ($found_one) { + $found_one = 1; + $r->print('Existing Metadata
'); + } + $r->print($env{$key}.'
'); + $key=~~m/^course\.$env{'request.course.id'}\.metadata\.title\.(d*)\./; + if ($1 ge $next_meta) { + $next_meta = $1 ++; + } + } + } + $r->print('Add Metadata Item
'); + } + $r->print(' + '); + return 'ok'; +} ################################################## sub defaultsetter { @@ -2954,6 +3009,10 @@ sub handler { &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', text=>"Overview Mode"}); &overview($r); + } elsif ($env{'form.action'} eq 'setinstmeta' && $parm_permission) { + &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setinstmeta', + text=>"Instructor Metadata"}); + &setinstmeta($r); } elsif ($env{'form.action'} eq 'newoverview' && $parm_permission) { &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', text=>"Overview Mode"});