--- loncom/interface/lonhtmlcommon.pm	2024/07/02 22:03:11	1.358.2.22
+++ loncom/interface/lonhtmlcommon.pm	2022/05/29 20:37:21	1.403
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.358.2.22 2024/07/02 22:03:11 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.403 2022/05/29 20:37:21 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -78,7 +78,12 @@ sub java_not_enabled {
 sub coursepreflink {
    my ($text,$category)=@_;
    if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {
-      return '<a target="_top" href="'.&HTML::Entities::encode("/adm/courseprefs?phase=display&actions=$category",'<>&"').'"><span class="LC_setting">'.$text.'</span></a>';
+       my $target =' target="_top"';
+       if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
+           (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) {
+           $target ='';
+       }
+       return '<a'.$target.' href="'.&HTML::Entities::encode("/adm/courseprefs?phase=display&actions=$category",'<>&"').'"><span class="LC_setting">'.$text.'</span></a>';
    } else {
       return '';
    }
@@ -101,9 +106,14 @@ sub direct_parm_link {
     $filter=&entity_encode($filter);
     $part=&entity_encode($part);
     if (($symb) && (&Apache::lonnet::allowed('opa')) && ($target ne 'tex')) {
-       return "<a target='_top' href='/adm/parmset?symb=$symb&amp;filter=$filter&amp;part=$part'><span class='LC_setting'>$linktext</span></a>";
+        my $target=' target="_top"';
+        if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
+            (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) {
+            $target='';
+        }
+        return "<a".$target." href=\"/adm/parmset?symb=$symb&amp;filter=$filter&amp;part=$part\"><span class=\"LC_setting\">$linktext</span></a>";
     } else {
-       return $linktext;
+        return $linktext;
     }
 }
 ##############################################
@@ -451,10 +461,12 @@ sub radio {
 &date_setter returns html and javascript for a compact date-setting form.
 To retrieve values from it, use &get_date_from_form.
 
-Inputs
-
 =over 4
 
+=item Inputs
+
+=over
+
 =item $dname 
 
 The name to prepend to the form elements.  
@@ -515,10 +527,12 @@ If true, text boxes for seconds are omit
 
 =back
 
-Bugs
+=item Bugs
 
 The method used to restrict user input will fail in the year 2400.
 
+=back
+
 =cut
 
 ##############################################
@@ -685,11 +699,13 @@ ENDJS
                       $monthselector,$dayselector,$yearselector,
                       $hourselector).
                    $tzone;
+
     } elsif ($no_ss) {
         $result .= &mt('[_1] [_2] [_3] [_4] [_5]m',
                       $monthselector,$dayselector,$yearselector,
                       $hourselector,$minuteselector).
                    $tzone;
+
     } else {
         $result .= &mt('[_1] [_2] [_3] [_4] [_5]m [_6]s ',
                       $monthselector,$dayselector,$yearselector,
@@ -741,7 +757,9 @@ sub build_url {
 
 get_date_from_form retrieves the date specified in an &date_setter form.
 
-Inputs:
+=over
+
+=item Inputs:
 
 =over 4
 
@@ -755,6 +773,8 @@ The unix time to use as the default in c
 
 =back
 
+=back
+
 Returns: Unix time represented in the form.
 
 =cut
@@ -848,13 +868,14 @@ parameter setting wizard.
 ##############################################
 sub pjump_javascript_definition {
     my $Str = <<END;
-    function pjump(type,dis,value,marker,ret,call,hour,min,sec) {
+    function pjump(type,dis,value,marker,ret,call,hour,min,sec,extra) {
         openMyModal("/adm/rat/parameter.html?type="+escape(type)
                  +"&value="+escape(value)+"&marker="+escape(marker)
                  +"&return="+escape(ret)
                  +"&call="+escape(call)+"&name="+escape(dis)
                  +"&defhour="+escape(hour)+"&defmin="+escape(min)
-                 +"&defsec="+escape(sec)+"&modal=1",350,350,'no');
+                 +"&defsec="+escape(sec)+"&extra="+escape(extra)
+                 +"&modal=1",350,350,'no');
     }
 END
     return $Str;
@@ -926,7 +947,9 @@ sub javascript_docopen {
 Returns html for a selection box which allows the user to choose the
 enrollment status of students.  The selection box name is 'Status'.
 
-Inputs:
+=over
+
+=item Inputs:
 
 $status: the currently selected status.  If undefined the value of
 $env{'form.Status'} is taken.  If that is undefined, a value of 'Active'
@@ -940,6 +963,8 @@ $size: the size (number of lines) of the
 $onchange: javascript to use when the value is changed.  Enclosed in 
 double quotes, ""s, not single quotes.
 
+=back
+
 Returns: a perl string as described.
 
 =cut
@@ -987,7 +1012,7 @@ sub StatusOptions {
 
 =pod
 
-=item Progess Window Handling Routines
+=item Progress Window Handling Routines
 
 These routines handle the creation, update, increment, and closure of 
 progress windows.  The progress window reports to the user the number
@@ -1001,9 +1026,11 @@ of items completed and an estimate of th
 Writes javascript to the client to open a progress window and returns a
 data structure used for bookkeeping.
 
-Inputs
+=over
+
+=item Inputs
 
-=over 4
+=over
 
 =item $r Apache request
 
@@ -1013,6 +1040,8 @@ Inputs
 
 =back
 
+=back
+
 Returns a hash containing the progress state data structure.
 If $number_to_do is zero or null, an indeterminate progress bar will
 be used.
@@ -1022,7 +1051,9 @@ be used.
 Updates the text in the progress indicator.  Does not increment the count.
 See &Increment_PrgWin.
 
-Inputs:
+=over
+
+=item Inputs:
 
 =over 4
 
@@ -1034,25 +1065,38 @@ Inputs:
 
 =back
 
+=back
+
 Returns: none
 
 
-=item Increment_PrgWin()
+=item &Increment_PrgWin()
 
 Increment the count of items completed for the progress window by $step or 1 if no step is provided.
 
-Inputs:
+=over
+
+=item Inputs:
 
 =over 4
 
-=item $r Apache request
+=item $r 
 
-=item $prog_state Pointer to the data structure returned by Create_PrgWin
+Apache request
+
+=item $prog_state
 
-=item $extraInfo A description of the items being iterated over.  Typically
-'student'.
+Pointer to the data structure returned by Create_PrgWin
 
-=item $step (optional) counter step. Will be set to default 1 if ommited. step must be greater than 0 or empty.
+=item $extraInfo
+
+A description of the items being iterated over.  Typically 'student'.
+
+=item $step
+
+(optional) counter step. Will be set to default 1 if ommited. step must be greater than 0 or empty.
+
+=back
 
 =back
 
@@ -1063,7 +1107,9 @@ Returns: none
 
 Closes the progress window.
 
-Inputs:
+=over
+
+=item Inputs:
 
 =over 4 
 
@@ -1073,6 +1119,8 @@ Inputs:
 
 =back
 
+=back
+
 Returns: none
 
 =back
@@ -1268,9 +1316,9 @@ sub htmlareaheaders {
 ENDEDITOR
 	}
     $s.=(<<ENDJQUERY);
-<script type="text/javascript" src="/adm/jQuery/js/jquery-3.7.1.min.js"></script>
-<script type="text/javascript" src="/adm/jQuery/js/jquery-ui-1.13.3.custom.min.js"></script>
-<link rel="stylesheet" type="text/css" href="/adm/jQuery/css/smoothness/jquery-ui-1.13.3.custom.min.css" />
+<script type="text/javascript" src="/adm/jQuery/js/jquery-3.2.1.min.js"></script>
+<script type="text/javascript" src="/adm/jQuery/js/jquery-ui-1.12.1.custom.min.js"></script>
+<link rel="stylesheet" type="text/css" href="/adm/jQuery/css/smoothness/jquery-ui-1.12.1.custom.min.css" />
 <script type="text/javascript" src="/adm/jpicker/js/jpicker-1.1.6.min.js" >
 </script>
 <link rel="stylesheet" type="text/css" href="/adm/jpicker/css/jPicker-1.1.6.min.css" />
@@ -1307,6 +1355,68 @@ $(document).ready(function(){
 });';
 }
 
+sub countdown {
+
+    # Code to put a due date countdown in 'duedatecountdown' span.
+    # This is currently located in the breadcrumb headers.
+    # note that the dueDateLayout is internatinoalized below.
+    # Here document is used to support the substitution into the javascript below.
+    # ..which unforunately necessitates escaping the $'s in the javascript.
+    # There are several times of importance
+    #
+    # serverDueDate -  The absolute time at which the problem expires.
+    # serverTime    -  The server's time when the problem finished computing.
+    # clientTime    -  The client's time...as close to serverTime as possible.
+    #                  The clientTime will be slightly later due to
+    #                  1. The latency between problem computation and
+    #                     the first network action.
+    #                  2. The time required between the page load-start and the actual
+    #                     initial javascript execution that got clientTime.
+    # These are used as follows:
+    #   The difference between clientTime and serverTime are used to
+    #   correct for differences in clock settings between the browser's system and the
+    #   server's.
+    #
+    #   The difference between clientTime and the time at which the ready() method
+    #   starts executing is used to estimate latencies for page load and submission.
+    #   Since this is an estimate, it is doubled.  The latency estimate + one minute
+    #   is used to determine when the countdown timer turns red to warn the user
+    #   to think about submitting.
+
+
+    my $dueDateLayout = &mt('Due in: {dn} {dl} {hnn}{sep}{mnn}{sep}{snn} [_1]',
+                            "<span id='submitearly'></span>");
+    my $early = '- <b>'.&mt('Submit Early').'</b>';
+    my $pastdue = '- <b>'.&mt('Past Due').'</b>';
+    return <<"JAVASCRIPT";
+
+    var documentReadyTime;
+
+\$(document).ready(function() {
+   if (typeof(dueDate) != "undefined") {
+       documentReadyTime = (new Date()).getTime();
+      \$("#duedatecountdown").countdown({until: dueDate, compact: true,
+         layout: "$dueDateLayout",
+         onTick: function (periods) {
+            var latencyEstimate = (documentReadyTime - clientTime) * 2;
+            if(\$.countdown.periodsToSeconds(periods) < (300 + latencyEstimate)) {
+               \$("#submitearly").html("$early");
+               if (\$.countdown.periodsToSeconds(periods) < 1) {
+                    \$("#submitearly").html("$pastdue");
+               }
+            }
+            if(\$.countdown.periodsToSeconds(periods) < (60 + latencyEstimate)) {
+               \$(this).css("color", "red");   //Highlight last minute.
+            }
+         }
+      });
+   }
+});
+
+JAVASCRIPT
+
+}
+
 # ----------------------------------------- Script to activate only some fields
 
 sub htmlareaselectactive {
@@ -1530,62 +1640,11 @@ sub htmlareaselectactive {
 
 	});
 ';
-    $output .= &color_picker;
-
-    # Code to put a due date countdown in 'duedatecountdown' span.
-    # This is currently located in the breadcrumb headers.
-    # note that the dueDateLayout is internatinoalized below.
-    # Here document is used to support the substitution into the javascript below.
-    # ..which unforunately necessitates escaping the $'s in the javascript.
-    # There are several times of importance
-    #
-    # serverDueDate -  The absolute time at which the problem expires.
-    # serverTime    -  The server's time when the problem finished computing.
-    # clientTime    -  The client's time...as close to serverTime as possible.
-    #                  The clientTime will be slightly later due to
-    #                  1. The latency between problem computation and 
-    #                     the first network action.
-    #                  2. The time required between the page load-start and the actual
-    #                     initial javascript execution that got clientTime.
-    # These are used as follows:
-    #   The difference between clientTime and serverTime are used to 
-    #   correct for differences in clock settings between the browser's system and the
-    #   server's.
-    #
-    #   The difference between clientTime and the time at which the ready() method
-    #   starts executing is used to estimate latencies for page load and submission.
-    #   Since this is an estimate, it is doubled.  The latency estimate + one minute
-    #   is used to determine when the countdown timer turns red to warn the user
-    #   to think about submitting.
+    $output .= &color_picker();
 
-    my $dueDateLayout = &mt('Due in: {dn} {dl} {hnn}{sep}{mnn}{sep}{snn} [_1]',
-                            "<span id='submitearly'></span>");
-    my $early = '- <b>'.&mt('Submit Early').'</b>';
-    my $pastdue = '- <b>'.&mt('Past Due').'</b>';
-    $output .= <<JAVASCRIPT;
+    $output .= &countdown();
 
-    var documentReadyTime;
-
-\$(document).ready(function() {
-   if (typeof(dueDate) != "undefined") {
-       documentReadyTime = (new Date()).getTime();
-      \$("#duedatecountdown").countdown({until: dueDate, compact: true, 
-         layout: "$dueDateLayout",
-         onTick: function (periods) {
-	    var latencyEstimate = (documentReadyTime - clientTime) * 2;
-            if(\$.countdown.periodsToSeconds(periods) < (300 + latencyEstimate)) {
-               \$("#submitearly").html("$early");
-               if (\$.countdown.periodsToSeconds(periods) < 1) {
-                    \$("#submitearly").html("$pastdue");
-               }
-            }
-            if(\$.countdown.periodsToSeconds(periods) < (60 + latencyEstimate)) {
-               \$(this).css("color", "red");   //Highlight last minute.
-            }
-         }
-      });
-   }
-});
+    $output .= <<"JAVASCRIPT";
 
     /* This code describes the spellcheck options that will be used for
        items with class 'spellchecked'.  It is necessary for those objects'
@@ -1679,8 +1738,9 @@ sub show_return_link {
     if ($env{'request.noversionuri'}=~m{^/priv/} ||
         $env{'request.uri'}=~m{^/priv/}) { return 1; }
     return if ($env{'request.noversionuri'} eq '/adm/supplemental');
-
-    if (($env{'request.noversionuri'} =~ m{^/adm/viewclasslist($|\?)})
+    return if (($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Placement') &&
+               (!$env{'request.role.adv'}));
+    if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)})
         || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {
 
         return if ($env{'form.register'});
@@ -1693,7 +1753,7 @@ sub show_return_link {
             (($env{'request.noversionuri'}=~/^\/adm\//) &&
              ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
              ($env{'request.noversionuri'}!~
-              m{^/adm/.*/(smppg|bulletinboard)($|\?)})
+              m{^/adm/.*/(smppg|bulletinboard|ext\.tool)($|\?)})
            ));
 }
 
@@ -1753,54 +1813,6 @@ clientTime = (new Date()).getTime();
 END
 }
 
-##
-# Client-side javascript to convert any dashes in text pasted
-# into textbox(es) for numericalresponse item(s) to a standard
-# minus, i.e., - . Calls to dash_to_minus_js() in end_problem()
-# and in loncommon::endbodytag() for a .page (arg: dashjs => 1)
-#
-# Will apply to any input tag with class: LC_numresponse_text.
-# Currently set in start_textline for numericalresponse items.
-#
-
-sub dash_to_minus_js {
-    return <<'ENDJS';
-
-<script type="text/javascript">
-//<![CDATA[
-//<!-- BEGIN LON-CAPA Internal
-document.addEventListener("DOMContentLoaded", (event) => {
-    const numresp = document.querySelectorAll("input.LC_numresponse_text");
-    if (numresp.length > 0) {
-        Array.from(numresp).forEach((el) => {
-            el.addEventListener("paste", (e) => {
-                e.preventDefault();
-                e.stopPropagation();
-                let p = (e.clipboardData || window.clipboardData).getData("text");
-                p.toString();
-                var regex;
-                try
-                {
-                    regex = new RegExp ("\\p{Dash}", "gu");
-                }
-                catch (e) { regex = new RegExp ("[\\u058A\\u05BE\\u1400\\u1806\\u2010-\\u2015\\u2E3A\\u2E3B\\u2E5D\\u301C\\uFE58\\uFE63\\uFF0D]","g"); }
-                p = p.replace(regex,'-');
-                putInText(p);
-            });
-        });
-    }
-    const putInText = (newText, el = document.activeElement) => {
-        const [start, end] = [el.selectionStart, el.selectionEnd];
-        el.setRangeText(newText, start, end, 'end');
-    }
-});
-// END LON-CAPA Internal -->
-//]]>
-</script>
-
-ENDJS
-}
-
 ############################################################
 ############################################################
 
@@ -1815,19 +1827,61 @@ A link to help for the component will be
 
 All inputs can be undef without problems.
 
-Inputs: $component (the text on the right side of the breadcrumbs trail),
-        $component_help (the help item filename (without .tex extension).
-        $menulink (boolean, controls whether to include a link to /adm/menu)
-        $helplink (if 'nohelp' don't include the orange help link)
-        $css_class (optional name for the class to apply to the table for CSS)
-        $no_mt (optional flag, 1 if &mt() is _not_ to be applied to $component
-           when including the text on the right.
-        $CourseBreadcrumbs (optional flag, 1 if &breadcrumbs called from &docs_breadcrumbs,
-           because breadcrumbs are being)
-        $topic_help (optional help item to be displayed on right side of the breadcrumbs 
-           row, using loncommon::help_open_topic() to generate the link.
-        $topic_help_text (text to include in the link in the optional help item 
-           on the right side of the breadcrumbs row.
+=over
+
+=item Inputs:
+
+=over
+
+=item $component
+
+the text on the right side of the breadcrumbs trail
+
+=item $component_help
+
+the help item filename (without .tex extension).
+
+=item $menulink
+
+boolean, controls whether to include a link to /adm/menu
+
+=item $helplink
+
+if 'nohelp' don't include the orange help link
+
+=item $css_class
+
+optional name for the class to apply to the table for CSS
+
+=item $no_mt 
+
+optional flag, 1 if &mt() is _not_ to be applied to $component when including the text on the right
+
+=item $CourseBreadcrumbs
+
+optional flag, 1 if &breadcrumbs called from &docs_breadcrumbs, because breadcrumbs are being
+used to display hierarchy for current folder shown in the Course Editor. 
+
+=item $topic_help
+
+optional help item to be displayed on right side of the breadcrumbs row, using 
+loncommon::help_open_topic() to generate the link. 
+
+=item $topic_help_text
+
+text to include in the link in the optional help item ($topic_help) on the right
+side of the breadcrumbs row.
+
+=item $links_target
+
+optionally includes the target (_top, _parent or _self) for (i) initial
+$menulink item in the breadcrumbs (if present), (ii) return to last location
+(if present), and (iii) help item at the right side of breadcrumbs menu, 
+created by loncommon::help_open_topic() or loncommon::help_open_menu().
+
+=back
+
+=back
 
 Returns a string containing breadcrumbs for the current page.
 
@@ -1856,7 +1910,7 @@ returns: nothing
     
     sub breadcrumbs {
         my ($component,$component_help,$menulink,$helplink,$css_class,$no_mt, 
-            $CourseBreadcrumbs,$topic_help,$topic_help_text) = @_;
+            $CourseBreadcrumbs,$topic_help,$topic_help_text,$links_target) = @_;
         #
         $css_class ||= 'LC_breadcrumbs';
 
@@ -1872,6 +1926,16 @@ returns: nothing
         # The first one should be the course or a menu link
         if (!defined($menulink)) { $menulink=1; }
         if ($menulink) {
+            if ($env{'request.course.id'}) {
+                my ($menucoll,$deeplinkmenu,$menuref) = &Apache::loncommon::menucoll_in_effect();
+                if (($menucoll) && (ref($menuref) eq 'HASH')) {
+                    if ($menuref->{'main'} eq 'n') {
+                       undef($menulink);
+                    }
+                }
+            }
+        }
+        if ($menulink) {
             my $description = 'Menu';
             my $no_mt_descr = 0;
             if ((exists($env{'request.course.id'})) && 
@@ -1889,9 +1953,16 @@ returns: nothing
                     }
                 }
             }
+            my $target = '_top';
+            if ($links_target) {
+                $target = $links_target;
+            } elsif ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
+                (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) {
+                $target='';
+            }
             $menulink =  {  href   =>'/adm/menu',
                             title  =>'Go to main menu',
-                            target =>'_top',
+                            target =>$target,
                             text   =>$description,
                             no_mt  =>$no_mt_descr, };
             if($last) {
@@ -1909,8 +1980,8 @@ returns: nothing
                             title => &mt('Back to most recent content resource'),
                             class => 'LC_menubuttons_link',
                           };
-            if ($env{'request.noversionuri'} eq '/adm/searchcat') {
-                $hashref->{'target'} = '_top'; 
+            if ($links_target) {
+                $hashref->{'target'} = $links_target;
             }
             $links=&htmltag( 'a','<img src="/res/adm/pages/tolastloc.png" alt="'.$alttext.'" class="LC_icon" />',
                              $hashref);
@@ -1961,11 +2032,12 @@ returns: nothing
         if ($faq ne '' || $component_help ne '' || $bug ne '') {
             $icons .= &Apache::loncommon::help_open_menu($component,
                                                          $component_help,
-                                                         $faq,$bug);
+                                                         $faq,$bug,'','','','',
+                                                         $links_target);
         }
         if ($topic_help && $topic_help_text) {
            $icons .= ' '.&Apache::loncommon::help_open_topic($topic_help,&mt($topic_help_text),'',
-                                                             undef,600);
+                                                             undef,600,'',$links_target);
         }
         #
 
@@ -2034,7 +2106,9 @@ Adds $html to $category of the breadcrum
 $html is usually a link to a page that invokes a function on the currently 
 displayed data (e.g. print when viewing a problem)
 
-Currently there are 3 possible values for $category: 
+=over
+
+=item Currently there are 3 possible values for $category: 
 
 =over 
 
@@ -2048,7 +2122,9 @@ remaining items in right of breadcrumbs
 advanced tools shown in a separate box below breadcrumbs line 
 
 =back
- 
+
+=back
+
 returns: nothing
 
 =cut
@@ -2097,8 +2173,17 @@ returns: a hash containing the current b
 Creates html for breadcrumb tools (categories navigation and tools) and inserts 
 \$breadcrumbs at the correct position.
 
-input: \$breadcrumbs - a reference to the string containing prepared 
-breadcrumbs.
+=over
+
+=item input: 
+
+=over
+
+=item \$breadcrumbs - a reference to the string containing prepared breadcrumbs.
+
+=back
+
+=back
 
 returns: nothing
 
@@ -2124,8 +2209,17 @@ returns: nothing
 Creates html for advanced tools (category advtools) and inserts \$breadcrumbs 
 at the correct position.
 
-input: \$breadcrumbs - a reference to the string containing prepared 
-breadcrumbs (after render_tools call).
+=over
+
+=item input:
+
+=over
+
+=item \$breadcrumbs - a reference to the string containing prepared breadcrumbs (after render_tools call).
+
+=back
+
+=back
 
 returns: nothing
 
@@ -3350,7 +3444,7 @@ PARAMSONE
             itemh = itemid.offsetHeight;
         }
         var primaryheight = 0;
-        if (document.getElementById('LC_nav_bar') != null) {
+        if (document.getElementById('LC_nav_bar') != null) { 
             primaryheight = document.getElementById('LC_nav_bar').offsetHeight;
         }
         var secondaryheight = 0;
@@ -3433,10 +3527,7 @@ THIRD
 sub javascript_jumpto_resource {
     my $confirm_switch = &mt("Editing requires switching to the resource's home server.")."\n".
                          &mt('Switch server?');
-    my $confirm_new_tab = &mt("Editing requires using the resource's home server.")."\n".
-                          &mt('Open a new browser tab?');
     &js_escape(\$confirm_switch);
-    &js_escape(\$confirm_new_tab);
     return (<<ENDUTILITY)
 
 function go(url) {
@@ -3457,13 +3548,9 @@ function go(url) {
    }
 }
 
-function need_switchserver(url,target) {
+function need_switchserver(url) {
     if (url!='' && url!= null) {
-        if (target == '_blank') {
-            if (confirm("$confirm_new_tab")) {
-                window.open(url,target);
-            }
-        } else if (confirm("$confirm_switch")) {
+        if (confirm("$confirm_switch")) {
             go(url);
         }
     }
@@ -3475,31 +3562,15 @@ ENDUTILITY
 }
 
 sub jump_to_editres {
-    my ($cfile,$home,$switchserver,$forceedit,$forcereg,$symb,$shownsymb,
-        $folderpath,$title,$hostname,$idx,$suppurl,$todocs,$suppanchor) = @_;
-    my ($jscall,$anchor,$usehttp,$usehttps,$is_ext,$target);
+    my ($cfile,$home,$switchserver,$forceedit,$forcereg,$symb,$folderpath,
+        $title,$hostname,$idx,$suppurl,$todocs,$suppanchor) = @_;
+    my ($jscall,$anchor,$usehttp,$usehttps,$is_ext);
     if ($switchserver) {
         if ($home) {
-            my $resedit;
-            if ($cfile =~ m{^/priv/($match_domain)/($match_username)/}) {
-                my ($audom,$auname) = ($1,$2);
-                unless (&Apache::lonnet::is_course($audom,$auname)) {
-                    if (($symb ne '') && ($env{'request.course.id'}) &&
-                        (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) {
-                        unless (&Apache::lonnet::can_switchserver($env{'user.domain'},$home)) {
-                            $target = '_blank';
-                            $resedit = 1;
-                        }
-                    }
-                }
-            }
             $cfile = '/adm/switchserver?otherserver='.$home.'&amp;role='.
                      &HTML::Entities::encode($env{'request.role'},'"<>&');
-            if ($shownsymb) {
-                $cfile .= '&amp;symb='.&HTML::Entities::encode($shownsymb,'"<>&');
-                if ($resedit) {
-                    $cfile .= '&amp;edit=1';
-                }
+            if ($symb) {
+                $cfile .= '&amp;symb='.&HTML::Entities::encode($symb,'"<>&');
             } elsif ($folderpath) {
                 $cfile .= '&amp;folderpath='.&HTML::Entities::encode($folderpath,'"<>&');
             }
@@ -3509,7 +3580,7 @@ sub jump_to_editres {
             if ($forcereg) {
                 $cfile .= '&amp;register=1';
             }
-            $jscall = "need_switchserver('".&Apache::loncommon::escape_single($cfile)."','$target');";
+            $jscall = "need_switchserver('".&Apache::loncommon::escape_single($cfile)."');";
         }
     } else {
         unless ($cfile =~ m{^/priv/}) {
@@ -3526,7 +3597,7 @@ sub jump_to_editres {
                     if ($env{'request.use_absolute'} =~ m{^https://}) {
                         $usehttps = 1;
                     }
-                }
+                } 
             } elsif ($cfile =~ m{^/?public/($match_domain)/($match_courseid)/syllabus}) {
                 if ($ENV{'SERVER_PORT'} == 443) {
                     my ($cdom,$cnum) = ($1,$2);
@@ -3726,7 +3797,9 @@ sub scripttag {
 
 Constructs a XHTML list from \@array.
 
-input: 
+=over
+
+=item input: 
 
 =over
 
@@ -3740,7 +3813,9 @@ Attributes for <ul> and <li> passed in a
 See htmltag() for more details.
 
 =back
- 
+
+=back
+
 returns: XHTML list as String. 
 
 =cut   
@@ -3859,13 +3934,19 @@ should be included in this list.
 
 If the optional headline text is not provided, a default text will be used.
 
+=over
+
+=item Related routines:
 
-Related routines:
 =over 4
-add_item_funclist
-end_funclist
+
+=item add_item_funclist
+
+=item end_funclist
+
 =back
 
+=back
 
 Inputs: (optional) headline text
 
@@ -3892,10 +3973,18 @@ sub start_funclist {
 
 Adds an item to the list of available functions
 
-Related routines:
+=over
+
+=item Related routines:
+
 =over 4
-start_funclist
-end_funclist
+
+=item start_funclist
+
+=item end_funclist
+
+=back
+
 =back
 
 Inputs: content item with text and link to function
@@ -3918,10 +4007,13 @@ sub add_item_funclist {
 
 End list of available functions
 
-Related routines:
-=over 4
-start_funclist
-add_item_funclist
+=over
+
+=item Related routines:
+
+ start_funclist
+ add_item_funclist
+
 =back
 
 Inputs: ./.
@@ -3954,7 +4046,7 @@ A string that's used as visually highlig
 it's value evaluates to false.
 
 =back
- 
+
 returns: XHTML list as string. 
 
 =back
@@ -3967,7 +4059,7 @@ sub funclist_from_array {
     $args->{legend} ||= mt('Functions');
     return list_from_array( [$args->{legend}, @$items], 
                { listattr => {class => 'LC_funclist'} });
-}   
+}
 
 =pod
 
@@ -3989,8 +4081,8 @@ e.g. a file operation in Authoring Space
 A reference to the array containing text. Details: sub funclist_from_array
 
 =back
- 
-Returns: XHTML div as string.
+
+Returns: XHTML div as string. 
 
 =back