version 1.242, 2005/08/27 00:03:32
|
version 1.243, 2005/08/27 19:07:58
|
Line 2728 ENDMAINFORMHEAD
|
Line 2728 ENDMAINFORMHEAD
|
sub setinstmeta { |
sub setinstmeta { |
my ($r)=@_; |
my ($r)=@_; |
my $next_meta; |
my $next_meta; |
if ($env{'form.nextmeta'}) { |
if ($env{'form.serial'}) { |
$next_meta = $env{'form.nextmeta'}; |
$next_meta = $env{'form.serial'}; |
} else { |
} else { |
$next_meta = 1; |
$next_meta = 1; |
} |
} |
Line 2742 sub setinstmeta {
|
Line 2742 sub setinstmeta {
|
'Set Instructor Metadata')); |
'Set Instructor Metadata')); |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $key_base = $env{'course.'.$env{'request.course.id'}.'.metadata.'}; |
if ($env{'form.state'}eq 'add') { |
if ($env{'form.state'}eq 'add') { |
$r->print('<strong>Compose a new metadata item:</strong><br />'); |
$r->print('<strong>Compose a new metadata item:</strong><br />'); |
$r->print('<form method="post" action="/adm/parmset">'); |
$r->print('<form method="post" action="/adm/parmset">'); |
Line 2756 sub setinstmeta {
|
Line 2757 sub setinstmeta {
|
$r->print('</form>'); |
$r->print('</form>'); |
} elsif ($env{'form.state'}eq 'save') { |
} elsif ($env{'form.state'}eq 'save') { |
$r->print('Here we save the metadata'); |
$r->print('Here we save the metadata'); |
|
$key_base.=$env{'form.serial'}.'.'; |
|
$r->print('The title: '.$env{'form.title'}.'<br>'); |
|
$r->print('The values: '.$env{'form.values'}.'<br>'); |
|
$r->print('The type: '.$env{'form.type'}.'<br>'); |
|
$r->print('The number: '.$env{'form.serial'}.'<br>'); |
|
my $name = 'metadata.'.$env{'form.serial'}.'.title'; |
|
my $value = $env{'form.title'}; |
|
my $put_result = &Apache::lonnet::put('environment', |
|
{$name=>$value},$dom,$crs); |
|
$r->print('the put result was: '.$put_result.'<br />'); |
|
$name = 'metadata.'.$env{'form.serial'}.'.type'; |
|
$value = $env{'form.type'}; |
|
$put_result = &Apache::lonnet::put('environment', |
|
{$name=>$value},$dom,$crs); |
|
$name = 'metadata.'.$env{'form.serial'}.'.values'; |
|
$value = $env{'form.values'}; |
|
$put_result = &Apache::lonnet::put('environment', |
|
{$name=>$value},$dom,$crs); |
|
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
} else { |
} else { |
|
my $found_one = 0; |
foreach my $key (sort keys %env) { |
foreach my $key (sort keys %env) { |
my $found_one = 0; |
if ($key=~m/^course\.$env{'request.course.id'}\.metadata\.\d+\.title$/) { |
if ($key=~m/^course\.$env{'request.course.id'}\.metadata\.title/) { |
unless ($found_one eq 1) { |
unless ($found_one) { |
|
$found_one = 1; |
$found_one = 1; |
$r->print('<strong>Existing Metadata</strong><br >'); |
$r->print('<strong>Existing Metadata</strong><br >'); |
} |
} |
$r->print($env{$key}.'<br />'); |
$r->print($env{$key}.'<br />'); |
$key=~~m/^course\.$env{'request.course.id'}\.metadata\.title\.(d*)\./; |
$key=~m/^course\.$env{'request.course.id'}\.metadata\.(\d+)\.title/; |
if ($1 ge $next_meta) { |
if ($1 ge $next_meta) { |
$next_meta = $1 ++; |
$next_meta = $1 + 1; |
} |
} |
} |
} |
} |
} |
$r->print('<a href="/adm/parmset?action=setinstmeta&state=add&nextmeta='.$next_meta.'">Add Metadata Item</a><br />'); |
$r->print('<a href="/adm/parmset?action=setinstmeta&state=add&serial='.$next_meta.'">Add Metadata Item</a><br />'); |
} |
} |
$r->print('</body> |
$r->print('</body> |
</html>'); |
</html>'); |
Line 2962 sub handler {
|
Line 2982 sub handler {
|
'pres_marker', |
'pres_marker', |
'pres_value', |
'pres_value', |
'pres_type', |
'pres_type', |
'udom','uname','symb']); |
'udom','uname','symb','serial']); |
|
|
|
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |