Tags:
archive_me1Add my vote for this tag attachments1Add my vote for this tag images1Add my vote for this tag create new tag
, view all tags

JavaPaste - to allow pasting of pictures and files.

This Java Applet was written by Catherine, a friend of mine at a firm where I used to work...

Overview

TWiki:Codev.JavaPaste is a Java applet. It provides the abiliy to paste pictures from the clipboard straight onto a Wiki page. You can also attach one or more files the same way.

The work is not yet finished but I think we have done all the hard parts.

It would be relatively straight forward to make it possible to add drag and drop to this.

It requires a Java Virtual Machine on the client and the applet must be signed with permissions to the system clipboard and (optionally) access to the local filesystem. The code to do the signing is provided.

Work to be finished:

Catherine says:

I have updated the code to cope with files being on the clipboard. This works fine at the moment because the user will be asked if they want to run the applet, however, once certificates get involved an additional line will need to be added in to allow read acces to files (all or some depending on what is required). The remaining tasks are:

  1. Ensuring files have correct extension rather than always .txt. This can be done either by sending the MIME type in the POST request or by sending correct extension in filename poarameter (i.e. clipboard.jpg).
  2. Redirection if there are problems in the attach.
  3. Adding the applet into the template so all attach pages contain it.
  4. The POST request could be updated to contain the additional fields that are contained in the standard file attach (file comment and link). The file comment could then be either be a standard one or the user could be prompted to enter a comment if required. The link option could be added in if the pasted data is required to be shown on the page. This will only come through in the post request if it is checked and the data that come through on the post request is just "on".
  5. Finalise how applet will be displayed on screen and if text area remains what messages should be displayed).

Code

I have attached all the code (including test code), bat files and html files:

\
output_attach.txt - POST request when attaching file using standard twiki "upload and attach" button
output_applet.txt - POST request when copying data form clipboard

\source
ClipboardHelper.java - contains methods to get clipboad contents, save contents to file (not used) and read contents from file.
FileUploader.java - contains methods to upload data, upload a file (not used) and read response from POST request
TwikiPaste.java - this is the applet.  This contains some unsed methods (such as saving html from POST response to file)

\source\test code
TwikiTest.java - Sends POST request using file for dynamic part (i.e. after standard headers)
ReadClipApp.java - Displays MIME type of data on clipboard
POSTRequestHelper.java - OLD code for sending POST request
HttpURLConnectionTestTest.java - Code downloaded from internet for uploading file
DebugPostServer.java - captures POST request in file

\jars
twikikeystore - keystore for signed jar file
Twiki.jar - unsigned jar file
STwiki.jar - signed jar file used by applet
sign.bat - bat file to jar up classes, generate keys and sign jar file (you will need to delete twikikeystore before using this as it will not overwrite it)
signTwikiJar.bat - complete signing process, creates certificate and imports into home directory of user
twiki.policy - policy file (note this is the original one when files were being written and then uploaded so the lines relating to this are no longer relevant.
twikiCER.cer - certificate
convert_myTwikiAttach_.html - html file containing applet (currently pointing to upload.pl on 143)
convert_myTwikiAttach_debug.html - html file for debugging (used in conjuection with DebugPostServer to capture POST request)

Addon Installation Instructions

Theoretically you add the code as in convert_myTwikiAttach_.html.

Please update these instructions and give any other feedback to TWiki:Plugins.JavaPasteAddOnDev

Addon Info

  • Set SHORTDESCRIPTION = Java Applet that allows pasting of pictures and files

Addon Author: Catherine MacLeod, TWiki:Main.MartinCleaver
Addon Version: 20 Jan 2002
Change History: 20 Jan 2002: Alpha version
CPAN Dependencies: ?
Other Dependencies: ?
Perl Version: ?.?
Addon Home: http://TWiki.org/cgi-bin/view/Plugins/JavaPasteAddOn
Feedback: http://TWiki.org/cgi-bin/view/Plugins/JavaPasteAddOnDev

-- MartinCleaver - 20 Jan 2002

Topic attachments
I Attachment History Action Size Date Who Comment
Compressed Zip archivezip jars.zip r1 manage 22.5 K 2002-01-20 - 09:55 MartinCleaver all compiled code
Texttxt output_applet.txt r1 manage 0.5 K 2002-01-20 - 09:51 MartinCleaver POST request when copying data form clipboard
Texttxt output_attach.txt r1 manage 0.9 K 2002-01-20 - 09:53 MartinCleaver POST request when attaching file using std upload
Compressed Zip archivezip source.zip r1 manage 12.3 K 2002-01-20 - 09:57 MartinCleaver all source code
Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2008-04-08 - ClifKussmaul
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.