Merge pull request #2744 from pratik-joshi/CRM-13992_temp_fix
[civicrm-core.git] / templates / CRM / Custom / Form / Preview.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
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 {capture assign=infoTitle}{ts}Preview Mode{/ts}{/capture}
27 {assign var="infoType" value="info"}
28 {if $preview_type eq 'group'}
29 {capture assign=infoMessage}{ts}Showing the custom data group (fieldset) as it will be displayed within an edit form.{/ts}{/capture}
30 {capture name=legend}
31 {foreach from=$groupTree item=fieldName}
32 {$fieldName.title}
33 {/foreach}
34 {/capture}
35 {else}
36 {capture assign=infoMessage}{ts}Showing this field as it will be displayed in an edit form.{/ts}{/capture}
37 {/if}
38 {include file="CRM/common/info.tpl"}
39 <div class="crm-block crm-form-block crm-custom-preview-form-block">
40 {strip}
41
42 {foreach from=$groupTree item=cd_edit key=group_id}
43 <p></p>
44 <fieldset>{if $preview_type eq 'group'}<legend>{$smarty.capture.legend}</legend>{/if}
45 {if $cd_edit.help_pre}<div class="messages help">{$cd_edit.help_pre}</div><br />{/if}
46 <table class="form-layout-compressed">
47 {foreach from=$cd_edit.fields item=element key=field_id}
48 {if $element.is_view eq 0}{* fix for CRM-2699 *}
49 {if $element.help_pre}
50 <tr><td class="label"></td><td class="description">{$element.help_pre}</td></tr>
51 {/if}
52 {if $element.options_per_line }
53 {*assign var="element_name" value=$element.custom_group_id|cat:_|cat:$field_id|cat:_|cat:$element.name*}
54 {assign var="element_name" value=$element.element_name}
55 <tr>
56 <td class="label">{$form.$element_name.label}{if $element.help_post}{help id=$element.id file="CRM/Custom/Form/CustomField.hlp" title=$form.$element_name.label}{/if}</td>
57 <td>
58 {assign var="count" value="1"}
59 <table class="form-layout-compressed">
60 <tr>
61 {* sort by fails for option per line. Added a variable to iterate through the element array*}
62 {assign var="index" value="1"}
63 {foreach name=outer key=key item=item from=$form.$element_name}
64 {if $index < 10}
65 {assign var="index" value=`$index+1`}
66 {else}
67 <td class="labels font-light">{$form.$element_name.$key.html}</td>
68 {if $count == $element.options_per_line}
69 {assign var="count" value="1"}
70 </tr>
71 {else}
72 {assign var="count" value=`$count+1`}
73 {/if}
74 {/if}
75 {/foreach}
76 </tr>
77 </table>
78 </td>
79 </tr>
80 {else}
81 {assign var="name" value=`$element.name`}
82 {*assign var="element_name" value=$group_id|cat:_|cat:$field_id|cat:_|cat:$element.name*}
83 {assign var="element_name" value=$element.element_name}
84 <tr>
85 <td class="label">{$form.$element_name.label}{if $element.help_post}{help id=$element.id file="CRM/Custom/Form/CustomField.hlp" title=$form.$element_name.label}{/if}</td>
86 <td>
87 {if $element.data_type neq 'Date'}
88 {$form.$element_name.html}&nbsp;
89 {elseif $element.skip_calendar NEQ true }
90 {include file="CRM/common/jcalendar.tpl" elementName=$element_name}
91 {/if}
92 {if $element.html_type eq 'Autocomplete-Select'}
93 {if $element.data_type eq 'ContactReference'}
94 {include file="CRM/Custom/Form/ContactReference.tpl"}
95 {/if}
96 {/if}
97 </td>
98 {/if}
99 {/if}
100 {/foreach}
101 </table>
102 {if $cd_edit.help_post}<br /><div class="messages help">{$cd_edit.help_post}</div>{/if}
103 </fieldset>
104 {/foreach}
105 {/strip}
106 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
107 </div>
108