Changeset 1882

Show
Ignore:
Timestamp:
03/09/07 04:37:56 (6 years ago)
Author:
rvelices
Message:

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

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/include/category_default.inc.php

    r1868 r1882  
    156156    AND validated = \'true\' 
    157157;'; 
    158     $row = mysql_fetch_array(pwg_query($query)); 
     158    list($row['nb_comments']) = mysql_fetch_array(pwg_query($query)); 
    159159    $template->assign_block_vars( 
    160160      'thumbnails.line.thumbnail.nb_comments', 
  • trunk/picture.php

    r1861 r1882  
    7171  } 
    7272 
    73   global $user, $page; 
    74  
    75   $my_template = new Template( 
    76     PHPWG_ROOT_PATH.'template/'.$user['template'], 
    77     $user['theme'] 
    78     ); 
    79   $my_template->set_filenames( 
     73  global $user, $page, $template; 
     74 
     75  $template->set_filenames( 
    8076    array('default_content'=>'picture_content.tpl') 
    8177    ); 
     
    8480  { 
    8581    $uuid = uniqid(rand()); 
    86     $my_template->assign_block_vars( 
     82    $template->assign_block_vars( 
    8783      'high', 
    8884      array( 
     
    9288      ); 
    9389  } 
    94   $my_template->assign_vars( array( 
     90  $template->assign_vars( array( 
    9591      'SRC_IMG' => $element_info['image_url'], 
    9692      'ALT_IMG' => $element_info['file'], 
     
    9995      ) 
    10096    ); 
    101   return $my_template->parse( 'default_content', true); 
     97  return $template->parse( 'default_content', true); 
    10298} 
    10399 
     
    483479$page['body_id'] = 'thePicturePage'; 
    484480 
    485 // maybe someone wants a special display (call it before page_header so that 
    486 // they can add stylesheets) 
    487 $element_content = trigger_event( 
    488   'render_element_content', 
    489   '', 
    490   $picture['current'] 
    491   ); 
     481// allow plugins to change what we computed before passing data to template 
     482$picture = trigger_event('picture_pictures_data', $picture); 
     483 
    492484 
    493485if (isset($picture['next']['image_url']) 
     
    531523    'PHOTO' => $title_nb, 
    532524    'TITLE' => $picture['current']['name'], 
    533     'ELEMENT_CONTENT' => $element_content, 
    534525 
    535526    'LEVEL_SEPARATOR' => $conf['level_separator'], 
     
    802793} 
    803794 
     795// maybe someone wants a special display (call it before page_header so that 
     796// they can add stylesheets) 
     797$element_content = trigger_event( 
     798  'render_element_content', 
     799  '', 
     800  $picture['current'] 
     801  ); 
     802$template->assign_var( 'ELEMENT_CONTENT', $element_content ); 
     803 
    804804// +-----------------------------------------------------------------------+ 
    805805// |                               sub pages                               | 
  • trunk/template/yoga/index.tpl

    r1864 r1882  
    4242      <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> 
    4343      <!-- END mode_created --> 
     44      {PLUGIN_INDEX_ACTIONS} 
    4445    </ul> 
    4546 
     
    6364  </div> <!-- titrePage --> 
    6465 
     66{PLUGIN_INDEX_CONTENT_BEGIN} 
    6567<!-- BEGIN calendar --> 
    6668<!-- BEGIN navbar --> 
     
    105107<!-- END related_tags --> 
    106108 
    107  
     109{PLUGIN_INDEX_CONTENT_END} 
    108110</div> <!-- content -->