diff -urp modules/compact_forms-5.x-1.0/compact_forms.css modules/compact_forms-6.x-1.0/compact_forms.css --- modules/compact_forms-5.x-1.0/compact_forms.css 2007-07-29 10:20:58.000000000 -0700 +++ modules/compact_forms-6.x-1.0/compact_forms.css 2008-12-24 09:27:03.000000000 -0800 @@ -1,4 +1,4 @@ -/* $Id: compact_forms.css,v 1.1 2007/07/29 17:20:58 tomsun Exp $ */ +/* $Id: compact_forms.css,v 1.1 2007/07/29 17:20:58 tomsun Exp $ */ .compact-form-wrapper { position: relative; diff -urp modules/compact_forms-5.x-1.0/compact_forms.info modules/compact_forms-6.x-1.0/compact_forms.info --- modules/compact_forms-5.x-1.0/compact_forms.info 2007-07-29 11:25:05.000000000 -0700 +++ modules/compact_forms-6.x-1.0/compact_forms.info 2008-12-24 09:27:04.000000000 -0800 @@ -1,9 +1,6 @@ -; $Id: compact_forms.info,v 1.1 2007/07/29 17:20:58 tomsun Exp $ +; $Id$ name = Compact Forms description = "Makes form fields compact by overlaying the field label on top the field itself using jQuery." - -; Information added by drupal.org packaging script on 2007-07-29 -version = "5.x-1.0" -project = "compact_forms" -datestamp = "1185733505" - +package = Forms +core = 6.x + diff -urp modules/compact_forms-5.x-1.0/compact_forms.module modules/compact_forms-6.x-1.0/compact_forms.module --- modules/compact_forms-5.x-1.0/compact_forms.module 2007-07-29 10:20:58.000000000 -0700 +++ modules/compact_forms-6.x-1.0/compact_forms.module 2008-12-24 14:01:18.000000000 -0800 @@ -1,7 +1,8 @@ - t('Compact Forms'), - 'path' => 'admin/settings/compact_forms', - 'description' => t('Makes form fields compact by overlaying the field label on top the field itself using jQuery.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => 'compact_forms_admin_form', - 'access' => user_access('administer Compact Forms'), - ); - } + $items['admin/settings/compact_forms'] = + array( + 'title' => t('Compact Forms'), + 'description' => t('Makes form fields compact by overlaying the field label on top the field itself using jQuery.'), + 'page callback' => 'drupal_get_form', + 'page arguments' => array('compact_forms_admin_form'), + 'access callback' => 'user_access', + 'access arguments' => array('administer Compact Forms'), + ); return $items; } +function compact_forms_admin_form_validate($form, &$form_state) { + $form_id=$form_state['values']['form_id']; + if (!empty($form_id)) { + $compact_forms_ids=$form_state['values']['compact_forms_ids']; + $ids_array=explode("\n", $compact_forms_ids); + + $all_clear=1; + $faulty_index=0; + foreach ($ids_array as $id) { + $faulty_index++; + if (preg_match('/ /', trim($id))) { + $all_clear=0; + break; + } + } + if (!$all_clear) { + form_set_error('compact_forms_ids', t('The ID in line !line_number contains whitespace. Please remove whitespace and re-enter.', array('!line_number' => $faulty_index))); + } else { + $ids_trimmed=array(); + foreach ($ids_array as $id) { + $ids_trimmed[]=trim($id); + } + $form_state['values']['compact_forms_ids']=implode("\n", $ids_trimmed); + } + } +} + /** * Compact Forms admin settings. */ @@ -121,11 +146,11 @@ function compact_forms_admin_form() { $form['compact_forms_ids'] = array( '#type' => 'textarea', - '#title' => t('Form ID:s'), + '#title' => t('Form IDs'), '#rows' => 3, '#cols' => 40, '#default_value' => variable_get('compact_forms_ids', "user-login-form"), - '#description' => 'Enter the CSS #id of the forms that you want to activate compact_forms for. One per line.', + '#description' => 'Enter the CSS #id of the forms that you want to activate compact_forms for, one per line, using hyphens in place of underscores, for example, user-login-form. Note that the user login form will be modified even if this is left empty.', ); $form['compact_forms_stars'] = array( @@ -176,8 +201,8 @@ function compact_forms_admin_form() { * Include JavaScript and CSS and attach behaviours to all selected forms. */ function _compact_forms_include_js() { - $ids = explode("\n", variable_get('compact_forms_ids', "user-login-form")); - $inline_js = ''; + $ids = explode("\n", variable_get('compact_forms_ids', "user-login-form")); + $inline_js = ''; if (is_array($ids) && !empty($ids)) { $stars = variable_get('compact_forms_stars', 2); @@ -186,7 +211,8 @@ function _compact_forms_include_js() { foreach ($ids as $id) { $id = trim($id); if (!empty($id)) { - + +# create a call via jQuery to the compactForm() Javascript function $inline_js .= '$("#' . $id. '").compactForm(' . $stars . ', ' . $colons . ');'; } }