CRM.confirm - support loading remote content
authorColeman Watts <coleman@civicrm.org>
Sun, 7 Sep 2014 23:47:44 +0000 (19:47 -0400)
committerColeman Watts <coleman@civicrm.org>
Sun, 7 Sep 2014 23:49:30 +0000 (19:49 -0400)
js/Common.js
templates/CRM/Case/Form/ActivityToCase.tpl

index 9c0e21ed3a96ef54c32d6780ad2c106048008eba..abd4bf0994b15e876b6b31eefb037a9780bed50d 100644 (file)
@@ -775,9 +775,10 @@ CRM.strings = CRM.strings || {};
    * @see https://wiki.civicrm.org/confluence/display/CRMDOC/Notification+Reference
    */
   CRM.confirm = function (options) {
-    var dialog, settings = {
+    var dialog, url, msg, settings = {
       title: ts('Confirm'),
       message: ts('Are you sure you want to continue?'),
+      url: null,
       width: 'auto',
       modal: true,
       resizable: false,
@@ -807,13 +808,22 @@ CRM.strings = CRM.strings || {};
         });
       });
     }
-    dialog = $('<div class="crm-confirm-dialog"></div>').html(settings.message);
+    url = settings.url;
+    msg = settings.message;
     delete settings.options;
     delete settings.message;
+    delete settings.url;
+    dialog = $('<div class="crm-confirm-dialog"></div>').dialog(settings);
     if ($.isFunction(options)) {
       dialog.on('crmConfirm:yes', options);
     }
-    return dialog.dialog(settings).trigger('crmLoad');
+    if (url) {
+      CRM.loadPage(url, {target: dialog});
+    }
+    else if (msg && msg.length) {
+      dialog.html(msg).trigger('crmLoad');
+    }
+    return dialog;
   };
 
   /** provides a local copy of ts for a domain */
index afa678a17891cc642a3ab08b5d652722e68fc5af..72518648caa306b07336d7080a9c7c07a4c961f7 100644 (file)
       width: '600',
       resizable: true,
       options: {yes: "{/literal}{ts escape='js'}Save{/ts}{literal}", no: "{/literal}{ts escape='js'}Cancel{/ts}{literal}"},
-      open: function() {
-        CRM.loadPage(dataUrl, {target: this});
-      }
+      url: dataUrl
     }).on('crmConfirm:yes', save);
     
   }