? 252877-execute.patch
? domain-submit_0.patch
Index: domain.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain.module,v
retrieving revision 1.98
diff -u -p -r1.98 domain.module
--- domain.module	23 Mar 2009 15:39:06 -0000	1.98
+++ domain.module	24 Mar 2009 20:06:27 -0000
@@ -922,9 +922,19 @@ function domain_node_grants($account, $o
  * if no options are selected, the node is assigned to the main site.
  */
 function domain_node_access_records($node) {
+  global $_domain;
   // Define the $grants array.
   $grants = array();
-
+  // Check to see if the node domains were set properly.
+  // If not, we are dealing with an automated node process, which
+  // means we have to add the logic from hook_form_alter() here.
+  if (!isset($node->domain_site)) {
+    // We came from a separate source, so let's set the proper defaults.
+    $node->domain_site = variable_get('domain_node_'. $node->type, variable_get('domain_behavior', DOMAIN_INSTALL_RULE));
+    // And the currently active domain.
+    $node->domains = array($_domain['domain_id'] => $_domain['domain_id']);
+  }
+  
   // If the form is hidden, we are passed the 'domains_raw' variable.
   // We need to append unique values from this variable to the existing
   // stored values.  See the logic for 'view domain publshing' in domain_form_alter().
Index: domain_source/README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain_source/README.txt,v
retrieving revision 1.3
diff -u -p -r1.3 README.txt
--- domain_source/README.txt	30 Mar 2008 17:51:46 -0000	1.3
+++ domain_source/README.txt	24 Mar 2009 20:06:28 -0000
@@ -90,7 +90,7 @@ Access module:
   domain.  With Domain Source, it also allows users to assign that content to
   any domain as the "source" domain.
 
-  -- 'view domain publishing'
+  -- 'publish to any assigned domain'
   This permission lets affiliate editors select publishing options for the
   domains on which they are editors.  If these users are allowed to select
   the affiliate domains for their content, they will also be allowed to assign
@@ -105,15 +105,8 @@ domain.
 ----
 3.2 Content Editing Forms
 
-Users with the 'view domain publishing' permission will only be able to select
-a "source" domain only if the "Content editing forms" setting on Admin > Build
-> Domains is set to:
-
-  -- Show user their publishing options
-  The node editing form is shown normally, and the user is presented a
-  list of checkboxes.  These options represent the affilaite domains that
-  the user is allowed to publish content to, according to the domains
-  assigned to their user account.
+Only users with the 'set domain access' or  'publish to any assigned domain' 
+permission will be able to select a "source" domain.
 
 Otherwise, domain assignments will be done automatically, based on the currently
 active domain.
Index: domain_source/domain_source.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain_source/domain_source.module,v
retrieving revision 1.10
diff -u -p -r1.10 domain_source.module
--- domain_source/domain_source.module	1 Aug 2008 15:18:36 -0000	1.10
+++ domain_source/domain_source.module	24 Mar 2009 20:06:28 -0000
@@ -32,7 +32,7 @@ function domain_source_form_alter(&$form
       }
     }
     // In the case of users with limited permissions, option 3 is the "show options" value.
-    else if (user_access('view domain publishing') && variable_get('domain_options', 0) == 3) {
+    else if (user_access('publish to any assigned domain')) {
       global $user;
       // Get the user's allowed domains.
       foreach ($domains as $domain) {
@@ -77,7 +77,6 @@ function domain_source_form_alter(&$form
     global $_domain;
     $options = array();
     $domains = domain_domains();
-    $show = FALSE;
     if (user_access('set domain access')) {
       foreach ($domains as $domain) {
         $options[$domain['domain_id']] = $domain['sitename'];
@@ -101,6 +100,10 @@ function domain_source_form_alter(&$form
 function domain_source_nodeapi(&$node, $op, $a3, $a4) {
   switch ($op) {
     case 'validate':
+      // If not set, we ignore.
+      if (!isset($node->domain_source)) {
+        return;
+      }
       // Cast the key from zero to -1 to match the data coming from the input.
       ($node->domain_source == 0) ? $key = -1 : $key = $node->domain_source;
       if ($node->domain_site && $key == -1) {
@@ -115,6 +118,11 @@ function domain_source_nodeapi(&$node, $
       break;
     case 'insert':
     case 'update':
+      global $_domain;
+      // If not set, we came from a drupal_execute() or other external call, so use the current domain.
+      if (!isset($node->domain_source)) {
+        $node->domain_source = $_domain['domain_id'];
+      }
       db_query("DELETE FROM {domain_source} WHERE nid = %d", $node->nid);
       db_query("INSERT INTO {domain_source} (nid, domain_id) VALUES (%d, %d)", $node->nid, $node->domain_source);
       break;
