Index: lams_tool_larsrc/web/includes/javascript/rsrcresourceitem.js =================================================================== diff -u -r2b350be06485bbfe1da8c66def9fc2cd81e883a8 -re9e2a6b00397afa86d303bfbc6ca3649744a982e --- lams_tool_larsrc/web/includes/javascript/rsrcresourceitem.js (.../rsrcresourceitem.js) (revision 2b350be06485bbfe1da8c66def9fc2cd81e883a8) +++ lams_tool_larsrc/web/includes/javascript/rsrcresourceitem.js (.../rsrcresourceitem.js) (revision e9e2a6b00397afa86d303bfbc6ca3649744a982e) @@ -1,18 +1,26 @@ /* - This is Resource Item instrcution area. + This is Resource Item instruction area. */ var instructionTargetDiv = "instructionArea"; var itemAttachmentTargetDiv = "itemAttachmentArea"; - var singleInstructionHeight = 40; + var singleInstructionHeight = 74; function removeInstruction(idx){ + //prepare lams_textarea value to Ajax submit + $('textarea').trigger('change'); + var param = $("#instructionForm").serialize() + "&removeIdx="+idx; removeInstructionLoading(); - $.post(removeInstructionUrl, param, function(xml) { - removeInstructionComplete(); - document.getElementById("instructionArea").innerHTML = xml; - }); + $.post( + removeInstructionUrl, + param, + function(xml) { + removeInstructionComplete(); + document.getElementById("instructionArea").innerHTML = xml; + } + ); } + function removeItemAttachment(idx){ removeItemAttachmentLoading(); $("#" + itemAttachmentTargetDiv).load( @@ -22,16 +30,26 @@ } ); } + function addInstruction(){ + //prepare lams_textarea value to Ajax submit + $('textarea').trigger('change'); + var param = $("#instructionForm").serialize(); addInstructionLoading(); - $.post(addInstructionUrl, param, function(xml) { - addInstructionComplete(); - document.getElementById("instructionArea").innerHTML = xml; - }); + + $.post( + addInstructionUrl, + param, + function(xml) { + addInstructionComplete(); + document.getElementById("instructionArea").innerHTML = xml; + } + ); + return false; - } + function adjustInstructionsDisplayAreaHeight(adjustAmount){ var obj = window.document.getElementById('reourceInputArea'); if (!obj && window.parent) { @@ -43,13 +61,19 @@ obj.style.height=obj.contentWindow.document.body.scrollHeight+adjustAmount+'px'; } function upItem(itemIdx){ + //prepare lams_textarea value to Ajax submit + $('textarea').trigger('change'); + if(itemIdx == 0) return; var currId = "instructionItemDesc" + itemIdx; var repId = "instructionItemDesc" + (--itemIdx); switchValue(currId,repId); } function downItem(itemIdx,maxSize){ + //prepare lams_textarea value to Ajax submit + $('textarea').trigger('change'); + if(itemIdx == (maxSize -1)) return; var currId = "instructionItemDesc" + itemIdx; @@ -83,6 +107,9 @@ } function submitResourceItem(){ + //prepare lams_textarea value to Ajax submit + $('textarea').trigger('change'); + document.getElementById("instructionList").value = $("#instructionForm").serialize(); $("#resourceItemForm").submit(); // after submit, it direct to itemlist.jsp,