Index: /trunk/library/ckeditor/plugins/expresso/plugin.js =================================================================== --- /trunk/library/ckeditor/plugins/expresso/plugin.js (revision 6410) +++ /trunk/library/ckeditor/plugins/expresso/plugin.js (revision 6930) @@ -125,30 +125,26 @@ }, add: function (e, data) { - + var iterator = idattachbycontent; if(!maxAttachmentSize || data.files[0].size < maxAttachmentSize || is_ie) { setTimeout(function() { $('#attDisposition'+ID).val('embedded'); - data.submit(); - }, 5000); + jqXHR[iterator] = data.submit(); + }, 100); } - + fileUploadMSG.find(' .attachments-list').show(); $.each(data.files, function (index, file) { var attach = {}; attach.fullFileName = file.name; attach.fileName = file.name; - if(file.name.length > 10) - attach.fileName = file.name.substr(0, 18) + "..." + file.name.substr(file.name.length-9, file.name.length); + if(file.name.length > 20) + attach.fileName = file.name.substr(0, 17) + "..." + file.name.substr(file.name.length-9, file.name.length); attach.fileSize = formatBytes(file.size); if(maxAttachmentSize && file.size > maxAttachmentSize) attach.error = 'Tamanho de arquivo nao permitido!!' - + else + attach.error = true; var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); - upload.find('.button.close').button({ - icons: { - primary: "ui-icon-close" - }, - text: false - }).click(function(){ + upload.find('.att-box-delete').click(function(){ var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); @@ -165,49 +161,123 @@ $('.attachments-list').find('input[value="'+idAttach+'"]').remove(); delAttachment(ID, idAttach); - $(this).parent().remove(); + $(this).parent().qtip("destroy"); + $(this).parent().remove(); + if(!fileUploadMSG.find(' .attachments-list').find(".att-box").length){ + fileUploadMSG.find(' .attachments-list').hide(); + } + if(jqXHR){ + jqXHR[iterator].abort(); + } }); - fileUploadMSG.find('.attachments-list').append(upload); - - if(!maxAttachmentSize || file.size < maxAttachmentSize){ - if(data.fileInput){ - fileUploadMSG.find('.fileinput-button.new').append(data.fileInput[0]).removeClass('new'); - fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden'); - } - }else - fileUploadMSG.find(' .fileinput-button.new').removeClass('new'); - + fileUploadMSG.find('.attachments-list').append(upload); + fileUploadMSG.find('.attachments-list .att-box:last').qtip({ + content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), + position: { + corner: { + tooltip: 'bottomMiddle', + target: 'topMiddle' + }, + adjust: { + resize: true, + scroll: true, + screen: show + } + }, + show: { + when: 'mouseover', // Don't specify a show event + ready: false // Show the tooltip when ready + }, + hide: 'mouseout', // Don't specify a hide event + style: { + border: { + width: 1, + radius: 5 + }, + width: { + min: 75, + max : 1000 + }, + padding: 3, + textAlign: 'left', + tip: true, // Give it a speech bubble tip with automatic corner detection + name: (typeof(attach.error) == 'boolean' ? 'light' : 'red') // Style it according to the preset 'cream' style + } + }); + if(!maxAttachmentSize || file.size < maxAttachmentSize){ + if(data.fileInput){ + fileUploadMSG.find('.fileinput-button.new').append(data.fileInput[0]).removeClass('new'); + fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden'); + } + }else{ + fileUploadMSG.find(' .fileinput-button.new').removeClass('new'); + } CKEDITOR.instances['body_'+ID].insertHtml(''); - + idattachbycontent++; }); CKEDITOR.dialog.getCurrent().hide(); - + }, done: function(e, data){ - if(!!data.result && data.result != "[]"){ - var newAttach = data.result; - if(!newAttach.mailAttachment.error){ - if(newAttach.rollback !== false) - { - fileUploadMSG.find('.in-progress:first').parents('p').append('').find('.status-upload').addClass('ui-icon ui-icon-check'); - addAttachment(ID,newAttach['mailAttachment'][0][0].id); - var content_body = RichTextEditor.getData('body_'+ID); - var rex = new RegExp(']*\/>', 'i'); - var newImg = ''; - content_body = content_body.replace(rex,newImg); - RichTextEditor.setData('body_'+ID,content_body); - } - else - fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error'); + var attach_box = fileUploadMSG.find('.att-box-loading:first').parents('.att-box'); + var attach = { + fullFileName : attach_box.find(".att-box-fullfilename").text(), + fileSize : attach_box.find(".att-box-filesize").text(), + OK : true, + error : false + }; + if(!!data.result && data.result != "[]" ){ + var newAttach = data.result; + if(!newAttach.mailAttachment.error || newAttach.rollback !== false){ + attach_box.append(''); + addAttachment(ID,newAttach['mailAttachment'][0][0].id); + var content_body = RichTextEditor.getData('body_'+ID); + var rex = new RegExp(']*\/>', 'i'); + var newImg = ''; + content_body = content_body.replace(rex,newImg); + RichTextEditor.setData('body_'+ID,content_body); }else{ - fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append(newAttach.mailAttachment.error).addClass('message-attach-error'); - } - }else - { - fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error'); - } - fileUploadMSG.find('.in-progress:first').remove(); - + attach_box.addClass('invalid-email-box'); + attach.error = newAttach.mailAttachment.error ? newAttach.mailAttachment.error : 'Erro ao anexar...'; + } + }else { + attach_box.addClass('invalid-email-box'); + attach.error = 'Erro ao anexar...'; + } + attach_box.qtip("destroy").qtip({ + content: DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist_tooltip.ejs", {attach : attach}), + position: { + corner: { + tooltip: 'bottomMiddle', + target: 'topMiddle' + }, + adjust: { + resize: true, + scroll: true, + screen: show + } + }, + show: { + when: 'mouseover', // Don't specify a show event + ready: false // Show the tooltip when ready + }, + hide: 'mouseout', // Don't specify a hide event + style: { + border: { + width: 1, + radius: 5 + }, + width: { + min: 75, + max : 1000 + }, + padding: 3, + textAlign: 'left', + tip: true, // Give it a speech bubble tip with automatic corner detection + name: (attach.error == false ? 'blue' : 'red')// Style it according to the preset 'cream' style + } + }); + fileUploadMSG.find(' .att-box-loading:first').remove(); } }); Index: /trunk/prototype/services/ImapServiceAdapter.php =================================================================== --- /trunk/prototype/services/ImapServiceAdapter.php (revision 6882) +++ /trunk/prototype/services/ImapServiceAdapter.php (revision 6930) @@ -78,12 +78,19 @@ foreach ($result as $res) { - $response[] = array( + //monta o array padrao + $array = array( 'id' => mb_convert_encoding( $res['folder_id'], 'UTF-8', 'UTF7-IMAP' ), 'commonName' => mb_convert_encoding( $res['folder_name'], 'UTF-8' , 'UTF7-IMAP' ), 'parentFolder' => mb_convert_encoding( $res['folder_parent'], 'UTF-8' , 'UTF7-IMAP' ), 'messageCount' => array('unseen' => isset($res['folder_unseen']) ? $res['folder_unseen'] : null, 'total' => null) - ); - } - + ); + + //se existir compartilhamento para pasta compartilhada + //adicionar array de permissoes + if(isset($res['acl_share'])){ + $array['acl_share'] = $res['acl_share']; + } + $response[] = $array; + } return $response; } Index: /trunk/prototype/modules/mail/js/foldertree.js =================================================================== --- /trunk/prototype/modules/mail/js/foldertree.js (revision 6574) +++ /trunk/prototype/modules/mail/js/foldertree.js (revision 6930) @@ -116,4 +116,10 @@ cp_tree1 = tree1; cp_tree2 = tree2; + var shared_acls = {}; + + $.each(cp_tree2, function(index, value){ + shared_acls[value.id] = value.acl_share; + }); + $("#content_folders").removeClass("menu-degrade").parent().removeClass("image-menu"); var html = DataLayer.render('../prototype/modules/mail/templates/detailedfoldertree.ejs', {folders: [tree1, tree2, tree3]}); @@ -166,5 +172,6 @@ }).end().end(); - folders_html.find('[id="'+selected+'"]').children().addClass("selected").end().end().find("li:first").find(".folder").not(".head_folder,.inbox,.drafts,.sent,.spam,.trash").draggable({ + folders_html.find('[id="'+selected+'"]').children().addClass("selected"); + $(".folder").not(".head_folder").not(".shared-folders").parent().find(".folder").not(".head_folder,.inbox,.drafts,.sent,.spam,.trash").draggable({ // DRAG DE PASTAS start : function(){ @@ -280,7 +287,9 @@ url : "controller.php?"+ $.param( { action: "$this.imap_functions.move_folder", folder_to_move: folder_to_move, folder_to: folder_to } ), success : function(data){ + cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu); data = connector.unserialize(data); - if(data){ - cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu); + if(data == "Permission denied"){ + write_msg(get_lang("Permission denied")); + }else if(data){ write_msg(get_lang("The folder was successfully moved")); } @@ -292,5 +301,6 @@ } } - }).hover( + }); + $(".folder").not(".head_folder").not(".shared-folders").parent().find(".folder").hover( function(){ //CASO A LI NÃO TENHA UM eventNU FLUTUANTE AINDA, O eventNU É ADICIONADO! @@ -298,10 +308,23 @@ var folder_ = $(this); var folder_name; + var shared = { + head : false, + valid : false + }; if(folder_.parent().attr('id')){ folder_name = folder_.parent().attr('id').split(cyrus_delimiter); folder_name = folder_name[folder_name.length -1]; + shared.valid = folder_.parent().attr('id').search("user/") == 0 ? true : false; }else folder_name = "Root"; - html = DataLayer.render("../prototype/modules/mail/templates/float_folder_menu.ejs", {name_folder : folder_name}); + + if(shared.valid){ + shared.head = folder_.parent().attr('id').split(cyrus_delimiter).length == 2 ? true : false; + var folder_name_parts = folder_.parent().attr('id').split(cyrus_delimiter); + var acls = shared_acls[folder_name_parts[0]+cyrus_delimiter+folder_name_parts[1]]; + + } + + html = DataLayer.render("../prototype/modules/mail/templates/float_folder_menu.ejs", {name_folder : folder_name, flag : shared, acl : acls}); //FUNÇÃO DO eventNU FLUTUANTE EDITAR < BEGIN var esc = false; @@ -334,5 +357,11 @@ type : "POST", data : "current="+folder_id+"&rename="+new_name, - success : function(){ + success : function(data){ + data = connector.unserialize(data); + if(data == "Permission denied"){ + $(".folders-loading").removeClass("folders-loading"); + cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu); + return write_msg(get_lang("Permission denied")); + } write_msg(get_lang("The folder was successfully rename")); cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu); @@ -383,4 +412,8 @@ $(".folders-loading").removeClass("folders-loading"); return write_msg(get_lang("Mailbox does not exist")); + }else if(data == "Permission denied"){ + $(".folders-loading").removeClass("folders-loading"); + cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu); + return write_msg(get_lang("Permission denied")); } write_msg(get_lang("The folder %1 was successfully removed", folder_name)); @@ -447,4 +480,20 @@ draw_new_tree_folder(); }); + }).end().find(".float-menu-export").click(function(){ + //proxy_mensagens.export_all_messages($(this).parents("li:first").attr("id")) + + var name_box = $(this).parents("li:first").attr("id"); + var name_folder = name_box.split(cyrus_delimiter)[name_box.split(cyrus_delimiter).length-1]; + + var hand_export = function(data){ + if(!data){ + write_msg(get_lang('Error compressing messages (ZIP). Contact the administrator.')) + }else if(data["empty_folder"]){ + write_msg(get_lang("The selected folder is empty.")); + }else + download_attachments(null, null, data, null,null, name_folder +'.zip'); + } + cExecute("$this.exporteml.export_all",hand_export,"folder="+name_box); + write_msg(get_lang('You must wait while the messages will be exported...')); }); //FUNÇÃO DO eventNU FLUTUANTE NOVA PASTA < END Index: /trunk/prototype/modules/mail/templates/attachment_add_itemlist.ejs =================================================================== --- /trunk/prototype/modules/mail/templates/attachment_add_itemlist.ejs (revision 6124) +++ /trunk/prototype/modules/mail/templates/attachment_add_itemlist.ejs (revision 6930) @@ -1,16 +1,11 @@ -
- <%=data.file.fileName%> - <%=data.file.fileSize%> - - - <%if(data.file.error){%> - <%=data.file.error%> - <%}if(!data.file.error){%> - - - - <%}%> - -
-