[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonhtmlcommon.pm lonindexer.pm lonmeta.pm lonsearchcat.pm

bisitz bisitz@source.lon-capa.org
Tue, 01 Dec 2009 18:07:50 -0000


This is a MIME encoded message

--bisitz1259690870
Content-Type: text/plain

bisitz		Tue Dec  1 18:07:50 2009 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonhtmlcommon.pm lonindexer.pm 
                     	lonmeta.pm lonsearchcat.pm 
  Log:
  Font size standardisation for filenames, links, crumbs / Bug 6114:
  - lonhtmlcommon::crumbs:
      - Eliminated size (font resize) parameter: Always generate code which uses standard font size. Removed deprecated font size tag.
      - Eliminated noformat parameter: The routine should generate content, not special styles or formats. If a different style/format is really needed, it can be added from outside. Due to consistency, currently no special styles/formats are used, only LC_filename. loncommon:CSTR_pageheader needs to be revisited anyway.
      - Use LC_filename for path and filename
      - Only single space before target attribute
      - Standard code indention
  - Decrease default font size for LC_filename
  - No different font size for links (<a>)
  - CSTR Header: only display lastitem when not empty
  - Optimized line breaks on browse resource / import resource screen
  
  
--bisitz1259690870
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20091201180750.txt"

Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.920 loncom/interface/loncommon.pm:1.921
--- loncom/interface/loncommon.pm:1.920	Mon Nov 30 21:29:47 2009
+++ loncom/interface/loncommon.pm	Tue Dec  1 18:07:50 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.920 2009/11/30 21:29:47 raeburn Exp $
+# $Id: loncommon.pm,v 1.921 2009/12/01 18:07:50 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4367,18 +4367,30 @@
     } else {
         $lastitem = $thisdisfn;
     }
-    return
+
+    my $output =
          '<div>'
         .&Apache::loncommon::help_open_menu('','',3,'Authoring') #FIXME: Broken? Where is it?
         .'<b>'.&mt('Construction Space:').'</b> '
         .'<form name="dirs" method="post" action="'.$formaction
-        .'" target="_top"><tt><b>' #FIXME lonpubdir: target="_parent"
-        .&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv','','+1',1)."$lastitem</b></tt><br />"
+        .'" target="_top">' #FIXME lonpubdir: target="_parent"
+        .&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv',undef,undef);
+
+    if ($lastitem) {
+        $output .=
+             '<span class="LC_filename">'
+            .$lastitem
+            .'</span>';
+    }
+    $output .=
+         '<br />'
         #FIXME lonpubdir: &Apache::lonhtmlcommon::crumbs($uname.$thisdisfn.'/','_top','/priv','','+1',1)."</b></tt><br />"
         .&Apache::lonhtmlcommon::select_recent('construct','recent','this.form.action=this.form.recent.value;this.form.submit()')
         .'</form>'
         .&Apache::lonmenu::constspaceform()
         .'</div>';
+
+    return $output;
 }
 
 ###############################################
@@ -4756,11 +4768,6 @@
   color:$font;
 }
 
-a:link,
-a:visited {
-  font-size:100%;
-}
-
 a:focus {
   color: red;
   background: yellow;
@@ -4787,6 +4794,7 @@
 .LC_filename {
   font-family: $mono;
   white-space:pre;
+  font-size: 120%;
 }
 
 .LC_fileicon {
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.251 loncom/interface/lonhtmlcommon.pm:1.252
--- loncom/interface/lonhtmlcommon.pm:1.251	Mon Nov 30 06:32:26 2009
+++ loncom/interface/lonhtmlcommon.pm	Tue Dec  1 18:07:50 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.251 2009/11/30 06:32:26 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.252 2009/12/01 18:07:50 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1130,47 +1130,45 @@
 # ------------------------------------------------------- Puts directory header
 
 sub crumbs {
-    my ($uri,$target,$prefix,$form,$size,$noformat,$skiplast)=@_;
-    if (! defined($size)) {
-        $size = '+2';
-    }
+    my ($uri,$target,$prefix,$form,$skiplast)=@_;
     if ($target) {
         $target = ' target="'.
                   &Apache::loncommon::escape_single($target).'"';
     }
-    my $output='';
-    unless ($noformat) { $output.='<br /><tt><b>'; }
-    $output.='<font size="'.$size.'">'.$prefix.'/';
+    my $output='<span class="LC_filename">';
+    $output.=$prefix.'/';
     if (($env{'user.adv'}) || ($env{'user.author'})) {
-	my $path=$prefix.'/';
-	foreach my $dir (split('/',$uri)) {
+        my $path=$prefix.'/';
+        foreach my $dir (split('/',$uri)) {
             if (! $dir) { next; }
             $path .= $dir;
-	    if ($path eq $uri) {
-		if ($skiplast) {
-		    $output.=$dir;
+            if ($path eq $uri) {
+                if ($skiplast) {
+                    $output.=$dir;
                     last;
-		} 
-	    } else {
-		$path.='/'; 
-	    }	    
+                } 
+            } else {
+                $path.='/'; 
+            }
             my $href_path = &HTML::Entities::encode($path,'<>&"');
-	    &Apache::loncommon::inhibit_menu_check(\$href_path);
-	    if ($form) {
-	        my $href = 'javascript:'.$form.".action='".$href_path."';".$form.'.submit();';
-	        $output.=qq{<a href="$href" $target>$dir</a>/};
-	    } else {
-	        $output.=qq{<a href="$href_path" $target>$dir</a>/};
-	    }
-	}
+            &Apache::loncommon::inhibit_menu_check(\$href_path);
+            if ($form) {
+                my $href = 'javascript:'.$form.".action='".$href_path."';".$form.'.submit();';
+                $output.=qq{<a href="$href"$target>$dir</a>/};
+            } else {
+                $output.=qq{<a href="$href_path"$target>$dir</a>/};
+            }
+        }
     } else {
-	foreach my $dir (split('/',$uri)) {
+        foreach my $dir (split('/',$uri)) {
             if (! $dir) { next; }
-	    $output.=$dir.'/';
-	}
+            $output.=$dir.'/';
+        }
     }
     if ($uri !~ m|/$|) { $output=~s|/$||; }
-    return $output.'</font>'.($noformat?'':'</b></tt><br />');
+    $output.='</span>';
+
+    return $output;
 }
 
 # --------------------- A function that generates a window for the spellchecker
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.201 loncom/interface/lonindexer.pm:1.202
--- loncom/interface/lonindexer.pm:1.201	Fri Oct 30 05:12:01 2009
+++ loncom/interface/lonindexer.pm	Tue Dec  1 18:07:50 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.201 2009/10/30 05:12:01 raeburn Exp $
+# $Id: lonindexer.pm,v 1.202 2009/12/01 18:07:50 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -541,11 +541,21 @@
 	$storeuri='/'.(split(/\.(page|sequence)\/\//,$uri))[-1];
 	$storeuri=~s/\/+/\//g;
 # ---------------------------------------------------------------- Bread crumbs
-        $r->print(&Apache::lonhtmlcommon::crumbs($storeuri,'','',
-				(($env{'form.catalogmode'} eq 'import')?
-				 'document.forms.fileattr':'')).
-		  &Apache::lonhtmlcommon::select_recent('residx','resrecent',
-'window.status=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.action=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.submit();'));
+        $r->print(
+            '<p>'
+           .&Apache::lonhtmlcommon::crumbs(
+                $storeuri,
+                '',
+                '',
+                (($env{'form.catalogmode'} eq 'import')?
+                                 'document.forms.fileattr':''))
+           .'<br />'
+           .&Apache::lonhtmlcommon::select_recent(
+                'residx',
+                'resrecent',
+                'window.status=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.action=this.form.resrecent.options[this.form.resrecent.selectedIndex].value;this.form.submit();')
+           .'</p>'
+        );
 # -------------------------------------------------------- Resource Home Button
 	my $reshome=$env{'course.'.$env{'request.course.id'}.'.reshome'};
 	if ($reshome) {
@@ -563,14 +573,13 @@
 	&Apache::lonhtmlcommon::store_recent('residx',$storeuri,$storeuri);
 # -------------------------------------------------- Check All and Uncheck all
 	if ($env{'form.catalogmode'} eq 'import') {
-	    $r->print('<br /><input type="button" value="'.&mt("Check All").'" id="checkallbutton" onclick="javascript:checkAll()" />');
-	    $r->print('<input type="button" value="'.&mt("Uncheck All").'" id="uncheckallbutton" onclick="javascript:uncheckAll()" />');
+	    $r->print('<p><input type="button" value="'.&mt("Check All").'" id="checkallbutton" onclick="javascript:checkAll()" />');
+	    $r->print('<input type="button" value="'.&mt("Uncheck All").'" id="uncheckallbutton" onclick="javascript:uncheckAll()" /></p>');
 	}
 # ----------------- output starting row to the indexed file/directory hierarchy
         #$r->print(&initdebug());
         #$r->print(&writedebug("Omit:@Omit")) if (@Omit);
         #$r->print(&writedebug("Only:@Only")) if (@Only);
-        $r->print('<br /><br />');
         $r->print(&Apache::loncommon::start_data_table("LC_tableBrowseRes")
                  .&Apache::loncommon::start_data_table_header_row());
 	$r->print("<th $colspan>".&mt('Name')."</th>\n");
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.236 loncom/interface/lonmeta.pm:1.237
--- loncom/interface/lonmeta.pm:1.236	Fri Oct 23 11:01:49 2009
+++ loncom/interface/lonmeta.pm	Tue Dec  1 18:07:50 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.236 2009/10/23 11:01:49 bisitz Exp $
+# $Id: lonmeta.pm,v 1.237 2009/12/01 18:07:50 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -425,7 +425,7 @@
 # Pretty printing of metadata field
 
 sub prettyprint {
-    my ($type,$value,$target,$prefix,$form,$noformat)=@_;
+    my ($type,$value,$target,$prefix,$form)=@_;
 # $target,$prefix,$form are optional and for filecrumbs only
     if (! defined($value)) { 
         return '&nbsp;'; 
@@ -500,8 +500,8 @@
                 } 
             }
             $_ = '<li>'.$title.' '.
-		&Apache::lonhtmlcommon::crumbs($url,$target,$prefix,$form,'0',$noformat).
-                '</li>'
+                 &Apache::lonhtmlcommon::crumbs($url,$target,$prefix,$form).
+                 '</li>'
 	    } split(/\s*\,\s*/,$value)).'</ul>';
     }
     # Evaluations
@@ -929,9 +929,8 @@
 	    $versiondisplay='Version: '.$currentversion;
 	}
     }
-    # crumbify displayed URL               uri     target prefix form  size
-    $disuri=&Apache::lonhtmlcommon::crumbs($disuri,undef, undef, undef,'+1');
-    $disuri =~ s:<br />::g;
+    # crumbify displayed URL               uri     target prefix form 
+    $disuri=&Apache::lonhtmlcommon::crumbs($disuri,undef, undef, undef);
     # obsolete
     my $obsolete=$content{'obsolete'};
     my $obsoletewarning='';
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.318 loncom/interface/lonsearchcat.pm:1.319
--- loncom/interface/lonsearchcat.pm:1.318	Fri Oct 23 16:55:15 2009
+++ loncom/interface/lonsearchcat.pm	Tue Dec  1 18:07:50 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.318 2009/10/23 16:55:15 bisitz Exp $
+# $Id: lonsearchcat.pm,v 1.319 2009/12/01 18:07:50 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3553,7 +3553,7 @@
             $result .= '<b>'.&mt($field->{'translate'}).'</b>';
             foreach my $item (split(',',$values{$field->{'name'}})){
                 $item = &Apache::lonnet::clutter($item);
-                $result .= &display_url($item,[2,0,1]);
+                $result .= '<br />'.&display_url($item,1).'<br />';
             }
         } elsif (exists($field->{'format'}) && $field->{'format'} ne ''){
             $result.= &mt($field->{'translate'},
@@ -3561,7 +3561,7 @@
                                   $values{$field->{'name'}}))."<br />\n";
         } else {
             if ($field->{'special'} eq 'url link') {
-                $result .= &display_url($jumpurl,[3,0,1]);
+                $result .= '<br />'.&display_url($jumpurl,1).'<br />';
             } else {
                 $result.= &mt($field->{'translate'},
                               $values{$field->{'name'}});
@@ -3615,7 +3615,7 @@
     }
     my $jumpurl=$values{'url'};
     $jumpurl=~s|^/ext/|http://|;
-    my $link = &display_url($jumpurl,[2,0,1]);
+    my $link = '<br />'.&display_url($jumpurl,1).'<br />';
 
     $result.=<<END;
 <a href="$jumpurl?inhibitmenu=yes" 
@@ -3651,7 +3651,7 @@
     my $jumpurl=$values{'url'};
     $jumpurl=~s|^/ext/|http://|;
 
-    my $link = &display_url($jumpurl,[1,1,1]);
+    my $link = &display_url($jumpurl,1);
     
     my $result = 
         $prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}).'" alt="" />';
@@ -3670,7 +3670,7 @@
 }
 
 sub display_url {
-    my ($url,$crumb_args) = @_;
+    my ($url,$skiplast) = @_;
     my $link;
     if ($url=~m|^/ext/|) {
 	$url=~s|^/ext/|http://|;
@@ -3678,10 +3678,12 @@
     } elsif ($url=~m{^(http://|/uploaded/)}) {
 	$link='<span class="LC_filename">'.$url.'</span>';
     } else {
-        $link=&Apache::lonhtmlcommon::crumbs($url,
-		  'preview',
-		  '',
-		  (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),@{$crumb_args}).' ';
+        $link=&Apache::lonhtmlcommon::crumbs(
+                  $url,
+                  'preview',
+                  '',
+                  (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),
+                  $skiplast).' ';
     }
     return $link;
 }

--bisitz1259690870--