[LON-CAPA-cvs] cvs: loncom /auth roles.tab rolesplain.tab /interface loncommon.pm londocs.pm lonextresedit.pm lonmenu.pm lonnavmaps.pm

raeburn raeburn at source.lon-capa.org
Mon Nov 21 19:45:00 EST 2016


raeburn		Tue Nov 22 00:45:00 2016 EDT

  Modified files:              
    /loncom/interface	loncommon.pm londocs.pm lonextresedit.pm 
                     	lonmenu.pm lonnavmaps.pm 
    /loncom/auth	roles.tab rolesplain.tab 
  Log:
  - 'cev' priv assignable to custom roles in course/community allows 
    view-only access to Course Editor. 
    - Intended for assignment to custom ad hoc course/community roles assignable
      to domain helpdesk personnel.
  
  
-------------- next part --------------
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1264 loncom/interface/loncommon.pm:1.1265
--- loncom/interface/loncommon.pm:1.1264	Mon Nov 21 00:06:19 2016
+++ loncom/interface/loncommon.pm	Tue Nov 22 00:43:12 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1264 2016/11/21 00:06:19 raeburn Exp $
+# $Id: loncommon.pm,v 1.1265 2016/11/22 00:43:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2185,7 +2185,7 @@
 }
 
 sub import_crsauthor_form {
-    my ($form,$firstselectname,$secondselectname,$onchangefirst,$only,$suffix) = @_;
+    my ($form,$firstselectname,$secondselectname,$onchangefirst,$only,$suffix,$disabled) = @_;
     return (0) unless ($env{'request.course.id'});
     my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
     my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.610 loncom/interface/londocs.pm:1.611
--- loncom/interface/londocs.pm:1.610	Mon Oct 31 19:48:59 2016
+++ loncom/interface/londocs.pm	Tue Nov 22 00:43:12 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.610 2016/10/31 19:48:59 raeburn Exp $
+# $Id: londocs.pm,v 1.611 2016/11/22 00:43:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -877,13 +877,13 @@
 }
 
 sub docs_change_log {
-    my ($r,$coursenum,$coursedom,$folder,$allowed,$crstype,$iconpath)=@_;
+    my ($r,$coursenum,$coursedom,$folder,$allowed,$crstype,$iconpath,$canedit)=@_;
     my $supplementalflag=($env{'form.folderpath'}=~/^supplemental/);
     my $js = '<script type="text/javascript">'."\n".
              '// <![CDATA['."\n".
              &Apache::loncommon::display_filter_js('docslog')."\n".
              &editing_js($env{'user.domain'},$env{'user.name'},$supplementalflag,
-                         $coursedom,$coursenum)."\n".
+                         $coursedom,$coursenum,'','',$canedit)."\n".
              &history_tab_js()."\n".
              &Apache::lonratedt::editscript('simple')."\n".
              '// ]]>'."\n".
@@ -2970,7 +2970,7 @@
 
 sub editor {
     my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$crstype,
-        $supplementalflag,$orderhash,$iconpath,$pathitem,$ltitoolsref)=@_;
+        $supplementalflag,$orderhash,$iconpath,$pathitem,$ltitoolsref,$canedit)=@_;
     my ($randompick,$ishidden,$isencrypted,$plain,$is_random_order,$container);
     if ($allowed) {
         (my $breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain,
@@ -3007,7 +3007,7 @@
 # ------------------------------------------------------------ Process commands
 
 # ---------------- if they are for this folder and user allowed to make changes
-    if (($allowed) && ($env{'form.folder'} eq $folder)) {
+    if (($allowed && $canedit) && ($env{'form.folder'} eq $folder)) {
 # set parameters and change order
 	&snapshotbefore();
 
@@ -3287,16 +3287,16 @@
         $output .= &entryline($idx,$name,$url,$folder,$allowed,$res,
                               $coursenum,$coursedom,$crstype,
                               $pathitem,$supplementalflag,$container,
-                              \%filters,\%curr_groups,$ltitoolsref);
+                              \%filters,\%curr_groups,$ltitoolsref,$canedit);
         $idx++;
         $shown++;
     }
     &Apache::loncommon::end_data_table_count();
 
     my $need_save;
-    if (($allowed) || ($supplementalflag && $folder eq 'supplemental')) {
+    if ($allowed || ($supplementalflag && $folder eq 'supplemental')) {
         my $toolslink;
-        if ($allowed || &Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
+        if ($allowed) {
             $toolslink = '<table><tr><td>'
                        .&Apache::loncommon::help_open_menu('Navigation Screen',
                                                            'Navigation_Screen',undef,'RAT')
@@ -3343,12 +3343,12 @@
                                 &Apache::loncommon::continue_data_table_row().
                                 '<td colspan="2"> </td>'.
                                 '<td>'.
-                                &multiple_check_form('actions',\%lists).
+                                &multiple_check_form('actions',\%lists,$canedit).
                                 '</td>'.
                                 '<td> </td>'.
                                 '<td> </td>'.
                                 '<td colspan="4">'.
-                                &multiple_check_form('settings',\%lists).
+                                &multiple_check_form('settings',\%lists,$canedit).
                                 '</td>'.
                                 &Apache::loncommon::end_data_table_row();
                              $need_save = 1;
@@ -3395,8 +3395,10 @@
     if ($allowed) {
         my $readfile="/uploaded/$coursedom/$coursenum/$folder.$container";
         $r->print(&generate_edit_table($tid,$orderhash,$to_show,$iconpath,
-                                       $jumpto,$readfile,$need_save,"$folder.$container"));
-        &print_paste_buffer($r,$container,$folder,$coursedom,$coursenum);
+                                       $jumpto,$readfile,$need_save,"$folder.$container",$canedit));
+        if ($canedit) {
+            &print_paste_buffer($r,$container,$folder,$coursedom,$coursenum);
+        }
     } else {
         $r->print($to_show);
     }
@@ -3404,8 +3406,12 @@
 }
 
 sub multiple_check_form {
-    my ($caller,$listsref) = @_;
+    my ($caller,$listsref,$canedit) = @_;
     return unless (ref($listsref) eq 'HASH');
+    my $disabled;
+    unless ($canedit) {
+        $disabled = 'disabled="disabled"'; 
+    }
     my $output =
     '<form action="/adm/coursedocs" method="post" name="togglemult'.$caller.'">'.
     '<span class="LC_nobreak" style="font-size:x-small;font-weight:bold;">'.
@@ -3418,15 +3424,15 @@
             '<table><tr>'.
             '<td class="LC_docs_entry_parameter">'.
             '<span class="LC_nobreak"><label>'.
-            '<input type="checkbox" name="hiddenresourceall" id="hiddenresourceall" onclick="propagateState(this.form,'."'hiddenresource'".')" />'.&mt('Hidden').
+            '<input type="checkbox" name="hiddenresourceall" id="hiddenresourceall" onclick="propagateState(this.form,'."'hiddenresource'".')"'.$disabled.' />'.&mt('Hidden').
             '</label></span></td>'.
             '<td class="LC_docs_entry_parameter">'.
-            '<span class="LC_nobreak"><label><input type="checkbox" name="randompickall" id="randompickall" onclick="updatePick(this.form,'."'all','check'".');propagateState(this.form,'."'randompick'".');propagateState(this.form,'."'rpicknum'".');" />'.&mt('Randomly Pick').'</label><span id="rpicktextall"></span><input type="hidden" name="rpicknumall" id="rpicknumall" value="" />'.
+            '<span class="LC_nobreak"><label><input type="checkbox" name="randompickall" id="randompickall" onclick="updatePick(this.form,'."'all','check'".');propagateState(this.form,'."'randompick'".');propagateState(this.form,'."'rpicknum'".');"'.$disabled.' />'.&mt('Randomly Pick').'</label><span id="rpicktextall"></span><input type="hidden" name="rpicknumall" id="rpicknumall" value="" />'.
             '</span></td>'.
             '</tr>'."\n".
             '<tr>'.
             '<td class="LC_docs_entry_parameter">'.
-            '<span class="LC_nobreak"><label><input type="checkbox" name="encrypturlall" id="encrypturlall" onclick="propagateState(this.form,'."'encrypturl'".')" />'.&mt('URL hidden').'</label></span></td><td class="LC_docs_entry_parameter"><span class="LC_nobreak"><label><input type="checkbox" name="randomorderall" id="randomorderall" onclick="propagateState(this.form,'."'randomorder'".')" />'.&mt('Random Order').
+            '<span class="LC_nobreak"><label><input type="checkbox" name="encrypturlall" id="encrypturlall" onclick="propagateState(this.form,'."'encrypturl'".')"'.$disabled.' />'.&mt('URL hidden').'</label></span></td><td class="LC_docs_entry_parameter"><span class="LC_nobreak"><label><input type="checkbox" name="randomorderall" id="randomorderall" onclick="propagateState(this.form,'."'randomorder'".')"'.$disabled.' />'.&mt('Random Order').
             '</label></span>'.
             '</td></tr></table>'."\n";
     } else {
@@ -3434,15 +3440,15 @@
             '<table><tr>'.
             '<td class="LC_docs_entry_parameter">'.
             '<span class="LC_nobreak LC_docs_remove">'.
-            '<label><input type="checkbox" name="removeall" id="removeall" onclick="propagateState(this.form,'."'remove'".')" />'.&mt('Remove').
+            '<label><input type="checkbox" name="removeall" id="removeall" onclick="propagateState(this.form,'."'remove'".')"'.$disabled.' />'.&mt('Remove').
             '</label></span></td>'.
             '<td class="LC_docs_entry_parameter">'.
             '<span class="LC_nobreak LC_docs_cut">'.
-            '<label><input type="checkbox" name="cut" id="cutall" onclick="propagateState(this.form,'."'cut'".');" />'.&mt('Cut').
+            '<label><input type="checkbox" name="cut" id="cutall" onclick="propagateState(this.form,'."'cut'".');"'.$disabled.' />'.&mt('Cut').
             '</label></span></td>'."\n".
             '<td class="LC_docs_entry_parameter">'.
             '<span class="LC_nobreak LC_docs_copy">'.
-            '<label><input type="checkbox" name="copyall" id="copyall" onclick="propagateState(this.form,'."'copy'".')" />'.&mt('Copy').
+            '<label><input type="checkbox" name="copyall" id="copyall" onclick="propagateState(this.form,'."'copy'".')"'. $disabled.' />'.&mt('Copy').
             '</label></span></td>'.
             '</tr></table>'."\n";
     }
@@ -3656,7 +3662,7 @@
 sub entryline {
     my ($index,$title,$url,$folder,$allowed,$residx,$coursenum,$coursedom,
         $crstype,$pathitem,$supplementalflag,$container,$filtersref,$currgroups,
-        $ltitoolsref)=@_;
+        $ltitoolsref,$canedit)=@_;
     my ($foldertitle,$renametitle,$oldtitle);
     if (&is_supplemental_title($title)) {
 	($title,$foldertitle,$renametitle) = &Apache::loncommon::parse_supplemental_title($title);
@@ -3666,6 +3672,12 @@
 	$foldertitle=$title;
     }
 
+    my ($disabled,$readonly,$js_lt);
+    unless ($canedit) {
+        $disabled = 'disabled="disabled"';
+        $readonly = 1;
+    }
+
     my $orderidx=$LONCAPA::map::order[$index];
 
     $renametitle=~s/\\/\\\\/g;
@@ -3729,7 +3741,7 @@
 	     ne '')) {
 	    $selectbox=
 		'<input type="hidden" name="currentpos" value="'.$incindex.'" />'.
-		'<select name="newpos" onchange="this.form.submit()">';
+		'<select name="newpos" onchange="this.form.submit()"'.$disabled.'>';
 	    for (my $i=1;$i<=$#LONCAPA::map::order+1;$i++) {
 		if ($i==$incindex) {
 		    $selectbox.='<option value="" selected="selected">('.$i.')</option>';
@@ -3752,7 +3764,8 @@
                 'pr' => 'Preview',
                 'sv' => 'Save',
                 'ul' => 'URL',
-                'ti' => 'Title', 
+                'ti' => 'Title',
+                'er' => 'Editing rights unavailable for your current role', 
                 );
 	my %denied = &action_restrictions($coursenum,$coursedom,$url,
                                           $env{'form.folderpath'},
@@ -3786,7 +3799,7 @@
 	    $copylink=(<<ENDCOPY);
 <form name="$formname" method="post" action="/adm/coursedocs">
 $form_common
-<input type="checkbox" name="copy" id="copy_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','copy');" class="LC_hidden" /><a href="$js" class="LC_docs_copy">$lt{'cp'}</a>
+<input type="checkbox" name="copy" id="copy_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','copy');" class="LC_hidden" $disabled /><a href="$js" class="LC_docs_copy">$lt{'cp'}</a>
 $form_end
 ENDCOPY
             if (($ishash) && (ref($filtersref->{'cancopy'}) eq 'ARRAY')) {
@@ -3804,7 +3817,7 @@
 <form name="$formname" method="post" action="/adm/coursedocs">
 $form_common
 <input type="hidden" name="skip_$orderidx" id="skip_cut_$orderidx" value="$skip_confirm" />
-<input type="checkbox" name="cut" id="cut_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','cut');" class="LC_hidden" /><a href="$js" class="LC_docs_cut">$lt{'ct'}</a>
+<input type="checkbox" name="cut" id="cut_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','cut');" class="LC_hidden" $disabled /><a href="$js" class="LC_docs_cut">$lt{'ct'}</a>
 $form_end
 ENDCUT
             if (($ishash) && (ref($filtersref->{'cancut'}) eq 'ARRAY')) {
@@ -3823,7 +3836,7 @@
 $form_common
 <input type="hidden" name="skip_$orderidx" id="skip_remove_$orderidx" value="$skip_confirm" />
 <input type="hidden" name="confirm_rem_$orderidx" id="confirm_removal_$orderidx" value="$confirm_removal" />
-<input type="checkbox" name="remove" id="remove_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','remove');" class="LC_hidden" /><a href="$js" class="LC_docs_remove">$lt{'rm'}</a>
+<input type="checkbox" name="remove" id="remove_$orderidx" value="$orderidx" onclick="javascript:singleCheck(this,'$orderidx','remove');" class="LC_hidden" $disabled /><a href="$js" class="LC_docs_remove">$lt{'rm'}</a>
 $form_end
 ENDREM
             if (($ishash) && (ref($filtersref->{'canremove'}) eq 'ARRAY')) {
@@ -3833,15 +3846,23 @@
         $renamelink=(<<ENDREN);
 <a href='javascript:changename("$esc_path","$index","$oldtitle");' class="LC_docs_rename">$lt{'rn'}</a>
 ENDREN
+        my ($uplink,$downlink);
+        if ($canedit) {
+            $uplink = "/adm/coursedocs?cmd=up_$index&folderpath=$esc_path&symb=$symb";
+            $downlink = "/adm/coursedocs?cmd=down_$index&folderpath=$esc_path&symb=$symb";
+        } else {
+            $uplink = "javascript:alert('".&js_escape($lt{'er'})."');";
+            $downlink = $uplink;
+        }
 	$line.=(<<END);
 <td>
 <div class="LC_docs_entry_move">
-  <a href='/adm/coursedocs?cmd=up_$index&folderpath=$esc_path&symb=$symb'>
+  <a href="$uplink">
     <img src="${iconpath}move_up.gif" alt="$lt{'up'}" class="LC_icon" />
   </a>
 </div>
 <div class="LC_docs_entry_move">
-  <a href='/adm/coursedocs?cmd=down_$index&folderpath=$esc_path&symb=$symb'>
+  <a href="$downlink">
     <img src="${iconpath}move_down.gif" alt="$lt{'dw'}" class="LC_icon" />
   </a>
 </div>
@@ -3971,7 +3992,7 @@
 '<form action="/adm/coursedocs" method="post" name="'.$formname.'">'."\n".
 $form_param."\n".
 $form_common."\n".
-'<span class="LC_nobreak"><label><input type="checkbox" name="randompick_'.$orderidx.'" id="randompick_'.$orderidx.'" onclick="'."updatePick(this.form,'$orderidx','check');".'"'.$rpckchk.' /> '.&mt('Randomly Pick').'</label><input type="hidden" name="rpicknum_'.$orderidx.'" id="rpicknum_'.$orderidx.'" value="'.$rpicknum.'" /><span id="randompicknum_'.$orderidx.'">';
+'<span class="LC_nobreak"><label><input type="checkbox" name="randompick_'.$orderidx.'" id="randompick_'.$orderidx.'" onclick="'."updatePick(this.form,'$orderidx','check');".'"'.$rpckchk.$disabled.' /> '.&mt('Randomly Pick').'</label><input type="hidden" name="rpicknum_'.$orderidx.'" id="rpicknum_'.$orderidx.'" value="'.$rpicknum.'" /><span id="randompicknum_'.$orderidx.'">';
             if ($rpicknum ne '') {
                 $rand_pick_text .= ': <a href="javascript:updatePick('."document.$formname,'$orderidx','link'".')">'.$rpicknum.'</a>';
             }
@@ -3989,7 +4010,7 @@
 '<form action="/adm/coursedocs" method="post" name="'.$formname.'">'."\n".
 $form_param."\n".
 $form_common."\n".
-'<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" id="randomorder_'.$orderidx.'" onclick="checkForSubmit(this.form,'."'randomorder','settings'".');" '.$ro_set.' /> '.&mt('Random Order').' </label></span>'.
+'<span class="LC_nobreak"><label><input type="checkbox" name="randomorder_'.$orderidx.'" id="randomorder_'.$orderidx.'" onclick="checkForSubmit(this.form,'."'randomorder','settings'".');" '.$ro_set.$disabled.' /> '.&mt('Random Order').' </label></span>'.
 $form_end; 
         }
     } elsif ($supplementalflag && !$allowed) {
@@ -4016,12 +4037,14 @@
             &Apache::lonnet::declutter(&Apache::lonnet::filelocation('',$orig_url));
         if ($isexternal) {
             ($editlink,$extresform) = 
-                &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem);
+                &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,
+                                                     undef,undef,undef,undef,undef,undef,
+                                                     undef,$disabled);
         } elsif ($orig_url =~ m{^/adm/$coursedom/$coursenum/\d+/exttools?$}) {
             ($editlink,$extresform) =
                 &Apache::lonextresedit::extedit_form(0,$residx,$orig_url,$title,$pathitem,
                                                      undef,undef,undef,'tool',$coursedom,
-                                                     $coursenum,$ltitoolsref);
+                                                     $coursenum,$ltitoolsref,$disabled);
         } elsif (!$isfolder && !$ispage) {
             my ($cfile,$home,$switchserver,$forceedit,$forceview) = 
                 &Apache::lonnet::can_edit_resource($fileloc,$coursenum,$coursedom,$orig_url);
@@ -4106,13 +4129,13 @@
     <form action="/adm/coursedocs" method="post" name="$formhidden">
     $form_param
     $form_common
-    <label><input type="checkbox" name="hiddenresource_$orderidx" id="hiddenresource_$orderidx" onclick="checkForSubmit(this.form,'hiddenresource','settings');" $hidtext /> $lt{'hd'}</label>
+    <label><input type="checkbox" name="hiddenresource_$orderidx" id="hiddenresource_$orderidx" onclick="checkForSubmit(this.form,'hiddenresource','settings');" $hidtext $disabled /> $lt{'hd'}</label>
     $form_end
     <br />
     <form action="/adm/coursedocs" method="post" name="$formurlhidden">
     $form_param
     $form_common
-    <label><input type="checkbox" name="encrypturl_$orderidx" id="encrypturl_$orderidx" onclick="checkForSubmit(this.form,'encrypturl','settings');" $enctext /> $lt{'ec'}</label>
+    <label><input type="checkbox" name="encrypturl_$orderidx" id="encrypturl_$orderidx" onclick="checkForSubmit(this.form,'encrypturl','settings');" $enctext $disabled /> $lt{'ec'}</label>
     $form_end
   </td>
   <td class="LC_docs_entry_parameter">$rand_pick_text<br />
@@ -4449,7 +4472,7 @@
 }
 
 sub checkversions {
-    my ($r) = @_;
+    my ($r,$canedit) = @_;
     my $crstype = &Apache::loncommon::course_type();
     $r->print(&Apache::loncommon::start_page("Check $crstype Resource Versions"));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Resource Versions"));
@@ -4470,51 +4493,53 @@
 
     $hashtied=0;
     &tiehash();
-    my %newsetversions=();
-    if ($env{'form.setmostrecent'}) {
-	$haschanged=1;
-	foreach my $key (keys(%hash)) {
-	    if ($key=~/^ids\_(\/res\/.+)$/) {
-		$newsetversions{$1}='mostrecent';
-                &devalidateversioncache($1);
+    if ($canedit) {
+        my %newsetversions=();
+        if ($env{'form.setmostrecent'}) {
+	    $haschanged=1;
+	    foreach my $key (keys(%hash)) {
+	        if ($key=~/^ids\_(\/res\/.+)$/) {
+		    $newsetversions{$1}='mostrecent';
+                    &devalidateversioncache($1);
+	        }
 	    }
-	}
-    } elsif ($env{'form.setcurrent'}) {
-	$haschanged=1;
-	foreach my $key (keys(%hash)) {
-	    if ($key=~/^ids\_(\/res\/.+)$/) {
-		my $getvers=&Apache::lonnet::getversion($1);
-		if ($getvers>0) {
-		    $newsetversions{$1}=$getvers;
-		    &devalidateversioncache($1);
-		}
+        } elsif ($env{'form.setcurrent'}) {
+	    $haschanged=1;
+	    foreach my $key (keys(%hash)) {
+	        if ($key=~/^ids\_(\/res\/.+)$/) {
+		    my $getvers=&Apache::lonnet::getversion($1);
+		    if ($getvers>0) {
+		        $newsetversions{$1}=$getvers;
+		        &devalidateversioncache($1);
+		    }
+	        }
 	    }
-	}
-    } elsif ($env{'form.setversions'}) {
-	$haschanged=1;
-	foreach my $key (keys(%env)) {
-	    if ($key=~/^form\.set_version_(.+)$/) {
-		my $src=$1;
-		if (($env{$key}) && ($env{$key} ne $setversions{$src})) {
-		    $newsetversions{$src}=$env{$key};
-		    &devalidateversioncache($src);
-		}
+        } elsif ($env{'form.setversions'}) {
+	    $haschanged=1;
+	    foreach my $key (keys(%env)) {
+	        if ($key=~/^form\.set_version_(.+)$/) {
+		    my $src=$1;
+		    if (($env{$key}) && ($env{$key} ne $setversions{$src})) {
+		        $newsetversions{$src}=$env{$key};
+		        &devalidateversioncache($src);
+		    }
+	        }
 	    }
-	}
-    }
-    if ($haschanged) {
-        if (&Apache::lonnet::put('resourceversions',\%newsetversions,
-			  $env{'course.'.$env{'request.course.id'}.'.domain'},
-			  $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') {
-	    $r->print(&Apache::loncommon::confirmwrapper(
-                &Apache::lonhtmlcommon::confirm_success(&mt('Your Version Settings have been Saved'))));
-	} else {
-	    $r->print(&Apache::loncommon::confirmwrapper(
-                &Apache::lonhtmlcommon::confirm_success(&mt('An Error Occured while Attempting to Save your Version Settings'),1)));
-	}
-	&mark_hash_old();
+        }
+        if ($haschanged) {
+            if (&Apache::lonnet::put('resourceversions',\%newsetversions,
+			             $env{'course.'.$env{'request.course.id'}.'.domain'},
+			             $env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') {
+	        $r->print(&Apache::loncommon::confirmwrapper(
+                    &Apache::lonhtmlcommon::confirm_success(&mt('Your Version Settings have been Saved'))));
+	    } else {
+	        $r->print(&Apache::loncommon::confirmwrapper(
+                    &Apache::lonhtmlcommon::confirm_success(&mt('An Error Occured while Attempting to Save your Version Settings'),1)));
+	    }
+	    &mark_hash_old();
+        }
+        &changewarning($r,'');
     }
-    &changewarning($r,'');
     if ($env{'form.timerange'} eq 'all') {
 # show all documents
 	$header=&mt('All content in '.$crstype);
@@ -4581,6 +4606,11 @@
 	       'save' => 'Save changes',
                'vers' => 'Version choice(s) for specific resources', 
 	       'act' => 'Actions');
+    my ($disabled,$readonly);
+    unless ($canedit) {
+        $disabled = 'disabled="disabled"';
+        $readonly = 1;
+    }
     $r->print(<<ENDHEADERS);
 <h4 class="LC_info">$header</h4>
 <form action="/adm/coursedocs" method="post">
@@ -4601,8 +4631,8 @@
 <div class="LC_left_float">
 <fieldset>
 <legend>$lt{'act'}</legend>
-$lt{'sm'}: <input type="submit" name="setmostrecent" value="Go" /><br />
-$lt{'sc'}: <input type="submit" name="setcurrent" value="Go" />
+$lt{'sm'}: <input type="submit" name="setmostrecent" value="Go" $disabled /><br />
+$lt{'sc'}: <input type="submit" name="setcurrent" value="Go" $disabled />
 </fieldset>
 </div>
 <br clear="all" />
@@ -4631,7 +4661,7 @@
         return;
     }
     $r->print(
-       '<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'.
+       '<input type="submit" name="setversions" value="'.$lt{'save'}.'"'.$disabled.' />'.
         &Apache::loncommon::start_data_table().
         &Apache::loncommon::start_data_table_header_row().
         '<th>'.&mt('Resources').'</th>'.
@@ -4676,7 +4706,7 @@
                       {'select_form_order' => ['',1..$currentversion,'mostrecent'],
                       '' => '',
                       'mostrecent' => &mt('most recent'),
-                      map {$_,$_} (1..$currentversion)}));
+                      map {$_,$_} (1..$currentversion)},'',$readonly));
             my $lastold=1;
             for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
                 my $url=$root.'.'.$prevvers.'.'.$extension;
@@ -4710,7 +4740,7 @@
     }
     $r->print(
         &Apache::loncommon::end_data_table().
-        '<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'.
+        '<input type="submit" name="setversions" value="'.$lt{'save'}.'"'.$disabled.' />'.
         '</form>'
     );
 
@@ -4880,13 +4910,22 @@
     $help{'Group Portfolio'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files');
     $help{'Caching'} = &Apache::loncommon::help_open_topic('Caching');
  
-    my ($allowed,$noendpage);
+    my ($allowed,$canedit,$canview,$noendpage,$disabled);
 # URI is /adm/supplemental when viewing supplemental docs in non-edit mode.
     unless ($r->uri eq '/adm/supplemental') {
         # does this user have privileges to modify content.  
-        $allowed = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});
+        if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
+            $allowed = 1;
+            $canedit = 1;
+            $canview = 1;
+        } elsif (&Apache::lonnet::allowed('cev',$env{'request.course.id'})) {
+            $allowed = 1;
+            $canview = 1;
+        }
+    }
+    unless ($canedit) {
+        $disabled = ' disabled="disabled"';
     }
-
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['inhibitmenu']);
   if ($allowed && $env{'form.verify'}) {
       &init_breadcrumbs('verify','Verify Content','Docs_Verify_Content');
@@ -4900,18 +4939,18 @@
       if ($folder eq '') {
           $folder='default';
       }
-      &docs_change_log($r,$coursenum,$coursedom,$folder,$allowed,$crstype,$iconpath);
+      &docs_change_log($r,$coursenum,$coursedom,$folder,$allowed,$crstype,$iconpath,$canedit);
   } elsif ($allowed && $env{'form.versions'}) {
       &init_breadcrumbs('versions','Check/Set Resource Versions','Docs_Check_Resource_Versions');
-      &checkversions($r);
-  } elsif ($allowed && $env{'form.dumpcourse'}) {
+      &checkversions($r,$canedit);
+  } elsif ($canedit && $env{'form.dumpcourse'}) {
       &init_breadcrumbs('dumpcourse','Copy '.&Apache::loncommon::course_type().' Content to Authoring Space');
       &dumpcourse($r);
-  } elsif ($allowed && $env{'form.exportcourse'}) {
+  } elsif ($canedit && $env{'form.exportcourse'}) {
       &init_breadcrumbs('exportcourse','IMS Export');
       &Apache::imsexport::exportcourse($r);
   } else {
-      if ($allowed && $env{'form.authorrole'}) {
+      if ($canedit && $env{'form.authorrole'}) {
           $noendpage = 1;
           my ($redirect,$error) = &makenewproblem($r,$coursedom,$coursenum);
           if ($redirect) {
@@ -5097,7 +5136,7 @@
         if ($showdoc) { # got called in sequence from course
 	    $allowed=0; 
         } else {
-            if ($allowed) {
+            if ($canedit) {
                 &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['cmd']);
                 $script=&Apache::lonratedt::editscript('simple');
             }
@@ -5139,7 +5178,7 @@
             %ltitools = &Apache::lonnet::get_domain_ltitools($coursedom);
             my $posslti = keys(%ltitools);
 	    $script .= &editing_js($udom,$uname,$supplementalflag,$coursedom,$coursenum,$posslti,
-                                   $londocroot).
+                                   $londocroot,$canedit).
                        &history_tab_js().
                        &inject_data_js().
                        &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr,$tid).
@@ -5170,34 +5209,52 @@
         $r->print(&Apache::loncommon::start_page("$crstype documents",undef,
                                                 {'force_register' => $showdoc,}));
     } elsif ($toolsflag) {
+        my ($breadtext,$breadtitle);
+        $breadtext = "$crstype Contents";
+        if ($canedit) {
+            $breadtitle = 'Editing '.$crstype.' Contents';
+        } else {
+            $breadtext .= ' (View-only mode)';
+            $breadtitle = 'Viewing '.$crstype.' Contents';
+        }
         &Apache::lonhtmlcommon::add_breadcrumb({
-            href=>"/adm/coursedocs",text=>"$crstype Contents"});
+            href=>"/adm/coursedocs",text=>$breadtext});
         $r->print(&Apache::loncommon::start_page("$crstype Contents", $script)
                  .&Apache::loncommon::help_open_menu('','',273,'RAT')
                  .&Apache::lonhtmlcommon::breadcrumbs(
-                     'Editing Course Contents')
+                     $breadtitle)
                  );
     } elsif ($r->uri eq '/adm/supplemental') {
         my $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype);
         $r->print(&Apache::loncommon::start_page("Supplemental $crstype Content",undef,
                                                 {'bread_crumbs' => $brcrum,}));
     } else {
+        my ($breadtext,$breadtitle,$helpitem);
+        $breadtext = "$crstype Contents";
+        if ($canedit) {
+            $breadtitle = 'Editing '.$crstype.' Contents';
+            $helpitem = 'Docs_Adding_Course_Doc';
+        } else {
+            $breadtext .= ' (View-only mode)';
+            $breadtitle = 'Viewing '.$crstype.' Contents';
+            $helpitem = 'Docs_Viewing_Course_Doc';
+        }
         &Apache::lonhtmlcommon::add_breadcrumb({
-            href=>"/adm/coursedocs",text=>"$crstype Contents"});
+            href=>"/adm/coursedocs",text=>$breadtext});
         $r->print(&Apache::loncommon::start_page("$crstype Contents", $script,
                                                  {'add_entries'    => $addentries}
                                                 )
                  .&Apache::loncommon::help_open_menu('','',273,'RAT')
                  .&Apache::lonhtmlcommon::breadcrumbs(
-                     'Editing '.$crstype.' Contents',
-                     'Docs_Adding_Course_Doc')
+                     $breadtitle,
+                     $helpitem)
         );
     }
 
   my %allfiles = ();
   my %codebase = ();
   my ($upload_result,$upload_output,$uploadphase);
-  if ($allowed) {
+  if ($canedit) {
       if (($env{'form.uploaddoc.filename'}) &&
 	  ($env{'form.cmd'}=~/^upload_(\w+)/)) {
           my $context = $1; 
@@ -5249,7 +5306,7 @@
 
   if ($allowed && $toolsflag) {
       $r->print(&startContentScreen('tools'));
-      $r->print(&generate_admin_menu($crstype));
+      $r->print(&generate_admin_menu($crstype,$canedit));
       $r->print(&endContentScreen());
   } elsif ((!$showdoc) && (!$uploadphase)) {
 # -----------------------------------------------------------------------------
@@ -5304,6 +5361,7 @@
                 'webctce4' => 'WebCT 4 Campus Edition',
                 'yes'      => 'Yes',
                 'no'       => 'No',
+                'er' => 'Editing rights unavailable for your current role',
         );
 # -----------------------------------------------------------------------------
 
@@ -5344,7 +5402,7 @@
 	my $fileupload=(<<FIUP);
         $quotainfo
 	$lt{'file'}:<br />
-	<input type="file" name="uploaddoc" class="flUpload" size="40" />
+	<input type="file" name="uploaddoc" class="flUpload" size="40" $disabled />
         <input type="hidden" id="free_space" value="$free_space" />
 FIUP
 
@@ -5353,7 +5411,7 @@
 	<input type="checkbox" name="parserflag" />
 	</label> -->
 	<label>
-	<input type="checkbox" name="parserflag" checked="checked" /> $lt{'parse'}
+	<input type="checkbox" name="parserflag" checked="checked" $disabled /> $lt{'parse'}
 	</label>
 CHBO
         my $imsfolder = $env{'form.folder'};
@@ -5370,7 +5428,7 @@
         <br />
         <p>
         $lt{'cms'}:  
-        <select name="source">
+        <select name="source" $disabled>
         <option value="-1" selected="selected">$lt{'se'}</option>
         <option value="bb5">$lt{'bb5'}</option>
         <option value="bb6">$lt{'bb6'}</option>
@@ -5380,7 +5438,7 @@
         <input type="hidden" name="folder" value="$imsfolder" />
         </p>
         <input type="hidden" name="phase" value="one" />
-        <input type="button" value="$lt{'imsl'}" onclick="makeims(this.form);" />
+        <input type="button" value="$lt{'imsl'}" onclick="makeims(this.form);" $disabled />
         </fieldset>
         </form>
 IMSFORM
@@ -5395,7 +5453,7 @@
     $fileupload
 	<br />
 	$lt{'title'}:<br />
-	<input type="text" size="60" name="comment" />
+	<input type="text" size="60" name="comment" $disabled />
 	$pathitem
 	<input type="hidden" name="cmd" value="upload_default" />
 	<br />
@@ -5403,11 +5461,17 @@
 	$checkbox
 	</span>
         <br clear="all" />
-        <input type="submit" value="$lt{'upld'}" />
+        <input type="submit" value="$lt{'upld'}" $disabled />
         </fieldset>
         </form>
 FUFORM
 
+        my $mapimportjs;
+        if ($canedit) {
+            $mapimportjs = "javascript:openbrowser('mapimportform','importmap','sequence,page','');"; 
+        } else {
+            $mapimportjs = "javascript:alert('".&js_escape($lt{'er'})."');";
+        }
 	my $importpubform=(<<SEDFFORM);
         <a class="LC_menubuttons_link" href="javascript:toggleMap('map');">
         $lt{'impm'}</a>$help{'Load_Map'}
@@ -5418,9 +5482,9 @@
         $lt{'copm'}<br />
         <span class="LC_nobreak">
         <input type="text" name="importmap" size="40" value="" 
-        onfocus="this.blur();openbrowser('mapimportform','importmap','sequence,page','');" />
-         <a href="javascript:openbrowser('mapimportform','importmap','sequence,page','');">$lt{'selm'}</a></span><br />
-        <input type="submit" name="loadmap" value="$lt{'load'}" />
+        onfocus="this.blur();$mapimportjs" $disabled />
+         <a href="$mapimportjs">$lt{'selm'}</a></span><br />
+        <input type="submit" name="loadmap" value="$lt{'load'}" $disabled />
         </fieldset>
         </form>
 
@@ -5440,19 +5504,26 @@
         <input type="hidden" name="active" value="bb" />
         $pickfile
         <p>
-        $lt{'title'}: <input type="textbox" name="crsrestitle" value="" />
+        $lt{'title'}: <input type="textbox" name="crsrestitle" value="" $disabled />
         </p>
         <input type="hidden" name="importdetail" value="" />
-        <input type="submit" name="crsres" value="$lt{'impo'}" />
+        <input type="submit" name="crsres" value="$lt{'impo'}" $disabled />
         </fieldset>
         </form>
 CRSFORM
         }
 
+        my $fromstoredjs;
+        if ($canedit) {
+            $fromstoredjs = 'open_StoredLinks_Import()'; 
+        } else {
+            $fromstoredjs = "alert('".&js_escape($lt{'er'})."')";
+        }
+
 	my @importpubforma = (
 	{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/src.png" alt="'.$lt{srch}.'"  onclick="javascript:groupsearch()" />' => $pathitem."<a class='LC_menubuttons_link' href='javascript:groupsearch()'>$lt{'srch'}</a>" },
 	{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/res.png" alt="'.$lt{impo}.'"  onclick="javascript:groupimport();"/>' => "<a class='LC_menubuttons_link' href='javascript:groupimport();'>$lt{'impo'}</a>$help{'Importing_LON-CAPA_Resource'}" },
-	{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/wishlist.png" alt="'.$lt{lnks}.'" onclick="javascript:open_StoredLinks_Import();" />' => "<a class='LC_menubuttons_link' href='javascript:open_StoredLinks_Import();'>$lt{'lnks'}</a>" },
+	{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/wishlist.png" alt="'.$lt{lnks}.'" onclick="javascript:'.$fromstoredjs.';" />' => '<a class="LC_menubuttons_link" href="javascript:'.$fromstoredjs.';">'.$lt{'lnks'}.'</a>' },
         { '<img class="LC_noBorder LC_middle" src="/res/adm/pages/sequence.png" alt="'.$lt{impm}.'" onclick="javascript:toggleMap(\'map\');" />' => $importpubform },
         );
         if ($pickfile) {
@@ -5461,12 +5532,13 @@
 	$importpubform = &create_form_ul(&create_list_elements(@importpubforma));
         my $extresourcesform =
             &Apache::lonextresedit::extedit_form(0,0,undef,undef,$pathitem,
-                                                 $help{'Adding_External_Resource'});
+                                                 $help{'Adding_External_Resource'},
+                                                 undef,undef,undef,undef,undef,undef,$disabled);
         my $exttoolform =
             &Apache::lonextresedit::extedit_form(0,0,undef,undef,$pathitem,
                                                  $help{'Adding_External_Tool'},undef,
                                                  undef,'tool',$coursedom,$coursenum,
-                                                 \%ltitools);
+                                                 \%ltitools,$disabled);
     if ($allowed) {
         my $folder = $env{'form.folder'};
         if ($folder eq '') {
@@ -5539,7 +5611,7 @@
 	$pathitem
 	<input type="hidden" name="importdetail" 
 	value="$lt{'navc'}=/adm/navmaps" />
-	<a class="LC_menubuttons_link" href="javascript:document.newnav.submit()">$lt{'navc'}</a>
+	<a class="LC_menubuttons_link" href="javascript:makenew(document.newnav);">$lt{'navc'}</a>
 	$help{'Navigate_Content'}
 	</form>
 NNFORM
@@ -5600,7 +5672,7 @@
 	$pathitem
 	<input type="hidden" name="importdetail" 
 	value="$plainname=/adm/$udom/$uname/aboutme" />
-	<a class="LC_menubuttons_link" href="javascript:document.newaboutme.submit()">$lt{'mypi'}</a>
+	<a class="LC_menubuttons_link" href="javascript:makenew(document.newaboutme);">$lt{'mypi'}</a>
 	$help{'My Personal Information Page'}
 	</form>
 NAMFORM
@@ -5620,7 +5692,7 @@
 	$pathitem
 	<input type="hidden" name="importdetail" 
 	value="$lt{'rost'}=/adm/viewclasslist" />
-	<a class="LC_menubuttons_link" href="javascript:document.newroster.submit()">$lt{'rost'}</a>
+	<a class="LC_menubuttons_link" href="javascript:makenew(document.newroster);">$lt{'rost'}</a>
 	$help{'Course_Roster'}
 	</form>
 NROSTFORM
@@ -5824,30 +5896,30 @@
         <p>
         $pickdir
         <span class="LC_nobreak">$lt{'news'}? 
-        <label><input type="radio" name="newsubdir" value="0" onclick="toggleNewsubdir(this.form);" checked="checked" />No</label>
+        <label><input type="radio" name="newsubdir" value="0" onclick="toggleNewsubdir(this.form);" checked="checked" $disabled />No</label>
          
-        <label><input type="radio" name="newsubdir" value="1" onclick="toggleNewsubdir(this.form);" />Yes</label>
+        <label><input type="radio" name="newsubdir" value="1" onclick="toggleNewsubdir(this.form);" $disabled />Yes</label>
         </span><span id="newsubdir"></span>
         <input type="hidden" name="newsubdirname" id="newsubdirname" value="" autocomplete="off" />
         </p>
         $lt{'fnam'}
-        <input type="text" size="20" name="newresourcename" autocomplete="off" />
+        <input type="text" size="20" name="newresourcename" autocomplete="off" $disabled />
         <p>
         <div id="newresource" style="display:$showtitle">
         $lt{'addp'}
-        <label><input type="radio" name="newresourceadd" value="0" checked="checked" onclick="toggleNewInCourse(this.form);" />
+        <label><input type="radio" name="newresourceadd" value="0" checked="checked" onclick="toggleNewInCourse(this.form);" $disabled />
         $lt{'no'}</label>  
-        <label><input type="radio" name="newresourceadd" value="1" onclick="toggleNewInCourse(this.form);" />
+        <label><input type="radio" name="newresourceadd" value="1" onclick="toggleNewInCourse(this.form);" $disabled />
         $lt{'yes'}</label>
         <span id="newrestitle"></span>
-        <input type="hidden" size="20" name="newresourcetitle" id="newresourcetitle" autocomplete="off" />
+        <input type="hidden" size="20" name="newresourcetitle" id="newresourcetitle" autocomplete="off" $disabled />
         </div>
         </p>
         <p>
         $lt{'uste'}
-        <label><input type="radio" name="newresusetemp" value="0" checked="checked" onclick="toggleWithTemplate(this.form);" />
+        <label><input type="radio" name="newresusetemp" value="0" checked="checked" onclick="toggleWithTemplate(this.form);" $disabled />
         $lt{'no'}</label>  
-        <label><input type="radio" name="newresusetemp" value="1" onclick="toggleWithTemplate(this.form);" />
+        <label><input type="radio" name="newresusetemp" value="1" onclick="toggleWithTemplate(this.form);" $disabled />
         $lt{'yes'}</label>
         <div id="newrestemplate" style="display:none">
         $templates
@@ -5856,7 +5928,7 @@
         </p>
         <span class="LC_nobreak">
         <input type="hidden" name="folderpath" value="$env{'form.folderpath'}" />
-        <input type="submit" name="newcrs" value="$lt{'crpr'}" />
+        <input type="submit" name="newcrs" value="$lt{'crpr'}" $disabled />
         </span>
         </fieldset>
         </form>
@@ -5900,7 +5972,7 @@
 	$pathitem
 	<input type="hidden" name="importdetail" 
 	value="$lt{'syll'}=/public/$coursedom/$coursenum/syllabus" />
-	<a class="LC_menubuttons_link" href="javascript:document.newsyl.submit()">$lt{'syll'}</a>
+	<a class="LC_menubuttons_link" href="javascript:makenew(document.newsyl);">$lt{'syll'}</a>
 	$help{'Syllabus'}
 
 	</form>
@@ -5912,14 +5984,14 @@
 	$pathitem
 	<input type="hidden" name="importdetail"
 	value="$lt{'grpo'}=/adm/$coursedom/$coursenum/aboutme" />
-	<a class="LC_menubuttons_link" href="javascript:document.newgroupfiles.submit()">$lt{'grpo'}</a>
+	<a class="LC_menubuttons_link" href="javascript:makenew(document.newgroupfiles);">$lt{'grpo'}</a>
 	$help{'Group Portfolio'}
 	</form>
 NGFFORM
 	@specialdocumentsforma=(
 	{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/page.png" alt="'.$lt{newp}.'"  onclick="javascript:makenewpage(document.newpage,\''.$pageseq.'\');" />'=>$newpageform},
-	{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/syllabus.png" alt="'.$lt{syll}.'" onclick="document.newsyl.submit()" />'=>$newsylform},
-	{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/navigation.png" alt="'.$lt{navc}.'" onclick="document.newnav.submit()" />'=>$newnavform},
+	{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/syllabus.png" alt="'.$lt{syll}.'" onclick="makenew(document.newsyl);" />'=>$newsylform},
+	{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/navigation.png" alt="'.$lt{navc}.'" onclick="javascript:makenew(document.newnav);" />'=>$newnavform},
         {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/simple.png" alt="'.$lt{sipa}.'" onclick="javascript:makesmppage();" />'=>$newsmppageform},
         {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/webpage.png" alt="'.$lt{webp}.'" onclick="javascript:makewebpage();" />'=>$newwebpageform},
         );
@@ -5956,8 +6028,8 @@
        {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/bchat.png" alt="'.$lt{bull}.'" onclick="javascript:makebulboard();" />'=>$newbulform},
         {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/myaboutme.png" alt="'.$lt{mypi}.'" onclick="javascript:makebulboard();" />'=>$newaboutmeform},
         {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/aboutme.png" alt="'.$lt{abou}.'" onclick="javascript:makeabout();" />'=>$newaboutsomeoneform},
-        {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/clst.png" alt="'.$lt{rost}.'" onclick="document.newroster.submit()" />'=>$newrosterform},
-        {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/groupportfolio.png" alt="'.$lt{grpo}.'" onclick="document.newgroupfiles.submit()" />'=>$newgroupfileform},
+        {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/clst.png" alt="'.$lt{rost}.'" onclick="javascript:makenew(document.newroster);" />'=>$newrosterform},
+        {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/groupportfolio.png" alt="'.$lt{grpo}.'" onclick="javascript:makenew(document.newgroupfiles);" />'=>$newgroupfileform},
         );
         $communityform = &create_form_ul(&create_list_elements(@communityforma));
 
@@ -5975,7 +6047,7 @@
  $hadchanges=0;
        unless (($supplementalflag || $toolsflag)) {
           my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
-                              $supplementalflag,\%orderhash,$iconpath,$pathitem,\%ltitools);
+                              $supplementalflag,\%orderhash,$iconpath,$pathitem,\%ltitools,$canedit);
           if ($error) {
              $r->print('<p><span class="LC_error">'.$error.'</span></p>');
           }
@@ -6040,13 +6112,15 @@
 	
         my $supextform =
             &Apache::lonextresedit::extedit_form(1,0,undef,undef,$pathitem,
-                                                 $help{'Adding_External_Resource'});
+                                                 $help{'Adding_External_Resource'},
+                                                 undef,undef,undef,undef,undef,undef,
+                                                 $disabled);
 
         my $supexttoolform =
             &Apache::lonextresedit::extedit_form(1,0,undef,undef,$pathitem,
                                                  $help{'Adding_External_Tool'},
                                                  undef,undef,'tool',$coursedom,
-                                                 $coursenum,\%ltitools);
+                                                 $coursenum,\%ltitools,$disabled);
 
 	my $supnewsylform=(<<SNSFORM);
 	<form action="/adm/coursedocs" method="post" name="supnewsyl">
@@ -6054,7 +6128,7 @@
         $pathitem
 	<input type="hidden" name="importdetail" 
 	value="Syllabus=/public/$coursedom/$coursenum/syllabus" />
-	<a class="LC_menubuttons_link" href="javascript:document.supnewsyl.submit()">$lt{'syll'}</a>
+	<a class="LC_menubuttons_link" href="javascript:makenew(document.supnewsyl);">$lt{'syll'}</a>
 	$help{'Syllabus'}
 	</form>
 SNSFORM
@@ -6065,7 +6139,7 @@
         $pathitem
 	<input type="hidden" name="importdetail" 
 	value="$plainname=/adm/$udom/$uname/aboutme" />
-	<a class="LC_menubuttons_link" href="javascript:document.supnewaboutme.submit()">$lt{'mypi'}</a>
+	<a class="LC_menubuttons_link" href="javascript:makenew(document.supnewaboutme);">$lt{'mypi'}</a>
 	$help{'My Personal Information Page'}
 	</form>
 SNAMFORM
@@ -6092,9 +6166,9 @@
 
 
 my @specialdocs = (
-		{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/syllabus.png" alt="'.$lt{syll}.'" onclick="document.supnewsyl.submit()" />'
+		{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/syllabus.png" alt="'.$lt{syll}.'" onclick="makenew(document.supnewsyl);" />'
             =>$supnewsylform},
-		{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/myaboutme.png" alt="'.$lt{mypi}.'" onclick="document.supnewaboutme.submit()" />'
+		{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/myaboutme.png" alt="'.$lt{mypi}.'" onclick="javascript:makenew(document.supnewaboutme);" />'
             =>$supnewaboutmeform},
                 {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/webpage.png" alt="'.$lt{webp}.'" onclick="javascript:makewebpage('."'supp'".');" />'=>$supwebpageform},
 
@@ -6120,7 +6194,7 @@
                 );
         if ($supplementalflag) {
            my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
-                               $supplementalflag,\%suporderhash,$iconpath,$pathitem,\%ltitools);
+                               $supplementalflag,\%suporderhash,$iconpath,$pathitem,\%ltitools,$canedit);
            if ($error) {
               $r->print('<p><span class="LC_error">'.$error.'</span></p>');
            } else {
@@ -6140,7 +6214,7 @@
         }
     } elsif ($supplementalflag) {
         my $error = &editor($r,$coursenum,$coursedom,$folder,$allowed,'',$crstype,
-                            $supplementalflag,'',$iconpath,$pathitem);
+                            $supplementalflag,'',$iconpath,$pathitem,$canedit);
         if ($error) {
             $r->print('<p><span class="LC_error">'.$error.'</span></p>');
         }
@@ -6327,7 +6401,7 @@
 }
 
 sub generate_admin_menu {
-    my ($crstype) = @_;
+    my ($crstype,$canedit) = @_;
     my $lc_crstype = lc($crstype);
     my ($home,$other,%outhash)=&authorhosts();
     my %lt= ( # do not translate here
@@ -6385,7 +6459,9 @@
                     linktitle  => "List the unique identifier used for each resource instance in your $lc_crstype"
                 },
                 ]
-        },
+        });
+    if ($canedit) {
+        push(@menu,
         {   categorytitle=>'Export',
             items =>[
                 {   linktext   => $lt{'imse'},
@@ -6404,6 +6480,7 @@
                 },
                 ]
         });
+    }
     return '<form action="/adm/coursedocs" method="post" name="courseverify">'."\n".
            '<input type="hidden" id="dummy" />'."\n".
            &Apache::lonhtmlcommon::generate_menu(@menu)."\n".
@@ -6412,15 +6489,16 @@
 
 sub generate_edit_table {
     my ($tid,$orderhash_ref,$to_show,$iconpath,$jumpto,$readfile,
-        $need_save,$copyfolder) = @_;
+        $need_save,$copyfolder,$canedit) = @_;
     return unless(ref($orderhash_ref) eq 'HASH');
     my %orderhash = %{$orderhash_ref};
-    my $form;
-    my $activetab;
-    my $active;
+    my ($form, $activetab, $active, $disabled);
     if (($env{'form.active'} ne '') && ($env{'form.active'} ne '00')) {
         $activetab = $env{'form.active'};
     }
+    unless ($canedit) {
+        $disabled = ' disabled="disabled"';
+    }
     my $backicon = $iconpath.'clickhere.gif';
     my $backtext = &mt('Exit Editor');
     $form = '<div class="LC_Box" style="margin:0;">'.
@@ -6484,7 +6562,7 @@
 <input type="hidden" name="multicopy" value="" />
 <input type="hidden" name="multichange" value="" />
 <input type="hidden" name="copyfolder" value="$copyfolder" />
-<input type="submit" name="savemultiples" value="$button" />
+<input type="submit" name="savemultiples" value="$button" $disabled />
 </form>
 </div>
 END
@@ -6510,7 +6588,7 @@
 }
 
 sub editing_js {
-    my ($udom,$uname,$supplementalflag,$coursedom,$coursenum,$posslti,$londocroot) = @_;
+    my ($udom,$uname,$supplementalflag,$coursedom,$coursenum,$posslti,$londocroot,$canedit) = @_;
     my %js_lt = &Apache::lonlocal::texthash(
                                           p_mnf => 'Name of New Folder',
                                           t_mnf => 'New Folder',
@@ -6554,6 +6632,7 @@
                                           nofi    => 'No file selected',
                                           tinc    => 'Title in course',
                                           sunm    => 'Sub-directory name',
+                                          edri    => 'Editing rights unavailable for your current role',
                                         );
     &js_escape(\%js_lt);
     my $crstype = &Apache::loncommon::course_type();
@@ -6614,8 +6693,10 @@
             $fieldsets .= ",'supptool'";
         }
     }
-
-    return <<ENDNEWSCRIPT;
+    
+    my $jsmakefunctions;
+    if ($canedit) {
+        $jsmakefunctions = <<ENDNEWSCRIPT;
 function makenewfolder(targetform,folderseq) {
     var foldername=prompt('$js_lt{"p_mnf"}','$js_lt{"t_mnf"}');
     if (foldername) {
@@ -6701,16 +6782,101 @@
 	   if ((comp[0]) && (comp[1])) {
 	       this.document.forms.newaboutsomeone.importdetail.value=
 		   '$js_lt{"p_mab2"}'+escape(user)+'=/adm/'+comp[1]+'/'+comp[0]+'/aboutme';
-       this.document.forms.newaboutsomeone.submit();
-   } else {
-       alert("$js_lt{'p_mab_alrt1'}");
-   }
-} else {
-   alert("$js_lt{'p_mab_alrt2'}");
+               this.document.forms.newaboutsomeone.submit();
+           } else {
+               alert("$js_lt{'p_mab_alrt1'}");
+           }
+       } else {
+           alert("$js_lt{'p_mab_alrt2'}");
+       }
+    }
+}
+
+function makenew(targetform) {
+    targetform.submit();
+}
+
+function changename(folderpath,index,oldtitle) {
+    var title=prompt('$js_lt{"p_chn"}',oldtitle);
+    if (title) {
+        this.document.forms.renameform.markcopy.value='';
+        this.document.forms.renameform.title.value=title;
+        this.document.forms.renameform.cmd.value='rename_'+index;
+        this.document.forms.renameform.folderpath.value=folderpath;
+        this.document.forms.renameform.submit();
+    }
+}
+
+ENDNEWSCRIPT
+    } else {
+        $jsmakefunctions = <<ENDNEWSCRIPT;
+
+function makenewfolder() {
+    alert("$js_lt{'edri'}");
+}
+
+function makenewpage() {
+    alert("$js_lt{'edri'}");
+}
+
+function makeexamupload() {
+    alert("$js_lt{'edri'}");
+}
+
+function makesmppage() {
+    alert("$js_lt{'edri'}");
+}
+
+function makewebpage(type) {
+    alert("$js_lt{'edri'}");
+}
+
+function makesmpproblem() {
+    alert("$js_lt{'edri'}");
+}
+
+function makedropbox() {
+    alert("$js_lt{'edri'}");
+}
+
+function makebulboard() {
+    alert("$js_lt{'edri'}");
+}
+
+function makeabout() {
+    alert("$js_lt{'edri'}");
+}
+
+function changename() {
+    alert("$js_lt{'edri'}");
+}
+
+function makenew() {
+    alert("$js_lt{'edri'}");
+}
+
+function groupimport() {
+    alert("$js_lt{'edri'}");
 }
+
+function groupsearch() {
+    alert("$js_lt{'edri'}");
 }
+
+function groupopen(url,recover) {
+   var options="scrollbars=1,resizable=1,menubar=0";
+   idxflag=1;
+   idx=open("/adm/groupsort?inhibitmenu=yes&mode=simple&recover="+recover+"&readfile="+url,"idxout",options);
+   idx.focus();
 }
 
+ENDNEWSCRIPT
+
+    }
+    return <<ENDSCRIPT;
+
+$jsmakefunctions
+
 function toggleUpload(caller) {
     var blocks = Array($fieldsets);
     for (var i=0; i<blocks.length; i++) {
@@ -6948,17 +7114,6 @@
     imsform.submit();
 }
 
-function changename(folderpath,index,oldtitle) {
-var title=prompt('$js_lt{"p_chn"}',oldtitle);
-if (title) {
-this.document.forms.renameform.markcopy.value='';
-this.document.forms.renameform.title.value=title;
-this.document.forms.renameform.cmd.value='rename_'+index;
-this.document.forms.renameform.folderpath.value=folderpath;
-this.document.forms.renameform.submit();
-}
-}
-
 function updatePick(targetform,index,caller) {
     var pickitem;
     var picknumitem;
@@ -7124,6 +7279,11 @@
 }
 
 function checkForSubmit(targetform,param,context,idx,folderpath,index,oldtitle,skip_confirm,container,folder,confirm_removal) {
+    var canedit = '$canedit';
+    if (canedit == '') {
+        alert("$js_lt{'edri'}");
+        return;
+    }
     var dosettings;
     var doaction;
     var control = document.togglemultsettings;
@@ -7700,7 +7860,7 @@
     }
 }
 
-ENDNEWSCRIPT
+ENDSCRIPT
 }
 
 sub history_tab_js {
Index: loncom/interface/lonextresedit.pm
diff -u loncom/interface/lonextresedit.pm:1.10 loncom/interface/lonextresedit.pm:1.11
--- loncom/interface/lonextresedit.pm:1.10	Mon Jun  6 17:40:48 2016
+++ loncom/interface/lonextresedit.pm	Tue Nov 22 00:43:12 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: lonextresedit.pm,v 1.10 2016/06/06 17:40:48 raeburn Exp $
+# $Id: lonextresedit.pm,v 1.11 2016/11/22 00:43:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -302,7 +302,7 @@
 
 sub extedit_form {
     my ($supplementalflag,$residx,$orig_url,$orig_title,$pathitem,$helpitem,$caller,
-        $symb,$type,$cdom,$cnum,$ltitools) = @_;
+        $symb,$type,$cdom,$cnum,$ltitools,$disabled) = @_;
     if ($type ne 'tool') {
         $type = 'ext';
     }
@@ -399,7 +399,7 @@
             $orig_url = 'http://';
             $orig_title = $lt{'ex'};
             $extsrc = $lt{'ul'}.':<br />';
-            $preview = '<input type="button" name="view" value="'.$lt{'pr'}.'" onclick="javascript:extUrlPreview('."'$urlid'".');" />';
+            $preview = '<input type="button" name="view" value="'.$lt{'pr'}.'" onclick="javascript:extUrlPreview('."'$urlid'".');"'.$disabled.' />';
             $save = $lt{'al'};
         } else {
             $orig_title = $lt{'et'};
@@ -410,7 +410,7 @@
     }
     $formid = $formname;
     if ($type eq 'ext') {
-        $urlelem = '<input type="text" size="'.$size.'" name="exturl" id="'.$urlid.'" value="'.$orig_url.'" />';
+        $urlelem = '<input type="text" size="'.$size.'" name="exturl" id="'.$urlid.'" value="'.$orig_url.'"'.$disabled.' />';
     } else {
         my $class = 'LC_nobreak';
         if ($residx) {
@@ -459,7 +459,7 @@
         } else {
             $toolelem = '<span class="LC_docs_ext_edit">'."\n".
                        '<select name="exttoolid" id="LC_exttoolid" onchange="javascript:updateExttool(this,'.
-                       'this.form,'."'$supplementalflag'".');">'."\n".
+                       'this.form,'."'$supplementalflag'".');"'.$disabled.'>'."\n".
                        '<option value="" selected="selected">'.&mt('Select').'</option>';
             my %bynum;
             if (ref($ltitools) eq 'HASH') {
@@ -486,21 +486,21 @@
         $toolelem .= '<div id="'.$toolattr{'dispdiv'}.'" style="'.$dispdivstyle.'">'.
                     '<span class="'.$class.'">'.&mt('Display target:').' '.
                     '<label><input type="radio" name="exttooltarget" value="iframe" '.$chkstate{'iframe'}.'onclick="updateTooldim(this.form,'.
-                    "'$toolattr{dimendiv}','$toolattr{dimenwidth}','$toolattr{dimenheight}'".');">'.&mt('iframe').'</label>'.(' 'x2).
+                    "'$toolattr{dimendiv}','$toolattr{dimenwidth}','$toolattr{dimenheight}'".');"'.$disabled.'>'.&mt('iframe').'</label>'.(' 'x2).
                     '<label><input type="radio" name="exttooltarget" value="window" '.$chkstate{'window'}.'onclick="updateTooldim(this.form,'.
-                    "'$toolattr{dimendiv}','$toolattr{dimenwidth}','$toolattr{dimenheight}'".');">'.&mt('window').'</label>'.
+                    "'$toolattr{dimendiv}','$toolattr{dimenwidth}','$toolattr{dimenheight}'".');"'.$disabled.'>'.&mt('window').'</label>'.
                     '</span><div id="'.$toolattr{'dimendiv'}.'" style="'.$dimendivstyle.'">'. 
                     '<span class="'.$class.'">'.
-                    &mt('Width').'<input type="text" id="'.$toolattr{'dimenwidth'}.'" name="exttoolwidth" value="'.$width.'">'.(' 'x2).
-                    &mt('Height').'<input type="text" id="'.$toolattr{'dimenheight'}.'" name="exttoolheight" value="'.$height.'"></span>'."\n".
+                    &mt('Width').'<input type="text" id="'.$toolattr{'dimenwidth'}.'" name="exttoolwidth" value="'.$width.'"'.$disabled.'>'.(' 'x2).
+                    &mt('Height').'<input type="text" id="'.$toolattr{'dimenheight'}.'" name="exttoolheight" value="'.$height.'"'.$disabled.'></span>'."\n".
                     '</div></div>'.
                     '<div id="'.$toolattr{'crslabeldiv'}.'" style="'.$labelstyle.'">'.
                     '<span class="'.$class.'">'.&mt('Course label:').' '.
-                    '<input type="text" id="'.$toolattr{'crslabel'}.'" name="exttoollabel" value="'.$crslabel.'"><br />'.
+                    '<input type="text" id="'.$toolattr{'crslabel'}.'" name="exttoollabel" value="'.$crslabel.'"'.$disabled.'><br />'.
                     '</div>'.
                     '<div id="'.$toolattr{'crstitlediv'}.'" style="'.$titlestyle.'">'.
                     '<span class="'.$class.'">'.&mt('Course title:').' '.
-                    '<input type="text" id="'.$toolattr{'crstitle'}.'" name="exttooltitle" value="'.$crstitle.'"><br />'.
+                    '<input type="text" id="'.$toolattr{'crstitle'}.'" name="exttooltitle" value="'.$crstitle.'"'.$disabled.'><br />'.
                     '</div>';
     }
     my $chooser = $toolelem;
@@ -524,11 +524,11 @@
 <div>
 <span$srcclass>
 $title
-<input type="text" size="$size" name="exttitle" value="$orig_title" />
+<input type="text" size="$size" name="exttitle" value="$orig_title" $disabled />
 <input type="hidden" name="importdetail" value="" />
 $pathitem
 $hiddenelem
-<input type="button" value="$save" onclick="javascript:setExternal(this.form,'$residx','$type','$orig_url','$supplementalflag');" />
+<input type="button" value="$save" onclick="javascript:setExternal(this.form,'$residx','$type','$orig_url','$supplementalflag');"'.$disabled.' />
 </span>
 </div>
 </fieldset>
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.461 loncom/interface/lonmenu.pm:1.462
--- loncom/interface/lonmenu.pm:1.461	Wed Nov  9 14:23:36 2016
+++ loncom/interface/lonmenu.pm	Tue Nov 22 00:43:12 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.461 2016/11/09 14:23:36 raeburn Exp $
+# $Id: lonmenu.pm,v 1.462 2016/11/22 00:43:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -746,6 +746,7 @@
         $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
         $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
         $perms{'mdc'} = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});
+        $perms{'cev'} = &Apache::lonnet::allowed('cev',$env{'request.course.id'});
         my @privs;
         if ($env{'request.symb'} ne '') {
              if ($env{'request.filename'}=~/$LONCAPA::assess_re/) {
@@ -785,7 +786,7 @@
 #
 # This applies to items inside a folder/page modifiable in the course.
 #
-        if (($env{'request.symb'}=~/^uploaded/) && ($perms{'mdc'})) {
+        if (($env{'request.symb'}=~/^uploaded/) && (($perms{'mdc'}) || ($perms{'cev'}))) {
             my $text = 'Edit Folder';
             if (($mapurl =~ /\.page$/) ||
                 ($env{'request.symb'}=~
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.524 loncom/interface/lonnavmaps.pm:1.525
--- loncom/interface/lonnavmaps.pm:1.524	Thu Sep 15 16:30:10 2016
+++ loncom/interface/lonnavmaps.pm	Tue Nov 22 00:43:12 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.524 2016/09/15 16:30:10 damieng Exp $
+# $Id: lonnavmaps.pm,v 1.525 2016/11/22 00:43:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -995,7 +995,8 @@
             $linkopen = "";
             $linkclose = "";
         }
-        if ((&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) &&
+        if (((&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) ||
+              (&Apache::lonnet::allowed('cev',$env{'request.course.id'}))) &&
             ($resource->symb=~/\_\_\_[^\_]+\_\_\_uploaded/)) {
             if (!$params->{'map_no_edit_link'}) {
                 my $icon = &Apache::loncommon::lonhttpdurl('/res/adm/pages').'/editmap.png';
@@ -1540,7 +1541,8 @@
 	$result.='</form>';
     }
     if (($args->{'caller'} eq 'navmapsdisplay') &&
-        (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) {
+        ((&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) ||
+         (&Apache::lonnet::allowed('cev',$env{'request.course.id'})))) {
         my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
         my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
         if ($env{'course.'.$env{'request.course.id'}.'.url'} eq 
Index: loncom/auth/roles.tab
diff -u loncom/auth/roles.tab:1.68 loncom/auth/roles.tab:1.69
--- loncom/auth/roles.tab:1.68	Wed Nov  9 17:32:11 2016
+++ loncom/auth/roles.tab	Tue Nov 22 00:44:59 2016
@@ -14,7 +14,7 @@
 ep:c bre&R:mgr&R:mqg&R:dcm:evb:las:pav:pfo
 cr:s adv&SR:bre&S:bro&S
 cr:d sma
-cr:c bre&R:vgr&SCR:mgr&SCR:mqg&SCR:mgq&SCR:gan&SCR:dcm&SC:vcb&SC:evb&SC:srm&SC:dff&SC:pch:plc:dch&S:pac:rin&S:las&SR:opa&SR:vpa&SR:mdc&SR:cst&IK:vcl&C:pav&C:pfo&C:whn&C:vsa&C:vcg&C
+cr:c bre&R:vgr&SCR:mgr&SCR:mqg&SCR:mgq&SCR:gan&SCR:dcm&SC:vcb&SC:evb&SC:srm&SC:dff&SC:pch:plc:dch&S:pac:rin&S:las&SR:opa&SR:vpa&SR:mdc&SR:cst&IK:vcl&C:pav&C:pfo&C:whn&C:vsa&C:vcg&C:cev&C
 st:d sma&L
 st:c bre&RXL:pch&CL:plc&CL:pac&CL
 ad:s adv
Index: loncom/auth/rolesplain.tab
diff -u loncom/auth/rolesplain.tab:1.49 loncom/auth/rolesplain.tab:1.50
--- loncom/auth/rolesplain.tab:1.49	Tue Nov  8 23:38:58 2016
+++ loncom/auth/rolesplain.tab	Tue Nov 22 00:44:59 2016
@@ -63,6 +63,7 @@
 vgr:View grades
 vsa:View student activity
 vcl:View class list
+cev:View-only access to course editing tools:View-only access to community editing tools 
 mgr:Modify grades
 mqg:Grade items in grading queue
 mgq:Modify grade queue


More information about the LON-CAPA-cvs mailing list