summaryrefslogtreecommitdiff
path: root/fs_selfservice/FS-SelfService/cgi/ticket_summary.html
blob: c840ca9d6789ece7986ba17fa67ca7677f3f3eba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<SCRIPT TYPE="text/javascript" SRC="overlibmws.js"></SCRIPT>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">
<TR><TH BGCOLOR="#ff6666" COLSPAN=15>Open Tickets</TH></TR>
<TR>
<%=
my $col1 = "ffffff";
my $col2 = "dddddd";
my $col = $col1;

my $can_set_priority = 
  grep { exists($_->{'_selfservice_priority'}) } @tickets;
if ( $can_set_priority ) {

  $OUT .= qq!<FORM ACTION="$selfurl" METHOD="POST">! .
          qq!<INPUT TYPE="hidden" NAME="session" VALUE="$session_id">! .
          qq!<INPUT TYPE="hidden" NAME="action" VALUE="ticket_priority">!;
}
$date_format ||= '%Y-%m-%d';
my $date_formatter = sub {
  my $time = Date::Parse::str2time($_[0], 'GMT'); # RT internal dates are GMT
  # exclude times within 24 hours of zero
  ($time > 86400) ? Date::Format::time2str($date_format, $time) : ''
};

my @titles = ('#', qw(Subject Queue Status Created Due));
push @titles, 'Estimated<BR>Hours';
push @titles, 'Priority';

$OUT .= join("\n", map { "<TH VALIGN=\"top\">$_</TH><TH>&nbsp;</TH>" } @titles)
      . '</TR>';

foreach my $ticket ( @tickets ) {
  my $id = $ticket->{'id'};
  my $td = qq!<TD BGCOLOR="#$col">!;
  my $space = $td.'&nbsp;</TD>';
  my $link = qq!<A HREF="${url}tktview;ticket_id=$id">!;
  $OUT .= '<TR>' . 
$td. $link . $id . '</A></TD>'. $space .
$td. $link . $ticket->{'subject'} . '</A></TD>'. $space .
$td. $ticket->{'queue'} . '</TD>'. $space .
$td. $ticket->{'status'} . '</TD>'. $space .
$td. $date_formatter->($ticket->{'created'}) . '</TD>'. $space .
$td. $date_formatter->($ticket->{'due'}) . '</TD>'. $space .
qq!<TD BGCOLOR="#$col" ALIGN="right">!. 
  ($ticket->{'timeestimated'} ? 
    sprintf('%.1f', $ticket->{'timeestimated'} / 60.0) # .1f?
  : ''
  ) .  '</TD>'. $space .
qq!<TD BGCOLOR="#$col" ALIGN="right">!;
  if ( $can_set_priority ) {
    $OUT .= '<INPUT TYPE="hidden" NAME="ticket'.$id.'" VALUE="1">' .
            '<INPUT TYPE="text" SIZE=4 NAME="priority'.$id.'"' .
            'VALUE="'.$ticket->{'_selfservice_priority'}.'"></TD>';
    if ( exists($ticket_error{$id}) ) {
      # display error message compactly
      $OUT .= '<TD><FONT COLOR="#ff0000" onmouseover="'.
              "return overlib('".$ticket_error{$id}."', AUTOSTATUS, WRAP);" .
              '" onmouseout="nd();">*</FONT></TD>';
    }
  }
  else {
    $OUT .= ($ticket->{'content'} || $ticket->{'priority'}) . '</TD>';
  }
  $OUT .= '</TR>';
  $col = $col eq $col1 ? $col2 : $col1;
} #foreach my $ticket
if ( $can_set_priority ) {
  $OUT .= '<TR><TD COLSPAN=15 ALIGN="right">
<INPUT TYPE="submit" VALUE="Save changes"></TD></TR></FORM>';
}
%>
</TABLE>