Commit | Line | Data |
---|---|---|
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 | {if $showListing} | |
e41f4660 PJ |
27 | {if $dontShowTitle neq 1}<h1>{ts}{$customGroupTitle}{/ts}</h1>{/if} |
28 | {if $pageViewType eq 'customDataView'} | |
29 | {assign var='dialogId' value='custom-record-dialog'} | |
30 | {else} | |
31 | {assign var='dialogId' value='profile-dialog'} | |
32 | {/if} | |
f8c36033 | 33 | {if $records and $headers} |
6a488035 | 34 | {include file="CRM/common/jsortable.tpl"} |
f8c36033 KJ |
35 | <div id="browseValues"> |
36 | <div> | |
6a488035 TO |
37 | {strip} |
38 | <table id="records" class="display"> | |
f8c36033 | 39 | <thead> |
7253f198 | 40 | <tr> |
f8c36033 KJ |
41 | {foreach from=$headers key=recId item=head} |
42 | <th>{ts}{$head}{/ts}</th> | |
7253f198 | 43 | {/foreach} |
f8c36033 | 44 | <th></th> |
7253f198 | 45 | </tr> |
f8c36033 KJ |
46 | </thead> |
47 | {foreach from=$records key=recId item=rows} | |
48 | <tr class="{cycle values="odd-row,even-row"}"> | |
49 | {foreach from=$headers key=hrecId item=head} | |
50 | <td>{$rows.$hrecId}</td> | |
51 | {/foreach} | |
52 | <td>{$rows.action}</td> | |
53 | </tr> | |
6a488035 | 54 | {/foreach} |
6a488035 TO |
55 | </table> |
56 | {/strip} | |
6a488035 | 57 | </div> |
f8c36033 | 58 | </div> |
e41f4660 | 59 | <div id='{$dialogId}' class="hiddenElement"></div> |
f8c36033 KJ |
60 | {elseif !$records} |
61 | <div class="messages status no-popup"> | |
62 | <div class="icon inform-icon"></div> | |
63 | | |
e5e3f1ad | 64 | {ts 1=$customGroupTitle}No records of type '%1' found.{/ts} |
f8c36033 | 65 | </div> |
e41f4660 | 66 | <div id='{$dialogId}' class="hiddenElement"></div> |
f8c36033 | 67 | {/if} |
6a488035 | 68 | |
f8c36033 | 69 | {if !$reachedMax} |
e41f4660 | 70 | {if $pageViewType eq 'customDataView'} |
1dde099b | 71 | <br/><a accesskey="N" title="{ts 1=$customGroupTitle}Add %1 Record{/ts}" href="{crmURL p='civicrm/contact/view/cd/edit' q="reset=1&snippet=1&type=$ctype&groupID=$customGroupId&entityID=$contactId&cgcount=$cgcount&multiRecordDisplay=single"}" |
e41f4660 PJ |
72 | class="button action-item"><span><div class="icon add-icon"></div>{ts 1=$customGroupTitle}Add %1 Record{/ts}</span></a> |
73 | {else} | |
74 | <a accesskey="N" href="{crmURL p='civicrm/profile/edit' q="reset=1&id=`$contactId`&multiRecord=add&gid=`$gid`&snippet=1&context=multiProfileDialog&onPopupClose=`$onPopupClose`"}" | |
04a0519a | 75 | class="button action-item"><span><div class="icon add-icon"></div>{ts}Add New Record{/ts}</span></a> |
e41f4660 | 76 | {/if} |
f8c36033 | 77 | {/if} |
6a488035 | 78 | {/if} |
04a0519a RN |
79 | {literal} |
80 | <script type='text/javascript'> | |
81 | cj(function () { | |
e41f4660 PJ |
82 | var dialogId = '{/literal}{$dialogId}{literal}'; |
83 | var pageViewType = '{/literal}{$pageViewType}{literal}'; | |
bf55af92 TO |
84 | // NOTE: Triggers two events, "profile-dialog:FOO:open" and "profile-dialog:FOO:close", |
85 | // where "FOO" is the internal name of a profile form | |
86 | function formDialog(dialogName, dataURL, dialogTitle) { | |
04a0519a RN |
87 | cj.ajax({ |
88 | url: dataURL, | |
89 | success: function (content) { | |
e41f4660 | 90 | cj('#' + dialogId).show().html(content).dialog({ |
04a0519a RN |
91 | title: dialogTitle, |
92 | modal: true, | |
93 | width: 680, | |
94 | overlay: { | |
95 | opacity: 0.5, | |
96 | background: "black" | |
97 | }, | |
bf55af92 | 98 | open: function(event, ui) { |
e41f4660 | 99 | cj('#' + dialogId).trigger({ |
25794aa8 TO |
100 | type: "crmFormLoad", |
101 | profileName: dialogName | |
bf55af92 TO |
102 | }); |
103 | }, | |
b40d870d | 104 | close: function (event, ui) { |
e41f4660 | 105 | cj('#' + dialogId).trigger({ |
25794aa8 TO |
106 | type: "crmFormClose", |
107 | profileName: dialogName | |
bf55af92 | 108 | }); |
e41f4660 | 109 | cj('#' + dialogId).html(''); |
b40d870d TO |
110 | } |
111 | }); | |
112 | cj('.action-link').hide(); | |
1dde099b PJ |
113 | if (pageViewType == 'customDataView') { |
114 | var labelElement = cj('#custom-record-dialog .html-adjust label').css('display', 'inline'); | |
115 | } | |
116 | else { | |
117 | var labelElement = cj('#profile-dialog #crm-profile-block .edit-value label').css('display', 'inline'); | |
e41f4660 | 118 | } |
b40d870d TO |
119 | } |
120 | }); | |
04a0519a RN |
121 | } |
122 | ||
3a2e7d2b | 123 | var profileName = {/literal}"{$ufGroupName}"{literal}; |
04a0519a | 124 | cj('.action-item').each(function () { |
eb2b4bdb | 125 | if (!cj(this).attr('jshref') && !cj(this).hasClass('ignore-jshref')) { |
3a2e7d2b RN |
126 | cj(this).attr('jshref', cj(this).attr('href')); |
127 | cj(this).attr('href', '#browseValues'); | |
34efc347 | 128 | } |
04a0519a RN |
129 | }); |
130 | ||
e41f4660 PJ |
131 | if (pageViewType == 'customDataView') { |
132 | var actionItemHeirarchy = '.action-item'; | |
133 | profileName = 'customRecordView'; | |
134 | } | |
135 | else { | |
136 | var actionItemHeirarchy = '.crm-profile-name-' + profileName + ' .action-item'; | |
137 | } | |
138 | ||
139 | cj(actionItemHeirarchy).click(function () { | |
04a0519a RN |
140 | dataURL = cj(this).attr('jshref'); |
141 | dialogTitle = cj(this).attr('title'); | |
eb2b4bdb PJ |
142 | if (!cj(this).hasClass('ignore-jshref')) { |
143 | formDialog(profileName, dataURL, dialogTitle); | |
144 | } | |
04a0519a RN |
145 | }); |
146 | }); | |
147 | </script> | |
c481c79f | 148 | {/literal} |