--- loncom/interface/portfolio.pm 2006/06/22 15:33:35 1.109 +++ loncom/interface/portfolio.pm 2006/06/22 18:33:58 1.115 @@ -31,7 +31,7 @@ use Apache::lonfeedback; use Apache::lonlocal; use Apache::lonnet; use Apache::longroup; -use lib '/home/httpd/lib/perl'; +use HTML::Entities; use LONCAPA; # receives a file name and path stub from username/userfiles/portfolio/ @@ -40,9 +40,9 @@ 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.''; return $anchor; @@ -63,38 +63,39 @@ sub display_common { 'createdir' => 'Create Subdirectory', 'createdir_label' => 'Create subdirectory in current directory:'); + my $escuri = &HTML::Entities::encode($r->uri,'&<>"'); $r->print(<<"TABLE"); - - - - - '); + $r->print('
- $text{'upload_label'} - $groupitem + + + + - - - - - - + + + + - - + + +
+ $text{'upload_label'} + $groupitem + -
- $text{'createdir_label'} - + +
+ $text{'createdir_label'} + +
$groupitem -
TABLE my @tree = split (/\//,$current_path); @@ -108,9 +109,9 @@ TABLE } $r->print(''); &Apache::lonhtmlcommon::store_recent($namespace,$current_path,$current_path); - $r->print('
'. &Apache::lonhtmlcommon::select_recent($namespace,'currentpath', @@ -153,13 +154,13 @@ sub display_directory { return; } if ($select_mode eq 'true') { + $r->print(''); $r->print(''. ''); - $r->print(''); } else { + $r->print(''); $r->print('
Select NameSizeLast Modified
'. ''); - $r->print(''); } if (defined($group)) { $r->print("\n".$groupitem."\n"); @@ -190,9 +191,9 @@ sub display_directory { if (($filename ne '.') && ($filename ne '..') && ($filename !~ /\.meta$/ ) && ($filename !~ /(.*)\.(\d+)\.([^\.]*)$/)) { if ($dirptr&$testdir) { if ($select_mode eq 'true'){ - $r->print(''); + $r->print(''); } else { - $r->print(''); + $r->print(''); } $r->print(''); $r->print(''); @@ -256,15 +257,15 @@ sub display_directory { } $curr_access = join('+ ',@allaccesses); } - $r->print(''); + $r->print(''); $r->print(''); $r->print(''); $r->print(''); - $r->print(''); + '">'.&mt('View/Change').''); $r->print(''); } } @@ -316,7 +317,7 @@ sub close_form { $group.'" />'); } $r->print('

'); - $r->print(' + $r->print('

'); @@ -547,11 +548,11 @@ sub update_access { my $updated_controls = $access_controls{$file_name}; my ($showstart,$showend); $r->print(&Apache::loncommon::start_data_table()); - $r->print(&Apache::loncommon::start_data_table_row()); + $r->print(&Apache::loncommon::start_data_table_header_row()); $r->print('

'); - $r->print(&Apache::loncommon::end_data_table_row()); + $r->print(&Apache::loncommon::end_data_table_header_row()); foreach my $chg (sort(keys(%processing))) { if (@{$processing{$chg}} > 0) { if ($chg eq 'delete') { @@ -693,7 +694,7 @@ sub update_access { &close_form($r,$url,$group); } else { $r->print('
'. + '&currentpath='.$env{'form.currentpath'}.'">'. &mt('Display all access settings for this file').''); } return; @@ -830,9 +831,9 @@ sub access_setting_table { $r->print('
Actions NameSizeLast ModifiedCurrent Access Status
'.&mt('open folder').'
'.&mt('closed folder').'Go to ...'.&make_anchor($url,$filename.'/',$current_path.$filename.'/',$env{'form.mode'},$env{"form.fieldname"},$env{'form.continue'},$group).''. $filename.''.$size.''.&Apache::lonlocal::locallocaltime($mtime).''.&mt($curr_access).'   '. + $r->print(''.&mt($curr_access).'   '. ''.&mt('View/Change').'
'.&mt('Type of change').''. &mt('Access control').''.&mt('Dates available'). ''.&mt('Additional information').'
'); - $r->print(&Apache::loncommon::end_data_table_row()); + $r->print(&Apache::loncommon::end_data_table_header_row()); $r->print(&Apache::loncommon::start_data_table_row()); if ($public) { $r->print(''); - $r->print(&Apache::loncommon::end_data_table_row()); + $r->print(&Apache::loncommon::end_data_table_header_row()); $r->print(&Apache::loncommon::start_data_table_row()); my $passwd; if ($guest) { @@ -926,8 +927,8 @@ sub display_access_row { my $uctype = $type; $uctype =~ s/^(\w)/uc($1)/e; $r->print(&Apache::loncommon::start_data_table()); - $r->print(&Apache::loncommon::start_data_table_row()); - $r->print(''); if (($type eq 'course') || ($type eq 'group')) { $r->print(''); + $r->print(&Apache::loncommon::end_data_table_row()); } $r->print(&Apache::loncommon::end_data_table()); } else { @@ -964,15 +967,8 @@ sub display_access_row { return; } -sub course_row { - my ($r,$status,$type,$item,$access_controls,$tablecolor,$now,$then) = @_; - my %content; - my $defdom = $env{'user.domain'}; - if ($status eq 'old') { - $defdom = $$access_controls{$item}{'domain'}; - } - $r->print(&Apache::loncommon::coursebrowser_javascript($defdom)); - $r->print(qq| +sub course_js { + return qq| -|); - $r->print(&Apache::loncommon::start_data_table_row()); +|; +} + +sub course_row { + my ($r,$status,$type,$item,$access_controls,$tablecolor,$now,$then) = @_; + my $content; + my $defdom = $env{'user.domain'}; + if ($status eq 'old') { + $content = $$access_controls{$item}; + $defdom = $content->{'domain'}; + } + my $js = &Apache::loncommon::coursebrowser_javascript($defdom) + .&course_js(); my $crsgrptext = 'Groups'; if ($type eq 'group') { $crsgrptext = 'Teams'; } my ($num,$scope,$end,$start) = &set_identifiers($status,$item,$now,$then, $type); - $r->print(''); + $r->print(''); if ($status eq 'old') { - my $cid = $content{'domain'}.'_'.$content{'number'}; + my $cid = $content->{'domain'}.'_'.$content->{'number'}; my %course_description = &Apache::lonnet::coursedescription($cid); - $r->print(''); + $r->print(''); } elsif ($status eq 'new') { my $uctype = $type; $uctype =~ s/^(\w)/uc($1)/e; @@ -1036,33 +1043,30 @@ function getIndex(name,value) { &mt($crsgrptext).''); if ($status eq 'old') { my $max_id = 0; - foreach my $role_id (sort(keys(%{$content{'roles'}}))) { + foreach my $role_id (sort(keys(%{$content->{'roles'}}))) { if ($role_id > $max_id) { $max_id = $role_id; } $max_id ++; - my $role_selects = &role_selectors($num,$role_id,$status,$type,\%content,'display'); - $r->print(''.$role_selects.''); + my $role_selects = &role_selectors($num,$role_id,$status,$type,$content,'display'); + $r->print(''.$role_selects.''); } - $r->print('
'); $r->print('

'.&mt('Public access:').' '.$publictext.'

'); $r->print(&Apache::loncommon::start_data_table()); - $r->print(&Apache::loncommon::start_data_table_row()); + $r->print(&Apache::loncommon::start_data_table_header_row()); $r->print('
'.&mt('Action').''.&mt('Dates available').''.&actionbox('old',$publicnum,'public').''. @@ -846,10 +847,10 @@ sub access_setting_table { $r->print(' '); $r->print('

'.&mt('Password-protected access:').' '.$guesttext.'

'); $r->print(&Apache::loncommon::start_data_table()); - $r->print(&Apache::loncommon::start_data_table_row()); + $r->print(&Apache::loncommon::start_data_table_header_row()); $r->print('
'.&mt('Action').''.&mt('Dates available'). ''. &mt('Password').''.&mt('Action?').''.&mt($uctype).''. + $r->print(&Apache::loncommon::start_data_table_header_row()); + $r->print(''.&mt('Action?').''.&mt($uctype).''. &mt('Dates available').''.&mt('Allowed [_1] member affiliations',$type). @@ -938,7 +939,8 @@ sub display_access_row { } elsif ($type eq 'domains') { @all_doms = &Apache::loncommon::get_domains(); } - $r->print(&Apache::loncommon::end_data_table_row()); + $r->print(&Apache::loncommon::end_data_table_header_row()); + $r->print(&Apache::loncommon::start_data_table_row()); foreach my $key (@{$items}) { if (($type eq 'course') || ($type eq 'group')) { &course_row($r,$status,$type,$key,$access_controls, @@ -951,10 +953,11 @@ sub display_access_row { } } $r->print(&Apache::loncommon::end_data_table_row()); - $r->print(&Apache::loncommon::start_data_table_row()); if ($status eq 'old') { + $r->print(&Apache::loncommon::start_data_table_row()); $r->print(''.&additional_item($type). ''.&actionbox($status,$num,$scope).''.$js.&actionbox($status,$num,$scope).''.$course_description{'description'}.''.$course_description{'description'}.'



'.&mt('Add a roles-based condition').' 

'.&mt('Add a roles-based condition').' {'domain'}','$content->{'number'}','Course'".')" value="'.$max_id.'" />'); } elsif ($status eq 'new') { my $role_id = 1; my $role_selects = &role_selectors($num,$role_id,$status,$type,undef,'display'); $r->print(''.&mt('Add').''.$role_selects); $r->print(''); } - $r->print(&Apache::loncommon::end_data_table_row()); return; } 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 = ''. ' '; - $r->print(&Apache::loncommon::start_data_table_row()); if ($status eq 'old') { my $content = $$access_controls{$item}; foreach my $dom (@{$all_doms}) { @@ -1079,15 +1083,13 @@ sub domains_row { $dom_select .= ''; } } + $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,7 +1098,6 @@ 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 { @@ -1107,17 +1108,17 @@ sub additional_item { sub actionbox { my ($status,$num,$scope) = @_; - my $output = ''. + '" />'.&mt('Delete').'
'. '
'; + $output .= ''; return $output; } @@ -1132,10 +1133,10 @@ sub dateboxes { undef,undef,1); my $enddate = &Apache::lonhtmlcommon::date_setter('portform', 'enddate_'.$num,$end,undef,undef,undef,1,undef, - undef,undef,1). '  '; + ''; my $output = &mt('Start: ').$startdate.'
'.&mt('End: ').$enddate; return $output; @@ -1278,7 +1279,7 @@ sub select_files { $java_files.=','; } my $javascript =(< +