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

raeburn raeburn at source.lon-capa.org
Thu Dec 13 01:33:32 EST 2012


raeburn		Thu Dec 13 06:33:32 2012 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonmenu.pm 
  Log:
  - For 2.11
    - Backport 1.388, 1.389, 1.390
  
  
-------------- next part --------------
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.369.2.25 loncom/interface/lonmenu.pm:1.369.2.26
--- loncom/interface/lonmenu.pm:1.369.2.25	Tue Oct  9 12:07:18 2012
+++ loncom/interface/lonmenu.pm	Thu Dec 13 06:33:31 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.369.2.25 2012/10/09 12:07:18 raeburn Exp $
+# $Id: lonmenu.pm,v 1.369.2.26 2012/12/13 06:33:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -509,7 +509,7 @@
 }
 
 sub innerregister {
-    my ($forcereg,$bread_crumbs) = @_;
+    my ($forcereg,$bread_crumbs,$group) = @_;
     my $const_space = ($env{'request.state'} eq 'construct');
     my $is_const_dir = 0;
 
@@ -530,7 +530,12 @@
         $newmail= 'swmenu.setstatus("you have","messages");';
     }
 
-    my $resurl; 
+    my $resurl;
+
+    if ($env{'request.course.id'} && $env{'request.symb'} eq '') {
+        $resurl = $env{'request.noversionuri'};
+    }
+
     if ( $env{'request.symb'} && $env{'request.course.id'} ) {
 
         (my $mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
@@ -562,203 +567,91 @@
 
         &Apache::lonhtmlcommon::clear_breadcrumbs();
         &Apache::lonhtmlcommon::add_breadcrumb(@crumbs);
-    }elsif (! $const_space){
+    } elsif (! $const_space){
         #a situation when we're looking at a resource outside of context of a 
         #course or construction space (e.g. with cumulative rights)
         &Apache::lonhtmlcommon::clear_breadcrumbs();
-        &Apache::lonhtmlcommon::add_breadcrumb({text => 'View Resource'});
+        unless ($env{'request.noversionuri'} =~ m{^/adm/$match_domain/$match_username/aboutme$}) {
+            &Apache::lonhtmlcommon::add_breadcrumb({text => 'View Resource'});
+        }
     }
     my $timesync   = ( $noremote ? '' : 'swmenu.syncclock(1000*'.time.');' );
 # =============================================================================
 # ============================ This is for URLs that actually can be registered
     if ( ($env{'request.noversionuri'}!~m{^/(res/)*adm/})
                        || ($forcereg)) {
-# -- This applies to homework problems for users with grading privileges
-	my $crs='/'.$env{'request.course.id'};
-	if ($env{'request.course.sec'}) {
-	    $crs.='_'.$env{'request.course.sec'};
-	}
-	$crs=~s/\_/\//g;
-
-        my %swtext;
-        if ($noremote) {
-            %swtext = &get_inline_text();
-        } else {
-            %swtext = &get_rc_text();
-        } 
-        my $hwkadd='';
-        if ($env{'request.symb'} ne '' &&
-	    $env{'request.filename'}=~/$LONCAPA::assess_re/) {
-	    if (&Apache::lonnet::allowed('mgr',$crs)) {
-		$hwkadd.=&switch('','',7,2,'pgrd.png',$swtext{'pgrd'},'grades[_4]',
-                       "gocmd('/adm/grades','gradingmenu')",
-                       'Content Grades');
-            } elsif (&Apache::lonnet::allowed('vgr',$crs)) {
-		$hwkadd.=&switch('','',7,2,'subm.png',$swtext{'subm'},'missions[_1]',
-                       "gocmd('/adm/grades','submission')",
-		       'Content Submissions');
-            }
-	}
-	if ($env{'request.symb'} ne '' &&
-	    &Apache::lonnet::allowed('opa',$crs)) {
-	    $hwkadd.=&switch('','',7,3,'pparm.png',$swtext{'pparm'},'parms[_2]',
-			     "gocmd('/adm/parmset','set')",
-			     'Content Settings');
-	}
-        if ($noremote) {  
-            if ($env{'request.symb'}=~/^uploaded/ &&
-                &Apache::lonnet::allowed('mdc',$crs)) {
-                $hwkadd.=&switch('','',7,4,'docs.png',$swtext{'docs'},'parms[_2]',
-                                 "gocmd('/adm/coursedocs','direct')",
-                                 'Folder/Page Content');
-            }
-        }
-# -- End Homework
-        ###
-        ### Determine whether or not to display the 'cstr' button for this
-        ### resource
-        ###
-        my $editbutton = '';
-        my $noeditbutton = 1;
-        my ($cnum,$cdom);
-        if ($env{'request.course.id'}) {
-            $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
-            $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
-        }
-        if ($env{'user.author'}) {
-            if ($env{'request.role'}=~/^(aa|ca|au)/) {
-#
-# We have the role of an author
-#
-                # Set defaults for authors
-                my ($top,$bottom) = ('con-','struct');
-                my $action = "go('/priv/".$env{'user.domain'}.'/'.$env{'user.name'}."');";
-                my $cadom  = $env{'request.role.domain'};
-                my $caname = $env{'user.name'};
-                my $desc = "Enter my construction space";
-                # Set defaults for co-authors
-                if ($env{'request.role'} =~ /^ca/) { 
-                    ($cadom,$caname)=($env{'request.role'}=~/($match_domain)\/($match_username)$/);
-                    ($top,$bottom) = ('co con-','struct');
-                    $action = "go('/priv/".$cadom.'/'.$caname."');";
-                    $desc = "Enter construction space as co-author";
-                } elsif ($env{'request.role'} =~ /^aa/) {
-                    ($cadom,$caname)=($env{'request.role'}=~/($match_domain)\/($match_username)$/);
-                    ($top,$bottom) = ('co con-','struct');
-                    $action = "go('/priv/".$cadom.'/'.$caname."');";
-                    $desc = "Enter construction space as assistant co-author";
-                }
-                # Check that we are on the correct machine
-                my $home = &Apache::lonnet::homeserver($caname,$cadom);
-		my $allowed=0;
-		my @ids=&Apache::lonnet::current_machine_ids();
-		foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
-		if (!$allowed) {
-		    $editbutton=&switch('','',6,1,,$top,$bottom,$action,$desc);
-                    $noeditbutton = 0;
-                }
-            }
-#
-# We are an author for some stuff, but currently do not have the role of author.
-# Figure out if we have authoring privileges for the resource we are looking at.
-# This should maybe become a privilege check in lonnet
-#
-            ##
-            ## Determine if user can edit url.
-            ##
-            my $cfile='';
-            my $cfuname='';
-            my $cfudom='';
-            my $uploaded;
-            my $switchserver='';
-            my $home;
-            if ($env{'request.filename'}) {
-                my $file=&Apache::lonnet::declutter($env{'request.filename'});
-                if (defined($cnum) && defined($cdom)) {
-                    $uploaded = &is_course_upload($file,$cnum,$cdom);
-                }
-                if (!$uploaded) {
-
-                    $file=~s{^(priv/$match_domain/$match_username)}{/$1};
-                    $file=~s{^($match_domain/$match_username)}{/priv/$1};
-
-                    # Check that the user has permission to edit this resource
-                    my $setpriv = 1;
-                    ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$setpriv);
-                    if (defined($cfudom)) {
-		        $home=&Apache::lonnet::homeserver($cfuname,$cfudom);
-		        my $allowed=0;
-		        my @ids=&Apache::lonnet::current_machine_ids();
-		        foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
-		        if ($allowed) {
-                            $cfile=$file;
-                        } else {
-                            $switchserver=$file;
-                        }
-                    }
-                }
-            }
-            # Finally, turn the button on or off
-            if (($cfile || $switchserver) && !$const_space) {
-                my $nocrsedit;
-                # Suppress display where CC has switched to student role.
-                if ($env{'request.course.id'}) {
-                    unless(&Apache::lonnet::allowed('mdc',
-                                                    $env{'request.course.id'})) {
-                        $nocrsedit = 1;
-                    }
-                }
-                if ($nocrsedit) {
-                    $editbutton=&clear(6,1);
-                } else {
-                    my $bot = "go('$cfile')";
-                    if ($switchserver) {
-                        if ( $env{'request.symb'} && $env{'request.course.id'} ) {
-                            $cfile = '/adm/switchserver?otherserver='.$home.'&role='.
-                                     &HTML::Entities::encode($env{'request.role'},'"<>&').'&symb='.
-                                     &HTML::Entities::encode($env{'request.symb'},'"<>&');
-                            $bot = "need_switchserver('$cfile');";
-                        }
-                    }
-                    $editbutton=&switch
-                       ('','',6,1,'pcstr.png',$swtext{'pcstr'},'resource[_2]',
-                        $bot,"Edit this resource");
-                    $noeditbutton = 0;
-                }
-            } elsif ($editbutton eq '') {
-                $editbutton=&clear(6,1);
-            }
+    my ($cdom,$cnum,%perms,$cfile,$switchserver,$home,$forceedit,
+        $forceview,$editbutton);
+    if ($env{'request.noversionuri'} =~ m{^/adm/($match_domain)/($match_username)/aboutme$}) {
+        ($cfile,$home,$switchserver,$forceedit,$forceview) =
+            &Apache::lonnet::can_edit_resource($env{'request.noversionuri'},$cnum,$cdom,
+                &Apache::lonnet::clutter($resurl),$env{'request.symb'},$group);
+        if (($cfile) && ($home ne '') && ($home ne 'no_host')) {
+            $editbutton = &get_editbutton($cfile,$home,$switchserver,
+                                          $forceedit,$forceview,$forcereg);
         }
-        if (($noeditbutton) && ($env{'request.filename'})) { 
-            if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
-                my $file=&Apache::lonnet::declutter($env{'request.filename'});
-                if (defined($cnum) && defined($cdom)) {
-                    if (&is_course_upload($file,$cnum,$cdom)) {
-                        my $cfile = &edit_course_upload($file,$cnum,$cdom);
-                        if ($cfile) {
-                            $editbutton=&switch
-                                        ('','',6,1,'pcstr.png',$swtext{'pcstr'},
-                                         'resource[_2]',"go('".$cfile."');",
-                                         'Edit this resource');
-                        }
-                    }
-                }
+    } elsif ($env{'request.role'} !~/^(aa|ca|au)/) {
+        $editbutton = &prepare_functions($resurl,$forcereg,$group);
+    }
+    if ($editbutton eq '') {
+        &clear(6,1);
+    }
+
+#
+# This applies in course context
+#
+    if ($env{'request.course.id'}) {
+        $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+        $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+        $perms{'mdc'} = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});
+        my @privs;
+        if ($env{'request.symb'} ne '') {
+             if ($env{'request.filename'}=~/$LONCAPA::assess_re/) {
+                 push(@privs,('mgr','vgr'));
+             }
+             push(@privs,'opa');
+        }
+        foreach my $priv (@privs) {
+            $perms{$priv} = &Apache::lonnet::allowed($priv,$env{'request.course.id'});
+            if (!$perms{$priv} && $env{'request.course.sec'} ne '') {
+                $perms{$priv} =
+                    &Apache::lonnet::allowed($priv,"$env{'request.course.id'}/$env{'request.course.sec'}");
             }
         }
-        if ($env{'request.course.id'}) {
-            if ($resurl eq "public/$cdom/$cnum/syllabus") {
-                if ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ /\w/) {
-                    if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
-                        $editbutton=&switch('','',6,1,'pcstr.png',$swtext{'pcstr'},
-                                            'resource[_2]',
-                                            "go('/adm/courseprefs?phase=display&actions=courseinfo')",
-                                            'Edit this resource');
-                    }
-                }
-            }
+#
+# Determine whether or not to show Grades and Submissions buttons
+#
+        if ($env{'request.symb'} ne '' &&
+            $env{'request.filename'}=~/$LONCAPA::assess_re/) {
+            if ($perms{'mgr'}) {
+                &switch('','',7,2,'pgrd.png','Content Grades','grades[_4]',
+                        "gocmd('/adm/grades','gradingmenu')",
+                        'Content Grades');
+            } elsif ($perms{'vgr'}) {
+                &switch('','',7,2,'subm.png','Content Submissions','missions[_1]',
+                        "gocmd('/adm/grades','submission')",
+                        'Content Submissions');
+             }
+        }
+        if (($env{'request.symb'} ne '') && ($perms{'opa'})) {
+            &switch('','',7,3,'pparm.png','Content Settings','parms[_2]',
+                    "gocmd('/adm/parmset','set')",
+                    'Content Settings');
+        }
+# End grades/submissions check
+
+#
+# This applies to items inside a folder/page modifiable in the course.
+#
+        if (($env{'request.symb'}=~/^uploaded/) && ($perms{'mdc'})) {
+            &switch('','',7,4,'docs-22x22.png','Folder/Page Content','parms[_2]',
+                    "gocmd('/adm/coursedocs','direct')",
+                    'Folder/Page Content');
         }
-        ###
-        ###
+# End modifiable folder/page container check
+    }
+# End course context
+
 # Prepare the rest of the buttons
         my ($menuitems,$got_prt,$got_wishlist,$cstritems);
         if ($const_space) {
@@ -928,10 +821,7 @@
                         &Apache::lonhtmlcommon::add_breadcrumb_tool(
                             'tools', $inlineremote[63]);
                     }
-                    unless ($env{'request.noversionuri'}=~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) {
-                        &Apache::lonhtmlcommon::add_breadcrumb_tool(
-                            'advtools', @inlineremote[61,71,72,73,74,92]);
-                    }
+                    &advtools_crumbs(@inlineremote);
                 }
             }
             return   &Apache::lonhtmlcommon::scripttag('', 'start')
@@ -1081,42 +971,6 @@
     return %text;
 }
 
-sub is_course_upload {
-    my ($file,$cnum,$cdom) = @_;
-    my $uploadpath = &LONCAPA::propath($cdom,$cnum);
-    $uploadpath =~ s{^\/}{};
-    if (($file =~ m{^\Q$uploadpath\E/userfiles/docs/}) ||
-        ($file =~ m{^userfiles/\Q$cdom\E/\Q$cnum\E/docs/})) {
-        return 1;
-    }
-    return;
-}
-
-sub edit_course_upload {
-    my ($file,$cnum,$cdom) = @_;
-    my $cfile;
-    if ($file =~/\.(htm|html|css|js|txt)$/) {
-        my $ext = $1;
-        my $url = &Apache::lonnet::hreflocation('',$file);
-        my $home = &Apache::lonnet::homeserver($cnum,$cdom);
-        my @ids=&Apache::lonnet::current_machine_ids();
-        my $dest;
-        if ($home && grep(/^\Q$home\E$/, at ids)) {
-            $dest = $url.'?forceedit=1';
-        } else {
-            unless (&Apache::lonnet::get_locks()) {
-                $dest = '/adm/switchserver?otherserver='.
-                        $home.'&role='.$env{'request.role'}.
-                        '&url='.$url.'&forceedit=1';
-            }
-        }
-        if ($dest) {
-            $cfile = &HTML::Entities::encode($dest,'"<>&');
-        }
-    }
-    return $cfile;
-}
-
 sub loadevents() {
     if ($env{'request.state'} eq 'construct' ||
         $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
@@ -1286,6 +1140,181 @@
     return '<script type="text/javascript">'.$returnval.'</script>';
 }
 
+sub get_editbutton {
+    my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg) = @_;
+    my $jscall =
+        &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,
+                                                $forceedit,$forcereg,$env{'request.symb'});
+    if ($jscall) {
+        my $icon = 'pcstr.png';
+        my $label = 'Edit';
+        if ($forceview) {
+            $icon = 'tolastloc.png';
+            $label = 'Exit Editing';
+        }
+        &switch('','',6,1,$icon,$label,'resource[_2]',
+                $jscall,"Edit this resource");
+        return 1;
+    }
+    return;
+}
+
+sub prepare_functions {
+    my ($resurl,$forcereg,$group,$bread_crumbs,$advtools) = @_;
+    unless ($env{'request.registered'}) {
+        undef(@inlineremote);
+    }
+    my ($cdom,$cnum,%perms,$cfile,$switchserver,$home,$forceedit,
+        $forceview);
+
+    if ($env{'request.course.id'}) {
+        $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+        $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+        $perms{'mdc'} = &Apache::lonnet::allowed('mdc',$env{'request.course.id'});
+    }
+
+    my $editbutton = '';
+#
+# Determine whether or not to display 'Edit' icon/button
+#
+    if ($resurl =~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) {
+#
+# This applies to a user's own about me page
+#
+        my ($sdom,$sname) = ($1,$2);
+        my $file=&Apache::lonnet::declutter($env{'request.filename'});
+        if (($sdom eq $env{'user.domain'}) && ($sname eq $env{'user.name'})) {
+            ($cfile,$home,$switchserver,$forceedit,$forceview) =
+                &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,
+                    &Apache::lonnet::clutter($resurl),$env{'request.symb'},$group);
+            $editbutton = &get_editbutton($cfile,$env{'user.home'},$switchserver,
+                                          $forceedit,$forceview,$forcereg);
+        }
+    } elsif ((!$editbutton) && (!$env{'request.course.id'}) &&
+             ($env{'user.author'}) && ($env{'request.filename'}) &&
+             ($env{'request.role'} !~/^(aa|ca|au)/)) {
+#
+# Currently do not have the role of author or co-author.
+# Do we have authoring privileges for the resource?
+#
+        my $file=&Apache::lonnet::declutter($env{'request.filename'});
+        ($cfile,$home,$switchserver,$forceedit,$forceview) =
+            &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,
+                &Apache::lonnet::clutter($resurl),$env{'request.symb'},$group);
+        # Turn the button on or off
+        if (($cfile) && ($home ne '') && ($home ne 'no_host')) {
+            $editbutton = &get_editbutton($cfile,$home,$switchserver,
+                                          $forceedit,$forceview,$forcereg);
+        }
+    } elsif ($env{'request.course.id'}) {
+#
+# This applies in course context
+#
+        if (($resurl eq "/public/$cdom/$cnum/syllabus") && ($perms{'mdc'})) {
+            if ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ /\w/) {
+                &switch('','',6,1,'pcstr.png','Edit',
+                        'resource[_2]',
+                        "go('/adm/courseprefs?phase=display&actions=courseinfo')",
+                        'Edit this resource');
+                $editbutton = 1;
+            } else {
+                $cfile = $resurl;
+                $home = &Apache::lonnet::homeserver($cnum,$cdom);
+                if ($env{'form.forceedit'}) {
+                    $forceview = 1;
+                } else {
+                    $forceedit = 1;
+                }
+                $editbutton = &get_editbutton($cfile,$home,$switchserver,
+                                              $forceedit,$forceview,$forcereg);
+            }
+        } elsif ($resurl !~ m{^adm/($match_domain)/($match_username)/aboutme$}) {
+            if ($env{'request.filename'}) {
+                my $file=&Apache::lonnet::declutter($env{'request.filename'});
+                ($cfile,$home,$switchserver,$forceedit,$forceview) =
+                    &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,
+                        &Apache::lonnet::clutter($resurl),$env{'request.symb'},$group);
+                if ($cfile ne '') {
+                    $editbutton = &get_editbutton($cfile,$home,$switchserver,
+                                                  $forceedit,$forceview,$forcereg);
+                }
+            }
+        }
+    }
+# End determination of 'Edit' icon/button display
+
+# This applies to about me page for users in a course
+    if ($env{'request.course.id'}) {
+        if ($resurl =~ m{^adm/($match_domain)/($match_username)/aboutme$}) {
+            my ($sdom,$sname) = ($1,$2);
+            unless (&Apache::lonnet::is_course($sdom,$sname)) {
+                &switch('','',6,4,'mail-message-new-22x22.png','Message to user',
+                        '',
+                        "go('/adm/email?compose=individual&recname=$sname&recdom=$sdom')",
+                            'Send message to specific user');
+            }
+            if (&Apache::lonnet::in_course($sdom,$sname,$cdom,$cnum)) {
+                foreach my $priv ('vsa','vgr','srm') {
+                    $perms{$priv} = &Apache::lonnet::allowed($priv,$env{'request.course.id'});
+                    if (!$perms{$priv} && $env{'request.course.sec'} ne '') {
+                        $perms{$priv} =
+                            &Apache::lonnet::allowed($priv,"$env{'request.course.id'}/$env{'request.course.sec'}");
+                    }
+                }
+                if ($perms{'vsa'}) {
+                    &switch('','',6,5,'trck-22x22.png','Activity',
+                            '',
+                            "go('/adm/trackstudent?selected_student=$sname:$sdom')",
+                            'View recent activity by this person');
+                }
+                if ($perms{'vgr'}) {
+                    &switch('','',6,6,'rsrv-22x22.png','Reservations',
+                            '',
+                            "go('/adm/slotrequest?command=showresv&origin=aboutme&uname=$sname&udom=$sdom')",
+                            'Slot reservation history');
+                }
+                if ($perms{'srm'}) {
+                    &switch('','',6,7,'contact-new-22x22.png','Records',
+                            '',
+                            "go('/adm/email?recordftf=retrieve&recname=$sname&recdom=$sdom')",
+                            'Add records');
+                }
+            }
+        }
+    }
+
+# End checking for items for about me page for users in a course
+
+    if ($env{'request.registered'}) {
+        return $editbutton;
+    } else {
+        if (ref($bread_crumbs) eq 'ARRAY') {
+            if (@inlineremote > 0) {
+                if (ref($advtools) eq 'ARRAY') {
+                    @{$advtools} = @inlineremote;
+                }
+            }
+            return;
+        } elsif (@inlineremote > 0) {
+            &Apache::lonhtmlcommon::clear_breadcrumb_tools();
+            &advtools_crumbs(@inlineremote);
+            return   &Apache::lonhtmlcommon::scripttag('', 'start')
+                   . &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0)
+                   . &Apache::lonhtmlcommon::scripttag('', 'end');
+        }
+    }
+}
+
+sub advtools_crumbs {
+    my @funcs = @_;
+    if ($env{'request.noversionuri'} =~ m{^/adm/$match_domain/$match_username/aboutme$}) {
+        &Apache::lonhtmlcommon::add_breadcrumb_tool(
+            'advtools', @funcs[61,64,65,66,67,74]);
+    } elsif ($env{'request.noversionuri'} !~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) {
+        &Apache::lonhtmlcommon::add_breadcrumb_tool(
+            'advtools', @funcs[61,71,72,73,74,92]);
+    }
+}
 
 # ================================================================== Raw Config
 
@@ -1750,8 +1779,7 @@
     my $end_page_annotate = 
         &Apache::loncommon::end_page({'js_ready' => 1});
 
-    my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'.
-                         &mt('Switch server?');
+    my $jumptores = &Apache::lonhtmlcommon::javascript_jumpto_resource();
 
     my $esc_url=&escape($currenturl);
     my $esc_symb=&escape($currentsymb);
@@ -1774,14 +1802,7 @@
    }
 }
 
-function need_switchserver(url) {
-    if (url!='' && url!= null) {
-        if (confirm("$confirm_switch")) {
-            go(url); 
-        }
-    }
-    return;
-}
+$jumptores
 
 function gopost(url,postdata) {
    if (url!='') {


More information about the LON-CAPA-cvs mailing list