diff -ruaN phone/phone.css phone-new/phone.css --- phone/phone.css 1969-12-31 19:00:00.000000000 -0500 +++ phone-new/phone.css 2008-06-27 15:28:06.000000000 -0400 @@ -0,0 +1,9 @@ +.phone-fields-wrapper div.form-item { + float: left; + width: 48%; +} + +.field-field-phone div.form-item { + float: left; + width: 48%; +} diff -ruaN phone/phone.install phone-new/phone.install --- phone/phone.install 1969-12-31 19:00:00.000000000 -0500 +++ phone-new/phone.install 2008-06-27 15:28:06.000000000 -0400 @@ -0,0 +1,40 @@ + TRUE, 'default' => '')); + break; + + case 'mysql': + case 'mysqli': + $field_instance_result = db_query("SELECT field_name, type_name from {node_field_instance} where widget_type = 'phone'"); + while ($field_instance = db_fetch_array($field_instance_result)) { + // ? // $field_instance['fields'] = array(); + $field_result = db_query("SELECT multiple from {node_field} where field_name = '%s'", $field_instance['field_name']); + while ($field = db_fetch_array($field_result)) { + $content_field_table = 'content_' . $field_instance['field_name']; + $content_field_type_value = $field_instance['field_name'] . '_type_value'; + $content_type_table = 'content_type_' . $field_instance['type_name']; + if ($field['multiple']) { + // multiple fields + $ret[] = update_sql("ALTER TABLE { $content_field_table } ADD COLUMN $content_field_type_value varchar(255) NOT NULL"); + } + else { + // single field + $ret[] = update_sql("ALTER TABLE { $content_type_table } ADD COLUMN $content_field_type_value varchar(255) NOT NULL"); + } + } + } + break; + } + + return $ret; +} diff -ruaN phone/phone.module phone-new/phone.module --- phone/phone.module 2008-06-27 15:29:07.000000000 -0400 +++ phone-new/phone.module 2008-06-27 15:28:25.000000000 -0400 @@ -75,12 +75,13 @@ || $field['type'] == 'es_phone' || $field['type'] == 'au_phone' || $field['type'] == 'cs_phone' - ){ - $columns = array( - 'value' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE), - ); - } - return $columns; + ){ + $columns = array( + 'value' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE), + 'type_value' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE), + ); + } + return $columns; } } @@ -132,19 +133,32 @@ * Implementation of hook_field_formatter(). **/ function phone_field_formatter($field, $item, $formatter, $node) { - if (!isset($item['value'])) { + // Deal with blank items in db - isset($item['value']) should have taken care of it, but it doesn't - this does catch it. + if (trim($item['value']) == '') { return ''; } if ($field['text_processing']) { $text = check_markup($item['value'], $item['format'], is_null($node) || isset($node->in_preview)); + $full_text = $text .' '. check_markup($item['type_value'], $item['format'], is_null($node) || isset($node->in_preview)); } else { $text = check_plain($item['value']); + // I don't know if iPhones can have number and type - probably just one field. + // if they can the $full_text part can go away and just use - $text .= check_plain($item['type_value']); + // Also change it up in the 'text processing' area to something similar. + $full_text = $text .' '. check_plain($item['type_value']); } // iPhone Support if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') !== FALSE) { - $text = '' . $text . ''; - } + // To test iPhone for both fields uncomment next line and comment following line. + //$text = '' . $full_text . ''; + $text = '' . $text . ''; + // Or maybe the href could contain the phone number type - comment previous line and uncomment the next line. + //$text = '' . $text . ''; + } + else { + $text = $full_text; + } return $text; } @@ -187,30 +201,53 @@ * Implementation of hook_widget(). */ function phone_widget($op, &$node, $field, &$node_field) { - switch ($op) { + drupal_add_css(drupal_get_path('module', 'phone'). '/phone.css', 'module', 'all', FALSE); + switch ($op) { case 'form': $form = array(); - - $form[$field['field_name']] = array('#tree' => TRUE); - + + $form[$field['field_name']] = array('#tree' => TRUE, '#theme' => 'phone_widget_form'); + if ($field['multiple']) { $form[$field['field_name']]['#type'] = 'fieldset'; $form[$field['field_name']]['#title'] = t($field['widget']['label']); + $form[$field['field_name']]['wrapper'] = array( + '#type' => 'markup', + '#value' => '