{*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
+--------------------------------------------------------------------+
*}
{if $showListing}
- <h1>{ts}{$customGroupTitle}{/ts}</h1>
+ {if $dontShowTitle neq 1}<h1>{ts}{$customGroupTitle}{/ts}</h1>{/if}
+ {if $pageViewType eq 'customDataView'}
+ {assign var='dialogId' value='custom-record-dialog'}
+ {else}
+ {assign var='dialogId' value='profile-dialog'}
+ {/if}
{if $records and $headers}
{include file="CRM/common/jsortable.tpl"}
- <div id="browseValues">
+ <div id="custom-{$customGroupId}-table-wrapper">
<div>
{strip}
<table id="records" class="display">
<th>{ts}{$head}{/ts}</th>
{/foreach}
<th></th>
+ {foreach from=$dateFields key=fieldId item=v}
+ <th class='hiddenElement'></th>
+ {/foreach}
</tr>
</thead>
{foreach from=$records key=recId item=rows}
<tr class="{cycle values="odd-row,even-row"}">
{foreach from=$headers key=hrecId item=head}
- <td>{$rows.$hrecId}</td>
+ {if $dateFieldsVals.$hrecId.$recId}
+ <td>{$rows.$hrecId|crmDate:"%b %d, %Y %l:%M %P"}</td>
+ {else}
+ <td>{$rows.$hrecId}</td>
+ {/if}
{/foreach}
<td>{$rows.action}</td>
+ {foreach from=$dateFieldsVals key=fid item=rec}
+ <td class='crm-field-{$fid}_date hiddenElement'>{$rec.$recId}</td>
+ {/foreach}
</tr>
{/foreach}
</table>
{/strip}
</div>
</div>
- <div id='profile-dialog' class="hiddenElement"></div>
+ <div id='{$dialogId}' class="hiddenElement"></div>
{elseif !$records}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>
{ts 1=$customGroupTitle}No records of type '%1' found.{/ts}
</div>
- <div id='profile-dialog' class="hiddenElement"></div>
+ <div id='{$dialogId}' class="hiddenElement"></div>
{/if}
{if !$reachedMax}
- <a accesskey="N" href="{crmURL p='civicrm/profile/edit' q="reset=1&id=`$contactId`&multiRecord=add&gid=`$gid`&snippet=1&context=multiProfileDialog&onPopupClose=`$onPopupClose`"}"
+ {if $pageViewType eq 'customDataView'}
+ <br/><a accesskey="N" title="{ts 1=$customGroupTitle}Add %1 Record{/ts}" href="{crmURL p='civicrm/contact/view/cd/edit' q="reset=1&type=$ctype&groupID=$customGroupId&entityID=$contactId&cgcount=$cgcount&multiRecordDisplay=single&mode=add"}"
+ class="button action-item"><span><div class="icon add-icon"></div>{ts 1=$customGroupTitle}Add %1 Record{/ts}</span></a>
+ {else}
+ <a accesskey="N" href="{crmURL p='civicrm/profile/edit' q="reset=1&id=`$contactId`&multiRecord=add&gid=`$gid`&context=multiProfileDialog&onPopupClose=`$onPopupClose`"}"
class="button action-item"><span><div class="icon add-icon"></div>{ts}Add New Record{/ts}</span></a>
+ {/if}
{/if}
{/if}
-{literal}
- <script type='text/javascript'>
- cj(function () {
- // NOTE: Triggers two events, "profile-dialog:FOO:open" and "profile-dialog:FOO:close",
- // where "FOO" is the internal name of a profile form
- function formDialog(dialogName, dataURL, dialogTitle) {
- cj.ajax({
- url: dataURL,
- success: function (content) {
- cj('#profile-dialog').show().html(content).dialog({
- title: dialogTitle,
- modal: true,
- width: 680,
- overlay: {
- opacity: 0.5,
- background: "black"
- },
- open: function(event, ui) {
- cj('#profile-dialog').trigger({
- type: "crmFormLoad",
- profileName: dialogName
- });
- },
- close: function (event, ui) {
- cj('#profile-dialog').trigger({
- type: "crmFormClose",
- profileName: dialogName
- });
- cj('#profile-dialog').html('');
- }
- });
- cj('.action-link').hide();
- cj('#profile-dialog #crm-profile-block .edit-value label').css('display', 'inline');
- }
- });
- }
-
- var profileName = {/literal}"{$ufGroupName}"{literal};
- cj('.action-item').each(function () {
- if (!cj(this).attr('jshref')) {
- cj(this).attr('jshref', cj(this).attr('href'));
- cj(this).attr('href', '#browseValues');
- }
- });
-
- cj(".crm-profile-name-" + profileName + " .action-item").click(function () {
- dataURL = cj(this).attr('jshref');
- dialogTitle = cj(this).attr('title');
- formDialog(profileName, dataURL, dialogTitle);
- });
- });
- </script>
- {/literal}