Changeset 14715

Show
Ignore:
Timestamp:
01/31/08 18:02:16 (10 months ago)
Author:
rambo
Message:

forward port r14714 and r14712

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.helper.datamanager2/locale/default.fi.txt

    r13663 r14715  
    4545 
    4646---STRING denotes required field 
    47 merkkaa pakollista kenttÀÀ 
     47Pakollinen kenttÀ 
    4848---STRINGEND 
    4949 
  • trunk/midcom/midcom.helper.datamanager2/schema.php

    r14404 r14715  
    352352    function _complete_field_defaults(&$config) 
    353353    { 
    354         if (! array_key_exists('description', $config)) 
    355         { 
    356             $config['description'] = null; 
    357         } 
    358         if (! array_key_exists('helptext', $config)) 
    359         { 
    360             $config['helptext'] = null; 
    361         } 
    362         if (! array_key_exists('static_prepend', $config)) 
    363         { 
    364             $config['static_prepend'] = null; 
    365         } 
    366         if (! array_key_exists('static_append', $config)) 
    367         { 
    368             $config['static_append'] = null; 
    369         } 
    370  
    371         if (! array_key_exists('readonly', $config)) 
    372         { 
    373             $config['readonly'] = false; 
    374         } 
    375         if (! array_key_exists('hidden', $config)) 
    376         { 
    377             $config['hidden'] = false; 
    378         } 
    379         if (! array_key_exists('aisonly', $config)) 
    380         { 
    381             $config['aisonly'] = false; 
    382         } 
    383         if (! array_key_exists('read_privilege', $config)) 
    384         { 
    385             $config['read_privilege'] = null; 
    386         } 
    387         if (! array_key_exists('write_privilege', $config)) 
    388         { 
    389             $config['write_privilege'] = null; 
    390         } 
    391  
    392         if (! array_key_exists('required', $config)) 
    393         { 
    394             $config['required'] = false; 
    395         } 
    396  
    397         if (! array_key_exists('default', $config)) 
    398         { 
    399             $config['default'] = null; 
    400         } 
    401  
     354        // Sanity check for b0rken schemas, missing type/widget would cause DM & PHP to barf later on... 
     355        if (   !array_key_exists('type', $config) 
     356            || empty($config['type'])) 
     357        { 
     358            $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Field '{$config['name']}' in schema '{$this->name}' loaded from {$this->_schemadb_path} is missing *type* definition"); 
     359            // this will exit 
     360        } 
     361        if (   !array_key_exists('widget', $config) 
     362            || empty($config['widget'])) 
     363        { 
     364            $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Field '{$config['name']}' in schema '{$this->name}' loaded from {$this->_schemadb_path} is missing *widget* definition"); 
     365            // this will exit 
     366        } 
     367        /* Rest of the defaults */ 
     368        // Simple ones 
     369        $simple_defaults = array 
     370        ( 
     371            'description' => null, 
     372            'helptext' => null, 
     373            'static_prepend' => null, 
     374            'static_append' => null, 
     375            'read_privilege' => null, 
     376            'write_privilege' => null, 
     377            'default' => null, 
     378            'readonly' => false, 
     379            'hidden' => false, 
     380            'aisonly' => false, 
     381            'required' => false, 
     382        ); 
     383        foreach ($simple_defaults as $property => $value) 
     384        { 
     385            if (! array_key_exists( $property, $config)) 
     386            { 
     387                $config[ $property] = $value; 
     388            } 
     389        } 
     390        unset($property, $value); 
     391 
     392        // And complex ones 
    402393        if (! array_key_exists('storage', $config)) 
    403394        {