Diff for /loncom/xml/lonxml.pm between versions 1.492 and 1.515

version 1.492, 2009/04/13 20:15:44 version 1.515, 2010/09/29 15:47:21
Line 109  use Apache::lonfeedback(); Line 109  use Apache::lonfeedback();
 use Apache::lonmsg();  use Apache::lonmsg();
 use Apache::loncacc();  use Apache::loncacc();
 use Apache::lonmaxima();  use Apache::lonmaxima();
   use Apache::lonr();
 use Apache::lonlocal;  use Apache::lonlocal;
   use Apache::lonhtmlcommon();
   
 #====================================   Main subroutine: xmlparse    #====================================   Main subroutine: xmlparse  
   
Line 220  sub xmlend { Line 222  sub xmlend {
     return $discussion;      return $discussion;
 }  }
   
 sub tokeninputfield {  
     my $defhost=$Apache::lonnet::perlvar{'lonHostID'};  
     $defhost=~tr/a-z/A-Z/;  
     return (<<ENDINPUTFIELD)  
 <script type="text/javascript">  
     function updatetoken() {  
  var comp=new Array;  
         var barcode=unescape(document.tokeninput.barcode.value);  
         comp=barcode.split('*');  
         if (typeof(comp[0])!="undefined") {  
     document.tokeninput.codeone.value=comp[0];  
  }  
         if (typeof(comp[1])!="undefined") {  
     document.tokeninput.codetwo.value=comp[1];  
  }  
         if (typeof(comp[2])!="undefined") {  
             comp[2]=comp[2].toUpperCase();  
     document.tokeninput.codethree.value=comp[2];  
  }  
         document.tokeninput.barcode.value='';  
     }    
 </script>  
 <form method="post" name="tokeninput">  
 <table border="2" bgcolor="#FFFFBB">  
 <tr><th>DocID Checkin</th></tr>  
 <tr><td>  
 <table>  
 <tr>  
 <td>Scan in Barcode</td>  
 <td><input type="text" size="22" name="barcode"   
 onChange="updatetoken()"/></td>  
 </tr>  
 <tr><td><i>or</i> Type in DocID</td>  
 <td>  
 <input type="text" size="5" name="codeone" />  
 <b><font size="+2">*</font></b>  
 <input type="text" size="5" name="codetwo" />  
 <b><font size="+2">*</font></b>  
 <input type="text" size="10" name="codethree" value="$defhost"   
 onChange="this.value=this.value.toUpperCase()" />  
 </td></tr>  
 </table>  
 </td></tr>  
 <tr><td><input type="submit" value="Check in DocID" /></td></tr>  
 </table>  
 </form>  
 ENDINPUTFIELD  
 }  
   
 sub maketoken {  
     my ($symb,$tuname,$tudom,$tcrsid)=@_;  
     unless ($symb) {  
  $symb=&Apache::lonnet::symbread();  
     }  
     unless ($tuname) {  
  $tuname=$env{'user.name'};  
         $tudom=$env{'user.domain'};  
         $tcrsid=$env{'request.course.id'};  
     }  
   
     return &Apache::lonnet::checkout($symb,$tuname,$tudom,$tcrsid);  
 }  
   
 sub printtokenheader {  
     my ($target,$token,$tsymb,$tcrsid,$tudom,$tuname)=@_;  
     unless ($token) { return ''; }  
   
     my ($symb,$courseid,$domain,$name) = &Apache::lonnet::whichuser();  
     unless ($tsymb) {  
  $tsymb=$symb;  
     }  
     unless ($tuname) {  
  $tuname=$name;  
         $tudom=$domain;  
         $tcrsid=$courseid;  
     }  
   
     my $plainname=&Apache::loncommon::plainname($tuname,$tudom);  
   
     if ($target eq 'web') {  
         my %idhash=&Apache::lonnet::idrget($tudom,($tuname));  
  return   
  '<img align="right" src="/cgi-bin/barcode.png?encode='.$token.'" />'.  
                &mt('Checked out for').' '.$plainname.  
                '<br />'.&mt('User').': '.$tuname.' at '.$tudom.  
        '<br />'.&mt('ID').': '.$idhash{$tuname}.  
        '<br />'.&mt('CourseID').': '.$tcrsid.  
        '<br />'.&mt('Course').': '.$env{'course.'.$tcrsid.'.description'}.  
                '<br />'.&mt('DocID').': '.$token.  
                '<br />'.&mt('Time').': '.&Apache::lonlocal::locallocaltime().'<hr />';  
     } else {  
         return $token;  
     }  
 }  
   
 sub printalltags {  sub printalltags {
   my $temp;    my $temp;
   foreach $temp (sort keys %Apache::lonxml::alltags) {    foreach $temp (sort keys %Apache::lonxml::alltags) {
Line 569  sub inner_xmlparse { Line 476  sub inner_xmlparse {
   }    }
   if (($ENV{'QUERY_STRING'}) && ($target eq 'web')) {    if (($ENV{'QUERY_STRING'}) && ($target eq 'web')) {
     $finaloutput=&afterburn($finaloutput);      $finaloutput=&afterburn($finaloutput);
     }
     if ($target eq 'modified') {
   # if modfied, handle startpart and endpart
        $finaloutput=~s/\<startpartmarker[^\>]*\>(.*)\<endpartmarker[^\>]*\>/<part>$1<\/part>/gs;
   }        }    
   return $finaloutput;    return $finaloutput;
 }  }
Line 731  sub setup_globals { Line 642  sub setup_globals {
   
 sub init_safespace {  sub init_safespace {
   my ($target,$safeeval,$safehole,$safeinit) = @_;    my ($target,$safeeval,$safehole,$safeinit) = @_;
   $safeeval->deny_only(':dangerous');  
   $safeeval->reval('use Math::Complex;');    $safeeval->reval('use Math::Complex;');
     $safeeval->reval('use LaTeX::Table;');
     $safeeval->deny_only(':dangerous');
   $safeeval->permit_only(":default");    $safeeval->permit_only(":default");
   $safeeval->permit("entereval");    $safeeval->permit("entereval");
   $safeeval->permit(":base_math");    $safeeval->permit(":base_math");
Line 755  sub init_safespace { Line 667  sub init_safespace {
   $safehole->wrap(\&Apache::lonmaxima::maxima_cas_formula_fix,$safeeval,    $safehole->wrap(\&Apache::lonmaxima::maxima_cas_formula_fix,$safeeval,
   '&maxima_cas_formula_fix');    '&maxima_cas_formula_fix');
   
     $safehole->wrap(\&Apache::lonr::r_eval,$safeeval,'&r_eval');
     $safehole->wrap(\&Apache::lonr::Rentry,$safeeval,'&Rentry');
     $safehole->wrap(\&Apache::lonr::Rarray,$safeeval,'&Rarray');
     $safehole->wrap(\&Apache::lonr::r_check,$safeeval,'&r_check');
     $safehole->wrap(\&Apache::lonr::r_cas_formula_fix,$safeeval,
                     '&r_cas_formula_fix');
    
   $safehole->wrap(\&Apache::caparesponse::capa_formula_fix,$safeeval,    $safehole->wrap(\&Apache::caparesponse::capa_formula_fix,$safeeval,
   '&capa_formula_fix');    '&capa_formula_fix');
   
Line 1035  sub get_id { Line 954  sub get_id {
     my ($parstack,$safeeval)=@_;      my ($parstack,$safeeval)=@_;
     my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);      my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);
     if ($env{'request.state'} eq 'construct' && $id =~ /([._]|[^\w\d\s[:punct:]])/) {      if ($env{'request.state'} eq 'construct' && $id =~ /([._]|[^\w\d\s[:punct:]])/) {
  &error(&mt("ID &quot;[_1]&quot; contains invalid characters, IDs are only allowed to contain letters, numbers, spaces and -",'<tt>'.$id.'</tt>'));   &error(&mt('ID [_1] contains invalid characters. IDs are only allowed to contain letters, numbers, spaces and -','"<tt>'.$id.'</tt>"'));
     }      }
     if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; }      if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; }
     return $id;      return $id;
Line 1504  SIMPLECONTENT Line 1423  SIMPLECONTENT
   return $filecontents;    return $filecontents;
 }  }
   
   sub createnewjs {
       my $filecontents=(<<SIMPLECONTENT);
   <script type="text/javascript" language="Javascript">
   
   </script>
   SIMPLECONTENT
       return $filecontents;
   }
   
 sub verify_html {  sub verify_html {
     my ($filecontents)=@_;      my ($filecontents)=@_;
     if ($filecontents!~/(?:\<|\&lt\;)(?:html|xml)[^\<]*(?:\>|\&gt\;)/is) {      if ($filecontents!~/(?:\<|\&lt\;)(?:html|xml)[^\<]*(?:\>|\&gt\;)/is) {
Line 1529  sub renderingoptions { Line 1457  sub renderingoptions {
                        = &Apache::loncommon::plainlanguagedescription($_);                         = &Apache::loncommon::plainlanguagedescription($_);
         }          }
     }      }
     return      my $output;
        '<span class="LC_nobreak">'.      unless ($env{'form.forceedit'}) {
        &mt('Language:').' '.         $output .=
        &Apache::loncommon::select_form($env{'form.languages'},'languages',             '<span class="LC_nobreak">'.
                                                      %langchoices).'             &mt('Language:').' '.
      </span>             &Apache::loncommon::select_form(
      <span class="LC_nobreak">'.                 $env{'form.languages'},
                  'languages',
                  {&Apache::lonlocal::texthash(%langchoices)}).
              '</span>';
       }
       $output .=
        ' <span class="LC_nobreak">'.
        &mt('Math Rendering:').' '.         &mt('Math Rendering:').' '.
        &Apache::loncommon::select_form($env{'form.texengine'},'texengine',         &Apache::loncommon::select_form(
                                                      ('' => '',             $env{'form.texengine'},
                                                       'tth' => 'tth (TeX to HTML)',             'texengine',
                                                       'jsMath' => 'jsMath',             {&Apache::lonlocal::texthash
                                                       'mimetex' => 'mimetex (Convert to Images)')).'                 (''        => '',
      </span>';                  'tth'     => 'tth (TeX to HTML)',
                   'jsMath'  => 'jsMath',
                   'mimetex' => 'mimetex (Convert to Images)')}).
        '</span>';
       return $output;
 }  }
   
 sub inserteditinfo {  sub inserteditinfo {
Line 1554  sub inserteditinfo { Line 1492  sub inserteditinfo {
       my $dragmath_button;        my $dragmath_button;
       my ($add_to_onload, $add_to_onresize);        my ($add_to_onload, $add_to_onresize);
       $initialize=&Apache::lonhtmlcommon::spellheader();        $initialize=&Apache::lonhtmlcommon::spellheader();
       if ($filetype eq 'html'         if (($filetype eq 'html') && (&Apache::lonhtmlcommon::htmlareabrowser())) {
   && (!&Apache::lonhtmlcommon::htmlareablocked() &&  
       &Apache::lonhtmlcommon::htmlareabrowser())) {  
   $textarea_id .= '___Frame';  
   my $lang = &Apache::lonhtmlcommon::htmlarea_lang();    my $lang = &Apache::lonhtmlcommon::htmlarea_lang();
   $initialize.=(<<FULLPAGE);            my %textarea_args = (
 <script type="text/javascript">                                  fullpage => 'true',
 lonca                                  dragmath => 'math',
     function initDocument() {                                );
         var oFCKeditor = new FCKeditor('filecont');            $initialize .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args); 
  oFCKeditor.Config['CustomConfigurationsPath'] = '/fckeditor/loncapaconfig.js'  ;        }
  oFCKeditor.Config['FullPage'] = true        $initialize .= (<<FULLPAGE);
  oFCKeditor.Config['AutoDetectLanguage'] = false;  
         oFCKeditor.Config['DefaultLanguage'] = "$lang";  
  oFCKeditor.ReplaceTextarea();  
     }  
     function check_if_dirty(editor) {  
  if (editor.IsDirty()) {  
     unClean();  
  }  
     }  
     function FCKeditor_OnComplete(editor) {  
  editor.Events.AttachEvent("OnSelectionChange",check_if_dirty);  
  resize_textarea('$textarea_id','LC_aftertextarea');  
     }  
 </script>  
 FULLPAGE  
       } else {  
   $initialize.=(<<FULLPAGE);  
 <script type="text/javascript">  <script type="text/javascript">
   // <![CDATA[
     function initDocument() {      function initDocument() {
  resize_textarea('$textarea_id','LC_aftertextarea');   resize_textarea('$textarea_id','LC_aftertextarea');
     }      }
   // ]]>
 </script>  </script>
 FULLPAGE  FULLPAGE
           if ($filetype eq 'html') {        if ($filetype eq 'html') {
               $initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup');            $dragmath_button = '<span id="math_filecont">'.&Apache::lonhtmlcommon::dragmath_button('filecont',1).'</span>';
               $dragmath_button = &Apache::lonhtmlcommon::dragmath_button('filecont',1);            $initialize .= "\n".&Apache::lonhtmlcommon::dragmath_js('EditMathPopup');
           }  
       }        }
   
       $add_to_onload = 'initDocument();';        $add_to_onload = 'initDocument();';
       $add_to_onresize = "resize_textarea('$textarea_id','LC_aftertextarea');";        $add_to_onresize = "resize_textarea('$textarea_id','LC_aftertextarea');";
   
Line 1603  FULLPAGE Line 1521  FULLPAGE
       }        }
   
       my $titledisplay=&display_title();        my $titledisplay=&display_title();
         my $textareaclass;
       my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit',        my %lt=&Apache::lonlocal::texthash('st' => 'Save and Edit',
  'vi' => 'Save and View',   'vi' => 'Save and View',
  'dv' => 'Discard Edits and View',   'dv' => 'Discard Edits and View',
  'un' => 'undo',   'un' => 'undo',
  'ed' => 'Edit');   'ed' => 'Edit');
       my $spelllink .=&Apache::lonhtmlcommon::spelllink('xmledit','filecont');        my $spelllink = &Apache::lonhtmlcommon::spelllink('xmledit','filecont');
       my $textarea_events = &Apache::edit::element_change_detection();        my $textarea_events = &Apache::edit::element_change_detection();
       my $form_events     = &Apache::edit::form_change_detection();        my $form_events     = &Apache::edit::form_change_detection();
       my $htmlerror;        my $htmlerror;
Line 1617  FULLPAGE Line 1536  FULLPAGE
           if ($htmlerror) {            if ($htmlerror) {
               $htmlerror='<span class="LC_error">'.$htmlerror.'</span>';                $htmlerror='<span class="LC_error">'.$htmlerror.'</span>';
           }            }
             if (&Apache::lonhtmlcommon::htmlareabrowser()) {
                 $textareaclass = 'class="LC_richDefaultOff"';
             }
       }        }
       my $editfooter=(<<ENDFOOTER);        my $editfooter=(<<ENDFOOTER);
 $initialize  $initialize
Line 1632  $initialize Line 1554  $initialize
     <div class="LC_edit_problem_discards">      <div class="LC_edit_problem_discards">
       <input type="submit" name="discardview" accesskey="d" value="$lt{'dv'}" />        <input type="submit" name="discardview" accesskey="d" value="$lt{'dv'}" />
       <input type="submit" name="Undo" accesskey="u" value="$lt{'un'}" />        <input type="submit" name="Undo" accesskey="u" value="$lt{'un'}" />
       $dragmath_button $spelllink $htmlerror        $htmlerror $dragmath_button
     </div>      </div>
     <div class="LC_edit_problem_saves">      <div class="LC_edit_problem_saves">
       <input type="submit" name="savethisfile" accesskey="s" value="$lt{'st'}" />        <input type="submit" name="savethisfile" accesskey="s" value="$lt{'st'}" />
       <input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" />        <input type="submit" name="viewmode" accesskey="v" value="$lt{'vi'}" />
     </div>      </div>
   </div>    </div>
   <textarea $textarea_events style="width:100%" cols="80" rows="44" name="filecont" id="filecont">$filecontents</textarea>    <textarea $textarea_events style="width:100%" cols="80" rows="44" name="filecont" id="filecont" $textareaclass>$filecontents</textarea><br />$spelllink
   <div id="LC_aftertextarea">    <div id="LC_aftertextarea">
     <br />      <br />
     $titledisplay      $titledisplay
Line 1679  sub get_target { Line 1601  sub get_target {
   
 sub handler {  sub handler {
     my $request=shift;      my $request=shift;
       
     my $target=&get_target();      my $target=&get_target();
       
     $Apache::lonxml::debug=$env{'user.debug'};      $Apache::lonxml::debug=$env{'user.debug'};
           
     &Apache::loncommon::content_type($request,'text/html');      &Apache::loncommon::content_type($request,'text/html');
Line 1690  sub handler { Line 1611  sub handler {
  $request->set_last_modified(&Apache::lonnet::metadata($request->uri,   $request->set_last_modified(&Apache::lonnet::metadata($request->uri,
       'lastrevisiondate'));        'lastrevisiondate'));
     }      }
       # Embedded Flash movies from Camtasia served from https will not display in IE
       #   if XML config file has expired from cache.    
       if ($ENV{'SERVER_PORT'} == 443) {
           if ($request->uri =~ /\.xml$/) {
               my ($httpbrowser,$clientbrowser) =
                   &Apache::loncommon::decode_user_agent($request);
               if ($clientbrowser =~ /^explorer$/i) {
                   delete $request->headers_out->{'Cache-control'};
                   delete $request->headers_out->{'Pragma'};
                   my $expiration = time + 60;
                   my $date=strftime("%a, %d %b %Y %H:%M:%S GMT",gmtime($expiration));
                   $request->headers_out->set("Expires" => $date);
               }
           }
       }
     $request->send_http_header;      $request->send_http_header;
           
     return OK if $request->header_only;      return OK if $request->header_only;
   
   
     my $file=&Apache::lonnet::filelocation("",$request->uri);      my $file=&Apache::lonnet::filelocation("",$request->uri);
     my $filetype;      my ($filetype,$breadcrumbtext);
     if ($file =~ /\.sty$/) {      if ($file =~ /\.(sty|css|js|txt|tex)$/) {
  $filetype='sty';   $filetype=$1;
     } else {      } else {
  $filetype='html';   $filetype='html';
     }      }
       if ($filetype eq 'sty') {
           $breadcrumbtext = 'Style File Editor';
       } elsif ($filetype eq 'js') {
           $breadcrumbtext = 'Javascript Editor';
       } elsif ($filetype eq 'css') {
           $breadcrumbtext = 'CSS Editor';
       } elsif ($filetype eq 'txt') {
           $breadcrumbtext = 'Text Editor';
       } elsif ($filetype eq 'tex') {
           $breadcrumbtext = 'TeX Editor';
       } else {
           $breadcrumbtext = 'HTML Editor';
       }
   
 #  #
 # Edit action? Save file.  # Edit action? Save file.
 #  #
Line 1720  sub handler { Line 1670  sub handler {
     if ($filecontents eq -1) {      if ($filecontents eq -1) {
  my $start_page=&Apache::loncommon::start_page('File Error');   my $start_page=&Apache::loncommon::start_page('File Error');
  my $end_page=&Apache::loncommon::end_page();   my $end_page=&Apache::loncommon::end_page();
  my $fnf=&mt('File not found');          my $errormsg='<p class="LC_error">'
                       .&mt('File not found: [_1]'
                           ,'<span class="LC_filename">'.$file.'</span>')
                       .'</p>';
  $result=(<<ENDNOTFOUND);   $result=(<<ENDNOTFOUND);
 $start_page  $start_page
 <b>$fnf: $file</b>  $errormsg
 $end_page  $end_page
 ENDNOTFOUND  ENDNOTFOUND
         $filecontents='';          $filecontents='';
  if ($env{'request.state'} ne 'published') {   if ($env{'request.state'} ne 'published') {
     if ($filetype eq 'sty') {      if ($filetype eq 'sty') {
  $filecontents=&createnewsty();   $filecontents=&createnewsty();
     } else {              } elsif ($filetype eq 'js') {
                   $filecontents=&createnewjs();
               } elsif ($filetype ne 'css' && $filetype ne 'txt' && $filetype ne 'tex') {
  $filecontents=&createnewhtml();   $filecontents=&createnewhtml();
     }      }
     $env{'form.editmode'}='Edit'; #force edit mode      $env{'form.editmode'}='Edit'; #force edit mode
Line 1746  ENDNOTFOUND Line 1701  ENDNOTFOUND
     ['editmode']);      ['editmode']);
  }   }
  if (!$env{'form.editmode'} || $env{'form.viewmode'} || $env{'form.discardview'}) {   if (!$env{'form.editmode'} || $env{'form.viewmode'} || $env{'form.discardview'}) {
     &Apache::structuretags::reset_problem_globals();              if ($filetype eq 'html' || $filetype eq 'sty') {
     $result = &Apache::lonxml::xmlparse($request,$target,$filecontents,          &Apache::structuretags::reset_problem_globals();
  '',%mystyle);          $result = &Apache::lonxml::xmlparse($request,$target,
                                                       $filecontents,'',%mystyle);
     # .html files may contain <problem> or <Task> need to clean      # .html files may contain <problem> or <Task> need to clean
     # up if it did      # up if it did
     &Apache::structuretags::reset_problem_globals();          &Apache::structuretags::reset_problem_globals();
     &Apache::lonhomework::finished_parsing();          &Apache::lonhomework::finished_parsing();
               } elsif ($filetype eq 'tex') {
                   $result = &Apache::lontexconvert::converted(\$filecontents,
                                 $env{'form.texengine'});
                   if ($env{'form.return_only_error_and_warning_counts'}) {
                       if (&verify_html('<html><body>'.$result.'</body></html>')) {
                           $errorcount++;
                       }
                       $result = "$errorcount:$warningcount";
                   }
               } else {
                   $result = $filecontents;
               }
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
     ['rawmode']);      ['rawmode']);
     if ($env{'form.rawmode'}) { $result = $filecontents; }      if ($env{'form.rawmode'}) { $result = $filecontents; }
     if ($filetype eq 'sty') {              if (($filetype ne 'html') && 
  my $controls =                  (!$env{'form.return_only_error_and_warning_counts'})) {
     ($env{'request.state'} eq 'construct') ? &Apache::londefdef::edit_controls()                  my $nochgview = 1;
                                            : '';                  my $controls = '';
  my %options = ('bgcolor' => '#FFFFFF');                      if ($env{'request.state'} eq 'construct') {
  $result =                           $controls = &Apache::loncommon::head_subbox(
     &Apache::loncommon::start_page(undef,undef,\%options).                                          &Apache::loncommon::CSTR_pageheader()
     $controls.                                         .&Apache::londefdef::edit_controls($nochgview));
     $result.                      }
     &Apache::loncommon::end_page();                  if ($filetype ne 'sty' && $filetype ne 'tex') {
     }                      $result =~ s/</&lt;/g;
  }                      $result =~ s/>/&gt;/g;
                       $result = '<table class="LC_sty_begin">'.
                                 '<tr><td><b><pre>'.$result.
                                 '</pre></b></td></tr></table>';
                   }
                   my $brcrum;
                   if ($env{'request.state'} eq 'construct') {
                       $brcrum = [{'href' => &Apache::loncommon::authorspace(),
                                   'text' => 'Construction Space'},
                                  {'href' => '',
                                   'text' => $breadcrumbtext}];
                   } else {
                       $brcrum = ''; # FIXME: Where are we?
                   }
                   my %options = ('bread_crumbs' => $brcrum,
                                  'bgcolor'      => '#FFFFFF');
                   $result =
                       &Apache::loncommon::start_page(undef,undef,\%options)
                      .$controls
                      .$result
                      .&Apache::loncommon::end_page();
               }
           }
     }      }
   
 #  #
Line 1784  ENDNOTFOUND Line 1774  ENDNOTFOUND
   
     my %options =       my %options = 
  ('add_entries' =>   ('add_entries' =>
                    {'onresize' => $add_to_onresize,                     {'onresize'     => $add_to_onresize,
     'onload'   => $add_to_onload,   });                      'onload'       => $add_to_onload,   });
               my $header;
     if ($env{'environment.remote'} ne 'off') {              if ($env{'request.state'} eq 'construct') {
  $options{'bgcolor'}   = '#FFFFFF';                  $options{'bread_crumbs'} = [{
  $options{'only_body'} = 1;                              'href' => &Apache::loncommon::authorspace(),
     }                              'text' => 'Construction Space'},
                              {'href' => '',
                               'text' => $breadcrumbtext}];
                   $header = &Apache::loncommon::head_subbox(
                                 &Apache::loncommon::CSTR_pageheader());
               }
     my $js =      my $js =
  &Apache::edit::js_change_detection().   &Apache::edit::js_change_detection().
  &Apache::loncommon::resize_textarea_js();   &Apache::loncommon::resize_textarea_js();
     my $start_page = &Apache::loncommon::start_page(undef,$js,      my $start_page = &Apache::loncommon::start_page(undef,$js,
     \%options);      \%options);
     $result=$start_page.              $result = $start_page
  &Apache::lonxml::message_location().                       .$header
  $edit_info.                       .&Apache::lonxml::message_location()
  &Apache::loncommon::end_page();                       .$edit_info
  }                       .&Apache::loncommon::end_page();
           }
     }      }
     if ($filetype eq 'html') { &writeallows($request->uri); }      if ($filetype eq 'html') { &writeallows($request->uri); }
       
     &Apache::lonxml::add_messages(\$result);      &Apache::lonxml::add_messages(\$result);
     $request->print($result);      $request->print($result);
           
Line 2172  sub get_tag { Line 2168  sub get_tag {
   
 =pod  =pod
   
 =item &print_pdf_radiobutton(fieldname, value,  text)  =item &print_pdf_radiobutton(fieldname, value)
   
 Returns a latexline to generate a PDF-Form-Radiobutton with Text.  Returns a latexline to generate a PDF-Form-Radiobutton.
   Note: Radiobuttons with equal names are automaticly grouped 
         in a selection-group.
   
 $fieldname: PDF internalname of the radiobutton  $fieldname: PDF internalname of the radiobutton(group)
 $value:     Value of radiobutton (read when dumping the PDF data)  $value:     Value of radiobutton
 $text:      Text on the rightside of the radiobutton  
   
 =cut  =cut
 sub print_pdf_radiobutton {  sub print_pdf_radiobutton {
     my $result = '';      my ($fieldname, $value) = @_;
     my ($fieldName, $value, $text) = @_;      return '\radioButton[\symbolchoice{circle}]{'
     $result .= '\begin{tabularx}{\textwidth}{p{0cm}X}'."\n";             .$fieldname.'}{10bp}{10bp}{'.$value.'}';
     $result .= '\radioButton[\symbolchoice{circle}]{'.   
                $fieldName.'}{10bp}{10bp}{'.$value.'}&'.$text."\n";  
     $result .= '\end{tabularx}' . "\n";  
     $result .= '\hspace{2mm}' . "\n";  
     return $result;  
 }  }
   
   

Removed from v.1.492  
changed lines
  Added in v.1.515


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