X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fcrm.ajax.js;h=b01e814bf076d3c0613793ef8a43d97d5fd3e69b;hb=58cb13f8bfa693af1dcf19e5eb24e13d77da2d14;hp=6f0f244553fb3eea19344822cd5fe57f186d73a7;hpb=4987db5931935a03c6bc9b3fbdbaf847747bb320;p=civicrm-core.git diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 6f0f244553..b01e814bf0 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -37,14 +37,6 @@ return url; }; - // @deprecated - $.extend ({'crmURL': - function (p, params) { - CRM.console('warn', 'Calling crmURL from jQuery is deprecated. Please use CRM.url() instead.'); - return CRM.url(p, params); - } - }); - $.fn.crmURL = function () { return this.each(function() { if (this.href) { @@ -55,6 +47,7 @@ /** * AJAX api + * @link http://wiki.civicrm.org/confluence/display/CRMDOC/AJAX+Interface#AJAXInterface-CRM.api3 */ CRM.api3 = function(entity, action, params, status) { if (typeof(entity) === 'string') { @@ -152,15 +145,6 @@ })($.extend({}, settings, options)); }; - /** - * Backwards compatible with jQuery fn - * @deprecated - */ - $.fn.crmAPI = function(entity, action, params, options) { - CRM.console('warn', 'Calling crmAPI from jQuery is deprecated. Please use CRM.api3() instead.'); - return CRM.api.call(this, entity, action, params, options); - }; - $.widget('civi.crmSnippet', { options: { url: null, @@ -256,6 +240,10 @@ if (this.options.crmForm) $('form', this.element).ajaxFormUnbind(); if (this.options.block) this.element.block(); $.getJSON(url, function(data) { + if (data.status === 'redirect') { + that.options.url = data.userContext; + return that.refresh(); + } if (that.options.block) that.element.unblock(); if (!$.isPlainObject(data)) { that._onFailure(data); @@ -292,13 +280,6 @@ $('.blockUI', this.element).remove(); this._originalContent = this.element.contents().detach(); } - if (window.tinyMCE && tinyMCE.editors) { - $.each(tinyMCE.editors, function(k) { - if ($.contains(that.element[0], this.getElement())) { - this.remove(); - } - }); - } if (this.options.crmForm) $('form', this.element).ajaxFormUnbind(); }, _destroy: function() { @@ -327,7 +308,7 @@ .dialog(settings.dialog) .parent().find('.ui-dialog-titlebar') .append($('') - .button({icons: {primary: 'ui-icon-print'}, text: false})); + .button({icons: {primary: 'fa-print'}, text: false})); } // Add handlers to new or existing dialog if ($(settings.target).data('uiDialog')) { @@ -381,7 +362,7 @@ var id = widget.attr('id') + '-unsaved-alert', title = widget.dialog('option', 'title'), alert = CRM.alert('
' + ts('%1 has not been saved.', {1: title}) + '
', ts('Unsaved Changes'), 'alert unsaved-dialog', {expires: 60000}); - $('#' + id).button({icons: {primary: 'ui-icon-arrowreturnthick-1-w'}}).click(function(e) { + $('#' + id).button({icons: {primary: 'fa-undo'}}).click(function(e) { widget.attr('data-unsaved-changes', 'false').dialog('open'); e.preventDefault(); }); @@ -458,7 +439,7 @@ }, settings.ajaxForm)); if (settings.openInline) { settings.autoClose = $el.crmSnippet('isOriginalUrl'); - $(this).on('click', settings.openInline, function(e) { + $(this).off('.openInline').on('click.openInline', settings.openInline, function(e) { if ($(this).is(exclude + ', .crm-popup')) { return; } @@ -480,15 +461,15 @@ label = $el.is('input') ? $el.attr('value') : $el.text(), identifier = $el.attr('name') || $el.attr('href'); if (!identifier || identifier === '#' || $.inArray(identifier, added) < 0) { - var $icon = $el.find('.icon'), + var $icon = $el.find('.icon, .crm-i'), button = {'data-identifier': identifier, text: label, click: function() { $el[0].click(); }}; if ($icon.length) { button.icons = {primary: $icon.attr('class')}; } else { - var action = $el.attr('crm-icon') || ($el.hasClass('cancel') ? 'close' : 'check'); - button.icons = {primary: 'ui-icon-' + action}; + var action = $el.attr('crm-icon') || ($el.hasClass('cancel') ? 'fa-times' : 'fa-check'); + button.icons = {primary: action}; } buttons.push(button); added.push(identifier);