diff --git a/pmnote/pmnote.install b/pmnote/pmnote.install index e085bc3..ae22cd4 100644 --- a/pmnote/pmnote.install +++ b/pmnote/pmnote.install @@ -1,6 +1,7 @@ '. t("Provides note support for Project Management") .'

'; + $o = '

' . t("Provides note support for Project Management") . '

'; break; } return $o; } +/** + * Implements hook_permission(). + */ function pmnote_permission() { return array( 'Project Management note: access' => array( @@ -84,6 +90,9 @@ function pmnote_theme() { ); } +/** + * Implements hook_node_info(). + */ function pmnote_node_info() { return array( 'pmnote' => array( @@ -94,6 +103,9 @@ function pmnote_node_info() { ); } +/** + * Implements hook_field_extra_fields(). + */ function pmnote_field_extra_fields() { $extra['node']['pmnote'] = array( 'form' => array( @@ -323,14 +335,23 @@ function pmnote_form(&$node, $form_state) { return $form; } +/** + * Ajax callback for the PM Note Organization Nid field. + */ function pmnote_ajax_organization_nid(&$form, &$form_state) { return $form['group1']['project_nid']; } +/** + * Ajax callback for the PM Note Project Nid field. + */ function pmnote_ajax_project_nid(&$form, &$form_state) { return $form['group1']['task_nid']; } +/** + * Implements hook_insert(). + */ function pmnote_insert($node) { _pmnote_beforesave($node); @@ -348,6 +369,9 @@ function pmnote_insert($node) { ->execute(); } +/** + * Implements hook_update(). + */ function pmnote_update($node) { _pmnote_beforesave($node); @@ -369,6 +393,9 @@ function pmnote_update($node) { } } +/** + * Pre-processing for the PM Note content type (before save). + */ function _pmnote_beforesave(&$node) { $org_result = db_select('node', 'n') ->fields('n', array('title')) @@ -395,6 +422,9 @@ function _pmnote_beforesave(&$node) { $node->task_title = isset($task->title) ? $task->title : ''; } +/** + * Implements hook_nodeapi(). + */ function pmnote_nodeapi(&$node, $op, $teaser, $page) { switch ($op) { case 'delete revision': @@ -406,12 +436,18 @@ function pmnote_nodeapi(&$node, $op, $teaser, $page) { } } +/** + * Implements hook_delete(). + */ function pmnote_delete($node) { db_delete('pmnote') ->condition('nid', $node->nid) ->execute(); } +/** + * Implements hook_load(). + */ function pmnote_load($nodes) { foreach ($nodes as $nid => &$node) { $result = db_select('pmnote', 'sno') @@ -428,6 +464,9 @@ function pmnote_load($nodes) { } } +/** + * Implements hook_view(). + */ function pmnote_view($node, $view_mode = 'full') { if ($view_mode = 'full') { $breadcrumb = array(); @@ -439,6 +478,9 @@ function pmnote_view($node, $view_mode = 'full') { return theme('pmnote_view', array('node' => $node, 'view_mode' => $view_mode)); } +/** + * Implements hook_views_api(). + */ function pmnote_views_api() { return array( 'api' => 2, diff --git a/pmnote/pmnote.test b/pmnote/pmnote.test index 066376b..5407f9e 100644 --- a/pmnote/pmnote.test +++ b/pmnote/pmnote.test @@ -1,10 +1,17 @@ t('Project Management Note Functionality'), @@ -13,10 +20,16 @@ class pmnoteTestCase extends DrupalWebTestCase { ); } + /** + * Set up of test environment. + */ public function setUp() { parent::setUp('views', 'pm', 'pmorganization', 'pmproject', 'pmtask', 'pmnote'); } + /** + * Access test case. + */ public function testpmnoteAccess() { $this->drupalGet('pm/notes'); $this->assertResponse(403, t('Make sure access is denied to Project Management Notes list for anonymous user')); @@ -32,6 +45,9 @@ class pmnoteTestCase extends DrupalWebTestCase { $this->assertText(t('Notes'), t('Make sure the correct page has been displayed by checking that the title is "Notes".')); } + /** + * Node creation test case. + */ public function testpmnoteCreate() { // Create and login user $user = $this->drupalCreateUser(array('Project Management Organization: add', 'Project Management Organization: view all', 'Project Management Project: add', 'Project Management Project: view all', 'Project Management Task: add', 'Project Management Task: view all', 'Project Management Note: add', 'Project Management Note: view all')); diff --git a/pmnote/pmnote.theme.inc b/pmnote/pmnote.theme.inc index b87c2d2..1668121 100644 --- a/pmnote/pmnote.theme.inc +++ b/pmnote/pmnote.theme.inc @@ -1,7 +1,11 @@ content['group1']['organization'] = array( '#prefix' => '
', '#suffix' => '
', - '#value' => theme('pm_view_item', array('label' => t('Organization'), 'value' => l($node->organization_title, 'node/'. $node->organization_nid))), + '#value' => theme('pm_view_item', array('label' => t('Organization'), 'value' => l($node->organization_title, 'node/' . $node->organization_nid))), '#weight' => 1, ); $node->content['group1']['project'] = array( '#prefix' => '
', '#suffix' => '
', - '#value' => theme('pm_view_item', array('label' => t('Project'), 'value' => l($node->project_title, 'node/'. $node->project_nid))), + '#value' => theme('pm_view_item', array('label' => t('Project'), 'value' => l($node->project_title, 'node/' . $node->project_nid))), '#weight' => 2, ); $node->content['group1']['task'] = array( '#prefix' => '
', '#suffix' => '
', - '#value' => theme('pm_view_item', array('label' => t('Task'), 'value' => l($node->task_title, 'node/'. $node->task_nid))), + '#value' => theme('pm_view_item', array('label' => t('Task'), 'value' => l($node->task_title, 'node/' . $node->task_nid))), '#weight' => 3, ); diff --git a/pmnote/pmnote.views.inc b/pmnote/pmnote.views.inc index 5db0a29..3fdba65 100644 --- a/pmnote/pmnote.views.inc +++ b/pmnote/pmnote.views.inc @@ -1,7 +1,11 @@ array( diff --git a/pmnote/pmnote.views_default.inc b/pmnote/pmnote.views_default.inc index 88d0dda..3b9dc06 100644 --- a/pmnote/pmnote.views_default.inc +++ b/pmnote/pmnote.views_default.inc @@ -1,4 +1,12 @@ description = ''; $view->tag = 'pm'; $view->base_table = 'node'; - $view->human_name = 'Project Management Note List'; + $view->human_name = 'PM Note list'; $view->core = 7; $view->api_version = '3.0'; $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */