Changeset 7871


Ignore:
Timestamp:
02/07/13 14:47:57 (11 years ago)
Author:
antonio
Message:

Ticket #3343 - DFD0147 - Possibitar anexar mensagens via recurso drag-and-drop

Location:
sandbox/2.5.1-expresso2/expressoMail1_2/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.5.1-expresso2/expressoMail1_2/js/abas.js

    r7786 r7871  
    283283                                $('.upper, .lower').show(); 
    284284                        $(".lower").css("top", ($("#content_folders").height()-18) + $("#content_folders").offset().top); 
     285 
     286                // Habilitar anexar mensagem po drag-and-drop, se a aba atual for de nova mensagem: 
     287                if (openTab.type[currentTab] == tabTypes.new) 
     288                { 
     289                    var dropzone = $("#fileupload_msg" + currentTab + "_droopzone"); 
     290                    dropzone.show(); 
     291                    dropzone.prev().hide(); 
     292                    dropzone.droppable({ 
     293                        over: function (event, ui){ 
     294                            dropzone.addClass('hover in'); 
     295                            $(ui.helper).find(".draggin-folder,.draggin-mail").css("color", "green"); 
     296                        }, 
     297                        out: function (event, ui) { 
     298                            dropzone.removeClass('hover in'); 
     299                            $(ui.helper).find(".draggin-folder,.draggin-mail").css("color", ""); 
     300                        }, 
     301                        drop: function (event, ui) { 
     302                            var border_id = ui.draggable.find("input[type=hidden]").attr("name"); 
     303                            var id_msg = border_id.split("_")[0]; 
     304                            var folder = $("#input_folder_"+border_id+"_r")[0] ? $("#input_folder_"+border_id+"_r").val() : (openTab.imapBox[border_id] ? openTab.imapBox[border_id]:get_current_folder()); 
     305                            attach_message(folder, id_msg); /* Anexa a mensagem especificada (por folder e id_msg) 
     306                                                               na mensagem sendo criada.*/ 
     307                        } 
     308                    }); 
     309                } 
     310 
    285311                                if($(".shared-folders").length){ 
    286312                                        $(".shared-folders").parent().find('.folder:not(".shared-folders")').droppable({ 
     
    331357                                $('.upper, .lower').hide(); 
    332358                                $(".shared-folders").parent().find(".folder").droppable("destroy"); 
     359                if (openTab.type[currentTab] == tabTypes.new) 
     360                { 
     361                    var dropzone = $("#fileupload_msg" + currentTab + "_droopzone"); 
     362                    dropzone.hide(); 
     363                    dropzone.prev().show(); 
     364                } 
    333365                        }, 
    334366                        helper: function(event){ 
  • sandbox/2.5.1-expresso2/expressoMail1_2/js/draw_api.js

    r7858 r7871  
    47504750        }); 
    47514751} 
    4752                  
     4752 
     4753/* 
     4754    Anexa uma mensagem a mensagem sendo enviada. 
     4755    Parâmetros: 
     4756        folder_name: nome da pasta na qual a mensagem sendo anexada se encontra. 
     4757        message_number: id da mensagem sendo anexada. 
     4758*/ 
     4759function attach_message (folder_name, message_number) { 
     4760    var ID = currentTab; 
     4761    var fileUploadMSG = $('#fileupload_msg'+ID); 
     4762    fileUploadMSG.find(' .attachments-list').show(); 
     4763    var att = new Object(); 
     4764    att.folder = folder_name; 
     4765    att.uid = message_number; 
     4766    att.type = 'imapMSG'; 
     4767    /* Substituída a variável onceOpenedMessages por onceOpenedHeadersMessages, 
     4768       porque essa última contem as mesmas informações da primeira, e está em escopo global.*/ 
     4769    att.name = Base64.encode(onceOpenedHeadersMessages[folder_name][message_number].subject + '.eml'); 
     4770    var idATT = JSON.stringify(att); 
     4771    addAttachment(ID, idATT); 
     4772    var attach = {}; 
     4773    attach.fileName = onceOpenedHeadersMessages[folder_name][message_number].subject + '.eml'; 
     4774    attach.fullFileName = onceOpenedHeadersMessages[folder_name][message_number].subject + '.eml'; 
     4775    if(attach.fileName.length > 20)  
     4776    { 
     4777        attach.fileName = attach.fileName.substr(0, 17) + "... " + attach.fileName.substr(attach.fileName.length - 9, attach.fileName.length); 
     4778    } 
     4779 
     4780    attach.error = false; 
     4781    attach.OK = true; 
     4782    attach.fileSize = formatBytes(onceOpenedHeadersMessages[folder_name][message_number].Size); 
     4783    var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", { 
     4784        file: attach 
     4785    })); 
     4786    $("#content_id_" + currentTab + " .save").button("enable"); 
     4787    upload.find('.att-box-loading').remove(); 
     4788    upload.append('<input type="hidden" name="fileId[]" value=\'' + idATT + '\'/>'); 
     4789 
     4790    upload.find('.att-box-delete').click(function() 
     4791    { 
     4792        $("#content_id_" + currentTab + " .save").button("enable"); 
     4793        var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
     4794        fileUploadMSG.find(' .attachments-list').find('input[value="' + idAttach + '"]').remove(); 
     4795        delAttachment(ID, idAttach); 
     4796        $(this).parent().qtip("destroy"); 
     4797        $(this).parent().remove(); 
     4798        if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length) 
     4799        { 
     4800            fileUploadMSG.find(' .attachments-list').hide(); 
     4801        } 
     4802    }); 
     4803 
     4804    fileUploadMSG.find('.attachments-list').append(upload); 
     4805 
     4806    upload.find('.att-box-loading').remove(); 
     4807 
     4808    fileUploadMSG.find('.attachments-list .att-box:last').qtip( 
     4809    { 
     4810        content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", { 
     4811            attach: attach 
     4812        }), 
     4813        position: { 
     4814            corner: { 
     4815                tooltip: 'bottomMiddle', 
     4816                target: 'topMiddle' 
     4817            }, 
     4818            adjust: { 
     4819                resize: true, 
     4820                scroll: true 
     4821            } 
     4822        }, 
     4823        show: { 
     4824            when: 'mouseover', 
     4825            // Don't specify a show event 
     4826            ready: false // Show the tooltip when ready 
     4827        }, 
     4828        hide: 'mouseout', 
     4829        // Don't specify a hide event 
     4830        style: { 
     4831            border: { 
     4832                width: 1, 
     4833                radius: 5 
     4834            }, 
     4835            width: { 
     4836                min: 75, 
     4837                max: 1000 
     4838            }, 
     4839            padding: 5, 
     4840            textAlign: 'center', 
     4841            tip: true, 
     4842            // Give it a speech bubble tip with automatic corner detection 
     4843            name: 'blue' // Style it according to the preset 'cream' style 
     4844        } 
     4845    }); 
     4846} 
     4847 
     4848         
    47534849function draw_new_message(border_ID){ 
    47544850        connector.loadScript("color_palette"); 
     
    51385234                        autoOpen:false 
    51395235        }); 
     5236 
    51405237        jQuery.getScript("../prototype/modules/attach_message/attach_message.js", function(){ 
    51415238                jQuery('#message-attach-dialog').dialog('open'); 
     
    51445241                        jQuery.each(selectedMessages, function(folder_name, messages) { 
    51455242                                jQuery.each(selectedMessages[folder_name], function(message_number, message) {  
    5146                                         if (message) { 
    5147                                                 fileUploadMSG.find(' .attachments-list').show();         
    5148                                                 var att = new Object(); 
    5149                                                 att.folder = folder_name; 
    5150                                                 att.uid = message_number; 
    5151                                                 att.type = 'imapMSG'; 
    5152                                                 att.name = Base64.encode(onceOpenedMessages[folder_name][message_number].subject + '.eml'); 
    5153                                                 var idATT = JSON.stringify(att); 
    5154                                                 addAttachment( ID , idATT);                         
    5155                                                 var attach = {}; 
    5156                                                 attach.fileName = onceOpenedMessages[folder_name][message_number].subject + '.eml'; 
    5157                                                 attach.fullFileName = onceOpenedMessages[folder_name][message_number].subject + '.eml'; 
    5158                                                 if(attach.fileName.length > 20) 
    5159                                                         attach.fileName = attach.fileName.substr(0, 17) + "... " + attach.fileName.substr(attach.fileName.length-9, attach.fileName.length); 
    5160  
    5161                                                 attach.error = false; 
    5162                         attach.OK = true; 
    5163                                                 attach.fileSize = formatBytes(onceOpenedMessages[folder_name][message_number].size); 
    5164                                                 var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 
    5165                                                 $("#content_id_"+currentTab+" .save").button("enable"); 
    5166                         upload.find('.att-box-loading').remove(); 
    5167                                                 upload.append('<input type="hidden" name="fileId[]" value=\''+idATT+'\'/>'); 
    5168                                                  
    5169                                                 upload.find('.att-box-delete').click(function(){ 
    5170                             $("#content_id_"+currentTab+" .save").button("enable"); 
    5171                                                         var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
    5172                                                         fileUploadMSG.find(' .attachments-list').find('input[value="'+idAttach+'"]').remove(); 
    5173                                                         delAttachment(ID,idAttach);  
    5174                                                         $(this).parent().qtip("destroy"); 
    5175                                                         $(this).parent().remove(); 
    5176                                                         if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ 
    5177                                                                 fileUploadMSG.find(' .attachments-list').hide(); 
    5178                                                         } 
    5179                                                 });      
    5180                                                          
    5181                                                 fileUploadMSG.find('.attachments-list').append(upload); 
    5182  
    5183                                                 upload.find('.att-box-loading').remove(); 
    5184  
    5185                                                 fileUploadMSG.find('.attachments-list .att-box:last').qtip({ 
    5186                                         content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), 
    5187                                                         position: { 
    5188                                                                 corner: { 
    5189                                                                         tooltip: 'bottomMiddle', 
    5190                                                                         target: 'topMiddle' 
    5191                                                                 }, 
    5192                                                                 adjust: { 
    5193                                                        resize: true, 
    5194                                                        scroll: true 
    5195                                                     } 
    5196                                                         }, 
    5197                                                         show: { 
    5198                                                                 when: 'mouseover', // Don't specify a show event 
    5199                                                                 ready: false // Show the tooltip when ready 
    5200                                                         }, 
    5201                                                         hide: 'mouseout', // Don't specify a hide event 
    5202                                                         style: { 
    5203                                                                 border: { 
    5204                                                                         width: 1, 
    5205                                                                         radius: 5 
    5206                                                                 }, 
    5207                                                                 width: { 
    5208                                                                          min: 75, 
    5209                                                                          max : 1000 
    5210                                                                 }, 
    5211                                                                 padding: 5,  
    5212                                                                 textAlign: 'center', 
    5213                                                                 tip: true, // Give it a speech bubble tip with automatic corner detection 
    5214                                                                 name: 'blue' // Style it according to the preset 'cream' style 
    5215                                                         } 
    5216                                 }); 
    5217                                         } 
     5243                    if (message) 
     5244                    { 
     5245                        /* Anexa a mensagem especificada (por folder e id_msg) 
     5246                           na mensagem sendo criada.*/ 
     5247                        attach_message(folder_name, message_number); 
     5248                    } 
    52185249                                }); 
    52195250                        }); 
Note: See TracChangeset for help on using the changeset viewer.