? decisions-HEAD-399952.patch
? decisions-form.js
Index: decisions.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/decisions/decisions.module,v
retrieving revision 1.208
diff -u -p -e -B -b -r1.208 decisions.module
Index: decisions_node.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/decisions/decisions_node.inc,v
retrieving revision 1.4
diff -u -p -e -B -b -r1.4 decisions_node.inc
*** decisions_node.inc	12 Mar 2009 23:11:33 -0000	1.4
--- decisions_node.inc	13 Mar 2009 17:46:50 -0000
*************** function decisions_form(&$node, &$form_s
*** 260,267 ****
                                           '#title' => t('Need more choices'),
                                           '#default_value' => 0,
                                           '#return_value' => 1,
-                                          '#prefix' => '<div id="morechoices">',
-                                          '#suffix' => '</div>',
                                           '#description' => t("If the amount of boxes above isn't enough, check this box and click the Preview button below to add some more."),
                                           '#weight' => 1
                                           );
--- 260,265 ----
*************** function decisions_form(&$node, &$form_s
*** 432,437 ****
--- 430,443 ----
  function decisions_form_alter(&$form, $form_state, $form_id) {
    if (preg_match('/^decisions_.*_node_form$/', $form_id)) {
      # XXX: not sure this is right
+     // Only add javascript once, even if _form is called multiple times.
+     static $decisions_add_js;
+     if (!$decisions_add_js) {
+       // Pass translatable strings
+       drupal_add_js(array('decisions' => array('remove' => t('Remove'), 'addChoice' => t('Add choice'), 'noLimit' => t('No limit'), 'noRemove' => t("Can't remove this choice.\nA minimum of two choices must be defined at all times."))), 'setting');
+       drupal_add_js(drupal_get_path('module', 'decisions') .'/decisions-form.js', 'module');
+       $decisions_add_js = TRUE;
+     }
      if ($form['choice']['morechoices']['#return_value']) {
        $form['#rebuild'] = TRUE;
        $choices = $form['choice']['choices']['#value'];
