? dif
cvs diff: Diffing .
Index: og_project.install
===================================================================
RCS file: og_project.install
diff -N og_project.install
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ og_project.install	30 Jul 2009 07:46:38 -0000
@@ -0,0 +1,16 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Database configuration for og_project.
+ */
+
+/**
+ * Implement hook_install().
+ */
+function og_project_install() {
+  // Make this module heavier than project_release and og.
+  db_query("UPDATE {system} SET weight = %d WHERE name = 'og_project'", 3);
+}
+
Index: og_project.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og_project/og_project.module,v
retrieving revision 1.3
diff -u -p -r1.3 og_project.module
--- og_project.module	18 Jun 2009 04:41:30 -0000	1.3
+++ og_project.module	30 Jul 2009 07:46:38 -0000
@@ -7,3 +7,50 @@
  * Handles the interaction between organic groups and the project module.
  */
 
+
+/**
+ * Implement hook_menu().
+ */
+function og_project_menu() {
+  $items['admin/project/og-project-settings'] = array(
+    'description' => 'Configure settings for the integration between Organic Groups and the Project family of modules.',
+    'title' => 'OG Project settings',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('og_project_settings_form'),
+    'access arguments' => array('administer projects'),
+    'weight' => 1,
+    'type' => MENU_NORMAL_ITEM,
+    'file' => 'og_project.settings.inc',
+  );
+  return $items;
+}
+
+/**
+ * Implement hook_form_alter().
+ *
+ * Note: we have to use hook_form_alter(), not the form_id-specific version,
+ * so that we're sure to come after other modules (namely OG) have altered the
+ * forms.
+ */
+function og_project_form_alter(&$form, $form_state, $form_id) {
+  if ($form_id == 'project_release_node_form') {  
+    return og_project_release_node_form_alter($form, $form_state);
+  }
+}
+
+/**
+ * Alter the project_release node form.
+ */
+function og_project_release_node_form_alter(&$form, $form_state) {
+  if (variable_get('og_project_release_automatic_audience', FALSE)) {
+    if (!empty($form['project'])) {
+      // If we have a project in the $form, it's adding a new release, so
+      // force the group audience to match the parent project for this release.
+      $project_nid = $form['project']['#value']->nid;
+      $form['og_nodeapi']['visible']['og_groups']['#default_value'] = array($project_nid);
+    }
+    // Either way, hide the OG UI.
+    $form['og_nodeapi']['#access'] = FALSE;
+  }
+}
+
Index: og_project.settings.inc
===================================================================
RCS file: og_project.settings.inc
diff -N og_project.settings.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ og_project.settings.inc	30 Jul 2009 07:46:38 -0000
@@ -0,0 +1,39 @@
+<?php
+
+// $Id$
+
+/**
+ * @file
+ * Code for the settings page for OG Project.
+ */
+
+/**
+ * Form builder for the administrative settings page.
+ */
+function og_project_settings_form($form_state) {
+  $project_group_behavior = variable_get('og_content_type_usage_project_project', 'group_post_standard');
+  if ($project_group_behavior == 'group') {
+    $node_type_names['%project'] = node_get_types('name', 'project_project');
+    if (module_exists('project_release')) {
+      $node_type_names['%project_release'] = node_get_types('name', 'project_release');
+    }
+    $form['og_project_audience'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Automatic group audience for %project content', $node_type_names),
+      '#description' => t('Your site is configured such that %project nodes act as organic group nodes. Every %project can have other content associated with it. You can have these related types of content automatically configured to use the group of their parent project as the group audience field.', $node_type_names),
+    );
+    if (module_exists('project_release')) {
+      $form['og_project_audience']['og_project_release_automatic_audience'] = array(
+        '#title' => t('Automatically set group audience for %project_release content', $node_type_names),
+        '#type' => 'checkbox',
+        '#default_value' => variable_get('og_project_release_automatic_audience', FALSE),
+        '#description' => t('If enabled, the group audience field for %project_release content will automatically be set to the %project that each %project_release belongs to.', $node_type_names),
+      );
+    }
+  }
+  if (!empty($form)) {
+    return system_settings_form($form);
+  }
+  return array();
+}
+
