diff --git a/syllabus/syllabus-app/src/java/org/sakaiproject/tool/syllabus/entityproviders/SyllabusEntityProvider.java b/syllabus/syllabus-app/src/java/org/sakaiproject/tool/syllabus/entityproviders/SyllabusEntityProvider.java index 4590236a1db1..f74a08daa21d 100644 --- a/syllabus/syllabus-app/src/java/org/sakaiproject/tool/syllabus/entityproviders/SyllabusEntityProvider.java +++ b/syllabus/syllabus-app/src/java/org/sakaiproject/tool/syllabus/entityproviders/SyllabusEntityProvider.java @@ -289,6 +289,22 @@ public void updateEntity(EntityReference ref, Object entity, Map String published = ServerConfigurationService.getBoolean("syllabus.new.published.default", false) ? SyllabusData.ITEM_POSTED : SyllabusData.ITEM_DRAFT; SyllabusData data = syllabusManager.createSyllabusDataObject(title, new Integer(initPosition), null, null, published, "none", null, null, Boolean.FALSE, null, null); data.setView("no"); + try { + String content = (String) params.get("content"); + if (StringUtils.isNotBlank(content)) { + StringBuilder alertMsg = new StringBuilder(); + String cleanedText = FormattedText.processFormattedText(content, alertMsg); + if (alertMsg.length() > 0) { + throw new IllegalArgumentException("Error formatting body text: " + alertMsg); + } else { + if (StringUtils.isNotEmpty(cleanedText)) { + data.setAsset(cleanedText); + } + } + } + } catch(Exception e) { + log.error(e.getMessage(), e); + } syllabusManager.addSyllabusToSyllabusItem(item, data); } } diff --git a/syllabus/syllabus-app/src/webapp/js/syllabus.js b/syllabus/syllabus-app/src/webapp/js/syllabus.js index a561eb2f784d..069406c32c91 100644 --- a/syllabus/syllabus-app/src/webapp/js/syllabus.js +++ b/syllabus/syllabus-app/src/webapp/js/syllabus.js @@ -503,12 +503,24 @@ function showConfirmDelete(deleteButton, msgs, event){ } function showConfirmAdd(msgs, mainframeId){ + $('#container', this.top.document).append("
"); + var emptyDiv = $('
', this.top.document); $('
').appendTo('body') - .html('
' + msgs.syllabus_title + "
") + .html("
" + msgs.syllabus_title + "
" + + "
" + msgs.syllabus_content + "