Index: cvs.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/cvslog/cvs.module,v retrieving revision 1.106.2.19.2.32 diff -u -p -r1.106.2.19.2.32 cvs.module --- cvs.module 3 Dec 2006 01:56:05 -0000 1.106.2.19.2.32 +++ cvs.module 4 Dec 2006 01:00:55 -0000 @@ -95,25 +95,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 +130,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 +138,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,21 +147,21 @@ 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'), + 'title' => t('Add repository'), 'callback' => 'cvs_repository_add', 'access' => $access, 'type' => MENU_LOCAL_TASK, @@ -160,21 +169,21 @@ function cvs_menu($may_cache) { ); $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 +197,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 +212,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 +232,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 +271,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 +313,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 +413,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 +427,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 +476,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 +522,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; @@ -601,7 +612,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; } /** @@ -612,11 +623,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))); } } @@ -641,7 +652,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'])) { @@ -914,7 +925,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 .= '
' . 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 .= '
' . 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 .= '
' . 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( @@ -1075,7 +1086,7 @@ function theme_cvs_commit_message($commi $output .= "
$commit->message
passwd-file, found in the CVSROOT-directory of a repository. Copy/paste the contents of the passwd-file (or parts thereof) into the form below to mass import existing CVS accounts.'));
$form['data'] = array(
'#type' => 'textarea',
@@ -1432,26 +1464,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));
}
}
}
@@ -1494,7 +1525,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 .= ''. t('%option CVS accounts: %count', array('%option' => $opt_name, '%count' => $count)) .'
'; + $output .= ''. t('!option CVS accounts: !count', array('!option' => $opt_name, '!count' => $count)) .'
'; } } @@ -1514,23 +1545,23 @@ function cvs_account_status() { $count = db_result(db_query('SELECT COUNT(*) FROM {cvs_messages}')); if ($count) { - $output .= ''. t('There have been %count commits.', array('%count' => $count)) .'
'; + $output .= ''. t('There have been !count commits.', array('!count' => $count)) .'
'; } $warnings = array(); $count = db_result(db_query('SELECT COUNT(*) FROM {cvs_messages} WHERE uid = 0')); if ($count) { - $warnings[] = '{cvs_messages}-table have no user ID associated with them.', array('%count' => $count)) .'{cvs_messages}-table have no user ID associated with them.', array('!count' => $count)) .'{cvs_files}-table have no user ID associated with them.', array('%count' => $count)) .'{cvs_files}-table have no user ID associated with them.', array('!count' => $count)) .'{cvs_files}-table have no project associated with them.', array('%count' => $count)) .'{cvs_files}-table have no project associated with them.', array('!count' => $count)) .'' . 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))) . '
'; + $output = '' . 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)) . '
'; $rows = array(); $header = array(); @@ -2168,9 +2199,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; } @@ -2191,7 +2222,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) { @@ -2201,15 +2232,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 @@ -2225,7 +2256,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)))); } /** @@ -2238,8 +2269,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'), @@ -2255,7 +2286,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"); } @@ -2295,9 +2326,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. -To request access to the Drupal CVS repository you must create -an account and login. Come back to this page after you have -logged on.
', array('%register' => url('user/register'), '%login' => url('user/login'))); +To request access to the Drupal CVS repository you must create +an account and login. Come back to this page after you have +logged on.
', 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 @@ -2305,15 +2336,15 @@ or documentation who wish to participateA 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 -CVS handbookand patch guide for more +CVS handbookand patch guide for more information.
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: