Changeset 17003

Show
Ignore:
Timestamp:
07/30/08 13:48:09 (4 months ago)
Author:
bergie
Message:

New DM2 helpers for email-friendly content formatting. Related to https://bugs.maemo.org/show_bug.cgi?id=3389

Files:

Legend:

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

    r16513 r17003  
    386386 
    387387    /** 
     388     * Little helper function returning an associative array of all field values converted to email-friendly format 
     389     * using their default convert_to_email option. 
     390     * 
     391     * @return Array All field values in their CSV representation indexed by their name. 
     392     */ 
     393    function get_content_email() 
     394    { 
     395        $result = Array(); 
     396        foreach ($this->schema->field_order as $name) 
     397        { 
     398            $result[$name] = $this->types[$name]->convert_to_email(); 
     399        } 
     400        return $result; 
     401    } 
     402 
     403    /** 
    388404     * Little helper function returning an associative array of all field values converted to 
    389405     * their raw storage representation.. 
  • trunk/midcom/midcom.helper.datamanager2/type.php

    r15253 r17003  
    212212 
    213213    /** 
     214     * Transforms the current object's state into a email-friendly string representation. 
     215     *  
     216     * Escaping and other encoding is done by the caller, you just return the string. 
     217     * 
     218     * If this method is not overwritten, convert_to_csv will be used instead. 
     219     * 
     220     * @return mixed The data to store into the object, or null on failure. 
     221     */ 
     222    function convert_to_email() 
     223    { 
     224        return $this->convert_to_csv(); 
     225    } 
     226 
     227    /** 
    214228     * Transforms the current object's state into HTML representation. 
    215229     * 
  • trunk/midcom/midcom.helper.datamanager2/type/boolean.php

    r14329 r17003  
    100100    } 
    101101 
     102    function convert_to_email() 
     103    { 
     104        if ($this->value) 
     105        { 
     106            return $_MIDCOM->i18n->get_string('yes', 'midcom.helper.datamanager2'); 
     107        } 
     108        else 
     109        { 
     110            return $_MIDCOM->i18n->get_string('no', 'midcom.helper.datamanager2'); 
     111        } 
     112    } 
     113 
    102114    /** 
    103115     * The HTML representation returns either the configured texts or a 
  • trunk/midcom/net.nemein.registrations/event.php

    r16858 r17003  
    934934 
    935935            $result .= $this->_l10n->get($field['title']) . ":\n"; 
    936             $data = $dm->types[$name]->convert_to_csv(); 
     936            $data = $dm->types[$name]->convert_to_email(); 
    937937            $result .= "  " . wordwrap ($data, 70, "\n  "); 
    938938            $result .= "\n\n"; 
  • trunk/midcom/net.nemein.registrations/registration.php

    r16858 r17003  
    216216 
    217217        $registration_dm =& $this->_request_data['registration_dm']; 
    218         $registration_data = $registration_dm->get_content_csv(); 
     218        $registration_data = $registration_dm->get_content_email(); 
    219219        $registration_all = net_nemein_registrations_event::dm_array_to_string($registration_dm); 
    220220