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

raeburn lon-capa-cvs@mail.lon-capa.org
Fri, 18 Aug 2006 13:49:35 -0000


raeburn		Fri Aug 18 09:49:35 2006 EDT

  Modified files:              
    /loncom/interface	portfolio.pm lonaboutme.pm 
  Log:
  Information about link to portfolio listing updated.  &get_portfolio_root() accepts domain and name arguments so catalog information is available in listing of viewable files. Some single/plural noun verb agreements.
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.159 loncom/interface/portfolio.pm:1.160
--- loncom/interface/portfolio.pm:1.159	Wed Aug 16 13:58:54 2006
+++ loncom/interface/portfolio.pm	Fri Aug 18 09:49:34 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # portfolio browser
 #
-# $Id: portfolio.pm,v 1.159 2006/08/16 17:58:54 banghart Exp $
+# $Id: portfolio.pm,v 1.160 2006/08/18 13:49:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -643,7 +643,7 @@
     $info .= &mt('The conditions can include affiliation with a particular course or group, 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>"));
+        $info .= (&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 />For logged in users a 'Display file listing' link will also appear (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><br />"));
     }
     
     if ($can_setacl) {
@@ -1677,7 +1677,10 @@
 }
 
 sub get_portfolio_root {
-    my ($uname,$udom) = &get_name_dom();
+    my ($udom,$uname) = @_;
+    if (!(defined($udom)) || !(defined($uname))) {
+        ($uname,$udom) = &get_name_dom();
+    }
     my $path;
     if (defined($env{'form.group'})) {
         $path = '/userfiles/groups/'.$env{'form.group'}.'/portfolio';
Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.52 loncom/interface/lonaboutme.pm:1.53
--- loncom/interface/lonaboutme.pm:1.52	Wed Aug 16 15:40:46 2006
+++ loncom/interface/lonaboutme.pm	Fri Aug 18 09:49:34 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # "About Me" Personal Information
 #
-# $Id: lonaboutme.pm,v 1.52 2006/08/16 19:40:46 albertel Exp $
+# $Id: lonaboutme.pm,v 1.53 2006/08/18 13:49:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -278,12 +278,24 @@
         $output .= '<a href="/adm/'.$cdom.'/'.$cnum.'/aboutme/portfolio'.
                    $query_string.'">'.&mt('Display file listing').
                    '</a><br /><br />';
-        $output .= &mt('A total of [quant,_1,portfolio file] owned by [_2] are available.',$filecounts->{'both'},$name).'<ul>';
+        if ($filecounts->{'both'} == 1) {
+            $output .= &mt('One portfolio file owned by [_2] is available.',$filecounts->{'both'},$name).'<ul>';
+        } else {
+            $output .= &mt('A total of [quant,_1,portfolio file] owned by [_2] are available.',$filecounts->{'both'},$name).'<ul>';
+        }
         if ($filecounts->{'withoutpass'}) {
-            $output .= '<li>'.&mt('[quant,_1,file] are publicly accessible.',$filecounts->{'withoutpass'}).'</li>';   
+            if ($filecounts->{'withoutpass'} == 1) {
+                $output .= '<li>'.&mt('[quant,_1,file] is publicly accessible.',$filecounts->{'withoutpass'}).'</li>';
+            } else {
+                $output .= '<li>'.&mt('[quant,_1,file] are publicly accessible.',$filecounts->{'withoutpass'}).'</li>';
+            }
         }
         if ($filecounts->{'withpass'}) {
-            $output .= '<li>'.&mt('[quant,_1,file] require a passphrase for access.',$filecounts->{'withpass'}).'</li>';
+            if ($filecounts->{'withpass'} == 1) {
+                $output .= '<li>'.&mt('[quant,_1,file] requires a passphrase for access.',$filecounts->{'withpass'}).'</li>';
+            } else {
+                $output .= '<li>'.&mt('[quant,_1,file] require a passphrase for access.',$filecounts->{'withpass'}).'</li>'; 
+            }
         }
         $output .= '</ul>';
     }
@@ -328,19 +340,21 @@
     &Apache::lonhtmlcommon::clear_breadcrumbs();
     my $forcestudent='';
     if ($env{'form.forcestudent'}) { $forcestudent='student'; };
-    my $output =
+    my $output = 
         &Apache::loncommon::start_page('Viewable portfolio files',undef,
                                             {'function' => $forcestudent, 
                                              'domain'   => $cdom,});
-    &Apache::lonhtmlcommon::add_breadcrumb
-        ({href=>"/adm/$cdom/$cnum/aboutme".$query_string,
-          text=>"Personal information - $name",
-          title=>"Go to personal information page for $name"},
-         {href=>"/adm/$cdom/$cnum/aboutme/portfolio",
-          text=>"Viewable files - $name",
-          title=>"Viewable portfolio files for $name"}
-);
-    $output .= &Apache::lonhtmlcommon::breadcrumbs(&mt('Viewable portfolio files.'));
+    if (!($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public')) {
+        &Apache::lonhtmlcommon::add_breadcrumb
+            ({href=>"/adm/$cdom/$cnum/aboutme".$query_string,
+              text=>"Personal information - $name",
+              title=>"Go to personal information page for $name"},
+             {href=>"/adm/$cdom/$cnum/aboutme/portfolio",
+              text=>"Viewable files - $name",
+              title=>"Viewable portfolio files for $name"}
+        );
+        $output .= &Apache::lonhtmlcommon::breadcrumbs(&mt('Viewable portfolio files.'));
+    }
     $output .= '<h3>'.&mt('Portfolio files for [_1]',$name).'</h3>';
     $r->print($output);
     return;
@@ -367,7 +381,7 @@
         if ($portaccess eq $type) {
             $output .= 'selected="selected"';
         }
-        $output .= '>'.&mt($type).'</option>';
+        $output .= '>'.$lt{$type}.'</option>';
     }
     $output .= '</select>'."\n".
                '<input type="submit" name="portaccessbutton" value="'.
@@ -375,10 +389,12 @@
     $output .= '</form><br /><br />';
     $r->print($output);
     my $filecounts = &portfolio_files($r,'listfiles',\%lt);
-    my $query_string = &build_query_string();
-    $r->print('<br /><br /><a href="/adm/'.$cdom.'/'.$cnum.
-               '/aboutme'.$query_string.'">'.
-               &mt('Information about [_1]',$name).'</a>');
+    if (!($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public')) {
+        my $query_string = &build_query_string();
+        $r->print('<br /><br /><a href="/adm/'.$cdom.'/'.$cnum.
+                  '/aboutme'.$query_string.'">'.
+                  &mt('Information about [_1]',$name).'</a>');
+    }
     return;
 }
 
@@ -482,7 +498,7 @@
     $depth++;
     my $output;
 
-    my $portfolio_root =  &Apache::portfolio::get_portfolio_root($cdom,$cnum); 
+    my $portfolio_root = &Apache::portfolio::get_portfolio_root($cdom,$cnum);
     my %dirlist = map {
 	    ((split('&',$_,2))[0],1)
 	} &Apache::lonnet::dirlist($path,$cdom,$cnum,$portfolio_root);