Index: contact_forms/contact_forms.css =================================================================== RCS file: contact_forms/contact_forms.css diff -N contact_forms/contact_forms.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ contact_forms/contact_forms.css 1 Dec 2008 14:49:42 -0000 @@ -0,0 +1,3 @@ +#block-contact_forms-0 input { + width: 100%; +} \ No newline at end of file Index: contact_forms/contact_forms.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/contact_forms/contact_forms.module,v retrieving revision 1.11 diff -u -p -r1.11 contact_forms.module --- contact_forms/contact_forms.module 25 Sep 2008 04:20:15 -0000 1.11 +++ contact_forms/contact_forms.module 1 Dec 2008 14:49:43 -0000 @@ -6,29 +6,29 @@ * Creates a unique Site Wide Contact form with out drop down menu for each of the Contact Categories. */ - - - -/** - * Implementation of hook_menu() - */ -function contact_forms_menu() { - // instead of hijacking the path 'contact' we create a path for each contact category - $result = db_query('SELECT category FROM {contact}'); - $num = db_result(db_query("SELECT COUNT(*) FROM {contact}")); - if ($num) { - foreach (db_fetch_object($result) as $contact) { - $name = str_replace(' ', '_' ,$contact->category); - - $items['contact/%name'] = array( - 'page arguments' => array('$name'), - 'access arguments' => array(1), // ?????????????? - 'type' => MENU_CALLBACK, - +function contact_forms_block($op = 'list', $delta = 0, $edit = array()) { + switch ($op) { + case 'list': + $blocks[0] = array( + 'info' => t('Site-wide contact form'), + 'cache' => BLOCK_NO_CACHE, + 'visibility' => 0, + 'pages' => "contact\ncontact/*", ); + return $blocks; + case 'view': + switch ($delta) { + case 0: + require_once(drupal_get_path('module', 'contact') .'/contact.pages.inc'); + drupal_add_css(drupal_get_path('module', 'contact_forms') .'/contact_forms.css', 'module'); + $block = array( + 'subject' => t('Contact'), + 'content' => drupal_get_form('contact_mail_page'), + ); + break; } - } - return $items; + return $block; + } } /** @@ -38,24 +38,26 @@ function contact_forms_form_alter(&$form $path = $_GET['q']; // redirect contact if another fall back page is defined - if ($path == 'contact' && variable_get('contactform_redirect', 'contact') != 'contact') { + if (arg(0) == 'contact' && $path == 'contact' && variable_get('contactform_redirect', 'contact') != 'contact') { drupal_goto(variable_get('contactform_redirect', 'contact')); } // Alter all contact forms except for /contact - if ($form_id == 'contact_mail_page' && $path != 'contact') { + if (arg(0) == 'contact' && $form_id == 'contact_mail_page' && $path != 'contact') { $category = str_replace( '_' , ' ' , arg(1)); $query = db_query("SELECT * FROM {contact} WHERE category = '%s'", $category); $num = db_result(db_query("SELECT COUNT(*) FROM {contact} WHERE category = '%s'", $category)); //if category doesn't exist redirect to 'contact' or User Defined Page - if (!$num) { + if (arg(0) == 'contact' && !$num) { drupal_goto(variable_get('contactform_redirect', 'contact')); } $categories_data = db_fetch_array($query); $contact_form_var = variable_get('contactform_title', 'Contact !category'); - drupal_set_title(t(variable_get('contactform_title', 'Contact !category'), array('!category' => $categories_data['category']))); + if (arg(0) == 'contact') { + drupal_set_title(t(variable_get('contactform_title', 'Contact !category'), array('!category' => $categories_data['category']))); + } $form['contact_information'] = array( '#type' => 'markup',