| 1 | <?php |
| 2 | /** |
| 3 | * read_attachments.tpl |
| 4 | * |
| 5 | * Template used to generate the attachment list while reading a message. This |
| 6 | * template is called from the function formatAttachments() in functions/mime.php. |
| 7 | * |
| 8 | * The following variables are available in this template: |
| 9 | * $plugin_output array An array of extra output that may be added by plugin(s). |
| 10 | * $attachments - array containing info for all message attachments. Each |
| 11 | * element in the array represents a separate attachment and |
| 12 | * contains the following elements: |
| 13 | * $el['Name'] - The name of the attachment |
| 14 | * $el['Description'] - Description of the attachment |
| 15 | * $el['DefaultHREF'] - URL to the action that should occur when the name is clicked |
| 16 | * $el['DownloadHREF'] - URL to download the attachment |
| 17 | * $el['ViewHREF'] - URL to view the attachment. Empty if not available. |
| 18 | * $el['Size'] - Size of attachment in bytes. |
| 19 | * $el['ContentType'] - Content-Type of the attachment |
| 20 | * $el['OtherLinks'] - array containing links to any other actions |
| 21 | * available for this attachment that might be |
| 22 | * provided by plugins, for example. Each element represents |
| 23 | * a different action and contains the following elements: |
| 24 | * $link['HREF'] - URL to access the functionality |
| 25 | * $link['Text'] - Text representing the functionality |
| 26 | * $link['Extra'] - Any extra anchor tag attributes provided by a plugin |
| 27 | * |
| 28 | * @copyright 1999-2022 The SquirrelMail Project Team |
| 29 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 30 | * @version $Id$ |
| 31 | * @package squirrelmail |
| 32 | * @subpackage templates |
| 33 | */ |
| 34 | |
| 35 | |
| 36 | /** extract template variables **/ |
| 37 | extract($t); |
| 38 | |
| 39 | /** Begin template **/ |
| 40 | if (count($attachments)==0) { |
| 41 | # If there are no attachments, display nothing. |
| 42 | return ''; |
| 43 | } |
| 44 | |
| 45 | ?> |
| 46 | <div class="readAttachments"> |
| 47 | <table cellspacing="0" class="table2"> |
| 48 | <tr> |
| 49 | <td class="header5" colspan="5"> |
| 50 | <?php |
| 51 | echo _("Attachments"); |
| 52 | if (!empty($plugin_output['attachments_top'])) echo $plugin_output['attachments_top']; |
| 53 | ?> |
| 54 | </td> |
| 55 | </tr> |
| 56 | <?php |
| 57 | foreach ($attachments as $count=>$attachment) { |
| 58 | ?> |
| 59 | <tr class="<?php echo ($count%2 ? 'odd' : 'even'); ?>"> |
| 60 | <td class="attachName"> |
| 61 | <a href="<?php echo $attachment['DefaultHREF']; ?>"><?php echo $attachment['Name']; ?></a> |
| 62 | </td> |
| 63 | <td class="attachType"> |
| 64 | <small><?php echo $attachment['ContentType']; ?></small> |
| 65 | </td> |
| 66 | <td class="attachSize"> |
| 67 | <small><?php echo humanReadableSize($attachment['Size']); ?></small> |
| 68 | </td> |
| 69 | <td class="attachDesc"> |
| 70 | <small><?php echo $attachment['Description']; ?></small> |
| 71 | </td> |
| 72 | <td class="attachActions"> |
| 73 | <small> |
| 74 | <a href="<?php echo $attachment['DownloadHREF']; ?>"><?php echo _("Download"); ?></a> |
| 75 | <?php |
| 76 | if (!empty($attachment['ViewHREF'])) { |
| 77 | ?> |
| 78 | | |
| 79 | <a href="<?php echo $attachment['ViewHREF']; ?>"><?php echo _("View"); ?></a> |
| 80 | <?php |
| 81 | } |
| 82 | |
| 83 | foreach ($attachment['OtherLinks'] as $link) { |
| 84 | echo ' | '; |
| 85 | if (empty($link['HREF'])) |
| 86 | echo '<span ' . $link['Extra'] . '>' . $link['Text'] . '</span>'; |
| 87 | else |
| 88 | echo '<a href="' . $link['HREF'] . '" ' . $link['Extra'] . '>' . $link['Text'] . '</a>'; |
| 89 | } |
| 90 | ?> |
| 91 | </small> |
| 92 | </td> |
| 93 | </tr> |
| 94 | <?php |
| 95 | } |
| 96 | |
| 97 | if (!empty($plugin_output['attachments_bottom'])) echo $plugin_output['attachments_bottom']; |
| 98 | ?> |
| 99 | </table> |
| 100 | <table cellspacing="0" class="spacer"> |
| 101 | <tr> |
| 102 | <td> |
| 103 | </td> |
| 104 | </tr> |
| 105 | </table> |
| 106 | </div> |