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

version 1.196.2.2, 2009/01/03 19:39:37 version 1.197, 2008/11/28 16:10:20
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,$group)=@_;      my ($r,$url,$current_path,$is_empty,$dir_list,$can_upload)=@_;
     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'));  
         $r->print(&display_usage($group));   # FIXME: This line should be deleted once Portfolio uses breadcrumbs
    $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 112  sub display_common { Line 114  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 139  $parse_check Line 140  $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="text" />$groupitem          <input name="newdir" type="input" />$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 184  TABLE Line 185  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,
  $href_location, $url, $current_path, $access_admin_text, $versions)=@_;   $href_location, $url, $current_path, $access_admin_text, $versions)=@_;
   
     my $fullpath =  &prepend_group($current_path.$filename);      my $fullpath =  &prepend_group($current_path.$filename);
     $r->print('<tr class="'.$css_class.'">');      $r->print(&Apache::loncommon::start_data_table_row());
     $r->print($line); # contains first two cells of table      $r->print($line); # contains first two cells of table
     my $lock_info;      my $lock_info;
     if ($version_flag) { # versioned can't be versioned, so TRUE when root file      if ($version_flag) { # versioned can't be versioned, so TRUE when root file
Line 268  sub display_directory_line { Line 227  sub display_directory_line {
     $r->print('<td>'.$size.'</td>');      $r->print('<td>'.$size.'</td>');
     $r->print('<td>'.&Apache::lonlocal::locallocaltime($mtime).'</td>');      $r->print('<td>'.&Apache::lonlocal::locallocaltime($mtime).'</td>');
     if ($select_mode ne 'true') {      if ($select_mode ne 'true') {
  $r->print('<td><span class="LC_nobreak">'.          $r->print('<td class="'.$css_class.'">&nbsp;&nbsp;</td>'); # Display status
   &mt($curr_access).'&nbsp;&nbsp;&nbsp;');          $r->print('<td><span class="LC_nobreak">'
                    .&mt($curr_access).'&nbsp;&nbsp;&nbsp;'
          );
         my %anchor_fields = (          my %anchor_fields = (
             'access' => $filename,              'access' => $filename,
             'currentpath' => $current_path              'currentpath' => $current_path
         );          );
  $r->print(&make_anchor($url, \%anchor_fields, $access_admin_text).'</span></td>');   $r->print(&make_anchor($url, \%anchor_fields, $access_admin_text).'</span></td>');
       } else {
           $r->print('<td class="'.$css_class.'">&nbsp;&nbsp;</td>'); # Display status
     }      }
     $r->print('</tr>'.$/);      $r->print(&Apache::loncommon::end_data_table_row().$/);
 }  }
   
 sub display_directory {  sub display_directory {
Line 318  sub display_directory { Line 281  sub display_directory {
     }      }
     if ($select_mode eq 'true') {      if ($select_mode eq 'true') {
         $r->print('<form method="post" name="checkselect" action="'.$url.'">');          $r->print('<form method="post" name="checkselect" action="'.$url.'">');
         $r->print('<table id="LC_browser">'.          $r->print(&Apache::loncommon::start_data_table()
             '<tr><th>Select</th><th>&nbsp;</th><th>&nbsp;</th><th>Name</th><th>Size</th><th>Last Modified</th></tr>');                   .&Apache::loncommon::start_data_table_header_row()
                    .'<th>'.&mt('Select').'</th>'
                    .'<th>&nbsp;</th><th>&nbsp;</th>'
                    .'<th>'.&mt('Name').'</th>'
                    .'<th>'.&mt('Size').'</th>'
                    .'<th>'.&mt('Last Modified').'</th>'
                    .'<th>&nbsp;</th>'
                    .&Apache::loncommon::end_data_table_header_row()
           );
     } else {      } else {
         $r->print('<form method="post" action="'.$url.'">');          $r->print('<form method="post" action="'.$url.'">');
  $r->print(&Apache::loncommon::help_open_topic('Portfolio FileList',   $r->print(&Apache::loncommon::help_open_topic('Portfolio FileList',
       &mt('Using the portfolio file list')));        &mt('Using the portfolio file list')));
         $r->print('<table id="LC_browser">'.          $r->print(&Apache::loncommon::start_data_table()
                   '<tr>'                   .&Apache::loncommon::start_data_table_header_row()
                  .'<th colspan="2">'.&mt('Actions'). &Apache::loncommon::help_open_topic('Portfolio FileAction').'</th>'                   .'<th colspan="2">'.&mt('Actions'). &Apache::loncommon::help_open_topic('Portfolio FileAction').'</th>'
                  .'<th>&nbsp;</th><th>&nbsp;</th>'                   .'<th>&nbsp;</th><th>&nbsp;</th>'
                  .'<th>'.&mt('Name').&Apache::loncommon::help_open_topic('Portfolio OpenFile').'</th>'                   .'<th>'.&mt('Name').&Apache::loncommon::help_open_topic('Portfolio OpenFile').'</th>'
                  .'<th>'.&mt('Size').'</th>'                   .'<th>'.&mt('Size').'</th>'
                  .'<th>'.&mt('Last Modified').'</th>'                   .'<th>'.&mt('Last Modified').'</th>'
                    .'<th>&nbsp;</th>'
                  .'<th>'.&mt('Current Access Status').&Apache::loncommon::help_open_topic('Portfolio ShareFile').'</th>'                   .'<th>'.&mt('Current Access Status').&Apache::loncommon::help_open_topic('Portfolio ShareFile').'</th>'
                  .'</tr>');                   .&Apache::loncommon::end_data_table_header_row());
     }      }
     $r->print("\n".&group_form_data()."\n");      $r->print("\n".&group_form_data()."\n");
   
Line 390  sub display_directory { Line 362  sub display_directory {
            $version_flag = '&nbsp;';             $version_flag = '&nbsp;';
        }         }
             if ($dirptr&$testdir) {              if ($dirptr&$testdir) {
  my $colspan='colspan="2"';   my $colspan_folder='';
    my $colspan_fill='';
                 if ($select_mode eq 'true'){                  if ($select_mode eq 'true'){
     undef($colspan);                      $colspan_fill=' colspan="3"';
                   } else {
                       $colspan_folder=' colspan="2"';
                       $colspan_fill=' colspan="4"';
                 }                  }
  $r->print('<tr class="LC_browser_folder"><td '.$colspan.'><img alt="'.&mt('closed folder').'" src="'.$iconpath.'folder_closed.gif" /></td>');   $r->print('<tr class="LC_browser_folder">');
                 $r->print('<td>'.&mt('Go to ...').'</td>');                  $r->print('<td'.$colspan_folder.'><img alt="'.&mt('closed folder').'" src="'.$iconpath.'folder_closed.gif" /></td>'
                            .'<td>'.&mt('Go to ...').'</td>');
                 my %anchor_fields = (                  my %anchor_fields = (
                     'selectfile'    => $filename.'/',                      'selectfile'    => $filename.'/',
                     'currentpath'   => $current_path.$filename.'/',                      'currentpath'   => $current_path.$filename.'/',
Line 403  sub display_directory { Line 380  sub display_directory {
                     'fieldname'     => $env{"form.fieldname"},                      'fieldname'     => $env{"form.fieldname"},
                     'continue'      => $env{"form.continue"}                      'continue'      => $env{"form.continue"}
                 );                    );  
                 $r->print('<td>'.$version_flag.'</td><td>'.&make_anchor($url,\%anchor_fields,$filename.'/').'</td>');                   $r->print('<td>'.$version_flag.'</td>'
                            .'<td>'.&make_anchor($url,\%anchor_fields,$filename.'/').'</td>'); 
                   $r->print('<td'.$colspan_fill.'>&nbsp;</td>');
                 $r->print('</tr>');                   $r->print('</tr>'); 
             } else {              } else {
  my $css_class = 'LC_browser_file';   my $css_class = 'LC_browser_file';
Line 411  sub display_directory { Line 390  sub display_directory {
                 if ($select_mode eq 'true') {                  if ($select_mode eq 'true') {
                     $line='<td><input type="checkbox" name="checkfile" value="'.$filename.'"';                      $line='<td><input type="checkbox" name="checkfile" value="'.$filename.'"';
     if ($$checked_files{$filename} eq 'selected') {      if ($$checked_files{$filename} eq 'selected') {
                         $line.=" checked ";                          $line.=' checked="checked" ';
                     }                      }
     $line.=' /></td>';      $line.=' /></td>';
                 } else {                  } else {
Line 494  sub display_directory { Line 473  sub display_directory {
         }          }
     }      }
     if ($select_mode eq 'true') {      if ($select_mode eq 'true') {
         $r->print('</table>          $r->print(&Apache::loncommon::end_data_table().'
             <input type="hidden" name="continue" value="true" />              <input type="hidden" name="continue" value="true" />
             <input type="hidden" name="fieldname" value="'.$env{'form.fieldname'}.'" />              <input type="hidden" name="fieldname" value="'.$env{'form.fieldname'}.'" />
             <input type="hidden" name="mode" value="selectfile" />              <input type="hidden" name="mode" value="selectfile" />
Line 503  sub display_directory { Line 482  sub display_directory {
             <input type="hidden" name="currentpath" value="'.$current_path.'" />              <input type="hidden" name="currentpath" value="'.$current_path.'" />
         </form>');                  </form>');        
     } else {      } else {
         $r->print('</table>');          $r->print(&Apache::loncommon::end_data_table());
         if ($can_delete) {          if ($can_delete) {
             $r->print('              $r->print('
         <input type="submit" name="doit" value="'.&mt('Delete Selected').'" />'.          <input type="submit" name="doit" value="'.&mt('Delete Selected').'" />'.
Line 709  sub rename { Line 688  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="text" size="50" />').'</p>');                    , '<input name="filenewname" type="input" size="50" />').'</p>');
         &close_form($r,$url);          &close_form($r,$url);
     }      }
 }  }
Line 816  sub display_access { Line 795  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\">http://$ENV{'SERVER_NAME'}/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\">http://$ENV{'SERVER_NAME'}/adm/$udom/$uname/aboutme</a><br />";
         if ($group ne '') {          if ($group ne '') {
             $info .= &mt("Users with privileges to edit course contents may add a course information page to a course using the 'Course Info' button in DOCS").'<br />';              $info .= &mt("Users with privileges to edit course contents may add a course information page to a course using the 'Course Info' button in DOCS").'<br />';
         }          }
Line 1515  sub course_row { Line 1494  sub course_row {
                 }                  }
                 $max_id ++;                  $max_id ++;
                 my $role_selects = &role_selectors($num,$role_id,$type,$content,'display');                  my $role_selects = &role_selectors($num,$role_id,$type,$content,'display');
                 $r->print('<tr><td><span class="LC_nobreak"><label><input type="checkbox" name="delete_role_'.$num.'" value="'.$role_id.'" />'.&mt('Delete').'</label></span><br /><input type="hidden" name="preserve_role_'.$num.'" value="'.$role_id.'" /></td>'.$role_selects.'</tr>');                  $r->print('<tr><td><span style="white-space: nowrap"><label><input type="checkbox" name="delete_role_'.$num.'" value="'.$role_id.'" />'.&mt('Delete').'</label></span><br /><input type="hidden" name="preserve_role_'.$num.'" value="'.$role_id.'" /></td>'.$role_selects.'</tr>');
             }              }
             $r->print('</table>');              $r->print('</table>');
         }          }
Line 1590  sub additional_item { Line 1569  sub additional_item {
   
 sub actionbox {  sub actionbox {
     my ($status,$num,$scope) = @_;      my ($status,$num,$scope) = @_;
     my $output = '<span class="LC_nobreak"><label>';      my $output = '<span style="white-space: nowrap"><label>';
     if ($status eq 'new') {      if ($status eq 'new') {
         my $checkstate;          my $checkstate;
         if ($scope eq 'domains' || $scope eq 'users' || $scope eq 'course') {          if ($scope eq 'domains' || $scope eq 'users' || $scope eq 'course') {
Line 1601  sub actionbox { Line 1580  sub actionbox {
         &mt('Activate');          &mt('Activate');
     } else {      } else {
         $output .= '<input type="checkbox" name="delete" value="'.$num.          $output .= '<input type="checkbox" name="delete" value="'.$num.
                    '" />'.&mt('Delete').'</label></span><br /><span class="LC_nobreak">'.                     '" />'.&mt('Delete').'</label></span><br /><span style="white-space: nowrap">'.
                    '<label><input type="checkbox" name="update" value="'.                     '<label><input type="checkbox" name="update" value="'.
                    $num.'" />'.&mt('Update');                     $num.'" />'.&mt('Update');
     }      }
Line 1620  sub dateboxes { Line 1599  sub dateboxes {
                             undef,undef,1);                              undef,undef,1);
     my $enddate = &Apache::lonhtmlcommon::date_setter('portform',      my $enddate = &Apache::lonhtmlcommon::date_setter('portform',
                                'enddate_'.$num,$end,undef,undef,undef,1,undef,                                 'enddate_'.$num,$end,undef,undef,undef,1,undef,
                                 undef,undef,1). '&nbsp;&nbsp;<span class="LC_nobreak"><label>'.                                  undef,undef,1). '&nbsp;&nbsp;<span style="white-space: nowrap"><label>'.
                                 '<input type="checkbox" name="noend_'.                                  '<input type="checkbox" name="noend_'.
                                 $num.'" '.$noend.' />'.&mt('No end date').                                  $num.'" '.$noend.' />'.&mt('No end date').
                                 '</label></span>';                                  '</label></span>';
Line 2257  sub handler { Line 2236  sub handler {
         $r->print(&Apache::loncommon::start_page($title));          $r->print(&Apache::loncommon::start_page($title));
     }      }
     $r->rflush();      $r->rflush();
     if ($caller ne 'coursegrp_portfolio') {  
         &Apache::lonhtmlcommon::clear_breadcrumbs();  
         &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/portfolio",  
                                                 text=>"Portfolio Manager"});  
         if (!&Apache::lonnet::usertools_access($uname,$udom,'portfolio')) {  
             $r->print(&Apache::lonhtmlcommon::breadcrumbs());  
             $r->print('<h2>'.&mt('No user portfolio available') .'</h2>'.  
                       &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);
     if ($blocked) {      if ($blocked) {
Line 2409  sub handler { Line 2371  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,$group);   $can_upload);
         &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.2  
changed lines
  Added in v.1.197


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