Merge remote-tracking branch 'upstream/4.3' into 4.3-4.4-2013-11-11-10-44-51
[civicrm-core.git] / templates / CRM / Form / attachment.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
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}&nbsp;-&nbsp;{$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}
52 <div class="crm-accordion-wrapper {if $context NEQ 'pcpCampaign'}collapsed{/if}">
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'}
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. Maximum size is 360 x 360 pixels.{/ts}</div>
63 {/if}
64 <tr>
65 <td class="label">{$form.attachFile_1.label}</td>
66 <td>{$form.attachFile_1.html}&nbsp;{$form.attachDesc_1.html}<span class="crm-clear-link">(<a href="#" onclick="clearAttachment( '#attachFile_1', '#attachDesc_1' ); return false;">{ts}clear{/ts}</a>)</span><br />
67 <span 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} Each file must be less than {$config->maxFileSize}M in size. You can also add a short description.</span>
68 </td>
69 </tr>
70 {if $form.tag_1.html}
71 <tr>
72 <td></td>
73 <td><label>{$form.tag_1.label}</label> <div class="crm-select-container crm-attachment-tags">{$form.tag_1.html}</div></td>
74 </tr>
75 {/if}
76 {if $tagsetInfo_attachment}
77 <tr><td></td><td>{include file="CRM/common/Tag.tpl" tagsetType='attachment' tagsetNumber=1 }</td></tr>
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>
87 <td>{$form.$attachName.html}&nbsp;{$form.$attachDesc.html}<span class="crm-clear-link">(<a href="#" onclick="clearAttachment( '#{$attachName}' ); return false;">{ts}clear{/ts}</a>)</span></td>
88 </tr>
89 <tr>
90 <td></td>
91 <td><label>{$form.$tagElement.label}</label> <div class="crm-select-container crm-attachment-tags">{$form.$tagElement.html}</div></td>
92 </tr>
93 {if $tagsetInfo_attachment}
94 <tr><td></td><td>{include file="CRM/common/Tag.tpl" tagsetType='attachment' tagsetNumber=$index}</td></tr>
95 {/if}
96 {/section}
97
98 {literal}
99 <script type="text/javascript">
100 cj(".crm-attachment-tags select[multiple]").crmasmSelect({
101 addItemTarget: 'bottom',
102 animate: true,
103 highlight: true,
104 sortable: true,
105 respectParents: true
106 });
107 </script>
108 {/literal}
109 {/if}
110 {if $currentAttachmentInfo}
111 <tr class="attachment-fieldset"><td colspan="2"></td></tr>
112 <tr>
113 <td class="label">{ts}Current Attachment(s){/ts}</td>
114 <td class="view-value">
115 {foreach from=$currentAttachmentInfo key=attKey item=attVal}
116 <div id="attachStatusMesg" class="status hiddenElement"></div>
117 <div id="attachFileRecord_{$attVal.fileID}">
118 <strong><a href="{$attVal.url}">{$attVal.cleanName}</a></strong>
119 {if $attVal.description}&nbsp;-&nbsp;{$attVal.description}{/if}
120 {if $attVal.deleteURLArgs}
121 <a href="#" onclick="showDeleteAttachment('{$attVal.cleanName}', '{$attVal.deleteURLArgs}', {$attVal.fileID}, '#attachStatusMesg', '#attachFileRecord_{$attVal.fileID}'); return false;" title="{ts}Delete this attachment{/ts}"><span class="icon red-icon delete-icon" style="margin:0px 0px -5px 20px" title="{ts}Delete this attachment{/ts}"></span></a>
122 {/if}
123 {if !empty($attVal.tag)}
124 <br/>
125 {ts}Tags{/ts}: {$attVal.tag}
126 <br/>
127 {/if}
128 </div>
129 {/foreach}
130 </td>
131 </tr>
132 <tr>
133 <td class="label">&nbsp;</td>
134 <td>{$form.is_delete_attachment.html}&nbsp;{$form.is_delete_attachment.label}<br />
135 <span class="description">{ts}Click the red trash-can next to a file name to delete a specific attachment. If you want to delete ALL attachments, check the box above and click Save.{/ts}</span>
136 </td>
137 </tr>
138 {/if}
139 </table>
140 </div>
141 </div><!-- /.crm-accordion-body -->
142 </div><!-- /.crm-accordion-wrapper -->
143 {if !$noexpand}
144 {literal}
145 <script type="text/javascript">
146 cj(function() {
147 cj().crmAccordions();
148 });
149 </script>
150 {/literal}
151 {/if}
152 {literal}
153 <script type="text/javascript">
154 function clearAttachment( element, desc ) {
155 cj(element).val('');
156 cj(desc).val('');
157 }
158 </script>
159 {/literal}
160 {/if} {* edit/add if*}
161
162 {if $currentAttachmentInfo}
163 {include file="CRM/Form/attachmentjs.tpl"}
164 {/if}
165
166 {/if} {* top level if *}
167