[LON-CAPA-cvs] cvs: loncom(version_2_10_X) /interface lonmenu.pm

raeburn raeburn@source.lon-capa.org
Thu, 26 Aug 2010 04:11:34 -0000


raeburn		Thu Aug 26 04:11:34 2010 EDT

  Modified files:              (Branch: version_2_10_X)
    /loncom/interface	lonmenu.pm 
  Log:
  - Backport 1.336.
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.315.2.2 loncom/interface/lonmenu.pm:1.315.2.3
--- loncom/interface/lonmenu.pm:1.315.2.2	Sat Aug 14 21:38:08 2010
+++ loncom/interface/lonmenu.pm	Thu Aug 26 04:11:34 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.315.2.2 2010/08/14 21:38:08 raeburn Exp $
+# $Id: lonmenu.pm,v 1.315.2.3 2010/08/26 04:11:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -622,15 +622,19 @@
                 if ($nocrsedit) {
                     $editbutton=&clear(6,1);
                 } else {
+                    my $bot = "go('$cfile')";
                     if ($switchserver) {
                         if ( $env{'request.symb'} && $env{'request.course.id'} ) {
                             my ($mapurl,$rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
-                            $cfile = '/adm/switchserver?otherserver='.$home.'&role='.$env{'request.role'}.'&symb='.$env{'request.symb'}.'&origurl='.$resurl;
+                            $cfile = '/adm/switchserver?otherserver='.$home.'&role='.
+                                     &HTML::Entities::encode($env{'request.role'},'"<>&').'&amp;symb='.
+                                     &HTML::Entities::encode($env{'request.symb'},'"<>&');
+                            $bot = "need_switchserver('$cfile');";
                         }
                     }
                     $editbutton=&switch
                        ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]',
-                     "go('".$cfile."');","Edit this resource");
+                       $bot,"Edit this resource");
                     $noeditbutton = 0;
                 }
             } elsif ($editbutton eq '') {
@@ -1617,6 +1621,9 @@
     my $end_page_bookmark = 
         &Apache::loncommon::end_page({'js_ready' => 1});
 
+    my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'.
+                         &mt('Switch server?');
+
 return (<<ENDUTILITY)
 
     var currentURL="$currenturl";
@@ -1640,6 +1647,15 @@
     }
 }
 
+function need_switchserver(url) {
+    if (url!='' && url!= null) {
+        if (confirm("$confirm_switch")) {
+            go(url);
+        }
+    }
+    return;
+}
+
 function gopost(url,postdata) {
    if (url!='') {
       this.document.server.action=url;