- Timestamp:
- 07/13/12 14:37:48 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.4.2-expresso2/library/ckeditor/plugins/expresso/plugin.js
r6410 r6776 132 132 }, 5000); 133 133 } 134 134 fileUploadMSG.find(' .attachments-list').show(); 135 135 $.each(data.files, function (index, file) { 136 136 var attach = {}; 137 137 attach.fullFileName = file.name; 138 138 attach.fileName = file.name; 139 if(file.name.length > 10)140 attach.fileName = file.name.substr(0, 1 8) + "..." + 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); 141 141 attach.fileSize = formatBytes(file.size); 142 142 if(maxAttachmentSize && file.size > maxAttachmentSize) 143 143 attach.error = 'Tamanho de arquivo nao permitido!!' 144 144 else 145 attach.error = true; 145 146 var upload = $(DataLayer.render("../prototype/modules/mail/templates/attachment_add_itemlist.ejs", {file : attach})); 146 147 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(){ 153 149 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 154 150 … … 165 161 $('.attachments-list').find('input[value="'+idAttach+'"]').remove(); 166 162 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 } 168 168 }); 169 169 170 170 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 }); 172 199 if(!maxAttachmentSize || file.size < maxAttachmentSize){ 173 200 if(data.fileInput){ … … 186 213 }, 187 214 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); 203 232 }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(); 212 269 } 213 270 });
Note: See TracChangeset
for help on using the changeset viewer.