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

Location:
sandbox/2.4.2-expresso2
Files:
3 edited

Legend:

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

    r6772 r6776  
    46654665                                                                attach.fileName = attach.fileName.substr(0, 17) + "... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); 
    46664666 
    4667                                                         attach.error = ""; 
     4667                                                        attach.error = false; 
     4668                            attach.OK = true; 
    46684669                                                        attach.fileSize = formatBytes(onceOpenedMessages[folder_name][message_number].size); 
    46694670                                                        var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 
  • 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    }                    
  • sandbox/2.4.2-expresso2/library/ckeditor/plugins/expresso/plugin.js

    r6410 r6776  
    132132                                }, 5000); 
    133133                        } 
    134  
     134            fileUploadMSG.find(' .attachments-list').show(); 
    135135                        $.each(data.files, function (index, file) {      
    136136                                var attach = {}; 
    137137                                attach.fullFileName = file.name; 
    138138                                attach.fileName = file.name; 
    139                                 if(file.name.length > 10) 
    140                                         attach.fileName = file.name.substr(0, 18) + "..." + file.name.substr(file.name.length-9, file.name.length); 
     139                                if(file.name.length > 20) 
     140                                        attach.fileName = file.name.substr(0, 17) + "..." + file.name.substr(file.name.length-9, file.name.length); 
    141141                                attach.fileSize = formatBytes(file.size); 
    142142                                if(maxAttachmentSize && file.size > maxAttachmentSize) 
    143143                                        attach.error = 'Tamanho de arquivo nao permitido!!' 
    144                                                                  
     144                                else 
     145                    attach.error = true; 
    145146                                var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach}));    
    146147 
    147                                 upload.find('.button.close').button({ 
    148                                         icons: { 
    149                                                 primary: "ui-icon-close" 
    150                                         }, 
    151                                         text: false 
    152                                 }).click(function(){ 
     148                                upload.find('.att-box-delete').click(function(){ 
    153149                                        var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
    154150                         
     
    165161                    $('.attachments-list').find('input[value="'+idAttach+'"]').remove(); 
    166162                    delAttachment(ID, idAttach); 
    167                                         $(this).parent().remove(); 
     163                                        $(this).parent().qtip("destroy"); 
     164                    $(this).parent().remove(); 
     165                    if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ 
     166                        fileUploadMSG.find(' .attachments-list').hide(); 
     167                    } 
    168168                                }); 
    169169                                 
    170170            fileUploadMSG.find('.attachments-list').append(upload); 
    171  
     171            fileUploadMSG.find('.attachments-list .att-box:last').qtip({ 
     172                content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), 
     173                position: { 
     174                    corner: { 
     175                        tooltip: 'bottomMiddle', 
     176                        target: 'topMiddle' 
     177                    }, 
     178                    adjust: { 
     179                       resize: true, 
     180                       scroll: true 
     181                    } 
     182                }, 
     183                show: { 
     184                    when: 'mouseover', // Don't specify a show event 
     185                    ready: false // Show the tooltip when ready 
     186                }, 
     187                hide: 'mouseout', // Don't specify a hide event 
     188                style: { 
     189                    border: { 
     190                        width: 1, 
     191                        radius: 5 
     192                    }, 
     193                    padding: 3,  
     194                    textAlign: 'left', 
     195                    tip: true, // Give it a speech bubble tip with automatic corner detection 
     196                    name: (typeof(attach.error) == 'boolean' ? 'light' : 'red') // Style it according to the preset 'cream' style 
     197                } 
     198            }); 
    172199                        if(!maxAttachmentSize || file.size < maxAttachmentSize){ 
    173200                                if(data.fileInput){ 
     
    186213                }, 
    187214                done: function(e, data){ 
    188                         if(!!data.result && data.result != "[]"){ 
    189                                 var newAttach = data.result; 
    190                                 if(!newAttach.mailAttachment.error){ 
    191                                         if(newAttach.rollback !== false) 
    192                                         { 
    193                                                 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'); 
    194                                                 addAttachment(ID,newAttach['mailAttachment'][0][0].id); 
    195                                                 var content_body  = RichTextEditor.getData('body_'+ID); 
    196                                                 var rex = new RegExp('<img src="" [^\/>]*\/>', 'i');  
    197                                                 var newImg = '<img src="../prototype/getArchive.php?mailAttachment='+newAttach['mailAttachment'][0][0].id+'" />';  
    198                                                 content_body = content_body.replace(rex,newImg);  
    199                                                 RichTextEditor.setData('body_'+ID,content_body);  
    200                                         } 
    201                                         else 
    202                                                 fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error');    
     215            var attach_box = fileUploadMSG.find('.att-box-loading:first').parents('.att-box'); 
     216            var attach = { 
     217                fullFileName : attach_box.find(".att-box-fullfilename").text(), 
     218                fileSize : attach_box.find(".att-box-filesize").text(), 
     219                OK : true, 
     220                error : false 
     221            }; 
     222            if(!!data.result && data.result != "[]" ){ 
     223                var newAttach = data.result;                              
     224                if(!newAttach.mailAttachment.error || newAttach.rollback !== false){ 
     225                                        attach_box.append('<input type="hidden" name="fileId[]" value="'+newAttach['mailAttachment'][0][0].id+'"/>'); 
     226                                        addAttachment(ID,newAttach['mailAttachment'][0][0].id); 
     227                                        var content_body  = RichTextEditor.getData('body_'+ID); 
     228                                        var rex = new RegExp('<img src="" [^\/>]*\/>', 'i');  
     229                                        var newImg = '<img src="../prototype/getArchive.php?mailAttachment='+newAttach['mailAttachment'][0][0].id+'" />';  
     230                                        content_body = content_body.replace(rex,newImg);  
     231                                        RichTextEditor.setData('body_'+ID,content_body);  
    203232                                }else{ 
    204                                         fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append(newAttach.mailAttachment.error).addClass('message-attach-error');    
    205                                 } 
    206                         }else  
    207                         { 
    208                 fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error');    
    209                         } 
    210                         fileUploadMSG.find('.in-progress:first').remove(); 
    211                      
     233                                        attach_box.addClass('invalid-email-box'); 
     234                    attach.error = newAttach.mailAttachment.error ? newAttach.mailAttachment.error : 'Erro ao anexar...'; 
     235                } 
     236                        }else { 
     237                attach_box.addClass('invalid-email-box'); 
     238                attach.error = 'Erro ao anexar...'; 
     239            } 
     240            attach_box.qtip("destroy").qtip({ 
     241                content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), 
     242                position: { 
     243                    corner: { 
     244                        tooltip: 'bottomMiddle', 
     245                        target: 'topMiddle' 
     246                    }, 
     247                    adjust: { 
     248                       resize: true, 
     249                       scroll: true 
     250                    } 
     251                }, 
     252                show: { 
     253                    when: 'mouseover', // Don't specify a show event 
     254                    ready: false // Show the tooltip when ready 
     255                }, 
     256                hide: 'mouseout', // Don't specify a hide event 
     257                style: { 
     258                    border: { 
     259                        width: 1, 
     260                        radius: 5 
     261                    }, 
     262                    padding: 3,  
     263                    textAlign: 'left', 
     264                    tip: true, // Give it a speech bubble tip with automatic corner detection 
     265                    name: (attach.error == false ? 'blue' : 'red')// Style it according to the preset 'cream' style 
     266                } 
     267            }); 
     268            fileUploadMSG.find(' .att-box-loading:first').remove(); 
    212269                } 
    213270        }); 
Note: See TracChangeset for help on using the changeset viewer.