orbeon-bluedb-integration/configuration/WEB-INF/resources/apps/fr/js/attachments.js

65 lines
2.0 KiB
JavaScript

if (ORBEON.jQuery(".fr-mode-edit").length != 0 || ORBEON.jQuery(".fr-mode-view").length != 0)
{
var xhttp = new XMLHttpRequest();
var url = document.URL;
var documentId = url.substring(url.lastIndexOf("/"));
xhttp.withCredentials = true;
xhttp.open("GET", "http://192.168.0.167:18080/integration/rest/form/issubmitted/" + documentId, true);
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.onload = function (e)
{
var disableSubmit = (xhttp.responseText == 'true')
if (disableSubmit)
{
//Below is for submision button
ORBEON.jQuery("#fr-view").find('.fr-submit-button').find('.btn').each(function (i)
{
ORBEON.jQuery(this).attr("disabled", "true");
});
}
}
xhttp.send();
var xhttp2 = new XMLHttpRequest();
var url = document.URL;
var documentId = url.substring(url.lastIndexOf("/"));
xhttp2.withCredentials = true;
xhttp2.open("GET", "http://192.168.0.167:18080/integration/rest/form/hasremovedattachments/" + documentId, true);
xhttp2.setRequestHeader("Content-type", "application/json");
xhttp2.onload = function (e)
{
var hideDownloads = (xhttp2.responseText == 'true')
if (hideDownloads)
{
//Below is for download attachment icon
ORBEON.jQuery("#fr-view").find('.xforms-output-output').each(function (i)
{
if (ORBEON.jQuery(this).text().trim() == "Download")
{
ORBEON.jQuery(this).attr("style", "visibility: hidden");
}
});
//Below is for remove attachment icon
ORBEON.jQuery("#fr-view").find('.xforms-upload-remove').each(function (i)
{
ORBEON.jQuery(this).attr("style", "visibility: hidden");
});
// Below is for upload file control
/*
ORBEON.jQuery("#fr-view").find('.xforms-upload-select').each(function(i) {
ORBEON.jQuery(this).attr("style", "visibility: hidden");
});
*/
}
}
xhttp2.send();
}
function hideSubmit() {
ORBEON.jQuery("#fr-view").find('.fr-submit-button').find('.btn').each(function (i)
{
ORBEON.jQuery(this).attr("disabled", "true");
});
}