Diff for /loncom/homework/edit.pm between versions 1.76 and 1.79

version 1.76, 2004/01/12 19:53:54 version 1.79, 2004/02/13 21:12:54
Line 289  sub insert_formularesponse { Line 289  sub insert_formularesponse {
 <formularesponse answer="" samples="">  <formularesponse answer="" samples="">
     <textline />      <textline />
     <hintgroup>      <hintgroup>
     <startouttext/>      <startouttext /><endouttext />
     <endouttext />  
     </hintgroup>      </hintgroup>
 </formularesponse>';  </formularesponse>';
 }  }
Line 300  sub insert_numericalresponse { Line 299  sub insert_numericalresponse {
 <numericalresponse answer="">  <numericalresponse answer="">
     <textline />      <textline />
     <hintgroup>      <hintgroup>
     <startouttext/>      <startouttext /><endouttext />
     <endouttext />  
     </hintgroup>      </hintgroup>
 </numericalresponse>';  </numericalresponse>';
 }  }
Line 311  sub insert_stringresponse { Line 309  sub insert_stringresponse {
 <stringresponse answer="" type="">  <stringresponse answer="" type="">
     <textline />      <textline />
     <hintgroup>      <hintgroup>
     <startouttext/>      <startouttext /><endouttext />
     <endouttext />  
     </hintgroup>      </hintgroup>
 </stringresponse>';  </stringresponse>';
 }  }
Line 330  sub insert_imageresponse { Line 327  sub insert_imageresponse {
     <foilgroup>      <foilgroup>
     </foilgroup>      </foilgroup>
     <hintgroup>      <hintgroup>
     <startouttext/>      <startouttext /><endouttext />
     <endouttext />  
     </hintgroup>      </hintgroup>
 </imageresponse>';  </imageresponse>';
 }  }
Line 342  sub insert_optionresponse { Line 338  sub insert_optionresponse {
     <foilgroup options="">      <foilgroup options="">
     </foilgroup>      </foilgroup>
     <hintgroup>      <hintgroup>
     <startouttext/>      <startouttext /><endouttext />
     <endouttext />  
     </hintgroup>      </hintgroup>
 </optionresponse>';  </optionresponse>';
 }  }
Line 353  sub insert_organicresponse { Line 348  sub insert_organicresponse {
 <organicresponse>  <organicresponse>
     <textline />      <textline />
     <hintgroup>      <hintgroup>
     <startouttext/>      <startouttext /><endouttext />
     <endouttext />  
     </hintgroup>      </hintgroup>
 </organicresponse>';  </organicresponse>';
 }  }
Line 371  sub insert_radiobuttonresponse { Line 365  sub insert_radiobuttonresponse {
     <foilgroup>      <foilgroup>
     </foilgroup>      </foilgroup>
     <hintgroup>      <hintgroup>
     <startouttext/>      <startouttext /><endouttext />
     <endouttext />  
     </hintgroup>      </hintgroup>
 </radiobuttonresponse>';  </radiobuttonresponse>';
 }  }
Line 382  sub insert_reactionresponse { Line 375  sub insert_reactionresponse {
 <reactionresponse>  <reactionresponse>
     <textline />      <textline />
     <hintgroup>      <hintgroup>
     <startouttext/>      <startouttext /><endouttext />
     <endouttext />  
     </hintgroup>      </hintgroup>
 </reactionresponse>';  </reactionresponse>';
 }  }
Line 394  sub insert_rankresponse { Line 386  sub insert_rankresponse {
     <foilgroup options="">      <foilgroup options="">
     </foilgroup>      </foilgroup>
     <hintgroup>      <hintgroup>
     <startouttext/>      <startouttext /><endouttext />
     <endouttext />  
     </hintgroup>      </hintgroup>
 </rankresponse>';  </rankresponse>';
 }  }
Line 408  sub insert_matchresponse { Line 399  sub insert_matchresponse {
       </itemgroup>        </itemgroup>
     </foilgroup>      </foilgroup>
     <hintgroup>      <hintgroup>
     <startouttext/>      <startouttext /><endouttext />
     <endouttext />  
     </hintgroup>      </hintgroup>
 </matchresponse>';  </matchresponse>';
 }  }
Line 427  sub insert_hintpart { Line 417  sub insert_hintpart {
 sub insert_hintgroup {  sub insert_hintgroup {
   return '    return '
 <hintgroup>  <hintgroup>
     <startouttext/>      <startouttext /><endouttext />
     <endouttext />  
 </hintgroup>';  </hintgroup>';
 }  }
   
Line 463  sub insert_optionhint { Line 452  sub insert_optionhint {
 }  }
   
 sub insert_startouttext {  sub insert_startouttext {
     return "<startouttext />\n<endouttext />";      return "<startouttext /><endouttext />";
 }  }
   
 sub insert_script {  sub insert_script {
     return "\n<script type=\"loncapa/perl\">\n</script>";      return "\n<script type=\"loncapa/perl\"></script>";
 }  }
   
 sub textarea_sizes {  sub textarea_sizes {
Line 543  sub get_new_args { Line 532  sub get_new_args {
  $token->[2]->{$arg}=$newvalue;   $token->[2]->{$arg}=$newvalue;
     }      }
     $rebuild=1;      $rebuild=1;
    } elsif (!defined($newvalue) && defined($value)) {
       delete($token->[2]->{$arg});
       $rebuild=1;
  }   }
     }      }
     return $rebuild;      return $rebuild;
Line 739  ENDBUTTON Line 731  ENDBUTTON
     return $result;      return $result;
 }  }
   
 # coordinate pair (x1,y1)-(x2,y2)  # coordinates (x1,y1)-(x2,y2)...
 sub entercoordpair {  # mode can be either box, or polygon
     my ($id,$mode,$width,$height) = @_;  sub entercoord {
     unless ($Apache::edit::bgimgsrc) { return ''; }      my ($idx,$mode,$width,$height,$type) = @_;
     my $bgfile=&Apache::lonnet::escape($Apache::edit::bgimgsrc);  
     my $form    = 'lonhomework';  
     my $element;  
     if (! defined($mode) || $mode eq 'attribute') {  
         $element = &Apache::lonnet::escape("$id\_$Apache::lonxml::curdepth");  
     } elsif ($mode eq 'textnode') {  # for data between <tag> ... </tag>  
         $element = &Apache::lonnet::escape('homework_edit_'.  
                                            $Apache::lonxml::curdepth);  
     }  
     my $formheight='';  
     if ($height) {  
  $formheight='&formheight='.$height.'_'.$Apache::edit::bgimgsrccurdepth;  
     }  
     my $formwidth='';  
     if ($width) {  
  $formwidth='&formwidth='.$width.'_'.$Apache::edit::bgimgsrccurdepth;  
     }  
     my $result = <<"ENDBUTTON";  
 <a href="/cgi-bin/imagechoice.pl?mode=pair&formname=$form&file=$bgfile$formheight$formwidth&formcoord=$element"  
 target="imagechoice">Click Coordinate Pair</a>  
 ENDBUTTON  
     return $result;  
 }  
   
 # coordinate polygon (x1,y1)-(x2,y2)...  
 sub entercoordpolygon {  
     my ($id,$mode,$width,$height) = @_;  
     unless ($Apache::edit::bgimgsrc) { return ''; }      unless ($Apache::edit::bgimgsrc) { return ''; }
     &Apache::lonnet::logthis($Apache::edit::bgimgsrc);  
     my $bgfile=&Apache::lonnet::escape(&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$Apache::edit::bgimgsrc));      my $bgfile=&Apache::lonnet::escape(&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$Apache::edit::bgimgsrc));
     &Apache::lonnet::logthis($Apache::edit::bgfile);      &Apache::lonnet::logthis($Apache::edit::bgfile);
     my $form    = 'lonhomework';      my $form    = 'lonhomework';
     my $element;      my $element;
     if (! defined($mode) || $mode eq 'attribute') {      if (! defined($mode) || $mode eq 'attribute') {
         $element = &Apache::lonnet::escape("$id\_$Apache::lonxml::curdepth");          $element = &Apache::lonnet::escape("$idx\_$Apache::lonxml::curdepth");
     } elsif ($mode eq 'textnode') {  # for data between <tag> ... </tag>      } elsif ($mode eq 'textnode') {  # for data between <tag> ... </tag>
         $element = &Apache::lonnet::escape('homework_edit_'.          $element = &Apache::lonnet::escape('homework_edit_'.
                                            $Apache::lonxml::curdepth);                                             $Apache::lonxml::curdepth);
     }      }
     my $id=$Apache::lonxml::curdepth;      my $id=$Apache::lonxml::curdepth;
     my %data=("imagechoice.$id.mode"      =>'polygon',      my %data=("imagechoice.$id.type"      =>$type,
       "imagechoice.$id.formname"  =>$form,        "imagechoice.$id.formname"  =>$form,
       "imagechoice.$id.file"      =>$bgfile,        "imagechoice.$id.file"      =>$bgfile,
       "imagechoice.$id.formcoord" =>$element);        "imagechoice.$id.formcoord" =>$element);
Line 796  sub entercoordpolygon { Line 760  sub entercoordpolygon {
     $Apache::edit::bgimgsrccurdepth;      $Apache::edit::bgimgsrccurdepth;
     }      }
     &Apache::lonnet::appenv(%data);      &Apache::lonnet::appenv(%data);
     my $result='<a href="/adm/imagechoice?token='.$id.'" target="imagechoice">Create Polygon Data</a>';      my $text="Enter Coordinates";
       if ($type eq 'polygon') { $text='Create Polygon Data'; }
       my $result='<a href="/adm/imagechoice?token='.$id.'" target="imagechoice">'.$text.'</a>';
     return $result;      return $result;
 }  }
   

Removed from v.1.76  
changed lines
  Added in v.1.79


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