Document deprecation of AdvMultiSelect widget
authorColeman Watts <coleman@civicrm.org>
Fri, 10 Oct 2014 14:44:55 +0000 (10:44 -0400)
committerColeman Watts <coleman@civicrm.org>
Fri, 10 Oct 2014 14:44:55 +0000 (10:44 -0400)
CRM/Custom/Form/Field.php
templates/CRM/Custom/Form/Field.tpl

index e45f7fcca308a6bb3f5c367e49c94551156754bd..6c95748674112b73e9afe9656f7c516139cf8302 100644 (file)
@@ -138,7 +138,7 @@ class CRM_Custom_Form_Field extends CRM_Core_Form {
       self::$_dataToLabels = array(
         array('Text' => ts('Text'), 'Select' => ts('Select'),
           'Radio' => ts('Radio'), 'CheckBox' => ts('CheckBox'), 'Multi-Select' => ts('Multi-Select'),
-          'AdvMulti-Select' => ts('Advanced Multi-Select'),
+          'AdvMulti-Select' => ts('Adv Multi-Select (obsolete)'),
           'Autocomplete-Select' => ts('Autocomplete Select'),
         ),
         array('Text' => ts('Text'), 'Select' => ts('Select'),
index 2154128789a4b8c7fd2a621e36510f3ba47e4e31..355b4b6bb3bf81b6225dd0f88e2154e532cfd724 100644 (file)
@@ -289,6 +289,20 @@ function custom_option_html_type( ) {
     </div>
 {literal}
 <script type="text/javascript">
+  CRM.$(function($) {
+    var $form = $('form.{/literal}{$form.formClass}{literal}'),
+      deprecatedNotice;
+    function deprecatedWidgets() {
+      deprecatedNotice && deprecatedNotice.close && deprecatedNotice.close();
+      switch ($('#data_type_1', $form).val()) {
+        case 'AdvMulti-Select':
+          deprecatedNotice = CRM.alert({/literal}'{ts escape="js"}The old "Advance Multi-Select" widget is being phased out and will be removed in a future version of CiviCRM. "Multi-Select" is the recommended substitute.{/ts}', '{ts escape="js"}Obsolete widget{/ts}'{literal}, 'alert', {expires: 0});
+          break;
+      }
+    }
+    $('#data_type_1', $form).each(deprecatedWidgets).change(deprecatedWidgets);
+  });
+
     //when page is reload, build show hide boxes
     //as per data type and html type selected.
     custom_option_html_type( );