Changeset 15493

Show
Ignore:
Timestamp:
03/11/08 13:40:05 (7 months ago)
Author:
rambo
Message:

forward port r15492

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.helper.datamanager2/type/image.php

    r14380 r15493  
    972972    function convert_to_storage() 
    973973    { 
    974         foreach ($this->attachments as $identifier => $copy) 
    975         { 
    976             $this->update_attachment_title($identifier, $this->title); 
     974        // FIXME: better safety for image*s* datatype calling parent::convert_to_storage() 
     975        if (!empty($this->title)) 
     976        { 
     977            foreach ($this->attachments as $identifier => $copy) 
     978            { 
     979                if ($copy->title === $this->title) 
     980                { 
     981                    continue; 
     982                } 
     983                $this->update_attachment_title($identifier, $this->title); 
     984            } 
    977985        } 
    978986 
  • trunk/midcom/midcom.helper.datamanager2/type/images.php

    r14380 r15493  
    370370    function convert_to_storage() 
    371371    { 
    372         /* 
    373          * TODO: Title handling 
     372        /** 
     373         * FIXME: Title handling (now handled separately by the images widget which is incorrect) 
    374374        foreach ($this->attachments as $identifier => $copy) 
    375375        { 
    376376            $this->update_attachment_title($identifier, $this->_title); 
    377377        } 
    378         */ 
     378        */ 
    379379 
    380380        return parent::convert_to_storage(); 
     
    490490            { 
    491491                // We have somehow broken data, try heuristics 
    492                 $info['images_identifier'] = substr($identifier, 0, 32); 
     492                $info['images_identifier'] = substr($identifier, 0, 32); // NOTE: the 16 byte identifier is MD5 not GUID, so this is safe 
    493493                debug_push_class(__CLASS__, __FUNCTION__); 
    494494                debug_add("\$info['images_identifier'] was not set, used heuristics to set it to '{$info['images_identifier']}' (from '{$identifier}')", MIDCOM_LOG_WARN); 
     
    498498            { 
    499499                // We have somehow broken data, try heuristics 
    500                 $info['images_name'] = substr($identifier, 32); 
     500                $info['images_name'] = substr($identifier, 32); // NOTE: the 16 byte identifier is MD5 not GUID, so this is safe 
    501501                debug_push_class(__CLASS__, __FUNCTION__); 
    502502                debug_add("\$info['images_name'] was not set, used heuristics to set it to '{$info['images_name']}' (from '{$identifier}')", MIDCOM_LOG_WARN);