[LON-CAPA-cvs] cvs: loncom /interface portfolio.pm

banghart lon-capa-cvs@mail.lon-capa.org
Fri, 11 Aug 2006 23:45:20 -0000


banghart		Fri Aug 11 19:45:20 2006 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  	Saving work in progress for showing versioned file info.
  	Use &make_anchor a couple of new places
  	Make code easier to read (shorten lines).
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.152 loncom/interface/portfolio.pm:1.153
--- loncom/interface/portfolio.pm:1.152	Wed Aug  9 13:47:26 2006
+++ loncom/interface/portfolio.pm	Fri Aug 11 19:45:18 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # portfolio browser
 #
-# $Id: portfolio.pm,v 1.152 2006/08/09 17:47:26 albertel Exp $
+# $Id: portfolio.pm,v 1.153 2006/08/11 23:45:18 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -169,10 +169,15 @@
 	$href_location, $url, $current_path, $access_admin_text, $versions)=@_;
     # my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); 
     $r->print('<tr class="'.$css_class.'">');
-    $r->print($line);
-    $r->print('<td><img alt="" src="'.&Apache::loncommon::icon($filename).'" /></td>');
-    $r->print('<td>'.$$version_flag{$filename}.'</td><td>');
-    $r->print(&make_anchor($href_location.$filename,undef,$filename).'</td>'); 
+    $r->print($line); # contains first two cells of table
+    if ($$version_flag{$filename}) { # versioned can't be versioned, so TRUE when root file
+        $r->print('<td><img alt="" src="'.&Apache::loncommon::icon($filename).'" /></td>');
+        $r->print('<td>'.$$version_flag{$filename}.'</td>');
+    } else { # this is a graded or handed back file
+        $r->print('<td colspan="2">&nbsp;</td>');
+    }
+    # $r->print('<td>'.$$version_flag{$filename}.'</td><td>');
+    $r->print('<td>'.&make_anchor($href_location.$filename,undef,$filename).'</td>'); 
     $r->print('<td>'.$size.'</td>');
     $r->print('<td>'.&Apache::lonlocal::locallocaltime($mtime).'</td>');
     if ($select_mode ne 'true') {
@@ -474,12 +479,12 @@
     unless (defined $message) {
         $message='Done';
     }
-    my $result = '<h3><a href="'.$url.'?currentpath='.
-	         $env{'form.currentpath'}.
-	         '&fieldname='.$env{'form.fieldname'}.
-	         '&mode='.$env{'form.mode'}.
-		 &group_args();
-    $result .= '">'.&mt($message).'</a></h3>';
+    my %anchor_fields = (
+        'currentpath' => $env{'form.currentpath'},
+        'fieldname' => $env{'form.fieldname'},
+        'mode'      => $env{'form.mode'}
+    );
+    my $result = '<h3>'.&make_anchor($url,\%anchor_fields,&mt($message)).'</h3>';
     return $result;
 }
 
@@ -615,8 +620,16 @@
     my %access_controls = &Apache::lonnet::get_access_controls($current_permissions,$group,$file_name);
     my $aclcount = keys(%access_controls);
     my $header = '<h3>'.&mt('Allowing others to retrieve file: [_1]',$port_path.$env{'form.currentpath'}.$env{'form.access'}).'</h3>';
-    my $info .= &mt('Access to this file by others can be set to be one or more of the following types: public, passphrase-protected or conditional.').'<br /><ul><li>'.&mt('Public files are available to anyone without the need for login.').'</li><li>'.&mt('Passphrase-protected files do not require log-in, but will require the viewer to enter the passphrase you set.').'</li><li>'.&mt('Conditional files are accessible to logged-in users with accounts in the LON-CAPA network, who satisfy the conditions you set.').'<br />'.&mt('The conditions can include affiliation with a particular course or group, or a user account in a specific domain.').'<br />'.&mt('Alternatively access can be granted to people with specific LON-CAPA usernames and domains.').'</li></ul>';
-
+    my $info .= &mt('Access to this file by others can be set to be one or ');
+    $info .= &mt('more of the following types: public, passphrase-protected or conditional.');
+    $info .= '<br /><ul><li>'.&mt('Public files are available to anyone without the need for login.');
+    $info .= '</li><li>'.&mt('Passphrase-protected files do not require log-in, but will require ');
+    $info .= &mt('the viewer to enter the passphrase you set.');
+    $info .= '</li><li>'.&mt('Conditional files are accessible to logged-in users with accounts ');
+    $info .= &mt('in the LON-CAPA network, who satisfy the conditions you set.').'<br />';
+    $info .= &mt('The conditions can include affiliation with a particular course or group, ');
+    $info .= &mt('or a user account in a specific domain.').'<br />';
+    $info .= &mt('Alternatively access can be granted to people with specific LON-CAPA usernames and domains.').'</li></ul>';
     if ($group eq '') {
         $info .= (&mt("Direct others to the 'Display file listing' link (shown when there are viewable files) on your personal information page:<br /><a href='/adm/$udom/$uname/aboutme'>http://$ENV{'SERVER_NAME'}/adm/$udom/$uname/aboutme</a>"));
     }
@@ -661,8 +674,10 @@
     } else {
         $r->print(&mt('No access control settings currently exist for this file.<br />' ));
     }
-    $r->print('<br /><a href="'.$url.'?currentpath='.$env{'form.currentpath'}.
-              &group_args().'">'.&mt('Return to directory listing').'</a>');
+    my %anchor_fields = (
+        'currentpath' => $env{'form.currentpath'}
+    );
+    $r->print('<br />'.&make_anchor($url, \%anchor_fields, &mt('Return to directory listing')));
     return;
 }
 
@@ -886,12 +901,13 @@
         }
         &close_form($r,$url);
     } else {
-        $r->print('<br /><a href="'.$url.'?access='.$env{'form.selectfile'}.
-                  '&amp;currentpath='.$env{'form.currentpath'}.&group_args().'">'.
-                   &mt('Display all access settings for this file').'</a>'.
-                  '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.
-                  '<a href="'.$url.'?currentpath='.$env{'form.currentpath'}.
-                  &group_args().'">'.&mt('Return to directory listing').'</a>');
+        my %anchor_fields = (
+            'currentpath' => $env{'form.currentpath'},
+            'access' => $env{'form.selectfile'}
+        );
+        $r->print('<br />'.&make_anchor($url, \%anchor_fields, &mt('Display all access settings for this file')));
+        delete $anchor_fields{'access'};
+        $r->print('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.&make_anchor($url,\%anchor_fields,&mt('Return to directory listing')));
     }
     return;
 }