Index: tool/src/java/org/sakaiproject/content/tool/ResourcesAction.java =================================================================== --- tool/src/java/org/sakaiproject/content/tool/ResourcesAction.java (revision 13762) +++ tool/src/java/org/sakaiproject/content/tool/ResourcesAction.java (working copy) @@ -2353,6 +2353,8 @@ context.put("today", TimeService.newTime()); context.put("TRUE", Boolean.TRUE.toString()); + + state.removeAttribute(STATE_ATTACHMENTS); } // copyright @@ -4399,6 +4401,7 @@ } EditItem edit_item = null; List edit_items = (List) current_stack_frame.get(ResourcesAction.STATE_STACK_CREATE_ITEMS); + boolean doHack = false; if(edit_items == null) { edit_item = (EditItem) current_stack_frame.get(ResourcesAction.STATE_STACK_EDIT_ITEM); @@ -4406,11 +4409,17 @@ else { edit_item = (EditItem) edit_items.get(0); + doHack = true; } if(edit_item != null) { Reference ref = (Reference) attachments.get(0); edit_item.setPropertyValue(fieldname, index, ref); + if (doHack) { + state.setAttribute("LAME_HACK_fieldname", fieldname); + state.setAttribute("LAME_HACK_index", Integer.valueOf(index)); + state.setAttribute("LAME_HACK_ref", ref); + } } } } @@ -4924,6 +4933,18 @@ } setupStructuredObjects(state); + + String fieldname = (String) state.getAttribute("LAME_HACK_fieldname"); + if (fieldname != null) { + EditItem item = (EditItem) new_items.get(0); + int index = ((Integer) state.getAttribute("LAME_HACK_index")) + .intValue(); + Object ref = state.getAttribute("LAME_HACK_ref"); + item.setPropertyValue(fieldname, index, ref); + state.removeAttribute("LAME_HACK_fieldname"); + state.removeAttribute("LAME_HACK_index"); + state.removeAttribute("LAME_HACK_ref"); + } String show_form_items = (String) current_stack_frame.get(STATE_SHOW_FORM_ITEMS); if(show_form_items == null) { @@ -5010,6 +5031,8 @@ Set missing = (Set) current_stack_frame.remove(STATE_CREATE_MISSING_ITEM); context.put("missing", missing); + state.removeAttribute(STATE_ATTACHMENTS); + // String template = (String) getContext(data).get("template"); return TEMPLATE_CREATE;