Diff for /loncom/interface/portfolio.pm between versions 1.196.2.1 and 1.196.2.2

version 1.196.2.1, 2008/12/12 15:38:53 version 1.196.2.2, 2009/01/03 19:39:37
Line 80  sub make_anchor { Line 80  sub make_anchor {
   
 my $dirptr=16384;  my $dirptr=16384;
 sub display_common {  sub display_common {
     my ($r,$url,$current_path,$is_empty,$dir_list,$can_upload)=@_;      my ($r,$url,$current_path,$is_empty,$dir_list,$can_upload,$group)=@_;
     my $namespace = &get_namespace();      my $namespace = &get_namespace();
     my $port_path = &get_port_path();      my $port_path = &get_port_path();
     if ($can_upload) {      if ($can_upload) {
Line 99  sub display_common { Line 99  sub display_common {
         my $escuri = &HTML::Entities::encode($r->uri,'&<>"');          my $escuri = &HTML::Entities::encode($r->uri,'&<>"');
  my $help_fileupload = &Apache::loncommon::help_open_topic('Portfolio AddFiles');   my $help_fileupload = &Apache::loncommon::help_open_topic('Portfolio AddFiles');
  my $help_createdir = &Apache::loncommon::help_open_topic('Portfolio CreateDirectory');   my $help_createdir = &Apache::loncommon::help_open_topic('Portfolio CreateDirectory');
           my $help_portfolio = &Apache::loncommon::help_open_topic('Portfolio About', &mt('Help on the portfolio'));
  # FIXME: This line should be deleted once Portfolio uses breadcrumbs          $r->print(&display_usage($group));
  $r->print(&Apache::loncommon::help_open_topic('Portfolio About', &mt('Help on the portfolio')));  
   
         my $parse_check;          my $parse_check;
         if (!&suppress_embed_prompt()) {          if (!&suppress_embed_prompt()) {
             $parse_check = <<"END";              $parse_check = <<"END";
Line 114  sub display_common { Line 112  sub display_common {
         </span>          </span>
 END  END
         }          }
         $r->print(<<"TABLE");           $r->print(<<"TABLE");
   $help_portfolio
 <table id="LC_portfolio_actions">  <table id="LC_portfolio_actions">
   <tr id="LC_portfolio_upload">    <tr id="LC_portfolio_upload">
     <td class="LC_label">      <td class="LC_label">
Line 140  $parse_check Line 139  $parse_check
     </td>      </td>
     <td class="LC_value">      <td class="LC_value">
       <form method="post" action="$escuri">        <form method="post" action="$escuri">
         <input name="newdir" type="input" />$groupitem          <input name="newdir" type="text" />$groupitem
         <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="fieldname" value="$env{"form.fieldname"}" />          <input type="hidden" name="fieldname" value="$env{"form.fieldname"}" />
Line 185  TABLE Line 184  TABLE
     $r->print("</form>");      $r->print("</form>");
 }  }
   
   sub display_usage {
       my ($group) = @_;
       my $disk_quota = &get_quota($group);
       my $getpropath = 1;
       my $portfolio_root = &get_portfolio_root();
       my ($uname,$udom) = &get_name_dom($group);
       my $current_disk_usage =
            &Apache::lonnet::diskusage($udom,$uname,$portfolio_root,$getpropath);
       my $usage = $current_disk_usage/1000;
       my $quota = $disk_quota/1000;
       my $percent;
       if ($disk_quota == 0) {
           $percent = 100.0;
       } else {
           $percent = 100*($current_disk_usage/$disk_quota);
       }
       $usage = sprintf("%.2f",$usage);
       $quota = sprintf("%.2f",$quota);
       $percent = sprintf("%.0f",$percent);
       my ($color,$cssclass);
       if ($percent <= 60) {
           $color = '#00A000';
       } elsif ($percent > 60 && $percent < 90) {
           $color = '#FFD300';
           $cssclass = 'class="LC_warning"';
       } elsif( $percent >= 90) {
           $color = '#FF0000';
           $cssclass = 'class="LC_error"';
       }
       my $prog_width = $percent;
       if ($prog_width > 100) {
           $prog_width = 100;
       }
       my $disk_meter = '
     <div align="left" '.$cssclass.'>'.&mt('Currently using [_1] of the [_2] available.',$usage.' MB <span style="font-weight:bold;">('.$percent.'%)</span>',$quota.' MB')."\n".
   '   <div style="display:block; margin-top:5px; margin-bottom:5px; margin-left:0px; margin-right:0px; width:400px; border:1px solid #000000; height:10px;">'."\n".
   '    <div style="display:block; background-color:'.$color.'; width:'.$prog_width.'%; height:10px; color:#000000; margin:0px;"></div>'."\n".
   '   </div>'."\n".
   '  </div><br />';
       return $disk_meter;
   }
   
 sub display_directory_line {  sub display_directory_line {
     my ($r,$select_mode, $filename, $mtime, $size, $css_class,      my ($r,$select_mode, $filename, $mtime, $size, $css_class,
  $line, $access_controls, $curr_access, $now, $version_flag,   $line, $access_controls, $curr_access, $now, $version_flag,
Line 668  sub rename { Line 709  sub rename {
     } else {      } else {
         &open_form($r,$url);          &open_form($r,$url);
         $r->print('<p>'.&mt('Rename [_1] to [_2]?', &display_file()          $r->print('<p>'.&mt('Rename [_1] to [_2]?', &display_file()
                   , '<input name="filenewname" type="input" size="50" />').'</p>');                    , '<input name="filenewname" type="text" size="50" />').'</p>');
         &close_form($r,$url);          &close_form($r,$url);
     }      }
 }  }
Line 2216  sub handler { Line 2257  sub handler {
         $r->print(&Apache::loncommon::start_page($title));          $r->print(&Apache::loncommon::start_page($title));
     }      }
     $r->rflush();      $r->rflush();
     if (!&Apache::lonnet::usertools_access($uname,$udom,'portfolio')) {      if ($caller ne 'coursegrp_portfolio') {
         $r->print('<h2>'.&mt('No user portfolio available') .'</h2>'.          &Apache::lonhtmlcommon::clear_breadcrumbs();
                   &mt('This is a result of one of the following:').'<ul>'.          &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/portfolio",
                   '<li>'.&mt('The administrator of this domain has disabled portfolio functionality for this specific user.').'</li>'.                                                  text=>"Portfolio Manager"});
                   '<li>'.&mt('The domain has been configured to disable, by default, portfolio functionality for all users in the domain.').'</li>'.          if (!&Apache::lonnet::usertools_access($uname,$udom,'portfolio')) {
                   '</ul>');              $r->print(&Apache::lonhtmlcommon::breadcrumbs());
         $r->print(&Apache::loncommon::end_page());              $r->print('<h2>'.&mt('No user portfolio available') .'</h2>'.
         return OK;                        &mt('This is a result of one of the following:').'<ul>'.
                         '<li>'.&mt('The administrator of this domain has disabled portfolio functionality for this specific user.').'</li>'.
                         '<li>'.&mt('The domain has been configured to disable, by default, portfolio functionality for all users in the domain.').'</li>'.
                         '</ul>');
               $r->print(&Apache::loncommon::end_page());
               return OK;
           } else {
               $r->print(&Apache::lonhtmlcommon::breadcrumbs('Portfolio Manager'));
           }
     }      }
     my ($blocked,$blocktext) =       my ($blocked,$blocktext) = 
         &Apache::loncommon::blocking_status('port',$uname,$udom);          &Apache::loncommon::blocking_status('port',$uname,$udom);
Line 2360  sub handler { Line 2409  sub handler {
  # need to know if directory is empty so it can be removed if desired   # need to know if directory is empty so it can be removed if desired
  my $is_empty=(@dir_list == 2);   my $is_empty=(@dir_list == 2);
  &display_common($r,$url,$current_path,$is_empty,\@dir_list,   &display_common($r,$url,$current_path,$is_empty,\@dir_list,
  $can_upload);   $can_upload,$group);
         &display_directory($r,$url,$current_path,$is_empty,\@dir_list,$group,          &display_directory($r,$url,$current_path,$is_empty,\@dir_list,$group,
                            $can_upload,$can_modify,$can_delete,$can_setacl);                             $can_upload,$can_modify,$can_delete,$can_setacl);
  $r->print(&Apache::loncommon::end_page());   $r->print(&Apache::loncommon::end_page());

Removed from v.1.196.2.1  
changed lines
  Added in v.1.196.2.2


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