CVS edit link for blup

I have created a drupal 7 module which exposes a new entity (called micro), and an extensive api and module integration (notably views) behind it. This entity is basically a fieldable pointer towards other entities (node/comment/user/micro) or the site itself (global). As well as various permissions, its access is based on the parent entity.

The micro itself stocks five columns in the database: the id, the micro type id, the user id, the parent entity id, and the timestamp. The micro_type table establishes the semantics of this micro bundle, including the entity + bundles to which it can be attached to, the input and display settings, as well as a serialized array column (data) which can be used by other modules to add their semantics.

Example use cases include micro nodes (nodes with no revisions), micro comments, status messages attached to users, private messages (a submodule i'm working on - based on parent-child access), hierarchical structures (pages that attach to chapters that attach to book), etc. The main goal is to extend the api so that these and other applications may be easily accomplished with quick submodules.

The module is currently in an early alpha state, and lacks some api documentation and bug squashing, but it's definitively usable.

CommentFileSizeAuthor
#13 micro.tgz43.68 KBblup
#8 micro.tgz45.08 KBblup
#5 micro.tgz45.14 KBblup
#1 micro.tgz300.9 KBblup

Comments

blup’s picture

StatusFileSize
new300.9 KB

Attaching the module files.

blup’s picture

Status: Postponed (maintainer needs more info) » Needs review

... And changing the status.

avpaderno’s picture

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

Hello, and thank you for applying for a CVS account.

As per requirements, the motivation should include a comparison of the existing solutions.

blup’s picture

Status: Needs work » Needs review

Well, there are no existing solutions that do what I'm trying to accomplish - the reason I made this module.

For drupal 6, there are several micro-communication modules (shoutbox, facebook style status, privatemsg, etc) which establish a communication between two users, and others (comment, notably) that establish a communication between a user and a node. With the coming of drupal 7 entities, I decided it was time to make a cohesive api that abstracts this relationship and provides a fieldable, customizable entity that attaches to others. This entity is light, and contains the essentials (no title/body, just fieldable), and thus very flexible for developers.

Like i mentioned on my motivation statement, this communication might be between a user and a node, a user and another user, or a user and a micro (which, as it can attach to itself, is nest-able). The possible applications are very extensive and I am already working on further expansions on this idea (like i mentioned, a finer grained access module that could turn 'micros' into private messages (user to user) or private comments (user to node/micro/comment).

blup’s picture

StatusFileSize
new45.14 KB

Newer version with OG support and without Git directory.

blup’s picture

I've done quite a bit of work on this module, and i have several others that are based on its api. Although in alpha phase, it remains a very functional and general solution for the problem i've discussed. I'm still working on integrating it with other modules (Views + OG are done, Panels is next) and making a demo website. Is there a chance I could get a review?

DjebbZ’s picture

I've tested the module, and the API is very interesting. It allows me to create "micro-nodes" (in fact micro entities) and attach them to others. I see many applications like the module creator said : private messages (micro entities attached to users with restricted access), annotations (similar to comments but restricted too), a Facebook-like wall of Facebook-style statuses. It could replace several D6 modules that haven't been (yet) ported to D7, and unify them thanks to a single API.

+1 !

blup’s picture

StatusFileSize
new45.08 KB

Another week of work...

blup’s picture

I've been a member for 2 and a half years and made numerous patches (including core). I've worked on this module for a couple of months now, and I believe I have answered all of the requirements for the application process. I understand not a small module (6300 lines with views, og, and search integration), and I still have a bit of a way to go with certain bug fixes and architectural issues, but 30 days and no admin review seems a bit much. Please let me know if there's anything else I could do to speed up the process.

kyle_mathews’s picture

Status: Needs review » Reviewed & tested by the community

I looked through the code a good bit this evening and think blup is more than ready to be given a CVS account. The code was very clean and showed a very good understanding of Drupal APIs. Whatever level of Drupal knowledge you think someone must pass before given a CVS account, blup is clearly past that.

Also, his module is something that potentially many many sites will be using on Drupal 7. Microblogging is one of the biggest UX innovations on the social web in the past several years and something (IMO) Drupal is still fairly weak at and this module could go a long way towards fixing that weakness.

blup’s picture

*bump*

avpaderno’s picture

Status: Reviewed & tested by the community » Needs work

As far as I am concerned,

  1. The module doesn't implement hook_uninstall() to remove the Drupal variables it defines.
  2. There are some code lines which are commented out, including the full code of hook_cron(). As per requirements, the module should be more complete, when it is used for a CVS account application.
  3. /**
     * Implements hook_form().
     */
    function micro_micro_form($micro, $form_state) {
      // It is impossible to define a content type without implementing hook_form()
      // @todo: remove this requirement.
      $form = array();
      return $form;
    }
    

    If the module name is micro.module, then the implementation of hook_form() should be micro_form().

  4.   $type = micro_type_get_type($micro);
      drupal_set_title(t('<em>Edit @type</em> @mid', array('@type' => $type->name, '@mid' => $micro->mid)), PASS_THROUGH);
      return drupal_get_form($type->machine_name . '_micro_form', $micro);
    

    The string used as title should not contain HTML tags.
    PASS_THROUGH should be used if the string is already passed through check_plain(), or any similar functions.

  5. Drupal.behaviors.microFieldsetSummaries = {
      attach: function (context) {
        $('fieldset#edit-revision-information', context).drupalSetSummary(function (context) {
          return $('#edit-revision', context).is(':checked') ?
            Drupal.t('New revision') :
            Drupal.t('No revision');
        });
    
        $('fieldset#edit-author', context).drupalSetSummary(function (context) {
          var name = $('#edit-name').val() || Drupal.settings.anonymous,
            date = $('#edit-date').val();
          return date ?
            Drupal.t('By @name on @date', { '@name': name, '@date': date }) :
            Drupal.t('By @name', { '@name': name });
        });
    
        // ...
    

    The code needs to be updated; Drupal behaviors get the settings object as second parameter.
    To avoid the behavior is applied twice to the same HTML element, the behavior should use $().once.

blup’s picture

Status: Needs work » Needs review
StatusFileSize
new43.68 KB

Thanks for the review kiamlaluno. I've attached a reviewed version. Here's a breakdown of your observations:

  1. Fixed
  2. The module is quite complete. Most of the commented out parts were 'Todo' reminders, but for the sake of clean code I removed all of the reminders and fixed hook_cron.
  3. Similar to node.module's hook_form (node_content_form):
    /**
     * Implements hook_form().
     */
    function node_content_form($node, $form_state) {
      // It is impossible to define a content type without implementing hook_form()
      // @todo: remove this requirement.
      $form = array();
      $type = node_type_get_type($node);
    
      if ($type->has_title) {
        $form['title'] = array(
          '#type' => 'textfield',
          '#title' => check_plain($type->title_label),
          '#required' => TRUE,
          '#default_value' => $node->title,
          '#maxlength' => 255,
          '#weight' => -5,
        );
      }
    
      return $form;
    }
    

    This hook responds to the hook_forms *_micro_form callback :

    /**
     * Implements hook_forms().
     * All micro forms share the same form handler.
     */
    function micro_forms() {
      $forms = array();
      if ($types = micro_type_get_types()) {
        foreach (array_keys($types) as $type) {
          $forms[$type . '_micro_form']['callback'] = 'micro_form';
        }
      }
      return $forms;
    }
    
  4. Although that was copied from node.pages.inc, which does exactly the same thing, I fixed it to your request.
  5. I have removed the *.js files altogether as I have no use for them yet - they were left there from when i inspired myself from node. If what you're mentioning is really an issue, you should mention it in the Core issue queue.


  6. I hope the module meets your standards now. I'm sure there are small bugs, but as you can see I'm actively working on improving the module. Thanks for your critiques.

avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Needs review » Fixed

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
Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

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