? cvs.info
? cvs.module_D5
Index: cvs.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cvslog/cvs.install,v
retrieving revision 1.10
diff -u -p -r1.10 cvs.install
--- cvs.install	5 Dec 2006 21:52:41 -0000	1.10
+++ cvs.install	15 Dec 2006 09:29:27 -0000
@@ -1,6 +1,6 @@
 <?php
 // $Id: cvs.install,v 1.10 2006/12/05 21:52:41 dww Exp $
-// $Name:  $
+// $Name: $
 
 /**
  * Implementation of hook_install()
@@ -173,3 +173,4 @@ function cvs_update_5() {
   return $ret;
 }
 
+
Index: cvs.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cvslog/cvs.module,v
retrieving revision 1.131
diff -u -p -r1.131 cvs.module
--- cvs.module	5 Dec 2006 21:52:41 -0000	1.131
+++ cvs.module	15 Dec 2006 09:29:31 -0000
@@ -58,7 +58,8 @@ function cvs_menu($may_cache) {
     $items[] = array(
       'path' => 'cvs-application',
       'title' => t('CVS application form'),
-      'callback' => 'cvs_application_page',
+      'callback' => 'drupal_get_form',
+      'callback arguments' => 'cvs_application_page',
       'access' => $access,
       'type' => MENU_SUGGESTED_ITEM,
     );
@@ -95,25 +96,34 @@ function cvs_menu($may_cache) {
       'access' => $access,
       'type' => MENU_NORMAL_ITEM,
     );
+    $items[] = array(
+      'path' => 'admin/settings/cvs',
+      'description' => t('Administer the CVS integration module settings.'),
+      'title' => t('CVS settings'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => '_cvs_settings',
+      'access' => $access,
+      'type' => MENU_NORMAL_ITEM,
+    );
 
     // Accounts:
     $items[] = array(
       'path' => 'admin/cvs/list',
-      'title' => t('list'),
+      'title' => t('List'),
       'callback' => 'cvs_account',
       'access' => $access,
       'type' => MENU_DEFAULT_LOCAL_TASK,
     );
     $items[] = array(
       'path' => 'admin/cvs/import',
-      'title' => t('import'),
+      'title' => t('Import'),
       'callback' => 'cvs_account_import',
       'access' => $access,
       'type' => MENU_LOCAL_TASK,
       'weight' => 2,
     );
     $items[] = array('path' => 'admin/cvs/export',
-      'title' => t('export'),
+      'title' => t('Export'),
       'callback' => 'cvs_account_export',
       'access' => $access,
       'type' => MENU_LOCAL_TASK,
@@ -121,7 +131,7 @@ function cvs_menu($may_cache) {
     );
     $items[] = array(
       'path' => 'admin/cvs/status',
-      'title' => t('status'),
+      'title' => t('Status'),
       'callback' => 'cvs_account_status',
       'access' => $access,
       'type' => MENU_LOCAL_TASK,
@@ -129,7 +139,7 @@ function cvs_menu($may_cache) {
     );
     $items[] = array(
       'path' => 'admin/cvs/edit',
-      'title' => t('edit account'),
+      'title' => t('Edit account'),
       'callback' => 'cvs_account_edit',
       'access' => $access,
       'type' => MENU_CALLBACK,
@@ -138,43 +148,44 @@ function cvs_menu($may_cache) {
     // Repositories:
     $items[] = array(
       'path' => 'admin/cvs/repositories',
-      'title' => t('repositories'),
+      'title' => t('Repositories'),
       'callback' => 'cvs_repository',
       'access' => $access,
       'type' => MENU_NORMAL_ITEM,
     );
     $items[] = array(
       'path' => 'admin/cvs/repositories/list',
-      'title' => t('list'),
+      'title' => t('List'),
       'callback' => 'cvs_repository',
       'access' => $access,
       'type' => MENU_DEFAULT_LOCAL_TASK,
     );
     $items[] = array(
       'path' => 'admin/cvs/repositories/add',
-      'title' => t('add repository'),
-      'callback' => 'cvs_repository_add',
+      'title' => t('Add repository'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => 'cvs_repository_form',
       'access' => $access,
       'type' => MENU_LOCAL_TASK,
       'weight' => 2,
     );
     $items[] = array(
       'path' => 'admin/cvs/repositories/edit',
-      'title' => t('edit repository'),
+      'title' => t('Edit repository'),
       'callback' => 'cvs_repository_edit',
       'access' => $access,
       'type' => MENU_CALLBACK,
     );
     $items[] = array(
       'path' => 'admin/cvs/repositories/delete',
-      'title' => t('delete'),
+      'title' => t('Delete'),
       'callback' => 'cvs_repository_delete',
       'access' => $access,
       'type' => MENU_CALLBACK,
     );
     $items[] = array(
       'path' => 'admin/cvs/repositories/fetch',
-      'title' => t('fetch log'),
+      'title' => t('Fetch log'),
       'callback' => 'cvs_repository_fetch',
       'access' => $access,
       'type' => MENU_CALLBACK,
@@ -188,7 +199,7 @@ function cvs_menu($may_cache) {
         // If the user has a CVS account, add a 'track CVS messages' tab to the tracker page.
         $items[] = array(
           'path' => 'user/'. arg(1) .'/track/code',
-          'title' => t('track code'),
+          'title' => t('Track code'),
           'callback' => 'cvs_account_tracker',
           'access' => user_access('access CVS messages') && $account->status == CVS_APPROVED,
           'type' => MENU_LOCAL_TASK,
@@ -203,8 +214,8 @@ function cvs_menu($may_cache) {
         $items[] = array(
           'path' => 'user/'. arg(1) .'/edit/cvs',
           'title' => t('CVS'),
-          'callback' => 'cvs_user_edit_form',
-          'callback arguments' => array($account->uid),
+          'callback' => 'drupal_get_form', 
+          'callback arguments' => array('cvs_user_edit_form', $account->uid),
           'access' => ($user->uid == $account->uid && $account->status == CVS_APPROVED) || user_access('administer CVS'),
           'type' => MENU_LOCAL_TASK,
           'weight' => 3,
@@ -223,7 +234,8 @@ function cvs_menu($may_cache) {
           $items[] = array(
             'path' => 'node/'. arg(1) .'/cvs-access',
             'title' => t('CVS access'),
-            'callback' => 'cvs_project_access_form',
+            'callback' => 'drupal_get_form',
+            'callback arguments' => 'cvs_project_access_form',
             'access' => TRUE,
             'type' => MENU_LOCAL_TASK,
             'weight' => 4,
@@ -261,9 +273,9 @@ function cvs_cron() {
 }
 
 /**
- * Implementation of hook_settings().
+ * Form builder function for system settings.
  */
-function cvs_settings() {
+function _cvs_settings() {
   $strings = _cvs_get_strings();
 
   $form['cvs_email_address'] = array(
@@ -303,25 +315,25 @@ function cvs_settings() {
     '#default_value' => variable_get('cvs_restrict_project_creation', 1),
     '#description' => t('If this box is checked, only users with CVS accounts will be allowed to create project nodes.'),
   );
-  if (module_exist('project') && project_use_taxonomy()) {
+  if (module_exists('project') && project_use_taxonomy()) {
     $form['cvs_directory_validate_by_type'] = array(
-      '#title' => t('Validate %cvs_dir using %type', array('%cvs_dir' => theme('placeholder', 'CVS directory'), '%type' => theme('placeholder', 'Project type'))),
+      '#title' => t('Validate %cvs_dir using %type', array('%cvs_dir' => 'CVS directory', '%type' => 'Project type')),
       '#type' => 'checkbox',
       '#default_value' => variable_get('cvs_directory_validate_by_type', 1),
-      '#description' => t("If this box is checked, the first element of the path specified in the %cvs_dir field must match the selected %type for project nodes. Note: this is a case insensitive comparison, and spaces in the %type field will be converted to hypens ('-') for the purpose of the comparison.", array('%cvs_dir' => theme('placeholder', 'CVS directory'), '%type' => theme('placeholder', 'Project type'))),
+      '#description' => t("If this box is checked, the first element of the path specified in the %cvs_dir field must match the selected %type for project nodes. Note: this is a case insensitive comparison, and spaces in the %type field will be converted to hypens ('-') for the purpose of the comparison.", array('%cvs_dir' => 'CVS directory', '%type' => 'Project type')),
     );
   }
   $form['cvs_validate_by_short_name'] = array(
-    '#title' => t('Validate %cvs_dir using %short_name', array('%cvs_dir' => theme('placeholder', 'CVS directory'), '%short_name' => theme('placeholder', 'Project short name'))),
+    '#title' => t('Validate %cvs_dir using %short_name', array('%cvs_dir' => 'CVS directory', '%short_name' => 'Project short name')),
     '#type' => 'checkbox',
     '#default_value' => variable_get('cvs_validate_by_short_name', 1),
-      '#description' => t("If this box is checked, the last element of the path specified in the %cvs_dir field must match the %short_name field for project nodes.", array('%cvs_dir' => theme('placeholder', 'CVS directory'), '%short_name' => theme('placeholder', 'Project short name'))),
+      '#description' => t("If this box is checked, the last element of the path specified in the %cvs_dir field must match the %short_name field for project nodes.", array('%cvs_dir' => 'CVS directory', '%short_name' => 'Project short name')),
   );
   $form['cvs_directory_validate_dir_root_by_case'] = array(
-    '#title' => t('Ensure lowercase for first element of %cvs_dir', array('%cvs_dir' => theme('placeholder', 'CVS directory'))),
+    '#title' => t('Ensure lowercase for first element of %cvs_dir', array('%cvs_dir' => 'CVS directory')),
     '#type' => 'checkbox',
     '#default_value' => variable_get('cvs_directory_validate_dir_root_by_case', 1),
-    '#description' => t("If this box is checked, the first element of the path specified in the %cvs_dir field must be lowercase.", array('%cvs_dir' => theme('placeholder', 'CVS directory'))),
+    '#description' => t("If this box is checked, the first element of the path specified in the %cvs_dir field must be lowercase.", array('%cvs_dir' => 'CVS directory')),
   );
   $form['cvs_list_per_page'] = array(
     '#title' => t('Number of CVS accounts listed per page'),
@@ -403,7 +415,7 @@ function cvs_settings() {
     '#description' => t('The message to send to users whose accounts have been declined.'),
   );
 
-  if (module_exist('project_release')) {
+  if (module_exists('project_release')) {
     $form['cvs_message_new_release_branch'] = array(
       '#title' => t('Message when new releases are added from a branch'),
       '#type' => 'textarea',
@@ -417,7 +429,7 @@ function cvs_settings() {
       '#description' => t('Message to show to project maintainers when they add a new official release from a tag.'),
     );
   }
-  return $form;
+  return system_settings_form($form);
 }
 
 /**
@@ -466,21 +478,21 @@ function cvs_nodeapi(&$node, $op, $arg =
             $path_elems = array_filter($path_elems);
             if (variable_get('cvs_directory_validate_dir_root_by_case', 1)) {
               if ($path_elems[1] != drupal_strtolower($path_elems[1])) {
-                form_set_error('cvs_directory', t("The root of the CVS directory (%root) must be lowercase.", array('%root' => theme('placeholder', $path_elems[1]))));
+                form_set_error('cvs_directory', t("The root of the CVS directory (%root) must be lowercase.", array('%root' => $path_elems[1])));
               }
             }
             if (project_use_taxonomy() && variable_get('cvs_directory_validate_by_type', 1)) {
               $tree = taxonomy_get_term($node->project_type);
               $path_equiv = drupal_strtolower(str_replace(' ', '-', $tree->name));
               if (drupal_strtolower($path_elems[1]) != $path_equiv) {
-                form_set_error('cvs_directory', t("The root of the CVS directory (%root) does not match the selected project type (%type). Spaces in the type name are converted to hyphens in the path, so given the current project type, the first element of the directory path should be: %goal.", array('%root' => theme('placeholder', $path_elems[1]), '%type' => theme('placeholder', $tree->name), '%goal' => theme('placeholder', $path_equiv))));
+                form_set_error('cvs_directory', t("The root of the CVS directory (%root) does not match the selected project type (%type). Spaces in the type name are converted to hyphens in the path, so given the current project type, the first element of the directory path should be: %goal.", array('%root' => $path_elems[1], '%type' => $tree->name, '%goal' => $path_equiv)));
               }
             }
             if (variable_get('cvs_validate_by_short_name', 1)) {
               $last_elem = array_pop($path_elems);
               if ($last_elem != $node->uri) {
-                form_set_error('cvs_directory', t("The last part of the CVS directory (%last) does not match the short project name (%short).", array('%last' => theme('placeholder', $last_elem), '%short' => theme('placeholder', $node->uri))));
-                form_set_error('uri', t("The short project name (%short) does not match the last part of the CVS directory (%last).", array('%last' => theme('placeholder', $last_elem), '%short' => theme('placeholder', $node->uri))));
+                form_set_error('cvs_directory', t("The last part of the CVS directory (%last) does not match the short project name (%short).", array('%last' => $last_elem, '%short' => $node->uri)));
+                form_set_error('uri', t("The short project name (%short) does not match the last part of the CVS directory (%last).", array('%last' => $last_elem, '%short' => $node->uri)));
               }
             }
           }
@@ -512,6 +524,7 @@ function cvs_form_alter($form_id, &$form
 
 /**
  * Menu Callback: Display the CVS account edit form.
+ * Form builder function for cvs_user_edit_form()
  */
 function cvs_user_edit_form($uid) {
   global $user;
@@ -605,7 +618,7 @@ function cvs_user_edit_form($uid) {
   $form['cvs']['cvs_uid'] = array('#type' => 'value', '#value' => $uid);
   $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
 
-  return drupal_get_form('cvs_user_edit_form', $form);
+  return $form;
 }
 
 /**
@@ -616,11 +629,11 @@ function cvs_user_edit_form_validate($fo
     // Check for duplicates:
     $id = db_result(db_query("SELECT uid FROM {cvs_accounts} WHERE name = '%s' AND uid != %d", $form_values['cvs_name'], $form_values['cvs_uid']));
     if ($id != 0) {
-      form_set_error('cvs_name', t('The specified CVS username is already in use by user #%id.', array('%id' => $id)));
+      form_set_error('cvs_name', t('The specified CVS username is already in use by user #!id.', array('!id' => $id)));
     }
   }
   if (!empty($form_values['cvs_pass']) && strlen($form_values['cvs_pass']) < CVS_MIN_PASS_LENGTH) {
-    form_set_error('cvs_pass', t('The CVS password you have chosen is too short (it must be at least %min characters long).', array('%min' => CVS_MIN_PASS_LENGTH)));
+    form_set_error('cvs_pass', t('The CVS password you have chosen is too short (it must be at least !min characters long).', array('!min' => CVS_MIN_PASS_LENGTH)));
   }
 }
 
@@ -651,7 +664,7 @@ function cvs_user_edit_form_submit($form
     if ($form_values['send_mail']) {
       cvs_mail_user($form_values['cvs_uid'], $form_values['message']);
     }
-    drupal_set_message(t('The CVS account %account has been updated successfully.', array('%account' => theme('placeholder', $form_values['cvs_name']))));
+    drupal_set_message(t('The CVS account %account has been updated successfully.', array('%account' => $form_values['cvs_name'])));
     return 'admin/cvs';
   }
   elseif (strlen($cvs_name) && $form_values['cvs_uid'] == $user->uid && isset($form_values['cvs_pass']) && strlen($form_values['cvs_pass'])) {
@@ -924,7 +937,7 @@ function cvs_alter_project_release_form(
       // TODO: make this a setting or generate the text in some other way?
       $err = t('ERROR: There are no CVS tags for this module that do not already have a release associated with them.');
       $err .= '<p>' . t('To create a release, you must first create either a new CVS tag on one of the existing branches for this project, or you must add a new CVS branch.');
-      $err .= '<p>' . t('Once you have created a tag or branch that should be used for your new release, try pressing the %retry link to continue.', array('%retry' => theme('placeholder', t('Retry'))));
+      $err .= '<p>' . t('Once you have created a tag or branch that should be used for your new release, try pressing the %retry link to continue.', array('%retry' => t('Retry')));
       drupal_set_message($err);
       unset($form['preview']);
       $form['retry'] = array(
@@ -1084,7 +1097,7 @@ function theme_cvs_commit_message($commi
 
   $output .= "<div class=\"title\">Commit ". 
     l("#$commit->cid", "cvs", NULL, "commit=$commit->cid") .
-    t(' by %name', array('%name' => ($commit->uid ? theme('username', $commit) : $commit->user))) .
+    t(' by !name', array('!name' => ($commit->uid ? theme('username', $commit) : $commit->user))) .
     "</div>\n";
   $output .= "<div class=\"files\">$commit->files</div>\n";
   $output .= "<div class=\"description\"><pre>$commit->message</pre></div>\n";
@@ -1160,14 +1173,14 @@ function cvs_show_messages_format($resul
     global $languages, $base_url;
 
     while ($commit = db_fetch_object($result)) {
-      $title = t('Commit %id by %user', array('%id' => $commit->cid, '%user' => $commit->user));
+      $title = t('Commit !id by !user', array('!id' => $commit->cid, '!user' => $commit->user));
       $link = url('cvs', "commit=$commit->cid", NULL, TRUE);
       $extra = array('pubDate' => gmdate('r', $commit->created));
       $message = theme('cvs_commit_message', $commit);
       $items .= format_rss_item($title, $link, $message, $extra);
     }
     
-    $title = t('CVS commit messages for %site', array('%site' => variable_get('site_name', 'drupal')));
+    $title = t('CVS commit messages for !site', array('!site' => variable_get('site_name', 'drupal')));
     $link = url('cvs', NULL, NULL, TRUE);
     $language = count($languages) ? reset(array_keys($languages)) : 'en';
     
@@ -1227,6 +1240,19 @@ function cvs_page_search() {
     $repositories[$repository->rid] = $repository->name;
   }
 
+  $output = drupal_get_form('cvs_search', $repositories);
+   
+  if ($_REQUEST['rid'] || $_REQUEST['user'] || $_REQUEST['branch'] || $_REQUEST['file'] || $_REQUEST['message']) {
+    $output .= theme('box', t('Search results'), cvs_show_messages());
+  }
+   
+  return $output;
+}
+ 
+/**
+ * Form builder function for cvs_search form
+ */
+function cvs_search($repositories) {
   $form['cvs_search'] = array('#type' => 'fieldset', '#title' => t('Search criteria'));
   $form['cvs_search']['message'] = array(
     '#type' => 'textfield',
@@ -1263,13 +1289,8 @@ function cvs_page_search() {
   //$output = preg_replace('/edit\[([^\]]+)\]/', '\1', $output);
   //$output = form($output, 'post', url($_GET['q'], NULL, 'cvs'));
   $form['cvs_search']['#action'] = url();
-  $output = drupal_get_form('cvs_search',$form);
   
-  if ($_REQUEST['rid'] || $_REQUEST['user'] || $_REQUEST['branch'] || $_REQUEST['file'] || $_REQUEST['message']) {
-    $output .= theme('box', t('Search results'), cvs_show_messages());
-  }
-  
-  return $output;
+  return $form;
 }
 
 /**
@@ -1299,8 +1320,8 @@ function cvs_get_project_contributors($n
   while ($contributor = db_fetch_object($result)) {
     $rows[] = array(
       theme('username', $contributor),
-      t('%time ago', array('%time' => format_interval(time() - $contributor->last_commit, 1))),
-      t('%time ago', array('%time' => format_interval(time() - $contributor->first_commit, 1))),
+      t('!time ago', array('!time' => format_interval(time() - $contributor->last_commit, 1))),
+      t('!time ago', array('!time' => format_interval(time() - $contributor->first_commit, 1))),
       format_plural($contributor->commits, '1 commit', '%count commits')
     );
   }
@@ -1355,8 +1376,8 @@ function cvs_mail_user($uid, $extra = ''
         break;
     }
 
-    $from = t('Drupal CVS administrator <%mail>', array('%mail' => variable_get('cvs_email_address', 'cvs@example.com')));
-    user_mail("$account->mail, ". variable_get('cvs_email_address', 'cvs@example.com'), t('CVS account maintenance'), $message, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
+    $from = t('Drupal CVS administrator <!mail>', array('!mail' => variable_get('cvs_email_address', 'cvs@example.com')));
+    drupal_mail('cvs_email_user', "$account->mail, ". variable_get('cvs_email_address', 'cvs@example.com'), t('CVS account maintenance'), $message, $from,  array('X-Mailer' => 'Drupal'));
   }
 }
 
@@ -1367,21 +1388,8 @@ function cvs_account() {
   if (!isset($_SESSION['cvs_list_view_filter'])) {
     $_SESSION['cvs_list_view_filter'] = CVS_QUEUED;
   }
-  $form['cvs_filter'] = array(
-    '#type' => 'select',
-    '#title' => t('Filter by status'),
-    '#options' => $status_options,
-    '#default_value' => $_SESSION['cvs_list_view_filter'],
-    '#prefix' => '<div class="container-inline">'
-  );
-
-  $form['submit'] = array(
-    '#type' => 'submit', 
-    '#value' => t('Filter'),
-    '#suffix' => '</div>'
-  );
   
-  $filter_output = drupal_get_form('cvs_list_view_form', $form);
+  $filter_output = drupal_get_form('cvs_list_view_form', $status_options);
 
   $header = array(
     array('data' => t('User'), 'field' => 'name'),
@@ -1408,8 +1416,8 @@ function cvs_account() {
     $rows[] = array(
       $user->uid ? theme('username', $user) : $user->cvs_name,
       $user->commits,
-      $user->commits ? t('%time ago', array('%time' => format_interval(time() - $user->first_commit, 1))) : t('n/a'),
-      $user->commits ? t('%time ago', array('%time' => format_interval(time() - $user->last_commit, 1))) : t('n/a'),
+      $user->commits ? t('!time ago', array('!time' => format_interval(time() - $user->first_commit, 1))) : t('n/a'),
+      $user->commits ? t('!time ago', array('!time' => format_interval(time() - $user->last_commit, 1))) : t('n/a'),
       $status_options[$user->status],
       l(t('edit'), "user/$user->uid/edit/cvs")
     );
@@ -1419,6 +1427,25 @@ function cvs_account() {
 }
 
 /**
+ * Form builder function for cvs_list_view_form
+ */
+function cvs_list_view_form($status_options) {
+  $form['cvs_filter'] = array(
+    '#type' => 'select',
+    '#title' => t('Filter by status'),
+    '#options' => $status_options,
+    '#default_value' => $_SESSION['cvs_list_view_filter'],
+    '#prefix' => '<div class="container-inline">'
+  );
+  $form['submit'] = array(
+    '#type' => 'submit', 
+    '#value' => t('Filter'),
+    '#suffix' => '</div>'
+  );
+  return $form;
+}
+
+/**
  * Form callback function for list filter.
  */
 function cvs_list_view_form_submit($form_id, $form_values) {
@@ -1430,7 +1457,15 @@ function cvs_list_view_form_submit($form
  *
  * @TODO: add support for multiple repositories.
  */
+
 function cvs_account_import() {
+  return drupal_get_form('_cvs_account_import');
+}
+
+/**
+ * Form builder function for cvs_account_import
+ */
+function _cvs_account_import() {
   $form['instructions'] = array('#value' => t('Drupal lets you import CVS accounts from a CVS <code>passwd</code>-file, found in the <code>CVSROOT</code>-directory of a repository. Copy/paste the contents of the <code>passwd</code>-file (or parts thereof) into the form below to mass import existing CVS accounts.'));
   $form['data'] = array(
     '#type' => 'textarea',
@@ -1440,26 +1475,25 @@ function cvs_account_import() {
     '#required' => TRUE,
   );
   $form['submit'] = array('#type' => 'submit', '#value' => t('Import accounts'));
-
-  return drupal_get_form('cvs_account_import', $form);
-}
-
+  return $form;
+} 
+ 
 /**
  * Process cvs_account_import form submissions.
  */
-function cvs_account_import_submit($form_id, $form_values) {
+function _cvs_account_import_submit($form_id, $form_values) {
   $lines = explode("\n", $form_values['data']);
   foreach ($lines as $line) {
     list($name, $pass, $user) = explode(':', $line);
     if ($name && $pass && $user) {
       if (db_result(db_query("SELECT name FROM {cvs_accounts} WHERE name = '%s'", $name))) {
         db_query("UPDATE {cvs_accounts} SET pass = '%s', status = %d WHERE name = '%s'", $pass, CVS_APPROVED, $name);
-        $names[] = t('updated %name', array('%name' => $name));
+        $names[] = t('updated !name', array('!name' => $name));
       }
       else {
         $uid = db_result(db_query("SELECT uid FROM {users} WHERE name = '%s'", $name));
         db_query("INSERT INTO {cvs_accounts} (uid, name, pass, status) VALUES (%d, '%s', '%s', %d)", $uid, $name, $pass, CVS_APPROVED);
-        $names[] = t('added %name', array('%name' => $name));
+        $names[] = t('added !name', array('!name' => $name));
       }
     }
   }
@@ -1502,7 +1536,7 @@ function cvs_account_status() {
   foreach ($options as $opt => $opt_name) {
     $count = db_result(db_query('SELECT COUNT(*) FROM {cvs_accounts} WHERE status = %d', $opt));
     if ($count) {
-      $output .= '<p>'. t('%option CVS accounts: %count', array('%option' => $opt_name, '%count' => $count)) .'</p>';
+      $output .= '<p>'. t('!option CVS accounts: !count', array('!option' => $opt_name, '!count' => $count)) .'</p>';
     }
   }
   
@@ -1522,23 +1556,23 @@ function cvs_account_status() {
   
   $count = db_result(db_query('SELECT COUNT(*) FROM {cvs_messages}'));
   if ($count) {
-    $output .= '<p>'. t('There have been %count commits.', array('%count' => $count)) .'</p>';
+    $output .= '<p>'. t('There have been !count commits.', array('!count' => $count)) .'</p>';
   }
   
   $warnings = array();
   $count = db_result(db_query('SELECT COUNT(*) FROM {cvs_messages} WHERE uid = 0'));
   if ($count) {
-    $warnings[] = '<li>'. theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')) .' '. t('%count rows in the <code>{cvs_messages}</code>-table have no user ID associated with them.', array('%count' => $count)) .'</li>';
+    $warnings[] = '<li>'. theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')) .' '. t('!count rows in the <code>{cvs_messages}</code>-table have no user ID associated with them.', array('!count' => $count)) .'</li>';
   }
 
   $count = db_result(db_query('SELECT COUNT(*) FROM {cvs_files} WHERE uid = 0'));
   if ($count) {
-    $warnings[] = '<li>'. theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')) .' '. t('%count rows in the <code>{cvs_files}</code>-table have no user ID associated with them.', array('%count' => $count)) .'</li>';
+    $warnings[] = '<li>'. theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')) .' '. t('!count rows in the <code>{cvs_files}</code>-table have no user ID associated with them.', array('!count' => $count)) .'</li>';
   }
 
   $count = db_result(db_query('SELECT COUNT(*) FROM {cvs_files} WHERE nid = 0'));
   if ($count) {
-    $warnings[] = '<li>'. theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')) .' '. t('%count rows in the <code>{cvs_files}</code>-table have no project associated with them.', array('%count' => $count)) .'</li>';
+    $warnings[] = '<li>'. theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')) .' '. t('!count rows in the <code>{cvs_files}</code>-table have no project associated with them.', array('!count' => $count)) .'</li>';
   }
 
   if ($warnings) {
@@ -1564,7 +1598,7 @@ function cvs_repository() {
       l(t('delete'), "admin/cvs/repositories/delete/$repo->rid")
     );
     if ($repo->method) {
-      $updated = message_na();
+      $updated = t('n/a');
       $repo->method = t('external');
     }
     else {
@@ -1634,21 +1668,12 @@ function cvs_fetch_repository(&$repo, $o
   }
 }
 
-function cvs_repository_edit($rid) {
-  if ($repo = db_fetch_object(db_query("SELECT * FROM {cvs_repositories} WHERE rid = '%s'", $rid))) {
-    if ($_POST['op'] == t('Save repository')) {
-      $repo = (object) $_POST['edit'];
-      db_query("UPDATE {cvs_repositories} SET name = '%s', root = '%s', modules = '%s', diffurl = '%s', newurl = '%s', trackerurl = '%s', method = %d WHERE rid = '%s'", $repo->name, $repo->root, $repo->modules, $repo->diffurl, $repo->newurl, $repo->trackerurl, $repo->method, $rid);
-      watchdog('special', 'cvs: updated repository '. $repo->name, l('view', 'admin/cvs'));
-      drupal_set_message(t('Updated CVS repository: %repo', array('%repo' => $repo->name)));
-      drupal_goto('admin/cvs/repositories');
-    }
-    
-    return cvs_repository_form($repo);
-  }
-  else {
-    drupal_not_found();
+function cvs_repository_edit() {
+  $args = func_get_args();
+  if (isset($args[0]) && is_numeric($args[0]) && $repo = db_fetch_object(db_query("SELECT * FROM {cvs_repositories} WHERE rid = %d", $args[0]))) {
+    return drupal_get_form('cvs_repository_form', $repo);
   }
+  drupal_not_found();
 }
 
 function cvs_repository_delete($rid) {
@@ -1659,30 +1684,41 @@ function cvs_repository_delete($rid) {
   drupal_goto('admin/cvs/repositories');
 }
 
-function cvs_repository_add() {
-  if ($_POST['op'] == t('Save repository')) {
-    $repo = (object) $_POST['edit'];
-    db_query("INSERT INTO {cvs_repositories} (name, root, modules, diffurl, newurl, trackerurl, method) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', %d)", $repo->name, $repo->root, $repo->modules, $repo->diffurl, $repo->newurl, $repo->trackerurl, $repo->method);
-    watchdog('special', 'cvs: added repository '. $repo->name, l('view', 'admin/cvs'));
-    drupal_set_message(t('Added CVS repository: %repo', array('%repo' => $repo->name)));
+function cvs_repository_form_submit($form_id, $form_values) {
+  if ($form_values['op'] == t('Save repository')) {
+    $repo = (object)$form_values;
+    if ($repo->rid > 0) {
+      db_query("UPDATE {cvs_repositories} SET name = '%s', root = '%s', modules = '%s', diffurl = '%s', newurl = '%s', trackerurl = '%s', method = %d WHERE rid = %d", $repo->name, $repo->root, $repo->modules, $repo->diffurl, $repo->newurl, $repo->trackerurl, $repo->method, $repo->rid);
+      watchdog('special', 'cvs: repository updated'. $repo->name, l('view', 'admin/cvs'));
+      drupal_set_message(t('Updated CVS repository: %repo', array('%repo' => $repo->name)));    
+    }
+    else {
+      db_query("INSERT INTO {cvs_repositories} (name, root, modules, diffurl, newurl, trackerurl, method) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', %d)", $repo->name, $repo->root, $repo->modules, $repo->diffurl, $repo->newurl, $repo->trackerurl, $repo->method);
+      watchdog('special', 'cvs: added repository '. $repo->name, l('view', 'admin/cvs'));
+      drupal_set_message(t('Added CVS repository: %repo', array('%repo' => $repo->name)));
+    }
     drupal_goto('admin/cvs/repositories');
   }
 
-  return cvs_repository_form($repo);
+  return drupal_get_form('cvs_repository_form', $repo);
 }
 
-function cvs_repository_form($repo = 0) {
+function cvs_repository_form($repo = NULL) {
   $form['cvs_information'] = array('#type' => 'fieldset', '#title' => t('Repository information'));
+  $form['cvs_information']['rid'] = array(
+    '#type' => 'value',
+    '#value' => !is_null($repo) ? $repo->rid : 0,
+  );
   $form['cvs_information']['name'] = array(
     '#type' => 'textfield',
     '#title' => t('Repository name'),
-    '#default_value' => $repo->name,
+    '#default_value' => !is_null($repo) ? $repo->name : '',
     '#size' => 40,
     '#maxlength' => 255,
   );
   $form['cvs_information']['method'] = array('#type' => 'radios',
     '#title' => t('Update method'),
-    '#default_value' => $repo->method,
+    '#default_value' => !is_null($repo) ? $repo->method : '',
     '#options' => array(t('Automatic log retrieval.'), t('Use external script to insert data.')),
     '#description' => t('Automatic log retrieval requires cron.'),
   );
@@ -1692,14 +1728,14 @@ function cvs_repository_form($repo = 0) 
   );
   $form['cvs_automatic']['root'] = array('#type' => 'textfield',
     '#title' => t('CVS root'),
-    '#default_value' => $repo->root,
+    '#default_value' => !is_null($repo) ? $repo->root : '',
     '#size' => 60,
     '#maxlength' => 255,
     '#description' => t('Examples: /path or :pserver:user:password@server:/path.'),
   );
   $form['cvs_automatic']['modules'] = array('#type' => 'textfield',
     '#title' => t('Modules'),
-    '#default_value' => $repo->modules,
+    '#default_value' => !is_null($repo) ? $repo->modules : '',
     '#size' => 40,
     '#maxlength' => 255,
     '#description' => t('Separate multiple modules with spaces.'),
@@ -1713,7 +1749,7 @@ function cvs_repository_form($repo = 0) 
   $form['cvs_urls']['diffurl'] = array(
     '#type' => 'textfield',
     '#title' => t('Diff URL'),
-    '#default_value' => $repo->diffurl,
+    '#default_value' => !is_null($repo) ? $repo->diffurl : '',
     '#size' => 40,
     '#maxlength' => 255,
     '#description' => t('Enter URL to diff web site. Use the %file, %old, %revision variables in the right place to represent the file, old version and new version.'),
@@ -1721,21 +1757,21 @@ function cvs_repository_form($repo = 0) 
   $form['cvs_urls']['newurl'] = array(
     '#type' => 'textfield',
     '#title' => t('New file URL'),
-    '#default_value' => $repo->newurl,
+    '#default_value' => !is_null($repo) ? $repo->newurl : '',
     '#size' => 40,
     '#maxlength' => 255,
     '#description' => t('Enter URL to for the initial revision of a file. Use the %file and %revision variables in the right place to represent the file and initial revision.'),
   );
   $form['cvs_urls']['trackerurl'] = array('#type' => 'textfield',
     '#title' => t('Issue tracker URL'),
-    '#default_value' =>  $repo->trackerurl,
+    '#default_value' =>  !is_null($repo) ? $repo->trackerurl : '',
     '#size' => 40,
     '#maxlength' => 255,
     '#description' => t('Enter URL to link to issues in log messages. Use the %d variable in the right place to represent the issue id.'),
   );
   $form['submit'] = array('#type' => 'submit', '#value' => t('Save repository'));
-
-  return drupal_get_form('cvs_repository_add',$form);
+  
+  return $form;
 }
 
 function cvs_explode($text, $delim = ':') {
@@ -1970,12 +2006,12 @@ function cvs_application_page() {
           break;
         case CVS_DECLINED:
         case CVS_DISABLED:
-          $output = cvs_application_form($application);
+          $output = drupal_get_form('cvs_application_form', $application);
           break;
       }
     }
     else {
-      $output = cvs_application_form();
+      $output = drupal_get_form('cvs_application_form');
     }
   }
   else {
@@ -2060,10 +2096,10 @@ function cvs_application_form($applicati
   
   $form['submit'] = array('#type' => 'submit', '#value' => t('Request CVS account'));
 
-  return drupal_get_form('cvs_application_page', $form);
+  return $form;
 }
 
-function cvs_application_page_validate($form_id, $form_values) {
+function cvs_application_form_validate($form_id, $form_values) {
   global $user;
 
   if ($form_values['maintain'] != 1) {
@@ -2079,7 +2115,7 @@ function cvs_application_page_validate($
     form_set_error('user', t('The CVS username you have chosen is already in use.'));
   }
   if (strlen($form_values['cvs_pass']) < CVS_MIN_PASS_LENGTH) {
-    form_set_error('cvs_pass', t('The CVS password you have chosen is too short (it must be at least %min characters long).', array('%min' => CVS_MIN_PASS_LENGTH)));
+    form_set_error('cvs_pass', t('The CVS password you have chosen is too short (it must be at least !min characters long).', array('!min' => CVS_MIN_PASS_LENGTH)));
   }
 }
 
@@ -2117,12 +2153,12 @@ function cvs_application_page_submit($fo
   }
 
   $message = strtr(variable_get('cvs_new_application_email', $strings['cvs_new_application_email']), $message_variables);
-  user_mail(variable_get('cvs_email_address', 'cvs@example.com'), $subject, $message, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
+  drupal_mail('cvs_email_submit_admin', variable_get('cvs_email_address', 'cvs@example.com'), t('CVS account request'), $message, $from, array('X-Mailer' => 'Drupal'));
   
   // Send an e-mail to the applicant:
-  $from = t('Drupal CVS administrator <%mail>', array('%mail' => variable_get('cvs_email_address', 'cvs@example.com')));
+  $from = t('Drupal CVS administrator <!mail>', array('!mail' => variable_get('cvs_email_address', 'cvs@example.com')));
   $message = strtr(variable_get('cvs_received_email', $strings['cvs_received_email']), $message_variables);
-  user_mail($user->mail, $subject, $message, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
+  drupal_mail('cvs_email_submit_applicant', $user->mail, t('CVS account request'), $message, $from, array('X-Mailer' => 'Drupal'));
   
   // Display a status message:
   drupal_set_message(t('Your CVS account request has been sent to the CVS administrators and will be processed as soon as possible.'));
@@ -2204,9 +2240,9 @@ function theme_cvs_project_access($form)
   $nid = arg(1);
   $node = node_load($nid);
 
-  drupal_set_title(t('CVS access for %title', array('%title' => theme('placeholder', $node->title))));
+  drupal_set_title(t('CVS access for %title', array('%title' => $node->title)));
 
-  $output = '<p>' . t("This page controls CVS access for the %title project. All users listed in this table have permission to commit and tag files in this project's directory in the CVS repository (%cvs_dir). The project owner is listed first and always has full access.", array('%cvs_dir' => theme('placeholder', '/contributions' . $node->cvs_directory), '%title' => theme('placeholder', $node->title))) . '</p>';
+  $output = '<p>' . t("This page controls CVS access for the %title project. All users listed in this table have permission to commit and tag files in this project's directory in the CVS repository (%cvs_dir). The project owner is listed first and always has full access.", array('%cvs_dir' => '/contributions' . $node->cvs_directory, '%title' => $node->title)) . '</p>';
 
   $rows = array();
   $header = array();
@@ -2224,9 +2260,9 @@ function theme_cvs_project_access($form)
                  l(t('delete'), "node/$nid/cvs-access/delete/$user->uid"));
   }
 
-  $rows[] = array(form_render($form['user']), form_render($form['submit']));
+  $rows[] = array(drupal_render($form['user']), drupal_render($form['submit']));
   $output .= theme('table', $header, $rows);
-  $output .= form_render($form);
+  $output .= drupal_render($form);
   return $output;
 }
 
@@ -2247,7 +2283,7 @@ function cvs_project_access_form() {
     '#value' => 0,
   );
   $form['submit'] = array('#type' => 'submit', '#value' => t('Grant access'));
-  return drupal_get_form('cvs_project_access', $form);
+  return $form;
 }
 
 function cvs_project_access_validate($form_id, $form_values, $form) {
@@ -2257,15 +2293,15 @@ function cvs_project_access_validate($fo
   }
   $user = $form_values['user'];
   if (!$user_result = db_fetch_object(db_query("SELECT name, uid FROM {users} WHERE name = '%s'", $user))) {
-     form_set_error('user', t('%user is not a valid user on this site.', array('%user' => theme('placeholder', $user))), 'error');
+     form_set_error('user', t('%user is not a valid user on this site.', array('%user' => $user)), 'error');
      return;
   }
   if (!db_num_rows(db_query("SELECT * FROM {cvs_accounts} WHERE status = %d AND uid = %d", CVS_APPROVED, $user_result->uid))) {
-     form_set_error('user', t('%user does not have a CVS account.', array('%user' => theme('placeholder',$user))), 'error');
+     form_set_error('user', t('%user does not have a CVS account.', array('%user' => $user)), 'error');
   }
   if (db_num_rows(db_query("SELECT * FROM {cvs_project_maintainers} WHERE uid = %d AND nid = %d", $user_result->uid, arg(1)))
       || (($node = node_load(arg(1))) && $user == $node->name)) {
-     form_set_error('user', t('%user already has CVS access for this project.', array('%user' => theme('placeholder', $user))), 'error');
+     form_set_error('user', t('%user already has CVS access for this project.', array('%user' => $user)), 'error');
   }
 
   // save the uid in the form so we don't have to look it up again in
@@ -2281,7 +2317,7 @@ function cvs_project_access_submit($form
   
   $user->uid = $form_values['uid'];
   $user->name = $form_values['user'];
-  drupal_set_message(t('CVS access has been granted to %user.', array('%user' => theme('username', $user))));
+  drupal_set_message(t('CVS access has been granted to !user.', array('!user' => theme('username', $user))));
 }
 
 /**
@@ -2294,8 +2330,8 @@ function cvs_project_delete_access($nid,
   $form['user'] = array('#type' => 'value', '#value' => $user);
 
   return confirm_form('cvs_project_delete_access_confirm', $form,
-            t('Are you sure you want to delete CVS access for %user?',
-              array('%user' => theme('username', $user))),
+            t('Are you sure you want to delete CVS access for !user?',
+              array('!user' => theme('username', $user))),
             "node/$nid/cvs-access/",
             t('This action cannot be undone.'),
             t('Delete'),
@@ -2311,7 +2347,7 @@ function cvs_project_delete_access_confi
   $uid = $form_values['uid'];
   $user = $form_values['user'];
   db_query("DELETE FROM {cvs_project_maintainers} WHERE nid = %d AND uid = %d", $nid, $uid);
-  drupal_set_message(t('CVS access for %user has been deleted.', array('%user' => theme('username', $user))));
+  drupal_set_message(t('CVS access for !user has been deleted.', array('!user' => theme('username', $user))));
   drupal_goto("node/$nid/cvs-access");
 }
 
@@ -2351,9 +2387,9 @@ function _cvs_get_strings() {
   $strings['cvs_message_anon'] = t('The Concurrent Versioning System (CVS) is a software
 development tool available to volunteers with experience in software development,
 translation, theming, or documentation who wish to participate in the Drupal project.
-<p>To request access to the Drupal CVS repository you must <a href="%register">create
-an account</a> and <a href="%login">login</a>. Come back to this page after you have
-logged on.</p>', array('%register' => url('user/register'), '%login' => url('user/login')));
+<p>To request access to the Drupal CVS repository you must <a href="!register">create
+an account</a> and <a href="!login">login</a>. Come back to this page after you have
+logged on.</p>', array('!register' => url('user/register'), '!login' => url('user/login')));
   $strings['cvs_message_auth'] = t('The Concurrent Versioning System (CVS) is a software
 development tool used to manage programs and files for the Drupal project. It is
 available to volunteers with experience in software development, translation, theming
@@ -2361,15 +2397,15 @@ or documentation who wish to participate
 <p>A CVS account is not required to contribute patches to the Drupal project or
 community contributed projects. Anonymous access to the Drupal CVS repository is
 available which can be used to accomplish this. Please peruse the
-<a href="%handbook">CVS handbook</a>and <a href="%patch">patch guide</a> for more
+<a href="!handbook">CVS handbook</a>and <a href="!patch">patch guide</a> for more
 information.</p>
 <p>If you are an open source software developer, themer, translator or documentation
 writer, please use the form below to request access to Drupal\'s CVS repository.
 Prior to applying, please ensure that:
 <ul>
   <li>you have a concrete idea as to what you intend to contribute.</li>
-  <li>you are not duplicating any <a href="%projects">existing projects</a>.</li>
-</ul></p>', array('%projects' => url('project'), '%handbook' => url('handbook/cvs'), '%patch' => url('patch')));
+  <li>you are not duplicating any <a href="!projects">existing projects</a>.</li>
+</ul></p>', array('!projects' => url('project'), '!handbook' => url('handbook/cvs'), '!patch' => url('patch')));
   $strings['cvs_motivation_description'] = t('A message providing information about
 yourself and your planned contributions.
 <ul>
