Index: branches/RC/core/units/general/helpers/image_helper.php =================================================================== diff -u -N -r9278 -r9598 --- branches/RC/core/units/general/helpers/image_helper.php (.../image_helper.php) (revision 9278) +++ branches/RC/core/units/general/helpers/image_helper.php (.../image_helper.php) (revision 9598) @@ -197,80 +197,6 @@ } /** - * Determines what image fields should be created (from post or just dummy fields for 1st upload) - * - * @param string $prefix - */ - function createItemImages($prefix) - { - $items_info = $this->Application->GetVar($prefix); - if ($items_info) { - list ($id, $fields_values) = each($items_info); - $this->createImageFields($prefix, $fields_values); - } - else { - $this->createImageFields($prefix, Array()); - } - } - - /** - * Dynamically creates virtual fields for item for each image field in submit - * - * @param string $prefix - * @param Array $fields_values - */ - function createImageFields($prefix, $fields_values) - { - $field_options = Array ( - 'type' => 'string', - 'formatter' => 'kPictureFormatter', -// 'skip_empty' => 1, - 'max_len' => 240, - 'default' => '', - 'not_null' => 1, - 'include_path' => 1, - 'allowed_types' => Array ('image/jpeg', 'image/pjpeg', 'image/png', 'image/gif', 'image/bmp'), - 'error_msgs' => Array ( - 'bad_file_format' => '!la_error_InvalidFileFormat!', - 'bad_file_size' => '!la_error_FileTooLarge!', - 'cant_save_file' => '!la_error_cant_save_file!' - ), - ); - - $fields = $this->Application->getUnitOption($prefix, 'Fields'); - $virtual_fields = $this->Application->getUnitOption($prefix, 'VirtualFields'); - - $image_count = 0; - foreach ($fields_values as $field_name => $field_value) { - if (preg_match('/^(Image[\d]+|PrimaryImage)$/', $field_name)) { - $fields[$field_name] = $field_options; - $virtual_fields[$field_name] = $field_options; - $virtual_fields['Delete'.$field_name] = Array ('type' => 'int', 'not_null' => 1, 'default' => 0); - $image_count++; - } - } - - if (!$image_count) { - // no images found in POST -> create default image fields - $image_names = Array ('PrimaryImage' => ''); - $image_count = $this->Application->ConfigValue($prefix.'_MaxImageCount'); - - $created_count = 1; - while ($created_count < $image_count) { - $image_names['Image'.$created_count] = ''; - $created_count++; - } - - $this->createImageFields($prefix, $image_names); - return ; - } - - $this->Application->setUnitOption($prefix, 'ImageCount', $image_count); - $this->Application->setUnitOption($prefix, 'Fields', $fields); - $this->Application->setUnitOption($prefix, 'VirtualFields', $virtual_fields); - } - - /** * Puts existing item images (from subitem) to virtual fields (in main item) * * @param kCatDBItem $object @@ -364,23 +290,6 @@ $i++; } } - - /** - * Preserves cloned item images to be rewrited with original item images - * - * @param Array $field_values - */ - function PreserveItemImages(&$field_values) - { - foreach ($field_values as $field_name => $field_value) { - if (!is_array($field_value)) continue; - - if (isset($field_value['upload']) && ($field_value['error'] == UPLOAD_ERR_NO_FILE)) { - // this is upload field, but nothing was uploaded this time - unset($field_values[$field_name]); - } - } - } } ?> \ No newline at end of file