Demo
Document processing demo
- Upload local document to the server. If upload ok, file will be automatically removed from queue and link will appear below applet.
- Click on the link to process document — latest version will be downloaded and associated editor will be executed. Document in the queue will show "editing" status. If there is no editor associated with document or editor does not lock document file while editing upload queue item will receive "error" status with "Not modified" message.
- Modify, save and close document. Document status will update to "ready". Start upload to store local version onto the server.
Code:
<p>
<applet id="jumpLoaderApplet" name="jumpLoaderApplet"
code="jmaster.jumploader.app.JumpLoaderApplet.class"
archive="jumploader_z.jar"
width="715"
height="300"
mayscript>
<param name="uc_uploadUrl" value="partitionedUploadHandler.php"/>
<param name="uc_partitionLength" value="100000"/>
<param name="vc_useThumbs" value="false"/>
<param name="ac_fireUploaderFileStatusChanged" value="true"/>
</applet>
<script>
/**
* file status changed notification
*/
function uploaderFileStatusChanged( uploader, file ) {
//
// check if file uploaded - add process link, then remove
if( file.isFinished() && file.getType() == 0 ) {
//
// add file link
var fileLinkHtml = "<a href=\"javascript:processDocument( '" + file.getId() + "', '" + file.getName() + "' )\">" + file.getName() + "</a>";
var fileLinks = document.getElementById( "fileLinks" );
fileLinks.innerHTML += "• " + fileLinkHtml + "<br>";
//
// remove file from queue
uploader.removeFile( file );
}
//
// check if document uploaded - remove
if( file.isFinished() && file.getType() == 1 ) {
uploader.removeFile( file );
}
}
function processDocument( fileId, fileName ) {
var uploader = document.jumpLoaderApplet.getUploader();
var downloadLocation = "http://" + window.location.hostname + ":" + window.location.port + "/uploaded/" + fileId + "." + fileName + "?rnd={rnd}";
var uploadLocation = "http://" + window.location.hostname + ":" + window.location.port + "/partitionedUploadHandler.php";
var uploadFile = uploader.processDocument( fileId, downloadLocation, uploadLocation, fileName );
//
// assign original fileId to newly created upload file, because on this depends file name on the server
uploadFile.setId( fileId );
}
</script>
</p>
<p id="fileLinks"></p>