version 1.244, 2013/04/30 14:27:51
|
version 1.247, 2013/07/03 16:00:03
|
Line 98 sub display_common {
|
Line 98 sub display_common {
|
my $help_fileupload = &Apache::loncommon::help_open_topic('Portfolio AddFiles'); |
my $help_fileupload = &Apache::loncommon::help_open_topic('Portfolio AddFiles'); |
my $help_createdir = &Apache::loncommon::help_open_topic('Portfolio CreateDirectory'); |
my $help_createdir = &Apache::loncommon::help_open_topic('Portfolio CreateDirectory'); |
my $help_portfolio = &Apache::loncommon::help_open_topic('Portfolio About', &mt('Help on the portfolio')); |
my $help_portfolio = &Apache::loncommon::help_open_topic('Portfolio About', &mt('Help on the portfolio')); |
$r->print(&display_usage($group)); |
$r->print(&display_portfolio_usage($group,$help_portfolio)); |
my $parse_check; |
my $parse_check; |
if (!&suppress_embed_prompt()) { |
if (!&suppress_embed_prompt()) { |
$parse_check = <<"END"; |
$parse_check = <<"END"; |
Line 112 sub display_common {
|
Line 112 sub display_common {
|
END |
END |
} |
} |
|
|
$r->print('<div>'.$help_portfolio); |
|
# Upload File |
# Upload File |
$r->print('<div class="LC_left_float">' |
$r->print('<div class="LC_left_float">' |
.'<form method="post" enctype="multipart/form-data" action="'.$escuri.'">' |
.'<form method="post" enctype="multipart/form-data" action="'.$escuri.'">' |
Line 149 END
|
Line 148 END
|
.'</form>' |
.'</form>' |
.'</div>' |
.'</div>' |
); |
); |
$r->print('</div>'); |
|
} # end "if can_upload" |
} # end "if can_upload" |
|
|
my @tree = split (/\//,$current_path); |
my @tree = split (/\//,$current_path); |
Line 188 END
|
Line 186 END
|
$r->print("</form>"); |
$r->print("</form>"); |
} |
} |
|
|
sub display_usage { |
sub display_portfolio_usage { |
my ($group) = @_; |
my ($group,$helpitem) = @_; |
my $disk_quota = &get_quota($group); |
my $disk_quota = &get_quota($group); |
my $getpropath = 1; |
my $getpropath = 1; |
my $portfolio_root = &get_portfolio_root(); |
my $portfolio_root = &get_portfolio_root(); |
my ($uname,$udom) = &get_name_dom($group); |
my ($uname,$udom) = &get_name_dom($group); |
my $current_disk_usage = |
my $current_disk_usage = |
&Apache::lonnet::diskusage($udom,$uname,$portfolio_root,$getpropath); |
&Apache::lonnet::diskusage($udom,$uname,$portfolio_root,$getpropath); |
my $usage = $current_disk_usage/1000; |
return &Apache::loncommon::head_subbox( |
my $quota = $disk_quota/1000; |
'<div style="float:right;padding-top:0;margin-top;0">' |
my $percent; |
.$helpitem |
if ($disk_quota == 0) { |
.'</div>' |
$percent = 100.0; |
.'<div>' |
} else { |
.&Apache::lonhtmlcommon::display_usage($current_disk_usage,$disk_quota) |
$percent = 100*($current_disk_usage/$disk_quota); |
.'</div>'); |
} |
|
$usage = sprintf("%.2f",$usage); |
|
$quota = sprintf("%.2f",$quota); |
|
$percent = sprintf("%.0f",$percent); |
|
my ($color,$cssclass); |
|
if ($percent <= 60) { |
|
$color = '#00A000'; |
|
} elsif ($percent > 60 && $percent < 90) { |
|
$color = '#FFD300'; |
|
$cssclass = 'class="LC_warning"'; |
|
} elsif( $percent >= 90) { |
|
$color = '#FF0000'; |
|
$cssclass = 'class="LC_error"'; |
|
} |
|
my $prog_width = $percent; |
|
if ($prog_width > 100) { |
|
$prog_width = 100; |
|
} |
|
my $disk_meter = ' |
|
<div id="meter1" align="left" '.$cssclass.'>'.&mt('Currently using [_1] of the [_2] available.',$usage.' MB <span style="font-weight:bold;">('.$percent.'%)</span>',$quota.' MB')."\n". |
|
' <div id="meter2" style="display:block; margin-top:5px; margin-bottom:5px; margin-left:0px; margin-right:0px; width:400px; border:1px solid #000000; height:10px;">'."\n". |
|
' <div id="meter3" style="display:block; background-color:'.$color.'; width:'.$prog_width.'%; height:10px; color:#000000; margin:0px;"></div>'."\n". |
|
' </div>'."\n". |
|
' </div>'; |
|
return &Apache::loncommon::head_subbox($disk_meter); |
|
} |
} |
|
|
sub display_directory_line { |
sub display_directory_line { |
Line 2101 function confirmOverwrite() {
|
Line 2074 function confirmOverwrite() {
|
} |
} |
// ]]> |
// ]]> |
</script> |
</script> |
|
<p> |
$msg |
$msg |
<br /><div class="LC_warning"><form method="post" action="$url" name="existingfile" onsubmit="return confirmOverwrite();"> |
</p> |
<span class="LC_nobreak">$lt{'over'} |
<form method="post" action="$url" name="existingfile" onsubmit="return confirmOverwrite();"> |
|
<p class="LC_nobreak">$lt{'over'} |
<label><input type="radio" name="overwrite" value="1" /> |
<label><input type="radio" name="overwrite" value="1" /> |
$lt{'yes'}</label> |
$lt{'yes'}</label> |
<label><input type="radio" name="overwrite" value="0" checked="checked" />$lt{'no'}</label></span> |
<label><input type="radio" name="overwrite" value="0" checked="checked" />$lt{'no'}</label></p> |
|
<p> |
<input type="hidden" name="action" value="cancel_overwrite" /> |
<input type="hidden" name="action" value="cancel_overwrite" /> |
<input type="hidden" name="filename" value="$showfname" /> |
<input type="hidden" name="filename" value="$showfname" /> |
<input type="hidden" name="timestamp" value="$timestamp" /> |
<input type="hidden" name="timestamp" value="$timestamp" /> |
$hidden |
$hidden |
$parserflag |
$parserflag |
$group_elem |
$group_elem |
<br /><br /> |
|
<input type="submit" name="process" value="$lt{'cont'}" /> |
<input type="submit" name="process" value="$lt{'cont'}" /> |
</form></div> |
</p> |
|
</form> |
END |
END |
} else { |
} else { |
$r->print( |
$r->print( |
Line 2213 sub overwrite {
|
Line 2189 sub overwrite {
|
} |
} |
} |
} |
if ($fname eq '') { |
if ($fname eq '') { |
my $msg = &mt('Invalid filename: [_1]; the name of the uploaded file did not contain any letters, '. |
$r->print( |
|
&Apache::loncommon::confirmwrapper( |
|
&Apache::lonhtmlcommon::confirm_success( |
|
&mt('Invalid filename: [_1]; the name of the uploaded file did not contain any letters, '. |
'so after eliminating special characters there was nothing left.', |
'so after eliminating special characters there was nothing left.', |
'<span class="LC_filename">'.$env{'form.filename'}.'</span>'); |
'<span class="LC_filename">'.$env{'form.filename'}.'</span>'),1))); |
$r->print($msg.&done(undef,$url)); |
$r->print(&done(undef,$url)); |
return; |
return; |
} |
} |
$env{'form.'.$formname.'.filename'} = $fname; |
$env{'form.'.$formname.'.filename'} = $fname; |
Line 2227 sub overwrite {
|
Line 2206 sub overwrite {
|
\%allfiles,\%codebase,undef,undef,undef, |
\%allfiles,\%codebase,undef,undef,undef, |
undef,undef,undef,\$mimetype); |
undef,undef,undef,\$mimetype); |
if ($result !~ m|^/uploaded/|) { |
if ($result !~ m|^/uploaded/|) { |
$r->print('<p class="LC_error">'.&mt('An error occurred ([_1]) while trying to overwrite [_2].' |
$r->print( |
,$result,&display_file(undef,$fname)).'</p>'); |
&Apache::loncommon::confirmwrapper( |
$r->print(&after_overwrite(&mt('Back'),$url)); |
&Apache::lonhtmlcommon::confirm_success( |
|
&mt('An error occurred ([_1]) while trying to overwrite [_2].' |
|
,$result,&display_file(undef,$fname)),1))); |
} else { |
} else { |
if ($mode eq 'parse') { |
if ($mode eq 'parse') { |
if ($mimetype eq 'text/html') { |
if ($mimetype eq 'text/html') { |
Line 2237 sub overwrite {
|
Line 2218 sub overwrite {
|
&print_dependency_form($r,$url,\%allfiles,\%codebase,$result); |
&print_dependency_form($r,$url,\%allfiles,\%codebase,$result); |
return; |
return; |
} else { |
} else { |
$r->print('<p>'.&mt('Overwriting completed.').'<br />'. |
$r->print( |
&mt('No embedded items identified.').'</p>'); |
&Apache::loncommon::confirmwrapper( |
|
&Apache::lonhtmlcommon::confirm_success( |
|
&mt('Overwriting completed.')) |
|
.'<br />'.&mt('No embedded items identified.'))); |
} |
} |
} |
} |
|
} else { |
|
$r->print( |
|
&Apache::loncommon::confirmwrapper( |
|
&Apache::lonhtmlcommon::confirm_success( |
|
&mt('Overwriting completed.')))); |
} |
} |
$r->print(&after_overwrite(undef,$url)); |
|
} |
} |
return; |
|
} |
|
|
|
sub after_overwrite { |
|
my ($text,$url) = @_; |
|
my $group_elem; |
my $group_elem; |
if (defined($env{'form.group'})) { |
if (defined($env{'form.group'})) { |
$group_elem = '<input type="hidden" name="group" value="'.$env{'form.group'}.'" />'; |
$group_elem = '<input type="hidden" name="group" value="'.$env{'form.group'}.'" />'; |
Line 2256 sub after_overwrite {
|
Line 2240 sub after_overwrite {
|
$group_elem .= '<input type="hidden" name="ref" value="'.$env{'form.ref'}.'" />'."\n"; |
$group_elem .= '<input type="hidden" name="ref" value="'.$env{'form.ref'}.'" />'."\n"; |
} |
} |
} |
} |
if ($text eq '') { |
|
$text = &mt('Done'); |
|
} |
|
my $hidden = &hidden_elems(); |
my $hidden = &hidden_elems(); |
return <<END; |
$r->print( |
|
&Apache::lonhtmlcommon::actionbox( |
<h3><a href="javascript:document.overwritedone.submit();">$text</a></h3> |
['<a href="javascript:document.overwritedone.submit();">' |
<form name="overwritedone" method="post" action="$url" /> |
.&mt('Return to directory') |
$hidden |
.'</a>']) |
$group_elem |
.'<form name="overwritedone" method="post" action="'.$url.'">' |
</form> |
.$hidden |
END |
.$group_elem |
|
.'</form>' |
|
); |
|
return; |
} |
} |
|
|
sub lock_info { |
sub lock_info { |