Changeset 2752


Ignore:
Timestamp:
05/10/10 16:56:18 (14 years ago)
Author:
amuller
Message:

Ticket #911 - unificação do cache do connector

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/js/jscode/TreeShow.js

    r2519 r2752  
    3535                if(!expresso_offline) 
    3636                { 
    37                         expresso.connector.cacheNextRequest(1); 
    3837                        cExecute ("expressoMail1_2.imap_functions.get_folders_list&folder="+current_folder, handler_update_folders);             
    3938                } 
     
    179178                                        ttreeBox.name_folder = "root"; //or use var newpast 
    180179                                        this.name_func = "newpast"; 
    181                                         expresso.connector.purgeCache(); 
    182180                                        ttreeBox.update_folder(); 
    183181                                } 
  • trunk/expressoMail1_2/js/jscode/common_functions.js

    r2747 r2752  
    8080        remove_className(tr_message, 'selected_msg'); 
    8181        Element("td_message_unseen_"+msg_number).innerHTML = "<img src ='"+URL_SERVER+"expressoMail1_2/templates/"+template+"/images/seen.gif' title='"+get_lang('Seen')+"'>"; 
    82         expresso.connector.purgeCache(); 
    8382        return true; 
    8483} 
  • trunk/expressoMail1_2/js/jscode/draw_api_folders.js

    r2747 r2752  
    923923                tr_element.msg_sample = headers_msgs.msg_sample.body.substr(0,120) + "..."; //trecho do body que sera exibido com o assunto; 
    924924        } 
    925  
    926925        tr_element.tip = ""; 
    927926        if(headers_msgs.msg_sample && preferences.preview_msg_tip == "1") 
     
    946945                add_className(tr_element,'flagged_msg'); 
    947946 
    948         td_element1 = document.createElement("TD"); 
    949         td_element1.className = "td_msg"; 
    950         td_element1.setAttribute("width", "1%"); 
    951         chk_box_element = document.createElement("INPUT"); 
    952         chk_box_element.setAttribute("type", "checkbox"); 
    953         chk_box_element.className = "checkbox"; 
    954         chk_box_element.setAttribute("id", "check_box_message_"+headers_msgs.msg_number); 
    955         chk_box_element.onclick = function(e){ 
     947        td_element1 = createAndSet("TD",['class','width'],['td_msg','1%']); 
     948        _chkbox = createAndSet("INPUT", ['type','class','id'], ['checkbox','checkbox',"check_box_message_"+headers_msgs.msg_number]); 
     949        _chkbox.onclick = function(e){ 
    956950                if (is_ie) 
    957951                        changeBgColor(window.event,headers_msgs.msg_number); 
     
    959953                        changeBgColor(e,headers_msgs.msg_number); 
    960954        }; 
    961         td_element1.appendChild(chk_box_element); 
     955        td_element1.appendChild(_chkbox); 
    962956 
    963957        td_element2 = document.createElement("TD"); 
     
    974968        if (headers_msgs.attachment && headers_msgs.attachment.number_attachments > 0) { 
    975969                attach_name = headers_msgs.attachment.names.split(", "); 
    976                 for(var item in attach_name) 
     970                for(var item=0; item < attach_name.length; item++) 
    977971                { 
    978972                        if (url_decode(attach_name[item]) != 'smime.p7s' && url_decode(attach_name[item]) != 'smime.p7m'){ 
     
    987981                headers_msgs.Draft = ''; 
    988982                headers_msgs.Answered = ''; 
    989                 headers_msgs.Forwarded = 'F'; 
    990983        } 
    991984        else if (headers_msgs.Draft == 'X') 
     
    1001994        td_element22.id = "td_message_signed_"+headers_msgs.msg_number; 
    1002995 
    1003         //td_element23 = document.createElement("TD"); 
    1004         //td_element23.setAttribute("width", "1%"); 
    1005         //td_element23.id = "td_message_signed_"+headers_msgs.msg_number; 
    1006996        switch(headers_msgs.ContentType) 
    1007997        { 
     
    10271017        td_element23.id = "td_message_important_"+headers_msgs.msg_number; 
    10281018 
    1029         if (headers_msgs.Flagged == 'F' || (headers_msgs.Importance.toLowerCase().indexOf("high") != -1 && parseInt(preferences.use_important_flag))) 
     1019        if (headers_msgs.Flagged == 'F' || (parseInt(preferences.use_important_flag) && headers_msgs.Importance.toLowerCase().indexOf("high") != -1)) 
    10301020        { 
    10311021                td_element23.innerHTML = '<img src ="' + URL_SERVER + 'expressoMail1_2/templates/'+template+'/images/important.gif" title="'+get_lang('Important')+'">'; 
     
    11431133        td_element6.className = "td_msg"; 
    11441134        td_element6.setAttribute("width", "14%"); 
    1145         td_element6.onclick = _onclick; 
    11461135        td_element6.setAttribute("noWrap","true"); 
    11471136        td_element6.setAttribute("align", "center"); 
     1137        td_element6.onclick = _onclick; 
    11481138 
    11491139        td_element6.innerHTML = borkb(headers_msgs.Size); 
    11501140 
    1151         tr_element.appendChild(td_element1); 
    1152         tr_element.appendChild(td_element2); 
    1153         tr_element.appendChild(td_element21); 
    1154         tr_element.appendChild(td_element22); 
    1155         tr_element.appendChild(td_element23); 
    1156         tr_element.appendChild(td_element24); 
    1157         tr_element.appendChild(td_element25); 
    1158         tr_element.appendChild(td_element3); 
    1159         tr_element.appendChild(td_element4); 
    1160         tr_element.appendChild(td_element5); 
    1161         tr_element.appendChild(td_element6); 
    1162         return tr_element; 
     1141        return appendChilds(tr_element,td_element1,td_element2,td_element21,td_element22,td_element23,td_element24,td_element25,td_element3,td_element4,td_element5,td_element6); 
    11631142} 
    11641143function draw_folder(){ 
     
    11901169                tr_element = createAndSet("TR",['class'],['message_header']); 
    11911170                td_element1 = createAndSet("TD",['width'],['1%']); 
    1192                 chk_box_element = createAndSet("INPUT",['id','type','class'],["chk_box_select_all_messages","checkbox","checkbox"]); 
    1193                 chk_box_element.onclick = function(){ 
     1171                _chkbox_element = createAndSet("INPUT",['id','type','class'],["chk_box_select_all_messages","checkbox","checkbox"]); 
     1172                _chkbox_element.onclick = function(){ 
    11941173                        select_all_messages(this.checked); 
    11951174                }; 
    1196                 chk_box_element.onmouseover = function () { 
     1175                _chkbox_element.onmouseover = function () { 
    11971176                        this.title=get_lang('Select all messages.'); 
    11981177                }; 
    1199                 chk_box_element.onkeydown = function (e){ 
     1178                _chkbox_element.onkeydown = function (e){ 
    12001179                        if (is_ie) 
    12011180                        { 
     
    12101189                }; 
    12111190 
    1212                 td_element1.appendChild(chk_box_element); 
     1191                td_element1.appendChild(_chkbox_element); 
    12131192 
    12141193                td_element2 = document.createElement("TD"); 
  • trunk/expressoMail1_2/js/jscode/main.js

    r2743 r2752  
    356356                else{ 
    357357                        /* No tab avaliable, the draw_message_header hasn't finished?! */ 
    358                         expresso.connector.cacheNextRequest(); 
    359                         setTimeout('cExecute("expressoMail1_2.imap_functions.get_info_msg&msg_number='+ id_msg_read +'&msg_folder=' + current_folder+'", show_msg)',3000); 
     358                        setTimeout('expresso.connector.cacheNextRequest(); cExecute("expressoMail1_2.imap_functions.get_info_msg&msg_number='+ ID +'&msg_folder=' + current_folder+'", show_msg)',100); 
    360359                } 
    361360 
     
    457456                                update_quota(get_current_folder()); 
    458457                        }                                                
    459                          //if(data.new_msgs > 0 || data.msgs_to_delete.length > 0) 
    460                         //      purgeCache();                                            
    461458                }; 
    462459                // Update Box BgColor 
     
    465462                        updateBoxBgColor(box.childNodes); 
    466463                } 
    467                 expresso.connector.purgeCache(); 
    468464                update_menu(); 
    469465        }; 
     
    567563        if (msgs_number.length > 0 || parseInt(msgs_number) > 0) 
    568564        { 
    569                 expresso.connector.purgeCache(); 
    570565                cExecute ("expressoMail1_2.imap_functions.delete_msgs&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse, handler_delete_msgs); 
    571566        } 
     
    615610                        updateBoxBgColor(box); 
    616611                } 
    617                 expresso.connector.purgeCache(); 
    618612        }; 
    619613 
     
    798792        if (parseInt(msgs_number) > 0 || msgs_number.length > 0) 
    799793        { 
    800                 expresso.connector.purgeCache(); 
    801794                cExecute ("expressoMail1_2.imap_functions.move_messages&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+preferences.delete_and_show_previous_message, handler_move_msgs); 
    802795        } 
     
    15371530                if ((! openTab.toPreserve[ID]) && (openTab.imapUid[ID] != 0)) 
    15381531                { 
    1539                         expresso.connector.purgeCache(); 
    15401532                        cExecute ("expressoMail1_2.imap_functions.delete_msgs&folder="+openTab.imapBox[ID]+"&msgs_number="+openTab.imapUid[ID],function(data){ return; }); 
    15411533                } 
     
    20482040        if (msgs_to_set) 
    20492041        { 
    2050                 expresso.connector.purgeCache(); 
    20512042                cExecute ("expressoMail1_2.imap_functions.set_messages_flag&folder="+folder+"&msgs_to_set="+msgs_to_set+"&flag="+flag, handler_set_messages_flag); 
    20522043        } 
     
    22172208        var realyEmptyTrash=confirm(get_lang('Do you really want to empty your trash folder?')); 
    22182209        if (realyEmptyTrash){ 
    2219                 expresso.connector.purgeCache(); 
    22202210                cExecute ("expressoMail1_2.imap_functions.empty_folder&clean_folder="+"imapDefaultTrashFolder", handler_empty_trash); 
    22212211        } 
  • trunk/expressoMail1_2/templates/default/config.tpl

    r2703 r2752  
    77<!-- END header --> 
    88<!-- BEGIN body --> 
    9    <tr bgcolor="{row_on}"> 
     9   <tr bgcolor="{row_off}"> 
    1010    <td colspan="2">&nbsp;</td> 
    1111   </tr> 
    12    <tr bgcolor="{row_off}"> 
     12   <tr bgcolor="{row_on}"> 
    1313    <td colspan="2"><b>{lang_ExpressoMail_settings}</b></td> 
    1414   </tr> 
    15    <tr class="{row_on}"> 
     15   <tr class="{row_off}"> 
    1616    <td>{lang_Would_you_like_to_use_expresso_offline?}:</td> 
    1717    <td> 
     
    2222    </td> 
    2323   </tr> 
    24    <tr bgcolor="{row_off}"> 
     24   <tr bgcolor="{row_on}"> 
    2525    <td>{lang_Do_you_want_to_enable_expressoMail_log?}</td> 
    2626    <td> 
     
    3030     </select>&nbsp;&nbsp;&nbsp;path: /home/expressolivre/ 
    3131    </td> 
    32    </tr> 
    33    <tr bgcolor="{row_on}"> 
    34    <td>{lang_Do_you_want_to_cache_php_requests_in_javascript?}</td> 
    35    <td> 
    36    <select name="newsettings[expressoMail_enable_cache]"> 
    37    <option value=""{selected_expressoMail_enable_cache_False}>{lang_No}</option> 
    38    <option value="True"{selected_expressoMail_enable_cache_True}>{lang_Yes}</option> 
    39    </select> 
    40    </td> 
    4132   </tr> 
    4233   <tr bgcolor="{row_off}"> 
  • trunk/phpgwapi/js/expressoAjax/expressoAjax.js

    r2676 r2752  
    4242                this.oldY = 0; 
    4343                this.updateVersion = ""; 
    44                 this.cacheRequest = null; 
    45                 this.connectorCache = { 
    46                                 'valid' : [], 
    47                                 'result' : [] 
    48                 }; 
    49                 this.expurgatedCache = new Array(); // Data to purge from cache 
     44                this.cacheRequest = false; 
    5045 
    5146        }; 
     
    297292                        { 
    298293                                handler( expresso.connector.unserialize( data ) ); 
    299                         } 
     294                        }, 
     295                        "cache": expresso.connector.cacheRequest 
    300296                } ); 
     297                this.cacheRequest=false; 
    301298        }; 
    302299        // Cancel Request Connector 
     
    360357        var id = null; 
    361358 
    362         cConnector.prototype.queryConnectorCache = function(url,handler){ 
    363                 if (this.connectorCache.valid[url]) 
    364                 { 
    365                         handler(this.connectorCache.result[url]); 
    366                         return true; 
    367                 } 
    368                 else 
    369                         return false; 
    370         }; 
    371         cConnector.prototype.purgeCache= function(){ 
    372                 if (typeof(preferences) == "undefined" || preferences.use_cache != 'True') 
    373                         return false; 
    374                 var i; 
    375                 for (i=0; i<= this.expurgatedCache.length; i++) 
    376                 { 
    377                         this.connectorCache.valid[this.expurgatedCache[i]] = false; 
    378                         try { 
    379                         delete this.connectorCache.result[this.expurgatedCache[i]]; 
    380                         } 
    381                         catch (e) { }; 
    382                 } 
    383         }; 
    384         cConnector.prototype.cacheNextRequest = function(expiration){ 
    385                 if (typeof(expiration) == 'undefined') 
    386                         expiration=0; 
    387                 this.cacheRequest=expiration; 
    388         }; 
    389  
    390         cConnector.prototype.addToCache = function(id,data){ 
    391                 if (typeof(preferences) == "undefined" || preferences.use_cache != 'True') 
    392                         return false; 
    393                 var func = id.substr(id.lastIndexOf('.')+1); 
    394                 if (func.indexOf('&') > 0) 
    395                         func = func.substr(0,func.indexOf('&')); 
    396                 switch (this.cacheRequest){ 
    397                         // functions that enters in cache and never expires 
    398                         case 0: 
    399                                 data.cacheHit = true; 
    400                                 this.connectorCache.valid[id] = true; 
    401                                 this.connectorCache.result[id] = data; 
    402                                 break; 
    403                         case 1: 
    404                         // function that needs expire 
    405                                 this.connectorCache.valid[id] = true; 
    406                                 this.connectorCache.result[id] = data; 
    407                                 var i = this.expurgatedCache.length; 
    408                                 this.expurgatedCache[i+1] = id; 
    409                                 break; 
    410                         default: 
    411                         // no cache 
    412                                 break; 
    413                 } 
     359        cConnector.prototype.cacheNextRequest = function(){ 
     360                this.cacheRequest=true; 
    414361        }; 
    415362 
     
    430377                } 
    431378                //url = URL_DEFAULT + url; 
    432  
    433                 if (expresso.connector.queryConnectorCache(params?url+"&"+params:url,handler)) 
    434                         return; 
    435  
    436379                if(params) 
    437380                        method = "POST"; 
Note: See TracChangeset for help on using the changeset viewer.