CVS edit link for vaeiou

I would like to start two modules: a module that provides an abstraction layer to the mdb2 database library and a module for organic groups that allows users to hide their membership to other users. The mdb2 module is an abstraction layer for the PEAR mdb2 package (http://pear.php.net/package/MDB2/) which provides a common layer for all supported relational databases (oracle, postgres, mysql, mssql, firebird, etc). While Drupal allows you to connect to multiple databases, you cannot connect to them at the same time. I have several instances where I need to use an external database and mdb2 allows this (along with support of oracle).

The second module, og_mp, allows for organic groups users to hide their membership based on roles. There are many times when users do not want to show that they belong to a specific group. This module was written for a student groups website; some groups have private membership lists.

These modules have been developed at Columbia College Information Technology (CCIT) at Columbia University.

Thank you for your time and consideration.

Comments

cchan’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new5.78 KB
new3.88 KB

I have attached tarballs of each of the modules, md2 and og_mp for review

Thank you.

cchan’s picture

Additional information:

Organic Groups privacy integrates with Views 2. It is an additional field in Views that appears when you create/alter the Organic Groups Membership List.

mdb2 requires parameterized queries and supports prepare and execute statements.

avpaderno’s picture

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

Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review your code, pointing out what needs to be changed.

As per http://drupal.org/cvs-application/requirements, the motivation message should be expanded to contain more details about the features of the proposed module/theme; for modules it should include also a comparison with the existing solutions, while for themes a screenshot is also required.

cchan’s picture

StatusFileSize
new134 KB

mdb2

This module provides the means for other Drupal modules to interface with the mdb2 database library. The mdb2 package provides a common API for a number of packages. Multiple database connections to different RDBS can be established. Each database connection is defined in a file specified in the mdb2 configuration page. The database connection is defined in this manner:

var $db_info = array(
  'dbtype', // database type
  'username', // db username
  'password', // password
  'hostspec', // hostname
  'database', // db name
  'port', // database port (defaults to standard)
);

The module uses the first part of a constant defined in the password file to identify the connection. For example:

<?php
  define("test1db_DB_NAME, "test1db");
  define("test1db_DB_HOST, "localhost");
  // ...
?>

There are two methods to use the db, raw query methods and and with parameterized queries. Parameterized queries are strongly recommended.

// Raw query example:
$this->db->selectQuery("SELECT * FROM test1;";

// Parameterized query example:
  $statement = '';
  $types = array('text'); // data types
  $values = array(':name' => 'vaeiou'); // values are automatically sanitized. no need for check_plain

  $statement = "SELECT id FROM test1 WHERE name = :name ;";
  $result = $this->db->mdb2_query($statement, $types, $values);
  $names = $this->db->fetchAll($result);

  return $names;

og_mp: Organic Groups Membership Privacy

The og_mp module enhances the organic groups membership listing view to allow users to hide their membership from various roles. A table is created to store the preferences for each user/group. An OUTER JOIN is implemented in the Views API so that all users do not have to have a corresponding entry in the og_mp table.

The module makes use of hook_views_pre_execute().

function og_mp_views_pre_execute(&$view) {

  if ($view->name == 'og_members') {

  	$pattern = "/users.uid = og_mp_privacy.uid/";

  	// Correct the join that Views makes (Views can't do conditional joins)

  	$replace = "(og_mp_privacy.uid = og_uid.uid AND og_mp_privacy.gid = og_uid.nid)";



    // Alter the regulary query.

    $view->build_info['query'] = preg_replace($pattern, $replace, $view->build_info['query']);

    

    // Alter the count query.

    $view->build_info['count_query'] = preg_replace($pattern, $replace, $view->build_info['count_query']);

  }

}

The {og_mp} table structure:

/* 
 * {og_mp_privacy} table
 * +---------+------------+------+-----+---------+-------+
 * | Field   | Type       | Null | Key | Default | Extra |
 * +---------+------------+------+-----+---------+-------+
 * | uid     | int(11)    | NO   | PRI | 0       |       | 
 * | gid     | int(11)    | NO   | PRI | 0       |       | 
 * | privacy | tinyint(4) | YES  |     | NULL    |       | 
 * +---------+------------+------+-----+---------+-------+
 */

I have attached a screenshot of the Views builder screen. One simply adds the OG Membership Privacy field to the view.

avpaderno’s picture

We review a module/theme per applicant; let us know which one you want reviewed (I am sorry; I forgot to report that before).

cchan’s picture

StatusFileSize
new33.42 KB

If one of the modules is accepted does that mean I can add the other project as a CVS commiter?

I would like to submit the og_mp module. I have attached another screenshot of what the membership listing page looks like.

Thanks.

avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Needs work » Needs review

If one of the modules is accepted does that mean I can add the other project as a CVS commiter?

Yes, it does. Once you get your CVS account, you can create more than one project. Of course, the criteria used to approve a CVS account should guide you when you create new projects. :-).

I am assigning the review to me, as I will review the module tomorrow morning (here it's afternoon, now).

cchan’s picture

Thanks for your time, kiamlaluno.

avpaderno’s picture

Status: Needs review » Fixed
  1. Strings used in the user interface should be in sentence case.
  2. Database schema descriptions should not be passed to t(); see what done from Drupal core modules.
  3. See http://drupal.org/coding-standards to understand how a module should be written. In particular, see how the code should be formatted. Some lines adopt a not constant indentation (probably the code is using tabs instead of spaces).

Thank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:

You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

I thank all the dedicated reviewers as well.

Status: Fixed » Closed (fixed)
Issue tags: -Module review

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

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