Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r8374 -r8388 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 8374) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 8388) @@ -208,29 +208,8 @@ */ function PrintList($params) { - $list =& $this->GetList($params); - $id_field = $this->Application->getUnitOption($this->Prefix,'IDField'); - - $list->Query(); - $o = ''; - $list->GoFirst(); - - $block_params=$this->prepareTagParams($params); - $block_params['name'] = $this->SelectParam($params, 'render_as,block'); - $block_params['pass_params'] = 'true'; - - $i = 0; - while (!$list->EOL()) - { - $this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); // for edit/delete links using GET - $block_params['is_last'] = ($i == $list->SelectedCount-1); - $o.= $this->Application->ParseBlock($block_params, 1); - $list->GoNext(); - $i++; - } - - $this->Application->SetVar( $this->getPrefixSpecial().'_id', ''); - return $o; + $params['no_table'] = 1; + return $this->PrintList2($params); } function InitList($params) @@ -408,6 +387,8 @@ $block_params['last_col'] = $column_number == $columns ? 1 : 0; $block_params['column_number'] = $column_number; + + $this->PrepareListElementParams($list, $block_params); // new, no need to rewrite PrintList $o.= $this->Application->ParseBlock($block_params, 1); array_push($displayed, $list->GetDBField($id_field)); @@ -457,6 +438,19 @@ return $o; } + /** + * Allows to modify block params & current list record before PrintList parses record + * + * @param kDBList $object + * @param Array $block_params + */ + function PrepareListElementParams(&$object, &$block_params) + { +// $fields_hash =& $object->Records[$this->CurrentIndex]; +// +// $object->Records[$this->CurrentIndex] =& $fields_hash; + } + function MoreLink($params) { $per_page = $this->SelectParam($params, 'per_page,max_items'); Index: trunk/core/kernel/db/dblist.php =================================================================== diff -u -N -r8369 -r8388 --- trunk/core/kernel/db/dblist.php (.../dblist.php) (revision 8369) +++ trunk/core/kernel/db/dblist.php (.../dblist.php) (revision 8388) @@ -714,6 +714,11 @@ return $this->getCurrentRecord(); } + /** + * Returns current record from list + * + * @return Array + */ function &getCurrentRecord() { return $this->Records[$this->CurrentIndex]; Index: trunk/kernel/units/images/image_event_handler.php =================================================================== diff -u -N -r7391 -r8388 --- trunk/kernel/units/images/image_event_handler.php (.../image_event_handler.php) (revision 7391) +++ trunk/kernel/units/images/image_event_handler.php (.../image_event_handler.php) (revision 8388) @@ -15,6 +15,22 @@ $this->eventMethods = array_merge($this->eventMethods, $image_events); } + /** + * Get's special of main item for linking with subitem + * + * @param kEvent $event + * @return string + */ + function getMainSpecial(&$event) + { + if ($event->Special == 'list' && !$this->Application->IsAdmin()) { + // ListImages aggregated tag uses this special + return ''; + } + + return parent::getMainSpecial($event); + } + function customProcessing(&$event, $type) { $object =& $event->GetObject(); Index: trunk/themes/default2007/platform/img/no_picture.gif =================================================================== diff -u -N Binary files differ Index: trunk/core/units/images/images_config.php =================================================================== diff -u -N -r8015 -r8388 --- trunk/core/units/images/images_config.php (.../images_config.php) (revision 8015) +++ trunk/core/units/images/images_config.php (.../images_config.php) (revision 8388) @@ -16,24 +16,27 @@ 'TagProcessorClass' => Array('class'=>'ImageTagProcessor','file'=>'image_tag_processor.php','build_event'=>'OnBuild'), 'AutoLoad' => true, - 'AggregateTags' => Array( - Array( - 'AggregateTo' => '#PARENT#', - 'AggregatedTagName' => 'Image', - 'LocalTagName' => 'ItemImage', - ), - Array( - 'AggregateTo' => '#PARENT#', - 'AggregatedTagName' => 'ListImages', - 'LocalTagName' => 'PrintList2', - 'LocalSpecial' => 'list', - ), - Array( - 'AggregateTo' => '#PARENT#', - 'AggregatedTagName' => 'LargeImageExists', - 'LocalTagName' => 'LargeImageExists', - ), - ), + 'AggregateTags' => Array ( + Array ( + 'AggregateTo' => '#PARENT#', + 'AggregatedTagName' => 'Image', + 'LocalTagName' => 'ItemImage', + 'LocalSpecial' => '-item', + ), + + Array ( + 'AggregateTo' => '#PARENT#', + 'AggregatedTagName' => 'ListImages', + 'LocalTagName' => 'PrintList2', + 'LocalSpecial' => 'list', + ), + + Array ( + 'AggregateTo' => '#PARENT#', + 'AggregatedTagName' => 'LargeImageExists', + 'LocalTagName' => 'LargeImageExists', + ), + ), 'QueryString' => Array( 1 => 'id', Index: trunk/core/units/images/image_tag_processor.php =================================================================== diff -u -N -r7867 -r8388 --- trunk/core/units/images/image_tag_processor.php (.../image_tag_processor.php) (revision 7867) +++ trunk/core/units/images/image_tag_processor.php (.../image_tag_processor.php) (revision 8388) @@ -2,21 +2,32 @@ class ImageTagProcessor extends kDBTagProcessor { - function Image($params) + /** + * Prepares all image parameters as list block parameters (for easy usage) + * + * @param kDBList $object + * @param Array $block_params + * @author Alex + */ + function PrepareListElementParams(&$object, &$block_params) { - $params['img_path'] = $this->ImageSrc($params); - if ($params['img_path'] === false) return ; - $params['img_size'] = $this->ImageSize($params); - if (!$params['img_size']){ - $params['img_size'] = ' width="'.getArrayValue($params, 'DefaultWidth').'"'; + $image_url = $this->ImageSrc($block_params); + if (!$image_url) { + return ; } - $object =& $this->Application->recallObject($this->getPrefixSpecial(), null); - $params['alt'] = htmlspecialchars($object->GetField('AltName')); - $params['name'] = $this->SelectParam($params, 'block,render_as'); - - return $this->Application->ParseBlock($params); + + $block_params['img_path'] = $image_url; + $image_dimensions = $this->ImageSize($block_params); + $block_params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$block_params['DefaultWidth'].'"'; + $block_params['alt'] = htmlspecialchars($object->GetField('AltName')); // really used ? } - + + /** + * [AGGREGATED TAG] works as + * + * @param Array $params + * @return string + */ function ItemImage($params) { $this->LoadItemImage($params); @@ -28,15 +39,16 @@ } } $params['name'] = $this->SelectParam($params, 'render_as,block'); - $object =& $this->Application->recallObject($this->getPrefixSpecial()); + $object =& $this->getObject($params); if ( !$object->isLoaded() && !$this->SelectParam($params, 'default_image,DefaultImage') ) return false; $params['alt'] = htmlspecialchars($object->GetField('AltName')); return $this->Application->ParseBlock($params); } - function LargeImageExists($params) { - $object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params); + function LargeImageExists($params) + { + $object =& $this->getObject($params); if ( $object->GetDBField('SameImages') == null || $object->GetDBField('SameImages')=='1' ) { return false; @@ -50,9 +62,8 @@ function LoadItemImage($params) { $parent_item =& $this->Application->recallObject($params['PrefixSpecial']); + $object =& $this->Application->recallObject($this->getPrefixSpecial(), null, Array('skip_autoload' => true)); - - // if we need primary thumbnail which is preloaded with products list $object->Clear(); // if we need primary thumbnail which is preloaded with products list @@ -101,40 +112,46 @@ function ImageSrc($params) { - $object =& $this->Application->recallObject($this->getPrefixSpecial(), null); + $object =& $this->getObject($params); + + $base_url = rtrim($this->Application->BaseURL(), '/'); + $ret = ''; // if we need thumb, or full image is same as thumb if ( $this->SelectParam($params, 'thumbnail,Thumbnail') || $object->GetDBField('SameImages') ) { // return local image or url - $ret = $object->GetDBField('LocalThumb') ? PROTOCOL.SERVER_NAME.BASE_PATH.'/'.$object->GetDBField('ThumbPath') : $object->GetDBField('ThumbUrl'); - if ( $object->GetDBField('LocalThumb') && !file_exists(FULL_PATH.'/'.$object->GetDBField('ThumbPath')) && !constOn('DBG_IMAGE_RECOVERY')) $ret = ''; + $ret = $object->GetDBField('LocalThumb') ? $base_url.$object->GetDBField('ThumbPath') : $object->GetDBField('ThumbUrl'); + if ($object->GetDBField('LocalThumb') && !file_exists(FULL_PATH.$object->GetDBField('ThumbPath')) && !constOn('DBG_IMAGE_RECOVERY')) { + // local thumbnail file is missing + $ret = ''; + } } else { // if we need full which is not the same as thumb - $ret = $object->GetDBField('LocalImage') ? PROTOCOL.SERVER_NAME.BASE_PATH.'/'.$object->GetDBField('LocalPath') : $object->GetDBField('Url'); - if ( $object->GetDBField('LocalImage') && !file_exists(FULL_PATH.'/'.$object->GetDBField('LocalPath')) ) $ret = ''; + $ret = $object->GetDBField('LocalImage') ? $base_url.$object->GetDBField('LocalPath') : $object->GetDBField('Url'); + if ($object->GetDBField('LocalImage') && !file_exists(FULL_PATH.$object->GetDBField('LocalPath'))) { + // local full image file is missing + $ret = ''; + } } $default_image = $this->SelectParam($params, 'default_image,DefaultImage'); - return ($ret && $ret != PROTOCOL.SERVER_NAME.BASE_PATH && $ret != PROTOCOL.SERVER_NAME.BASE_PATH.'/') ? $ret : ($default_image ? PROTOCOL.SERVER_NAME.BASE_PATH.THEMES_PATH.'/'.$default_image : false); + return ($ret && $ret != $base_url) ? $ret : ($default_image ? $base_url.THEMES_PATH.'/'.$default_image : false); } - function GetFullPath($path) + function getFullPath($path) { - if(!$path) return $path; + if (!$path) { + return $path; + } // absolute url - if( preg_match('/^(.*):\/\/(.*)$/U', $path) ) - { - if(strpos($path, PROTOCOL.SERVER_NAME.BASE_PATH) === 0) - { - $path = str_replace(PROTOCOL.SERVER_NAME.BASE_PATH, FULL_PATH.'/', $path); - } - return $path; + if (preg_match('/^(.*):\/\/(.*)$/U', $path)) { + return preg_replace('/^'.preg_quote($this->Application->BaseURL(), '/').'(.*)/', FULL_PATH.'/\\1', $path); } // relative url - return FULL_PATH.'/'.substr(THEMES_PATH,1).'/'.$path; + return FULL_PATH.'/'.substr(THEMES_PATH, 1).'/'.$path; } /** @@ -147,14 +164,14 @@ */ function ImageSize($params) { - $img_path = $this->GetFullPath( getArrayValue($params, 'img_path') ); + $img_path = $this->getFullPath($params['img_path']); - if (!file_exists($img_path)) return false; + if (!file_exists($img_path)) { + return false; + } + $image_info = @getimagesize($img_path); - -// if( !($img_path && file_exists($img_path) && isset($image_info) ) ) - if( !$image_info ) - { + if (!$image_info) { trigger_error('Image '.$img_path.' missing or invalid', E_USER_WARNING); return false; } @@ -167,36 +184,59 @@ $too_large = is_numeric($max_width) ? ($orig_width > $max_width) : false; $too_large = $too_large || (is_numeric($max_height) ? ($orig_height > $max_height) : false); - if($too_large) - { + if ($too_large) { $width_ratio = $max_width ? $max_width / $orig_width : 1; $height_ratio = $max_height ? $max_height / $orig_height : 1; $ratio = min($width_ratio, $height_ratio); $width = ceil($orig_width * $ratio); $height = ceil($orig_height * $ratio); } - else - { + else { $width = $orig_width; $height = $orig_height; } - - $size_clause = ' width="'.$width.'" height="'.$height.'"'; - return $size_clause; + + return ' width="'.$width.'" height="'.$height.'"'; } + /** + * Prepares image parameters & parses block with them (for admin) + * + * @param Array $params + * @return string + */ + function Image($params) + { + $image_url = $this->ImageSrc($params); + if (!$image_url) { + return ; + } + + $object =& $this->getObject($params); + $params['img_path'] = $image_url; + $image_dimensions = $this->ImageSize($params); + $params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$params['DefaultWidth'].'"'; + $params['alt'] = htmlspecialchars($object->GetField('AltName')); // really used ? + $params['name'] = $this->SelectParam($params, 'block,render_as'); - // used in admin + return $this->Application->ParseBlock($params); + } + + + /** + * Returns url for image in case when image source is url (for admin) + * + * @param Array $params + * @return string + */ function ImageUrl($params) { - $object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params); - if ($object->GetDBField('SameImages') ? $object->GetDBField('LocalThumb') : $object->GetDBField('LocalImage') ) - { + $object =& $this->getObject($params); + if ($object->GetDBField('SameImages') ? $object->GetDBField('LocalThumb') : $object->GetDBField('LocalImage') ) { $ret = $this->Application->Phrase(getArrayValue($params,'local_phrase')); } - else - { + else { $ret = $object->GetDBField('SameImages') ? $object->GetDBField('ThumbUrl') : $object->GetDBField('Url'); } return $ret; Index: trunk/themes/default2007/platform/designs/content_boxes.tpl =================================================================== diff -u -N -r8385 -r8388 --- trunk/themes/default2007/platform/designs/content_boxes.tpl (.../content_boxes.tpl) (revision 8385) +++ trunk/themes/default2007/platform/designs/content_boxes.tpl (.../content_boxes.tpl) (revision 8388) @@ -29,7 +29,11 @@ - + + + " title="" alt="" border="0" /> + + Index: trunk/kernel/units/images/image_tag_processor.php =================================================================== diff -u -N -r7867 -r8388 --- trunk/kernel/units/images/image_tag_processor.php (.../image_tag_processor.php) (revision 7867) +++ trunk/kernel/units/images/image_tag_processor.php (.../image_tag_processor.php) (revision 8388) @@ -2,21 +2,32 @@ class ImageTagProcessor extends kDBTagProcessor { - function Image($params) + /** + * Prepares all image parameters as list block parameters (for easy usage) + * + * @param kDBList $object + * @param Array $block_params + * @author Alex + */ + function PrepareListElementParams(&$object, &$block_params) { - $params['img_path'] = $this->ImageSrc($params); - if ($params['img_path'] === false) return ; - $params['img_size'] = $this->ImageSize($params); - if (!$params['img_size']){ - $params['img_size'] = ' width="'.getArrayValue($params, 'DefaultWidth').'"'; + $image_url = $this->ImageSrc($block_params); + if (!$image_url) { + return ; } - $object =& $this->Application->recallObject($this->getPrefixSpecial(), null); - $params['alt'] = htmlspecialchars($object->GetField('AltName')); - $params['name'] = $this->SelectParam($params, 'block,render_as'); - - return $this->Application->ParseBlock($params); + + $block_params['img_path'] = $image_url; + $image_dimensions = $this->ImageSize($block_params); + $block_params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$block_params['DefaultWidth'].'"'; + $block_params['alt'] = htmlspecialchars($object->GetField('AltName')); // really used ? } - + + /** + * [AGGREGATED TAG] works as + * + * @param Array $params + * @return string + */ function ItemImage($params) { $this->LoadItemImage($params); @@ -28,15 +39,16 @@ } } $params['name'] = $this->SelectParam($params, 'render_as,block'); - $object =& $this->Application->recallObject($this->getPrefixSpecial()); + $object =& $this->getObject($params); if ( !$object->isLoaded() && !$this->SelectParam($params, 'default_image,DefaultImage') ) return false; $params['alt'] = htmlspecialchars($object->GetField('AltName')); return $this->Application->ParseBlock($params); } - function LargeImageExists($params) { - $object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params); + function LargeImageExists($params) + { + $object =& $this->getObject($params); if ( $object->GetDBField('SameImages') == null || $object->GetDBField('SameImages')=='1' ) { return false; @@ -50,9 +62,8 @@ function LoadItemImage($params) { $parent_item =& $this->Application->recallObject($params['PrefixSpecial']); + $object =& $this->Application->recallObject($this->getPrefixSpecial(), null, Array('skip_autoload' => true)); - - // if we need primary thumbnail which is preloaded with products list $object->Clear(); // if we need primary thumbnail which is preloaded with products list @@ -101,40 +112,46 @@ function ImageSrc($params) { - $object =& $this->Application->recallObject($this->getPrefixSpecial(), null); + $object =& $this->getObject($params); + + $base_url = rtrim($this->Application->BaseURL(), '/'); + $ret = ''; // if we need thumb, or full image is same as thumb if ( $this->SelectParam($params, 'thumbnail,Thumbnail') || $object->GetDBField('SameImages') ) { // return local image or url - $ret = $object->GetDBField('LocalThumb') ? PROTOCOL.SERVER_NAME.BASE_PATH.'/'.$object->GetDBField('ThumbPath') : $object->GetDBField('ThumbUrl'); - if ( $object->GetDBField('LocalThumb') && !file_exists(FULL_PATH.'/'.$object->GetDBField('ThumbPath')) && !constOn('DBG_IMAGE_RECOVERY')) $ret = ''; + $ret = $object->GetDBField('LocalThumb') ? $base_url.$object->GetDBField('ThumbPath') : $object->GetDBField('ThumbUrl'); + if ($object->GetDBField('LocalThumb') && !file_exists(FULL_PATH.$object->GetDBField('ThumbPath')) && !constOn('DBG_IMAGE_RECOVERY')) { + // local thumbnail file is missing + $ret = ''; + } } else { // if we need full which is not the same as thumb - $ret = $object->GetDBField('LocalImage') ? PROTOCOL.SERVER_NAME.BASE_PATH.'/'.$object->GetDBField('LocalPath') : $object->GetDBField('Url'); - if ( $object->GetDBField('LocalImage') && !file_exists(FULL_PATH.'/'.$object->GetDBField('LocalPath')) ) $ret = ''; + $ret = $object->GetDBField('LocalImage') ? $base_url.$object->GetDBField('LocalPath') : $object->GetDBField('Url'); + if ($object->GetDBField('LocalImage') && !file_exists(FULL_PATH.$object->GetDBField('LocalPath'))) { + // local full image file is missing + $ret = ''; + } } $default_image = $this->SelectParam($params, 'default_image,DefaultImage'); - return ($ret && $ret != PROTOCOL.SERVER_NAME.BASE_PATH && $ret != PROTOCOL.SERVER_NAME.BASE_PATH.'/') ? $ret : ($default_image ? PROTOCOL.SERVER_NAME.BASE_PATH.THEMES_PATH.'/'.$default_image : false); + return ($ret && $ret != $base_url) ? $ret : ($default_image ? $base_url.THEMES_PATH.'/'.$default_image : false); } - function GetFullPath($path) + function getFullPath($path) { - if(!$path) return $path; + if (!$path) { + return $path; + } // absolute url - if( preg_match('/^(.*):\/\/(.*)$/U', $path) ) - { - if(strpos($path, PROTOCOL.SERVER_NAME.BASE_PATH) === 0) - { - $path = str_replace(PROTOCOL.SERVER_NAME.BASE_PATH, FULL_PATH.'/', $path); - } - return $path; + if (preg_match('/^(.*):\/\/(.*)$/U', $path)) { + return preg_replace('/^'.preg_quote($this->Application->BaseURL(), '/').'(.*)/', FULL_PATH.'/\\1', $path); } // relative url - return FULL_PATH.'/'.substr(THEMES_PATH,1).'/'.$path; + return FULL_PATH.'/'.substr(THEMES_PATH, 1).'/'.$path; } /** @@ -147,14 +164,14 @@ */ function ImageSize($params) { - $img_path = $this->GetFullPath( getArrayValue($params, 'img_path') ); + $img_path = $this->getFullPath($params['img_path']); - if (!file_exists($img_path)) return false; + if (!file_exists($img_path)) { + return false; + } + $image_info = @getimagesize($img_path); - -// if( !($img_path && file_exists($img_path) && isset($image_info) ) ) - if( !$image_info ) - { + if (!$image_info) { trigger_error('Image '.$img_path.' missing or invalid', E_USER_WARNING); return false; } @@ -167,36 +184,59 @@ $too_large = is_numeric($max_width) ? ($orig_width > $max_width) : false; $too_large = $too_large || (is_numeric($max_height) ? ($orig_height > $max_height) : false); - if($too_large) - { + if ($too_large) { $width_ratio = $max_width ? $max_width / $orig_width : 1; $height_ratio = $max_height ? $max_height / $orig_height : 1; $ratio = min($width_ratio, $height_ratio); $width = ceil($orig_width * $ratio); $height = ceil($orig_height * $ratio); } - else - { + else { $width = $orig_width; $height = $orig_height; } - - $size_clause = ' width="'.$width.'" height="'.$height.'"'; - return $size_clause; + + return ' width="'.$width.'" height="'.$height.'"'; } + /** + * Prepares image parameters & parses block with them (for admin) + * + * @param Array $params + * @return string + */ + function Image($params) + { + $image_url = $this->ImageSrc($params); + if (!$image_url) { + return ; + } + + $object =& $this->getObject($params); + $params['img_path'] = $image_url; + $image_dimensions = $this->ImageSize($params); + $params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$params['DefaultWidth'].'"'; + $params['alt'] = htmlspecialchars($object->GetField('AltName')); // really used ? + $params['name'] = $this->SelectParam($params, 'block,render_as'); - // used in admin + return $this->Application->ParseBlock($params); + } + + + /** + * Returns url for image in case when image source is url (for admin) + * + * @param Array $params + * @return string + */ function ImageUrl($params) { - $object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params); - if ($object->GetDBField('SameImages') ? $object->GetDBField('LocalThumb') : $object->GetDBField('LocalImage') ) - { + $object =& $this->getObject($params); + if ($object->GetDBField('SameImages') ? $object->GetDBField('LocalThumb') : $object->GetDBField('LocalImage') ) { $ret = $this->Application->Phrase(getArrayValue($params,'local_phrase')); } - else - { + else { $ret = $object->GetDBField('SameImages') ? $object->GetDBField('ThumbUrl') : $object->GetDBField('Url'); } return $ret; Index: trunk/kernel/units/images/images_config.php =================================================================== diff -u -N -r8015 -r8388 --- trunk/kernel/units/images/images_config.php (.../images_config.php) (revision 8015) +++ trunk/kernel/units/images/images_config.php (.../images_config.php) (revision 8388) @@ -16,24 +16,27 @@ 'TagProcessorClass' => Array('class'=>'ImageTagProcessor','file'=>'image_tag_processor.php','build_event'=>'OnBuild'), 'AutoLoad' => true, - 'AggregateTags' => Array( - Array( - 'AggregateTo' => '#PARENT#', - 'AggregatedTagName' => 'Image', - 'LocalTagName' => 'ItemImage', - ), - Array( - 'AggregateTo' => '#PARENT#', - 'AggregatedTagName' => 'ListImages', - 'LocalTagName' => 'PrintList2', - 'LocalSpecial' => 'list', - ), - Array( - 'AggregateTo' => '#PARENT#', - 'AggregatedTagName' => 'LargeImageExists', - 'LocalTagName' => 'LargeImageExists', - ), - ), + 'AggregateTags' => Array ( + Array ( + 'AggregateTo' => '#PARENT#', + 'AggregatedTagName' => 'Image', + 'LocalTagName' => 'ItemImage', + 'LocalSpecial' => '-item', + ), + + Array ( + 'AggregateTo' => '#PARENT#', + 'AggregatedTagName' => 'ListImages', + 'LocalTagName' => 'PrintList2', + 'LocalSpecial' => 'list', + ), + + Array ( + 'AggregateTo' => '#PARENT#', + 'AggregatedTagName' => 'LargeImageExists', + 'LocalTagName' => 'LargeImageExists', + ), + ), 'QueryString' => Array( 1 => 'id', Index: trunk/core/units/general/cat_tag_processor.php =================================================================== diff -u -N -r8385 -r8388 --- trunk/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 8385) +++ trunk/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 8388) @@ -223,6 +223,21 @@ return $this->Application->ProcessParsedTag('c', 'CategoryLink', $params); } + + /** + * Allows to detect if item has any additional images available + * + * @param Array $params + * @return string + */ + function HasAdditionalImages($params) + { + $object =& $this->getObject($params); + $sql = 'SELECT ImageId + FROM '.$this->Application->getUnitOption('img', 'TableName').' + WHERE ResourceId = '.$object->GetDBField('ResourceId').' AND DefaultImg != 1 AND Enabled = 1'; + return $this->Conn->GetOne($sql) ? 1 : 0; + } } Index: trunk/core/units/images/image_event_handler.php =================================================================== diff -u -N -r7391 -r8388 --- trunk/core/units/images/image_event_handler.php (.../image_event_handler.php) (revision 7391) +++ trunk/core/units/images/image_event_handler.php (.../image_event_handler.php) (revision 8388) @@ -15,6 +15,22 @@ $this->eventMethods = array_merge($this->eventMethods, $image_events); } + /** + * Get's special of main item for linking with subitem + * + * @param kEvent $event + * @return string + */ + function getMainSpecial(&$event) + { + if ($event->Special == 'list' && !$this->Application->IsAdmin()) { + // ListImages aggregated tag uses this special + return ''; + } + + return parent::getMainSpecial($event); + } + function customProcessing(&$event, $type) { $object =& $event->GetObject();