CRM-13992 : handling multi-custom data listing, edit, add, view actions. reused profi...
[civicrm-core.git] / templates / CRM / Custom / Form / CustomData.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
232624b1 3 | CiviCRM version 4.4 |
6a488035
TO
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{* Custom Data form*}
27{if $formEdit}
4bb6b4e3
CW
28 {if $cd_edit.help_pre}
29 <div class="messages help">{$cd_edit.help_pre}</div>
30 {/if}
31 <table class="form-layout-compressed">
32 {foreach from=$cd_edit.fields item=element key=field_id}
33 {include file="CRM/Custom/Form/CustomField.tpl"}
34 {/foreach}
35 </table>
36 <div class="spacer"></div>
37 {if $cd_edit.help_post}
38 <div class="messages help">{$cd_edit.help_post}</div>
6a488035 39 {/if}
4bb6b4e3
CW
40 {if $cd_edit.is_multiple and ( ( $cd_edit.max_multiple eq '' ) or ( $cd_edit.max_multiple > 0 and $cd_edit.max_multiple >= $cgCount ) ) }
41 <div id="add-more-link-{$cgCount}" class="add-more-link-{$group_id}-{$cgCount}"><a href="#" onclick="CRM.buildCustomData('{$cd_edit.extends}',{if $cd_edit.subtype}'{$cd_edit.subtype}'{else}'{$cd_edit.extends_entity_column_id}'{/if}, '', {$cgCount}, {$group_id}, true ); return false;">{ts 1=$cd_edit.title}Add another %1 record{/ts}</a></div>
42 {/if}
43{else}
44 {foreach from=$groupTree item=cd_edit key=group_id name=custom_sets}
e41f4660
PJ
45 {if $cd_edit.is_multiple and $multiRecordDisplay eq 'single'}
46 <div id="{$cd_edit.name}">
47 {if $cd_edit.help_pre}
48 <div class="messages help">{$cd_edit.help_pre}</div>
49 {/if}
50 <table>
51 {foreach from=$cd_edit.fields item=element key=field_id}
52 {include file="CRM/Custom/Form/CustomField.tpl"}
53 {/foreach}
54 </table>
55 <div class="spacer"></div>
56 {if $cd_edit.help_post}
57 <div class="messages help">{$cd_edit.help_post}</div>
58 {/if}
59 </div>
60 {else}
61 <div id="{$cd_edit.name}" class="crm-accordion-wrapper {if $cd_edit.collapse_display and !$skipTitle}collapsed{/if}">
4bb6b4e3
CW
62 {if !$skipTitle}
63 <div class="crm-accordion-header">
64 {$cd_edit.title}
65 </div><!-- /.crm-accordion-header -->
66 {/if}
67 <div id="{$cd_edit.name}" class="crm-accordion-body">
68 {if $cd_edit.help_pre}
69 <div class="messages help">{$cd_edit.help_pre}</div>
70 {/if}
71 <table class="form-layout-compressed">
72 {foreach from=$cd_edit.fields item=element key=field_id}
73 {include file="CRM/Custom/Form/CustomField.tpl"}
74 {/foreach}
75 </table>
76 <div class="spacer"></div>
77 {if $cd_edit.help_post}
78 <div class="messages help">{$cd_edit.help_post}</div>
6a488035 79 {/if}
4bb6b4e3 80 </div>
e41f4660
PJ
81 </div>
82 {if $cd_edit.is_multiple and ( ( $cd_edit.max_multiple eq '' ) or ( $cd_edit.max_multiple > 0 and $cd_edit.max_multiple >= $cgCount ) ) }
eca160d5
CW
83 {if $skipTitle}
84 {* We don't yet support adding new records in inline-edit forms *}
85 <div class="messages help">
86 <em>{ts 1=$cd_edit.title}Click "Edit Contact" to add more %1 records{/ts}</em>
87 </div>
88 {else}
e41f4660 89 <div id="add-more-link-{$cgCount}"><a href="#" onclick="CRM.buildCustomData('{$cd_edit.extends}',{if $cd_edit.subtype}'{$cd_edit.subtype}'{else}'{$cd_edit.extends_entity_column_id}'{/if}, '', {$cgCount}, {$group_id}, true ); return false;">{ts 1=$cd_edit.title}Add another %1 record{/ts}</a></div>
eca160d5 90 {/if}
4bb6b4e3 91 {/if}
e41f4660 92 {/if}
6a488035 93 <div id="custom_group_{$group_id}_{$cgCount}"></div>
4bb6b4e3
CW
94 {/foreach}
95 <script type="text/javascript">
6a488035 96 {literal}
4bb6b4e3
CW
97 cj(function() {
98 cj().crmAccordions();
99 });
6a488035 100 {/literal}
4bb6b4e3 101 </script>
1ef465c2 102
6a488035 103{/if}
cbe8b99c
DL
104
105{include file="CRM/Form/attachmentjs.tpl"}