? .module_builder.admin.inc.swp ? .module_builder.module.swp ? module_builder-admin_inc.patch Index: module_builder.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/module_builder/module_builder.module,v retrieving revision 1.41 diff -u -p -r1.41 module_builder.module --- module_builder.module 8 Feb 2009 22:02:17 -0000 1.41 +++ module_builder.module 29 May 2009 16:00:50 -0000 @@ -117,6 +117,7 @@ function module_builder_menu() { 'page arguments' => array('module_builder_admin_settings'), 'access arguments' => array('access module builder'), 'type' => MENU_NORMAL_ITEM, + 'file' => 'module_builder.admin.inc', ); $items['admin/settings/module_builder/settings'] = array( 'title' => 'Settings', @@ -125,6 +126,7 @@ function module_builder_menu() { 'page arguments' => array('module_builder_admin_settings'), 'access arguments' => array('access module builder'), 'type' => MENU_DEFAULT_LOCAL_TASK, + 'file' => 'module_builder.admin.inc', ); $items['admin/settings/module_builder/update'] = array( 'title' => 'Update hooks', @@ -133,100 +135,12 @@ function module_builder_menu() { 'page arguments' => array('module_builder_admin_update'), 'access arguments' => array('access module builder'), 'type' => MENU_LOCAL_TASK, + 'file' => 'module_builder.admin.inc', ); return $items; } -/** - * Admin settings page. - * - * @ingroup module_builder_core - */ -function module_builder_admin_settings($form_state) { - - $form['module_builder_hooks_directory'] = array( - '#type' => 'textfield', - '#title' => t('Path to hook documentation directory'), - '#description' => t('Subdirectory in the directory "%dir" where local copies of hook documentation should be stored.', array('%dir' => file_directory_path() .'/')), - '#default_value' => variable_get('module_builder_hooks_directory', 'hooks'), - ); - - $form['module_builder_write_directory'] = array( - '#type' => 'textfield', - '#title' => t('Path to write module files'), - '#description' => t('Subdirectory in the directory "%dir" where module files should be written.', array('%dir' => file_directory_path() .'/')), - '#default_value' => variable_get('module_builder_write_directory', 'modules'), - ); - - $form['module_builder_header'] = array( - '#type' => 'textarea', - '#title' => t('Module header'), - '#description' => t('This is the code that will be displayed at the top of your module file.'), - '#rows' => 15, - '#default_value' => variable_get('module_builder_header', MODULE_BUILDER_HEADER_DEFAULT), - ); - $form['module_builder_footer'] = array( - '#type' => 'textarea', - '#title' => t('Module footer'), - '#description' => t('This is the code that will be displayed at the bottom of your module file.'), - '#rows' => 15, - '#default_value' => variable_get('module_builder_footer', ''), - ); - $form['module_builder_detail'] = array( - '#type' => 'radios', - '#title' => t('Code detail level'), - '#description' => t('This setting will either display or suppress additional explanatory comments in the resulting module code to help new developers.'), - '#options' => array( - 1 => t("Beginner: I'm just starting out with Drupal development; please display lots of helpful comments in my module code!"), - 0 => t("Advanced: I already know what I'm doing; don't put in a bunch of crap in my module file that I don't need!"), - ), - '#default_value' => variable_get('module_builder_detail', 0), - ); - /* - $form['module_builder_download'] = array( - '#type' => 'radios', - '#title' => t('Download module file checkbox defaults to'), - '#description' => t('When checked, this will automatically generate your module file for you and prompt your browser to download it.'), - '#options' => array( - 1 => t('Enabled'), - 0 => t('Disabled'), - ), - '#default_value' => variable_get('module_builder_download', 1), - ); - */ - return system_settings_form($form); -} - -/** - * Admin hook update form. - */ -function module_builder_admin_update($form_state) { - $last_update = variable_get('module_builder_last_update', 0); - - $form['last_update'] = array( - '#type' => 'item', - '#value' => $last_update ? - t('Your last hook documentation update was %date.', array('%date' => $last_update)) : - t('The hook documentation has not yet been downloaded.'), - ); - - $form['update'] = array( - '#type' => 'submit', - '#value' => 'Download', - ); - - return $form; -} - -/** - * Admin hook update form submit handler. - * Download hooks documentation. - */ -function module_builder_admin_update_submit($form, $form_state) { - _module_builder_check_settings(); - module_builder_update_documentation(); -} /** * Create a directory to store hook files if it does not exist.