Index: webform.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.module,v
retrieving revision 1.212
diff -u -r1.212 webform.module
--- webform.module	1 Apr 2010 02:07:54 -0000	1.212
+++ webform.module	3 Apr 2010 02:37:17 -0000
@@ -1150,7 +1150,7 @@
   }
 
   // Print out messages for the webform.
-  if (!empty($node->in_preview) && !$logging_in) {
+  if (empty($node->in_preview) && !$logging_in) {
     theme('webform_view_messages', array('node' => $node, 'teaser' => $teaser, 'page' => $page, 'submission_count' => $submission_count, 'limit_exceeded' => $limit_exceeded, 'allowed_roles' => $allowed_roles));
   }
 
@@ -1804,7 +1804,7 @@
     'uid' => $user->uid,
     'submitted' => REQUEST_TIME,
     'remote_addr' => ip_address(),
-    'is_draft' => $is_draft,
+    'is_draft' => (int) $is_draft,
     'data' => webform_submission_data($node, $form_state['values']['submitted']),
   );
 
@@ -2329,7 +2329,7 @@
     ),
     'unsafe' => array(
       '%cookie' => $_COOKIE,
-      '%session' => $_SESSION,
+      '%session' => isset($_SESSION) ? $_SESSION : array(),
       '%request' => $_REQUEST,
       '%server' => $_SERVER,
       '%profile' => (array) $user,
@@ -2342,8 +2342,8 @@
 
     // Load profile information if available.
     if ($user->uid && module_exists('profile')) {
-      profile_load_profile($user);
-      $special_tokens['unsafe']['%profile'] = (array) $user;
+      $account = user_load($user->uid);
+      $special_tokens['unsafe']['%profile'] = (array) $account;
     }
 
     // User replacements.
Index: webform.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.install,v
retrieving revision 1.45
diff -u -r1.45 webform.install
--- webform.install	27 Mar 2010 18:21:02 -0000	1.45
+++ webform.install	3 Apr 2010 02:37:15 -0000
@@ -334,13 +334,13 @@
   $webform_type = array(
     'type' => 'webform',
     'name' => st('Webform'),
-    'module' => 'node',
+    'base' => 'node_content',
     'description' => st('Create a new form or questionnaire accessible to users. Submission results and statistics are recorded and accessible to privileged users.'),
     'custom' => TRUE,
     'modified' => TRUE,
     'locked' => FALSE,
   );
-  $webform_type = (object) node_type_set_defaults($webform_type);
+  $webform_type = node_type_set_defaults($webform_type);
   node_type_save($webform_type);
 }
 
@@ -365,7 +365,7 @@
   }
 
   // Delete uploaded files.
-  $filepath = file_create_path('webform');
+  $filepath = file_build_uri('webform');
   _webform_recursive_delete($filepath);
 
   // Drop tables.
Index: webform.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.info,v
retrieving revision 1.7
diff -u -r1.7 webform.info
--- webform.info	11 Mar 2010 01:40:11 -0000	1.7
+++ webform.info	3 Apr 2010 02:37:14 -0000
@@ -3,6 +3,8 @@
 description = Enables the creation of forms and questionnaires.
 core = 7.x
 package = Webform
+configure = admin/config/content/webform
+
 files[] = webform.module
 files[] = webform.install
 
@@ -32,4 +34,9 @@
 files[] = views/webform_handler_field_submission_count.inc
 files[] = views/webform_handler_field_submission_link.inc
 files[] = views/webform_handler_filter_is_draft.inc
-files[] = views/webform.views.inc
\ No newline at end of file
+files[] = views/webform.views.inc
+
+files[] = tests/components.test
+files[] = tests/permissions.test
+files[] = tests/submission.test
+files[] = tests/webform.test
Index: includes/webform.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/includes/webform.pages.inc,v
retrieving revision 1.13
diff -u -r1.13 webform.pages.inc
--- includes/webform.pages.inc	27 Mar 2010 18:21:02 -0000	1.13
+++ includes/webform.pages.inc	3 Apr 2010 02:37:17 -0000
@@ -34,13 +34,13 @@
   );
 
   $form['submission']['confirmation'] = array(
-    '#type' => 'textarea',
+    '#type' => 'text_format',
     '#title' => t('Confirmation message'),
     '#description' => t('Message to be shown upon successful submission. If <em>Redirect URL</em> is set this displays as a message, otherwise it will be shown on its own page.'),
     '#default_value' => $node->webform['confirmation'],
     '#cols' => 40,
     '#rows' => 10,
-    '#text_format' => $node->webform['confirmation_format'],
+    '#format' => $node->webform['confirmation_format'],
     '#parents' => array('confirmation'),
   );
 
@@ -189,7 +189,7 @@
 
   // Save the confirmation.
   $node->webform['confirmation'] = $form_state['values']['confirmation'];
-  $node->webform['confirmation_format'] = $form_state['values']['confirmation_format'];
+  $node->webform['confirmation_format'] = $form_state['values']['format'];
 
   // Save the redirect URL
   $node->webform['redirect_url'] = $form_state['values']['redirect_url'];
Index: tests/permissions.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/tests/permissions.test,v
retrieving revision 1.4
diff -u -r1.4 permissions.test
--- tests/permissions.test	3 Mar 2010 02:51:37 -0000	1.4
+++ tests/permissions.test	3 Apr 2010 02:37:17 -0000
@@ -46,7 +46,7 @@
     // Test that the authenticated user is able to access.
     $this->drupalLogin($this->webform_users['userAccess']);
     $this->drupalGet('node/' . $node->nid);
-    $this->assertText($node->body, t('Webform node created and accessible to authenticated users at !url', array('!url' => 'node/' . $node->nid)), t('Webform'));
+    $this->assertText($node->body[LANGUAGE_NONE][0]['value'], t('Webform node created and accessible to authenticated users at !url', array('!url' => 'node/' . $node->nid)), t('Webform'));
 
     // Confirm that the submission has been created.
     $this->drupalPost(NULL, array(), 'Submit');
@@ -55,10 +55,10 @@
 
     // The anonymous user should not be able to submit.
     $this->drupalGet('node/' . $node->nid);
+
     // Note: Should be: You must <a href="!login">login</a> or <a href="!register">register</a> to view this form.
     // Something in SimpleTest isn't handling the string correctly.
-    $this->assertText(t('to view this form.', array('!login' => url('user/login'), '!register' => url('user/register'))), t('Anonymous user is not allowed to submit form.'), t('Webform'));
-    $this->drupalLogout();
+    $this->assertText('to view this form.', t('Anonymous user is not allowed to submit form.'), t('Webform'));
   }
 
   /**
Index: tests/webform.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/tests/webform.test,v
retrieving revision 1.7
diff -u -r1.7 webform.test
--- tests/webform.test	27 Mar 2010 18:21:02 -0000	1.7
+++ tests/webform.test	3 Apr 2010 02:37:18 -0000
@@ -12,17 +12,6 @@
   public $webform_users;
 
   /**
-   * Implementation of getInfo().
-   */
-  public static function getInfo() {
-    return array(
-      'name' => t('Webform'),
-      'description' => t('Parent test suite used to setup Webform tests.'),
-      'group' => t('Webform'),
-    );
-  }
-
-  /**
    * Implementation of setUp().
    */
   function setUp() {
@@ -30,7 +19,7 @@
     parent::setUp('webform', 'profile');
 
     // Create a profile field to test %profile tokens.
-    db_query("INSERT INTO {profile_fields} (title, name, explanation, category, type, weight, required, register, visibility, autocomplete, options, page) VALUES ('Gender', 'profile_gender', '', 'Profile', 'textfield', 0, 0, 0, 2, 0, '', '')");
+    db_query("INSERT INTO {profile_field} (title, name, explanation, category, type, weight, required, register, visibility, autocomplete, options, page) VALUES ('Gender', 'profile_gender', '', 'Profile', 'textfield', 0, 0, 0, 2, 0, '', '')");
 
     // Create a normal user that can view their own submissions.
     $permissions['userAccess'] = array(
@@ -78,8 +67,11 @@
     // Delete the webform admin and any created nodes.
     foreach ($this->webform_users as $account) {
       $uid = $account->uid;
-      $result = db_query('SELECT nid FROM {node} WHERE uid = :uid', array(':uid' => $uid));
-      foreach ($result->execute() as $node) {
+      $result = db_select('node')
+        ->fields('node')
+        ->condition('uid', $uid)
+        ->execute();
+      foreach ($result as $node) {
         node_delete($node->nid);
       }
       user_cancel(array(), $uid, 'user_cancel_delete');
@@ -113,14 +105,6 @@
       return $this->_webform_components;
     }
 
-    // Time components use a lot of conversion factors, generate a list of times
-    // equal to 10:30pm (the default value used as a sample).
-    $timestamp = strtotime('10:30pm');
-    $site_hour12 = gmdate('g', $timestamp + (int)variable_get('date_default_timezone', 0));
-    $site_hour24 = gmdate('G', $timestamp + (int)variable_get('date_default_timezone', 0));
-    $site_minute = gmdate('i', $timestamp + (int)variable_get('date_default_timezone', 0));
-    $site_ampm = gmdate('a', $timestamp + (int)variable_get('date_default_timezone', 0));
-
     $this->_webform_components = array(
       // Test date components.
       'date' => array(
@@ -141,8 +125,8 @@
           'page_num' => 1,
         ),
         'sample values' => array('day' => '30', 'month' => '9', 'year' => '1982'),
-        'database values' => array('9', '30', '1982'),
-        'database default values' => array('11', '19', '1978'),
+        'database values' => array('1982-09-30'),
+        'database default values' => array('1978-11-19'),
       ),
 
       // Test grid components.
@@ -153,8 +137,8 @@
           'type' => 'grid',
           'value' => '',
           'extra' => array(
-            'questions' => "Ålphå\nıé†å\nÎé¬†å", // Left side
-            'options' => "øne\ntwö\nǼBƇ\n€Euro", // Top
+            'questions' => "0|Ålphå\n1|ıé†å\n2|Îé¬†å", // Left side
+            'options' => "0|øne\n1|twö\n2|ǼBƇ\n3|€Euro", // Top
           ),
           'mandatory' => '0',
           'email' => '1',
@@ -162,8 +146,8 @@
           'weight' => '-19',
           'page_num' => 1,
         ),
-        'sample values' => array('q1' => 'øne', 'q2' => 'twö', 'q3' => 'ǼBƇ'),
-        'database values' => array('øne', 'twö', 'ǼBƇ'),
+        'sample values' => array('0' => '0', '1' => '1', '2' => '2'),
+        'database values' => array('0' => '0', '1' => '1', '2' => '2'),
         'database default values' => array('', '', ''),
       ),
       'grid_keyed' => array(
@@ -173,7 +157,7 @@
           'type' => 'grid',
           'value' => '',
           'extra' => array(
-            'questions' => "What's your option?\nAgåin?\nOne more time!", // Left side.
+            'questions' => "one|What's your option?\ntwo|Agåin?\nthree|One more time!", // Left side.
             'options' => "one|Option one\ntwo|Option 2\nthree| Three is me", // Top
           ),
           'mandatory' => '0',
@@ -182,61 +166,9 @@
           'weight' => '-15',
           'page_num' => 1,
         ),
-        'sample values' => array(
-          'q1' => 'one',
-          'q2' => 'two',
-          'q3' => 'three',
-        ),
-        'database values' => array('one', 'two', 'three'),
-        'database default values' => array('', '', ''),
-      ),
-      'grid_mixed' => array(
-        'component' => array(
-          'form_key' => 'grid_mixed',
-          'name' => 'Grid Mixed',
-          'type' => 'grid',
-          'value' => '',
-          'extra' => array(
-            'questions' => "Ålphå\nıé†å\nÎé¬†å", // Left side
-            'options' => "øne\ntwö\nǼBƇ\n€Euro", // Top
-            'optrand' => 1,
-            'qrand' => 1,
-          ),
-          'mandatory' => '0',
-          'email' => '1',
-          'pid' => '2',
-          'weight' => '-19',
-          'page_num' => 1,
-        ),
-        'sample values' => array('q1' => 'øne', 'q2' => 'twö', 'q3' => 'ǼBƇ'),
-        'database values' => array('øne', 'twö', 'ǼBƇ'),
-        'database default values' => array('', '', ''),
-      ),
-      'grid_keyed_mixed' => array(
-        'component' => array(
-          'form_key' => 'grid_keyed_mixed',
-          'name' => 'Grid Keyed',
-          'type' => 'grid',
-          'value' => '',
-          'extra' => array(
-            'questions' => "What's your option?\nAgåin?\nOne more time!", // Left side.
-            'options' => "one|Option one\ntwo|Option 2\nthree| Three is me", // Top
-            'optrand' => 1,
-            'qrand' => 1,
-          ),
-          'mandatory' => '0',
-          'email' => '1',
-          'pid' => '0',
-          'weight' => '-15',
-          'page_num' => 1,
-        ),
-        'sample values' => array(
-          'q1' => 'one',
-          'q2' => 'two',
-          'q3' => 'three',
-        ),
-        'database values' => array('one', 'two', 'three'),
-        'database default values' => array('', '', ''),
+        'sample values' => array('one' => 'one', 'two' => 'two', 'three' => 'three'),
+        'database values' => array('one' => 'one', 'two' => 'two', 'three' => 'three'),
+        'database default values' => array('one' => '', 'two' => '', 'three' => ''),
       ),
 
       // Test select components.
@@ -247,7 +179,7 @@
           'type' => 'select',
           'value' => 'two',
           'extra' => array(
-            'items' => "one\ntwo\nthree",
+            'items' => "one|one\ntwo|two\nthree|three",
             'multiple' => 'Y',
             'email' => 0,
           ),
@@ -261,6 +193,26 @@
         'database values' => array('one', 'three'),
         'database default values' => array('two'),
       ),
+      'checkboxes_zero' => array(
+        'component' => array(
+          'form_key' => 'checkboxes_zero',
+          'name' => 'Checkboxes zero',
+          'type' => 'select',
+          'value' => '0',
+          'extra' => array(
+            'items' => "0|zero\n1|one\n2|two",
+            'email' => 0,
+          ),
+          'mandatory' => '1',
+          'email' => '1',
+          'pid' => '0',
+          'weight' => '-9',
+          'page_num' => 1,
+        ),
+        'sample values' => '0',
+        'database values' => array('0'),
+        'database default values' => array('0'),
+      ),
       'radios' => array(
         'component' => array(
           'form_key' => 'radios',
@@ -268,7 +220,7 @@
           'type' => 'select',
           'value' => 'two',
           'extra' => array(
-            'items' => "one\ntwo\nthree",
+            'items' => "one|one\ntwo|two\nthree|three",
             'email' => 0,
           ),
           'mandatory' => '1',
@@ -284,7 +236,7 @@
       'radios_zero' => array(
         'component' => array(
           'form_key' => 'radios_zero',
-          'name' => 'Radios',
+          'name' => 'Radios zero',
           'type' => 'select',
           'value' => '0',
           'extra' => array(
@@ -309,7 +261,7 @@
           'value' => 'one',
           'extra' => array(
             'description' => '<p>Description here</p>',
-            'items' => "one\ntwo\nthree\nfour\nfive\nsix",
+            'items' => "one|one\ntwo|two\nthree|three\nfour|four\nfive|five\nsix|six",
             'aslist' => 'Y',
             'email' => 0,
           ),
@@ -353,7 +305,7 @@
           'value' => 'option 1-2',
           'extra' => array(
             'description' => '<p>Tests saving zero as a value.</p>',
-            'items' => "<Group 1>\noption 1-1\noption 1-2\noption 1-3\n<Group 2>\noption 2-1\noption 2-2\noption 2-3",
+            'items' => "<Group 1>\noption 1-1|option 1-1\noption 1-2|option 1-2\noption 1-3|option 1-3\n<Group 2>\noption 2-1|option 2-1\noption 2-2|option 2-2\noption 2-3|option 2-3",
             'aslist' => 'Y',
             'email' => 0,
           ),
@@ -372,9 +324,9 @@
           'form_key' => 'select_email',
           'name' => 'Select e-mails',
           'type' => 'select',
-          'value' => 'nate@localhost',
+          'value' => 'nate@localhost.localhost',
           'extra' => array(
-            'items' => "nate@localhost|one\nadmin@localhost|two",
+            'items' => "nate@localhost.localhost|one\nadmin@localhost.localhost|two",
             'email' => 3,
           ),
           'mandatory' => '0',
@@ -383,9 +335,9 @@
           'weight' => '-17',
           'page_num' => 1,
         ),
-        'sample values' => 'admin@localhost',
-        'database values' => array('admin@localhost'),
-        'database default values' => array('nate@localhost'),
+        'sample values' => 'admin@localhost.localhost',
+        'database values' => array('admin@localhost.localhost'),
+        'database default values' => array('nate@localhost.localhost'),
       ),
       'select_multiple' => array(
         'component' => array(
@@ -394,7 +346,7 @@
           'type' => 'select',
           'value' => 'one,two',
           'extra' => array(
-            'items' => "one\ntwo\nthree",
+            'items' => "one|one\ntwo|two\nthree|three",
             'multiple' => 'Y',
             'aslist' => 'Y',
             'email' => 0,
@@ -431,8 +383,8 @@
           'page_num' => 1,
         ),
         'sample values' => array('day' => '30', 'month' => '9', 'year' => '1982'),
-        'database values' => array('9', '30', '1982'),
-        'database default values' => array('11', '19', '1978'),
+        'database values' => array('1982-09-30'),
+        'database default values' => array('1978-11-19'),
       ),
 
       // Test email components.
@@ -451,8 +403,8 @@
           'weight' => '-5',
           'page_num' => 1,
         ),
-        'sample values' => 'admin@localhost',
-        'database values' => array('admin@localhost'),
+        'sample values' => 'admin@localhost.localhost',
+        'database values' => array('admin@localhost.localhost'),
         'database default values' => array($this->webform_users['admin']->mail),
       ),
 
@@ -553,9 +505,9 @@
           'weight' => '16',
           'page_num' => 1,
         ),
-        'sample values' => array('hour' => '5', 'minute' => '00', 'ampm' => 'am'),
-        'database values' => array('5', '00', 'am'),
-        'database default values' => array($site_hour12, $site_minute, $site_ampm),
+        'sample values' => array('hour' => '5', 'minute' => '0', 'ampm' => 'am'),
+        'database values' => array('05:00:00'),
+        'database default values' => array('22:30:00'),
       ),
       'time_24h' => array(
         'component' => array(
@@ -573,9 +525,9 @@
           'weight' => '17',
           'page_num' => 1,
         ),
-        'sample values' => array('hour' => '5', 'minute' => '00'),
-        'database values' => array('5', '00'),
-        'database default values' => array($site_hour24, $site_minute),
+        'sample values' => array('hour' => '5', 'minute' => '0'),
+        'database values' => array('05:00:00'),
+        'database default values' => array('22:30:00'),
       ),
     );
 
@@ -589,7 +541,7 @@
 
     $settings = array(
      'type' => 'webform',
-     'language' => '',
+     'language'  => LANGUAGE_NONE,
      'uid' => '1',
      'status' => '1',
      'promote' => '1',
@@ -598,13 +550,14 @@
      'tnid' => '0',
      'translate' => '0',
      'title' => 'Test Webform',
-     'body' => 'Donec placerat. Nullam nibh dolor, blandit sed, fermentum id, imperdiet sit amet, neque. Nam mollis ultrices justo. Sed tempor. Sed vitae tellus. Etiam sem arcu, eleifend sit amet, gravida eget, porta at, wisi. Nam non lacus vitae ipsum viverra pretium. Phasellus massa. Fusce magna sem, gravida in, feugiat ac, molestie eget, wisi. Fusce consectetuer luctus ipsum. Vestibulum nunc. Suspendisse dignissim adipiscing libero. Integer leo. Sed pharetra ligula a dui. Quisque ipsum nibh, ullamcorper eget, pulvinar sed, posuere vitae, nulla. Sed varius nibh ut lacus. Curabitur fringilla. Nunc est ipsum, pretium quis, dapibus sed, varius non, lectus. Proin a quam. Praesent lacinia, eros quis aliquam porttitor, urna lacus volutpat urna, ut fermentum neque mi egestas dolor.',
-     'teaser' => 'Donec placerat. Nullam nibh dolor, blandit sed, fermentum id, imperdiet sit amet, neque. Nam mollis ultrices justo. Sed tempor. Sed vitae tellus. Etiam sem arcu, eleifend sit amet, gravida eget, porta at, wisi. Nam non lacus vitae ipsum viverra pretium. Phasellus massa. Fusce magna sem, gravida in, feugiat ac, molestie eget, wisi. Fusce consectetuer luctus ipsum. Vestibulum nunc. Suspendisse dignissim adipiscing libero. Integer leo. Sed pharetra ligula a dui. Quisque ipsum nibh, ullamcorper eget, pulvinar sed, posuere vitae, nulla. Sed varius nibh ut lacus. Curabitur fringilla.',
+     'body' => array(LANGUAGE_NONE => array(array('value' => 'Donec placerat. Nullam nibh dolor, blandit sed, fermentum id, imperdiet sit amet, neque. Nam mollis ultrices justo. Sed tempor. Sed vitae tellus. Etiam sem arcu, eleifend sit amet, gravida eget, porta at, wisi. Nam non lacus vitae ipsum viverra pretium. Phasellus massa. Fusce magna sem, gravida in, feugiat ac, molestie eget, wisi. Fusce consectetuer luctus ipsum. Vestibulum nunc. Suspendisse dignissim adipiscing libero. Integer leo. Sed pharetra ligula a dui. Quisque ipsum nibh, ullamcorper eget, pulvinar sed, posuere vitae, nulla. Sed varius nibh ut lacus. Curabitur fringilla. Nunc est ipsum, pretium quis, dapibus sed, varius non, lectus. Proin a quam. Praesent lacinia, eros quis aliquam porttitor, urna lacus volutpat urna, ut fermentum neque mi egestas dolor.'))),
+     'teaser' => array(LANGUAGE_NONE => array(array('value' => 'Donec placerat. Nullam nibh dolor, blandit sed, fermentum id, imperdiet sit amet, neque. Nam mollis ultrices justo. Sed tempor. Sed vitae tellus. Etiam sem arcu, eleifend sit amet, gravida eget, porta at, wisi. Nam non lacus vitae ipsum viverra pretium. Phasellus massa. Fusce magna sem, gravida in, feugiat ac, molestie eget, wisi. Fusce consectetuer luctus ipsum. Vestibulum nunc. Suspendisse dignissim adipiscing libero. Integer leo. Sed pharetra ligula a dui. Quisque ipsum nibh, ullamcorper eget, pulvinar sed, posuere vitae, nulla. Sed varius nibh ut lacus. Curabitur fringilla.'))),
      'log' => '',
      'format' => '1',
      'webform' => array(
         'confirmation' => 'Thanks!',
         'confirmation_format' => filter_default_format(),
+        'redirect_url' => '',
         'teaser' => '0',
         'allow_draft' => '1',
         'submit_text' => '',
Index: tests/submission.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/tests/submission.test,v
retrieving revision 1.6
diff -u -r1.6 submission.test
--- tests/submission.test	8 Mar 2010 01:04:42 -0000	1.6
+++ tests/submission.test	3 Apr 2010 02:37:17 -0000
@@ -67,7 +67,7 @@
 
     // Visit the node page with the "foo=bar" query, to test %get[] default values.
     $this->drupalGet('node/' . $node->nid, array('query' => array('foo' => 'bar')));
-    $this->assertText($node->body, t('Webform node created and accessible at !url', array('!url' => 'node/' . $node->nid)), t('Webform'));
+    $this->assertText($node->body[LANGUAGE_NONE][0]['value'], t('Webform node created and accessible at !url', array('!url' => 'node/' . $node->nid)), t('Webform'));
 
     // Submit our test data.
     $this->drupalPost(NULL, $submission_values, 'Submit');
Index: components/markup.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/components/markup.inc,v
retrieving revision 1.17
diff -u -r1.17 markup.inc
--- components/markup.inc	21 Mar 2010 03:38:25 -0000	1.17
+++ components/markup.inc	3 Apr 2010 02:37:17 -0000
@@ -28,12 +28,13 @@
 function _webform_edit_markup($component) {
   $form = array();
   $form['value'] = array(
-    '#type' => 'textarea',
+    '#type' => 'text_format',
     '#title' => t('Value'),
     '#default_value' => $component['value'],
     '#description' => t('Markup allows you to enter custom HTML or PHP logic into your form.') . theme('webform_token_help'),
     '#weight' => -1,
-    '#text_format' => $component['extra']['format'],
+    '#format' => $component['extra']['format'],
+    '#element_validate' => array('_webform_edit_markup_validate'),
   );
 
   // No description for markup.
@@ -43,6 +44,13 @@
 }
 
 /**
+ * Element validate handler; Set the text format value.
+ */
+function _webform_edit_markup_validate($form, &$form_state) {
+  $form_state['values']['extra']['format'] = $form_state['values']['format'];
+}
+
+/**
  * Implementation of _webform_render_component().
  */
 function _webform_render_markup($component, $value = NULL, $filter = TRUE) {
Index: components/select.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/components/select.inc,v
retrieving revision 1.50
diff -u -r1.50 select.inc
--- components/select.inc	29 Mar 2010 03:19:37 -0000	1.50
+++ components/select.inc	3 Apr 2010 02:37:17 -0000
@@ -131,11 +131,15 @@
       '#description' => t('<strong>Key-value pairs MUST be specified as "safe_key|Some readable option"</strong>. Only alphanumeric characters and underscores are allowed as a key. One option per line. Option groups may be specified with &lt;Group Name&gt;. &lt;&gt; can be used to insert items at the root of the menu after specifying a group.') . theme('webform_token_help'),
       '#cols' => 60,
       '#rows' => 5,
-      '#weight' => -2,
+      '#weight' => 0,
       '#required' => TRUE,
-      '#attributes' => array('readonly' => !empty($component['extra']['options_source'])),
       '#element_validate' => array('_webform_edit_validate_select'),
     );
+
+    if (!empty($component['extra']['options_source'])) {
+      $form['extra']['items']['#attributes'] = array('readonly' => 'readonly');
+    }
+
     $form['extra'] = array_merge($form['extra'], $other);
     $form['value'] = array(
       '#type' => 'textfield',
@@ -426,16 +430,28 @@
  * Convert FAPI 0/1 values into something saveable.
  */
 function _webform_submit_select($component, $value) {
-  $options = drupal_map_assoc(array_flip(_webform_select_options($component)));
+  // Build a list of all valid keys expected to be submitted.
+  $options = _webform_select_options($component);
+  $keys = array();
+  foreach ($options as $option_key => $option_value) {
+    if (is_array($option_key)) {
+      foreach ($option_key as $option_subkey => $option_subvalue) {
+        $keys[$option_subkey] = $option_subkey;
+      }
+    }
+    else {
+      $keys[$option_key] = $option_key;
+    }
+  }
 
   $return = NULL;
   if (is_array($value)) {
     $return = array();
     foreach ($value as $key => $option_value) {
       // Handle options that are specified options.
-      if ($option_value !== '' && isset($options[$key])) {
+      if ($option_value !== '' && isset($keys[$key])) {
         // Checkboxes submit an *integer* value of 0 when not checked.
-        if ($option_value === 0 && $options[$key] !== '0' && !$component['extra']['aslist'] && $component['extra']['multiple']) {
+        if ($option_value === 0 && $keys[$key] !== '0' && !$component['extra']['aslist'] && $component['extra']['multiple']) {
           unset($value[$key]);
         }
         else {
