Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.358.2.19.2.6 and 1.404

version 1.358.2.19.2.6, 2023/01/23 05:47:50 version 1.404, 2022/06/11 05:07:55
Line 78  sub java_not_enabled { Line 78  sub java_not_enabled {
 sub coursepreflink {  sub coursepreflink {
    my ($text,$category)=@_;     my ($text,$category)=@_;
    if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {     if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {
       my $target =' target="_top"';         my $target =' target="_top"';
       if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self')) {         if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
           $target = '';             (($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>';         }
          return '<a'.$target.' href="'.&HTML::Entities::encode("/adm/courseprefs?phase=display&actions=$category",'<>&"').'"><span class="LC_setting">'.$text.'</span></a>';
    } else {     } else {
       return '';        return '';
    }     }
Line 106  sub direct_parm_link { Line 107  sub direct_parm_link {
     $part=&entity_encode($part);      $part=&entity_encode($part);
     if (($symb) && (&Apache::lonnet::allowed('opa')) && ($target ne 'tex')) {      if (($symb) && (&Apache::lonnet::allowed('opa')) && ($target ne 'tex')) {
         my $target=' target="_top"';          my $target=' target="_top"';
         if (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self')) {          if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
             $target = '';              (($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>";          return "<a".$target." href=\"/adm/parmset?symb=$symb&amp;filter=$filter&amp;part=$part\"><span class=\"LC_setting\">$linktext</span></a>";
     } else {      } else {
        return $linktext;          return $linktext;
     }      }
 }  }
 ##############################################  ##############################################
Line 459  sub radio { Line 461  sub radio {
 &date_setter returns html and javascript for a compact date-setting form.  &date_setter returns html and javascript for a compact date-setting form.
 To retrieve values from it, use &get_date_from_form.  To retrieve values from it, use &get_date_from_form.
   
 Inputs  
   
 =over 4  =over 4
   
   =item Inputs
   
   =over
   
 =item $dname   =item $dname 
   
 The name to prepend to the form elements.    The name to prepend to the form elements.  
Line 523  If true, text boxes for seconds are omit Line 527  If true, text boxes for seconds are omit
   
 =back  =back
   
 Bugs  =item Bugs
   
 The method used to restrict user input will fail in the year 2400.  The method used to restrict user input will fail in the year 2400.
   
   =back
   
 =cut  =cut
   
 ##############################################  ##############################################
Line 693  ENDJS Line 699  ENDJS
                       $monthselector,$dayselector,$yearselector,                        $monthselector,$dayselector,$yearselector,
                       $hourselector).                        $hourselector).
                    $tzone;                     $tzone;
   
     } elsif ($no_ss) {      } elsif ($no_ss) {
         $result .= &mt('[_1] [_2] [_3] [_4] [_5]m',          $result .= &mt('[_1] [_2] [_3] [_4] [_5]m',
                       $monthselector,$dayselector,$yearselector,                        $monthselector,$dayselector,$yearselector,
                       $hourselector,$minuteselector).                        $hourselector,$minuteselector).
                    $tzone;                     $tzone;
   
     } else {      } else {
         $result .= &mt('[_1] [_2] [_3] [_4] [_5]m [_6]s ',          $result .= &mt('[_1] [_2] [_3] [_4] [_5]m [_6]s ',
                       $monthselector,$dayselector,$yearselector,                        $monthselector,$dayselector,$yearselector,
Line 749  sub build_url { Line 757  sub build_url {
   
 get_date_from_form retrieves the date specified in an &date_setter form.  get_date_from_form retrieves the date specified in an &date_setter form.
   
 Inputs:  =over
   
   =item Inputs:
   
 =over 4  =over 4
   
Line 763  The unix time to use as the default in c Line 773  The unix time to use as the default in c
   
 =back  =back
   
   =back
   
 Returns: Unix time represented in the form.  Returns: Unix time represented in the form.
   
 =cut  =cut
Line 935  sub javascript_docopen { Line 947  sub javascript_docopen {
 Returns html for a selection box which allows the user to choose the  Returns html for a selection box which allows the user to choose the
 enrollment status of students.  The selection box name is 'Status'.  enrollment status of students.  The selection box name is 'Status'.
   
 Inputs:  =over
   
   =item Inputs:
   
 $status: the currently selected status.  If undefined the value of  $status: the currently selected status.  If undefined the value of
 $env{'form.Status'} is taken.  If that is undefined, a value of 'Active'  $env{'form.Status'} is taken.  If that is undefined, a value of 'Active'
Line 949  $size: the size (number of lines) of the Line 963  $size: the size (number of lines) of the
 $onchange: javascript to use when the value is changed.  Enclosed in   $onchange: javascript to use when the value is changed.  Enclosed in 
 double quotes, ""s, not single quotes.  double quotes, ""s, not single quotes.
   
   =back
   
 Returns: a perl string as described.  Returns: a perl string as described.
   
 =cut  =cut
Line 996  sub StatusOptions { Line 1012  sub StatusOptions {
   
 =pod  =pod
   
 =item Progess Window Handling Routines  =item Progress Window Handling Routines
   
 These routines handle the creation, update, increment, and closure of   These routines handle the creation, update, increment, and closure of 
 progress windows.  The progress window reports to the user the number  progress windows.  The progress window reports to the user the number
Line 1010  of items completed and an estimate of th Line 1026  of items completed and an estimate of th
 Writes javascript to the client to open a progress window and returns a  Writes javascript to the client to open a progress window and returns a
 data structure used for bookkeeping.  data structure used for bookkeeping.
   
 Inputs  =over
   
 =over 4  =item Inputs
   
   =over
   
 =item $r Apache request  =item $r Apache request
   
Line 1022  Inputs Line 1040  Inputs
   
 =back  =back
   
   =back
   
 Returns a hash containing the progress state data structure.  Returns a hash containing the progress state data structure.
 If $number_to_do is zero or null, an indeterminate progress bar will  If $number_to_do is zero or null, an indeterminate progress bar will
 be used.  be used.
Line 1031  be used. Line 1051  be used.
 Updates the text in the progress indicator.  Does not increment the count.  Updates the text in the progress indicator.  Does not increment the count.
 See &Increment_PrgWin.  See &Increment_PrgWin.
   
 Inputs:  =over
   
   =item Inputs:
   
 =over 4  =over 4
   
Line 1043  Inputs: Line 1065  Inputs:
   
 =back  =back
   
   =back
   
 Returns: none  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.  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  =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
   
   Pointer to the data structure returned by Create_PrgWin
   
   =item $extraInfo
   
 =item $extraInfo A description of the items being iterated over.  Typically  A description of the items being iterated over.  Typically 'student'.
 'student'.  
   
 =item $step (optional) counter step. Will be set to default 1 if ommited. step must be greater than 0 or empty.  =item $step
   
   (optional) counter step. Will be set to default 1 if ommited. step must be greater than 0 or empty.
   
   =back
   
 =back  =back
   
Line 1072  Returns: none Line 1107  Returns: none
   
 Closes the progress window.  Closes the progress window.
   
 Inputs:  =over
   
   =item Inputs:
   
 =over 4   =over 4 
   
Line 1082  Inputs: Line 1119  Inputs:
   
 =back  =back
   
   =back
   
 Returns: none  Returns: none
   
 =back  =back
Line 1316  $(document).ready(function(){ Line 1355  $(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  # ----------------------------------------- Script to activate only some fields
   
 sub htmlareaselectactive {  sub htmlareaselectactive {
Line 1539  sub htmlareaselectactive { Line 1640  sub htmlareaselectactive {
   
  });   });
 ';  ';
     $output .= &color_picker;      $output .= &color_picker();
   
     # Code to put a due date countdown in 'duedatecountdown' span.      $output .= &countdown();
     # 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]',      $output .= <<"JAVASCRIPT";
                             "<span id='submitearly'></span>");  
     my $early = '- <b>'.&mt('Submit Early').'</b>';  
     my $pastdue = '- <b>'.&mt('Past Due').'</b>';  
     $output .= <<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.  
             }  
          }  
       });  
    }  
 });  
   
     /* This code describes the spellcheck options that will be used for      /* This code describes the spellcheck options that will be used for
        items with class 'spellchecked'.  It is necessary for those objects'         items with class 'spellchecked'.  It is necessary for those objects'
Line 1688  sub show_return_link { Line 1738  sub show_return_link {
     if ($env{'request.noversionuri'}=~m{^/priv/} ||      if ($env{'request.noversionuri'}=~m{^/priv/} ||
         $env{'request.uri'}=~m{^/priv/}) { return 1; }          $env{'request.uri'}=~m{^/priv/}) { return 1; }
     return if ($env{'request.noversionuri'} eq '/adm/supplemental');      return if ($env{'request.noversionuri'} eq '/adm/supplemental');
       return if (($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Placement') &&
                  (!$env{'request.role.adv'}));
     if (($env{'request.noversionuri'} =~ m{^/adm/viewclasslist($|\?)})      if (($env{'request.noversionuri'} =~ m{^/adm/viewclasslist($|\?)})
         || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {          || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {
   
Line 1776  A link to help for the component will be Line 1827  A link to help for the component will be
   
 All inputs can be undef without problems.  All inputs can be undef without problems.
   
 Inputs: $component (the text on the right side of the breadcrumbs trail),  =over
         $component_help (the help item filename (without .tex extension).  
         $menulink (boolean, controls whether to include a link to /adm/menu)  =item Inputs:
         $helplink (if 'nohelp' don't include the orange help link)  
         $css_class (optional name for the class to apply to the table for CSS)  =over
         $no_mt (optional flag, 1 if &mt() is _not_ to be applied to $component  
            when including the text on the right.  =item $component
         $CourseBreadcrumbs (optional flag, 1 if &breadcrumbs called from &docs_breadcrumbs,  
            because breadcrumbs are being)  the text on the right side of the breadcrumbs trail
         $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 $component_help
         $topic_help_text (text to include in the link in the optional help item   
            on the right side of the breadcrumbs row.  the help item filename (without .tex extension).
         $links_target optionally includes the target (_top, _parent or _self)  
   =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.  Returns a string containing breadcrumbs for the current page.
   
Line 1864  returns: nothing Line 1956  returns: nothing
             my $target = '_top';              my $target = '_top';
             if ($links_target) {              if ($links_target) {
                 $target = $links_target;                  $target = $links_target;
             } elsif (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self')) {              } elsif ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
                 $target = '';                  (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) {
                   $target='';
             }              }
             $menulink =  {  href   =>'/adm/menu',              $menulink =  {  href   =>'/adm/menu',
                             title  =>'Go to main menu',                              title  =>'Go to main menu',
Line 2013  Adds $html to $category of the breadcrum Line 2106  Adds $html to $category of the breadcrum
 $html is usually a link to a page that invokes a function on the currently   $html is usually a link to a page that invokes a function on the currently 
 displayed data (e.g. print when viewing a problem)  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   =over 
   
Line 2027  remaining items in right of breadcrumbs Line 2122  remaining items in right of breadcrumbs
 advanced tools shown in a separate box below breadcrumbs line   advanced tools shown in a separate box below breadcrumbs line 
   
 =back  =back
    
   =back
   
 returns: nothing  returns: nothing
   
 =cut  =cut
Line 2076  returns: a hash containing the current b Line 2173  returns: a hash containing the current b
 Creates html for breadcrumb tools (categories navigation and tools) and inserts   Creates html for breadcrumb tools (categories navigation and tools) and inserts 
 \$breadcrumbs at the correct position.  \$breadcrumbs at the correct position.
   
 input: \$breadcrumbs - a reference to the string containing prepared   =over
 breadcrumbs.  
   =item input: 
   
   =over
   
   =item \$breadcrumbs - a reference to the string containing prepared breadcrumbs.
   
   =back
   
   =back
   
 returns: nothing  returns: nothing
   
Line 2103  returns: nothing Line 2209  returns: nothing
 Creates html for advanced tools (category advtools) and inserts \$breadcrumbs   Creates html for advanced tools (category advtools) and inserts \$breadcrumbs 
 at the correct position.  at the correct position.
   
 input: \$breadcrumbs - a reference to the string containing prepared   =over
 breadcrumbs (after render_tools call).  
   =item input:
   
   =over
   
   =item \$breadcrumbs - a reference to the string containing prepared breadcrumbs (after render_tools call).
   
   =back
   
   =back
   
 returns: nothing  returns: nothing
   
Line 2122  returns: nothing Line 2237  returns: nothing
 } # End of scope for @Crumbs  } # End of scope for @Crumbs
   
 sub docs_breadcrumbs {  sub docs_breadcrumbs {
     my ($allowed,$crstype,$contenteditor,$title,$precleared,$checklinkprot)=@_;      my ($allowed,$crstype,$contenteditor,$title,$precleared)=@_;
     my ($folderpath,@folders,$supplementalflag);      my ($folderpath,@folders,$supplementalflag);
     @folders = split('&',$env{'form.folderpath'});      @folders = split('&',$env{'form.folderpath'});
     if ($env{'form.folderpath'} =~ /^supplemental/) {      if ($env{'form.folderpath'} =~ /^supplemental/) {
Line 2148  sub docs_breadcrumbs { Line 2263  sub docs_breadcrumbs {
 # each of randompick number, hidden, encrypted, random order, is_page   # each of randompick number, hidden, encrypted, random order, is_page 
 # are appended with ":"s to the foldername  # are appended with ":"s to the foldername
         $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)\:?(\d*)$//;          $name=~s/\:(\d*)\:(\w*)\:(\w*):(\d*)\:?(\d*)$//;
         if ($contenteditor) {          unless ($supplementalflag) {
             if ($supplementalflag) {              if ($contenteditor) { 
                 if ($2) { $ishidden=1; }  
             } else {  
                 if ($1 ne '') {                  if ($1 ne '') {
                     $randompick=$1;                      $randompick=$1;
                 } else {                  } else {
Line 2195  sub docs_breadcrumbs { Line 2308  sub docs_breadcrumbs {
         if (!$allowed && !$contenteditor) {          if (!$allowed && !$contenteditor) {
             $menulink = 1;              $menulink = 1;
         }          }
         if ($checklinkprot) {  
             if ($env{'request.deeplink.login'}) {  
                 my $linkprotout = &Apache::lonmenu::linkprot_exit();  
                 if ($linkprotout) {  
                     &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$linkprotout);  
                 }  
             }  
         }  
         return (&breadcrumbs(undef,undef,$menulink,'nohelp',undef,undef,          return (&breadcrumbs(undef,undef,$menulink,'nohelp',undef,undef,
                              $contenteditor),                               $contenteditor),
                              $randompick,$ishidden,$isencrypted,$plain,                               $randompick,$ishidden,$isencrypted,$plain,
Line 3339  PARAMSONE Line 3444  PARAMSONE
             itemh = itemid.offsetHeight;              itemh = itemid.offsetHeight;
         }          }
         var primaryheight = 0;          var primaryheight = 0;
         if (document.getElementById('LC_nav_bar') != null) {          if (document.getElementById('LC_nav_bar') != null) { 
             primaryheight = document.getElementById('LC_nav_bar').offsetHeight;              primaryheight = document.getElementById('LC_nav_bar').offsetHeight;
         }          }
         var secondaryheight = 0;          var secondaryheight = 0;
Line 3422  THIRD Line 3527  THIRD
 sub javascript_jumpto_resource {  sub javascript_jumpto_resource {
     my $confirm_switch = &mt("Editing requires switching to the resource's home server.")."\n".      my $confirm_switch = &mt("Editing requires switching to the resource's home server.")."\n".
                          &mt('Switch server?');                           &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_switch);
     &js_escape(\$confirm_new_tab);  
     return (<<ENDUTILITY)      return (<<ENDUTILITY)
   
 function go(url) {  function go(url) {
Line 3446  function go(url) { Line 3548  function go(url) {
    }     }
 }  }
   
 function need_switchserver(url,target) {  function need_switchserver(url) {
     if (url!='' && url!= null) {      if (url!='' && url!= null) {
         if (target == '_blank') {          if (confirm("$confirm_switch")) {
             if (confirm("$confirm_new_tab")) {  
                 window.open(url,target);  
             }  
         } else if (confirm("$confirm_switch")) {  
             go(url);              go(url);
         }          }
     }      }
Line 3464  ENDUTILITY Line 3562  ENDUTILITY
 }  }
   
 sub jump_to_editres {  sub jump_to_editres {
     my ($cfile,$home,$switchserver,$forceedit,$forcereg,$symb,$shownsymb,      my ($cfile,$home,$switchserver,$forceedit,$forcereg,$symb,$folderpath,
         $folderpath,$title,$hostname,$idx,$suppurl,$todocs,$suppanchor) = @_;          $title,$hostname,$idx,$suppurl,$todocs,$suppanchor) = @_;
     my ($jscall,$anchor,$usehttp,$usehttps,$is_ext,$target);      my ($jscall,$anchor,$usehttp,$usehttps,$is_ext);
     if ($switchserver) {      if ($switchserver) {
         if ($home) {          if ($home) {
             my $resedit;  
             if ($cfile =~ m{^/priv/($match_domain)/($match_username)/}) {  
                 my ($audom,$auname) = ($1,$2);  
                 unless (&Apache::lonnet::is_course($audom,$auname)) {  
                     unless ((&Apache::lonnet::will_trust('othcoau',$env{'user.domain'},$audom)) &&  
                             (&Apache::lonnet::will_trust('coaurem',$audom,$env{'user.domain'}))) {  
                        return;  
                     }  
                     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='.              $cfile = '/adm/switchserver?otherserver='.$home.'&amp;role='.
                      &HTML::Entities::encode($env{'request.role'},'"<>&');                       &HTML::Entities::encode($env{'request.role'},'"<>&');
             if ($shownsymb) {              if ($symb) {
                 $cfile .= '&amp;symb='.&HTML::Entities::encode($shownsymb,'"<>&');                  $cfile .= '&amp;symb='.&HTML::Entities::encode($symb,'"<>&');
                 if ($resedit) {  
                     $cfile .= '&amp;edit=1';  
                 }  
             } elsif ($folderpath) {              } elsif ($folderpath) {
                 $cfile .= '&amp;folderpath='.&HTML::Entities::encode($folderpath,'"<>&');                  $cfile .= '&amp;folderpath='.&HTML::Entities::encode($folderpath,'"<>&');
             }              }
Line 3502  sub jump_to_editres { Line 3580  sub jump_to_editres {
             if ($forcereg) {              if ($forcereg) {
                 $cfile .= '&amp;register=1';                  $cfile .= '&amp;register=1';
             }              }
             $jscall = "need_switchserver('".&Apache::loncommon::escape_single($cfile)."','$target')";              $jscall = "need_switchserver('".&Apache::loncommon::escape_single($cfile)."');";
         }          }
     } else {      } else {
         unless ($cfile =~ m{^/priv/}) {          unless ($cfile =~ m{^/priv/}) {
Line 3519  sub jump_to_editres { Line 3597  sub jump_to_editres {
                     if ($env{'request.use_absolute'} =~ m{^https://}) {                      if ($env{'request.use_absolute'} =~ m{^https://}) {
                         $usehttps = 1;                          $usehttps = 1;
                     }                      }
                 }                  } 
             } elsif ($cfile =~ m{^/?public/($match_domain)/($match_courseid)/syllabus}) {              } elsif ($cfile =~ m{^/?public/($match_domain)/($match_courseid)/syllabus}) {
                 if ($ENV{'SERVER_PORT'} == 443) {                  if ($ENV{'SERVER_PORT'} == 443) {
                     my ($cdom,$cnum) = ($1,$2);                      my ($cdom,$cnum) = ($1,$2);
Line 3719  sub scripttag { Line 3797  sub scripttag {
   
 Constructs a XHTML list from \@array.  Constructs a XHTML list from \@array.
   
 input:   =over
   
   =item input: 
   
 =over  =over
   
Line 3733  Attributes for <ul> and <li> passed in a Line 3813  Attributes for <ul> and <li> passed in a
 See htmltag() for more details.  See htmltag() for more details.
   
 =back  =back
    
   =back
   
 returns: XHTML list as String.   returns: XHTML list as String. 
   
 =cut     =cut   
Line 3852  should be included in this list. Line 3934  should be included in this list.
   
 If the optional headline text is not provided, a default text will be used.  If the optional headline text is not provided, a default text will be used.
   
   =over
   
   =item Related routines:
   
 Related routines:  
 =over 4  =over 4
 add_item_funclist  
 end_funclist  =item add_item_funclist
   
   =item end_funclist
   
 =back  =back
   
   =back
   
 Inputs: (optional) headline text  Inputs: (optional) headline text
   
Line 3885  sub start_funclist { Line 3973  sub start_funclist {
   
 Adds an item to the list of available functions  Adds an item to the list of available functions
   
 Related routines:  =over
   
   =item Related routines:
   
 =over 4  =over 4
 start_funclist  
 end_funclist  =item start_funclist
   
   =item end_funclist
   
   =back
   
 =back  =back
   
 Inputs: content item with text and link to function  Inputs: content item with text and link to function
Line 3911  sub add_item_funclist { Line 4007  sub add_item_funclist {
   
 End list of available functions  End list of available functions
   
 Related routines:  =over
 =over 4  
 start_funclist  =item Related routines:
 add_item_funclist  
    start_funclist
    add_item_funclist
   
 =back  =back
   
 Inputs: ./.  Inputs: ./.
Line 3947  A string that's used as visually highlig Line 4046  A string that's used as visually highlig
 it's value evaluates to false.  it's value evaluates to false.
   
 =back  =back
    
 returns: XHTML list as string.   returns: XHTML list as string. 
   
 =back  =back
Line 3960  sub funclist_from_array { Line 4059  sub funclist_from_array {
     $args->{legend} ||= mt('Functions');      $args->{legend} ||= mt('Functions');
     return list_from_array( [$args->{legend}, @$items],       return list_from_array( [$args->{legend}, @$items], 
                { listattr => {class => 'LC_funclist'} });                 { listattr => {class => 'LC_funclist'} });
 }     }
   
 =pod  =pod
   
Line 3982  e.g. a file operation in Authoring Space Line 4081  e.g. a file operation in Authoring Space
 A reference to the array containing text. Details: sub funclist_from_array  A reference to the array containing text. Details: sub funclist_from_array
   
 =back  =back
    
 Returns: XHTML div as string.  Returns: XHTML div as string. 
   
 =back  =back
   

Removed from v.1.358.2.19.2.6  
changed lines
  Added in v.1.404


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>