$links[CRM_Core_Action::DELETE]['url'] = 'civicrm/profile/edit';
$links[CRM_Core_Action::DELETE]['qs'] = "reset=1&id=%%id%%&recordId=%%recordId%%&gid=%%gid%%&multiRecord={$delete}&snippet=1&context=multiProfileDialog&onPopupClose=%%onPopupClose%%";
}
+ // NOTE : links for DELETE action for customDataView is handled in browse
self::$_links[$this->_pageViewType] = $links;
}
// and $cgcount is used to build new record url
$cgcount = 1;
if ($result && !empty($result)) {
- $links = self::links($this->_pageViewType);
+ $links = self::links();
if ($this->_pageViewType == 'profileDataView') {
$pageCheckSum = $this->get('pageCheckSum');
if ($pageCheckSum) {
$actionParams['recId'] = $recId;
$actionParams['type'] = $this->_contactType;
$actionParams['cgcount'] = $cgcount;
+
+ // DELETE action links
+ $links[CRM_Core_Action::DELETE]['url'] = '#';
+ $links[CRM_Core_Action::DELETE]['extra'] = " onclick='showDeleteInDialog({$recId}, {$this->_customGroupId}, {$this->_contactId})' ";
+ $links[CRM_Core_Action::DELETE]['class'] = 'ignore-jshref';
}
if (!empty($pageCheckSum)) {
$actionParams['cs'] = $pageCheckSum;
}
+
$value['action'] = CRM_Core_Action::formLink(
$links,
$linkAction,
*}
{* this template is used for building tabbed custom data *}
{if $cdType }
- {include file="CRM/Custom/Form/CustomData.tpl"}
-{if $multiRecordDisplay eq 'single'}
- <div class="html-adjust">{$form.buttons.html}</div>
-{/if}
+ {include file="CRM/Custom/Form/CustomData.tpl"}
+ {if $multiRecordDisplay eq 'single'}
+ <div class="html-adjust">{$form.buttons.html}</div>
+ {* for form rule handling *}
+ {include file="CRM/Form/validate.tpl"}
+ {literal}
+ <script type='text/javascript'>
+ cj(function($) {
+ $('#custom-record-dialog .crm-container-snippet #CustomData').validate(CRM.validate.params);
+ });
+ </script>
+ {/literal}
+ {/if}
{else}
-{debug}
<div id="customData"></div>
<div class="html-adjust">{$form.buttons.html}</div>
{*include custom data js file*}
{include file="CRM/common/customData.tpl"}
-
- {if $customValueCount }
+ {if $customValueCount}
{literal}
<script type="text/javascript">
var customValueCount = {/literal}"{$customValueCount}"{literal};
{/if}
{/if}
-{include file="CRM/Form/attachmentjs.tpl"}
+{include file="CRM/Form/attachmentjs.tpl"}
\ No newline at end of file
{include file="CRM/Contact/Form/CustomData.tpl" mainEdit=$mainEditForm}
{/if}
{if $displayStyle eq 'tableOriented'}
- {include file='CRM/Profile/Page/MultipleRecordFieldsListing.tpl' showListing=1 dontShowTitle=1 pageViewType='customDataView'}
+ {include file='CRM/Profile/Page/MultipleRecordFieldsListing.tpl' showListing=1 dontShowTitle=1 pageViewType='customDataView'}
+ {literal}
+ <script type="text/javascript">
+ function showDeleteInDialog(valueID, groupID, contactID) {
+ var confirmText = '{/literal}{ts escape='js'}Are you sure you want to delete this record?{/ts}{literal}';
+ cj('#browseValues').after("<div id='delete-record'></div>");
+ cj('#delete-record').html(confirmText).dialog({
+ title: "{/literal}{ts escape='js'}Delete Record{/ts}{literal}",
+ modal: true,
+ width: 680,
+ overlay: {
+ opacity: 0.5,
+ background: "black"
+ },
+
+ buttons: {
+ {/literal}"{ts escape='js'}Cancel{/ts}"{literal}: function() {
+ cj(this).dialog("close");
+ cj('#delete-record').html('');
+ },
+ {/literal}"{ts escape='js'}OK{/ts}{literal}": function() {
+ deleteCustomValueRec(valueID, groupID, contactID);
+ window.setTimeout(function(){window.location.reload( )}, 1000);
+ }
+ }
+ });
+ }
+
+ function deleteCustomValueRec(valueID, groupID, contactID) {
+ var postUrl = {/literal}"{crmURL p='civicrm/ajax/customvalue' h=0 }"{literal};
+ cj.ajax({
+ type: "POST",
+ data: "valueID=" + valueID + "&groupID=" + groupID + "&contactId=" + contactID + "&key={/literal}{crmKey name='civicrm/ajax/customvalue'}{literal}",
+ url: postUrl,
+ success: function (html) {
+ CRM.alert('', '{/literal}{ts escape="js"}Record Deleted{/ts}{literal}', 'success');
+ }
+ });
+ }
+ </script>
+ {/literal}
{else}
{strip}
{if $action eq 16 or $action eq 4} {* Browse or View actions *}
{assign var="showEdit" value=1}
{foreach from=$viewCustomData item=customValues key=customGroupId}
{foreach from=$customValues item=cd_edit key=cvID}
+{if $multiRecordDisplay neq 'single'}
<table class="no-border">
{assign var='index' value=$groupId|cat:"_$cvID"}
- {if $multiRecordDisplay neq 'single' and (($editOwnCustomData and $showEdit) or ($showEdit and $editCustomData and $groupId))}
+ {if ($editOwnCustomData and $showEdit) or ($showEdit and $editCustomData and $groupId)}
<tr>
<td>
<a
</tr>
{/if}
{assign var="showEdit" value=0}
- {if $multiRecordDisplay neq 'single'}
<tr id="statusmessg_{$index}" class="hiddenElement">
<td><span class="success-status"></span></td>
</tr>
- {/if}
<tr>
<td id="{$cd_edit.name}_{$index}" class="section-shown form-item">
- <div {if $multiRecordDisplay neq 'single'} class="crm-accordion-wrapper {if $cd_edit.collapse_display eq 0 or $skipTitle} {else}collapsed{/if}"{/if}>
+ <div class="crm-accordion-wrapper {if $cd_edit.collapse_display eq 0 or $skipTitle} {else}collapsed{/if}">
{if !$skipTitle}
<div class="crm-accordion-header">
{$cd_edit.title}
</div>
{/if}
- <div {if $multiRecordDisplay neq 'single'} class="crm-accordion-body" {/if}>
- {if $groupId and $cvID and $editCustomData and $multiRecordDisplay neq 'single'}
+ <div class="crm-accordion-body">
+ {if $groupId and $cvID and $editCustomData}
<div class="crm-submit-buttons">
<a href="#"
onclick="showDelete( {$cvID}, '{$cd_edit.name}_{$index}', {$customGroupId}, {$contactId} ); return false;"
</div>
{/if}
{foreach from=$cd_edit.fields item=element key=field_id}
- <table class="crm-info-panel crm-section">
+ <table class="crm-info-panel">
<tr>
{if $element.options_per_line != 0}
<td class="label">{$element.field_title}</td>
- <td class="html-adjust content">
+ <td class="html-adjust">
{* sort by fails for option per line. Added a variable to iterate through the element array*}
{foreach from=$element.field_value item=val}
{$val}
<td class="label">{$element.field_title}</td>
{if $element.field_type == 'File'}
{if $element.field_value.displayURL}
- <td class="html-adjust content">
+ <td class="html-adjust">
<a href="{$element.field_value.displayURL}" class='crm-image-popup'>
<img src="{$element.field_value.displayURL}" height="100" width="100">
</a>
</td>
{else}
- <td class="html-adjust content">
+ <td class="html-adjust">
<a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
</td>
{/if}
{else}
{if $element.field_data_type == 'Money'}
{if $element.field_type == 'Text'}
- <td class="html-adjust content">{$element.field_value|crmMoney}</td>
+ <td class="html-adjust">{$element.field_value|crmMoney}</td>
{else}
- <td class="html-adjust content">{$element.field_value}</td>
+ <td class="html-adjust">{$element.field_value}</td>
{/if}
{else}
- <td class="html-adjust content">
+ <td class="html-adjust">
{if $element.contact_ref_id}
<a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
{/if}
</td>
</tr>
</table>
+{else}
+ {foreach from=$cd_edit.fields item=element key=field_id}
+ <div class="crm-section">
+ {if $element.options_per_line != 0}
+ <div class="label">{$element.field_title}</div>
+ <div class="content">
+ {* sort by fails for option per line. Added a variable to iterate through the element array*}
+ {foreach from=$element.field_value item=val}
+ {$val}
+ <br/>
+ {/foreach}
+ </div>
+ {else}
+ <div class="label">{$element.field_title}</div>
+ {if $element.field_type == 'File'}
+ {if $element.field_value.displayURL}
+ <div class="content">
+ <a href="{$element.field_value.displayURL}" class='crm-image-popup'>
+ <img src="{$element.field_value.displayURL}" height="100" width="100">
+ </a>
+ </div>
+ {else}
+ <div class="content">
+ <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
+ </div>
+ {/if}
+ {else}
+ {if $element.field_data_type == 'Money'}
+ {if $element.field_type == 'Text'}
+ <div class="content">{$element.field_value|crmMoney}</div>
+ {else}
+ <div class="content">{$element.field_value}</div>
+ {/if}
+ {else}
+ <div class="content">
+ {if $element.contact_ref_id}
+ <a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
+ {/if}
+ {if $element.field_data_type == 'Memo'}
+ {$element.field_value|nl2br}
+ {else}
+ {$element.field_value}
+ {/if}
+ {if $element.contact_ref_id}
+ </a>
+ {/if}
+ </div>
+ {/if}
+ {/if}
+ {/if}
+ {/foreach}
+{/if}
{/foreach}
{/foreach}
{literal}
{if !$reachedMax}
{if $pageViewType eq 'customDataView'}
- <a accesskey="N" href="{crmURL p='civicrm/contact/view/cd/edit' q="reset=1&snippet=1&type=$ctype&groupID=$customGroupId&entityID=$contactId&cgcount=$cgcount&multiRecordDisplay=single"}"
+ <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"}"
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`&snippet=1&context=multiProfileDialog&onPopupClose=`$onPopupClose`"}"
var profileName = {/literal}"{$ufGroupName}"{literal};
cj('.action-item').each(function () {
- if (!cj(this).attr('jshref')) {
+ if (!cj(this).attr('jshref') && !cj(this).hasClass('ignore-jshref')) {
cj(this).attr('jshref', cj(this).attr('href'));
cj(this).attr('href', '#browseValues');
}
cj(actionItemHeirarchy).click(function () {
dataURL = cj(this).attr('jshref');
dialogTitle = cj(this).attr('title');
- formDialog(profileName, dataURL, dialogTitle);
+ if (!cj(this).hasClass('ignore-jshref')) {
+ formDialog(profileName, dataURL, dialogTitle);
+ }
});
});
</script>