Index: CHANGELOG.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/form_controller/CHANGELOG.txt,v retrieving revision 1.2 diff -u -p -r1.2 CHANGELOG.txt --- CHANGELOG.txt 2 Mar 2008 01:52:04 -0000 1.2 +++ CHANGELOG.txt 14 Nov 2009 23:31:24 -0000 @@ -4,7 +4,7 @@ Form controller x.x-x.x, xxxx-xx-xx ----------------------------------- -Form controller 5.x-1.x, xxxx-xx-xx +Form controller 6.x-1.x, xxxx-xx-xx ----------------------------------- Index: form_controller.api.php =================================================================== RCS file: form_controller.api.php diff -N form_controller.api.php --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ form_controller.api.php 29 Feb 2008 03:07:47 -0000 @@ -0,0 +1,59 @@ + 'radios', + '#title' => t('Journal entry'), + '#options' => array( + 0 => t('Disable'), + -1 => t('Allow'), + 1 => t('Required'), + ), + '#default_value' => isset($journal_ids[$edit]) ? $journal_ids[$edit] : -1, + '#description' => t('Whether journal entries for this form should be allowed, required, or completely disabled.'), + ); + return $form; + + case 'validate': + // Debug code example: + // dpm($edit); + // form_set_error(''); + break; + + case 'submit': + $journal_ids = variable_get('journal_form_ids', array()); + if ($edit['journal'] != -1) { + $journal_ids = array_merge($journal_ids, array($edit['#form_id'] => (int)$edit['journal'])); + } + else { + unset($journal_ids[$edit['#form_id']]); + } + variable_set('journal_form_ids', $journal_ids); + break; + } +} + Index: form_controller.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/form_controller/form_controller.info,v retrieving revision 1.2 diff -u -p -r1.2 form_controller.info --- form_controller.info 2 Mar 2008 01:48:23 -0000 1.2 +++ form_controller.info 14 Nov 2009 23:31:47 -0000 @@ -1,5 +1,5 @@ ; $Id: form_controller.info,v 1.2 2008/03/02 01:48:23 sun Exp $ name = Form controller description = Helper module for managing form elements of other modules. -dependencies = jquery_update package = Development +core = 6.x Index: form_controller.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/form_controller/form_controller.module,v retrieving revision 1.3 diff -u -p -r1.3 form_controller.module --- form_controller.module 2 Mar 2008 01:48:23 -0000 1.3 +++ form_controller.module 14 Nov 2009 23:43:08 -0000 @@ -4,63 +4,42 @@ /** * @file * Loader and callback functions for Form controller. - * - * @see README.txt */ /** - * Implementation of hook_perm(). - * - * Access to Form controller is only controlled by user role permissions. + * Implements hook_perm(). */ function form_controller_perm() { - return array('access form controller'); + return array('administer forms'); } /** - * Implementation of hook_menu(). - * - * Loads JavaScript and Form controller JavaScript callbacks. + * Implements hook_menu(). */ -function form_controller_menu($may_cache) { - $access = user_access('access form controller'); - if (!$access) { - return; - } - $items = array(); - if ($may_cache) { - $items[] = array( - 'path' => 'form_controller', - 'callback' => 'form_controller', - 'access' => $access, - 'type' => MENU_CALLBACK, - ); - } - else { - drupal_add_css(drupal_get_path('module', 'form_controller') .'/form_controller.css'); - drupal_add_js(drupal_get_path('module', 'form_controller') .'/form_controller.js'); - drupal_add_js(array('formControllerPathPrefix' => base_path() . (variable_get('clean_url', 0) ? '' : '?q=')), 'setting'); - } +function form_controller_menu() { + $items['form_controller'] = array( + 'page callback' => 'form_controller', + 'access arguments' => array('administer forms'), + 'type' => MENU_CALLBACK, + ); return $items; } /** - * Implementation of hook_form_alter(). + * Implements hook_form_alter(). * * Attaches Form controller to all forms, if there are any hook_form_controller() * implementations. */ -function form_controller_form_alter($form_id, &$form) { - if (!user_access('access form controller') || $form_id == 'form_controller_form' || !form_controller_get_modules()) { +function form_controller_form_alter(&$form, &$form_state, $form_id) { + if (!user_access('administer forms') || $form_id == 'form_controller_form' || !form_controller_get_modules()) { return; } - $icon = theme('image', drupal_get_path('module', 'form_controller') .'/images/zoom-in.png', t('Configure this form')); - $form[] = array( - '#type' => 'markup', + $form['form_controller'] = array( '#prefix' => '