views:

830

answers:

6

We're using the Mantis bugtracker (version 1.1.8), which is based on PHP. To ease the workflow of adding bugs we'd like to add an option to paste screenshots from the clipboard directly into the 'new bug form'.

Screenshots make bugreports much more valuable for developers, so I'd like to make adding them as easy as possible. Preferably without using an external application, but right in the browser.

I've looked all over for a way to add this, but no luck. How do other people do this? Am I missing something obvious?

edit: The bugtracker is a private one, in a small company, so I'd be willing to accept the security risks that for example Java applets present.

+3  A: 

There isn't really a way to do this short of using ActiveX, applet or Flash-type technology on the client. Even then, there are numerous security roadblocks. A browser has no easy way to convert stuff from the clipboard into a suitable format for upload to a website, and even if it did there would be security concerns. For example, malicious code in a page could copy sensitive information from your clipboard and send it to the page's site without you even knowing it was happening.

Update: There is a standalone screen capture utility which claims to work with Mantis (and a whole bunch of other bug-trackers). This is probably your best option.

Vinay Sajip
Since the bugtracker is a private one, in a small (15 people) company, so I'd be willing to accept the security risks. That probably explains the lack of readily available plugins though. :-) Any thought on a Java or Flash solution?
Martijn Heemels
I've used the "standalone screen capture utility" referenced above, "Bug Shooting". It's great. I've authored a bug tracker, (BugTracker.NET) and wrote my own screen capture utility for it, but I've abandoned what I wrote and use "Bug Shooting" instead.
Corey Trager
Thanks for the suggestion Vinay. I was aware of the standalone utility, but would prefer to use something browserbased.
Martijn Heemels
A: 

I looked in to this also. No real easy way, so instead I allowed them to upload an unlimited number of files and those files would then be "attached" to that bug. It actually turned out to be better because they can upload screenshot, spreadsheets, word docs, etc.

Like yours, this is an internal only site so security is light. I did this in ASP.Net, but the general idea is that when they are looking at a page for a bug they have an upload box. When they upload something I pre-append it with the bug id. So ScreenShot.jpg becomes 233_ScreenShot.jpg.

Also on that page is a grid (GridView) that is bound to all of the filenames in my upload directory that start with that bug id.

To see what this looks like click here.

JBrooks
Thanks, but Mantis already supports attaching files to a bugreport. The question is about uploading directly from clipboard, without the intermediate file normally needed.
Martijn Heemels
Yes, I don't think this is an easy thing especially if you want it to work with all browsers. I looked into how FogBugz does it and from what I can tell - they have a Windows program running on your PC (and it shows up in the tray), and when you invoke it it allows you to play with the image and then when you submit it it sends the image to the server using a web service. This can be done, but its not a trivial task and not sure if you like the idea of your users allowing a program to be installed, etc.
JBrooks
+1  A: 
Robert Munteanu
That's a nice feature. I was already about to try Mylyn soon since it seems like a great system. However, most bugs are entered by our testers and managers. I can't expect them to use Eclipse.
Martijn Heemels
_Maybe_ you can introduce this 'bug tracking client' to them - standalone Eclipse, trimmed down ( no Java, no CVS etc ) + Mylyn + Connector.
Robert Munteanu
Some developer colleagues and I have started using Mylyn, and we love it. I believe its screenshot util is far from ideal for non-developers, because it relies on Eclipse, but it works very well for the developers.
Martijn Heemels
+2  A: 

There is a drag n drop image attacher Java applet for Atlassian Confluence which has the functionality you need. It only supports Confluence but as the sourcecode is freely available under BSD you should be able to customize it to your needs.

Forgot the link: http://confluence.atlassian.com/display/CONFEXT/Drag+and+Drop+Image+Attacher+Plugin

OliverS
+1  A: 

I've managed to build my own solution that works quite well. It places a Java file upload applet on the pages where you'd want to attach a screenshot. The applet has two buttons:

  1. 'paste screenshot', which pastes an image from the clipboard into the applet
  2. 'upload screenshot', which uploads the pasted image to the /tmp dir on the Mantis server and uses a javascript callback to place the autogenerated filename of the uploaded image into a form field.

Once the form is submitted, a new function in Mantis uses the filename in the form field to move the image from /tmp to the final location and processes the image just like other attachments. If the form is never submitted the uploaded file remains in /tmp and will eventually be purged by the server.

It works well, but has one drawback that I cannot avoid: I'm using Java to get access to the client's clipboard, but that requires breaking the JVM sandbox. Apparently, this can be done if you digitally sign the applet, which requires a rather expensive yearly payment (something like $500) to a company like Verisign (currently free options like cacert.org are still limited in their usefulness).

Another way to allow Java applets access to the clipboard is to create a file called .java.policy in your home or profile directory. This file should contain the following (Replace the domain with the domain that hosts your Java applet):

grant codeBase "http://bugs.example.com/-" {
  permission java.awt.AWTPermission "accessClipboard";
};

Thankfully the solution is cross-browser compatible since the JVM always checks the same file regardless of the browser used. Since my solution requires having this .java.policy file on each client computer I don't consider it ideal, but workable in a controlled company environment.

Martijn Heemels
A: 

I worked with Mercury Quality center before, and I know for a fact that it has the ability to use it's own built-in screenshot utlity, then it includes it into the defect. I think it might be called HP Quality Center now, or even HP Test Director.

Duane Nason

related questions