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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 15 Jun 2007 23:29:17 -0000


albertel		Fri Jun 15 19:29:17 2007 EDT

  Modified files:              
    /loncom/interface	lonsearchcat.pm 
  Log:
  - remove crumbing from portfolio results
  
  
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.286 loncom/interface/lonsearchcat.pm:1.287
--- loncom/interface/lonsearchcat.pm:1.286	Tue May  1 21:33:49 2007
+++ loncom/interface/lonsearchcat.pm	Fri Jun 15 19:29:17 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.286 2007/05/02 01:33:49 albertel Exp $
+# $Id: lonsearchcat.pm,v 1.287 2007/06/15 23:29:17 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2997,8 +2997,8 @@
         $title=~ s/\'/\\\'/g;
         if ($env{'form.catalogmode'} eq 'interactive') {
             $output.=<<END 
-<font size='-1'><INPUT TYPE="button" NAME="returnvalues" VALUE="SELECT"
-onClick="javascript:select_data('$title','$url')">
+<font size='-1'><input type="button" name="returnvalues" value="select"
+onClick="javascript:select_data('$title','$url')" />
 </font>
 END
         }
@@ -3007,7 +3007,7 @@
         $groupsearch_db{"pre_${fnum}_title"}=$title;
         $output.=<<END;
 <font size='-1'>
-<input type="checkbox" name="returnvalues" value="SELECT"
+<input type="checkbox" name="returnvalues" value="select"
 onClick="javascript:queue($checkbox_num,$fnum)" />
 </font>
 END
@@ -3444,11 +3444,8 @@
         if (exists($field->{'type'}) && $field->{'type'} eq 'list') {
             $result .= '<b>'.&mt($field->{'translate'}).'</b>';
             foreach my $item (split(',',$values{$field->{'name'}})){
-                $result .= 
-		  &Apache::lonhtmlcommon::crumbs(&Apache::lonnet::clutter($item),
-		  'preview',
-		  '',
-		  (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),2,0,1);
+                $item = &Apache::lonnet::clutter($item);
+                $result .= &display_url($item,[2,0,1]);
             }
         } elsif (exists($field->{'format'}) && $field->{'format'} ne ''){
             $result.= &mt($field->{'translate'},
@@ -3456,15 +3453,7 @@
                                   $values{$field->{'name'}}))."<br />\n";
         } else {
             if ($field->{'special'} eq 'url link') {
-               if ($jumpurl=~/^http\:\/\//) {
-                 $result.='<tt>'.$jumpurl.'</tt>';
-               } else {
-                 $result .=
-		  &Apache::lonhtmlcommon::crumbs($jumpurl,
-		  'preview',
-		  '',
-		  (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),3,0,1);
-               }
+                $result .= &display_url($jumpurl,[3,0,1]);
             } else {
                 $result.= &mt($field->{'translate'},
                               $values{$field->{'name'}});
@@ -3520,19 +3509,13 @@
         $result .= '&nbsp;'.$tmp.'&nbsp;';
     }
     my $jumpurl=$values{'url'};
-    my $link;
-    if ($jumpurl=~m|^/ext/|) {
-	$jumpurl=~s|^/ext/|http://|;
-	$link='<br /><tt>'.$jumpurl.'</tt>';
-    } else {
-	$link=&Apache::lonhtmlcommon::crumbs($jumpurl,
-		  'preview',
-		  '',
-		  (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),2,0,1);
-    }
+    $jumpurl=~s|^/ext/|http://|;
+    my $link = &display_url($jumpurl,[2,0,1]);
+
     $result.=<<END;
 <a href="$jumpurl" 
-   target='preview'>$values{'title'}</a>$link
+   target='preview'>$values{'title'}</a> <br />
+$link <br />
 $values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br />
 $values{'copyrighttag'}<br />
 $values{'extrashow'}
@@ -3565,16 +3548,10 @@
 sub compact_view {
     my ($prefix,%values) = @_;
     my $jumpurl=$values{'url'};
-    my $link;
-    if ($jumpurl=~m|^/ext/|) {
-	$jumpurl=~s|^/ext/|http://|;
-	$link='<tt>'.$jumpurl.'</tt>';
-    } else {
-        $link=&Apache::lonhtmlcommon::crumbs($jumpurl,
-		  'preview',
-		  '',
-		  (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),1,1,1).' ';
-    }
+    $jumpurl=~s|^/ext/|http://|;
+
+    my $link = &display_url($jumpurl,[1,1,1]);
+    
     my $result = 
         $prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}).'">';
     if (exists($env{'form.sortfield'}) && 
@@ -3583,12 +3560,30 @@
         if (! defined($tmp)) { $tmp = 'undefined'; }
         $result .= '&nbsp;'.$tmp.'&nbsp;';
     }
-    $result.='&nbsp;<a href="'.$jumpurl.'" target="preview">'.
-        $values{'title'}.'</a>'.('&nbsp;'x2).$link.
-        '<b>'.$values{'author'}.'</b> ('.$values{'domain'}.')<br />';
+    $jumpurl = &HTML::Entities::encode($jumpurl,'<>&"');
+    $result.=' <span class="LC_nobreak">'.
+	'<a href="'.$jumpurl.'" target="preview">'.
+        &HTML::Entities::encode($values{'title'},'<>&"').'</a></span> '.
+	$link.' <b>'.$values{'author'}.'</b> ('.$values{'domain'}.')<br />';
     return $result;
 }
 
+sub display_url {
+    my ($url,$crumb_args) = @_;
+    my $link;
+    if ($url=~m|^/ext/|) {
+	$url=~s|^/ext/|http://|;
+	$link='<span class="LC_filename">'.$url.'</span>';
+    } 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}).' ';
+    }
+    return $link;
+}
 
 ######################################################################
 ######################################################################