| 1 | {* |
| 2 | +--------------------------------------------------------------------+ |
| 3 | | Copyright CiviCRM LLC. All rights reserved. | |
| 4 | | | |
| 5 | | This work is published under the GNU AGPLv3 license with some | |
| 6 | | permitted exceptions and without any warranty. For full license | |
| 7 | | and copyright information, see https://civicrm.org/licensing | |
| 8 | +--------------------------------------------------------------------+ |
| 9 | *} |
| 10 | {if $form.attachFile_1 OR $currentAttachmentInfo} |
| 11 | {if $action EQ 4 AND $currentAttachmentInfo} {* For View action we exclude the form fields and just show any current attachments. *} |
| 12 | <tr> |
| 13 | <td class="label"><label>{ts}Current Attachment(s){/ts}</label></td> |
| 14 | <td class="view-value"> |
| 15 | {foreach from=$currentAttachmentInfo key=attKey item=attVal} |
| 16 | <div id="attachStatusMesg" class="status hiddenElement"></div> |
| 17 | <div id="attachFileRecord_{$attVal.fileID}"> |
| 18 | <strong><a href="{$attVal.url}"><i class="crm-i {$attVal.icon}" aria-hidden="true"></i> {$attVal.cleanName}</a></strong> |
| 19 | {if $attVal.description} - {$attVal.description}{/if} |
| 20 | {if !empty($attVal.tag)} |
| 21 | <br /> |
| 22 | {ts}Tags{/ts}: {$attVal.tag} |
| 23 | <br /> |
| 24 | {/if} |
| 25 | </div> |
| 26 | {/foreach} |
| 27 | </td> |
| 28 | </tr> |
| 29 | {elseif $action NEQ 4} |
| 30 | {if !empty($context) && $context EQ 'pcpCampaign'} |
| 31 | {capture assign=attachTitle}{ts}Include a Picture or an Image{/ts}{/capture} |
| 32 | {else} |
| 33 | {capture assign=attachTitle}{ts}Attachment(s){/ts}{/capture} |
| 34 | {/if} |
| 35 | <div class="crm-accordion-wrapper {if (empty($context) || $context NEQ 'pcpCampaign') AND empty($currentAttachmentInfo)}collapsed{/if}"> |
| 36 | <div class="crm-accordion-header"> |
| 37 | {$attachTitle} |
| 38 | </div><!-- /.crm-accordion-header --> |
| 39 | <div class="crm-accordion-body"> |
| 40 | <div id="attachments"> |
| 41 | <table class="form-layout-compressed"> |
| 42 | {if !empty($form.attachFile_1)} |
| 43 | {if !empty($context) && $context EQ 'pcpCampaign'} |
| 44 | <div class="description">{ts}You can upload a picture or image to include on your page. Your file should be in .jpg, .gif, or .png format. Recommended image size is 250 x 250 pixels. Images over 360 pixels wide will be automatically resized to fit.{/ts}</div> |
| 45 | {/if} |
| 46 | <tr> |
| 47 | <td class="label">{$form.attachFile_1.label}</td> |
| 48 | <td>{$form.attachFile_1.html} {$form.attachDesc_1.html}<a href="#" class="crm-hover-button crm-clear-attachment" style="visibility: hidden;" title="{ts}Clear{/ts}"><i class="crm-i fa-times" aria-hidden="true"></i></a> |
| 49 | <div class="description">{ts}Browse to the <strong>file</strong> you want to upload.{/ts}{if $maxAttachments GT 1} {ts 1=$maxAttachments}You can have a maximum of %1 attachment(s).{/ts}{/if} {ts 1=$config->maxFileSize}Each file must be less than %1M in size. You can also add a short description.{/ts}</div> |
| 50 | </td> |
| 51 | </tr> |
| 52 | {if !empty($form.tag_1.html)} |
| 53 | <tr> |
| 54 | <td class="label">{$form.tag_1.label}</td> |
| 55 | <td><div class="crm-select-container crm-attachment-tags">{$form.tag_1.html}</div></td> |
| 56 | </tr> |
| 57 | {/if} |
| 58 | {if !empty($tagsetInfo.file)} |
| 59 | <tr>{include file="CRM/common/Tagset.tpl" tagsetType='file' tableLayout=true tagsetElementName="file_taglist_1"}</tr> |
| 60 | {/if} |
| 61 | {section name=attachLoop start=2 loop=$numAttachments+1} |
| 62 | {assign var=index value=$smarty.section.attachLoop.index} |
| 63 | {assign var=attachName value="attachFile_"|cat:$index} |
| 64 | {assign var=attachDesc value="attachDesc_"|cat:$index} |
| 65 | {assign var=tagElement value="tag_"|cat:$index} |
| 66 | <tr class="attachment-fieldset solid-border-top"><td colspan="2"></td></tr> |
| 67 | <tr> |
| 68 | <td class="label">{$form.attachFile_1.label}</td> |
| 69 | <td>{$form.$attachName.html} {$form.$attachDesc.html}<a href="#" class="crm-hover-button crm-clear-attachment" style="visibility: hidden;" title="{ts}Clear{/ts}"><i class="crm-i fa-times" aria-hidden="true"></i></a></td> |
| 70 | </tr> |
| 71 | {if !empty($form.$tagElement.html)} |
| 72 | <tr> |
| 73 | <td class="label">{$form.$tagElement.label}</td> |
| 74 | <td><div class="crm-select-container crm-attachment-tags">{$form.$tagElement.html}</div></td> |
| 75 | </tr> |
| 76 | {/if} |
| 77 | {if !empty($tagsetInfo.file)} |
| 78 | <tr>{include file="CRM/common/Tagset.tpl" tagsetType='file' tableLayout=true tagsetElementName="file_taglist_$index"}</tr> |
| 79 | {/if} |
| 80 | {/section} |
| 81 | |
| 82 | {/if} |
| 83 | {if $currentAttachmentInfo} |
| 84 | <tr class="attachment-fieldset solid-border-top"><td colspan="2"></td></tr> |
| 85 | <tr> |
| 86 | <td class="label">{ts}Current Attachment(s){/ts}</td> |
| 87 | <td class="view-value"> |
| 88 | {foreach from=$currentAttachmentInfo key=attKey item=attVal} |
| 89 | <div class="crm-attachment-wrapper crm-entity" id="file_{$attVal.fileID}"> |
| 90 | <strong><a class="crm-attachment" href="{$attVal.url}">{$attVal.cleanName}</a></strong> |
| 91 | {if $attVal.description} - {$attVal.description}{/if} |
| 92 | {if $attVal.deleteURLArgs} |
| 93 | <a href="#" class="crm-hover-button delete-attachment" data-filename="{$attVal.cleanName}" data-args="{$attVal.deleteURLArgs}" title="{ts}Delete File{/ts}"><span class="icon delete-icon"></span></a> |
| 94 | {/if} |
| 95 | {if !empty($attVal.tag)} |
| 96 | <br/> |
| 97 | {ts}Tags{/ts}: {$attVal.tag} |
| 98 | <br/> |
| 99 | {/if} |
| 100 | </div> |
| 101 | {/foreach} |
| 102 | </td> |
| 103 | </tr> |
| 104 | <tr> |
| 105 | <td class="label"> </td> |
| 106 | <td>{$form.is_delete_attachment.html} {$form.is_delete_attachment.label} |
| 107 | </td> |
| 108 | </tr> |
| 109 | {/if} |
| 110 | </table> |
| 111 | </div> |
| 112 | </div><!-- /.crm-accordion-body --> |
| 113 | </div><!-- /.crm-accordion-wrapper --> |
| 114 | {literal} |
| 115 | <script type="text/javascript"> |
| 116 | CRM.$(function($) { |
| 117 | var $form = $("form.{/literal}{$form.formClass}{literal}"); |
| 118 | $form |
| 119 | .on('click', '.crm-clear-attachment', function(e) { |
| 120 | e.preventDefault(); |
| 121 | $(this).css('visibility', 'hidden').closest('td').find(':input').val(''); |
| 122 | }) |
| 123 | .on('change', '#attachments :input', function() { |
| 124 | $(this).closest('td').find('.crm-clear-attachment').css('visibility', 'visible'); |
| 125 | }); |
| 126 | }); |
| 127 | </script> |
| 128 | {/literal} |
| 129 | {/if} {* edit/add if*} |
| 130 | |
| 131 | {if $currentAttachmentInfo} |
| 132 | {include file="CRM/Form/attachmentjs.tpl"} |
| 133 | {/if} |
| 134 | |
| 135 | {/if} {* top level if *} |