--- loncom/interface/lonparmset.pm 2016/07/19 21:55:12 1.563 +++ loncom/interface/lonparmset.pm 2016/10/16 21:49:51 1.568 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.563 2016/07/19 21:55:12 damieng Exp $ +# $Id: lonparmset.pm,v 1.568 2016/10/16 21:49:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -371,10 +371,10 @@ sub endSettingsScreen { # (parmval is also used for the log of parameter changes) ################################################## -# Calls parmval_by_symb, getting the symb from $id (the big hash resource id) with &symbcache. +# Calls parmval_by_symb, getting the symb from $id with &symbcache. # # @param {string} $what - part info and parameter name separated by a dot, e.g. '0.weight' -# @param {string} $id - big hash resource id +# @param {string} $id - resource id or map pc # @param {string} $def - the resource's default value for this parameter # @param {string} $uname - user name # @param {string} $udom - user domain @@ -394,7 +394,7 @@ sub parmval { # (level 1 is the most specific and will have precedence) # # @param {string} $what - part info and parameter name separated by a dot, e.g. '0.weight' -# @param {string} $symb - resource symb +# @param {string} $symb - resource symb or map src # @param {string} $def - the resource's default value for this parameter # @param {string} $uname - user name # @param {string} $udom - user domain @@ -597,7 +597,7 @@ sub reset_caches { } } -# cache big hash id -> symb, using lonnavmaps to find association +# cache resource id or map pc -> resource symb or map src, using lonnavmaps to find association { my $symbsid; # course identifier, to initialize the cache only once for a course my %symbs; # hash id->symb @@ -607,7 +607,8 @@ sub reset_caches { undef(%symbs); } - # returns the symb corresponding to a big hash id (using lonnavmaps and a cache) + # returns the resource symb or map src corresponding to a resource id or map pc + # (using lonnavmaps and a cache) sub symbcache { my $id=shift; if ($symbsid ne $env{'request.course.id'}) { @@ -718,8 +719,8 @@ sub date_sanity_info { # Store a parameter value and type by ID, also triggering more parameter changes based on parameter default actions. # -# @param {string} $sresid - resource big hash id -# @param {string} $spnam - part info and parameter name separated by a dot, e.g. '0.weight' +# @param {string} $sresid - resource id or map pc +# @param {string} $spnam - part info and parameter name separated by a dot or underscore, e.g. '0.weight' # @param {integer} $snum - level # @param {string} $nval - new value # @param {string} $ntype - new type @@ -737,8 +738,8 @@ my %recstack; # hash parameter name -> 1 # Store a parameter value and type by symb, also triggering more parameter changes based on parameter default actions. # Uses storeparm_by_symb_inner to actually store the parameter, ignoring any returned error. # -# @param {string} $symb - resource symb -# @param {string} $spnam - part info and parameter name separated by a dot, e.g. '0.weight' +# @param {string} $symb - resource symb or map src +# @param {string} $spnam - part info and parameter name separated by a dot or underscore, e.g. '0.weight' # @param {integer} $snum - level # @param {string} $nval - new value # @param {string} $ntype - new type @@ -776,8 +777,7 @@ sub storeparm_by_symb { # are there restrictions? if (&rulescache($triggered.'_triggervalue')=~/\w/) { $active=0; - foreach my $possiblevalue (split(/\s*\, - \s*/,&rulescache($triggered.'_triggervalue'))) { + foreach my $possiblevalue (split(/\s*\,\s*/,&rulescache($triggered.'_triggervalue'))) { if (lc($possiblevalue) eq lc($nval)) { $active=1; } } } @@ -808,7 +808,7 @@ sub log_parmset { # Store a parameter value and type by symb, without using the parameter default actions. # Expire related sheets. # -# @param {string} $symb - resource symb +# @param {string} $symb - resource symb or map src # @param {string} $spnam - part info and parameter name separated by a dot, e.g. '0.weight' # @param {integer} $snum - level # @param {string} $nval - new value @@ -1365,7 +1365,7 @@ ENDHEAD # @param {string} $which - parameter key ('parameter_'.part.'_'.name) # @param {hash reference} $part - parameter key -> parameter part (can be problem part.'_'.response id for response parameters) # @param {hash reference} $name - parameter key -> parameter name -# @param {hash reference} $symbp - resource id -> symb +# @param {hash reference} $symbp - map pc or resource/map id -> map src.'___(all)' or resource symb # @param {string} $rid - resource id # @param {hash reference} $default - parameter key -> resource parameter default value # @param {hash reference} $defaulttype - parameter key -> resource parameter default type @@ -1380,9 +1380,11 @@ ENDHEAD # @param {string} $cgroup - group name # @param {array reference} $usersgroups - list of groups the user belongs to, if any # @param {boolean} $noeditgrp - true if no edit is allowed for group level parameters +# @param {boolean} $readonly - true if no editing allowed. sub print_row { my ($r,$which,$part,$name,$symbp,$rid,$default,$defaulttype,$display,$defbgone, - $defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups,$noeditgrp)=@_; + $defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups,$noeditgrp, + $readonly)=@_; my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); @@ -1427,27 +1429,27 @@ sub print_row { if ($parmlev eq 'general') { if ($uname) { - &print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); + &print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); } elsif ($cgroup) { - &print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); + &print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly); } elsif ($csec) { - &print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); + &print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); } else { - &print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); + &print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); } } elsif ($parmlev eq 'map') { if ($uname) { - &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); + &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); } elsif ($cgroup) { - &print_td($r,7,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); - &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); + &print_td($r,7,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly); + &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly); } elsif ($csec) { - &print_td($r,11,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); + &print_td($r,11,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); } else { - &print_td($r,17,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); + &print_td($r,17,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); } } else { if ($uname) { @@ -1467,35 +1469,35 @@ sub print_row { } } - &print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,17,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,15,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,14,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); + &print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,17,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,15,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,14,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); if ($csec) { - &print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,11,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); + &print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,11,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); } if ($cgroup) { - &print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); - &print_td($r,7,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); - &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); - &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); + &print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,'',$readonly); + &print_td($r,7,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,'',$readonly); + &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,'',$readonly); + &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp.'',$readonly); } if ($uname) { if ($othergrp) { $r->print($othergrp); } - &print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); + &print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); + &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); } } # end of $parmlev if/else @@ -1532,26 +1534,31 @@ sub print_row { # @param {array reference} $typeoutpar - array level -> parameter type (when defined) # @param {hash reference} $display - parameter key -> full title for the parameter # @param {boolean} $noeditgrp - true if no edit is allowed for group level parameters +# @param {boolean} $readonly -true if editing not allowed. sub print_td { - my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,$noeditgrp)=@_; + my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,$noeditgrp,$readonly)=@_; $r->print(''); my $nolink = 0; - if ($which == 14 || $which == 15) { - $nolink = 1; - } elsif (($env{'request.course.sec'} ne '') && ($which > 12)) { + if ($readonly) { $nolink = 1; - } elsif ($which == 5 || $which == 6 || $which == 7 || $which == 8) { - if ($noeditgrp) { + } else { + if ($which == 14 || $which == 15) { $nolink = 1; - } - } elsif ($mprefix =~ /availablestudent\&$/) { - if ($which > 4) { - $nolink = 1; - } - } elsif ($mprefix =~ /examcode\&$/) { - unless ($which == 2) { + } elsif (($env{'request.course.sec'} ne '') && ($which > 12)) { $nolink = 1; + } elsif ($which == 5 || $which == 6 || $which == 7 || $which == 8) { + if ($noeditgrp) { + $nolink = 1; + } + } elsif ($mprefix =~ /availablestudent\&$/) { + if ($which > 4) { + $nolink = 1; + } + } elsif ($mprefix =~ /examcode\&$/) { + unless ($which == 2) { + $nolink = 1; + } } } if ($nolink) { @@ -1651,16 +1658,16 @@ sub parm_control_group { # Extracts lots of information about all of the the course's resources into a variety of hashes, using lonnavmaps and lonnet::metadata. # All the parameters are references and are filled by the sub. # -# @param {array reference} $ids - resource ids -# @param {hash reference} $typep - hash resource id (from big hash) -> resource type (file extension) -# @param {hash reference} $keyp - hash resource id -> comma-separated list of parameter keys from lonnet::metadata +# @param {array reference} $ids - resource and map ids +# @param {hash reference} $typep - hash resource/map id -> resource type (file extension) +# @param {hash reference} $keyp - hash resource/map id -> comma-separated list of parameter keys from lonnet::metadata # @param {hash reference} $allparms - hash parameter name -> parameter title # @param {hash reference} $allparts - hash parameter part -> part title (a parameter part can be problem part.'_'.response id for response parameters) -# @param {hash reference} $allmaps - hash map id (from big hash) -> map src -# @param {hash reference} $mapp - hash resource id -> enclosing map src -# @param {hash reference} $symbp - hash map id or resource id -> map src.'___(all)' for a map or resource symb for a resource -# @param {hash reference} $maptitles - hash map id or src -> map title (this should really be two separate hashes) -# @param {hash reference} $uris - hash resource id -> resource src +# @param {hash reference} $allmaps - hash map pc -> map src +# @param {hash reference} $mapp - hash map pc or resource/map id -> enclosing map src +# @param {hash reference} $symbp - hash map pc or resource/map id -> map src.'___(all)' for a map or resource symb for a resource +# @param {hash reference} $maptitles - hash map pc or src -> map title (this should really be two separate hashes) +# @param {hash reference} $uris - hash resource/map id -> resource src # @param {hash reference} $keyorder - hash parameter key -> appearance rank for this parameter when looking through every resource and every parameter, starting at 100 (integer) # @param {hash reference} $defkeytype - hash parameter name -> parameter type sub extractResourceInformation { @@ -2261,10 +2268,10 @@ sub displaymenu { # Used by table mode and overview mode. # # @param {Apache2::RequestRec} $r - the Apache request -# @param {hash reference} $allmaps - hash map id -> map src -# @param {string} $pschp - selected map id, or 'all' +# @param {hash reference} $allmaps - hash map pc -> map src +# @param {string} $pschp - selected map pc, or 'all' # @param {hash reference} $maptitles - hash map id or src -> map title -# @param {hash reference} $symbp - hash map id or resource id -> map src.'___(all)' for a map or resource symb for a resource +# @param {hash reference} $symbp - hash map pc or resource/map id -> map src.'___(all)' or resource symb sub mapmenu { my ($r,$allmaps,$pschp,$maptitles,$symbp)=@_; my %allmaps_inverted = reverse %$allmaps; @@ -2620,7 +2627,7 @@ sub standardkeyorder { # pres_value - &&&-separated parameter values # prevvisit - '1' if the user has submitted the form before # pscat (multiple values) - selected parameter names -# pschp - selected map id, or 'all' +# pschp - selected map pc, or 'all' # psprt (multiple values) - list of selected parameter parts # filter - part of or whole parameter name, to be filtered out when parameters are displayed (unused ?) # recent_* (* = parameter type) - recent values entered by the user for parameter types @@ -2630,20 +2637,22 @@ sub standardkeyorder { # url - used only with command 'set', the resource url # # @param {Apache2::RequestRec} $r - the Apache request +# @param $parm_permission - ref to hash of permissions +# if $parm_permission->{'edit'} is true, editing is allowed. sub assessparms { - my $r=shift; + my ($r,$parm_permission) = @_; # -------------------------------------------------------- Variable declaration - my @ids=(); # resource ids - my %symbp=(); # hash map id or resource id -> map src.'___(all)' for a map or resource symb for a resource - my %mapp=(); # hash resource id -> enclosing map src - my %typep=(); # hash resource id (from big hash) -> resource type (file extension) - my %keyp=(); # hash resource id -> comma-separated list of parameter keys - my %uris=(); # hash resource id -> resource src - my %maptitles=(); # hash map id or src -> map title - my %allmaps=(); # hash map id (from big hash) -> map src + my @ids=(); # resource and map ids + my %symbp=(); # hash map pc or resource/map id -> map src.'___(all)' or resource symb + my %mapp=(); # hash map pc or resource/map id -> enclosing map src + my %typep=(); # hash resource/map id -> resource type (file extension) + my %keyp=(); # hash resource/map id -> comma-separated list of parameter keys + my %uris=(); # hash resource/map id -> resource src + my %maptitles=(); # hash map pc or src -> map title + my %allmaps=(); # hash map pc -> map src my %alllevs=(); # hash English level title -> value my $uname; # selected user name @@ -2803,7 +2812,7 @@ sub assessparms { $symbp{'0.0'} = ''; # ---------------------------------------------------------- Anything to store? - if ($env{'form.pres_marker'}) { + if ($env{'form.pres_marker'} && $parm_permission->{'edit'}) { my @markers=split(/\&\&\&/,$env{'form.pres_marker'}); my @values=split(/\&\&\&/,$env{'form.pres_value'}); my @types=split(/\&\&\&/,$env{'form.pres_type'}); @@ -3096,6 +3105,10 @@ ENDPARMSELSCRIPT my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; my $csuname=$env{'user.name'}; my $csudom=$env{'user.domain'}; + my $readonly = 1; + if ($parm_permission->{'edit'}) { + undef($readonly); + } if ($parmlev eq 'full') { # @@ -3279,7 +3292,7 @@ ENDTABLEHEADFOUR &print_row($r,$item,\%part,\%name,\%symbp,$rid,\%default, \%type,\%display,$defbgone,$defbgtwo, $defbgthree,$parmlev,$uname,$udom,$csec, - $cgroup,\@usersgroups,$noeditgrp); + $cgroup,\@usersgroups,$noeditgrp,$readonly); } } } @@ -3402,7 +3415,8 @@ ENDTABLEHEADFOUR $r->print(&Apache::loncommon::start_data_table_row()); &print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default, \%type,\%display,$defbgone,$defbgtwo,$defbgthree, - $parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp); + $parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp, + $readonly); } $r->print(&Apache::loncommon::end_data_table().'

' .'' @@ -3491,8 +3505,9 @@ ENDMAPONE foreach my $item (&keysinorder(\%name,\%keyorder)) { $r->print(&Apache::loncommon::start_data_table_row()); &print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default, - \%type,\%display,$defbgone,$defbgtwo,$defbgthree, - $parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp); + \%type,\%display,$defbgone,$defbgtwo,$defbgthree, + $parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp, + $readonly); } $r->print(&Apache::loncommon::end_data_table() .'

' @@ -3850,9 +3865,10 @@ sub parse_listdata_key { # @param {string} $sortorder - realmstudent|studentrealm # @param {string} $caller - name of the calling sub (overview|newoverview) # @param {hash reference} $classlist - from loncoursedata::get_classlist +# @param {boolean} $readonly - true if editing not allowed # @returns{integer} - number of $listdata parameters processed sub listdata { - my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist)=@_; + my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist,$readonly)=@_; # Start list output @@ -3916,7 +3932,6 @@ sub listdata { } keys(%{$listdata})) { # foreach my $thiskey - my $readonly; if ($$listdata{$thiskey.'.type'}) { my $thistype=$$listdata{$thiskey.'.type'}; if ($$resourcedata{$thiskey.'.type'}) { @@ -4140,7 +4155,7 @@ sub string_ip_selector { @{$access{'deny'}} = (''); } my ($disabled,$addmore); - if ($disabled) { + if ($readonly) { $disabled=' disabled="disabled"'; } else { $addmore = "\n".''; @@ -4561,17 +4576,21 @@ sub date_interval_selector { $currprocdisplay = 'text'; } my $onclick = ' onclick="toggleSecret(this.form,'."'done_','$thiskey'".');"'; + my $disabled; + if ($readonly) { + $disabled = ' disabled="disabled"'; + } $result .= '
'.&mt('Include "done" button'). - '
'. + 'name="done_'.$thiskey.'_proctorkey" value="'.&HTML::Entities::encode($currproctorkey,'"<>&').'"'.$disabled.' />
'. ''.&mt('Button text').': '. - '&').'" />'; + '&').'"'.$disabled.' />'; } } unless ($readonly) { @@ -4705,11 +4724,15 @@ sub dateshift { # # @param {Apache2::RequestRec} $r - the Apache request sub newoverview { - my ($r) = @_; + my ($r,$parm_permission) = @_; my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; + my $readonly = 1; + if ($parm_permission->{'edit'}) { + undef($readonly); + } &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', text=>"Overview Mode"}); @@ -4868,11 +4891,13 @@ ENDOVER # List data - &listdata($r,$resourcedata,$listdata,$sortorder,'newoverview'); + &listdata($r,$resourcedata,$listdata,$sortorder,'newoverview',undef,$readonly); } - $r->print(&tableend(). - ((($env{'form.store'}) || ($env{'form.dis'}))?'

':''). - ''); + $r->print(&tableend()); + unless ($readonly) { + $r->print( ((($env{'form.store'}) || ($env{'form.dis'}))?'

':'') ); + } + $r->print(''); &endSettingsScreen($r); $r->print(&Apache::loncommon::end_page()); } @@ -4882,15 +4907,15 @@ ENDOVER # The non-type value is always 1. # # @param {string} $cat - parameter name -# @param {string} $pschp - selected map id, or 'all' +# @param {string} $pschp - selected map pc, or 'all' # @param {string} $parmlev - selected level value (full|map|general), or '' # @param {hash reference} $listdata - the parameter data that will be modified # @param {array reference} $psprt - selected parts # @param {array reference} $selections - selected sections # @param {hash reference} $defkeytype - hash parameter name -> parameter type -# @param {hash reference} $allmaps - hash map id -> map src -# @param {array reference} $ids - resource ids -# @param {hash reference} $symbp - hash map id or resource id -> map src.'___(all)' for a map or resource symb for a resource +# @param {hash reference} $allmaps - hash map pc -> map src +# @param {array reference} $ids - resource and map ids +# @param {hash reference} $symbp - hash map pc or resource/map id -> map src.'___(all)' or resource symb sub secgroup_lister { my ($cat,$pschp,$parmlev,$listdata,$psprt,$selections,$defkeytype,$allmaps,$ids,$symbp) = @_; foreach my $item (@{$selections}) { @@ -4934,10 +4959,14 @@ sub secgroup_lister { # # @param {Apache2::RequestRec} $r - the Apache request sub overview { - my ($r) = @_; + my ($r,$parm_permission) = @_; my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; + my $readonly = 1; + if ($parm_permission->{'edit'}) { + undef($readonly); + } my $js = '