Commit | Line | Data |
---|---|---|
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} - {$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 CW |
35 | {if empty($noexpand)} |
36 | <div class="crm-accordion-wrapper {if (empty($context) || $context NEQ 'pcpCampaign') AND empty($currentAttachmentInfo)}collapsed{/if}"> | |
6a488035 TO |
37 | <div class="crm-accordion-header"> |
38 | {$attachTitle} | |
39 | </div><!-- /.crm-accordion-header --> | |
40 | <div class="crm-accordion-body"> | |
41 | {/if} | |
42 | <div id="attachments"> | |
43 | <table class="form-layout-compressed"> | |
633ce286 | 44 | {if !empty($form.attachFile_1)} |
a5359ee7 | 45 | {if !empty($context) && $context EQ 'pcpCampaign'} |
546b73ae | 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> |
6a488035 TO |
47 | {/if} |
48 | <tr> | |
49 | <td class="label">{$form.attachFile_1.label}</td> | |
13a3d214 | 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> |
643be985 | 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> |
6a488035 TO |
52 | </td> |
53 | </tr> | |
9da51b0e | 54 | {if !empty($form.tag_1.html)} |
6a488035 | 55 | <tr> |
310bbbe5 CW |
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> | |
6a488035 TO |
58 | </tr> |
59 | {/if} | |
9da51b0e | 60 | {if !empty($tagsetInfo.file)} |
310bbbe5 | 61 | <tr>{include file="CRM/common/Tagset.tpl" tagsetType='file' tableLayout=true tagsetElementName="file_taglist_1"}</tr> |
6a488035 TO |
62 | {/if} |
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} | |
22b67281 | 68 | <tr class="attachment-fieldset solid-border-top"><td colspan="2"></td></tr> |
6a488035 TO |
69 | <tr> |
70 | <td class="label">{$form.attachFile_1.label}</td> | |
13a3d214 | 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> |
6a488035 | 72 | </tr> |
9da51b0e | 73 | {if !empty($form.$tagElement.html)} |
6a488035 | 74 | <tr> |
310bbbe5 CW |
75 | <td class="label">{$form.$tagElement.label}</td> |
76 | <td><div class="crm-select-container crm-attachment-tags">{$form.$tagElement.html}</div></td> | |
6a488035 | 77 | </tr> |
9da51b0e | 78 | {/if} |
79 | {if !empty($tagsetInfo.file)} | |
310bbbe5 | 80 | <tr>{include file="CRM/common/Tagset.tpl" tagsetType='file' tableLayout=true tagsetElementName="file_taglist_$index"}</tr> |
6a488035 TO |
81 | {/if} |
82 | {/section} | |
83 | ||
6a488035 TO |
84 | {/if} |
85 | {if $currentAttachmentInfo} | |
22b67281 | 86 | <tr class="attachment-fieldset solid-border-top"><td colspan="2"></td></tr> |
6a488035 TO |
87 | <tr> |
88 | <td class="label">{ts}Current Attachment(s){/ts}</td> | |
89 | <td class="view-value"> | |
90 | {foreach from=$currentAttachmentInfo key=attKey item=attVal} | |
6414adce CW |
91 | <div class="crm-attachment-wrapper crm-entity" id="file_{$attVal.fileID}"> |
92 | <strong><a class="crm-attachment" href="{$attVal.url}">{$attVal.cleanName}</a></strong> | |
6a488035 TO |
93 | {if $attVal.description} - {$attVal.description}{/if} |
94 | {if $attVal.deleteURLArgs} | |
6414adce | 95 | <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 |
96 | {/if} |
97 | {if !empty($attVal.tag)} | |
98 | <br/> | |
99 | {ts}Tags{/ts}: {$attVal.tag} | |
100 | <br/> | |
101 | {/if} | |
102 | </div> | |
103 | {/foreach} | |
104 | </td> | |
105 | </tr> | |
106 | <tr> | |
107 | <td class="label"> </td> | |
6414adce | 108 | <td>{$form.is_delete_attachment.html} {$form.is_delete_attachment.label} |
6a488035 TO |
109 | </td> |
110 | </tr> | |
111 | {/if} | |
112 | </table> | |
113 | </div> | |
114 | </div><!-- /.crm-accordion-body --> | |
115 | </div><!-- /.crm-accordion-wrapper --> | |
6a488035 TO |
116 | {literal} |
117 | <script type="text/javascript"> | |
643be985 | 118 | CRM.$(function($) { |
b50fdacc | 119 | var $form = $("form.{/literal}{$form.formClass}{literal}"); |
643be985 CW |
120 | $form |
121 | .on('click', '.crm-clear-attachment', function(e) { | |
122 | e.preventDefault(); | |
123 | $(this).css('visibility', 'hidden').closest('td').find(':input').val(''); | |
124 | }) | |
125 | .on('change', '#attachments :input', function() { | |
126 | $(this).closest('td').find('.crm-clear-attachment').css('visibility', 'visible'); | |
127 | }); | |
128 | }); | |
6a488035 TO |
129 | </script> |
130 | {/literal} | |
131 | {/if} {* edit/add if*} | |
6a488035 | 132 | |
1ef465c2 DL |
133 | {if $currentAttachmentInfo} |
134 | {include file="CRM/Form/attachmentjs.tpl"} | |
6a488035 | 135 | {/if} |
1ef465c2 | 136 | |
6a488035 | 137 | {/if} {* top level if *} |