Changeset 16721

Show
Ignore:
Timestamp:
06/26/08 11:40:43 (4 months ago)
Author:
rambo
Message:

forward port r16720

Files:

Legend:

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

    r14806 r16721  
    2020class midcom_helper_datamanager2_type_tags extends midcom_helper_datamanager2_type_text 
    2121{ 
     22    /** 
     23     * Automatically use this context for all tags that lack one 
     24     */ 
     25    var $auto_context = null; 
     26 
    2227    /** 
    2328     * This event handler is called after construction, so passing references to $this to the 
     
    4651    function convert_to_storage() 
    4752    { 
     53     
    4854        $tag_array = net_nemein_tag_handler::string2tag_array($this->value); 
     55        $this->auto_context = trim($this->auto_context); 
     56        if (!empty($this->auto_context)) 
     57        { 
     58            $new_tag_array = array(); 
     59            foreach ($tag_array as $tagname => $url) 
     60            { 
     61                $context = net_nemein_tag_handler::resolve_context($tagname); 
     62                if (empty($context)) 
     63                { 
     64                    $tagname = "{$this->auto_context}:{$tagname}"; 
     65                } 
     66                $new_tag_array[$tagname] = $url; 
     67            } 
     68            unset($tagname, $url); 
     69            $tag_array = $new_tag_array; 
     70            unset($new_tag_array); 
     71        } 
    4972        $status = net_nemein_tag_handler::tag_object($this->storage->object, $tag_array); 
    5073        if (!$status)