Index: modules/profile/profile-block.tpl.php
===================================================================
RCS file: modules/profile/profile-block.tpl.php
diff -N modules/profile/profile-block.tpl.php
--- modules/profile/profile-block.tpl.php 6 Aug 2009 05:05:59 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,42 +0,0 @@
-title: Title of the profile field.
- * - $field->value: Value of the profile field.
- * - $field->type: Type of the profile field, i.e., checkbox, textfield,
- * textarea, selection, list, url or date.
- *
- * Since $profile is keyed, a direct print of the field is possible. Not
- * all accounts may have a value for a profile so do a check first. If a field
- * of "last_name" was set for the site, the following can be used.
- *
- *
- *
-
Index: modules/profile/profile-listing.tpl.php
===================================================================
RCS file: modules/profile/profile-listing.tpl.php
diff -N modules/profile/profile-listing.tpl.php
--- modules/profile/profile-listing.tpl.php 6 Aug 2009 05:05:59 -0000 1.7
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,53 +0,0 @@
-title: Title of the profile field.
- * - $field->value: Value of the profile field.
- * - $field->type: Type of the profile field, i.e., checkbox, textfield,
- * textarea, selection, list, url or date.
- *
- * Since $profile is keyed, a direct print of the field is possible. Not
- * all accounts may have a value for a profile so do a check first. If a field
- * of "last_name" was set for the site, the following can be used.
- *
- *
- *
';
- $form['addnewfields'] = array('#markup' => $addnewfields);
-
- return $form;
-}
-
-/**
- * Submit handler to update changed profile field weights and categories.
- *
- * @see profile_admin_overview()
- */
-function profile_admin_overview_submit($form, &$form_state) {
- foreach (element_children($form_state['values']) as $fid) {
- if (is_numeric($fid)) {
- $weight = $form_state['values'][$fid]['weight'];
- $category = $form_state['values'][$fid]['category'];
- if ($weight != $form[$fid]['weight']['#default_value'] || $category != $form[$fid]['category']['#default_value']) {
- db_update('profile_field')
- ->fields(array(
- 'weight' => $weight,
- 'category' => $category,
- ))
- ->condition('fid', $fid)
- ->execute();
- }
- }
- }
-
- drupal_set_message(t('Profile fields have been updated.'));
- cache_clear_all();
- menu_rebuild();
-}
-
-/**
- * Theme the profile field overview into a drag and drop enabled table.
- *
- * @ingroup themeable
- * @see profile_admin_overview()
- */
-function theme_profile_admin_overview($variables) {
- $form = $variables['form'];
-
- drupal_add_css(drupal_get_path('module', 'profile') . '/profile.css');
- // Add javascript if there's more than one field.
- if (isset($form['submit'])) {
- drupal_add_js(drupal_get_path('module', 'profile') . '/profile.js');
- }
-
- $rows = array();
- $categories = array();
- $category_number = 0;
- foreach (element_children($form) as $key) {
- // Don't take form control structures.
- if (array_key_exists('category', $form[$key])) {
- $field = &$form[$key];
- $category = $field['category']['#default_value'];
-
- if (!isset($categories[$category])) {
- // Category classes are given numeric IDs because there's no guarantee
- // class names won't contain invalid characters.
- $categories[$category] = $category_number;
- $category_field['#attributes']['class'] = array('profile-category', 'profile-category-' . $category_number);
- $rows[] = array(array('data' => $category, 'colspan' => 7, 'class' => array('category')));
- $rows[] = array('data' => array(array('data' => '' . t('No fields in this category. If this category remains empty when saved, it will be removed.') . '', 'colspan' => 7)), 'class' => array('category-' . $category_number . '-message', 'category-message', 'category-populated'));
-
- // Make it draggable only if there is more than one field
- if (isset($form['submit'])) {
- drupal_add_tabledrag('profile-fields', 'order', 'sibling', 'profile-weight', 'profile-weight-' . $category_number);
- drupal_add_tabledrag('profile-fields', 'match', 'sibling', 'profile-category', 'profile-category-' . $category_number);
- }
- $category_number++;
- }
-
- // Add special drag and drop classes that group fields together.
- $field['weight']['#attributes']['class'] = array('profile-weight', 'profile-weight-' . $categories[$category]);
- $field['category']['#attributes']['class'] = array('profile-category', 'profile-category-' . $categories[$category]);
-
- // Add the row
- $row = array();
- $row[] = drupal_render($field['title']);
- $row[] = drupal_render($field['name']);
- $row[] = drupal_render($field['type']);
- if (isset($form['submit'])) {
- $row[] = drupal_render($field['category']);
- $row[] = drupal_render($field['weight']);
- }
- $row[] = drupal_render($field['edit']);
- $row[] = drupal_render($field['delete']);
- $rows[] = array('data' => $row, 'class' => array('draggable'));
- }
- }
- if (empty($rows)) {
- $rows[] = array(array('data' => t('No fields available.'), 'colspan' => 7));
- }
-
- $header = array(t('Title'), t('Name'), t('Type'));
- if (isset($form['submit'])) {
- $header[] = t('Category');
- $header[] = t('Weight');
- }
- $header[] = array('data' => t('Operations'), 'colspan' => 2);
-
- $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'profile-fields')));
- $output .= drupal_render_children($form);
-
- return $output;
-}
-
-/**
- * Menu callback: Generate a form to add/edit a user profile field.
- *
- * @ingroup forms
- * @see profile_field_form_validate()
- * @see profile_field_form_submit()
- */
-function profile_field_form($form, &$form_state, $arg = NULL) {
- if (arg(4) == 'edit') {
- if (is_numeric($arg)) {
- $fid = $arg;
-
- $edit = db_query('SELECT * FROM {profile_field} WHERE fid = :fid', array('fid' => $fid))->fetchAssoc();
-
- if (!$edit) {
- drupal_not_found();
- return;
- }
- drupal_set_title(t('edit %title', array('%title' => $edit['title'])), PASS_THROUGH);
- $form['fid'] = array('#type' => 'value',
- '#value' => $fid,
- );
- $type = $edit['type'];
- }
- else {
- drupal_not_found();
- return;
- }
- }
- else {
- $types = _profile_field_types();
- if (!isset($types[$arg])) {
- drupal_not_found();
- return;
- }
- $type = $arg;
- drupal_set_title(t('add new %type', array('%type' => $types[$type])), PASS_THROUGH);
- $edit = array('name' => 'profile_');
- $form['type'] = array('#type' => 'value', '#value' => $type);
- }
- $edit += array(
- 'category' => '',
- 'title' => '',
- 'explanation' => '',
- 'weight' => 0,
- 'page' => '',
- 'autocomplete' => '',
- 'required' => '',
- 'register' => '',
- );
- $form['fields'] = array('#type' => 'fieldset',
- '#title' => t('Field settings'),
- );
- $form['fields']['category'] = array('#type' => 'textfield',
- '#title' => t('Category'),
- '#default_value' => $edit['category'],
- '#autocomplete_path' => 'admin/config/people/profile/autocomplete',
- '#description' => t('The category the new field should be part of. Categories are used to group fields logically. An example category is "Personal information".'),
- '#required' => TRUE,
- );
- $form['fields']['title'] = array('#type' => 'textfield',
- '#title' => t('Title'),
- '#default_value' => $edit['title'],
- '#description' => t('The title of the new field. The title will be shown to the user. An example title is "Favorite color".'),
- '#required' => TRUE,
- );
- $form['fields']['name'] = array('#type' => 'textfield',
- '#title' => t('Form name'),
- '#default_value' => $edit['name'],
- '#description' => t('The name of the field. The form name is not shown to the user but used internally in the HTML code and URLs.
-Unless you know what you are doing, it is highly recommended that you prefix the form name with profile_ to avoid name clashes with other fields. Spaces or any other special characters except dash (-) and underscore (_) are not allowed. An example name is "profile_favorite_color" or perhaps just "profile_color".'),
- '#required' => TRUE,
- );
- $form['fields']['explanation'] = array('#type' => 'textarea',
- '#title' => t('Explanation'),
- '#default_value' => $edit['explanation'],
- '#description' => t('An optional explanation to go with the new field. The explanation will be shown to the user.'),
- );
- if ($type == 'selection') {
- $form['fields']['options'] = array('#type' => 'textarea',
- '#title' => t('Selection options'),
- '#default_value' => isset($edit['options']) ? $edit['options'] : '',
- '#description' => t('A list of all options. Put each option on a separate line. Example options are "red", "blue", "green", etc.'),
- );
- }
- $form['fields']['visibility'] = array('#type' => 'radios',
- '#title' => t('Visibility'),
- '#default_value' => isset($edit['visibility']) ? $edit['visibility'] : PROFILE_PUBLIC,
- '#options' => array(PROFILE_HIDDEN => t('Hidden profile field, only accessible by administrators, modules and themes.'), PROFILE_PRIVATE => t('Private field, content only available to privileged users.'), PROFILE_PUBLIC => t('Public field, content shown on profile page but not used on member list pages.'), PROFILE_PUBLIC_LISTINGS => t('Public field, content shown on profile page and on member list pages.')),
- );
- if ($type == 'selection' || $type == 'list' || $type == 'textfield') {
- $form['fields']['page'] = array('#type' => 'textfield',
- '#title' => t('Page title'),
- '#default_value' => $edit['page'],
- '#description' => t('To enable browsing this field by value, enter a title for the resulting page. The word %value will be substituted with the corresponding value. An example page title is "People whose favorite color is %value" . This is only applicable for a public field.'),
- );
- }
- elseif ($type == 'checkbox') {
- $form['fields']['page'] = array('#type' => 'textfield',
- '#title' => t('Page title'),
- '#default_value' => $edit['page'],
- '#description' => t('To enable browsing this field by value, enter a title for the resulting page. An example page title is "People who are employed" . This is only applicable for a public field.'),
- );
- }
- $form['fields']['weight'] = array('#type' => 'weight',
- '#title' => t('Weight'),
- '#default_value' => $edit['weight'],
- '#description' => t('The weights define the order in which the form fields are shown. Lighter fields "float up" towards the top of the category.'),
- );
- $form['fields']['autocomplete'] = array('#type' => 'checkbox',
- '#title' => t('Form will auto-complete while user is typing.'),
- '#default_value' => $edit['autocomplete'],
- '#description' => t('For security, auto-complete will be disabled if the user does not have access to user profiles.'),
- );
- $form['fields']['required'] = array('#type' => 'checkbox',
- '#title' => t('The user must enter a value.'),
- '#default_value' => $edit['required'],
- );
- $form['fields']['register'] = array('#type' => 'checkbox',
- '#title' => t('Visible in user registration form.'),
- '#default_value' => $edit['register'],
- );
- $form['submit'] = array('#type' => 'submit',
- '#value' => t('Save field'),
- );
- return $form;
-}
-
-/**
- * Validate profile_field_form submissions.
- */
-function profile_field_form_validate($form, &$form_state) {
- // Validate the 'field name':
- if (preg_match('/[^a-zA-Z0-9_-]/', $form_state['values']['name'])) {
- form_set_error('name', t('The specified form name contains one or more illegal characters. Spaces or any other special characters except dash (-) and underscore (_) are not allowed.'));
- }
-
- $users_table = drupal_get_schema('users');
- if (!empty($users_table['fields'][$form_state['values']['name']])) {
- form_set_error('name', t('The specified form name is reserved for use by Drupal.'));
- }
- // Validate the category:
- if (!$form_state['values']['category']) {
- form_set_error('category', t('You must enter a category.'));
- }
- if (strtolower($form_state['values']['category']) == 'account') {
- form_set_error('category', t('The specified category name is reserved for use by Drupal.'));
- }
- $query = db_select('profile_field');
- $query->fields('profile_field', array('fid'));
-
- if (isset($form_state['values']['fid'])) {
- $query->condition('fid', $form_state['values']['fid']);
- }
- $query_name = clone $query;
-
- $title = $query
- ->condition('title', $form_state['values']['title'])
- ->condition('category', $form_state['values']['category'])
- ->execute()
- ->fetchField();
- if ($title) {
- form_set_error('title', t('The specified title is already in use.'));
- }
- $name = $query_name
- ->condition('name', $form_state['values']['name'])
- ->execute()
- ->fetchField();
- if ($name) {
- form_set_error('name', t('The specified name is already in use.'));
- }
- if ($form_state['values']['visibility'] == PROFILE_HIDDEN) {
- if ($form_state['values']['required']) {
- form_set_error('required', t('A hidden field cannot be required.'));
- }
- if ($form_state['values']['register']) {
- form_set_error('register', t('A hidden field cannot be set to visible on the user registration form.'));
- }
- }
-}
-
-/**
- * Process profile_field_form submissions.
- */
-function profile_field_form_submit($form, &$form_state) {
- if (!isset($form_state['values']['options'])) {
- $form_state['values']['options'] = '';
- }
- if (!isset($form_state['values']['page'])) {
- $form_state['values']['page'] = '';
- }
- if (!isset($form_state['values']['fid'])) {
- // Remove all elements that are not profile_field columns.
- $values = array_intersect_key($form_state['values'], array_flip(array('type', 'category', 'title', 'name', 'explanation', 'visibility', 'page', 'weight', 'autocomplete', 'required', 'register', 'options')));
- db_insert('profile_field')
- ->fields($values)
- ->execute();
- drupal_set_message(t('The field has been created.'));
- watchdog('profile', 'Profile field %field added under category %category.', array('%field' => $form_state['values']['title'], '%category' => $form_state['values']['category']), WATCHDOG_NOTICE, l(t('view'), 'admin/config/people/profile'));
- }
- else {
- db_update('profile_field')
- ->fields($form_state['values'])
- ->condition('fid', $form_state['values']['fid'])
- ->exeucte();
- drupal_set_message(t('The field has been updated.'));
- }
- cache_clear_all();
- menu_rebuild();
-
- $form_state['redirect'] = 'admin/config/people/profile';
- return;
-}
-
-/**
- * Menu callback; deletes a field from all user profiles.
- */
-function profile_field_delete($form, &$form_state, $fid) {
- $field = db_query("SELECT title FROM {profile_field} WHERE fid = :fid", array(':fid' => $fid))->fetchObject();
- if (!$field) {
- drupal_not_found();
- return;
- }
- $form['fid'] = array('#type' => 'value', '#value' => $fid);
- $form['title'] = array('#type' => 'value', '#value' => $field->title);
-
- return confirm_form($form,
- t('Are you sure you want to delete the field %field?', array('%field' => $field->title)), 'admin/config/people/profile',
- t('This action cannot be undone. If users have entered values into this field in their profile, these entries will also be deleted. If you want to keep the user-entered data, instead of deleting the field you may wish to edit this field and change it to a hidden profile field so that it may only be accessed by administrators.', array('@edit-field' => url('admin/config/people/profile/edit/' . $fid))),
- t('Delete'), t('Cancel'));
-}
-
-/**
- * Process a field delete form submission.
- */
-function profile_field_delete_submit($form, &$form_state) {
- db_delete('profile_field')
- ->condition('fid', $form_state['values']['fid'])
- ->execute();
- db_delete('profile_value')
- ->condition('fid', $form_state['values']['fid'])
- ->execute();
-
- cache_clear_all();
-
- drupal_set_message(t('The field %field has been deleted.', array('%field' => $form_state['values']['title'])));
- watchdog('profile', 'Profile field %field deleted.', array('%field' => $form_state['values']['title']), WATCHDOG_NOTICE, l(t('view'), 'admin/config/people/profile'));
-
- $form_state['redirect'] = 'admin/config/people/profile';
- return;
-}
-
-/**
- * Retrieve a pipe delimited string of autocomplete suggestions for profile categories
- */
-function profile_admin_settings_autocomplete($string) {
- $matches = array();
- $result = db_query_range("SELECT category FROM {profile_field} WHERE LOWER(category) LIKE LOWER(:category)", 0, 10, array(':category' => $string . '%'));
- foreach ($result as $data) {
- $matches[$data->category] = check_plain($data->category);
- }
- drupal_json_output($matches);
-}
Index: modules/profile/profile.css
===================================================================
RCS file: modules/profile/profile.css
diff -N modules/profile/profile.css
--- modules/profile/profile.css 30 Nov 2007 09:02:51 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-/* $Id: profile.css,v 1.3 2007/11/30 09:02:51 goba Exp $ */
-
-#profile-fields td.category {
- font-weight: bold;
-}
-#profile-fields tr.category-message {
- color: #999;
-}
-#profile-fields tr.category-populated {
- display: none;
-}
Index: modules/profile/profile.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.info,v
retrieving revision 1.9
diff -u -p -r1.9 profile.info
--- modules/profile/profile.info 8 Jun 2009 09:23:53 -0000 1.9
+++ modules/profile/profile.info 11 Oct 2009 23:46:29 -0000
@@ -1,11 +1,9 @@
-; $Id: profile.info,v 1.9 2009/06/08 09:23:53 dries Exp $
-name = Profile
-description = Supports configurable user profiles.
-package = Core
-version = VERSION
-core = 7.x
-files[] = profile.module
-files[] = profile.admin.inc
-files[] = profile.pages.inc
-files[] = profile.install
-files[] = profile.test
+; $Id: profile.info,v 1.9 2009/06/08 09:23:53 dries Exp $
+name = Profile
+description = Supports configurable user profiles.
+package = Core
+version = VERSION
+core = 7.x
+files[] = profile.module
+files[] = profile.install
+files[] = profile.test
Index: modules/profile/profile.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.install,v
retrieving revision 1.22
diff -u -p -r1.22 profile.install
--- modules/profile/profile.install 29 Sep 2009 15:13:56 -0000 1.22
+++ modules/profile/profile.install 11 Oct 2009 23:46:29 -0000
@@ -1,156 +1,134 @@
- 'Stores profile field information.',
- 'fields' => array(
- 'fid' => array(
- 'type' => 'serial',
- 'not null' => TRUE,
- 'description' => 'Primary Key: Unique profile field ID.',
- ),
- 'title' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'description' => 'Title of the field shown to the end user.',
- ),
- 'name' => array(
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'Internal name of the field used in the form HTML and URLs.',
- ),
- 'explanation' => array(
- 'type' => 'text',
- 'not null' => FALSE,
- 'description' => 'Explanation of the field to end users.',
- ),
- 'category' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'description' => 'Profile category that the field will be grouped under.',
- ),
- 'page' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- 'description' => "Title of page used for browsing by the field's value",
- ),
- 'type' => array(
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => FALSE,
- 'description' => 'Type of form field.',
- ),
- 'weight' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'tiny',
- 'description' => 'Weight of field in relation to other profile fields.',
- ),
- 'required' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'tiny',
- 'description' => 'Whether the user is required to enter a value. (0 = no, 1 = yes)',
- ),
- 'register' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'tiny',
- 'description' => 'Whether the field is visible in the user registration form. (1 = yes, 0 = no)',
- ),
- 'visibility' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'tiny',
- 'description' => 'The level of visibility for the field. (0 = hidden, 1 = private, 2 = public on profile but not member list pages, 3 = public on profile and list pages)',
- ),
- 'autocomplete' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'tiny',
- 'description' => 'Whether form auto-completion is enabled. (0 = disabled, 1 = enabled)',
- ),
- 'options' => array(
- 'type' => 'text',
- 'not null' => FALSE,
- 'description' => 'List of options to be used in a list selection field.',
- ),
- ),
- 'indexes' => array(
- 'category' => array('category'),
- ),
- 'unique keys' => array(
- 'name' => array('name'),
- ),
- 'primary key' => array('fid'),
- );
-
- $schema['profile_value'] = array(
- 'description' => 'Stores values for profile fields.',
- 'fields' => array(
- 'fid' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'The {profile_field}.fid of the field.',
- ),
- 'uid' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'The {users}.uid of the profile user.',
- ),
- 'value' => array(
- 'type' => 'text',
- 'not null' => FALSE,
- 'description' => 'The value for the field.',
- ),
- ),
- 'primary key' => array('uid', 'fid'),
- 'indexes' => array(
- 'fid' => array('fid'),
- ),
- 'foreign keys' => array(
- 'fid' => array('profile_field' => 'fid'),
- 'uid' => array('users' => 'uid'),
- ),
- );
-
- return $schema;
-}
-
-/**
- * Rename {profile_fields} table to {profile_field} and {profile_values} to {profile_value}.
- */
-function profile_update_7001() {
- db_rename_table('profile_fields', 'profile_field');
- db_rename_table('profile_values', 'profile_value');
-}
+ 'main',
+ 'label' => t('Profile'),
+ 'weight' => 0,
+ 'locked' => TRUE,
+ ));
+ // Auto-create a field for the full name.
+ $field = array(
+ 'field_name' => 'profile_fullname',
+ 'type' => 'text',
+ 'cardinality' => 1,
+ 'translatable' => FALSE,
+ );
+ field_create_field($field);
+
+ $instance = array(
+ 'field_name' => 'profile_fullname',
+ 'bundle' => 'main',
+ 'label' => 'Full name',
+ 'description' => 'Specify your first and last name.',
+ 'widget' => array(
+ 'type' => 'text_textfield',
+ 'weight' => 0,
+ ),
+ );
+ field_create_instance($instance);
+ }
+}
+
+/**
+ * Implement hook_uninstall().
+ */
+function profile_uninstall() {
+ variable_del('profile_register');
+}
+
+/**
+ * Implement hook_schema().
+ */
+function profile_schema() {
+ $schema['profile'] = array(
+ 'description' => 'Stores profile items.',
+ 'fields' => array(
+ 'pid' => array(
+ 'type' => 'serial',
+ 'not null' => TRUE,
+ 'description' => 'Primary Key: Unique profile item ID.',
+ ),
+ 'name' => array(
+ 'type' => 'varchar',
+ 'length' => 32,
+ 'not null' => TRUE,
+ 'default' => '',
+ 'description' => 'The name of the profile.',
+ ),
+ 'uid' => array(
+ 'type' => 'int',
+ 'unsigned' => TRUE,
+ 'not null' => FALSE,
+ 'default' => NULL,
+ 'description' => "The {users}.uid of the associated user.",
+ ),
+ ),
+ 'primary key' => array('pid'),
+ 'indexes' => array(
+ 'uid' => array('uid'),
+ ),
+ 'foreign keys' => array(
+ 'uid' => array('users' => 'uid'),
+ 'name' => array('profile_types' => 'name'),
+ ),
+ );
+
+ $schema['profile_type'] = array(
+ 'description' => 'Stores information about all defined profile types.',
+ 'fields' => array(
+ 'name' => array(
+ 'type' => 'varchar',
+ 'length' => 32,
+ 'not null' => TRUE,
+ 'description' => 'The machine-readable name of this profile type.',
+ ),
+ 'label' => array(
+ 'type' => 'varchar',
+ 'length' => 255,
+ 'not null' => TRUE,
+ 'default' => '',
+ 'description' => 'The human-readable name of this profile type.',
+ ),
+ 'weight' => array(
+ 'type' => 'int',
+ 'not null' => TRUE,
+ 'default' => 0,
+ 'size' => 'tiny',
+ 'description' => 'The weight of this profile type in relation to others.',
+ ),
+ 'locked' => array(
+ 'type' => 'int',
+ 'not null' => TRUE,
+ 'default' => 0,
+ 'size' => 'tiny',
+ 'description' => 'A boolean indicating whether the administrator may delete this type.',
+ ),
+ 'data' => array(
+ 'type' => 'text',
+ 'not null' => FALSE,
+ 'size' => 'big',
+ 'serialize' => TRUE,
+ 'description' => 'A serialized array of additional data related to this profile type.',
+ ),
+ ),
+ 'primary key' => array('name'),
+ );
+
+ return $schema;
+}
+
+//TODO: Update procedure.
Index: modules/profile/profile.js
===================================================================
RCS file: modules/profile/profile.js
diff -N modules/profile/profile.js
--- modules/profile/profile.js 27 Apr 2009 20:19:37 -0000 1.7
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,59 +0,0 @@
-// $Id: profile.js,v 1.7 2009/04/27 20:19:37 webchick Exp $
-(function ($) {
-
-/**
- * Add functionality to the profile drag and drop table.
- *
- * This behavior is dependent on the tableDrag behavior, since it uses the
- * objects initialized in that behavior to update the row. It shows and hides
- * a warning message when removing the last field from a profile category.
- */
-Drupal.behaviors.profileDrag = {
- attach: function (context, settings) {
- var table = $('#profile-fields');
- var tableDrag = Drupal.tableDrag['profile-fields']; // Get the profile tableDrag object.
-
- // Add a handler for when a row is swapped, update empty categories.
- tableDrag.row.prototype.onSwap = function (swappedRow) {
- var rowObject = this;
- $('tr.category-message', table).each(function () {
- // If the dragged row is in this category, but above the message row, swap it down one space.
- if ($(this).prev('tr').get(0) == rowObject.element) {
- // Prevent a recursion problem when using the keyboard to move rows up.
- if ((rowObject.method != 'keyboard' || rowObject.direction == 'down')) {
- rowObject.swap('after', this);
- }
- }
- // This category has become empty
- if ($(this).next('tr').is(':not(.draggable)') || $(this).next('tr').size() == 0) {
- $(this).removeClass('category-populated').addClass('category-empty');
- }
- // This category has become populated.
- else if ($(this).is('.category-empty')) {
- $(this).removeClass('category-empty').addClass('category-populated');
- }
- });
- };
-
- // Add a handler so when a row is dropped, update fields dropped into new categories.
- tableDrag.onDrop = function () {
- dragObject = this;
- if ($(dragObject.rowObject.element).prev('tr').is('.category-message')) {
- var categoryRow = $(dragObject.rowObject.element).prev('tr').get(0);
- var categoryNum = categoryRow.className.replace(/([^ ]+[ ]+)*category-([^ ]+)-message([ ]+[^ ]+)*/, '$2');
- var categoryField = $('select.profile-category', dragObject.rowObject.element);
- var weightField = $('select.profile-weight', dragObject.rowObject.element);
- var oldcategoryNum = weightField[0].className.replace(/([^ ]+[ ]+)*profile-weight-([^ ]+)([ ]+[^ ]+)*/, '$2');
-
- if (!categoryField.is('.profile-category-' + categoryNum)) {
- categoryField.removeClass('profile-category-' + oldcategoryNum).addClass('profile-category-' + categoryNum);
- weightField.removeClass('profile-weight-' + oldcategoryNum).addClass('profile-weight-' + categoryNum);
-
- categoryField.val(categoryField[0].options[categoryNum].value);
- }
- }
- };
- }
-};
-
-})(jQuery);
\ No newline at end of file
Index: modules/profile/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v
retrieving revision 1.279
diff -u -p -r1.279 profile.module
--- modules/profile/profile.module 10 Oct 2009 21:39:03 -0000 1.279
+++ modules/profile/profile.module 11 Oct 2009 23:46:29 -0000
@@ -1,624 +1,402 @@
-' . t('The profile module allows custom fields (such as country, full name, or age) to be defined and displayed in the My Account section. This permits users of a site to share more information about themselves, and can help community-based sites organize users around specific information.') . '';
- $output .= '
' . t('The following types of fields can be added to a user profile:') . '
';
- $output .= '
' . t('single-line textfield') . '
';
- $output .= '
' . t('multi-line textfield') . '
';
- $output .= '
' . t('checkbox') . '
';
- $output .= '
' . t('list selection') . '
';
- $output .= '
' . t('freeform list') . '
';
- $output .= '
' . t('URL') . '
';
- $output .= '
' . t('date') . '
';
- $output .= '
' . t('For more information, see the online handbook entry for Profile module.', array('@profile' => 'http://drupal.org/handbook/modules/profile/')) . '
';
- return $output;
- case 'admin/config/people/profile':
- return '
' . t("This page displays a list of the existing custom profile fields to be displayed on a user's My Account page. To provide structure, similar or related fields may be placed inside a category. To add a new category (or edit an existing one), edit a profile field and provide a new category name. Remember that your changes will not be saved until you click the Save configuration button at the bottom of the page.") . '