Index: modules/contact/contact.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.admin.inc,v retrieving revision 1.5 diff -u -r1.5 contact.admin.inc --- modules/contact/contact.admin.inc 2 Jul 2008 20:05:11 -0000 1.5 +++ modules/contact/contact.admin.inc 5 Sep 2008 14:01:11 -0000 @@ -13,9 +13,9 @@ $result = db_query('SELECT cid, category, recipients, selected FROM {contact} ORDER BY weight, category'); $rows = array(); while ($category = db_fetch_object($result)) { - $rows[] = array($category->category, $category->recipients, ($category->selected ? t('Yes') : t('No')), l(t('edit'), 'admin/build/contact/edit/' . $category->cid), l(t('delete'), 'admin/build/contact/delete/' . $category->cid)); + $rows[] = array($category->category, $category->recipients, ($category->selected ? t('Yes') : t('No')), l(t('contact form'), 'contact/'. $category->cid), l(t('edit'), 'admin/build/contact/edit/' . $category->cid), l(t('delete'), 'admin/build/contact/delete/' . $category->cid)); } - $header = array(t('Category'), t('Recipients'), t('Selected'), array('data' => t('Operations'), 'colspan' => 2)); + $header = array(t('Category'), t('Recipients'), t('Selected'), t('Link'), array('data' => t('Operations'), 'colspan' => 2)); return theme('table', $header, $rows); } Index: modules/contact/contact.module =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.module,v retrieving revision 1.108 diff -u -r1.108 contact.module --- modules/contact/contact.module 24 Jul 2008 16:25:17 -0000 1.108 +++ modules/contact/contact.module 5 Sep 2008 14:01:12 -0000 @@ -46,10 +46,11 @@ * Implementation of hook_menu(). */ function contact_menu() { - $items['admin/build/contact'] = array( + $items['admin/build/contact/%'] = array( 'title' => 'Contact form', 'description' => 'Create a system contact form and set up categories for the form to use.', 'page callback' => 'contact_admin_categories', + 'page arguments' => array(NULL), 'access arguments' => array('administer site-wide contact form'), ); $items['admin/build/contact/list'] = array( Index: modules/contact/contact.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.pages.inc,v retrieving revision 1.11 diff -u -r1.11 contact.pages.inc --- modules/contact/contact.pages.inc 16 Jul 2008 21:59:26 -0000 1.11 +++ modules/contact/contact.pages.inc 5 Sep 2008 14:01:12 -0000 @@ -10,14 +10,14 @@ /** * Site-wide contact page. */ -function contact_site_page() { +function contact_site_page($arg_category = NULL) { global $user; if (!flood_is_allowed('contact', variable_get('contact_hourly_threshold', 3)) && !user_access('administer site-wide contact form')) { $output = t("You cannot send more than %number messages per hour. Please try again later.", array('%number' => variable_get('contact_hourly_threshold', 3))); } else { - $output = drupal_get_form('contact_mail_page'); + $output = drupal_get_form('contact_mail_page',$arg_category); } return $output; @@ -35,6 +35,10 @@ $default_category = $category->cid; } } + $arg_category = func_get_arg(1); + if (is_numeric($arg_category) && array_key_exists($arg_category, $categories)) { + $default_category = $arg_category; + } if (count($categories) > 0) { $form['#token'] = $user->uid ? $user->name . $user->mail : ''; @@ -57,18 +61,23 @@ '#required' => TRUE, ); if (count($categories) > 1) { - // If there is more than one category available and no default category has been selected, - // prepend a default placeholder value. if (!isset($default_category)) { - $default_category = t('- Please choose -'); + $default_category = '<'. t('Please choose') .'>'; $categories = array($default_category) + $categories; + $form['cid'] = array('#type' => 'select', + '#title' => t('Category'), + '#default_value' => $default_category, + '#options' => $categories, + '#required' => TRUE, + ); + } + else { + // if set $default_category set it hidden, and set the page title + $form['cid'] = array('#type' => 'hidden', + '#value' => $default_category, + ); + drupal_set_title($categories[$default_category]); } - $form['cid'] = array('#type' => 'select', - '#title' => t('Category'), - '#default_value' => $default_category, - '#options' => $categories, - '#required' => TRUE, - ); } else { // If there is only one category, store its cid.