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: 528 $
- 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_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_HIGH_QUALITY_PREVIEW, 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_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, PROP_AFTER_UPLOAD_TARGET, PROP_AFTER_UPLOAD_URL, PROP_ALBUM_ID, PROP_ALLOW_HTTP_PERSISTENT, PROP_ALLOWED_FILE_EXTENSIONS, 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_HIGH_QUALITY_PREVIEW, 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_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 |
|
Method Summary |
void |
afterUpload(Exception e,
String serverOutput)
This method is called after an upload, whether it is successful or not. |
void |
displayParameterStatus()
This method displays the applet parameter list, according to the current
debugLevel. |
String |
getPostURL()
Get the target URL for upload. |
String |
getUploadName(FileData fileData,
int index)
Get an upload filename, that is to be send in the HTTP upload request. |
boolean |
isUploadReady()
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. |
void |
onFileSelected(FileData fileData)
Default implementation of the
UploadPolicy.onFileSelected(wjhk.jupload2.filedata.FileData). |
void |
setProperty(String prop,
String value)
This method only handles the albumId parameter, which is the only
applet parameter that is specific to this class. |
| Methods inherited from class wjhk.jupload2.policies.PictureUploadPolicy |
actionPerformed, beforeUpload, createFileChooser, createFileData, createTopPanel, fileViewGetIcon, getFileChooserImagePreview, getHighQualityPreview, getMaxHeight, getMaxWidth, getPictureCompressionQuality, getPictureTransmitMetadata, getRealMaxHeight, getRealMaxWidth, getTargetPictureFormat, hasToStoreBufferedImage, imageUpdate, onFileDoubleClicked, setCursor, setFileChooserImagePreview, setHighQualityPreview, setMaxHeight, setMaxWidth, setPictureCompressionQuality, setPictureTransmitMetadata, setRealMaxHeight, setRealMaxWidth, setStoreBufferedImage, 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, getApplet, getDateFormat, getDebugLevel, getFileChooserIconFromFileContent, getFileChooserIconSize, getFilenameEncoding, getFormdata, getLastException, getLastResponseBody, getLastResponseMessage, getLookAndFeel, getMaxChunkSize, getMaxFileSize, getNbFilesPerRequest, getServerProtocol, getShowLogWindow, getSpecificHeaders, getSslVerifyCert, getString, getStringUploadError, getStringUploadSuccess, getStringUploadWarning, getUploadFilename, getUrlToSendErrorTo, onAppendHeader, sendDebugInformation, setAfterUploadURL, setAllowedFileExtensions, setAllowHttpPersistent, setDebugLevel, setDebugLevel, setFileChooserIconFromFileContent, setFileChooserIconSize, setFilenameEncoding, 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(JUploadApplet theApplet)
throws JUploadException
- Parameters:
theApplet - 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()
getUploadName
public String getUploadName(FileData fileData,
int index)
- Description copied from interface:
UploadPolicy
- Get an upload filename, that is to be send in the HTTP upload request.
This is the name part of the Content-Disposition header. That is: this is
the name under which you can manage the file (for instance in the
_FILES[$name] in PHP) and not the filename of the original file.
- Specified by:
getUploadName in interface UploadPolicy- Overrides:
getUploadName in class DefaultUploadPolicy
- Parameters:
fileData - The file data whose upload name must be calculated.index - index of the file in the current request to the server (from
0 to n)
- Returns:
- The name part of the Content-Disposition header.
- See Also:
UploadPolicy.getUploadName(FileData, int)
isUploadReady
public boolean isUploadReady()
- 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:
isUploadReady in interface UploadPolicy- Overrides:
isUploadReady in class DefaultUploadPolicy
- Returns:
- indicate if everything is ready for upload.
- See Also:
UploadPolicy.isUploadReady()
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()