aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-15 15:04:14 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-15 15:04:14 -0300
commit66dd3f3f5f14bb0ba6d2c7ef83b5b612d5ee2e30 (patch)
tree6002cbd9db40b15b4e67a67d5669644f86e4dbde /views
downloadelgg-66dd3f3f5f14bb0ba6d2c7ef83b5b612d5ee2e30.tar.gz
elgg-66dd3f3f5f14bb0ba6d2c7ef83b5b612d5ee2e30.tar.bz2
Squashed 'mod/lightbox/' content from commit a83b8d8
git-subtree-dir: mod/lightbox git-subtree-split: a83b8d89691c31b4568f47790fb40d0bc962aca5
Diffstat (limited to 'views')
-rw-r--r--views/default/forms/lightbox/edit.php74
-rw-r--r--views/default/forms/lightbox/images/edit.php0
-rw-r--r--views/default/js/lightbox/album.php8
-rw-r--r--views/default/lightbox/image.php16
-rw-r--r--views/default/object/album.php117
-rw-r--r--views/default/object/image.php100
6 files changed, 315 insertions, 0 deletions
diff --git a/views/default/forms/lightbox/edit.php b/views/default/forms/lightbox/edit.php
new file mode 100644
index 000000000..b7f33e86a
--- /dev/null
+++ b/views/default/forms/lightbox/edit.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Elgg album create/edit form
+ *
+ * @package ElggLightbox
+ */
+
+// 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);
+?>
+<div>
+ <label><?php echo elgg_echo('lightbox:title'); ?></label><br />
+ <?php echo elgg_view('input/text', array('name' => 'title', 'value' => $title)); ?>
+</div>
+
+<div>
+ <label><?php echo elgg_echo('lightbox:image:upload'); ?></label><br />
+ <?php echo elgg_view('input/file', array('name' => 'upload0')); ?>
+</div>
+<div>
+ <label><?php echo elgg_echo('lightbox:image:upload:another'); ?></label><br />
+ <?php echo elgg_view('input/file', array('name' => 'upload1')); ?>
+</div>
+<div>
+ <label><?php echo elgg_echo('lightbox:image:upload:another'); ?></label><br />
+ <?php echo elgg_view('input/file', array('name' => 'upload2')); ?>
+</div>
+
+<?php if($guid): ?>
+
+<div>
+ <label><?php echo elgg_echo('lightbox:description'); ?></label>
+ <?php echo elgg_view('input/longtext', array('name' => 'description', 'value' => $desc)); ?>
+</div>
+
+<?php endif; ?>
+
+<div>
+ <label><?php echo elgg_echo('lightbox: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' => 'guid', 'value' => $guid));
+}
+
+echo elgg_view('input/submit', array('value' => elgg_echo('save')));
+
+?>
+</div>
diff --git a/views/default/forms/lightbox/images/edit.php b/views/default/forms/lightbox/images/edit.php
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/views/default/forms/lightbox/images/edit.php
diff --git a/views/default/js/lightbox/album.php b/views/default/js/lightbox/album.php
new file mode 100644
index 000000000..19d5dbc04
--- /dev/null
+++ b/views/default/js/lightbox/album.php
@@ -0,0 +1,8 @@
+$(function(){
+ $images = $('.elgg-gallery .lightbox-photo .album-gallery-item a');
+ $.each($images, function(i, a) {
+ a.href = $(a).children().first().attr('src').replace(/size=[^&]*/, "size=full");
+ });
+ $images.lightBox({txtImage: 'Imagem',
+ txtOf: 'de'});
+});
diff --git a/views/default/lightbox/image.php b/views/default/lightbox/image.php
new file mode 100644
index 000000000..28d82e2be
--- /dev/null
+++ b/views/default/lightbox/image.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Display an image
+ */
+
+$image_url = elgg_get_site_url() . "mod/lightbox/thumbnail.php?guid={$vars['entity']->getGUID()}&size=large";
+$image_url = elgg_format_url($image_url);
+$download_url = elgg_get_site_url() . "mod/lightbox/thumbnail.php?guid={$vars['entity']->getGUID()}&size=full";
+
+if ($vars['full_view'] && $smallthumb = $vars['entity']->smallthumb) {
+ echo <<<HTML
+ <div class="file-photo">
+ <a href="$download_url"><img class="elgg-photo" src="$image_url" /></a>
+ </div>
+HTML;
+}
diff --git a/views/default/object/album.php b/views/default/object/album.php
new file mode 100644
index 000000000..676488702
--- /dev/null
+++ b/views/default/object/album.php
@@ -0,0 +1,117 @@
+<?php
+/**
+ * Album renderer.
+ *
+ * @package ElggLightbox
+ */
+
+elgg_load_js('jquery.lightbox');
+elgg_load_css('jquery.lightbox');
+elgg_load_js('lightbox.album');
+
+$full = elgg_extract('full_view', $vars, FALSE);
+$entity = elgg_extract('entity', $vars, FALSE);
+
+if (!$entity) {
+ return TRUE;
+}
+
+$owner = $entity->getOwnerEntity();
+$container = $entity->getContainerEntity();
+$categories = elgg_view('output/categories', $vars);
+$excerpt = elgg_get_excerpt($entity->description);
+
+$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));
+
+$icon = elgg_view_entity_icon($entity, 'small');
+
+$tags = elgg_view('output/tags', array('tags' => $entity->tags));
+$date = elgg_view_friendly_time($entity->time_created);
+
+$comments_count = $entity->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' => $entity->getURL() . '#album-comments',
+ 'text' => $text,
+ 'is_trusted' => true,
+ ));
+} else {
+ $comments_link = '';
+}
+
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $vars['entity'],
+ 'handler' => 'album',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
+
+$subtitle = "$author_text $date $comments_link $categories";
+
+// do not show the metadata and controls in widget view
+if (elgg_in_context('widgets')) {
+ $metadata = '';
+}
+
+if ($full && !elgg_in_context('gallery')) {
+
+ $params = array(
+ 'entity' => $entity,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ );
+ $params = $params + $vars;
+ $summary = elgg_view('object/elements/summary', $params);
+
+ $gallery = elgg_list_entities_from_relationship(array(
+ 'type' => 'object',
+ 'subtype' => 'image',
+ 'relationship' => 'in_album',
+ 'relationship_guid' => $entity->guid,
+ 'inverse_relationship' => false,
+ 'list_type' => 'gallery',
+ 'item_class' => 'elgg-photo lightbox-photo',
+ 'full_view' => false,
+
+ ));
+
+ $text = elgg_view('output/longtext', array('value' => $entity->description));
+ $body = "$text $gallery";
+
+ echo elgg_view('object/elements/full', array(
+ 'entity' => $entity,
+ 'title' => false,
+ 'icon' => $icon,
+ 'summary' => $summary,
+ 'body' => $body,
+ ));
+
+} elseif (elgg_in_context('gallery')) {
+ echo '<div class="album-gallery-item">';
+ echo "<h3>" . $entity->title . "</h3>";
+ echo elgg_view_entity_icon($entity, 'medium');
+ echo "<p class='subtitle'>$owner_link $date</p>";
+ echo '</div>';
+} else {
+ // brief view
+
+ $params = array(
+ 'entity' => $entity,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ 'content' => $excerpt,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
+
+ echo elgg_view_image_block($icon, $list_body);
+}
diff --git a/views/default/object/image.php b/views/default/object/image.php
new file mode 100644
index 000000000..06a50202a
--- /dev/null
+++ b/views/default/object/image.php
@@ -0,0 +1,100 @@
+<?php
+/**
+ * Image renderer.
+ *
+ * @package ElggLightbox
+ */
+
+$full = elgg_extract('full_view', $vars, FALSE);
+$entity = elgg_extract('entity', $vars, FALSE);
+
+if (!$entity) {
+ return TRUE;
+}
+
+$owner = $entity->getOwnerEntity();
+$container = $entity->getContainerEntity();
+$categories = elgg_view('output/categories', $vars);
+$excerpt = elgg_get_excerpt($entity->description);
+
+$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));
+
+$icon = elgg_view_entity_icon($entity, 'small');
+
+$tags = elgg_view('output/tags', array('tags' => $entity->tags));
+$date = elgg_view_friendly_time($entity->time_created);
+
+$comments_count = $entity->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' => $entity->getURL() . '#album-comments',
+ 'text' => $text,
+ 'is_trusted' => true,
+ ));
+} else {
+ $comments_link = '';
+}
+
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $vars['entity'],
+ 'handler' => 'album',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
+
+$subtitle = "$author_text $date $comments_link $categories";
+
+// do not show the metadata and controls in widget view
+if (elgg_in_context('widgets')) {
+ $metadata = '';
+}
+
+if ($full && !elgg_in_context('gallery')) {
+
+ $params = array(
+ 'entity' => $entity,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ );
+ $params = $params + $vars;
+ $summary = elgg_view('object/elements/summary', $params);
+
+ $body = elgg_view('lightbox/image' , $vars)
+ . elgg_view('output/longtext', array('value' => $entity->description));
+
+ echo elgg_view('object/elements/full', array(
+ 'entity' => $entity,
+ 'title' => false,
+ 'icon' => $icon,
+ 'summary' => $summary,
+ 'body' => $body,
+ ));
+
+} elseif (elgg_in_context('gallery')) {
+ echo '<div class="album-gallery-item">';
+ echo "<h3>" . $entity->title . "</h3>";
+ echo elgg_view_entity_icon($entity, 'medium');
+ echo '</div>';
+} else {
+ // brief view
+
+ $params = array(
+ 'entity' => $entity,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ 'content' => $excerpt,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
+
+ echo elgg_view_image_block($icon, $list_body);
+}