Changeset 7971 for trunk


Ignore:
Timestamp:
03/06/13 12:45:43 (11 years ago)
Author:
thiago
Message:

Ticket #3377 - Corrigido o problema da abertura da mensagem.

Location:
trunk/expressoMail1_2/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/js/MAExpressoPattern.js

    r7715 r7971  
    12411241+   '}'; 
    12421242 
    1243     var strMailMessage = connector.unserialize(tplMessage); 
     1243    var strMailMessage = connector.unserializeArchiver(tplMessage); 
    12441244//    strMessage['from'] = mheader["from"]; 
    12451245    //strMessage['from'] = expresso_mail_archive.toExpressoBody(mheader, mbody); 
  • trunk/expressoMail1_2/js/connector.js

    r7915 r7971  
    171171        } 
    172172 
     173    cConnector.prototype.unserializeArchiver = function(str) 
     174    {    
     175        _thisObject = this; 
     176        var matchB = function (str, iniPos) 
     177        { 
     178            var nOpen, nClose = iniPos; 
     179            do 
     180            { 
     181                nOpen = str.substr(nClose+1).search(/[0-9]\:\{/ ); 
     182 
     183                if (nOpen > 0) 
     184                    nOpen = nOpen + nClose+3; 
     185 
     186                nClose = str.indexOf('}', nClose+1); 
     187 
     188                if (nOpen < 0) 
     189                { 
     190                    return nClose; 
     191                } 
     192                if (nOpen < nClose ) 
     193                { 
     194                    nClose = matchB(str, nOpen); 
     195                } 
     196            } while (nOpen < nClose); 
     197 
     198            return nClose; 
     199        } 
     200         
     201        var f = function (str) 
     202        { 
     203            switch (str.charAt(0)) 
     204            { 
     205                case 'a': 
     206                     
     207                    var data = new Array(); 
     208                    var n = parseInt( str.substring( str.indexOf(':')+1, str.indexOf(':',2) ) ); 
     209                    var arrayContent = str.substring(str.indexOf('{')+1, str.lastIndexOf('}')); 
     210                 
     211                    for (var i = 0; i < n; i++) 
     212                    { 
     213                        var pos = 0; 
     214     
     215                        /* Process Index */ 
     216                        var indexStr = arrayContent.substr(pos, arrayContent.indexOf(';')+1); 
     217                        var index = f(indexStr); 
     218                        pos = arrayContent.indexOf(';', pos)+1; 
     219                         
     220                        /* Process Content */ 
     221                        var part = null; 
     222                        switch (arrayContent.charAt(pos)) 
     223                        { 
     224                            case 'a': 
     225                                var pos_ = matchB(arrayContent, arrayContent.indexOf('{', pos))+1; 
     226                                part = arrayContent.substring(pos, pos_); 
     227                                pos = pos_; 
     228                                data[index] = f(part); 
     229                                break; 
     230                         
     231                            case 's': 
     232                                var pval = arrayContent.indexOf(':', pos+2); 
     233                                var val  = parseInt(arrayContent.substring(pos+2, pval)); 
     234                                pos = pval + val + 4; 
     235                                data[index] = arrayContent.substr(pval+2, val); 
     236                                break; 
     237     
     238                            default: 
     239                                part = arrayContent.substring(pos, arrayContent.indexOf(';', pos)+1); 
     240                                pos = arrayContent.indexOf(';', pos)+1; 
     241                                data[index] = f(part); 
     242                                break; 
     243                        } 
     244                        arrayContent = arrayContent.substr(pos); 
     245                    } 
     246                    break; 
     247                     
     248                case 's': 
     249                    var pos = str.indexOf(':', 2); 
     250                    var val = parseInt(str.substring(2,pos)); 
     251                    var data = str.substr(pos+2, val); 
     252                    str = str.substr(pos + 4 + val); 
     253                    break; 
     254     
     255                case 'i': 
     256                case 'd': 
     257                    var pos = str.indexOf(';'); 
     258                    var data = parseInt(str.substring(2,pos)); 
     259                    str = str.substr(pos + 1); 
     260                    break; 
     261                 
     262                case 'N': 
     263                    var data = null; 
     264                    str = str.substr(str.indexOf(';') + 1); 
     265                    break; 
     266     
     267                case 'b': 
     268                    var data = str.charAt(2) == '1' ? true : false; 
     269                    break; 
     270            } 
     271            return data; 
     272        } 
     273     
     274        return f(str); 
     275    } 
     276 
    173277        //Unserialize Data Method 
    174278        cConnector.prototype.unserialize = function(str) 
    175279        { 
    176                  
    177280                _thisObject = this; 
    178281                var matchB = function (str, iniPos) 
     
    187290 
    188291                nClose = (str.substr(nClose+1) == '}' || str.substr(nClose+1,1) == '}') ? nClose +1 : str.substr(nClose+1).search(/[0-9\"]\;\}/ ) + nClose + 3; 
    189  
     292                 
    190293                if (nOpen < 0) 
    191294                { 
Note: See TracChangeset for help on using the changeset viewer.