[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonconfigsettings.pm

raeburn raeburn at source.lon-capa.org
Sun Oct 23 17:13:52 EDT 2016


raeburn		Sun Oct 23 21:13:52 2016 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonconfigsettings.pm 
  Log:
  - For 2.11
    - Backport 1.33
  
  
Index: loncom/interface/lonconfigsettings.pm
diff -u loncom/interface/lonconfigsettings.pm:1.21.4.8 loncom/interface/lonconfigsettings.pm:1.21.4.9
--- loncom/interface/lonconfigsettings.pm:1.21.4.8	Thu Aug  4 17:34:35 2016
+++ loncom/interface/lonconfigsettings.pm	Sun Oct 23 21:13:51 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: lonconfigsettings.pm,v 1.21.4.8 2016/08/04 17:34:35 raeburn Exp $
+# $Id: lonconfigsettings.pm,v 1.21.4.9 2016/10/23 21:13:51 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -209,7 +209,7 @@
 }
 
 sub print_footer {
-    my ($r,$phase,$newphase,$button_text,$actions,$container) = @_;
+    my ($r,$phase,$newphase,$button_text,$actions,$container,$parm_permission) = @_;
     $button_text = &mt($button_text);
     $r->print('<input type="hidden" name="phase" value="" />');
     if (defined($env{'form.origin'})) {
@@ -234,8 +234,16 @@
         } else {
             $onclick = '"javascript:changePage(document.'.$phase.','."'$newphase'".')"';
         }
-        $r->print('<p><input type="button" name="store" value="'.
-                  $button_text.'" onclick='.$onclick.' /></p>');
+        my $showbutton = 1;
+        if (ref($parm_permission) eq 'HASH') {
+            unless (($parm_permission->{'process'}) || ($newphase eq 'display')) {
+                $showbutton = 0;
+            }
+        }
+        if ($showbutton) {
+            $r->print('<p><input type="button" name="store" value="'.
+                      $button_text.'" onclick='.$onclick.' /></p>');
+        }
     }
     if ($phase eq 'process') {
         $r->print('</form>');
@@ -245,7 +253,8 @@
 }
 
 sub make_changes {
-    my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$roles,$allitems,$container) = @_;
+    my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$roles,
+        $allitems,$container,$parm_permission) = @_;
     my %brcrumtext = &get_crumb_text();
     my @actions = &Apache::loncommon::get_env_multiple('form.actions');
     my ($numchanged,%changes,%disallowed);
@@ -309,14 +318,14 @@
     if ($context eq 'course') {
         $footer_text = 'Back to display/edit settings'; 
     }
-    &print_footer($r,$phase,'display',$footer_text,\@actions,$container);
+    &print_footer($r,$phase,'display',$footer_text,\@actions,$container,$parm_permission);
     $r->print('</p>');
     return \%lastact;
 }
 
 sub display_settings {
     my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$jscript,
-        $allitems,$crstype,$container) = @_;
+        $allitems,$crstype,$container,$parm_permission) = @_;
     my %brcrumtext = &get_crumb_text();
     my @actions = &Apache::loncommon::get_env_multiple('form.actions');
     &Apache::lonhtmlcommon::add_breadcrumb
@@ -377,7 +386,7 @@
                     } else {
                         ($output{$item},$rowtotal{$item}) =
                             &Apache::courseprefs::print_config_box($r,$dom,$phase,
-                                $item,$prefs->{$item},$values,$allitems,$crstype);
+                                $item,$prefs->{$item},$values,$allitems,$crstype,$parm_permission);
                     }
                     $rowsum += $rowtotal{$item};
                 }
@@ -387,7 +396,7 @@
                 $r->print($output{$items[$i]});
             }
             $r->print('</div>');
-            $r->print(&print_footer($r,$phase,'process','Save Changes',\@actions,$container));
+            $r->print(&print_footer($r,$phase,'process','Save Changes',\@actions,$container,$parm_permission));
         } else {
             $r->print('<input type="hidden" name="phase" value="" />'.
                       '<span class="LC_error">'.&mt('No settings chosen').
@@ -400,7 +409,7 @@
 }
 
 sub display_choices {
-    my ($r,$phase,$context,$prefs_order,$prefs,$container) = @_;
+    my ($r,$phase,$context,$prefs_order,$prefs,$container,$parm_permission) = @_;
     if ($phase eq '') {
         $phase = 'pickactions';
     }
@@ -411,7 +420,13 @@
               &Apache::loncommon::check_uncheck_jscript()."\n".
               '// ]]>'."\n".
               '</script>'."\n");
-    $r->print('<h3>'.&mt('Settings to display/modify').'</h3>'.
+    my $heading = &mt('Settings to display/modify');
+    if (ref($parm_permission) eq 'HASH') {
+        unless ($parm_permission->{'process'}) {
+            $heading = &mt('Settings to display');
+        }
+    }
+    $r->print('<h3>'.$heading.'</h3>'.
               '<div><input type="button" value="'.&mt('check all').'" '.
               'onclick="javascript:checkAll(document.pickactions.actions)"'.
               ' />'.(' 'x2).
@@ -449,7 +464,7 @@
         }
         $r->print('</div><br clear="all" />');
     }
-    $r->print(&print_footer($r,$phase,'display','Display',undef,$container));
+    $r->print(&print_footer($r,$phase,'display','Display',undef,$container,$parm_permission));
     $r->print('</form>');
     $r->print(&Apache::loncommon::end_page());
     return;




More information about the LON-CAPA-cvs mailing list