Merge pull request #22972 from eileenmcnaughton/notice_send
[civicrm-core.git] / templates / CRM / Form / attachment.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
1188c7a8 3 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 4 | |
1188c7a8
TO
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 |
6a488035
TO
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}">
13a3d214 18 <strong><a href="{$attVal.url}"><i class="crm-i {$attVal.icon}" aria-hidden="true"></i> {$attVal.cleanName}</a></strong>
6a488035
TO
19 {if $attVal.description}&nbsp;-&nbsp;{$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}
a5359ee7 30 {if !empty($context) && $context EQ 'pcpCampaign'}
6a488035
TO
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}
a5359ee7 35 <div class="crm-accordion-wrapper {if (empty($context) || $context NEQ 'pcpCampaign') AND empty($currentAttachmentInfo)}collapsed{/if}">
f8e58ff2
EM
36 <div class="crm-accordion-header">
37 {$attachTitle}
38 </div><!-- /.crm-accordion-header -->
39 <div class="crm-accordion-body">
6a488035
TO
40 <div id="attachments">
41 <table class="form-layout-compressed">
633ce286 42 {if !empty($form.attachFile_1)}
a5359ee7 43 {if !empty($context) && $context EQ 'pcpCampaign'}
546b73ae 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>
6a488035
TO
45 {/if}
46 <tr>
47 <td class="label">{$form.attachFile_1.label}</td>
13a3d214 48 <td>{$form.attachFile_1.html}&nbsp;{$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>
643be985 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>
6a488035
TO
50 </td>
51 </tr>
9da51b0e 52 {if !empty($form.tag_1.html)}
6a488035 53 <tr>
310bbbe5
CW
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>
6a488035
TO
56 </tr>
57 {/if}
9da51b0e 58 {if !empty($tagsetInfo.file)}
310bbbe5 59 <tr>{include file="CRM/common/Tagset.tpl" tagsetType='file' tableLayout=true tagsetElementName="file_taglist_1"}</tr>
6a488035
TO
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}
22b67281 66 <tr class="attachment-fieldset solid-border-top"><td colspan="2"></td></tr>
6a488035
TO
67 <tr>
68 <td class="label">{$form.attachFile_1.label}</td>
13a3d214 69 <td>{$form.$attachName.html}&nbsp;{$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>
6a488035 70 </tr>
9da51b0e 71 {if !empty($form.$tagElement.html)}
6a488035 72 <tr>
310bbbe5
CW
73 <td class="label">{$form.$tagElement.label}</td>
74 <td><div class="crm-select-container crm-attachment-tags">{$form.$tagElement.html}</div></td>
6a488035 75 </tr>
9da51b0e 76 {/if}
77 {if !empty($tagsetInfo.file)}
310bbbe5 78 <tr>{include file="CRM/common/Tagset.tpl" tagsetType='file' tableLayout=true tagsetElementName="file_taglist_$index"}</tr>
6a488035
TO
79 {/if}
80 {/section}
81
6a488035
TO
82 {/if}
83 {if $currentAttachmentInfo}
22b67281 84 <tr class="attachment-fieldset solid-border-top"><td colspan="2"></td></tr>
6a488035
TO
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}
6414adce
CW
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>
6a488035
TO
91 {if $attVal.description}&nbsp;-&nbsp;{$attVal.description}{/if}
92 {if $attVal.deleteURLArgs}
6414adce 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>
6a488035
TO
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">&nbsp;</td>
6414adce 106 <td>{$form.is_delete_attachment.html}&nbsp;{$form.is_delete_attachment.label}
6a488035
TO
107 </td>
108 </tr>
109 {/if}
110 </table>
111 </div>
112 </div><!-- /.crm-accordion-body -->
113 </div><!-- /.crm-accordion-wrapper -->
6a488035
TO
114 {literal}
115 <script type="text/javascript">
643be985 116 CRM.$(function($) {
b50fdacc 117 var $form = $("form.{/literal}{$form.formClass}{literal}");
643be985
CW
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 });
6a488035
TO
127 </script>
128 {/literal}
129 {/if} {* edit/add if*}
6a488035 130
1ef465c2
DL
131{if $currentAttachmentInfo}
132{include file="CRM/Form/attachmentjs.tpl"}
6a488035 133{/if}
1ef465c2 134
6a488035 135{/if} {* top level if *}