When a ticket is being viewed, it only shows the following fields:
Organization :
Project :
Task :

I'd like to be able to see this fields, without having to click edit or viewing it on the ticket summary page:
Category:
Status:
Priority:

Comments

jorditr’s picture

Hi nektir, I've customized my stormticket_view() function with:

<?php
function stormticket_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) {
  $node = node_prepare($node, $teaser);

  $node->content['stormticket'] = array(
    '#prefix' => '<div id="stormticket">',
    '#suffix' => '</div>',
    '#weight' => -10,
  );
  $node->content['stormticket']['organization'] = array(
    '#prefix' => '<div class="organization">',
    '#suffix' => '</div>',
    '#value' => theme('storm_view_item', t('Organization') , l($node->organization_title, 'node/'. $node->organization_nid)),
    '#weight' => -8,
  );
  $node->content['stormticket']['project'] = array(
    '#prefix' => '<div class="project">',
    '#suffix' => '</div>',
    '#value' => theme('storm_view_item', t('Project'), l($node->project_title, 'node/'. $node->project_nid)),
    '#weight' => -8,
  );
  $node->content['stormticket']['task'] = array(
    '#prefix' => '<div class="task">',
    '#suffix' => '</div>',
    '#value' => theme('storm_view_item', t('Task'), l($node->task_title, 'node/'. $node->task_nid)),
    '#weight' => -7,
  );
  $node->content['stormticket']['category'] = array(
    '#prefix' => '<div class="category">',
    '#suffix' => '</div>',
    '#value' => theme('storm_view_item', t('Category'), $node->ticketcategory),
    '#weight' => -6,
  );
  $node->content['stormticket']['status'] = array(
    '#prefix' => '<div class="status">',
    '#suffix' => '</div>',
    '#value' => theme('storm_view_item', t('Status'), $node->ticketstatus),
    '#weight' => -5,
  );
  $node->content['stormticket']['priority'] = array(
    '#prefix' => '<div class="priority">',
    '#suffix' => '</div>',
    '#value' => theme('storm_view_item', t('Priority'), $node->ticketpriority),
    '#weight' => -4,
  );
  $node->content['stormticket']['content'] = array(
    '#prefix' => '<div class="content">',
    '#suffix' => '</div>',
    '#value' => theme('stormticket_view', $node, $teaser, $page),
    '#weight' => 2,
  );

  return $node;
}
?>

It's working properly on my site, with drupal 5 but I'm almost sure you can substitute it on the drupal 6 version of storm. In any case, make a backup of your module before trying that upgrade, I don't think you could loose anything or break things down, but I prefer not being responsible of any damage ;-)

KrisBulman’s picture

has anyone tried this in 6?

samuelet’s picture

In 6.x it's a little different from #1.
Add this code before the "return $node;" statement inside the theme_stormticket_view function in modules/storm/stormticket/stormticket.theme.inc file:

  $node->content['stormticket']['category'] = array(
    '#prefix' => '<div class="category">',
    '#suffix' => '</div>',
    '#value' => theme('storm_view_item', t('Category'), $node->ticketcategory),
    '#weight' => $w++,
  );
  $node->content['stormticket']['status'] = array(
    '#prefix' => '<div class="storm_status">',
    '#suffix' => '</div>',
    '#value' => theme('storm_view_item', t('Status'), $node->ticketstatus),
    '#weight' => $w++,
  );
  $node->content['stormticket']['priority'] = array(
    '#prefix' => '<div class="priority">',
    '#suffix' => '</div>',
    '#value' => theme('storm_view_item', t('Priority'), $node->ticketpriority),
    '#weight' => $w++,
  );

"storm_status" in place of "status" class because last one is used for drupal messages.

samuelet’s picture

I'm trying to use the http://drupal.org/node/173880#function-override system to avoid rewriting the modules/storm/stormticket/stormticket.theme.inc file, but it does not work. Was anyone able to?
This is my template.php overriding function:

function garland_stormticket_view($node, $teaser = FALSE, $page = FALSE) {
  $node = node_prepare($node, $teaser);

  $w = 0;
  $node->content['stormticket'] = array(
    '#prefix' => '<div id="stormticket">',
    '#suffix' => '</div>',
    '#weight' => $w++,
  );

  $node->content['stormticket']['field'] = array(
     '#type' => 'fieldset',
     '#collapsible' => true,
     '#title' => 'Dati',
     '#weight' => $w++,
  );

  $node->content['stormticket']['field']['project'] = array(
    '#prefix' => '<div class="project">',
    '#suffix' => '</div>',
    '#value' => theme('storm_view_item', storm_t('Project', 'ticket'), l($node->project_title, 'node/'. $node->project_nid)),
    '#weight' => $w++,
  );
  if (!empty($node->task_nid)) {
    $node->content['stormticket']['field']['task'] = array(
      '#prefix' => '<div class="task">',
      '#suffix' => '</div>',
      '#value' => theme('storm_view_item', storm_t('Task', 'ticket'), l($node->task_title, 'node/'. $node->task_nid)),
      '#weight' => $w++,
    );
  }
  $node->content['stormticket']['field']['category'] = array(
    '#prefix' => '<div class="category">',
    '#suffix' => '</div>',
    '#value' => theme('storm_view_item', t('Category'), storm_icon('category_'. $node->ticketcategory, $node->ticketcategory)),
    '#weight' => $w++,
  );
  $node->content['stormticket']['field']['status'] = array(
    '#prefix' => '<div class="storm_status">',
    '#suffix' => '</div>',
    '#value' => theme('storm_view_item', t('Status'), storm_icon('status_'. $node->ticketstatus, $node->ticketstatus)),
    '#weight' => $w++,
  );
  $node->content['stormticket']['field']['priority'] = array(
    '#prefix' => '<div class="priority">',
    '#suffix' => '</div>',
    '#value' => theme('storm_view_item', t('Priority'), storm_icon('priority_'. $node->ticketpriority, $node->ticketpriority)),
    '#weight' => $w++,
  );
  return $node;
}
samuelet’s picture

I was wrong, overriding theme works. I needed only to purge drupal cache after template.php modification.

jorditr’s picture

:-)

hillaryneaf’s picture

Thank you samuelet this is a great alternative until it is added to the module!

samuelet’s picture

Glad that it was useful.
As bonus info, i post the theme overriding for showing, in the ticket overview page, a CCK field associated to the ticket.
In my example, i use the "Open by" field to track who opens the ticket (and optionally send him a mail with workflow).
Change the "garland" with your own theme, and "field_open_by" with the your CCk name (it's displayed in "type content"->ticket->"manage fields").
It works on 6.x, don't know 5.x

/**
 *
 * Theme the stormticket list overview.
 */
function garland_stormticket_list($header, $tickets) {
  $rows = array();
  $header[]="Open By";
  foreach ($tickets as $ticket) {
    //Load node properties
    $node=node_load($ticket->nid);
    $n = new stdClass();
    $n->nid = $ticket->nid;
    $n->uid = $ticket->uid;
    $n->organization_nid = $ticket->organization_nid;
    $n->type = 'stormticket';

    $rows[] = array(
      storm_icon('category_'. $ticket->ticketcategory, $ticket->ticketcategory),
      l($ticket->organization_title, 'node/'. $ticket->organization_nid),
      l($ticket->project_title, 'node/'. $ticket->project_nid),
      l($ticket->title, 'node/'. $ticket->nid) . theme('mark', node_mark($ticket->nid, $ticket->changed)),
      format_date($ticket->created, 'small'),
      storm_icon('status_'. $ticket->ticketstatus, $ticket->ticketstatus),
      storm_icon('priority_'. $ticket->ticketpriority, $ticket->ticketpriority),
      array(
        'data' => storm_icon_edit_node($n, $_GET) .'&nbsp;'. storm_icon_delete_node($n, $_GET),
        'class' => 'storm_list_operations',
      ),
      //The CCK field
      $node->field_open_by[0]['value'],
    );
  }
  $o = theme('table', $header, $rows);
  return $o;
}
KrisBulman’s picture

roberto, can this be added to dev?

Magnity’s picture

Version: 6.x-1.17 » 6.x-1.x-dev

It definitely makes sense to me to show more information on the view ticket page. I will look at implementing this.

However I wonder whether anyone uses the fact that these aren't displayed as a pseudo field permissions filter? IE those people who have permission to edit can see these additional fields - others can't. For that reason, i'd add category, status and priority but would leave out pricing information which could more private, just as this issue suggests.

Magnity’s picture

Component: User interface » Storm Ticket
Status: Active » Fixed

Committed. Will roll into -dev at midnight and 1.23 when released.

http://drupal.org/cvs?commit=216438

Status: Fixed » Closed (fixed)

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