From 34102e5462dcd08e9d5dd1b185e01f299b35b0e9 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 30 Dec 2010 14:00:57 +0000 Subject: updated the object/file view git-svn-id: http://code.elgg.org/elgg/trunk@7770 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/file/view.php | 2 +- mod/file/views/default/file/css.php | 21 +- mod/file/views/default/file/icon.php | 87 +++----- .../default/file/icon/application/default.php | 12 +- .../views/default/file/icon/application/excel.php | 12 +- .../views/default/file/icon/application/msword.php | 12 +- .../views/default/file/icon/application/pdf.php | 12 +- .../default/file/icon/application/powerpoint.php | 12 +- .../default/file/icon/application/vnd.ms-excel.php | 12 +- .../file/icon/application/vnd.ms-powerpoint.php | 12 +- .../application/vnd.oasis.opendocument.text.php | 12 +- .../views/default/file/icon/application/x-gzip.php | 7 +- .../file/icon/application/x-rar-compressed.php | 7 +- .../default/file/icon/application/x-stuffit.php | 7 +- .../views/default/file/icon/application/zip.php | 7 +- mod/file/views/default/file/icon/archive.php | 12 +- mod/file/views/default/file/icon/audio.php | 12 +- mod/file/views/default/file/icon/audio/default.php | 7 +- mod/file/views/default/file/icon/default.php | 20 +- mod/file/views/default/file/icon/document.php | 12 +- mod/file/views/default/file/icon/text/default.php | 7 +- .../views/default/file/icon/text/directory.php | 12 +- mod/file/views/default/file/icon/text/v-card.php | 7 +- mod/file/views/default/file/icon/video.php | 12 +- mod/file/views/default/file/icon/video/default.php | 7 +- .../default/file/specialcontent/audio/mid.php | 4 - .../default/file/specialcontent/audio/mp3.php | 4 - .../default/file/specialcontent/audio/mpeg.php | 4 - .../default/file/specialcontent/audio/x-wav.php | 4 - .../default/file/specialcontent/image/default.php | 13 +- mod/file/views/default/object/file.php | 220 +++------------------ 31 files changed, 190 insertions(+), 401 deletions(-) delete mode 100644 mod/file/views/default/file/specialcontent/audio/mid.php delete mode 100644 mod/file/views/default/file/specialcontent/audio/mp3.php delete mode 100644 mod/file/views/default/file/specialcontent/audio/mpeg.php delete mode 100644 mod/file/views/default/file/specialcontent/audio/x-wav.php (limited to 'mod/file') diff --git a/mod/file/view.php b/mod/file/view.php index db123d3ad..ee882f604 100644 --- a/mod/file/view.php +++ b/mod/file/view.php @@ -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, 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 @@ +.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 @@ "; +} 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 ""; - } 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 ""; - } - } - - 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 ""; - } - 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 @@ "; +$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 @@ "; +$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 @@ "; +$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 @@ "; +$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 @@ "; +$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 @@ "; - -?> \ 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 @@ "; - -?> \ 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 @@ "; +$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 @@ \ 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 @@ \ 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 @@ \ 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 @@ \ 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 @@ "; +$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 @@ "; +$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 @@ \ 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 @@ \ 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 ""; 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 @@ "; +$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 @@ \ 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 @@ "; +$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 @@ \ 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 @@ "; +$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 @@ \ 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 @@ - - - - \ 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 @@ - - - - \ 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 @@ - - - - \ 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 @@ - - - - \ 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 @@ smallthumb) { - - echo "

getGUID()}\">getGUID()}&size=large\" border=\"0\" />

"; - - } - -?> \ No newline at end of file +if ($vars['full'] && $smallthumb = $vars['entity']->smallthumb) { + echo "

getGUID()}\">getGUID()}&size=large\" />

"; +} 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 = "

" . elgg_view('output/tags', array('tags' => $file->tags)) . "

"; } 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 = "
".elgg_view('file/specialcontent/' . $mime, $vars)."
"; - } else if (elgg_view_exists("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default")) { - $blah = "
".elgg_view("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default", $vars)."
"; - } - + $file_info = elgg_view_image_block($file_icon, $list_body); echo << $body - $blah + $extra +

$download

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 ""; - - } else { - - $info = "

getURL()}\">{$title}

"; - $info .= "

username}\">{$owner->name} {$friendlytime}"; - $numcomments = elgg_count_comments($file); - if ($numcomments) - $info .= ", getURL()}\">" . elgg_echo("comments") . " (" . $numcomments . ")"; - $info .= "

"; - $icon = "getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid, 'size' => 'small')) . ""; - - echo elgg_view_listing($icon, $info); - - } - - } else { // Start main version - -?> -
- - -
- guid . "&listtype=gallery"; - ?> - -

-
- $owner, 'size' => 'tiny')); - - ?> -

name; ?>
-

-
-
- - -
- -
$desc)); ?>
- -

$tags)); ?>

- -

- - ".elgg_view('file/specialcontent/' . $mime, $vars)."
"; - } else if (elgg_view_exists("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default")) { - echo "
".elgg_view("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default", $vars)."
"; - } - - ?> - -

- -canEdit()) { -?> - -
-

-   - "action/file/delete?file=" . $file->getGUID(), - 'text' => elgg_echo("delete"), - 'confirm' => elgg_echo("file:delete:confirm"), - 'is_action' => true, - - )); - ?> -

-
- - -
- - - - - \ No newline at end of file -- cgit v1.2.3