diff --git a/js/Common.js b/js/Common.js index bf4273c74e0c1af82131c6b2ae151f0378416a92..c9f76c912aa0a061c1953d69f6d4b008d095061c 100644 --- a/js/Common.js +++ b/js/Common.js @@ -763,8 +763,8 @@ CRM.validate = CRM.validate || { }); } - $(document).ready(function() { - if (CRM && CRM.config && CRM.config.urlIsPublic === false) { + $(function() { + if ($('#crm-notification-container').length) { // Initialize notifications $('#crm-notification-container').notify(); messagesFromMarkup.call($('#crm-container')); diff --git a/templates/CRM/Core/APIDoc.tpl b/templates/CRM/Core/APIDoc.tpl index 914448a2505b7e6710e83aa4cceed78a4c5fab3e..ac08b2bb356033635696e6676b946b962a9b25d5 100644 --- a/templates/CRM/Core/APIDoc.tpl +++ b/templates/CRM/Core/APIDoc.tpl @@ -10,7 +10,6 @@ h2.entity {cursor:pointer} {/literal} </style> -{include file="CRM/common/scripts.tpl"} <script> if (!jQuery) {ldelim} var head= document.getElementsByTagName('head')[0]; diff --git a/templates/CRM/Form/validate.tpl b/templates/CRM/Form/validate.tpl index e5a5df0e51848b6c6a3128bfa7c17d2cb608540c..e78fb11c05f4d5ad9a132b7261278843916acaac 100644 --- a/templates/CRM/Form/validate.tpl +++ b/templates/CRM/Form/validate.tpl @@ -56,14 +56,13 @@ cj(function($) { // use civicrm notifications when there are errors params.invalidHandler = function(form, validator) { var errors = validator.errorList; - if (CRM && CRM.config && CRM.config.urlIsPublic === false) { + {/literal}{if !$urlIsPublic}{literal} for (var i in errors) { $(errors[i].element).crmError(errors[i].message); } - } - else { - alert({/literal}"{ts escape='js'}Please review and correct the highlighted fields before continuing.{/ts}"{literal}); - } + {/literal}{else} + alert("{ts escape='js'}Please review and correct the highlighted fields before continuing.{/ts}"); + {/if}{literal} }; CRM.validate.params = CRM.validate.params || {}; diff --git a/templates/CRM/common/Navigation.tpl b/templates/CRM/common/Navigation.tpl index 5d1f6788285c6e8cb8ed07b226510b5f8caf0ab9..d79740a541bc1ff6ce242a8b9a4b2758de484f94 100644 --- a/templates/CRM/common/Navigation.tpl +++ b/templates/CRM/common/Navigation.tpl @@ -70,9 +70,8 @@ cj(function( ) { minChars: 1, matchContains: true, delay: 400, - max: CRM.config.search_autocomplete_count, + max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal}, extraParams:{ - limit: CRM.config.search_autocomplete_count, fieldName:function () { return cj('input[name=quickSearchField]:checked').val(); }, diff --git a/templates/CRM/common/drupal.tpl b/templates/CRM/common/drupal.tpl index 951f6623aa862038896a96299a0af14b3ca6ca14..2875ee8173c4640202947938e3dad80743756997 100644 --- a/templates/CRM/common/drupal.tpl +++ b/templates/CRM/common/drupal.tpl @@ -23,7 +23,6 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{include file="CRM/common/scripts.tpl"} {if $config->debug} {include file="CRM/common/debug.tpl"} {/if} diff --git a/templates/CRM/common/drupal6.tpl b/templates/CRM/common/drupal6.tpl index 59bd454f2d4c06d2400b7d2c64f3637b4604d7f0..33fe217d337ed0cdded61f38fd0e197276c16c88 100644 --- a/templates/CRM/common/drupal6.tpl +++ b/templates/CRM/common/drupal6.tpl @@ -23,7 +23,6 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{include file="CRM/common/scripts.tpl"} {if $config->debug} {include file="CRM/common/debug.tpl"} {/if} diff --git a/templates/CRM/common/joomla.tpl b/templates/CRM/common/joomla.tpl index b2751cd7c52bd1e8c2c901b2ddbd3458ec1dde04..a408259c84d39d55ad81dc1f0fcaf550e4ec6689 100644 --- a/templates/CRM/common/joomla.tpl +++ b/templates/CRM/common/joomla.tpl @@ -23,7 +23,6 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{include file="CRM/common/scripts.tpl"} {if $config->debug} {include file="CRM/common/debug.tpl"} {/if} diff --git a/templates/CRM/common/print.tpl b/templates/CRM/common/print.tpl index 6633dc62b0767df1140f207f0cc133f3359fb04b..058ccee91e01e3526e0bc9975867c1b37c60bda0 100644 --- a/templates/CRM/common/print.tpl +++ b/templates/CRM/common/print.tpl @@ -35,7 +35,6 @@ </head> <body> -{include file="CRM/common/scripts.tpl"} {if $config->debug} {include file="CRM/common/debug.tpl"} {/if} diff --git a/templates/CRM/common/scripts.tpl b/templates/CRM/common/scripts.tpl deleted file mode 100644 index 61b25aedccb6f5e55ef075c52f9391c852b3d8bc..0000000000000000000000000000000000000000 --- a/templates/CRM/common/scripts.tpl +++ /dev/null @@ -1,49 +0,0 @@ -{* - +--------------------------------------------------------------------+ - | CiviCRM version 4.3 | - +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2013 | - +--------------------------------------------------------------------+ - | This file is a part of CiviCRM. | - | | - | CiviCRM is free software; you can copy, modify, and distribute it | - | under the terms of the GNU Affero General Public License | - | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | - | | - | CiviCRM is distributed in the hope that it will be useful, but | - | WITHOUT ANY WARRANTY; without even the implied warranty of | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | - | See the GNU Affero General Public License for more details. | - | | - | You should have received a copy of the GNU Affero General Public | - | License and the CiviCRM Licensing Exception along | - | with this program; if not, contact CiviCRM LLC | - | at info[AT]civicrm[DOT]org. If you have questions about the | - | GNU Affero General Public License or the licensing of CiviCRM, | - | see the CiviCRM license FAQ at http://civicrm.org/licensing | - +--------------------------------------------------------------------+ -*} - -<script type="text/javascript"> -{*/* - * Here we define the CRM object, - * A single global variable to hold everything that needs to be accessed from the global scope - * Translated strings are stored in the CRM.strings object, and can be accessed via ts() in javascript - * Very common strings are included here for convenience. Others should be added dynamically per-page. - * - * To extend this object from php: - * CRM_Core_Resources::singleton()->addSetting(array('myNamespace' => array('foo' => 'bar'))); - * It can then be accessed client-side via CRM.myNamespace.foo - */ - *} - {literal} - var CRM = CRM || {}; - CRM = cj.extend(true, { - strings: {}, - config: {{/literal} - urlIsPublic: {if $urlIsPublic}true{else}false{/if}, - search_autocomplete_count: {crmSetting name="search_autocomplete_count" group="Search Preferences"} - {literal}}, - }, CRM); - {/literal} -</script> diff --git a/templates/CRM/common/wordpress.tpl b/templates/CRM/common/wordpress.tpl index fdb0231abd4586d999ffa4f2984ceb41f756e8f7..8187f5759e4f8fee1a3cb2f616d60923d8ee616e 100644 --- a/templates/CRM/common/wordpress.tpl +++ b/templates/CRM/common/wordpress.tpl @@ -23,7 +23,6 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{include file="CRM/common/scripts.tpl"} {if $config->debug} {include file="CRM/common/debug.tpl"} {/if}