Changeset 17958

Show
Ignore:
Timestamp:
10/06/08 12:33:06 (2 months ago)
Author:
adrenalin
Message:

Help MN relations to detect default values and previously entered
values. Corresponding options are not required by default any more.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/midcom.helper.datamanager2/type/mnrelation.php

    r16539 r17958  
    147147     */ 
    148148    var $member_limit_like = null; 
     149     
     150    /** 
     151     * Set this to false to use with universalchooser, this skips making sure the key exists in option list 
     152     * Mainly used to avoid unnecessary seeks to load all a ton of objects to the options list. This is false 
     153     * by default for mn relations, since by its nature this is intended for dynamic searches. 
     154     * 
     155     * @var boolean 
     156     * @access public 
     157     */ 
     158     var $require_corresponding_option = false; 
    149159 
    150160    /** 
     
    296306    { 
    297307        $this->selection = Array(); 
    298  
    299         if (! $this->storage->object) 
     308         
     309        // Check for the defaults section first 
     310        if (   isset($this->storage->_defaults) 
     311            && isset($this->storage->_defaults[$this->name])) 
     312        { 
     313            foreach ($this->storage->_defaults[$this->name] as $id) 
     314            { 
     315                if (is_object($id)) 
     316                { 
     317                    if ($this->master_is_id) 
     318                    { 
     319                        $this->selection[] = $id->id; 
     320                    } 
     321                    else 
     322                    { 
     323                        $this->selection[] = $id->guid; 
     324                    } 
     325                } 
     326                else 
     327                { 
     328                    $this->selection[] = $guid; 
     329                } 
     330            } 
     331        } 
     332         
     333        if (!$this->storage->object) 
    300334        { 
    301335            // That's all folks, no storage object, thus we cannot continue. 
    302336            return; 
    303337        } 
    304  
     338         
    305339        $this->_load_membership_objects(); 
     340         
    306341        foreach ($this->_membership_objects as $member) 
    307342        { 
     
    323358        } 
    324359    } 
    325  
     360     
    326361    /** 
    327362     * Updates the mapping table to match the current selection. 
  • branches/MidCOM_2_8/midcom.helper.datamanager2/type/select.php

    r16539 r17958  
    125125     * @access public 
    126126     */ 
    127     var $options = null
     127    var $options = array()
    128128 
    129129    /** 
     
    355355    { 
    356356        $key = (string) $key; 
    357  
     357         
    358358        if ($this->option_callback === null) 
    359359        {