'.
+ undef,undef,1). ' '.
' '.&mt('No end date').
' ';
@@ -1643,12 +1717,12 @@ sub role_selectors {
'group' => $groups,
);
foreach my $item ('role','access','section','group') {
- $output .= ''."\n";
+ $output .= ''."\n";
foreach my $entry (@{$allitems{$item}}) {
if ($caller eq 'display') {
if ((@{$$content{'roles'}{$role_id}{$item}} > 0) &&
(grep(/^\Q$entry\E$/,@{$$content{'roles'}{$role_id}{$item}}))) {
- $output .= ' '.
+ $output .= ' '.
$lookup{$item}{$entry}.' ';
next;
}
@@ -1746,15 +1820,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('Files selected from other directories:')." "
+ .&Apache::loncommon::end_data_table_header_row()
+ );
foreach my $file (@otherfiles) {
- $r->print($file." ");
+ $r->print(&Apache::loncommon::start_data_table_row()
+ .''.$file." "
+ .&Apache::loncommon::end_data_table_row()
+ );
}
+ $r->print(&Apache::loncommon::end_data_table()
+ .' '
+ );
}
+ $r->print(''
+ .&mt('Check as many files as you wish in response to the problem:')
+ .'
'
+ );
}
@@ -1809,10 +1896,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 +1914,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 +1930,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.")."
");
- $r->print(&Apache::londocs::ask_for_embedded_content('/adm/portfolio',$state,\%allfiles,\%codebase,
+ $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.")."
");
+ $r->print(&Apache::loncommon::ask_for_embedded_content('/adm/portfolio',$state,\%allfiles,\%codebase,
{'error_on_invalid_names' => 1,
'ignore_remote_references' => 1,}));
- $r->print('Or '.&done('Return to directory',$url).'
');
+ $r->print('Or '.&done('Return to directory',$url).'
');
+ }
} else {
$r->print(&done(undef,$url));
}
}
}
-sub upload_embedded {
- my ($r,$url,$group)=@_;
- for (my $i=0; $i<$env{'form.number_embedded_items'}; $i++) {
- next if (!exists($env{'form.embedded_item_'.$i.'.filename'}));
- my $orig_uploaded_filename =
- $env{'form.embedded_item_'.$i.'.filename'};
-
- $env{'form.embedded_orig_'.$i} =
- &unescape($env{'form.embedded_orig_'.$i});
- my ($path,$fname) =
- ($env{'form.embedded_orig_'.$i} =~ m{(.*/)([^/]*)});
- # no path, whole string is fname
- if (!$fname) { $fname = $env{'form.embedded_orig_'.$i} };
-
- $path = $env{'form.currentpath'}.$path;
- $fname = &Apache::lonnet::clean_filename($fname);
-
- my ($state,$msg) = &check_for_upload($path,$fname,$group,
- 'embedded_item_'.$i);
-
- if ($state eq 'will_exceed_quota'
- || $state eq 'file_locked'
- || $state eq 'file_exists' ) {
- $r->print($msg);
- next;
- }
-
- my $port_path = &get_port_path();
- my $src_path = $env{'form.embedded_orig_'.$i};
- $env{'form.embedded_item_'.$i.'.filename'}=$fname;
-
- my $result=
- &Apache::lonnet::userfileupload('embedded_item_'.$i,'',
- $port_path.$path);
- if ($result !~ m|^/uploaded/|) {
- $r->print(''
- .&mt('An error occurred ([_1]) while trying to upload [_2] for embedded element [_3].'
- ,$result,$orig_uploaded_filename,$env{'form.embedded_orig_'.$i})
- .' ');
- next;
- } else {
- $r->print(" Uploaded ".
- &display_file($port_path.$path,$fname).'
');
- }
- }
- $r->print(&done(undef,$url));
-}
-
sub lock_info {
my ($r,$url,$group) = @_;
my ($uname,$udom) = &get_name_dom($group);
@@ -2091,7 +2138,7 @@ sub missing_priv {
$r->print(&mt('You do not have sufficient privileges to [_1] ',
$longtext->{$priv}));
if (defined($env{'form.group'})) {
- $r->print(&mt("in the group's file repository."));
+ $r->print(&mt("in the group's group portfolio."));
$rtnlink .= &group_args()
} else {
$r->print(&mt('in this portfolio.'));
@@ -2143,6 +2190,17 @@ sub get_quota {
return $disk_quota;
}
+sub suppress_embed_prompt {
+ my $suppress_prompt = 0;
+ if (($env{'request.role'} =~ /^st/) && ($env{'request.course.id'} ne '')) {
+ if ($env{'course.'.$env{'request.course.id'}.'.suppress_embed_prompt'} eq 'yes') {
+ $suppress_prompt = 1;
+ }
+ }
+ return $suppress_prompt;
+}
+
+
sub handler {
# this handles file management
my $r = shift;
@@ -2188,7 +2246,7 @@ sub handler {
$r->print(&mt('Not a valid group for this course'));
$earlyout = 1;
}
- $title = &mt('Group files for [_1]', $group);
+ $title = &mt('Group portfolio for [_1]', $group);
} else {
$r->print(&mt('Invalid group'));
$earlyout = 1;
@@ -2216,7 +2274,7 @@ sub handler {
} else {
($uname,$udom) = &get_name_dom();
$portfolio_root = &get_portfolio_root();
- $title = &mt('Portfolio Manager');
+ $title = &mt('My Space');
$can_modify = 1;
$can_delete = 1;
$can_upload = 1;
@@ -2228,14 +2286,28 @@ sub handler {
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
# Give the LON-CAPA page header
+ my $brcrum = [{href=>"/adm/portfolio",text=>"Portfolio Manager"}];
+
if ($env{"form.mode"} eq 'selectfile'){
$r->print(&Apache::loncommon::start_page($title,undef,
{'only_body' => 1}));
} elsif ($env{'form.action'} eq 'rolepicker') {
$r->print(&Apache::loncommon::start_page('New role-based condition',undef,
{'no_nav_bar' => 1, }));
- } else {
+ } elsif ($caller eq 'coursegrp_portfolio') {
$r->print(&Apache::loncommon::start_page($title));
+ } else {
+ $r->print(&Apache::loncommon::start_page($title,undef,
+ {'bread_crumbs' => $brcrum}));
+ if (!&Apache::lonnet::usertools_access($uname,$udom,'portfolio')) {
+ $r->print(''.&mt('No user portfolio available') .' '.
+ &mt('This is a result of one of the following:').''.
+ ''.&mt('The administrator of this domain has disabled portfolio functionality for this specific user.').' '.
+ ''.&mt('The domain has been configured to disable, by default, portfolio functionality for all users in the domain.').' '.
+ ' ');
+ $r->print(&Apache::loncommon::end_page());
+ return OK;
+ }
}
$r->rflush();
my ($blocked,$blocktext) =
@@ -2267,7 +2339,14 @@ sub handler {
}
} elsif ($env{'form.action'} eq 'upload_embedded') {
if ($can_upload) {
- &upload_embedded($r,$url,$group);
+ my $disk_quota = &get_quota($group);
+ my $getpropath = 1;
+ my $current_disk_usage =
+ &Apache::lonnet::diskusage($udom,$uname,$portfolio_root,$getpropath);
+ $r->print(
+ &Apache::loncommon::upload_embedded('portfolio',$port_path,$uname,$udom,
+ $group,$portfolio_root,$group,$disk_quota,$current_disk_usage));
+ $r->print(&done(undef,$url));
} else {
&missing_priv($r,$url,'upload');
}
@@ -2366,7 +2445,7 @@ sub handler {
# need to know if directory is empty so it can be removed if desired
my $is_empty=(@dir_list == 2);
&display_common($r,$url,$current_path,$is_empty,\@dir_list,
- $can_upload);
+ $can_upload,$group);
&display_directory($r,$url,$current_path,$is_empty,\@dir_list,$group,
$can_upload,$can_modify,$can_delete,$can_setacl);
$r->print(&Apache::loncommon::end_page());