CVS edit link for juncmodule

I am a Drupal Module Developer for Arts and Sciences at The Ohio State University.

I have created a courses module that enables administrators to maintain a course descriptions listing and users to search courses by term and year. Terms may be created since some colleges use semesters and some use quarters. I have several other modules, however, I do not feel that they meet Drupal's CVS requirements as they provide functionality that is only useful to The Ohio State University Community. I have modified my courses module in an attempt to make it as universally useful for all colleges and universities. All of the modules I develop are verified using Coder with "minor (most)" and "Internationalization" selected. I currently host my modules at GitHub, I have read many times that hosting code outside of Drupal.org hurts Drupal. This module is my attempt to at least bring some of my efforts under Drupal.org. If you feel that any of my other modules would be appropriate to host on Drupal.org please let me know, I would be more than happy to add them.

All of my modules may be found here:

http://github.com/mitchellshelton

The specific module I would like to contribute may be found here:

http://github.com/mitchellshelton/courses

An older, and not so clean, but functionally the same, version of this module can be seen in production here:

http://sls.osu.edu/courses

Thank you for your time and consideration. I look forward to getting more involved in the Drupal community!

CommentFileSizeAuthor
#4 courses.tar_.gz9.25 KBmitchellshelton
#1 courses.zip52.06 KBmitchellshelton

Comments

mitchellshelton’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new52.06 KB

I have attached the courses module for review.

Thank you,
-Mitchell

avpaderno’s picture

Status: Needs review » Needs work
Issue tags: +Module review

Hello, and thanks for applying for a CVS account.

  1. See http://drupal.org/coding-standards to understand how a module should be written.
  2. hook_uninstall() is not removing the Drupal variables defined, and used by the module.
  3. // Include node functions
    include(drupal_get_path('module', 'courses') . '/actions/courses.node.inc');
    
    // Include get term function
    include(drupal_get_path('module', 'courses') . '/actions/courses.getterm.inc');
    
    // Include term node functions
    include(drupal_get_path('module', 'courses') . '/actions/courses.termnode.inc');
    
    // Include main functions
    include(drupal_get_path('module', 'courses') . '/actions/courses.main.inc');
    

    If you are always loading those files, then it is better to merge them with the module file.

mitchellshelton’s picture

Thank you for taking the time to look at my module. I have attempted to address the issues you brought up:

1. Is this just a helpful link, or was there something specific I seem to be missing? My module successfully passes coder, but that is mostly syntax, is there something more generic I'm missing.
2. I have updated hook_uninstall as requested. As far as I know only variables using get_variable or set_variable need to be deleted here, is this correct?
3. I have merged these into the .module file as requested. My intention was to keep things clean, perhaps I was just including them incorrectly? Should I have been using require_once() here? Is it generally frowned upon to break apart the .module file? I have heard conflicting sides to this issue and am not sure if it is a matter of personal preference, or adopted as a standard.

Thank you again for your time.

mitchellshelton’s picture

StatusFileSize
new9.25 KB

Attached is the updated version with the changes you requested.

It can also be reviewed here under the master branch:
http://github.com/mitchellshelton/courses

Thank you,
-Mitchell

mitchellshelton’s picture

Status: Needs work » Needs review

Forgot to change the status back to needs review.

mitchellshelton’s picture

Is there something else I need to do here? Or are folks just busy? Is there anything I can do to help?

avpaderno’s picture

Status: Needs review » Needs work
  • The points reported in this review are not in order or importance / relevance.
  • Most of the times I report the code that present an issue. In such cases, the same error can be present in other parts of the code; the fact I don't report the same issue more than once doesn't mean the same issue is not present in different places.
  • Not all the reported points are application blockers; some of the points I report are simple suggestions to who applies for a CVS account. For a list of what is considered a blocker for the application approval, see CVS applications review, what to expect. Keep in mind the list is still under construction, and can be changed to adapt it to what has been found out during code review, or to make the list clearer to who applies for a CVS account.
  1. The version line needs to be removed from the .info file.
  2. Menu descriptions and titles, as well as schema descriptions, are not passed to t().
  3. // Add the stylesheet
    drupal_add_css(drupal_get_path('module', 'courses') .'/css/courses.css');
    
    

    CSS files should be added in the implementation of hook_init(), or more specifically, on the pages where they are required. The module is adding its own CSS files even for pages handled by other modules, and this could cause compatibility problems.

  4. See http://drupal.org/coding-standards to understand how a module should be written. In particular, see how Drupal variables, global variables, constants, and functions defined from the module should be named; how the code should be formatted.
  5.   return array(
        'create course',
        'delete own course',
        'delete any course',
        'edit own course',
        'edit any course',
        'administer courses',
        'create term',
        'delete own term',
        'delete any term',
        'edit own term',
        'edit any term',
        'administer term',
      );
    
    

    Most of the permissions are already implemented from node.module, which defines some permissions for any content type defined from third-party modules.

  6. /**
     *
     * Implementation of hook_admin().
     *
     * Module settings page
     */
    function courses_admin() {
    
    

    The hook hook_admin() doesn't exist in Drupal 6; course_admin() is simply a form builder.

  7. Hook implementation comments should be like the following one:
    /**
     * Implements hook_menu().
     */
    
  8. } // function term_load($node)
    
    

    Those comments are not standard, in Drupal.

  9.   $output .= t('<strong>Long Term Name</strong>: !title', array('!title' => check_plain($node->title)));
    
    

    Using the correct t()-placeholder, there would not be the need to call check_plain().

  10.     'term' => array(
          'name' => t('Term'),
          'module' => 'term',
          'description' => t('Create a term.'),
          'title_label' => t('Term Long Name'),
        )
    
    

    The word term has a particular meaning, in Drupal; it would be better to call the content type differently, to avoid to confuse the users.

  11.   $output .= t('%coursedept&nbsp;', array('%coursedept' => check_plain($node->coursedept)));
    
    

    There is no need to call check_plain(), because that is already done by t() for such t()-placeholders.
    In this case, to use t() is not necessary; a translator cannot translate a string made of just a placeholder.

  12.   $term = t(drupal_substr($tempty, 0, 2));
    
      // Pull the year
      $year = t(drupal_substr($tempty, 2, drupal_strlen($tempty)));
    
    

    The first argument of t() is a literal string, not a concatenation of strings. The script used to create the translation template is not able to handle any dynamic value, even in the case of code similar to t($variable); this means that if the argument of the function is not a literal string, it will not appear in the translation template.

  13. function courses_selofferings_archive_form_submit($form, &$form_state) {
      // Send the user to the course archive page
      drupal_goto('courses/archive');
    } // function courses_selofferings_archive_form_submit($form, &$form_state)
    
    

    Form submission callbacks don't use drupal_goto().

  14.   $form['seltermset'] = array(
        '#type' => 'fieldset',
        '#title' => t('Select Date'),
        '#tree' => TRUE,
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
        '#prefix' => '<div class="courses-selterm-desc">Use the buttons below to select archived, current or future course offerings.</div>',
      );
    
    

    Why isn't the code using #description? #prefix is not used to add a description to the form field.

  15.   if ($options == '') {
        $options[] = t('--');
      }
    
    

    The string '--' doesn't change when translated to a different language; that is like to translate an HTML tag, or decimal digits.

avpaderno’s picture

Status: Needs work » Closed (won't fix)

I am closing this application due to lack of replies.

avpaderno’s picture

Component: Miscellaneous » new project application
Issue summary: View changes

Please read the following links as this is very important information about CVS applications.