| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm,v 1.69 2005/07/14 13:15:26 glarose Exp $ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm,v 1.70 2005/08/24 19:41:59 jj Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
6 | # This program is free software; you can redistribute it and/or modify it under |
| 7 | # the terms of either: (a) the GNU General Public License as published by the |
7 | # the terms of either: (a) the GNU General Public License as published by the |
| 8 | # Free Software Foundation; either version 2, or (at your option) any later |
8 | # Free Software Foundation; either version 2, or (at your option) any later |
| 9 | # version, or (b) the "Artistic License" which comes with this package. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 1389 | my $type = $properties->{type}; |
1389 | my $type = $properties->{type}; |
| 1390 | my $access = $properties->{access}; |
1390 | my $access = $properties->{access}; |
| 1391 | my $items = $properties->{items}; |
1391 | my $items = $properties->{items}; |
| 1392 | my $synonyms = $properties->{synonyms}; |
1392 | my $synonyms = $properties->{synonyms}; |
| 1393 | |
1393 | |
|
|
1394 | if ($type eq "email") { |
|
|
1395 | if ($value eq ' ') { |
|
|
1396 | return $value;} |
|
|
1397 | else { |
|
|
1398 | return CGI::a({-href=>"mailto:$value"},$value); |
|
|
1399 | } |
|
|
1400 | } |
|
|
1401 | |
| 1394 | if ($access eq "readonly") { |
1402 | if ($access eq "readonly") { |
| 1395 | return $value; |
1403 | return $value; |
| 1396 | } |
1404 | } |
| 1397 | |
1405 | |
| 1398 | if ($type eq "number" or $type eq "text") { |
1406 | if ($type eq "number" or $type eq "text") { |
| 1399 | return CGI::input({type=>"text", name=>$fieldName, value=>$value, size=>$size}); |
1407 | return CGI::input({type=>"text", name=>$fieldName, value=>$value, size=>$size}); |
| 1400 | } |
1408 | } |
| 1401 | |
1409 | |
| 1402 | if ($type eq "enumerable") { |
1410 | if ($type eq "enumerable") { |
| 1403 | my $matched = undef; # Whether a synonym match has occurred |
1411 | my $matched = undef; # Whether a synonym match has occurred |
| 1404 | |
1412 | |
| 1405 | # Process synonyms for enumerable objects |
1413 | # Process synonyms for enumerable objects |
| 1406 | foreach my $synonym (keys %$synonyms) { |
1414 | foreach my $synonym (keys %$synonyms) { |
| … | |
… | |
| 1519 | } |
1527 | } |
| 1520 | } |
1528 | } |
| 1521 | |
1529 | |
| 1522 | # User Fields |
1530 | # User Fields |
| 1523 | foreach my $field ($User->NONKEYFIELDS) { |
1531 | foreach my $field ($User->NONKEYFIELDS) { |
| 1524 | my $fieldName = "user." . $User->user_id . "." . $field, |
1532 | my $fieldName = 'user.' . $User->user_id . '.' . $field, |
| 1525 | my $fieldValue = $User->$field; |
1533 | my $fieldValue = $User->$field; |
| 1526 | my %properties = %{ FIELD_PROPERTIES()->{$field} }; |
1534 | my %properties = %{ FIELD_PROPERTIES()->{$field} }; |
| 1527 | $properties{access} = "readonly" unless $editMode; |
1535 | $properties{access} = 'readonly' unless $editMode; |
|
|
1536 | $properties{type} = 'email' if ($field eq 'email_address' and !$editMode and !$passwordMode); |
| 1528 | $fieldValue = $self->nbsp($fieldValue) unless $editMode; |
1537 | $fieldValue = $self->nbsp($fieldValue) unless $editMode; |
| 1529 | push @tableCells, CGI::div({class=>$statusClass}, $self->fieldEditHTML($fieldName, $fieldValue, \%properties)); |
1538 | push @tableCells, CGI::div({class=>$statusClass}, $self->fieldEditHTML($fieldName, $fieldValue, \%properties)); |
| 1530 | } |
1539 | } |
| 1531 | |
1540 | |
| 1532 | # PermissionLevel Fields |
1541 | # PermissionLevel Fields |
| 1533 | foreach my $field ($PermissionLevel->NONKEYFIELDS) { |
1542 | foreach my $field ($PermissionLevel->NONKEYFIELDS) { |
| 1534 | my $fieldName = "permission." . $PermissionLevel->user_id . "." . $field, |
1543 | my $fieldName = 'permission.' . $PermissionLevel->user_id . '.' . $field, |
| 1535 | my $fieldValue = $PermissionLevel->$field; |
1544 | my $fieldValue = $PermissionLevel->$field; |
| 1536 | my %properties = %{ FIELD_PROPERTIES()->{$field} }; |
1545 | my %properties = %{ FIELD_PROPERTIES()->{$field} }; |
| 1537 | $properties{access} = "readonly" unless $editMode; |
1546 | $properties{access} = 'readonly' unless $editMode; |
| 1538 | $fieldValue = $self->nbsp($fieldValue) unless $editMode; |
1547 | $fieldValue = $self->nbsp($fieldValue) unless $editMode; |
| 1539 | push @tableCells, CGI::div({class=>$statusClass}, $self->fieldEditHTML($fieldName, $fieldValue, \%properties)); |
1548 | push @tableCells, CGI::div({class=>$statusClass}, $self->fieldEditHTML($fieldName, $fieldValue, \%properties)); |
| 1540 | } |
1549 | } |
| 1541 | |
1550 | |
| 1542 | return CGI::Tr({}, CGI::td({nowrap=>1}, \@tableCells)); |
1551 | return CGI::Tr({}, CGI::td({nowrap=>1}, \@tableCells)); |