Room Reservations is a module that makes it simple for any facility to set up and maintain a system that allows its patrons to reserve rooms. It was created by Randall Library at the University of North Carolina Wilmington, where it is used by students, faculty, and staff to reserve group study rooms within the library. During the most recent month (November 2012), 1781 reservations were made for the library's 15 group study rooms with almost no assistance or involvement from library personnel.

reservation calendar

Users are presented with an easy to read reservation calendar that shows bookings and open times for all the available rooms. To make a reservation, the user clicks on an open time block and fills out a short reservation form. A confirmation is sent immediately by email or cell phone text message, and reminders are sent if the reservation is made more than a day in advance.

The module can be extensively configured to meet the needs of different institutions. Some of the elements that can be customized include:

  • application name
  • room categories
  • rooms
  • hours by day when reservations can be made
  • reservation policies
  • reservation instructions
  • SMS wireless network information
  • reservation confirmation messages
  • reservation reminder messages
  • time of day when reminders are sent

Before creating this module, we reviewed and analyzed every Drupal module that offered any type of reservation functionality. A number of modules contained a small fraction of the functionality we required, but none of the existing modules offered everything needed to provide our users with an intuitive, easy-to-use interface. For example, there is no module that includes the reservation calendar shown above. There is a sizable amount of interest among academic libraries for a module like this, and this kind of module will be useful to any kind of institution that is need of an automated room reservation system.

Room Reservations project page

Room Reservations project documentation

Try out a demonstration

Repository:

git clone --recursive --branch 6.x-1.x BobHumphrey@git.drupal.org:sandbox/BobHumphrey/1834546.git room_reservations

Drupal 6

Other projects reviewed:

Thank you for reviewing!

CommentFileSizeAuthor
#10 coder-result.txt1.75 KBklausi

Comments

monymirza’s picture

Priority: Normal » Critical
Status: Needs review » Needs work

Hi,

there is a little bit work required. Please fix errors and warnings listed here: http://ventral.org/pareview/httpgitdrupalorgsandboxbobhumphrey1834546git

Run coder module to check your code before pushing to git
(please check the Drupal coding standards)

dydave’s picture

Hi Bob,

Thanks for contributing this very interesting module and for all the detailed information.

Several additional comments in terms of code structure:

1 - room_reservation.js
I would recommend you try replacing your JS calls with Drupal.behaviors.xxxx.
For example:

(function ($) {

  Drupal.behaviors.room_reservation = {
    attach: function (context, settings) {
      // select room and start time
      $('#rooms ul li.reservable, #rooms ul li.open').mouseover(function() {
        $(this).css( {
          'background-color' : '#999999'
        });
      }); // end mouseover function
      $('#rooms ul li.reservable, #rooms ul li.open').mouseout(function() {
        $(this).css( {
          'background-color' : '#FFFFFF'
        });
      }); // end mouseout function
      
      [....Next parts of your code...]
    }
  };
})(jQuery);

As a recommendation, I would suggest you take a look at facetapi.admin.js from the Facetapi module.

2 - room_reservation.module
For coding standards, maintenance and the sake of clarity, I would recommend moving all your class objects and declarations into:
includes/room_reservation.[obj].inc
At this point you would have to include these class files in the room_reservation.info file as well.
For an example, I would recommend that you take a look at the Facetapi module, again, which has this includes folder (I think it's called plugins) with many classes declarations.

3 - room_reservation.css
line 1: The @charset is not needed I think (never saw it in other modules).
For example, check Facetapi module, mentioned in point 1.

That's all I could see so far, but I guess we would have to do other checks after the coding standards and these comments have been cleaned up.

Hope that helps. Cheers!

Bob Humphrey’s picture

Priority: Critical » Normal
Status: Needs work » Needs review

Thank you monymirza for reviewing my module!

I've fixed all the errors and warnings listed at http://ventral.org/pareview/httpgitdrupalorgsandboxbobhumphrey1834546git.

Bob Humphrey’s picture

Thank you DYdave for reviewing my module!

I made the changes outlined in #1 and #3 above.

However, as for item #2, I don't understand what you are requesting. I've reread the Drupal module developers guide and Drupal Standards, security and best practices and I don't see anything that explains this.

I've studied the Facet API module, but I don't understand this part of the code. I see that the classes are placed inside of the plugins/facetapi directory, and I see that they are referenced in facetapi.facetapi.inc. But I don't understand the linking mechanism between the classes and the rest of the code.

There are methods like this within facetapi.facetapi.inc:

/**
 * Implements hook_facetapi_widgets().
 */
function facetapi_facetapi_adapters() {
  $path = drupal_get_path('module', 'facetapi') . '/plugins/facetapi/';
  return array(
    'adapter' => array(
      'handler' => array(
        'label' => t('Abstract class for adapters'),
        'class' => 'FacetapiAdapter',
        'abstract' => TRUE,
        'path' => $path,
        'file' => 'adapter.inc',
      ),
    ),
  );
}

But what's going on here? It seems that some kind of custom hook has been created, but what is the hook doing and how is it being used? There is no documentation, and I can't find a reference to anything like this within the Drupal documentation. I don't know what the array is that is being created in this function, or what any of the values mean. And a search on this function shows that it is not being called directly from anywhere in facetapi module.

I'm wondering if this type of structure is needed for my module. I'm only creating one class, and it's a very simple class with only one function, a constructor.

I very much appreciate the time you have taken to review my module.

dydave’s picture

Hi Bob,

Really sorry for the late reply, but I have been kept overly busy with other urgent cases.

Alright, so I took a look again at the code, but I have to say the module file is very large (more than 4000 lines), so it takes quite some time obviously to even just go through half of the code of this single file (not to mention the room_reservations.admin.inc which is pretty big, as well...).

So I guess you're very likely to need quite a few reviews and testing for such an important amount of code, objects and functions.

I assume it would be a good thing to try improving structural aspects, which would end up in a better organization of the code, as I mentioned in #2:

2 - room_reservation.module
For coding standards, maintenance and the sake of clarity, I would recommend moving all your class objects and declarations into:
includes/room_reservation.[obj].inc
...
For an example, I would recommend that you take a look at the Facetapi module, again, which has this includes folder (I think it's called plugins) with many classes declarations.

At that time, I couldn't recall the example of code I was referring to, in my mind, so I just tried to find another module, but that was probably a little inappropriate/awkward.
I think this wasn't necessarily the best example I find, since Facetapi is not exactly the module I was looking for.

I went through the modules I reviewed and followed a little bit and finally found the module I was looking for: Botcha-7.x-2.0.
In particular, I would like to attract your attention at the way the files are organized with the controller and model folders which allow a clearer definition and organization of the code that is needed for defining objects and classes and or controller to do stuffs with objects.

But then it seems that's a 7.x module and Room Reservations is for 6.x (so far), so I'm not sure at all whether something like that would be feasible or recommended with drupal-6.x.
Maybe you could take a look at the Botcha-6.x to see if there is anything that could be adapted.

What I meant is that perhaps a small improvement could be to try moving the class Reservation to its own file and for that perhaps the Botcha could give you some inspiration.

I haven't looked any further than that into module's code and more specifically at the details of how this Botcha style structure could be applied, but I thought you might be interested in looking into that module as well.

That's pretty much all I got from this review so far, but I will keep looking further and surely let you know if I found anything else.

One last note, is that if you ever considered working on a 7.x version, I would certainly recommend you look at working with Entity or Entity API.

I hope all these comments will help improving this impressive module, which must have required a very important amount of work and time.

Feel free to let me know if you would have any other questions, comments or concerns on these items, I would surely be glad to provide more information.

Cheers!

Bob Humphrey’s picture

Hello DYdave,

I studied Botcha-6.x and reorganized my room_reservations.module file based on your suggestions. There are now model, view, and controller folders inside the module, with files in each folder to handle the different parts of the application. I also moved all the helper functions into a new file named room_reservations.inc. I think the module is much better organized now, and it should be a lot easier to find things and perform maintenance in the future.

I will definitely take your suggestion and study the other modules you mentioned, as I am hoping to create a 7.x version of this module in the future.

Thank you once again for your work in reviewing this code. It is very generous of you to take the time to review such a large module.

Bob

dydave’s picture

Hi Bob,

You've really done some amazing work there.
It seems my comment and the Botcha module actually gave you a lot of inspiration and you managed taking down the module file from 4000 lines to 800+ .... That's an incredible improvement.
Not to mention the folder structure and distinction with helper functions, etc....

Really nice work.
I checked again the PAReview and it seems that obviously you watched out for that as well (no errors).

So far, I have nothing else to report, but I will certainly keep checking and let you know if I am able to find anything subject to suspicion.

Thanks again very much for all your work, efforts and very kind answers.
Cheers!

Bob Humphrey’s picture

Priority: Normal » Major
Bob Humphrey’s picture

Issue summary: View changes

Correct git branch

Bob Humphrey’s picture

Issue tags: +PAreview: review bonus

Added review bonus.

klausi’s picture

Priority: Major » Normal
Status: Needs review » Needs work
Issue tags: -PAreview: review bonus
StatusFileSize
new1.75 KB

Review of the 6.x-1.x branch:

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. http://drupal.org/project/simple_reservation/ - Module duplication and fragmentation is a huge problem on drupal.org and we prefer collaboration over competition. Could this be integrated into the existing module? If not please describe the differences to the existing project on your project page.
  2. "module_load_include('inc', 'room_reservations', ...": no need to use module_load_include as you are including files from your own module which you already know where they are. Use something like require_once 'mymodule.inc';
  3. room_reservations.module: why do you need to populate the global variable on every single page request? Do not execute any stuff in the global scope outside of a function.
  4. why do you need to globally include so many files? Are there all hooks in them? Otherwise you should only include files when you actually need them. And you can specify files for inclusion with hook_menu() for example.
  5. A global variable? Really? What for? Shouldn't that be just a statically cached function?
  6. "db_set_active('mainsite');": what is mainsite? Do I need a second DB in order for your module to work? Please add that to the README.txt
  7. _room_reservations_current_months(): why are the months not translated with t()? Please add a comment.
  8. _room_reservations_hours(): could be seriously shortened with a loop?
  9. _room_reservations_detect_mobile(): that looks really site-specific and should be removed. All the DB switching is really confusing ... what is the mobile site? Where is it explained that I need to configure a second DB for that?
  10. "define('SAVE_CONFIRMATION_MSG', ...": all constants defined by your module to be prefixed with your module's name to avoid name collisions.
  11. "form_set_error($field, check_plain($message));": why do you use check_plain() here? $message does not contain any user provided text, so it is useless. Please read http://drupal.org/node/28984 again. Also in many other places.
  12. "$message = 'Invalid email address.';": all user facing text must run through t() for translation.

Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

PA robot’s picture

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

Closing due to lack of activity. Feel free to reopen if you are still working on this application.

I'm a robot and this is an automated message from Project Applications Scraper.

PA robot’s picture

Issue summary: View changes

Added other modules reviewed.