[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface courseprefs.pm
raeburn
raeburn at source.lon-capa.org
Mon Oct 24 14:10:08 EDT 2016
raeburn Mon Oct 24 18:10:08 2016 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface courseprefs.pm
Log:
- For 2.11
- Backport 1.80, 1.81, 1.82
-------------- next part --------------
Index: loncom/interface/courseprefs.pm
diff -u loncom/interface/courseprefs.pm:1.49.2.20 loncom/interface/courseprefs.pm:1.49.2.21
--- loncom/interface/courseprefs.pm:1.49.2.20 Fri Aug 5 20:28:14 2016
+++ loncom/interface/courseprefs.pm Mon Oct 24 18:10:08 2016
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set configuration settings for a course
#
-# $Id: courseprefs.pm,v 1.49.2.20 2016/08/05 20:28:14 raeburn Exp $
+# $Id: courseprefs.pm,v 1.49.2.21 2016/10/24 18:10:08 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -137,7 +137,7 @@
advanced course user .db file for a course are to be hidden (e.g.,
in syllabus, or from course user lists).
-Inputs: $cdom,$item,$settings,$crstype
+Inputs: $cdom,$item,$settings,$crstype,$noedit
where $cdom is course domain, item is nothideprivileged, $settings is
HASH ref of the current values for nothideprivileged, $crstype is
course type (Course or Community).
@@ -235,9 +235,9 @@
my $cid = $env{'request.course.id'};
my ($cnum,$cdom,$chome) = &get_course($cid);
my $crstype = &Apache::loncommon::course_type();
- my $parm_permission = &Apache::lonnet::allowed('opa',$cid);
+ my ($parm_permission,$allowed) = &get_permission($cid);
my $navmap = Apache::lonnavmaps::navmap->new();
- if ($parm_permission && $navmap) {
+ if ($allowed && $navmap) {
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
} else {
@@ -344,12 +344,12 @@
$phase = $env{'form.phase'};
}
- if ($phase eq 'categorizecourse') {
+ if (($phase eq 'categorizecourse') && ($parm_permission->{'categorizecourse'})) {
&assign_course_categories($r,$crstype);
return OK;
}
- if ($phase eq 'releaseinfo') {
+ if (($phase eq 'releaseinfo') && ($parm_permission->{'releaseinfo'})) {
my $loncaparev = $env{'course.'.$cid.'.internal.releaserequired'};
if ($loncaparev) {
if (&display_loncaparev_constraints($r,$navmap,$loncaparev,$crstype)) {
@@ -535,23 +535,52 @@
}],
},
);
- if ($phase eq 'process') {
+ if (($phase eq 'process') && ($parm_permission->{'process'})) {
my @allitems = &get_allitems(%prefs);
&Apache::lonconfigsettings::make_changes($r,$cdom,$phase,$context,
\@prefs_order,\%prefs,\%values,
- $cnum,undef,\@allitems,'coursepref');
- } elsif ($phase eq 'display') {
+ $cnum,undef,\@allitems,
+ 'coursepref',$parm_permission);
+ } elsif (($phase eq 'display') && ($parm_permission->{'display'})) {
my $jscript = &get_jscript($cid,$cdom,$phase,$crstype,\%values);
my @allitems = &get_allitems(%prefs);
&Apache::lonconfigsettings::display_settings($r,$cdom,$phase,$context,
- \@prefs_order,\%prefs,\%values,undef,$jscript,\@allitems,$crstype,'coursepref');
+ \@prefs_order,\%prefs,\%values,undef,$jscript,\@allitems,$crstype,
+ 'coursepref',$parm_permission);
} else {
&Apache::lonconfigsettings::display_choices($r,$phase,$context,
- \@prefs_order,\%prefs,'coursepref');
+ \@prefs_order,\%prefs,
+ 'coursepref',$parm_permission);
}
return OK;
}
+sub get_permission {
+ my ($cid) = @_;
+ my %permission;
+ my $allowed = 0;
+ return (\%permission,$allowed) unless ($cid);
+ if (&Apache::lonnet::allowed('opa',$cid)) {
+ %permission= (
+ 'pickactions' => 1,
+ 'categorizecourse' => 1,
+ 'releaseinfo' => 1,
+ 'process' => 1,
+ 'display' => 1,
+ );
+ } elsif (&Apache::lonnet::allowed('vpa',$env{'request.course.id'})) {
+ %permission = (
+ 'pickactions' => 1,
+ 'releaseinfo' => 1,
+ 'display' => 1,
+ );
+ }
+ foreach my $perm (values(%permission)) {
+ if ($perm) { $allowed=1; last; }
+ }
+ return (\%permission,$allowed);
+}
+
sub get_allitems {
my (%prefs) = @_;
my @allitems;
@@ -569,9 +598,15 @@
}
sub print_config_box {
- my ($r,$cdom,$phase,$action,$item,$settings,$allitems,$crstype) = @_;
+ my ($r,$cdom,$phase,$action,$item,$settings,$allitems,$crstype,$parm_permission) = @_;
my $ordered = $item->{'ordered'};
my $itemtext = $item->{'itemtext'};
+ my $noedit;
+ if (ref($parm_permission) eq 'HASH') {
+ unless ($parm_permission->{'process'}) {
+ $noedit = 1;
+ }
+ }
my $rowtotal = 0;
my $output =
'<table class="LC_nested_outer">
@@ -606,9 +641,9 @@
}
$rowtotal ++;
if ($action eq 'feedback') {
- $output .= &print_feedback('top',$cdom,$settings,$ordered,$itemtext,\$rowtotal);
+ $output .= &print_feedback('top',$cdom,$settings,$ordered,$itemtext,\$rowtotal,$noedit);
} elsif ($action eq 'classlists') {
- $output .= &print_classlists('top',$cdom,$settings,$itemtext,\$rowtotal,$crstype);
+ $output .= &print_classlists('top',$cdom,$settings,$itemtext,\$rowtotal,$crstype,$noedit);
}
$output .= '
</table>
@@ -629,7 +664,7 @@
$output .= &mt($item->{'header'}->[1]->{'col2'}).'</td>
</tr>';
if ($action eq 'classlists') {
- $output .= &print_classlists('middle',$cdom,$settings,$itemtext,\$rowtotal,$crstype).
+ $output .= &print_classlists('middle',$cdom,$settings,$itemtext,\$rowtotal,$crstype,$noedit).
'
</table>
</td>
@@ -668,27 +703,27 @@
}
$rowtotal ++;
if ($action eq 'courseinfo') {
- $output .= &print_courseinfo($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype);
+ $output .= &print_courseinfo($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit);
} elsif ($action eq 'localization') {
- $output .= &print_localization($cdom,$settings,$ordered,$itemtext,\$rowtotal);
+ $output .= &print_localization($cdom,$settings,$ordered,$itemtext,\$rowtotal,$noedit);
} elsif ($action eq 'feedback') {
- $output .= &print_feedback('bottom',$cdom,$settings,$ordered,$itemtext,\$rowtotal);
+ $output .= &print_feedback('bottom',$cdom,$settings,$ordered,$itemtext,\$rowtotal,$noedit);
} elsif ($action eq 'discussion') {
- $output .= &print_discussion($cdom,$settings,$ordered,$itemtext,\$rowtotal);
+ $output .= &print_discussion($cdom,$settings,$ordered,$itemtext,\$rowtotal,$noedit);
} elsif (($action eq 'classlists') || ($action eq 'viewableroster')) {
- $output .= &print_classlists('bottom',$cdom,$settings,$itemtext,\$rowtotal,$crstype);
+ $output .= &print_classlists('bottom',$cdom,$settings,$itemtext,\$rowtotal,$crstype,$noedit);
} elsif ($action eq 'appearance') {
- $output .= &print_appearance($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype);
+ $output .= &print_appearance($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit);
} elsif ($action eq 'grading') {
- $output .= &print_grading($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype);
+ $output .= &print_grading($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit);
} elsif ($action eq 'printouts') {
- $output .= &print_printouts($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype);
+ $output .= &print_printouts($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit);
} elsif ($action eq 'spreadsheet') {
- $output .= &print_spreadsheet($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype);
+ $output .= &print_spreadsheet($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit);
} elsif ($action eq 'bridgetasks') {
- $output .= &print_bridgetasks($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype);
+ $output .= &print_bridgetasks($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit);
} elsif ($action eq 'other') {
- $output .= &print_other($cdom,$settings,$allitems,\$rowtotal,$crstype);
+ $output .= &print_other($cdom,$settings,$allitems,\$rowtotal,$crstype,$noedit);
}
$output .= '
</table>
@@ -1934,7 +1969,7 @@
sub print_courseinfo {
- my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_;
+ my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype,$noedit) = @_;
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) {
return;
}
@@ -2089,6 +2124,10 @@
);
my $datatable;
my $count = 0;
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
foreach my $item (@{$ordered}) {
my $colspan;
if ($item eq 'hidefromcat') {
@@ -2108,7 +2147,7 @@
$datatable .= &item_table_row_start($items{$item}{text},$count,undef,$colspan);
}
if ($items{$item}{input} eq 'radio') {
- $datatable .= &yesno_radio($item,$settings);
+ $datatable .= &yesno_radio($item,$settings,undef,undef,undef,$noedit);
} elsif ($item eq 'cloners') {
my $includeempty = 1;
my $num = 0;
@@ -2122,14 +2161,14 @@
$datatable .= ' checked="checked" ';
}
$datatable .= 'onchange="javascript:update_cloners('.
- "'cloners_all'".');" />'.&mt('Yes').'</label>'.
+ "'cloners_all'".');"'.$disabled.' />'.&mt('Yes').'</label>'.
(' 'x2).'<label>'.
'<input type="radio" name="cloners_all" value="0" ';
if ($settings->{$item} ne '*') {
$datatable .= ' checked="checked" ';
}
$datatable .= ' onchange="javascript:update_cloners('.
- "'cloners_all'".');" />'.&mt('No').'</label></td>'.
+ "'cloners_all'".');"'.$disabled.' />'.&mt('No').'</label></td>'.
&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table().
'<table><tr><td align="left"><b>'.&mt('Or').
@@ -2137,11 +2176,13 @@
&Apache::loncommon::start_data_table();
my @cloners;
if ($settings->{$item} eq '') {
- my $default;
- if ($currcanclone eq 'domain') {
- $default = '0';
- }
- $datatable .= &new_cloners_dom_row($cdom,'0',$default);
+ unless ($noedit) {
+ my $default;
+ if ($currcanclone eq 'domain') {
+ $default = '0';
+ }
+ $datatable .= &new_cloners_dom_row($cdom,'0',$default);
+ }
} elsif ($settings->{$item} ne '*') {
my @entries = split(/,/,$settings->{$item});
if (@entries > 0) {
@@ -2162,7 +2203,7 @@
'</b><input type="hidden" name="cloners_dom_'.$num.
'" value="'.$udom.'" /></span><br />'.
'<span class="LC_nobreak"><label><input type="checkbox" '.
- 'name="cloners_delete" value="'.$num.'" onchange="javascript:update_cloners('."'cloners_delete','$num'".');" />'.
+ 'name="cloners_delete" value="'.$num.'" onchange="javascript:update_cloners('."'cloners_delete','$num'".');"'.$disabled.' />'.
&mt('Delete').'</label></span></td>'.
&Apache::loncommon::end_data_table_row();
$num ++;
@@ -2185,7 +2226,8 @@
'<td align="left"><span class="LC_nobreak">'.
$add_domtitle.'</span><br />'.
&Apache::loncommon::select_dom_form('','cloners_newdom',
- $includeempty).
+ $includeempty,undef,undef,
+ undef,undef,$noedit).
'<input type="hidden" name="cloners_total" value="'.$num.'" />'.
'</td>'.&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table().
@@ -2197,7 +2239,7 @@
&mt('Specific users').' (<tt>'.
&mt('user:domain,user:domain').'</tt>)<br />'.
&Apache::lonhtmlcommon::textbox($item,$cloners_str,
- $items{$item}{'size'}).
+ $items{$item}{'size'},$disabled).
'</td>'.&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table();
if (@code_order > 0) {
@@ -2221,13 +2263,13 @@
'<td align="left"><span class="LC_nobreak">'.
&mt('Cloning by official course(s) based on course category').(' 'x2).
'<label>'.
- '<input type="radio" name="cloners_instcode" value="1" onclick="toggleCloners(this);"'.$checkedon.' />'.&mt('Yes').'</label>'.
+ '<input type="radio" name="cloners_instcode" value="1" onclick="toggleCloners(this);"'.$checkedon.$disabled.' />'.&mt('Yes').'</label>'.
(' ').
'<label>'.
- '<input type="radio" name="cloners_instcode" value="0" onclick="toggleCloners(this);"'.$checkedoff.' />'.&mt('No').'</label>'.
+ '<input type="radio" name="cloners_instcode" value="0" onclick="toggleCloners(this);"'.$checkedoff.$disabled.' />'.&mt('No').'</label>'.
&Apache::courseclassifier::build_instcode_selectors($numtitles,
$lasttitle,\%cat_items,\@codetitles,\%cat_titles,\%cat_order,
- $showncodes,'LC_cloners_instcodes','LC_cloners_instcode').
+ $showncodes,'LC_cloners_instcodes','LC_cloners_instcode',$noedit).
'</td>'.&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table();
}
@@ -2248,12 +2290,17 @@
'</span></td><td align="left">'.
&Apache::lonhtmlcommon::textbox('rolenames_'.$role,
$settings->{$role.'.plaintext'},
- $items{$item}{size}).'</td>'.
+ $items{$item}{size},$disabled).'</td>'.
&Apache::loncommon::end_data_table_row();
}
$datatable .= &Apache::loncommon::end_data_table().'</td>';
} elsif ($item eq 'categories') {
- my $launcher = 'onfocus="this.blur();javascript:catsbrowser();"';
+ my $launcher;
+ if ($noedit) {
+ $launcher = $disabled;
+ } else {
+ $launcher = 'onfocus="this.blur();javascript:catsbrowser();"';
+ }
$datatable .= '<input type="hidden" name="categories" value="'.$settings->{$item}.'" />'.
&Apache::lonhtmlcommon::textbox($item.'_display',$settings->{$item},
$items{$item}{size},$launcher);
@@ -2293,13 +2340,13 @@
if (($crstype eq 'Course') && ($env{'course.'.$env{'request.course.id'}.'.internal.coursecode'}) && ($autocoowner)) {
$datatable .= &show_autocoowners(@currcoown);
} else {
- $datatable .= &coowner_invitations($cnum,$cdom, at currcoown);
+ $datatable .= &coowner_invitations($cnum,$cdom,\@currcoown,$noedit);
}
} else {
if (($crstype eq 'Course') && ($env{'course.'.$env{'request.course.id'}.'.internal.coursecode'}) && ($autocoowner)) {
$datatable .= &show_autocoowners(@currcoown);
} else {
- $datatable .= &manage_coownership($cnum,$cdom, at currcoown);
+ $datatable .= &manage_coownership($cnum,$cdom,\@currcoown,$noedit);
}
}
} elsif ($item eq 'externalsyllabus') {
@@ -2343,7 +2390,7 @@
}
$datatable .= $showreqd;
} else {
- $datatable .= &Apache::lonhtmlcommon::textbox($item,$settings->{$item},$items{$item}{size});
+ $datatable .= &Apache::lonhtmlcommon::textbox($item,$settings->{$item},$items{$item}{size},$disabled);
}
$datatable .= &item_table_row_end();
}
@@ -3111,13 +3158,20 @@
}
sub coowner_invitations {
- my ($cnum,$cdom, at currcoown) = @_;
- my ($output, at pendingcoown, at othercoords);
+ my ($cnum,$cdom,$currcoownref,$noedit) = @_;
+ my ($output, at pendingcoown, at othercoords, at currcoown);
my $pendingcoowners =
$env{'course.'.$env{'request.course.id'}.'.internal.pendingco-owners'};
if ($pendingcoowners) {
@pendingcoown = split(',',$pendingcoowners);
}
+ if (ref($currcoownref) eq 'ARRAY') {
+ @currcoown == @{$currcoownref};
+ }
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
my $ccrole = 'cc';
my %ccroles = &Apache::lonnet::get_my_roles($cnum,$cdom,undef,undef,[$ccrole]);
foreach my $key (sort(keys(%ccroles))) {
@@ -3135,7 +3189,7 @@
'<td><i>'.&mt('Current co-owners').'</i></td><td>';
foreach my $person (@currcoown) {
my ($co_uname,$co_dom) = split(':',$person);
- $output .= '<span class="LC_nobreak"><label><input type="checkbox" name="coowners" checked="checked" value="'.$person.'" />'.&Apache::loncommon::plainname($co_uname,$co_dom).'</label></span>'.(' 'x2).' ';
+ $output .= '<span class="LC_nobreak"><label><input type="checkbox" name="coowners" checked="checked" value="'.$person.'"'.$disabled.' />'.&Apache::loncommon::plainname($co_uname,$co_dom).'</label></span>'.(' 'x2).' ';
}
$output .= '</td>'.
&Apache::loncommon::end_data_table_row();
@@ -3145,7 +3199,7 @@
'<td><i>'.&mt('Invited as co-owners [_1](agreement pending)','<br />').'</i></td><td>';
foreach my $person (@pendingcoown) {
my ($co_uname,$co_dom) = split(':',$person);
- $output .= '<span class="LC_nobreak"><label><input type="checkbox" name="pendingcoowners" checked="checked" value="'.$person.'" />'.&Apache::loncommon::plainname($co_uname,$co_dom).'</label></span>'.(' 'x2).' ';
+ $output .= '<span class="LC_nobreak"><label><input type="checkbox" name="pendingcoowners" checked="checked" value="'.$person.'"'.$disabled.' />'.&Apache::loncommon::plainname($co_uname,$co_dom).'</label></span>'.(' 'x2).' ';
}
$output .= '</td>'.
&Apache::loncommon::end_data_table_row();
@@ -3155,7 +3209,7 @@
'<td><i>'.&mt('Invite other Coordinators [_1]to become co-owners','<br />').'</i></td><td>';
foreach my $person (@othercoords) {
my ($co_uname,$co_dom) = split(':',$person);
- $output .= '<span class="LC_nobreak"><label><input type="checkbox" name="invitecoowners" value="'.$person.'" />'.&Apache::loncommon::plainname($co_uname,$co_dom).'</label></span>'.(' 'x2).' ';
+ $output .= '<span class="LC_nobreak"><label><input type="checkbox" name="invitecoowners" value="'.$person.'"'.$disabled.' />'.&Apache::loncommon::plainname($co_uname,$co_dom).'</label></span>'.(' 'x2).' ';
}
$output .= '</td>'.
&Apache::loncommon::end_data_table_row();
@@ -3168,13 +3222,20 @@
}
sub manage_coownership {
- my ($cnum,$cdom, at currcoown) = @_;
- my (@pendingcoown);
+ my ($cnum,$cdom,$currcoownref,$noedit) = @_;
+ my (@pendingcoown, at currcoown);
my $pendingcoowners =
$env{'course.'.$env{'request.course.id'}.'.internal.pendingco-owners'};
if ($pendingcoowners) {
@pendingcoown = split(',',$pendingcoowners);
}
+ if (ref($currcoownref) eq 'ARRAY') {
+ @currcoown == @{$currcoownref};
+ }
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
my ($is_coowner,$is_pending,$output);
my $uname = $env{'user.name'};
my $udom = $env{'user.domain'};
@@ -3206,8 +3267,8 @@
if ($is_coowner) {
$output .= &mt('You are currently a co-owner:').' <label><input type="checkbox" name="remove_coowoner" value="'.$uname.':'.$udom.'" />'.&mt('Discontinue?').'</label>';
} else {
- $output .= &mt('The course owner has invited you to become a co-owner:').' <label><input type="radio" name="pending_coowoner" value="accept" />'.&mt('Accept?').'</label>'.(' 'x2).
- '<label><input type="radio" name=pending_coowoner" value="decline" />'.&mt('Decline?').'</label>';
+ $output .= &mt('The course owner has invited you to become a co-owner:').' <label><input type="radio" name="pending_coowoner" value="accept"'.$disabled.' />'.&mt('Accept?').'</label>'.(' 'x2).
+ '<label><input type="radio" name=pending_coowoner" value="decline"'.$disabled.' />'.&mt('Decline?').'</label>';
}
$output .= '</span>';
if (@currcoown) {
@@ -3221,7 +3282,7 @@
}
sub print_localization {
- my ($cdom,$settings,$ordered,$itemtext,$rowtotal) = @_;
+ my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$noedit) = @_;
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) {
return;
}
@@ -3240,8 +3301,11 @@
input => 'selectbox',
},
);
- my $datatable;
+ my ($datatable,$disabled);
my $count = 0;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
foreach my $item (@{$ordered}) {
$count ++;
my $colspan;
@@ -3254,7 +3318,7 @@
my $timezone = &Apache::lonlocal::gettimezone();
$datatable .=
&Apache::loncommon::select_timezone($item,$timezone,undef,
- $includeempty);
+ $includeempty,$disabled);
} elsif ($item eq 'datelocale') {
my $includeempty = 1;
my $locale_obj = &Apache::lonlocal::getdatelocale();
@@ -3264,11 +3328,13 @@
}
$datatable .=
&Apache::loncommon::select_datelocale($item,$currdatelocale,
- undef,$includeempty);
+ undef,$includeempty,$disabled);
} else {
if ($settings->{$item} eq '') {
- $datatable .= '</td><td align="right">'.
- &Apache::loncommon::select_language('languages_0','',1);
+ unless ($noedit) {
+ $datatable .= '</td><td align="right">'.
+ &Apache::loncommon::select_language('languages_0','',1);
+ }
} else {
my $num = 0;
my @languages = split(/\s*[,;:]\s*/,$settings->{$item});
@@ -3288,19 +3354,22 @@
'</b><input type="hidden" name="languages_'.$num.
'" value="'.$lang.'" /></span><br />'.
'<span class="LC_nobreak"><label><input type="checkbox" '.
- 'name="languages_delete" value="'.$num.'" />'.
+ 'name="languages_delete" value="'.$num.'"'.$disabled.' />'.
&mt('Delete').'</label></span></td>'.
&Apache::loncommon::end_data_table_row();
$num ++;
}
}
- $datatable .= &Apache::loncommon::start_data_table_row().
+ unless ($noedit) {
+ $datatable .=
+ &Apache::loncommon::start_data_table_row().
'<td align="left"><span class="LC_nobreak">'.
&mt('Additional language:'). '</span><br />'.
&Apache::loncommon::select_language('languages_'.$num,'',1).
'<input type="hidden" name="languages_total" value="'.$num.'" />'.
- '</td>'.&Apache::loncommon::end_data_table_row().
- &Apache::loncommon::end_data_table().'<br />';
+ '</td>'.&Apache::loncommon::end_data_table_row();
+ }
+ $datatable .= &Apache::loncommon::end_data_table().'<br />';
}
}
$datatable .= &item_table_row_end();
@@ -3321,7 +3390,7 @@
}
sub print_feedback {
- my ($position,$cdom,$settings,$ordered,$itemtext,$rowtotal) = @_;
+ my ($position,$cdom,$settings,$ordered,$itemtext,$rowtotal,$noedit) = @_;
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) {
return;
}
@@ -3356,7 +3425,10 @@
del => 'Delete?',
sec => 'Sections:',
);
-
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
foreach my $item (@{$ordered}) {
$count ++;
if ($position eq 'top') {
@@ -3368,10 +3440,10 @@
my $includeempty = 0;
$datatable .= '</td><td align="right">'.
&user_table($cdom,$item,\@sections,
- $settings->{$item},\%lt);
+ $settings->{$item},\%lt,$noedit);
} else {
$datatable .= &Apache::lonhtmlcommon::textbox($item.'.text',
- $settings->{$item.'.text'},$items{$item}{size});
+ $settings->{$item.'.text'},$items{$item}{size},$disabled);
}
$datatable .= &item_table_row_end();
}
@@ -3380,15 +3452,21 @@
}
sub user_table {
- my ($cdom,$item,$sections,$currvalue,$lt) = @_;
+ my ($cdom,$item,$sections,$currvalue,$lt,$noedit) = @_;
my $output;
if ($currvalue eq '') {
- $output .= &select_recipient($item,'0',$cdom,$sections);
+ unless ($noedit) {
+ $output .= &select_recipient($item,'0',$cdom,$sections);
+ }
} else {
my $num = 0;
my @curr = split(/,/,$currvalue);
$output .= '<table class="LC_data_table">';
my ($currusers);
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
foreach my $val (@curr) {
next if ($val eq '');
my ($uname,$udom,$seclist) = ($val =~ /^($match_username):($match_domain)(\(?[^\)]*\)?)$/);
@@ -3400,7 +3478,7 @@
$currusers .= '<tr>'.
'<td valign="top"><span class="LC_nobreak">'.
'<label><input type="checkbox" '.
- 'name="'.$item.'_delete" value="'.$num.'" />'.
+ 'name="'.$item.'_delete" value="'.$num.'"'.$disabled.' />'.
$lt->{'del'}.'</label>'.
'<input type="hidden" name="'.$item.'_user_'.
$num.'" value="'.$uname.':'.$udom.'" />'.(' 'x2).
@@ -3411,7 +3489,7 @@
if (@{$sections}) {
$currusers.= (' 'x3).$lt->{'sec'}.' '.
&select_sections($item,$num,$sections,
- \@selsec);
+ \@selsec,$noedit);
}
}
$currusers .= '</span></td></tr>';
@@ -3429,12 +3507,16 @@
'<table>'.$currusers.'</table></td>'.
'</tr>';
}
- $output .= '<tr>'.
+ unless ($noedit) {
+ $output .=
+ '<tr>'.
'<td align="left"><span class="LC_nobreak"><i>'.
$lt->{'add'}.'</i></span><br />'.
&select_recipient($item,$num,$cdom,$sections).
'<input type="hidden" name="'.$item.'_total" value="'.$num.'" />'.
- '</td></tr></table>';
+ '</td></tr>';
+ }
+ $output .= '</table>';
}
return $output;
}
@@ -3461,14 +3543,17 @@
}
sub select_sections {
- my ($item,$num,$sections,$selected) = @_;
- my ($output, at currsecs,$allsec);
+ my ($item,$num,$sections,$selected,$noedit) = @_;
+ my ($output, at currsecs,$allsec,$disabled);
if (ref($selected) eq 'ARRAY') {
@currsecs = @{$selected};
}
if (!@currsecs) {
$allsec = ' selected="selected"';
}
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
if (ref($sections) eq 'ARRAY') {
if (@{$sections}) {
my $mult;
@@ -3478,7 +3563,7 @@
$mult .= ' size="4"';
}
}
- $output = '<select name="'.$item.'_sections_'.$num.'"'.$mult.'>'.
+ $output = '<select name="'.$item.'_sections_'.$num.'"'.$mult.$disabled.'>'.
' <option value=""'.$allsec.'>'.&mt('All').'</option>';
foreach my $sec (@{$sections}) {
my $is_sel;
@@ -3494,7 +3579,7 @@
}
sub print_discussion {
- my ($cdom,$settings,$ordered,$itemtext,$rowtotal) = @_;
+ my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$noedit) = @_;
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) {
return;
}
@@ -3560,22 +3645,22 @@
$datatable .= &item_table_row_start($items{$item}{text},$count,undef,$colspan);
if ($item eq 'plc.roles.denied') {
$datatable .= '</td><td align="right">'.
- '<table>'.&role_checkboxes($cdom,$cnum,$item,$settings).
+ '<table>'.&role_checkboxes($cdom,$cnum,$item,$settings,undef,undef,$noedit).
'</table>';
} elsif ($item eq 'plc.users.denied') {
$datatable .= '</td><td align="right">'.
&user_table($cdom,$item,undef,
- $settings->{$item},\%lt);
+ $settings->{$item},\%lt,$noedit);
} elsif ($item eq 'pch.roles.denied') {
$datatable .= '</td><td align="right">'.
- '<table>'.&role_checkboxes($cdom,$cnum,$item,$settings).
+ '<table>'.&role_checkboxes($cdom,$cnum,$item,$settings,undef,undef,$noedit).
'</table>';
} elsif ($item eq 'pch.users.denied') {
$datatable .= '</td><td align="right">'.
&user_table($cdom,$item,undef,
- $settings->{$item},\%lt);
+ $settings->{$item},\%lt,$noedit);
} elsif ($item eq 'allow_limited_html_in_feedback') {
- $datatable .= &yesno_radio($item,$settings);
+ $datatable .= &yesno_radio($item,$settings,undef,undef,undef,$noedit);
} elsif ($item eq 'allow_discussion_post_editing') {
$datatable .= '</td><td align="right"><br />'.
&Apache::loncommon::start_data_table().
@@ -3583,7 +3668,7 @@
'<th align="left">'.&mt('Role').'</th><th>'.
&mt('Sections').'</th>'.
&Apache::loncommon::end_data_table_row().
- &role_checkboxes($cdom,$cnum,$item,$settings,1).
+ &role_checkboxes($cdom,$cnum,$item,$settings,1,undef,$noedit).
&Apache::loncommon::end_data_table().'<br />';
} elsif ($item eq 'discussion_post_fonts') {
$datatable .= '</td><td align="right"><br />'.
@@ -3595,7 +3680,7 @@
'<th align="center">'.&mt('font-style').'</th>'.
'<th align="center">'.&mt('Other css').'</th>'.
&Apache::loncommon::end_data_table_row().
- &set_discussion_fonts($cdom,$cnum,$item,$settings).
+ &set_discussion_fonts($cdom,$cnum,$item,$settings,$noedit).
&Apache::loncommon::end_data_table().'<br />';
}
$datatable .= &item_table_row_end();
@@ -3605,7 +3690,7 @@
}
sub role_checkboxes {
- my ($cdom,$cnum,$item,$settings,$showsections,$crstype) = @_;
+ my ($cdom,$cnum,$item,$settings,$showsections,$crstype,$noedit) = @_;
my @roles = ('st','ad','ta','ep','in');
if ($crstype eq 'Community') {
push(@roles,'co');
@@ -3643,6 +3728,10 @@
}
my $numinrow = 3;
my $count = 0;
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
foreach my $role (@roles) {
my $checked = '';
if (grep(/^\Q$role\E$/, at current)) {
@@ -3661,11 +3750,11 @@
}
}
$output .= '<td align="left"><span class="LC_nobreak"><label><input type="checkbox" name="'.
- $item.'" value="'.$role.'"'.$checked.'/> '.
+ $item.'" value="'.$role.'"'.$checked.$disabled.'/> '.
$plrole.'</label></span></td>';
if ($showsections) {
$output .= '<td align="left">'.
- &select_sections($item,$role,\@sections,$currsec{$role}).
+ &select_sections($item,$role,\@sections,$currsec{$role},$noedit).
'</td></tr>';
}
$count ++;
@@ -3693,11 +3782,11 @@
}
}
$output .= '<td><span class="LC_nobreak"><label><input type="checkbox" name="'.
- $item.'" value="'.$value.'"'.$checked.' /> '.$rolename.
+ $item.'" value="'.$value.'"'.$checked.$disabled.' /> '.$rolename.
'</label></span></td>';
if ($showsections) {
$output .= '<td>'.
- &select_sections($item,$role,\@sections,$currsec{$role}).
+ &select_sections($item,$role,\@sections,$currsec{$role},$noedit).
'</td>'.&Apache::loncommon::end_data_table_row();
}
$total ++;
@@ -3719,11 +3808,15 @@
}
sub set_discussion_fonts {
- my ($cdom,$cnum,$item,$settings) = @_;
+ my ($cdom,$cnum,$item,$settings,$noedit) = @_;
my ($classorder,$classtitles) = &discussion_vote_classes();
my ($styleorder,$styleitems) = &discussion_vote_styles();
my $output;
if (ref($classorder) eq 'ARRAY') {
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
foreach my $cat (@{$classorder}) {
my %curr = ();
($curr{'size'},$curr{'weight'},$curr{'style'},$curr{'other'}) =
@@ -3740,12 +3833,12 @@
($currsize,$currunit) = ($1,$2);
$curr{'size'} = $currunit;
}
- $output .= '<input type="textbox" name="discussion_post_fonts_'.$cat.'_'.$item.'" value="'.$currsize.'" size="5">'.
+ $output .= '<input type="textbox" name="discussion_post_fonts_'.$cat.'_'.$item.'" value="'.$currsize.'" size="5"'.$disabled.' />'.
' ';
$selitem = 'unit';
}
if ((ref($styleitems) eq 'HASH') && (ref($styleitems->{$item}) eq 'ARRAY')) {
- $output .= '<select name="discussion_post_fonts_'.$cat.'_'.$selitem.'">';
+ $output .= '<select name="discussion_post_fonts_'.$cat.'_'.$selitem.'"'.$disabled.'>';
foreach my $val (@{$styleitems->{$item}}) {
my $sel;
if ($val eq $curr{$item}) {
@@ -3756,7 +3849,7 @@
}
}
}
- $output .= '</span></td><td><input type="textbox" size="10" name="discussion_post_fonts_'.$cat.'_other" value="'.$curr{'other'}.'" /></td>';
+ $output .= '</span></td><td><input type="textbox" size="10" name="discussion_post_fonts_'.$cat.'_other" value="'.$curr{'other'}.'"'.$disabled.' /></td>';
}
$output .= &Apache::loncommon::end_data_table_row();
}
@@ -3788,7 +3881,7 @@
}
sub print_classlists {
- my ($position,$cdom,$settings,$itemtext,$rowtotal,$crstype) = @_;
+ my ($position,$cdom,$settings,$itemtext,$rowtotal,$crstype,$noedit) = @_;
my @ordered;
if ($position eq 'top') {
@ordered = ('default_enrollment_start_date',
@@ -3862,11 +3955,11 @@
($settings->{'student_classlist_view'} eq 'section')) {
$settings->{'student_classlist_view'} = 'disabled';
}
- return &make_item_rows($cdom,\%items,\@ordered,$settings,$rowtotal,$crstype,'classlists');
+ return &make_item_rows($cdom,\%items,\@ordered,$settings,$rowtotal,$crstype,'classlists',$noedit);
}
sub print_appearance {
- my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_;
+ my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype,$noedit) = @_;
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) {
return;
}
@@ -3919,11 +4012,11 @@
input => 'radio',
},
);
- return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'appearance');
+ return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'appearance',$noedit);
}
sub print_grading {
- my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_;
+ my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype,$noedit) = @_;
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) {
return;
}
@@ -3974,11 +4067,11 @@
input => 'radio',
},
);
- return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'grading');
+ return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'grading',$noedit);
}
sub print_printouts {
- my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_;
+ my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype,$noedit) = @_;
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) {
return;
}
@@ -4027,11 +4120,11 @@
nullval => &mt('None specified - use domain default'),
}
);
- return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'printouts');
+ return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'printouts',$noedit);
}
sub print_spreadsheet {
- my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_;
+ my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype,$noedit) = @_;
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) {
return;
}
@@ -4063,11 +4156,11 @@
input => 'radio',
},
);
- return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'spreadsheet');
+ return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'spreadsheet',$noedit);
}
sub print_bridgetasks {
- my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype) = @_;
+ my ($cdom,$settings,$ordered,$itemtext,$rowtotal,$crstype,$noedit) = @_;
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) {
return;
}
@@ -4105,11 +4198,11 @@
input => 'radio',
},
);
- return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'bridgetasks');
+ return &make_item_rows($cdom,\%items,$ordered,$settings,$rowtotal,$crstype,'bridgetasks',$noedit);
}
sub print_other {
- my ($cdom,$settings,$allitems,$rowtotal,$crstype) = @_;
+ my ($cdom,$settings,$allitems,$rowtotal,$crstype,$noedit) = @_;
unless ((ref($settings) eq 'HASH') && (ref($allitems) eq 'ARRAY')) {
return;
}
@@ -4130,7 +4223,7 @@
input => 'textbox',
size => '30',
};
- my $output = &make_item_rows($cdom,\%items,\@ordered,$settings,$rowtotal,$crstype,'other');
+ my $output = &make_item_rows($cdom,\%items,\@ordered,$settings,$rowtotal,$crstype,'other',$noedit);
}
sub get_other_items {
@@ -4179,7 +4272,7 @@
}
sub yesno_radio {
- my ($item,$settings,$unsetdefault,$valueyes,$valueno) = @_;
+ my ($item,$settings,$unsetdefault,$valueyes,$valueno,$noedit) = @_;
my $itemon = ' ';
my $itemoff = ' checked="checked" ';
if (($valueyes eq '') && ($valueno eq '')) {
@@ -4198,16 +4291,24 @@
}
}
}
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
return '<span class="LC_nobreak"><label>'.
'<input type="radio" name="'.$item.'"'.
- $itemon.' value="'.$valueyes.'" />'.&mt('Yes').'</label> '.
+ $itemon.' value="'.$valueyes.'"'.$disabled.' />'.&mt('Yes').'</label> '.
'<label><input type="radio" name="'.$item.'"'.
- $itemoff.' value="'.$valueno.'" />'.&mt('No').'</label></span>';
+ $itemoff.' value="'.$valueno.'"'.$disabled.' />'.&mt('No').'</label></span>';
}
sub select_from_options {
- my ($item,$order,$options,$curr,$nullval,$multiple,$maxsize,$onchange) = @_;
+ my ($item,$order,$options,$curr,$nullval,$multiple,$maxsize,$onchange,$noedit) = @_;
my $output;
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled=disabled"';
+ }
if ((ref($order) eq 'ARRAY') && (ref($options) eq 'HASH')) {
$output='<select name="'.$item.'" '.$onchange;
if ($multiple) {
@@ -4218,7 +4319,7 @@
$output .= ' size="'.$maxsize.'"';
}
}
- $output .= '>'."\n";
+ $output .= $disabled.'>'."\n";
if ($nullval ne '') {
$output .= '<option value=""';
if (ref($curr) eq 'ARRAY') {
@@ -4251,7 +4352,7 @@
}
sub make_item_rows {
- my ($cdom,$items,$ordered,$settings,$rowtotal,$crstype,$caller) = @_;
+ my ($cdom,$items,$ordered,$settings,$rowtotal,$crstype,$caller,$noedit) = @_;
my $datatable;
if ((ref($items) eq 'HASH') && (ref($ordered) eq 'ARRAY')) {
my $count = 0;
@@ -4277,15 +4378,19 @@
}
$datatable .= $showcredits;
} elsif ($item eq 'nothideprivileged') {
- $datatable .= ¬hidepriv_row($cdom,$item,$settings,$crstype);
+ $datatable .= ¬hidepriv_row($cdom,$item,$settings,$crstype,$noedit);
} elsif ($item eq 'checkforpriv') {
- $datatable .= &checkforpriv_row($cdom,$item,$settings,$crstype);
+ $datatable .= &checkforpriv_row($cdom,$item,$settings,$crstype,$noedit);
} elsif ($item eq 'print_header_format') {
- $datatable .= &print_hdrfmt_row($item,$settings);
+ $datatable .= &print_hdrfmt_row($item,$settings,$noedit);
} elsif ($items->{$item}{input} eq 'dates') {
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
$datatable .=
&Apache::lonhtmlcommon::date_setter('display',$item,
- $settings->{$item});
+ $settings->{$item},$disabled);
} elsif ($items->{$item}{input} eq 'radio') {
my ($unsetdefault,$valueyes,$valueno);
if (($item eq 'usejsme') || ($item eq 'uselcmath')) {
@@ -4296,17 +4401,23 @@
$valueyes = "1";
$valueno = "0";
}
- $datatable .= &yesno_radio($item,$settings,$unsetdefault,$valueyes,$valueno);
+ $datatable .= &yesno_radio($item,$settings,$unsetdefault,$valueyes,$valueno,$noedit);
} elsif ($items->{$item}{input} eq 'selectbox') {
my $curr = $settings->{$item};
$datatable .=
&select_from_options($item,$items->{$item}{'order'},
$items->{$item}{'options'},$curr,
- $items->{$item}{'nullval'});
+ $items->{$item}{'nullval'},
+ undef,undef,undef,$noedit);
} elsif ($items->{$item}{input} eq 'textbox') {
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled=disabled"';
+ }
$datatable .=
&Apache::lonhtmlcommon::textbox($item,$settings->{$item},
- $items->{$item}{size});
+ $items->{$item}{size},
+ $disabled);
}
$datatable .= &item_table_row_end();
}
@@ -4318,7 +4429,7 @@
}
sub nothidepriv_row {
- my ($cdom,$item,$settings,$crstype) = @_;
+ my ($cdom,$item,$settings,$crstype,$noedit) = @_;
my ($cnum) = &get_course();
my ($datatable,%nothide, at checkdoms);
if (ref($settings) eq 'HASH') {
@@ -4355,6 +4466,10 @@
}
}
if (@privusers > 0) {
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
$datatable .= '<table align="right">';
foreach my $user (sort(@privusers)) {
my $hideon = ' checked="checked" ';
@@ -4371,9 +4486,9 @@
'</td><td align="left">'.
'<span class="LC_nobreak"><label>'.
'<input type="radio" name="'.$item.'_'.$user.'"'.
- $hideon.' value="" />'.&mt('Hidden').'</label> '.
+ $hideon.' value=""'.$disabled.' />'.&mt('Hidden').'</label> '.
'<label><input type="radio" name="'.$item.'_'.$user.'"'.
- $hideoff.' value="yes" />'.&mt('Shown').'</label></span></td>'.
+ $hideoff.' value="yes"'.$disabled.' />'.&mt('Shown').'</label></span></td>'.
'</tr>';
}
$datatable .= '</table>';
@@ -4388,7 +4503,7 @@
}
sub checkforpriv_row {
- my ($cdom,$item,$settings,$crstype) = @_;
+ my ($cdom,$item,$settings,$crstype,$noedit) = @_;
my $datatable;
my %domains=map { $_ => 1; } &Apache::lonnet::all_domains();
if (keys(%domains) == 1) {
@@ -4401,12 +4516,17 @@
if ($settings->{$item} eq '') {
$datatable = '</td><td align="right">'.
&Apache::loncommon::select_dom_form('','checkforpriv_'.$num,
- 1,1,undef,undef,\@excdoms);
+ 1,1,undef,undef,\@excdoms,
+ $noedit);
} else {
my @privdoms = split(/,/,$settings->{$item});
my %domains=map { $_ => 1; } &Apache::lonnet::all_domains();
$datatable = '</td><td align="right"><br />'.
&Apache::loncommon::start_data_table();
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
if (@privdoms > 0) {
foreach my $currdom (@privdoms) {
next unless ($domains{$currdom});
@@ -4421,7 +4541,7 @@
'</b><input type="hidden" name="checkforpriv_'.$num.
'" value="'.$currdom.'" /></span><br />'.
'<span class="LC_nobreak"><label><input type="checkbox" '.
- 'name="checkforpriv_delete" value="'.$num.'" />'.
+ 'name="checkforpriv_delete" value="'.$num.'"'.$disabled.' />'.
&mt('Delete').'</label></span></td>'.
&Apache::loncommon::end_data_table_row();
$num ++;
@@ -4436,7 +4556,7 @@
'<td align="left"><span class="LC_nobreak">'.
&mt('Additional domain:'). '</span><br />'.
&Apache::loncommon::select_dom_form('','checkforpriv_'.$num,1,
- 1,undef,undef,\@excdoms).
+ 1,undef,undef,\@excdoms,$noedit).
'</td>'.&Apache::loncommon::end_data_table_row();
}
$datatable .= &Apache::loncommon::end_data_table().
@@ -4447,7 +4567,7 @@
}
sub print_hdrfmt_row {
- my ($item,$settings) = @_;
+ my ($item,$settings,$noedit) = @_;
my @curr;
my $currnum = 0;
my $maxnum = 2;
@@ -4520,36 +4640,43 @@
ENDJS
$output .= '</td><td align="right"><br />'.
$currstr.'<table class="LC_data_table">';
+ my $disabled;
+ if ($noedit) {
+ $disabled = ' disabled="disabled"';
+ }
if (@curr > 0) {
for (my $i=0; $i<@curr; $i++) {
my $pos = $i+1;
$output .= '<tr>'.
'<td align="left"><span class="LC_nobreak">'.
- &position_selector($pos,$i,$maxnum).&mt('Delete:').
+ &position_selector($pos,$i,$maxnum,$disabled).&mt('Delete:').
'<input type="checkbox" name="printfmthdr_del_'.$i.
- '" /></span></td>';
+ '"'.$disabled.' /></span></td>';
if ($curr[$i] =~ /^%\d*[nca]$/) {
my ($limit,$subst) = ($curr[$i] =~ /^%(\d*)([nca])$/);
$output .= '<td align="left">'.
- &substitution_selector($i,$subst,$limit).'</td>';
+ &substitution_selector($i,$subst,$limit,$disabled).'</td>';
} else {
$output .= '<td colspan="2" align="left">'.&mt('Text').'<br />'.
'<input type="textbox" name="printfmthdr_text_'.$i.'"'.
- ' value="'.$curr[$i].'" size="25" /></td>';
+ ' value="'.$curr[$i].'" size="25"'.$disabled.' /></td>';
}
$output .= '</tr>';
}
}
my $pos = $currnum+1;
- $output .= '<tr>'.
+ unless ($noedit) {
+ $output .=
+ '<tr>'.
'<td align="left"><span class="LC_nobreak">'.
&position_selector($pos,$currnum,$maxnum).
'<b>'.&mt('New').'</b></span></td><td align="left">'.
&substitution_selector($currnum).'</td>'.
'</tr>';
- $pos ++;
- $currnum ++;
- $output .= '<tr>'.
+ $pos ++;
+ $currnum ++;
+ $output .=
+ '<tr>'.
'<td align="left"><span class="LC_nobreak">'.
&position_selector($pos,$currnum,$maxnum).
'<b>'.&mt('New').'</b></span></td>'.
@@ -4558,14 +4685,15 @@
'" value="" size ="25" />'.
'<input type="hidden" name="printfmthdr_maxnum" value="'.
$maxnum.'" /></td>'.
- '</tr>'.
- '</table><br />';
+ '</tr>';
+ }
+ $output .= '</table><br />';
return $output;
}
sub position_selector {
- my ($pos,$num,$maxnum) = @_;
- my $output = '<select name="printfmthdr_pos_'.$num.'" onchange="reOrder('."'$num'".');">';
+ my ($pos,$num,$maxnum,$disabled) = @_;
+ my $output = '<select name="printfmthdr_pos_'.$num.'" onchange="reOrder('."'$num'".');"'.$disabled.'>';
for (my $j=1; $j<=$maxnum; $j++) {
my $sel = '';
if ($pos == $j) {
@@ -4579,7 +4707,7 @@
}
sub substitution_selector {
- my ($num,$subst,$limit,$crstype) = @_;
+ my ($num,$subst,$limit,$crstype,$disabled) = @_;
my ($stunametxt,$crsidtxt);
if ($crstype eq 'Community') {
$stunametxt = 'member name';
@@ -4594,7 +4722,7 @@
a => 'assignment note',
);
my $output .= &mt('Substitution').'<br />'.
- '<select name="printfmthdr_sub_'.$num.'">';
+ '<select name="printfmthdr_sub_'.$num.'"'.$disabled.'>';
if ($subst eq '') {
$output .= '<option value="" selected="selected"> </option>';
}
@@ -4608,7 +4736,7 @@
}
$output .= '</select></td><td align="left">'.&mt('Size limit').'<br />'.
'<input type="textbox" name="printfmthdr_limit_'.$num.
- '" value="'.$limit.'" size="5" /></span>';
+ '" value="'.$limit.'" size="5"'.$disabled.' /></span>';
return $output;
}
More information about the LON-CAPA-cvs
mailing list