Index: versioncontrol.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/versioncontrol/versioncontrol.admin.inc,v
retrieving revision 1.63
diff -u -p -r1.63 versioncontrol.admin.inc
--- versioncontrol.admin.inc	27 Oct 2010 15:48:03 -0000	1.63
+++ versioncontrol.admin.inc	1 Nov 2010 22:14:20 -0000
@@ -549,71 +549,13 @@ function versioncontrol_admin_account_ex
 function versioncontrol_admin_repository_list(&$form_state) {
   $form = array();
   $backends = versioncontrol_get_backends();
-  $repositories = versioncontrol_repository_load_multiple(FALSE);
-
-  if (empty($repositories)) {
-    $form['empty'] = array(
-      '#value' => '<p>'. t('No repositories are currently known. Please add one or more repositories in order to be able to use version control features on the site.') .'</p>'
-    );
-    return $form;
-  }
-
-  // The header may be modified separately for each VCS,
-  // so this is only a template and still missing the Actions column.
-  $header_template = array(t('Name'), t('Root'));
-
-  // Sort repositories by backend.
-  $repositories_by_backend = array();
-  foreach ($repositories as $repo_id => $repository) {
-    if (!isset($repositories_by_backend[$repository['vcs']])) {
-      $repositories_by_backend[$repository['vcs']] = array();
-    }
-    $repositories_by_backend[$repository['vcs']][$repo_id] = $repository;
-  }
-
-  // Construct the form elements for each VCS separately.
-  foreach ($repositories_by_backend as $vcs => $vcs_repositories) {
-    $header = $header_template;
-    $title = t('@vcs repositories', array('@vcs' => $backends[$vcs]->name));
+  foreach ($backends as $backend) {
+    $title = t('@vcs repositories', array('@vcs' => $backend->name));
     $form[$vcs] = array(
       '#value' => '<h4>'. $title .'</h4>',
     );
-
-    // Add the standard items of each repository - name and root - to the rows.
-    $rows_by_repo_id = array();
-    foreach ($vcs_repositories as $repo_id => $repository) {
-      $rows_by_repo_id[$repo_id] = array(
-        'name' => check_plain($repository['name']),
-        'root' => check_plain($repository['root']),
-      );
-    }
-    // Provide a possibility for backends and other modules to modify the list.
-    // TODO replace with drupal_alter()
-    foreach (module_implements('versioncontrol_alter_repository_list') as $module) {
-      $function = $module .'_versioncontrol_alter_repository_list';
-      $function($vcs, $vcs_repositories, $header, $rows_by_repo_id);
-    }
-    // Add the Actions column as final column, after all the other ones
-    $header[] = array('data' => t('Actions'), 'colspan' => 2);
-    foreach ($rows_by_repo_id as $repo_id => $row) {
-      $links = array(
-        array(
-          'title' => t('Edit'),
-          'href' => 'admin/project/versioncontrol-repositories/edit/'. $repo_id,
-        ),
-        array(
-          'title' => t('Delete'),
-          'href' => 'admin/project/versioncontrol-repositories/delete/'. $repo_id,
-        ),
-      );
-      $rows_by_repo_id[$repo_id]['links'] = theme('links', $links);
-    }
-    // We don't want the repository ids in the final $rows array.
-    $rows = array_values($rows_by_repo_id);
-
-    // The finished table for the currently processed VCS.
-    $form[$vcs]['list'] = array(
-      '#value' => theme('table', $header, $rows) .'<br/>'
+    $form[$vcs . '_repositories'] = array(
+      '#value' => views_embed_view($backend->getViewName('repositories'), 'default', $backend->name),
     );
   }
   return $form;
Index: includes/views/versioncontrol.views_default.inc
===================================================================
RCS file: includes/views/versioncontrol.views_default.inc
diff -N includes/views/versioncontrol.views_default.inc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ includes/views/versioncontrol.views_default.inc     2 Nov 2010 04:03:06 -0000
@@ -0,0 +1,296 @@
+<?php
+// $Id$
+
+/**
+ * Implementation of hook_views_default_views().
+ */
+function versioncontrol_views_default_views() {
+  /*
+   * View 'versioncontrol_repositories'
+   */
+  $view = new view;
+  $view->name = 'versioncontrol_repositories';
+  $view->description = 'VersionControl Repositories';
+  $view->tag = 'VersionControl';
+  $view->view_php = '';
+  $view->base_table = 'versioncontrol_repositories';
+  $view->is_cacheable = FALSE;
+  $view->api_version = 2;
+  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+  $handler = $view->new_display('default', 'Defaults', 'default');
+  $handler->override_option('fields', array(
+    'repo_id' => array(
+      'label' => 'Repository ID',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'link_class' => '',
+        'alt' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'strip_tags' => 0,
+        'html' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'set_precision' => FALSE,
+      'precision' => 0,
+      'decimal' => '.',
+      'separator' => ',',
+      'prefix' => '',
+      'suffix' => '',
+      'exclude' => 1,
+      'id' => 'repo_id',
+      'table' => 'versioncontrol_repositories',
+      'field' => 'repo_id',
+      'relationship' => 'none',
+    ),
+    'name' => array(
+      'label' => 'Name',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'link_class' => '',
+        'alt' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'strip_tags' => 0,
+        'html' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'exclude' => 0,
+      'id' => 'name',
+      'table' => 'versioncontrol_repositories',
+      'field' => 'name',
+      'relationship' => 'none',
+    ),
+    'vcs' => array(
+      'label' => 'Backend Type',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'link_class' => '',
+        'alt' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'strip_tags' => 0,
+        'html' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'exclude' => 0,
+      'id' => 'vcs',
+      'table' => 'versioncontrol_repositories',
+      'field' => 'vcs',
+      'relationship' => 'none',
+    ),
+    'root' => array(
+      'label' => 'Root',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'link_class' => '',
+        'alt' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'strip_tags' => 0,
+        'html' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'exclude' => 0,
+      'id' => 'root',
+      'table' => 'versioncontrol_repositories',
+      'field' => 'root',
+      'relationship' => 'none',
+    ),
+    'update_method' => array(
+      'label' => 'Update method',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'link_class' => '',
+        'alt' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'strip_tags' => 0,
+        'html' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'exclude' => 0,
+      'id' => 'update_method',
+      'table' => 'versioncontrol_repositories',
+      'field' => 'update_method',
+      'relationship' => 'none',
+    ),
+    'actions' => array(
+      'label' => 'Actions',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'link_class' => '',
+        'alt' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'target' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'strip_tags' => 0,
+        'html' => 0,
+      ),
+      'empty' => '',
+      'hide_empty' => 0,
+      'empty_zero' => 0,
+      'exclude' => 0,
+      'id' => 'actions',
+      'table' => 'versioncontrol_repositories',
+      'field' => 'actions',
+      'relationship' => 'none',
+    ),
+  ));
+  $handler->override_option('arguments', array(
+    'vcs' => array(
+      'default_action' => 'ignore',
+      'style_plugin' => 'default_summary',
+      'style_options' => array(),
+      'wildcard' => 'all',
+      'wildcard_substitution' => 'All',
+      'title' => '',
+      'breadcrumb' => '',
+      'default_argument_type' => 'fixed',
+      'default_argument' => '',
+      'validate_type' => 'none',
+      'validate_fail' => 'not found',
+      'glossary' => 0,
+      'limit' => '0',
+      'case' => 'none',
+      'path_case' => 'none',
+      'transform_dash' => 0,
+      'id' => 'vcs',
+      'table' => 'versioncontrol_repositories',
+      'field' => 'vcs',
+      'validate_user_argument_type' => 'uid',
+      'validate_user_roles' => array(
+        '2' => 0,
+      ),
+      'relationship' => 'none',
+      'default_options_div_prefix' => '',
+      'default_argument_user' => 0,
+      'default_argument_fixed' => '',
+      'arbitrary_data' => '',
+      'default_argument_php' => '',
+      'validate_argument_node_type' => array(
+        'project_project' => 0,
+        'project_release' => 0,
+        'company' => 0,
+        'page' => 0,
+        'person' => 0,
+        'story' => 0,
+      ),
+      'validate_argument_node_access' => 0,
+      'validate_argument_nid_type' => 'nid',
+      'validate_argument_vocabulary' => array(),
+      'validate_argument_type' => 'tid',
+      'validate_argument_transform' => 0,
+      'validate_user_restrict_roles' => 0,
+      'validate_argument_project_term_argument_type' => 'tid',
+      'validate_argument_project_term_argument_action_top_without' => 'pass',
+      'validate_argument_project_term_argument_action_top_with' => 'pass',
+      'validate_argument_project_term_argument_action_child' => 'pass',
+      'validate_argument_php' => '',
+    ),
+  ));
+  $handler->override_option('access', array(
+    'type' => 'perm',
+    'perm' => 'administer version control systems',
+  ));
+  $handler->override_option('cache', array(
+    'type' => 'none',
+  ));
+  $handler->override_option('use_ajax', TRUE);
+  $handler->override_option('items_per_page', 15);
+  $handler->override_option('use_pager', 'mini');
+  $handler->override_option('style_plugin', 'table');
+  $handler->override_option('style_options', array(
+    'grouping' => '',
+    'override' => 1,
+    'sticky' => 1,
+    'order' => 'asc',
+    'columns' => array(
+      'vcs' => 'vcs',
+      'repo_id' => 'repo_id',
+      'name' => 'name',
+    ),
+    'info' => array(
+      'vcs' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'repo_id' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+      'name' => array(
+        'sortable' => 1,
+        'separator' => '',
+      ),
+    ),
+    'default' => '-1',
+  ));
+  $views[$view->name] = $view;
+
+  return $views;
+}
+

