From ebb9197bbe53c43af2f0e3211d4312c0f781362b Mon Sep 17 00:00:00 2001 From: CiviCRM Date: Tue, 23 Jul 2013 14:36:19 +0530 Subject: [PATCH] CRM-11137, replaced old style windowpop with jqueryui dialog and also fixed the issue ---------------------------------------- * CRM-11137: http://issues.civicrm.org/jira/browse/CRM-11137 --- CRM/Core/BAO/CustomField.php | 5 ++++- js/Common.js | 18 ++++++++++++++---- templates/CRM/Case/Page/CustomDataView.tpl | 4 ++-- .../Contact/Page/View/CustomDataFieldView.tpl | 5 ++++- templates/CRM/Custom/Form/CustomField.tpl | 6 +++++- templates/CRM/Custom/Page/CustomDataView.tpl | 13 ++++++++----- 6 files changed, 37 insertions(+), 14 deletions(-) diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index c2197f9d5b..d6def06dc3 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1485,7 +1485,10 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { "reset=1&id=$fileID&eid=$contactID", $absolute, NULL, TRUE, TRUE ); - $result['file_url'] = ""; + $result['file_url'] = " + + + "; // for non image files } else { diff --git a/js/Common.js b/js/Common.js index 8f5294ef60..d54a4fe4f0 100644 --- a/js/Common.js +++ b/js/Common.js @@ -426,10 +426,6 @@ function popUp(URL) { eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=640,height=420,left = 202,top = 184');"); } -function imagePopUp(path) { - window.open(path, 'popupWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,screenX=150,screenY=150,top=150,left=150'); -} - /** * Function to show / hide the row in optionFields * @@ -824,6 +820,20 @@ CRM.validate = CRM.validate || { messagesFromMarkup.call($('#crm-container')); $('#crm-container').on('crmFormLoad', '*', messagesFromMarkup); } + + // bind the event for image popup + $('body').on('click', 'a.crm-image-popup', function() { + var o = $('
'); + + CRM.confirm('', + { + title: ts('Preview'), + message: o + }, + ts('Done') + ); + return false; + }); }); $.fn.crmAccordions = function (speed) { diff --git a/templates/CRM/Case/Page/CustomDataView.tpl b/templates/CRM/Case/Page/CustomDataView.tpl index f3f8b34578..dd85887cbf 100644 --- a/templates/CRM/Case/Page/CustomDataView.tpl +++ b/templates/CRM/Case/Page/CustomDataView.tpl @@ -48,8 +48,8 @@ {if $element.field_type == 'File'} {if $element.field_value.displayURL} - - + + {else} diff --git a/templates/CRM/Contact/Page/View/CustomDataFieldView.tpl b/templates/CRM/Contact/Page/View/CustomDataFieldView.tpl index dd3364d665..e28a61015a 100644 --- a/templates/CRM/Contact/Page/View/CustomDataFieldView.tpl +++ b/templates/CRM/Contact/Page/View/CustomDataFieldView.tpl @@ -46,7 +46,10 @@ {if $element.field_type == 'File'} {if $element.field_value.displayURL}
- + + +
{else}
diff --git a/templates/CRM/Custom/Form/CustomField.tpl b/templates/CRM/Custom/Form/CustomField.tpl index 4ba37d2514..b86f978ae3 100644 --- a/templates/CRM/Custom/Form/CustomField.tpl +++ b/templates/CRM/Custom/Form/CustomField.tpl @@ -81,7 +81,11 @@
 {ts}Attached File{/ts}:   {if $element.element_value.displayURL} - + + + {else} {$element.element_value.fileName} {/if} diff --git a/templates/CRM/Custom/Page/CustomDataView.tpl b/templates/CRM/Custom/Page/CustomDataView.tpl index e67b91ffe6..46747a130d 100644 --- a/templates/CRM/Custom/Page/CustomDataView.tpl +++ b/templates/CRM/Custom/Page/CustomDataView.tpl @@ -77,12 +77,15 @@ {$element.field_title} {if $element.field_type == 'File'} {if $element.field_value.displayURL} - + + + + + {else} - {$element.field_value.fileName} + + {$element.field_value.fileName} + {/if} {else} {if $element.field_data_type == 'Money'} -- 2.25.1