Index: og.js
===================================================================
RCS file: /cvs/drupal/contributions/modules/og/og.js,v
retrieving revision 1.5
diff -u -r1.5 og.js
--- og.js	4 Sep 2007 03:22:48 -0000	1.5
+++ og.js	27 Dec 2007 19:24:33 -0000
@@ -1,15 +1,15 @@
 // $Id: og.js,v 1.5 2007/09/04 03:22:48 weitzman Exp $
 
 Drupal.ogAttach = function() {
-/*  Disable the public checkbox if no groups are selected in in Audience*/
+  // Disable the public checkbox if no groups are selected in Audience
   $('.og-audience').click(function() {
     // Audience can be select or checkboxes
 		var cnt;
     if ( $('.og-audience .form-checkbox').size() > 0) {
-      cnt = $('input.og-audience:checked').size();  
+      cnt = $('input.og-audience:checked').size();
     }
     else {
-      cnt = $('.og-audience option:selected').size();      
+      cnt = $('.og-audience option:selected').size();
     }
     if (cnt > 0) {
       $('#edit-og-public').removeAttr("disabled");
@@ -22,14 +22,44 @@
 	if ( $('.og-audience .form-checkbox').size() > 0 ) {
 	  if ( $('input.og-audience:checked').size() < 1) {
 	      $('#edit-og-public').attr("disabled", "disabled");
-	  }		
+	  }
 	}
 	else {
 	  if ( $('.og-audience option:selected').size() < 1) {
 	      $('#edit-og-public').attr("disabled", "disabled");
-	  }				
+	  }
 	}
-};
+
+  /**
+   * DELETING A GROUP page -- form field UI stuff
+   * 
+   * Find out if the 'move all posts to another group' radio button is checked,
+   * and if so, re-enable the og_node_delete_group_form's $form['target'] dropdown list.
+   */
+  $('#og-move-posts-to-group-selector').hide();
+  $('#og-delete-group-posts-description').hide();
+  $('#og-delete-group-dropdown').attr("disabled", "disabled");
+  
+  var i = 1;
+  $('.form-radios').children().each(function(){
+    if (i == 3) {
+      $(this).click(function(){
+        $('#og-delete-group-posts-description').slideDown('fast');
+        $('#og-delete-group-dropdown').removeAttr("disabled");
+        $('#og-move-posts-to-group-selector').slideDown('normal');
+      });
+    } else {
+      $(this).click(function(){
+        $('#og-delete-group-posts-description').hide();
+        $('#og-delete-group-dropdown').attr("disabled", "disabled");
+        $('#og-move-posts-to-group-selector').hide();
+      });
+
+    }
+    i++; 
+  });
+
+}
 
 if (Drupal.jsEnabled) {
   $(document).ready(Drupal.ogAttach);
Index: og.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/og/og.module,v
retrieving revision 1.412
diff -u -r1.412 og.module
--- og.module	19 Dec 2007 04:26:22 -0000	1.412
+++ og.module	27 Dec 2007 19:24:34 -0000
@@ -1409,6 +1409,7 @@
 }
 
 function og_form_alter($form_id, &$form) {
+  drupal_add_js(drupal_get_path('module', 'og'). '/og.js');
   // Add audience selection to node forms
   if (isset($form['#node']) && $form_id == $form['#node']->type .'_node_form') {
     $node = $form['#node'];
@@ -1456,19 +1457,62 @@
 
 }
 
-// form_alter() the node_delete form for a group
+// Form_alter() the node_delete form (for removing groups).
 function og_node_delete_group_form(&$form) {
-  $options[] = t('Do nothing.');
-  $options[] = t('Delete all group posts which don\'t also belong to another group.');
-  if (user_access('administer nodes')) {
-    $options[] = t('Move all group posts to the group listed below.');
+  // Make a list of all the available groups.
+  $dropdown_choices = og_all_groups_options();
+  // Remove the group that's being deleted from the list of groups.
+  unset($dropdown_choices[$form['nid']['#value']]);
+  // Find out if there's more than one group available for selection before
+  // presenting the user with a Target Group dropdown.
+  if (count($dropdown_choices) > 0) {
+    $multiple_groups_exist = TRUE;
   }
-  $form['verb'] = array('#type' => 'radios', '#title' => t('Group posts'), '#options' => $options, '#weight' => 0, '#description' => t('In addition to deleting this group, you may choose how to disposition the posts within it.'));
-  if (user_access('administer nodes')) {
-    $options = og_all_groups_options();
-    unset($options[$form['nid']['#value']]);
-    $form['target'] = array('#type' => 'select', '#title' => t('Target group'), '#default_value' => 0, '#options' => $options, '#weight' => 0, '#description' => t('If you chose <b>Move all group posts</b> above, specify a destination group.'));
-    // register a submit handler
+
+  // Create some options for the radio buttons.
+  $choices[] = t('Do nothing.');
+  if ($multiple_groups_exist) {
+    $choices[] = t('Delete all group posts which don\'t also belong to another group.');
+  }
+  else {
+    $choices[] = t('Delete all of this group\'s posts.');
+  }
+  if (user_access('administer nodes') && $multiple_groups_exist) {
+    $choices[] = t('Move all posts to another group.');
+  }
+  // Only show the descriptive text if there's more than one group to delete.
+  if ($multiple_groups_exist) {
+    $description = '<span id="og-delete-group-posts-description">In addition to deleting this group, you may choose how to disposition the posts within it.</span>';
+  }
+  else {
+    $description = 'When you delete this group, what should happen to it\'s posts?';
+  }
+  $form['verb'] = array(
+    '#type' => 'radios',
+    '#title' => t('This group\'s posts'),
+    '#description' => $description,
+    '#options' => $choices,
+    '#default_value' => 0,
+    '#weight' => 0,
+  );
+  // Make a CSS ID for the above-mentioned radio buttons.
+  $form['verb']['#attributes'] = array('id' => 'og-delete-group-radios');
+  
+  if (user_access('administer nodes') && $multiple_groups_exist) {
+    $form['target'] = array(
+      '#prefix' => '<div id="og-move-posts-to-group-selector">',
+      '#type' => 'select',
+      '#title' => t('Target group'),
+      '#description' => '',
+      '#options' => $dropdown_choices,
+      '#default_value' => 0,
+      '#weight' => 0,
+      '#suffix' => '</div>',
+    );
+    // make a css id for the above-mentioned dropdown menu.
+    $form['target']['#attributes'] = array('id' => 'og-delete-group-dropdown');
+
+    // Register a submit handler
     $form['#submit']['og_node_delete_confirm_submit'] = array();
   }
   $form['actions']['submit']['#value'] = t('Delete group');
@@ -1504,7 +1548,7 @@
     $node = node_load($child_nid);
     unset($node->og_groups[$deleted_group_nid]);
     if ($move_children) {
-      // there is an array_unique() in og_save_ancestry which giards against duplicates so don't worry here.
+      // there is an array_unique() in og_save_ancestry which guards against duplicates so don't worry here.
       $node->og_groups[] = $target_group_nid;
     }
     if ($delete_orphans && count($node->og_groups) == 0) {
