[LON-CAPA-cvs] cvs: loncom /interface lonmenu.pm /publisher packages.tab

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 16 Jul 2007 01:57:43 -0000


raeburn		Sun Jul 15 21:57:43 2007 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm 
    /loncom/publisher	packages.tab 
  Log:
  Parameter to hide all buttons/icons/text except page flip arrows from inline menu or remote for students.
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.219 loncom/interface/lonmenu.pm:1.220
--- loncom/interface/lonmenu.pm:1.219	Tue Jul 10 19:38:09 2007
+++ loncom/interface/lonmenu.pm	Sun Jul 15 21:57:38 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.219 2007/07/10 23:38:09 albertel Exp $
+# $Id: lonmenu.pm,v 1.220 2007/07/16 01:57:38 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -507,10 +507,19 @@
         my $buttons='';
         foreach (split(/\n/,$menuitems)) {
 	    my ($command,@rest)=split(/\&/,$_);
-            if ($command eq 's') {
-		$buttons.=&switch('','',@rest);
-            } else {
-                $buttons.=&clear(@rest);
+            my $idx=10*$rest[0]+$rest[1];
+            if (&hidden_button_check() eq 'yes') {
+                if ($idx == 21 ||$idx == 23) {
+                    $buttons.=&switch('','',@rest);
+                } else {
+                    $buttons.=&clear(@rest);
+                }
+            } else {  
+                if ($command eq 's') {
+	            $buttons.=&switch('','',@rest);
+                } else {
+                    $buttons.=&clear(@rest);
+                }
             }
         }
 
@@ -520,28 +529,35 @@
 	    my $inlinebuttons='';
 	    if ($addremote) {
 # Registered, textual output
-
 		if ($env{'browser.interface'} eq 'textual') {
 		    $inlinebuttons=
                         join('',map { (defined($_)?$_:'') } @inlineremote);
 		} else {
                     if ($env{'environment.icons'} eq 'iconsonly') {
-                       $inlinebuttons=(<<ENDINLINEICONS);
+                        $inlinebuttons=(<<ENDARROWSINLINE);
 <tr><td>
 $inlineremote[21] $inlineremote[23]
+ENDARROWSINLINE
+                        if (&hidden_button_check() ne 'yes') {
+                            $inlinebuttons .= (<<ENDINLINEICONS);
 $inlineremote[61] $inlineremote[63]
 $inlineremote[71] $inlineremote[72] $inlineremote[73]
 $inlineremote[81] $inlineremote[82] $inlineremote[83]
 $inlineremote[91] $inlineremote[92] $inlineremote[93]</td></tr>
 ENDINLINEICONS
+                        }
                     } else {
-		       $inlinebuttons=(<<ENDINLINE);
+			$inlinebuttons=(<<ENDFIRSTLINE);
 <tr><td>$inlineremote[21]</td><td>&nbsp;</td><td>$inlineremote[23]</td></tr>
+ENDFIRSTLINE
+                        if (&hidden_button_check() ne 'yes') { 
+                            $inlinebuttons .= (<<ENDINLINE);
 <tr><td>$inlineremote[61]</td><td>$inlineremote[62]</td><td>$inlineremote[63]</td></tr>
 <tr><td>$inlineremote[71]</td><td>$inlineremote[72]</td><td>$inlineremote[73]</td></tr>
 <tr><td>$inlineremote[81]</td><td>$inlineremote[82]</td><td>$inlineremote[83]</td></tr>
 <tr><td>$inlineremote[91]</td><td>$inlineremote[92]</td><td>$inlineremote[93]</td></tr>
 ENDINLINE
+                        }
                     }
                 }
 	    }
@@ -1337,6 +1353,16 @@
     return $rolename;
 }
 
+sub hidden_button_check {
+    my $hidden;
+    if ($env{'request.course.id'} eq '') {
+        return;
+    }
+    if ($env{'request.role.adv'}) {
+        return;
+    }
+    return(&Apache::lonnet::EXT('resource.0.buttonshide')); 
+}
 
 # ================================================================ Main Program
 
Index: loncom/publisher/packages.tab
diff -u loncom/publisher/packages.tab:1.50 loncom/publisher/packages.tab:1.51
--- loncom/publisher/packages.tab:1.50	Tue Jun  5 18:37:50 2007
+++ loncom/publisher/packages.tab	Sun Jul 15 21:57:43 2007
@@ -137,6 +137,8 @@
 default&discusshide&default:yes
 default&hiddenresource&display:Resource Hidden from Students
 default&hiddenresource&type:string_yesno
+default&buttonshide&display:Hide buttons from students
+default&buttonshide&type:string_yesno
 #default&hiddenresource&hidden:parm
 
 #bridge tasks