### Eclipse Workspace Patch 1.0
#P moodle19
Index: mod/data/field/file/field.class.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/data/field/file/field.class.php,v
retrieving revision 1.17.2.1
diff -u -r1.17.2.1 field.class.php
--- mod/data/field/file/field.class.php	15 Apr 2008 02:37:29 -0000	1.17.2.1
+++ mod/data/field/file/field.class.php	15 Apr 2008 08:17:45 -0000
@@ -97,35 +97,29 @@
 
         global $CFG;
 
-        if ($content = get_record('data_content', 'fieldid', $this->field->id, 'recordid', $recordid)){
-            $contents[0] = $content->content;
-            $contents[1] = $content->content1;
-
-            $src = empty($contents[0])? '':$contents[0];
-            $name = empty($contents[1])? $src:$contents[1];
-
-            $path = $this->data->course.'/'.$CFG->moddata.'/data/'.$this->data->id.'/'.$this->field->id.'/'.$recordid;
-
-            if ($CFG->slasharguments) {
-                $source = $CFG->wwwroot.'/file.php/'.$path;
-            } else {
-                $source = $CFG->wwwroot.'/file.php?file=/'.$path;
-            }
+        if (!$content = get_record('data_content', 'fieldid', $this->field->id, 'recordid', $recordid)) {
+            return false;
+        }
 
-            $width = $this->field->param1 ? ' width = "'.s($this->field->param1).'" ':' ';
-            $height = $this->field->param2 ? ' height = "'.s($this->field->param2).'" ':' ';
+        $width = $this->field->param1 ? ' width = "'.s($this->field->param1).'" ':' ';
+        $height = $this->field->param2 ? ' height = "'.s($this->field->param2).'" ':' ';
 
-            if (isset($contents[0])) {
-                require_once($CFG->libdir.'/filelib.php');
-                $icon = mimeinfo('icon', $src);
-                $str = '<img src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />&nbsp;'.
-                                '<a href="'.$source.'/'.$src.'" >'.$name.'</a>';
-            } else {
-                $str = '';
-            }
-            return $str;
+        if (empty($content->content)) {
+            return '';
         }
-        return false;
+
+        require_once($CFG->libdir.'/filelib.php');
+
+        $src  = $content->content;
+        $name = empty($content->content1) ? $src : $content->content1;
+
+        $source = get_file_url($this->data->course.'/'.$CFG->moddata.'/data/'.$this->data->id.'/'.$this->field->id.'/'.$recordid);
+
+        $icon = mimeinfo('icon', $src);
+        $str = '<img src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />&nbsp;'.
+                        '<a href="'.$source.'/'.$src.'" >'.$name.'</a>';
+
+        return $str;
     }
 
 
