plugins only:

- fix in category_default.inc.php (action parameters were wrong if show_nb_comments was true)
- refactor actions and events in picture.php in order to give more flexibility to plugins
- added some variables in index.tpl (not used by pwg itself) to allow plugins to add their own content

git-svn-id: http://piwigo.org/svn/trunk@1882 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices 2007-03-09 03:37:56 +00:00
parent f266c3b4cb
commit 81030a7ab4
3 changed files with 21 additions and 19 deletions

View file

@ -155,7 +155,7 @@ SELECT COUNT(*) AS nb_comments
WHERE image_id = '.$row['id'].'
AND validated = \'true\'
;';
$row = mysql_fetch_array(pwg_query($query));
list($row['nb_comments']) = mysql_fetch_array(pwg_query($query));
$template->assign_block_vars(
'thumbnails.line.thumbnail.nb_comments',
array(

View file

@ -70,20 +70,16 @@ function default_picture_content($content, $element_info)
return $content;
}
global $user, $page;
global $user, $page, $template;
$my_template = new Template(
PHPWG_ROOT_PATH.'template/'.$user['template'],
$user['theme']
);
$my_template->set_filenames(
$template->set_filenames(
array('default_content'=>'picture_content.tpl')
);
if ( !isset($page['slideshow']) and isset($element_info['high_url']) )
{
$uuid = uniqid(rand());
$my_template->assign_block_vars(
$template->assign_block_vars(
'high',
array(
'U_HIGH' => $element_info['high_url'],
@ -91,14 +87,14 @@ function default_picture_content($content, $element_info)
)
);
}
$my_template->assign_vars( array(
$template->assign_vars( array(
'SRC_IMG' => $element_info['image_url'],
'ALT_IMG' => $element_info['file'],
'WIDTH_IMG' => @$element_info['scaled_width'],
'HEIGHT_IMG' => @$element_info['scaled_height'],
)
);
return $my_template->parse( 'default_content', true);
return $template->parse( 'default_content', true);
}
// +-----------------------------------------------------------------------+
@ -482,13 +478,9 @@ if ($metadata_showable)
$page['body_id'] = 'thePicturePage';
// maybe someone wants a special display (call it before page_header so that
// they can add stylesheets)
$element_content = trigger_event(
'render_element_content',
'',
$picture['current']
);
// allow plugins to change what we computed before passing data to template
$picture = trigger_event('picture_pictures_data', $picture);
if (isset($picture['next']['image_url'])
and isset($picture['next']['is_picture']))
@ -530,7 +522,6 @@ $template->assign_vars(
'PICTURE_TITLE' => $picture['current']['name'],
'PHOTO' => $title_nb,
'TITLE' => $picture['current']['name'],
'ELEMENT_CONTENT' => $element_content,
'LEVEL_SEPARATOR' => $conf['level_separator'],
@ -801,6 +792,15 @@ if (isset($_GET['slideshow']))
);
}
// maybe someone wants a special display (call it before page_header so that
// they can add stylesheets)
$element_content = trigger_event(
'render_element_content',
'',
$picture['current']
);
$template->assign_var( 'ELEMENT_CONTENT', $element_content );
// +-----------------------------------------------------------------------+
// | sub pages |
// +-----------------------------------------------------------------------+

View file

@ -41,6 +41,7 @@
<!-- BEGIN mode_created -->
<li><a href="{mode_created.URL}" title="{lang:mode_created_hint}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/calendar_created.png" class="button" alt="{lang:mode_created_hint}"></a></li>
<!-- END mode_created -->
{PLUGIN_INDEX_ACTIONS}
</ul>
<h2>{TITLE}</h2>
@ -62,6 +63,7 @@
</div> <!-- titrePage -->
{PLUGIN_INDEX_CONTENT_BEGIN}
<!-- BEGIN calendar -->
<!-- BEGIN navbar -->
<div class="calendarBar">
@ -104,5 +106,5 @@
</ul>
<!-- END related_tags -->
{PLUGIN_INDEX_CONTENT_END}
</div> <!-- content -->