diff options
Diffstat (limited to 'mod/file/views')
40 files changed, 328 insertions, 778 deletions
diff --git a/mod/file/views/default/embed/file_upload/content.php b/mod/file/views/default/embed/file_upload/content.php new file mode 100644 index 000000000..8b630c828 --- /dev/null +++ b/mod/file/views/default/embed/file_upload/content.php @@ -0,0 +1,17 @@ +<?php +/** + * Upload a file through the embed interface + */ + +$form_vars = array( + 'enctype' => 'multipart/form-data', + 'class' => 'elgg-form-embed', +); +$body_vars = array('container_guid' => elgg_get_page_owner_guid()); +echo elgg_view_form('file/upload', $form_vars, $body_vars); + +// the tab we want to be forwarded to after upload is complete +echo elgg_view('input/hidden', array( + 'name' => 'embed_forward', + 'value' => 'file', +));
\ No newline at end of file diff --git a/mod/file/views/default/file/css.php b/mod/file/views/default/file/css.php index d4d1a2c13..5476ed7e2 100644 --- a/mod/file/views/default/file/css.php +++ b/mod/file/views/default/file/css.php @@ -5,133 +5,11 @@ * @package ElggFile */ ?> -.file-image { +.file-photo { text-align: center; -} -.file-image img { - padding: 10px; - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - background: #333333; + margin-bottom: 15px; } .file-gallery-item { - float: left; text-align: center; width: 165px; - margin: 10px 10px 0 0; - padding: 5px; - background-color: #eeeeee; - -webkit-border-radius: 6px; - -moz-border-radius: 6px; -} -.file-gallery-item img { - margin: 5px 0; -} - - -.files .entity-listing .entity-listing-info { - width:453px; -} -.files .entity-listing:hover { - background-color: white; -} - -/* files - single entity view */ -.filerepo_title_owner_wrapper .filerepo_title, -.filerepo_title_owner_wrapper .filerepo_owner, -.filerepo_file .filerepo_maincontent { - margin-left: 70px !important; -} -.filerepo_owner_details { - margin:0; - padding:0; - line-height: 1.2em; -} -.filerepo_owner_details small { - color:#666666; -} -.filerepo_owner .elgg-user-icon { - margin: 3px 5px 5px 0; - float: left; -} -.filerepo_file .filerepo_icon { - width: 70px; - position: absolute; - margin:5px 0 10px 0; -} -.filerepo_file .filerepo_title { - margin:0; - padding:7px 4px 10px 0; - line-height: 1.2em; -} -.filerepo_file .filerepo_description { - margin:10px 0 0 0; -} -.filerepo_file .filerepo_description p { - padding:0 0 5px 0; - margin:0; -} -.filerepo_file .filerepo_specialcontent img { - padding:10px; - margin-bottom:10px; - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - background: #333333; -} - - -/* files - gallery view */ -.entity_gallery_item .filerepo_gallery_item { - margin:10px 10px 0 0; - padding:5px; - text-align:center; - background-color: #eeeeee; - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - width:165px; -} -.entity_gallery_item .filerepo_gallery_item:hover { - background-color: #999999; -} -.filerepo_download, -.filerepo_controls { - padding:0 0 1px 0; - margin:0 0 10px 0; -} -.entity_gallery .filerepo_title { - font-weight: bold; - line-height: 1.1em; - margin:0 0 10px 0; -} -.filerepo_gallery_item p { - margin:0; - padding:0; -} -.filerepo_gallery_item .filerepo_controls { - margin-top:10px; -} -.filerepo_gallery_item .filerepo_controls a { - padding-right:10px; - padding-left:10px; -} -.entity_gallery .filerepo_comments { - font-size:90%; -} -.filerepo_user_gallery_link { - float:right; - margin:5px 5px 5px 50px; -} -.filerepo_user_gallery_link a { - padding:2px 25px 5px 0; - background: transparent url(<?php echo elgg_get_site_url(); ?>mod/file/graphics/icon_gallery.gif) no-repeat right top; - display:block; -} -.filerepo_user_gallery_link a:hover { - background-position: right -40px; } - - - - - - diff --git a/mod/file/views/default/file/embed_upload.php b/mod/file/views/default/file/embed_upload.php deleted file mode 100644 index 8a54a4fa9..000000000 --- a/mod/file/views/default/file/embed_upload.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Files upload form for embed - */ - -$access_id = get_default_access(get_loggedin_user()); -if ($categories = elgg_view('categories', $vars)) { - $categories = "<p>$categories</p>"; -} - -// recycling the upload action so some of these options are a bit weird. -$form_body = '<p>' . elgg_view('input/file', array('internalname' => 'upload')) . '</p>'; -$form_body .= '<p>' . elgg_echo('file:title') . ": " . elgg_view("input/text", array('internalname' => 'title')) . '</p>'; -$form_body .= '<p>' . elgg_echo('file:desc') . ": " . elgg_view("input/text",array('internalname' => 'description')) . '</p>'; -$form_body .= '<p>' . elgg_echo('file:tags') . ": " . elgg_view("input/tags", array('internalname' => 'tags')) . '</p>'; -$form_body .= '<p>' . elgg_echo('access') . ": " . elgg_view('input/access', array('internalname' => 'access_id', 'value' => $access_id)) . '</p>'; -$form_body .= $categories; -$form_body .= elgg_view('input/hidden', array('internalname' => 'ajax', 'value' => TRUE)); -$form_body .= '<p>' . elgg_view('input/submit', array('value' => elgg_echo('upload'))) . '</p>'; - -echo elgg_view('input/form', array( - 'body' => $form_body, - 'internalid' => 'file_embed_upload', - 'action' => 'action/file/upload', -)); - -?> - -<script type="text/javascript"> -$(document).ready(function() { - // fire off the ajax upload - $('#file_embed_upload').submit(function() { - var options = { - success: function(data) { - var info = jQuery.parseJSON(data); - - if (info.status == 'success') { - $('.popup .content').load('<?php echo elgg_get_site_url() . 'pg/embed/embed'; ?>?active_section=file'); - } else { - $('.popup .content').find('form').prepend('<p>' + info.message + '</p>'); - } - } - }; - $(this).ajaxSubmit(options); - return false; - }); -}); -</script> diff --git a/mod/file/views/default/file/group_module.php b/mod/file/views/default/file/group_module.php new file mode 100644 index 000000000..ad6c58dbb --- /dev/null +++ b/mod/file/views/default/file/group_module.php @@ -0,0 +1,45 @@ +<?php +/** + * Group file module + */ + +$group = elgg_get_page_owner_entity(); + +if ($group->file_enable == "no") { + return true; +} + +$all_link = elgg_view('output/url', array( + 'href' => "file/group/$group->guid/all", + 'text' => elgg_echo('link:view:all'), + 'is_trusted' => true, +)); + +elgg_push_context('widgets'); +$options = array( + 'type' => 'object', + 'subtype' => 'file', + 'container_guid' => elgg_get_page_owner_guid(), + 'limit' => 6, + 'full_view' => false, + 'pagination' => false, +); +$content = elgg_list_entities($options); +elgg_pop_context(); + +if (!$content) { + $content = '<p>' . elgg_echo('file:none') . '</p>'; +} + +$new_link = elgg_view('output/url', array( + 'href' => "file/add/$group->guid", + 'text' => elgg_echo('file:add'), + 'is_trusted' => true, +)); + +echo elgg_view('groups/profile/module', array( + 'title' => elgg_echo('file:group'), + 'content' => $content, + 'all_link' => $all_link, + 'add_link' => $new_link, +)); diff --git a/mod/file/views/default/file/groupprofile_files.php b/mod/file/views/default/file/groupprofile_files.php deleted file mode 100644 index 5cbf75bce..000000000 --- a/mod/file/views/default/file/groupprofile_files.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - - // Files on group profile page - - //check to make sure group files is activated - if($vars['entity']->file_enable != 'no'){ - -?> -<div class="group_tool_widget files"> -<h3><?php echo elgg_echo("file:group"); ?></h3> - -<?php - - //the number of files to display - $number = (int) $vars['entity']->num_display; - if (!$number) - $number = 6; - - //get the group's files - $files = elgg_get_entities(array('type' => 'object', - 'subtype' => 'file', - 'container_guid' => $vars['entity']->guid, - 'limit' => $number - )); - - //if there are some files, go get them - if ($files) { - - //display in list mode - foreach($files as $f){ - - $mime = $f->mimetype; - echo "<div class='entity-listing clearfix'>"; - echo "<div class='entity-listing-icon'><a href=\"{$f->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $f->thumbnail, 'file_guid' => $f->guid)) . "</a></div>"; - echo "<div class='entity-listing-info'>"; - echo "<p class='entity-title'>" . $f->title . "</p>"; - echo "<p class='entity-subtext'>" . elgg_view_friendly_time($f->time_created) . "</p>"; - echo "</div></div>"; - - } - - - //get a link to the users files - $users_file_url = elgg_get_site_url() . "pg/file/group/" . elgg_get_page_owner()->guid; - - echo "<p><a href=\"{$users_file_url}\">" . elgg_echo('file:more') . "</a></p>"; - - } else { - - echo "<p class='margin-top'>" . elgg_echo("file:none") . "</p>"; - - } - -?> -</div> - -<?php - }//end of activate check statement -?>
\ No newline at end of file diff --git a/mod/file/views/default/file/icon.php b/mod/file/views/default/file/icon.php deleted file mode 100644 index 63756a952..000000000 --- a/mod/file/views/default/file/icon.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * 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'] - */ - -$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 -$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 { - $icon = elgg_view('file/icon/default', $vars); - } -} - -echo $icon; diff --git a/mod/file/views/default/file/icon/application/default.php b/mod/file/views/default/file/icon/application/default.php deleted file mode 100644 index 6a7c7e13c..000000000 --- a/mod/file/views/default/file/icon/application/default.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -/** - * Default application icon - */ - -$vars['type'] = 'application'; - -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 deleted file mode 100644 index f5cfffb54..000000000 --- a/mod/file/views/default/file/icon/application/excel.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -/** - * Excel icon - */ - -$vars['type'] = 'excel'; - -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 deleted file mode 100644 index edb7b3694..000000000 --- a/mod/file/views/default/file/icon/application/msword.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -/** - * Word icon - */ - -$vars['type'] = 'word'; - -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 deleted file mode 100644 index 2b32c5825..000000000 --- a/mod/file/views/default/file/icon/application/pdf.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -/** - * PDF icon - */ - -$vars['type'] = 'pdf'; - -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 deleted file mode 100644 index fba3af016..000000000 --- a/mod/file/views/default/file/icon/application/powerpoint.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -/** - * Powerpoint icon - */ - -$vars['type'] = 'ppt'; - -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 deleted file mode 100644 index fe5b22ff0..000000000 --- a/mod/file/views/default/file/icon/application/vnd.ms-excel.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -/** - * Excel icon - */ - -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 deleted file mode 100644 index d6425be90..000000000 --- a/mod/file/views/default/file/icon/application/vnd.ms-powerpoint.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -/** - * Powerpoint icon - */ - -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 deleted file mode 100644 index 82199922d..000000000 --- a/mod/file/views/default/file/icon/application/vnd.oasis.opendocument.text.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -/** - * Open Office icon - */ - -$vars['type'] = 'openoffice'; - -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 deleted file mode 100644 index f90d28376..000000000 --- a/mod/file/views/default/file/icon/application/x-gzip.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -/** - * GZip icon - */ - -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 deleted file mode 100644 index 3cc09b6d9..000000000 --- a/mod/file/views/default/file/icon/application/x-rar-compressed.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -/** - * Rar icon - */ - -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 deleted file mode 100644 index 7491e77a9..000000000 --- a/mod/file/views/default/file/icon/application/x-stuffit.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -/** - * Stuffit icon - */ - -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 deleted file mode 100644 index c0bb01a47..000000000 --- a/mod/file/views/default/file/icon/application/zip.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -/** - * Zip icon - */ - -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 deleted file mode 100644 index 552f7f218..000000000 --- a/mod/file/views/default/file/icon/archive.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -/** - * Archive icon - */ - -$vars['type'] = 'archive'; - -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 deleted file mode 100644 index 9a42be9ac..000000000 --- a/mod/file/views/default/file/icon/audio.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -/** - * Audio icon - */ - -$vars['type'] = 'music'; - -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 deleted file mode 100644 index 60e03b6c4..000000000 --- a/mod/file/views/default/file/icon/audio/default.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -/** - * Audio default icon - */ - -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 deleted file mode 100644 index c4fc8e2a7..000000000 --- a/mod/file/views/default/file/icon/default.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -/** - * Default file icon - */ - -$type = elgg_get_array_value('type', $vars, 'general'); - -$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 deleted file mode 100644 index 55a71394e..000000000 --- a/mod/file/views/default/file/icon/document.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -/** - * Document icon - */ - -$vars['type'] = 'text'; - -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 deleted file mode 100644 index f6b42b587..000000000 --- a/mod/file/views/default/file/icon/text/default.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -/** - * Document default icon - */ - -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 deleted file mode 100644 index f221100cd..000000000 --- a/mod/file/views/default/file/icon/text/directory.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -/** - * Directory default icon - */ - -$vars['type'] = 'vcard'; - -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 deleted file mode 100644 index 3554f37c1..000000000 --- a/mod/file/views/default/file/icon/text/v-card.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -/** - * V-card icon - */ - -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 deleted file mode 100644 index ff6b7e68f..000000000 --- a/mod/file/views/default/file/icon/video.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -/** - * Video icon - */ - -$vars['type'] = 'video'; - -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 deleted file mode 100644 index a33940ebf..000000000 --- a/mod/file/views/default/file/icon/video/default.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -/** - * Video default icon - */ - -echo elgg_view('file/icon/video', $vars); diff --git a/mod/file/views/default/file/sidebar.php b/mod/file/views/default/file/sidebar.php new file mode 100644 index 000000000..f61b8e64e --- /dev/null +++ b/mod/file/views/default/file/sidebar.php @@ -0,0 +1,14 @@ +<?php +/** + * File sidebar + */ + +echo elgg_view('page/elements/comments_block', array( + 'subtypes' => 'file', + 'owner_guid' => elgg_get_page_owner_guid(), +)); + +echo elgg_view('page/elements/tagcloud_block', array( + 'subtypes' => 'file', + 'owner_guid' => elgg_get_page_owner_guid(), +)); diff --git a/mod/file/views/default/file/specialcontent/image/default.php b/mod/file/views/default/file/specialcontent/image/default.php index a55b97eb5..431ac9f4f 100644 --- a/mod/file/views/default/file/specialcontent/image/default.php +++ b/mod/file/views/default/file/specialcontent/image/default.php @@ -1,8 +1,20 @@ <?php /** * Display an image + * + * @uses $vars['entity'] */ -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>"; +$file = $vars['entity']; + +$image_url = $file->getIconURL('large'); +$image_url = elgg_format_url($image_url); +$download_url = elgg_get_site_url() . "file/download/{$file->getGUID()}"; + +if ($vars['full_view']) { + echo <<<HTML + <div class="file-photo"> + <a href="$download_url"><img class="elgg-photo" src="$image_url" /></a> + </div> +HTML; } diff --git a/mod/file/views/default/file/typecloud.php b/mod/file/views/default/file/typecloud.php index bb322d4d7..4253bf674 100644 --- a/mod/file/views/default/file/typecloud.php +++ b/mod/file/views/default/file/typecloud.php @@ -1,59 +1,50 @@ <?php +/** + * Type cloud + */ - $types = $vars['types']; +function file_type_cloud_get_url($type, $friends) { + $url = elgg_get_site_url() . 'file/search?subtype=file'; - if (is_array($vars['types']) && sizeof($vars['types'])) { + if ($type->tag != "all") { + $url .= "&md_type=simpletype&tag=" . urlencode($type->tag); + } -?> -<ul> -<?php + if ($friends) { + $url .= "&friends=$friends"; + } - $all = new stdClass; - $all->tag = "all"; - $vars['types'][] = $all; - $vars['types'] = array_reverse($vars['types']); - foreach($vars['types'] as $type) { - - $tag = $type->tag; - if ($tag != "all") { - $label = elgg_echo("file:type:" . $tag); - } else { - $label = elgg_echo('all'); - } - - $url = elgg_get_site_url() . "mod/file/search.php?subtype=file"; - if ($tag != "all") - $url .= "&md_type=simpletype&tag=" . urlencode($tag); - if (isset($vars['friend_guid']) && $vars['friend_guid'] != false) { - $url .= "&friends_guid={$vars['friend_guid']}"; - } else if ($vars['owner_guid'] != "") { - if (is_array($vars['owner_guid'])) { - $owner_guid = implode(",",$vars['owner_guid']); - } else { - $owner_guid = $vars['owner_guid']; - } - $url .= "&owner_guid={$owner_guid}"; - } - if ($tag == "image") - $url .= "&listtype=gallery"; + if ($type->tag == "image") { + $url .= "&list_type=gallery"; + } + if (elgg_get_page_owner_guid()) { $url .= "&page_owner=" . elgg_get_page_owner_guid(); + } - $inputtag = get_input('tag'); - if ($inputtag == $tag || (empty($inputtag) && $tag == "all")) { - $class = " class=\"selected\" "; - } else { - $class = ""; - } + return $url; +} - add_submenu_item($label, $url, 'filetypes'); - } -?> -</ul> +$types = elgg_extract('types', $vars, array()); +if (!$types) { + return true; +} -<?php +$friends = elgg_extract('friends', $vars, false); - } +$all = new stdClass; +$all->tag = "all"; +elgg_register_menu_item('page', array( + 'name' => 'file:all', + 'text' => elgg_echo('all'), + 'href' => file_type_cloud_get_url($all, $friends), +)); -?>
\ No newline at end of file +foreach ($types as $type) { + elgg_register_menu_item('page', array( + 'name' => "file:$type->tag", + 'text' => elgg_echo("file:type:$type->tag"), + 'href' => file_type_cloud_get_url($type, $friends), + )); +} diff --git a/mod/file/views/default/file/upload.php b/mod/file/views/default/file/upload.php deleted file mode 100644 index 041bd9227..000000000 --- a/mod/file/views/default/file/upload.php +++ /dev/null @@ -1,128 +0,0 @@ -<?php -/** - * Elgg file browser uploader - * - * @package ElggFile - */ - -global $CONFIG; - -if (isset($vars['entity'])) { - $action_type = "update"; - $action = "file/upload"; - $title = $vars['entity']->title; - $description = $vars['entity']->description; - $tags = $vars['entity']->tags; - $access_id = $vars['entity']->access_id; - $container_guid = $vars['entity']->container_guid; -} else { - $action_type = "new"; - $action = "file/upload"; - $title = isset($_SESSION['uploadtitle']) ? $_SESSION['uploadtitle'] : ''; - $description = isset($_SESSION['uploaddesc']) ? $_SESSION['uploaddesc'] : ''; - $tags = isset($_SESSION['uploadtags']) ? $_SESSION['uploadtags'] : ''; - if (defined('ACCESS_DEFAULT')) { - $access_id = ACCESS_DEFAULT; - } else { - $access_id = 0; - } - $access_id = isset($_SESSION['uploadaccessid']) ? $_SESSION['uploadaccessid'] : $access_id; - $container_guid = elgg_get_page_owner_guid(); -} - -// make sure session cache is cleared -unset($_SESSION['uploadtitle']); -unset($_SESSION['uploaddesc']); -unset($_SESSION['uploadtags']); -unset($_SESSION['uploadaccessid']); - - -?> -<form action="<?php echo elgg_get_site_url(); ?>action/<?php echo $action; ?>" enctype="multipart/form-data" method="post" class="margin-top"> -<p> - <label> -<?php - echo elgg_view('input/securitytoken'); - if ($action_type == "new") { - echo elgg_echo("file:file"); - } else { - echo elgg_echo("file:replace"); - } -?> -<br /> -<?php - - echo elgg_view("input/file",array('internalname' => 'upload')); - -?> - </label> -</p> -<p> - <label><?php echo elgg_echo("title"); ?><br /> -<?php - - echo elgg_view("input/text", array( - "internalname" => "title", - "value" => $title, - )); - -?> - </label> -</p> -<p class="longtext_inputarea"> - <label><?php echo elgg_echo("description"); ?></label> -<?php - - echo elgg_view("input/longtext",array( - "internalname" => "description", - "value" => $description, - )); -?> -</p> -<p> - <label><?php echo elgg_echo("tags"); ?><br /> -<?php - - echo elgg_view("input/tags", array( - "internalname" => "tags", - "value" => $tags, - )); - -?> - </label> -</p> -<?php - - $categories = elgg_view('categories',$vars); - if (!empty($categories)) { -?> - - <p> - <?php echo $categories; ?> - </p> - -<?php - } - -?> -<p> - <label> - <?php echo elgg_echo('access'); ?><br /> - <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); ?> - </label> -</p> - -<p> -<?php - - echo "<input type=\"hidden\" name=\"container_guid\" value=\"{$container_guid}\" />"; - - if (isset($vars['entity'])) { - echo "<input type=\"hidden\" name=\"file_guid\" value=\"{$vars['entity']->getGUID()}\" />"; - } - -?> - <input type="submit" value="<?php echo elgg_echo("save"); ?>" /> -</p> - -</form>
\ No newline at end of file diff --git a/mod/file/views/default/forms/file/upload.php b/mod/file/views/default/forms/file/upload.php new file mode 100644 index 000000000..f637a419e --- /dev/null +++ b/mod/file/views/default/forms/file/upload.php @@ -0,0 +1,68 @@ +<?php +/** + * Elgg file upload/save form + * + * @package ElggFile + */ + +// once elgg_view stops throwing all sorts of junk into $vars, we can use +$title = elgg_extract('title', $vars, ''); +$desc = elgg_extract('description', $vars, ''); +$tags = elgg_extract('tags', $vars, ''); +$access_id = elgg_extract('access_id', $vars, ACCESS_DEFAULT); +$container_guid = elgg_extract('container_guid', $vars); +if (!$container_guid) { + $container_guid = elgg_get_logged_in_user_guid(); +} +$guid = elgg_extract('guid', $vars, null); + +if ($guid) { + $file_label = elgg_echo("file:replace"); + $submit_label = elgg_echo('save'); +} else { + $file_label = elgg_echo("file:file"); + $submit_label = elgg_echo('upload'); +} + +?> +<div> + <label><?php echo $file_label; ?></label><br /> + <?php echo elgg_view('input/file', array('name' => 'upload')); ?> +</div> +<div> + <label><?php echo elgg_echo('title'); ?></label><br /> + <?php echo elgg_view('input/text', array('name' => 'title', 'value' => $title)); ?> +</div> +<div> + <label><?php echo elgg_echo('description'); ?></label> + <?php echo elgg_view('input/longtext', array('name' => 'description', 'value' => $desc)); ?> +</div> +<div> + <label><?php echo elgg_echo('tags'); ?></label> + <?php echo elgg_view('input/tags', array('name' => 'tags', 'value' => $tags)); ?> +</div> +<?php + +$categories = elgg_view('input/categories', $vars); +if ($categories) { + echo $categories; +} + +?> +<div> + <label><?php echo elgg_echo('access'); ?></label><br /> + <?php echo elgg_view('input/access', array('name' => 'access_id', 'value' => $access_id)); ?> +</div> +<div class="elgg-foot"> +<?php + +echo elgg_view('input/hidden', array('name' => 'container_guid', 'value' => $container_guid)); + +if ($guid) { + echo elgg_view('input/hidden', array('name' => 'file_guid', 'value' => $guid)); +} + +echo elgg_view('input/submit', array('value' => $submit_label)); + +?> +</div> diff --git a/mod/file/views/default/icon/object/file.php b/mod/file/views/default/icon/object/file.php new file mode 100644 index 000000000..a3190310b --- /dev/null +++ b/mod/file/views/default/icon/object/file.php @@ -0,0 +1,54 @@ +<?php +/** + * File icon view + * + * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method + * @uses $vars['size'] topbar, tiny, small, medium (default), large, master + * @uses $vars['href'] Optional override for link + * @uses $vars['img_class'] Optional CSS class added to img + * @uses $vars['link_class'] Optional CSS class added to link + */ + +$entity = $vars['entity']; + +$sizes = array('small', 'medium', 'large', 'tiny', 'master', 'topbar'); +// Get size +if (!in_array($vars['size'], $sizes)) { + $vars['size'] = "medium"; +} + +$title = $entity->title; +$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8', false); + +$url = $entity->getURL(); +if (isset($vars['href'])) { + $url = $vars['href']; +} + +$class = ''; +if (isset($vars['img_class'])) { + $class = $vars['img_class']; +} +if ($entity->thumbnail) { + $class = "class=\"elgg-photo $class\""; +} else if ($class) { + $class = "class=\"$class\""; +} + +$img_src = $entity->getIconURL($vars['size']); +$img_src = elgg_format_url($img_src); +$img = "<img $class src=\"$img_src\" alt=\"$title\" />"; + +if ($url) { + $params = array( + 'href' => $url, + 'text' => $img, + 'is_trusted' => true, + ); + if (isset($vars['link_class'])) { + $params['class'] = $vars['link_class']; + } + echo elgg_view('output/url', $params); +} else { + echo $img; +} diff --git a/mod/file/views/default/object/file.php b/mod/file/views/default/object/file.php index 1d3aa7140..64f19c483 100644 --- a/mod/file/views/default/object/file.php +++ b/mod/file/views/default/object/file.php @@ -5,8 +5,8 @@ * @package ElggFile */ -$full = elgg_get_array_value('full', $vars, FALSE); -$file = elgg_get_array_value('entity', $vars, FALSE); +$full = elgg_extract('full_view', $vars, FALSE); +$file = elgg_extract('entity', $vars, FALSE); if (!$file) { return TRUE; @@ -14,51 +14,43 @@ if (!$file) { $owner = $file->getOwnerEntity(); $container = $file->getContainerEntity(); -$categories = elgg_view('categories/view', $vars); +$categories = elgg_view('output/categories', $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)); - $owner_link = elgg_view('output/url', array( - 'href' => "pg/file/owner/$owner->username", + 'href' => "file/owner/$owner->username", 'text' => $owner->name, + 'is_trusted' => true, )); -$author_text = elgg_echo('blog:author_by_line', array($owner_link)); +$author_text = elgg_echo('byline', array($owner_link)); -$file_icon = elgg_view('file/icon', array( - 'mimetype' => $mime, - 'thumbnail' => $file->thumbnail, - 'file_guid' => $file->guid, - 'size' => 'small' -)); +$file_icon = elgg_view_entity_icon($file, 'small'); -if ($file->tags) { - $tags = "<p class=\"elgg-tags\">" . elgg_view('output/tags', array('tags' => $file->tags)) . "</p>"; -} else { - $tags = ""; -} $date = elgg_view_friendly_time($file->time_created); -$comments_count = elgg_count_comments($file); +$comments_count = $file->countComments(); //only display if there are commments if ($comments_count != 0) { $text = elgg_echo("comments") . " ($comments_count)"; $comments_link = elgg_view('output/url', array( 'href' => $file->getURL() . '#file-comments', 'text' => $text, + 'is_trusted' => true, )); } else { $comments_link = ''; } -$metadata = elgg_view('layout/objects/list/metadata', array( - 'entity' => $file, +$metadata = elgg_view_menu('entity', array( + 'entity' => $vars['entity'], 'handler' => 'file', + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', )); -$subtitle = "$author_text $date $categories $comments_link"; +$subtitle = "$author_text $date $comments_link $categories"; // do not show the metadata and controls in widget view if (elgg_in_context('widgets')) { @@ -74,39 +66,29 @@ if ($full && !elgg_in_context('gallery')) { $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( 'entity' => $file, 'title' => false, 'metadata' => $metadata, 'subtitle' => $subtitle, - 'tags' => $tags, ); - $list_body = elgg_view('layout/objects/list/body', $params); + $params = $params + $vars; + $summary = elgg_view('object/elements/summary', $params); - $file_info = elgg_view_image_block($file_icon, $list_body); + $text = elgg_view('output/longtext', array('value' => $file->description)); + $body = "$text $extra"; - echo <<<HTML -$header -$file_info -<div class="file elgg-content"> - $body - $extra - <p>$download</p> -</div> -HTML; + echo elgg_view('object/elements/full', array( + 'entity' => $file, + 'icon' => $file_icon, + 'summary' => $summary, + 'body' => $body, + )); } elseif (elgg_in_context('gallery')) { echo '<div class="file-gallery-item">'; echo "<h3>" . $file->title . "</h3>"; - echo "<a href=\"{$file->getURL()}\"><img src=\"".elgg_get_site_url()."mod/file/thumbnail.php?size=medium&file_guid={$vars['entity']->getGUID()}\" /></a>"; + echo elgg_view_entity_icon($file, 'medium'); echo "<p class='subtitle'>$owner_link $date</p>"; echo '</div>'; } else { @@ -116,10 +98,10 @@ HTML; 'entity' => $file, 'metadata' => $metadata, 'subtitle' => $subtitle, - 'tags' => $tags, 'content' => $excerpt, ); - $list_body = elgg_view('layout/objects/list/body', $params); + $params = $params + $vars; + $list_body = elgg_view('object/elements/summary', $params); echo elgg_view_image_block($file_icon, $list_body); } diff --git a/mod/file/views/default/river/object/file/create.php b/mod/file/views/default/river/object/file/create.php index 620d1d18c..e8e6142e0 100644 --- a/mod/file/views/default/river/object/file/create.php +++ b/mod/file/views/default/river/object/file/create.php @@ -7,29 +7,7 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->description); $excerpt = elgg_get_excerpt($excerpt); -$params = array( - 'href' => $object->getURL(), - 'text' => $object->title, -); -$link = elgg_view('output/url', $params); - -$group_string = ''; -$container = $object->getContainerEntity(); -if ($container instanceof ElggGroup) { - $params = array( - 'href' => $container->getURL(), - 'text' => $container->name, - ); - $group_link = elgg_view('output/url', $params); - $group_string = elgg_echo('river:ingroup', array($group_link)); -} - -echo elgg_echo('file:river:create'); - -echo " $link $group_string"; - -if ($excerpt) { - echo '<div class="elgg-river-content">'; - echo $excerpt; - echo '</div>'; -} +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'message' => $excerpt, +));
\ No newline at end of file diff --git a/mod/file/views/default/widgets/filerepo/content.php b/mod/file/views/default/widgets/filerepo/content.php index 130b5e3de..f3e152de3 100644 --- a/mod/file/views/default/widgets/filerepo/content.php +++ b/mod/file/views/default/widgets/filerepo/content.php @@ -6,65 +6,28 @@ */ -$owner_guid = $vars['entity']->owner_guid; -$number = $vars['entity']->num_display; +$num = $vars['entity']->num_display; -//get the layout view which is set by the user in the edit panel -$get_view = (int) $vars['entity']->gallery_list; -if (!$get_view || $get_view == 1) { - $view = "list"; -} else { - $view = "gallery"; -} - -//get the user's files $options = array( 'type' => 'object', 'subtype' => 'file', - 'limit' => $number, - 'container_guid' => $owner_guid + 'container_guid' => $vars['entity']->owner_guid, + 'limit' => $num, + 'full_view' => FALSE, + 'pagination' => FALSE, ); -$files = elgg_get_entities($options); - -//if there are some files, go get them -if ($files) { - - echo "<div id='filerepo_widget_layout'>"; - - if ($view == "gallery") { - - echo "<div class='filerepo_widget_galleryview'>"; - - //display in gallery mode - foreach ($files as $f) { - - $mime = $f->mimetype; - echo "<a href=\"{$f->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $f->thumbnail, 'file_guid' => $f->guid)) . "</a>"; - } - - echo "</div>"; - } else { - - //display in list mode - foreach ($files as $f) { - - $mime = $f->mimetype; - echo "<div class='filerepo_widget_singleitem clearfix'>"; - echo "<div class='filerepo_listview_icon'><a href=\"{$f->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $f->thumbnail, 'file_guid' => $f->guid)) . "</a></div>"; - echo "<div class='filerepo_widget-content'>"; - echo "<div class='filerepo_listview_title'><p class='filerepo_title'>" . $f->title . "</p></div>"; - echo "<div class='filerepo_listview_date'><p class='filerepo_timestamp'><small>" . elgg_view_friendly_time($f->time_created) . "</small></p></div>"; - echo "</div></div>"; - } - } - - - //get a link to the users files - $users_file_url = elgg_get_site_url() . "pg/file/" . get_user($f->owner_guid)->username; - - echo "<div class='filerepo_widget_singleitem_more'><a href=\"{$users_file_url}\">" . elgg_echo('file:more') . "</a></div>"; - echo "</div>"; +$content = elgg_list_entities($options); + +echo $content; + +if ($content) { + $url = "file/owner/" . elgg_get_page_owner_entity()->username; + $more_link = elgg_view('output/url', array( + 'href' => $url, + 'text' => elgg_echo('file:more'), + 'is_trusted' => true, + )); + echo "<span class=\"elgg-widget-more\">$more_link</span>"; } else { - - echo "<p class='margin-top'>" . elgg_echo("file:none") . "</p>"; + echo elgg_echo('file:none'); } diff --git a/mod/file/views/default/widgets/filerepo/edit.php b/mod/file/views/default/widgets/filerepo/edit.php index 0ee794dca..cab35b6ef 100644 --- a/mod/file/views/default/widgets/filerepo/edit.php +++ b/mod/file/views/default/widgets/filerepo/edit.php @@ -5,32 +5,21 @@ * @package ElggFile */ + // set default value if (!isset($vars['entity']->num_display)) { $vars['entity']->num_display = 4; } -?> -<p> - <?php echo elgg_echo("file:num_files"); ?>: - <select name="params[num_display]"> -<?php -$options = array(1,2,3,4,5,6,7,8,9,10,15,20); -foreach ($options as $option) { - $selected = ''; - if ($vars['entity']->num_display == $option) { - $selected = "selected='selected'"; - } - echo " <option value='{$option}' $selected >{$option}</option>\n"; -} -?> - </select> -</p> +$params = array( + 'name' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20), +); +$dropdown = elgg_view('input/dropdown', $params); -<p> - <?php echo elgg_echo("file:gallery_list"); ?>? - <select name="params[gallery_list]"> - <option value="1" <?php if($vars['entity']->gallery_list == 1) echo "SELECTED"; ?>><?php echo elgg_echo("file:list"); ?></option> - <option value="2" <?php if($vars['entity']->gallery_list == 2) echo "SELECTED"; ?>><?php echo elgg_echo("file:gallery"); ?></option> - </select> -</p>
\ No newline at end of file +?> +<div> + <?php echo elgg_echo('file:num_files'); ?>: + <?php echo $dropdown; ?> +</div> diff --git a/mod/file/views/rss/file/enclosure.php b/mod/file/views/rss/file/enclosure.php new file mode 100644 index 000000000..fb4a899d9 --- /dev/null +++ b/mod/file/views/rss/file/enclosure.php @@ -0,0 +1,16 @@ +<?php +/** + * Link to download the file + * + * @uses $vars['entity'] + */ + +if (elgg_instanceof($vars['entity'], 'object', 'file')) { + $download_url = elgg_get_site_url() . 'file/download/' . $vars['entity']->getGUID(); + $size = $vars['entity']->size(); + $mime_type = $vars['entity']->getMimeType(); + echo <<<END + + <enclosure url="$download_url" length="$size" type="$mime_type" />"; +END; +} diff --git a/mod/file/views/rss/object/file.php b/mod/file/views/rss/object/file.php deleted file mode 100644 index a0660d6c8..000000000 --- a/mod/file/views/rss/object/file.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * Elgg RSS file object view - * - * @package ElggFile - * @subpackage Core - */ -$title = $vars['entity']->title; -if (empty($title)) { - $title = elgg_get_excerpt($vars['entity']->description, 32); -} -?> - -<item> - <guid isPermaLink='true'><?php echo $vars['entity']->getURL(); ?></guid> - <pubDate><?php echo date("r", $vars['entity']->time_created) ?></pubDate> - <link><?php echo $vars['entity']->getURL(); ?></link> - <title><![CDATA[<?php echo $title; ?>]]></title> - <description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description> - <enclosure url="<?php echo elgg_get_site_url(); ?>mod/file/download.php?file_guid=<?php echo $vars['entity']->getGUID(); ?>" length="<?php echo $vars['entity']->size(); ?>" type="<?php echo $vars['entity']->getMimeType(); ?>" /> -</item> |
