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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 02 Aug 2006 20:18:11 -0000


albertel		Wed Aug  2 16:18:11 2006 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonaboutme.pm 
  Log:
  - css
  - xhtml
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.439 loncom/interface/loncommon.pm:1.440
--- loncom/interface/loncommon.pm:1.439	Fri Jul 28 20:31:58 2006
+++ loncom/interface/loncommon.pm	Wed Aug  2 16:18:10 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.439 2006/07/29 00:31:58 raeburn Exp $
+# $Id: loncommon.pm,v 1.440 2006/08/02 20:18:10 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3200,6 +3200,9 @@
 .LC_success {
   color: green;
 }
+.LC_icon {
+  border: 0px;
+}
 
 table#LC_top_nav, table#LC_menubuttons {
   width: 100%;
@@ -3327,6 +3330,11 @@
   font-weight: bold;
 }
 
+table.LC_aboutme_port {
+  border: 0px;
+  border-collapse: collapse;
+  border-spacing: 0px;
+}
 table.LC_data_table, table.LC_mail_list {
   border: 1px solid #000000;
   border-collapse: separate;
@@ -3340,11 +3348,13 @@
   background-color: $data_table_head;
   font-size: smaller;
 }
-table.LC_data_table tr td {
+table.LC_data_table tr td, 
+table.LC_aboutme_port tr td {
   background-color: $data_table_light;
   padding: 2px;
 }
-table.LC_data_table tr.LC_even_row td {
+table.LC_data_table tr.LC_even_row td,
+table.LC_aboutme_port tr.LC_even_row td {
   background-color: $data_table_dark;
 }
 table.LC_data_table tr.LC_data_table_highlight td {
Index: loncom/interface/lonaboutme.pm
diff -u loncom/interface/lonaboutme.pm:1.44 loncom/interface/lonaboutme.pm:1.45
--- loncom/interface/lonaboutme.pm:1.44	Wed Aug  2 15:29:35 2006
+++ loncom/interface/lonaboutme.pm	Wed Aug  2 16:18:10 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # "About Me" Personal Information
 #
-# $Id: lonaboutme.pm,v 1.44 2006/08/02 19:29:35 albertel Exp $
+# $Id: lonaboutme.pm,v 1.45 2006/08/02 20:18:10 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -281,12 +281,12 @@
         $output .= '<a href="/adm/'.$cdom.'/'.$cnum.'/aboutme'.
                    $query_string.'">'.&mt('Display file listing').
                    '</a><br /><br />';
-        $output .= &mt('A total of [_1] portfolio files owned by [_2] are available for viewing.',$filecounts->{'both'},$name).'<ul>';
+        $output .= &mt('A total of [quant,_1,portfolio file] owned by [_2] are available.',$filecounts->{'both'},$name).'<ul>';
         if ($filecounts->{'withoutpass'}) {
-            $output .= '<li>'.&mt('[_1] files are either publicly accessible, or directly available to you because of your current role, domain and/or username.',$filecounts->{'withoutpass'}).'</li>';   
+            $output .= '<li>'.&mt('[quant,_1,file] are publicly accessible.',$filecounts->{'withoutpass'}).'</li>';   
         }
         if ($filecounts->{'withpass'}) {
-            $output .= '<li>'.&mt('[_1] files will be available after you have entered a passphrase set for each specific file.',$filecounts->{'withpass'}).'</li>';
+            $output .= '<li>'.&mt('[quant,_1,file] require a passphrase for access.',$filecounts->{'withpass'}).'</li>';
         }
         $output .= '</ul>';
     }
@@ -351,13 +351,14 @@
 
 sub display_portfolio_files {
     my ($r,$lt) = @_;
-    my ($cdom,$cnum,$name) = aboutme_info($r);
+    my ($cdom,$cnum,$name) = &aboutme_info($r);
     my $portaccess = 'withoutpass';
     if (exists($env{'form.portaccess'})) {
         $portaccess = $env{'form.portaccess'};
     }
-    my $output = '<form name="displaystatus" method="post">'.
-                 &mt('File access type: ').'<select name="portaccess">';
+    my $output = '<form action="'.&HTML::Entities::encode($r->uri,'<>&"')
+	.'" name="displaystatus" method="post">'.
+	&mt('File access type: ').'<select name="portaccess">';
     foreach my $type ('withoutpass','withpass','both') {
         $output .= '<option value="'.$type.'" ';
         if ($portaccess eq $type) {
@@ -367,9 +368,9 @@
     }
     $output .= '</select>'."\n".
                '<input type="submit" name="portaccessbutton" value="'.
-               &mt('Update display').'">'.
+               &mt('Update display').'" />'.
                '<input type="hidden" name="action" value="'.
-               $env{'form.action'}.'"/>';
+               $env{'form.action'}.'" />';
     $output .= '</form><br /><br />';
     $r->print($output);
     my $filecounts = &portfolio_files($r,'listfiles',$lt);
@@ -445,11 +446,8 @@
     if ($mode eq 'listfiles') {
         my $output;
         if (keys(%allfileshash) > 0) {
-            my $depth = 0;
-            my $count = 0;
-            $output = '<table border="0" cellpadding="2" cellspacing="0">';
-            ($count,$output) = &parse_directory($r,$output,$depth,
-                                               \%allfileshash,$count);
+            $output = &portfolio_table_start();
+            $output .= &parse_directory($r,0,\%allfileshash);
             $output .= '</table>';
         } else {
             my $access_text;
@@ -463,27 +461,33 @@
     return $filecounts;
 }
 
+{ 
+    my $count=0;
+    sub portfolio_table_start {
+	$count=0;
+	return '<table class="LC_aboutme_port">';
+    }
+    sub portfolio_row_start {
+	$count++;
+	my $class = ($count%2)?'LC_odd_row'
+	                      :'LC_even_row';
+	return '<tr class="'.$class.'">';
+    }
+}
+
 sub parse_directory {
-    my ($r,$output,$depth,$currhash,$count) = @_;
+    my ($r,$depth,$currhash) = @_;
     my ($cdom,$cnum,$name) = &aboutme_info($r);
-    $depth ++;
-    my @backgroundColors = ("#FFFFFF", "#F6F6F6");
-    my $indent = '<img src="'.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace1.gif").'" width="25" height="1" alt="&nbsp;&nbsp;" border="0" />';
-    $output .= $indent;
+    $depth++;
+    my $output;
     foreach my $item (sort(keys(%{$currhash}))) {
-        $count ++;
-        my $backgroundcolor = $backgroundColors[$count%2]; 
-        $output .= '<tr bgcolor="'.$backgroundcolor.'">';
-        $output .= '<td>';
-        for (my $i=0; $i<$depth; $i++) {
-            $output .= $indent;
-        }
+        $output .= &portfolio_row_start();
+        $output .= '<td style="padding-left: '.($depth*25).'px">';
         if (ref($currhash->{$item}) eq 'HASH') {
-            my $title = $item;
-            $title=~s/\"/\&quot;/g;
-            $output .= '<img src="'.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/navmap.folder.open.gif").'" alt="'.&mt('Folder').' '.$title.' border="0" />&nbsp;'.$title;
-            ($count,$output) = &parse_directory($r,$output,$depth,
-                                                $currhash->{$item},$count);
+            my $title=&HTML::Entities::encode($item,'<>&"');
+            $output .= '<img src="'.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/navmap.folder.open.gif").'" alt="'.&mt('Folder').' '.$title.'" class="LC_icon" />&nbsp;'.$title;
+	    $output .= '</td></tr>';
+            $output .= &parse_directory($r,$depth,$currhash->{$item});
         } else {
             my $showname;
             if ($currhash->{$item} =~ m|/([^/]+)$|) {
@@ -491,11 +495,12 @@
             } else {
                 $showname = $currhash->{$item};
             }
-            $output .= '<img alt="" src="'.&Apache::loncommon::icon($currhash->{$item}).'" />&nbsp;<a href="/uploaded/'.$cdom.'/'.$cnum.'/portfolio/'.$currhash->{$item}.'">'.$showname.'</a>';
+            $showname=&HTML::Entities::encode($showname,'<>&"');
+            $output .= '<img alt="" src="'.&Apache::loncommon::icon($currhash->{$item}).'" class="LC_icon" />&nbsp;<a href="/uploaded/'.$cdom.'/'.$cnum.'/portfolio/'.$currhash->{$item}.'">'.$showname.'</a>';
+	    $output .= '</td></tr>';
         }
-        $output .= '</td></tr>';
     }
-    return ($count,$output);
+    return $output;
 }
 
 1;