aboutsummaryrefslogtreecommitdiff
path: root/mod/file/views
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-30 14:00:57 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-30 14:00:57 +0000
commit34102e5462dcd08e9d5dd1b185e01f299b35b0e9 (patch)
tree15dafb46d9d7d93928ec9fef09da4c793b11fd26 /mod/file/views
parenta2b3db924719b111c7c01812fe3470fbbd1ae7cc (diff)
downloadelgg-34102e5462dcd08e9d5dd1b185e01f299b35b0e9.tar.gz
elgg-34102e5462dcd08e9d5dd1b185e01f299b35b0e9.tar.bz2
updated the object/file view
git-svn-id: http://code.elgg.org/elgg/trunk@7770 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/file/views')
-rw-r--r--mod/file/views/default/file/css.php21
-rw-r--r--mod/file/views/default/file/icon.php87
-rw-r--r--mod/file/views/default/file/icon/application/default.php12
-rw-r--r--mod/file/views/default/file/icon/application/excel.php12
-rw-r--r--mod/file/views/default/file/icon/application/msword.php12
-rw-r--r--mod/file/views/default/file/icon/application/pdf.php12
-rw-r--r--mod/file/views/default/file/icon/application/powerpoint.php12
-rw-r--r--mod/file/views/default/file/icon/application/vnd.ms-excel.php12
-rw-r--r--mod/file/views/default/file/icon/application/vnd.ms-powerpoint.php12
-rw-r--r--mod/file/views/default/file/icon/application/vnd.oasis.opendocument.text.php12
-rw-r--r--mod/file/views/default/file/icon/application/x-gzip.php7
-rw-r--r--mod/file/views/default/file/icon/application/x-rar-compressed.php7
-rw-r--r--mod/file/views/default/file/icon/application/x-stuffit.php7
-rw-r--r--mod/file/views/default/file/icon/application/zip.php7
-rw-r--r--mod/file/views/default/file/icon/archive.php12
-rw-r--r--mod/file/views/default/file/icon/audio.php12
-rw-r--r--mod/file/views/default/file/icon/audio/default.php7
-rw-r--r--mod/file/views/default/file/icon/default.php20
-rw-r--r--mod/file/views/default/file/icon/document.php12
-rw-r--r--mod/file/views/default/file/icon/text/default.php7
-rw-r--r--mod/file/views/default/file/icon/text/directory.php12
-rw-r--r--mod/file/views/default/file/icon/text/v-card.php7
-rw-r--r--mod/file/views/default/file/icon/video.php12
-rw-r--r--mod/file/views/default/file/icon/video/default.php7
-rw-r--r--mod/file/views/default/file/specialcontent/audio/mid.php4
-rw-r--r--mod/file/views/default/file/specialcontent/audio/mp3.php4
-rw-r--r--mod/file/views/default/file/specialcontent/audio/mpeg.php4
-rw-r--r--mod/file/views/default/file/specialcontent/audio/x-wav.php4
-rw-r--r--mod/file/views/default/file/specialcontent/image/default.php13
-rw-r--r--mod/file/views/default/object/file.php220
30 files changed, 189 insertions, 400 deletions
diff --git a/mod/file/views/default/file/css.php b/mod/file/views/default/file/css.php
index 8f4d1c6a6..206cdc345 100644
--- a/mod/file/views/default/file/css.php
+++ b/mod/file/views/default/file/css.php
@@ -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;
}
diff --git a/mod/file/views/default/file/icon.php b/mod/file/views/default/file/icon.php
index f2cb38785..63756a952 100644
--- a/mod/file/views/default/file/icon.php
+++ b/mod/file/views/default/file/icon.php
@@ -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;
diff --git a/mod/file/views/default/file/icon/application/default.php b/mod/file/views/default/file/icon/application/default.php
index d9d60901b..6a7c7e13c 100644
--- a/mod/file/views/default/file/icon/application/default.php
+++ b/mod/file/views/default/file/icon/application/default.php
@@ -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
diff --git a/mod/file/views/default/file/icon/application/excel.php b/mod/file/views/default/file/icon/application/excel.php
index a4123ea6e..f5cfffb54 100644
--- a/mod/file/views/default/file/icon/application/excel.php
+++ b/mod/file/views/default/file/icon/application/excel.php
@@ -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
diff --git a/mod/file/views/default/file/icon/application/msword.php b/mod/file/views/default/file/icon/application/msword.php
index 074f7ed91..edb7b3694 100644
--- a/mod/file/views/default/file/icon/application/msword.php
+++ b/mod/file/views/default/file/icon/application/msword.php
@@ -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
diff --git a/mod/file/views/default/file/icon/application/pdf.php b/mod/file/views/default/file/icon/application/pdf.php
index 1aeafdb7b..2b32c5825 100644
--- a/mod/file/views/default/file/icon/application/pdf.php
+++ b/mod/file/views/default/file/icon/application/pdf.php
@@ -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
diff --git a/mod/file/views/default/file/icon/application/powerpoint.php b/mod/file/views/default/file/icon/application/powerpoint.php
index 47a15b639..fba3af016 100644
--- a/mod/file/views/default/file/icon/application/powerpoint.php
+++ b/mod/file/views/default/file/icon/application/powerpoint.php
@@ -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
diff --git a/mod/file/views/default/file/icon/application/vnd.ms-excel.php b/mod/file/views/default/file/icon/application/vnd.ms-excel.php
index a4123ea6e..fe5b22ff0 100644
--- a/mod/file/views/default/file/icon/application/vnd.ms-excel.php
+++ b/mod/file/views/default/file/icon/application/vnd.ms-excel.php
@@ -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
diff --git a/mod/file/views/default/file/icon/application/vnd.ms-powerpoint.php b/mod/file/views/default/file/icon/application/vnd.ms-powerpoint.php
index 47a15b639..d6425be90 100644
--- a/mod/file/views/default/file/icon/application/vnd.ms-powerpoint.php
+++ b/mod/file/views/default/file/icon/application/vnd.ms-powerpoint.php
@@ -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
diff --git a/mod/file/views/default/file/icon/application/vnd.oasis.opendocument.text.php b/mod/file/views/default/file/icon/application/vnd.oasis.opendocument.text.php
index 309977160..82199922d 100644
--- a/mod/file/views/default/file/icon/application/vnd.oasis.opendocument.text.php
+++ b/mod/file/views/default/file/icon/application/vnd.oasis.opendocument.text.php
@@ -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
diff --git a/mod/file/views/default/file/icon/application/x-gzip.php b/mod/file/views/default/file/icon/application/x-gzip.php
index 72f839732..f90d28376 100644
--- a/mod/file/views/default/file/icon/application/x-gzip.php
+++ b/mod/file/views/default/file/icon/application/x-gzip.php
@@ -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);
diff --git a/mod/file/views/default/file/icon/application/x-rar-compressed.php b/mod/file/views/default/file/icon/application/x-rar-compressed.php
index 72f839732..3cc09b6d9 100644
--- a/mod/file/views/default/file/icon/application/x-rar-compressed.php
+++ b/mod/file/views/default/file/icon/application/x-rar-compressed.php
@@ -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);
diff --git a/mod/file/views/default/file/icon/application/x-stuffit.php b/mod/file/views/default/file/icon/application/x-stuffit.php
index 72f839732..7491e77a9 100644
--- a/mod/file/views/default/file/icon/application/x-stuffit.php
+++ b/mod/file/views/default/file/icon/application/x-stuffit.php
@@ -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);
diff --git a/mod/file/views/default/file/icon/application/zip.php b/mod/file/views/default/file/icon/application/zip.php
index 72f839732..c0bb01a47 100644
--- a/mod/file/views/default/file/icon/application/zip.php
+++ b/mod/file/views/default/file/icon/application/zip.php
@@ -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);
diff --git a/mod/file/views/default/file/icon/archive.php b/mod/file/views/default/file/icon/archive.php
index 694574e8f..552f7f218 100644
--- a/mod/file/views/default/file/icon/archive.php
+++ b/mod/file/views/default/file/icon/archive.php
@@ -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);
diff --git a/mod/file/views/default/file/icon/audio.php b/mod/file/views/default/file/icon/audio.php
index ce6f6ab4f..9a42be9ac 100644
--- a/mod/file/views/default/file/icon/audio.php
+++ b/mod/file/views/default/file/icon/audio.php
@@ -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);
diff --git a/mod/file/views/default/file/icon/audio/default.php b/mod/file/views/default/file/icon/audio/default.php
index 2bd1498b2..60e03b6c4 100644
--- a/mod/file/views/default/file/icon/audio/default.php
+++ b/mod/file/views/default/file/icon/audio/default.php
@@ -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);
diff --git a/mod/file/views/default/file/icon/default.php b/mod/file/views/default/file/icon/default.php
index ed1b71547..c4fc8e2a7 100644
--- a/mod/file/views/default/file/icon/default.php
+++ b/mod/file/views/default/file/icon/default.php
@@ -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\" />";
diff --git a/mod/file/views/default/file/icon/document.php b/mod/file/views/default/file/icon/document.php
index fed4660fb..55a71394e 100644
--- a/mod/file/views/default/file/icon/document.php
+++ b/mod/file/views/default/file/icon/document.php
@@ -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
diff --git a/mod/file/views/default/file/icon/text/default.php b/mod/file/views/default/file/icon/text/default.php
index bf5da852d..f6b42b587 100644
--- a/mod/file/views/default/file/icon/text/default.php
+++ b/mod/file/views/default/file/icon/text/default.php
@@ -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);
diff --git a/mod/file/views/default/file/icon/text/directory.php b/mod/file/views/default/file/icon/text/directory.php
index 863e53d68..f221100cd 100644
--- a/mod/file/views/default/file/icon/text/directory.php
+++ b/mod/file/views/default/file/icon/text/directory.php
@@ -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
diff --git a/mod/file/views/default/file/icon/text/v-card.php b/mod/file/views/default/file/icon/text/v-card.php
index 5c8ecd855..3554f37c1 100644
--- a/mod/file/views/default/file/icon/text/v-card.php
+++ b/mod/file/views/default/file/icon/text/v-card.php
@@ -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);
diff --git a/mod/file/views/default/file/icon/video.php b/mod/file/views/default/file/icon/video.php
index db3f001f7..ff6b7e68f 100644
--- a/mod/file/views/default/file/icon/video.php
+++ b/mod/file/views/default/file/icon/video.php
@@ -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
diff --git a/mod/file/views/default/file/icon/video/default.php b/mod/file/views/default/file/icon/video/default.php
index 0ff2db791..a33940ebf 100644
--- a/mod/file/views/default/file/icon/video/default.php
+++ b/mod/file/views/default/file/icon/video/default.php
@@ -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
index 61b3218f1..000000000
--- a/mod/file/views/default/file/specialcontent/audio/mid.php
+++ /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
index cb4ab9376..000000000
--- a/mod/file/views/default/file/specialcontent/audio/mp3.php
+++ /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
index cb4ab9376..000000000
--- a/mod/file/views/default/file/specialcontent/audio/mpeg.php
+++ /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
index b637eb1e1..000000000
--- a/mod/file/views/default/file/specialcontent/audio/x-wav.php
+++ /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
diff --git a/mod/file/views/default/file/specialcontent/image/default.php b/mod/file/views/default/file/specialcontent/image/default.php
index 8034c87d4..a55b97eb5 100644
--- a/mod/file/views/default/file/specialcontent/image/default.php
+++ b/mod/file/views/default/file/specialcontent/image/default.php
@@ -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>";
+}
diff --git a/mod/file/views/default/object/file.php b/mod/file/views/default/object/file.php
index 0f128eed6..166ab9cd3 100644
--- a/mod/file/views/default/object/file.php
+++ b/mod/file/views/default/object/file.php
@@ -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