[ Index ] |
|
Code source de IMP H3 (4.1.5) |
1 <script type="text/javascript"> 2 <!-- 3 4 function attachmentChanged() 5 { 6 var usedFields = 0; 7 var fields = new Array(); 8 for (var i = 0; i < document.compose.elements.length; i++) { 9 if (document.compose.elements[i].type == 'file' && 10 document.compose.elements[i].name.substr(0, 7) == 'upload_') { 11 fields[fields.length] = document.compose.elements[i]; 12 } 13 } 14 15 <?php 16 $max_attachments = $imp_compose->additionalAttachmentsAllowed(); 17 if ($max_attachments !== true): 18 ?> 19 if (fields.length == <?php echo $max_attachments ?>) { 20 return; 21 } 22 <?php endif; ?> 23 24 for (var i = 0; i < fields.length; i++) { 25 if (fields[i].value.length > 0) { 26 usedFields++; 27 } 28 } 29 30 if (usedFields == fields.length) { 31 var lastRow = document.getElementById('attachment_row_' + usedFields); 32 if (lastRow) { 33 var newRow = document.createElement('TR'); 34 newRow.id = 'attachment_row_' + (usedFields + 1); 35 var td = document.createElement('TD'); 36 newRow.appendChild(td); 37 td.align = 'left'; 38 var strong = document.createElement('STRONG'); 39 td.appendChild(strong); 40 strong.appendChild(document.createTextNode('<?php echo _("File") ?> ' + (usedFields + 1) + ':')); 41 td.appendChild(document.createTextNode(' ')); 42 var file = document.createElement('INPUT'); 43 file.type = 'file'; 44 td.appendChild(file); 45 file.name = 'upload_' + (usedFields + 1); 46 file.onchange = function() { attachmentChanged(); }; 47 file.size = 25; 48 file.className = 'fixed'; 49 td = document.createElement('TD'); 50 newRow.appendChild(td); 51 td.align = 'left'; 52 var select = document.createElement('SELECT'); 53 td.appendChild(select); 54 select.name = 'upload_disposition_' + (usedFields + 1); 55 select.options[0] = new Option('<?php echo _("Attachment") ?>', 'attachment', true); 56 select.options[1] = new Option('<?php echo _("Inline") ?>', 'inline'); 57 lastRow.parentNode.insertBefore(newRow, lastRow.nextSibling); 58 } 59 } 60 } 61 62 if (document.compose.to && document.compose.to.value == "") { 63 document.compose.to.focus(); 64 } else if (document.compose.subject.value == "") { 65 document.compose.subject.focus(); 66 } else { 67 <?php if ($rtemode): ?> 68 document.compose.editor.focus(); 69 <?php else: ?> 70 document.compose.message.focus(); 71 <?php endif; ?> 72 } 73 74 // --> 75 </script>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 12:30:07 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |