diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-01-01 17:55:18 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-01-01 17:55:18 +0000 |
commit | 7b8a18ab7f993aa5f4f7f643478f06a8e3f7ed52 (patch) | |
tree | 1070be6b85c5a2327163cb0326dfbcbc62f10d62 /mod/file/views/default | |
parent | 07ffe6464b453fd90cd2833fc55f804c57c52b4a (diff) | |
download | elgg-7b8a18ab7f993aa5f4f7f643478f06a8e3f7ed52.tar.gz elgg-7b8a18ab7f993aa5f4f7f643478f06a8e3f7ed52.tar.bz2 |
almost finished updating the file plugin to work with new html/css
git-svn-id: http://code.elgg.org/elgg/trunk@7804 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/file/views/default')
-rw-r--r-- | mod/file/views/default/file/css.php | 108 | ||||
-rw-r--r-- | mod/file/views/default/file/group_module.php | 48 | ||||
-rw-r--r-- | mod/file/views/default/file/groupprofile_files.php | 59 | ||||
-rw-r--r-- | mod/file/views/default/file/icon.php | 2 | ||||
-rw-r--r-- | mod/file/views/default/file/typecloud.php | 83 | ||||
-rw-r--r-- | mod/file/views/default/file/upload.php | 128 | ||||
-rw-r--r-- | mod/file/views/default/forms/file/upload.php | 63 | ||||
-rw-r--r-- | mod/file/views/default/widgets/filerepo/content.php | 68 | ||||
-rw-r--r-- | mod/file/views/default/widgets/filerepo/edit.php | 33 |
9 files changed, 175 insertions, 417 deletions
diff --git a/mod/file/views/default/file/css.php b/mod/file/views/default/file/css.php index d4d1a2c13..53fa94e46 100644 --- a/mod/file/views/default/file/css.php +++ b/mod/file/views/default/file/css.php @@ -27,111 +27,3 @@ .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/group_module.php b/mod/file/views/default/file/group_module.php new file mode 100644 index 000000000..babdcf677 --- /dev/null +++ b/mod/file/views/default/file/group_module.php @@ -0,0 +1,48 @@ +<?php +/** + * Group file module + */ + +$group = elgg_get_page_owner(); + +if ($group->file_enable == "no") { + return true; +} + +$all_link = elgg_view('output/url', array( + 'href' => "pg/file/group/$group->guid/owner", + 'text' => elgg_echo('link:view:all'), +)); + +$header = "<span class=\"group-widget-viewall\">$all_link</span>"; +$header .= '<h3>' . elgg_echo('file:group') . '</h3>'; + + +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' => "pg/file/new/$group->guid", + 'text' => elgg_echo('file:new'), +)); +$content .= "<span class='elgg-widget-more'>$new_link</span>"; + + +$params = array( + 'header' => $header, + 'body' => $content, +); +echo elgg_view('layout/objects/module', $params); 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 index 63756a952..391afd0c8 100644 --- a/mod/file/views/default/file/icon.php +++ b/mod/file/views/default/file/icon.php @@ -13,7 +13,7 @@ */ $mime = $vars['mimetype']; -$simple_type = get_general_file_type($mime); +$simple_type = file_get_simple_type($mime); // is this request for an image thumbnail $thumbnail = elgg_get_array_value('thumbnail', $vars, false); diff --git a/mod/file/views/default/file/typecloud.php b/mod/file/views/default/file/typecloud.php index bb322d4d7..4a59d8a7c 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() . "mod/file/search.php?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 .= "&listtype=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_get_array_value('types', $vars, array()); +if (!$types) { + return true; +} -<?php +$friends = elgg_get_array_value('friends', $vars, false); - } +$all = new stdClass; +$all->tag = "all"; +elgg_register_menu_item('page', array( + 'name' => 'file:all', + 'title' => elgg_echo('all'), + 'url' => 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", + 'title' => elgg_echo("file:type:$type->tag"), + 'url' => 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..f3012ea7a --- /dev/null +++ b/mod/file/views/default/forms/file/upload.php @@ -0,0 +1,63 @@ +<?php +/** + * Elgg file upload/save form + * + * @package ElggFile + */ + +// once elgg_view stops throwing all sorts of junk into $vars, we can use +$title = elgg_get_array_value('title', $vars, ''); +$desc = elgg_get_array_value('description', $vars, ''); +$tags = elgg_get_array_value('tags', $vars, ''); +$access_id = elgg_get_array_value('access_id', $vars, ACCESS_DEFAULT); +$container_guid = elgg_get_array_value('container_guid', $vars); +$guid = elgg_get_array_value('guid', $vars, null); + +if ($guid) { + $file_label = elgg_echo("file:replace"); +} else { + $file_label = elgg_echo("file:file"); +} + +?> +<p> + <label><?php echo $file_label; ?></label><br /> + <?php echo elgg_view('input/file', array('internalname' => 'upload')); ?> +</p> +<p> + <label><?php echo elgg_echo('title'); ?></label><br /> + <?php echo elgg_view('input/text', array('internalname' => 'title', 'value' => $title)); ?> +</p> +<p> + <label><?php echo elgg_echo('description'); ?></label> + <?php echo elgg_view('input/longtext', array('internalname' => 'description', 'value' => $desc)); ?> +</p> +<p> + <label><?php echo elgg_echo('tags'); ?></label> + <?php echo elgg_view('input/tags', array('internalname' => 'tags', 'value' => $tags)); ?> +</p> +<?php + +$categories = elgg_view('categories', $vars); +if ($categories) { + echo "<p>$categories</p>"; +} + +?> +<p> + <label><?php echo elgg_echo('access'); ?></label><br /> + <?php echo elgg_view('input/access', array('internalname' => 'access_id', 'value' => $access_id)); ?> +</p> +<p> +<?php + +echo elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $container_guid)); + +if ($guid) { + echo elgg_view('input/hidden', array('internalname' => 'file_guid', 'value' => $guid)); +} + +echo elgg_view('input/submit', array('value' => elgg_echo("save"))); + +?> +</p> diff --git a/mod/file/views/default/widgets/filerepo/content.php b/mod/file/views/default/widgets/filerepo/content.php index 130b5e3de..d2cd246ae 100644 --- a/mod/file/views/default/widgets/filerepo/content.php +++ b/mod/file/views/default/widgets/filerepo/content.php @@ -6,65 +6,27 @@ */ -$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'>"; +$content = elgg_list_entities($options); - //display in gallery mode - foreach ($files as $f) { +echo $content; - $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>"; +if ($content) { + $url = "pg/file/owner/" . elgg_get_page_owner()->username; + $more_link = elgg_view('output/url', array( + 'href' => $url, + 'text' => elgg_echo('file:more'), + )); + 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..695d16afc 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( + 'internalname' => '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/pulldown', $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 + <?php echo elgg_echo('file:num_files'); ?>: + <?php echo $dropdown; ?> +</p> |