diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-12-29 20:45:58 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-12-29 20:45:58 -0200 |
commit | 97e689213ff4e829f251af526ed4e796a3cc2b71 (patch) | |
tree | b04d03ec56305041216b72328fc9b5afde27bc76 /mod/lightpics/views/default/object | |
parent | 0ab6351abb7a602d96c62b0ad35413c88113a6cf (diff) | |
parent | 69e2d8c5d8732042c9319aef1fdea45a82b63e42 (diff) | |
download | elgg-97e689213ff4e829f251af526ed4e796a3cc2b71.tar.gz elgg-97e689213ff4e829f251af526ed4e796a3cc2b71.tar.bz2 |
Merge branch 'master' into saravea
Conflicts:
.gitmodules
mod/admins
mod/assemblies
mod/audio_html5
mod/beechat
mod/crud
mod/elgg-activitystreams
mod/elggman
mod/elggpg
mod/favorites
mod/federated-objects
mod/friendly_time
mod/group_alias
mod/group_operators
mod/languages
mod/lightpics
mod/openid_client
mod/spotlight
mod/suicide
mod/tasks
mod/videolist
Diffstat (limited to 'mod/lightpics/views/default/object')
-rw-r--r-- | mod/lightpics/views/default/object/album.php | 22 | ||||
-rw-r--r-- | mod/lightpics/views/default/object/album/full.php | 59 | ||||
-rw-r--r-- | mod/lightpics/views/default/object/album/gallery.php | 36 | ||||
-rw-r--r-- | mod/lightpics/views/default/object/album/list.php | 42 | ||||
-rw-r--r-- | mod/lightpics/views/default/object/image.php | 211 | ||||
-rw-r--r-- | mod/lightpics/views/default/object/image/full.php | 62 | ||||
-rw-r--r-- | mod/lightpics/views/default/object/image/navigation.php | 34 | ||||
-rw-r--r-- | mod/lightpics/views/default/object/image/summary.php | 41 |
8 files changed, 507 insertions, 0 deletions
diff --git a/mod/lightpics/views/default/object/album.php b/mod/lightpics/views/default/object/album.php new file mode 100644 index 000000000..bfcfd96d2 --- /dev/null +++ b/mod/lightpics/views/default/object/album.php @@ -0,0 +1,22 @@ +<?php +/** + * Album view + * + * @uses $vars['entity'] TidypicsAlbum + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$album = elgg_extract('entity', $vars); +$full_view = elgg_extract('full_view', $vars, false); + +if ($full_view) { + echo elgg_view('object/album/full', $vars); +} else { + if (elgg_in_context('widgets')) { + echo elgg_view('object/album/list', $vars); + } else { + echo elgg_view('object/album/gallery', $vars); + } +} diff --git a/mod/lightpics/views/default/object/album/full.php b/mod/lightpics/views/default/object/album/full.php new file mode 100644 index 000000000..7b273c66e --- /dev/null +++ b/mod/lightpics/views/default/object/album/full.php @@ -0,0 +1,59 @@ +<?php +/** + * Full view of an album + * + * @uses $vars['entity'] TidypicsAlbum + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$album = elgg_extract('entity', $vars); +$owner = $album->getOwnerEntity(); + +$owner_icon = elgg_view_entity_icon($owner, 'tiny'); + +$metadata = elgg_view_menu('entity', array( + 'entity' => $album, + 'handler' => 'photos', + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); + +$owner_link = elgg_view('output/url', array( + 'href' => "photos/owner/$owner->username", + 'text' => $owner->name, + 'is_trusted' => true, +)); +$author_text = elgg_echo('byline', array($owner_link)); +$date = elgg_view_friendly_time($album->time_created); +$categories = elgg_view('output/categories', $vars); + +$subtitle = "$author_text $date $categories"; + +$params = array( + 'entity' => $album, + 'title' => false, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + 'tags' => elgg_view('output/tags', array('tags' => $album->tags)), +); +$params = $params + $vars; +$summary = elgg_view('object/elements/summary', $params); + +$body = ''; +if ($album->description) { + $body = elgg_view('output/longtext', array( + 'value' => $album->description, + 'class' => 'mbm', + )); +} + +$body .= $album->viewImages(); + +echo elgg_view('object/elements/full', array( + 'entity' => $album, + 'icon' => $owner_icon, + 'summary' => $summary, + 'body' => $body, +)); diff --git a/mod/lightpics/views/default/object/album/gallery.php b/mod/lightpics/views/default/object/album/gallery.php new file mode 100644 index 000000000..d6fb598e4 --- /dev/null +++ b/mod/lightpics/views/default/object/album/gallery.php @@ -0,0 +1,36 @@ +<?php +/** + * Display an album in a gallery + * + * @uses $vars['entity'] TidypicsAlbum + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$album = elgg_extract('entity', $vars); + + +$album_cover = elgg_view_entity_icon($album, 'small'); + +$header = elgg_view('output/url', array( + 'text' => $album->getTitle(), + 'href' => $album->getURL(), + 'is_trusted' => true, + 'class' => 'tidypics-heading', +)); + +$footer = ""; +if ($album->getContainerEntity()) { + $footer .= elgg_view('output/url', array( + 'text' => $album->getContainerEntity()->name, + 'href' => $album->getContainerEntity()->getURL(), + 'is_trusted' => true, + )); +} +$footer .= '<div class="elgg-subtext">' . elgg_echo('album:num', array($album->getSize())) . '</div>'; + +$params = array( + 'footer' => $footer, +); +echo elgg_view_module('tidypics-album', $header, $album_cover, $params); diff --git a/mod/lightpics/views/default/object/album/list.php b/mod/lightpics/views/default/object/album/list.php new file mode 100644 index 000000000..e576c92f1 --- /dev/null +++ b/mod/lightpics/views/default/object/album/list.php @@ -0,0 +1,42 @@ +<?php +/** + * Display an album as an item in a list + * + * @uses $vars['entity'] TidypicsAlbum + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$album = elgg_extract('entity', $vars); +$owner = $album->getOwnerEntity(); + +$owner_link = elgg_view('output/url', array( + 'href' => "photos/owner/$owner->username", + 'text' => $owner->name, + 'is_trusted' => true, +)); +$author_text = elgg_echo('byline', array($owner_link)); +$date = elgg_view_friendly_time($album->time_created); +$categories = elgg_view('output/categories', $vars); + +$subtitle = "$author_text $date $categories"; + +$title = elgg_view('output/url', array( + 'text' => $album->getTitle(), + 'href' => $album->getURL(), +)); + +$params = array( + 'entity' => $album, + 'title' => $title, + 'metadata' => null, + 'subtitle' => $subtitle, + 'tags' => elgg_view('output/tags', array('tags' => $album->tags)), +); +$params = $params + $vars; +$summary = elgg_view('object/elements/summary', $params); + +$icon = elgg_view_entity_icon($album, 'tiny'); + +echo $header = elgg_view_image_block($icon, $summary); diff --git a/mod/lightpics/views/default/object/image.php b/mod/lightpics/views/default/object/image.php new file mode 100644 index 000000000..fc8ea827e --- /dev/null +++ b/mod/lightpics/views/default/object/image.php @@ -0,0 +1,211 @@ +<?php +/** + * Image view + * + * @uses $vars['entity'] TidypicsImage + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + + +$full_view = elgg_extract('full_view', $vars, false); + +if ($full_view) { + echo elgg_view('object/image/full', $vars); +} else { + echo elgg_view('object/image/summary', $vars); +} + +return true; + +global $CONFIG; +include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/lib/exif.php"; + +$image = $vars['entity']; +$image_guid = $image->getGUID(); +$tags = $image->tags; +$title = $image->getTitle(); +$desc = $image->description; +$owner = $image->getOwnerEntity(); +$friendlytime = friendly_time($image->time_created); + + +/******************************************************************** + * + * search view of an image + * + ********************************************************************/ +if (get_context() == "search") { + + // gallery view is a matrix view showing just the image - size: small + if (get_input('search_viewtype') == "gallery") { +?> +<div class="tidypics_album_images"> + <a href="<?php echo $image->getURL();?>"><img src="<?php echo $vars['url'];?>mod/tidypics/thumbnail.php?file_guid=<?php echo $image_guid;?>&size=small" alt="thumbnail"/></a> +</div> +<?php + } else { + // list view displays a thumbnail icon of the image, its title, and the number of comments + $info = '<p><a href="' .$image->getURL(). '">'.$title.'</a></p>'; + $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/profile/{$owner->username}\">{$owner->name}</a> {$friendlytime}"; + $numcomments = elgg_count_comments($image); + if ($numcomments) { + $info .= ", <a href=\"{$image->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>"; + } + $info .= "</p>"; + $icon = "<a href=\"{$image->getURL()}\">" . '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $image_guid . '&size=thumb" alt="' . $title . '" /></a>'; + + echo elgg_view_listing($icon, $info); + } + +/*************************************************************** + * + * front page view + * + ****************************************************************/ +} else if (get_context() == "front" || get_context() == "widget") { + // the front page view is a clickable thumbnail of the image +?> +<a href="<?php echo $image->getURL(); ?>"> + <img src="<?php echo $vars['url'];?>mod/tidypics/thumbnail.php?file_guid=<?php echo $image_guid;?>&size=thumb" class="tidypics_album_cover" alt="<?php echo $title; ?>" title="<?php echo $title; ?>" /> +</a> + <?php +} else { + +/******************************************************************** + * + * listing of photos in an album + * + *********************************************************************/ + if (!$vars['full']) { + + // plugins can override the image link to add lightbox code here + $image_html = false; + $image_html = trigger_plugin_hook('tp_thumbnail_link', 'album', array('image' => $image), $image_html); + + if ($image_html) { + echo $image_html; + } else { + // default link to image if no one overrides +?> +<div class="tidypics_album_images"> + <a href="<?php echo $image->getURL();?>"><img src="<?php echo $vars['url'];?>pg/photos/thumbnail/<?php echo $image_guid;?>/small/" alt="<?php echo $image->title; ?>"/></a> +</div> +<?php + } + } else { + +/******************************************************************** + * + * tidypics individual image display + * + *********************************************************************/ + + + $viewer = get_loggedin_user(); + + + // Build back and next links + $back = ''; + $next = ''; + $album = get_entity($image->container_guid); + $back_guid = $album->getPreviousImageGuid($image->guid); + $next_guid = $album->getNextImageGuid($image->guid); + + if ($back_guid != 0) { + $text = elgg_echo('image:back'); + $back = "<a href=\"{$vars['url']}pg/photos/view/$back_guid\">« $text</a>"; + } + + if ($next_guid != 0) { + $text = elgg_echo('image:next'); + $next = "<a href=\"{$vars['url']}pg/photos/view/$next_guid\">$text »</a>"; + } + +?> +<div class="contentWrapper"> + <div id="tidypics_wrapper"> + + <div id="tidypics_breadcrumbs"> + <?php echo elgg_view('tidypics/breadcrumbs', array('album' => $album,) ); ?> <br /> +<?php + if (get_plugin_setting('view_count', 'tidypics') != "disabled") { + + $image->addView($viewer->guid); + $views = $image->getViews($viewer->guid); + if (is_array($views)) { + echo sprintf(elgg_echo("tidypics:views"), $views['total']); + if ($owner->guid == $viewer->guid) { + echo ' ' . sprintf(elgg_echo("tidypics:viewsbyowner"), $views['unique']); + } else { + if ($views['mine']) { + echo ' ' . sprintf(elgg_echo("tidypics:viewsbyothers"), $views['mine']); + } + } + } + } +?> + </div> + + <div id="tidypics_desc"> + <?php echo autop($desc); ?> + </div> + <div id="tidypics_image_nav"> + <ul> + <li><?php echo $back; ?></li> + <li><?php echo $next; ?></li> + </ul> + </div> + <div id="tidypics_image_wrapper"> + <?php + // this code controls whether the photo is a hyperlink or not and what it links to + if (get_plugin_setting('download_link', 'tidypics') != "disabled") { + // admin allows downloads so default to inline download link + $image_html = "<a href=\"{$vars['url']}pg/photos/download/{$image_guid}/inline/\" title=\"{$title}\" >"; + $image_html .= "<img id=\"tidypics_image\" src=\"{$vars['url']}pg/photos/thumbnail/{$image_guid}/large/\" alt=\"{$title}\" />"; + $image_html .= "</a>"; + } else { + $image_html = "<img id=\"tidypics_image\" src=\"{$vars['url']}pg/photos/thumbnail/{$image_guid}/large/\" alt=\"{$title}\" />"; + } + // does any plugin want to override the link + $image_html = trigger_plugin_hook('tp_thumbnail_link', 'image', array('image' => $image), $image_html); + echo $image_html; + ?> + <div class="clearfloat"></div> + </div> + <?php + if (get_plugin_setting('exif', 'tidypics') == "enabled") { + echo elgg_view('tidypics/exif', array('guid'=> $image_guid)); + } +?> + <div class="tidypics_info"> +<?php + if (!is_null($tags)) { +?> + <div class="object_tag_string"><?php echo elgg_view('output/tags',array('value' => $tags));?></div> +<?php + } + if (get_plugin_setting('photo_ratings', 'tidypics') == "enabled") { +?> + <div id="rate_container"> + <?php echo elgg_view('rate/rate', array('entity'=> $vars['entity'])); ?> + </div> +<?php + } + + echo elgg_echo('image:by');?> <b><a href="<?php echo $vars['url']; ?>pg/profile/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b> <?php echo $friendlytime; +?> + </div> + </div> <!-- tidypics wrapper--> +<?php + + echo elgg_view_comments($image); + + echo '<div class="clearfloat"></div>'; + + echo '</div>'; // content wrapper + + } // end of individual image display + +} diff --git a/mod/lightpics/views/default/object/image/full.php b/mod/lightpics/views/default/object/image/full.php new file mode 100644 index 000000000..74436f500 --- /dev/null +++ b/mod/lightpics/views/default/object/image/full.php @@ -0,0 +1,62 @@ +<?php +/** + * Full view of an image + * + * @uses $vars['entity'] TidypicsImage + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$image = $photo = $vars['entity']; + +$img = elgg_view_entity_icon($image, 'large', array( + 'href' => $image->getIconURL('master'), + 'img_class' => 'tidypics-photo', + 'link_class' => 'tidypics-lightbox elgg-lightbox-photo', +)); + +$owner_link = elgg_view('output/url', array( + 'href' => "photos/owner/" . $photo->getOwnerEntity()->username, + 'text' => $photo->getOwnerEntity()->name, +)); +$author_text = elgg_echo('byline', array($owner_link)); + +$owner_icon = elgg_view_entity_icon($photo->getOwnerEntity(), 'tiny'); + +$metadata = elgg_view_menu('entity', array( + 'entity' => $vars['entity'], + 'handler' => 'photos', + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); + +$subtitle = "$author_text $date $categories $comments_link"; + +$params = array( + 'entity' => $photo, + 'title' => false, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + 'tags' => $tags, +); +$list_body = elgg_view('object/elements/summary', $params); + +$params = array('class' => 'mbl'); +$summary = elgg_view_image_block($owner_icon, $list_body, $params); + +echo $summary; + +echo '<div class="tidypics-photo-wrapper center">'; +echo elgg_view('object/image/navigation', $vars); +echo $img; +echo '</div>'; + +if ($photo->description) { + echo elgg_view('output/longtext', array( + 'value' => $photo->description, + 'class' => 'mbl', + )); +} + +echo elgg_view_comments($photo); diff --git a/mod/lightpics/views/default/object/image/navigation.php b/mod/lightpics/views/default/object/image/navigation.php new file mode 100644 index 000000000..155b76364 --- /dev/null +++ b/mod/lightpics/views/default/object/image/navigation.php @@ -0,0 +1,34 @@ +<?php +/** + * Photo navigation + * + * @uses $vars['entity'] + */ + +$photo = $vars['entity']; + +$album = $photo->getContainerEntity(); +$previous_photo = $album->getPreviousImage($photo->getGUID()); +$next_photo = $album->getNextImage($photo->getGUID()); +$size = $album->getSize(); +$index = $album->getIndex($photo->getGUID()); + +echo '<ul class="elgg-menu elgg-menu-hz tidypics-album-nav">'; +echo '<li>'; +echo elgg_view('output/url', array( + 'text' => elgg_view_icon('arrow-left'), + 'href' => $previous_photo->getURL(), +)); +echo '</li>'; + +echo '<li>'; +echo '<span>' . elgg_echo('image:index', array($index, $size)) . '</span>'; +echo '</li>'; + +echo '<li>'; +echo elgg_view('output/url', array( + 'text' => elgg_view_icon('arrow-right'), + 'href' => $next_photo->getURL(), +)); +echo '</li>'; +echo '</ul>'; diff --git a/mod/lightpics/views/default/object/image/summary.php b/mod/lightpics/views/default/object/image/summary.php new file mode 100644 index 000000000..0fa03cbe8 --- /dev/null +++ b/mod/lightpics/views/default/object/image/summary.php @@ -0,0 +1,41 @@ +<?php +/** + * Summary of an image for lists/galleries + * + * @uses $vars['entity'] TidypicsImage + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$image = elgg_extract('entity', $vars); + + +$header = elgg_view('output/url', array( + 'text' => $image->getTitle(), + 'href' => $image->getURL(), + 'is_trusted' => true, + 'class' => 'tidypics-heading', +)); + +$body = elgg_view_entity_icon($image, 'small', array( + 'href' => $image->getURL(), + 'img_class' => 'tidypics-photo', + 'encode_text' => false, + 'is_trusted' => true, + 'link_class' => 'tidypics-lightbox elgg-lightbox-photo', +)); + +/* +$footer = elgg_view('output/url', array( + 'text' => $image->getContainerEntity()->name, + 'href' => $image->getContainerEntity()->getURL(), + 'is_trusted' => true, +)); +$footer .= '<div class="elgg-subtext">' . elgg_echo('album:num', array($album->getSize())) . '</div>'; +*/ + +$params = array( + 'footer' => $footer, +); +echo elgg_view_module('tidypics-image', $header, $body, $params); |