Import from SVN (r45945, r596)
[civicrm-core.git] / templates / CRM / Custom / Form / Preview.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.3 |
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 {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_name text=$element.help_post}{/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 {if $element.html_type eq 'Radio'}
77 <tr>
78 <td><span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('{$element_name}', '{$form.formName}'); return false;" >{ts}clear{/ts}</a>)</span></td>
79 {/if}
80 </tr>
81 </table>
82 </td>
83 </tr>
84 {else}
85 {assign var="name" value=`$element.name`}
86 {*assign var="element_name" value=$group_id|cat:_|cat:$field_id|cat:_|cat:$element.name*}
87 {assign var="element_name" value=$element.element_name}
88 <tr>
89 <td class="label">{$form.$element_name.label}{if $element.help_post}{help id=$element_name text=$element.help_post}{/if}</td>
90 <td>
91 {if $element.data_type neq 'Date'}
92 {$form.$element_name.html}&nbsp;
93 {elseif $element.skip_calendar NEQ true }
94 {include file="CRM/common/jcalendar.tpl" elementName=$element_name}
95 {/if}
96 {if $element.html_type eq 'Radio'}
97 <span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('{$element_name}', '{$form.formName}'); return false;" >{ts}clear{/ts}</a>)</span>
98 {elseif $element.html_type eq 'Autocomplete-Select'}
99 {if $element.data_type eq 'ContactReference'}
100 {include file="CRM/Custom/Form/ContactReference.tpl"}
101 {else}
102 {include file="CRM/Custom/Form/AutoComplete.tpl"}
103 {/if}
104 {/if}
105 </td>
106 {/if}
107 {/if}
108 {/foreach}
109 </table>
110 {if $cd_edit.help_post}<br /><div class="messages help">{$cd_edit.help_post}</div>{/if}
111 </fieldset>
112 {/foreach}
113 {/strip}
114 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
115 </div>
116