version 1.49, 2010/02/16 10:26:17
|
version 1.53, 2010/12/26 03:09:11
|
Line 70 Start page output
|
Line 70 Start page output
|
|
|
=item * |
=item * |
|
|
output relevant interface phase (phaseone or phasetwo or phasethree) |
output relevant interface phase (phaseone, phasetwo, phasethree or phasefour) |
|
|
=item * |
=item * |
|
|
Line 99 as overwriting an existing file).
|
Line 99 as overwriting an existing file).
|
Interface for handling secondary uploads of embedded objects |
Interface for handling secondary uploads of embedded objects |
in an html file. |
in an html file. |
|
|
|
=item phasefour() |
|
|
|
Interface for handling optional renaming of links to embedded |
|
objects. |
|
|
=item upfile_store() |
=item upfile_store() |
|
|
Store contents of uploaded file into temporary space. Invoked |
Store contents of uploaded file into temporary space. Invoked |
Line 350 sub check_extension {
|
Line 355 sub check_extension {
|
my (%allfiles,%codebase); |
my (%allfiles,%codebase); |
&Apache::lonnet::extract_embedded_items($target,\%allfiles,\%codebase); |
&Apache::lonnet::extract_embedded_items($target,\%allfiles,\%codebase); |
if (keys(%allfiles) > 0) { |
if (keys(%allfiles) > 0) { |
my $state = <<STATE; |
my ($currentpath) = ($url =~ m{^(.+)/[^/]+$}); |
<input type="hidden" name="action" value="upload_embedded" /> |
my $state = &embedded_form_elems('upload_embedded',$url,$mode); |
<input type="hidden" name="currentpath" value="$env{'form.currentpath'}" /> |
my ($embedded,$num,$pathchg) = |
<input type="hidden" name="mode" value="$mode" /> |
&Apache::loncommon::ask_for_embedded_content($action,$state,\%allfiles, |
<input type="hidden" name="phase" value="three" /> |
\%codebase, |
<input type="hidden" name="filename" value="$url" /> |
{'error_on_invalid_names' => 1, |
STATE |
'ignore_remote_references' => 1, |
$result .= "<h3>".&mt("Reference Warning")."</h3>". |
'current_path' => $currentpath}); |
"<p>".&mt("Completed upload of the file. This file contained references to other files.")."</p>". |
if ($embedded) { |
"<p>".&mt("Please select the locations from which the referenced files are to be uploaded.")."</p>". |
$result .= '<h3>'.&mt('Reference Warning').'</h3>'; |
&Apache::loncommon::ask_for_embedded_content($action,$state,\%allfiles,\%codebase, |
if ($num) { |
{'error_on_invalid_names' => 1, |
$result .= '<p>'.&mt('Completed upload of the file.').' '.&mt('This file contained references to other files.').'</p>'. |
'ignore_remote_references' => 1,}); |
'<p>'.&mt('Please select the locations from which the referenced files are to be uploaded.').'</p>'. |
if ($mode eq 'testbank') { |
$embedded; |
$returnflag = 'embedded'; |
if ($mode eq 'testbank') { |
$result .= '<p>'.&mt('Or [_1]continue[_2] the testbank import without these files','<a href="javascript:document.testbankForm.submit();">','</a>').'</p>'; |
$returnflag = 'embedded'; |
|
$result .= '<p>'.&mt('Or [_1]continue[_2] the testbank import without these files.','<a href="javascript:document.testbankForm.submit();">','</a>').'</p>'; |
|
} |
|
} else { |
|
$result .= '<p>'.&mt('Completed upload of the file.').'</p>'.$embedded; |
|
if ($pathchg) { |
|
if ($mode eq 'testbank') { |
|
$returnflag = 'embedded'; |
|
$result .= '<p>'.&mt('Or [_1]continue[_2] the testbank import without modifying the references(s).','<a href="javascript:document.testbankForm.submit();">','</a>').'</p>'; |
|
} |
|
} |
|
} |
} |
} |
} |
} |
} |
} |
Line 385 STATE
|
Line 401 STATE
|
|
|
sub phasethree { |
sub phasethree { |
my ($r,$fn,$uname,$udom,$mode) = @_; |
my ($r,$fn,$uname,$udom,$mode) = @_; |
|
my $action = '/adm/upload'; |
|
if ($mode eq 'testbank') { |
|
$action = '/adm/testbank'; |
|
} elsif ($mode eq 'imsimport') { |
|
$action = '/adm/imsimport'; |
|
} |
|
my $dir_root = '/home/'.$uname.'/public_html'; |
|
my $url_root = '/priv/'.$uname; |
|
my $path = &File::Basename::dirname($fn); |
|
my $filename = &HTML::Entities::encode($env{'form.filename'},'<>&"'); |
|
my $state = &embedded_form_elems('modify_orightml',$filename,$mode). |
|
'<input type="hidden" name="phase" value="four" />'; |
|
my ($result,$returnflag) = |
|
&Apache::loncommon::upload_embedded($mode,$path,$uname,$udom, |
|
$dir_root,$url_root,undef, |
|
undef,undef,$state,$action); |
|
if ($mode ne 'imsimport' && $mode ne 'testbank') { |
|
$result .= '<br /><h3><a href="'.$url_root.$fn.'">'. |
|
&mt('View main file').'</a></h3>'. |
|
'<h3><a href="'.$url_root.$path.'">'. |
|
&mt('Back to Directory').'</a></h3><br />'; |
|
} |
|
return ($result,$returnflag); |
|
} |
|
|
|
sub embedded_form_elems { |
|
my ($action,$filename,$mode) = @_; |
|
return <<STATE; |
|
<input type="hidden" name="action" value="$action" /> |
|
<input type="hidden" name="mode" value="$mode" /> |
|
<input type="hidden" name="filename" value="$filename" /> |
|
STATE |
|
} |
|
|
|
sub phasefour { |
|
my ($r,$fn,$uname,$udom,$mode) = @_; |
|
my $action = '/adm/upload'; |
|
if ($mode eq 'testbank') { |
|
$action = '/adm/testbank'; |
|
} elsif ($mode eq 'imsimport') { |
|
$action = '/adm/imsimport'; |
|
} |
my $result; |
my $result; |
my $dir_root = '/home/'.$uname.'/public_html'; |
my $dir_root = '/home/'.$uname.'/public_html'; |
my $url_root = '/priv/'.$uname; |
my $url_root = '/priv/'.$uname; |
my $base = &File::Basename::basename($fn); |
|
my $path = &File::Basename::dirname($fn); |
my $path = &File::Basename::dirname($fn); |
$result = &Apache::loncommon::upload_embedded($mode,$path,$uname,$udom, |
$result .= &Apache::loncommon::modify_html_refs($mode,$path, |
$dir_root,$url_root); |
$uname,$udom,$dir_root); |
if ($mode ne 'imsimport' && $mode ne 'testbank') { |
if ($mode ne 'imsimport' && $mode ne 'testbank') { |
$result = '<br /><font size="+2"><a href="'.$url_root.$fn.'">'. |
$result .= '<br /><h3><a href="'.$url_root.$fn.'">'. |
&mt('View main file').'</a></font>'. |
&mt('View main file').'</a></h3>'. |
'<br /><font size="+2"><a href="'.$url_root.$path.'">'. |
'<h3><a href="'.$url_root.$path.'">'. |
&mt('Back to Directory').'</a></font><br />'; |
&mt('Back to Directory').'</a></h3><br />'; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 481 function verifyForm() {
|
Line 538 function verifyForm() {
|
); |
); |
|
|
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { |
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { |
$r->print('<p class="LC_warning">' |
$r->print('<p class="LC_info">' |
.&mt('Co-Author [_1]',$uname.':'.$udom) |
.&mt('Co-Author [_1]',$uname.':'.$udom) |
.'</p>' |
.'</p>' |
); |
); |
} |
} |
|
if ($env{'form.phase'} eq 'four') { |
if ($env{'form.phase'} eq 'three') { |
my $output = &phasefour($r,$fn,$uname,$udom,'author'); |
my $output = &phasethree($r,$fn,$uname,$udom,'author'); |
$r->print($output); |
|
} elsif ($env{'form.phase'} eq 'three') { |
|
my ($output,$rtnflag) = &phasethree($r,$fn,$uname,$udom,'author'); |
$r->print($output); |
$r->print($output); |
} elsif ($env{'form.phase'} eq 'two') { |
} elsif ($env{'form.phase'} eq 'two') { |
my ($output,$returnflag) = &phasetwo($r,$fn,$uname,$udom); |
my ($output,$returnflag) = &phasetwo($r,$fn,$uname,$udom); |