[LON-CAPA-cvs] cvs: loncom /interface lonmenu.pm /xml lonxml.pm

www lon-capa-cvs@mail.lon-capa.org
Fri, 14 Feb 2003 15:14:38 -0000


This is a MIME encoded message

--www1045235678
Content-Type: text/plain

www		Fri Feb 14 10:14:38 2003 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm 
    /loncom/xml	lonxml.pm 
  Log:
  Trying to move more and more menu-related functions into lonmenu.pm
  
  
--www1045235678
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20030214101438.txt"

Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.36 loncom/interface/lonmenu.pm:1.37
--- loncom/interface/lonmenu.pm:1.36	Fri Feb 14 09:30:09 2003
+++ loncom/interface/lonmenu.pm	Fri Feb 14 10:14:37 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.36 2003/02/14 14:30:09 www Exp $
+# $Id: lonmenu.pm,v 1.37 2003/02/14 15:14:37 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -146,19 +146,6 @@
     return '<script>'.$returnval.'</script>';
 }
 
-# ============================================================ Switch Menu Item
-
-sub switchmenu {
-    my ($row,$col,$imgsrc,$texttop,$textbot,$action,$description)=@_;
-    if ($ENV{'browser.interface'} eq 'textual') { return ''; }
-    my $openwin=&openmenu();
-    return(<<ENDSMENU);
-<script>
-   var swmenu=$openwin
-   swmenu.switchbutton($row,$col,"$imgsrc","$texttop","$textbot","$action","$description");
-</script>
-ENDSMENU
-}
 
 # ================================================================== Raw Config
 
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.232 loncom/xml/lonxml.pm:1.233
--- loncom/xml/lonxml.pm:1.232	Thu Feb 13 16:14:35 2003
+++ loncom/xml/lonxml.pm	Fri Feb 14 10:14:37 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.232 2003/02/13 21:14:35 albertel Exp $
+# $Id: lonxml.pm,v 1.233 2003/02/14 15:14:37 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -376,18 +376,6 @@
     return $headerstring;
 }
 
-
-##
-## switchmenu - modeled on lonmenu::switchmenu, but better. 
-## Helper function for registerurl
-##
-sub switchmenu {
-    my ($row,$col,$imgsrc,$texttop,$textbot,$action,$description)=@_;
-    return(<<ENDSMENU);
-    menu.switchbutton($row,$col,'$imgsrc','$texttop','$textbot','$action','$description');
-ENDSMENU
-}
-
 sub registerurl {
     my $forcereg=shift;
     my $target = shift;
@@ -395,13 +383,14 @@
     
     if ($target eq 'edit') {
         $result .="<script type=\"text/javascrtipt\">\n".
-            "if (typeof menu != 'undefined') {menu.currentURL=null;}\n".
+            "if (typeof swmenu != 'undefined') {swmenu.currentURL=null;}\n".
             &Apache::loncommon::browser_and_searcher_javascript().
                 "\n</script>\n";
     }
-    if ((($ENV{'request.publicaccess'}) || 
+    if (($ENV{'browser.interface'} eq 'textual') ||
+        ((($ENV{'request.publicaccess'}) || 
          (!&Apache::lonnet::is_on_map($ENV{'REQUEST_URI'}))) &&
-        (!$forcereg)) {
+        (!$forcereg))) {
 	return $result.
          '<script type="text/javascript">function LONCAPAreg(){;} function LONCAPAstale(){}</script>';
     }
@@ -410,27 +399,27 @@
     my $reopen=&Apache::lonmenu::reopenmenu();
     my $newmail='';
     if (&Apache::lonmsg::newmail()) { 
-       $newmail='menu.setstatus("you have","messages");';
+       $newmail='swmenu.setstatus("you have","messages");';
     }
-    my $timesync='menu.syncclock(1000*'.time.');';
+    my $timesync='swmenu.syncclock(1000*'.time.');';
     if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
         my $hwkadd='';
         if ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
 	    if (&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) {
 		$hwkadd.=(<<ENDSUBM);
-                     menu.switchbutton(7,1,'subm.gif','view sub','missions','gocmd("/adm/grades","submission")',
+                     swmenu.switchbutton(7,1,'subm.gif','view sub','missions','gocmd("/adm/grades","submission")',
                      'View user submissions for this assessment resource');
 ENDSUBM
             }
 	    if (&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) {
 		$hwkadd.=(<<ENDGRDS);
-                     menu.switchbutton(7,2,'pgrd.gif','problem','grades','gocmd("/adm/grades","gradingmenu")',
+                     swmenu.switchbutton(7,2,'pgrd.gif','problem','grades','gocmd("/adm/grades","gradingmenu")',
                      'Modify user grades for this assessment resource');
 ENDGRDS
             }
 	    if (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'})) {
 		$hwkadd.=(<<ENDPARM);
-                     menu.switchbutton(7,3,'pparm.gif','problem','parms','gocmd("/adm/parmset","set")',
+                     swmenu.switchbutton(7,3,'pparm.gif','problem','parms','gocmd("/adm/parmset","set")',
                      'Modify deadlines, etc, for this assessment resource');
 ENDPARM
             }
@@ -452,14 +441,14 @@
                 if ($ENV{'request.role'} =~ /^ca/) { 
                     ($cadom,$caname)=($ENV{'request.role'}=~/(\w+)\/(\w+)$/);
                     ($top,$bottom) = ('co con-','struct');
-                    $action = 'go("/priv/'.$caname.'");';
+                    $action = "go('/priv/".$caname."');";
                     $desc = "Enter construction space as co-author";
                 }
                 # Check that we are on the correct machine
                 my $home = &Apache::lonnet::homeserver($caname,$cadom);
                 if ($home eq $Apache::lonnet::perlvar{'lonHostID'}) {
-                    $editbutton=&switchmenu
-                        (6,1,$top,,$bottom,$action,$desc);
+                    $editbutton=&Apache::lonmenu::switch
+                        ('','',6,1,$top,,$bottom,$action,$desc);
                 }
             }
             ##
@@ -482,11 +471,11 @@
             }        
             # Finally, turn the button on or off
             if ($cfile) {
-                $editbutton=&switchmenu
-                    (6,1,'cstr.gif','edit','resource',
-                     'go("'.$cfile.'");',"Edit this resource");
+                $editbutton=&Apache::lonmenu::switch
+                    ('','',6,1,'cstr.gif','edit','resource',
+                     "go('".$cfile."');","Edit this resource");
             } elsif ($editbutton eq '') {
-                $editbutton = '    menu.clearbut(6,1);';
+                $editbutton = '    swmenu.clearbut(6,1);';
             }
         }
         ###
@@ -497,49 +486,49 @@
 // BEGIN LON-CAPA Internal
 
     function LONCAPAreg() {
-	  menu=$reopen;
-          menu.clearTimeout(menu.menucltim);
+	  swmenu=$reopen;
+          swmenu.clearTimeout(swmenu.menucltim);
           $timesync
           $newmail
-	  menu.currentURL=window.location.pathname;
-          menu.reloadURL=window.location.pathname;
-          menu.currentSymb="$ENV{'request.symb'}";
-          menu.reloadSymb="$ENV{'request.symb'}";
-          menu.currentStale=0;
-          menu.clearbut(3,1);
-          menu.switchbutton
+	  swmenu.currentURL=window.location.pathname;
+          swmenu.reloadURL=window.location.pathname;
+          swmenu.currentSymb="$ENV{'request.symb'}";
+          swmenu.reloadSymb="$ENV{'request.symb'}";
+          swmenu.currentStale=0;
+          swmenu.clearbut(3,1);
+          swmenu.switchbutton
        (6,3,'catalog.gif','catalog','info','catalog_info()','Show catalog information');
-          menu.switchbutton
+          swmenu.switchbutton
        (8,1,'eval.gif','evaluate','this','gopost("/adm/evaluate",currentURL)','Provide my evaluation of this resource');
-          menu.switchbutton
+          swmenu.switchbutton
     (8,2,'fdbk.gif','feedback','discuss','gopost("/adm/feedback",currentURL)','Provide feedback messages or contribute to the course discussion about this resource');
-          menu.switchbutton
+          swmenu.switchbutton
      (8,3,'prt.gif','prepare','printout','gopost("/adm/printout",currentURL)','Prepare a printable document');
-          menu.switchbutton
+          swmenu.switchbutton
        (2,1,'back.gif','backward','','gopost("/adm/flip","back:"+currentURL)','Go to the previous resource in the course sequence');
-          menu.switchbutton
+          swmenu.switchbutton
      (2,3,'forw.gif','forward','','gopost("/adm/flip","forward:"+currentURL)','Go to the next resource in the course sequence');
-          menu.switchbutton
+          swmenu.switchbutton
                             (9,1,'sbkm.gif','set','bookmark','set_bookmark()','Set a bookmark for this resource');
-          menu.switchbutton
+          swmenu.switchbutton
                          (9,2,'vbkm.gif','view','bookmark','edit_bookmarks()','Use or edit my bookmark collection');
-          menu.switchbutton
+          swmenu.switchbutton
                                (9,3,'anot.gif','anno-','tations','annotate()','Make notes and annotations about this resource');
           $hwkadd
           $editbutton
     }
 
     function LONCAPAstale() {
-	  menu=$reopen
-          menu.currentStale=1;
-          if (menu.reloadURL!='' && menu.reloadURL!= null) { 
-             menu.switchbutton
+	  swmenu=$reopen
+          swmenu.currentStale=1;
+          if (swmenu.reloadURL!='' && swmenu.reloadURL!= null) { 
+             swmenu.switchbutton
              (3,1,'reload.gif','return','location','go(reloadURL)','Return to the last known location in the course sequence');
 	  }
-          menu.clearbut(7,1);
-          menu.clearbut(7,2);
-          menu.clearbut(7,3);
-          menu.menucltim=menu.setTimeout(
+          swmenu.clearbut(7,1);
+          swmenu.clearbut(7,2);
+          swmenu.clearbut(7,3);
+          swmenu.menucltim=swmenu.setTimeout(
  'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+
  'clearbut(9,1);clearbut(9,2);clearbut(9,3);clearbut(6,3);clearbut(6,1)',
 			  2000);
@@ -557,19 +546,19 @@
 // BEGIN LON-CAPA Internal
 
     function LONCAPAreg() {
-	  menu=$reopen
+	  swmenu=$reopen
           $timesync
-          menu.currentStale=1;
-          menu.clearbut(2,1);
-          menu.clearbut(2,3);
-          menu.clearbut(8,1);
-          menu.clearbut(8,2);
-          menu.clearbut(8,3);
-          if (menu.currentURL) {
-             menu.switchbutton
+          swmenu.currentStale=1;
+          swmenu.clearbut(2,1);
+          swmenu.clearbut(2,3);
+          swmenu.clearbut(8,1);
+          swmenu.clearbut(8,2);
+          swmenu.clearbut(8,3);
+          if (swmenu.currentURL) {
+             swmenu.switchbutton
               (3,1,'reload.gif','return','location','go(currentURL)');
  	  } else {
-	      menu.clearbut(3,1);
+	      swmenu.clearbut(3,1);
           }
     }
 

--www1045235678--