Index: project.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project/project.inc,v retrieving revision 1.92 diff -u -p -r1.92 project.inc --- project.inc 12 Nov 2006 13:40:22 -0000 1.92 +++ project.inc 18 Dec 2006 01:17:26 -0000 @@ -257,7 +257,7 @@ function project_project_validate(&$node if ($node->project_type != $tid) { $tid_field = 'tid_' . $tid; if (!empty($node->$tid_field)) { - form_set_error($tid, t('Project type %project_type was selected, you can not use values from %invalid_type categories', array('%project_type' => theme('placeholder', $top_level[$node->project_type]), '%invalid_type' => theme('placeholder', $top_level[$tid])))); + form_set_error($tid, t('Project type %project_type was selected, you can not use values from %invalid_type categories', array('%project_type' => $top_level[$node->project_type], '%invalid_type' => $top_level[$tid]))); } } } @@ -285,7 +285,7 @@ function project_project_set_location(&$ return $breadcrumb; } -function project_project_view(&$node, $teaser = false, $page = false) { +function project_project_view($node, $teaser = false, $page = false) { $node = project_project_content($node, $teaser); if ($page) { // Breadcrumb navigation @@ -294,7 +294,10 @@ function project_project_view(&$node, $t menu_set_location($breadcrumb); if (function_exists('project_release_project_download_table')) { - $output = project_release_project_download_table($node); + $node->content['project_release_project_download_table'] = array( + '#value' => project_release_project_download_table($node), + '#weight' => -10, + ); } // Misc section @@ -306,6 +309,8 @@ function project_project_view(&$node, $t } } + $output = ''; + if ($links) { $output .= theme('item_list', $links, t('Resources')); } @@ -313,7 +318,7 @@ function project_project_view(&$node, $t // Support section $links = array(); - if (module_exist('forum') && ($support_forum = variable_get('project_support_forum', ''))) { + if (module_exists('forum') && ($support_forum = variable_get('project_support_forum', ''))) { $links[] = l(t('Support forum'), 'forum/' . $support_forum); } @@ -343,7 +348,7 @@ function project_project_view(&$node, $t $links[] = sprintf('%s', $node->cvs, t('Browse the CVS repository')); } - if (module_exist('cvs')) { + if (module_exists('cvs')) { $links[] = l(t('View CVS messages'), 'project/cvs/'. $node->nid); $links[] = l(t('Developers'), 'project/developers/'. $node->nid); } @@ -352,8 +357,12 @@ function project_project_view(&$node, $t $output .= theme('item_list', $links, t('Development')); } - $node->body .= $output; + $node->content['project_body'] = array( + '#value' => $output, + '#weight' => 0, + ); } + return $node; } function project_project_load($node) { @@ -370,14 +379,14 @@ function project_project_nodeapi(&$node, switch ($op) { case 'insert': _project_save_taxonomy($node); - if (module_exist('path')) { + if (module_exists('path')) { path_set_alias("node/$node->nid", "project/$node->uri"); } break; case 'update': _project_save_taxonomy($node); - if (module_exist('path')) { + if (module_exists('path')) { path_set_alias("node/$node->nid"); // Clear existing alias. path_set_alias("node/$node->nid", "project/$node->uri"); } @@ -409,7 +418,7 @@ function project_project_access($op, $no if ($user->uid && user_access('maintain projects')) { // Since this CVS access checking is non-standard, we need to // special-case uid 1 to always allow everything. - if ($user->uid != 1 && module_exist('cvs') && variable_get('cvs_restrict_project_creation',1)) { + if ($user->uid != 1 && module_exists('cvs') && variable_get('cvs_restrict_project_creation',1)) { return db_result(db_query("SELECT uid FROM {cvs_accounts} WHERE uid = %d AND status = %d", $user->uid, CVS_APPROVED)) ? TRUE : FALSE; } else { Index: project.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/project/project.module,v retrieving revision 1.256 diff -u -p -r1.256 project.module --- project.module 12 Nov 2006 13:40:22 -0000 1.256 +++ project.module 18 Dec 2006 01:17:28 -0000 @@ -8,10 +8,8 @@ if (file_exists("$path/project.inc")) { function project_help($section) { switch ($section) { - case 'admin/modules#description': - return t('Provides a project node type and browsing of projects.'); case 'node/add#project_project': - return t('A project is something a group is working on. It can optionally have issue tracking, integration with revision control systems, releases, and so on.' ); + return t('A project is something a group is working on. It can optionally have issue tracking, integration with revision control systems, releases, and so on.'); case 'node/add/project_project': if (project_use_taxonomy()) { $tree = taxonomy_get_tree(_project_get_vid()); @@ -28,8 +26,8 @@ function project_help($section) { $help = t('

Properly categorizing your project will help ensure that users can find it easily. Please follow these steps:

', array('%types' => implode (', ', $types), '%type' => $types[0], '%categories' => implode (', ', $categories))); +
  • Then choose one or more categories below this term to classify your project. For example, for !type, you would choose from the various !type types: !categories, and so on.
  • + ', array('!types' => implode (', ', $types), '!type' => $types[0], '!categories' => implode (', ', $categories))); } } $help .= variable_get('project_help_node_add', ''); @@ -40,7 +38,7 @@ function project_help($section) { return t('

    The project module makes special use of the taxonomy (category) system. A special vocabulary, "Projects", has been created automatically.

    To take full advantage of project categorization, add at least two levels of terms to this vocabulary. The first level will be the basic project types, e.g., "modules", "themes", "translations".

    Subterms of each of these types will be the categories that users can select to classify the projects. For example, "modules" might have sub-terms including "mail" and "XML".

    -

    Use the vocabulary admin page to view and add terms.

    ', array('%taxonomy-admin' => url('admin/taxonomy/' . $vid))); +

    Use the vocabulary admin page to view and add terms.

    ', array('!taxonomy-admin' => url('admin/content/taxonomy/' . $vid))); } break; } @@ -55,11 +53,11 @@ function project_block($op = 'list', $de return $blocks; } else if ($op == 'view') { - $uris = NULL; - $projects = array_merge(array(0 => t('')), project_projects_select_options($uris, FALSE, 'node/')); $block['subject'] = t('Project navigation'); - $form = project_quick_navigate_form($projects); - $block['content'] = drupal_get_form('project_quick_navigate_form', $form); + //$form = project_quick_navigate_form($projects); + $block['content'] = drupal_get_form('project_quick_navigate_form'); return $block; } @@ -67,7 +65,11 @@ function project_block($op = 'list', $de function project_node_info() { return array( - 'project_project' => array('name' => t('project'), 'base' => 'project_project'), + 'project_project' => array( + 'name' => t('Project'), + 'module' => 'project_project', + 'description' => t('Provides a project node type and browsing of projects.'), + ), ); } @@ -110,7 +112,7 @@ function project_main_settings() { '#title' => $term->name, '#default_value' => variable_get('project_sort_method_used_' . $term->tid, array_keys($sort_methods)), '#options' => $sort_methods, - '#description' => t('Sorting options to enable for %term', array('%term' => $term->name)) + '#description' => t('Sorting options to enable for !term', array('!term' => $term->name)) ); } } @@ -121,13 +123,13 @@ function project_main_settings() { '#description' => t('The default maximum number of projects to list when browsing lists, e.g., by category.') ); - if (module_exist('forum') && project_use_taxonomy()) { + if (module_exists('forum') && project_use_taxonomy()) { $form['project_support_forum'] = taxonomy_form(_forum_get_vid(), variable_get('project_support_forum', ''), t('Select the support forum for projects'), 'project_support_forum'); } // If the project_sort_method setting has changed, the menu will need to be rebuilt. menu_rebuild(); - return system_settings_form('project_main_settings', $form); + return system_settings_form($form); } function project_link($type, $node = 0, $main = 0) { @@ -136,9 +138,9 @@ function project_link($type, $node = 0, case 'page': if (user_access('access projects')) { $links['project_view_all'] = array( - '#title' => t('projects'), - '#href' => 'project', - '#attributes' => array('title' => t('View all projects.')), + 'title' => t('Projects'), + 'href' => 'project', + 'attributes' => array('title' => t('View all projects.')), ); } break; @@ -213,14 +215,22 @@ function project_menu($may_cache) { // User pages: $access = user_access('access projects'); + $items[] = array('path' => 'admin/settings/project', + 'title' => t('Projects'), + 'callback' => 'drupal_get_form', + 'callback arguments' => 'project_main_settings', + 'access' => user_access('administer projects'), + 'type' => MENU_NORMAL_ITEM, + 'description' => t('Provides a project node type and browsing of projects.'),); + $items[] = array('path' => 'project', - 'title' => t('projects'), + 'title' => t('Projects'), 'callback' => 'project_page_overview', 'access' => $access, 'type' => MENU_NORMAL_ITEM); $items[] = array('path' => 'project/goto', - 'title' => t('project navigation'), + 'title' => t('Project navigation'), 'callback' => 'project_goto', 'access' => $access, 'type' => MENU_CALLBACK); @@ -249,7 +259,7 @@ function project_menu($may_cache) { $term_methods = array_filter(variable_get('project_sort_method_used_' . $term->tid, $sort_methods)); foreach ($term_methods as $sort_method) { $items[] = array('path' => 'project/' . $term->name . '/'. $sort_method, - 'title' => t('browse by %sort_method', array('%sort_method' => $sort_method)), + 'title' => t('browse by !sort_method', array('!sort_method' => $sort_method)), 'access' => $access, 'type' => (($sort_method == variable_get('project_sort_method', 'category') || (($j == 0) && !in_array(variable_get('project_sort_method', 'category'), $term_methods))) ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK), 'weight' => ($sort_method == variable_get('project_sort_method', 'category')) ? -10 : $j, @@ -265,11 +275,6 @@ function project_menu($may_cache) { // CVS messages: $items[] = array('path' => 'project/cvs', 'title' => t('CVS'), 'callback' => 'project_cvs', 'access' => $access, 'type' => MENU_CALLBACK); - - // Create projects - $access = project_project_access('create', NULL); - $items[] = array('path' => 'node/add/project_project', 'title' => t('project'), 'callback' => 'node_page', 'access' => $access, 'type' => MENU_NORMAL_ITEM); - } else { drupal_add_css(drupal_get_path('module', 'project') .'/project.css'); @@ -305,7 +310,7 @@ function project_form_alter($form_id, &$ } else { unset($form['path']['path']); - $form['path']['value'] = array('#value' => t('Automatically generated path alias: %url', array('%url' => theme('placeholder', $url_alias)))); + $form['path']['value'] = array('#value' => t('Automatically generated path alias: %url', array('%url' => $url_alias))); } } } @@ -334,7 +339,7 @@ function project_goto() { drupal_goto($_REQUEST['edit']['project_goto']); } else { - drupal_goto(); + //drupal_goto(); } } @@ -353,24 +358,10 @@ function project_page_overview($termname $breadcrumb = array(l(t('Home'), NULL)); $sort_methods = module_invoke_all('project_sort_methods', 'methods'); - - if (module_exist('project_release') && variable_get('project_release_browse_versions', 0)) { - // Read in requested version, if any. - if ($_POST['edit']['version_tid']) { - $version = $_POST['edit']['version_tid']; - } - else if ($_SESSION['project_version']) { - $version = $_SESSION['project_version']; - } - else { - $version = variable_get('project_release_overview', -1); - } - $form = project_release_version_filter_form($version); - $version_form = drupal_get_form('project_release_version_filter_form', $form); - if ($_POST['edit']['version_tid']) { - $_SESSION['project_version'] = $form_values['version_tid']; - } - $output .= $version_form; + $output = ''; + + if (module_exists('project_release') && variable_get('project_release_browse_versions', 0)) { + $output .= drupal_get_form('project_release_version_filter_form');; } // If browsing by taxonomy, only fetch projects for this term. @@ -380,7 +371,7 @@ function project_page_overview($termname $term = db_fetch_object(db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE t.vid = %d AND t.name = '%s'", 't', 'tid'), $vid, $termname)); - $breadcrumb[] = l(t('projects'), 'project', array('title' => t('Browse projects'))); + $breadcrumb[] = l(t('Projects'), 'project', array('title' => t('Browse projects'))); if (!$sort_method) { // For the default, we use the overall default if enabled for this term, and if not we use the first enabled method. @@ -489,7 +480,7 @@ function project_page_overview($termname // If the site has enabled issue tracking via the project_issue // module, we want to add 1 more field and JOIN to our query so // we can provide the link for "Bugs and feature requests"... - if (module_exist('project_issue')) { + if (module_exists('project_issue')) { $sql_elements['fields']['pieces'][] = 'pip.issues'; $sql_elements['joins']['pieces'][] = 'INNER JOIN {project_issue_projects} pip ON n.nid = pip.nid'; } @@ -570,7 +561,7 @@ function project_page_overview($termname // If the site has enabled issue tracking via the project_issue // module, we want to add 1 more field and JOIN to our query so // we can provide the link for "Bugs and feature requests"... - if (module_exist('project_issue')) { + if (module_exists('project_issue')) { $ISSUES = ', pip.issues'; $ISSUE_JOIN ='INNER JOIN {project_issue_projects} pip ON n.nid = pip.nid'; } @@ -584,7 +575,10 @@ function project_page_overview($termname $project->terms = array(); foreach (taxonomy_node_get_terms($project->nid) as $term) { if ($term->name != $termname) { - $project->terms[] = l($term->name, project_term_path($term)); + $project->terms[] = array( + 'title' => $term->name, + 'href' => project_term_path($term), + ); } } } @@ -762,7 +756,7 @@ function _project_date($timestamp) { */ function project_projects_select_options(&$project_urls, $issues = TRUE, $key_prefix = NULL) { $projects = array(); - if ($issues && module_exist('project_issue')) { + if ($issues && module_exists('project_issue')) { $ISSUE_JOIN ='INNER JOIN {project_issue_projects} pip ON n.nid = pip.nid'; $ISSUE_WHERE = 'AND pip.issues = 1'; } @@ -796,32 +790,36 @@ function project_projects_select_options return $projects; } -function project_quick_navigate_form($projects) { +function project_quick_navigate_form() { + $uris = NULL; + $projects = array_merge(array(0 => t('