--- loncom/interface/portfolio.pm 2006/06/22 15:33:35 1.109
+++ loncom/interface/portfolio.pm 2008/11/28 16:10:20 1.197
@@ -1,3 +1,8 @@
+# The LearningOnline Network
+# portfolio browser
+#
+# $Id: portfolio.pm,v 1.197 2008/11/28 16:10:20 bisitz Exp $
+#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
@@ -31,118 +36,240 @@ use Apache::lonfeedback;
use Apache::lonlocal;
use Apache::lonnet;
use Apache::longroup;
-use lib '/home/httpd/lib/perl';
+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)=@_;
- my $groupitem;
- my $namespace = &get_namespace($group);
- my $port_path = &get_port_path($group);
- if (defined($group)) {
- $groupitem = '';
- }
- my $iconpath= $r->dir_config('lonIconsURL') . "/";
- my %text=&Apache::lonlocal::texthash('upload' => 'Upload',
+ 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 = &group_form_data();
+
+ my $iconpath= $r->dir_config('lonIconsURL') . "/";
+ my %text=&Apache::lonlocal::texthash(
+ 'upload' => 'Upload',
'upload_label' =>
'Upload file to current directory:',
'createdir' => 'Create Subdirectory',
'createdir_label' =>
- 'Create subdirectory in current directory:');
- $r->print(<<"TABLE");
-
');
+ $r->print('
'.&mt('Add a roles-based condition').
+ ' {'domain'}','$content->{'number'}',
+ '$uctype'".')" value="" />');
+ $newrole_id = $max_id;
+ } else {
+ $r->print('');
}
- $r->print(&Apache::loncommon::end_data_table_row());
+ $r->print(&add_course_role($num,$newrole_id));
+ $r->print('');
return;
}
+sub add_course_role {
+ my ($num,$max_id) = @_;
+ my $output;
+ $output .=''.
+ ''.
+ ''.
+ '';
+ return $output;
+}
+
sub domains_row {
my ($r,$status,$item,$all_doms,$access_controls,$now,$then) = @_;
- $r->print(&Apache::loncommon::start_data_table_row());
my ($num,$scope,$end,$start) = &set_identifiers($status,$item,$now,$then,
'domains');
- my $dom_select = ''.
+ my $dom_select = '';
$r->print(''.&actionbox($status,$num,$scope).' | '.$dom_select.
' | '.&dateboxes($num,$start,$end).' | ');
- $r->print(&Apache::loncommon::end_data_table_row());
- $r->print(&Apache::loncommon::start_data_table_row());
}
sub users_row {
my ($r,$status,$item,$access_controls,$now,$then) = @_;
- $r->print(&Apache::loncommon::start_data_table_row());
my ($num,$scope,$end,$start) = &set_identifiers($status,$item,$now,$then,
'users');
my $curr_user_list;
@@ -1096,28 +1559,32 @@ sub users_row {
$curr_user_list = &sort_users($content->{'users'});
}
$r->print(''.&actionbox($status,$num,$scope).' | '.&mt("Format for users' username:domain information:").' sparty:msu,illini:uiuc ... etc.
| '.&dateboxes($num,$start,$end).' | ');
- $r->print(&Apache::loncommon::end_data_table_row());
}
sub additional_item {
my ($type) = @_;
- my $output = &mt('Add new [_1] condition(s)?',$type).' '.&mt('Number to add: ').'';
+ my $output = &mt('Add new [_1] condition(s)?',&mt($type)).' '.&mt('Number to add: ').'';
return $output;
}
sub actionbox {
my ($status,$num,$scope) = @_;
- my $output = '
'.
''.&mt('Update');
}
- $output .= '';
+ $output .= '';
return $output;
}
@@ -1132,10 +1599,10 @@ 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').
- '';
+ '';
my $output = &mt('Start: ').$startdate.'
'.&mt('End: ').$enddate;
return $output;
@@ -1157,27 +1624,20 @@ sub set_identifiers {
}
sub role_selectors {
- my ($num,$role_id,$status,$type,$content,$caller) = @_;
+ my ($num,$role_id,$type,$content,$caller) = @_;
my ($output,$cdom,$cnum,$longid);
if ($caller eq 'display') {
$longid = '_'.$num.'_'.$role_id;
- if ($status eq 'new') {
- foreach my $item ('role','access','section','group') {
- $output .= ' | ';
- }
- return $output;
- } else {
- $cdom = $$content{'domain'};
- $cnum = $$content{'number'};
- }
+ $cdom = $$content{'domain'};
+ $cnum = $$content{'number'};
} elsif ($caller eq 'rolepicker') {
$cdom = $env{'form.cdom'};
$cnum = $env{'form.cnum'};
}
+ my $uctype = $type;
+ $uctype =~ s/^(\w)/uc($1)/e;
my ($sections,$groups,$allroles,$rolehash,$accesshash) =
- &Apache::loncommon::get_secgrprole_info($cdom,$cnum,1,$type);
+ &Apache::loncommon::get_secgrprole_info($cdom,$cnum,1,$uctype);
if (!@{$sections}) {
@{$sections} = ('none');
} else {
@@ -1207,7 +1667,7 @@ sub role_selectors {
'role' => $allroles,
'access' => \@allaccesses,
'section' => $sections,
- 'group' => $groups,
+ 'group' => $groups,
);
foreach my $item ('role','access','section','group') {
$output .= ' |