Index: modules/path/path.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.admin.inc,v
retrieving revision 1.10
diff -u -p -r1.10 path.admin.inc
--- modules/path/path.admin.inc	21 Aug 2008 19:36:37 -0000	1.10
+++ modules/path/path.admin.inc	1 Sep 2008 13:29:33 -0000
@@ -7,14 +7,32 @@
  */
 
 /**
+ * Administrative page callbacks for the path module.
+ */ 
+function path_admin_overview($callback_arg = '') {
+  if (!empty($_POST['paths']) && isset($_POST['operation']) && ($_POST['operation'] == 'delete')) {
+    $output = drupal_get_form('path_multiple_delete_confirm');
+  } 
+  else {
+    $output = drupal_get_form('path_admin_filter_form');
+    $output .= drupal_get_form('path_admin_overview_form');
+  } 
+
+  return $output;
+}
+
+/**
  * Return a listing of all defined URL aliases.
  * When filter key passed, perform a standard search on the given key,
  * and return the list of matching URL aliases.
  */
-function path_admin_overview($keys = NULL) {
-  // Add the filter form above the overview table.
-  $output = drupal_get_form('path_admin_filter_form', $keys);
-  // Enable language column if locale is enabled or if we have any alias with language
+function path_admin_overview_form(&$form_state) {
+  if (arg(3) == 'list' && arg(4)) {
+    $form_state['values']['filter'] = arg(4);
+  }
+  $keys = isset($form_state['values']['filter']) ? $form_state['values']['filter'] : NULL;
+
+  // Enable language column if locale is enabled or if we have any alias with language.
   $count = db_result(db_query("SELECT COUNT(*) FROM {url_alias} WHERE language != ''"));
   $multilanguage = (module_exists('locale') || $count);
 
@@ -28,39 +46,46 @@ function path_admin_overview($keys = NUL
     $sql = 'SELECT * FROM {url_alias}';
     $args = array();
   }
+
   $header = array(
+    array(),
     array('data' => t('Alias'), 'field' => 'dst', 'sort' => 'asc'),
     array('data' => t('System'), 'field' => 'src'),
-    array('data' => t('Operations'), 'colspan' => '2')
   );
   if ($multilanguage) {
-    $header[3] = $header[2];
-    $header[2] = array('data' => t('Language'), 'field' => 'language');
+    $header[] = array('data' => t('Language'), 'field' => 'language');
   }
+  $header[] = array('data' => t('Operations'));
+
   $sql .= tablesort_sql($header);
   $result = pager_query($sql, 50, 0 , NULL, $args);
 
   $rows = array();
+  $paths = array();
   $destination = drupal_get_destination();
   while ($data = db_fetch_object($result)) {
-    $row = array(check_plain($data->dst), check_plain($data->src), l(t('edit'), "admin/build/path/edit/$data->pid", array('query' => $destination)), l(t('delete'), "admin/build/path/delete/$data->pid", array('query' => $destination)));
+    $paths[$data->pid] = '';
+    $form['dst'][$data->pid] = array('#value' => check_plain($data->dst));
+    $form['src'][$data->pid] = array('#value' => check_plain($data->src));
+    
+    $form['operations'][$data->pid] = array('#value' => l(t('edit'), "admin/build/path/edit/$data->pid", array('query' => $destination)));
+
     if ($multilanguage) {
-      $row[4] = $row[3];
-      $row[3] = $row[2];
-      $row[2] = module_invoke('locale', 'language_name', $data->language);
+      $form['language'][$data->pid] = array('#value' => module_invoke('locale', 'language_name', $data->language));
     }
-    $rows[] = $row;
   }
 
-  if (empty($rows)) {
-    $empty_message = $keys ? t('No URL aliases found.') : t('No URL aliases available.') ;
-    $rows[] = array(array('data' => $empty_message, 'colspan' => ($multilanguage ? 5 : 4)));
-  }
-
-  $output .= theme('table', $header, $rows);
-  $output .= theme('pager', NULL, 50, 0);
-
-  return $output;
+  $form['paths'] = array(
+    '#type' => 'checkboxes',
+    '#options' => $paths
+  );
+  $form['pager'] = array('#value' => theme('pager', NULL, 50, 0));
+  
+  $form['delete'] = array('#type' => 'submit', '#value' => t('Delete selected'));
+  $form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
+  
+  $form['#theme'] = 'path_admin_overview_form';
+  return $form;
 }
 
 /**
@@ -110,7 +135,7 @@ function path_admin_form(&$form_state, $
     '#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
+  // This will be a hidden value unless locale module is enabled.
   $form['language'] = array(
     '#type' => 'value',
     '#value' => $edit['language']
@@ -128,7 +153,7 @@ function path_admin_form(&$form_state, $
 
 
 /**
- * Verify that a new URL alias is valid
+ * Verify that a new URL alias is valid.
  */
 function path_admin_form_validate($form, &$form_state) {
   $src = $form_state['values']['src'];
@@ -150,7 +175,7 @@ function path_admin_form_validate($form,
  * Save a new URL alias to the database.
  */
 function path_admin_form_submit($form, &$form_state) {
-  // Language is only set if locale module is enabled
+  // Language is only set if locale module is enabled.
   path_set_alias($form_state['values']['src'], $form_state['values']['dst'], isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0, isset($form_state['values']['language']) ? $form_state['values']['language'] : '');
 
   drupal_set_message(t('The alias has been saved.'));
@@ -159,7 +184,7 @@ function path_admin_form_submit($form, &
 }
 
 /**
- * Menu callback; confirms deleting an URL alias
+ * Menu callback; confirms deleting an URL alias.
  */
 function path_admin_delete_confirm($form_state, $pid) {
   $path = path_load($pid);
@@ -173,7 +198,7 @@ function path_admin_delete_confirm($form
 }
 
 /**
- * Execute URL alias deletion
+ * Execute URL alias deletion.
  */
 function path_admin_delete_confirm_submit($form, &$form_state) {
   if ($form_state['values']['confirm']) {
@@ -190,7 +215,15 @@ function path_admin_delete_confirm_submi
  * @ingroup forms
  * @see path_admin_filter_form_submit()
  */
-function path_admin_filter_form(&$form_state, $keys = '') {
+function path_admin_filter_form(&$form_state) {
+  if (isset($form_state['post']['filter'])) {
+    $form_state['values']['filter'] = $form_state['post']['filter'];
+  }
+  if (arg(3) == 'list' && arg(4)) {
+    $form_state['values']['filter'] = arg(4);
+  }
+  $keys = isset($form_state['values']['filter']) ? $form_state['values']['filter'] : NULL;
+  
   $form['#attributes'] = array('class' => 'search-form');
   $form['basic'] = array('#type' => 'fieldset',
     '#title' => t('Filter aliases')
@@ -237,7 +270,67 @@ function path_admin_filter_form_submit_r
  * Helper function for grabbing filter keys.
  */
 function path_admin_filter_get_keys() {
-  // Extract keys as remainder of path
+  // Extract keys as remainder of path.
   $path = explode('/', $_GET['q'], 5);
   return count($path) == 5 ? $path[4] : '';
 }
+
+/**
+ * Theme the path alias overview.
+ * 
+ * @ingroup themeable
+ **/
+function theme_path_admin_overview_form($form) {
+  if (arg(3) == 'list' && arg(4)) {
+    $form_state['values']['filter'] = arg(4);
+  }
+  $keys = isset($form_state['values']['filter']) ? $form_state['values']['filter'] : NULL;
+
+  // Enable language column if locale is enabled or if we have any alias with language.
+  $count = db_result(db_query("SELECT COUNT(*) FROM {url_alias} WHERE language != ''"));
+
+  $multilanguage = (module_exists('locale') || $count);
+
+  // Overview table:
+  $header = array(
+    theme('table_select_header_cell'),
+    array('data' => t('Alias'), 'field' => 'dst', 'sort' => 'asc'),
+    array('data' => t('System'), 'field' => 'src'),
+  );
+  if ($multilanguage) {
+    $header[] = array('data' => t('Language'), 'field' => 'language');
+  }
+  $header[] = t('Operations');
+
+  $rows = array();
+  $colspan = 5;
+  if (isset($form['dst']) && is_array($form['dst'])) {
+    foreach (element_children($form['dst']) as $key) {
+      $row = array(
+        drupal_render($form['paths'][$key]),
+        drupal_render($form['dst'][$key]),
+        drupal_render($form['src'][$key]),
+      );
+      if (isset($form['language'][$key])) {
+        $row[] = drupal_render($form['language'][$key]);
+        $colspan = 6;
+      }
+      $row[] = drupal_render($form['operations'][$key]);
+      $rows[] = $row;
+    }
+  }
+  else  {
+    $rows[] = array(array('data' => ($keys ? t('No URL aliases found.') : t('No URL aliases available.')), 'colspan' => $colspan));
+    // Remove useless button.
+    unset($form['delete']);
+  }
+
+  $output = theme('table', $header, $rows, array('summary' => t('URL aliases')));
+  if ($form['pager']['#value']) {
+    $output .= drupal_render($form['pager']);
+  }
+
+  $output .= drupal_render($form);
+
+  return $output;
+}
Index: modules/path/path.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.module,v
retrieving revision 1.144
diff -u -p -r1.144 path.module
--- modules/path/path.module	21 Jun 2008 18:22:38 -0000	1.144
+++ modules/path/path.module	1 Sep 2008 13:29:33 -0000
@@ -72,7 +72,6 @@ function path_menu() {
  */
 function path_admin_delete($pid = 0) {
   db_query('DELETE FROM {url_alias} WHERE pid = %d', $pid);
-  drupal_set_message(t('The alias has been deleted.'));
 }
 
 /**
@@ -215,3 +214,40 @@ function path_perm() {
 function path_load($pid) {
   return db_fetch_array(db_query('SELECT * FROM {url_alias} WHERE pid = %d', $pid));
 }
+
+function path_multiple_delete_confirm(&$form_state) {
+  $edit = $form_state['post'];
+
+  $form['paths'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
+  // array_filter() without any callback function supplied removes all entries equal to FALSE.
+  foreach (array_filter($edit['paths']) as $pid => $value) {
+    $alias = path_load($pid);
+    $form['paths'][$pid] = array('#type' => 'hidden', '#value' => $pid, '#prefix' => '<li>', '#suffix' => check_plain($alias['dst']) ."</li>\n");
+   }
+  $form['operation'] = array('#type' => 'hidden', '#value' => 'delete');
+
+  return confirm_form($form, t('Are you sure you want to delete these URL aliases?'), 'admin/build/path', t('This action cannot be undone.'), t('Delete selected'), t('Cancel'));
+}
+
+function path_multiple_delete_confirm_submit($form, &$form_state) {
+  if ($form_state['values']['confirm']) {
+    foreach ($form_state['values']['paths'] as $pid => $value) {
+      path_admin_delete($pid);
+    }
+    drupal_set_message(format_plural(count($form_state['values']['paths']), 'The URL alias has been deleted.', 'The URL aliases have been deleted.'));
+  }
+  $form_state['redirect'] = 'admin/build/path';
+  return;
+}
+
+/**
+ * Implementation of hook_theme(). 
+ */
+function path_theme() {
+  return array(
+    'path_admin_overview_form' => array(
+      'arguments' => array('form' => NULL),
+      'file' => 'path.admin.inc',
+    ),
+  );
+}
