Merge pull request #4003 from civicrm/4.5
[civicrm-core.git] / templates / CRM / Custom / Form / CustomField.tpl
CommitLineData
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{assign var="element_name" value=$element.element_name}
6a488035
TO
27
28 {if $element.help_pre}
29 <tr class="custom_field-help-pre-row {$element.element_name}-row-help-pre">
30 <td>&nbsp;</td>
31 <td class="html-adjust description">{$element.help_pre}</td>
32 </tr>
33 {/if}
34 {if $element.options_per_line != 0 }
35 <tr class="custom_field-row {$element.element_name}-row">
a10979ba 36 <td class="label">{$form.$element_name.label}{if $element.help_post}{help id=$element.id file="CRM/Custom/Form/CustomField.hlp" title=$element.label}{/if}</td>
6a488035
TO
37 <td class="html-adjust">
38 {assign var="count" value="1"}
39 <table class="form-layout-compressed" style="margin-top: -0.5em;">
40 <tr>
41 {* sort by fails for option per line. Added a variable to iterate through the element array*}
42 {assign var="index" value="1"}
43 {foreach name=outer key=key item=item from=$form.$element_name}
44 {if $index < 10}
45 {assign var="index" value=`$index+1`}
46 {else}
47 <td class="labels font-light">{$form.$element_name.$key.html}</td>
48 {if $count == $element.options_per_line}
49 </tr>
50 <tr>
51 {assign var="count" value="1"}
52 {else}
53 {assign var="count" value=`$count+1`}
54 {/if}
55 {/if}
56 {/foreach}
6a488035
TO
57 </tr>
58 </table>
59 </td>
60 </tr>
61
62 {else}
63 <tr class="custom_field-row {$element.element_name}-row">
a10979ba 64 <td class="label">{$form.$element_name.label}{if $element.help_post}{help id=$element.id file="CRM/Custom/Form/CustomField.hlp" title=$element.label}{/if}</td>
6a488035
TO
65 <td class="html-adjust">
66 {if $element.data_type neq 'Date' OR ($element.data_type eq 'Date' AND $element.is_view eq 1)}
67 {$form.$element_name.html}&nbsp;
68 {elseif $element.skip_calendar NEQ true}
69 {include file="CRM/common/jcalendar.tpl" elementName=$element_name}
70 {/if}
71
4a143c04 72 {if $element.data_type eq 'File'}
6a488035 73 {if $element.element_value.data}
6414adce 74 <div class="crm-attachment-wrapper crm-entity" id="file_{$element_name}">
6a488035
TO
75 <span class="html-adjust"><br />
76 &nbsp;{ts}Attached File{/ts}: &nbsp;
1ef465c2 77 {if $element.element_value.displayURL}
6414adce 78 <a href="{$element.element_value.displayURL}" class='crm-image-popup crm-attachment'>
ebb9197b
C
79 <img src="{$element.element_value.displayURL}"
80 height = "{$element.element_value.imageThumbHeight}"
81 width="{$element.element_value.imageThumbWidth}">
82 </a>
6a488035 83 {else}
6414adce 84 <a class="crm-attachment" href="{$element.element_value.fileURL}">{$element.element_value.fileName}</a>
6a488035 85 {/if}
1ef465c2 86 {if $element.element_value.deleteURL}
6414adce 87 <a href="#" class="crm-hover-button delete-attachment" data-filename="{$element.element_value.fileName}" data-args="{$element.element_value.deleteURLArgs}" title="{ts}Delete File{/ts}"><span class="icon delete-icon"></span></a>
6a488035
TO
88 {/if}
89 </span>
1ef465c2 90 </div>
6a488035
TO
91 {/if}
92 {elseif $element.html_type eq 'Autocomplete-Select'}
93 {if $element.data_type eq 'ContactReference'}
94 {include file="CRM/Custom/Form/ContactReference.tpl"}
6a488035
TO
95 {/if}
96 {/if}
97 </td>
98 </tr>
99
100 {/if}