diff options
author | Sem <sembrestels@riseup.net> | 2013-11-09 16:22:50 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2013-11-09 16:22:50 +0100 |
commit | f448cd91f9ecebea37daf40aada2fa1a20200817 (patch) | |
tree | 4636059da6a1be133a4974e5098b7c1e08944dd5 /mod/lightpics/views | |
parent | 52335325e5ea8c89c711e1ba40d9ac1657004e61 (diff) | |
parent | 324f39c3a9aa41e9e23bafba38882a2b72f62441 (diff) | |
download | elgg-f448cd91f9ecebea37daf40aada2fa1a20200817.tar.gz elgg-f448cd91f9ecebea37daf40aada2fa1a20200817.tar.bz2 |
Add 'mod/lightpics/' from commit '324f39c3a9aa41e9e23bafba38882a2b72f62441'
git-subtree-dir: mod/lightpics
git-subtree-mainline: 52335325e5ea8c89c711e1ba40d9ac1657004e61
git-subtree-split: 324f39c3a9aa41e9e23bafba38882a2b72f62441
Diffstat (limited to 'mod/lightpics/views')
47 files changed, 2381 insertions, 0 deletions
diff --git a/mod/lightpics/views/default/admin/settings/photos.php b/mod/lightpics/views/default/admin/settings/photos.php new file mode 100644 index 000000000..cc3592f37 --- /dev/null +++ b/mod/lightpics/views/default/admin/settings/photos.php @@ -0,0 +1,71 @@ +<?php +/** + * Admin page + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$tab = get_input('tab', 'settings'); + +echo elgg_view('navigation/tabs', array( + 'tabs' => array( + array( + 'text' => elgg_echo('settings'), + 'href' => '/admin/settings/photos', + 'selected' => ($tab == 'settings'), + ), + array( + 'text' => elgg_echo('tidypics:server_info'), + 'href' => '/admin/settings/photos?tab=server_info', + 'selected' => ($tab == 'server_info'), + ), + array( + 'text' => elgg_echo('tidypics:server_config'), + 'href' => '/admin/settings/photos?tab=server_config', + 'selected' => ($tab == 'server_config'), + ), + array( + 'text' => 'ImageMagick', + 'href' => '/admin/settings/photos?tab=image_lib', + 'selected' => ($tab == 'image_lib'), + ), + array( + 'text' => elgg_echo('tidypics:settings:thumbnail'), + 'href' => '/admin/settings/photos?tab=thumbnail', + 'selected' => ($tab == 'thumbnail'), + ), + array( + 'text' => elgg_echo('tidypics:settings:help'), + 'href' => '/admin/settings/photos?tab=help', + 'selected' => ($tab == 'help'), + ), + ) +)); + +switch ($tab) { + case 'server_info': + echo elgg_view('admin/settings/photos/server_info'); + break; + + case 'server_config': + echo elgg_view('admin/settings/photos/server_config'); + break; + + case 'image_lib': + echo elgg_view('admin/settings/photos/image_lib'); + break; + + case 'thumbnail': + echo elgg_view('admin/settings/photos/thumbnail'); + break; + + case 'help': + echo elgg_view('admin/settings/photos/help'); + break; + + default: + case 'settings': + echo elgg_view('admin/settings/photos/settings'); + break; +} diff --git a/mod/lightpics/views/default/admin/settings/photos/help.php b/mod/lightpics/views/default/admin/settings/photos/help.php new file mode 100644 index 000000000..1e5bdd254 --- /dev/null +++ b/mod/lightpics/views/default/admin/settings/photos/help.php @@ -0,0 +1,14 @@ +<?php +/** + * Tidypics Help + * + */ + +elgg_load_library('elgg:markdown'); + +$faq = elgg_get_plugins_path() . 'lightpics/FAQ.txt'; +$text = Markdown(file_get_contents($faq)); + +$content = "<div class=\"elgg-markdown\">$text</div>"; + +echo elgg_view_module('inline', elgg_echo('tidypics:settings:help'), $content); diff --git a/mod/lightpics/views/default/admin/settings/photos/image_lib.php b/mod/lightpics/views/default/admin/settings/photos/image_lib.php new file mode 100644 index 000000000..6e519b607 --- /dev/null +++ b/mod/lightpics/views/default/admin/settings/photos/image_lib.php @@ -0,0 +1,38 @@ +<?php +/** + * Test the location of ImageMagick + */ + +$content .= '<p>' . elgg_echo('tidypics:lib_tools:testing') . '</p>'; +$content .= '<p><label>' . elgg_echo('tidypics:settings:im_path'); +$content .= elgg_view('input/text', array( + 'name' => 'im_location' +)); +$content .= '</p><p>'; +$content .= elgg_view('input/submit', array( + 'value' => elgg_echo('submit'), + 'id' => 'tidypics-im-test' +)); +$content .= '</p>'; +$content .= '<p id="tidypics-im-results"></p>'; + +echo elgg_view_module('inline', 'ImageMagick', $content); + +?> +<script type="text/javascript"> + $(function() { + $('#tidypics-im-test').click(function() { + var loc = $('input[name=im_location]').val(); + $("#tidypics-im-results").html(""); + $.ajax({ + type: "GET", + url: elgg.normalize_url('mod/tidypics/actions/photos/admin/imtest.php'), + data: {location: loc}, + cache: false, + success: function(html){ + $("#tidypics-im-results").html(html); + } + }); + }); + }); +</script> diff --git a/mod/lightpics/views/default/admin/settings/photos/server_config.php b/mod/lightpics/views/default/admin/settings/photos/server_config.php new file mode 100644 index 000000000..b4fe552ec --- /dev/null +++ b/mod/lightpics/views/default/admin/settings/photos/server_config.php @@ -0,0 +1,14 @@ +<?php +/** + * Tidypics server configuration + * + */ + +elgg_load_library('elgg:markdown'); + +$faq = elgg_get_plugins_path() . 'lightpics/CONFIG.txt'; +$text = Markdown(file_get_contents($faq)); + +$content = "<div class=\"elgg-markdown\">$text</div>"; + +echo elgg_view_module('inline', elgg_echo('tidypics:server_config'), $content); diff --git a/mod/lightpics/views/default/admin/settings/photos/server_info.php b/mod/lightpics/views/default/admin/settings/photos/server_info.php new file mode 100644 index 000000000..c100b0de2 --- /dev/null +++ b/mod/lightpics/views/default/admin/settings/photos/server_info.php @@ -0,0 +1,120 @@ +<?php +/** + * Tidypics server analysis + */ + +function tp_readable_size($bytes) { + if (strpos($bytes, 'M')) { + return $bytes . 'B'; + } + + $size = $bytes / 1024; + if ($size < 1024) { + $size = number_format($size, 2); + $size .= ' KB'; + } else { + $size = $size / 1024; + if ($size < 1024) { + $size = number_format($size, 2); + $size .= ' MB'; + } else { + $size = $size / 1024; + $size = number_format($size, 2); + $size .= ' GB'; + } + } + return $size; +} + +$disablefunc = explode(',', ini_get('disable_functions')); +$exec_avail = elgg_echo('tidypics:disabled'); +if (is_callable('exec') && !in_array('exec',$disablefunc)) { + $exec_avail = elgg_echo('tidypics:enabled'); +} + +ob_start(); + +?> +<table class="elgg-table-alt"> + <tr> + <td><?php echo elgg_echo('tidypics:server_info:php_version'); ?></td> + <td><?php echo phpversion(); ?></td> + <td></td> + </tr> + <tr> + <td>GD</td> + <td><?php echo (extension_loaded('gd')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td> + <td><?php echo elgg_echo('tidypics:server_info:gd_desc'); ?></td> + </tr> + <tr> + <td>imagick</td> + <td><?php echo (extension_loaded('imagick')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td> + <td></td> + </tr> + <tr> + <td>exec()</td> + <td><?php echo $exec_avail; ?></td> + <td><?php echo elgg_echo('tidypics:server_info:exec_desc'); ?></td> + </tr> + <tr> + <td><?php echo elgg_echo('tidypics:server_info:memory_limit'); ?></td> + <td><?php echo tp_readable_size(ini_get('memory_limit')); ?></td> + <td><?php echo elgg_echo('tidypics:server_info:memory_limit_desc'); ?></td> + </tr> + <tr> + <td><?php echo elgg_echo('tidypics:server_info:peak_usage'); ?></td> + <td><?php if (function_exists('memory_get_peak_usage')) echo tp_readable_size(memory_get_peak_usage()); ?></td> + <td><?php echo elgg_echo('tidypics:server_info:peak_usage_desc'); ?></td> + </tr> + <tr> + <td><?php echo elgg_echo('tidypics:server_info:upload_max_filesize'); ?></td> + <td><?php echo tp_readable_size(ini_get('upload_max_filesize')); ?></td> + <td><?php echo elgg_echo('tidypics:server_info:upload_max_filesize_desc'); ?></td> + </tr> + <tr> + <td><?php echo elgg_echo('tidypics:server_info:post_max_size'); ?></td> + <td><?php echo tp_readable_size(ini_get('post_max_size')); ?></td> + <td><?php echo elgg_echo('tidypics:server_info:post_max_size_desc'); ?></td> + </tr> + <tr> + <td><?php echo elgg_echo('tidypics:server_info:max_input_time'); ?></td> + <td><?php echo ini_get('max_input_time'); ?>s</td> + <td><?php echo elgg_echo('tidypics:server_info:max_input_time_desc'); ?></td> + </tr> + <tr> + <td><?php echo elgg_echo('tidypics:server_info:max_execution_time'); ?></td> + <td><?php echo ini_get('max_execution_time'); ?> s</td> + <td><?php echo elgg_echo('tidypics:server_info:max_execution_time_desc'); ?></td> + </tr> + <tr> + <td>GD imagejpeg</td> + <td><?php echo (is_callable('imagejpeg')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td> + <td></td> + </tr> + <tr> + <td>GD imagepng</td> + <td><?php echo (is_callable('imagepng')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td> + <td></td> + </tr> + <tr> + <td>GD imagegif</td> + <td><?php echo (is_callable('imagegif')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td> + <td></td> + </tr> + <tr> + <td>EXIF</td> + <td><?php echo (is_callable('exif_read_data')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td> + <td></td> + </tr> + <tr> + <td><?php echo elgg_echo('tidypics:server_info:use_only_cookies'); ?></td> + <td><?php echo (ini_get('session.use_only_cookies')) ? elgg_echo('tidypics:enabled') : elgg_echo('tidypics:disabled'); ?></td> + <td><?php echo elgg_echo('tidypics:server_info:use_only_cookies_desc'); ?></td> + </tr> +</table> + +<?php + +$content = ob_get_clean(); + +echo elgg_view_module('inline', elgg_echo('tidypics:server_info'), $content);
\ No newline at end of file diff --git a/mod/lightpics/views/default/admin/settings/photos/settings.php b/mod/lightpics/views/default/admin/settings/photos/settings.php new file mode 100644 index 000000000..6ea444392 --- /dev/null +++ b/mod/lightpics/views/default/admin/settings/photos/settings.php @@ -0,0 +1,18 @@ +<?php +/** + * Tidypics settings + */ + +if (tidypics_is_upgrade_available()) { + echo '<div class="elgg-admin-notices">'; + echo '<p>'; + echo elgg_view('output/url', array( + 'text' => elgg_echo('tidypics:upgrade'), + 'href' => 'action/photos/admin/upgrade', + 'is_action' => true, + )); + echo '</p>'; + echo '</div>'; +} + +echo elgg_view_form('photos/admin/settings'); diff --git a/mod/lightpics/views/default/admin/settings/photos/thumbnail.php b/mod/lightpics/views/default/admin/settings/photos/thumbnail.php new file mode 100644 index 000000000..5f9769e91 --- /dev/null +++ b/mod/lightpics/views/default/admin/settings/photos/thumbnail.php @@ -0,0 +1,54 @@ +<?php +/** + * Tidypics thumbnail creation tool + */ + +$title = elgg_echo('tidypics:settings:thumbnail'); +$body = '<p>' . elgg_echo('tidypics:thumbnail_tool_blurb') . '</p>'; +$im_id = elgg_echo('tidypics:settings:im_id'); +$input = elgg_view('input/text', array( + 'name' => 'image_id' +)); +$submit = elgg_view('input/submit', array( + 'value' => elgg_echo('submit'), + 'id' => 'elgg-tidypics-im-test' +)); + +$body .=<<<HTML + <p> + <label>$im_id $input</label> + </p> + <p> + $submit + <div id="elgg-tidypics-im-results"></div> + </p> +HTML; + +echo elgg_view_module('inline', $title, $body); + +?> + +<script type="text/javascript"> + $(function() { + $('#elgg-tidypics-im-test').click(function() { + var image_id = $('input[name=image_id]').val(); + $("#elgg-tidypics-im-results").html('<div class="elgg-ajax-loader"></div>'); + elgg.action('photos/admin/create_thumbnails', { + format: 'JSON', + data: {guid: image_id}, + cache: false, + success: function(result) { + // error + if (result.status < 0) { + var html = ''; + } else { + var html = '<img class="elgg-photo tidypics-photo" src="' + + result.output.thumbnail_src + '" alt="' + result.output.title + + '" />'; + } + $("#elgg-tidypics-im-results").html(html); + } + }); + }); + }); +</script>
\ No newline at end of file diff --git a/mod/lightpics/views/default/forms/photos/admin/settings.php b/mod/lightpics/views/default/forms/photos/admin/settings.php new file mode 100644 index 000000000..e0b8a9880 --- /dev/null +++ b/mod/lightpics/views/default/forms/photos/admin/settings.php @@ -0,0 +1,26 @@ +<?php +/** + * Tidypics admin settings form body + * + * @todo remove original image, group only upload not delete + */ + +$plugin = elgg_get_plugin_from_id('lightpics'); + +$title = elgg_echo('tidypics:settings:main'); +$content = elgg_view('forms/photos/admin/settings/main', array('plugin' => $plugin)); +echo elgg_view_module('inline', $title, $content); + +$title = elgg_echo('tidypics:settings:heading:img_lib'); +$content = elgg_view('forms/photos/admin/settings/image_lib', array('plugin' => $plugin)); +echo elgg_view_module('inline', $title, $content); + +$title = elgg_echo('tidypics:settings:heading:river'); +$content = elgg_view('forms/photos/admin/settings/activity', array('plugin' => $plugin)); +echo elgg_view_module('inline', $title, $content); + +$title = elgg_echo('tidypics:settings:heading:sizes'); +$content = elgg_view('forms/photos/admin/settings/thumbnails', array('plugin' => $plugin)); +echo elgg_view_module('inline', $title, $content); + +echo elgg_view('input/submit', array('value' => elgg_echo("save"))); diff --git a/mod/lightpics/views/default/forms/photos/admin/settings/activity.php b/mod/lightpics/views/default/forms/photos/admin/settings/activity.php new file mode 100644 index 000000000..d62901af6 --- /dev/null +++ b/mod/lightpics/views/default/forms/photos/admin/settings/activity.php @@ -0,0 +1,31 @@ +<?php +/** + * River integration + */ + +$plugin = $vars['plugin']; + +echo '<div>'; +echo elgg_echo('tidypics:settings:img_river_view') . ': '; +echo elgg_view('input/dropdown', array( + 'name' => 'params[img_river_view]', + 'options_values' => array( + 'all' => elgg_echo('tidypics:option:all'), + 'batch' => '1', + 'none' => elgg_echo('tidypics:option:none'), + ), + 'value' => $plugin->img_river_view, +)); +echo '</div>'; +echo '<div>'; +echo elgg_echo('tidypics:settings:album_river_view') . ': '; +echo elgg_view('input/dropdown', array( + 'name' => 'params[album_river_view]', + 'options_values' => array( + 'cover' => elgg_echo('tidypics:option:cover'), + 'set' => elgg_echo('tidypics:option:set'), + ), + 'value' => $plugin->album_river_view, +)); +echo '</div>'; + diff --git a/mod/lightpics/views/default/forms/photos/admin/settings/image_lib.php b/mod/lightpics/views/default/forms/photos/admin/settings/image_lib.php new file mode 100644 index 000000000..4e3f7f2a0 --- /dev/null +++ b/mod/lightpics/views/default/forms/photos/admin/settings/image_lib.php @@ -0,0 +1,20 @@ +<?php +/** + * Image library settings + */ + +$plugin = $vars['plugin']; + +echo'<div>'; +echo elgg_echo('tidypics:settings:image_lib') . ': '; +echo elgg_view('input/dropdown', array( + 'name' => 'params[image_lib]', + 'options_values' => tidypics_get_image_libraries(), + 'value' => $plugin->image_lib, +)); +echo '</div>'; +echo '<div>'; +echo elgg_echo('tidypics:settings:im_path') . ' '; +echo elgg_view("input/text", array('name' => 'params[im_path]', 'value' => $plugin->im_path)); +echo '</div>'; + diff --git a/mod/lightpics/views/default/forms/photos/admin/settings/main.php b/mod/lightpics/views/default/forms/photos/admin/settings/main.php new file mode 100644 index 000000000..a35c9ab59 --- /dev/null +++ b/mod/lightpics/views/default/forms/photos/admin/settings/main.php @@ -0,0 +1,39 @@ +<?php +/** + * Primary settings for Elgg + */ + +$plugin = $vars['plugin']; + +$checkboxes = array('view_count', 'exif', 'download_link'); +foreach ($checkboxes as $checkbox) { + echo '<div>'; + echo elgg_view('input/checkbox', array( + 'name' => "params[$checkbox]", + 'value' => true, + 'checked' => (bool)$plugin->$checkbox, + )); + echo ' ' . elgg_echo("tidypics:settings:$checkbox"); + echo '</div>'; +} + +// max image size +echo '<div>'; +echo elgg_echo('tidypics:settings:maxfilesize'); +echo elgg_view('input/text', array( + 'name' => 'params[maxfilesize]', + 'value' => $plugin->maxfilesize, +)); +echo '</div>'; + +// Quota Size +$quota = $plugin->quota; +if (!$quota) { + $quota = 0; +} +echo '<div>' . elgg_echo('tidypics:settings:quota'); +echo elgg_view('input/text', array( + 'name' => 'params[quota]', + 'value' => $quota, +)); +echo '</div>'; diff --git a/mod/lightpics/views/default/forms/photos/admin/settings/thumbnails.php b/mod/lightpics/views/default/forms/photos/admin/settings/thumbnails.php new file mode 100644 index 000000000..ec7a6d1b2 --- /dev/null +++ b/mod/lightpics/views/default/forms/photos/admin/settings/thumbnails.php @@ -0,0 +1,33 @@ +<?php +/** + * Thumbnail sizes + */ + +$plugin = $vars['plugin']; + +echo '<span class="elgg-text-help">' . elgg_echo('tidypics:settings:sizes:instructs') . '</span>'; +$image_sizes = unserialize($plugin->image_sizes); +echo '<table>'; +$sizes = array('large', 'small', 'tiny'); +foreach ($sizes as $size) { + echo '<tr>'; + echo '<td class="pas">'; + echo elgg_echo("tidypics:settings:{$size}size"); + echo '</td><td class="pas">'; + echo 'width: '; + echo elgg_view('input/text', array( + 'name' => "{$size}_image_width", + 'value' => $image_sizes["{$size}_image_width"], + 'class' => 'tidypics-input-thin', + )); + echo '</td><td class="pas">'; + echo 'height: '; + echo elgg_view('input/text', array( + 'name' => "{$size}_image_height", + 'value' => $image_sizes["{$size}_image_height"], + 'class' => 'tidypics-input-thin', + )); + echo '</td>'; + echo '</tr>'; +} +echo '</table>'; diff --git a/mod/lightpics/views/default/forms/photos/album/save.php b/mod/lightpics/views/default/forms/photos/album/save.php new file mode 100644 index 000000000..8a1202c07 --- /dev/null +++ b/mod/lightpics/views/default/forms/photos/album/save.php @@ -0,0 +1,48 @@ +<?php +/** + * Save album form body + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$title = elgg_extract('title', $vars, ''); +$description = elgg_extract('description', $vars, ''); +$tags = elgg_extract('tags', $vars, ''); +$access_id = elgg_extract('access_id', $vars, get_default_access()); +$container_guid = elgg_extract('container_guid', $vars, elgg_get_page_owner_guid()); +$guid = elgg_extract('guid', $vars, 0); + +?> + +<div> + <label><?php echo elgg_echo('album:title'); ?></label> + <?php echo elgg_view('input/text', array('name' => 'title', 'value' => $title)); ?> +</div> +<div> + <label><?php echo elgg_echo('album:desc'); ?></label> + <?php echo elgg_view('input/longtext', array('name' => 'description', 'value' => $description)); ?> +</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> + <?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' => 'guid', 'value' => $guid)); +echo elgg_view('input/hidden', array('name' => 'container_guid', 'value' => $container_guid)); +echo elgg_view('input/submit', array('value' => elgg_echo('save'))); +?> +</div> diff --git a/mod/lightpics/views/default/forms/photos/album/sort.php b/mod/lightpics/views/default/forms/photos/album/sort.php new file mode 100644 index 000000000..49bd016aa --- /dev/null +++ b/mod/lightpics/views/default/forms/photos/album/sort.php @@ -0,0 +1,28 @@ +<?php +/** + * Album sorting view + */ + +$album = $vars['album']; +$image_guids = $album->getImageList(); + +echo '<div>'; +echo elgg_echo('tidypics:sort:instruct'); +echo '</div>'; + +echo '<div>'; +echo elgg_view('input/hidden', array('name' => 'guids')); +echo elgg_view('input/hidden', array('name' => 'album_guid', 'value' => $album->guid)); +echo elgg_view('input/submit', array('value' => elgg_echo('save'))); +echo '</div>'; + +echo '<div class="elgg-foot">'; +echo '<ul id="tidypics-sort" class="elgg-gallery">'; +foreach ($image_guids as $image_guid) { + $image = get_entity($image_guid); + $img = elgg_view('output/img', array( + 'src' => $image->getIconURL(), + )); + echo "<li class=\"mam\" id=\"$image_guid\">$img</li>"; +} +echo '</ul>'; diff --git a/mod/lightpics/views/default/forms/photos/basic_upload.php b/mod/lightpics/views/default/forms/photos/basic_upload.php new file mode 100644 index 000000000..9e71cf59e --- /dev/null +++ b/mod/lightpics/views/default/forms/photos/basic_upload.php @@ -0,0 +1,63 @@ +<?php +$album = $vars['entity']; +$help = elgg_echo('tidypics:uploader:help'); + +$input = elgg_view('input/file', array( + 'name' => 'images[]', + 'multiple' => 'multiple', + 'class' => 'hidden-js', +)); + +$button = elgg_view('output/url', array( + 'text' => elgg_echo('tidypics:uploader:upload') . $input, + 'class' => 'elgg-button elgg-button-action fileinput-button', +)); + +$reset = elgg_view('input/reset', array( + 'value' => elgg_echo('cancel'), + 'class' => 'hidden', +)); + +$foot = elgg_view('input/hidden', array('name' => 'guid', 'value' => $album->getGUID())); +$foot .= elgg_view('input/submit', array('value' => elgg_echo("save"))); + +echo <<<HTML +<div> + $max +</div> +<div class="fileinput-container"> + $button + $reset + <p class="elgg-text-help">$help</p> +</div> +<div class="mtm"><!-- The table listing the files available for upload/download --> + <table role="presentation" class="elgg-table-alt clearfloat mtm"> + <tbody class="files"></tbody> + </table> +</div> +<div class='elgg-foot'> + $foot +</div> +HTML; + +?> + +<noscript><style type="text/css">hidden-nojs {display: hidden}</style></noscript> + +<!-- The template to display files available for upload --> +<script id="template-upload" type="text/x-tmpl"> +{% for (var i=0, file; file=o.files[i]; i++) { %} + <tr class="template-upload fade"> + {% if (file.error) { %} + <td class="error"><span class="elgg-message elgg-state-error">{%=locale.fileupload.error%} {%=locale.fileupload.errors[file.error] || file.error%}</span></td> + {% } else { %} + <td class="preview"><span class="fade"></span></td> + {% } %} + <td class="name"><span>{%=file.name%}</span></td> + <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td> + + </tr> +{% } %} +</script> +<!-- The template to display files available for download --> +<script id="template-download" type="text/x-tmpl" /> diff --git a/mod/lightpics/views/default/forms/photos/batch/edit.php b/mod/lightpics/views/default/forms/photos/batch/edit.php new file mode 100644 index 000000000..d843d8349 --- /dev/null +++ b/mod/lightpics/views/default/forms/photos/batch/edit.php @@ -0,0 +1,33 @@ +<?php +/** + * Edit properties on a batch of images + * + * @uses $vars['batch'] ElggObject + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$batch = $vars['batch']; +$album = $batch->getContainerEntity(); + +$images = elgg_get_entities_from_relationship(array( + 'type' => 'object', + 'subtype' => 'image', + 'relationship' => 'belongs_to_batch', + 'relationship_guid' => $batch->getGUID(), + 'inverse_relationship' => true, + 'limit' => 0 +)); + +echo '<ul>'; +foreach ($images as $image) { + echo '<li>'; + echo elgg_view('forms/photos/batch/edit/image', array('entity' => $image)); + echo '</li>'; +} +echo '</ul>'; + +echo '<div class="elgg-foot">'; +echo elgg_view('input/submit', array('value' => elgg_echo('save'))); +echo '</div>'; diff --git a/mod/lightpics/views/default/forms/photos/batch/edit/image.php b/mod/lightpics/views/default/forms/photos/batch/edit/image.php new file mode 100644 index 000000000..eed804e90 --- /dev/null +++ b/mod/lightpics/views/default/forms/photos/batch/edit/image.php @@ -0,0 +1,35 @@ +<?php +/** + * Form component for editing a single image + * + * @uses $vars['entity'] + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$image = $vars['entity']; + +echo '<div class="elgg-image-block">'; + +echo '<div class="elgg-image">'; +echo elgg_view_entity_icon($image, 'small', array('href' => false)); +echo '</div>'; + +echo '<div class="elgg-body"><fieldset class="mlm">'; +echo '<div><label>' . elgg_echo('album:title') . '</label>'; +echo elgg_view('input/text', array('name' => 'title[]', 'value' => $title,)); +echo '</div>'; + +echo '<div><label>' . elgg_echo('caption') . '</label>'; +echo elgg_view('input/longtext', array('name' => 'caption[]')); +echo '</div>'; + +echo '<div><label>' . elgg_echo("tags") . '</label>'; +echo elgg_view('input/tags', array('name' => 'tags[]')); +echo '</div>'; + +echo elgg_view('input/hidden', array('name' => 'guid[]', 'value' => $image->getGUID())); +echo '<fieldset></div>'; + +echo '</div>'; diff --git a/mod/lightpics/views/default/forms/photos/image/save.php b/mod/lightpics/views/default/forms/photos/image/save.php new file mode 100644 index 000000000..47a08640a --- /dev/null +++ b/mod/lightpics/views/default/forms/photos/image/save.php @@ -0,0 +1,48 @@ +<?php +/** + * Save image form body + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$title = elgg_extract('title', $vars, ''); +$description = elgg_extract('description', $vars, ''); +$tags = elgg_extract('tags', $vars, ''); +$access_id = elgg_extract('access_id', $vars, get_default_access()); +$container_guid = elgg_extract('container_guid', $vars, elgg_get_page_owner_guid()); +$guid = elgg_extract('guid', $vars, 0); + +?> + +<div> + <label><?php echo elgg_echo('album:title'); ?></label> + <?php echo elgg_view('input/text', array('name' => 'title', 'value' => $title)); ?> +</div> +<div> + <label><?php echo elgg_echo('album:desc'); ?></label> + <?php echo elgg_view('input/longtext', array('name' => 'description', 'value' => $description)); ?> +</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> + <?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' => 'guid', 'value' => $guid)); +echo elgg_view('input/hidden', array('name' => 'container_guid', 'value' => $container_guid)); +echo elgg_view('input/submit', array('value' => elgg_echo('save'))); +?> +</div> diff --git a/mod/lightpics/views/default/icon/object/album.php b/mod/lightpics/views/default/icon/object/album.php new file mode 100644 index 000000000..ddc6a8a56 --- /dev/null +++ b/mod/lightpics/views/default/icon/object/album.php @@ -0,0 +1,41 @@ +<?php +/** + * Image icon view + * + * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method + * @uses $vars['size'] tiny, small (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 + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$album = $vars['entity']; + +$cover_guid = $album->getCoverImageGuid(); +if ($cover_guid) { + $vars['title'] = $album->getTitle(); + $vars['href'] = $album->getURL(); + echo elgg_view_entity_icon(get_entity($cover_guid), $vars['size'], $vars); +} else { + $url = "mod/lightpics/graphics/empty_album.png"; + $url = elgg_normalize_url($url); + $img = elgg_view('output/img', array( + 'src' => $url, + 'class' => 'elgg-photo', + 'title' => $album->getTitle(), + 'alt' => $album->getTitle(), + )); + + $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); +} diff --git a/mod/lightpics/views/default/icon/object/image.php b/mod/lightpics/views/default/icon/object/image.php new file mode 100644 index 000000000..9087fc3d8 --- /dev/null +++ b/mod/lightpics/views/default/icon/object/image.php @@ -0,0 +1,62 @@ +<?php +/** + * Image icon view + * + * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method + * @uses $vars['size'] tiny, small (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 + * @uses $vars['title'] Optional title override + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$entity = $vars['entity']; + +$sizes = array('master', 'large', 'small', 'tiny'); +// Get size +if (!in_array($vars['size'], $sizes)) { + $vars['size'] = 'small'; +} + +if (!isset($vars['title'])) { + $title = $entity->getTitle(); +} else { + $title = $vars['title']; +} + +$url = isset($vars['href']) ? $vars['href'] : $entity->getURL(); +if (isset($vars['href'])) { + $url = $vars['href']; +} + +$class = ''; +if (isset($vars['img_class'])) { + $class = $vars['img_class']; +} +$class = "elgg-photo $class"; + +$img_src = $entity->getIconURL($vars['size']); +$img_src = elgg_format_url($img_src); +$img = elgg_view('output/img', array( + 'src' => $img_src, + 'class' => $class, + 'title' => $title, + '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/lightpics/views/default/js/photos/tidypics.php b/mod/lightpics/views/default/js/photos/tidypics.php new file mode 100644 index 000000000..1ff7b2c40 --- /dev/null +++ b/mod/lightpics/views/default/js/photos/tidypics.php @@ -0,0 +1,43 @@ +<?php +/** + * + */ + +?> + +elgg.provide('elgg.tidypics'); + +elgg.tidypics.init = function() { + + if (elgg.ui.lightbox) { + $('.elgg-lightbox, .elgg-lightbox-photo').colorbox({ + href: function() { + if ((new RegExp("photos/image/[0-9]+", 'i')).test($(this).attr('href'))) { + var guid = (new RegExp("photos/image/[0-9]+", 'i')).exec($(this).attr('href')).toString().substr("photos/image/".length); + return elgg.config.wwwroot + "photos/thumbnail/" + guid + "/large"; + } else { + return $(this).attr('href'); + } + }, + title: function() { + return '<h3 style="display: inline">'+ $(this).find('img').attr('title') +'</h3> - <a href="'+ $(this).attr('href') +'">'+ elgg.echo('comments') +'</a>'; + } + }); + } + + $("#tidypics-sort").sortable({ + opacity: 0.7, + revert: true, + scroll: true + }); + + $('.elgg-form-photos-album-sort').submit(function() { + var tidypics_guids = []; + $("#tidypics-sort li").each(function(index) { + tidypics_guids.push($(this).attr('id')); + }); + $('input[name="guids"]').val(tidypics_guids.toString()); + }); +}; + +elgg.register_hook_handler('init', 'system', elgg.tidypics.init); diff --git a/mod/lightpics/views/default/js/photos/upload.php b/mod/lightpics/views/default/js/photos/upload.php new file mode 100644 index 000000000..e3922c8c8 --- /dev/null +++ b/mod/lightpics/views/default/js/photos/upload.php @@ -0,0 +1,63 @@ +<?php +/** + * + */ + +if ($maxfilesize = (int) elgg_get_plugin_setting('maxfilesize', 'lightpics')) { + $maxfilesize *= 1024 * 1024; +} else { + $maxfilesize = 5 * 1024 * 1024; +} +?> + +elgg.provide('elgg.tidypics.upload'); + +elgg.tidypics.upload.init = function() { + + window.locale = { + "fileupload": { + "error": elgg.echo('tidypics:upload:error'), + "errors": { + "maxFileSize": elgg.echo('tidypics:upload:maxfilesize'), + "minFileSize": elgg.echo('tidypics:upload:minfilesize'), + "acceptFileTypes": elgg.echo('tidypics:upload:acceptfiletypes'), + "maxNumberOfFiles": elgg.echo('tidypics:upload:maxnumberoffiles'), + }, + } + }; + + $.widget('blueimpJUI.fileupload', $.blueimpUI.fileupload, { + _transition: function (node) { + var that = this, + deferred = $.Deferred(); + if (node.hasClass('fade')) { + node.fadeToggle(function () { + deferred.resolveWith(node); + }); + } else { + deferred.resolveWith(node); + } + return deferred; + }, + }); + + // Initialize the jQuery File Upload widget: + $('#fileupload').fileupload(); + + // Settings + $('#fileupload').fileupload('option', { + maxFileSize: <?php echo $maxfilesize; ?>, + acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, + change: function() { + elgg.tidypics.upload.fileinput.hide().appendTo($('#fileupload')); + elgg.tidypics.upload.fileinput = $('#fileupload .elgg-input-file'); + }, + drop: function () { + return false; + } + }); + + elgg.tidypics.upload.fileinput = $('#fileupload .elgg-input-file'); +}; + +elgg.register_hook_handler('init', 'system', elgg.tidypics.upload.init); 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); diff --git a/mod/lightpics/views/default/photos/css.php b/mod/lightpics/views/default/photos/css.php new file mode 100644 index 000000000..9a2b1768f --- /dev/null +++ b/mod/lightpics/views/default/photos/css.php @@ -0,0 +1,470 @@ +<?php +/** + * Tidypics CSS + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ +?> + +/* *************************************** + TIDYPICS +*************************************** */ +.elgg-module-tidypics-album, +.elgg-module-tidypics-image { + width: 161px; + text-align: center; + margin: 5px 0; +} +.elgg-module-tidypics-image { + margin: 5px auto; + height: 80%; +} + +.tidypics-gallery-widget > li { + width: 100%; +} +.tidypics-photo-wrapper { + position: relative; +} + +.tidypics-heading { + color: #0054A7; +} +.tidypics-heading:hover { + color: #0054A7; + text-decoration: none; +} + +.tidypics-input-thin { + width: 120px; +} + +#tidypics-sort li { + width:153px; + height:153px; + cursor: move; +} + +.tidypics-river-list > li { + display: inline-block; +} + +.tidypics-photo-item + .tidypics-photo-item { + margin-left: 7px; +} + +.tidypics-gallery > li { + padding: 0 10px; +} + +.tidypics-album-nav { + margin: 3px 0; + text-align: center; + color: #aaa; +} + +.tidypics-album-nav > li { + padding: 0 3px; +} + +.tidypics-album-nav > li { + vertical-align: top; +} + +/* *************************************** + UPLOADER +*************************************** */ + +.fileinput-container { + text-align: center; +} +.fileinput-button { + cursor: pointer; +} +.fileinput-button input { + position: absolute; + top: 0; + right: 0; + margin: 0; + opacity: 0; + filter: alpha(opacity=0); + +} +.files .fade { + display: none; +} +/* Fix for IE 6: */ +*html .fileinput-button { + margin-right: -2px; +} +*html .fileinput-button .elgg-button { + line-height: 24px; +} +*html .fileupload-buttonbar .elgg-button { + margin-left: 3px; +} + +/* Fix for IE 7: */ +*+html .fileinput-button { + margin-right: 1px; +} +*+html .fileinput-button .elgg-button { + line-height: 24px; +} +*+html .fileupload-buttonbar .elgg-button { + margin-left: 3px; +} + +@media (max-width: 480px) { + .files .preview * { + width: 40px; + } + .files .name * { + width: 80px; + display: inline-block; + word-wrap: break-word; + } +} + +/* Fix for Webkit (Safari, Chrome) */ +@media screen and (-webkit-min-device-pixel-ratio:0) { + .fileinput-button { + margin-top: 2px; + } +} + +<?php +return true; +?> + +/* ---- tidypics object views ---- */ + +.tidypics_wrapper > table.entity_gallery { + border-spacing: 0; +} + +.tidypics_wrapper .entity_gallery td { + padding: 0; +} + +.tidypics_wrapper .entity_gallery_item, +.tidypics_wrapper .entity_gallery_item:hover { + background-color: transparent; + color: inherit; +} + +#tidypics_breadcrumbs { +margin:5px 0 15px 0; +font-size:80%; +} + +#tidypics_desc { +padding:0 20px; +font-style:italic; +} + +#tidypics_image_nav { +text-align:center; +} + +#tidypics_image_wrapper { +margin:10px 0 10px 0; +text-align:center; +} + +#tidypics_image { +border:1px solid #dedede; +padding:5px; +} + +#tidypics_image_nav ul li { +display:inline; +margin-right:15px; +} + +#tidypics_controls { +text-align:center; +margin-bottom:10px; +} + +#tidypics_controls a { +margin:10px; +} + +#tidypics_controls ul { +list-style:none; +margin:0px; +padding:8px; +} + +#tidypics_controls ul li { +padding:2px 10px 2px 22px; +margin:2px 0px; +display:inline; +} + +.tidypics_info { +padding:20px; +} + +#tidypics_exif { +padding-left:20px; +font-size:80%; +} + +.tidypics_album_images { +float:left; +width:153px; +height:153px; +margin:3px; +padding:4px; +border:1px solid #dedede; +text-align:center; +} + +.tidypics_album_cover { +padding:2px; +border:1px solid #dedede; +margin:5px 0; +} + +.tidypics_album_widget_single_item { +margin-bottom:8px; +} + +.tidypics_album_gallery_item { +float:left; +margin-bottom:20px; +padding: 4px; +text-align:center; +width: 160px; +} + +.tidypics_line_break { +width: 100%; +clear: both; +} + +.tidypics_gallery_title { +font-weight:bold; +} + +.tidypics_popup { +border:1px solid #3B5999; +width:200px; +position:absolute; +z-index:10000; +display:none; +background:#ffffff; +padding:10px; +font-size:12px; +text-align:left; +} + +/* ------ tidypics widget view ------ */ + +#tidypics_album_widget_container { +text-align:center; +} + +.tidypics_album_widget_timestamp { +color:#333333; +} + +.tidypics_widget_latest { +margin: 0 auto; +width: 208px; +} + +/* --------- image upload/edit forms ------------ */ + +#tidpics_image_upload_list li { +margin:3px 0; +} + +.tidypics_edit_image_container { +padding:5px; +margin:5px 0; +overflow:auto; +} + +.tidypics_edit_images { +float:right; +width:160px; +height:160px; +margin:4px; +padding:5px; +border:1px solid #dedede; +text-align:center; +} + +.tidypics_image_info { +float:left; +width:60%; +} + +.tidypics_image_info label { +font-size:1em; +} + +.tidypics_caption_input { + width:98%; + height:100px; +} + +/* ---- tidypics group css ----- */ + +#tidypics_group_profile { +-webkit-border-radius: 8px; +-moz-border-radius: 8px; +background:white none repeat scroll 0 0; +margin:0 0 20px; +padding:0 0 5px; +} + + +/* --------- tidypics river items ------------ */ + +.river_object_image_create { + background: url(<?php echo $vars['url']; ?>mod/lightpics/graphics/icons/river_icon_image.gif) no-repeat left -1px; +} +.river_object_album_create { + background: url(<?php echo $vars['url']; ?>mod/lightpics/graphics/icons/river_icon_album.gif) no-repeat left -1px; +} +.river_object_image_comment { + background: url(<?php echo $vars['url']; ?>_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px; +} +.river_object_album_comment { + background: url(<?php echo $vars['url']; ?>_graphics/river_icons/river_icon_comment.gif) no-repeat left -1px; +} +.river_user_tag { + background: url(<?php echo $vars['url']; ?>mod/lightpics/graphics/icons/river_icon_tag.gif) no-repeat left -1px; +} + +/* ----------- tagging ---------------- */ +#tidypics_tag_instructions { +background:#BBDAF7; +border:1px solid #4690D6; +padding:10px; +height:25px; +min-width:360px; +display:none; +overflow:hidden; +position:absolute; +z-index:10000; +-webkit-border-radius: 8px; +-moz-border-radius: 8px; +} + +#tidypics_tag_instruct_text { +padding-top: 3px; +float: left; +} + +#tidypics_tag_instruct_button_div { +float: left; +margin-left: 15px; +} + +#tidypics_tag_instruct_button { +margin:0; +} + +#tidypics_tag_menu { +width:240px; +max-height:400px; +overflow:hidden; +-webkit-border-radius: 8px; +-moz-border-radius: 8px; +} + +.tidypics_popup_header { +width:100%; +margin-bottom:10px; +} + + +#tidypics_tagmenu_left { +width:175px; +float:left; +} + +#tidypics_tagmenu_right { +float:left; +} + +#tidypics_tagmenu_left .input-filter { +width:150px; +} + +#tidypics_tagmenu_right .submit_button { +margin-top:2px; +} + +#tidypics_delete_tag_menu { +-webkit-border-radius: 8px; +-moz-border-radius: 8px; +overflow:hidden; +} + +.tidypics_tag { +display:none; +background:url(<?php echo $vars['url']; ?>mod/lightpics/graphics/spacer.gif); +border:2px solid #ffffff; +overflow:hidden; +position:absolute; +z-index:0; +} + +.tidypics_tag_text { +display:none; +overflow:hidden; +position:absolute; +z-index:0; +text-align:center; +background:#BBDAF7; +border:1px solid #3B5999; +-webkit-border-radius:3px; +-moz-border-radius:3px; +padding:1px; +} + +#tidypics_phototags_list { +padding:0 20px 0 20px; +} + +#tidypics_phototags_list ul { +list-style:none; +margin:0px; +padding:8px; +} + +#tidypics_phototags_list ul li { +padding-right:10px; +margin:2px 0px; +display:inline; +} + +#tidypics_image_upload_list { +list-style: none; +} + +#tidypics_album_sort { +padding:0; +margin:0; +} + +#tidypics_album_sort li { +float:left; +margin:3px; +width:161px; +height:161px; +list-style:none; +} + +#tidypics_album_sort img { +border:1px solid #dedede; +padding:4px; +} + diff --git a/mod/lightpics/views/default/photos/group_module.php b/mod/lightpics/views/default/photos/group_module.php new file mode 100644 index 000000000..de7a451c4 --- /dev/null +++ b/mod/lightpics/views/default/photos/group_module.php @@ -0,0 +1,45 @@ +<?php +/** + * Group blog module + */ + +$group = $vars['entity']; + +if ($group->photos_enable == "no") { + return true; +} + +$all_link = elgg_view('output/url', array( + 'href' => "photos/group/$group->guid/all", + 'text' => elgg_echo('link:view:all'), + 'is_trusted' => true, +)); + +elgg_push_context('widgets'); +$options = array( + 'type' => 'object', + 'subtype' => 'album', + '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('tidypics:none') . '</p>'; +} + +$new_link = elgg_view('output/url', array( + 'href' => "photos/add/$group->guid", + 'text' => elgg_echo('photos:add'), + 'is_trusted' => true, +)); + +echo elgg_view('groups/profile/module', array( + 'title' => elgg_echo('photos:group'), + 'content' => $content, + 'all_link' => $all_link, + 'add_link' => $new_link, +)); diff --git a/mod/lightpics/views/default/photos/sidebar.php b/mod/lightpics/views/default/photos/sidebar.php new file mode 100644 index 000000000..fd5202691 --- /dev/null +++ b/mod/lightpics/views/default/photos/sidebar.php @@ -0,0 +1,18 @@ +<?php +/** + * Sidebar view + */ + +$page = elgg_extract('page', $vars); +$image = elgg_extract('image', $vars); +if ($image && $page == 'view') { + if (elgg_get_plugin_setting('exif', 'tidypics')) { + echo elgg_view('photos/sidebar/exif', $vars); + } +} + +if ($page == 'upload') { + if (elgg_get_plugin_setting('quota', 'tidypics')) { + echo elgg_view('photos/sidebar/quota', $vars); + } +}
\ No newline at end of file diff --git a/mod/lightpics/views/default/photos/sidebar/exif.php b/mod/lightpics/views/default/photos/sidebar/exif.php new file mode 100644 index 000000000..1d4444b53 --- /dev/null +++ b/mod/lightpics/views/default/photos/sidebar/exif.php @@ -0,0 +1,20 @@ +<?php +/** + * EXIF sidebar module + */ + +$image = $vars['image']; + +elgg_load_library('tidypics:exif'); + +$exif = tp_exif_formatted($image); +if ($exif) { + $title = "EXIF"; + $body = '<table class="elgg-table elgg-table-alt">'; + foreach ($exif as $key => $value) { + $body .= "<tr><td>$key</td><td>$value</td></tr>"; + } + $body .= '</table>'; + + echo elgg_view_module('aside', $title, $body); +} diff --git a/mod/lightpics/views/default/photos/sidebar/quota.php b/mod/lightpics/views/default/photos/sidebar/quota.php new file mode 100644 index 000000000..16b7885c4 --- /dev/null +++ b/mod/lightpics/views/default/photos/sidebar/quota.php @@ -0,0 +1,27 @@ +<?php +/** + * User quota + */ + +$user = elgg_get_logged_in_user_entity(); + + +$quota = elgg_get_plugin_setting('quota', 'tidypics'); +if ($quota) { + $image_repo_size = (int)$user->image_repo_size; + $image_repo_size = $image_repo_size / 1024 / 1024; + $quote_percentage = round(100 * ($image_repo_size / $quota)); + // for small quotas, so one decimal place + if ($quota < 10) { + $image_repo_size = sprintf('%.1f', $image_repo_size); + } else { + $image_repo_size = round($image_repo_size); + } + if ($image_repo_size > $quota) { + $image_repo_size = $quota; + } + + $title = elgg_echo('tidypics:title:quota'); + $body = elgg_echo("tidypics:quota") . ' ' . $image_repo_size . '/' . $quota . " MB ({$quote_percentage}%)"; + echo elgg_view_module('aside', $title, $body); +} diff --git a/mod/lightpics/views/default/river/object/album/create.php b/mod/lightpics/views/default/river/object/album/create.php new file mode 100644 index 000000000..29620041f --- /dev/null +++ b/mod/lightpics/views/default/river/object/album/create.php @@ -0,0 +1,40 @@ +<?php +/** + * Album river view + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +elgg_load_css('lightbox'); +elgg_load_js('lightbox'); +elgg_load_js('tidypics'); + +$album = $vars['item']->getObjectEntity(); + +$album_river_view = elgg_get_plugin_setting('album_river_view', 'tidypics'); +if ($album_river_view == "cover") { + $image = $album->getCoverImage(); + if ($image) { + $attachments = elgg_view_entity_icon($image, 'tiny'); + } +} else { + $images = $album->getImages(7); + + if (count($images)) { + $attachments = '<ul class="tidypics-river-list elgg-lightbox-gallery">'; + foreach($images as $image) { + $attachments .= '<li class="tidypics-photo-item">'; + $attachments .= elgg_view_entity_icon($image, 'tiny', array( + 'link_class' => 'tidypics-lightbox elgg-lightbox-photo', + )); + $attachments .= '</li>'; + } + $attachments .= '</ul>'; + } +} + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'attachments' => $attachments, +)); diff --git a/mod/lightpics/views/default/river/object/image/create.php b/mod/lightpics/views/default/river/object/image/create.php new file mode 100644 index 000000000..6b68b4d68 --- /dev/null +++ b/mod/lightpics/views/default/river/object/image/create.php @@ -0,0 +1,41 @@ +<?php +/** + * Image album view + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +elgg_load_css('lightbox'); +elgg_load_js('lightbox'); +elgg_load_js('tidypics'); + +$subject = $vars['item']->getSubjectEntity(); +$subject_link = elgg_view('output/url', array( + 'href' => $subject->getURL(), + 'text' => $subject->name, + 'class' => 'elgg-river-subject', + 'is_trusted' => true, +)); + +$image = $vars['item']->getObjectEntity(); +$attachments = elgg_view_entity_icon($image, 'tiny'); + +$image_link = elgg_view('output/url', array( + 'href' => $image->getURL(), + 'text' => $image->getTitle(), + 'is_trusted' => true, + 'class' => 'elgg-lightbox-photo', +)); + +$album_link = elgg_view('output/url', array( + 'href' => $image->getContainerEntity()->getURL(), + 'text' => $image->getContainerEntity()->getTitle(), + 'is_trusted' => true, +)); + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'attachments' => $attachments, + 'summary' => elgg_echo('image:river:created', array($subject_link, $image_link, $album_link)), +)); diff --git a/mod/lightpics/views/default/river/object/tidypics_batch/create.php b/mod/lightpics/views/default/river/object/tidypics_batch/create.php new file mode 100644 index 000000000..b97c853a3 --- /dev/null +++ b/mod/lightpics/views/default/river/object/tidypics_batch/create.php @@ -0,0 +1,66 @@ +<?php +/** + * Batch river view + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +elgg_load_css('lightbox'); +elgg_load_js('lightbox'); +elgg_load_js('tidypics'); + +$batch = $vars['item']->getObjectEntity(); + +// Get images related to this batch +$images = elgg_get_entities_from_relationship(array( + 'relationship' => 'belongs_to_batch', + 'relationship_guid' => $batch->getGUID(), + 'inverse_relationship' => true, + 'type' => 'object', + 'subtype' => 'image', + 'offset' => 0, +)); + +$album = $batch->getContainerEntity(); +if (!$album) { + // something went quite wrong - this batch has no associated album + return true; +} +$album_link = elgg_view('output/url', array( + 'href' => $album->getURL(), + 'text' => $album->getTitle(), + 'is_trusted' => true, +)); + +$subject = $vars['item']->getSubjectEntity(); +$subject_link = elgg_view('output/url', array( + 'href' => $subject->getURL(), + 'text' => $subject->name, + 'class' => 'elgg-river-subject', + 'is_trusted' => true, +)); + +if (count($images)) { + $attachments = '<ul class="tidypics-river-list elgg-lightbox-gallery">'; + foreach($images as $image) { + $attachments .= '<li class="tidypics-photo-item">'; + $attachments .= elgg_view_entity_icon($image, 'tiny', array( + 'link_class' => 'tidypics-lightbox elgg-lightbox-photo', + )); + $attachments .= '</li>'; + } + $attachments .= '</ul>'; +} + +if (count($images) == 1) { + $summary = elgg_echo('image:river:created', array($subject_link, $album_link)); +} else { + $summary = elgg_echo('image:river:created:multiple', array($subject_link, count($images), $album_link)); +} + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'attachments' => $attachments, + 'summary' => $summary +)); diff --git a/mod/lightpics/views/default/widgets/album_view/content.php b/mod/lightpics/views/default/widgets/album_view/content.php new file mode 100644 index 000000000..88c8837b3 --- /dev/null +++ b/mod/lightpics/views/default/widgets/album_view/content.php @@ -0,0 +1,17 @@ +<?php +/** + * List albums in a widget + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$options = array( + 'type' => 'object', + 'subtype' => 'album', + 'container_guid' => elgg_get_page_owner_guid(), + 'limit' => $vars['entity']->num_display, + 'full_view' => false, + 'pagination' => false, +); +echo elgg_list_entities($options); diff --git a/mod/lightpics/views/default/widgets/album_view/edit.php b/mod/lightpics/views/default/widgets/album_view/edit.php new file mode 100644 index 000000000..873fcc3eb --- /dev/null +++ b/mod/lightpics/views/default/widgets/album_view/edit.php @@ -0,0 +1,25 @@ +<?php +/** + * Widget settings for newest albums + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +// set default value +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 5; +} + +$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); + +?> +<div> + <?php echo elgg_echo('tidypics:widget:num_albums'); ?>: + <?php echo $dropdown; ?> +</div> diff --git a/mod/lightpics/views/default/widgets/latest_photos/content.php b/mod/lightpics/views/default/widgets/latest_photos/content.php new file mode 100644 index 000000000..8a3bb4891 --- /dev/null +++ b/mod/lightpics/views/default/widgets/latest_photos/content.php @@ -0,0 +1,18 @@ +<?php +/** + * Display the latest photos uploaded by an individual + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +echo elgg_list_entities(array( + 'type' => 'object', + 'subtype' => 'image', + 'limit' => $vars['entity']->num_display, + 'owner_guid' => elgg_get_page_owner_guid(), + 'full_view' => false, + 'list_type' => 'gallery', + 'list_type_toggle' => false, + 'gallery_class' => 'tidypics-gallery-widget', +)); diff --git a/mod/lightpics/views/default/widgets/latest_photos/edit.php b/mod/lightpics/views/default/widgets/latest_photos/edit.php new file mode 100644 index 000000000..dd32e2b6d --- /dev/null +++ b/mod/lightpics/views/default/widgets/latest_photos/edit.php @@ -0,0 +1,25 @@ +<?php +/** + * Widget settings for latest photos + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +// set default value +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 6; +} + +$params = array( + 'name' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(3, 6, 9, 12), +); +$dropdown = elgg_view('input/dropdown', $params); + +?> +<div> + <?php echo elgg_echo('tidypics:widget:num_latest'); ?>: + <?php echo $dropdown; ?> +</div> diff --git a/mod/lightpics/views/rss/extensions/photos/xmlns.php b/mod/lightpics/views/rss/extensions/photos/xmlns.php new file mode 100644 index 000000000..67cf45133 --- /dev/null +++ b/mod/lightpics/views/rss/extensions/photos/xmlns.php @@ -0,0 +1,9 @@ +<?php +/** + * Support media files by adding a namespace + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +?> xmlns:media="http://search.yahoo.com/mrss/"
\ No newline at end of file diff --git a/mod/lightpics/views/rss/object/album.php b/mod/lightpics/views/rss/object/album.php new file mode 100644 index 000000000..f880b56d6 --- /dev/null +++ b/mod/lightpics/views/rss/object/album.php @@ -0,0 +1,17 @@ +<?php +/** + * Album RSS view + * + * @uses $vars['entity'] TidypicsAlbum + * + * @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/album/full', $vars); +} else { + echo elgg_view('object/album/summary', $vars); +} diff --git a/mod/lightpics/views/rss/object/album/full.php b/mod/lightpics/views/rss/object/album/full.php new file mode 100644 index 000000000..b1f5a567b --- /dev/null +++ b/mod/lightpics/views/rss/object/album/full.php @@ -0,0 +1,19 @@ +<?php +/** + * List photos in an album for RSS + * + * @uses $vars['entity'] TidypicsAlbum + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$limit = (int)get_input('limit', 20); + +echo elgg_list_entities(array( + 'type' => 'object', + 'subtype' => 'image', + 'container_guid' => $vars['entity']->getGUID(), + 'limit' => $limit, + 'full_view' => false, +)); diff --git a/mod/lightpics/views/rss/object/album/summary.php b/mod/lightpics/views/rss/object/album/summary.php new file mode 100644 index 000000000..b6dc8f003 --- /dev/null +++ b/mod/lightpics/views/rss/object/album/summary.php @@ -0,0 +1,33 @@ +<?php +/** + * Individual album summary view for RSS + * + * @uses $vars['entity'] TidypicsAlbum + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8'); +$pubdate = date('r', $vars['entity']->getTimeCreated()); + +$title = $vars['entity']->getTitle(); +$description = autop($vars['entity']->description); + +$creator = elgg_view('page/components/creator', $vars); +$georss = elgg_view('page/components/georss', $vars); +$extension = elgg_view('extensions/item', $vars); + +$item = <<<__HTML +<item> + <guid isPermaLink="true">$permalink</guid> + <pubDate>$pubdate</pubDate> + <link>$permalink</link> + <title><![CDATA[$title]]></title> + <description><![CDATA[$description]]></description> + $creator$georss$extension +</item> + +__HTML; + +echo $item; diff --git a/mod/lightpics/views/rss/object/image.php b/mod/lightpics/views/rss/object/image.php new file mode 100644 index 000000000..e3b67ee74 --- /dev/null +++ b/mod/lightpics/views/rss/object/image.php @@ -0,0 +1,42 @@ +<?php +/** + * Individual image RSS view + * + * @uses $vars['entity'] TidypicsImage + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8'); +$pubdate = date('r', $vars['entity']->getTimeCreated()); + +$title = $vars['entity']->getTitle(); +$description = autop($vars['entity']->description); + +$creator = elgg_view('page/components/creator', $vars); +$georss = elgg_view('page/components/georss', $vars); +$extension = elgg_view('extensions/item', $vars); + +$thumbnail_url = $vars['entity']->getIconURL('tiny'); +$download_url = $vars['entity']->getIconURL('large'); + +$mime_type = $vars['entity']->getMimeType(); + +$item = <<<__HTML +<item> + <guid isPermaLink="true">$permalink</guid> + <pubDate>$pubdate</pubDate> + <link>$permalink</link> + <title><![CDATA[$title]]></title> + <description><![CDATA[$description]]></description> + $creator$georss$extension + <media:content url="$download_url" medium="image" type="$mime_type" /> + <media:title><![CDATA[$title]]></media:title> + <media:description><![CDATA[$description]]></media:description> + <media:thumbnail url="$thumbnail_url"></media:thumbnail> +</item> + +__HTML; + +echo $item; |