Diff for /loncom/interface/portfolio.pm between versions 1.256 and 1.264

version 1.256, 2015/06/18 20:19:06 version 1.264, 2021/04/29 16:18:58
Line 121  END Line 121  END
                  .'<fieldset>'                   .'<fieldset>'
                  .'<legend>'.$lt{'upload_label'}.'</legend>'                   .'<legend>'.$lt{'upload_label'}.'</legend>'
                  .$groupitem                    .$groupitem 
                  .'<input name="uploaddoc" type="file" class="flUpload" />'                   .'<input name="uploaddoc" type="file" class="LC_flUpload" />'
                  .'<input type="hidden" id="free_space" value="'.$free_space.'" />'                   .'<input type="hidden" id="LC_free_space" value="'.$free_space.'" />'
                  .'<input type="hidden" name="currentpath" value="'.$current_path.'" />'                   .'<input type="hidden" name="currentpath" value="'.$current_path.'" />'
                  .'<input type="hidden" name="action" value="'.$env{"form.action"}.'" />'                   .'<input type="hidden" name="action" value="'.$env{"form.action"}.'" />'
                  .'<input type="hidden" name="symb" value="'.$env{"form.symb"}.'" />'                   .'<input type="hidden" name="symb" value="'.$env{"form.symb"}.'" />'
Line 203  sub display_portfolio_usage { Line 203  sub display_portfolio_usage {
                     .$helpitem                      .$helpitem
                     .'</div>'                      .'</div>'
                     .'<div>'                      .'<div>'
                     .&Apache::lonhtmlcommon::display_usage($current_disk_usage,$disk_quota)                      .&Apache::lonhtmlcommon::display_usage($current_disk_usage,
                                                              $disk_quota,'portfolio')
                     .'</div>');                      .'</div>');
 }  }
   
Line 908  sub display_access { Line 909  sub display_access {
         $info .= '</li><li>'.&mt('Passphrase-protected files do not require log-in, but will require the viewer to enter the passphrase you set.');          $info .= '</li><li>'.&mt('Passphrase-protected files do not require log-in, but will require the viewer to enter the passphrase you set.');
         $info .= '</li><li>'.&explain_conditionals();          $info .= '</li><li>'.&explain_conditionals();
         $info .= '</li></ul>'.          $info .= '</li></ul>'.
                   &mt('A listing of files viewable without log-in is available at: ')."<a href=\"/adm/$udom/$uname/aboutme/portfolio\">".&Apache::lonnet::absolute_url($ENV{'SERVER_NAME'})."/adm/$udom/$uname/aboutme/portfolio</a>.<br />";                    &mt('A listing of files viewable without log-in is available at: ')."<a href=\"/adm/$udom/$uname/aboutme/portfolio\">".&Apache::lonnet::absolute_url()."/adm/$udom/$uname/aboutme/portfolio</a>.<br />";
         if ($group eq '') {          if ($group eq '') {
             $info .= &mt("For logged in users a 'Display file listing' link will also appear (when there are viewable files) on your personal information page:");              $info .= &mt("For logged in users a 'Display file listing' link will also appear (when there are viewable files) on your personal information page:");
         } else {          } else {
             $info .= &mt("For logged in users a 'Display file listing' link will also appear (when there are viewable files) on the course information page:");              $info .= &mt("For logged in users a 'Display file listing' link will also appear (when there are viewable files) on the course information page:");
         }          }
         $info .= "<br /><a href=\"/adm/$udom/$uname/aboutme\">".&Apache::lonnet::absolute_url($ENV{'SERVER_NAME'})."/adm/$udom/$uname/aboutme</a><br />";          $info .= "<br /><a href=\"/adm/$udom/$uname/aboutme\">".&Apache::lonnet::absolute_url()."/adm/$udom/$uname/aboutme</a><br />";
         if ($group ne '') {          if ($group ne '') {
             $info .= &mt("Users with course editing rights may add a 'Group Portfolio' item using the Course Editor (Collaboration tab), to provide access to viewable group portfolio files.").'<br />';              $info .= &mt("Users with course editing rights may add a 'Group Portfolio' item using the Course Editor (Collaboration tab), to provide access to viewable group portfolio files.").'<br />';
         }          }
Line 1072  sub build_access_summary { Line 1073  sub build_access_summary {
                     $r->print(&mt('Users: ').$curr_user_list);                      $r->print(&mt('Users: ').$curr_user_list);
                 } elsif ($scope eq 'ip') {                  } elsif ($scope eq 'ip') {
                     my $curr_ips_list = &sort_ips($content->{'ip'});                      my $curr_ips_list = &sort_ips($content->{'ip'});
                     $r->print(&mt('IP(s): ').$curr_ips_list);                      $r->print(&mt('IP(s):').' '.$curr_ips_list);
                 } else {                  } else {
                     $r->print('&nbsp;');                      $r->print('&nbsp;');
                 }                  }
Line 2548  sub coursegrp_portfolio_header { Line 2549  sub coursegrp_portfolio_header {
     }      }
     &Apache::lonhtmlcommon::add_breadcrumb      &Apache::lonhtmlcommon::add_breadcrumb
         ({href=>"/adm/$cdom/$cnum/$env{'form.group'}/smppg?ref=$env{'form.ref'}",          ({href=>"/adm/$cdom/$cnum/$env{'form.group'}/smppg?ref=$env{'form.ref'}",
           text=>"$ucgpterm: $grp_desc",            text=>&mt('Group').": $grp_desc",
           title=>"Go to group's home page"},            title=>&mt("Go to group's home page"),
             no_mt=>1},
          {href=>"/adm/coursegrp_portfolio?".&group_args(),           {href=>"/adm/coursegrp_portfolio?".&group_args(),
           text=>"Group Portfolio",            text=>"Group Portfolio",
           title=>"Display group portfolio"});            title=>"Display group portfolio"});
     my $output = &Apache::lonhtmlcommon::breadcrumbs(      my $output = &Apache::lonhtmlcommon::breadcrumbs(
                          &mt('[_1] portfolio files - [_2]',$gpterm,$grp_desc));                           &mt('Group portfolio files - [_1]',$grp_desc),
                                                        undef,undef,undef,undef,1);
     return $output;      return $output;
 }  }
   
Line 2571  sub get_quota { Line 2574  sub get_quota {
     } else {      } else {
         $disk_quota = &Apache::loncommon::get_user_quota($env{'user.name'},          $disk_quota = &Apache::loncommon::get_user_quota($env{'user.name'},
                                     $env{'user.domain'}); #expressed in MB                                      $env{'user.domain'}); #expressed in MB
         $disk_quota = 1000 * $disk_quota; # convert from MB to kB          $disk_quota = 1024 * $disk_quota; # convert from MB to kB
     }      }
     return $disk_quota;      return $disk_quota;
 }  }
Line 2614  sub free_space { Line 2617  sub free_space {
     return $free_space;      return $free_space;
 }  }
   
   sub valid_container {
       my ($uname,$udom,$group) = @_;
       my $container_prefix;
       if ($group ne '') {
           $container_prefix = "/uploaded/$udom/$uname/groups/$group/portfolio";
       } else {
           $container_prefix = "/uploaded/$udom/$uname/portfolio";
       }
       if ($env{'form.currentpath'}) {
           $container_prefix .= $env{'form.currentpath'};
       } else {
           $container_prefix .= '/';
       }
       if ($env{'form.container'} =~ m{^\Q$container_prefix\E(.+)$}) {
           my $filename = $1;
           if ($filename eq &Apache::lonnet::clean_filename($filename)) {
               return 1;
           }
       }
       return;
   }
   
   sub invalid_parms {
       my ($r,$url,$currentpath) = @_;
       my $escpath = &HTML::Entities::encode($currentpath,'&<>"');
       my $rtnlink = '<a href="'.$url;
       if ($url =~ /\?/) {
           $rtnlink .= '&';
       } else {
           $rtnlink .= '?';
       }
       $rtnlink .= 'currentpath='.$escpath;
       $rtnlink .= '">'.&mt('Return to directory').'</a>';
       $r->print('<h3>'.&mt('Action disallowed').'</h3>');
       $r->print(&mt('Some of the data included with this request were invalid'));
       $r->print('<br />'.$rtnlink);
       return;
   }
   
 sub handler {  sub handler {
     # this handles file management      # this handles file management
     my $r = shift;      my $r = shift;
Line 2762  sub handler { Line 2804  sub handler {
             $r->print(&Apache::loncommon::end_page());              $r->print(&Apache::loncommon::end_page());
             return OK;              return OK;
         }          }
       }
       if (($env{'form.currentpath'}) && ($env{'form.currentpath'} ne '/')) {
           my $clean_currentpath = '/'.&Apache::loncommon::clean_path($env{'form.currentpath'}).'/';
           unless ($env{'form.currentpath'} eq $clean_currentpath) {
               &invalid_parms($r,$url);
               $r->print(&Apache::loncommon::end_page());
               return OK;
           }
       }
       if ($env{'form.container'}) {
           unless (&valid_container($uname,$udom,$group)) {
               &invalid_parms($r,$url,$env{'form.currentpath'});
               $r->print(&Apache::loncommon::end_page());
               return OK;
           }
     }      }
     if (($env{'form.storeupl'}) & (!$env{'form.uploaddoc.filename'})){      if (($env{'form.storeupl'}) & (!$env{'form.uploaddoc.filename'})){
     $r->print(      $r->print(

Removed from v.1.256  
changed lines
  Added in v.1.264


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>