Changeset 6410 for trunk/library/ckeditor/plugins/expresso/plugin.js
- Timestamp:
- 06/04/12 16:28:29 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/library/ckeditor/plugins/expresso/plugin.js
r6074 r6410 63 63 CKEDITOR.dialog.add( 'imgDialog', function( api ) 64 64 { 65 65 var ID = currentTab; 66 66 // CKEDITOR.dialog.definition 67 67 var dialogDefinition = 68 68 { 69 69 70 70 title : 'Inserir Imagem', 71 71 minWidth : 400, 72 72 minHeight : 70, … … 82 82 { 83 83 type : 'html', 84 html : '<form id="fileupload_img'+ID+'" class="fileupload" action="mailAttachment:img" method="POST"> <input type="file" name="files[]" multiple="" onclick="bindFileUpload();" style="margin-left:10px"></form>'84 html : '<form id="fileupload_img'+ID+'" class="fileupload" action="mailAttachment:img" method="POST"> <input type="file" name="files[]" onclick="bindFileUpload(this);" style="margin-left:10px"></form>' 85 85 } 86 86 ] … … 100 100 function bindFileUpload(e) { 101 101 var ID = currentTab; 102 var newImageId = new Date().getTime(); 103 var fileUploadIMG = $('#fileupload_img'+ID); 102 var fileUploadIMG = $(e).parents('form'); 104 103 var fileUploadMSG = $('#fileupload_msg'+ID); 105 104 var maxAttachmentSize = (preferences.max_attachment_size !== "" && preferences.max_attachment_size != 0) ? (parseInt(preferences.max_attachment_size.replace('M', '')) * 1048576 ) : false; … … 133 132 }, 5000); 134 133 } 135 136 }, 137 change: function (e, data) { 134 138 135 $.each(data.files, function (index, file) { 139 136 var attach = {}; … … 146 143 attach.error = 'Tamanho de arquivo nao permitido!!' 147 144 148 fileUploadMSG.find('.attachments-list').append(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 149 150 if(!maxAttachmentSize || file.size < maxAttachmentSize){ 151 fileUploadMSG.find(' .fileinput-button.new').append(data.fileInput[0]).removeClass('new'); 152 fileUploadMSG.find(' .attachments-list').find('[type=file]').addClass('hidden'); 153 154 }else 155 fileUploadMSG.find(' .fileinput-button.new').removeClass('new'); 156 157 158 fileUploadMSG.find(' .attachments-list').find('.button.close').button({ 145 var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 146 147 upload.find('.button.close').button({ 159 148 icons: { 160 149 primary: "ui-icon-close" … … 164 153 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 165 154 166 167 155 var content_body = RichTextEditor.getData('body_'+ID); 156 var imagens = content_body.match(/<img[^>]*>/g); 168 157 169 170 171 172 158 if(imagens != null) 159 for (var x = 0; x < imagens.length; x++) 160 if(imagens[x].indexOf('src="../prototype/getArchive.php?mailAttachment='+idAttach+'"') !== -1) 161 content_body = content_body.replace(imagens[x],''); 173 162 174 163 RichTextEditor.setData('body_'+ID,content_body); 175 164 176 177 165 $('.attachments-list').find('input[value="'+idAttach+'"]').remove(); 166 delAttachment(ID, idAttach); 178 167 $(this).parent().remove(); 179 168 }); 180 169 181 CKEDITOR.instances['body_'+ID].insertHtml('<img id="'+newImageId+'" src=""/>'); 182 183 }); 170 fileUploadMSG.find('.attachments-list').append(upload); 171 172 if(!maxAttachmentSize || file.size < maxAttachmentSize){ 173 if(data.fileInput){ 174 fileUploadMSG.find('.fileinput-button.new').append(data.fileInput[0]).removeClass('new'); 175 fileUploadMSG.find('.attachments-list').find('[type=file]').addClass('hidden'); 176 } 177 }else 178 fileUploadMSG.find(' .fileinput-button.new').removeClass('new'); 179 180 CKEDITOR.instances['body_'+ID].insertHtml('<img src=""/>'); 181 182 }); 184 183 185 CKEDITOR.dialog.getCurrent().hide(); 186 }, 184 CKEDITOR.dialog.getCurrent().hide(); 185 186 }, 187 187 done: function(e, data){ 188 188 if(!!data.result && data.result != "[]"){ … … 194 194 addAttachment(ID,newAttach['mailAttachment'][0][0].id); 195 195 var content_body = RichTextEditor.getData('body_'+ID); 196 var rex = new RegExp('<img id="'+newImageId+'"src="" [^\/>]*\/>', 'i');196 var rex = new RegExp('<img src="" [^\/>]*\/>', 'i'); 197 197 var newImg = '<img src="../prototype/getArchive.php?mailAttachment='+newAttach['mailAttachment'][0][0].id+'" />'; 198 198 content_body = content_body.replace(rex,newImg); … … 204 204 fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append(newAttach.mailAttachment.error).addClass('message-attach-error'); 205 205 } 206 }else { 207 fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error'); 206 }else 207 { 208 fileUploadMSG.find('.in-progress:first').parents('p').find('.status-upload').append('Erro ao fazer upload!').addClass('message-attach-error'); 208 209 } 209 210 fileUploadMSG.find('.in-progress:first').remove();
Note: See TracChangeset
for help on using the changeset viewer.