summaryrefslogtreecommitdiff
path: root/modules/path/path.admin.inc
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-11-10 12:08:22 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-11-10 12:08:22 +0000
commit480c53b6dbcabba5dca76cfc24e1c284cff75c4c (patch)
tree8fabf241a251fea183f522b759f1b0df1af80b2d /modules/path/path.admin.inc
parentecf6c8de03e303e4da1bad39450483528ca136fd (diff)
downloadbrdo-480c53b6dbcabba5dca76cfc24e1c284cff75c4c.tar.gz
brdo-480c53b6dbcabba5dca76cfc24e1c284cff75c4c.tar.bz2
#154517 by chx and Desbeers: usability fixes for path module (required fields, permission info and resetting the filter made possible), and fixing language usage on nodeapi update in path_nodeapi
Diffstat (limited to 'modules/path/path.admin.inc')
-rw-r--r--modules/path/path.admin.inc38
1 files changed, 31 insertions, 7 deletions
diff --git a/modules/path/path.admin.inc b/modules/path/path.admin.inc
index 9e22dd705..d63d26c62 100644
--- a/modules/path/path.admin.inc
+++ b/modules/path/path.admin.inc
@@ -95,7 +95,8 @@ function path_admin_form(&$form_state, $edit = array('src' => '', 'dst' => '', '
'#maxlength' => 64,
'#size' => 45,
'#description' => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.'),
- '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=')
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
+ '#required' => TRUE,
);
$form['dst'] = array(
'#type' => 'textfield',
@@ -104,7 +105,8 @@ function path_admin_form(&$form_state, $edit = array('src' => '', 'dst' => '', '
'#maxlength' => 64,
'#size' => 45,
'#description' => t('Specify an alternative path by which this data can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
- '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=')
+ '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
+ '#required' => TRUE,
);
// This will be a hidden value unless locale module is enabled
$form['language'] = array(
@@ -136,6 +138,10 @@ function path_admin_form_validate($form, &$form_state) {
if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid != %d AND dst = '%s' AND language = '%s'", $pid, $dst, $language))) {
form_set_error('dst', t('The alias %alias is already in use in this language.', array('%alias' => $dst)));
}
+ $item = menu_get_item($src);
+ if (!$item || !$item['access']) {
+ form_set_error('src', t("The path '@link_path' is either invalid or you do not have access to it.", array('@link_path' => $src)));
+ }
}
/**
@@ -195,19 +201,37 @@ function path_admin_filter_form(&$form_state, $keys = '') {
'#maxlength' => 64,
'#size' => 25,
);
- $form['basic']['inline']['submit'] = array('#type' => 'submit', '#value' => t('Filter'));
-
+ $form['basic']['inline']['submit'] = array(
+ '#type' => 'submit',
+ '#value' => t('Filter'),
+ '#submit' => array('path_admin_filter_form_submit_filter'),
+ );
+ if ($keys) {
+ $form['basic']['inline']['reset'] = array(
+ '#type' => 'submit',
+ '#value' => t('Reset'),
+ '#submit' => array('path_admin_filter_form_submit_reset'),
+ );
+ }
return $form;
}
/**
- * Process filter form submission.
+ * Process filter form submission when the Filter button is pressed.
*/
-function path_admin_filter_form_submit($form, &$form_state) {
- return 'admin/build/path/list/'. trim($form_state['values']['filter']);
+function path_admin_filter_form_submit_filter($form, &$form_state) {
+ $form_state['redirect'] = 'admin/build/path/list/'. trim($form_state['values']['filter']);
}
/**
+ * Process filter form submission when the Reset button is pressed.
+ */
+function path_admin_filter_form_submit_reset($form, &$form_state) {
+ $form_state['redirect'] = 'admin/build/path/list';
+}
+
+
+/**
* Helper function for grabbing filter keys.
*/
function path_admin_filter_get_keys() {