--- loncom/interface/lonhtmlcommon.pm 2006/07/18 21:55:24 1.144
+++ loncom/interface/lonhtmlcommon.pm 2006/07/29 00:31:58 1.147
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.144 2006/07/18 21:55:24 albertel Exp $
+# $Id: lonhtmlcommon.pm,v 1.147 2006/07/29 00:31:58 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1094,6 +1094,7 @@ _editor_url='/htmlarea/';
_editor_lang='$lang';
+
ENDHEADERS
}
@@ -1264,9 +1265,9 @@ returns: nothing
$bug = $last->{'bug'} if (exists($last->{'bug'}));
$help = $last->{'help'} if (exists($last->{'help'}));
$component_help=($component_help?$component_help:$help);
- if ($faq ne '') {
- $icons .= &Apache::loncommon::help_open_faq($faq);
- }
+# if ($faq ne '') {
+# $icons .= &Apache::loncommon::help_open_faq($faq);
+# }
# if ($bug ne '') {
# $icons .= &Apache::loncommon::help_open_bug($bug);
# }
@@ -1417,7 +1418,7 @@ ENDTWO
}
sub role_select_row {
- my ($roles,$title,$css_class) = @_;
+ my ($roles,$title,$css_class,$show_separate_custom,$cdom,$cnum) = @_;
my $output;
if (defined($title)) {
$output = &row_title($title,$css_class);
@@ -1428,10 +1429,25 @@ sub role_select_row {
my $plrole;
if ($role eq 'ow') {
$plrole = &mt('Course Owner');
+ } elsif ($role eq 'cr') {
+ if ($show_separate_custom) {
+ if ($cdom ne '' && $cnum ne '') {
+ my %course_customroles = &course_custom_roles($cdom,$cnum);
+ foreach my $crrole (sort(keys(%course_customroles))) {
+ my ($plcrrole) = ($crrole =~ m|^cr/[^/]+/[^/]+/(.+)$|);
+ $output .= ' ';
+ }
+ }
+ } else {
+ $plrole = &mt('Custom Role');
+ }
} else {
$plrole=&Apache::lonnet::plaintext($role);
}
- $output .= ' ';
+ if (($role ne 'cr') || (!$show_separate_custom)) {
+ $output .= ' ';
+ }
}
$output .= qq| \n|;
if (defined($title)) {
@@ -1584,6 +1600,24 @@ sub submit_row {
return $output;
}
+sub course_custom_roles {
+ my ($cdom,$cnum) = @_;
+ my %returnhash=();
+ my %coursepersonnel=&Apache::lonnet::dump('nohist_userroles',$cdom,$cnum);
+ foreach my $person (sort(keys(%coursepersonnel))) {
+ my ($role) = ($person =~ /^([^:]+):/);
+ my ($end,$start) = split(/:/,$coursepersonnel{$person});
+ if ($end == -1 && $start == -1) {
+ next;
+ }
+ if ($role =~ m|^cr/[^/]+/[^/]+/[^/]|) {
+ $returnhash{$role} ++;
+ }
+ }
+ return %returnhash;
+}
+
+
##############################################
##############################################
@@ -1722,66 +1756,66 @@ sub set_form_elements {
my $valuestring = join('","',@{$values{$name}});
$output .= qq|
var textvalues = new Array ("$valuestring");
- var total = courseForm.$name.length;
+ var total = courseForm.elements['$name'].length;
if (total > $numvalues) {
total = $numvalues;
}
for (var i=0; i