[LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm
banghart
lon-capa-cvs@mail.lon-capa.org
Sat, 27 Aug 2005 00:03:34 -0000
banghart Fri Aug 26 20:03:34 2005 EDT
Modified files:
/loncom/interface lonparmset.pm
Log:
Working toward instructor interface for defining metadata
items. Still need to save the metadata definition. No
doubt this will break the student side (applying metadata
to portfolio documents). Work in progress.
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.241 loncom/interface/lonparmset.pm:1.242
--- loncom/interface/lonparmset.pm:1.241 Fri Aug 26 15:55:19 2005
+++ loncom/interface/lonparmset.pm Fri Aug 26 20:03:32 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.241 2005/08/26 19:55:19 banghart Exp $
+# $Id: lonparmset.pm,v 1.242 2005/08/27 00:03:32 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2727,7 +2727,12 @@
### Set instructor defined metadata
sub setinstmeta {
my ($r)=@_;
- my $setoutput='';
+ my $next_meta;
+ if ($env{'form.nextmeta'}) {
+ $next_meta = $env{'form.nextmeta'};
+ } else {
+ $next_meta = 1;
+ }
$r->print(&Apache::lonxml::xmlbegin());
$r->print('<head>
<title>LON-CAPA Set Instructor Metadata</title>
@@ -2737,7 +2742,37 @@
'Set Instructor Metadata'));
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
- $r->print('Set instructor metadata here');
+ if ($env{'form.state'}eq 'add') {
+ $r->print('<strong>Compose a new metadata item:</strong><br />');
+ $r->print('<form method="post" action="/adm/parmset">');
+ $r->print ('Title of item: '.&Apache::lonhtmlcommon::textbox("title",undef,undef,undef).'<br />');
+ $r->print ('List if items (comma separated): '.&Apache::lonhtmlcommon::textbox("values",undef,undef,undef).'<br />');
+ $r->print ('Select one: <input type="radio" name="type" value="one"><br />');
+ $r->print ('Select many: <input type="radio" name="type" value="many"><br />');
+ $r->print('<input type="hidden" name="serial" value="'.$next_meta.'" />');
+ $r->print('<input type="hidden" name="action" value="setinstmeta" />');
+ $r->print('<input type="hidden" name="state" value="save" />');
+ $r->print('<input type="submit" value="Save Metadata">');
+ $r->print('</form>');
+ } 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('<strong>Existing Metadata</strong><br >');
+ }
+ $r->print($env{$key}.'<br />');
+ $key=~~m/^course\.$env{'request.course.id'}\.metadata\.title\.(d*)\./;
+ if ($1 ge $next_meta) {
+ $next_meta = $1 ++;
+ }
+ }
+ }
+ $r->print('<a href="/adm/parmset?action=setinstmeta&state=add&nextmeta='.$next_meta.'">Add Metadata Item</a><br />');
+ }
$r->print('</body>
</html>');
return 'ok';