version 1.153, 2010/05/23 12:29:25
|
version 1.156, 2010/06/02 21:27:50
|
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; |
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 |
|
$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 414 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.= ' <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 |
Line 429 sub start_import {
|
Line 440 sub start_import {
|
if ($id) { |
if ($id) { |
$result.='" id="'.$id; |
$result.='" id="'.$id; |
} |
} |
$result.='">'; |
$result.='" importmode="'.$token->[2]{'importmode'}.'">'; |
$result.=$bodytext; |
$result.=$bodytext; |
$result.='</import>'; |
$result.='</import>'; |
} |
} |