Changeset 16987


Ignore:
Timestamp:
Jul 24, 2012, 10:34:52 PM (8 years ago)
Author:
rvelices
Message:

refactor code when selected derivative on index page is changed by a plugin ...

Location:
trunk
Files:
2 edited

Legend:

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

    r13234 r16987  
    152152}
    153153
    154 $derivative_params = trigger_event('get_index_derivative_params', ImageStdParams::get_by_type( pwg_get_session_var('index_deriv', IMG_THUMB) ) );
    155 
    156154$template->assign( array(
    157   'derivative_params' =>$derivative_params,
     155  'derivative_params' => trigger_event('get_index_derivative_params', ImageStdParams::get_by_type( pwg_get_session_var('index_deriv', IMG_THUMB) ) ),
    158156  'SHOW_THUMBNAIL_CAPTION' =>$conf['show_thumbnail_caption'],
    159157    ) );
     
    163161$template->assign_var_from_handle('THUMBNAILS', 'index_thumbnails');
    164162unset($pictures, $selection, $tpl_thumbnails_var);
    165 $template->clear_assign( array('thumbnails', 'derivative_params') );
     163$template->clear_assign( 'thumbnails' );
    166164pwg_debug('end include/category_default.inc.php');
    167165?>
  • trunk/index.php

    r16986 r16987  
    274274}
    275275
    276 if ( count($page['items']) > 0 )
    277 {
     276// category comment
     277if ($page['start']==0 and !isset($page['chronology_field']) and !empty($page['comment']) )
     278{
     279  $template->assign('CONTENT_DESCRIPTION', $page['comment'] );
     280}
     281
     282// include menubar
     283include( PHPWG_ROOT_PATH.'include/menubar.inc.php');
     284
     285if ( isset($page['category']['count_categories']) and $page['category']['count_categories']==0 )
     286{// count_categories might be computed by menubar - if the case unassign flat link if no sub albums
     287        $template->clear_assign('U_MODE_FLAT');
     288}
     289
     290//------------------------------------------------------ main part : thumbnails
     291if ( 0==$page['start']
     292    and !isset($page['flat'])
     293    and !isset($page['chronology_field'])
     294    and ('recent_cats'==$page['section'] or 'categories'==$page['section'])
     295    and (!isset($page['category']['count_categories']) or $page['category']['count_categories']>0 )
     296  )
     297{
     298  include(PHPWG_ROOT_PATH.'include/category_cats.inc.php');
     299}
     300if ( !empty($page['items']) )
     301{
     302  include(PHPWG_ROOT_PATH.'include/category_default.inc.php');
    278303  $url = add_url_params(
    279304          duplicate_index_url(),
    280305          array('display' => '')
    281306        );
    282   $selected_type = trigger_event('get_index_derivative_params', ImageStdParams::get_by_type( pwg_get_session_var('index_deriv', IMG_THUMB) ) )->type;
     307  $selected_type = $template->get_template_vars('derivative_params')->type;
     308  $template->clear_assign( 'derivative_params' );
    283309  $type_map = ImageStdParams::get_defined_type_map();
    284310  unset($type_map[IMG_XXLARGE], $type_map[IMG_XLARGE]);
     
    294320      );
    295321  }
    296 }
    297 
    298 // category comment
    299 if ($page['start']==0 and !isset($page['chronology_field']) and !empty($page['comment']) )
    300 {
    301   $template->assign('CONTENT_DESCRIPTION', $page['comment'] );
    302 }
    303 
    304 // include menubar
    305 include( PHPWG_ROOT_PATH.'include/menubar.inc.php');
    306 
    307 if ( isset($page['category']['count_categories']) and $page['category']['count_categories']==0 )
    308 {// count_categories might be computed by menubar - if the case unassign flat link if no sub albums
    309         $template->clear_assign('U_MODE_FLAT');
    310 }
    311 
    312 //------------------------------------------------------ main part : thumbnails
    313 if ( 0==$page['start']
    314     and !isset($page['flat'])
    315     and !isset($page['chronology_field'])
    316     and ('recent_cats'==$page['section'] or 'categories'==$page['section'])
    317     and (!isset($page['category']['count_categories']) or $page['category']['count_categories']>0 )
    318   )
    319 {
    320   include(PHPWG_ROOT_PATH.'include/category_cats.inc.php');
    321 }
    322 if ( !empty($page['items']) )
    323 {
    324   include(PHPWG_ROOT_PATH.'include/category_default.inc.php');
    325322}
    326323//------------------------------------------------------- category informations
Note: See TracChangeset for help on using the changeset viewer.