Ignore:
Timestamp:
07/13/12 14:37:48 (12 years ago)
Author:
gustavo
Message:

Ticket #2953 - Melhorar a disposição da listagem de anexos no expressoMail

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.4.2-expresso2/expressoMail1_2/js/main.js

    r6762 r6776  
    814814                          
    815815                        if (!archive && (parseInt(preferences.save_deleted_msg)) && (folder != userTrashFolder)){  
    816                                 move_msgs2(folder, msgs_number, border_ID, userTrashFolder,special_folders['Trash'],show_success_msg );  
     816                    var msgs = new Array(); 
     817                    var i = 0; 
     818                    $.each(selectedMessages, function(index, value){ 
     819                        if(value) 
     820                            msgs[i++] = index; 
     821                    }); 
     822                    msgs_number = msgs.join(); 
     823                            move_msgs2(folder, msgs_number, border_ID, userTrashFolder,special_folders['Trash'],show_success_msg );  
    817824                                return; 
    818825        } 
     
    21632170                                    var attach = {}; 
    21642171                                    attach.fileName =  attachments[i].text.substring(0, attachments[i].text.lastIndexOf('(')); 
    2165  
    2166                                     if(attach.fileName.length > 45) 
    2167                                         attach.fileName = attach.fileName.substr(0, 32) + " ... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); 
     2172                    attach.fullFileName = attach.fileName; 
     2173                                    if(attach.fileName.length > 20) 
     2174                                        attach.fileName = attach.fileName.substr(0, 17) + " ... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); 
    21682175 
    21692176                                    attach.fileSize =  attachments[i].text.substring(( attachments[i].text.lastIndexOf('(')+1), attachments[i].text.lastIndexOf(')')); 
    21702177 
     2178                    attach.error = false; 
     2179                    fileUploadMSG.find(' .attachments-list').show(); 
    21712180                                    var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 
    2172                                     upload.find('.status-upload').remove(); 
    2173                                     upload.find('.in-progress').remove();  
    21742181                                    upload.append('<input type="hidden" name="fileId[]" value=\''+idATT+'\'/>'); 
    2175                                     upload.find('.button.close').button({ 
    2176                                             icons: { 
    2177                                                     primary: "ui-icon-close" 
    2178                                             }, 
    2179                                             text: false 
    2180  
    2181                                     }).click(function(){ 
     2182                    upload.find(".att-box-loading").remove(); 
     2183                                    upload.find('.att-box-delete').click(function(){ 
    21822184                                            var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
    21832185                                            var content_body = RichTextEditor.getData('body_'+new_border_ID); 
     
    21952197                                            fileUploadMSG.find('.attachments-list').find('input[value="'+idAttach+'"]'); 
    21962198                                            delAttachment(new_border_ID,idAttach);  
    2197                                             $(this).parent().remove(); 
     2199                                            $(this).parent().qtip("destroy"); 
     2200                        $(this).parent().remove(); 
     2201                        if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ 
     2202                            fileUploadMSG.find(' .attachments-list').hide(); 
     2203                        } 
    21982204                                    }); 
    21992205 
    22002206                                    fileUploadMSG.find('.attachments-list').append(upload); 
     2207                    fileUploadMSG.find('.attachments-list .att-box:last').qtip({ 
     2208                        content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), 
     2209                        position: { 
     2210                            corner: { 
     2211                                tooltip: 'bottomMiddle', 
     2212                                target: 'topMiddle' 
     2213                            }, 
     2214                            adjust: { 
     2215                               resize: true, 
     2216                               scroll: true 
     2217                            } 
     2218                        }, 
     2219                        show: { 
     2220                            when: 'mouseover', // Don't specify a show event 
     2221                            ready: false // Show the tooltip when ready 
     2222                        }, 
     2223                        hide: 'mouseout', // Don't specify a hide event 
     2224                        style: { 
     2225                            border: { 
     2226                                width: 1, 
     2227                                radius: 5 
     2228                            }, 
     2229                            padding: 3,  
     2230                            textAlign: 'left', 
     2231                            tip: true, // Give it a speech bubble tip with automatic corner detection 
     2232                            name: 'blue' // Style it according to the preset 'cream' style 
     2233                        } 
     2234                    }); 
    22012235                                } 
    22022236                                else 
     
    22212255                                    var attach = {}; 
    22222256                                    attach.fileName =  arrayAttachmentsA[i].text.substring(0, arrayAttachmentsA[i].text.lastIndexOf('(')); 
    2223  
    2224                                     if(attach.fileName.length > 45) 
    2225                                         attach.fileName = attach.fileName.substr(0, 32) + " ... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); 
     2257                    attach.fullFileName = attach.fileName; 
     2258                                    if(attach.fileName.length > 20) 
     2259                                        attach.fileName = attach.fileName.substr(0, 17) + " ... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); 
    22262260 
    22272261                                    attach.fileSize =  arrayAttachmentsA[i].text.substring(( arrayAttachmentsA[i].text.lastIndexOf('(')+1), arrayAttachmentsA[i].text.lastIndexOf(')')); 
    2228  
     2262                    attach.error = false; 
     2263                    fileUploadMSG.find(' .attachments-list').show(); 
    22292264                                    var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 
    2230                                     upload.find('.status-upload').remove(); 
    2231                                     upload.find('.in-progress').remove();  
     2265                                    upload.find('.att-box-loading').remove();  
    22322266                                    upload.append('<input type="hidden" name="fileId[]" value=\''+arrayAttachments[i]+'\'/>'); 
    2233                                     upload.find('.button.close').button({ 
    2234                                             icons: { 
    2235                                                     primary: "ui-icon-close" 
    2236                                             }, 
    2237                                             text: false 
    2238  
    2239                                     }).click(function(){ 
    2240                                             var idAttach = $(this).parent().parent().find('input[name="fileId[]"]').val(); 
     2267                                    upload.find('.att-box-delete').click(function(){ 
     2268                                            var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
    22412269                                            var content_body = RichTextEditor.getData('body_'+new_border_ID); 
    22422270                                            var imagens = content_body.match(/<img[^>]*>/g); 
     
    22532281                                            fileUploadMSG.find('.attachments-list').find('input[value="'+idAttach+'"]'); 
    22542282                                            delAttachment(new_border_ID,idAttach);  
    2255                                             $(this).parent().remove(); 
     2283                                            $(this).parent().qtip("destroy"); 
     2284                        $(this).parent().remove(); 
     2285                        if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ 
     2286                            fileUploadMSG.find(' .attachments-list').hide(); 
     2287                        } 
    22562288                                    }); 
    22572289 
    22582290                                    fileUploadMSG.find('.attachments-list').append(upload); 
    2259  
     2291                    fileUploadMSG.find('.attachments-list .att-box:last').qtip({ 
     2292                        content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), 
     2293                        position: { 
     2294                            corner: { 
     2295                                tooltip: 'bottomMiddle', 
     2296                                target: 'topMiddle' 
     2297                            }, 
     2298                            adjust: { 
     2299                               resize: true, 
     2300                               scroll: true 
     2301                            } 
     2302                        }, 
     2303                        show: { 
     2304                            when: 'mouseover', // Don't specify a show event 
     2305                            ready: false // Show the tooltip when ready 
     2306                        }, 
     2307                        hide: 'mouseout', // Don't specify a hide event 
     2308                        style: { 
     2309                            border: { 
     2310                                width: 1, 
     2311                                radius: 5 
     2312                            }, 
     2313                            padding: 3,  
     2314                            textAlign: 'left', 
     2315                            tip: true, // Give it a speech bubble tip with automatic corner detection 
     2316                            name: 'blue' // Style it according to the preset 'cream' style 
     2317                        } 
     2318                    }); 
    22602319                        } 
    22612320 
     
    22752334            if((attachments[i].tagName=="SPAN") || (attachments[i].tagName=="IMG") || ((attachments[i].href.indexOf("javascript:download_local_attachment")==-1)&&(attachments[i].href.indexOf("javascript:download_attachments")==-1))) 
    22762335                    continue; 
    2277  
     2336                fileUploadMSG.find(' .attachments-list').show(); 
    22782337                var arrayAtt = attachments[i].href.replace("javascript:download_attachments(", "").replace(")", "").split(',');                                  
    22792338                var att = new Object(); 
     
    22872346 
    22882347                var attach = {}; 
     2348 
    22892349                attach.fileName =  attachments[i].text.substring(0, attachments[i].text.lastIndexOf('(')); 
    2290  
    2291                 if(attach.fileName.length > 45) 
    2292                     attach.fileName = attach.fileName.substr(0, 32) + " ... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); 
     2350                attach.fullFileName = attach.fileName; 
     2351 
     2352                if(attach.fileName.length > 20) 
     2353                    attach.fileName = attach.fileName.substr(0, 17) + " ... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); 
    22932354 
    22942355                attach.fileSize =  attachments[i].text.substring(( attachments[i].text.lastIndexOf('(')+1), attachments[i].text.lastIndexOf(')')); 
     2356                attach.error = false; 
    22952357 
    22962358                var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 
    2297                 upload.find('.status-upload').remove(); 
    2298                 upload.find('.in-progress').remove();  
    2299                 upload.find('.button.close').button({ 
    2300                         icons: { 
    2301                                 primary: "ui-icon-close" 
     2359                upload.find('.att-box-loading').remove();  
     2360                upload.find('.att-box-delete').click(function(){ 
     2361                    var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
     2362                    var content_body = RichTextEditor.getData('body_'+new_border_ID); 
     2363                    var imagens = content_body.match(/<img[^>]*>/g); 
     2364                    var att = JSON.parse(idAttach); 
     2365                    if(imagens != null) 
     2366                    {    
     2367                        for (var x = 0; x < imagens.length; x++) 
     2368                            if(imagens[x].indexOf('src="./inc/get_archive.php?msgFolder='+att.folder+'&amp;msgNumber='+att.uid+'&amp;indexPart='+att.part) !== -1) 
     2369                                content_body = content_body.replace(imagens[x],''); 
     2370 
     2371                         RichTextEditor.setData('body_'+new_border_ID,content_body);     
     2372                    }        
     2373 
     2374                    fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]'); 
     2375                    delAttachment(new_border_ID,idAttach);  
     2376                    $(this).parent().qtip("destroy"); 
     2377                    $(this).parent().remove(); 
     2378                    if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ 
     2379                        fileUploadMSG.find(' .attachments-list').hide(); 
     2380                    } 
     2381                });      
     2382 
     2383 
     2384                upload.append('<input type="hidden" name="fileId[]" value=\''+idATT+'\'/>'); 
     2385                fileUploadMSG.find('.attachments-list').append(upload); 
     2386                fileUploadMSG.find('.attachments-list .att-box:last').qtip({ 
     2387                    content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), 
     2388                    position: { 
     2389                        corner: { 
     2390                            tooltip: 'bottomMiddle', 
     2391                            target: 'topMiddle' 
    23022392                        }, 
    2303                         text: false 
    2304                 }).click(function(){ 
    2305                         var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
    2306                         var content_body = RichTextEditor.getData('body_'+new_border_ID); 
    2307                         var imagens = content_body.match(/<img[^>]*>/g); 
    2308                         var att = JSON.parse(idAttach); 
    2309                         if(imagens != null) 
    2310                         {    
    2311                             for (var x = 0; x < imagens.length; x++) 
    2312                                 if(imagens[x].indexOf('src="./inc/get_archive.php?msgFolder='+att.folder+'&amp;msgNumber='+att.uid+'&amp;indexPart='+att.part) !== -1) 
    2313                                     content_body = content_body.replace(imagens[x],''); 
    2314  
    2315                              RichTextEditor.setData('body_'+new_border_ID,content_body);     
    2316                         }        
    2317  
    2318                         fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]'); 
    2319                         delAttachment(new_border_ID,idAttach);  
    2320                         $(this).parent().remove(); 
    2321                 });      
    2322  
    2323  
    2324                 upload.find("p").append('<input type="hidden" name="fileId[]" value=\''+idATT+'\'/>'); 
    2325                 fileUploadMSG.find('.attachments-list').append(upload); 
     2393                        adjust: { 
     2394                           resize: true, 
     2395                           scroll: true 
     2396                        } 
     2397                    }, 
     2398                    show: { 
     2399                        when: 'mouseover', // Don't specify a show event 
     2400                        ready: false // Show the tooltip when ready 
     2401                    }, 
     2402                    hide: 'mouseout', // Don't specify a hide event 
     2403                    style: { 
     2404                        border: { 
     2405                            width: 1, 
     2406                            radius: 5 
     2407                        }, 
     2408                        padding: 3,  
     2409                        textAlign: 'left', 
     2410                        tip: true, // Give it a speech bubble tip with automatic corner detection 
     2411                        name: 'blue' // Style it according to the preset 'cream' style 
     2412                    } 
     2413                }); 
    23262414 
    23272415    }                    
Note: See TracChangeset for help on using the changeset viewer.