2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
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 +--------------------------------------------------------------------+
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. *}
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)}
22 {ts}Tags{/ts}: {$attVal.tag}
29 {elseif $action NEQ 4}
30 {if $context EQ 'pcpCampaign'}
31 {capture assign=attachTitle}{ts}Include a Picture or an Image{/ts}{/capture}
33 {capture assign=attachTitle}{ts}Attachment(s){/ts}{/capture}
36 <div class="crm-accordion-wrapper {if $context NEQ 'pcpCampaign' AND !$currentAttachmentInfo}collapsed{/if}">
37 <div class="crm-accordion-header">
39 </div><!-- /.crm-accordion-header -->
40 <div class="crm-accordion-body">
42 <div id="attachments">
43 <table class="form-layout-compressed">
44 {if $form.attachFile_1}
45 {if $context EQ 'pcpCampaign'}
46 <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>
49 <td class="label">{$form.attachFile_1.label}</td>
50 <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>
51 <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>
56 <td class="label">{$form.tag_1.label}</td>
57 <td><div class="crm-select-container crm-attachment-tags">{$form.tag_1.html}</div></td>
61 <tr>{include file="CRM/common/Tagset.tpl" tagsetType='file' tableLayout=true tagsetElementName="file_taglist_1"}</tr>
63 {section name=attachLoop start=2 loop=$numAttachments+1}
64 {assign var=index value=$smarty.section.attachLoop.index}
65 {assign var=attachName value="attachFile_"|cat:$index}
66 {assign var=attachDesc value="attachDesc_"|cat:$index}
67 {assign var=tagElement value="tag_"|cat:$index}
68 <tr class="attachment-fieldset solid-border-top"><td colspan="2"></td></tr>
70 <td class="label">{$form.attachFile_1.label}</td>
71 <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>
74 <td class="label">{$form.$tagElement.label}</td>
75 <td><div class="crm-select-container crm-attachment-tags">{$form.$tagElement.html}</div></td>
78 <tr>{include file="CRM/common/Tagset.tpl" tagsetType='file' tableLayout=true tagsetElementName="file_taglist_$index"}</tr>
83 {if $currentAttachmentInfo}
84 <tr class="attachment-fieldset solid-border-top"><td colspan="2"></td></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>
95 {if !empty($attVal.tag)}
97 {ts}Tags{/ts}: {$attVal.tag}
105 <td class="label"> </td>
106 <td>{$form.is_delete_attachment.html} {$form.is_delete_attachment.label}
112 </div><!-- /.crm-accordion-body -->
113 </div><!-- /.crm-accordion-wrapper -->
115 <script type="text/javascript">
117 var $form = $("form.{/literal}{$form.formClass}{literal}");
119 .on('click', '.crm-clear-attachment', function(e) {
121 $(this).css('visibility', 'hidden').closest('td').find(':input').val('');
123 .on('change', '#attachments :input', function() {
124 $(this).closest('td').find('.crm-clear-attachment').css('visibility', 'visible');
129 {/if} {* edit/add if*}
131 {if $currentAttachmentInfo}
132 {include file="CRM/Form/attachmentjs.tpl"}
135 {/if} {* top level if *}