[LON-CAPA-cvs] cvs: loncom /interface lonmenu.pm lonpreferences.pm doc/loncapafiles loncapafiles.lpml

www lon-capa-cvs-allow@mail.lon-capa.org
Fri, 13 Apr 2007 13:39:32 -0000


www		Fri Apr 13 09:39:32 2007 EDT

  Modified files:              
    /doc/loncapafiles	loncapafiles.lpml 
    /loncom/interface	lonmenu.pm lonpreferences.pm 
  Log:
  Icons in menu menu, configurable in prefs
  
  
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.531 doc/loncapafiles/loncapafiles.lpml:1.532
--- doc/loncapafiles/loncapafiles.lpml:1.531	Thu Apr 12 22:03:49 2007
+++ doc/loncapafiles/loncapafiles.lpml	Fri Apr 13 09:39:28 2007
@@ -2,7 +2,7 @@
  "http://lpml.sourceforge.net/DTD/lpml.dtd">
 <!-- loncapafiles.lpml -->
 
-<!-- $Id: loncapafiles.lpml,v 1.531 2007/04/13 02:03:49 www Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.532 2007/04/13 13:39:28 www Exp $ -->
 
 <!--
 
@@ -6190,6 +6190,55 @@
 vbkm.gif;
 </filenames>
 </fileglob>
+<fileglob>
+<glob>*.png</glob>
+<sourcedir>loncom/html/res/adm/pages/</sourcedir>
+<targetdir dist='default'>home/httpd/html/res/adm/pages/</targetdir>
+<categoryname>graphic file</categoryname>
+<description>main menu graphical icons</description>
+<filenames>
+anno.png;
+bchat.png;
+ccrs.png;
+conf.png;
+docs.png;
+eval.png;
+grps.png;
+mail.png;
+new.png;
+pgrd.png;
+pref.png;
+roles.png;
+sprs.png;
+vbkm.png;
+anot.png;
+blog.png;
+chrt.png;
+cprv.png;
+egrd.png;
+fdbk.png;
+keys.png;
+mcrs.png;
+parm.png;
+port.png;
+prt.png;
+sbkm.png;
+src.png;
+back.png;
+catalog.png;
+com.png;
+cstr.png;
+enrl.png;
+forw.png;
+logout.png;
+nav.png;
+pcstr.png;
+pparm.png;
+res.png;
+sctr.png;
+stat.png;
+</filenames>
+</fileglob>
 <file>
 <source>loncom/html/res/adm/pages/math_example.tex</source>
 <target dist='default'>home/httpd/html/res/adm/pages/math_example.tex</target>
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.212 loncom/interface/lonmenu.pm:1.213
--- loncom/interface/lonmenu.pm:1.212	Thu Apr 12 22:03:54 2007
+++ loncom/interface/lonmenu.pm	Fri Apr 13 09:39:32 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.212 2007/04/13 02:03:54 www Exp $
+# $Id: lonmenu.pm,v 1.213 2007/04/13 13:39:32 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -842,6 +842,9 @@
        }
    } else {
 # Inline Remote
+       if ($env{'environment.icons'} ne 'classic') {
+          $img=~s/\.gif$/\.png/;
+       }
        if ($nobreak==2) { return ''; }
        my $text=$top.' '.$bot;
        $text=~s/\s*\-\s*//gs;
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.97 loncom/interface/lonpreferences.pm:1.98
--- loncom/interface/lonpreferences.pm:1.97	Wed Mar  7 11:24:08 2007
+++ loncom/interface/lonpreferences.pm	Fri Apr 13 09:39:32 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.97 2007/03/07 16:24:08 raeburn Exp $
+# $Id: lonpreferences.pm,v 1.98 2007/04/13 13:39:32 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -516,6 +516,45 @@
 }
 
 ################################################################
+#                     Icon Subroutines                         #
+################################################################
+sub iconchanger {
+    my $r = shift;
+    my $user       = $env{'user.name'};
+    my $domain     = $env{'user.domain'};
+    my %userenv = &Apache::lonnet::get
+        ('environment',['icons']);
+    my $iconic='checked="checked"';
+    my $classic='';
+    if ($userenv{'icons'} eq 'classic') {
+       $classic='checked="checked"';
+       $iconic='';
+    }
+    my $useicons=&mt('Use icons');
+    my $usebuttons=&mt('Use classic buttons');
+    my $change=&mt('Change');
+    $r->print(<<ENDSCREEN);
+<form name="prefs" action="/adm/preferences" method="post">
+<input type="hidden" name="action" value="verify_and_change_icons" />
+<label><input type="radio" name="menumode" value="iconic" $iconic /> $useicons</label><br />
+<label><input type="radio" name="menumode" value="classic" $classic /> $usebuttons</label><br />
+<input type="submit" value="$change" />
+</form>
+ENDSCREEN
+}
+
+sub verify_and_change_icons {
+    my $r = shift;
+    my $user       = $env{'user.name'};
+    my $domain     = $env{'user.domain'};
+    my $newicons  = $env{'form.menumode'};
+
+    &Apache::lonnet::put('environment',{'icons' => $newicons});
+    &Apache::lonnet::appenv('environment.icons' => $newicons);
+    $r->print(&mt('Set menu mode to [_1].',$newicons));
+}
+
+################################################################
 #         Message Forward                                      #
 ################################################################
 
@@ -1470,6 +1509,22 @@
 		      }));
     }
 
+    push (@Options,({ action   => 'changeicons',
+                      linktext => 'Change How Main Menu is Displayed',
+                      href     => '/adm/preferences',
+                      subroutine => \&iconchanger,
+                      breadcrumb =>
+                          { href => '/adm/preferences?action=changeicons',
+                            text => 'Change Main Menu'},
+                      },
+                    { action   => 'verify_and_change_icons',
+                      subroutine => \&verify_and_change_icons,
+                      breadcrumb =>
+                          { href => '/adm/preferences?action=changeicons',
+                            text => 'Change Main Menu'},
+                      printmenu => 'yes',
+                      }));
+
     if (&Apache::lonnet::allowed('whn',$env{'request.course.id'})
 	|| &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/'
 				    .$env{'request.course.sec'})) {