[LON-CAPA-cvs] cvs: loncom /interface groupsort.pm loncommon.pm lonhtmlcommon.pm lonindexer.pm lonsearchcat.pm lonsource.pm rat lonratedt.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Wed, 11 Jul 2007 20:32:17 -0000


This is a MIME encoded message

--albertel1184185937
Content-Type: text/plain

albertel		Wed Jul 11 16:32:17 2007 EDT

  Modified files:              
    /rat	lonratedt.pm 
    /loncom/interface	groupsort.pm lonindexer.pm lonsearchcat.pm 
                     	lonsource.pm loncommon.pm lonhtmlcommon.pm 
  Log:
  - BUG#4168 inhibit the inline menu in the seraching/browsing popup window.
  
  
  
--albertel1184185937
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20070711163217.txt"

Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.87 rat/lonratedt.pm:1.88
--- rat/lonratedt.pm:1.87	Tue Jan 16 16:10:55 2007
+++ rat/lonratedt.pm	Wed Jul 11 16:32:01 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Edit Handler for RAT Maps
 #
-# $Id: lonratedt.pm,v 1.87 2007/01/16 21:10:55 albertel Exp $
+# $Id: lonratedt.pm,v 1.88 2007/07/11 20:32:01 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -274,7 +274,7 @@
    var options="scrollbars=1,resizable=1,menubar=0,location=1,toolbar=1";
    idxmode=mode;
    idxflag=1;
-   idx=open('$resurl/?launch=1&mode=$mode&catalogmode='+mode,'idxout',options);
+   idx=open('$resurl/?inhibitmenu=yes&launch=1&mode=$mode&catalogmode='+mode,'idxout',options);
    idx.focus();
 }
 
@@ -282,7 +282,7 @@
 function groupopen(url,recover,bookmarks) {
    var options="scrollbars=1,resizable=1,menubar=0";
    idxflag=1;
-   idx=open("/adm/groupsort?mode=$mode&recover="+recover+"&readfile="+url+"&bookmarks="+bookmarks,"idxout",options);
+   idx=open("/adm/groupsort?inhibitmenu=yes&mode=$mode&recover="+recover+"&readfile="+url+"&bookmarks="+bookmarks,"idxout",options);
    idx.focus();
 }
 
@@ -291,7 +291,7 @@
    var options="scrollbars=1,resizable=1,menubar=0";
    srchmode=mode;
    srchflag=1;
-   srch=open("/adm/searchcat?launch=1&mode=$mode&catalogmode="+mode,"srchout",options);
+   srch=open("/adm/searchcat?inhibitmenu=yes&launch=1&mode=$mode&catalogmode="+mode,"srchout",options);
    srch.focus();
 }
 // ----------------------------------------------------- launch indexer browser
@@ -326,6 +326,7 @@
         if (editbrowser == null) {
             url += 'launch=1&';
         }
+        url += 'inhibitmenu=yes&';
         url += 'catalogmode=interactive&';
         url += 'mode=edit&';
         url += 'form=' + formname + '&';
Index: loncom/interface/groupsort.pm
diff -u loncom/interface/groupsort.pm:1.53 loncom/interface/groupsort.pm:1.54
--- loncom/interface/groupsort.pm:1.53	Fri Jul  6 04:34:37 2007
+++ loncom/interface/groupsort.pm	Wed Jul 11 16:32:15 2007
@@ -2,7 +2,7 @@
 # The LON-CAPA group sort handler
 # Allows for sorting prior to import into RAT.
 #
-# $Id: groupsort.pm,v 1.53 2007/07/06 08:34:37 albertel Exp $
+# $Id: groupsort.pm,v 1.54 2007/07/11 20:32:15 albertel Exp $
 # 
 # Copyright Michigan State University Board of Trustees
 #
@@ -353,7 +353,7 @@
 <input type="hidden" name="recover" value="$env{'form.recover'}" />
 END
 
-
+        $r->print(&Apache::loncommon::inhibit_menu_check('input'));
         # ---
     
         if ($env{'form.recover'}) {
@@ -368,9 +368,9 @@
 		&Apache::loncommon::escape_single(&Apache::loncommon::lastresurl());
 	    $r->print(<<END);
 <input type="button" name="alter" value="$lt{'ci'}"
- onClick="window.location='$resurl?catalogmode=import'" />&nbsp;
+ onClick="window.location='$resurl?inhibitmenu=yes&amp;catalogmode=import'" />&nbsp;
 <input type="button" name="altersearch" value="$lt{'cs'}"
- onClick="window.location='/adm/searchcat?catalogmode=import'" />&nbsp;
+ onClick="window.location='/adm/searchcat?inhibitmenu=yes&amp;catalogmode=import'" />&nbsp;
 <input type="button" name="alter" value="$lt{'fi'}"
  onClick="finish_import()" />&nbsp;
 <input type="button" name="alter" value="$lt{'ca'}" onClick="self.close()" />
@@ -396,6 +396,8 @@
 <input type="hidden" name="newval" value="" />
 <input type="hidden" name="mode" value="$env{'form.mode'}" />
 END
+        $r->print(&Apache::loncommon::inhibit_menu_check('input'));
+
     }
     foreach (sort {$shash{$a}<=>$shash{$b}} (keys %shash)) {
 	my $key=$_;
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.169 loncom/interface/lonindexer.pm:1.170
--- loncom/interface/lonindexer.pm:1.169	Fri Jul  6 04:34:37 2007
+++ loncom/interface/lonindexer.pm	Wed Jul 11 16:32:15 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.169 2007/07/06 08:34:37 albertel Exp $
+# $Id: lonindexer.pm,v 1.170 2007/07/11 20:32:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -241,7 +241,7 @@
 #
 #
 	    if (!defined($mode) || ($mode ne 'edit' && $mode ne 'parmset')) {
-                my $location = "/adm/groupsort?catalogmode=import&";
+                my $location = "/adm/groupsort?&inhibitmenu=yes&catalogmode=import&";
                 $location .= "mode=".$mode."&";
                 $location .= "acts=";
 		$catalogmodefunctions=<<"END";
@@ -345,7 +345,9 @@
 END
 	}
 
+        my $inhibit_menu = "+'&".&Apache::loncommon::inhibit_menu_check()."'";
 # ---------------------------------------------------------------- Print Header
+        
 	my $js = <<"ENDHEADER";
 <script type="text/javascript">
 $catalogmodefunctions
@@ -387,7 +389,7 @@
     newWin.focus();
 }
 function gothere(val) {
-    window.location=val+'?acts='+document.forms.fileattr.acts.value;
+    window.location=val+'?acts='+document.forms.fileattr.acts.value$inhibit_menu;
 }
 </script>
 ENDHEADER
@@ -498,6 +500,7 @@
 <input type="hidden" name="acts" value="" />
 $closebutton $groupimportbutton
 END
+        $r->print(&Apache::loncommon::inhibit_menu_check('input'));
 # -------------- Filter out sequence containment in crumbs and "recent folders"
 	my $storeuri=$uri;
 	$storeuri='/'.(split(/\.(page|sequence)\/\//,$uri))[-1];
@@ -513,7 +516,7 @@
 	if ($reshome) {
 	    $r->print("<font size='+2'><a href='");
 	    if ($env{'form.catalogmode'} eq 'import') {
-		$r->print('javascript:document.forms.fileattr.action="'.$reshome.'";document.forms.fileattr.submit();');
+		$r->print('javascript:document.forms.fileattr.action="'.&Apache::loncommon::inhibit_menu_check($reshome).'";document.forms.fileattr.submit();');
 	    } else {
 		$r->print($reshome);
 	    }
@@ -847,6 +850,7 @@
 		   'document.forms.fileattr.acts.value)" '.
 		   'enctype="application/x-www-form-urlencoded"'.
                    '>'."\n");
+	$r->print(&Apache::loncommon::inhibit_menu_check('input'));
 	$r->print ('<input type=hidden name=openuri value="'.
 		   $startdir.'" />'."\n");
 	$r->print ('<input type="hidden" name="acts" value="" />'."\n");
@@ -1000,13 +1004,13 @@
 	$r->print("<img alt=\"\" src='$iconname' class='LC_icon' />\n");
 	my $quotable_filelink = &Apache::loncommon::escape_single($filelink);
 
-
 	$r->print (" <a href=\"javascript:openWindow('".$quotable_filelink.
-		   "','previewfile','450','500','no','yes','yes');\"".
+		   "?inhibitmenu=yes','previewfile','450','500','no','yes','yes');\"".
 		   " target=\"_self\">$listname</a> ");
-
+	$quotable_filelink = &Apache::loncommon::escape_single($filelink.'.meta');
+	&Apache::loncommon::inhibit_menu_check(\$quotable_filelink);
 	$r->print (" (<a href=\"javascript:openWindow('".$quotable_filelink.
-		   ".meta','metadatafile','500','550','no','yes','no');\" ".
+		   "?inhibitmenu=yes','metadatafile','500','550','no','yes','no');\" ".
 		   " target=\"_self\">metadata</a>) ");
 # Close form to open/close sequence
 	if ($filelink=~/\.(page|sequence)$/) {
@@ -1069,6 +1073,7 @@
 	    if($source eq 'open') {
 		my $sourcelink = &Apache::lonsource::make_link($filelink,$listname);
 		my $quotable_sourcelink = &Apache::loncommon::escape_single($sourcelink);
+		&Apache::loncommon::inhibit_menu_check(\$quotable_sourcelink);
 		$r->print('<td>'."<a href=\"javascript:openWindow('"
 			  .$quotable_sourcelink.
 			  "', 'previewsource', '700', '700', 'no', 'yes','yes');\"".
@@ -1266,6 +1271,7 @@
     $r->print ('<input type="hidden" name="openuri" value="'.$uri.'" />'.
 	       "\n");
     $r->print ('<input type="hidden" name="dirPointer" value="on" />'."\n");
+    $r->print(&Apache::loncommon::inhibit_menu_check('input'));
     $dnum++;
 }
 
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.287 loncom/interface/lonsearchcat.pm:1.288
--- loncom/interface/lonsearchcat.pm:1.287	Fri Jun 15 19:29:17 2007
+++ loncom/interface/lonsearchcat.pm	Wed Jul 11 16:32:15 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.287 2007/06/15 23:29:17 albertel Exp $
+# $Id: lonsearchcat.pm,v 1.288 2007/07/11 20:32:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -138,7 +138,7 @@
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
              ['catalogmode','launch','acts','mode','form','element','pause',
               'phase','persistent_db_id','table','start','show',
-              'cleargroupsort','titleelement','area']);
+              'cleargroupsort','titleelement','area','inhibitmenu']);
     ##
     ## The following is a trick - we wait a few seconds if asked to so
     ##     the daemon running the search can get ahead of the daemon
@@ -190,7 +190,8 @@
     }
     &Apache::lonhtmlcommon::add_breadcrumb
        ({href=>'/adm/searchcat?'.
-               'catalogmode='.$env{'form.catalogmode'}.
+	       &Apache::loncommon::inhibit_menu_check().
+               '&catalogmode='.$env{'form.catalogmode'}.
                '&launch='.$env{'form.launch'}.
                '&mode='.$env{'form.mode'},
               text=>"$crumb_text",
@@ -258,6 +259,9 @@
     if (exists($env{'form.area'})) {
         $hidden_fields .= &hidden_field('area');
     }
+    if (exists($env{'form.inhibitmenu'})) {
+        $hidden_fields .= &hidden_field('inhibitmenu');
+    }
     ##
     ## Configure dynamic components of interface
     ##
@@ -308,15 +312,17 @@
             $srchtype = 'Portfolio';
         }
         &Apache::lonhtmlcommon::add_breadcrumb
-            ({href=>'/adm/searchcat?phase=disp_adv&'.
-                  'catalogmode='.$env{'form.catalogmode'}.
+            ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check().
+		  '&phase=disp_adv'.
+                  '&catalogmode='.$env{'form.catalogmode'}.
                   '&launch='.$env{'form.launch'}.
                   '&mode='.$env{'form.mode'},
                   text=>"Advanced $srchtype Search",
                   bug=>'Searching',});
     } elsif ($env{'form.searchmode'} eq 'course search') {
         &Apache::lonhtmlcommon::add_breadcrumb
-            ({href=>'/adm/searchcat?phase=disp_adv&'.
+            ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check().
+		  '&phase=disp_adv'.
                   'catalogmode='.$env{'form.catalogmode'}.
                   '&launch='.$env{'form.launch'}.
                   '&mode='.$env{'form.mode'},
@@ -759,8 +765,9 @@
                   '</label>';
     }
     $adv_search_link = '<a href="/adm/searchcat?'.
-                       'phase=disp_adv&'.
-                       'catalogmode='.$env{'form.catalogmode'}.
+	               &Apache::loncommon::inhibit_menu_check().
+		       '&phase=disp_adv'.
+                       '&catalogmode='.$env{'form.catalogmode'}.
                        '&launch='.$env{'form.launch'}.
                        '&mode='.$env{'form.mode'}.
                        '&area='.$area.
@@ -3234,6 +3241,7 @@
 SCRIPT
         }
     }
+    my $inhibit_menu = "&".&Apache::loncommon::inhibit_menu_check();
     $js.=<<SCRIPT if $env{'form.catalogmode'} eq 'import';
 <script type="text/javascript">
     function queue(checkbox_num,val) {
@@ -3254,7 +3262,7 @@
     }
     function select_group() {
 	parent.window.location=
-    "/adm/groupsort?mode=$env{'form.mode'}&catalogmode=import&acts="+
+    "/adm/groupsort?mode=$env{'form.mode'}&catalogmode=import$inhibit_menu&acts="+
 	    parent.statusframe.document.forms.statusform.elements.acts.value;
     }
 </script>
@@ -3377,7 +3385,7 @@
     $jumpurl=~s|^/ext/|http://|;
     $result .= '<b>'.$prefix.
         '<img src="'.&Apache::loncommon::icon($values{'url'}).'" />'.'&nbsp;'.
-        '<a href="'.$jumpurl.'" '.
+        '<a href="'.$jumpurl.'?inhibitmenu=yes" '.
         'target="preview">'.$values{'title'}."</a></b>\n";
     $result .= "<p>\n";
     $result .= '<b>'.$values{'author'}.'</b>,'.
@@ -3513,7 +3521,7 @@
     my $link = &display_url($jumpurl,[2,0,1]);
 
     $result.=<<END;
-<a href="$jumpurl" 
+<a href="$jumpurl?inhibitmenu=yes" 
    target='preview'>$values{'title'}</a> <br />
 $link <br />
 $values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br />
@@ -3562,7 +3570,7 @@
     }
     $jumpurl = &HTML::Entities::encode($jumpurl,'<>&"');
     $result.=' <span class="LC_nobreak">'.
-	'<a href="'.$jumpurl.'" target="preview">'.
+	'<a href="'.$jumpurl.'?inhibitmenu=yes" target="preview">'.
         &HTML::Entities::encode($values{'title'},'<>&"').'</a></span> '.
 	$link.' <b>'.$values{'author'}.'</b> ('.$values{'domain'}.')<br />';
     return $result;
@@ -3607,7 +3615,7 @@
 $prefix <img src="$icon" />
 <dl>
 <dt>URL:</dt>
-    <dd><a href="$jumpurl" 
+    <dd><a href="$jumpurl?inhibitmenu=yes" 
          target='preview'>$values{'url'}</a></dd>
 END
     foreach my $field ('title','author','domain','subject','keywords','notes',
Index: loncom/interface/lonsource.pm
diff -u loncom/interface/lonsource.pm:1.17 loncom/interface/lonsource.pm:1.18
--- loncom/interface/lonsource.pm:1.17	Thu Jun 22 14:17:23 2006
+++ loncom/interface/lonsource.pm	Wed Jul 11 16:32:15 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Souce Code handler
 #
-# $Id: lonsource.pm,v 1.17 2006/06/22 18:17:23 www Exp $
+# $Id: lonsource.pm,v 1.18 2007/07/11 20:32:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -44,7 +44,7 @@
 
 sub make_link {
     my ($filename, $listname) = @_;
-    my $sourcelink = "/adm/source?filename=".$filename."&listname=".$listname;
+    my $sourcelink = "/adm/source?inhibitmenu=yes&filename=".$filename."&listname=".$listname;
 
     return $sourcelink;
 }
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.547 loncom/interface/loncommon.pm:1.548
--- loncom/interface/loncommon.pm:1.547	Fri Jul  6 20:53:24 2007
+++ loncom/interface/loncommon.pm	Wed Jul 11 16:32:15 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.547 2007/07/07 00:53:24 albertel Exp $
+# $Id: loncommon.pm,v 1.548 2007/07/11 20:32:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4939,6 +4939,51 @@
     }
 }
 
+=pod
+
+=item * &inhibit_menu_check($arg)
+
+Checks for a inhibitmenu state and generates output to preserve it
+
+Inputs:         $arg - can be any of
+                     - undef - in which case the return value is a string 
+                               to add  into arguments list of a uri
+                     - 'input' - in which case the return value is a HTML
+                                 <form> <input> field of type hidden to
+                                 preserve the value
+                     - a url - in which case the return value is the url with
+                               the neccesary cgi args added to preserve the
+                               inhibitmenu state
+                     - a ref to a url - no return value, but the string is
+                                        updated to include the neccessary cgi
+                                        args to preserve the inhibitmenu state
+
+=cut
+
+sub inhibit_menu_check {
+    my ($arg) = @_;
+    &get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']);
+    if ($arg eq 'input') {
+	if ($env{'form.inhibitmenu'}) {
+	    return '<input type="hidden" name="inhibitmenu" value="'.$env{'form.inhibitmenu'}.'" />';
+	} else {
+	    return
+	}
+    }
+    if ($env{'form.inhibitmenu'}) {
+	if (ref($arg)) {
+	    $$arg .= '?inhibitmenu='.$env{'form.inhibitmenu'};
+	} elsif ($arg eq '') {
+	    $arg .= 'inhibitmenu='.$env{'form.inhibitmenu'};
+	} else {
+	    $arg .= '?inhibitmenu='.$env{'form.inhibitmenu'};
+	}
+    }
+    if (!ref($arg)) {
+	return $arg;
+    }
+}
+
 ###############################################
 
 =pod
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.159 loncom/interface/lonhtmlcommon.pm:1.160
--- loncom/interface/lonhtmlcommon.pm:1.159	Sun May 13 14:03:15 2007
+++ loncom/interface/lonhtmlcommon.pm	Wed Jul 11 16:32:15 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.159 2007/05/13 18:03:15 banghart Exp $
+# $Id: lonhtmlcommon.pm,v 1.160 2007/07/11 20:32:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -140,6 +140,7 @@
     foreach my $value (sort(keys(%recent))) {
 	unless ($value =~/^error\:/) {
 	    my $escaped = &Apache::loncommon::escape_url($value);
+	    &Apache::loncommon::inhibit_menu_check(\$escaped);
 	    $return.="\n<option value='$escaped'>".
 		&unescape((split(/\&/,$recent{$value}))[1]).
 		'</option>';
@@ -1003,13 +1004,9 @@
 	    } else {
 		$path.='/'; 
 	    }	    
-            my $linkpath = &Apache::loncommon::escape_single($path);
-            if ($form) {
-		$linkpath=
-                    qq{javascript:$form.action='$linkpath';$form.submit();};
-            }
             my $href_path = &HTML::Entities::encode($path,'<>&"');
-	    $output.=qq{<a href="$path" $target>$dir</a>/};
+	    &Apache::loncommon::inhibit_menu_check(\$href_path);
+	    $output.=qq{<a href="$href_path" $target>$dir</a>/};
 	}
     } else {
 	foreach my $dir (split('/',$uri)) {

--albertel1184185937--