? .DS_Store
? 270302_11_upload_type_namespace_conflict_D7.patch
? 270302_13_upload_type_namespace_conflict_D7.patch
? 270302_8_upload_type_namespace_conflict_D7.patch
? block_body_required_00.patch
? form_required_cursor_01.patch
? make_node_optional_00.patch
? make_node_optional_01.patch
? make_node_optional_02.patch
? make_node_optional_03.patch
? password_colouring_00.patch
? upload_variable_conflict_00.patch
? modules/.DS_Store
? modules/simpletest/.DS_Store
? profiles/.DS_Store
? sites/.DS_Store
? sites/default/files
? sites/default/settings.php
Index: modules/system/system.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v
retrieving revision 1.24
diff -u -p -r1.24 system.api.php
--- modules/system/system.api.php	10 Mar 2009 16:08:43 -0000	1.24
+++ modules/system/system.api.php	15 Mar 2009 22:08:21 -0000
@@ -242,7 +242,7 @@ function hook_page_alter($page) {
  * One popular use of this hook is to add form elements to the node form. When
  * altering a node form, the node object retrieved at from $form['#node'].
  *
- * Note that you can also use hook_FORM_ID_alter() to alter a specific form,
+ * Note that you can also use hook_form_FORM_ID_alter() to alter a specific form,
  * instead of this hook, which gets called for all forms.
  *
  * @param $form
@@ -256,11 +256,11 @@ function hook_page_alter($page) {
  *   None.
  */
 function hook_form_alter(&$form, $form_state, $form_id) {
-  if (isset($form['type']) && $form['type']['#value'] . '_node_settings' == $form_id) {
-    $form['workflow']['upload_' . $form['type']['#value']] = array(
+  if ($form_id == 'node_type_form' && isset($form['identity']['type'])) {
+    $form['workflow']['upload_node_type'] = array(
       '#type' => 'radios',
       '#title' => t('Attachments'),
-      '#default_value' => variable_get('upload_' . $form['type']['#value'], 1),
+      '#default_value' => variable_get('upload_node_type_' . $form['#node_type']->type, 1),
       '#options' => array(t('Disabled'), t('Enabled')),
     );
   }
Index: modules/upload/upload.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.install,v
retrieving revision 1.8
diff -u -p -r1.8 upload.install
--- modules/upload/upload.install	15 Nov 2008 13:01:11 -0000	1.8
+++ modules/upload/upload.install	15 Mar 2009 22:08:21 -0000
@@ -82,4 +82,26 @@ function upload_schema() {
   return $schema;
 }
 
+/**
+ * Drupal 6.x to 7.x updates
+ */
 
+/**
+ * Rename upload_<node_type> variables to upload_node_type_<node_type>.
+ */
+function upload_update_7000() {
+  $variables = db_query("SELECT * FROM {variable} WHERE name LIKE 'upload_%'")
+    ->fetchAllKeyed();
+  $node_types = db_query("SELECT type FROM {node_type}")
+    ->fetchCol();
+  foreach ($node_types as $node_type) {
+    if (isset($variables['upload_' . $node_type])) {
+      variable_set('upload_node_type_' . $node_type, $variables['upload_' . $node_type]);
+      variable_del('upload_' . $node_type);
+    }
+  }
+}
+
+/**
+ * End of 6.x to 7.x updates
+ */
\ No newline at end of file
Index: modules/upload/upload.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v
retrieving revision 1.229
diff -u -p -r1.229 upload.module
--- modules/upload/upload.module	8 Mar 2009 04:25:07 -0000	1.229
+++ modules/upload/upload.module	15 Mar 2009 22:08:22 -0000
@@ -211,19 +211,22 @@ function upload_node_form_submit(&$form,
   }
 }
 
+/*
+ * Implementation of hook_form_alter().
+ */
 function upload_form_alter(&$form, $form_state, $form_id) {
   if ($form_id == 'node_type_form' && isset($form['identity']['type'])) {
-    $form['workflow']['upload'] = array(
+    $form['workflow']['upload_node_type'] = array(
       '#type' => 'radios',
       '#title' => t('Attachments'),
-      '#default_value' => variable_get('upload_' . $form['#node_type']->type, 1),
+      '#default_value' => variable_get('upload_node_type_' . $form['#node_type']->type, 1),
       '#options' => array(t('Disabled'), t('Enabled')),
     );
   }
 
   if (!empty($form['#node_edit_form'])) {
     $node = $form['#node'];
-    if (variable_get("upload_$node->type", TRUE)) {
+    if (variable_get('upload_node_type_' . $node->type, TRUE)) {
       // Attachments fieldset
       $form['attachments'] = array(
         '#type' => 'fieldset',
@@ -306,7 +309,7 @@ function upload_node_load($nodes, $types
   // Collect all the revision ids for nodes with upload enabled.
   $node_vids = array();
   foreach ($nodes as $node) {
-    if (variable_get("upload_$node->type", 1) == 1) {
+    if (variable_get('upload_node_type_' . $node->type, 1) == 1) {
       $node_vids[$node->vid] = $node->vid;
       $node->files = array();
     }
Index: modules/upload/upload.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.test,v
retrieving revision 1.13
diff -u -p -r1.13 upload.test
--- modules/upload/upload.test	22 Feb 2009 17:55:30 -0000	1.13
+++ modules/upload/upload.test	15 Mar 2009 22:08:22 -0000
@@ -2,6 +2,9 @@
 // $Id: upload.test,v 1.13 2009/02/22 17:55:30 dries Exp $
 
 class UploadTestCase extends DrupalWebTestCase {
+  protected $admin_user;
+  protected $web_user;
+
   function getInfo() {
     return array(
       'name' => t('Upload functionality'),
@@ -12,6 +15,8 @@ class UploadTestCase extends DrupalWebTe
 
   function setUp() {
     parent::setUp('upload');
+    $this->admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer content types'));
+    $this->web_user = $this->drupalCreateUser(array('access content', 'edit any page content', 'upload files', 'view uploaded files'));
   }
 
   /**
@@ -19,10 +24,7 @@ class UploadTestCase extends DrupalWebTe
    */
   function testNodeUpload() {
     global $base_url;
-    $admin_user = $this->drupalCreateUser(array('administer site configuration'));
-    $web_user = $this->drupalCreateUser(array('access content', 'edit any page content', 'upload files', 'view uploaded files'));
-
-    $this->drupalLogin($admin_user);
+    $this->drupalLogin($this->admin_user);
 
     // Setup upload settings.
     $edit = array();
@@ -34,7 +36,7 @@ class UploadTestCase extends DrupalWebTe
     $this->assertText('The configuration options have been saved.', 'Upload setting saved.');
 
     $this->drupalLogout();
-    $this->drupalLogin($web_user);
+    $this->drupalLogin($this->web_user);
 
     // Create a node and attempt to attach files.
     $node = $this->drupalCreateNode();
@@ -84,13 +86,34 @@ class UploadTestCase extends DrupalWebTe
   }
 
   /**
+   * Test disabling attachments.
+   */
+  function testContentTypeSettings() {
+    $this->drupalLogin($this->admin_user);
+
+    // Setup upload settings.
+    $edit = array();
+    $edit['upload_node_type'] = '0'; // Disabled.
+    $this->drupalPost('admin/build/node-type/article', $edit, 'Save content type');
+    $this->assertText(t('The content type Article has been updated.'), 'Attachment setting saved.');
+
+    // Add a new article. Because attachments are disabled, we should not see a
+    // 'File Attachments'-fieldset.
+    $this->drupalGet('node/add/article');
+    $this->assertNoText(t('File attachments'), 'Node add page does not contain a File Attachments fieldset.');
+
+    // Enable file attachments again for other tests.
+    $edit = array();
+    $edit['upload_node_type'] = '1'; // Enabled.
+    $this->drupalPost('admin/build/node-type/article', $edit, 'Save content type');
+    $this->assertText(t('The content type Article has been updated.'), 'Attachment setting saved.');
+  }
+
+  /**
    * Ensure the the file filter works correctly by attempting to upload a non-allowed file extension.
    */
   function testFilesFilter() {
-    $admin_user = $this->drupalCreateUser(array('administer site configuration'));
-    $web_user = $this->drupalCreateUser(array('access content', 'edit any page content', 'upload files', 'view uploaded files'));
-
-    $this->drupalLogin($admin_user);
+    $this->drupalLogin($this->admin_user);
 
     // Setup upload settings.
     $settings = array();
@@ -98,9 +121,9 @@ class UploadTestCase extends DrupalWebTe
     $settings['upload_extensions'] = 'html';
     $settings['upload_uploadsize'] = '1';
     $settings['upload_usersize'] = '1';
-    $this->setUploadSettings($settings, $this->getSimpletestRoleId($web_user));
+    $this->setUploadSettings($settings, $this->getSimpletestRoleId($this->web_user));
 
-    $this->drupalLogin($web_user);
+    $this->drupalLogin($this->web_user);
 
     $node = $this->drupalCreateNode();
 
@@ -130,10 +153,7 @@ class UploadTestCase extends DrupalWebTe
     $files = $this->drupalGetTestFiles('text', 1310720); // 1 MB.
     $file = current($files)->filepath;
 
-    $admin_user = $this->drupalCreateUser(array('administer site configuration'));
-    $web_user = $this->drupalCreateUser(array('access content', 'edit any page content', 'upload files', 'view uploaded files'));
-
-    $this->drupalLogin($admin_user);
+    $this->drupalLogin($this->admin_user);
 
     // Setup upload settings.
     $settings = array();
@@ -141,9 +161,9 @@ class UploadTestCase extends DrupalWebTe
     $settings['upload_extensions'] = 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp';
     $settings['upload_uploadsize'] = '0.5';
     $settings['upload_usersize'] = '1.5';
-    $this->setUploadSettings($settings, $this->getSimpletestRoleId($web_user));
+    $this->setUploadSettings($settings, $this->getSimpletestRoleId($this->web_user));
 
-    $this->drupalLogin($web_user);
+    $this->drupalLogin($this->web_user);
 
     $node = $this->drupalCreateNode();
 
