Ignore:
Timestamp:
07/10/12 14:45:02 (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/draw_api.js

    r6717 r6752  
    896896        var _mouse_out; 
    897897        var _cell; 
    898         var colGroupMain = document.getElementById("colgroup_main_"+numBox); 
    899         var colGroupHead = document.getElementById("colgroup_head_"+numBox); 
    900898        for (var r=0;r<trM.length;r++) { 
    901899                for (var c=0;c<trM[r].cells.length;c++) { 
     
    904902                        if (is_mozilla && !is_webkit) { 
    905903                                if (!emptyBody) { 
    906                                         colGroupMain.childNodes[c].setAttribute("width",colSizes[tbl][c]); 
     904                                        document.getElementById("colgroup_main_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]); 
    907905                                } 
    908                                 colGroupHead.childNodes[c].setAttribute("width",colSizes[tbl][c]); 
     906                                document.getElementById("colgroup_head_"+numBox).childNodes[c].setAttribute("width",colSizes[tbl][c]); 
    909907                                if (tbH.rows[0].cells[c].className=="th_resizable") { 
    910908                                        // lots of stupid fixes for FF to redraw cell content 
     
    921919                                } 
    922920                        } 
    923                         /* 
    924921                        else { 
    925922                                tbH.rows[0].cells[c].setAttribute("width",_cell.offsetWidth); 
    926                         }*/ 
     923                        } 
    927924                } 
    928925        } 
     
    43374334        var maxAttachmentSize = (preferences.max_attachment_size !== "" && preferences.max_attachment_size != 0) ? (parseInt(preferences.max_attachment_size.replace('M', '')) * 1048576 ) : false; 
    43384335         
     4336        content.find(".new-msg-head-data").scroll(function(){ 
     4337                $.each(fileUploadMSG.find(".attachments-list .att-box"), function(index, value){ 
     4338                        $(this).qtip("api").updatePosition(); 
     4339                }); 
     4340        }); 
     4341        $("#fileupload_msg"+ID+"_droopzone").click(function(){ 
     4342                $(this).removeClass('in hover'); 
     4343        $(this).hide(); 
     4344        $(this).prev().show(); 
     4345        }); 
    43394346        fileUploadMSG.find(".button").button().filter(".fileinput-button").find(".ui-button-text").css("margin-top", "2px").find("input:file").fileupload({ 
    4340                 //singleFileUploads : true, 
     4347                //singleFileUploads : true,fileUploadMSG 
    43414348                sequentialUploads: true,  
    43424349                type: 'post', 
     
    43444351                url: "../prototype/post.php", 
    43454352                forceIframeTransport: false, 
    4346                 dropZone : fileUploadMSG, 
     4353                dropZone : $("#fileupload_msg"+ID+"_droopzone"), 
    43474354                formData: function(form) { 
    43484355                        return [ 
     
    43684375                                }, 3000); 
    43694376                        } 
     4377                        fileUploadMSG.find(' .attachments-list').show(); 
    43704378                        $.each(data.files, function (index, file) { 
    43714379                                var attach = {}; 
    43724380                                attach.fullFileName = file.name; 
    43734381                                attach.fileName = file.name; 
    4374                                 if(file.name.length > 50) 
    4375                                         attach.fileName = file.name.substr(0, 32) + " ... " + file.name.substr(file.name.length-9, file.name.length); 
     4382                                if(file.name.length > 20) 
     4383                                        attach.fileName = file.name.substr(0, 17) + " ... " + file.name.substr(file.name.length-6, file.name.length); 
    43764384                                attach.fileSize = formatBytes(file.size); 
    43774385                                if(maxAttachmentSize && file.size > maxAttachmentSize) 
    43784386                                        attach.error = 'Tamanho de arquivo nao permitido!!' 
    4379                                  
    4380                                 var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach}));                            
    4381                                 upload.find('.button.close').button({ 
    4382                                         icons: { 
    4383                                                 primary: "ui-icon-close" 
    4384                                         }, 
    4385                                         text: false 
    4386                                 }).click(function(){ 
     4387                                else 
     4388                                        attach.error = 'Loading...';     
     4389                                var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach}));                            
     4390                                upload.find('.att-box-delete').click(function(){ 
    43874391                                        var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
    43884392                                        fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); 
    4389                                         delAttachment(ID, idAttach) 
     4393                    delAttachment(ID, idAttach); 
     4394                    $(this).parent().qtip("destroy"); 
    43904395                                        $(this).parent().remove(); 
     4396                                        if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ 
     4397                                                fileUploadMSG.find(' .attachments-list').hide(); 
     4398                                        } 
    43914399                                }); 
    4392                                  
    4393                                 fileUploadMSG.find('.attachments-list').append(upload); 
     4400                    
     4401                fileUploadMSG.find('.attachments-list').append(upload); 
     4402 
     4403                fileUploadMSG.find('.attachments-list .att-box:last').qtip({ 
     4404                        content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), 
     4405                                        position: { 
     4406                                                corner: { 
     4407                                                        tooltip: 'bottomMiddle', 
     4408                                                        target: 'topMiddle' 
     4409                                                }, 
     4410                                                adjust: { 
     4411                                       resize: true, 
     4412                                       scroll: true 
     4413                                    } 
     4414                                        }, 
     4415                                        show: { 
     4416                                                when: 'mouseover', // Don't specify a show event 
     4417                                                ready: false // Show the tooltip when ready 
     4418                                        }, 
     4419                                        hide: 'mouseout', // Don't specify a hide event 
     4420                                        style: { 
     4421                                                border: { 
     4422                                                        width: 1, 
     4423                                                        radius: 5 
     4424                                                }, 
     4425                                                padding: 5,  
     4426                                                textAlign: 'center', 
     4427                                                tip: true, // Give it a speech bubble tip with automatic corner detection 
     4428                                                name: 'blue' // Style it according to the preset 'cream' style 
     4429                                        } 
     4430                }); 
    43944431 
    43954432                                if(!maxAttachmentSize || file.size < maxAttachmentSize){ 
     
    44084445                                        if(newAttach.rollback !== false) 
    44094446                                        { 
    4410                                                 fileUploadMSG.find('.in-progress:first').parents('p').append('<input type="hidden" name="fileId[]" value="'+newAttach['mailAttachment'][0][0].id+'"/>').find('.status-upload').addClass('ui-icon ui-icon-check'); 
     4447                                                fileUploadMSG.find('.att-box-loading:first').parents('div:first').append('<input type="hidden" name="fileId[]" value="'+newAttach['mailAttachment'][0][0].id+'"/>'); 
    44114448                                                addAttachment(ID,newAttach['mailAttachment'][0][0].id); 
    44124449                                        } 
    44134450                                        else                              
    4414                                                 fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error');    
     4451                                                fileUploadMSG.find('.att-box-loading:first').parents('div:first').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error');    
    44154452                                }else{ 
    4416                                         fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append(newAttach.mailAttachment.error).addClass('message-attach-error');    
     4453                                        fileUploadMSG.find('.att-box-loading:first').parents('div:first').find('.status-upload').append(newAttach.mailAttachment.error).addClass('message-attach-error');    
    44174454                                } 
    44184455                                 
    44194456                        }else { 
    4420                                 fileUploadMSG.find(' .progress.on-complete:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error'); 
    4421                         } 
    4422             fileUploadMSG.find(' .in-progress:first').remove(); 
     4457                                fileUploadMSG.find(' .progress.on-complete:first').parents('div:first').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error'); 
     4458                        } 
     4459            fileUploadMSG.find(' .att-box-loading:first').remove(); 
    44234460                } 
    44244461        }).css({ 
     
    44494486                                        jQuery.each(selectedMessages[folder_name], function(message_number, message) {  
    44504487                                                if (message) { 
     4488                                                        fileUploadMSG.find(' .attachments-list').show();         
    44514489                                                        var att = new Object(); 
    44524490                                                        att.folder = folder_name; 
     
    44584496                                                        var attach = {}; 
    44594497                                                        attach.fileName = onceOpenedMessages[folder_name][message_number].subject + '.eml'; 
    4460                                                         if(attach.fileName.length > 45) 
    4461                                                                         attach.fileName = attach.fileName.substr(0, 32) + " ... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); 
    4462  
     4498                                                        attach.fullFileName = onceOpenedMessages[folder_name][message_number].subject + '.eml'; 
     4499                                                        if(attach.fileName.length > 20) 
     4500                                                                attach.fileName = attach.fileName.substr(0, 17) + "... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); 
     4501 
     4502                                                        attach.error = ""; 
    44634503                                                        attach.fileSize = formatBytes(onceOpenedMessages[folder_name][message_number].size); 
    44644504                                                        var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 
    4465                                                         upload.find('.status-upload').addClass('ui-icon ui-icon-check'); 
    4466                                                         upload.find('.in-progress').remove();  
     4505                                                        upload.find('.att-box-loading').remove(); 
    44674506                                                        upload.append('<input type="hidden" name="fileId[]" value=\''+idATT+'\'/>'); 
    44684507                                                         
    4469                                                         upload.find('.button.close').button({ 
    4470                                                                 icons: { 
    4471                                                                                                 primary: "ui-icon-close" 
    4472                                                                                 }, 
    4473                                                                                 text: false 
    4474                                                                 }).click(function(){ 
    4475                                                                                 var idAttach = $(this).parents("li:first").find('input[name="fileId[]"]').val(); 
    4476                                                                                 fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]'); 
    4477                                                                                 delAttachment(ID,idAttach);  
    4478                                                                                 $(this).parent().remove(); 
     4508                                                        upload.find('.att-box-delete').click(function(){ 
     4509                                                                var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
     4510                                                                fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); 
     4511                                                                delAttachment(ID,idAttach);  
     4512                                                                $(this).parent().qtip("destroy"); 
     4513                                                                $(this).parent().remove(); 
     4514                                                                if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ 
     4515                                                                        fileUploadMSG.find(' .attachments-list').hide(); 
     4516                                                                } 
    44794517                                                        });      
    44804518                                                         
    4481                                                         fileUploadMSG.find('.attachments-list').append(upload);    
     4519                                                        fileUploadMSG.find('.attachments-list').append(upload);  
     4520 
     4521                                                        upload.find('.att-box-loading').remove(); 
     4522 
     4523                                                        fileUploadMSG.find('.attachments-list .att-box:last').qtip({ 
     4524                                                content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), 
     4525                                                                position: { 
     4526                                                                        corner: { 
     4527                                                                                tooltip: 'bottomMiddle', 
     4528                                                                                target: 'topMiddle' 
     4529                                                                        }, 
     4530                                                                        adjust: { 
     4531                                                               resize: true, 
     4532                                                               scroll: true 
     4533                                                            } 
     4534                                                                }, 
     4535                                                                show: { 
     4536                                                                        when: 'mouseover', // Don't specify a show event 
     4537                                                                        ready: false // Show the tooltip when ready 
     4538                                                                }, 
     4539                                                                hide: 'mouseout', // Don't specify a hide event 
     4540                                                                style: { 
     4541                                                                        border: { 
     4542                                                                                width: 1, 
     4543                                                                                radius: 5 
     4544                                                                        }, 
     4545                                                                        padding: 5,  
     4546                                                                        textAlign: 'center', 
     4547                                                                        tip: true, // Give it a speech bubble tip with automatic corner detection 
     4548                                                                        name: 'blue' // Style it according to the preset 'cream' style 
     4549                                                                } 
     4550                                        }); 
    44824551                                                } 
    44834552                                        }); 
     
    44924561                }); 
    44934562        }); 
     4563        $(document).bind('drop dragover', function (e) { 
     4564            e.preventDefault(); 
     4565        }); 
     4566        //DRAG and DROP DE ARQUIVOS NÃO FUNCIONA NO IE 
     4567        if(!is_ie){ 
     4568                $("body").bind('dragenter', function (e) { 
     4569                    var dropZone = $("#fileupload_msg"+ID+"_droopzone"); 
     4570                var timeout = window.dropZoneTimeout; 
     4571                        dropZone.show(); 
     4572                        dropZone.prev().hide(); 
     4573                    if (!timeout) { 
     4574                        dropZone.addClass('in'); 
     4575                    } else { 
     4576                        clearTimeout(timeout); 
     4577                    } 
     4578                    if (e.target === dropZone[0]) { 
     4579                        dropZone.addClass('hover'); 
     4580                    } else { 
     4581                        dropZone.removeClass('hover'); 
     4582                    } 
     4583                    $(window).unbind('dragleave'); 
     4584                    window.dropZoneTimeout = setTimeout(function () { 
     4585                        $(window).bind('dragleave', function (e) { 
     4586                                        window.dropZoneTimeout = null; 
     4587                                dropZone.removeClass('in hover'); 
     4588                                dropZone.hide(); 
     4589                                dropZone.prev().show(); 
     4590                                }); 
     4591                    }, 1); 
     4592                }).bind('dragleave', function (e) { 
     4593                        var dropZone = $("#fileupload_msg"+ID+"_droopzone"); 
     4594                        window.dropZoneTimeout = setTimeout(function () { 
     4595                        $(window).bind('dragleave', function (e) { 
     4596                                        window.dropZoneTimeout = null; 
     4597                                dropZone.removeClass('in hover'); 
     4598                                dropZone.hide(); 
     4599                                dropZone.prev().show(); 
     4600                                }); 
     4601                    }, 1); 
     4602                }).bind('drop', function(e){ 
     4603                        var dropZone = $("#fileupload_msg"+ID+"_droopzone"); 
     4604                        window.dropZoneTimeout = null; 
     4605                dropZone.removeClass('in hover'); 
     4606                dropZone.hide(); 
     4607                dropZone.prev().show(); 
     4608                }); 
     4609        }        
    44944610        return ID; 
    44954611} 
Note: See TracChangeset for help on using the changeset viewer.