diff -ubr /home/simon/pageroute/pageroute.install ./pageroute.install --- /home/simon/pageroute/pageroute.install 2009-09-30 23:52:25.000000000 +0930 +++ ./pageroute.install 2009-10-18 09:14:37.000000000 +1030 @@ -14,6 +14,7 @@ 'fields' => array( 'prid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), 'path' => array('type' => 'varchar', 'length' => 127, 'not null' => TRUE), + 'menu_title' => array('type' => 'varchar', 'length' => 127, 'not null' => TRUE), 'options' => array('type' => 'text', 'size' => 'medium', 'not null' => TRUE) ), 'primary key' => array('prid') @@ -100,3 +101,11 @@ return $ret; } + +function pageroute_update_6002() { + $ret = array(); + + $ret[] = update_sql("ALTER TABLE {pageroute_routes} ADD COLUMN menu_title VARCHAR(127) AFTER path"); + + return $ret; +} diff -ubr /home/simon/pageroute/pageroute.module ./pageroute.module --- /home/simon/pageroute/pageroute.module 2009-10-07 20:26:47.000000000 +1030 +++ ./pageroute.module 2009-10-18 09:24:09.000000000 +1030 @@ -59,8 +59,19 @@ } } + if ($route_data->options['hide_menu'] == 1) { $items[$route_data->path] = array( - 'title' => $route_data->path, + 'title' => $route_data->menu_title, + 'page callback' => 'drupal_get_form', + 'page arguments' => array('pageroute_form', (string)$route_data->prid), + 'access callback' => 'pageroute_access', + 'access arguments' => array((string)$route_data->prid), + 'type' => MENU_CALLBACK + ); + } + else { + $items[$route_data->path] = array( + 'title' => $route_data->menu_title, 'page callback' => 'drupal_get_form', 'page arguments' => array('pageroute_form', (string)$route_data->prid), 'access callback' => 'pageroute_access', @@ -68,6 +79,7 @@ 'type' => MENU_NORMAL_ITEM ); } + } return $items; } diff -ubr /home/simon/pageroute/pageroute_ui.forms.inc ./pageroute_ui.forms.inc --- /home/simon/pageroute/pageroute_ui.forms.inc 2009-09-10 19:44:08.000000000 +0930 +++ ./pageroute_ui.forms.inc 2009-10-18 09:19:32.000000000 +1030 @@ -22,7 +22,20 @@ '#required' => TRUE, '#weight' => -5, ); + $form['menu_title'] = array('#type' => 'textfield', + '#title' => t('Menu title'), + '#maxlength' => 127, + '#default_value' => isset($route) ? $route->menu_title : '', + '#weight' => -4, + ); $form['options']['#tree'] = TRUE; + $form['options']['hide_menu'] = array( + '#type' => 'checkbox', + '#title' => t('Use menu callback instead of menu item'), + '#default_value' => isset($route->options['hide_menu']) ? $route->options['hide_menu'] : 0, + '#description' => t('No menu item will be created, you need to use logintoboggan or a manual link to direct the user manually to the start of the pageroute.'), + '#weight' => -2, + ); $form['options']['tabs'] = array( '#type' => 'radios', '#title' => t('Tabs'), @@ -115,7 +128,8 @@ function pageroute_ui_route_edit_submit($form, &$form_state) { $record->path = $form_state['values']['path']; + $record->menu_title = $form_state['values']['menu_title']; $record->options = serialize($form_state['values']['options']); if (!isset($form_state['values']['route']->new)) {