diff options
author | rvelices <rv-github@modusoptimus.com> | 2008-03-01 14:24:04 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2008-03-01 14:24:04 +0000 |
commit | 732e456b3ba0c3e9ff4134e0ea815df03375918b (patch) | |
tree | 1bec560e6642d417c37a161b0de39d778686f8e3 | |
parent | e6b785cbaa554d815a385e380ff959c7dea595ba (diff) |
- thumbnails.tpl migration
git-svn-id: http://piwigo.org/svn/trunk@2234 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | include/category_cats.inc.php | 37 | ||||
-rw-r--r-- | include/category_default.inc.php | 52 | ||||
-rw-r--r-- | template/yoga/theme/wipi/theme.css | 2 | ||||
-rw-r--r-- | template/yoga/thumbnails.tpl | 78 |
4 files changed, 62 insertions, 107 deletions
diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php index e969b475b..7f3c2ace6 100644 --- a/include/category_cats.inc.php +++ b/include/category_cats.inc.php @@ -288,7 +288,7 @@ if (count($categories) > 0) } } }//fromto - + $template->append( 'category_thumbnails', $tpl_var); @@ -302,10 +302,6 @@ if (count($categories) > 0) else { $template->set_filename( 'thumbnails', 'thumbnails.tpl'); - // first line - $template->assign_block_vars('thumbnails.line', array()); - // current row displayed - $row_number = 0; if ($page['section']=='recent_cats') { @@ -315,8 +311,7 @@ if (count($categories) > 0) foreach ($categories as $category) { - $template->assign_block_vars( - 'thumbnails.line.thumbnail', + $tpl_var = array( 'IMAGE' => $thumbnail_src_of[ $category['representative_picture_id'] ], 'IMAGE_ALT' => $category['name'], @@ -335,8 +330,7 @@ if (count($categories) > 0) ) ), 'CLASS' => 'thumbCat', - ) - ); + ); if ($page['section']=='recent_cats') { $name = get_cat_display_name_cache($category['uppercats'], null, false); @@ -344,30 +338,16 @@ if (count($categories) > 0) else { $name = $category['name']; - $template->merge_block_vars( - 'thumbnails.line.thumbnail', - array( - 'IMAGE_TS' => get_icon($category['max_date_last'], $category['is_child_date_last']), - ) - ); + $tpl_var['IMAGE_TS'] = get_icon($category['max_date_last'], $category['is_child_date_last']); } - $template->assign_block_vars( - 'thumbnails.line.thumbnail.category_name', - array( - 'NAME' => $name - ) - ); + $tpl_var['CATEGORY_NAME']=$name; + + $template->append('thumbnails', $tpl_var); //plugins need to add/modify sth in this loop ? trigger_action('loc_index_category_thumbnail', - $category, 'thumbnails.line.thumbnail' ); + $category, 'thumbnails' ); - // create a new line ? - if (++$row_number == $user['nb_image_line']) - { - $template->assign_block_vars('thumbnails.line', array()); - $row_number = 0; - } } if ( isset($old_level_separator) ) @@ -376,7 +356,6 @@ if (count($categories) > 0) } $template->assign_var_from_handle('CATEGORIES', 'thumbnails'); - $template->delete_block_vars('thumbnails', true); // category_default reuse them } trigger_action('loc_end_index_category_thumbnails', $categories); } diff --git a/include/category_default.inc.php b/include/category_default.inc.php index 402df757b..365eedff6 100644 --- a/include/category_default.inc.php +++ b/include/category_default.inc.php @@ -62,11 +62,6 @@ SELECT * $template->set_filenames( array( 'thumbnails' => 'thumbnails.tpl',)); if (count($pictures) > 0) { - // first line - $template->assign_block_vars('thumbnails.line', array()); - // current row displayed - $row_number = 0; - // define category slideshow url $row = reset($pictures); $page['cat_slideshow_url'] = @@ -82,6 +77,8 @@ if (count($pictures) > 0) (isset($_GET['slideshow']) ? $_GET['slideshow'] : '' )) ); + + $template->clear_assign('thumbnails'); // category_default reuse them } trigger_action('loc_begin_index_thumbnails', $pictures); @@ -99,8 +96,7 @@ foreach ($pictures as $row) array('start') ); - $template->assign_block_vars( - 'thumbnails.line.thumbnail', + $tpl_var = array( 'IMAGE' => $thumbnail_url, 'IMAGE_ALT' => $row['file'], @@ -110,18 +106,15 @@ foreach ($pictures as $row) 'U_IMG_LINK' => $url, 'CLASS' => 'thumbElmt', - ) ); + if ($user['show_nb_hits']) { - $template->assign_block_vars( - 'thumbnails.line.thumbnail.nb_hits', + $tpl_var['nb_hits'] = array( - 'HITS'=> l10n_dec('%d hit', '%d hits', $row['hit']), - 'CLASS'=> set_span_class($row['hit']) . ' nb-hits', - ) - ); - + 'HITS'=> $row['hit'], + 'CLASS'=> set_span_class($row['hit']), + ); } if ($conf['show_thumbnail_caption']) @@ -152,12 +145,7 @@ foreach ($pictures as $row) } } - $template->assign_block_vars( - 'thumbnails.line.thumbnail.element_name', - array( - 'NAME' => $name - ) - ); + $tpl_var['ELEMENT_NAME'] = $name; } if ($user['show_nb_comments']) @@ -169,25 +157,17 @@ SELECT COUNT(*) AS nb_comments AND validated = \'true\' ;'; list($row['nb_comments']) = mysql_fetch_array(pwg_query($query)); - $template->assign_block_vars( - 'thumbnails.line.thumbnail.nb_comments', + $tpl_var['nb_comments'] = array( - 'NB_COMMENTS'=> l10n_dec('%d comment', '%d comments', - $row['nb_comments']), - 'CLASS'=> set_span_class($row['nb_comments']) . ' nb-comments', - ) - ); + 'NB_COMMENTS'=> $row['nb_comments'], + 'CLASS'=> set_span_class($row['nb_comments']), + ); } - //plugins need to add/modify sth in this loop ? - trigger_action('loc_index_thumbnail', $row, 'thumbnails.line.thumbnail' ); + $template->append('thumbnails', $tpl_var); - // create a new line ? - if (++$row_number == $user['nb_image_line']) - { - $template->assign_block_vars('thumbnails.line', array()); - $row_number = 0; - } + //plugins need to add/modify sth in this loop ? + trigger_action('loc_index_thumbnail', $row, 'thumbnails' ); } trigger_action('loc_end_index_thumbnails', $pictures); diff --git a/template/yoga/theme/wipi/theme.css b/template/yoga/theme/wipi/theme.css index 0cd85f53e..000ac4ca2 100644 --- a/template/yoga/theme/wipi/theme.css +++ b/template/yoga/theme/wipi/theme.css @@ -254,8 +254,6 @@ input#qsearchInput { padding: 1px 3px; } .zero { display: none } -.one { background: transparent; } -.plural { background: transparent; } .nb-hits { color: #69c; } .nb-comments { color: #f92; } diff --git a/template/yoga/thumbnails.tpl b/template/yoga/thumbnails.tpl index 84c814a76..106a20847 100644 --- a/template/yoga/thumbnails.tpl +++ b/template/yoga/thumbnails.tpl @@ -1,43 +1,41 @@ -<!-- DEV TAG: not smarty migrated --> -<!-- $Id$ --> -<!-- BEGIN thumbnails --> +{* $Id$ *} + +{if !empty($thumbnails)} <ul class="thumbnails"> - <!-- BEGIN line --> - <!-- BEGIN thumbnail --> - <li class="{thumbnails.line.thumbnail.CLASS}"> - <span class="wrap1"> - <span class="wrap2"> - <a href="{thumbnails.line.thumbnail.U_IMG_LINK}"> - <img class="thumbnail" src="{thumbnails.line.thumbnail.IMAGE}" - alt="{thumbnails.line.thumbnail.IMAGE_ALT}" - title="{thumbnails.line.thumbnail.IMAGE_TITLE}"> - </a> - </span> - <span class="thumbLegend"> - <!-- BEGIN element_name --> - {thumbnails.line.thumbnail.element_name.NAME} - <!-- END element_name --> - <!-- BEGIN category_name --> - [{thumbnails.line.thumbnail.category_name.NAME}] - <!-- END category_name --> - {thumbnails.line.thumbnail.IMAGE_TS} - <!-- BEGIN nb_comments --> - <span class="{thumbnails.line.thumbnail.nb_comments.CLASS}"> - <br /> - {thumbnails.line.thumbnail.nb_comments.NB_COMMENTS} - </span> - <!-- END nb_comments --> - <!-- BEGIN nb_hits --> - <span class="{thumbnails.line.thumbnail.nb_hits.CLASS}"> - <br /> - {thumbnails.line.thumbnail.nb_hits.HITS} - </span> - <!-- END nb_hits --> - </span> - </span> - </li> - <!-- END thumbnail --> - <!-- END line --> +{foreach from=$thumbnails item=thumbnail} + <li class="{$thumbnail.CLASS}"> + <span class="wrap1"> + <span class="wrap2"> + <a href="{$thumbnail.U_IMG_LINK}"> + <img class="thumbnail" src="{$thumbnail.IMAGE}" + alt="{$thumbnail.IMAGE_ALT}" + title="{$thumbnail.IMAGE_TITLE}"> + </a> + </span> + <span class="thumbLegend"> + {if !empty($thumbnail.ELEMENT_NAME)}{$thumbnail.ELEMENT_NAME}{/if} + {if !empty($thumbnail.CATEGORY_NAME)}{$thumbnail.CATEGORY_NAME}{/if} + {if !empty($thumbnail.IMAGE_TS)}{$thumbnail.IMAGE_TS}{/if} + + {if !empty($thumbnail.nb_comments)} + <span class="{$thumbnail.nb_comments.CLASS} nb-comments"> + <br /> + {$pwg->l10n_dec('%d comment', '%d comments',$thumbnail.nb_comments.NB_COMMENTS)} + </span> + {/if} + + {if !empty($thumbnail.nb_hits)} + <span class="{$thumbnail.nb_hits.CLASS} nb-hits"> + <br /> + {$pwg->l10n_dec('%d hit', '%d hits',$thumbnail.nb_hits.HITS)} + </span> + {/if} + </span> + </span> + </li> +{/foreach} </ul> -<!-- END thumbnails --> +{/if} + + |