CVS edit link for Becky Kinney

I work in Educational Technology, both at the University of Delaware, and as a freelance consultant. I have an MA in education, and have been employed as an educational technology consultant for about 10 years.

My first module is a simple block module that collects, stores and displays private notes which users enter while viewing a Drupal node. The notes are visible in a textarea input, which submits via AHAH and returns a success message immediately beneath the form submit button. That way, the student can see that his notes have been updated, but is not inconvenienced by a page refresh.

The module includes two blocks. The Page Notes block stores notes that are unique to each node/user combination. The Book Notes block keys off of the current page's Book ID rather than page ID, and is used when the instructor or Drupal administrator deems it better to store notes for an entire book rather than on a per-page basis. Although it is possible to deploy both blocks simultaneously, this is not the intended use. Using existing block visibility controls, it is of course possible to display Book Notes only within book pages, and Page Notes elsewhere.

Clearly the functionality of this module overlaps with features found in other modules. Before building this module, I experimented with using Flag to mark comments as private. However, there are a few key differences between a private comment and notes stored in my module:

* notes can more easily be seen and edited while the node content is fully available for viewing, and possibly interaction (as in a content page containing a game, video, or simulation)
* notes can be updated without refreshing the page, and without installing yet another module (Ajax, Ajax Comment, etc).
* notes can bridge across pages within a book

I look forward to your feedback.

CommentFileSizeAuthor
#1 notes.tar_.gz2.65 KBAnonymous (not verified)

Comments

Anonymous’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new2.65 KB
avpaderno’s picture

Issue tags: +Module review

Thanks for applying for a CVS account. I am adding the review tags, and somebody will review the code you have attached; I am also changing the status to make clear there is code to review.

Reviewing is done from volunteers; please have patience if this can take a little more time than you would expect.

avpaderno’s picture

/**
 * Implementation of hook_form().
 *  This is the note taking form for single page notes.
 */
function notes_form($form_state) {
  $form = array();
  global $user;
  $node = node_load(arg(1));  
  $nid = $node->nid; 
  $note = db_fetch_object(db_query('SELECT * FROM {note} WHERE nid=%d AND uid=%d', $nid, $user->uid));

  // If a noteid exists, then get the existing values.
  if ($note) {
    $noteid = $note->noteid;
    $content = $note->content;
  }
  else {
    $noteid = NULL;
    $content = '';
  }

The implementation of hook_form() is used from a module that implements a node type; in that case, the modules needs to implement other hooks that the module doesn't define.
Clearly the function is not an implementation of hook_form().

  $node = node_load(arg(1));  
  $nid = $node->nid; 

If the code just needed the node ID, then it should use arg(1). Then, arg(1) contains the node ID only when the page viewed has a path like node/2; if the user is visualizing his user profile, then arg(1) doesn't contain any node ID (the same is true when the user is not watching a node).

I don't see then any relevant differences between notes_form(), and notes_book_form(); the code could be in a single function.

avpaderno’s picture

Status: Needs review » Needs work
avpaderno’s picture

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

There have not been replies in the last week. I am marking this application as won't fix.