Diff for /loncom/xml/lonxml.pm between versions 1.154 and 1.159

version 1.154, 2002/02/26 21:00:38 version 1.159, 2002/03/21 20:51:10
Line 64  qw(@pwd @outputstack $redirection $impor Line 64  qw(@pwd @outputstack $redirection $impor
 use strict;  use strict;
 use HTML::TokeParser;  use HTML::TokeParser;
 use HTML::TreeBuilder;  use HTML::TreeBuilder;
   use HTML::Entities;
 use Safe;  use Safe;
 use Safe::Hole;  use Safe::Hole;
 use Math::Cephes qw(:trigs :hypers :bessels erf erfc);  use Math::Cephes qw(:trigs :hypers :bessels erf erfc);
Line 316  sub fontsettings() { Line 317  sub fontsettings() {
   
 sub registerurl {  sub registerurl {
     my $forcereg=shift;      my $forcereg=shift;
       my $target = shift;
       my $result = '';
     if ($ENV{'request.publicaccess'}) {      if ($ENV{'request.publicaccess'}) {
  return    return 
          '<script>function LONCAPAreg(){} function LONCAPAstale(){}</script>';           '<script>function LONCAPAreg(){} function LONCAPAstale(){}</script>';
     }      }
     if ($Apache::lonxml::registered && !$forcereg) { return ''; }      if ($Apache::lonxml::registered && !$forcereg) { return ''; }
     $Apache::lonxml::registered=1;      $Apache::lonxml::registered=1;
       my $nothing='';
       if ($ENV{'browser.type'} eq 'explorer') { $nothing='javascript:void(0);'; }
     if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {      if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
         my $hwkadd='';          my $hwkadd='';
         if ($ENV{'REQUEST_URI'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {          if ($ENV{'REQUEST_URI'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
Line 347  ENDGRDS Line 352  ENDGRDS
 ENDPARM  ENDPARM
             }              }
  }   }
  return (<<ENDREGTHIS);   $result = (<<ENDREGTHIS);
             
 <script language="JavaScript">  <script language="JavaScript">
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
   
     function LONCAPAreg() {      function LONCAPAreg() {
   menu=window.open("","LONCAPAmenu");    menu=window.open("$nothing","LONCAPAmenu","",false);
           menu.clearTimeout(menu.menucltim);            menu.clearTimeout(menu.menucltim);
   menu.currentURL=window.location.pathname;    menu.currentURL=window.location.pathname;
           menu.currentStale=0;            menu.currentStale=0;
Line 380  ENDPARM Line 385  ENDPARM
     }      }
   
     function LONCAPAstale() {      function LONCAPAstale() {
   menu=window.open("","LONCAPAmenu");    menu=window.open("$nothing","LONCAPAmenu","",false);
           menu.currentStale=1;            menu.currentStale=1;
           menu.switchbutton            menu.switchbutton
              (3,1,'reload.gif','return','location','go(currentURL)');               (3,1,'reload.gif','return','location','go(currentURL)');
Line 399  ENDPARM Line 404  ENDPARM
 ENDREGTHIS  ENDREGTHIS
   
     } else {      } else {
         return (<<ENDDONOTREGTHIS);          $result = (<<ENDDONOTREGTHIS);
   
 <script language="JavaScript">  <script language="JavaScript">
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
   
     function LONCAPAreg() {      function LONCAPAreg() {
   menu=window.open("","LONCAPAmenu");    menu=window.open("$nothing","LONCAPAmenu","",false);
           menu.currentStale=1;            menu.currentStale=1;
           menu.clearbut(2,1);            menu.clearbut(2,1);
           menu.clearbut(2,3);            menu.clearbut(2,3);
Line 426  ENDREGTHIS Line 431  ENDREGTHIS
 // END LON-CAPA Internal  // END LON-CAPA Internal
 </script>  </script>
 ENDDONOTREGTHIS  ENDDONOTREGTHIS
   
     }      }
       if ($target eq 'edit') {
    # Javascript routines for construction space:
    # openbrowser and opensearcher will start the file browser
    # (lonindexer) and searcher (lonsearchcat) respectively.
    # Inputs are the name of the html form being used
    # and the name of the element the selected URL should
    # be placed in.
           $result .=<<"ENDBROWSERSCRIPT";
   <script>
       var editbrowser;
       function openbrowser(formname,elementname) {
           var url = '/res/?';
           if (editbrowser == null) {
               url += 'launch=1&';
           }
           url += 'catalogmode=interactive&';
           url += 'mode=edit&';
           url += 'form=' + formname + '&';
           url += 'element=' + elementname + '';
           var title = 'Browser';
           var options = 'scrollbars=1,resizable=1,menubar=0';
           options += ',width=700,height=600';
           editbrowser = open(url,title,options,'1');
           editbrowser.focus();
       }
       var editsearcher;
       function opensearcher(formname,elementname) {
           var url = '/adm/searchcat?';
           if (editsearcher == null) {
               url += 'launch=1&';
           }
           url += 'catalogmode=interactive&';
           url += 'mode=edit&';
           url += 'form=' + formname + '&';
           url += 'element=' + elementname + '';
           var title = 'Search';
           var options = 'scrollbars=1,resizable=1,menubar=0';
           options += ',width=700,height=600';
           editsearcher = open(url,title,options,'1');
           editsearcher.focus();
       }
   </script>
   ENDBROWSERSCRIPT
       }
       return $result;
 }  }
   
 sub loadevents() {  sub loadevents() {
Line 1041  SIMPLECONTENT Line 1090  SIMPLECONTENT
   
 sub inserteditinfo {  sub inserteditinfo {
       my ($result,$filecontents)=@_;        my ($result,$filecontents)=@_;
       $filecontents =~ s:</textarea>:&lt;/textarea&gt;:ig;        $filecontents = &HTML::Entities::encode($filecontents);
 #      my $editheader='<a href="#editsection">Edit below</a><hr />';  #      my $editheader='<a href="#editsection">Edit below</a><hr />';
       my $editfooter=(<<ENDFOOTER);        my $editfooter=(<<ENDFOOTER);
 <hr />  <hr />
Line 1204  sub get_param { Line 1253  sub get_param {
   if ( ! $context ) { $context = -1; }    if ( ! $context ) { $context = -1; }
   my $args ='';    my $args ='';
   if ( $#$parstack > (-2-$context) ) { $args=$$parstack[$context]; }    if ( $#$parstack > (-2-$context) ) { $args=$$parstack[$context]; }
     if ( ! $args ) { return undef; }
   if ( $args =~ /my \$$param=\"/ ) {    if ( $args =~ /my \$$param=\"/ ) {
     return &Apache::run::run("{$args;".'return $'.$param.'}',$safeeval); #'      return &Apache::run::run("{$args;".'return $'.$param.'}',$safeeval); #'
   } else {    } else {

Removed from v.1.154  
changed lines
  Added in v.1.159


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