Changeset 6087

Show
Ignore:
Timestamp:
05/31/07 15:52:47 (1 year ago)
Author:
bergie
Message:

Get nicer XML for the API

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/midcom.helper.datamanager2/datamanager.php

    r5875 r6087  
    306306 
    307307    /** 
     308     * Little helper function returning an accociative array of all field values converted to XML 
     309     * using their default convert_to_csv or convert_to_raw options. 
     310     * 
     311     * @return Array All field values in their XML representation indexed by their name. 
     312     */ 
     313    function get_content_xml() 
     314    { 
     315        $result = Array(); 
     316        foreach ($this->schema->field_order as $name) 
     317        { 
     318            if (is_a($this->types[$name], 'midcom_helper_datamanager2_type_blobs')) 
     319            { 
     320                $result[$name] = explode(',', $this->types[$name]->convert_to_csv()); 
     321            } 
     322            elseif (is_a($this->types[$name], 'midcom_helper_datamanager2_type_select')) 
     323            { 
     324                $this->types[$name]->csv_export_key = true; 
     325                $this->types[$name]->multiple_storagemode = 'array'; 
     326                $result[$name] = $this->types[$name]->convert_to_storage(); 
     327            } 
     328            else 
     329            { 
     330                $result[$name] = $this->types[$name]->convert_to_storage(); 
     331            } 
     332        } 
     333        return $result; 
     334    } 
     335 
     336    /** 
    308337     * Little helper function returning an accociative array of all field values converted to CSV 
    309338     * using their default convert_to_csv option. 
  • trunk/src/midcom.helper.xml/objectmapper.php

    r6074 r6087  
    200200    function dm2data($datamanager, $fallback_label = 'default') 
    201201    { 
    202         $content = $datamanager->get_content_csv(); 
     202        $content = $datamanager->get_content_xml(); 
    203203        $label = $datamanager->schema->name; 
    204204        if ($label == 'default') 
     
    229229        foreach ($array as $key => $field) 
    230230        { 
     231            if (is_numeric($key)) 
     232            { 
     233                $key = 'value'; 
     234            } 
     235             
    231236            if (empty($field)) 
    232237            { 
    233238               $data .= "{$prefix}    <{$key}/>\n"; 
    234239            } 
     240             
    235241            elseif (is_array($field)) 
    236242            { 
  • trunk/src/org.openpsa.products/handler/product/api.php

    r6068 r6087  
    3838        } 
    3939         
    40         $_MIDCOM->auth->require_valid_user('basic'); 
     40        //$_MIDCOM->auth->require_valid_user('basic'); 
    4141         
    4242        //Content-Type