From 1ef465c289195ded45fb7452c22aa2826edd7e7b Mon Sep 17 00:00:00 2001 From: "Donald A. Lobo" Date: Sat, 30 Mar 2013 09:51:00 -0700 Subject: [PATCH] CRM-12254 --- CRM/Core/BAO/CustomGroup.php | 1 + CRM/Core/BAO/File.php | 2 +- CRM/Core/Page/File.php | 2 +- templates/CRM/Contact/Form/CustomData.tpl | 3 +++ templates/CRM/Custom/Form/CustomData.tpl | 1 + templates/CRM/Custom/Form/CustomField.tpl | 11 ++++---- templates/CRM/Form/attachment.tpl | 32 +++-------------------- templates/CRM/Form/attachmentjs.tpl | 27 +++++++++++++++++++ 8 files changed, 44 insertions(+), 35 deletions(-) create mode 100644 templates/CRM/Form/attachmentjs.tpl diff --git a/CRM/Core/BAO/CustomGroup.php b/CRM/Core/BAO/CustomGroup.php index 27459a4478..11b30806f0 100644 --- a/CRM/Core/BAO/CustomGroup.php +++ b/CRM/Core/BAO/CustomGroup.php @@ -630,6 +630,7 @@ SELECT $select 'fid' => $fieldID, ) ); + $customValue['deleteURLArgs'] = CRM_Core_BAO_File::deleteURLArgs($table, $dao->$entityIDName, $fileDAO->id); $customValue['fileName'] = CRM_Utils_File::cleanFileName(basename($fileDAO->uri)); if ($fileDAO->mime_type == "image/jpeg" || $fileDAO->mime_type == "image/pjpeg" || diff --git a/CRM/Core/BAO/File.php b/CRM/Core/BAO/File.php index c11b92a5a2..c10becaced 100644 --- a/CRM/Core/BAO/File.php +++ b/CRM/Core/BAO/File.php @@ -105,7 +105,7 @@ list($sql, $params) = self::sql($entityTable, $entityID, $fileTypeID); } else { - list($sql, $params) = self::sql($entityTable, $entityID, NULL); + list($sql, $params) = self::sql($entityTable, $entityID, 0); } $dao = CRM_Core_DAO::executeQuery($sql, $params); diff --git a/CRM/Core/Page/File.php b/CRM/Core/Page/File.php index 67725b7edd..51a64dedcc 100644 --- a/CRM/Core/Page/File.php +++ b/CRM/Core/Page/File.php @@ -33,8 +33,8 @@ * */ class CRM_Core_Page_File extends CRM_Core_Page { - function run() { + function run() { $eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, TRUE); $fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, FALSE); $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); diff --git a/templates/CRM/Contact/Form/CustomData.tpl b/templates/CRM/Contact/Form/CustomData.tpl index cf13c8983c..0816b8e3ab 100644 --- a/templates/CRM/Contact/Form/CustomData.tpl +++ b/templates/CRM/Contact/Form/CustomData.tpl @@ -33,6 +33,7 @@ {*include custom data js file*} {include file="CRM/common/customData.tpl"} + {if $customValueCount } {literal} + {/if} diff --git a/templates/CRM/Custom/Form/CustomField.tpl b/templates/CRM/Custom/Form/CustomField.tpl index c916648ce6..67b0caa0fc 100644 --- a/templates/CRM/Custom/Form/CustomField.tpl +++ b/templates/CRM/Custom/Form/CustomField.tpl @@ -76,18 +76,20 @@ ({ts}clear{/ts}) {elseif $element.data_type eq 'File'} {if $element.element_value.data} +
+

 {ts}Attached File{/ts}:   - {if $element.element_value.displayURL } + {if $element.element_value.displayURL} {else} {$element.element_value.fileName} {/if} - {if $element.element_value.deleteURL } -
- {$element.element_value.deleteURL} + {if $element.element_value.deleteURL} + {/if}
+
{/if} {elseif $element.html_type eq 'Autocomplete-Select'} {if $element.data_type eq 'ContactReference'} @@ -100,4 +102,3 @@ {/if} - diff --git a/templates/CRM/Form/attachment.tpl b/templates/CRM/Form/attachment.tpl index 4b46567e25..4648ac684a 100644 --- a/templates/CRM/Form/attachment.tpl +++ b/templates/CRM/Form/attachment.tpl @@ -118,7 +118,7 @@ {$attVal.cleanName} {if $attVal.description} - {$attVal.description}{/if} {if $attVal.deleteURLArgs} - + {/if} {if !empty($attVal.tag)}
@@ -158,34 +158,10 @@ {/literal} {/if} {* edit/add if*} -{if $currentAttachmentInfo} - +{if $currentAttachmentInfo} +{include file="CRM/Form/attachmentjs.tpl"} {/if} + {/if} {* top level if *} diff --git a/templates/CRM/Form/attachmentjs.tpl b/templates/CRM/Form/attachmentjs.tpl new file mode 100644 index 0000000000..b1c8c018ee --- /dev/null +++ b/templates/CRM/Form/attachmentjs.tpl @@ -0,0 +1,27 @@ + -- 2.25.1