wjhk.jupload2.policies
Class CoppermineUploadPolicy
java.lang.Object
wjhk.jupload2.policies.DefaultUploadPolicy
wjhk.jupload2.policies.PictureUploadPolicy
wjhk.jupload2.policies.CoppermineUploadPolicy
- All Implemented Interfaces:
- ActionListener, ImageObserver, EventListener, UploadPolicy
public class CoppermineUploadPolicy
- extends PictureUploadPolicy
Specific UploadPolicy for the coppermine picture gallery. It is based on the
PictureUploadPolicy, and some specific part to add the uploaded pictures to a
coppermine existing album.
Specific features for this policy are:
- Album handling : the setProperty("albumId", n) can be called from
javascript, when the user selects another album (with n is the numeric id for
the selected album). This needs that the MAYSCRIPT HTML parameter is set, in
the APPLET tag (see the example below). The upload can not start if the user
didn't first select an album.
- If an error occurs, the applet asks the user if he wants to send a mail
to the webmaster. If he answered yes, the full debug output is submitted to
the URL pointed by urlToSendErrorTo. This URL should send a mail to the
manager of the Coppermine galery.
Call of the applet from a php script in coppermine
You'll find below an example of how to put the applet into a PHP page:
Example
2: albumId set by a javascript call.
- Version:
- $Revision: 870 $
- Author:
- etienne_sf
Fields inherited from interface wjhk.jupload2.policies.UploadPolicy |
DEFAULT_AFTER_UPLOAD_TARGET, DEFAULT_AFTER_UPLOAD_URL, DEFAULT_ALBUM_ID, DEFAULT_ALLOW_HTTP_PERSISTENT, DEFAULT_ALLOWED_FILE_EXTENSIONS, DEFAULT_BROWSING_DIRECTORY, DEFAULT_DATE_FORMAT, DEFAULT_DEBUG_LEVEL, DEFAULT_FILE_CHOOSER_ICON_FROM_FILE_CONTENT, DEFAULT_FILE_CHOOSER_ICON_SIZE, DEFAULT_FILE_CHOOSER_IMAGE_PREVIEW, DEFAULT_FILENAME_ENCODING, DEFAULT_FORMDATA, DEFAULT_FTP_CREATE_DIRECTORY_STRUCTURE, DEFAULT_FTP_TRANSFERT_BINARY, DEFAULT_FTP_TRANSFERT_PASSIVE, DEFAULT_HIGH_QUALITY_PREVIEW, DEFAULT_HTTP_UPLOAD_PARAMETER_NAME, DEFAULT_HTTP_UPLOAD_PARAMETER_TYPE, DEFAULT_KEEP_ORIG_EXTENSION, DEFAULT_LANG, DEFAULT_LOOK_AND_FEEL, DEFAULT_MAX_CHUNK_SIZE, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_HEIGHT, DEFAULT_MAX_WIDTH, DEFAULT_NB_FILES_PER_REQUEST, DEFAULT_PICTURE_COMPRESSION_QUALITY, DEFAULT_PICTURE_TRANSMIT_METADATA, DEFAULT_POST_URL, DEFAULT_READ_COOKIE_FROM_NAVIGATOR, DEFAULT_REAL_MAX_HEIGHT, DEFAULT_REAL_MAX_WIDTH, DEFAULT_SERVER_PROTOCOL, DEFAULT_SHOW_LOGWINDOW, DEFAULT_SHOW_STATUSBAR, DEFAULT_SPECIFIC_HEADERS, DEFAULT_SSL_VERIFY_CERT, DEFAULT_STORE_BUFFERED_IMAGE, DEFAULT_STRING_UPLOAD_ERROR, DEFAULT_STRING_UPLOAD_SUCCESS, DEFAULT_STRING_UPLOAD_WARNING, DEFAULT_TARGET_PICTURE_FORMAT, DEFAULT_UPLOAD_POLICY, DEFAULT_URL_TO_SEND_ERROR_TO, HTTPUPLOADPARAMETERTYPE_ARRAY, HTTPUPLOADPARAMETERTYPE_ITERATION, HTTPUPLOADPARAMETERTYPE_ONE_FILE, PROP_AFTER_UPLOAD_TARGET, PROP_AFTER_UPLOAD_URL, PROP_ALBUM_ID, PROP_ALLOW_HTTP_PERSISTENT, PROP_ALLOWED_FILE_EXTENSIONS, PROP_BROWSING_DIRECTORY, PROP_DEBUG_LEVEL, PROP_FILE_CHOOSER_ICON_FROM_FILE_CONTENT, PROP_FILE_CHOOSER_ICON_SIZE, PROP_FILE_CHOOSER_IMAGE_PREVIEW, PROP_FILENAME_ENCODING, PROP_FORMDATA, PROP_FTP_CREATE_DIRECTORY_STRUCTURE, PROP_FTP_TRANSFERT_BINARY, PROP_FTP_TRANSFERT_PASSIVE, PROP_HIGH_QUALITY_PREVIEW, PROP_HTTP_UPLOAD_PARAMETER_NAME, PROP_HTTP_UPLOAD_PARAMETER_TYPE, PROP_KEEP_ORIG_EXTENSION, PROP_LANG, PROP_LOOK_AND_FEEL, PROP_MAX_CHUNK_SIZE, PROP_MAX_FILE_SIZE, PROP_MAX_HEIGHT, PROP_MAX_WIDTH, PROP_NB_FILES_PER_REQUEST, PROP_PICTURE_COMPRESSION_QUALITY, PROP_PICTURE_TRANSMIT_METADATA, PROP_POST_URL, PROP_READ_COOKIE_FROM_NAVIGATOR, PROP_REAL_MAX_HEIGHT, PROP_REAL_MAX_WIDTH, PROP_SERVER_PROTOCOL, PROP_SHOW_LOGWINDOW, PROP_SHOW_STATUSBAR, PROP_SPECIFIC_HEADERS, PROP_SSL_VERIFY_CERT, PROP_STORE_BUFFERED_IMAGE, PROP_STRING_UPLOAD_ERROR, PROP_STRING_UPLOAD_SUCCESS, PROP_STRING_UPLOAD_WARNING, PROP_TARGET_PICTURE_FORMAT, PROP_UPLOAD_POLICY, PROP_URL_TO_SEND_ERROR_TO, SHOWLOGWINDOW_FALSE, SHOWLOGWINDOW_ONERROR, SHOWLOGWINDOW_TRUE |
Methods inherited from class wjhk.jupload2.policies.PictureUploadPolicy |
actionPerformed, createFileChooser, createFileData, createTopPanel, fileViewGetIcon, getFileChooserImagePreview, getHighQualityPreview, getImageFileConversionInfo, getKeepOrigExtension, getMaxHeight, getMaxWidth, getPictureCompressionQuality, getPictureTransmitMetadata, getRealMaxHeight, getRealMaxWidth, getTargetPictureFormat, getUploadFilename, imageUpdate, onFileDoubleClicked, setCursor, setFileChooserImagePreview, setHighQualityPreview, setKeepOrigExtension, setMaxHeight, setMaxWidth, setPictureCompressionQuality, setPictureTransmitMetadata, setRealMaxHeight, setRealMaxWidth, setTargetPictureFormat, setWaitCursor |
Methods inherited from class wjhk.jupload2.policies.DefaultUploadPolicy |
addComponentsToJUploadPanel, addHeader, addMsgToDebugLog, afterFileDropped, alert, alertStr, checkUploadSuccess, createProgressPanel, createStatusBar, deleteLog, displayDebug, displayErr, displayErr, displayErr, displayInfo, displayWarn, fileFilterAccept, fileFilterGetDescription, getAfterUploadTarget, getAfterUploadURL, getAllowedFileExtensions, getAllowHttpPersistent, getContext, getCurrentBrowsingDirectory, getDateFormat, getDebugLevel, getEncodedFilename, getFileChooserIconFromFileContent, getFileChooserIconSize, getFilenameEncoding, getFormdata, getFtpCreateDirectoryStructure, getFtpTransfertBinary, getFtpTransfertPassive, getHttpUploadParameterName, getHttpUploadParameterType, getLastException, getLastResponseBody, getLastResponseMessage, getLookAndFeel, getMaxChunkSize, getMaxFileSize, getNbFilesPerRequest, getReadCookieFromNavigator, getServerProtocol, getShowLogWindow, getSpecificHeaders, getSslVerifyCert, getString, getStringUploadError, getStringUploadSuccess, getStringUploadWarning, getUploadName, getUrlToSendErrorTo, onAppendHeader, sendDebugInformation, setAfterUploadURL, setAllowedFileExtensions, setAllowHttpPersistent, setCurrentBrowsingDirectory, setCurrentBrowsingDirectory, setDebugLevel, setDebugLevel, setFileChooserIconFromFileContent, setFileChooserIconSize, setFilenameEncoding, setFtpCreateDirectoryStructure, setFtpTransfertBinary, setFtpTransfertPassive, setLang, setLastException, setLookAndFeel, setMaxChunkSize, setMaxFileSize, setNbFilesPerRequest, setPostURL, setServerProtocol, setShowLogWindow, setShowStatusbar, setSpecificHeaders, setSslVerifyCert, setStringUploadError, setStringUploadSuccess, setStringUploadWarning, setUrlToSendErrorTo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CoppermineUploadPolicy
public CoppermineUploadPolicy(wjhk.jupload2.context.JUploadContext juploadContext)
throws JUploadException
- Parameters:
juploadContext
- Identifier for the current applet. It's necessary,
to read information from the navigator.
- Throws:
JUploadException
onFileSelected
public void onFileSelected(FileData fileData)
- Description copied from class:
DefaultUploadPolicy
- Default implementation of the
UploadPolicy.onFileSelected(wjhk.jupload2.filedata.FileData)
. Nothing's done.
- Specified by:
onFileSelected
in interface UploadPolicy
- Overrides:
onFileSelected
in class PictureUploadPolicy
- See Also:
UploadPolicy.onFileSelected(wjhk.jupload2.filedata.FileData)
setProperty
public void setProperty(String prop,
String value)
throws JUploadException
- This method only handles the albumId parameter, which is the only
applet parameter that is specific to this class. The super.setProperty
method is called for other properties.
- Specified by:
setProperty
in interface UploadPolicy
- Overrides:
setProperty
in class PictureUploadPolicy
- Parameters:
prop
- The property which value should changevalue
- The new value for this property. If invalid, the default
value is used.
- Throws:
JUploadException
JUploadExceptionStopAddingFiles
- indicates that the applet
should stop strying adding the current file selection.
Useful for instance, when a user drop a directory, full of
unallowed file: it's annoying for the user to click 'Ok'
for each file in the alert box.- See Also:
UploadPolicy.setProperty(java.lang.String,
java.lang.String)
getPostURL
public String getPostURL()
- Description copied from interface:
UploadPolicy
- Get the target URL for upload.
- Specified by:
getPostURL
in interface UploadPolicy
- Overrides:
getPostURL
in class DefaultUploadPolicy
- Returns:
- Should be valid URL...
- See Also:
UploadPolicy.getPostURL()
beforeUpload
public boolean beforeUpload()
- This method checks that an album id has been given, and then stores the
number of files that are to be uploaded, before upload, then call its
superclass. This number is then used to display to the user the list of
pictures he just uploaded.
- Specified by:
beforeUpload
in interface UploadPolicy
- Overrides:
beforeUpload
in class PictureUploadPolicy
- Returns:
- indicate if everything is ready for upload.
- See Also:
UploadPolicy.beforeUpload()
afterUpload
public void afterUpload(Exception e,
String serverOutput)
throws JUploadException
- Description copied from interface:
UploadPolicy
- This method is called after an upload, whether it is successful or not.
This method is called once for each click of the user on the 'upload'
button. That is: if the nbFilesPerRequest is 2, and the user selected 5
files before clicking on the 'upload' button. Then the afterUpload is
called once the 5 files were uploaded to the server.
- Specified by:
afterUpload
in interface UploadPolicy
- Overrides:
afterUpload
in class DefaultUploadPolicy
- Parameters:
e
- null if success, or the exception indicating the problem.serverOutput
- The full server output, including the HTTP headers.
- Throws:
JUploadException
- See Also:
UploadPolicy.afterUpload(Exception, String)
displayParameterStatus
public void displayParameterStatus()
- Description copied from class:
DefaultUploadPolicy
- This method displays the applet parameter list, according to the current
debugLevel. It is called by the
DefaultUploadPolicy.setDebugLevel(int)
method. It
should be override by any subclasses, that should display its own
parameters, then call super.displayParameterStatus().
- Specified by:
displayParameterStatus
in interface UploadPolicy
- Overrides:
displayParameterStatus
in class PictureUploadPolicy
- See Also:
DefaultUploadPolicy.displayParameterStatus()