Skip to content

Commit

Permalink
LSNBLDR-812 - Lessonbuilder CP importing some jpg files inline (sakai…
Browse files Browse the repository at this point in the history
  • Loading branch information
jonespm authored May 18, 2017
1 parent 9adea8b commit 1d69875
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4135,7 +4135,7 @@
# DEFAULT: true
# lessonbuilder.cc-export=false

# Whether or not to force new HTML content as inline even if it doesn't have the attribute. See LSNBLDR-455, LSNBLDR-311
# Whether or not to force new (top level) inported HTML content as inline even if it doesn't have the attribute. See LSNBLDR-455, LSNBLDR-311
# DEFAULT: false
# lessonbuilder.cc.import.forceinline=true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,17 @@ private ContentCollection makeBaseFolder(String name) {
return collection;
}

//Get filename from a resource element
//Return the href attribute, otherwise return the href value of a file child
private String getFileName(Element resource) {
Element file = resource.getChild(FILE, ns.getNs());
if (file != null)
return file.getAttributeValue(HREF);
else
return null;
//The problem here is there might be multiple <file> elements, so should trust the href on the resource first
String href = resource.getAttributeValue(HREF);
if (href == null) {
Element file = resource.getChild(FILE, ns.getNs());
//This will return null if there is no HREF on the file
return file.getAttributeValue(HREF);
}
return href;
}

public String getGroupForRole(String role) {
Expand Down Expand Up @@ -587,9 +592,6 @@ else if ("mmDisplayType.lessonbuilder.sakaiproject.org".equals(name))
}

boolean forceInline = ServerConfigurationService.getBoolean("lessonbuilder.cc.import.forceinline", false);
if (forceInline) {
inline = true;
}

try {
if ((type.equals(CC_WEBCONTENT) || (type.equals(UNKNOWN))) && !hide) {
Expand All @@ -614,7 +616,7 @@ else if ("mmDisplayType.lessonbuilder.sakaiproject.org".equals(name))

boolean nofile = false;
//Only text type files can be inlined
if (inline && mime != null && mime.startsWith("text/")) {
if ((inline || forceInline) && mime != null && mime.startsWith("text/")) {
StringBuilder html = new StringBuilder();
String htmlString = null;

Expand Down

0 comments on commit 1d69875

Please sign in to comment.