--- loncom/interface/portfolio.pm 2006/07/19 21:58:16 1.139 +++ loncom/interface/portfolio.pm 2007/06/11 20:59:17 1.182 @@ -1,7 +1,7 @@ # The LearningOnline Network # portfolio browser # -# $Id: portfolio.pm,v 1.139 2006/07/19 21:58:16 albertel Exp $ +# $Id: portfolio.pm,v 1.182 2007/06/11 20:59:17 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -66,12 +66,15 @@ sub group_form_data { # receives a file name and path stub from username/userfiles/portfolio/ # returns an anchor tag consisting encoding filename and currentpath sub make_anchor { - my ($url, $filename, $current_path, $current_mode, $field_name, - $continue_select) = @_; - if ($continue_select ne 'true') {$continue_select = 'false'}; - my $anchor = ''; + $anchor .= '">'.$inner_text.''; return $anchor; } @@ -92,6 +95,12 @@ sub display_common { 'createdir_label' => 'Create subdirectory in current directory:'); my $escuri = &HTML::Entities::encode($r->uri,'&<>"'); + my $help_fileupload = &Apache::loncommon::help_open_topic('Portfolio AddFiles'); + my $help_createdir = &Apache::loncommon::help_open_topic('Portfolio CreateDirectory'); + + # FIXME: This line should be deleted once Portfolio uses breadcrumbs + $r->print(&Apache::loncommon::help_open_topic('Portfolio About', 'Help on the portfolio')); + $r->print(<<"TABLE");
'.&mt('Roles').' | '.&mt('[_1] status',$type).' | '.&mt('Sections').' | '.&mt($grouptitle).' |
---|---|---|---|
'.&mt('Roles').' | '.&mt('[_1] status',$type).' | '.&mt('Sections').' | '.&mt('Groups').' |
---|---|---|---|
Completed upload of the file. This file contained references to other files. You can upload these now:
"); + $r->print(&Apache::londocs::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 listing',$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'})); + + $env{'form.embedded_orig_'.$i} = + &unescape($env{'form.embedded_orig_'.$i}); + my ($path,$fname) = + ($env{'form.embedded_orig_'.$i} =~ m{(.*/)([^/]*)}); + $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(''.'An error occurred ('.$result. + ') while trying to upload '.&display_file($path,$fname).'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(); @@ -1539,24 +1890,35 @@ sub lock_info { $file_name = &prepend_group($file_name); if (defined($file_name) && defined($$current_permissions{$file_name})) { foreach my $array_item (@{$$current_permissions{$file_name}}) { - if (ref($array_item) eq 'ARRAY') { - my $filetext; - if (defined($group)) { - $filetext = ''.$env{'form.lockinfo'}. - ' (group: '.$group.')'; - } else { - $filetext = ''.$file_name.''; - } - $r->print(&mt('[_1] was submitted in response to problem: ', - $filetext). - ''.&Apache::lonnet::gettitle($$array_item[0]). - '