usergallery show/hide non-image objects
This commit is contained in:
parent
aa76581d22
commit
85eb2c4b98
|
@ -1,3 +1,8 @@
|
|||
2.61:
|
||||
-----
|
||||
* Added option to exclude Non-Image object files. (Defaults to images only)
|
||||
The file plugin_usergallery.tpl has changed. Please update your template copy file, if have.
|
||||
|
||||
2.60:
|
||||
-----
|
||||
* Added option for using lightboxes
|
||||
|
|
|
@ -95,3 +95,6 @@
|
|||
@define('PLUGIN_EVENT_USERGALLERY_SHOWLIGHTBOX_DESC', 'Benötigt ein installiertes Lightbox-Plugin und obige Option: "Einzelbildanzeige" gesetzt als "In Seite einpassen"!');
|
||||
@define('PLUGIN_EVENT_USERGALLERY_LIGHTBOXTYPE_NAME', 'Lightbox-Typ, wie im Lightbox-Plugin gewählt');
|
||||
|
||||
@define('PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_NAME', 'Zeige alle Nicht-Bild Dateien');
|
||||
@define('PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_DESC', 'Erweitere das Galerie Array mit allen Nicht-Bild Dateien aus der Mediendatendank, zB. *.pdf Dateien.');
|
||||
|
||||
|
|
|
@ -94,3 +94,6 @@
|
|||
@define('PLUGIN_EVENT_USERGALLERY_SHOWLIGHTBOX_DESC', 'Benötigt ein installiertes Lightbox-Plugin und obige Option: "Einzelbildanzeige" gesetzt als "In Seite einpassen"!');
|
||||
@define('PLUGIN_EVENT_USERGALLERY_LIGHTBOXTYPE_NAME', 'Lightbox-Typ, wie im Lightbox-Plugin gewählt');
|
||||
|
||||
@define('PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_NAME', 'Zeige alle Nicht-Bild Dateien');
|
||||
@define('PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_DESC', 'Erweitere das Galerie Array mit allen Nicht-Bild Dateien aus der Mediendatendank, zB. *.pdf Dateien.');
|
||||
|
||||
|
|
|
@ -101,3 +101,6 @@
|
|||
@define('PLUGIN_EVENT_USERGALLERY_SHOWLIGHTBOX_DESC', 'Needs the lightbox-plugin installed and upper option "Display Single Image" set to "Scaled to fit"!');
|
||||
@define('PLUGIN_EVENT_USERGALLERY_LIGHTBOXTYPE_NAME', 'Lightbox-type as selected in lightbox-plugin');
|
||||
|
||||
@define('PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_NAME', 'Show all Non-Image objects');
|
||||
@define('PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_DESC', 'Include other media library object files to show up too, eg *.pdf application objects.');
|
||||
|
||||
|
|
|
@ -28,97 +28,131 @@ function popImage(file_name,file_title,file_width,file_height) {ldelim}
|
|||
<h3 class="serendipity_date">{$plugin_usergallery_title}</h3>
|
||||
|
||||
<div class="serendipity_entry_body">
|
||||
<div class="serendipity_gallery_navigation">
|
||||
<div class="serendipity_gallery_navigation">
|
||||
<a href="{$plugin_usergallery_httppath}">{$plugin_usergallery_title}</a>{foreach name="gallery" from=$plugin_usergallery_gallery_breadcrumb item="gallery"} » <a href="{$plugin_usergallery_httppath_extend}gallery={$gallery.path}">{$gallery.name}</a>{/foreach}{if $plugin_usergallery_limit_directory!=""} » <a href="{$plugin_usergallery_httppath_extend}gallery={$plugin_usergallery_currentgal}">{$plugin_usergallery_limit_directory}</a>{/if}
|
||||
|
||||
</div>
|
||||
{if $plugin_usergallery_preface}
|
||||
<div class="serendipity_preface">{$plugin_usergallery_preface}</div>
|
||||
{/if}
|
||||
<!-- album list -->
|
||||
|
||||
<!-- album list -->
|
||||
{if $plugin_usergallery_dir_list eq 'yes'}
|
||||
|
||||
<ul class="plainList serendipity_gallery_directory">
|
||||
{if $plugin_usergallery_display_dir_tree eq "yes"}
|
||||
|
||||
<!-- basefolder in treeview -->
|
||||
<!-- considering singular/plural form of "image" depending on the filecount -->
|
||||
<li><a href="{$plugin_usergallery_httppath}">{$plugin_usergallery_title} ({$plugin_usergallery_maindir_filecount} {if $plugin_usergallery_maindir_filecount == 1}{$CONST.IMAGE}{else}{$CONST.PLUGIN_EVENT_USERGALLERY_IMAGES}{/if})</a></li>
|
||||
{else}
|
||||
{if $plugin_usergallery_toplevel eq 'no'}
|
||||
|
||||
<!-- 'up-one-level' link in galleries-->
|
||||
<li><a href="{$plugin_usergallery_httppath_extend}gallery={$plugin_usergallery_uppath}">{$const.uponelevel} ({$plugin_usergallery_maindir_filecount} {if $plugin_usergallery_maindir_filecount == 1}{$CONST.IMAGE}{else}{$CONST.PLUGIN_EVENT_USERGALLERY_IMAGES}{/if})</a></li>
|
||||
{else}
|
||||
|
||||
<!-- basefolder in listview -->
|
||||
<li><a href="{$plugin_usergallery_httppath}">{$plugin_usergallery_title} ({$plugin_usergallery_maindir_filecount} {if $plugin_usergallery_maindir_filecount == 1}{$CONST.IMAGE}{else}{$CONST.PLUGIN_EVENT_USERGALLERY_IMAGES}{/if})</a></li>
|
||||
{/if}
|
||||
{/if}
|
||||
<!-- folders -->
|
||||
|
||||
<!-- folders -->
|
||||
{foreach name="dir_list" from=$plugin_usergallery_subdirectories item="dir"}
|
||||
{if $dir.filecount > 0}
|
||||
|
||||
<li style="padding-left: {$dir.pxdepth}px;"><a href="{$plugin_usergallery_httppath_extend}gallery={$dir.relpath}">{$dir.name} ({$dir.filecount} {if $dir.filecount == 1}{$CONST.IMAGE}{else}{$CONST.PLUGIN_EVENT_USERGALLERY_IMAGES}{/if})</a></li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
{/if}
|
||||
<!-- end album list -->
|
||||
|
||||
<!-- end album list -->
|
||||
{if $plugin_usergallery_pagination}
|
||||
<!-- pagination -->
|
||||
<div class="serendipity_gallery_pagination_top" style="text-align: center">
|
||||
|
||||
<!-- pagination -->
|
||||
<div class="serendipity_gallery_pagination_top" style="text-align: center">
|
||||
{if $plugin_usergallery_current_page != 1}
|
||||
<a class="prev" href="{$plugin_usergallery_httppath_extend}gallery={$plugin_usergallery_currentgal}&page={$plugin_usergallery_previous_page}">« {$CONST.PREVIOUS_PAGE}</a>
|
||||
|
||||
<a class="prev" href="{$plugin_usergallery_httppath_extend}gallery={$plugin_usergallery_currentgal}&page={$plugin_usergallery_previous_page}">« {$CONST.PREVIOUS_PAGE}</a>
|
||||
{/if}
|
||||
<span>({$CONST.PLUGIN_EVENT_USERGALLERY_PAGINATION|@sprintf:$plugin_usergallery_current_page:$plugin_usergallery_total_pages:$plugin_usergallery_total_count})</span>
|
||||
|
||||
<span>({$CONST.PLUGIN_EVENT_USERGALLERY_PAGINATION|@sprintf:$plugin_usergallery_current_page:$plugin_usergallery_total_pages:$plugin_usergallery_total_count})</span>
|
||||
{if $plugin_usergallery_current_page != $plugin_usergallery_total_pages}
|
||||
<a class="next" href="{$plugin_usergallery_httppath_extend}gallery={$plugin_usergallery_currentgal}&page={$plugin_usergallery_next_page}">{$CONST.NEXT_PAGE} »</a>
|
||||
|
||||
<a class="next" href="{$plugin_usergallery_httppath_extend}gallery={$plugin_usergallery_currentgal}&page={$plugin_usergallery_next_page}">{$CONST.NEXT_PAGE} »</a>
|
||||
{/if}
|
||||
</div>
|
||||
<!-- end pagination -->
|
||||
|
||||
</div>
|
||||
<!-- end pagination -->
|
||||
{/if}
|
||||
<!-- images -->
|
||||
|
||||
<!-- images -->
|
||||
{foreach name="column" from=$plugin_usergallery_images item="image"}
|
||||
{if $smarty.foreach.column.first}
|
||||
|
||||
<div class="serendipity_gallery_row">
|
||||
{/if}
|
||||
<div class="serendipity_gallery_thumbs" style="width: {$plugin_usergallery_colwidth}%;">
|
||||
|
||||
<div class="serendipity_gallery_thumbs" style="width: {$plugin_usergallery_colwidth}%;">
|
||||
{if $image.isimage}
|
||||
{if $plugin_usergallery_image_display eq 'popup'}
|
||||
<!-- popup -->
|
||||
<a href="javascript:popImage('{$image.fullimage}','{$image.name}','{$image.dimensions_width}','{$image.dimensions_height}')"><img class="gallery_thumb" {if $plugin_usergallery_fixed_width !=0}height={$plugin_usergallery_fixed_width}px width={$plugin_usergallery_fixed_width}px{/if} src="{$image.link}" alt="" /></a>
|
||||
|
||||
<!-- popup -->
|
||||
<a href="javascript:popImage('{$image.fullimage}','{$image.name}','{$image.dimensions_width}','{$image.dimensions_height}')"><img class="gallery_thumb" {if $plugin_usergallery_fixed_width !=0}height={$plugin_usergallery_fixed_width}px width={$plugin_usergallery_fixed_width}px{/if} src="{$image.link}" alt="" /></a>
|
||||
{else}
|
||||
<!-- show thumb -->
|
||||
|
||||
<!-- show thumb -->
|
||||
{if $plugin_usergallery_uselightbox}
|
||||
<a href="{$image.fullimage}" {$plugin_usergallery_lightbox_type}><img class="gallery_thumb" {if $plugin_usergallery_fixed_width !=0}height={$plugin_usergallery_fixed_width}px width={$plugin_usergallery_fixed_width}px{/if} style="width: 100%;" src="{$image.link}" alt="" /></a>
|
||||
|
||||
<a href="{$image.fullimage}" {$plugin_usergallery_lightbox_type}><img class="gallery_thumb" {if $plugin_usergallery_fixed_width !=0}height={$plugin_usergallery_fixed_width}px width={$plugin_usergallery_fixed_width}px{/if} style="width: 100%;" src="{$image.link}" alt="" /></a>
|
||||
{else}
|
||||
<a href="{$plugin_usergallery_httppath_extend}serendipity[image]={$image.id}"><img class="gallery_thumb" {if $plugin_usergallery_fixed_width !=0}height={$plugin_usergallery_fixed_width}px width={$plugin_usergallery_fixed_width}px{/if} style="width: 100%;" src="{$image.link}" alt="" /></a>
|
||||
|
||||
<a href="{$plugin_usergallery_httppath_extend}serendipity[image]={$image.id}"><img class="gallery_thumb" {if $plugin_usergallery_fixed_width !=0}height={$plugin_usergallery_fixed_width}px width={$plugin_usergallery_fixed_width}px{/if} style="width: 100%;" src="{$image.link}" alt="" /></a>
|
||||
{/if}
|
||||
{/if}
|
||||
{else}
|
||||
<!-- download link -->
|
||||
<a href="{$image.fullimage}" target=blank><img class="gallery_thumb" src="{$image.link}" alt="" /></a><br><a href="{$image.fullimage}" target=blank>Download {$image.name}.{$image.extension}</a>
|
||||
|
||||
<!-- download link -->
|
||||
<a href="{$image.fullimage}" target=blank><img class="gallery_thumb" src="{$image.link}" alt="" /></a><br><a href="{$image.fullimage}" target=blank>Download {$image.name}.{$image.extension}</a>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{if $smarty.foreach.column.last}
|
||||
<!-- last column -->
|
||||
<div style="clear: both;"></div>
|
||||
|
||||
<!-- last column -->
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
{else}
|
||||
{if $smarty.foreach.column.iteration is div by $plugin_usergallery_cols}
|
||||
<!-- new column -->
|
||||
<div style="clear: both;"></div>
|
||||
{if $smarty.foreach.column.iteration is div by $plugin_usergallery_cols}
|
||||
|
||||
<!-- new column -->
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<div class="serendipity_gallery_row">
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
<!-- end images -->
|
||||
|
||||
<!-- end images -->
|
||||
{if $plugin_usergallery_pagination}
|
||||
<!-- pagination -->
|
||||
<div class="serendipity_gallery_pagination_bottom" style="text-align: center">
|
||||
|
||||
<!-- pagination -->
|
||||
<div class="serendipity_gallery_pagination_bottom" style="text-align: center">
|
||||
{if $plugin_usergallery_current_page != 1}
|
||||
<a class="prev" href="{$plugin_usergallery_httppath_extend}gallery={$plugin_usergallery_currentgal}&page={$plugin_usergallery_previous_page}">« {$CONST.PREVIOUS_PAGE}</a>
|
||||
|
||||
<a class="prev" href="{$plugin_usergallery_httppath_extend}gallery={$plugin_usergallery_currentgal}&page={$plugin_usergallery_previous_page}">« {$CONST.PREVIOUS_PAGE}</a>
|
||||
{/if}
|
||||
<span>({$CONST.PLUGIN_EVENT_USERGALLERY_PAGINATION|@sprintf:$plugin_usergallery_current_page:$plugin_usergallery_total_pages:$plugin_usergallery_total_count})</span>
|
||||
|
||||
<span>({$CONST.PLUGIN_EVENT_USERGALLERY_PAGINATION|@sprintf:$plugin_usergallery_current_page:$plugin_usergallery_total_pages:$plugin_usergallery_total_count})</span>
|
||||
{if $plugin_usergallery_current_page != $plugin_usergallery_total_pages}
|
||||
<a class="next" href="{$plugin_usergallery_httppath_extend}gallery={$plugin_usergallery_currentgal}&page={$plugin_usergallery_next_page}">{$CONST.NEXT_PAGE} »</a>
|
||||
|
||||
<a class="next" href="{$plugin_usergallery_httppath_extend}gallery={$plugin_usergallery_currentgal}&page={$plugin_usergallery_next_page}">{$CONST.NEXT_PAGE} »</a>
|
||||
{/if}
|
||||
</div>
|
||||
<!-- end pagination -->
|
||||
|
||||
</div>
|
||||
<!-- end pagination -->
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
|
|
|
@ -24,7 +24,7 @@ class serendipity_event_usergallery extends serendipity_event
|
|||
$propbag->add('description', PLUGIN_EVENT_USERGALLERY_DESC);
|
||||
$propbag->add('stackable', true);
|
||||
$propbag->add('author', 'Arnan de Gans, Matthew Groeninger, Stefan Willoughby, Ian');
|
||||
$propbag->add('version', '2.60');
|
||||
$propbag->add('version', '2.61');
|
||||
$propbag->add('requirements', array(
|
||||
'serendipity' => '0.8',
|
||||
'smarty' => '2.6.7',
|
||||
|
@ -40,7 +40,7 @@ class serendipity_event_usergallery extends serendipity_event
|
|||
));
|
||||
$propbag->add('groups', array('IMAGES'));
|
||||
$propbag->add('configuration', array('title', 'num_cols', 'subpage', 'frontpage', 'permalink', 'style', 'base_directory', 'dir_list', 'show_1lvl_sub',
|
||||
'display_dir_tree', 'dir_tab', 'images_per_page', 'image_order','intro', 'image_display', 'show_lightbox', 'lightbox_type', 'image_strict', 'fixed_width', 'image_width',
|
||||
'display_dir_tree', 'dir_tab', 'images_per_page', 'image_order','intro', 'image_display', 'show_lightbox', 'lightbox_type', 'show_objects', 'image_strict', 'fixed_width', 'image_width',
|
||||
'feed_width', 'feed_linked_only', 'feed_body', 'exif_show_data', 'exif_data', 'show_media_properties', 'media_properties', 'linked_entries'));
|
||||
}
|
||||
|
||||
|
@ -198,6 +198,16 @@ class serendipity_event_usergallery extends serendipity_event
|
|||
$propbag->add('default', 'lightbox');
|
||||
break;
|
||||
|
||||
case 'show_objects':
|
||||
$propbag->add('type', 'radio');
|
||||
$propbag->add('name', PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_NAME);
|
||||
$propbag->add('description', PLUGIN_EVENT_USERGALLERY_SHOWOBJECTS_DESC);
|
||||
$propbag->add('radio', array('value' => array('true','false'),
|
||||
'desc' => array(YES,NO)));
|
||||
$propbag->add('radio_per_row', '2');
|
||||
$propbag->add('default', 'false');
|
||||
break;
|
||||
|
||||
case 'image_strict':
|
||||
if ($this->get_config('style') == 'thumbpage') {
|
||||
$propbag->add('type', 'radio');
|
||||
|
@ -600,11 +610,13 @@ class serendipity_event_usergallery extends serendipity_event
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($serendipity['GET']['image'])) {
|
||||
$this->displayImage($serendipity['GET']['image'], $orderby, $order);
|
||||
} else {
|
||||
$num_cols = $this->get_config('num_cols');
|
||||
$base_directory = $this->get_config('base_directory');
|
||||
$show_objects = serendipity_db_bool($this->get_config('show_objects', false));
|
||||
|
||||
if ($this->get_config('style') == "thumbpage") {
|
||||
$images_per_page = $this->get_config('images_per_page');
|
||||
|
@ -624,14 +636,12 @@ class serendipity_event_usergallery extends serendipity_event
|
|||
$serendipity['smarty']->assign('plugin_usergallery_currentgal','');
|
||||
$serendipity['smarty']->assign('plugin_usergallery_uppath','');
|
||||
$serendipity['smarty']->assign('plugin_usergallery_toplevel','yes');
|
||||
|
||||
//Let's get a directory listing that has all our ACLs applied already!
|
||||
if (version_compare($serendipity['version'],"1.1.beta3") >= 0) {
|
||||
$directories_temp = serendipity_traversePath($serendipity['serendipityPath'].$serendipity['uploadPath'],$limit_directory,true,NULL,1, NULL,"read",NULL);
|
||||
$directories_temp = serendipity_traversePath($serendipity['serendipityPath'].$serendipity['uploadPath'], $limit_directory, NULL, $pattern,1, NULL, "read", NULL);
|
||||
} else {
|
||||
$directories_temp = serendipity_traversePath($serendipity['serendipityPath'].$serendipity['uploadPath'],$limit_directory);
|
||||
$directories_temp = serendipity_traversePath($serendipity['serendipityPath'].$serendipity['uploadPath'], $limit_directory);
|
||||
}
|
||||
|
||||
//Check to see if we are calling a gallery directly
|
||||
if (isset($_GET['gallery']) && $_GET['gallery'] != '') {
|
||||
//replace weird characters. Was more important before we used the database.
|
||||
|
@ -673,7 +683,8 @@ class serendipity_event_usergallery extends serendipity_event
|
|||
}
|
||||
}
|
||||
|
||||
$query = "SELECT path, count(id) FROM {$serendipity['dbPrefix']}images GROUP BY path";
|
||||
$where = $show_objects ? '' : ' WHERE mime LIKE "image/%" ';
|
||||
$query = "SELECT path, count(id) FROM {$serendipity['dbPrefix']}images ". $where ." GROUP BY path";
|
||||
$rs = serendipity_db_query($query, false, 'assoc');
|
||||
if (is_array($rs)) {
|
||||
foreach($rs AS $f => $record) {
|
||||
|
@ -705,7 +716,7 @@ class serendipity_event_usergallery extends serendipity_event
|
|||
}
|
||||
}
|
||||
|
||||
if (is_array($directories_temp)) {
|
||||
if (is_array($directories_temp)) {
|
||||
if (version_compare($serendipity['version'],"1.1.beta3") >= 0) {
|
||||
usort($directories_temp, 'serendipity_sortPath');
|
||||
}
|
||||
|
@ -719,7 +730,7 @@ class serendipity_event_usergallery extends serendipity_event
|
|||
} else {
|
||||
if ($show_1lvl_sub == 'yes') {
|
||||
$temp_count = strlen($limit_images_directory);
|
||||
if (strcmp(substr($directory,0,$temp_count),$limit_images_directory) == 0 && $directory!=$limit_images_directory) {
|
||||
if (strcmp(substr($directory,0,$temp_count),$limit_images_directory) == 0 && $directory != $limit_images_directory) {
|
||||
$full_length = strlen($directory);
|
||||
if (substr_count(substr($directory,$temp_count,$full_length),'/') == 1) {
|
||||
$directories[$dir['relpath']] = $dir;
|
||||
|
@ -730,7 +741,7 @@ class serendipity_event_usergallery extends serendipity_event
|
|||
}
|
||||
} else {
|
||||
$temp_count = strlen($limit_images_directory);
|
||||
if (strcmp(substr($directory,0,$temp_count),$limit_images_directory) == 0 && $directory !=$limit_images_directory) {
|
||||
if (strcmp(substr($directory,0,$temp_count),$limit_images_directory) == 0 && $directory != $limit_images_directory) {
|
||||
$directories[$directory] = $dir;
|
||||
}
|
||||
}
|
||||
|
@ -738,7 +749,6 @@ class serendipity_event_usergallery extends serendipity_event
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$serendipity['smarty']->assign('plugin_usergallery_subdirectories', $directories);
|
||||
|
||||
$lower_limit = 0;
|
||||
|
@ -806,6 +816,7 @@ class serendipity_event_usergallery extends serendipity_event
|
|||
|
||||
$image['popupwidth'] = ($is_image ? ($image['dimensions_width'] + 20) : 600);
|
||||
$image['popupheight'] = ($is_image ? ($image['dimensions_height'] + 20) : 500);
|
||||
if (!$is_image && !$show_objects) continue; // do not include Non-Image objects to array
|
||||
$process_images[$image['name']] = $image;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue