--- loncom/interface/portfolio.pm 2008/05/28 20:46:46 1.193
+++ loncom/interface/portfolio.pm 2008/12/08 23:15:56 1.201
@@ -1,7 +1,7 @@
# The LearningOnline Network
# portfolio browser
#
-# $Id: portfolio.pm,v 1.193 2008/05/28 20:46:46 raeburn Exp $
+# $Id: portfolio.pm,v 1.201 2008/12/08 23:15:56 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -87,13 +87,12 @@ sub display_common {
my $groupitem = &group_form_data();
my $iconpath= $r->dir_config('lonIconsURL') . "/";
- my %text=&Apache::lonlocal::texthash(
+ my %lt=&Apache::lonlocal::texthash(
'upload' => 'Upload',
- 'upload_label' =>
- 'Upload file to current directory:',
+ 'upload_label' => 'Upload file to current directory',
'createdir' => 'Create Subdirectory',
'createdir_label' =>
- 'Create subdirectory in current directory:',
+ 'Create subdirectory in current directory',
'parse' => 'If HTML file, upload embedded images/multimedia/css/linked files'
);
my $escuri = &HTML::Entities::encode($r->uri,'&<>"');
@@ -103,48 +102,56 @@ sub display_common {
# FIXME: This line should be deleted once Portfolio uses breadcrumbs
$r->print(&Apache::loncommon::help_open_topic('Portfolio About', &mt('Help on the portfolio')));
- $r->print(<<"TABLE");
-
-
-
- $text{'upload_label'}
-
-
-
-
-
-
-
- $text{'createdir_label'}
-
-
-
-
-
-
-TABLE
- }
+END
+ }
+
+ $r->print('
');
+ # Upload File
+ $r->print('
'
+ .''
+ .'
'
+ );
+ # Create Subdirectory
+ $r->print('
'
+ .''
+ .'
'
+ );
+ $r->print('
');
+ } # end "if can_upload"
+
my @tree = split (/\//,$current_path);
my %anchor_fields = (
'selectfile' => $port_path,
@@ -184,7 +191,7 @@ sub display_directory_line {
$href_location, $url, $current_path, $access_admin_text, $versions)=@_;
my $fullpath = &prepend_group($current_path.$filename);
- $r->print('
');
+ $r->print(&Apache::loncommon::start_data_table_row());
$r->print($line); # contains first two cells of table
my $lock_info;
if ($version_flag) { # versioned can't be versioned, so TRUE when root file
@@ -220,15 +227,19 @@ sub display_directory_line {
$r->print('
');
}
$r->print('');
}
@@ -1542,7 +1575,7 @@ sub additional_item {
sub actionbox {
my ($status,$num,$scope) = @_;
- my $output = ' '.
''.&mt('Update');
}
@@ -1572,7 +1605,7 @@ sub dateboxes {
undef,undef,1);
my $enddate = &Apache::lonhtmlcommon::date_setter('portform',
'enddate_'.$num,$end,undef,undef,undef,1,undef,
- undef,undef,1). ' '.
+ undef,undef,1). ' '.
''.&mt('No end date').
'';
@@ -1746,15 +1779,28 @@ ENDSMP
ENDSMP
$r->print($javascript);
- $r->print("
".&mt('Select portfolio files')."
".
- &mt('Check as many as you wish in response to the problem.')." ");
+ $r->print("
".&mt('Select portfolio files')."
");
my @otherfiles=&Apache::lonnet::files_not_in_path($env{'user.name'}, $env{'form.currentpath'});
if (@otherfiles) {
- $r->print("".&mt('Files selected from other directories:')." ");
+ $r->print(&Apache::loncommon::start_data_table()
+ .&Apache::loncommon::start_data_table_header_row()
+ .'
'
+ .&mt('Check as many files as you wish in response to the problem:')
+ .'
'
+ );
}
@@ -1809,10 +1855,17 @@ sub check_for_upload {
sub upload {
my ($r,$url,$group)=@_;
my $fname=&Apache::lonnet::clean_filename($env{'form.uploaddoc.filename'});
-
- my ($state,$msg) = &check_for_upload($env{'form.currentpath'},
- $fname,$group,'uploaddoc');
-
+ my $disk_quota = &get_quota($group);
+ my $portfolio_root = &get_portfolio_root();
+ my $port_path = &get_port_path();
+ my ($uname,$udom) = &get_name_dom($group);
+ my $getpropath = 1;
+ my $current_disk_usage = &Apache::lonnet::diskusage($udom,$uname,$portfolio_root,$getpropath);
+ my ($state,$msg) =
+ &Apache::loncommon::check_for_upload($env{'form.currentpath'},$fname,
+ $group,'uploaddoc',$portfolio_root,
+ $port_path,$disk_quota,
+ $current_disk_usage,$uname,$udom);
if ($state eq 'will_exceed_quota'
|| $state eq 'file_locked'
|| $state eq 'file_exists' ) {
@@ -1820,7 +1873,6 @@ sub upload {
return;
}
- my $port_path = &get_port_path();
my (%allfiles,%codebase,$mode);
if ($env{'form.uploaddoc.filename'} =~ m/(\.htm|\.html|\.shtml)$/i) {
if ($env{'form.parserflag'}) {
@@ -1837,73 +1889,27 @@ sub upload {
$r->print(&done('Back',$url));
} else {
if (%allfiles) {
- my $state = <
STATE
- $r->print("
".&mt("Reference Warning")."
");
- $r->print("
".&mt("Completed upload of the file. This file contained references to other files. You must upload the referenced files or else the uploaded file may not work properly.")."
");
- $r->print("
".&mt("Please select the locations from which the referenced files are to be uploaded.")."
".&mt("Completed upload of the file. This file contained references to other files. You must upload the referenced files or else the uploaded file may not work properly.")."
");
+ $r->print("
".&mt("Please select the locations from which the referenced files are to be uploaded.")."