Diff for /loncom/interface/loncommon.pm between versions 1.429 and 1.430

version 1.429, 2006/07/17 19:47:20 version 1.430, 2006/07/18 21:55:24
Line 706  sub helpLatexCheatsheet { Line 706  sub helpLatexCheatsheet {
  .'</td></tr></table>';   .'</td></tr></table>';
 }  }
   
   sub general_help {
       my $helptopic='Student_Intro';
       if ($env{'request.role'}=~/^(ca|au)/) {
    $helptopic='Authoring_Intro';
       } elsif ($env{'request.role'}=~/^cc/) {
    $helptopic='Course_Coordination_Intro';
       }
       return $helptopic;
   }
   
   sub update_help_link {
       my ($topic,$component_help,$faq,$bug,$stayOnPage) = @_;
       my $origurl = $ENV{'REQUEST_URI'};
       $origurl=~s|^/~|/priv/|;
       my $timestamp = time;
       foreach my $datum (\$topic,\$component_help,\$faq,\$bug,\$origurl) {
           $$datum = &escape($$datum);
       }
   
       my $banner_link = "/adm/helpmenu?page=banner&amp;topic=$topic&amp;component_help=$component_help&amp;faq=$faq&amp;bug=$bug&amp;origurl=$origurl&amp;stamp=$timestamp&amp;stayonpage=$stayOnPage";
       my $output .= <<"ENDOUTPUT";
   <script type="text/javascript">
   // <!-- BEGIN LON-CAPA Internal
   banner_link = '$banner_link';
   // END LON-CAPA Internal -->
   </script>
   ENDOUTPUT
       return $output;
   }
   
   # now just updates the help link and generates a blue icon
 sub help_open_menu {  sub help_open_menu {
     my ($topic,$component_help,$faq,$bug,$stayOnPage,$width,$height,$text) = @_;      my ($topic,$component_help,$faq,$bug,$stayOnPage,$width,$height,$text) 
    = @_;
       
       $stayOnPage = 0 if (not defined $stayOnPage);
       if ($env{'browser.interface'} eq 'textual' ||
    $env{'environment.remote'} eq 'off' ) {
    $stayOnPage=1;
       }
       my $output;
       if ($component_help) {
    if (!$text) {
       $output=&help_open_topic($component_help,undef,$stayOnPage,
          $width,$height);
    } else {
       my $help_text;
       $help_text=&unescape($topic);
       $output='<table><tr><td>'.
    &help_open_topic($component_help,$help_text,$stayOnPage,
    $width,$height).'</td></tr></table>';
    }
       }
       my $banner_link = &update_help_link($topic,$component_help,$faq,$bug,$stayOnPage);
       return $output.$banner_link;
   }
   
   sub top_nav_help {
       my ($text) = @_;
   
       my ($topic,$component_help,$faq,$bug,$stayOnPage,$width,$height);
      
     $text = "" if (not defined $text);      $text = "" if (not defined $text);
     $stayOnPage = 0 if (not defined $stayOnPage);      $stayOnPage = 0 if (not defined $stayOnPage);
     if ($env{'browser.interface'} eq 'textual' ||      if ($env{'browser.interface'} eq 'textual' ||
Line 718  sub help_open_menu { Line 778  sub help_open_menu {
     $height = 600 if (not defined $height);      $height = 600 if (not defined $height);
     my $link='';      my $link='';
     my $title = &mt('Get help');      my $title = &mt('Get help');
     my $origurl = $ENV{'REQUEST_URI'};      if ($stayOnPage) {
     $origurl=~s|^/~|/priv/|;   $link = "javascript:helpMenu('display')";
     my $timestamp = time;  
     foreach my $datum (\$topic,\$component_help,\$faq,\$bug,\$origurl) {  
         $$datum = &escape($$datum);  
     }  
     if (!$stayOnPage) {  
          $link = "javascript:helpMenu('open')";  
     } else {      } else {
         $link = "javascript:helpMenu('display')";          $link = "javascript:helpMenu('open')";
     }      }
     my $banner_link = "/adm/helpmenu?page=banner&amp;topic=$topic&amp;component_help=$component_help&amp;faq=$faq&amp;bug=$bug&amp;origurl=$origurl&amp;stamp=$timestamp&amp;stayonpage=$stayOnPage";      my $helptopic=&general_help();
     my $details_link = "/adm/helpmenu?page=body&amp;topic=$topic&amp;component_help=$component_help&amp;faq=$faq&amp;bug=$bug&amp;origurl=$origurl&amp;stamp=$timestamp";      my $banner_link = &update_help_link($topic,$component_help,$faq,$bug,$stayOnPage);
       my $details_link = '/adm/help/'.$helptopic.'.hlp';
     my $template;      my $template;
     if ($text ne "") {  
  $template .=   
   "<table bgcolor='#CC3300' cellspacing='1' cellpadding='1' border='0'><tr>".  
   "<td bgcolor='#CC6600'><a href=\"$link\"><font color='#FFFFFF' size='2'>$text</font></a>";  
     }  
     my $nothing=&Apache::lonhtmlcommon::javascript_nothing();      my $nothing=&Apache::lonhtmlcommon::javascript_nothing();
     my $helpicon=&lonhttpdurl("/adm/lonIcons/helpgateway.gif");      my $helpicon=&lonhttpdurl("/adm/lonIcons/helpgateway.gif");
     my $start_page =      my $start_page =
Line 754  sub help_open_menu { Line 804  sub help_open_menu {
  <script type="text/javascript">   <script type="text/javascript">
 // <!-- BEGIN LON-CAPA Internal  // <!-- BEGIN LON-CAPA Internal
 // <![CDATA[  // <![CDATA[
   var banner_link = '';
 function helpMenu(target) {  function helpMenu(target) {
     var caller = this;      var caller = this;
     if (target == 'open') {      if (target == 'open') {
Line 773  function helpMenu(target) { Line 824  function helpMenu(target) {
     return;      return;
 }  }
 function writeHelp(caller) {  function writeHelp(caller) {
     caller.document.writeln('$start_page<frame name="bannerframe"  src="$banner_link" /><frame name="bodyframe" src="$details_link" /> $end_page')      caller.document.writeln('$start_page<frame name="bannerframe"  src="'+banner_link+'" /><frame name="bodyframe" src="$details_link" /> $end_page')
     caller.document.close()      caller.document.close()
     caller.focus()      caller.focus()
 }  }
 // ]]>  // ]]>
 // END LON-CAPA Internal -->  // END LON-CAPA Internal -->
  </script>   </script>
  <a href="$link" title="$title"><img src="$helpicon" border="0" alt="(Help Menu)" /></a>  $banner_link
    <a href="$link" title="$title">$text<img src="$helpicon" border="0" alt="(Help Menu)" /></a>
 ENDTEMPLATE  ENDTEMPLATE
     if ($component_help) {  
  if (!$text) {  
     $template=&help_open_topic($component_help,undef,$stayOnPage,  
        $width,$height).' '.$template;  
  } else {  
     my $help_text;  
     $help_text=&unescape($topic);  
     $template='<table><tr><td>'.  
  &help_open_topic($component_help,$help_text,$stayOnPage,  
  $width,$height).'</td><td>'.$template.  
  '</td></tr></table>';  
  }  
     }  
     if ($text ne '') { $template.='</td></tr></table>' };  
     return $template;      return $template;
 }  }
   

Removed from v.1.429  
changed lines
  Added in v.1.430


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