diff --git a/resources/js/kt_bulkupload.js b/resources/js/kt_bulkupload.js index 2a23c7d..b0adfaa 100755 --- a/resources/js/kt_bulkupload.js +++ b/resources/js/kt_bulkupload.js @@ -1,19 +1,17 @@ -function swapInItem(elementId, req) { +function swapInItem(docId, elementId, req) { var cp = getElement(elementId); cp.innerHTML = req.responseText; - - //Sample { "htmlId" : {'metadata_7' : 'metadata_7','metadata_9' : 'metadata_9'}} - jQuery.getJSON('http://localhost/test/presentation/lookAndFeel/knowledgeTree/documentmanagement/getHtmlFields.php?fDocumentTypeID=2', + //Sample { "htmlId" : {'metadata_7' : 'metadata_7','metadata_9' : 'metadata_9'}} + jQuery.getJSON('presentation/lookAndFeel/knowledgeTree/documentmanagement/getHtmlFields.php?fDocumentTypeID=' + docId, function(json){ jQuery.each(json.htmlId, function(id) { //Envoking the MCE editor for each html id jQuery('#' + id).tinymce(kt_TinyMCEOptions); }); }); - initialiseConditionalFieldsets(); } @@ -22,18 +20,15 @@ function xmlFailure(err) { alert('failed'); } -function swapElementFromRequest(elementId, url) { +function swapElementFromRequest(elementId, url, docId) { var deff = doSimpleXMLHttpRequest(url); var cp = getElement(elementId); cp.innerHTML=_("loading..."); - deff.addCallback(partial(swapInItem, elementId)); - - - + deff.addCallback(partial(swapInItem, docId, elementId)); } function getMetadataForType(id) { - swapElementFromRequest('type_metadata_fields','presentation/lookAndFeel/knowledgeTree/documentmanagement/getTypeMetadataFields.php?fDocumentTypeID=' + id); + swapElementFromRequest('type_metadata_fields','presentation/lookAndFeel/knowledgeTree/documentmanagement/getTypeMetadataFields.php?fDocumentTypeID=' + id, id); } function document_type_changed() {