Diff for /loncom/imspackages/imsexport.pm between versions 1.1 and 1.2

version 1.1, 2004/12/23 14:00:58 version 1.2, 2004/12/23 16:31:28
Line 27  use strict; Line 27  use strict;
 use Apache::lonnet;  use Apache::lonnet;
   
 sub simpleproblem  {  sub simpleproblem  {
     my ($symb,$output) = @_;      my ($symb) = @_;
       my $output;
     my %qparms = &Apache::lonnet::dump('resourcedata',      my %qparms = &Apache::lonnet::dump('resourcedata',
                   $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},                    $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
                   $ENV{'course.'.$ENV{'request.course.id'}.'.num'},                    $ENV{'course.'.$ENV{'request.course.id'}.'.num'},
Line 45  sub simpleproblem  { Line 46  sub simpleproblem  {
             if ($qtype eq 'option') {              if ($qtype eq 'option') {
                 my $options=$qparms{$prefix.'options'};                  my $options=$qparms{$prefix.'options'};
                 %values = &evaloptionhash($options);                  %values = &evaloptionhash($options);
                 $$output .= qq|                  $output .= qq|
 <problem>  <problem>
   <optionresponse max="$maxfoils" randomize="$randomize">    <optionresponse max="$maxfoils" randomize="$randomize">
     <foilgroup options="$options">      <foilgroup options="$options">
 |;  |;
                 for (my $k=0; $k<10; $k++) {                  for (my $k=0; $k<10; $k++) {
                     my $iter = $k+1;                      my $iter = $k+1;
                     $$output .= '   <foil name="foil'.$k.'" value="'.$qparms{$prefix.'.value.'.$iter}.'"';                      $output .= '   <foil name="foil'.$k.'" value="'.$qparms{$prefix.'value'.$iter}.'"';
                     $$output .= 'location="'.$qparms{$prefix.'.position.'.$iter}.'" ';                      $output .= ' location="'.$qparms{$prefix.'position'.$iter}.'" ';
                     $$output .= '><startouttext />'.$qparms{$prefix.'.text.'.$iter}.'<endouttext /></foil>'."\n";                      $output .= '><startouttext />'.$qparms{$prefix.'text'.$iter}.'<endouttext /></foil>'."\n";
                 }                  }
                 chomp($$output);                  chomp($output);
                 $$output .= qq|                  $output .= qq|
     </foilgroup>      </foilgroup>
 |;  |;
                 if ($hint) {                  if ($hint) {
                     $$output .= '                      $output .= '
     <hintgroup>      <hintgroup>
      <hintpart on="default">       <hintpart on="default">
       <startouttext />'.$hint.'<endouttext/>        <startouttext />'.$hint.'<endouttext/>
      </hintpart>       </hintpart>
     </hintgroup>';      </hintgroup>';
                 }                  }
                 $$output .= qq|                  $output .= qq|
   </optionresponse>    </optionresponse>
 </problem>  </problem>
 |;  |;
             } else {              } else {
                 $$output .= qq|                  $output .= qq|
 <problem>  <problem>
   <radiobuttonresponse max="$maxfoils" randomize="$randomize">    <radiobuttonresponse max="$maxfoils" randomize="$randomize">
    <foilgroup>     <foilgroup>
 |;  |;
                 for (my $k=0; $k<10; $k++) {                  for (my $k=0; $k<10; $k++) {
                     my $iter = $k+1;                      my $iter = $k+1;
                     $$output .= '   <foil name="foil'.$k.'" value="'.$qparms{$prefix.'.value.'.$iter}.'"';                      $output .= '   <foil name="foil'.$k.'" value="'.$qparms{$prefix.'value'.$iter}.'"';
                     $$output .= 'location="'.$qparms{$prefix.'.position.'.$iter}.'" ';                      $output .= ' location="'.$qparms{$prefix.'position'.$iter}.'" ';
                     $$output .= '><startouttext />'.$qparms{$prefix.'.text.'.$iter}.'<endouttext /></foil>'."\n";                      $output .= '><startouttext />'.$qparms{$prefix.'text'.$iter}.'<endouttext /></foil>'."\n";
                 }                  }
                 chomp($$output);                  chomp($output);
                 $$output .= qq|                  $output .= qq|
    </foilgroup>     </foilgroup>
 |;  |;
                 if ($hint) {                  if ($hint) {
                     $$output .= '                      $output .= '
    <hintgroup>     <hintgroup>
     <hintpart on="default">      <hintpart on="default">
      <startouttext />'.$hint.'<endouttext/>       <startouttext />'.$hint.'<endouttext/>
     </hintpart>      </hintpart>
    </hintgroup>';     </hintgroup>';
                 }                  }
                 $$output .= qq|                  $output .= qq|
   </radiobuttonresponse>    </radiobuttonresponse>
 </problem>  </problem>
 |;  |;
Line 104  sub simpleproblem  { Line 105  sub simpleproblem  {
         } elsif ($qtype eq 'stringanswer') {          } elsif ($qtype eq 'stringanswer') {
             my $stringanswer = $qparms{$prefix.'stringanswer'};              my $stringanswer = $qparms{$prefix.'stringanswer'};
             my $stringtype=$qparms{$prefix.'stringtype'};              my $stringtype=$qparms{$prefix.'stringtype'};
             $$output .= qq|              $output .= qq|
 <problem>  <problem>
   <stringresponse answer="$stringanswer" type="$stringtype">    <stringresponse answer="$stringanswer" type="$stringtype">
     <textline>      <textline>
     </textline>      </textline>
             |;              |;
             if ($hint) {              if ($hint) {
                 $$output .= '                  $output .= '
    <hintgroup>     <hintgroup>
     <hintpart on="default">      <hintpart on="default">
      <startouttext />'.$hint.'<endouttext/>       <startouttext />'.$hint.'<endouttext/>
     </hintpart>      </hintpart>
    </hintgroup>';     </hintgroup>';
             }              }
             $$output .= qq|              $output .= qq|
   </stringresponse>    </stringresponse>
 </problem>  </problem>
 |;  |;
         } else {          } else {
             $$output .= qq|              $output .= qq|
 <problem>  <problem>
   <startouttext />$qtext<endouttext />    <startouttext />$qtext<endouttext />
   <essayresponse>    <essayresponse>
Line 133  sub simpleproblem  { Line 134  sub simpleproblem  {
 |;  |;
         }          }
     }      }
     return;      return $output;
 }  }
   
 sub evaloptionhash {  sub evaloptionhash {
Line 150  sub evaloptionhash { Line 151  sub evaloptionhash {
 sub external {  sub external {
     my ($symb,$title) = @_;      my ($symb,$title) = @_;
     my $output;      my $output;
     if ($symb =~  m-\.sequence___\d+___ext$-) {      if ($symb =~  m-\.sequence___\d+___ext(.+)$-) {
         my $exturl = &Apache::lonnet::escape($1);          my $exturl = &Apache::lonnet::unescape($1);
         $output = qq|          $output = qq|
 <html>  <html>
 <head><title>$title</title>  <head><title>$title</title>
 </head>  </head>
 <frameset rows="0,*" border="0">  <frameset rows="0,*" border="0">
 <frame src=''>  <frame src='' />
 <frame src="$exturl" name="external">  <frame src="http://$exturl" name="external" />
 </frameset>  </frameset>
 </html>  </html>
         |;          |;
Line 228  sub templatedpage { Line 229  sub templatedpage {
 </$_>|;  </$_>|;
     }      }
     if (defined($syllabusdata{'uploaded.photourl'})) {      if (defined($syllabusdata{'uploaded.photourl'})) {
         if ($syllabusdata{'uploaded.photourl'} =~  m-^/uploaded/$cdom/$cnum/$content_type/(.+)$-) {          if ($syllabusdata{'uploaded.photourl'} =~  m-/([^/]+)$-) {
             push @{$$uploads}, $syllabusdata{'uploaded.photourl'};              push @$uploads, $syllabusdata{'uploaded.photourl'};
         }          }
         $output .= '          $output .= '
 <photo>  <photo>

Removed from v.1.1  
changed lines
  Added in v.1.2


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