dotProject Recipe: Add journal entries from the project view page

NOTE (07-02-08): The modified Journal module has now been updated to work with v. 2.x of dotProject.

J. Christopher Pereira created a journal module which is quite handy: it lets you add notes to projects – any type of note, without creating a task.

The module is very useful, but a coworker requested that we modify it so you could add a journal note without ever leaving the project view page. Instead of a new window opening to enter the journal note, you simply enter the note into a text box that is always visible on the project view page.

You just enter text in the new text field, hit “save”…

..and it shows up at the top of the list.

To give you an idea of how I work when customizing dotproject, since my knowledge of php is limited, I look for similar functionality to what I want somewhere else in the application, then copy the code to where I want it to appear. That usually creates errors, but with debugging on, the errors give you clues to what is missing, often database queries or url parameters. I fix them one by one – laborious but it works!

The revised journal module files are available below. The files which were modified are modules/journal/index.php, modules/journal/addedit.php and modules/projects/view.php.

modified_journal2.x.zip

  1. In “modules/projects/view.php”:
    Right after the line:
    
    $tabBox = new CTabBox( "?m=projects&a=view&project_id=$project_id", "", $tab );
    
    Add this line: 
    
    $tabBox->add( DP_BASE_DIR.'/modules/journal/index', 'Journal' );
    
    

    or, to avoid modifying the core code, use the new framework mechanism in 2.x. Create a new file in the modules/journal folder named projects_tab.view.journal.php with the following content:

    <?php
    if (!defined('DP_BASE_DIR')){
    die('You should not access this file directly');
    }
    include (DP_BASE_DIR . '/modules/journal/index.php') ;
    ?&rt;
    

    (thanks to Barry A. for this tip)

  2. Unzip the journal folder from the zip archive and upload the “journal” folder into the /modules/ folder. Activate the Journal module.

To see the new functionality, from the Projects list, click on any project title. On the page that appears, you should now see the journal text entry box on the first tab. I set this tab as the default to lower the barriers to recording notes as much as possible. I’m also thinking of adding a popup version of this right on the projects list page.