arvin
Sr. Member
  
Karma: 10
Posts: 400
Yeah thats right !
|
 |
« on: April 08, 2008, 03:16:49 PM » |
|
Just wondering ....
is there a way....to indicate that a customer has attached a file in the ticket browser page .... I guess have its own column and paper clip gif or something .... I sure there is a way to do this .... but how much time and code is required .....
also ... can I restict the file types accepted? to only *.doc,*.xls, *.pdf
Thank you in advance
|
|
|
|
« Last Edit: April 08, 2008, 03:19:11 PM by sparky672 »
|
Logged
|
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 83
Posts: 2,228
stop pushing all those buttons
|
 |
« Reply #1 on: April 08, 2008, 03:28:40 PM » |
|
This is an excellent idea and should be very do-able. Roughly: You'd need the Layout Designer module. From within Setup, specify a new field for the paperclip and also make it a column in the ticket list. Then create a hidden field for the paperclip in the newticket.html template. Then creatively using some Javascript, upon form submission, look to see if there is a document attached and then set the paperclip value to one of two things.... full HTML of a blank image or a paperclip. I foresee plenty of kinks, otherwise... Easy. "... can I restict the file types accepted? to only *.doc,*.xls, *.pdf"Normally, that's something you should be able to do with any file attachment program. I don't have the module so I can't say how or where you'd specify that.
|
|
|
|
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 83
Posts: 2,228
stop pushing all those buttons
|
 |
« Reply #2 on: April 08, 2008, 04:20:10 PM » |
|
You could probably do some Javascript "form validation".
Basically, it interrupts the submission of the form to check the form entries. If the entries pass validation, then the form submits normally. Otherwise an error message.
Since TTX does form validation (required fields) in the PERL, you don't need that part.
But you could modify a Javascript to validate just the file attachment field. If you see a file extension that doesn't meet your criteria, then fail the validation with an error message.
|
|
|
|
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
arvin
Sr. Member
  
Karma: 10
Posts: 400
Yeah thats right !
|
 |
« Reply #3 on: April 08, 2008, 04:48:58 PM » |
|
Awesome .... This is a project for tomorrow  I will keep you posted .... Thank you for you suggestions ...they come in very handy
|
|
|
|
|
Logged
|
|
|
|
arvin
Sr. Member
  
Karma: 10
Posts: 400
Yeah thats right !
|
 |
« Reply #4 on: April 28, 2008, 01:04:17 PM » |
|
Hello,
How or where can I specify the file types allowed to be uploaded via the File Attachment MOD.
I want only .doc, .xls, .pdf allowed
sorry if this question has already been asked ..and Thank you in adv
Arv
|
|
|
|
« Last Edit: April 28, 2008, 01:11:31 PM by sparky672 »
|
Logged
|
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 83
Posts: 2,228
stop pushing all those buttons
|
 |
« Reply #5 on: April 28, 2008, 01:11:09 PM » |
|
It was asked recently.
I don't think you can without modification to the module.
However I mentioned a Javascript solution involving a form validation routine.
TTX already does form validation. It looks at which fields are required and prevents submission while giving you an error. This is done on the CGI/server level.
My suggestion was to find and install a free Javascript form validation script. This would prevent submission of the form and come into play before anything else. Instead of having it look at blank fields, you'd have it validate your file types.
|
|
|
|
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
|
|
arvin
Sr. Member
  
Karma: 10
Posts: 400
Yeah thats right !
|
 |
« Reply #7 on: April 28, 2008, 01:33:06 PM » |
|
LMAO ....OOPS !
Thank you Sparky!
|
|
|
|
|
Logged
|
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 83
Posts: 2,228
stop pushing all those buttons
|
 |
« Reply #8 on: April 28, 2008, 10:35:46 PM » |
|
Not sure how good you are at Perl but this is a start. I've successfully filtered the file upload to only PDF type. When you select any other type, the upload is just ignored and nothing is uploaded. It's very crude (case-sensitive and no error messages) but it's a simple start and we can spruce it up later. For existing tickets... In TTXTicket.pm in the ticket subroutine... The red is new... my $attachment; if (TTXData::get('ISPRO')) { for (my $i = 1; $i < 4; ++$i) { next if $query->param("f$i") eq undef; if ($query->param("fname$i") =~ /.pdf/) { $attachment .= TTXFile::addfile($query, "f$i", "fname$i", $t->{id}); } } } The newticket subroutine would have similar code... if (TTXData::get('ISPRO')) { for (my $i = 1; $i < 4; ++$i) { next if $query->param("f$i") eq undef; if ($query->param("fname$i") =~ /.pdf/) { $messages[0] .= TTXFile::addfile($query, "f$i", "fname$i", $ticket->{id}); } } }
|
|
|
|
« Last Edit: April 28, 2008, 10:39:12 PM by sparky672 »
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
arvin
Sr. Member
  
Karma: 10
Posts: 400
Yeah thats right !
|
 |
« Reply #9 on: April 29, 2008, 10:55:47 AM » |
|
Good Morning Sparky!
Still learning perl ...but i understand enough of it to get by LOL ....
okay ... so ..is it safe to assume that......if I take this
if ($query->param("fname$i") =~ /.pdf/) {
and change it to
if ($query->param("fname$i") =~ /.pdf/.doc/.xls) {
I should be safe .....
Thank you in advance
|
|
|
|
|
Logged
|
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 83
Posts: 2,228
stop pushing all those buttons
|
 |
« Reply #10 on: April 29, 2008, 11:11:48 AM » |
|
if ($query->param("fname$i") =~ /.pdf|.PDF|.doc|.DOC|.xls|.XLS/) { I think there's a way with Perl to ignore the case-sensitivity but I don't have the time today to clean that up. You could try this... if ($query->param("fname$i") =~ /.pdf|.doc|.xls/i) {
|
|
|
|
« Last Edit: April 29, 2008, 11:18:00 AM by sparky672 »
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
|
|
arvin
Sr. Member
  
Karma: 10
Posts: 400
Yeah thats right !
|
 |
« Reply #12 on: May 12, 2008, 03:58:51 PM » |
|
LOL .... Sorry Sparky ... I was on another vacation  .... felt so good ! I'm back now ...and will start working on this
|
|
|
|
|
Logged
|
|
|
|
ihiebert
Newbie
Karma: 0
Posts: 12
|
 |
« Reply #13 on: March 31, 2010, 12:01:12 PM » |
|
I'm looking for the same thing, restrict attachments to .doc, .xls &.pdf's
Did anyone come up with a working mod ?
|
|
|
|
|
Logged
|
|
|
|
Sparky
Moderator
Hero Member
   
Karma: 83
Posts: 2,228
stop pushing all those buttons
|
 |
« Reply #14 on: March 31, 2010, 12:08:14 PM » |
|
I think it's working as-is. Try it.
|
|
|
|
|
Logged
|
Did you update the paths in ttxcfg.cgi after moving TTX to your new location? To those seeking help.... please report back when you figure it out. 
|
|
|
|