Created
October 29, 2008 20:38
-
-
Save ssoper/20821 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$().ready(function() { | |
// init file upload | |
var uploadTimer; | |
var doUpload=$('#upload1').upload({ | |
name: 'file', | |
method: 'post', | |
enctype: 'multipart/form-data', | |
action: '<c:url value="ParseResumeDocumentServlet"/>', | |
params: { | |
editorFlag: "" | |
}, | |
autoSubmit: true, | |
onComplete: function(data) { | |
clearTimeout(uploadTimer); | |
$('#dialog').jqmHide(); | |
var text = data.replace(/(<([^>]+)>)/ig,""); | |
if (text == "<c:out value='${pageBean.errorCode_UploadingDocument}'/>") { | |
$("#errorTitle").css("color","#ff0000"); | |
$("#errorTitle").html("<c:out value='${pageBean.errorUploadingDocument_Header}'/>"); | |
$("#errorBody").html("<c:out value='${pageBean.errorUploadingDocument_Message}'/>"); | |
$('#dialog').jqmShow(); | |
} else if (text == "<c:out value='${pageBean.errorCode_AttachmentFileTypeNotSupported}'/>") { | |
$("#errorTitle").css("color","#99cc00"); | |
$("#errorTitle").html("<c:out value='${pageBean.errorAttachmentFileTypeNotSupported_Header }'/>"); | |
$("#errorBody").html("<c:out value='${pageBean.errorAttachmentFileTypeNotSupported_Message}'/>"); | |
$('#dialog').jqmShow(); | |
} else if (text == "<c:out value='${pageBean.errorCode_AttachmentFileTypeDocx}'/>") { | |
$("#errorTitle").css("color","#99cc00"); | |
$("#errorTitle").html("<c:out value='${pageBean.errorAttachmentFileTypeDocx_Header}'/>"); | |
$("#errorBody").html("<c:out value='${pageBean.errorAttachmentFileTypeDocx_Message }'/>"); | |
$('#dialog').jqmShow(); | |
} else { | |
// no server errors. | |
if (document.decisionform.editorFlag.value == "rich") { | |
// if RTE | |
try { | |
HardCoreWebEditorSetContent(data); | |
} catch (err) { | |
$("#errorTitle").css("color","#ff0000"); | |
$("#errorTitle").html("<c:out value='${pageBean.errorUploadingDocument_Header}'/>"); | |
$("#errorBody").html("<c:out value='${pageBean.errorUploadingDocument_Message}'/>"); | |
$('#dialog').jqmShow(); | |
} | |
} else if (document.decisionform.editorFlag.value == "plain") { | |
// if plain text | |
document.getElementById("rezbox").value = text; | |
} | |
} | |
} | |
}); | |
var self = doUpload; | |
doUpload.set({ | |
onSubmit: function() { | |
var flagValue = document.decisionform.editorFlag.value; | |
alert(flagValue); | |
self.params({editorFlag: flagValue}); | |
uploadTimer = setTimeout(function(){ | |
$("#errorTitle").css("color","#99cc00"); | |
$("#errorTitle").html("your file is uploading"); | |
$("#errorBody").html("Please be patient while your file uploads. Thank you."); | |
$('#dialog').jqmShow();}, | |
2000); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment