--- loncom/interface/portfolio.pm 2006/07/18 02:20:19 1.135
+++ loncom/interface/portfolio.pm 2008/11/17 17:04:20 1.196
@@ -1,7 +1,7 @@
# The LearningOnline Network
# portfolio browser
#
-# $Id: portfolio.pm,v 1.135 2006/07/18 02:20:19 banghart Exp $
+# $Id: portfolio.pm,v 1.196 2008/11/17 17:04:20 schafran Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -40,29 +40,52 @@ use Apache::lonhtmlcommon;
use HTML::Entities;
use LONCAPA;
+sub group_args {
+ my $output;
+ if (defined($env{'form.group'})) {
+ $output .= '&group='.$env{'form.group'};
+ if (defined($env{'form.ref'})) {
+ $output .= '&ref='.$env{'form.ref'};
+ }
+ }
+ return $output;
+}
+
+sub group_form_data {
+ my $output;
+ if (defined($env{'form.group'})) {
+ $output = '';
+ if (exists($env{'form.ref'})) {
+ $output .= '';
+ }
+ }
+ return $output;
+}
+
# 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,$group) = @_;
- if ($continue_select ne 'true') {$continue_select = 'false'};
- my $anchor = ''.$filename.'';
+ my ($url, $anchor_fields, $inner_text) = @_;
+ if ($$anchor_fields{'continue'} ne 'true') {$$anchor_fields{'continue'} = 'false'};
+ my $anchor = ''.$inner_text.'';
return $anchor;
}
+
my $dirptr=16384;
sub display_common {
- my ($r,$url,$current_path,$is_empty,$dir_list,$group,$can_upload)=@_;
- my $namespace = &get_namespace($group);
- my $port_path = &get_port_path($group);
+ my ($r,$url,$current_path,$is_empty,$dir_list,$can_upload)=@_;
+ my $namespace = &get_namespace();
+ my $port_path = &get_port_path();
if ($can_upload) {
- my $groupitem;
- if (defined($group)) {
- $groupitem = '';
- }
+ my $groupitem = &group_form_data();
+
my $iconpath= $r->dir_config('lonIconsURL') . "/";
my %text=&Apache::lonlocal::texthash(
'upload' => 'Upload',
@@ -70,8 +93,27 @@ sub display_common {
'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,'&<>"');
+ 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', &mt('Help on the portfolio')));
+
+ my $parse_check;
+ if (!&suppress_embed_prompt()) {
+ $parse_check = <<"END";
+
+
+
+
+END
+ }
$r->print(<<"TABLE");
'); - $r->print(' | '.$$version_flag{$filename}.''. - $filename.' | '); - $r->print(''.$size.' | '); - $r->print(''.&Apache::lonlocal::locallocaltime($mtime).' | '); - if ($select_mode ne 'true') { - $r->print(''. - &mt($curr_access).' '); - $r->print(''.$access_admin_text.' | '); - } - $r->print('|||||
'); + $r->print(' | '.$version_flag.' | '); + } else { # this is a graded or handed back file + my ($user,$domain) = &get_name_dom($env{'form.group'}); + my $permissions_hash = &Apache::lonnet::get_portfile_permissions($domain,$user); + if (defined($$permissions_hash{$fullpath})) { + foreach my $array_item (@{$$permissions_hash{$fullpath}}) { + if (ref($array_item) eq 'ARRAY') { + if ($$array_item[-1] eq 'handback') { + $lock_info = 'Handback'; + } elsif ($$array_item[-1] eq 'graded') { + $lock_info = 'Graded'; + } + } + } + } + if ($lock_info) { + my %anchor_fields = ('lockinfo' => $fullpath); + if ($versions) { # hold the folder open + my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($fullpath); + $fname =~ s|^/||; + $anchor_fields{'showversions'} = $fname.'.'.$extension; + } + $lock_info = &make_anchor(undef,\%anchor_fields,$lock_info); + } + $r->print(''.$lock_info.' | '); + } + # $r->print(''.$$version_flag{$filename}.' | '); + $r->print(' | '.&make_anchor($href_location.$filename,undef,$filename).' | '); + $r->print(''.$size.' | '); + $r->print(''.&Apache::lonlocal::locallocaltime($mtime).' | '); + if ($select_mode ne 'true') { + $r->print(''. + &mt($curr_access).' '); + my %anchor_fields = ( + 'access' => $filename, + 'currentpath' => $current_path + ); + $r->print(&make_anchor($url, \%anchor_fields, $access_admin_text).' | '); + } + $r->print('
'.&mt('Roles').' | '.&mt('[_1] status',$type).' | '.&mt('Sections').' | '.&mt($grouptitle).' |
---|---|---|---|
'.&mt('Roles').' | '.&mt('[_1] status',$type).' | '.&mt('Sections').' | '.&mt('Groups').' |
---|---|---|---|
".&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).'
'); + } + } else { + $r->print(&done(undef,$url)); + } + } } sub lock_info { @@ -1537,32 +1877,43 @@ sub lock_info { my $current_permissions = &Apache::lonnet::get_portfile_permissions($udom, $uname); my $file_name = $env{'form.lockinfo'}; - $file_name = &prepend_group($file_name,$group); + $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]). - '