--- loncom/interface/portfolio.pm 2009/10/23 09:33:45 1.216
+++ loncom/interface/portfolio.pm 2010/10/29 23:19:54 1.228
@@ -1,7 +1,7 @@
# The LearningOnline Network
# portfolio browser
#
-# $Id: portfolio.pm,v 1.216 2009/10/23 09:33:45 bisitz Exp $
+# $Id: portfolio.pm,v 1.228 2010/10/29 23:19:54 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -38,7 +38,7 @@ use Apache::lonnet;
use Apache::longroup;
use Apache::lonhtmlcommon;
use HTML::Entities;
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
sub group_args {
my $output;
@@ -223,7 +223,7 @@ sub display_usage {
'
'."\n".
' '."\n".
' ';
- return $disk_meter;
+ return &Apache::loncommon::head_subbox($disk_meter);
}
sub display_directory_line {
@@ -287,7 +287,6 @@ sub display_directory {
my ($r,$url,$current_path,$is_empty,$dir_list,$group,$can_upload,
$can_modify,$can_delete,$can_setacl)=@_;
my $iconpath= $r->dir_config('lonIconsURL') . "/";
- my $display_out;
my $select_mode;
my $checked_files;
my $port_path = &get_port_path();
@@ -304,30 +303,17 @@ sub display_directory {
my %access_controls = &Apache::lonnet::get_access_controls($current_permissions,$group);
my $now = time;
if ($env{"form.mode"} eq 'selectfile') {
- &select_files($r);
- $checked_files =&Apache::lonnet::files_in_path($uname,$env{'form.currentpath'});
- $select_mode = 'true';
- }
- if ($is_empty && ($current_path ne '/') && $can_delete) {
- $display_out = '';
-
- $r->print($display_out);
- return;
+ &select_files($r);
+ $checked_files =&Apache::lonnet::files_in_path($uname,$env{'form.currentpath'});
+ $select_mode = 'true';
}
if ($select_mode eq 'true') {
$r->print(''
+ );
+ # Delete button
+ $r->print(
+ ''
+ );
+ # Directory is empty, so nothing else to display
+ return;
+ }
+
$r->print("\n".&group_form_data()."\n");
my $href_location="/uploaded/$udom/$uname/$port_path".$current_path;
@@ -453,8 +477,7 @@ sub display_directory {
$line .= '';
}
if ($can_modify) {
- my $cat='';
-# src="'.#&Apache::loncommon::lonhttpdurl('/res/adm/pages/catalog.gif').'" />';
+ my $cat='';
my %anchor_fields = (
'rename' => $filename,
currentpath => $current_path
@@ -881,7 +904,7 @@ sub display_access {
sub explain_conditionals {
return
&mt('Conditional files are accessible to logged-in users with accounts in the LON-CAPA network, who satisfy the conditions you set.').' '."\n".
- &mt('The conditions can include affiliation with a particular course, or a user account in a specific domain.').' '."\n".
+ &mt('The conditions can include affiliation with a particular course or community, or a user account in a specific domain.').' '."\n".
&mt('Alternatively access can be granted to people with specific LON-CAPA usernames and domains.');
}
@@ -922,7 +945,7 @@ sub build_access_summary {
guest => 'Passphrase-protected',
domains => 'Conditional: domain-based',
users => 'Conditional: user-based',
- course => 'Conditional: course-based',
+ course => 'Conditional: course/community-based',
);
my @allscopes = ('public','guest','domains','users','course');
foreach my $scope (@allscopes) {
@@ -947,11 +970,16 @@ sub build_access_summary {
}
}
$r->print('
'.&mt($scope_desc{$scope}));
+ my $crstype;
if ($scope eq 'course') {
if ($chg ne 'delete') {
my $cid = $content->{'domain'}.'_'.$content->{'number'};
my %course_description = &Apache::lonnet::coursedescription($cid);
$r->print(' ('.$course_description{'description'}.')');
+ $crstype = 'Course';
+ if ($course_description{'type'} ne '') {
+ $crstype = $course_description{'type'};
+ }
}
}
$r->print('
'.&mt('Start: ').$showstart.
@@ -971,8 +999,6 @@ sub build_access_summary {
foreach my $item ('role','access','section','group') {
$r->print('
');
if ($item eq 'role') {
- my $ucscope = $scope;
- $ucscope =~ s/^(\w)/uc($1)/e;
my $role_output;
foreach my $role (@{$content->{'roles'}{$id}{$item}}) {
if ($role eq 'all') {
@@ -980,7 +1006,7 @@ sub build_access_summary {
} elsif ($role =~ /^cr/) {
$role_output .= (split('/',$role))[3].',';
} else {
- $role_output .= &Apache::lonnet::plaintext($role,$ucscope).',';
+ $role_output .= &Apache::lonnet::plaintext($role,$crstype).',';
}
}
$role_output =~ s/,$//;
@@ -1106,16 +1132,22 @@ sub update_access {
my $totalnew = 0;
my $status = 'new';
my ($firstitem,$lastitem);
- foreach my $newitem ('course','domains','users') {
+ my @types = ('course','domains','users');
+ foreach my $newitem (@types) {
$allnew += $env{'form.new'.$newitem};
}
if ($allnew > 0) {
my $now = time;
my $then = $now + (60*60*24*180); # six months approx.
&open_form($r,$url);
- foreach my $newitem ('course','domains','users') {
+ my %showtypes = &Apache::lonlocal::texthash (
+ course => 'course/community',
+ domains => 'domain',
+ users => 'user',
+ );
+ foreach my $newitem (@types) {
if ($env{'form.new'.$newitem} > 0) {
- $r->print(' '.&mt('Add new [_1]-based access control for portfolio file: [_2]',&mt($newitem),$env{'form.currentpath'}.$env{'form.selectfile'}).'
');
+ $r->print(' '.&mt('Add new [_1]-based[_2] access control for portfolio file: [_3]',''.$showtypes{$newitem},'',''.$env{'form.currentpath'}.$env{'form.selectfile'}.'').'
');
$firstitem = $totalnew;
$lastitem = $totalnew + $env{'form.new'.$newitem};
$totalnew = $lastitem;
@@ -1358,7 +1390,7 @@ sub standard_settings {
&build_access_summary($r,$count,$chg,%conditionals);
$r->print(&Apache::loncommon::end_data_table());
} else {
- $r->print(&make_anchor($url,\%anchor_fields,&mt('Add conditional access')).' '.&mt('based on domain, username, or course affiliation.'));
+ $r->print(&make_anchor($url,\%anchor_fields,&mt('Add conditional access')).' '.&mt('based on domain, username, or course/community affiliation.'));
}
}
@@ -1392,10 +1424,12 @@ sub acl_status {
sub access_element {
my ($r,$type,$acl_count,$items,$access_controls,$now,$then) = @_;
- my $title = $type;
- $title =~ s/s$//;
- $title =~ s/^(\w)/uc($1)/e;
- $r->print('