summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-05-05 09:25:21 +0000
committerDries Buytaert <dries@buytaert.net>2006-05-05 09:25:21 +0000
commit33cac6420db8b991dc16b3f4e4abb782d6f73dad (patch)
tree5038e03d48007efbf07c5eb57a29ae121a24db61
parent0f7ed2a5905d63eb690e3ce51635c2e6dc219f75 (diff)
downloadbrdo-33cac6420db8b991dc16b3f4e4abb782d6f73dad.tar.gz
brdo-33cac6420db8b991dc16b3f4e4abb782d6f73dad.tar.bz2
- Patch #61952 by Matt: usability improvement: add auto-complete functionality on the profile configuration patch.
-rw-r--r--modules/profile.module19
-rw-r--r--modules/profile/profile.module19
2 files changed, 38 insertions, 0 deletions
diff --git a/modules/profile.module b/modules/profile.module
index 38d49ffad..720385e69 100644
--- a/modules/profile.module
+++ b/modules/profile.module
@@ -66,6 +66,11 @@ function profile_menu($may_cache) {
'title' => t('add field'),
'callback' => 'profile_field_form',
'type' => MENU_CALLBACK);
+ $items[] = array('path' => 'admin/settings/profile/autocomplete',
+ 'title' => t('profile category autocomplete'),
+ 'callback' => 'profile_admin_settings_autocomplete',
+ 'access' => user_access('administer users'),
+ 'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/settings/profile/edit',
'title' => t('edit field'),
'callback' => 'profile_field_form',
@@ -212,6 +217,7 @@ function profile_field_form($arg = NULL) {
$form['fields']['category'] = array('#type' => 'textfield',
'#title' => t('Category'),
'#default_value' => $edit['category'],
+ '#autocomplete_path' => 'admin/settings/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,
);
@@ -786,3 +792,16 @@ function _profile_field_types($type = NULL) {
function _profile_field_serialize($type = NULL) {
return $type == 'date';
}
+
+/**
+ * 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_fields} WHERE LOWER(category) LIKE LOWER('%s%%')", $string, 0, 10);
+ while ($data = db_fetch_object($result)) {
+ $matches[$data->category] = check_plain($data->category);
+ }
+ print drupal_to_js($matches);
+ exit();
+}
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index 38d49ffad..720385e69 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -66,6 +66,11 @@ function profile_menu($may_cache) {
'title' => t('add field'),
'callback' => 'profile_field_form',
'type' => MENU_CALLBACK);
+ $items[] = array('path' => 'admin/settings/profile/autocomplete',
+ 'title' => t('profile category autocomplete'),
+ 'callback' => 'profile_admin_settings_autocomplete',
+ 'access' => user_access('administer users'),
+ 'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/settings/profile/edit',
'title' => t('edit field'),
'callback' => 'profile_field_form',
@@ -212,6 +217,7 @@ function profile_field_form($arg = NULL) {
$form['fields']['category'] = array('#type' => 'textfield',
'#title' => t('Category'),
'#default_value' => $edit['category'],
+ '#autocomplete_path' => 'admin/settings/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,
);
@@ -786,3 +792,16 @@ function _profile_field_types($type = NULL) {
function _profile_field_serialize($type = NULL) {
return $type == 'date';
}
+
+/**
+ * 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_fields} WHERE LOWER(category) LIKE LOWER('%s%%')", $string, 0, 10);
+ while ($data = db_fetch_object($result)) {
+ $matches[$data->category] = check_plain($data->category);
+ }
+ print drupal_to_js($matches);
+ exit();
+}