Help Desk Software & Beyond
May 21, 2012, 10:24:37 PM *
Welcome, Guest. Please login or register.
To post messages you need to register. We apologize for inconvenience, but this is to prevent spam.
Registration is instant (no email verification) and we do not ask for any personal information.

Login with username, password and session length
News: Welcome to Help Desk Software forum!
 
   Home   Help Search Login Register  
Pages: [1] 2
  Print  
Author Topic: [REQ] Modify ticket! (how it displays)  (Read 3767 times)
mikedomain
Newbie
*

Karma: 0
Posts: 8


View Profile
« on: April 17, 2007, 08:01:01 AM »

Anyone knows how to modify the ticket-history?
I want to add a line between each response in the tickets, think it would be a lot
easier to read the story.

Is there any way to show the responses in HTML in the textareas?
« Last Edit: January 16, 2008, 08:39:55 PM by sparky672 » Logged
Alex
Administrator
Hero Member
*****

Karma: 22
Posts: 605



View Profile WWW
« Reply #1 on: April 17, 2007, 08:13:48 AM »

You will need to modify TTXTicket.pm. For your reference here goes the code (it may be slightly different, as this is a development version) that generates message list.

Code:
  foreach my $msg (@{$t->{messages}}) {
    my @msgparts = split(/\n\n/, $msg);
    my $rawheader = shift @msgparts;
    my $body = join("\n\n", @msgparts);
    my @headerlines = split(/\n/, $rawheader);
    chomp @headerlines;
    my %header;
    foreach my $line (@headerlines) {
      if ($line =~ /^([a-zA-Z][a-zA-Z0-9-]*):\s*(.*)$/) {
        $header{uc $1} = $2;
      }
    }
    next if $header{OPERATOR} && $header{INTERNAL} =~ /Yes/ && !$isoper;
    my $style;
    if ($header{OPERATOR}) {
      if ($header{INTERNAL} =~ /Yes/) {
        $style = 'imsg';
      } else {
        $style = 'omsg'
      }
    } else {
      $style = 'cmsg';
    }
    my $imgtag;
    my $fromtag;
    if ($header{OPERATOR}) {
      if (!exists $images{$header{FROM}}) {
        my $u = TTXUser->new($header{FROM});
        if ($u eq undef) {
          $images{$header{FROM}} = undef;
          $names{$header{FROM}} = undef;
        } else {
          $images{$header{FROM}} = $u->{image};
          $names{$header{FROM}} = $u->{fname}.' '.$u->{lname};
        }
      }
      if ($images{$header{FROM}} ne undef) {
        $imgtag = "<br><br class=sm><center><nobr>&nbsp;<img src=\"$images{$header{FROM}}\">&nbsp;</nobr></center><br class=sm>\n";
      }
      $fromtag = $names{$header{FROM}};
      if ($isoper) { $fromtag .= " ($header{FROM})"; }
    }
    $fromtag = $header{FROM} if $fromtag eq undef;
    $fromtag =~ s/</&lt;/g;
    if ($isoper) {
      if ($header{IP} ne undef) {
        $fromtag .= "<br>[$header{IP}]";
      }
    }
    if ($editlink ne undef) {
      $editlink = "<br>".TTXMsgEdit::link($cfg, $t, $mid);
      ++$mid;
    }
    $data->{MESSAGES} .= "<tr>\n<td width=20% align=left valign=top class=$style>$fromtag<br>".TTXCommon::tmtxt($header{DATE})."$editlink$imgtag</td>\n";
    $body =~ s/</&lt;/g;
    $body = TTXMarkup::html($body);
    $body =~ s/\n/<br>\n/g;
    my $firstfile = 1;
    for (my $i=1; $i < 4; ++$i) {
      if ($header{"FILE$i"} ne undef) {
        if ($firstfile) {
          $body .= '<br class=sm><br class=sm>[%Attachments%]:<br>'."\n";
          $firstfile = 0;
        }
        $header{"FILE$i"} =~ s/CGIURL/$ENV{SCRIPT_NAME}/;
        $body .= $header{"FILE$i"} . "<br>\n";
      }
    }
    $data->{MESSAGES} .= "<td align=left valign=top class=$style>$body</td>\n</tr>\n";
  }
Logged

Follow me on: LinkedIn
mikedomain
Newbie
*

Karma: 0
Posts: 8


View Profile
« Reply #2 on: April 17, 2007, 09:12:57 AM »

Can you please show me where i should add the line Smiley

And the question about showing HTML in the replys, did you have some answer on that?
Logged
mikedomain
Newbie
*

Karma: 0
Posts: 8


View Profile
« Reply #3 on: April 17, 2007, 05:48:06 PM »

I found it.....thanx!

Another Question: i purchased the AnswerLib, and noticed that when im logged in and will create a new ticket for some customer, i aint got access to the AnswerLib. I need that, how can i do?
The "Intern"-checkbox is visible when im logged in and want to create a new ticket.......want the same for AnswerLib.
Logged
Alex
Administrator
Hero Member
*****

Karma: 22
Posts: 605



View Profile WWW
« Reply #4 on: April 18, 2007, 12:17:40 AM »

I do not see an easy solution for this, as multiple files must be modified. As a workaround you may create a custom contact form having permanent link (do not forget copy JavaScript code for pop-up window as well) to the Answer Library on it.
Logged

Follow me on: LinkedIn
mikedomain
Newbie
*

Karma: 0
Posts: 8


View Profile
« Reply #5 on: April 18, 2007, 06:20:13 AM »

Hmm, yes that can be an option.....
But the absolute best solution would be to integrate it on the newticket-page. So you MUST be logged in to use it.

What is it that tells if to show the "intern"-checkbox......it must be som script that checks if you are logged in. Cant that be done to the AnswerLib as well?
Do you use sessions to check it or what?
Logged
Alex
Administrator
Hero Member
*****

Karma: 22
Posts: 605



View Profile WWW
« Reply #6 on: April 18, 2007, 06:25:38 AM »

TTXTicket.pm, function newticket():

Code:
  if ($cfg->get('_USER') ne undef) {
    if (isrestricted($cfg)) {
      $data->{INTERNALCHECKBOX} = '<input type=hidden name=internal value=1>';
    } else {
      $data->{INTERNALCHECKBOX} = '<input type=checkbox name=internal value=1' .
         ($query->param('internal') ? ' checked':''). '> <span class=lbl>[%Internal%]</span>';
    }
  } else {
    $data->{INTERNALCHECKBOX} = '&nbsp;';
  }
Logged

Follow me on: LinkedIn
mikedomain
Newbie
*

Karma: 0
Posts: 8


View Profile
« Reply #7 on: April 18, 2007, 07:17:37 AM »

Isn it possible to do something like that for the AnswerLib?

Make this code(modified) i TTXTicket.pm and insert the (%AnswerLib%) including the javascript in newticket.html?
Logged
mikedomain
Newbie
*

Karma: 0
Posts: 8


View Profile
« Reply #8 on: April 18, 2007, 12:23:48 PM »

Fixed......lovely program  Smiley
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #9 on: August 23, 2007, 05:49:35 PM »

I was wondering if somebody could explain what "modify ticket history" means.

At first I thought it was a request to be able to edit the actual contents/replies already posted in a ticket.

I tried to insert the experimental code as listed here but then my ticket screen failed to load so I had to remove it.  I'm running TTX version 2.21.96

Thank-you for any clarification!
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
Magnus Wester
Full Member
***

Karma: 2
Posts: 116



View Profile WWW
« Reply #10 on: August 24, 2007, 01:16:10 PM »

I guess they mean "the communication that took place in the process of handling the ticket", i.e. the different messages in the ticket.
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #11 on: August 24, 2007, 05:31:39 PM »

I guess they mean "the communication that took place in the process of handling the ticket", i.e. the different messages in the ticket.

If that's the case, I wish I knew what I did wrong when I inserted that developmental code.  He didn't say where to put it in the file so I just inserted it between a couple subroutines.

Not sure if I was supposed to do something else.  It would be nice to play around with such a feature.
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
Magnus Wester
Full Member
***

Karma: 2
Posts: 116



View Profile WWW
« Reply #12 on: August 26, 2007, 11:49:44 AM »

He didn't say where to put it in the file so I just inserted it between a couple subroutines.

Oh, I believe he did. Read the post again and you will see the pointer to the actual module and function. Look for code similar to the code Alex is providing, and modify it according to the example.
Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #13 on: August 26, 2007, 12:11:42 PM »

He didn't say where to put it in the file so I just inserted it between a couple subroutines.

Oh, I believe he did. Read the post again and you will see the pointer to the actual module and function. Look for code similar to the code Alex is providing, and modify it according to the example.

Ok, I saw the pointer to the module... however I did not see mention of it specifically replacing anything.  I also was not sure if the second modification was related to the first because the original poster was trying to get two totally different questions answered at the same time.

My mistake for not studying it closer and assuming it all just gets added...  I'll give it another shot.

Thank-you for the tip!
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #14 on: August 27, 2007, 01:18:56 AM »

I found the similar section in TTXTicket.pm and replaced with the new code mentioned here.

Fatal Error: Unable to load module TTXTicket

The code still does not work so I compared the original with the new and found this section of code as the only difference.

Code:
if ($isoper) {
      if ($header{IP} ne undef) {
        $fromtag .= "<br>[$header{IP}]";
      }
    }
    if ($editlink ne undef) {
      $editlink = "<br>".TTXMsgEdit::link($cfg, $t, $mid);
      ++$mid;
    }
    $data->{MESSAGES} .= "<tr>\n<td width=20% align=left valign=top class=$style>$fromtag<br>".TTXCommon::tmtxt($header{DATE})."$editlink$imgtag</td>\n";

Looking at the 7th line...

Code:
$editlink = "<br>".TTXMsgEdit::link($cfg, $t, $mid);

A module named TTXMsgEdit is called.  I don't have such a module in 2.21.96 so I downloaded the latest, version 2.22 of TTX... still no module called TTXMsgEdit.

What could I be doing wrong?
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC3 | SMF © 2001-2006, Lewis Media Valid XHTML 1.0! Valid CSS!
Page created in 0.035 seconds with 19 queries.