Diff for /loncom/xml/scripttag.pm between versions 1.153 and 1.154

version 1.153, 2010/05/23 12:29:25 version 1.154, 2010/05/26 02:04:20
Line 385  sub start_import { Line 385  sub start_import {
       return "";        return "";
     }      }
     my $importmode=&Apache::lonxml::get_param('importmode',$parstack,$safeeval);      my $importmode=&Apache::lonxml::get_param('importmode',$parstack,$safeeval);
     if ($importmode eq 'problem') {      if (($importmode eq 'problem') || ($importmode eq 'part')) {
        $file=~s/^\s*<problem>/<library>/s;  # We are using import to import published problems
        $file=~s/<\/problem>\s*$/<\/library>/s;  # This will require some on-the-fly rewriting
          my $importid=&Apache::lonxml::get_param('id',$parstack,$safeeval);
          if ($importid) {
   # Rewrite all internal IDs of the problem to avoid duplicates
             $file=~s/id\s*=\s*([\"\'])(\w+)([\"\'])/id=$1$2DynPart$importid$3/gs;
          }
          if (($importmode eq 'problem') || ($file=~/<part[^<]*>/s)) {
   # We explicitly don't want this to be a separate part or the problem already has parts
             $file=~s/^\s*<problem>/<library>/s;
     $file=~s/<\/problem>\s*$/<\/library>/s;
          } else {
   # We want this to be a separate part, but it currently is not
             if ($importid) {
                $file=~s/^\s*<problem>/<library><part id="DynPart$importid">/s;
             } else {
                $file=~s/^\s*<problem>/<library><part>/s;
             }
     $file=~s/<\/problem>\s*$/<\/part><\/library>/s;
          }
     }      }
     my $dir=$location;      my $dir=$location;
     $dir=~s:/[^/]*$::;      $dir=~s:/[^/]*$::;
Line 406  sub start_import { Line 424  sub start_import {
     $location=~s/\s*$//s;      $location=~s/\s*$//s;
     $result.=&Apache::edit::editline($location,$bodytext,'',40);      $result.=&Apache::edit::editline($location,$bodytext,'',40);
     $result.=&Apache::edit::browse(undef,'textnode');      $result.=&Apache::edit::browse(undef,'textnode');
         $result.= '<label>'.&mt('Import as:').      $result.= '&nbsp;<label>'.&mt('Import as:').
               '<select name="importmode_'.$Apache::lonxml::curdepth.'">';                '<select name="importmode_'.$Apache::lonxml::curdepth.'">';
     foreach my $option ('','problem') {      my %options=&Apache::lonlocal::texthash(''        => 'as standard library',
                                               'problem' => 'as problem',
                                               'part'    => 'as problem part(s)');
       foreach my $option (sort(keys(%options))) {
        $result.='<option value="'.$option.'"';         $result.='<option value="'.$option.'"';
        if ($option eq &Apache::lonxml::get_param('importmode',$parstack,$safeeval)) {         if ($option eq &Apache::lonxml::get_param('importmode',$parstack,$safeeval)) {
           $result.=' selected="selected"';            $result.=' selected="selected"';
        }         }
        $result.='>'.($option?&mt('as problem'):&mt('as standard library')).'</option>';         $result.='>'.$options{$option}.'</option>';
     }      }
     $result.='</select></label>';      $result.='</select></label>';
     #FIXME this need to convert $bodytext to be a contruction space reference      #FIXME this need to convert $bodytext to be a contruction space reference

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


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