[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lon-capa-cvs
Subject:    [LON-CAPA-cvs] cvs: loncom /interface lonindexer.pm
From:       banghart <lon-capa-cvs-allow () mail ! lon-capa ! org>
Date:       2007-06-29 19:21:16
Message-ID: cvsbanghart1183144876 () cvsserver
[Download RAW message or body]

banghart		Fri Jun 29 15:21:16 2007 EDT

  Modified files:              
    /loncom/interface	lonindexer.pm 
  Log:
  	Call lonnet::gettitle only once and only if needed.
  
  
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.165 loncom/interface/lonindexer.pm:1.166
--- loncom/interface/lonindexer.pm:1.165	Thu Jun 28 18:28:22 2007
+++ loncom/interface/lonindexer.pm	Fri Jun 29 15:21:15 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.165 2007/06/28 22:28:22 banghart Exp $
+# $Id: lonindexer.pm,v 1.166 2007/06/29 19:21:15 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -918,7 +918,11 @@
 
 # display file
     if (($fnptr == 0 and $filecom[3] ne '') or $absolute) {
+        my $title;
 	my $filelink = $pathprefix.$filecom[0];
+	if ($hash{'display_attrs_0'} == 1) {
+	    my $title = &Apache::lonnet::gettitle($filelink,'title');
+	}
 	my @file_ext = split (/\./,$listname);
 	my $curfext = $file_ext[-1];
         if (@Omit) {
@@ -951,7 +955,7 @@
 	    $r->print(" />\n");
 	    $r->print("</form></td><td nowrap='nowrap' valign='top'>");
 	    $hash{"pre_${fnum}_link"}=$filelink;
-	    $hash{"pre_${fnum}_title"}=&Apache::lonnet::gettitle($filelink,'title');
+	    $hash{"pre_${fnum}_title"}=$title;
 	    if (!$hash{"pre_${fnum}_title"}) {
 	        $hash{"pre_${fnum}_title"} = 'Untitled';
 	    }
@@ -1008,7 +1012,6 @@
 	}
 	$r->print("</td>\n");
 	if ($hash{'display_attrs_0'} == 1) {
-	    my $title = &Apache::lonnet::gettitle($filelink,'title');
 	    $r->print('<td> '.($title eq '' ? '&nbsp;' : $title).
 		      ' </td>'."\n");
 	}


_______________________________________________
LON-CAPA-cvs mailing list
LON-CAPA-cvs@mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic