Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
819d0d41 | 3 | | CiviCRM version 4.5 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
819d0d41 | 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
6 | +--------------------------------------------------------------------+ |
7 | | This file is a part of CiviCRM. | | |
8 | | | | |
9 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
10 | | under the terms of the GNU Affero General Public License | | |
11 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
12 | | | | |
13 | | CiviCRM is distributed in the hope that it will be useful, but | | |
14 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
16 | | See the GNU Affero General Public License for more details. | | |
17 | | | | |
18 | | You should have received a copy of the GNU Affero General Public | | |
19 | | License and the CiviCRM Licensing Exception along | | |
20 | | with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
25 | *} | |
26 | {if $form.attachFile_1 OR $currentAttachmentInfo} | |
27 | {if $action EQ 4 AND $currentAttachmentInfo} {* For View action we exclude the form fields and just show any current attachments. *} | |
28 | <tr> | |
29 | <td class="label"><label>{ts}Current Attachment(s){/ts}</label></td> | |
30 | <td class="view-value"> | |
31 | {foreach from=$currentAttachmentInfo key=attKey item=attVal} | |
32 | <div id="attachStatusMesg" class="status hiddenElement"></div> | |
33 | <div id="attachFileRecord_{$attVal.fileID}"> | |
34 | <strong><a href="{$attVal.url}">{$attVal.cleanName}</a></strong> | |
35 | {if $attVal.description} - {$attVal.description}{/if} | |
36 | {if !empty($attVal.tag)} | |
37 | <br /> | |
38 | {ts}Tags{/ts}: {$attVal.tag} | |
39 | <br /> | |
40 | {/if} | |
41 | </div> | |
42 | {/foreach} | |
43 | </td> | |
44 | </tr> | |
45 | {elseif $action NEQ 4} | |
46 | {if $context EQ 'pcpCampaign'} | |
47 | {capture assign=attachTitle}{ts}Include a Picture or an Image{/ts}{/capture} | |
48 | {else} | |
49 | {capture assign=attachTitle}{ts}Attachment(s){/ts}{/capture} | |
50 | {/if} | |
51 | {if !$noexpand} | |
6414adce | 52 | <div class="crm-accordion-wrapper {if $context NEQ 'pcpCampaign' AND !$currentAttachmentInfo}collapsed{/if}"> |
6a488035 TO |
53 | <div class="crm-accordion-header"> |
54 | {$attachTitle} | |
55 | </div><!-- /.crm-accordion-header --> | |
56 | <div class="crm-accordion-body"> | |
57 | {/if} | |
58 | <div id="attachments"> | |
59 | <table class="form-layout-compressed"> | |
60 | {if $form.attachFile_1} | |
61 | {if $context EQ 'pcpCampaign'} | |
546b73ae | 62 | <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 |
63 | {/if} |
64 | <tr> | |
65 | <td class="label">{$form.attachFile_1.label}</td> | |
643be985 CW |
66 | <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}"><span class="icon close-icon"></span></a> |
67 | <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 |
68 | </td> |
69 | </tr> | |
70 | {if $form.tag_1.html} | |
71 | <tr> | |
310bbbe5 CW |
72 | <td class="label">{$form.tag_1.label}</td> |
73 | <td><div class="crm-select-container crm-attachment-tags">{$form.tag_1.html}</div></td> | |
6a488035 TO |
74 | </tr> |
75 | {/if} | |
310bbbe5 CW |
76 | {if $tagsetInfo.file} |
77 | <tr>{include file="CRM/common/Tagset.tpl" tagsetType='file' tableLayout=true tagsetElementName="file_taglist_1"}</tr> | |
6a488035 TO |
78 | {/if} |
79 | {section name=attachLoop start=2 loop=$numAttachments+1} | |
80 | {assign var=index value=$smarty.section.attachLoop.index} | |
81 | {assign var=attachName value="attachFile_"|cat:$index} | |
82 | {assign var=attachDesc value="attachDesc_"|cat:$index} | |
83 | {assign var=tagElement value="tag_"|cat:$index} | |
84 | <tr class="attachment-fieldset"><td colspan="2"></td></tr> | |
85 | <tr> | |
86 | <td class="label">{$form.attachFile_1.label}</td> | |
643be985 | 87 | <td>{$form.$attachName.html} {$form.$attachDesc.html}<a href="#" class="crm-hover-button crm-clear-attachment" style="visibility: hidden;" title="{ts}Clear{/ts}"><span class="icon close-icon"></span></a></td> |
6a488035 TO |
88 | </tr> |
89 | <tr> | |
310bbbe5 CW |
90 | <td class="label">{$form.$tagElement.label}</td> |
91 | <td><div class="crm-select-container crm-attachment-tags">{$form.$tagElement.html}</div></td> | |
6a488035 | 92 | </tr> |
310bbbe5 CW |
93 | {if $tagsetInfo.file} |
94 | <tr>{include file="CRM/common/Tagset.tpl" tagsetType='file' tableLayout=true tagsetElementName="file_taglist_$index"}</tr> | |
6a488035 TO |
95 | {/if} |
96 | {/section} | |
97 | ||
6a488035 TO |
98 | {/if} |
99 | {if $currentAttachmentInfo} | |
100 | <tr class="attachment-fieldset"><td colspan="2"></td></tr> | |
101 | <tr> | |
102 | <td class="label">{ts}Current Attachment(s){/ts}</td> | |
103 | <td class="view-value"> | |
104 | {foreach from=$currentAttachmentInfo key=attKey item=attVal} | |
6414adce CW |
105 | <div class="crm-attachment-wrapper crm-entity" id="file_{$attVal.fileID}"> |
106 | <strong><a class="crm-attachment" href="{$attVal.url}">{$attVal.cleanName}</a></strong> | |
6a488035 TO |
107 | {if $attVal.description} - {$attVal.description}{/if} |
108 | {if $attVal.deleteURLArgs} | |
6414adce | 109 | <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 |
110 | {/if} |
111 | {if !empty($attVal.tag)} | |
112 | <br/> | |
113 | {ts}Tags{/ts}: {$attVal.tag} | |
114 | <br/> | |
115 | {/if} | |
116 | </div> | |
117 | {/foreach} | |
118 | </td> | |
119 | </tr> | |
120 | <tr> | |
121 | <td class="label"> </td> | |
6414adce | 122 | <td>{$form.is_delete_attachment.html} {$form.is_delete_attachment.label} |
6a488035 TO |
123 | </td> |
124 | </tr> | |
125 | {/if} | |
126 | </table> | |
127 | </div> | |
128 | </div><!-- /.crm-accordion-body --> | |
129 | </div><!-- /.crm-accordion-wrapper --> | |
6a488035 TO |
130 | {literal} |
131 | <script type="text/javascript"> | |
643be985 CW |
132 | CRM.$(function($) { |
133 | var $form = $("#{/literal}{$form.formName}{literal}"); | |
134 | $form | |
135 | .on('click', '.crm-clear-attachment', function(e) { | |
136 | e.preventDefault(); | |
137 | $(this).css('visibility', 'hidden').closest('td').find(':input').val(''); | |
138 | }) | |
139 | .on('change', '#attachments :input', function() { | |
140 | $(this).closest('td').find('.crm-clear-attachment').css('visibility', 'visible'); | |
141 | }); | |
142 | }); | |
6a488035 TO |
143 | </script> |
144 | {/literal} | |
145 | {/if} {* edit/add if*} | |
6a488035 | 146 | |
1ef465c2 DL |
147 | {if $currentAttachmentInfo} |
148 | {include file="CRM/Form/attachmentjs.tpl"} | |
6a488035 | 149 | {/if} |
1ef465c2 | 150 | |
6a488035 TO |
151 | {/if} {* top level if *} |
152 |