]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
updated the object/file view
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 30 Dec 2010 14:00:57 +0000 (14:00 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 30 Dec 2010 14:00:57 +0000 (14:00 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7770 36083f99-b078-4883-b0ff-0f9b5a30f544

31 files changed:
mod/file/view.php
mod/file/views/default/file/css.php
mod/file/views/default/file/icon.php
mod/file/views/default/file/icon/application/default.php
mod/file/views/default/file/icon/application/excel.php
mod/file/views/default/file/icon/application/msword.php
mod/file/views/default/file/icon/application/pdf.php
mod/file/views/default/file/icon/application/powerpoint.php
mod/file/views/default/file/icon/application/vnd.ms-excel.php
mod/file/views/default/file/icon/application/vnd.ms-powerpoint.php
mod/file/views/default/file/icon/application/vnd.oasis.opendocument.text.php
mod/file/views/default/file/icon/application/x-gzip.php
mod/file/views/default/file/icon/application/x-rar-compressed.php
mod/file/views/default/file/icon/application/x-stuffit.php
mod/file/views/default/file/icon/application/zip.php
mod/file/views/default/file/icon/archive.php
mod/file/views/default/file/icon/audio.php
mod/file/views/default/file/icon/audio/default.php
mod/file/views/default/file/icon/default.php
mod/file/views/default/file/icon/document.php
mod/file/views/default/file/icon/text/default.php
mod/file/views/default/file/icon/text/directory.php
mod/file/views/default/file/icon/text/v-card.php
mod/file/views/default/file/icon/video.php
mod/file/views/default/file/icon/video/default.php
mod/file/views/default/file/specialcontent/audio/mid.php [deleted file]
mod/file/views/default/file/specialcontent/audio/mp3.php [deleted file]
mod/file/views/default/file/specialcontent/audio/mpeg.php [deleted file]
mod/file/views/default/file/specialcontent/audio/x-wav.php [deleted file]
mod/file/views/default/file/specialcontent/image/default.php
mod/file/views/default/object/file.php

index db123d3ad754016167ea8690eb72f578025e8409..ee882f60447c475daf167e8f3ebd560c6221d17d 100644 (file)
@@ -24,7 +24,7 @@ $title = $file->title;
 elgg_push_breadcrumb($title);
 
 $content = elgg_view_entity($file, true);
-//$content .= elgg_view_comments($file);
+$content .= elgg_view_comments($file);
 
 $body = elgg_view_layout('content', array(
        'content' => $content,
index 8f4d1c6a6348c581e6b06722e07a659a03752b7b..206cdc345a4237dc9ee96e9f5263323ef47ab451 100644 (file)
@@ -1,10 +1,21 @@
 <?php
-       /**
       * File CSS extender 
       
-        * @package Elgg File Repository
       */
+/**
+ * File CSS extender 
+ * 
+ * @package ElggFile
+ */
 ?>
+.file-image {
+       text-align: center;
+}
+.file-image img {
+       padding: 10px;
+       -webkit-border-radius: 6px;
+       -moz-border-radius: 6px;
+       background: #333333;
+}
+
+
 .files .entity-listing .entity-listing-info {
        width:453px;
 }
index f2cb3878529a5ae5621b4fa9ced493e5ecc287af..63756a95272fc97907f609aef536c5f2c6892b94 100644 (file)
@@ -1,62 +1,37 @@
 <?php
-       /**
-        * Elgg file icons.
-        * Displays an icon, depending on its mime type, for a file. 
-        * Optionally you can specify a size.
-        * 
-        * @package ElggFile
-        */
+/**
+ * Elgg file icons.
+ * Displays an icon, depending on its mime type, for a file. 
+ * Optionally you can specify a size.
+ * 
+ * @package ElggFile
+ *
+ * @uses $vars['size']
+ * @uses $vars['mimetype']
+ * @uses $vars['thumbnail']
+ * @uses $vars['file_guid']
+ */
 
-       global $CONFIG;
-       
-       $mime = $vars['mimetype'];
-       
-       // is this request for an image thumbnail
-       if (isset($vars['thumbnail'])) {
-               $thumbnail = $vars['thumbnail'];
-       } else {
-               $thumbnail = false;
-       }
+$mime = $vars['mimetype'];
+$simple_type = get_general_file_type($mime);
+
+// is this request for an image thumbnail
+$thumbnail = elgg_get_array_value('thumbnail', $vars, false);
 
-       // default size is small for thumbnails
-       if (isset($vars['size'])) {
-               $size = $vars['size'];
+// default size is small for thumbnails
+$size = elgg_get_array_value('size', $vars, 'small');
+
+if ($simple_type == 'image' && $thumbnail) {
+       $icon = "<img src=\"" . elgg_get_site_url() . "mod/file/thumbnail.php?file_guid={$vars['file_guid']}&size={$size}\" />";
+} else {
+       $base_type = substr($mime, 0, strpos($mime, '/'));
+       if ($mime && elgg_view_exists("file/icon/$mime")) {
+               $icon = elgg_view("file/icon/{$mime}", $vars);
+       } else if ($mime && elgg_view_exists("file/icon/$base_type/default")) {
+               $icon = elgg_view("file/icon/$base_type/default", $vars);
        } else {
-               $size = 'small';
-       }
-       
-       // Handle 
-       switch ($mime)
-       {
-               case 'image/jpg'        :
-               case 'image/jpeg'       :
-               case 'image/pjpeg'      :
-               case 'image/png'        :
-               case 'image/x-png'      :
-               case 'image/gif'        :
-               case 'image/bmp'        : 
-                       if ($thumbnail) {
-                               echo "<img src=\"".elgg_get_site_url()."mod/file/thumbnail.php?file_guid={$vars['file_guid']}&size={$size}\" border=\"0\" />";                          
-                       } else {
-                               if (!empty($mime) && elgg_view_exists("file/icon/{$mime}")) {
-                                       echo elgg_view("file/icon/{$mime}", $vars);
-                               } else if (!empty($mime) && elgg_view_exists("file/icon/" . substr($mime,0,strpos($mime,'/')) . "/default")) {
-                                       echo elgg_view("file/icon/" . substr($mime,0,strpos($mime,'/')) . "/default", $vars);
-                               } else {
-                                       echo "<img src=\"". elgg_view('file/icon/default',$vars) ."\" border=\"0\" />";
-                               }       
-                       }
-                       
-               break;
-               default :
-                       if (!empty($mime) && elgg_view_exists("file/icon/{$mime}")) {
-                               echo elgg_view("file/icon/{$mime}", $vars);
-                       } else if (!empty($mime) && elgg_view_exists("file/icon/" . substr($mime,0,strpos($mime,'/')) . "/default")) {
-                               echo elgg_view("file/icon/" . substr($mime,0,strpos($mime,'/')) . "/default", $vars);
-                       } else {
-                               echo "<img src=\"". elgg_view('file/icon/default',$vars) ."\" border=\"0\" />";
-                       } 
-               break;
+               $icon = elgg_view('file/icon/default', $vars);
        }
+}
 
-?>
\ No newline at end of file
+echo $icon;
index d9d60901bc9600aeeea84601322bff36b2274541..6a7c7e13c50b009d593ad04202441034d98111a2 100644 (file)
@@ -1,10 +1,8 @@
 <?php
+/**
+ * Default application icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo "<img src=\"".elgg_get_site_url()."mod/file/graphics/icons/application{$ext}.gif\" border=\"0\" />";
+$vars['type'] = 'application';
 
-?>
\ No newline at end of file
+echo elgg_view('file/icon/default', $vars);
\ No newline at end of file
index a4123ea6e213ad0b614c549a023978e06e1c65bc..f5cfffb54899d535350f90ab2917ee80cf22d2b4 100644 (file)
@@ -1,10 +1,8 @@
 <?php
+/**
+ * Excel icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo "<img src=\"".elgg_get_site_url()."mod/file/graphics/icons/excel{$ext}.gif\" border=\"0\" />";
+$vars['type'] = 'excel';
 
-?>
\ No newline at end of file
+echo elgg_view('file/icon/default', $vars);
\ No newline at end of file
index 074f7ed918d1be1e93f89c59a893819749b50f0c..edb7b36944a06fdcf92bd11071168d224b837756 100644 (file)
@@ -1,10 +1,8 @@
 <?php
+/**
+ * Word icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo "<img src=\"".elgg_get_site_url()."mod/file/graphics/icons/word{$ext}.gif\" border=\"0\" />";
+$vars['type'] = 'word';
 
-?>
\ No newline at end of file
+echo elgg_view('file/icon/default', $vars);
\ No newline at end of file
index 1aeafdb7bf5da7f798c67a729db24e0a65297c77..2b32c5825890cd6aa2f2b7fd5394eca443e9d6c5 100644 (file)
@@ -1,10 +1,8 @@
 <?php
+/**
+ * PDF icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo "<img src=\"".elgg_get_site_url()."mod/file/graphics/icons/pdf{$ext}.gif\" border=\"0\" />";
+$vars['type'] = 'pdf';
 
-?>
\ No newline at end of file
+echo elgg_view('file/icon/default', $vars);
\ No newline at end of file
index 47a15b639b625bcc306c7b2c3442408cf95b9407..fba3af0168cfb6eb2cb4905b0b11c9ee3aa789fc 100644 (file)
@@ -1,10 +1,8 @@
 <?php
+/**
+ * Powerpoint icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo "<img src=\"".elgg_get_site_url()."mod/file/graphics/icons/ppt{$ext}.gif\" border=\"0\" />";
+$vars['type'] = 'ppt';
 
-?>
\ No newline at end of file
+echo elgg_view('file/icon/default', $vars);
\ No newline at end of file
index a4123ea6e213ad0b614c549a023978e06e1c65bc..fe5b22ff0585242684063ce2b1c34837eb33c0a0 100644 (file)
@@ -1,10 +1,6 @@
 <?php
+/**
+ * Excel icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo "<img src=\"".elgg_get_site_url()."mod/file/graphics/icons/excel{$ext}.gif\" border=\"0\" />";
-
-?>
\ No newline at end of file
+echo elgg_view('file/icon/application/excel', $vars);
\ No newline at end of file
index 47a15b639b625bcc306c7b2c3442408cf95b9407..d6425be903497a666c8b88d5840a718262f5ca4f 100644 (file)
@@ -1,10 +1,6 @@
 <?php
+/**
+ * Powerpoint icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo "<img src=\"".elgg_get_site_url()."mod/file/graphics/icons/ppt{$ext}.gif\" border=\"0\" />";
-
-?>
\ No newline at end of file
+echo elgg_view('file/icon/application/powerpoint', $vars);
\ No newline at end of file
index 30997716005476dbf7d67e90a3f75b1180b2ce6d..82199922de18a71de90d0837283b5644f404f301 100644 (file)
@@ -1,10 +1,8 @@
 <?php
+/**
+ * Open Office icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo "<img src=\"".elgg_get_site_url()."mod/file/graphics/icons/openoffice{$ext}.gif\" border=\"0\" />";
+$vars['type'] = 'openoffice';
 
-?>
\ No newline at end of file
+echo elgg_view('file/icon/default', $vars);
\ No newline at end of file
index 72f8397329ab500ad8b55f824ca6ee4bab806d54..f90d28376083151f19932f9d8f65cee95b181424 100644 (file)
@@ -1,5 +1,6 @@
 <?php
+/**
+ * GZip icon
+ */
 
-       echo elgg_view('file/icon/archive',$vars);
-
-?>
\ No newline at end of file
+echo elgg_view('file/icon/archive', $vars);
index 72f8397329ab500ad8b55f824ca6ee4bab806d54..3cc09b6d94a5562bc4a40f498e79c44a7b41d2d6 100644 (file)
@@ -1,5 +1,6 @@
 <?php
+/**
+ * Rar icon
+ */
 
-       echo elgg_view('file/icon/archive',$vars);
-
-?>
\ No newline at end of file
+echo elgg_view('file/icon/archive', $vars);
index 72f8397329ab500ad8b55f824ca6ee4bab806d54..7491e77a99b00e80df516a787aa5baec70102cc3 100644 (file)
@@ -1,5 +1,6 @@
 <?php
+/**
+ * Stuffit icon
+ */
 
-       echo elgg_view('file/icon/archive',$vars);
-
-?>
\ No newline at end of file
+echo elgg_view('file/icon/archive', $vars);
index 72f8397329ab500ad8b55f824ca6ee4bab806d54..c0bb01a47eded9e83214350043a170289e764105 100644 (file)
@@ -1,5 +1,6 @@
 <?php
+/**
+ * Zip icon
+ */
 
-       echo elgg_view('file/icon/archive',$vars);
-
-?>
\ No newline at end of file
+echo elgg_view('file/icon/archive', $vars);
index 694574e8fa75925c13e315f06927ebf826db46ff..552f7f21844eedada2f6454e2d3218cdcc00cb00 100644 (file)
@@ -1,10 +1,8 @@
 <?php
+/**
+ * Archive icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo "<img src=\"".elgg_get_site_url()."mod/file/graphics/icons/archive{$ext}.gif\" border=\"0\" />";
+$vars['type'] = 'archive';
 
-?>
\ No newline at end of file
+echo elgg_view('file/icon/default', $vars);
index ce6f6ab4f911b3c4fec586dcc3cb484096016017..9a42be9acfcfef9d31590e6835349398b96fab8b 100644 (file)
@@ -1,10 +1,8 @@
 <?php
+/**
+ * Audio icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo "<img src=\"".elgg_get_site_url()."mod/file/graphics/icons/music{$ext}.gif\" border=\"0\" />";
+$vars['type'] = 'music';
 
-?>
\ No newline at end of file
+echo elgg_view('file/icon/default', $vars);
index 2bd1498b24f76bd584c7ba263cf8ddcc7ee0068b..60e03b6c48dd1b3855d92e6ecebd8bad5d2720ca 100644 (file)
@@ -1,5 +1,6 @@
 <?php
+/**
+ * Audio default icon
+ */
 
-       echo elgg_view('file/icon/audio',$vars);
-
-?>
\ No newline at end of file
+echo elgg_view('file/icon/audio', $vars);
index ed1b71547e3daafaec88617e278264d468a2d9ac..c4fc8e2a739772044a86c5b8c5801054fb9db9be 100644 (file)
@@ -1,10 +1,16 @@
 <?php
+/**
+ * Default file icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo elgg_get_site_url()."mod/file/graphics/icons/general{$ext}.gif";
+$type = elgg_get_array_value('type', $vars, 'general');
 
-?>
\ No newline at end of file
+$size = elgg_get_array_value('size', $vars, '');
+if ($size == 'large') {
+       $ext = '_lrg';
+} else {
+       $ext = '';
+}
+
+$src = elgg_get_site_url() . "mod/file/graphics/icons/{$type}{$ext}.gif";
+echo "<img src=\"$src\" />";
index fed4660fbe5a1a54b8c4e12f042dbfd0cb46fab9..55a71394e50128d767b21be422eb5f3dd19e3b6f 100644 (file)
@@ -1,10 +1,8 @@
 <?php
+/**
+ * Document icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo "<img src=\"".elgg_get_site_url()."mod/file/graphics/icons/text{$ext}.gif\" border=\"0\" />";
+$vars['type'] = 'text';
 
-?>
\ No newline at end of file
+echo elgg_view('file/icon/default', $vars);
\ No newline at end of file
index bf5da852dd3f0a4a48aae0350bf957d9fcc3e929..f6b42b587aa448afc504eba8987ad8d1a235140d 100644 (file)
@@ -1,5 +1,6 @@
 <?php
+/**
+ * Document default icon
+ */
 
-       echo elgg_view('file/icon/document',$vars);
-
-?>
\ No newline at end of file
+echo elgg_view('file/icon/document', $vars);
index 863e53d6870b830711d09d7e96fa91cf971aa71e..f221100cda9f3bc769007e1ee0f5431f86fc1453 100644 (file)
@@ -1,10 +1,8 @@
 <?php
+/**
+ * Directory default icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo "<img src=\"".elgg_get_site_url()."mod/file/graphics/icons/vcard{$ext}.gif\" border=\"0\" />";
+$vars['type'] = 'vcard';
 
-?>
\ No newline at end of file
+echo elgg_view('file/icon/default', $vars);
\ No newline at end of file
index 5c8ecd855022740db43e30f1ae7a52ad9bea12e6..3554f37c1755db3c68ca40987239bc8d2a842d92 100644 (file)
@@ -1,5 +1,6 @@
 <?php
+/**
+ * V-card icon
+ */
 
-       echo elgg_view('file/icon/text/directory',$vars);
-
-?>
\ No newline at end of file
+echo elgg_view('file/icon/text/directory', $vars);
index db3f001f7e7a2e218ba0094fc18d7ff4ac48f4c1..ff6b7e68fe546436096ac0b9ef1d1a94612838f5 100644 (file)
@@ -1,10 +1,8 @@
 <?php
+/**
+ * Video icon
+ */
 
-       if ($vars['size'] == 'large') {
-               $ext = '_lrg';
-       } else {
-               $ext = '';
-       }
-       echo "<img src=\"".elgg_get_site_url()."mod/file/graphics/icons/video{$ext}.gif\" border=\"0\" />";
+$vars['type'] = 'video';
 
-?>
\ No newline at end of file
+echo elgg_view('file/icon/default', $vars);
\ No newline at end of file
index 0ff2db791091f0da214d5cdc6e08dfbfe525e859..a33940ebfd7a7b8a8cc4f0e42e1c1adf10c602e0 100644 (file)
@@ -1,5 +1,6 @@
 <?php
+/**
+ * Video default icon
+ */
 
-       echo elgg_view('file/icon/video',$vars);
-
-?>
\ No newline at end of file
+echo elgg_view('file/icon/video', $vars);
diff --git a/mod/file/views/default/file/specialcontent/audio/mid.php b/mod/file/views/default/file/specialcontent/audio/mid.php
deleted file mode 100644 (file)
index 61b3218..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<object type="audio/midi" data="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $vars['entity']->getGUID(); ?>" width="200" height="20">
-  <param name="autoplay" value="false">
-  <param name="autoStart" value="0">
-</object>
\ No newline at end of file
diff --git a/mod/file/views/default/file/specialcontent/audio/mp3.php b/mod/file/views/default/file/specialcontent/audio/mp3.php
deleted file mode 100644 (file)
index cb4ab93..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<object type="audio/mpeg" data="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $vars['entity']->getGUID(); ?>" width="200" height="20">
-  <param name="autoplay" value="false">
-  <param name="autoStart" value="0">
-</object>
\ No newline at end of file
diff --git a/mod/file/views/default/file/specialcontent/audio/mpeg.php b/mod/file/views/default/file/specialcontent/audio/mpeg.php
deleted file mode 100644 (file)
index cb4ab93..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<object type="audio/mpeg" data="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $vars['entity']->getGUID(); ?>" width="200" height="20">
-  <param name="autoplay" value="false">
-  <param name="autoStart" value="0">
-</object>
\ No newline at end of file
diff --git a/mod/file/views/default/file/specialcontent/audio/x-wav.php b/mod/file/views/default/file/specialcontent/audio/x-wav.php
deleted file mode 100644 (file)
index b637eb1..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<object type="audio/x-wav" data="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $vars['entity']->getGUID(); ?>" width="200" height="20">
-  <param name="autoplay" value="false">
-  <param name="autoStart" value="0">
-</object>
\ No newline at end of file
index 8034c87d40ea99ea64864e435d0b22ddf18983c8..a55b97eb5c78650307c06e8f3b0f3bd83cbd8743 100644 (file)
@@ -1,9 +1,8 @@
 <?php
+/**
+ * Display an image
+ */
 
-       if ($vars['full'] && $smallthumb = $vars['entity']->smallthumb) {
-               echo "<p><a href=\"".elgg_get_site_url()."mod/file/download.php?file_guid={$vars['entity']->getGUID()}\"><img src=\"".elgg_get_site_url()."mod/file/thumbnail.php?file_guid={$vars['entity']->getGUID()}&size=large\" border=\"0\" /></a></p>";
-               
-       }
-
-?>
\ No newline at end of file
+if ($vars['full'] && $smallthumb = $vars['entity']->smallthumb) {
+       echo "<p class=\"file-image\"><a href=\"".elgg_get_site_url()."mod/file/download.php?file_guid={$vars['entity']->getGUID()}\"><img src=\"".elgg_get_site_url()."mod/file/thumbnail.php?file_guid={$vars['entity']->getGUID()}&size=large\" /></a></p>";
+}
index 0f128eed6efff7f2ec43a2284e49abd98087c0a3..166ab9cd3607533ebd81c66880337d7eda5b17a6 100644 (file)
@@ -17,14 +17,23 @@ $container = $file->getContainerEntity();
 $categories = elgg_view('categories/view', $vars);
 $excerpt = elgg_get_excerpt($file->description);
 $mime = $file->mimetype;
+$base_type = substr($mime, 0, strpos($mime,'/'));
+
+$body = elgg_view('output/longtext', array('value' => $file->description));
 
-$body = autop($file->description);
-$owner_icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'tiny'));
 $owner_link = elgg_view('output/url', array(
        'href' => "pg/file/owner/$owner->username",
        'text' => $owner->name,
 ));
 $author_text = elgg_echo('blog:author_by_line', array($owner_link));
+
+$file_icon = elgg_view('file/icon', array(
+       'mimetype' => $mime,
+       'thumbnail' => $file->thumbnail,
+       'file_guid' => $file->guid,
+       'size' => 'small'
+));
+
 if ($file->tags) {
        $tags = "<p class=\"elgg-tags\">" . elgg_view('output/tags', array('tags' => $file->tags)) . "</p>";
 } else {
@@ -58,6 +67,19 @@ if (elgg_in_context('widgets')) {
 
 if ($full) {
 
+       $extra = '';
+       if (elgg_view_exists("file/specialcontent/$mime")) {
+               $extra = elgg_view("file/specialcontent/$mime", $vars);
+       } else if (elgg_view_exists("file/specialcontent/$base_type/default")) {
+               $extra = elgg_view("file/specialcontent/$base_type/default", $vars);
+       }
+
+       $download = elgg_view('output/url', array(
+               'href' => "mod/file/download.php?file_guid=$file->guid",
+               'text' => elgg_echo("file:download"),
+               'class' => 'elgg-action-button',
+       ));
+
        $header = elgg_view_title($file->title);
 
        $params = array(
@@ -69,21 +91,15 @@ if ($full) {
        );
        $list_body = elgg_view('layout/objects/list/body', $params);
 
-       $file_info = elgg_view_image_block($owner_icon, $list_body);
-
-       if (elgg_view_exists('file/specialcontent/' . $mime)) {
-               $blah = "<div class='filerepo_specialcontent'>".elgg_view('file/specialcontent/' . $mime, $vars)."</div>";
-       } else if (elgg_view_exists("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default")) {
-               $blah = "<div class='filerepo_specialcontent'>".elgg_view("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default", $vars)."</div>";
-       }
-
+       $file_info = elgg_view_image_block($file_icon, $list_body);
 
        echo <<<HTML
 $header
 $file_info
 <div class="file elgg-content">
        $body
-       $blah
+       $extra
+       <p>$download</p>
 </div>
 HTML;
 
@@ -99,185 +115,5 @@ HTML;
        );
        $list_body = elgg_view('layout/objects/list/body', $params);
 
-       echo elgg_view_image_block($owner_icon, $list_body);
+       echo elgg_view_image_block($file_icon, $list_body);
 }
-
-return true;
-
-       global $CONFIG;
-
-       $file = $vars['entity'];
-
-       $file_guid = $file->getGUID();
-       $tags = $file->tags;
-       $title = $file->title;
-       $desc = $file->description;
-       $owner = $vars['entity']->getOwnerEntity();
-       $friendlytime = elgg_view_friendly_time($vars['entity']->time_created);
-       $mime = $file->mimetype;
-
-       if (!$title) {
-               $title = elgg_echo('untitled');
-       }
-
-       if (elgg_get_context() == "search") {   // Start search listing version
-
-               if (get_input('listtype') == "gallery") {
-                       echo "<div class='filerepo_gallery_item'>";
-                       if ($vars['entity']->smallthumb) {
-                               echo "<p class='filerepo_title'>" . $file->title . "</p>";
-                               echo "<p><a href=\"{$file->getURL()}\"><img src=\"".elgg_get_site_url()."mod/file/thumbnail.php?size=medium&file_guid={$vars['entity']->getGUID()}\" border=\"0\" /></a></p>";
-                               echo "<p class='filerepo_timestamp'><small><a href=\"".elgg_get_site_url()."pg/file/{$owner->username}\">{$owner->username}</a> {$friendlytime}</small></p>";
-
-                               //get the number of comments
-                               $numcomments = elgg_count_comments($vars['entity']);
-                               if ($numcomments)
-                                       echo "<p class='filerepo_comments'><a href=\"{$file->getURL()}\">" . elgg_echo("comments") . " (" . $numcomments . ")</a></p>";
-
-
-                               //if the user can edit, display edit and delete links
-                               if ($file->canEdit()) {
-                                       echo "<div class='filerepo_controls'><p>";
-                                       echo "<a href=\"".elgg_get_site_url()."mod/file/edit.php?file_guid={$file->getGUID()}\">" . elgg_echo('edit') . "</a>&nbsp;";
-                                       echo elgg_view('output/confirmlink',array(
-
-                                                       'href' => "action/file/delete?file=" . $file->getGUID(),
-                                                       'text' => elgg_echo("delete"),
-                                                       'confirm' => elgg_echo("file:delete:confirm"),
-                                                       'is_action' => true,
-
-                                               ));
-                                       echo "</p></div>";
-                               }
-
-
-                       } else {
-                               echo "<p class='filerepo_title'>{$title}</p>";
-                               echo "<a href=\"{$file->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid, 'size' => 'large')) . "</a>";
-                               echo "<p class='filerepo_timestamp'><small><a href=\"".elgg_get_site_url()."pg/file/{$owner->username}\">{$owner->name}</a> {$friendlytime}</small></p>";
-                               //get the number of comments
-                               $numcomments = elgg_count_comments($file);
-                               if ($numcomments)
-                                       echo "<p class='filerepo_comments'><a href=\"{$file->getURL()}\">" . elgg_echo("comments") . " (" . $numcomments . ")</a></p>";
-
-                       }
-                       echo "</div>";
-
-               } else {
-
-                       $info = "<p class='entity-title'> <a href=\"{$file->getURL()}\">{$title}</a></p>";
-                       $info .= "<p class='entity-subtext'><a href=\"".elgg_get_site_url()."pg/file/{$owner->username}\">{$owner->name}</a> {$friendlytime}";
-                       $numcomments = elgg_count_comments($file);
-                       if ($numcomments)
-                               $info .= ", <a href=\"{$file->getURL()}\">" . elgg_echo("comments") . " (" . $numcomments . ")</a>";
-                       $info .= "</p>";
-                       $icon = "<a href=\"{$file->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid, 'size' => 'small')) . "</a>";
-
-                       echo elgg_view_listing($icon, $info);
-
-               }
-
-       } else { // Start main version
-
-?>
-       <div class="filerepo_file">
-               <div class="filerepo_icon">
-                                       <a href="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $file_guid; ?>"><?php
-
-                                               echo elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid));
-
-                                       ?></a>
-               </div>
-
-               <div class="filerepo_title_owner_wrapper">
-               <?php
-                       //get the user and a link to their gallery
-                       $user_gallery = elgg_get_site_url() . "mod/file/search.php?md_type=simpletype&subtype=file&tag=image&owner_guid=" . $owner->guid . "&listtype=gallery";
-               ?>
-               <div class="filerepo_user_gallery_link"><a href="<?php echo $user_gallery; ?>"><?php echo elgg_echo("file:user:gallery",array('')); ?></a></div>
-               <div class="filerepo_title"><h2><a href="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $file_guid; ?>"><?php echo $title; ?></a></h2></div>
-               <div class="filerepo_owner">
-                               <?php
-
-                                       echo elgg_view("profile/icon",array('entity' => $owner, 'size' => 'tiny'));
-
-                               ?>
-                               <p class="filerepo_owner_details"><b><a href="<?php echo elgg_get_site_url(); ?>pg/file/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b><br />
-                               <small><?php echo $friendlytime; ?></small></p>
-               </div>
-               </div>
-
-
-               <div class="filerepo_maincontent">
-
-               <div class="filerepo_description"><?php echo elgg_view('output/longtext', array('value' => $desc)); ?></div>
-<?php
-
-               if (!empty($tags)) {
-?>
-                       <p class="tags"><?php echo elgg_view('output/tags',array('value' => $tags)); ?></p>
-<?php
-               }
-
-               $categories = elgg_view('categories/view',$vars);
-               if (!empty($categories)) {
-?>
-                       <p class="categories"><?php echo $categories; ?></p>
-<?php
-               }
-
-?>
-               <?php
-                       if (elgg_view_exists('file/specialcontent/' . $mime)) {
-                               echo "<div class='filerepo_specialcontent'>".elgg_view('file/specialcontent/' . $mime, $vars)."</div>";
-                       } else if (elgg_view_exists("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default")) {
-                               echo "<div class='filerepo_specialcontent'>".elgg_view("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default", $vars)."</div>";
-                       }
-
-               ?>
-
-               <div class="filerepo_download"><p><a class="elgg-action-button small" href="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $file_guid; ?>"><?php echo elgg_echo("file:download"); ?></a></p></div>
-
-<?php
-
-       if ($file->canEdit()) {
-?>
-
-       <div class="filerepo_controls">
-                               <p>
-                                       <a href="<?php echo elgg_get_site_url(); ?>mod/file/edit.php?file_guid=<?php echo $file->getGUID(); ?>"><?php echo elgg_echo('edit'); ?></a>&nbsp;
-                                       <?php
-                                               echo elgg_view('output/confirmlink',array(
-
-                                                       'href' => "action/file/delete?file=" . $file->getGUID(),
-                                                       'text' => elgg_echo("delete"),
-                                                       'confirm' => elgg_echo("file:delete:confirm"),
-                                                       'is_action' => true,
-
-                                               ));
-                                       ?>
-                               </p>
-       </div>
-
-<?php
-       }
-
-?>
-       </div>
-</div>
-
-<?php
-
-       if ($vars['full']) {
-
-               echo elgg_view_comments($file);
-
-       }
-
-?>
-
-<?php
-
-       }
-
-?>
\ No newline at end of file